aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CREDITS12
-rw-r--r--Documentation/DocBook/Makefile2
-rw-r--r--Documentation/DocBook/kernel-api.tmpl2
-rw-r--r--Documentation/DocBook/mtdnand.tmpl6
-rw-r--r--Documentation/IPMI.txt25
-rw-r--r--Documentation/SubmitChecklist2
-rw-r--r--Documentation/SubmittingDrivers3
-rw-r--r--Documentation/accounting/cgroupstats.txt27
-rw-r--r--Documentation/arm/Samsung-S3C24XX/DMA.txt18
-rw-r--r--Documentation/atomic_ops.txt14
-rw-r--r--Documentation/cachetlb.txt27
-rw-r--r--Documentation/cdrom/cdrom-standard.tex2
-rw-r--r--Documentation/cgroups.txt545
-rw-r--r--Documentation/cpu-hotplug.txt4
-rw-r--r--Documentation/cpusets.txt226
-rw-r--r--Documentation/device-mapper/dm-uevent.txt97
-rw-r--r--Documentation/devices.txt2
-rw-r--r--Documentation/driver-model/devres.txt4
-rw-r--r--Documentation/fb/deferred_io.txt4
-rw-r--r--Documentation/feature-removal-schedule.txt42
-rw-r--r--Documentation/filesystems/9p.txt2
-rw-r--r--Documentation/filesystems/Locking2
-rw-r--r--Documentation/filesystems/ext3.txt14
-rw-r--r--Documentation/filesystems/files.txt6
-rw-r--r--Documentation/filesystems/proc.txt7
-rw-r--r--Documentation/filesystems/sysfs.txt2
-rw-r--r--Documentation/filesystems/vfs.txt2
-rw-r--r--Documentation/i2c/i2c-protocol2
-rw-r--r--Documentation/ia64/err_inject.txt6
-rw-r--r--Documentation/input/atarikbd.txt8
-rw-r--r--Documentation/input/ff.txt2
-rw-r--r--Documentation/input/iforce-protocol.txt20
-rw-r--r--Documentation/input/input-programming.txt17
-rw-r--r--Documentation/isdn/CREDITS2
-rw-r--r--Documentation/isdn/README.concap2
-rw-r--r--Documentation/java.txt2
-rw-r--r--Documentation/kbuild/kconfig-language.txt14
-rw-r--r--Documentation/kbuild/makefiles.txt22
-rw-r--r--Documentation/kdump/kdump.txt26
-rw-r--r--Documentation/kernel-docs.txt4
-rw-r--r--Documentation/kernel-parameters.txt64
-rw-r--r--Documentation/m68k/kernel-options.txt5
-rw-r--r--Documentation/markers.txt81
-rw-r--r--Documentation/memory-barriers.txt14
-rw-r--r--Documentation/mips/00-INDEX2
-rw-r--r--Documentation/mips/AU1xxx_IDE.README2
-rw-r--r--Documentation/mips/time.README173
-rw-r--r--Documentation/mutex-design.txt4
-rw-r--r--Documentation/networking/bcm43xx.txt2
-rw-r--r--Documentation/networking/ip-sysctl.txt2
-rw-r--r--Documentation/networking/rxrpc.txt2
-rw-r--r--Documentation/networking/udplite.txt6
-rw-r--r--Documentation/parport-lowlevel.txt29
-rw-r--r--Documentation/power/basic-pm-debugging.txt4
-rw-r--r--Documentation/power/freezing-of-tasks.txt44
-rw-r--r--Documentation/power/interface.txt2
-rw-r--r--Documentation/power/swsusp-and-swap-files.txt2
-rw-r--r--Documentation/powerpc/eeh-pci-error-recovery.txt4
-rw-r--r--Documentation/powerpc/mpc52xx-device-tree-bindings.txt12
-rw-r--r--Documentation/scsi/aic79xx.txt2
-rw-r--r--Documentation/scsi/aic7xxx.txt6
-rw-r--r--Documentation/scsi/arcmsr_spec.txt2
-rw-r--r--Documentation/scsi/ibmmca.txt58
-rw-r--r--Documentation/sharedsubtree.txt1
-rw-r--r--Documentation/sound/alsa/soc/DAI.txt8
-rw-r--r--Documentation/sound/alsa/soc/clocking.txt10
-rw-r--r--Documentation/sound/alsa/soc/codec.txt6
-rw-r--r--Documentation/sound/alsa/soc/dapm.txt4
-rw-r--r--Documentation/sound/alsa/soc/overview.txt17
-rw-r--r--Documentation/sound/alsa/soc/platform.txt2
-rw-r--r--Documentation/sound/alsa/soc/pops_clicks.txt6
-rw-r--r--Documentation/sound/oss/es137164
-rw-r--r--Documentation/spi/pxa2xx2
-rw-r--r--Documentation/thinkpad-acpi.txt29
-rw-r--r--Documentation/usb/usb-serial.txt2
-rw-r--r--MAINTAINERS25
-rw-r--r--Makefile74
-rw-r--r--arch/alpha/Kconfig2
-rw-r--r--arch/alpha/kernel/err_marvel.c2
-rw-r--r--arch/alpha/kernel/err_titan.c2
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/alpha/kernel/semaphore.c16
-rw-r--r--arch/alpha/kernel/smp.c1
-rw-r--r--arch/alpha/kernel/sys_alcor.c2
-rw-r--r--arch/alpha/kernel/sys_sio.c2
-rw-r--r--arch/alpha/kernel/traps.c6
-rw-r--r--arch/alpha/lib/checksum.c2
-rw-r--r--arch/alpha/lib/csum_partial_copy.c2
-rw-r--r--arch/alpha/lib/fls.c2
-rw-r--r--arch/alpha/mm/fault.c4
-rw-r--r--arch/alpha/mm/init.c2
-rw-r--r--arch/alpha/oprofile/Kconfig23
-rw-r--r--arch/alpha/oprofile/op_impl.h2
-rw-r--r--arch/arm/Kconfig4
-rw-r--r--arch/arm/common/sharpsl_pm.c9
-rw-r--r--arch/arm/kernel/process.c2
-rw-r--r--arch/arm/kernel/ptrace.c8
-rw-r--r--arch/arm/kernel/traps.c10
-rw-r--r--arch/arm/mach-at91/gpio.c2
-rw-r--r--arch/arm/mach-at91/pm.c7
-rw-r--r--arch/arm/mach-omap1/irq.c2
-rw-r--r--arch/arm/mach-omap1/pm.c29
-rw-r--r--arch/arm/mach-omap2/pm.c35
-rw-r--r--arch/arm/mach-omap2/timer-gp.c2
-rw-r--r--arch/arm/mach-pnx4008/pm.c6
-rw-r--r--arch/arm/mach-pxa/pm.c4
-rw-r--r--arch/arm/mach-pxa/pxa25x.c4
-rw-r--r--arch/arm/mach-pxa/pxa27x.c2
-rw-r--r--arch/arm/mach-s3c2410/clock.c2
-rw-r--r--arch/arm/mach-s3c2412/clock.c2
-rw-r--r--arch/arm/mach-s3c2443/clock.c2
-rw-r--r--arch/arm/mach-sa1100/pm.c6
-rw-r--r--arch/arm/mm/alignment.c2
-rw-r--r--arch/arm/mm/fault.c2
-rw-r--r--arch/arm/nwfpe/fpopcode.h40
-rw-r--r--arch/arm/oprofile/Kconfig42
-rw-r--r--arch/arm/plat-omap/dma.c2
-rw-r--r--arch/arm/plat-omap/gpio.c2
-rw-r--r--arch/arm/plat-s3c24xx/pm.c6
-rw-r--r--arch/avr32/Kconfig2
-rw-r--r--arch/avr32/kernel/traps.c2
-rw-r--r--arch/avr32/mm/fault.c6
-rw-r--r--arch/blackfin/Kconfig73
-rw-r--r--arch/blackfin/mach-common/pm.c59
-rw-r--r--arch/blackfin/oprofile/Kconfig29
-rw-r--r--arch/cris/Kconfig2
-rw-r--r--arch/cris/arch-v10/Kconfig2
-rw-r--r--arch/cris/arch-v10/boot/compressed/misc.c2
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c2
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c2
-rw-r--r--arch/cris/arch-v10/kernel/entry.S2
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c2
-rw-r--r--arch/cris/arch-v10/kernel/irq.c2
-rw-r--r--arch/cris/arch-v10/kernel/kgdb.c2
-rw-r--r--arch/cris/arch-v10/kernel/process.c2
-rw-r--r--arch/cris/arch-v10/kernel/shadows.c2
-rw-r--r--arch/cris/arch-v10/lib/dram_init.S4
-rw-r--r--arch/cris/arch-v10/lib/string.c2
-rw-r--r--arch/cris/arch-v10/lib/usercopy.c6
-rw-r--r--arch/cris/arch-v32/boot/compressed/misc.c6
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c2
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c2
-rw-r--r--arch/cris/arch-v32/drivers/nandflash.c2
-rw-r--r--arch/cris/arch-v32/drivers/pcf8563.c2
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c2
-rw-r--r--arch/cris/arch-v32/kernel/irq.c8
-rw-r--r--arch/cris/arch-v32/kernel/process.c2
-rw-r--r--arch/cris/arch-v32/kernel/signal.c4
-rw-r--r--arch/cris/arch-v32/kernel/smp.c2
-rw-r--r--arch/cris/arch-v32/kernel/time.c2
-rw-r--r--arch/cris/arch-v32/kernel/traps.c2
-rw-r--r--arch/cris/arch-v32/lib/dram_init.S2
-rw-r--r--arch/cris/arch-v32/lib/string.c2
-rw-r--r--arch/cris/arch-v32/lib/usercopy.c6
-rw-r--r--arch/cris/arch-v32/mm/tlb.c6
-rw-r--r--arch/cris/kernel/irq.c8
-rw-r--r--arch/cris/mm/fault.c4
-rw-r--r--arch/cris/mm/init.c2
-rw-r--r--arch/cris/mm/tlb.c2
-rw-r--r--arch/frv/Kconfig2
-rw-r--r--arch/frv/kernel/irq-mb93091.c2
-rw-r--r--arch/frv/kernel/irq-mb93093.c2
-rw-r--r--arch/frv/kernel/irq-mb93493.c2
-rw-r--r--arch/frv/kernel/irq.c4
-rw-r--r--arch/frv/kernel/semaphore.c2
-rw-r--r--arch/frv/kernel/time.c4
-rw-r--r--arch/h8300/Kconfig2
-rw-r--r--arch/h8300/Kconfig.debug6
-rw-r--r--arch/h8300/kernel/irq.c2
-rw-r--r--arch/h8300/kernel/time.c2
-rw-r--r--arch/h8300/kernel/traps.c2
-rw-r--r--arch/h8300/platform/h8s/ints.c2
-rw-r--r--arch/h8300/platform/h8s/ints_h8s.c2
-rw-r--r--arch/i386/Kconfig33
-rw-r--r--arch/i386/Makefile6
-rw-r--r--arch/ia64/Kconfig23
-rw-r--r--arch/ia64/configs/sn2_defconfig1
-rw-r--r--arch/ia64/ia32/sys_ia32.c6
-rw-r--r--arch/ia64/kernel/efi.c4
-rw-r--r--arch/ia64/kernel/perfmon.c161
-rw-r--r--arch/ia64/kernel/perfmon_default_smpl.c8
-rw-r--r--arch/ia64/kernel/process.c3
-rw-r--r--arch/ia64/kernel/setup.c88
-rw-r--r--arch/ia64/kernel/signal.c4
-rw-r--r--arch/ia64/kernel/time.c5
-rw-r--r--arch/ia64/kernel/traps.c6
-rw-r--r--arch/ia64/kernel/unaligned.c5
-rw-r--r--arch/ia64/mm/fault.c2
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/oprofile/Kconfig20
-rw-r--r--arch/ia64/sn/kernel/xpnet.c13
-rw-r--r--arch/m32r/Kconfig2
-rw-r--r--arch/m32r/kernel/irq.c2
-rw-r--r--arch/m32r/kernel/signal.c2
-rw-r--r--arch/m32r/kernel/smp.c18
-rw-r--r--arch/m32r/kernel/smpboot.c6
-rw-r--r--arch/m32r/kernel/sys_m32r.c2
-rw-r--r--arch/m32r/kernel/traps.c2
-rw-r--r--arch/m32r/mm/fault.c2
-rw-r--r--arch/m32r/oprofile/Kconfig23
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68k/amiga/pcmcia.c2
-rw-r--r--arch/m68k/ifpsp060/CHANGES2
-rw-r--r--arch/m68k/ifpsp060/MISC2
-rw-r--r--arch/m68k/ifpsp060/README2
-rw-r--r--arch/m68k/ifpsp060/TEST.DOC2
-rw-r--r--arch/m68k/ifpsp060/fplsp.doc2
-rw-r--r--arch/m68k/ifpsp060/fpsp.doc2
-rw-r--r--arch/m68k/ifpsp060/fskeleton.S2
-rw-r--r--arch/m68k/ifpsp060/ilsp.doc2
-rw-r--r--arch/m68k/ifpsp060/iskeleton.S2
-rw-r--r--arch/m68k/ifpsp060/isp.doc2
-rw-r--r--arch/m68k/ifpsp060/os.S2
-rw-r--r--arch/m68k/ifpsp060/src/fplsp.S2
-rw-r--r--arch/m68k/ifpsp060/src/fpsp.S2
-rw-r--r--arch/m68k/ifpsp060/src/ftest.S2
-rw-r--r--arch/m68k/ifpsp060/src/ilsp.S2
-rw-r--r--arch/m68k/ifpsp060/src/isp.S2
-rw-r--r--arch/m68k/ifpsp060/src/itest.S2
-rw-r--r--arch/m68k/ifpsp060/src/pfpsp.S2
-rw-r--r--arch/m68k/kernel/traps.c4
-rw-r--r--arch/m68k/mac/config.c4
-rw-r--r--arch/m68k/mac/iop.c4
-rw-r--r--arch/m68k/mac/oss.c2
-rw-r--r--arch/m68k/mac/via.c2
-rw-r--r--arch/m68k/math-emu/fp_log.c2
-rw-r--r--arch/m68k/mm/fault.c2
-rw-r--r--arch/m68k/q40/q40ints.c4
-rw-r--r--arch/m68k/sun3/mmu_emu.c2
-rw-r--r--arch/m68k/tools/amiga/dmesg.c2
-rw-r--r--arch/m68knommu/Kconfig2
-rw-r--r--arch/m68knommu/platform/5307/pit.c2
-rw-r--r--arch/mips/Kconfig28
-rw-r--r--arch/mips/au1000/Kconfig1
-rw-r--r--arch/mips/au1000/pb1200/irqmap.c2
-rw-r--r--arch/mips/basler/excite/excite_irq.c2
-rw-r--r--arch/mips/bcm47xx/time.c7
-rw-r--r--arch/mips/configs/ip27_defconfig1
-rw-r--r--arch/mips/configs/mipssim_defconfig532
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig1
-rw-r--r--arch/mips/emma2rh/markeins/setup.c6
-rw-r--r--arch/mips/jazz/irq.c6
-rw-r--r--arch/mips/jazz/setup.c8
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c66
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/cevt-r4k.c273
-rw-r--r--arch/mips/kernel/head.S16
-rw-r--r--arch/mips/kernel/irixelf.c4
-rw-r--r--arch/mips/kernel/irixsig.c2
-rw-r--r--arch/mips/kernel/module.c2
-rw-r--r--arch/mips/kernel/sysirix.c4
-rw-r--r--arch/mips/kernel/time.c348
-rw-r--r--arch/mips/kernel/traps.c13
-rw-r--r--arch/mips/lemote/lm2e/setup.c5
-rw-r--r--arch/mips/mm/fault.c2
-rw-r--r--arch/mips/oprofile/Kconfig23
-rw-r--r--arch/mips/pci/pci-excite.c2
-rw-r--r--arch/mips/pmc-sierra/Kconfig2
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_time.c3
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-irq.c5
-rw-r--r--arch/mips/sgi-ip27/ip27-timer.c155
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c6
-rw-r--r--arch/mips/sibyte/bcm1480/smp.c5
-rw-r--r--arch/mips/sibyte/bcm1480/time.c74
-rw-r--r--arch/mips/sibyte/sb1250/irq.c36
-rw-r--r--arch/mips/sibyte/sb1250/smp.c5
-rw-r--r--arch/mips/sibyte/sb1250/time.c104
-rw-r--r--arch/mips/sibyte/swarm/setup.c25
-rw-r--r--arch/mips/sni/pcimt.c2
-rw-r--r--arch/mips/sni/time.c18
-rw-r--r--arch/mips/tx4927/common/tx4927_setup.c16
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c10
-rw-r--r--arch/mips/tx4938/common/setup.c7
-rw-r--r--arch/mips/vr41xx/Kconfig6
-rw-r--r--arch/mips/vr41xx/common/init.c5
-rw-r--r--arch/parisc/Kconfig2
-rw-r--r--arch/parisc/kernel/signal.c2
-rw-r--r--arch/parisc/kernel/traps.c10
-rw-r--r--arch/parisc/kernel/unaligned.c2
-rw-r--r--arch/parisc/mm/fault.c2
-rw-r--r--arch/parisc/oprofile/Kconfig23
-rw-r--r--arch/powerpc/Kconfig15
-rw-r--r--arch/powerpc/configs/cell_defconfig1
-rw-r--r--arch/powerpc/configs/pmac32_defconfig1
-rw-r--r--arch/powerpc/configs/ppc64_defconfig1
-rw-r--r--arch/powerpc/configs/pseries_defconfig1
-rw-r--r--arch/powerpc/kernel/asm-offsets.c1
-rw-r--r--arch/powerpc/kernel/cpu_setup_6xx.S2
-rw-r--r--arch/powerpc/kernel/irq.c2
-rw-r--r--arch/powerpc/kernel/l2cr_6xx.S2
-rw-r--r--arch/powerpc/kernel/machine_kexec.c54
-rw-r--r--arch/powerpc/kernel/process.c2
-rw-r--r--arch/powerpc/kernel/time.c32
-rw-r--r--arch/powerpc/kernel/traps.c4
-rw-r--r--arch/powerpc/mm/fault.c2
-rw-r--r--arch/powerpc/oprofile/Kconfig24
-rw-r--r--arch/powerpc/platforms/52xx/lite5200_pm.c34
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pm.c15
-rw-r--r--arch/powerpc/platforms/Kconfig2
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c2
-rw-r--r--arch/powerpc/platforms/celleb/scc_uhc.c2
-rw-r--r--arch/powerpc/platforms/maple/setup.c2
-rw-r--r--arch/powerpc/platforms/pseries/ras.c2
-rw-r--r--arch/ppc/Kconfig2
-rw-r--r--arch/ppc/boot/Makefile2
-rw-r--r--arch/ppc/kernel/traps.c2
-rw-r--r--arch/ppc/mm/fault.c2
-rw-r--r--arch/ppc/platforms/chestnut.c1
-rw-r--r--arch/s390/Kconfig16
-rw-r--r--arch/s390/kernel/process.c2
-rw-r--r--arch/s390/lib/uaccess_pt.c2
-rw-r--r--arch/s390/mm/fault.c2
-rw-r--r--arch/s390/oprofile/Kconfig22
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh/boards/hp6xx/pm.c6
-rw-r--r--arch/sh/kernel/machine_kexec.c21
-rw-r--r--arch/sh/kernel/process.c2
-rw-r--r--arch/sh/kernel/setup.c38
-rw-r--r--arch/sh/kernel/signal.c4
-rw-r--r--arch/sh/kernel/traps.c7
-rw-r--r--arch/sh/mm/fault.c2
-rw-r--r--arch/sh/oprofile/Kconfig23
-rw-r--r--arch/sh64/Kconfig2
-rw-r--r--arch/sh64/kernel/pci_sh5.c2
-rw-r--r--arch/sh64/kernel/traps.c4
-rw-r--r--arch/sh64/mm/fault.c10
-rw-r--r--arch/sh64/oprofile/Kconfig23
-rw-r--r--arch/sparc/Kconfig6
-rw-r--r--arch/sparc/kernel/of_device.c20
-rw-r--r--arch/sparc/kernel/ptrace.c4
-rw-r--r--arch/sparc/kernel/sys_sparc.c2
-rw-r--r--arch/sparc/kernel/sys_sunos.c2
-rw-r--r--arch/sparc/kernel/traps.c4
-rw-r--r--arch/sparc/oprofile/Kconfig17
-rw-r--r--arch/sparc64/Kconfig15
-rw-r--r--arch/sparc64/kernel/irq.c8
-rw-r--r--arch/sparc64/kernel/of_device.c20
-rw-r--r--arch/sparc64/kernel/pci_common.c7
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c2
-rw-r--r--arch/sparc64/kernel/traps.c2
-rw-r--r--arch/sparc64/lib/atomic.S38
-rw-r--r--arch/sparc64/lib/bitops.S30
-rw-r--r--arch/sparc64/oprofile/Kconfig17
-rw-r--r--arch/sparc64/solaris/misc.c4
-rw-r--r--arch/um/Kconfig4
-rw-r--r--arch/um/drivers/line.c2
-rw-r--r--arch/um/drivers/null.c2
-rw-r--r--arch/um/drivers/slip_kern.c4
-rw-r--r--arch/um/drivers/slirp_kern.c4
-rw-r--r--arch/um/drivers/stderr_console.c2
-rw-r--r--arch/um/kernel/gmon_syms.c4
-rw-r--r--arch/um/kernel/irq.c2
-rw-r--r--arch/um/kernel/ptrace.c2
-rw-r--r--arch/um/kernel/trap.c2
-rw-r--r--arch/um/sys-i386/bug.c2
-rw-r--r--arch/um/sys-i386/tls.c2
-rw-r--r--arch/um/sys-x86_64/bug.c2
-rw-r--r--arch/um/sys-x86_64/sysrq.c4
-rw-r--r--arch/v850/Kconfig2
-rw-r--r--arch/v850/kernel/me2.c4
-rw-r--r--arch/v850/kernel/rte_mb_a_pci.c4
-rw-r--r--arch/x86/boot/compressed/misc_32.c4
-rw-r--r--arch/x86/boot/compressed/misc_64.c4
-rw-r--r--arch/x86/ia32/ia32_binfmt.c125
-rw-r--r--arch/x86/kernel/Makefile_323
-rw-r--r--arch/x86/kernel/Makefile_644
-rw-r--r--arch/x86/kernel/acpi/Makefile_323
-rw-r--r--arch/x86/kernel/acpi/boot.c10
-rw-r--r--arch/x86/kernel/acpi/cstate.c4
-rw-r--r--arch/x86/kernel/acpi/earlyquirk_32.c84
-rw-r--r--arch/x86/kernel/acpi/processor.c2
-rw-r--r--arch/x86/kernel/acpi/wakeup_32.S12
-rw-r--r--arch/x86/kernel/acpi/wakeup_64.S32
-rw-r--r--arch/x86/kernel/alternative.c6
-rw-r--r--arch/x86/kernel/apic_32.c4
-rw-r--r--arch/x86/kernel/apm_32.c2
-rw-r--r--arch/x86/kernel/cpu/amd.c2
-rw-r--r--arch/x86/kernel/cpu/centaur.c4
-rw-r--r--arch/x86/kernel/cpu/common.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/Kconfig_32 (renamed from arch/x86/kernel/cpu/cpufreq/Kconfig)0
-rw-r--r--arch/x86/kernel/cpu/cpufreq/Kconfig_64 (renamed from arch/x86/kernel/cpufreq/Kconfig)2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/e_powersaver.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/elanfreq.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/gx-suspmod.c8
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longhaul.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longrun.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k6.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k7.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.h4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/sc520_freq.c4
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-lib.c2
-rw-r--r--arch/x86/kernel/cpu/cyrix.c10
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c78
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c10
-rw-r--r--arch/x86/kernel/cpu/mtrr/cyrix.c4
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c2
-rw-r--r--arch/x86/kernel/cpu/perfctr-watchdog.c16
-rw-r--r--arch/x86/kernel/cpu/proc.c11
-rw-r--r--arch/x86/kernel/cpuid.c34
-rw-r--r--arch/x86/kernel/crash_dump_32.c1
-rw-r--r--arch/x86/kernel/e820_32.c5
-rw-r--r--arch/x86/kernel/e820_64.c3
-rw-r--r--arch/x86/kernel/early-quirks.c (renamed from arch/x86/kernel/early-quirks_64.c)19
-rw-r--r--arch/x86/kernel/genapic_64.c15
-rw-r--r--arch/x86/kernel/genapic_flat_64.c2
-rw-r--r--arch/x86/kernel/head64.c2
-rw-r--r--arch/x86/kernel/hpet.c5
-rw-r--r--arch/x86/kernel/i8253.c2
-rw-r--r--arch/x86/kernel/i8259_32.c3
-rw-r--r--arch/x86/kernel/init_task.c (renamed from arch/x86/kernel/init_task_32.c)11
-rw-r--r--arch/x86/kernel/init_task_64.c54
-rw-r--r--arch/x86/kernel/io_apic_32.c17
-rw-r--r--arch/x86/kernel/io_apic_64.c4
-rw-r--r--arch/x86/kernel/machine_kexec_32.c22
-rw-r--r--arch/x86/kernel/machine_kexec_64.c27
-rw-r--r--arch/x86/kernel/mce_64.c46
-rw-r--r--arch/x86/kernel/mce_amd_64.c4
-rw-r--r--arch/x86/kernel/microcode.c6
-rw-r--r--arch/x86/kernel/mpparse_32.c2
-rw-r--r--arch/x86/kernel/mpparse_64.c17
-rw-r--r--arch/x86/kernel/msr.c37
-rw-r--r--arch/x86/kernel/pci-dma_64.c2
-rw-r--r--arch/x86/kernel/process_32.c56
-rw-r--r--arch/x86/kernel/ptrace_32.c2
-rw-r--r--arch/x86/kernel/quirks.c112
-rw-r--r--arch/x86/kernel/reboot_64.c3
-rw-r--r--arch/x86/kernel/reboot_fixups_32.c8
-rw-r--r--arch/x86/kernel/setup64.c10
-rw-r--r--arch/x86/kernel/setup_32.c55
-rw-r--r--arch/x86/kernel/setup_64.c64
-rw-r--r--arch/x86/kernel/signal_32.c6
-rw-r--r--arch/x86/kernel/signal_64.c2
-rw-r--r--arch/x86/kernel/smp_32.c8
-rw-r--r--arch/x86/kernel/smp_64.c119
-rw-r--r--arch/x86/kernel/smpboot_32.c83
-rw-r--r--arch/x86/kernel/smpboot_64.c76
-rw-r--r--arch/x86/kernel/summit_32.c2
-rw-r--r--arch/x86/kernel/suspend_64.c114
-rw-r--r--arch/x86/kernel/suspend_asm_64.S49
-rw-r--r--arch/x86/kernel/traps_32.c58
-rw-r--r--arch/x86/kernel/traps_64.c18
-rw-r--r--arch/x86/kernel/tsc_32.c12
-rw-r--r--arch/x86/kernel/tsc_64.c4
-rw-r--r--arch/x86/kernel/vsyscall_64.c29
-rw-r--r--arch/x86/lib/delay_32.c2
-rw-r--r--arch/x86/lib/delay_64.c3
-rw-r--r--arch/x86/lib/usercopy_32.c2
-rw-r--r--arch/x86/mach-default/setup.c4
-rw-r--r--arch/x86/mach-generic/default.c2
-rw-r--r--arch/x86/mach-generic/probe.c2
-rw-r--r--arch/x86/mach-voyager/voyager_smp.c24
-rw-r--r--arch/x86/mach-voyager/voyager_thread.c2
-rw-r--r--arch/x86/mm/boot_ioremap_32.c2
-rw-r--r--arch/x86/mm/discontig_32.c2
-rw-r--r--arch/x86/mm/fault_32.c13
-rw-r--r--arch/x86/mm/fault_64.c22
-rw-r--r--arch/x86/mm/numa_64.c2
-rw-r--r--arch/x86/mm/pageattr_64.c9
-rw-r--r--arch/x86/mm/srat_64.c2
-rw-r--r--arch/x86/oprofile/backtrace.c110
-rw-r--r--arch/x86/oprofile/op_x86_model.h2
-rw-r--r--arch/x86/pci/irq.c4
-rw-r--r--arch/x86_64/.gitignore1
-rw-r--r--arch/x86_64/Kconfig30
-rw-r--r--arch/x86_64/Makefile6
-rw-r--r--arch/xtensa/Kconfig2
-rw-r--r--arch/xtensa/boot/Makefile3
-rw-r--r--arch/xtensa/kernel/traps.c6
-rw-r--r--arch/xtensa/mm/fault.c2
-rw-r--r--arch/xtensa/platform-iss/network.c2
-rw-r--r--block/elevator.c2
-rw-r--r--block/ll_rw_blk.c4
-rw-r--r--crypto/api.c2
-rw-r--r--crypto/fcrypt.c2
-rw-r--r--drivers/Kconfig2
-rw-r--r--drivers/Makefile3
-rw-r--r--drivers/acpi/Kconfig16
-rw-r--r--drivers/acpi/Makefile1
-rw-r--r--drivers/acpi/ac.c33
-rw-r--r--drivers/acpi/battery.c1038
-rw-r--r--drivers/acpi/bus.c23
-rw-r--r--drivers/acpi/button.c6
-rw-r--r--drivers/acpi/ec.c93
-rw-r--r--drivers/acpi/events/evevent.c6
-rw-r--r--drivers/acpi/hardware/hwregs.c89
-rw-r--r--drivers/acpi/hardware/hwsleep.c40
-rw-r--r--drivers/acpi/osl.c8
-rw-r--r--drivers/acpi/processor_core.c30
-rw-r--r--drivers/acpi/processor_idle.c488
-rw-r--r--drivers/acpi/sbs.c1869
-rw-r--r--drivers/acpi/sbshc.c309
-rw-r--r--drivers/acpi/sbshc.h27
-rw-r--r--drivers/acpi/sleep/main.c43
-rw-r--r--drivers/acpi/sleep/sleep.h1
-rw-r--r--drivers/acpi/sleep/wakeup.c117
-rw-r--r--drivers/acpi/tables/tbutils.c2
-rw-r--r--drivers/acpi/thermal.c28
-rw-r--r--drivers/acpi/video.c30
-rw-r--r--drivers/ata/Kconfig16
-rw-r--r--drivers/ata/Makefile1
-rw-r--r--drivers/ata/ahci.c2
-rw-r--r--drivers/ata/libata-core.c2
-rw-r--r--drivers/ata/libata-sff.c6
-rw-r--r--drivers/ata/pata_acpi.c2
-rw-r--r--drivers/ata/pata_bf54x.c77
-rw-r--r--drivers/ata/pata_cmd64x.c2
-rw-r--r--drivers/ata/pata_cs5530.c2
-rw-r--r--drivers/ata/pata_cs5535.c2
-rw-r--r--drivers/ata/pata_cs5536.c4
-rw-r--r--drivers/ata/pata_it821x.c4
-rw-r--r--drivers/ata/pata_mpiix.c2
-rw-r--r--drivers/ata/pata_ns87410.c2
-rw-r--r--drivers/ata/pata_oldpiix.c2
-rw-r--r--drivers/ata/pata_radisys.c2
-rw-r--r--drivers/ata/pata_sc1200.c2
-rw-r--r--drivers/ata/pata_sil680.c2
-rw-r--r--drivers/ata/pata_via.c2
-rw-r--r--drivers/ata/pdc_adma.c9
-rw-r--r--drivers/ata/sata_fsl.c1490
-rw-r--r--drivers/ata/sata_mv.c26
-rw-r--r--drivers/ata/sata_sil24.c11
-rw-r--r--drivers/ata/sata_sis.c15
-rw-r--r--drivers/atm/firestream.c2
-rw-r--r--drivers/base/dmapool.c2
-rw-r--r--drivers/base/power/trace.c2
-rw-r--r--drivers/base/topology.c11
-rw-r--r--drivers/block/Kconfig21
-rw-r--r--drivers/block/loop.c2
-rw-r--r--drivers/block/nbd.c3
-rw-r--r--drivers/block/rd.c2
-rw-r--r--drivers/block/xsysace.c4
-rw-r--r--drivers/cdrom/cdrom.c48
-rw-r--r--drivers/char/Kconfig19
-rw-r--r--drivers/char/apm-emulation.c2
-rw-r--r--drivers/char/cyclades.c771
-rw-r--r--drivers/char/drm/drm_bufs.c2
-rw-r--r--drivers/char/drm/drm_drv.c2
-rw-r--r--drivers/char/drm/drm_fops.c7
-rw-r--r--drivers/char/drm/drm_hashtab.c2
-rw-r--r--drivers/char/drm/drm_hashtab.h2
-rw-r--r--drivers/char/drm/drm_lock.c6
-rw-r--r--drivers/char/drm/drm_mm.c2
-rw-r--r--drivers/char/drm/drm_os_linux.h2
-rw-r--r--drivers/char/drm/drm_pci.c4
-rw-r--r--drivers/char/drm/drm_sarea.h2
-rw-r--r--drivers/char/drm/drm_sman.c2
-rw-r--r--drivers/char/drm/drm_sman.h2
-rw-r--r--drivers/char/drm/i810_dma.c2
-rw-r--r--drivers/char/drm/i830_dma.c2
-rw-r--r--drivers/char/drm/r128_drv.h2
-rw-r--r--drivers/char/drm/radeon_irq.c2
-rw-r--r--drivers/char/drm/radeon_state.c2
-rw-r--r--drivers/char/drm/sis_mm.c2
-rw-r--r--drivers/char/drm/via_mm.c2
-rw-r--r--drivers/char/drm/via_verifier.h2
-rw-r--r--drivers/char/esp.c4
-rw-r--r--drivers/char/hw_random/omap-rng.c2
-rw-r--r--drivers/char/i8k.c14
-rw-r--r--drivers/char/ipmi/ipmi_msghandler.c25
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c29
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c268
-rw-r--r--drivers/char/isicom.c10
-rw-r--r--drivers/char/keyboard.c48
-rw-r--r--drivers/char/moxa.c148
-rw-r--r--drivers/char/mxser.c25
-rw-r--r--drivers/char/mxser_new.c122
-rw-r--r--drivers/char/n_tty.c4
-rw-r--r--drivers/char/pty.c24
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/rocket.c93
-rw-r--r--drivers/char/rocket_int.h7
-rw-r--r--drivers/char/sonypi.c10
-rw-r--r--drivers/char/sx.c2
-rw-r--r--drivers/char/sysrq.c2
-rw-r--r--drivers/char/tty_io.c25
-rw-r--r--drivers/char/tty_ioctl.c13
-rw-r--r--drivers/char/vt.c51
-rw-r--r--drivers/cpuidle/Kconfig20
-rw-r--r--drivers/cpuidle/Makefile5
-rw-r--r--drivers/cpuidle/cpuidle.c295
-rw-r--r--drivers/cpuidle/cpuidle.h33
-rw-r--r--drivers/cpuidle/driver.c56
-rw-r--r--drivers/cpuidle/governor.c141
-rw-r--r--drivers/cpuidle/governors/Makefile6
-rw-r--r--drivers/cpuidle/governors/ladder.c166
-rw-r--r--drivers/cpuidle/governors/menu.c137
-rw-r--r--drivers/cpuidle/sysfs.c361
-rw-r--r--drivers/dma/ioat.c37
-rw-r--r--drivers/dma/ioat_dca.c12
-rw-r--r--drivers/dma/ioat_dma.c239
-rw-r--r--drivers/dma/ioatdma.h8
-rw-r--r--drivers/edac/edac_core.h2
-rw-r--r--drivers/edac/pasemi_edac.c1
-rw-r--r--drivers/firewire/fw-transaction.c2
-rw-r--r--drivers/firmware/dcdbas.h1
-rw-r--r--drivers/hid/hidraw.c4
-rw-r--r--drivers/hid/usbhid/hid-ff.c2
-rw-r--r--drivers/hid/usbhid/usbkbd.c7
-rw-r--r--drivers/hid/usbhid/usbmouse.c12
-rw-r--r--drivers/hwmon/adm1026.c2
-rw-r--r--drivers/hwmon/applesmc.c2
-rw-r--r--drivers/hwmon/coretemp.c6
-rw-r--r--drivers/hwmon/gl520sm.c4
-rw-r--r--drivers/hwmon/hdaps.c2
-rw-r--r--drivers/hwmon/hwmon-vid.c2
-rw-r--r--drivers/hwmon/lm63.c2
-rw-r--r--drivers/hwmon/sis5595.c2
-rw-r--r--drivers/hwmon/via686a.c4
-rw-r--r--drivers/hwmon/vt1211.c2
-rw-r--r--drivers/hwmon/w83791d.c2
-rw-r--r--drivers/hwmon/w83792d.c4
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c2
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c2
-rw-r--r--drivers/i2c/algos/i2c-algo-pcf.c2
-rw-r--r--drivers/i2c/busses/Kconfig10
-rw-r--r--drivers/i2c/busses/i2c-elektor.c2
-rw-r--r--drivers/i2c/busses/i2c-hydra.c2
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c2
-rw-r--r--drivers/i2c/busses/i2c-omap.c2
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c2
-rw-r--r--drivers/i2c/busses/i2c-parport.c2
-rw-r--r--drivers/i2c/busses/i2c-pmcmsp.c8
-rw-r--r--drivers/i2c/busses/i2c-pnx.c2
-rw-r--r--drivers/i2c/busses/i2c-pxa.c54
-rw-r--r--drivers/i2c/busses/i2c-via.c4
-rw-r--r--drivers/i2c/busses/i2c-viapro.c2
-rw-r--r--drivers/i2c/chips/menelaus.c2
-rw-r--r--drivers/i2c/i2c-core.c2
-rw-r--r--drivers/ide/Kconfig3
-rw-r--r--drivers/ide/arm/bast-ide.c2
-rw-r--r--drivers/ide/arm/icside.c63
-rw-r--r--drivers/ide/arm/ide_arm.c2
-rw-r--r--drivers/ide/arm/rapide.c37
-rw-r--r--drivers/ide/cris/ide-cris.c3
-rw-r--r--drivers/ide/h8300/ide-h8300.c3
-rw-r--r--drivers/ide/ide-acpi.c2
-rw-r--r--drivers/ide/ide-cd.c6
-rw-r--r--drivers/ide/ide-disk.c32
-rw-r--r--drivers/ide/ide-dma.c44
-rw-r--r--drivers/ide/ide-io.c64
-rw-r--r--drivers/ide/ide-iops.c26
-rw-r--r--drivers/ide/ide-pnp.c3
-rw-r--r--drivers/ide/ide-probe.c90
-rw-r--r--drivers/ide/ide-proc.c2
-rw-r--r--drivers/ide/ide-tape.c3
-rw-r--r--drivers/ide/ide-taskfile.c37
-rw-r--r--drivers/ide/ide.c77
-rw-r--r--drivers/ide/legacy/ali14xx.c13
-rw-r--r--drivers/ide/legacy/buddha.c4
-rw-r--r--drivers/ide/legacy/dtc2278.c16
-rw-r--r--drivers/ide/legacy/falconide.c2
-rw-r--r--drivers/ide/legacy/gayle.c2
-rw-r--r--drivers/ide/legacy/ht6560b.c33
-rw-r--r--drivers/ide/legacy/ide-cs.c2
-rw-r--r--drivers/ide/legacy/ide_platform.c43
-rw-r--r--drivers/ide/legacy/macide.c6
-rw-r--r--drivers/ide/legacy/q40ide.c7
-rw-r--r--drivers/ide/legacy/qd65xx.c64
-rw-r--r--drivers/ide/legacy/umc8672.c9
-rw-r--r--drivers/ide/mips/au1xxx-ide.c22
-rw-r--r--drivers/ide/mips/swarm.c14
-rw-r--r--drivers/ide/pci/aec62xx.c116
-rw-r--r--drivers/ide/pci/alim15x3.c121
-rw-r--r--drivers/ide/pci/amd74xx.c44
-rw-r--r--drivers/ide/pci/atiixp.c24
-rw-r--r--drivers/ide/pci/cmd640.c42
-rw-r--r--drivers/ide/pci/cmd64x.c89
-rw-r--r--drivers/ide/pci/cs5520.c57
-rw-r--r--drivers/ide/pci/cs5530.c28
-rw-r--r--drivers/ide/pci/cs5535.c17
-rw-r--r--drivers/ide/pci/cy82c693.c22
-rw-r--r--drivers/ide/pci/delkin_cb.c2
-rw-r--r--drivers/ide/pci/generic.c167
-rw-r--r--drivers/ide/pci/hpt34x.c56
-rw-r--r--drivers/ide/pci/hpt366.c376
-rw-r--r--drivers/ide/pci/it8213.c18
-rw-r--r--drivers/ide/pci/it821x.c28
-rw-r--r--drivers/ide/pci/jmicron.c14
-rw-r--r--drivers/ide/pci/ns87415.c8
-rw-r--r--drivers/ide/pci/opti621.c34
-rw-r--r--drivers/ide/pci/pdc202xx_new.c201
-rw-r--r--drivers/ide/pci/pdc202xx_old.c145
-rw-r--r--drivers/ide/pci/piix.c173
-rw-r--r--drivers/ide/pci/rz1000.c10
-rw-r--r--drivers/ide/pci/sc1200.c21
-rw-r--r--drivers/ide/pci/scc_pata.c33
-rw-r--r--drivers/ide/pci/serverworks.c95
-rw-r--r--drivers/ide/pci/sgiioc4.c27
-rw-r--r--drivers/ide/pci/siimage.c125
-rw-r--r--drivers/ide/pci/sis5513.c18
-rw-r--r--drivers/ide/pci/sl82c105.c24
-rw-r--r--drivers/ide/pci/slc90e66.c27
-rw-r--r--drivers/ide/pci/tc86c001.c28
-rw-r--r--drivers/ide/pci/triflex.c14
-rw-r--r--drivers/ide/pci/trm290.c13
-rw-r--r--drivers/ide/pci/via82cxxx.c83
-rw-r--r--drivers/ide/ppc/mpc8xx.c4
-rw-r--r--drivers/ide/ppc/pmac.c13
-rw-r--r--drivers/ide/setup-pci.c260
-rw-r--r--drivers/infiniband/core/cma.c5
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c4
-rw-r--r--drivers/input/evdev.c12
-rw-r--r--drivers/input/fixp-arith.h2
-rw-r--r--drivers/input/gameport/gameport.c6
-rw-r--r--drivers/input/input.c10
-rw-r--r--drivers/input/joydev.c16
-rw-r--r--drivers/input/joystick/a3d.c28
-rw-r--r--drivers/input/joystick/adi.c2
-rw-r--r--drivers/input/joystick/amijoy.c7
-rw-r--r--drivers/input/joystick/analog.c2
-rw-r--r--drivers/input/joystick/cobra.c2
-rw-r--r--drivers/input/joystick/db9.c4
-rw-r--r--drivers/input/joystick/gamecon.c4
-rw-r--r--drivers/input/joystick/gf2k.c2
-rw-r--r--drivers/input/joystick/grip.c2
-rw-r--r--drivers/input/joystick/grip_mp.c2
-rw-r--r--drivers/input/joystick/guillemot.c2
-rw-r--r--drivers/input/joystick/iforce/Makefile2
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c3
-rw-r--r--drivers/input/joystick/iforce/iforce.h4
-rw-r--r--drivers/input/joystick/interact.c2
-rw-r--r--drivers/input/joystick/magellan.c2
-rw-r--r--drivers/input/joystick/sidewinder.c2
-rw-r--r--drivers/input/joystick/spaceball.c17
-rw-r--r--drivers/input/joystick/spaceorb.c2
-rw-r--r--drivers/input/joystick/stinger.c9
-rw-r--r--drivers/input/joystick/tmdc.c2
-rw-r--r--drivers/input/joystick/turbografx.c2
-rw-r--r--drivers/input/joystick/twidjoy.c2
-rw-r--r--drivers/input/joystick/warrior.c8
-rw-r--r--drivers/input/joystick/xpad.c2
-rw-r--r--drivers/input/keyboard/aaed2000_kbd.c2
-rw-r--r--drivers/input/keyboard/amikbd.c2
-rw-r--r--drivers/input/keyboard/atakbd.c2
-rw-r--r--drivers/input/keyboard/atkbd.c21
-rw-r--r--drivers/input/keyboard/corgikbd.c3
-rw-r--r--drivers/input/keyboard/gpio_keys.c2
-rw-r--r--drivers/input/keyboard/hil_kbd.c5
-rw-r--r--drivers/input/keyboard/hilkbd.c5
-rw-r--r--drivers/input/keyboard/locomokbd.c2
-rw-r--r--drivers/input/keyboard/newtonkbd.c2
-rw-r--r--drivers/input/keyboard/omap-keypad.c4
-rw-r--r--drivers/input/keyboard/pxa27x_keyboard.c5
-rw-r--r--drivers/input/keyboard/spitzkbd.c3
-rw-r--r--drivers/input/keyboard/stowaway.c2
-rw-r--r--drivers/input/keyboard/sunkbd.c8
-rw-r--r--drivers/input/keyboard/xtkbd.c2
-rw-r--r--drivers/input/misc/Kconfig4
-rw-r--r--drivers/input/misc/ati_remote.c8
-rw-r--r--drivers/input/misc/ati_remote2.c7
-rw-r--r--drivers/input/misc/atlas_btns.c2
-rw-r--r--drivers/input/misc/cobalt_btns.c2
-rw-r--r--drivers/input/misc/ixp4xx-beeper.c4
-rw-r--r--drivers/input/misc/keyspan_remote.c2
-rw-r--r--drivers/input/misc/m68kspkr.c4
-rw-r--r--drivers/input/misc/pcspkr.c4
-rw-r--r--drivers/input/misc/powermate.c9
-rw-r--r--drivers/input/misc/sparcspkr.c4
-rw-r--r--drivers/input/misc/yealink.c2
-rw-r--r--drivers/input/mouse/alps.c26
-rw-r--r--drivers/input/mouse/amimouse.c7
-rw-r--r--drivers/input/mouse/atarimouse.c7
-rw-r--r--drivers/input/mouse/hil_ptr.c6
-rw-r--r--drivers/input/mouse/inport.c7
-rw-r--r--drivers/input/mouse/lifebook.c11
-rw-r--r--drivers/input/mouse/logibm.c7
-rw-r--r--drivers/input/mouse/pc110pad.c6
-rw-r--r--drivers/input/mouse/psmouse-base.c9
-rw-r--r--drivers/input/mouse/rpcmouse.c7
-rw-r--r--drivers/input/mouse/sermouse.c7
-rw-r--r--drivers/input/mouse/touchkit_ps2.c2
-rw-r--r--drivers/input/mouse/vsxxxaa.c2
-rw-r--r--drivers/input/mousedev.c26
-rw-r--r--drivers/input/serio/serio.c3
-rw-r--r--drivers/input/tablet/acecad.c12
-rw-r--r--drivers/input/tablet/gtco.c6
-rw-r--r--drivers/input/tablet/kbtab.c11
-rw-r--r--drivers/input/tablet/wacom_sys.c58
-rw-r--r--drivers/input/touchscreen/ads7846.c4
-rw-r--r--drivers/input/touchscreen/corgi_ts.c4
-rw-r--r--drivers/input/touchscreen/elo.c4
-rw-r--r--drivers/input/touchscreen/fujitsu_ts.c4
-rw-r--r--drivers/input/touchscreen/gunze.c4
-rw-r--r--drivers/input/touchscreen/h3600_ts_input.c5
-rw-r--r--drivers/input/touchscreen/hp680_ts_input.c4
-rw-r--r--drivers/input/touchscreen/mk712.c4
-rw-r--r--drivers/input/touchscreen/mtouch.c4
-rw-r--r--drivers/input/touchscreen/penmount.c4
-rw-r--r--drivers/input/touchscreen/touchright.c4
-rw-r--r--drivers/input/touchscreen/touchwin.c4
-rw-r--r--drivers/input/touchscreen/ucb1400_ts.c5
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c4
-rw-r--r--drivers/isdn/act2000/act2000_isa.c2
-rw-r--r--drivers/isdn/gigaset/common.c3
-rw-r--r--drivers/isdn/hardware/avm/b1.c28
-rw-r--r--drivers/isdn/hardware/avm/b1dma.c28
-rw-r--r--drivers/isdn/hardware/avm/c4.c16
-rw-r--r--drivers/isdn/hardware/avm/t1isa.c28
-rw-r--r--drivers/isdn/hardware/eicon/capifunc.c4
-rw-r--r--drivers/isdn/hisax/amd7930_fn.c2
-rw-r--r--drivers/isdn/hisax/enternow_pci.c18
-rw-r--r--drivers/isdn/hisax/hfc_pci.c2
-rw-r--r--drivers/isdn/hisax/isdnhdlc.c4
-rw-r--r--drivers/isdn/hisax/isdnhdlc.h2
-rw-r--r--drivers/isdn/hisax/jade.c2
-rw-r--r--drivers/isdn/pcbit/capi.c4
-rw-r--r--drivers/isdn/sc/debug.h19
-rw-r--r--drivers/isdn/sc/includes.h1
-rw-r--r--drivers/isdn/sc/init.c2
-rw-r--r--drivers/leds/leds-s3c24xx.c2
-rw-r--r--drivers/macintosh/adbhid.c19
-rw-r--r--drivers/macintosh/mac_hid.c7
-rw-r--r--drivers/macintosh/mediabay.c2
-rw-r--r--drivers/macintosh/via-pmu.c2
-rw-r--r--drivers/md/Kconfig12
-rw-r--r--drivers/md/Makefile6
-rw-r--r--drivers/md/dm-bio-list.h5
-rw-r--r--drivers/md/dm-crypt.c172
-rw-r--r--drivers/md/dm-delay.c23
-rw-r--r--drivers/md/dm-emc.c8
-rw-r--r--drivers/md/dm-hw-handler.c6
-rw-r--r--drivers/md/dm-hw-handler.h1
-rw-r--r--drivers/md/dm-ioctl.c40
-rw-r--r--drivers/md/dm-log.c2
-rw-r--r--drivers/md/dm-log.h3
-rw-r--r--drivers/md/dm-mpath-hp-sw.c248
-rw-r--r--drivers/md/dm-mpath-rdac.c15
-rw-r--r--drivers/md/dm-mpath.c88
-rw-r--r--drivers/md/dm-path-selector.c6
-rw-r--r--drivers/md/dm-raid1.c35
-rw-r--r--drivers/md/dm-snap.c3
-rw-r--r--drivers/md/dm-stripe.c3
-rw-r--r--drivers/md/dm-table.c3
-rw-r--r--drivers/md/dm-target.c6
-rw-r--r--drivers/md/dm-uevent.c222
-rw-r--r--drivers/md/dm-uevent.h59
-rw-r--r--drivers/md/dm.c79
-rw-r--r--drivers/md/kcopyd.c8
-rw-r--r--drivers/md/md.c2
-rw-r--r--drivers/md/raid1.c2
-rw-r--r--drivers/media/common/saa7146_hlp.c2
-rw-r--r--drivers/media/dvb/bt8xx/bt878.c2
-rw-r--r--drivers/media/dvb/cinergyT2/cinergyT2.c4
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c3
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c2
-rw-r--r--drivers/media/dvb/ttpci/av7110_ir.c2
-rw-r--r--drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c2
-rw-r--r--drivers/media/dvb/ttusb-dec/ttusb_dec.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c26
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/meye.c2
-rw-r--r--drivers/media/video/meye.h2
-rw-r--r--drivers/media/video/saa5246a.c4
-rw-r--r--drivers/media/video/saa5249.c4
-rw-r--r--drivers/media/video/usbvideo/konicawc.c4
-rw-r--r--drivers/media/video/usbvideo/quickcam_messenger.c4
-rw-r--r--drivers/media/video/usbvideo/vicam.c2
-rw-r--r--drivers/media/video/v4l1-compat.c2
-rw-r--r--drivers/media/video/v4l2-common.c2
-rw-r--r--drivers/media/video/zoran_driver.c4
-rw-r--r--drivers/message/i2o/README4
-rw-r--r--drivers/message/i2o/exec-osm.c4
-rw-r--r--drivers/message/i2o/i2o_config.c6
-rw-r--r--drivers/message/i2o/i2o_proc.c4
-rw-r--r--drivers/message/i2o/iop.c4
-rw-r--r--drivers/message/i2o/pci.c4
-rw-r--r--drivers/mfd/Kconfig4
-rw-r--r--drivers/misc/Kconfig21
-rw-r--r--drivers/misc/Makefile1
-rw-r--r--drivers/misc/fujitsu-laptop.c358
-rw-r--r--drivers/misc/ibmasm/remote.c10
-rw-r--r--drivers/misc/phantom.c97
-rw-r--r--drivers/misc/sony-laptop.c214
-rw-r--r--drivers/misc/thinkpad_acpi.c207
-rw-r--r--drivers/misc/thinkpad_acpi.h37
-rw-r--r--drivers/mtd/maps/Kconfig10
-rw-r--r--drivers/mtd/nand/s3c2410.c2
-rw-r--r--drivers/mtd/ubi/wl.c2
-rw-r--r--drivers/net/3c59x.c2
-rw-r--r--drivers/net/8139too.c2
-rw-r--r--drivers/net/Kconfig43
-rw-r--r--drivers/net/amd8111e.c2
-rw-r--r--drivers/net/ariadne.c2
-rw-r--r--drivers/net/ariadne.h2
-rw-r--r--drivers/net/au1000_eth.c2
-rw-r--r--drivers/net/ax88796.c2
-rw-r--r--drivers/net/bnx2.c36
-rw-r--r--drivers/net/bnx2_fw2.h7833
-rw-r--r--drivers/net/bonding/bond_3ad.c32
-rw-r--r--drivers/net/bonding/bond_3ad.h12
-rw-r--r--drivers/net/bonding/bond_sysfs.c2
-rw-r--r--drivers/net/cris/eth_v10.c2
-rw-r--r--drivers/net/cxgb3/adapter.h2
-rw-r--r--drivers/net/dm9000.c6
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000/e1000_main.c2
-rw-r--r--drivers/net/ehea/ehea_main.c8
-rw-r--r--drivers/net/eth16i.c1
-rw-r--r--drivers/net/fealnx.c1
-rw-r--r--drivers/net/forcedeth.c27
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c28
-rw-r--r--drivers/net/fs_enet/fs_enet.h1
-rw-r--r--drivers/net/gianfar.c4
-rw-r--r--drivers/net/gianfar.h1
-rw-r--r--drivers/net/hamradio/6pack.c2
-rw-r--r--drivers/net/hamradio/Kconfig2
-rw-r--r--drivers/net/hamradio/dmascc.c2
-rw-r--r--drivers/net/ibm_newemac/mal.c2
-rw-r--r--drivers/net/irda/actisys-sir.c2
-rw-r--r--drivers/net/irda/actisys.c2
-rw-r--r--drivers/net/irda/donauboe.c2
-rw-r--r--drivers/net/irda/girbil-sir.c2
-rw-r--r--drivers/net/irda/girbil.c2
-rw-r--r--drivers/net/irda/irport.h2
-rw-r--r--drivers/net/irda/irtty-sir.c2
-rw-r--r--drivers/net/irda/nsc-ircc.c2
-rw-r--r--drivers/net/irda/nsc-ircc.h2
-rw-r--r--drivers/net/irda/tekram-sir.c2
-rw-r--r--drivers/net/irda/tekram.c2
-rw-r--r--drivers/net/irda/w83977af_ir.h2
-rw-r--r--drivers/net/mac89x0.c2
-rw-r--r--drivers/net/meth.h3
-rw-r--r--drivers/net/myri10ge/myri10ge.c3
-rw-r--r--drivers/net/natsemi.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c3
-rw-r--r--drivers/net/pcnet32.c58
-rw-r--r--drivers/net/phy/mdio-bitbang.c2
-rw-r--r--drivers/net/s2io-regs.h632
-rw-r--r--drivers/net/s2io.c16
-rw-r--r--drivers/net/s2io.h84
-rw-r--r--drivers/net/sky2.c48
-rw-r--r--drivers/net/smc911x.c2
-rw-r--r--drivers/net/spider_net.c4
-rw-r--r--drivers/net/tc35815.c4
-rw-r--r--drivers/net/tsi108_eth.c2
-rw-r--r--drivers/net/tulip/Kconfig14
-rw-r--r--drivers/net/tulip/uli526x.c2
-rw-r--r--drivers/net/tulip/winbond-840.c2
-rw-r--r--drivers/net/usb/Kconfig2
-rw-r--r--drivers/net/usb/mcs7830.c16
-rw-r--r--drivers/net/via-velocity.c2
-rw-r--r--drivers/net/wireless/b43/main.c5
-rw-r--r--drivers/net/wireless/b43legacy/main.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_leds.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_xmit.h2
-rw-r--r--drivers/net/wireless/hostap/hostap_common.h3
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c2
-rw-r--r--drivers/net/wireless/ipw2100.c72
-rw-r--r--drivers/net/wireless/ipw2100.h6
-rw-r--r--drivers/net/wireless/ipw2200.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c44
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c52
-rw-r--r--drivers/net/wireless/iwlwifi/iwlwifi.h7
-rw-r--r--drivers/net/wireless/netwave_cs.c8
-rw-r--r--drivers/net/wireless/p54common.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c1
-rw-r--r--drivers/net/wireless/rtl8187_dev.c35
-rw-r--r--drivers/net/wireless/zd1201.c4
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c7
-rw-r--r--drivers/net/xen-netfront.c2
-rw-r--r--drivers/of/platform.c21
-rw-r--r--drivers/parport/daisy.c29
-rw-r--r--drivers/parport/procfs.c38
-rw-r--r--drivers/pcmcia/m32r_pcc.c2
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c2
-rw-r--r--drivers/power/ds2760_battery.c2
-rw-r--r--drivers/ps3/ps3av.c6
-rw-r--r--drivers/ps3/ps3stor_lib.c2
-rw-r--r--drivers/ps3/vuart.c2
-rw-r--r--drivers/rtc/Kconfig2
-rw-r--r--drivers/rtc/rtc-pl031.c2
-rw-r--r--drivers/rtc/rtc-sa1100.c2
-rw-r--r--drivers/rtc/rtc-sysfs.c5
-rw-r--r--drivers/s390/block/dasd_3990_erp.c4
-rw-r--r--drivers/s390/char/sclp_cpi.c2
-rw-r--r--drivers/s390/cio/cmf.c2
-rw-r--r--drivers/s390/cio/idset.c2
-rw-r--r--drivers/s390/net/claw.c2
-rw-r--r--drivers/s390/net/ctcmain.c10
-rw-r--r--drivers/s390/net/qeth_main.c3
-rw-r--r--drivers/sbus/char/vfc.h2
-rw-r--r--drivers/sbus/char/vfc_dev.c7
-rw-r--r--drivers/scsi/FlashPoint.c83
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/aacraid/aacraid.h2
-rw-r--r--drivers/scsi/aha152x.c6
-rw-r--r--drivers/scsi/aic7xxx/cam.h2
-rw-r--r--drivers/scsi/dc395x.c6
-rw-r--r--drivers/scsi/ide-scsi.c2
-rw-r--r--drivers/scsi/ipr.c11
-rw-r--r--drivers/scsi/libsas/sas_discover.c8
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c8
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c2
-rw-r--r--drivers/scsi/nsp32.h5
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.h1
-rw-r--r--drivers/scsi/qla4xxx/ql4_fw.h2
-rw-r--r--drivers/scsi/qla4xxx/ql4_init.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c2
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--drivers/scsi/sun3_NCR5380.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_fw2.h2
-rw-r--r--drivers/scsi/wd33c93.h2
-rw-r--r--drivers/serial/Kconfig6
-rw-r--r--drivers/serial/amba-pl011.c26
-rw-r--r--drivers/serial/crisv10.c2
-rw-r--r--drivers/serial/s3c2410.c4
-rw-r--r--drivers/serial/serial_core.c10
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c2
-rw-r--r--drivers/spi/spi_bfin5xx.c2
-rw-r--r--drivers/spi/spi_imx.c4
-rw-r--r--drivers/ssb/Kconfig4
-rw-r--r--drivers/ssb/driver_mipscore.c3
-rw-r--r--drivers/usb/class/cdc-acm.c34
-rw-r--r--drivers/usb/core/devio.c2
-rw-r--r--drivers/usb/core/endpoint.c2
-rw-r--r--drivers/usb/core/hub.c3
-rw-r--r--drivers/usb/core/message.c4
-rw-r--r--drivers/usb/gadget/file_storage.c2
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c2
-rw-r--r--drivers/usb/host/ehci-hub.c2
-rw-r--r--drivers/usb/host/ohci-s3c2410.c2
-rw-r--r--drivers/usb/host/sl811-hcd.c2
-rw-r--r--drivers/usb/image/Kconfig2
-rw-r--r--drivers/usb/misc/adutux.c4
-rw-r--r--drivers/usb/misc/cytherm.c2
-rw-r--r--drivers/usb/misc/emi26.c4
-rw-r--r--drivers/usb/misc/emi62.c4
-rw-r--r--drivers/usb/misc/iowarrior.c8
-rw-r--r--drivers/usb/misc/phidgetmotorcontrol.c2
-rw-r--r--drivers/usb/serial/ChangeLog.history2
-rw-r--r--drivers/usb/serial/Kconfig2
-rw-r--r--drivers/usb/serial/ftdi_sio.c6
-rw-r--r--drivers/usb/serial/ftdi_sio.h6
-rw-r--r--drivers/usb/serial/io_edgeport.c2
-rw-r--r--drivers/usb/serial/ipaq.c4
-rw-r--r--drivers/usb/serial/ipw.c18
-rw-r--r--drivers/usb/serial/mos7720.c4
-rw-r--r--drivers/usb/serial/oti6858.c2
-rw-r--r--drivers/usb/serial/sierra.c10
-rw-r--r--drivers/usb/storage/isd200.c2
-rw-r--r--drivers/usb/storage/unusual_devs.h4
-rw-r--r--drivers/usb/storage/usb.c5
-rw-r--r--drivers/video/Kconfig6
-rw-r--r--drivers/video/amifb.c14
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/au1100fb.c2
-rw-r--r--drivers/video/console/Kconfig2
-rw-r--r--drivers/video/console/newport_con.c6
-rw-r--r--drivers/video/cyber2000fb.c236
-rw-r--r--drivers/video/geode/video_gx.c2
-rw-r--r--drivers/video/gxt4500.c2
-rw-r--r--drivers/video/intelfb/intelfbdrv.c2
-rw-r--r--drivers/video/intelfb/intelfbhw.c2
-rw-r--r--drivers/video/logo/logo.c10
-rw-r--r--drivers/video/modedb.c4
-rw-r--r--drivers/video/omap/Kconfig2
-rw-r--r--drivers/video/omap/blizzard.c2
-rw-r--r--drivers/video/omap/dispc.c6
-rw-r--r--drivers/video/omap/hwa742.c2
-rw-r--r--drivers/video/omap/rfbi.c4
-rw-r--r--drivers/video/pnx4008/sdum.h3
-rw-r--r--drivers/video/s3c2410fb.c4
-rw-r--r--drivers/video/vermilion/vermilion.c4
-rw-r--r--drivers/video/vermilion/vermilion.h2
-rw-r--r--drivers/w1/masters/ds1wm.c2
-rw-r--r--drivers/watchdog/Kconfig (renamed from drivers/char/watchdog/Kconfig)0
-rw-r--r--drivers/watchdog/Makefile (renamed from drivers/char/watchdog/Makefile)0
-rw-r--r--drivers/watchdog/acquirewdt.c (renamed from drivers/char/watchdog/acquirewdt.c)0
-rw-r--r--drivers/watchdog/advantechwdt.c (renamed from drivers/char/watchdog/advantechwdt.c)0
-rw-r--r--drivers/watchdog/alim1535_wdt.c (renamed from drivers/char/watchdog/alim1535_wdt.c)0
-rw-r--r--drivers/watchdog/alim7101_wdt.c (renamed from drivers/char/watchdog/alim7101_wdt.c)0
-rw-r--r--drivers/watchdog/at32ap700x_wdt.c (renamed from drivers/char/watchdog/at32ap700x_wdt.c)0
-rw-r--r--drivers/watchdog/at91rm9200_wdt.c (renamed from drivers/char/watchdog/at91rm9200_wdt.c)2
-rw-r--r--drivers/watchdog/bfin_wdt.c (renamed from drivers/char/watchdog/bfin_wdt.c)0
-rw-r--r--drivers/watchdog/booke_wdt.c (renamed from drivers/char/watchdog/booke_wdt.c)0
-rw-r--r--drivers/watchdog/cpu5wdt.c (renamed from drivers/char/watchdog/cpu5wdt.c)0
-rw-r--r--drivers/watchdog/davinci_wdt.c (renamed from drivers/char/watchdog/davinci_wdt.c)0
-rw-r--r--drivers/watchdog/ep93xx_wdt.c (renamed from drivers/char/watchdog/ep93xx_wdt.c)0
-rw-r--r--drivers/watchdog/eurotechwdt.c (renamed from drivers/char/watchdog/eurotechwdt.c)0
-rw-r--r--drivers/watchdog/i6300esb.c (renamed from drivers/char/watchdog/i6300esb.c)6
-rw-r--r--drivers/watchdog/iTCO_vendor_support.c (renamed from drivers/char/watchdog/iTCO_vendor_support.c)2
-rw-r--r--drivers/watchdog/iTCO_wdt.c (renamed from drivers/char/watchdog/iTCO_wdt.c)0
-rw-r--r--drivers/watchdog/ib700wdt.c (renamed from drivers/char/watchdog/ib700wdt.c)0
-rw-r--r--drivers/watchdog/ibmasr.c (renamed from drivers/char/watchdog/ibmasr.c)0
-rw-r--r--drivers/watchdog/indydog.c (renamed from drivers/char/watchdog/indydog.c)0
-rw-r--r--drivers/watchdog/iop_wdt.c (renamed from drivers/char/watchdog/iop_wdt.c)0
-rw-r--r--drivers/watchdog/ixp2000_wdt.c (renamed from drivers/char/watchdog/ixp2000_wdt.c)0
-rw-r--r--drivers/watchdog/ixp4xx_wdt.c (renamed from drivers/char/watchdog/ixp4xx_wdt.c)0
-rw-r--r--drivers/watchdog/ks8695_wdt.c (renamed from drivers/char/watchdog/ks8695_wdt.c)2
-rw-r--r--drivers/watchdog/machzwd.c (renamed from drivers/char/watchdog/machzwd.c)0
-rw-r--r--drivers/watchdog/mixcomwd.c (renamed from drivers/char/watchdog/mixcomwd.c)0
-rw-r--r--drivers/watchdog/mpc5200_wdt.c (renamed from drivers/char/watchdog/mpc5200_wdt.c)0
-rw-r--r--drivers/watchdog/mpc83xx_wdt.c (renamed from drivers/char/watchdog/mpc83xx_wdt.c)0
-rw-r--r--drivers/watchdog/mpc8xx_wdt.c (renamed from drivers/char/watchdog/mpc8xx_wdt.c)0
-rw-r--r--drivers/watchdog/mpcore_wdt.c (renamed from drivers/char/watchdog/mpcore_wdt.c)0
-rw-r--r--drivers/watchdog/mtx-1_wdt.c (renamed from drivers/char/watchdog/mtx-1_wdt.c)0
-rw-r--r--drivers/watchdog/mv64x60_wdt.c (renamed from drivers/char/watchdog/mv64x60_wdt.c)0
-rw-r--r--drivers/watchdog/omap_wdt.c (renamed from drivers/char/watchdog/omap_wdt.c)2
-rw-r--r--drivers/watchdog/omap_wdt.h (renamed from drivers/char/watchdog/omap_wdt.h)0
-rw-r--r--drivers/watchdog/pc87413_wdt.c (renamed from drivers/char/watchdog/pc87413_wdt.c)0
-rw-r--r--drivers/watchdog/pcwd.c (renamed from drivers/char/watchdog/pcwd.c)0
-rw-r--r--drivers/watchdog/pcwd_pci.c (renamed from drivers/char/watchdog/pcwd_pci.c)0
-rw-r--r--drivers/watchdog/pcwd_usb.c (renamed from drivers/char/watchdog/pcwd_usb.c)0
-rw-r--r--drivers/watchdog/pnx4008_wdt.c (renamed from drivers/char/watchdog/pnx4008_wdt.c)0
-rw-r--r--drivers/watchdog/rm9k_wdt.c (renamed from drivers/char/watchdog/rm9k_wdt.c)0
-rw-r--r--drivers/watchdog/s3c2410_wdt.c (renamed from drivers/char/watchdog/s3c2410_wdt.c)0
-rw-r--r--drivers/watchdog/sa1100_wdt.c (renamed from drivers/char/watchdog/sa1100_wdt.c)2
-rw-r--r--drivers/watchdog/sbc60xxwdt.c (renamed from drivers/char/watchdog/sbc60xxwdt.c)0
-rw-r--r--drivers/watchdog/sbc8360.c (renamed from drivers/char/watchdog/sbc8360.c)0
-rw-r--r--drivers/watchdog/sbc_epx_c3.c (renamed from drivers/char/watchdog/sbc_epx_c3.c)0
-rw-r--r--drivers/watchdog/sc1200wdt.c (renamed from drivers/char/watchdog/sc1200wdt.c)0
-rw-r--r--drivers/watchdog/sc520_wdt.c (renamed from drivers/char/watchdog/sc520_wdt.c)0
-rw-r--r--drivers/watchdog/scx200_wdt.c (renamed from drivers/char/watchdog/scx200_wdt.c)0
-rw-r--r--drivers/watchdog/shwdt.c (renamed from drivers/char/watchdog/shwdt.c)0
-rw-r--r--drivers/watchdog/smsc37b787_wdt.c (renamed from drivers/char/watchdog/smsc37b787_wdt.c)0
-rw-r--r--drivers/watchdog/softdog.c (renamed from drivers/char/watchdog/softdog.c)0
-rw-r--r--drivers/watchdog/w83627hf_wdt.c (renamed from drivers/char/watchdog/w83627hf_wdt.c)0
-rw-r--r--drivers/watchdog/w83697hf_wdt.c (renamed from drivers/char/watchdog/w83697hf_wdt.c)2
-rw-r--r--drivers/watchdog/w83877f_wdt.c (renamed from drivers/char/watchdog/w83877f_wdt.c)0
-rw-r--r--drivers/watchdog/w83977f_wdt.c (renamed from drivers/char/watchdog/w83977f_wdt.c)0
-rw-r--r--drivers/watchdog/wafer5823wdt.c (renamed from drivers/char/watchdog/wafer5823wdt.c)0
-rw-r--r--drivers/watchdog/wd501p.h (renamed from drivers/char/watchdog/wd501p.h)0
-rw-r--r--drivers/watchdog/wdrtas.c (renamed from drivers/char/watchdog/wdrtas.c)0
-rw-r--r--drivers/watchdog/wdt.c (renamed from drivers/char/watchdog/wdt.c)0
-rw-r--r--drivers/watchdog/wdt285.c (renamed from drivers/char/watchdog/wdt285.c)0
-rw-r--r--drivers/watchdog/wdt977.c (renamed from drivers/char/watchdog/wdt977.c)0
-rw-r--r--drivers/watchdog/wdt_pci.c (renamed from drivers/char/watchdog/wdt_pci.c)0
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c5
-rw-r--r--drivers/zorro/zorro.ids2
-rw-r--r--fs/Kconfig11
-rw-r--r--fs/aio.c16
-rw-r--r--fs/attr.c26
-rw-r--r--fs/autofs/inode.c2
-rw-r--r--fs/autofs/root.c6
-rw-r--r--fs/autofs/waitq.c2
-rw-r--r--fs/autofs4/autofs_i.h2
-rw-r--r--fs/autofs4/inode.c4
-rw-r--r--fs/autofs4/root.c4
-rw-r--r--fs/autofs4/waitq.c2
-rw-r--r--fs/binfmt_elf.c16
-rw-r--r--fs/binfmt_elf_fdpic.c16
-rw-r--r--fs/binfmt_em86.c2
-rw-r--r--fs/binfmt_misc.c2
-rw-r--r--fs/binfmt_script.c2
-rw-r--r--fs/cifs/CHANGES21
-rw-r--r--fs/cifs/Makefile2
-rw-r--r--fs/cifs/asn1.c10
-rw-r--r--fs/cifs/cifs_debug.c28
-rw-r--r--fs/cifs/cifsacl.c333
-rw-r--r--fs/cifs/cifsacl.h64
-rw-r--r--fs/cifs/cifsencrypt.c5
-rw-r--r--fs/cifs/cifsfs.c38
-rw-r--r--fs/cifs/cifsfs.h11
-rw-r--r--fs/cifs/cifsglob.h31
-rw-r--r--fs/cifs/cifspdu.h20
-rw-r--r--fs/cifs/cifsproto.h8
-rw-r--r--fs/cifs/cifssmb.c158
-rw-r--r--fs/cifs/connect.c264
-rw-r--r--fs/cifs/dir.c9
-rw-r--r--fs/cifs/export.c1
-rw-r--r--fs/cifs/file.c86
-rw-r--r--fs/cifs/inode.c57
-rw-r--r--fs/cifs/link.c2
-rw-r--r--fs/cifs/misc.c1
-rw-r--r--fs/cifs/netmisc.c33
-rw-r--r--fs/cifs/readdir.c8
-rw-r--r--fs/cifs/sess.c103
-rw-r--r--fs/cifs/smberr.h5
-rw-r--r--fs/cifs/transport.c34
-rw-r--r--fs/cifs/xattr.c19
-rw-r--r--fs/coda/upcall.c2
-rw-r--r--fs/compat_ioctl.c2
-rw-r--r--fs/cramfs/inode.c9
-rw-r--r--fs/dlm/user.c2
-rw-r--r--fs/ecryptfs/inode.c8
-rw-r--r--fs/eventpoll.c7
-rw-r--r--fs/exec.c16
-rw-r--r--fs/ext3/fsync.c2
-rw-r--r--fs/ext3/inode.c4
-rw-r--r--fs/ext3/resize.c6
-rw-r--r--fs/ext3/super.c6
-rw-r--r--fs/ext3/xattr.c3
-rw-r--r--fs/ext4/balloc.c112
-rw-r--r--fs/ext4/dir.c7
-rw-r--r--fs/ext4/extents.c14
-rw-r--r--fs/ext4/fsync.c2
-rw-r--r--fs/ext4/group.h27
-rw-r--r--fs/ext4/ialloc.c151
-rw-r--r--fs/ext4/inode.c18
-rw-r--r--fs/ext4/namei.c20
-rw-r--r--fs/ext4/resize.c59
-rw-r--r--fs/ext4/super.c97
-rw-r--r--fs/ext4/xattr.c7
-rw-r--r--fs/fcntl.c5
-rw-r--r--fs/file_table.c5
-rw-r--r--fs/fs-writeback.c2
-rw-r--r--fs/fuse/dir.c241
-rw-r--r--fs/fuse/file.c111
-rw-r--r--fs/fuse/fuse_i.h32
-rw-r--r--fs/fuse/inode.c39
-rw-r--r--fs/ioprio.c9
-rw-r--r--fs/isofs/inode.c2
-rw-r--r--fs/jbd/commit.c14
-rw-r--r--fs/jbd/journal.c173
-rw-r--r--fs/jbd/recovery.c6
-rw-r--r--fs/jbd/transaction.c25
-rw-r--r--fs/jbd2/commit.c16
-rw-r--r--fs/jbd2/journal.c128
-rw-r--r--fs/jbd2/recovery.c2
-rw-r--r--fs/jbd2/revoke.c4
-rw-r--r--fs/jbd2/transaction.c19
-rw-r--r--fs/jffs2/debug.h8
-rw-r--r--fs/jfs/jfs_dtree.c2
-rw-r--r--fs/namei.c6
-rw-r--r--fs/namespace.c2
-rw-r--r--fs/nfs/delegation.c3
-rw-r--r--fs/nfs/dir.c14
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/nfs/inode.c29
-rw-r--r--fs/nfs/nfs4_fs.h4
-rw-r--r--fs/nfs/nfs4proc.c19
-rw-r--r--fs/nfs/nfs4state.c14
-rw-r--r--fs/nfs/nfsroot.c2
-rw-r--r--fs/nfs/unlink.c117
-rw-r--r--fs/nfs/write.c17
-rw-r--r--fs/nfsd/vfs.c27
-rw-r--r--fs/nls/nls_base.c2
-rw-r--r--fs/ntfs/ChangeLog4
-rw-r--r--fs/ntfs/sysctl.c2
-rw-r--r--fs/ntfs/sysctl.h2
-rw-r--r--fs/ocfs2/cluster/heartbeat.c2
-rw-r--r--fs/ocfs2/cluster/masklog.h2
-rw-r--r--fs/ocfs2/dcache.c2
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c10
-rw-r--r--fs/proc/array.c32
-rw-r--r--fs/proc/base.c202
-rw-r--r--fs/proc/inode.c2
-rw-r--r--fs/proc/proc_misc.c3
-rw-r--r--fs/proc/root.c83
-rw-r--r--fs/reiserfs/bitmap.c111
-rw-r--r--fs/reiserfs/inode.c14
-rw-r--r--fs/reiserfs/journal.c24
-rw-r--r--fs/reiserfs/prints.c10
-rw-r--r--fs/reiserfs/resize.c15
-rw-r--r--fs/reiserfs/stree.c6
-rw-r--r--fs/reiserfs/super.c17
-rw-r--r--fs/reiserfs/xattr.c5
-rw-r--r--fs/select.c5
-rw-r--r--fs/super.c38
-rw-r--r--fs/sysfs/file.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c6
-rw-r--r--fs/xfs/linux-2.6/xfs_export.h6
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c24
-rw-r--r--fs/xfs/xfs_dmops.c21
-rw-r--r--fs/xfs/xfs_fs.h29
-rw-r--r--fs/xfs/xfs_qmops.c22
-rw-r--r--fs/xfs/xfs_vfsops.c9
-rw-r--r--fs/xfs/xfs_vfsops.h4
-rw-r--r--fs/xfs/xfs_vnodeops.c13
-rw-r--r--fs/xfs/xfs_vnodeops.h2
-rw-r--r--include/acpi/achware.h4
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/acpi/acpixf.h2
-rw-r--r--include/acpi/processor.h5
-rw-r--r--include/asm-alpha/bitops.h55
-rw-r--r--include/asm-alpha/ide.h1
-rw-r--r--include/asm-alpha/tlbflush.h11
-rw-r--r--include/asm-arm/arch-aaec2000/aaec2000.h4
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h3
-rw-r--r--include/asm-arm/arch-pxa/pm.h2
-rw-r--r--include/asm-arm/bitops.h5
-rw-r--r--include/asm-arm/dma-mapping.h2
-rw-r--r--include/asm-arm/ide.h1
-rw-r--r--include/asm-arm/tlbflush.h5
-rw-r--r--include/asm-avr32/bitops.h5
-rw-r--r--include/asm-avr32/tlbflush.h7
-rw-r--r--include/asm-blackfin/bitops.h5
-rw-r--r--include/asm-blackfin/ide.h1
-rw-r--r--include/asm-blackfin/processor.h4
-rw-r--r--include/asm-blackfin/system.h4
-rw-r--r--include/asm-blackfin/tlbflush.h6
-rw-r--r--include/asm-cris/arch-v32/ide.h2
-rw-r--r--include/asm-cris/bitops.h5
-rw-r--r--include/asm-cris/posix_types.h2
-rw-r--r--include/asm-cris/tlbflush.h7
-rw-r--r--include/asm-frv/bitops.h5
-rw-r--r--include/asm-frv/tlbflush.h2
-rw-r--r--include/asm-generic/bitops.h5
-rw-r--r--include/asm-generic/bitops/atomic.h27
-rw-r--r--include/asm-generic/bitops/lock.h45
-rw-r--r--include/asm-generic/bitops/non-atomic.h29
-rw-r--r--include/asm-generic/vmlinux.lds.h7
-rw-r--r--include/asm-h8300/bitops.h6
-rw-r--r--include/asm-h8300/system.h3
-rw-r--r--include/asm-h8300/tlbflush.h6
-rw-r--r--include/asm-ia64/bitops.h45
-rw-r--r--include/asm-ia64/cacheflush.h2
-rw-r--r--include/asm-ia64/ide.h1
-rw-r--r--include/asm-ia64/meminit.h2
-rw-r--r--include/asm-ia64/pgtable.h2
-rw-r--r--include/asm-ia64/smp.h2
-rw-r--r--include/asm-ia64/spinlock.h2
-rw-r--r--include/asm-ia64/tlbflush.h13
-rw-r--r--include/asm-m32r/bitops.h5
-rw-r--r--include/asm-m32r/ide.h1
-rw-r--r--include/asm-m32r/pgtable.h2
-rw-r--r--include/asm-m32r/tlbflush.h3
-rw-r--r--include/asm-m68k/bitops.h5
-rw-r--r--include/asm-m68k/ide.h2
-rw-r--r--include/asm-m68k/tlbflush.h10
-rw-r--r--include/asm-m68knommu/bitops.h5
-rw-r--r--include/asm-m68knommu/system.h3
-rw-r--r--include/asm-m68knommu/tlbflush.h6
-rw-r--r--include/asm-mips/bitops.h106
-rw-r--r--include/asm-mips/fpu.h2
-rw-r--r--include/asm-mips/ip32/crime.h3
-rw-r--r--include/asm-mips/ip32/mace.h3
-rw-r--r--include/asm-mips/mach-generic/ide.h1
-rw-r--r--include/asm-mips/mach-ip27/kernel-entry-init.h9
-rw-r--r--include/asm-mips/pci/bridge.h2
-rw-r--r--include/asm-mips/sni.h2
-rw-r--r--include/asm-mips/time.h12
-rw-r--r--include/asm-mips/tlbflush.h7
-rw-r--r--include/asm-parisc/bitops.h5
-rw-r--r--include/asm-parisc/ide.h1
-rw-r--r--include/asm-parisc/pgtable.h2
-rw-r--r--include/asm-parisc/tlbflush.h4
-rw-r--r--include/asm-powerpc/bitops.h49
-rw-r--r--include/asm-powerpc/ide.h3
-rw-r--r--include/asm-powerpc/io.h2
-rw-r--r--include/asm-powerpc/iommu.h2
-rw-r--r--include/asm-powerpc/mmu_context.h2
-rw-r--r--include/asm-powerpc/mpc52xx.h6
-rw-r--r--include/asm-powerpc/paca.h5
-rw-r--r--include/asm-powerpc/tlbflush.h11
-rw-r--r--include/asm-ppc/mmu_context.h3
-rw-r--r--include/asm-ppc/time.h2
-rw-r--r--include/asm-s390/bitops.h5
-rw-r--r--include/asm-s390/tlbflush.h7
-rw-r--r--include/asm-sh/bitops.h6
-rw-r--r--include/asm-sh/se7751.h2
-rw-r--r--include/asm-sh/systemh7751.h2
-rw-r--r--include/asm-sh/tlbflush.h6
-rw-r--r--include/asm-sh64/bitops.h6
-rw-r--r--include/asm-sh64/ide.h1
-rw-r--r--include/asm-sh64/system.h3
-rw-r--r--include/asm-sh64/tlbflush.h4
-rw-r--r--include/asm-sparc/bitops.h5
-rw-r--r--include/asm-sparc/ide.h1
-rw-r--r--include/asm-sparc/ioctls.h4
-rw-r--r--include/asm-sparc/of_platform.h5
-rw-r--r--include/asm-sparc/termbits.h15
-rw-r--r--include/asm-sparc/termios.h48
-rw-r--r--include/asm-sparc/tlbflush.h6
-rw-r--r--include/asm-sparc64/backoff.h28
-rw-r--r--include/asm-sparc64/bitops.h5
-rw-r--r--include/asm-sparc64/ide.h1
-rw-r--r--include/asm-sparc64/ioctls.h4
-rw-r--r--include/asm-sparc64/of_platform.h5
-rw-r--r--include/asm-sparc64/smp.h2
-rw-r--r--include/asm-sparc64/termbits.h17
-rw-r--r--include/asm-sparc64/termios.h42
-rw-r--r--include/asm-sparc64/tlbflush.h7
-rw-r--r--include/asm-um/bitops.h4
-rw-r--r--include/asm-um/tlbflush.h6
-rw-r--r--include/asm-v850/bitops.h4
-rw-r--r--include/asm-v850/system.h3
-rw-r--r--include/asm-v850/tlbflush.h6
-rw-r--r--include/asm-x86/acpi_32.h6
-rw-r--r--include/asm-x86/bitops_32.h5
-rw-r--r--include/asm-x86/bitops_64.h5
-rw-r--r--include/asm-x86/compat.h6
-rw-r--r--include/asm-x86/desc_64.h30
-rw-r--r--include/asm-x86/geode.h2
-rw-r--r--include/asm-x86/hpet.h7
-rw-r--r--include/asm-x86/ide.h1
-rw-r--r--include/asm-x86/io_apic_64.h2
-rw-r--r--include/asm-x86/ipi.h2
-rw-r--r--include/asm-x86/irq_32.h3
-rw-r--r--include/asm-x86/msr-index.h36
-rw-r--r--include/asm-x86/pgtable_32.h5
-rw-r--r--include/asm-x86/pgtable_64.h2
-rw-r--r--include/asm-x86/processor_32.h16
-rw-r--r--include/asm-x86/processor_64.h16
-rw-r--r--include/asm-x86/proto.h2
-rw-r--r--include/asm-x86/ptrace_32.h2
-rw-r--r--include/asm-x86/ptrace_64.h2
-rw-r--r--include/asm-x86/smp_32.h8
-rw-r--r--include/asm-x86/smp_64.h11
-rw-r--r--include/asm-x86/suspend_64.h2
-rw-r--r--include/asm-x86/system_32.h1
-rw-r--r--include/asm-x86/tlbflush_32.h7
-rw-r--r--include/asm-x86/tlbflush_64.h9
-rw-r--r--include/asm-x86/topology_32.h4
-rw-r--r--include/asm-x86/topology_64.h6
-rw-r--r--include/asm-xtensa/bitops.h5
-rw-r--r--include/asm-xtensa/tlbflush.h11
-rw-r--r--include/linux/Kbuild1
-rw-r--r--include/linux/acpi.h26
-rw-r--r--include/linux/aio.h12
-rw-r--r--include/linux/bit_spinlock.h26
-rw-r--r--include/linux/bitmap.h1
-rw-r--r--include/linux/bitops.h8
-rw-r--r--include/linux/capability.h4
-rw-r--r--include/linux/cdrom.h6
-rw-r--r--include/linux/cgroup.h327
-rw-r--r--include/linux/cgroup_subsys.h38
-rw-r--r--include/linux/cgroupstats.h70
-rw-r--r--include/linux/clocksource.h5
-rw-r--r--include/linux/compiler-gcc.h12
-rw-r--r--include/linux/compiler.h14
-rw-r--r--include/linux/console.h7
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/cpu_acct.h14
-rw-r--r--include/linux/cpuidle.h180
-rw-r--r--include/linux/cpuset.h17
-rw-r--r--include/linux/crypto.h2
-rw-r--r--include/linux/cyclades.h27
-rw-r--r--include/linux/delayacct.h13
-rw-r--r--include/linux/device-mapper.h3
-rw-r--r--include/linux/dm-ioctl.h5
-rw-r--r--include/linux/dma-mapping.h30
-rw-r--r--include/linux/ext3_fs.h4
-rw-r--r--include/linux/ext4_fs.h103
-rw-r--r--include/linux/ext4_fs_extents.h4
-rw-r--r--include/linux/ext4_fs_i.h5
-rw-r--r--include/linux/ext4_fs_sb.h3
-rw-r--r--include/linux/ext4_jbd2.h6
-rw-r--r--include/linux/filter.h1
-rw-r--r--include/linux/freezer.h38
-rw-r--r--include/linux/fs.h9
-rw-r--r--include/linux/fuse.h65
-rw-r--r--include/linux/hid.h4
-rw-r--r--include/linux/hrtimer.h2
-rw-r--r--include/linux/ide.h167
-rw-r--r--include/linux/init_task.h12
-rw-r--r--include/linux/input.h47
-rw-r--r--include/linux/ipc.h3
-rw-r--r--include/linux/ipmi.h10
-rw-r--r--include/linux/ipmi_smi.h38
-rw-r--r--include/linux/jbd.h33
-rw-r--r--include/linux/jbd2.h49
-rw-r--r--include/linux/kernel_stat.h2
-rw-r--r--include/linux/kexec.h2
-rw-r--r--include/linux/keyboard.h11
-rw-r--r--include/linux/libata.h12
-rw-r--r--include/linux/list.h3
-rw-r--r--include/linux/lockdep.h8
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/marker.h129
-rw-r--r--include/linux/mempolicy.h12
-rw-r--r--include/linux/module.h12
-rw-r--r--include/linux/msg.h1
-rw-r--r--include/linux/netdevice.h20
-rw-r--r--include/linux/netfilter/xt_sctp.h13
-rw-r--r--include/linux/nfs_fs.h8
-rw-r--r--include/linux/notifier.h17
-rw-r--r--include/linux/nsproxy.h50
-rw-r--r--include/linux/of.h2
-rw-r--r--include/linux/of_platform.h4
-rw-r--r--include/linux/parport.h1
-rw-r--r--include/linux/phantom.h6
-rw-r--r--include/linux/pid.h61
-rw-r--r--include/linux/pid_namespace.h26
-rw-r--r--include/linux/pm.h98
-rw-r--r--include/linux/poison.h3
-rw-r--r--include/linux/prefetch.h9
-rw-r--r--include/linux/prio_heap.h58
-rw-r--r--include/linux/proc_fs.h19
-rw-r--r--include/linux/reiserfs_fs.h28
-rw-r--r--include/linux/reiserfs_fs_sb.h4
-rw-r--r--include/linux/sched.h222
-rw-r--r--include/linux/security.h24
-rw-r--r--include/linux/sem.h1
-rw-r--r--include/linux/shm.h1
-rw-r--r--include/linux/suspend.h169
-rw-r--r--include/linux/sysctl.h58
-rw-r--r--include/linux/taskstats.h7
-rw-r--r--include/linux/tick.h9
-rw-r--r--include/linux/types.h3
-rw-r--r--include/linux/uinput.h4
-rw-r--r--include/linux/vt.h12
-rw-r--r--include/linux/workqueue.h49
-rw-r--r--include/net/9p/9p.h4
-rw-r--r--include/net/inet_frag.h7
-rw-r--r--include/net/ipv6.h11
-rw-r--r--include/net/irda/irttp.h4
-rw-r--r--include/net/scm.h4
-rw-r--r--include/net/sock.h22
-rw-r--r--include/net/xfrm.h33
-rw-r--r--include/video/sstfb.h1
-rw-r--r--include/video/tdfx.h2
-rw-r--r--init/Kconfig51
-rw-r--r--init/do_mounts_rd.c6
-rw-r--r--init/main.c13
-rw-r--r--ipc/mqueue.c17
-rw-r--r--ipc/msg.c253
-rw-r--r--ipc/sem.c308
-rw-r--r--ipc/shm.c316
-rw-r--r--ipc/util.c506
-rw-r--r--ipc/util.h168
-rw-r--r--kernel/Kconfig.instrumentation49
-rw-r--r--kernel/Makefile10
-rw-r--r--kernel/acct.c66
-rw-r--r--kernel/audit.c14
-rw-r--r--kernel/auditfilter.c4
-rw-r--r--kernel/auditsc.c10
-rw-r--r--kernel/capability.c200
-rw-r--r--kernel/cgroup.c2805
-rw-r--r--kernel/cgroup_debug.c97
-rw-r--r--kernel/compat.c117
-rw-r--r--kernel/cpu.c14
-rw-r--r--kernel/cpu_acct.c186
-rw-r--r--kernel/cpuset.c1613
-rw-r--r--kernel/delayacct.c6
-rw-r--r--kernel/die_notifier.c38
-rw-r--r--kernel/dma.c8
-rw-r--r--kernel/exec_domain.c2
-rw-r--r--kernel/exit.c157
-rw-r--r--kernel/fork.c157
-rw-r--r--kernel/futex.c30
-rw-r--r--kernel/futex_compat.c3
-rw-r--r--kernel/hrtimer.c33
-rw-r--r--kernel/itimer.c4
-rw-r--r--kernel/kexec.c172
-rw-r--r--kernel/lockdep.c24
-rw-r--r--kernel/marker.c525
-rw-r--r--kernel/module.c68
-rw-r--r--kernel/notifier.c539
-rw-r--r--kernel/ns_cgroup.c100
-rw-r--r--kernel/nsproxy.c62
-rw-r--r--kernel/panic.c12
-rw-r--r--kernel/params.c8
-rw-r--r--kernel/pid.c353
-rw-r--r--kernel/posix-cpu-timers.c12
-rw-r--r--kernel/posix-timers.c21
-rw-r--r--kernel/power/Kconfig11
-rw-r--r--kernel/power/disk.c156
-rw-r--r--kernel/power/main.c48
-rw-r--r--kernel/power/power.h21
-rw-r--r--kernel/power/process.c141
-rw-r--r--kernel/power/snapshot.c62
-rw-r--r--kernel/power/swsusp.c33
-rw-r--r--kernel/power/user.c4
-rw-r--r--kernel/printk.c16
-rw-r--r--kernel/ptrace.c5
-rw-r--r--kernel/relay.c6
-rw-r--r--kernel/rtmutex-debug.c15
-rw-r--r--kernel/rtmutex.c2
-rw-r--r--kernel/sched.c366
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/sched_stats.h8
-rw-r--r--kernel/signal.c67
-rw-r--r--kernel/softlockup.c2
-rw-r--r--kernel/sys.c587
-rw-r--r--kernel/sysctl.c280
-rw-r--r--kernel/sysctl_check.c1588
-rw-r--r--kernel/taskstats.c69
-rw-r--r--kernel/time.c14
-rw-r--r--kernel/time/clocksource.c22
-rw-r--r--kernel/time/tick-sched.c16
-rw-r--r--kernel/timer.c16
-rw-r--r--kernel/tsacct.c4
-rw-r--r--kernel/workqueue.c38
-rw-r--r--lib/Kconfig.debug2
-rw-r--r--lib/Makefile2
-rw-r--r--lib/argv_split.c3
-rw-r--r--lib/crc32.c12
-rw-r--r--lib/hweight.c2
-rw-r--r--lib/kernel_lock.c2
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--lib/libcrc32c.c6
-rw-r--r--lib/percpu_counter.c5
-rw-r--r--lib/prio_heap.c70
-rw-r--r--lib/spinlock_debug.c8
-rw-r--r--mm/Kconfig2
-rw-r--r--mm/filemap.c3
-rw-r--r--mm/hugetlb.c4
-rw-r--r--mm/memory.c5
-rw-r--r--mm/memory_hotplug.c2
-rw-r--r--mm/mempolicy.c5
-rw-r--r--mm/mempool.c2
-rw-r--r--mm/migrate.c5
-rw-r--r--mm/mmap.c11
-rw-r--r--mm/mprotect.c6
-rw-r--r--mm/mremap.c4
-rw-r--r--mm/nommu.c3
-rw-r--r--mm/oom_kill.c17
-rw-r--r--mm/page-writeback.c2
-rw-r--r--mm/page_alloc.c8
-rw-r--r--mm/prio_tree.c2
-rw-r--r--mm/slab.c313
-rw-r--r--mm/swap.c2
-rw-r--r--mm/vmalloc.c6
-rw-r--r--mm/vmscan.c4
-rw-r--r--net/9p/Kconfig2
-rw-r--r--net/atm/br2684.c121
-rw-r--r--net/ax25/ax25_ds_in.c2
-rw-r--r--net/ax25/ax25_ds_subr.c2
-rw-r--r--net/bluetooth/bnep/core.c2
-rw-r--r--net/bluetooth/bnep/netdev.c2
-rw-r--r--net/bluetooth/hidp/core.c12
-rw-r--r--net/bridge/netfilter/ebtables.c2
-rw-r--r--net/core/filter.c59
-rw-r--r--net/core/gen_estimator.c2
-rw-r--r--net/core/neighbour.c75
-rw-r--r--net/core/pktgen.c8
-rw-r--r--net/core/rtnetlink.c8
-rw-r--r--net/core/scm.c4
-rw-r--r--net/core/sock.c16
-rw-r--r--net/dccp/input.c3
-rw-r--r--net/dccp/sysctl.c3
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c2
-rw-r--r--net/ieee80211/ieee80211_wx.c2
-rw-r--r--net/ipv4/Kconfig2
-rw-r--r--net/ipv4/fib_trie.c2
-rw-r--r--net/ipv4/inet_connection_sock.c2
-rw-r--r--net/ipv4/inet_fragment.c89
-rw-r--r--net/ipv4/inet_hashtables.c2
-rw-r--r--net/ipv4/ip_fragment.c159
-rw-r--r--net/ipv4/ipvs/ip_vs_sync.c6
-rw-r--r--net/ipv4/netfilter/nf_conntrack_proto_icmp.c2
-rw-r--r--net/ipv4/sysctl_net_ipv4.c6
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_input.c6
-rw-r--r--net/ipv4/udp.c5
-rw-r--r--net/ipv4/xfrm4_input.c40
-rw-r--r--net/ipv4/xfrm4_mode_beet.c1
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c1
-rw-r--r--net/ipv4/xfrm4_output.c2
-rw-r--r--net/ipv4/xfrm4_policy.c27
-rw-r--r--net/ipv4/xfrm4_state.c1
-rw-r--r--net/ipv4/xfrm4_tunnel.c11
-rw-r--r--net/ipv6/addrconf.c10
-rw-r--r--net/ipv6/af_inet6.c1
-rw-r--r--net/ipv6/ah6.c11
-rw-r--r--net/ipv6/esp6.c9
-rw-r--r--net/ipv6/inet6_hashtables.c2
-rw-r--r--net/ipv6/ip6_flowlabel.c57
-rw-r--r--net/ipv6/ipcomp6.c9
-rw-r--r--net/ipv6/ndisc.c24
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c1
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c1
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c112
-rw-r--r--net/ipv6/reassembly.c131
-rw-r--r--net/ipv6/route.c1
-rw-r--r--net/ipv6/xfrm6_input.c14
-rw-r--r--net/ipv6/xfrm6_mode_beet.c1
-rw-r--r--net/ipv6/xfrm6_mode_ro.c9
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c1
-rw-r--r--net/ipv6/xfrm6_output.c2
-rw-r--r--net/ipv6/xfrm6_policy.c17
-rw-r--r--net/ipv6/xfrm6_state.c7
-rw-r--r--net/ipv6/xfrm6_tunnel.c4
-rw-r--r--net/irda/discovery.c2
-rw-r--r--net/irda/ircomm/ircomm_tty_attach.c15
-rw-r--r--net/irda/iriap.c2
-rw-r--r--net/irda/iriap_event.c2
-rw-r--r--net/irda/irias_object.c2
-rw-r--r--net/irda/irlan/irlan_client.c2
-rw-r--r--net/irda/irlan/irlan_client_event.c2
-rw-r--r--net/irda/irlan/irlan_common.c2
-rw-r--r--net/irda/irlan/irlan_eth.c2
-rw-r--r--net/irda/irlan/irlan_event.c2
-rw-r--r--net/irda/irlan/irlan_filter.c2
-rw-r--r--net/irda/irlan/irlan_provider.c2
-rw-r--r--net/irda/irlan/irlan_provider_event.c2
-rw-r--r--net/irda/irlap_event.c2
-rw-r--r--net/irda/irlap_frame.c2
-rw-r--r--net/irda/irlmp.c2
-rw-r--r--net/irda/irlmp_event.c2
-rw-r--r--net/irda/irlmp_frame.c2
-rw-r--r--net/irda/irmod.c2
-rw-r--r--net/irda/irqueue.c2
-rw-r--r--net/irda/irsysctl.c36
-rw-r--r--net/irda/irttp.c2
-rw-r--r--net/irda/timer.c2
-rw-r--r--net/irda/wrapper.c2
-rw-r--r--net/iucv/iucv.c2
-rw-r--r--net/llc/af_llc.c2
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/ieee80211_ioctl.c16
-rw-r--r--net/mac80211/ieee80211_sta.c126
-rw-r--r--net/netfilter/nf_conntrack_proto_generic.c2
-rw-r--r--net/netfilter/nf_conntrack_proto_sctp.c14
-rw-r--r--net/netfilter/nf_conntrack_proto_tcp.c29
-rw-r--r--net/netfilter/nf_conntrack_proto_udp.c4
-rw-r--r--net/netfilter/xt_CONNMARK.c2
-rw-r--r--net/netfilter/xt_connbytes.c2
-rw-r--r--net/netfilter/xt_connmark.c2
-rw-r--r--net/netfilter/xt_limit.c4
-rw-r--r--net/netfilter/xt_sctp.c18
-rw-r--r--net/packet/af_packet.c5
-rw-r--r--net/rfkill/rfkill-input.c12
-rw-r--r--net/sched/Kconfig10
-rw-r--r--net/sched/em_meta.c2
-rw-r--r--net/sched/sch_generic.c33
-rw-r--r--net/sunrpc/sched.c2
-rw-r--r--net/sunrpc/sysctl.c4
-rw-r--r--net/unix/af_unix.c6
-rw-r--r--net/xfrm/xfrm_input.c5
-rw-r--r--net/xfrm/xfrm_output.c4
-rw-r--r--net/xfrm/xfrm_policy.c179
-rw-r--r--net/xfrm/xfrm_state.c206
-rw-r--r--samples/Kconfig16
-rw-r--r--samples/Makefile3
-rw-r--r--samples/markers/Makefile4
-rw-r--r--samples/markers/marker-example.c54
-rw-r--r--samples/markers/probe-example.c98
-rw-r--r--scripts/Kbuild.include11
-rw-r--r--scripts/basic/docproc.c11
-rwxr-xr-xscripts/checkpatch.pl514
-rwxr-xr-xscripts/checkstack.pl2
-rw-r--r--scripts/kconfig/Makefile2
-rw-r--r--scripts/kconfig/menu.c35
-rw-r--r--scripts/kconfig/qconf.cc4
-rw-r--r--scripts/mod/modpost.c3
-rw-r--r--scripts/package/builddeb2
-rw-r--r--security/commoncap.c62
-rw-r--r--security/dummy.c16
-rw-r--r--security/selinux/xfrm.c2
-rw-r--r--sound/arm/aaci.c4
-rw-r--r--sound/core/seq/seq_midi_emul.c8
-rw-r--r--sound/drivers/opl3/opl3_midi.c2
-rw-r--r--sound/isa/es18xx.c4
-rw-r--r--sound/mips/au1x00.c8
-rw-r--r--sound/oss/Makefile1
-rw-r--r--sound/oss/dmasound/Makefile6
-rw-r--r--sound/oss/dmasound/awacs_defs.h251
-rw-r--r--sound/oss/dmasound/dac3550a.c209
-rw-r--r--sound/oss/dmasound/dmasound.h13
-rw-r--r--sound/oss/dmasound/dmasound_awacs.c3215
-rw-r--r--sound/oss/dmasound/dmasound_core.c287
-rw-r--r--sound/oss/dmasound/tas3001c.c849
-rw-r--r--sound/oss/dmasound/tas3001c.h64
-rw-r--r--sound/oss/dmasound/tas3001c_tables.c375
-rw-r--r--sound/oss/dmasound/tas3004.c1138
-rw-r--r--sound/oss/dmasound/tas3004.h77
-rw-r--r--sound/oss/dmasound/tas3004_tables.c301
-rw-r--r--sound/oss/dmasound/tas_common.c214
-rw-r--r--sound/oss/dmasound/tas_common.h284
-rw-r--r--sound/oss/dmasound/tas_eq_prefs.h24
-rw-r--r--sound/oss/dmasound/tas_ioctl.h23
-rw-r--r--sound/oss/dmasound/trans_16.c898
-rw-r--r--sound/oss/es1371.c3131
-rw-r--r--sound/pci/au88x0/au88x0.c2
-rw-r--r--sound/ppc/beep.c4
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/soc/soc-dapm.c2
-rw-r--r--sound/synth/emux/emux_synth.c2
-rw-r--r--sound/usb/caiaq/caiaq-input.c9
1765 files changed, 35155 insertions, 33525 deletions
diff --git a/.gitignore b/.gitignore
index 22fb8fa9bc3d..8d14531846b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@
12*.s 12*.s
13*.ko 13*.ko
14*.so 14*.so
15*.so.dbg
15*.mod.c 16*.mod.c
16*.i 17*.i
17*.lst 18*.lst
diff --git a/CREDITS b/CREDITS
index 99566b1a6eeb..ee909f2cc49e 100644
--- a/CREDITS
+++ b/CREDITS
@@ -959,7 +959,7 @@ S: 2037 Walnut #6
959S: Boulder, Colorado 80302 959S: Boulder, Colorado 80302
960S: USA 960S: USA
961 961
962N: Heiko Eissfeldt 962N: Heiko Eißfeldt
963E: heiko@colossus.escape.de heiko@unifix.de 963E: heiko@colossus.escape.de heiko@unifix.de
964D: verify_area stuff, generic SCSI fixes 964D: verify_area stuff, generic SCSI fixes
965D: SCSI Programming HOWTO 965D: SCSI Programming HOWTO
@@ -1988,8 +1988,8 @@ N: Volker Lendecke
1988E: vl@kki.org 1988E: vl@kki.org
1989D: Kernel smbfs (to mount WfW, NT and OS/2 network drives.) 1989D: Kernel smbfs (to mount WfW, NT and OS/2 network drives.)
1990D: NCP filesystem support (to mount NetWare volumes) 1990D: NCP filesystem support (to mount NetWare volumes)
1991S: Von Ossietzky Str. 12 1991S: Von-Ossietzky-Str. 12
1992S: 37085 Goettingen 1992S: 37085 Göttingen
1993S: Germany 1993S: Germany
1994 1994
1995N: Kevin Lentin 1995N: Kevin Lentin
@@ -2431,11 +2431,11 @@ S: 12725 SW Millikan Way, Suite 400
2431S: Beaverton, Oregon 97005 2431S: Beaverton, Oregon 97005
2432S: USA 2432S: USA
2433 2433
2434N: Eberhard Moenkeberg 2434N: Eberhard Mönkeberg
2435E: emoenke@gwdg.de 2435E: emoenke@gwdg.de
2436D: CDROM driver "sbpcd" (Matsushita/Panasonic/Soundblaster) 2436D: CDROM driver "sbpcd" (Matsushita/Panasonic/Soundblaster)
2437S: Ruhstrathoehe 2 b. 2437S: Ruhstrathöhe 2 b.
2438S: D-37085 Goettingen 2438S: D-37085 Göttingen
2439S: Germany 2439S: Germany
2440 2440
2441N: Thomas Molina 2441N: Thomas Molina
diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index 1a7f53068ec2..054a7ecf64c6 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -165,7 +165,7 @@ quiet_cmd_db2man = MAN $@
165 @touch $@ 165 @touch $@
166 166
167### 167###
168# Rules to generate postscripts and PNG imgages from .fig format files 168# Rules to generate postscripts and PNG images from .fig format files
169quiet_cmd_fig2eps = FIG2EPS $@ 169quiet_cmd_fig2eps = FIG2EPS $@
170 cmd_fig2eps = fig2dev -Leps $< $@ 170 cmd_fig2eps = fig2dev -Leps $< $@
171 171
diff --git a/Documentation/DocBook/kernel-api.tmpl b/Documentation/DocBook/kernel-api.tmpl
index d3290c46af51..aa38cc5692a0 100644
--- a/Documentation/DocBook/kernel-api.tmpl
+++ b/Documentation/DocBook/kernel-api.tmpl
@@ -46,7 +46,7 @@
46 46
47 <sect1><title>Atomic and pointer manipulation</title> 47 <sect1><title>Atomic and pointer manipulation</title>
48!Iinclude/asm-x86/atomic_32.h 48!Iinclude/asm-x86/atomic_32.h
49!Iinclude/asm-x86/unaligned_32.h 49!Iinclude/asm-x86/unaligned.h
50 </sect1> 50 </sect1>
51 51
52 <sect1><title>Delaying, scheduling, and timer routines</title> 52 <sect1><title>Delaying, scheduling, and timer routines</title>
diff --git a/Documentation/DocBook/mtdnand.tmpl b/Documentation/DocBook/mtdnand.tmpl
index 6fbc41d98c1e..957cf5c26831 100644
--- a/Documentation/DocBook/mtdnand.tmpl
+++ b/Documentation/DocBook/mtdnand.tmpl
@@ -282,7 +282,7 @@ int __init board_init (void)
282 goto out; 282 goto out;
283 } 283 }
284 284
285 /* map physical adress */ 285 /* map physical address */
286 baseaddr = (unsigned long)ioremap(CHIP_PHYSICAL_ADDRESS, 1024); 286 baseaddr = (unsigned long)ioremap(CHIP_PHYSICAL_ADDRESS, 1024);
287 if(!baseaddr){ 287 if(!baseaddr){
288 printk("Ioremap to access NAND chip failed\n"); 288 printk("Ioremap to access NAND chip failed\n");
@@ -306,7 +306,7 @@ int __init board_init (void)
306 this->dev_ready = board_dev_ready; 306 this->dev_ready = board_dev_ready;
307 this->eccmode = NAND_ECC_SOFT; 307 this->eccmode = NAND_ECC_SOFT;
308 308
309 /* Scan to find existance of the device */ 309 /* Scan to find existence of the device */
310 if (nand_scan (board_mtd, 1)) { 310 if (nand_scan (board_mtd, 1)) {
311 err = -ENXIO; 311 err = -ENXIO;
312 goto out_ior; 312 goto out_ior;
@@ -340,7 +340,7 @@ static void __exit board_cleanup (void)
340 /* Release resources, unregister device */ 340 /* Release resources, unregister device */
341 nand_release (board_mtd); 341 nand_release (board_mtd);
342 342
343 /* unmap physical adress */ 343 /* unmap physical address */
344 iounmap((void *)baseaddr); 344 iounmap((void *)baseaddr);
345 345
346 /* Free the MTD device structure */ 346 /* Free the MTD device structure */
diff --git a/Documentation/IPMI.txt b/Documentation/IPMI.txt
index 24dc3fcf1594..bc38283379f0 100644
--- a/Documentation/IPMI.txt
+++ b/Documentation/IPMI.txt
@@ -441,17 +441,20 @@ ACPI, and if none of those then a KCS device at the spec-specified
4410xca2. If you want to turn this off, set the "trydefaults" option to 4410xca2. If you want to turn this off, set the "trydefaults" option to
442false. 442false.
443 443
444If you have high-res timers compiled into the kernel, the driver will 444If your IPMI interface does not support interrupts and is a KCS or
445use them to provide much better performance. Note that if you do not 445SMIC interface, the IPMI driver will start a kernel thread for the
446have high-res timers enabled in the kernel and you don't have 446interface to help speed things up. This is a low-priority kernel
447interrupts enabled, the driver will run VERY slowly. Don't blame me, 447thread that constantly polls the IPMI driver while an IPMI operation
448is in progress. The force_kipmid module parameter will all the user to
449force this thread on or off. If you force it off and don't have
450interrupts, the driver will run VERY slowly. Don't blame me,
448these interfaces suck. 451these interfaces suck.
449 452
450The driver supports a hot add and remove of interfaces. This way, 453The driver supports a hot add and remove of interfaces. This way,
451interfaces can be added or removed after the kernel is up and running. 454interfaces can be added or removed after the kernel is up and running.
452This is done using /sys/modules/ipmi_si/hotmod, which is a write-only 455This is done using /sys/modules/ipmi_si/parameters/hotmod, which is a
453parameter. You write a string to this interface. The string has the 456write-only parameter. You write a string to this interface. The string
454format: 457has the format:
455 <op1>[:op2[:op3...]] 458 <op1>[:op2[:op3...]]
456The "op"s are: 459The "op"s are:
457 add|remove,kcs|bt|smic,mem|i/o,<address>[,<opt1>[,<opt2>[,...]]] 460 add|remove,kcs|bt|smic,mem|i/o,<address>[,<opt1>[,<opt2>[,...]]]
@@ -581,9 +584,11 @@ The watchdog will panic and start a 120 second reset timeout if it
581gets a pre-action. During a panic or a reboot, the watchdog will 584gets a pre-action. During a panic or a reboot, the watchdog will
582start a 120 timer if it is running to make sure the reboot occurs. 585start a 120 timer if it is running to make sure the reboot occurs.
583 586
584Note that if you use the NMI preaction for the watchdog, you MUST 587Note that if you use the NMI preaction for the watchdog, you MUST NOT
585NOT use nmi watchdog mode 1. If you use the NMI watchdog, you 588use the nmi watchdog. There is no reasonable way to tell if an NMI
586must use mode 2. 589comes from the IPMI controller, so it must assume that if it gets an
590otherwise unhandled NMI, it must be from IPMI and it will panic
591immediately.
587 592
588Once you open the watchdog timer, you must write a 'V' character to the 593Once you open the watchdog timer, you must write a 'V' character to the
589device to close it, or the timer will not stop. This is a new semantic 594device to close it, or the timer will not stop. This is a new semantic
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index 19e7f65c269f..34e06d2f194f 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -67,7 +67,7 @@ kernel patches.
6720: Check that it all passes `make headers_check'. 6720: Check that it all passes `make headers_check'.
68 68
6921: Has been checked with injection of at least slab and page-allocation 6921: Has been checked with injection of at least slab and page-allocation
70 fauilures. See Documentation/fault-injection/. 70 failures. See Documentation/fault-injection/.
71 71
72 If the new code is substantial, addition of subsystem-specific fault 72 If the new code is substantial, addition of subsystem-specific fault
73 injection might be appropriate. 73 injection might be appropriate.
diff --git a/Documentation/SubmittingDrivers b/Documentation/SubmittingDrivers
index d7e26427e426..24f2eb40cae5 100644
--- a/Documentation/SubmittingDrivers
+++ b/Documentation/SubmittingDrivers
@@ -36,8 +36,7 @@ Linux 2.4:
36 If the code area has a general maintainer then please submit it to 36 If the code area has a general maintainer then please submit it to
37 the maintainer listed in MAINTAINERS in the kernel file. If the 37 the maintainer listed in MAINTAINERS in the kernel file. If the
38 maintainer does not respond or you cannot find the appropriate 38 maintainer does not respond or you cannot find the appropriate
39 maintainer then please contact Marcelo Tosatti 39 maintainer then please contact Willy Tarreau <w@1wt.eu>.
40 <marcelo.tosatti@cyclades.com>.
41 40
42Linux 2.6: 41Linux 2.6:
43 The same rules apply as 2.4 except that you should follow linux-kernel 42 The same rules apply as 2.4 except that you should follow linux-kernel
diff --git a/Documentation/accounting/cgroupstats.txt b/Documentation/accounting/cgroupstats.txt
new file mode 100644
index 000000000000..eda40fd39cad
--- /dev/null
+++ b/Documentation/accounting/cgroupstats.txt
@@ -0,0 +1,27 @@
1Control Groupstats is inspired by the discussion at
2http://lkml.org/lkml/2007/4/11/187 and implements per cgroup statistics as
3suggested by Andrew Morton in http://lkml.org/lkml/2007/4/11/263.
4
5Per cgroup statistics infrastructure re-uses code from the taskstats
6interface. A new set of cgroup operations are registered with commands
7and attributes specific to cgroups. It should be very easy to
8extend per cgroup statistics, by adding members to the cgroupstats
9structure.
10
11The current model for cgroupstats is a pull, a push model (to post
12statistics on interesting events), should be very easy to add. Currently
13user space requests for statistics by passing the cgroup path.
14Statistics about the state of all the tasks in the cgroup is returned to
15user space.
16
17NOTE: We currently rely on delay accounting for extracting information
18about tasks blocked on I/O. If CONFIG_TASK_DELAY_ACCT is disabled, this
19information will not be available.
20
21To extract cgroup statistics a utility very similar to getdelays.c
22has been developed, the sample output of the utility is shown below
23
24~/balbir/cgroupstats # ./getdelays -C "/cgroup/a"
25sleeping 1, blocked 0, running 1, stopped 0, uninterruptible 0
26~/balbir/cgroupstats # ./getdelays -C "/cgroup"
27sleeping 155, blocked 0, running 1, stopped 0, uninterruptible 2
diff --git a/Documentation/arm/Samsung-S3C24XX/DMA.txt b/Documentation/arm/Samsung-S3C24XX/DMA.txt
index 37f4edcc5d87..3ed82383efea 100644
--- a/Documentation/arm/Samsung-S3C24XX/DMA.txt
+++ b/Documentation/arm/Samsung-S3C24XX/DMA.txt
@@ -5,7 +5,7 @@ Introduction
5------------ 5------------
6 6
7 The kernel provides an interface to manage DMA transfers 7 The kernel provides an interface to manage DMA transfers
8 using the DMA channels in the cpu, so that the central 8 using the DMA channels in the CPU, so that the central
9 duty of managing channel mappings, and programming the 9 duty of managing channel mappings, and programming the
10 channel generators is in one place. 10 channel generators is in one place.
11 11
@@ -17,24 +17,24 @@ DMA Channel Ordering
17 channels to all sources, which means that some devices 17 channels to all sources, which means that some devices
18 have a restricted number of channels that can be used. 18 have a restricted number of channels that can be used.
19 19
20 To allow flexibilty for each cpu type and board, the 20 To allow flexibility for each CPU type and board, the
21 dma code can be given an dma ordering structure which 21 DMA code can be given a DMA ordering structure which
22 allows the order of channel search to be specified, as 22 allows the order of channel search to be specified, as
23 well as allowing the prohibition of certain claims. 23 well as allowing the prohibition of certain claims.
24 24
25 struct s3c24xx_dma_order has a list of channels, and 25 struct s3c24xx_dma_order has a list of channels, and
26 each channel within has a slot for a list of dma 26 each channel within has a slot for a list of DMA
27 channel numbers. The slots are searched in order, for 27 channel numbers. The slots are searched in order for
28 the presence of a dma channel number with DMA_CH_VALID 28 the presence of a DMA channel number with DMA_CH_VALID
29 orred in. 29 or-ed in.
30 30
31 If the order has the flag DMA_CH_NEVER set, then after 31 If the order has the flag DMA_CH_NEVER set, then after
32 checking the channel list, the system will return no 32 checking the channel list, the system will return no
33 found channel, thus denying the request. 33 found channel, thus denying the request.
34 34
35 A board support file can call s3c24xx_dma_order_set() 35 A board support file can call s3c24xx_dma_order_set()
36 to register an complete ordering set. The routine will 36 to register a complete ordering set. The routine will
37 copy the data, so the original can be discared with 37 copy the data, so the original can be discarded with
38 __initdata. 38 __initdata.
39 39
40 40
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index d46306fea230..f20c10c2858f 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
@@ -418,6 +418,20 @@ brothers:
418 */ 418 */
419 smp_mb__after_clear_bit(); 419 smp_mb__after_clear_bit();
420 420
421There are two special bitops with lock barrier semantics (acquire/release,
422same as spinlocks). These operate in the same way as their non-_lock/unlock
423postfixed variants, except that they are to provide acquire/release semantics,
424respectively. This means they can be used for bit_spin_trylock and
425bit_spin_unlock type operations without specifying any more barriers.
426
427 int test_and_set_bit_lock(unsigned long nr, unsigned long *addr);
428 void clear_bit_unlock(unsigned long nr, unsigned long *addr);
429 void __clear_bit_unlock(unsigned long nr, unsigned long *addr);
430
431The __clear_bit_unlock version is non-atomic, however it still implements
432unlock barrier semantics. This can be useful if the lock itself is protecting
433the other bits in the word.
434
421Finally, there are non-atomic versions of the bitmask operations 435Finally, there are non-atomic versions of the bitmask operations
422provided. They are used in contexts where some other higher-level SMP 436provided. They are used in contexts where some other higher-level SMP
423locking scheme is being used to protect the bitmask, and thus less 437locking scheme is being used to protect the bitmask, and thus less
diff --git a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt
index 552cabac0608..da42ab414c48 100644
--- a/Documentation/cachetlb.txt
+++ b/Documentation/cachetlb.txt
@@ -87,30 +87,7 @@ changes occur:
87 87
88 This is used primarily during fault processing. 88 This is used primarily during fault processing.
89 89
905) void flush_tlb_pgtables(struct mm_struct *mm, 905) void update_mmu_cache(struct vm_area_struct *vma,
91 unsigned long start, unsigned long end)
92
93 The software page tables for address space 'mm' for virtual
94 addresses in the range 'start' to 'end-1' are being torn down.
95
96 Some platforms cache the lowest level of the software page tables
97 in a linear virtually mapped array, to make TLB miss processing
98 more efficient. On such platforms, since the TLB is caching the
99 software page table structure, it needs to be flushed when parts
100 of the software page table tree are unlinked/freed.
101
102 Sparc64 is one example of a platform which does this.
103
104 Usually, when munmap()'ing an area of user virtual address
105 space, the kernel leaves the page table parts around and just
106 marks the individual pte's as invalid. However, if very large
107 portions of the address space are unmapped, the kernel frees up
108 those portions of the software page tables to prevent potential
109 excessive kernel memory usage caused by erratic mmap/mmunmap
110 sequences. It is at these times that flush_tlb_pgtables will
111 be invoked.
112
1136) void update_mmu_cache(struct vm_area_struct *vma,
114 unsigned long address, pte_t pte) 91 unsigned long address, pte_t pte)
115 92
116 At the end of every page fault, this routine is invoked to 93 At the end of every page fault, this routine is invoked to
@@ -123,7 +100,7 @@ changes occur:
123 translations for software managed TLB configurations. 100 translations for software managed TLB configurations.
124 The sparc64 port currently does this. 101 The sparc64 port currently does this.
125 102
1267) void tlb_migrate_finish(struct mm_struct *mm) 1036) void tlb_migrate_finish(struct mm_struct *mm)
127 104
128 This interface is called at the end of an explicit 105 This interface is called at the end of an explicit
129 process migration. This interface provides a hook 106 process migration. This interface provides a hook
diff --git a/Documentation/cdrom/cdrom-standard.tex b/Documentation/cdrom/cdrom-standard.tex
index 92f94e597582..c713aeb020c4 100644
--- a/Documentation/cdrom/cdrom-standard.tex
+++ b/Documentation/cdrom/cdrom-standard.tex
@@ -1009,7 +1009,7 @@ taken over the torch in maintaining \cdromc\ and integrating much
1009\cdrom-related code in the 2.1-kernel. Thanks to Scott Snyder and 1009\cdrom-related code in the 2.1-kernel. Thanks to Scott Snyder and
1010Gerd Knorr, who were the first to implement this interface for SCSI 1010Gerd Knorr, who were the first to implement this interface for SCSI
1011and IDE-CD drivers and added many ideas for extension of the data 1011and IDE-CD drivers and added many ideas for extension of the data
1012structures relative to kernel~2.0. Further thanks to Heiko Eissfeldt, 1012structures relative to kernel~2.0. Further thanks to Heiko Ei{\sz}feldt,
1013Thomas Quinot, Jon Tombs, Ken Pizzini, Eberhard M\"onkeberg and Andrew 1013Thomas Quinot, Jon Tombs, Ken Pizzini, Eberhard M\"onkeberg and Andrew
1014Kroll, the \linux\ \cdrom\ device driver developers who were kind 1014Kroll, the \linux\ \cdrom\ device driver developers who were kind
1015enough to give suggestions and criticisms during the writing. Finally 1015enough to give suggestions and criticisms during the writing. Finally
diff --git a/Documentation/cgroups.txt b/Documentation/cgroups.txt
new file mode 100644
index 000000000000..98a26f81fa75
--- /dev/null
+++ b/Documentation/cgroups.txt
@@ -0,0 +1,545 @@
1 CGROUPS
2 -------
3
4Written by Paul Menage <menage@google.com> based on Documentation/cpusets.txt
5
6Original copyright statements from cpusets.txt:
7Portions Copyright (C) 2004 BULL SA.
8Portions Copyright (c) 2004-2006 Silicon Graphics, Inc.
9Modified by Paul Jackson <pj@sgi.com>
10Modified by Christoph Lameter <clameter@sgi.com>
11
12CONTENTS:
13=========
14
151. Control Groups
16 1.1 What are cgroups ?
17 1.2 Why are cgroups needed ?
18 1.3 How are cgroups implemented ?
19 1.4 What does notify_on_release do ?
20 1.5 How do I use cgroups ?
212. Usage Examples and Syntax
22 2.1 Basic Usage
23 2.2 Attaching processes
243. Kernel API
25 3.1 Overview
26 3.2 Synchronization
27 3.3 Subsystem API
284. Questions
29
301. Control Groups
31==========
32
331.1 What are cgroups ?
34----------------------
35
36Control Groups provide a mechanism for aggregating/partitioning sets of
37tasks, and all their future children, into hierarchical groups with
38specialized behaviour.
39
40Definitions:
41
42A *cgroup* associates a set of tasks with a set of parameters for one
43or more subsystems.
44
45A *subsystem* is a module that makes use of the task grouping
46facilities provided by cgroups to treat groups of tasks in
47particular ways. A subsystem is typically a "resource controller" that
48schedules a resource or applies per-cgroup limits, but it may be
49anything that wants to act on a group of processes, e.g. a
50virtualization subsystem.
51
52A *hierarchy* is a set of cgroups arranged in a tree, such that
53every task in the system is in exactly one of the cgroups in the
54hierarchy, and a set of subsystems; each subsystem has system-specific
55state attached to each cgroup in the hierarchy. Each hierarchy has
56an instance of the cgroup virtual filesystem associated with it.
57
58At any one time there may be multiple active hierachies of task
59cgroups. Each hierarchy is a partition of all tasks in the system.
60
61User level code may create and destroy cgroups by name in an
62instance of the cgroup virtual file system, specify and query to
63which cgroup a task is assigned, and list the task pids assigned to
64a cgroup. Those creations and assignments only affect the hierarchy
65associated with that instance of the cgroup file system.
66
67On their own, the only use for cgroups is for simple job
68tracking. The intention is that other subsystems hook into the generic
69cgroup support to provide new attributes for cgroups, such as
70accounting/limiting the resources which processes in a cgroup can
71access. For example, cpusets (see Documentation/cpusets.txt) allows
72you to associate a set of CPUs and a set of memory nodes with the
73tasks in each cgroup.
74
751.2 Why are cgroups needed ?
76----------------------------
77
78There are multiple efforts to provide process aggregations in the
79Linux kernel, mainly for resource tracking purposes. Such efforts
80include cpusets, CKRM/ResGroups, UserBeanCounters, and virtual server
81namespaces. These all require the basic notion of a
82grouping/partitioning of processes, with newly forked processes ending
83in the same group (cgroup) as their parent process.
84
85The kernel cgroup patch provides the minimum essential kernel
86mechanisms required to efficiently implement such groups. It has
87minimal impact on the system fast paths, and provides hooks for
88specific subsystems such as cpusets to provide additional behaviour as
89desired.
90
91Multiple hierarchy support is provided to allow for situations where
92the division of tasks into cgroups is distinctly different for
93different subsystems - having parallel hierarchies allows each
94hierarchy to be a natural division of tasks, without having to handle
95complex combinations of tasks that would be present if several
96unrelated subsystems needed to be forced into the same tree of
97cgroups.
98
99At one extreme, each resource controller or subsystem could be in a
100separate hierarchy; at the other extreme, all subsystems
101would be attached to the same hierarchy.
102
103As an example of a scenario (originally proposed by vatsa@in.ibm.com)
104that can benefit from multiple hierarchies, consider a large
105university server with various users - students, professors, system
106tasks etc. The resource planning for this server could be along the
107following lines:
108
109 CPU : Top cpuset
110 / \
111 CPUSet1 CPUSet2
112 | |
113 (Profs) (Students)
114
115 In addition (system tasks) are attached to topcpuset (so
116 that they can run anywhere) with a limit of 20%
117
118 Memory : Professors (50%), students (30%), system (20%)
119
120 Disk : Prof (50%), students (30%), system (20%)
121
122 Network : WWW browsing (20%), Network File System (60%), others (20%)
123 / \
124 Prof (15%) students (5%)
125
126Browsers like firefox/lynx go into the WWW network class, while (k)nfsd go
127into NFS network class.
128
129At the same time firefox/lynx will share an appropriate CPU/Memory class
130depending on who launched it (prof/student).
131
132With the ability to classify tasks differently for different resources
133(by putting those resource subsystems in different hierarchies) then
134the admin can easily set up a script which receives exec notifications
135and depending on who is launching the browser he can
136
137 # echo browser_pid > /mnt/<restype>/<userclass>/tasks
138
139With only a single hierarchy, he now would potentially have to create
140a separate cgroup for every browser launched and associate it with
141approp network and other resource class. This may lead to
142proliferation of such cgroups.
143
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
146wants to do online gaming :) OR give one of the students simulation
147apps enhanced CPU power,
148
149With ability to write pids directly to resource classes, its just a
150matter of :
151
152 # echo pid > /mnt/network/<new_class>/tasks
153 (after some time)
154 # echo pid > /mnt/network/<orig_class>/tasks
155
156Without this ability, he would have to split the cgroup into
157multiple separate ones and then associate the new cgroups with the
158new resource classes.
159
160
161
1621.3 How are cgroups implemented ?
163---------------------------------
164
165Control Groups extends the kernel as follows:
166
167 - Each task in the system has a reference-counted pointer to a
168 css_set.
169
170 - A css_set contains a set of reference-counted pointers to
171 cgroup_subsys_state objects, one for each cgroup subsystem
172 registered in the system. There is no direct link from a task to
173 the cgroup of which it's a member in each hierarchy, but this
174 can be determined by following pointers through the
175 cgroup_subsys_state objects. This is because accessing the
176 subsystem state is something that's expected to happen frequently
177 and in performance-critical code, whereas operations that require a
178 task's actual cgroup assignments (in particular, moving between
179 cgroups) are less common. A linked list runs through the cg_list
180 field of each task_struct using the css_set, anchored at
181 css_set->tasks.
182
183 - A cgroup hierarchy filesystem can be mounted for browsing and
184 manipulation from user space.
185
186 - You can list all the tasks (by pid) attached to any cgroup.
187
188The implementation of cgroups requires a few, simple hooks
189into the rest of the kernel, none in performance critical paths:
190
191 - in init/main.c, to initialize the root cgroups and initial
192 css_set at system boot.
193
194 - in fork and exit, to attach and detach a task from its css_set.
195
196In addition a new file system, of type "cgroup" may be mounted, to
197enable browsing and modifying the cgroups presently known to the
198kernel. When mounting a cgroup hierarchy, you may specify a
199comma-separated list of subsystems to mount as the filesystem mount
200options. By default, mounting the cgroup filesystem attempts to
201mount a hierarchy containing all registered subsystems.
202
203If an active hierarchy with exactly the same set of subsystems already
204exists, it will be reused for the new mount. If no existing hierarchy
205matches, and any of the requested subsystems are in use in an existing
206hierarchy, the mount will fail with -EBUSY. Otherwise, a new hierarchy
207is activated, associated with the requested subsystems.
208
209It's not currently possible to bind a new subsystem to an active
210cgroup hierarchy, or to unbind a subsystem from an active cgroup
211hierarchy. This may be possible in future, but is fraught with nasty
212error-recovery issues.
213
214When a cgroup filesystem is unmounted, if there are any
215child cgroups created below the top-level cgroup, that hierarchy
216will remain active even though unmounted; if there are no
217child cgroups then the hierarchy will be deactivated.
218
219No new system calls are added for cgroups - all support for
220querying and modifying cgroups is via this cgroup file system.
221
222Each task under /proc has an added file named 'cgroup' displaying,
223for each active hierarchy, the subsystem names and the cgroup name
224as the path relative to the root of the cgroup file system.
225
226Each cgroup is represented by a directory in the cgroup file system
227containing the following files describing that cgroup:
228
229 - tasks: list of tasks (by pid) attached to that cgroup
230 - notify_on_release flag: run /sbin/cgroup_release_agent on exit?
231
232Other subsystems such as cpusets may add additional files in each
233cgroup dir
234
235New cgroups are created using the mkdir system call or shell
236command. The properties of a cgroup, such as its flags, are
237modified by writing to the appropriate file in that cgroups
238directory, as listed above.
239
240The named hierarchical structure of nested cgroups allows partitioning
241a large system into nested, dynamically changeable, "soft-partitions".
242
243The attachment of each task, automatically inherited at fork by any
244children of that task, to a cgroup allows organizing the work load
245on a system into related sets of tasks. A task may be re-attached to
246any other cgroup, if allowed by the permissions on the necessary
247cgroup file system directories.
248
249When a task is moved from one cgroup to another, it gets a new
250css_set pointer - if there's an already existing css_set with the
251desired collection of cgroups then that group is reused, else a new
252css_set is allocated. Note that the current implementation uses a
253linear search to locate an appropriate existing css_set, so isn't
254very efficient. A future version will use a hash table for better
255performance.
256
257To 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;
259each 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
261cg_cgroup_links for a single css_set on its cg_link_list.
262
263Thus the set of tasks in a cgroup can be listed by iterating over
264each css_set that references the cgroup, and sub-iterating over
265each css_set's task set.
266
267The use of a Linux virtual file system (vfs) to represent the
268cgroup hierarchy provides for a familiar permission and name space
269for cgroups, with a minimum of additional kernel code.
270
2711.4 What does notify_on_release do ?
272------------------------------------
273
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
278whenever the last task in the cgroup leaves (exits or attaches to
279some other cgroup) and the last child cgroup of that cgroup
280is removed, then the kernel runs the command specified by the contents
281of the "release_agent" file in that hierarchy's root directory,
282supplying the pathname (relative to the mount point of the cgroup
283file system) of the abandoned cgroup. This enables automatic
284removal of abandoned cgroups. The default value of
285notify_on_release in the root cgroup at system boot is disabled
286(0). The default value of other cgroups at creation is the current
287value of their parents notify_on_release setting. The default value of
288a cgroup hierarchy's release_agent path is empty.
289
2901.5 How do I use cgroups ?
291--------------------------
292
293To start a new job that is to be contained within a cgroup, using
294the "cpuset" cgroup subsystem, the steps are something like:
295
296 1) mkdir /dev/cgroup
297 2) mount -t cgroup -ocpuset cpuset /dev/cgroup
298 3) Create the new cgroup by doing mkdir's and write's (or echo's) in
299 the /dev/cgroup virtual file system.
300 4) Start a task that will be the "founding father" of the new job.
301 5) Attach that task to the new cgroup by writing its pid to the
302 /dev/cgroup tasks file for that cgroup.
303 6) fork, exec or clone the job tasks from this founding father task.
304
305For example, the following sequence of commands will setup a cgroup
306named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
307and then start a subshell 'sh' in that cgroup:
308
309 mount -t cgroup cpuset -ocpuset /dev/cgroup
310 cd /dev/cgroup
311 mkdir Charlie
312 cd Charlie
313 /bin/echo 2-3 > cpus
314 /bin/echo 1 > mems
315 /bin/echo $$ > tasks
316 sh
317 # The subshell 'sh' is now running in cgroup Charlie
318 # The next line should display '/Charlie'
319 cat /proc/self/cgroup
320
3212. Usage Examples and Syntax
322============================
323
3242.1 Basic Usage
325---------------
326
327Creating, modifying, using the cgroups can be done through the cgroup
328virtual filesystem.
329
330To mount a cgroup hierarchy will all available subsystems, type:
331# mount -t cgroup xxx /dev/cgroup
332
333The "xxx" is not interpreted by the cgroup code, but will appear in
334/proc/mounts so may be any useful identifying string that you like.
335
336To mount a cgroup hierarchy with just the cpuset and numtasks
337subsystems, type:
338# mount -t cgroup -o cpuset,numtasks hier1 /dev/cgroup
339
340To change the set of subsystems bound to a mounted hierarchy, just
341remount with different options:
342
343# mount -o remount,cpuset,ns /dev/cgroup
344
345Note that changing the set of subsystems is currently only supported
346when the hierarchy consists of a single (root) cgroup. Supporting
347the ability to arbitrarily bind/unbind subsystems from an existing
348cgroup hierarchy is intended to be implemented in the future.
349
350Then under /dev/cgroup you can find a tree that corresponds to the
351tree of the cgroups in the system. For instance, /dev/cgroup
352is the cgroup that holds the whole system.
353
354If you want to create a new cgroup under /dev/cgroup:
355# cd /dev/cgroup
356# mkdir my_cgroup
357
358Now you want to do something with this cgroup.
359# cd my_cgroup
360
361In this directory you can find several files:
362# ls
363notify_on_release release_agent tasks
364(plus whatever files are added by the attached subsystems)
365
366Now attach your shell to this cgroup:
367# /bin/echo $$ > tasks
368
369You can also create cgroups inside your cgroup by using mkdir in this
370directory.
371# mkdir my_sub_cs
372
373To remove a cgroup, just use rmdir:
374# rmdir my_sub_cs
375
376This will fail if the cgroup is in use (has cgroups inside, or
377has processes attached, or is held alive by other subsystem-specific
378reference).
379
3802.2 Attaching processes
381-----------------------
382
383# /bin/echo PID > tasks
384
385Note that it is PID, not PIDs. You can only attach ONE task at a time.
386If you have several tasks to attach, you have to do it one after another:
387
388# /bin/echo PID1 > tasks
389# /bin/echo PID2 > tasks
390 ...
391# /bin/echo PIDn > tasks
392
3933. Kernel API
394=============
395
3963.1 Overview
397------------
398
399Each kernel subsystem that wants to hook into the generic cgroup
400system needs to create a cgroup_subsys object. This contains
401various methods, which are callbacks from the cgroup system, along
402with a subsystem id which will be assigned by the cgroup system.
403
404Other fields in the cgroup_subsys object include:
405
406- subsys_id: a unique array index for the subsystem, indicating which
407 entry in cgroup->subsys[] this subsystem should be
408 managing. Initialized by cgroup_register_subsys(); prior to this
409 it should be initialized to -1
410
411- hierarchy: an index indicating which hierarchy, if any, this
412 subsystem is currently attached to. If this is -1, then the
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
417- name: should be initialized to a unique subsystem name prior to
418 calling cgroup_register_subsystem. Should be no longer than
419 MAX_CGROUP_TYPE_NAMELEN
420
421Each cgroup object created by the system has an array of pointers,
422indexed by subsystem id; this pointer is entirely managed by the
423subsystem; the generic cgroup code will never touch this pointer.
424
4253.2 Synchronization
426-------------------
427
428There is a global mutex, cgroup_mutex, used by the cgroup
429system. This should be taken by anything that wants to modify a
430cgroup. It may also be taken to prevent cgroups from being
431modified, but more specific locks may be more appropriate in that
432situation.
433
434See kernel/cgroup.c for more details.
435
436Subsystems 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().
440
441Accessing a task's cgroup pointer may be done in the following ways:
442- while holding cgroup_mutex
443- while holding the task's alloc_lock (via task_lock())
444- inside an rcu_read_lock() section via rcu_dereference()
445
4463.3 Subsystem API
447--------------------------
448
449Each subsystem should:
450
451- add an entry in linux/cgroup_subsys.h
452- define a cgroup_subsys object called <name>_subsys
453
454Each subsystem may export the following methods. The only mandatory
455methods are create/destroy. Any others that are null are presumed to
456be successful no-ops.
457
458struct cgroup_subsys_state *create(struct cgroup *cont)
459LL=cgroup_mutex
460
461Called to create a subsystem state object for a cgroup. The
462subsystem should allocate its subsystem state object for the passed
463cgroup, returning a pointer to the new object on success or a
464negative error code. On success, the subsystem pointer should point to
465a structure of type cgroup_subsys_state (typically embedded in a
466larger subsystem-specific object), which will be initialized by the
467cgroup system. Note that this will be called at initialization to
468create the root subsystem state for this subsystem; this case can be
469identified by the passed cgroup object having a NULL parent (since
470it's the root of the hierarchy) and may be an appropriate place for
471initialization code.
472
473void destroy(struct cgroup *cont)
474LL=cgroup_mutex
475
476The cgroup system is about to destroy the passed cgroup; the
477subsystem should do any necessary cleanup
478
479int can_attach(struct cgroup_subsys *ss, struct cgroup *cont,
480 struct task_struct *task)
481LL=cgroup_mutex
482
483Called prior to moving a task into a cgroup; if the subsystem
484returns an error, this will abort the attach operation. If a NULL
485task is passed, then a successful result indicates that *any*
486unspecified task can be moved into the cgroup. Note that this isn't
487called on a fork. If this method returns 0 (success) then this should
488remain valid while the caller holds cgroup_mutex.
489
490void attach(struct cgroup_subsys *ss, struct cgroup *cont,
491 struct cgroup *old_cont, struct task_struct *task)
492LL=cgroup_mutex
493
494
495Called after the task has been attached to the cgroup, to allow any
496post-attachment activity that requires memory allocations or blocking.
497
498void fork(struct cgroup_subsy *ss, struct task_struct *task)
499LL=callback_mutex, maybe read_lock(tasklist_lock)
500
501Called when a task is forked into a cgroup. Also called during
502registration for all existing tasks.
503
504void exit(struct cgroup_subsys *ss, struct task_struct *task)
505LL=callback_mutex
506
507Called during task exit
508
509int populate(struct cgroup_subsys *ss, struct cgroup *cont)
510LL=none
511
512Called after creation of a cgroup to allow a subsystem to populate
513the cgroup directory with file entries. The subsystem should make
514calls to cgroup_add_file() with objects of type cftype (see
515include/linux/cgroup.h for details). Note that although this
516method can return an error code, the error code is currently not
517always handled well.
518
519void post_clone(struct cgroup_subsys *ss, struct cgroup *cont)
520
521Called at the end of cgroup_clone() to do any paramater
522initialization which might be required before a task could attach. For
523example in cpusets, no task may attach before 'cpus' and 'mems' are set
524up.
525
526void bind(struct cgroup_subsys *ss, struct cgroup *root)
527LL=callback_mutex
528
529Called when a cgroup subsystem is rebound to a different hierarchy
530and root cgroup. Currently this will only involve movement between
531the default hierarchy (which never has sub-cgroups) and a hierarchy
532that is being created/destroyed (and hence has no sub-cgroups).
533
5344. Questions
535============
536
537Q: what's up with this '/bin/echo' ?
538A: bash's builtin 'echo' command does not check calls to write() against
539 errors. If you use it in the cgroup file system, you won't be
540 able to tell whether a command succeeded or failed.
541
542Q: When I attach processes, only the first of the line gets really attached !
543A: We can only return one error code per call to write(). So you should also
544 put only ONE pid.
545
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index b6d24c22274b..a741f658a3c9 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -220,7 +220,9 @@ A: The following happen, listed in no particular order :-)
220 CPU_DOWN_PREPARE or CPU_DOWN_PREPARE_FROZEN, depending on whether or not the 220 CPU_DOWN_PREPARE or CPU_DOWN_PREPARE_FROZEN, depending on whether or not the
221 CPU is being offlined while tasks are frozen due to a suspend operation in 221 CPU is being offlined while tasks are frozen due to a suspend operation in
222 progress 222 progress
223- All process is migrated away from this outgoing CPU to a new CPU 223- All processes are migrated away from this outgoing CPU to new CPUs.
224 The new CPU is chosen from each process' current cpuset, which may be
225 a subset of all online CPUs.
224- All interrupts targeted to this CPU is migrated to a new CPU 226- All interrupts targeted to this CPU is migrated to a new CPU
225- timers/bottom half/task lets are also migrated to a new CPU 227- timers/bottom half/task lets are also migrated to a new CPU
226- Once all services are migrated, kernel calls an arch specific routine 228- Once all services are migrated, kernel calls an arch specific routine
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index ec9de6917f01..141bef1c8599 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -7,6 +7,7 @@ Written by Simon.Derr@bull.net
7Portions Copyright (c) 2004-2006 Silicon Graphics, Inc. 7Portions Copyright (c) 2004-2006 Silicon Graphics, Inc.
8Modified by Paul Jackson <pj@sgi.com> 8Modified by Paul Jackson <pj@sgi.com>
9Modified by Christoph Lameter <clameter@sgi.com> 9Modified by Christoph Lameter <clameter@sgi.com>
10Modified by Paul Menage <menage@google.com>
10 11
11CONTENTS: 12CONTENTS:
12========= 13=========
@@ -16,9 +17,9 @@ CONTENTS:
16 1.2 Why are cpusets needed ? 17 1.2 Why are cpusets needed ?
17 1.3 How are cpusets implemented ? 18 1.3 How are cpusets implemented ?
18 1.4 What are exclusive cpusets ? 19 1.4 What are exclusive cpusets ?
19 1.5 What does notify_on_release do ? 20 1.5 What is memory_pressure ?
20 1.6 What is memory_pressure ? 21 1.6 What is memory spread ?
21 1.7 What is memory spread ? 22 1.7 What is sched_load_balance ?
22 1.8 How do I use cpusets ? 23 1.8 How do I use cpusets ?
232. Usage Examples and Syntax 242. Usage Examples and Syntax
24 2.1 Basic Usage 25 2.1 Basic Usage
@@ -44,18 +45,19 @@ hierarchy visible in a virtual file system. These are the essential
44hooks, beyond what is already present, required to manage dynamic 45hooks, beyond what is already present, required to manage dynamic
45job placement on large systems. 46job placement on large systems.
46 47
47Each task has a pointer to a cpuset. Multiple tasks may reference 48Cpusets use the generic cgroup subsystem described in
48the same cpuset. Requests by a task, using the sched_setaffinity(2) 49Documentation/cgroup.txt.
49system call to include CPUs in its CPU affinity mask, and using the 50
50mbind(2) and set_mempolicy(2) system calls to include Memory Nodes 51Requests by a task, using the sched_setaffinity(2) system call to
51in its memory policy, are both filtered through that tasks cpuset, 52include CPUs in its CPU affinity mask, and using the mbind(2) and
52filtering out any CPUs or Memory Nodes not in that cpuset. The 53set_mempolicy(2) system calls to include Memory Nodes in its memory
53scheduler will not schedule a task on a CPU that is not allowed in 54policy, are both filtered through that tasks cpuset, filtering out any
54its cpus_allowed vector, and the kernel page allocator will not 55CPUs or Memory Nodes not in that cpuset. The scheduler will not
55allocate a page on a node that is not allowed in the requesting tasks 56schedule a task on a CPU that is not allowed in its cpus_allowed
56mems_allowed vector. 57vector, and the kernel page allocator will not allocate a page on a
57 58node that is not allowed in the requesting tasks mems_allowed vector.
58User level code may create and destroy cpusets by name in the cpuset 59
60User level code may create and destroy cpusets by name in the cgroup
59virtual file system, manage the attributes and permissions of these 61virtual file system, manage the attributes and permissions of these
60cpusets and which CPUs and Memory Nodes are assigned to each cpuset, 62cpusets and which CPUs and Memory Nodes are assigned to each cpuset,
61specify and query to which cpuset a task is assigned, and list the 63specify and query to which cpuset a task is assigned, and list the
@@ -115,7 +117,7 @@ Cpusets extends these two mechanisms as follows:
115 - Cpusets are sets of allowed CPUs and Memory Nodes, known to the 117 - Cpusets are sets of allowed CPUs and Memory Nodes, known to the
116 kernel. 118 kernel.
117 - Each task in the system is attached to a cpuset, via a pointer 119 - Each task in the system is attached to a cpuset, via a pointer
118 in the task structure to a reference counted cpuset structure. 120 in the task structure to a reference counted cgroup structure.
119 - Calls to sched_setaffinity are filtered to just those CPUs 121 - Calls to sched_setaffinity are filtered to just those CPUs
120 allowed in that tasks cpuset. 122 allowed in that tasks cpuset.
121 - Calls to mbind and set_mempolicy are filtered to just 123 - Calls to mbind and set_mempolicy are filtered to just
@@ -145,15 +147,10 @@ into the rest of the kernel, none in performance critical paths:
145 - in page_alloc.c, to restrict memory to allowed nodes. 147 - in page_alloc.c, to restrict memory to allowed nodes.
146 - in vmscan.c, to restrict page recovery to the current cpuset. 148 - in vmscan.c, to restrict page recovery to the current cpuset.
147 149
148In addition a new file system, of type "cpuset" may be mounted, 150You should mount the "cgroup" filesystem type in order to enable
149typically at /dev/cpuset, to enable browsing and modifying the cpusets 151browsing and modifying the cpusets presently known to the kernel. No
150presently known to the kernel. No new system calls are added for 152new system calls are added for cpusets - all support for querying and
151cpusets - all support for querying and modifying cpusets is via 153modifying cpusets is via this cpuset file system.
152this cpuset file system.
153
154Each task under /proc has an added file named 'cpuset', displaying
155the cpuset name, as the path relative to the root of the cpuset file
156system.
157 154
158The /proc/<pid>/status file for each task has two added lines, 155The /proc/<pid>/status file for each task has two added lines,
159displaying the tasks cpus_allowed (on which CPUs it may be scheduled) 156displaying the tasks cpus_allowed (on which CPUs it may be scheduled)
@@ -163,16 +160,15 @@ in the format seen in the following example:
163 Cpus_allowed: ffffffff,ffffffff,ffffffff,ffffffff 160 Cpus_allowed: ffffffff,ffffffff,ffffffff,ffffffff
164 Mems_allowed: ffffffff,ffffffff 161 Mems_allowed: ffffffff,ffffffff
165 162
166Each cpuset is represented by a directory in the cpuset file system 163Each cpuset is represented by a directory in the cgroup file system
167containing the following files describing that cpuset: 164containing (on top of the standard cgroup files) the following
165files describing that cpuset:
168 166
169 - cpus: list of CPUs in that cpuset 167 - cpus: list of CPUs in that cpuset
170 - mems: list of Memory Nodes in that cpuset 168 - mems: list of Memory Nodes in that cpuset
171 - memory_migrate flag: if set, move pages to cpusets nodes 169 - memory_migrate flag: if set, move pages to cpusets nodes
172 - cpu_exclusive flag: is cpu placement exclusive? 170 - cpu_exclusive flag: is cpu placement exclusive?
173 - mem_exclusive flag: is memory placement exclusive? 171 - mem_exclusive flag: is memory placement exclusive?
174 - tasks: list of tasks (by pid) attached to that cpuset
175 - notify_on_release flag: run /sbin/cpuset_release_agent on exit?
176 - memory_pressure: measure of how much paging pressure in cpuset 172 - memory_pressure: measure of how much paging pressure in cpuset
177 173
178In addition, the root cpuset only has the following file: 174In addition, the root cpuset only has the following file:
@@ -237,21 +233,7 @@ such as requests from interrupt handlers, is allowed to be taken
237outside even a mem_exclusive cpuset. 233outside even a mem_exclusive cpuset.
238 234
239 235
2401.5 What does notify_on_release do ? 2361.5 What is memory_pressure ?
241------------------------------------
242
243If the notify_on_release flag is enabled (1) in a cpuset, then whenever
244the last task in the cpuset leaves (exits or attaches to some other
245cpuset) and the last child cpuset of that cpuset is removed, then
246the kernel runs the command /sbin/cpuset_release_agent, supplying the
247pathname (relative to the mount point of the cpuset file system) of the
248abandoned cpuset. This enables automatic removal of abandoned cpusets.
249The default value of notify_on_release in the root cpuset at system
250boot is disabled (0). The default value of other cpusets at creation
251is the current value of their parents notify_on_release setting.
252
253
2541.6 What is memory_pressure ?
255----------------------------- 237-----------------------------
256The memory_pressure of a cpuset provides a simple per-cpuset metric 238The memory_pressure of a cpuset provides a simple per-cpuset metric
257of the rate that the tasks in a cpuset are attempting to free up in 239of the rate that the tasks in a cpuset are attempting to free up in
@@ -308,7 +290,7 @@ the tasks in the cpuset, in units of reclaims attempted per second,
308times 1000. 290times 1000.
309 291
310 292
3111.7 What is memory spread ? 2931.6 What is memory spread ?
312--------------------------- 294---------------------------
313There are two boolean flag files per cpuset that control where the 295There are two boolean flag files per cpuset that control where the
314kernel allocates pages for the file system buffers and related in 296kernel allocates pages for the file system buffers and related in
@@ -378,6 +360,142 @@ policy, especially for jobs that might have one thread reading in the
378data set, the memory allocation across the nodes in the jobs cpuset 360data set, the memory allocation across the nodes in the jobs cpuset
379can become very uneven. 361can become very uneven.
380 362
3631.7 What is sched_load_balance ?
364--------------------------------
365
366The kernel scheduler (kernel/sched.c) automatically load balances
367tasks. If one CPU is underutilized, kernel code running on that
368CPU will look for tasks on other more overloaded CPUs and move those
369tasks to itself, within the constraints of such placement mechanisms
370as cpusets and sched_setaffinity.
371
372The algorithmic cost of load balancing and its impact on key shared
373kernel data structures such as the task list increases more than
374linearly with the number of CPUs being balanced. So the scheduler
375has support to partition the systems CPUs into a number of sched
376domains such that it only load balances within each sched domain.
377Each sched domain covers some subset of the CPUs in the system;
378no two sched domains overlap; some CPUs might not be in any sched
379domain and hence won't be load balanced.
380
381Put simply, it costs less to balance between two smaller sched domains
382than one big one, but doing so means that overloads in one of the
383two domains won't be load balanced to the other one.
384
385By default, there is one sched domain covering all CPUs, except those
386marked isolated using the kernel boot time "isolcpus=" argument.
387
388This default load balancing across all CPUs is not well suited for
389the following two situations:
390 1) On large systems, load balancing across many CPUs is expensive.
391 If the system is managed using cpusets to place independent jobs
392 on separate sets of CPUs, full load balancing is unnecessary.
393 2) Systems supporting realtime on some CPUs need to minimize
394 system overhead on those CPUs, including avoiding task load
395 balancing if that is not needed.
396
397When the per-cpuset flag "sched_load_balance" is enabled (the default
398setting), it requests that all the CPUs in that cpusets allowed 'cpus'
399be contained in a single sched domain, ensuring that load balancing
400can move a task (not otherwised pinned, as by sched_setaffinity)
401from any CPU in that cpuset to any other.
402
403When the per-cpuset flag "sched_load_balance" is disabled, then the
404scheduler will avoid load balancing across the CPUs in that cpuset,
405--except-- in so far as is necessary because some overlapping cpuset
406has "sched_load_balance" enabled.
407
408So, for example, if the top cpuset has the flag "sched_load_balance"
409enabled, then the scheduler will have one sched domain covering all
410CPUs, and the setting of the "sched_load_balance" flag in any other
411cpusets won't matter, as we're already fully load balancing.
412
413Therefore in the above two situations, the top cpuset flag
414"sched_load_balance" should be disabled, and only some of the smaller,
415child cpusets have this flag enabled.
416
417When doing this, you don't usually want to leave any unpinned tasks in
418the top cpuset that might use non-trivial amounts of CPU, as such tasks
419may be artificially constrained to some subset of CPUs, depending on
420the particulars of this flag setting in descendent cpusets. Even if
421such a task could use spare CPU cycles in some other CPUs, the kernel
422scheduler might not consider the possibility of load balancing that
423task to that underused CPU.
424
425Of course, tasks pinned to a particular CPU can be left in a cpuset
426that disables "sched_load_balance" as those tasks aren't going anywhere
427else anyway.
428
429There is an impedance mismatch here, between cpusets and sched domains.
430Cpusets are hierarchical and nest. Sched domains are flat; they don't
431overlap and each CPU is in at most one sched domain.
432
433It is necessary for sched domains to be flat because load balancing
434across partially overlapping sets of CPUs would risk unstable dynamics
435that would be beyond our understanding. So if each of two partially
436overlapping cpusets enables the flag 'sched_load_balance', then we
437form a single sched domain that is a superset of both. We won't move
438a task to a CPU outside it cpuset, but the scheduler load balancing
439code might waste some compute cycles considering that possibility.
440
441This mismatch is why there is not a simple one-to-one relation
442between which cpusets have the flag "sched_load_balance" enabled,
443and the sched domain configuration. If a cpuset enables the flag, it
444will get balancing across all its CPUs, but if it disables the flag,
445it will only be assured of no load balancing if no other overlapping
446cpuset enables the flag.
447
448If two cpusets have partially overlapping 'cpus' allowed, and only
449one of them has this flag enabled, then the other may find its
450tasks only partially load balanced, just on the overlapping CPUs.
451This is just the general case of the top_cpuset example given a few
452paragraphs above. In the general case, as in the top cpuset case,
453don't leave tasks that might use non-trivial amounts of CPU in
454such partially load balanced cpusets, as they may be artificially
455constrained to some subset of the CPUs allowed to them, for lack of
456load balancing to the other CPUs.
457
4581.7.1 sched_load_balance implementation details.
459------------------------------------------------
460
461The per-cpuset flag 'sched_load_balance' defaults to enabled (contrary
462to most cpuset flags.) When enabled for a cpuset, the kernel will
463ensure that it can load balance across all the CPUs in that cpuset
464(makes sure that all the CPUs in the cpus_allowed of that cpuset are
465in the same sched domain.)
466
467If two overlapping cpusets both have 'sched_load_balance' enabled,
468then they will be (must be) both in the same sched domain.
469
470If, as is the default, the top cpuset has 'sched_load_balance' enabled,
471then by the above that means there is a single sched domain covering
472the whole system, regardless of any other cpuset settings.
473
474The kernel commits to user space that it will avoid load balancing
475where it can. It will pick as fine a granularity partition of sched
476domains as it can while still providing load balancing for any set
477of CPUs allowed to a cpuset having 'sched_load_balance' enabled.
478
479The internal kernel cpuset to scheduler interface passes from the
480cpuset code to the scheduler code a partition of the load balanced
481CPUs in the system. This partition is a set of subsets (represented
482as an array of cpumask_t) of CPUs, pairwise disjoint, that cover all
483the CPUs that must be load balanced.
484
485Whenever the 'sched_load_balance' flag changes, or CPUs come or go
486from a cpuset with this flag enabled, or a cpuset with this flag
487enabled is removed, the cpuset code builds a new such partition and
488passes it to the scheduler sched domain setup code, to have the sched
489domains rebuilt as necessary.
490
491This partition exactly defines what sched domains the scheduler should
492setup - one sched domain for each element (cpumask_t) in the partition.
493
494The scheduler remembers the currently active sched domain partitions.
495When the scheduler routine partition_sched_domains() is invoked from
496the cpuset code to update these sched domains, it compares the new
497partition requested with the current, and updates its sched domains,
498removing the old and adding the new, for each change.
381 499
3821.8 How do I use cpusets ? 5001.8 How do I use cpusets ?
383-------------------------- 501--------------------------
@@ -469,7 +587,7 @@ than stress the kernel.
469To start a new job that is to be contained within a cpuset, the steps are: 587To start a new job that is to be contained within a cpuset, the steps are:
470 588
471 1) mkdir /dev/cpuset 589 1) mkdir /dev/cpuset
472 2) mount -t cpuset none /dev/cpuset 590 2) mount -t cgroup -ocpuset cpuset /dev/cpuset
473 3) Create the new cpuset by doing mkdir's and write's (or echo's) in 591 3) Create the new cpuset by doing mkdir's and write's (or echo's) in
474 the /dev/cpuset virtual file system. 592 the /dev/cpuset virtual file system.
475 4) Start a task that will be the "founding father" of the new job. 593 4) Start a task that will be the "founding father" of the new job.
@@ -481,7 +599,7 @@ For example, the following sequence of commands will setup a cpuset
481named "Charlie", containing just CPUs 2 and 3, and Memory Node 1, 599named "Charlie", containing just CPUs 2 and 3, and Memory Node 1,
482and then start a subshell 'sh' in that cpuset: 600and then start a subshell 'sh' in that cpuset:
483 601
484 mount -t cpuset none /dev/cpuset 602 mount -t cgroup -ocpuset cpuset /dev/cpuset
485 cd /dev/cpuset 603 cd /dev/cpuset
486 mkdir Charlie 604 mkdir Charlie
487 cd Charlie 605 cd Charlie
@@ -513,7 +631,7 @@ Creating, modifying, using the cpusets can be done through the cpuset
513virtual filesystem. 631virtual filesystem.
514 632
515To mount it, type: 633To mount it, type:
516# mount -t cpuset none /dev/cpuset 634# mount -t cgroup -o cpuset cpuset /dev/cpuset
517 635
518Then under /dev/cpuset you can find a tree that corresponds to the 636Then under /dev/cpuset you can find a tree that corresponds to the
519tree of the cpusets in the system. For instance, /dev/cpuset 637tree of the cpusets in the system. For instance, /dev/cpuset
@@ -556,6 +674,18 @@ To remove a cpuset, just use rmdir:
556This will fail if the cpuset is in use (has cpusets inside, or has 674This will fail if the cpuset is in use (has cpusets inside, or has
557processes attached). 675processes attached).
558 676
677Note that for legacy reasons, the "cpuset" filesystem exists as a
678wrapper around the cgroup filesystem.
679
680The command
681
682mount -t cpuset X /dev/cpuset
683
684is equivalent to
685
686mount -t cgroup -ocpuset X /dev/cpuset
687echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent
688
5592.2 Adding/removing cpus 6892.2 Adding/removing cpus
560------------------------ 690------------------------
561 691
diff --git a/Documentation/device-mapper/dm-uevent.txt b/Documentation/device-mapper/dm-uevent.txt
new file mode 100644
index 000000000000..07edbd85c714
--- /dev/null
+++ b/Documentation/device-mapper/dm-uevent.txt
@@ -0,0 +1,97 @@
1The device-mapper uevent code adds the capability to device-mapper to create
2and send kobject uevents (uevents). Previously device-mapper events were only
3available through the ioctl interface. The advantage of the uevents interface
4is the event contains environment attributes providing increased context for
5the event avoiding the need to query the state of the device-mapper device after
6the event is received.
7
8There are two functions currently for device-mapper events. The first function
9listed creates the event and the second function sends the event(s).
10
11void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
12 const char *path, unsigned nr_valid_paths)
13
14void dm_send_uevents(struct list_head *events, struct kobject *kobj)
15
16
17The variables added to the uevent environment are:
18
19Variable Name: DM_TARGET
20Uevent Action(s): KOBJ_CHANGE
21Type: string
22Description:
23Value: Name of device-mapper target that generated the event.
24
25Variable Name: DM_ACTION
26Uevent Action(s): KOBJ_CHANGE
27Type: string
28Description:
29Value: Device-mapper specific action that caused the uevent action.
30 PATH_FAILED - A path has failed.
31 PATH_REINSTATED - A path has been reinstated.
32
33Variable Name: DM_SEQNUM
34Uevent Action(s): KOBJ_CHANGE
35Type: unsigned integer
36Description: A sequence number for this specific device-mapper device.
37Value: Valid unsigned integer range.
38
39Variable Name: DM_PATH
40Uevent Action(s): KOBJ_CHANGE
41Type: string
42Description: Major and minor number of the path device pertaining to this
43event.
44Value: Path name in the form of "Major:Minor"
45
46Variable Name: DM_NR_VALID_PATHS
47Uevent Action(s): KOBJ_CHANGE
48Type: unsigned integer
49Description:
50Value: Valid unsigned integer range.
51
52Variable Name: DM_NAME
53Uevent Action(s): KOBJ_CHANGE
54Type: string
55Description: Name of the device-mapper device.
56Value: Name
57
58Variable Name: DM_UUID
59Uevent Action(s): KOBJ_CHANGE
60Type: string
61Description: UUID of the device-mapper device.
62Value: UUID. (Empty string if there isn't one.)
63
64An example of the uevents generated as captured by udevmonitor is shown
65below.
66
671.) Path failure.
68UEVENT[1192521009.711215] change@/block/dm-3
69ACTION=change
70DEVPATH=/block/dm-3
71SUBSYSTEM=block
72DM_TARGET=multipath
73DM_ACTION=PATH_FAILED
74DM_SEQNUM=1
75DM_PATH=8:32
76DM_NR_VALID_PATHS=0
77DM_NAME=mpath2
78DM_UUID=mpath-35333333000002328
79MINOR=3
80MAJOR=253
81SEQNUM=1130
82
832.) Path reinstate.
84UEVENT[1192521132.989927] change@/block/dm-3
85ACTION=change
86DEVPATH=/block/dm-3
87SUBSYSTEM=block
88DM_TARGET=multipath
89DM_ACTION=PATH_REINSTATED
90DM_SEQNUM=2
91DM_PATH=8:32
92DM_NR_VALID_PATHS=1
93DM_NAME=mpath2
94DM_UUID=mpath-35333333000002328
95MINOR=3
96MAJOR=253
97SEQNUM=1131
diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index 6c46730c631a..e6244cde26e9 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -2188,7 +2188,7 @@ Your cooperation is appreciated.
2188 2188
2189136-143 char Unix98 PTY slaves 2189136-143 char Unix98 PTY slaves
2190 0 = /dev/pts/0 First Unix98 pseudo-TTY 2190 0 = /dev/pts/0 First Unix98 pseudo-TTY
2191 1 = /dev/pts/1 Second Unix98 pesudo-TTY 2191 1 = /dev/pts/1 Second Unix98 pseudo-TTY
2192 ... 2192 ...
2193 2193
2194 These device nodes are automatically generated with 2194 These device nodes are automatically generated with
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt
index 8569072fa387..387b8a720f4a 100644
--- a/Documentation/driver-model/devres.txt
+++ b/Documentation/driver-model/devres.txt
@@ -32,7 +32,7 @@ braindamaged document, if it's finally working, well, it's working.
32 32
33For one reason or another, low level drivers don't receive as much 33For one reason or another, low level drivers don't receive as much
34attention or testing as core code, and bugs on driver detach or 34attention or testing as core code, and bugs on driver detach or
35initilaization failure doesn't happen often enough to be noticeable. 35initialization failure don't happen often enough to be noticeable.
36Init failure path is worse because it's much less travelled while 36Init failure path is worse because it's much less travelled while
37needs to handle multiple entry points. 37needs to handle multiple entry points.
38 38
@@ -160,7 +160,7 @@ resources on failure. For example,
160 devres_release_group(dev, NULL); 160 devres_release_group(dev, NULL);
161 return err_code; 161 return err_code;
162 162
163As resource acquision failure usually means probe failure, constructs 163As resource acquisition failure usually means probe failure, constructs
164like above are usually useful in midlayer driver (e.g. libata core 164like above are usually useful in midlayer driver (e.g. libata core
165layer) where interface function shouldn't have side effect on failure. 165layer) where interface function shouldn't have side effect on failure.
166For LLDs, just returning error code suffices in most cases. 166For LLDs, just returning error code suffices in most cases.
diff --git a/Documentation/fb/deferred_io.txt b/Documentation/fb/deferred_io.txt
index 73cf9fb7cf60..63883a892120 100644
--- a/Documentation/fb/deferred_io.txt
+++ b/Documentation/fb/deferred_io.txt
@@ -3,7 +3,7 @@ Deferred IO
3 3
4Deferred IO is a way to delay and repurpose IO. It uses host memory as a 4Deferred IO is a way to delay and repurpose IO. It uses host memory as a
5buffer and the MMU pagefault as a pretrigger for when to perform the device 5buffer and the MMU pagefault as a pretrigger for when to perform the device
6IO. The following example may be a useful explaination of how one such setup 6IO. The following example may be a useful explanation of how one such setup
7works: 7works:
8 8
9- userspace app like Xfbdev mmaps framebuffer 9- userspace app like Xfbdev mmaps framebuffer
@@ -28,7 +28,7 @@ a relatively more expensive operation.
28 28
29For some types of nonvolatile high latency displays, the desired image is 29For some types of nonvolatile high latency displays, the desired image is
30the final image rather than the intermediate stages which is why it's okay 30the final image rather than the intermediate stages which is why it's okay
31to not update for each write that is occuring. 31to not update for each write that is occurring.
32 32
33It may be the case that this is useful in other scenarios as well. Paul Mundt 33It may be the case that this is useful in other scenarios as well. Paul Mundt
34has mentioned a case where it is beneficial to use the page count to decide 34has mentioned a case where it is beneficial to use the page count to decide
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 280ec06573e6..6b0f963f5379 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -82,6 +82,41 @@ Who: Dominik Brodowski <linux@brodo.de>
82 82
83--------------------------- 83---------------------------
84 84
85What: sys_sysctl
86When: September 2010
87Option: CONFIG_SYSCTL_SYSCALL
88Why: The same information is available in a more convenient from
89 /proc/sys, and none of the sysctl variables appear to be
90 important performance wise.
91
92 Binary sysctls are a long standing source of subtle kernel
93 bugs and security issues.
94
95 When I looked several months ago all I could find after
96 searching several distributions were 5 user space programs and
97 glibc (which falls back to /proc/sys) using this syscall.
98
99 The man page for sysctl(2) documents it as unusable for user
100 space programs.
101
102 sysctl(2) is not generally ABI compatible to a 32bit user
103 space application on a 64bit and a 32bit kernel.
104
105 For the last several months the policy has been no new binary
106 sysctls and no one has put forward an argument to use them.
107
108 Binary sysctls issues seem to keep happening appearing so
109 properly deprecating them (with a warning to user space) and a
110 2 year grace warning period will mean eventually we can kill
111 them and end the pain.
112
113 In the mean time individual binary sysctls can be dealt with
114 in a piecewise fashion.
115
116Who: Eric Biederman <ebiederm@xmission.com>
117
118---------------------------
119
85What: a.out interpreter support for ELF executables 120What: a.out interpreter support for ELF executables
86When: 2.6.25 121When: 2.6.25
87Files: fs/binfmt_elf.c 122Files: fs/binfmt_elf.c
@@ -184,13 +219,6 @@ Who: Jean Delvare <khali@linux-fr.org>,
184 219
185--------------------------- 220---------------------------
186 221
187What: drivers depending on OBSOLETE_OSS
188When: options in 2.6.22, code in 2.6.24
189Why: OSS drivers with ALSA replacements
190Who: Adrian Bunk <bunk@stusta.de>
191
192---------------------------
193
194What: ACPI procfs interface 222What: ACPI procfs interface
195When: July 2008 223When: July 2008
196Why: ACPI sysfs conversion should be finished by January 2008. 224Why: ACPI sysfs conversion should be finished by January 2008.
diff --git a/Documentation/filesystems/9p.txt b/Documentation/filesystems/9p.txt
index d6fd6c6e4244..b90f537af35c 100644
--- a/Documentation/filesystems/9p.txt
+++ b/Documentation/filesystems/9p.txt
@@ -54,7 +54,7 @@ OPTIONS
54 aname=name aname specifies the file tree to access when the server is 54 aname=name aname specifies the file tree to access when the server is
55 offering several exported file systems. 55 offering several exported file systems.
56 56
57 cache=mode specifies a cacheing policy. By default, no caches are used. 57 cache=mode specifies a caching policy. By default, no caches are used.
58 loose = no attempts are made at consistency, 58 loose = no attempts are made at consistency,
59 intended for exclusive, read-only mounts 59 intended for exclusive, read-only mounts
60 60
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index fe26cc978523..37c10cba7177 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -224,7 +224,7 @@ against the page the filesystem should redirty the page with
224redirty_page_for_writepage(), then unlock the page and return zero. 224redirty_page_for_writepage(), then unlock the page and return zero.
225This may also be done to avoid internal deadlocks, but rarely. 225This may also be done to avoid internal deadlocks, but rarely.
226 226
227If the filesytem is called for sync then it must wait on any 227If the filesystem is called for sync then it must wait on any
228in-progress I/O and then start new I/O. 228in-progress I/O and then start new I/O.
229 229
230The filesystem should unlock the page synchronously, before returning to the 230The filesystem should unlock the page synchronously, before returning to the
diff --git a/Documentation/filesystems/ext3.txt b/Documentation/filesystems/ext3.txt
index 4aecc9bdb273..b45f3c1b8b43 100644
--- a/Documentation/filesystems/ext3.txt
+++ b/Documentation/filesystems/ext3.txt
@@ -130,12 +130,12 @@ Device layer.
130 130
131Journaling Block Device layer 131Journaling Block Device layer
132----------------------------- 132-----------------------------
133The Journaling Block Device layer (JBD) isn't ext3 specific. It was design to 133The Journaling Block Device layer (JBD) isn't ext3 specific. It was designed
134add journaling capabilities on a block device. The ext3 filesystem code will 134to add journaling capabilities to a block device. The ext3 filesystem code
135inform the JBD of modifications it is performing (called a transaction). The 135will inform the JBD of modifications it is performing (called a transaction).
136journal supports the transactions start and stop, and in case of crash, the 136The journal supports the transactions start and stop, and in case of a crash,
137journal can replayed the transactions to put the partition back in a 137the journal can replay the transactions to quickly put the partition back into
138consistent state fast. 138a consistent state.
139 139
140Handles represent a single atomic update to a filesystem. JBD can handle an 140Handles represent a single atomic update to a filesystem. JBD can handle an
141external journal on a block device. 141external journal on a block device.
@@ -164,7 +164,7 @@ written to the journal first, and then to its final location.
164In the event of a crash, the journal can be replayed, bringing both data and 164In the event of a crash, the journal can be replayed, bringing both data and
165metadata into a consistent state. This mode is the slowest except when data 165metadata into a consistent state. This mode is the slowest except when data
166needs to be read from and written to disk at the same time where it 166needs to be read from and written to disk at the same time where it
167outperforms all others modes. 167outperforms all other modes.
168 168
169Compatibility 169Compatibility
170------------- 170-------------
diff --git a/Documentation/filesystems/files.txt b/Documentation/filesystems/files.txt
index 133e213ebb72..bb0142f61084 100644
--- a/Documentation/filesystems/files.txt
+++ b/Documentation/filesystems/files.txt
@@ -76,13 +76,13 @@ the fdtable structure -
765. Handling of the file structures is special. Since the look-up 765. Handling of the file structures is special. Since the look-up
77 of the fd (fget()/fget_light()) are lock-free, it is possible 77 of the fd (fget()/fget_light()) are lock-free, it is possible
78 that look-up may race with the last put() operation on the 78 that look-up may race with the last put() operation on the
79 file structure. This is avoided using the rcuref APIs 79 file structure. This is avoided using atomic_inc_not_zero()
80 on ->f_count : 80 on ->f_count :
81 81
82 rcu_read_lock(); 82 rcu_read_lock();
83 file = fcheck_files(files, fd); 83 file = fcheck_files(files, fd);
84 if (file) { 84 if (file) {
85 if (rcuref_inc_lf(&file->f_count)) 85 if (atomic_inc_not_zero(&file->f_count))
86 *fput_needed = 1; 86 *fput_needed = 1;
87 else 87 else
88 /* Didn't get the reference, someone's freed */ 88 /* Didn't get the reference, someone's freed */
@@ -92,7 +92,7 @@ the fdtable structure -
92 .... 92 ....
93 return file; 93 return file;
94 94
95 rcuref_inc_lf() detects if refcounts is already zero or 95 atomic_inc_not_zero() detects if refcounts is already zero or
96 goes to zero during increment. If it does, we fail 96 goes to zero during increment. If it does, we fail
97 fget()/fget_light(). 97 fget()/fget_light().
98 98
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index e5c1df52a876..dec99455321f 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -813,9 +813,9 @@ Various pieces of information about kernel activity are available in the
813since the system first booted. For a quick look, simply cat the file: 813since the system first booted. For a quick look, simply cat the file:
814 814
815 > cat /proc/stat 815 > cat /proc/stat
816 cpu 2255 34 2290 22625563 6290 127 456 816 cpu 2255 34 2290 22625563 6290 127 456 0
817 cpu0 1132 34 1441 11311718 3675 127 438 817 cpu0 1132 34 1441 11311718 3675 127 438 0
818 cpu1 1123 0 849 11313845 2614 0 18 818 cpu1 1123 0 849 11313845 2614 0 18 0
819 intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...] 819 intr 114930548 113199788 3 0 5 263 0 4 [... lots more numbers ...]
820 ctxt 1990473 820 ctxt 1990473
821 btime 1062191376 821 btime 1062191376
@@ -835,6 +835,7 @@ second). The meanings of the columns are as follows, from left to right:
835- iowait: waiting for I/O to complete 835- iowait: waiting for I/O to complete
836- irq: servicing interrupts 836- irq: servicing interrupts
837- softirq: servicing softirqs 837- softirq: servicing softirqs
838- steal: involuntary wait
838 839
839The "intr" line gives counts of interrupts serviced since boot time, for each 840The "intr" line gives counts of interrupts serviced since boot time, for each
840of the possible system interrupts. The first column is the total of all 841of the possible system interrupts. The first column is the total of all
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index 4b5ca26e5048..4598ef7b622b 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -51,7 +51,7 @@ for the attributes, providing a means to read and write kernel
51attributes. 51attributes.
52 52
53Attributes should be ASCII text files, preferably with only one value 53Attributes should be ASCII text files, preferably with only one value
54per file. It is noted that it may not be efficient to contain only 54per file. It is noted that it may not be efficient to contain only one
55value per file, so it is socially acceptable to express an array of 55value per file, so it is socially acceptable to express an array of
56values of the same type. 56values of the same type.
57 57
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 6f8e16e3d6c0..9d019d35728f 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -706,7 +706,7 @@ struct address_space_operations {
706 wants to make it a free page. If ->releasepage succeeds, the 706 wants to make it a free page. If ->releasepage succeeds, the
707 page will be removed from the address_space and become free. 707 page will be removed from the address_space and become free.
708 708
709 The second case if when a request has been made to invalidate 709 The second case is when a request has been made to invalidate
710 some or all pages in an address_space. This can happen 710 some or all pages in an address_space. This can happen
711 through the fadvice(POSIX_FADV_DONTNEED) system call or by the 711 through the fadvice(POSIX_FADV_DONTNEED) system call or by the
712 filesystem explicitly requesting it as nfs and 9fs do (when 712 filesystem explicitly requesting it as nfs and 9fs do (when
diff --git a/Documentation/i2c/i2c-protocol b/Documentation/i2c/i2c-protocol
index 579b92d5f3a3..10518dd58814 100644
--- a/Documentation/i2c/i2c-protocol
+++ b/Documentation/i2c/i2c-protocol
@@ -68,7 +68,7 @@ We have found some I2C devices that needs the following modifications:
68 68
69 Flags I2C_M_IGNORE_NAK 69 Flags I2C_M_IGNORE_NAK
70 Normally message is interrupted immediately if there is [NA] from the 70 Normally message is interrupted immediately if there is [NA] from the
71 client. Setting this flag treats any [NA] as [A], and all of 71 client. Setting this flag treats any [NA] as [A], and all of
72 message is sent. 72 message is sent.
73 These messages may still fail to SCL lo->hi timeout. 73 These messages may still fail to SCL lo->hi timeout.
74 74
diff --git a/Documentation/ia64/err_inject.txt b/Documentation/ia64/err_inject.txt
index 6449a7090dbb..223e4f0582d0 100644
--- a/Documentation/ia64/err_inject.txt
+++ b/Documentation/ia64/err_inject.txt
@@ -21,10 +21,10 @@ software test suits to do stressful testing on IPF.
21 21
22Below is a sample application as part of the whole tool. The sample 22Below is a sample application as part of the whole tool. The sample
23can be used as a working test tool. Or it can be expanded to include 23can be used as a working test tool. Or it can be expanded to include
24more features. It also can be a integrated into a libary or other user 24more features. It also can be a integrated into a library or other user
25application to have more thorough test. 25application to have more thorough test.
26 26
27The sample application takes err.conf as error configuation input. Gcc 27The sample application takes err.conf as error configuration input. GCC
28compiles the code. After you install err_inject driver, you can run 28compiles the code. After you install err_inject driver, you can run
29this sample application to inject errors. 29this sample application to inject errors.
30 30
@@ -809,7 +809,7 @@ int err_inj()
809 } 809 }
810 810
811 /* Create semaphore: If one_lock, one semaphore for all processors. 811 /* Create semaphore: If one_lock, one semaphore for all processors.
812 Otherwise, one sempaphore for each processor. */ 812 Otherwise, one semaphore for each processor. */
813 if (one_lock) { 813 if (one_lock) {
814 if (create_sem(0)) { 814 if (create_sem(0)) {
815 printf("Can not create semaphore...exit\n"); 815 printf("Can not create semaphore...exit\n");
diff --git a/Documentation/input/atarikbd.txt b/Documentation/input/atarikbd.txt
index ab050621e20f..f3a3ba8847ba 100644
--- a/Documentation/input/atarikbd.txt
+++ b/Documentation/input/atarikbd.txt
@@ -170,7 +170,7 @@ major controller faults (ROM checksum and RAM test) and such things as stuck
170keys. Any keys down at power-up are presumed to be stuck, and their BREAK 170keys. Any keys down at power-up are presumed to be stuck, and their BREAK
171(sic) code is returned (which without the preceding MAKE code is a flag for a 171(sic) code is returned (which without the preceding MAKE code is a flag for a
172keyboard error). If the controller self-test completes without error, the code 172keyboard error). If the controller self-test completes without error, the code
1730xF0 is returned. (This code will be used to indicate the version/rlease of 1730xF0 is returned. (This code will be used to indicate the version/release of
174the ikbd controller. The first release of the ikbd is version 0xF0, should 174the ikbd controller. The first release of the ikbd is version 0xF0, should
175there be a second release it will be 0xF1, and so on.) 175there be a second release it will be 0xF1, and so on.)
176The ikbd defaults to a mouse position reporting with threshold of 1 unit in 176The ikbd defaults to a mouse position reporting with threshold of 1 unit in
@@ -413,7 +413,7 @@ INTERROGATION MODE.
413 %nnnnmmmm ; where m is JOYSTICK1 state 413 %nnnnmmmm ; where m is JOYSTICK1 state
414 ; and n is JOYSTICK0 state 414 ; and n is JOYSTICK0 state
415 415
416Sets the ikbd to do nothing but monitor the serial command lne, maintain the 416Sets the ikbd to do nothing but monitor the serial command line, maintain the
417time-of-day clock, and monitor the joystick. The rate sets the interval 417time-of-day clock, and monitor the joystick. The rate sets the interval
418between joystick samples. 418between joystick samples.
419N.B. The user should not set the rate higher than the serial communications 419N.B. The user should not set the rate higher than the serial communications
@@ -446,10 +446,10 @@ The sample interval should be as constant as possible.
446 ; until vertical cursor key is generated before RY 446 ; until vertical cursor key is generated before RY
447 ; has elapsed 447 ; has elapsed
448 VX ; length (in tenths of seconds) of joystick closure 448 VX ; length (in tenths of seconds) of joystick closure
449 ; until horizontal cursor keystokes are generated 449 ; until horizontal cursor keystrokes are generated
450 ; after RX has elapsed 450 ; after RX has elapsed
451 VY ; length (in tenths of seconds) of joystick closure 451 VY ; length (in tenths of seconds) of joystick closure
452 ; until vertical cursor keystokes are generated 452 ; until vertical cursor keystrokes are generated
453 ; after RY has elapsed 453 ; after RY has elapsed
454 454
455In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes. 455In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes.
diff --git a/Documentation/input/ff.txt b/Documentation/input/ff.txt
index 085eb15b45b7..ded4d5f53109 100644
--- a/Documentation/input/ff.txt
+++ b/Documentation/input/ff.txt
@@ -1,5 +1,5 @@
1Force feedback for Linux. 1Force feedback for Linux.
2By Johann Deneux <deneux@ifrance.com> on 2001/04/22. 2By Johann Deneux <johann.deneux@gmail.com> on 2001/04/22.
3Updated by Anssi Hannula <anssi.hannula@gmail.com> on 2006/04/09. 3Updated by Anssi Hannula <anssi.hannula@gmail.com> on 2006/04/09.
4You may redistribute this file. Please remember to include shape.fig and 4You may redistribute this file. Please remember to include shape.fig and
5interactive.fig as well. 5interactive.fig as well.
diff --git a/Documentation/input/iforce-protocol.txt b/Documentation/input/iforce-protocol.txt
index 8777d2d321e3..3ac92413c874 100644
--- a/Documentation/input/iforce-protocol.txt
+++ b/Documentation/input/iforce-protocol.txt
@@ -4,10 +4,10 @@ specify force effects to I-Force 2.0 devices. None of this information comes
4from Immerse. That's why you should not trust what is written in this 4from Immerse. That's why you should not trust what is written in this
5document. This document is intended to help understanding the protocol. 5document. This document is intended to help understanding the protocol.
6This is not a reference. Comments and corrections are welcome. To contact me, 6This is not a reference. Comments and corrections are welcome. To contact me,
7send an email to: deneux@ifrance.com 7send an email to: johann.deneux@gmail.com
8 8
9** WARNING ** 9** WARNING **
10I may not be held responsible for any dammage or harm caused if you try to 10I shall not be held responsible for any damage or harm caused if you try to
11send data to your I-Force device based on what you read in this document. 11send data to your I-Force device based on what you read in this document.
12 12
13** Preliminary Notes: 13** Preliminary Notes:
@@ -151,13 +151,13 @@ OP= ff
151Query command. Length varies according to the query type. 151Query command. Length varies according to the query type.
152The general format of this packet is: 152The general format of this packet is:
153ff 01 QUERY [INDEX] CHECKSUM 153ff 01 QUERY [INDEX] CHECKSUM
154reponses are of the same form: 154responses are of the same form:
155FF LEN QUERY VALUE_QUERIED CHECKSUM2 155FF LEN QUERY VALUE_QUERIED CHECKSUM2
156where LEN = 1 + length(VALUE_QUERIED) 156where LEN = 1 + length(VALUE_QUERIED)
157 157
158**** Query ram size **** 158**** Query ram size ****
159QUERY = 42 ('B'uffer size) 159QUERY = 42 ('B'uffer size)
160The device should reply with the same packet plus two additionnal bytes 160The device should reply with the same packet plus two additional bytes
161containing the size of the memory: 161containing the size of the memory:
162ff 03 42 03 e8 CS would mean that the device has 1000 bytes of ram available. 162ff 03 42 03 e8 CS would mean that the device has 1000 bytes of ram available.
163 163
@@ -234,19 +234,23 @@ is the amount of memory apparently needed for every set of parameters:
234 234
235** Appendix: How to study the protocol ? ** 235** Appendix: How to study the protocol ? **
236 236
2371. Generate effects using the force editor provided with the DirectX SDK, or use Immersion Studio (freely available at their web site in the developer section: www.immersion.com) 2371. Generate effects using the force editor provided with the DirectX SDK, or
2382. Start a soft spying RS232 or USB (depending on where you connected your joystick/wheel). I used ComPortSpy from fCoder (alpha version!) 238use Immersion Studio (freely available at their web site in the developer section:
239www.immersion.com)
2402. Start a soft spying RS232 or USB (depending on where you connected your
241joystick/wheel). I used ComPortSpy from fCoder (alpha version!)
2393. Play the effect, and watch what happens on the spy screen. 2423. Play the effect, and watch what happens on the spy screen.
240 243
241A few words about ComPortSpy: 244A few words about ComPortSpy:
242At first glance, this soft seems, hum, well... buggy. In fact, data appear with a few seconds latency. Personnaly, I restart it every time I play an effect. 245At first glance, this software seems, hum, well... buggy. In fact, data appear with a
246few seconds latency. Personally, I restart it every time I play an effect.
243Remember it's free (as in free beer) and alpha! 247Remember it's free (as in free beer) and alpha!
244 248
245** URLS ** 249** URLS **
246Check www.immerse.com for Immersion Studio, and www.fcoder.com for ComPortSpy. 250Check www.immerse.com for Immersion Studio, and www.fcoder.com for ComPortSpy.
247 251
248** Author of this document ** 252** Author of this document **
249Johann Deneux <deneux@ifrance.com> 253Johann Deneux <johann.deneux@gmail.com>
250Home page at http://www.esil.univ-mrs.fr/~jdeneux/projects/ff/ 254Home page at http://www.esil.univ-mrs.fr/~jdeneux/projects/ff/
251 255
252Additions by Vojtech Pavlik. 256Additions by Vojtech Pavlik.
diff --git a/Documentation/input/input-programming.txt b/Documentation/input/input-programming.txt
index d9d523099bb7..47fc86830cd7 100644
--- a/Documentation/input/input-programming.txt
+++ b/Documentation/input/input-programming.txt
@@ -42,8 +42,8 @@ static int __init button_init(void)
42 goto err_free_irq; 42 goto err_free_irq;
43 } 43 }
44 44
45 button_dev->evbit[0] = BIT(EV_KEY); 45 button_dev->evbit[0] = BIT_MASK(EV_KEY);
46 button_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); 46 button_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
47 47
48 error = input_register_device(button_dev); 48 error = input_register_device(button_dev);
49 if (error) { 49 if (error) {
@@ -79,7 +79,7 @@ In the _init function, which is called either upon module load or when
79booting the kernel, it grabs the required resources (it should also check 79booting the kernel, it grabs the required resources (it should also check
80for the presence of the device). 80for the presence of the device).
81 81
82Then it allocates a new input device structure with input_aloocate_device() 82Then it allocates a new input device structure with input_allocate_device()
83and sets up input bitfields. This way the device driver tells the other 83and sets up input bitfields. This way the device driver tells the other
84parts of the input systems what it is - what events can be generated or 84parts of the input systems what it is - what events can be generated or
85accepted by this input device. Our example device can only generate EV_KEY 85accepted by this input device. Our example device can only generate EV_KEY
@@ -217,14 +217,15 @@ If you don't need absfuzz and absflat, you can set them to zero, which mean
217that the thing is precise and always returns to exactly the center position 217that the thing is precise and always returns to exactly the center position
218(if it has any). 218(if it has any).
219 219
2201.4 NBITS(), LONG(), BIT() 2201.4 BITS_TO_LONGS(), BIT_WORD(), BIT_MASK()
221~~~~~~~~~~~~~~~~~~~~~~~~~~ 221~~~~~~~~~~~~~~~~~~~~~~~~~~
222 222
223These three macros from input.h help some bitfield computations: 223These three macros from bitops.h help some bitfield computations:
224 224
225 NBITS(x) - returns the length of a bitfield array in longs for x bits 225 BITS_TO_LONGS(x) - returns the length of a bitfield array in longs for
226 LONG(x) - returns the index in the array in longs for bit x 226 x bits
227 BIT(x) - returns the index in a long for bit x 227 BIT_WORD(x) - returns the index in the array in longs for bit x
228 BIT_MASK(x) - returns the index in a long for bit x
228 229
2291.5 The id* and name fields 2301.5 The id* and name fields
230~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 231~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/Documentation/isdn/CREDITS b/Documentation/isdn/CREDITS
index 7c17c837064f..8cac6c2f23ee 100644
--- a/Documentation/isdn/CREDITS
+++ b/Documentation/isdn/CREDITS
@@ -40,7 +40,7 @@ Andreas Kool (akool@Kool.f.EUnet.de)
40Pedro Roque Marques (roque@di.fc.ul.pt) 40Pedro Roque Marques (roque@di.fc.ul.pt)
41 For lot of new ideas and the pcbit driver. 41 For lot of new ideas and the pcbit driver.
42 42
43Eberhard Moenkeberg (emoenke@gwdg.de) 43Eberhard Mönkeberg (emoenke@gwdg.de)
44 For testing and help to get into kernel. 44 For testing and help to get into kernel.
45 45
46Thomas Neumann (tn@ruhr.de) 46Thomas Neumann (tn@ruhr.de)
diff --git a/Documentation/isdn/README.concap b/Documentation/isdn/README.concap
index 2f114babe4b6..a76d74845a4c 100644
--- a/Documentation/isdn/README.concap
+++ b/Documentation/isdn/README.concap
@@ -111,7 +111,7 @@ struct concap_proto_ops{
111 struct concap_proto * (*proto_new) (void); 111 struct concap_proto * (*proto_new) (void);
112 112
113 /* delete encapsulation protocol instance and free all its resources. 113 /* delete encapsulation protocol instance and free all its resources.
114 cprot may no loger be referenced after calling this */ 114 cprot may no longer be referenced after calling this */
115 void (*proto_del)(struct concap_proto *cprot); 115 void (*proto_del)(struct concap_proto *cprot);
116 116
117 /* initialize the protocol's data. To be called at interface startup 117 /* initialize the protocol's data. To be called at interface startup
diff --git a/Documentation/java.txt b/Documentation/java.txt
index 3cce3fbb6644..e6a723281547 100644
--- a/Documentation/java.txt
+++ b/Documentation/java.txt
@@ -37,7 +37,7 @@ other program after you have done the following:
37 or the following, if you want to be more selective: 37 or the following, if you want to be more selective:
38 ':Applet:M::<!--applet::/usr/bin/appletviewer:' 38 ':Applet:M::<!--applet::/usr/bin/appletviewer:'
39 39
40 Of cause you have to fix the path names. Given path/file names in this 40 Of course you have to fix the path names. The path/file names given in this
41 document match the Debian 2.1 system. (i.e. jdk installed in /usr, 41 document match the Debian 2.1 system. (i.e. jdk installed in /usr,
42 custom wrappers from this document in /usr/local) 42 custom wrappers from this document in /usr/local)
43 43
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index fe8b0c4892cf..616043a6da99 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -77,7 +77,12 @@ applicable everywhere (see syntax).
77 Optionally, dependencies only for this default value can be added with 77 Optionally, dependencies only for this default value can be added with
78 "if". 78 "if".
79 79
80- dependencies: "depends on"/"requires" <expr> 80- type definition + default value:
81 "def_bool"/"def_tristate" <expr> ["if" <expr>]
82 This is a shorthand notation for a type definition plus a value.
83 Optionally dependencies for this default value can be added with "if".
84
85- dependencies: "depends on" <expr>
81 This defines a dependency for this menu entry. If multiple 86 This defines a dependency for this menu entry. If multiple
82 dependencies are defined, they are connected with '&&'. Dependencies 87 dependencies are defined, they are connected with '&&'. Dependencies
83 are applied to all other options within this menu entry (which also 88 are applied to all other options within this menu entry (which also
@@ -289,3 +294,10 @@ source:
289 "source" <prompt> 294 "source" <prompt>
290 295
291This reads the specified configuration file. This file is always parsed. 296This reads the specified configuration file. This file is always parsed.
297
298mainmenu:
299
300 "mainmenu" <prompt>
301
302This sets the config program's title bar if the config program chooses
303to use it.
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index f099b814d383..6166e2d7da76 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -518,6 +518,28 @@ more details, with real examples.
518 In this example for a specific GCC version the build will error out explaining 518 In this example for a specific GCC version the build will error out explaining
519 to the user why it stops. 519 to the user why it stops.
520 520
521 cc-cross-prefix
522 cc-cross-prefix is used to check if there exist a $(CC) in path with
523 one of the listed prefixes. The first prefix where there exist a
524 prefix$(CC) in the PATH is returned - and if no prefix$(CC) is found
525 then nothing is returned.
526 Additional prefixes are separated by a single space in the
527 call of cc-cross-prefix.
528 This functionality is usefull for architecture Makefile that try
529 to set CROSS_COMPILE to well know values but may have several
530 values to select between.
531 It is recommended only to try to set CROSS_COMPILE is it is a cross
532 build (host arch is different from target arch). And is CROSS_COMPILE
533 is already set then leave it with the old value.
534
535 Example:
536 #arch/m68k/Makefile
537 ifneq ($(SUBARCH),$(ARCH))
538 ifeq ($(CROSS_COMPILE),)
539 CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu-)
540 endif
541 endif
542
521=== 4 Host Program support 543=== 4 Host Program support
522 544
523Kbuild supports building executables on the host for use during the 545Kbuild supports building executables on the host for use during the
diff --git a/Documentation/kdump/kdump.txt b/Documentation/kdump/kdump.txt
index 1b37b28cc234..d0ac72cc19ff 100644
--- a/Documentation/kdump/kdump.txt
+++ b/Documentation/kdump/kdump.txt
@@ -231,6 +231,32 @@ Dump-capture kernel config options (Arch Dependent, ia64)
231 any space below the alignment point will be wasted. 231 any space below the alignment point will be wasted.
232 232
233 233
234Extended crashkernel syntax
235===========================
236
237While the "crashkernel=size[@offset]" syntax is sufficient for most
238configurations, sometimes it's handy to have the reserved memory dependent
239on the value of System RAM -- that's mostly for distributors that pre-setup
240the kernel command line to avoid a unbootable system after some memory has
241been removed from the machine.
242
243The syntax is:
244
245 crashkernel=<range1>:<size1>[,<range2>:<size2>,...][@offset]
246 range=start-[end]
247
248For example:
249
250 crashkernel=512M-2G:64M,2G-:128M
251
252This would mean:
253
254 1) if the RAM is smaller than 512M, then don't reserve anything
255 (this is the "rescue" case)
256 2) if the RAM size is between 512M and 2G, then reserve 64M
257 3) if the RAM size is larger than 2G, then reserve 128M
258
259
234Boot into System Kernel 260Boot into System Kernel
235======================= 261=======================
236 262
diff --git a/Documentation/kernel-docs.txt b/Documentation/kernel-docs.txt
index d9e3b199929b..5a4ef48224ae 100644
--- a/Documentation/kernel-docs.txt
+++ b/Documentation/kernel-docs.txt
@@ -76,9 +76,9 @@
76 * Title: "Conceptual Architecture of the Linux Kernel" 76 * Title: "Conceptual Architecture of the Linux Kernel"
77 Author: Ivan T. Bowman. 77 Author: Ivan T. Bowman.
78 URL: http://plg.uwaterloo.ca/~itbowman/papers/CS746G-a1.html 78 URL: http://plg.uwaterloo.ca/~itbowman/papers/CS746G-a1.html
79 Keywords: conceptual software arquitecture, extracted design, 79 Keywords: conceptual software architecture, extracted design,
80 reverse engineering, system structure. 80 reverse engineering, system structure.
81 Description: Conceptual software arquitecture of the Linux kernel, 81 Description: Conceptual software architecture of the Linux kernel,
82 automatically extracted from the source code. Very detailed. Good 82 automatically extracted from the source code. Very detailed. Good
83 figures. Gives good overall kernel understanding. 83 figures. Gives good overall kernel understanding.
84 84
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 98cf90f2631d..6accd360da73 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -222,9 +222,6 @@ and is between 256 and 4096 characters. It is defined in the file
222 Warning: Many of these options can produce a lot of 222 Warning: Many of these options can produce a lot of
223 output and make your system unusable. Be very careful. 223 output and make your system unusable. Be very careful.
224 224
225
226 acpi_fake_ecdt [HW,ACPI] Workaround failure due to BIOS lacking ECDT
227
228 acpi_pm_good [X86-32,X86-64] 225 acpi_pm_good [X86-32,X86-64]
229 Override the pmtimer bug detection: force the kernel 226 Override the pmtimer bug detection: force the kernel
230 to assume that this machine's pmtimer latches its value 227 to assume that this machine's pmtimer latches its value
@@ -297,9 +294,6 @@ and is between 256 and 4096 characters. It is defined in the file
297 apm= [APM] Advanced Power Management 294 apm= [APM] Advanced Power Management
298 See header of arch/i386/kernel/apm.c. 295 See header of arch/i386/kernel/apm.c.
299 296
300 applicom= [HW]
301 Format: <mem>,<irq>
302
303 arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards 297 arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards
304 Format: <io>,<irq>,<nodeID> 298 Format: <io>,<irq>,<nodeID>
305 299
@@ -345,12 +339,6 @@ and is between 256 and 4096 characters. It is defined in the file
345 Format: <io>,<irq>,<mode> 339 Format: <io>,<irq>,<mode>
346 See header of drivers/net/hamradio/baycom_ser_hdx.c. 340 See header of drivers/net/hamradio/baycom_ser_hdx.c.
347 341
348 blkmtd_device= [HW,MTD]
349 blkmtd_erasesz=
350 blkmtd_ro=
351 blkmtd_bs=
352 blkmtd_count=
353
354 boot_delay= Milliseconds to delay each printk during boot. 342 boot_delay= Milliseconds to delay each printk during boot.
355 Values larger than 10 seconds (10000) are changed to 343 Values larger than 10 seconds (10000) are changed to
356 no delay (0). 344 no delay (0).
@@ -431,8 +419,10 @@ and is between 256 and 4096 characters. It is defined in the file
431 over the 8254 in addition to over the IO-APIC. The 419 over the 8254 in addition to over the IO-APIC. The
432 kernel tries to set a sensible default. 420 kernel tries to set a sensible default.
433 421
434 hpet= [X86-32,HPET] option to disable HPET and use PIT. 422 hpet= [X86-32,HPET] option to control HPET usage
435 Format: disable 423 Format: { enable (default) | disable | force }
424 disable: disable HPET and use PIT instead
425 force: allow force enabled of undocumented chips (ICH4, VIA)
436 426
437 com20020= [HW,NET] ARCnet - COM20020 chipset 427 com20020= [HW,NET] ARCnet - COM20020 chipset
438 Format: 428 Format:
@@ -479,6 +469,16 @@ and is between 256 and 4096 characters. It is defined in the file
479 UART at the specified I/O port or MMIO address. 469 UART at the specified I/O port or MMIO address.
480 The options are the same as for ttyS, above. 470 The options are the same as for ttyS, above.
481 471
472 no_console_suspend
473 [HW] Never suspend the console
474 Disable suspending of consoles during suspend and
475 hibernate operations. Once disabled, debugging
476 messages can reach various consoles while the rest
477 of the system is being put to sleep (ie, while
478 debugging driver suspend/resume hooks). This may
479 not work reliably with all consoles, but is known
480 to work with serial and VGA consoles.
481
482 cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver 482 cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver
483 Format: 483 Format:
484 <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] 484 <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
@@ -487,6 +487,13 @@ and is between 256 and 4096 characters. It is defined in the file
487 [KNL] Reserve a chunk of physical memory to 487 [KNL] Reserve a chunk of physical memory to
488 hold a kernel to switch to with kexec on panic. 488 hold a kernel to switch to with kexec on panic.
489 489
490 crashkernel=range1:size1[,range2:size2,...][@offset]
491 [KNL] Same as above, but depends on the memory
492 in the running system. The syntax of range is
493 start-[end] where start and end are both
494 a memory unit (amount[KMG]). See also
495 Documentation/kdump/kdump.txt for a example.
496
490 cs4232= [HW,OSS] 497 cs4232= [HW,OSS]
491 Format: <io>,<irq>,<dma>,<dma2>,<mpuio>,<mpuirq> 498 Format: <io>,<irq>,<dma>,<dma2>,<mpuio>,<mpuirq>
492 499
@@ -496,8 +503,6 @@ and is between 256 and 4096 characters. It is defined in the file
496 cs89x0_media= [HW,NET] 503 cs89x0_media= [HW,NET]
497 Format: { rj45 | aui | bnc } 504 Format: { rj45 | aui | bnc }
498 505
499 cyclades= [HW,SERIAL] Cyclades multi-serial port adapter.
500
501 dasd= [HW,NET] 506 dasd= [HW,NET]
502 See header of drivers/s390/block/dasd_devmap.c. 507 See header of drivers/s390/block/dasd_devmap.c.
503 508
@@ -555,10 +560,6 @@ and is between 256 and 4096 characters. It is defined in the file
555 See drivers/char/README.epca and 560 See drivers/char/README.epca and
556 Documentation/digiepca.txt. 561 Documentation/digiepca.txt.
557 562
558 dmascc= [HW,AX25,SERIAL] AX.25 Z80SCC driver with DMA
559 support available.
560 Format: <io_dev0>[,<io_dev1>[,..<io_dev32>]]
561
562 dmasound= [HW,OSS] Sound subsystem buffers 563 dmasound= [HW,OSS] Sound subsystem buffers
563 564
564 dscc4.setup= [NET] 565 dscc4.setup= [NET]
@@ -589,17 +590,10 @@ and is between 256 and 4096 characters. It is defined in the file
589 0: polling mode 590 0: polling mode
590 non-0: interrupt mode (default) 591 non-0: interrupt mode (default)
591 592
592 eda= [HW,PS2]
593
594 edb= [HW,PS2]
595
596 edd= [EDD] 593 edd= [EDD]
597 Format: {"of[f]" | "sk[ipmbr]"} 594 Format: {"of[f]" | "sk[ipmbr]"}
598 See comment in arch/i386/boot/edd.S 595 See comment in arch/i386/boot/edd.S
599 596
600 eicon= [HW,ISDN]
601 Format: <id>,<membase>,<irq>
602
603 eisa_irq_edge= [PARISC,HW] 597 eisa_irq_edge= [PARISC,HW]
604 See header of drivers/parisc/eisa.c. 598 See header of drivers/parisc/eisa.c.
605 599
@@ -875,9 +869,6 @@ and is between 256 and 4096 characters. It is defined in the file
875 lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in 869 lapic_timer_c2_ok [X86-32,x86-64,APIC] trust the local apic timer in
876 C2 power state. 870 C2 power state.
877 871
878 lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip
879 Format: addr:<io>,irq:<irq>
880
881 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume 872 libata.noacpi [LIBATA] Disables use of ACPI in libata suspend/resume
882 when set. 873 when set.
883 Format: <int> 874 Format: <int>
@@ -1125,9 +1116,6 @@ and is between 256 and 4096 characters. It is defined in the file
1125 noapic [SMP,APIC] Tells the kernel to not make use of any 1116 noapic [SMP,APIC] Tells the kernel to not make use of any
1126 IOAPICs that may be present in the system. 1117 IOAPICs that may be present in the system.
1127 1118
1128 noasync [HW,M68K] Disables async and sync negotiation for
1129 all devices.
1130
1131 nobats [PPC] Do not use BATs for mapping kernel lowmem 1119 nobats [PPC] Do not use BATs for mapping kernel lowmem
1132 on "Classic" PPC cores. 1120 on "Classic" PPC cores.
1133 1121
@@ -1439,6 +1427,7 @@ and is between 256 and 4096 characters. It is defined in the file
1439 Param: <number> - step/bucket size as a power of 2 for 1427 Param: <number> - step/bucket size as a power of 2 for
1440 statistical time based profiling. 1428 statistical time based profiling.
1441 Param: "sleep" - profile D-state sleeping (millisecs) 1429 Param: "sleep" - profile D-state sleeping (millisecs)
1430 Param: "kvm" - profile VM exits.
1442 1431
1443 processor.max_cstate= [HW,ACPI] 1432 processor.max_cstate= [HW,ACPI]
1444 Limit processor to maximum C-state 1433 Limit processor to maximum C-state
@@ -1565,9 +1554,6 @@ and is between 256 and 4096 characters. It is defined in the file
1565 sa1100ir [NET] 1554 sa1100ir [NET]
1566 See drivers/net/irda/sa1100_ir.c. 1555 See drivers/net/irda/sa1100_ir.c.
1567 1556
1568 sb= [HW,OSS]
1569 Format: <io>,<irq>,<dma>,<dma2>
1570
1571 sbni= [NET] Granch SBNI12 leased line adapter 1557 sbni= [NET] Granch SBNI12 leased line adapter
1572 1558
1573 sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver 1559 sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver
@@ -1611,8 +1597,6 @@ and is between 256 and 4096 characters. It is defined in the file
1611 1597
1612 serialnumber [BUGS=X86-32] 1598 serialnumber [BUGS=X86-32]
1613 1599
1614 sg_def_reserved_size= [SCSI]
1615
1616 shapers= [NET] 1600 shapers= [NET]
1617 Maximal number of shapers. 1601 Maximal number of shapers.
1618 1602
@@ -2003,10 +1987,6 @@ and is between 256 and 4096 characters. It is defined in the file
2003 norandmaps Don't use address space randomization 1987 norandmaps Don't use address space randomization
2004 Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space 1988 Equivalent to echo 0 > /proc/sys/kernel/randomize_va_space
2005 1989
2006 unwind_debug=N N > 0 will enable dwarf2 unwinder debugging
2007 This is useful to get more information why
2008 you got a "dwarf2 unwinder stuck"
2009
2010______________________________________________________________________ 1990______________________________________________________________________
2011 1991
2012TODO: 1992TODO:
diff --git a/Documentation/m68k/kernel-options.txt b/Documentation/m68k/kernel-options.txt
index 8a523f6af48a..248589e8bcf5 100644
--- a/Documentation/m68k/kernel-options.txt
+++ b/Documentation/m68k/kernel-options.txt
@@ -890,10 +890,7 @@ Syntax: nosync:0
8905.5.2) noasync 8905.5.2) noasync
891-------------- 891--------------
892 892
893Syntax: noasync:0 893[OBSOLETE, REMOVED]
894
895 Disables async and sync negotiation for all devices. Any value
896 after the colon is acceptable (and has the same effect).
897 894
8985.5.3) nodisconnect 8955.5.3) nodisconnect
899------------------- 896-------------------
diff --git a/Documentation/markers.txt b/Documentation/markers.txt
new file mode 100644
index 000000000000..295a71bc301e
--- /dev/null
+++ b/Documentation/markers.txt
@@ -0,0 +1,81 @@
1 Using the Linux Kernel Markers
2
3 Mathieu Desnoyers
4
5
6This document introduces Linux Kernel Markers and their use. It provides
7examples of how to insert markers in the kernel and connect probe functions to
8them and provides some examples of probe functions.
9
10
11* Purpose of markers
12
13A marker placed in code provides a hook to call a function (probe) that you can
14provide at runtime. A marker can be "on" (a probe is connected to it) or "off"
15(no probe is attached). When a marker is "off" it has no effect, except for
16adding a tiny time penalty (checking a condition for a branch) and space
17penalty (adding a few bytes for the function call at the end of the
18instrumented function and adds a data structure in a separate section). When a
19marker is "on", the function you provide is called each time the marker is
20executed, in the execution context of the caller. When the function provided
21ends its execution, it returns to the caller (continuing from the marker site).
22
23You can put markers at important locations in the code. Markers are
24lightweight hooks that can pass an arbitrary number of parameters,
25described in a printk-like format string, to the attached probe function.
26
27They can be used for tracing and performance accounting.
28
29
30* Usage
31
32In order to use the macro trace_mark, you should include linux/marker.h.
33
34#include <linux/marker.h>
35
36And,
37
38trace_mark(subsystem_event, "%d %s", someint, somestring);
39Where :
40- subsystem_event is an identifier unique to your event
41 - subsystem is the name of your subsystem.
42 - event is the name of the event to mark.
43- "%d %s" is the formatted string for the serializer.
44- someint is an integer.
45- somestring is a char pointer.
46
47Connecting a function (probe) to a marker is done by providing a probe (function
48to call) for the specific marker through marker_probe_register() and can be
49activated by calling marker_arm(). Marker deactivation can be done by calling
50marker_disarm() as many times as marker_arm() has been called. Removing a probe
51is done through marker_probe_unregister(); it will disarm the probe and make
52sure there is no caller left using the probe when it returns. Probe removal is
53preempt-safe because preemption is disabled around the probe call. See the
54"Probe example" section below for a sample probe module.
55
56The marker mechanism supports inserting multiple instances of the same marker.
57Markers can be put in inline functions, inlined static functions, and
58unrolled loops as well as regular functions.
59
60The naming scheme "subsystem_event" is suggested here as a convention intended
61to limit collisions. Marker names are global to the kernel: they are considered
62as being the same whether they are in the core kernel image or in modules.
63Conflicting format strings for markers with the same name will cause the markers
64to be detected to have a different format string not to be armed and will output
65a printk warning which identifies the inconsistency:
66
67"Format mismatch for probe probe_name (format), marker (format)"
68
69
70* Probe / marker example
71
72See the example provided in samples/markers/src
73
74Compile them with your kernel.
75
76Run, as root :
77modprobe marker-example (insmod order is not important)
78modprobe probe-example
79cat /proc/marker-example (returns an expected error)
80rmmod marker-example probe-example
81dmesg
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 650657c54733..4e17beba2379 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -1479,7 +1479,8 @@ kernel.
1479 1479
1480Any atomic operation that modifies some state in memory and returns information 1480Any atomic operation that modifies some state in memory and returns information
1481about the state (old or new) implies an SMP-conditional general memory barrier 1481about the state (old or new) implies an SMP-conditional general memory barrier
1482(smp_mb()) on each side of the actual operation. These include: 1482(smp_mb()) on each side of the actual operation (with the exception of
1483explicit lock operations, described later). These include:
1483 1484
1484 xchg(); 1485 xchg();
1485 cmpxchg(); 1486 cmpxchg();
@@ -1536,10 +1537,19 @@ If they're used for constructing a lock of some description, then they probably
1536do need memory barriers as a lock primitive generally has to do things in a 1537do need memory barriers as a lock primitive generally has to do things in a
1537specific order. 1538specific order.
1538 1539
1539
1540Basically, each usage case has to be carefully considered as to whether memory 1540Basically, each usage case has to be carefully considered as to whether memory
1541barriers are needed or not. 1541barriers are needed or not.
1542 1542
1543The following operations are special locking primitives:
1544
1545 test_and_set_bit_lock();
1546 clear_bit_unlock();
1547 __clear_bit_unlock();
1548
1549These implement LOCK-class and UNLOCK-class operations. These should be used in
1550preference to other operations when implementing locking primitives, because
1551their implementations can be optimised on many architectures.
1552
1543[!] Note that special memory barrier primitives are available for these 1553[!] Note that special memory barrier primitives are available for these
1544situations because on some CPUs the atomic instructions used imply full memory 1554situations because on some CPUs the atomic instructions used imply full memory
1545barriers, and so barrier instructions are superfluous in conjunction with them, 1555barriers, and so barrier instructions are superfluous in conjunction with them,
diff --git a/Documentation/mips/00-INDEX b/Documentation/mips/00-INDEX
index 9df8a2eac7b4..3f13bf8043d2 100644
--- a/Documentation/mips/00-INDEX
+++ b/Documentation/mips/00-INDEX
@@ -4,5 +4,3 @@ AU1xxx_IDE.README
4 - README for MIPS AU1XXX IDE driver. 4 - README for MIPS AU1XXX IDE driver.
5GT64120.README 5GT64120.README
6 - README for dir with info on MIPS boards using GT-64120 or GT-64120A. 6 - README for dir with info on MIPS boards using GT-64120 or GT-64120A.
7time.README
8 - README for MIPS time services.
diff --git a/Documentation/mips/AU1xxx_IDE.README b/Documentation/mips/AU1xxx_IDE.README
index afb31c141d9d..5c8334123f4f 100644
--- a/Documentation/mips/AU1xxx_IDE.README
+++ b/Documentation/mips/AU1xxx_IDE.README
@@ -59,7 +59,7 @@ Four configs variables are introduced:
59 CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA - enable the PIO+DBDMA mode 59 CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA - enable the PIO+DBDMA mode
60 CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - enable the MWDMA mode 60 CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA - enable the MWDMA mode
61 CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - set Burstable FIFO in DBDMA 61 CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON - set Burstable FIFO in DBDMA
62 controler 62 controller
63 CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ - maximum transfer size 63 CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ - maximum transfer size
64 per descriptor 64 per descriptor
65 65
diff --git a/Documentation/mips/time.README b/Documentation/mips/time.README
deleted file mode 100644
index a4ce603ed3b3..000000000000
--- a/Documentation/mips/time.README
+++ /dev/null
@@ -1,173 +0,0 @@
1README for MIPS time services
2
3Jun Sun
4jsun@mvista.com or jsun@junsun.net
5
6
7ABOUT
8-----
9This file describes the new arch/mips/kernel/time.c, related files and the
10services they provide.
11
12If you are short in patience and just want to know how to use time.c for a
13new board or convert an existing board, go to the last section.
14
15
16FILES, COMPATABILITY AND CONFIGS
17---------------------------------
18
19The old arch/mips/kernel/time.c is renamed to old-time.c.
20
21A new time.c is put there, together with include/asm-mips/time.h.
22
23Two configs variables are introduced, CONFIG_OLD_TIME_C and CONFIG_NEW_TIME_C.
24So we allow boards using
25
26 1) old time.c (CONFIG_OLD_TIME_C)
27 2) new time.c (CONFIG_NEW_TIME_C)
28 3) neither (their own private time.c)
29
30However, it is expected every board will move to the new time.c in the near
31future.
32
33
34WHAT THE NEW CODE PROVIDES?
35---------------------------
36
37The new time code provide the following services:
38
39 a) Implements functions required by Linux common code:
40 time_init
41
42 b) provides an abstraction of RTC and null RTC implementation as default.
43 extern unsigned long (*rtc_get_time)(void);
44 extern int (*rtc_set_time)(unsigned long);
45
46 c) high-level and low-level timer interrupt routines where the timer
47 interrupt source may or may not be the CPU timer. The high-level
48 routine is dispatched through do_IRQ() while the low-level is
49 dispatched in assemably code (usually int-handler.S)
50
51
52WHAT THE NEW CODE REQUIRES?
53---------------------------
54
55For the new code to work properly, each board implementation needs to supply
56the following functions or values:
57
58 a) board_time_init - a function pointer. Invoked at the beginnig of
59 time_init(). It is optional.
60 1. (optional) set up RTC routines
61 2. (optional) calibrate and set the mips_hpt_frequency
62
63 b) plat_timer_setup - a function pointer. Invoked at the end of time_init()
64 1. (optional) over-ride any decisions made in time_init()
65 2. set up the irqaction for timer interrupt.
66 3. enable the timer interrupt
67
68 c) (optional) board-specific RTC routines.
69
70 d) (optional) mips_hpt_frequency - It must be definied if the board
71 is using CPU counter for timer interrupt.
72
73
74PORTING GUIDE
75-------------
76
77Step 1: decide how you like to implement the time services.
78
79 a) does this board have a RTC? If yes, implement the two RTC funcs.
80
81 b) does the CPU have counter/compare registers?
82
83 If the answer is no, you need a timer to provide the timer interrupt
84 at 100 HZ speed.
85
86 c) The following sub steps assume your CPU has counter register.
87 Do you plan to use the CPU counter register as the timer interrupt
88 or use an exnternal timer?
89
90 In order to use CPU counter register as the timer interrupt source, you
91 must know the counter speed (mips_hpt_frequency). It is usually the
92 same as the CPU speed or an integral divisor of it.
93
94 d) decide on whether you want to use high-level or low-level timer
95 interrupt routines. The low-level one is presumably faster, but should
96 not make too mcuh difference.
97
98
99Step 2: the machine setup() function
100
101 If you supply board_time_init(), set the function poointer.
102
103
104Step 3: implement rtc routines, board_time_init() and plat_timer_setup()
105 if needed.
106
107 board_time_init() -
108 a) (optional) set up RTC routines,
109 b) (optional) calibrate and set the mips_hpt_frequency
110 (only needed if you intended to use cpu counter as timer interrupt
111 source)
112
113 plat_timer_setup() -
114 a) (optional) over-write any choices made above by time_init().
115 b) machine specific code should setup the timer irqaction.
116 c) enable the timer interrupt
117
118
119 If the RTC chip is a common chip, I suggest the routines are put under
120 arch/mips/libs. For example, for DS1386 chip, one would create
121 rtc-ds1386.c under arch/mips/lib directory. Add the following line to
122 the arch/mips/lib/Makefile:
123
124 obj-$(CONFIG_DDB5476) += rtc-ds1386.o
125
126Step 4: if you are using low-level timer interrupt, change your interrupt
127 dispathcing code to check for timer interrupt and jump to
128 ll_timer_interrupt() directly if one is detected.
129
130Step 5: Modify arch/mips/config.in and add CONFIG_NEW_TIME_C to your machine.
131 Modify the appropriate defconfig if applicable.
132
133Final notes:
134
135For some tricky cases, you may need to add your own wrapper functions
136for some of the functions in time.c.
137
138For example, you may define your own timer interrupt routine, which does
139some of its own processing and then calls timer_interrupt().
140
141You can also over-ride any of the built-in functions (RTC routines
142and/or timer interrupt routine).
143
144
145PORTING NOTES FOR SMP
146----------------------
147
148If you have a SMP box, things are slightly more complicated.
149
150The time service running every jiffy is logically divided into two parts:
151
152 1) the one for the whole system (defined in timer_interrupt())
153 2) the one that should run for each CPU (defined in local_timer_interrupt())
154
155You need to decide on your timer interrupt sources.
156
157 case 1) - whole system has only one timer interrupt delivered to one CPU
158
159 In this case, you set up timer interrupt as in UP systems. In addtion,
160 you need to set emulate_local_timer_interrupt to 1 so that other
161 CPUs get to call local_timer_interrupt().
162
163 THIS IS CURRENTLY NOT IMPLEMNETED. However, it is rather easy to write
164 one should such a need arise. You simply make a IPI call.
165
166 case 2) - each CPU has a separate timer interrupt
167
168 In this case, you need to set up IRQ such that each of them will
169 call local_timer_interrupt(). In addition, you need to arrange
170 one and only one of them to call timer_interrupt().
171
172 You can also do the low-level version of those interrupt routines,
173 following similar dispatching routes described above.
diff --git a/Documentation/mutex-design.txt b/Documentation/mutex-design.txt
index 51f935191ae5..aa60d1f627e5 100644
--- a/Documentation/mutex-design.txt
+++ b/Documentation/mutex-design.txt
@@ -133,4 +133,6 @@ the APIs of 'struct mutex' have been streamlined:
133 int mutex_trylock(struct mutex *lock); 133 int mutex_trylock(struct mutex *lock);
134 void mutex_unlock(struct mutex *lock); 134 void mutex_unlock(struct mutex *lock);
135 int mutex_is_locked(struct mutex *lock); 135 int mutex_is_locked(struct mutex *lock);
136 136 void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
137 int mutex_lock_interruptible_nested(struct mutex *lock,
138 unsigned int subclass);
diff --git a/Documentation/networking/bcm43xx.txt b/Documentation/networking/bcm43xx.txt
index a136721499bf..d602c8d6ff3e 100644
--- a/Documentation/networking/bcm43xx.txt
+++ b/Documentation/networking/bcm43xx.txt
@@ -37,7 +37,7 @@ all, distributions. There is, however, additional software that is
37required. The firmware used by the chip is the intellectual property 37required. The firmware used by the chip is the intellectual property
38of Broadcom and they have not given the bcm43xx team redistribution 38of Broadcom and they have not given the bcm43xx team redistribution
39rights to this firmware. Since we cannot legally redistribute 39rights to this firmware. Since we cannot legally redistribute
40the firwmare we cannot include it with the driver. Furthermore, it 40the firmware we cannot include it with the driver. Furthermore, it
41cannot be placed in the downloadable archives of any distributing 41cannot be placed in the downloadable archives of any distributing
42organization; therefore, the user is responsible for obtaining the 42organization; therefore, the user is responsible for obtaining the
43firmware and placing it in the appropriate location so that the driver 43firmware and placing it in the appropriate location so that the driver
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 6ae2feff3087..747a5d15d529 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -293,7 +293,7 @@ tcp_no_metrics_save - BOOLEAN
293 when the connection closes, so that connections established in the 293 when the connection closes, so that connections established in the
294 near future can use these to set initial conditions. Usually, this 294 near future can use these to set initial conditions. Usually, this
295 increases overall performance, but may sometimes cause performance 295 increases overall performance, but may sometimes cause performance
296 degredation. If set, TCP will not cache metrics on closing 296 degradation. If set, TCP will not cache metrics on closing
297 connections. 297 connections.
298 298
299tcp_orphan_retries - INTEGER 299tcp_orphan_retries - INTEGER
diff --git a/Documentation/networking/rxrpc.txt b/Documentation/networking/rxrpc.txt
index c36b64b0020f..c3669a3fb4af 100644
--- a/Documentation/networking/rxrpc.txt
+++ b/Documentation/networking/rxrpc.txt
@@ -689,7 +689,7 @@ such as the AFS filesystem. This permits such a utility to:
689 buffers manipulated directly. 689 buffers manipulated directly.
690 690
691To use the RxRPC facility, a kernel utility must still open an AF_RXRPC socket, 691To use the RxRPC facility, a kernel utility must still open an AF_RXRPC socket,
692bind an addess as appropriate and listen if it's to be a server socket, but 692bind an address as appropriate and listen if it's to be a server socket, but
693then it passes this to the kernel interface functions. 693then it passes this to the kernel interface functions.
694 694
695The kernel interface functions are as follows: 695The kernel interface functions are as follows:
diff --git a/Documentation/networking/udplite.txt b/Documentation/networking/udplite.txt
index 6be09ba24a36..b6409cab075c 100644
--- a/Documentation/networking/udplite.txt
+++ b/Documentation/networking/udplite.txt
@@ -12,7 +12,7 @@
12 For in-depth information, you can consult: 12 For in-depth information, you can consult:
13 13
14 o The UDP-Lite Homepage: http://www.erg.abdn.ac.uk/users/gerrit/udp-lite/ 14 o The UDP-Lite Homepage: http://www.erg.abdn.ac.uk/users/gerrit/udp-lite/
15 Fom here you can also download some example application source code. 15 From here you can also download some example application source code.
16 16
17 o The UDP-Lite HOWTO on 17 o The UDP-Lite HOWTO on
18 http://www.erg.abdn.ac.uk/users/gerrit/udp-lite/files/UDP-Lite-HOWTO.txt 18 http://www.erg.abdn.ac.uk/users/gerrit/udp-lite/files/UDP-Lite-HOWTO.txt
@@ -223,7 +223,7 @@
223 While it is important that such cases are dealt with correctly, they 223 While it is important that such cases are dealt with correctly, they
224 are (annoyingly) rare: UDP-Lite is designed for optimising multimedia 224 are (annoyingly) rare: UDP-Lite is designed for optimising multimedia
225 performance over wireless (or generally noisy) links and thus smaller 225 performance over wireless (or generally noisy) links and thus smaller
226 coverage lenghts are likely to be expected. 226 coverage lengths are likely to be expected.
227 227
228 228
229 V) UDP-LITE RUNTIME STATISTICS AND THEIR MEANING 229 V) UDP-LITE RUNTIME STATISTICS AND THEIR MEANING
@@ -259,7 +259,7 @@
259 VI) IPTABLES 259 VI) IPTABLES
260 260
261 There is packet match support for UDP-Lite as well as support for the LOG target. 261 There is packet match support for UDP-Lite as well as support for the LOG target.
262 If you copy and paste the following line into /etc/protcols, 262 If you copy and paste the following line into /etc/protocols,
263 263
264 udplite 136 UDP-Lite # UDP-Lite [RFC 3828] 264 udplite 136 UDP-Lite # UDP-Lite [RFC 3828]
265 265
diff --git a/Documentation/parport-lowlevel.txt b/Documentation/parport-lowlevel.txt
index 8f2302415eff..265fcdcb8e5f 100644
--- a/Documentation/parport-lowlevel.txt
+++ b/Documentation/parport-lowlevel.txt
@@ -25,7 +25,6 @@ Global functions:
25 parport_open 25 parport_open
26 parport_close 26 parport_close
27 parport_device_id 27 parport_device_id
28 parport_device_num
29 parport_device_coords 28 parport_device_coords
30 parport_find_class 29 parport_find_class
31 parport_find_device 30 parport_find_device
@@ -735,7 +734,7 @@ NULL is returned.
735 734
736SEE ALSO 735SEE ALSO
737 736
738parport_register_device, parport_device_num 737parport_register_device
739 738
740parport_close - unregister device for particular device number 739parport_close - unregister device for particular device number
741------------- 740-------------
@@ -787,29 +786,7 @@ Many devices have ill-formed IEEE 1284 Device IDs.
787 786
788SEE ALSO 787SEE ALSO
789 788
790parport_find_class, parport_find_device, parport_device_num 789parport_find_class, parport_find_device
791
792parport_device_num - convert device coordinates to device number
793------------------
794
795SYNOPSIS
796
797#include <linux/parport.h>
798
799int parport_device_num (int parport, int mux, int daisy);
800
801DESCRIPTION
802
803Convert between device coordinates (port, multiplexor, daisy chain
804address) and device number (zero-based).
805
806RETURN VALUE
807
808Device number, or -1 if no device at given coordinates.
809
810SEE ALSO
811
812parport_device_coords, parport_open, parport_device_id
813 790
814parport_device_coords - convert device number to device coordinates 791parport_device_coords - convert device number to device coordinates
815------------------ 792------------------
@@ -833,7 +810,7 @@ Zero on success, in which case the coordinates are (*parport, *mux,
833 810
834SEE ALSO 811SEE ALSO
835 812
836parport_device_num, parport_open, parport_device_id 813parport_open, parport_device_id
837 814
838parport_find_class - find a device by its class 815parport_find_class - find a device by its class
839------------------ 816------------------
diff --git a/Documentation/power/basic-pm-debugging.txt b/Documentation/power/basic-pm-debugging.txt
index 1a85e2b964dc..57aef2f6e0de 100644
--- a/Documentation/power/basic-pm-debugging.txt
+++ b/Documentation/power/basic-pm-debugging.txt
@@ -78,8 +78,8 @@ c) Advanced debugging
78In case the STD does not work on your system even in the minimal configuration 78In case the STD does not work on your system even in the minimal configuration
79and compiling more drivers as modules is not practical or some modules cannot 79and compiling more drivers as modules is not practical or some modules cannot
80be unloaded, you can use one of the more advanced debugging techniques to find 80be unloaded, you can use one of the more advanced debugging techniques to find
81the problem. First, if there is a serial port in your box, you can set the 81the problem. First, if there is a serial port in your box, you can boot the
82CONFIG_DISABLE_CONSOLE_SUSPEND kernel configuration option and try to log kernel 82kernel with the 'no_console_suspend' parameter and try to log kernel
83messages using the serial console. This may provide you with some information 83messages using the serial console. This may provide you with some information
84about the reasons of the suspend (resume) failure. Alternatively, it may be 84about the reasons of the suspend (resume) failure. Alternatively, it may be
85possible to use a FireWire port for debugging with firescope 85possible to use a FireWire port for debugging with firescope
diff --git a/Documentation/power/freezing-of-tasks.txt b/Documentation/power/freezing-of-tasks.txt
index 04dc1cf9d215..38b57248fd61 100644
--- a/Documentation/power/freezing-of-tasks.txt
+++ b/Documentation/power/freezing-of-tasks.txt
@@ -19,12 +19,13 @@ we only consider hibernation, but the description also applies to suspend).
19Namely, as the first step of the hibernation procedure the function 19Namely, as the first step of the hibernation procedure the function
20freeze_processes() (defined in kernel/power/process.c) is called. It executes 20freeze_processes() (defined in kernel/power/process.c) is called. It executes
21try_to_freeze_tasks() that sets TIF_FREEZE for all of the freezable tasks and 21try_to_freeze_tasks() that sets TIF_FREEZE for all of the freezable tasks and
22sends a fake signal to each of them. A task that receives such a signal and has 22either wakes them up, if they are kernel threads, or sends fake signals to them,
23TIF_FREEZE set, should react to it by calling the refrigerator() function 23if they are user space processes. A task that has TIF_FREEZE set, should react
24(defined in kernel/power/process.c), which sets the task's PF_FROZEN flag, 24to it by calling the function called refrigerator() (defined in
25changes its state to TASK_UNINTERRUPTIBLE and makes it loop until PF_FROZEN is 25kernel/power/process.c), which sets the task's PF_FROZEN flag, changes its state
26cleared for it. Then, we say that the task is 'frozen' and therefore the set of 26to TASK_UNINTERRUPTIBLE and makes it loop until PF_FROZEN is cleared for it.
27functions handling this mechanism is called 'the freezer' (these functions are 27Then, we say that the task is 'frozen' and therefore the set of functions
28handling this mechanism is referred to as 'the freezer' (these functions are
28defined in kernel/power/process.c and include/linux/freezer.h). User space 29defined in kernel/power/process.c and include/linux/freezer.h). User space
29processes are generally frozen before kernel threads. 30processes are generally frozen before kernel threads.
30 31
@@ -35,21 +36,27 @@ task enter refrigerator() if the flag is set.
35 36
36For user space processes try_to_freeze() is called automatically from the 37For user space processes try_to_freeze() is called automatically from the
37signal-handling code, but the freezable kernel threads need to call it 38signal-handling code, but the freezable kernel threads need to call it
38explicitly in suitable places. The code to do this may look like the following: 39explicitly in suitable places or use the wait_event_freezable() or
40wait_event_freezable_timeout() macros (defined in include/linux/freezer.h)
41that combine interruptible sleep with checking if TIF_FREEZE is set and calling
42try_to_freeze(). The main loop of a freezable kernel thread may look like the
43following one:
39 44
45 set_freezable();
40 do { 46 do {
41 hub_events(); 47 hub_events();
42 wait_event_interruptible(khubd_wait, 48 wait_event_freezable(khubd_wait,
43 !list_empty(&hub_event_list)); 49 !list_empty(&hub_event_list) ||
44 try_to_freeze(); 50 kthread_should_stop());
45 } while (!signal_pending(current)); 51 } while (!kthread_should_stop() || !list_empty(&hub_event_list));
46 52
47(from drivers/usb/core/hub.c::hub_thread()). 53(from drivers/usb/core/hub.c::hub_thread()).
48 54
49If a freezable kernel thread fails to call try_to_freeze() after the freezer has 55If a freezable kernel thread fails to call try_to_freeze() after the freezer has
50set TIF_FREEZE for it, the freezing of tasks will fail and the entire 56set TIF_FREEZE for it, the freezing of tasks will fail and the entire
51hibernation operation will be cancelled. For this reason, freezable kernel 57hibernation operation will be cancelled. For this reason, freezable kernel
52threads must call try_to_freeze() somewhere. 58threads must call try_to_freeze() somewhere or use one of the
59wait_event_freezable() and wait_event_freezable_timeout() macros.
53 60
54After the system memory state has been restored from a hibernation image and 61After the system memory state has been restored from a hibernation image and
55devices have been reinitialized, the function thaw_processes() is called in 62devices have been reinitialized, the function thaw_processes() is called in
@@ -81,7 +88,16 @@ hibernation image has been created and before the system is finally powered off.
81The majority of these are user space processes, but if any of the kernel threads 88The majority of these are user space processes, but if any of the kernel threads
82may cause something like this to happen, they have to be freezable. 89may cause something like this to happen, they have to be freezable.
83 90
842. The second reason is to prevent user space processes and some kernel threads 912. Next, to create the hibernation image we need to free a sufficient amount of
92memory (approximately 50% of available RAM) and we need to do that before
93devices are deactivated, because we generally need them for swapping out. Then,
94after the memory for the image has been freed, we don't want tasks to allocate
95additional memory and we prevent them from doing that by freezing them earlier.
96[Of course, this also means that device drivers should not allocate substantial
97amounts of memory from their .suspend() callbacks before hibernation, but this
98is e separate issue.]
99
1003. The third reason is to prevent user space processes and some kernel threads
85from interfering with the suspending and resuming of devices. A user space 101from interfering with the suspending and resuming of devices. A user space
86process running on a second CPU while we are suspending devices may, for 102process running on a second CPU while we are suspending devices may, for
87example, be troublesome and without the freezing of tasks we would need some 103example, be troublesome and without the freezing of tasks we would need some
@@ -111,7 +127,7 @@ frozen before the driver's .suspend() callback is executed and it will be
111thawed after the driver's .resume() callback has run, so it won't be accessing 127thawed after the driver's .resume() callback has run, so it won't be accessing
112the device while it's suspended. 128the device while it's suspended.
113 129
1143. Another reason for freezing tasks is to prevent user space processes from 1304. Another reason for freezing tasks is to prevent user space processes from
115realizing that hibernation (or suspend) operation takes place. Ideally, user 131realizing that hibernation (or suspend) operation takes place. Ideally, user
116space processes should not notice that such a system-wide operation has occurred 132space processes should not notice that such a system-wide operation has occurred
117and should continue running without any problems after the restore (or resume 133and should continue running without any problems after the restore (or resume
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt
index fd5192a8fa8a..e67211fe0ee2 100644
--- a/Documentation/power/interface.txt
+++ b/Documentation/power/interface.txt
@@ -20,7 +20,7 @@ states.
20/sys/power/disk controls the operating mode of the suspend-to-disk 20/sys/power/disk controls the operating mode of the suspend-to-disk
21mechanism. Suspend-to-disk can be handled in several ways. We have a 21mechanism. Suspend-to-disk can be handled in several ways. We have a
22few options for putting the system to sleep - using the platform driver 22few options for putting the system to sleep - using the platform driver
23(e.g. ACPI or other pm_ops), powering off the system or rebooting the 23(e.g. ACPI or other suspend_ops), powering off the system or rebooting the
24system (for testing). 24system (for testing).
25 25
26Additionally, /sys/power/disk can be used to turn on one of the two testing 26Additionally, /sys/power/disk can be used to turn on one of the two testing
diff --git a/Documentation/power/swsusp-and-swap-files.txt b/Documentation/power/swsusp-and-swap-files.txt
index 06f911a5f885..f281886de490 100644
--- a/Documentation/power/swsusp-and-swap-files.txt
+++ b/Documentation/power/swsusp-and-swap-files.txt
@@ -39,7 +39,7 @@ resume=<swap_file_partition> resume_offset=<swap_file_offset>
39where <swap_file_partition> is the partition on which the swap file is located 39where <swap_file_partition> is the partition on which the swap file is located
40and <swap_file_offset> is the offset of the swap header determined by the 40and <swap_file_offset> is the offset of the swap header determined by the
41application in 2) (of course, this step may be carried out automatically 41application in 2) (of course, this step may be carried out automatically
42by the same application that determies the swap file's header offset using the 42by the same application that determines the swap file's header offset using the
43FIBMAP ioctl) 43FIBMAP ioctl)
44 44
45OR 45OR
diff --git a/Documentation/powerpc/eeh-pci-error-recovery.txt b/Documentation/powerpc/eeh-pci-error-recovery.txt
index 4530d1bf0286..df7afe43d462 100644
--- a/Documentation/powerpc/eeh-pci-error-recovery.txt
+++ b/Documentation/powerpc/eeh-pci-error-recovery.txt
@@ -36,8 +36,8 @@ Causes of EEH Errors
36EEH was originally designed to guard against hardware failure, such 36EEH was originally designed to guard against hardware failure, such
37as PCI cards dying from heat, humidity, dust, vibration and bad 37as PCI cards dying from heat, humidity, dust, vibration and bad
38electrical connections. The vast majority of EEH errors seen in 38electrical connections. The vast majority of EEH errors seen in
39"real life" are due to eithr poorly seated PCI cards, or, 39"real life" are due to either poorly seated PCI cards, or,
40unfortunately quite commonly, due device driver bugs, device firmware 40unfortunately quite commonly, due to device driver bugs, device firmware
41bugs, and sometimes PCI card hardware bugs. 41bugs, and sometimes PCI card hardware bugs.
42 42
43The most common software bug, is one that causes the device to 43The most common software bug, is one that causes the device to
diff --git a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
index e59fcbbe338c..5f7d536cb0c6 100644
--- a/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
+++ b/Documentation/powerpc/mpc52xx-device-tree-bindings.txt
@@ -17,12 +17,12 @@ passed by the boot loader to the kernel at boot time. The device tree
17describes what devices are present on the board and how they are 17describes what devices are present on the board and how they are
18connected. The device tree can either be passed as a binary blob (as 18connected. The device tree can either be passed as a binary blob (as
19described in Documentation/powerpc/booting-without-of.txt), or passed 19described in Documentation/powerpc/booting-without-of.txt), or passed
20by Open Firmare (IEEE 1275) compatible firmware using an OF compatible 20by Open Firmware (IEEE 1275) compatible firmware using an OF compatible
21client interface API. 21client interface API.
22 22
23This document specifies the requirements on the device-tree for mpc5200 23This document specifies the requirements on the device-tree for mpc5200
24based boards. These requirements are above and beyond the details 24based boards. These requirements are above and beyond the details
25specified in either the OpenFirmware spec or booting-without-of.txt 25specified in either the Open Firmware spec or booting-without-of.txt
26 26
27All new mpc5200-based boards are expected to match this document. In 27All new mpc5200-based boards are expected to match this document. In
28cases where this document is not sufficient to support a new board port, 28cases where this document is not sufficient to support a new board port,
@@ -73,8 +73,8 @@ match on the compatible list; the 'most compatible' driver should be
73selected. 73selected.
74 74
75The split between the MPC5200 and the MPC5200B leaves a bit of a 75The split between the MPC5200 and the MPC5200B leaves a bit of a
76connundrum. How should the compatible property be set up to provide 76conundrum. How should the compatible property be set up to provide
77maximum compatability information; but still acurately describe the 77maximum compatibility information; but still accurately describe the
78chip? For the MPC5200; the answer is easy. Most of the SoC devices 78chip? For the MPC5200; the answer is easy. Most of the SoC devices
79originally appeared on the MPC5200. Since they didn't exist anywhere 79originally appeared on the MPC5200. Since they didn't exist anywhere
80else; the 5200 compatible properties will contain only one item; 80else; the 5200 compatible properties will contain only one item;
@@ -84,7 +84,7 @@ The 5200B is almost the same as the 5200, but not quite. It fixes
84silicon bugs and it adds a small number of enhancements. Most of the 84silicon bugs and it adds a small number of enhancements. Most of the
85devices either provide exactly the same interface as on the 5200. A few 85devices either provide exactly the same interface as on the 5200. A few
86devices have extra functions but still have a backwards compatible mode. 86devices have extra functions but still have a backwards compatible mode.
87To express this infomation as completely as possible, 5200B device trees 87To express this information as completely as possible, 5200B device trees
88should have two items in the compatible list; 88should have two items in the compatible list;
89"mpc5200b-<device>\0mpc5200-<device>". It is *strongly* recommended 89"mpc5200b-<device>\0mpc5200-<device>". It is *strongly* recommended
90that 5200B device trees follow this convention (instead of only listing 90that 5200B device trees follow this convention (instead of only listing
@@ -199,7 +199,7 @@ ethernet@<addr> network mpc5200-fec MPC5200 ethernet device
199ata@<addr> ata mpc5200-ata IDE ATA interface 199ata@<addr> ata mpc5200-ata IDE ATA interface
200i2c@<addr> i2c mpc5200-i2c I2C controller 200i2c@<addr> i2c mpc5200-i2c I2C controller
201usb@<addr> usb-ohci-be mpc5200-ohci,ohci-be USB controller 201usb@<addr> usb-ohci-be mpc5200-ohci,ohci-be USB controller
202xlb@<addr> xlb mpc5200-xlb XLB arbritrator 202xlb@<addr> xlb mpc5200-xlb XLB arbitrator
203 203
204Important child node properties 204Important child node properties
205name type description 205name type description
diff --git a/Documentation/scsi/aic79xx.txt b/Documentation/scsi/aic79xx.txt
index 6aa9a891f3d0..683ccae00ad4 100644
--- a/Documentation/scsi/aic79xx.txt
+++ b/Documentation/scsi/aic79xx.txt
@@ -120,7 +120,7 @@ The following information is available in this file:
120 list size to avoid SCSI malloc pool fragmentation. 120 list size to avoid SCSI malloc pool fragmentation.
121 - Cleanup channel display in our /proc output. 121 - Cleanup channel display in our /proc output.
122 - Workaround duplicate device entries in the mid-layer 122 - Workaround duplicate device entries in the mid-layer
123 devlice list during add-single-device. 123 device list during add-single-device.
124 124
125 1.3.6 (March 28th, 2003) 125 1.3.6 (March 28th, 2003)
126 - Correct a double free in the Domain Validation code. 126 - Correct a double free in the Domain Validation code.
diff --git a/Documentation/scsi/aic7xxx.txt b/Documentation/scsi/aic7xxx.txt
index 5f34d2ba69b4..b7e238cbb5a7 100644
--- a/Documentation/scsi/aic7xxx.txt
+++ b/Documentation/scsi/aic7xxx.txt
@@ -159,7 +159,7 @@ The following information is available in this file:
159 - Add support for 2.5.X's scsi_report_device_reset(). 159 - Add support for 2.5.X's scsi_report_device_reset().
160 160
161 6.2.34 (May 5th, 2003) 161 6.2.34 (May 5th, 2003)
162 - Fix locking regression instroduced in 6.2.29 that 162 - Fix locking regression introduced in 6.2.29 that
163 could cause a lock order reversal between the io_request_lock 163 could cause a lock order reversal between the io_request_lock
164 and our per-softc lock. This was only possible on RH9, 164 and our per-softc lock. This was only possible on RH9,
165 SuSE, and kernel.org 2.4.X kernels. 165 SuSE, and kernel.org 2.4.X kernels.
@@ -264,7 +264,7 @@ The following information is available in this file:
264 Option: tag_info:{{value[,value...]}[,{value[,value...]}...]} 264 Option: tag_info:{{value[,value...]}[,{value[,value...]}...]}
265 Definition: Set the per-target tagged queue depth on a 265 Definition: Set the per-target tagged queue depth on a
266 per controller basis. Both controllers and targets 266 per controller basis. Both controllers and targets
267 may be ommitted indicating that they should retain 267 may be omitted indicating that they should retain
268 the default tag depth. 268 the default tag depth.
269 Examples: tag_info:{{16,32,32,64,8,8,,32,32,32,32,32,32,32,32,32} 269 Examples: tag_info:{{16,32,32,64,8,8,,32,32,32,32,32,32,32,32,32}
270 On Controller 0 270 On Controller 0
@@ -290,7 +290,7 @@ The following information is available in this file:
290 ----------------------------------------------------------------- 290 -----------------------------------------------------------------
291 Option: dv: {value[,value...]} 291 Option: dv: {value[,value...]}
292 Definition: Set Domain Validation Policy on a per-controller basis. 292 Definition: Set Domain Validation Policy on a per-controller basis.
293 Controllers may be ommitted indicating that 293 Controllers may be omitted indicating that
294 they should retain the default read streaming setting. 294 they should retain the default read streaming setting.
295 Example: dv:{-1,0,,1,1,0} 295 Example: dv:{-1,0,,1,1,0}
296 On Controller 0 leave DV at its default setting. 296 On Controller 0 leave DV at its default setting.
diff --git a/Documentation/scsi/arcmsr_spec.txt b/Documentation/scsi/arcmsr_spec.txt
index 5e0042340fd3..45d9482c1517 100644
--- a/Documentation/scsi/arcmsr_spec.txt
+++ b/Documentation/scsi/arcmsr_spec.txt
@@ -3,7 +3,7 @@
3******************************************************************************* 3*******************************************************************************
4** Usage of IOP331 adapter 4** Usage of IOP331 adapter
5** (All In/Out is in IOP331's view) 5** (All In/Out is in IOP331's view)
6** 1. Message 0 --> InitThread message and retrun code 6** 1. Message 0 --> InitThread message and return code
7** 2. Doorbell is used for RS-232 emulation 7** 2. Doorbell is used for RS-232 emulation
8** inDoorBell : bit0 -- data in ready 8** inDoorBell : bit0 -- data in ready
9** (DRIVER DATA WRITE OK) 9** (DRIVER DATA WRITE OK)
diff --git a/Documentation/scsi/ibmmca.txt b/Documentation/scsi/ibmmca.txt
index a08e225653d6..a810421f1fb3 100644
--- a/Documentation/scsi/ibmmca.txt
+++ b/Documentation/scsi/ibmmca.txt
@@ -21,7 +21,7 @@
21 versions older than 4.0 do not work with kernels 2.4.0 or later! If you 21 versions older than 4.0 do not work with kernels 2.4.0 or later! If you
22 try to compile your kernel with the wrong driver source, the 22 try to compile your kernel with the wrong driver source, the
23 compilation is aborted and you get a corresponding error message. This is 23 compilation is aborted and you get a corresponding error message. This is
24 no bug in the driver. It prevents you from using the wrong sourcecode 24 no bug in the driver; it prevents you from using the wrong source code
25 with the wrong kernel version. 25 with the wrong kernel version.
26 26
27 Authors of this Driver 27 Authors of this Driver
@@ -58,7 +58,7 @@
58 5 Users' Manual 58 5 Users' Manual
59 5.1 Commandline Parameters 59 5.1 Commandline Parameters
60 5.2 Troubleshooting 60 5.2 Troubleshooting
61 5.3 Bugreports 61 5.3 Bug reports
62 5.4 Support WWW-page 62 5.4 Support WWW-page
63 6 References 63 6 References
64 7 Credits to 64 7 Credits to
@@ -71,13 +71,13 @@
71 71
72 1 Abstract 72 1 Abstract
73 ---------- 73 ----------
74 This README-file describes the IBM SCSI-subsystem low level driver for 74 This README-file describes the IBM SCSI-subsystem low level driver for
75 Linux. The descriptions which were formerly kept in the source-code have 75 Linux. The descriptions which were formerly kept in the source code have
76 been taken out to this file to easify the codes' readability. The driver 76 been taken out of this file to simplify the codes readability. The driver
77 description has been updated, as most of the former description was already 77 description has been updated, as most of the former description was already
78 quite outdated. The history of the driver development is also kept inside 78 quite outdated. The history of the driver development is also kept inside
79 here. Multiple historical developments have been summarized to shorten the 79 here. Multiple historical developments have been summarized to shorten the
80 textsize a bit. At the end of this file you can find a small manual for 80 text size a bit. At the end of this file you can find a small manual for
81 this driver and hints to get it running on your machine. 81 this driver and hints to get it running on your machine.
82 82
83 2 Driver Description 83 2 Driver Description
@@ -186,7 +186,7 @@
186 between 0 and 7). The IBM SCSI-2 F/W adapter offers this on up to two 186 between 0 and 7). The IBM SCSI-2 F/W adapter offers this on up to two
187 busses and provides support for 30 logical devices at the same time, where 187 busses and provides support for 30 logical devices at the same time, where
188 in wide-addressing mode you can have 16 puns with 32 luns on each device. 188 in wide-addressing mode you can have 16 puns with 32 luns on each device.
189 This section dexribes you the handling of devices on non-F/W adapters. 189 This section describes the handling of devices on non-F/W adapters.
190 Just imagine, that you can have 16 * 32 = 512 devices on a F/W adapter 190 Just imagine, that you can have 16 * 32 = 512 devices on a F/W adapter
191 which means a lot of possible devices for such a small machine. 191 which means a lot of possible devices for such a small machine.
192 192
@@ -209,10 +209,10 @@
209 -------------------------------------------------------- 209 --------------------------------------------------------
210 One consequence of information hiding is that the real (pun,lun) 210 One consequence of information hiding is that the real (pun,lun)
211 numbers are also hidden. The two possibilities to get around this problem 211 numbers are also hidden. The two possibilities to get around this problem
212 is to offer fake pun/lun combinations to the operating system or to 212 are to offer fake pun/lun combinations to the operating system or to
213 delete the whole mapping of the adapter and to reassign the ldns, using 213 delete the whole mapping of the adapter and to reassign the ldns, using
214 the immediate assign command of the SCSI-subsystem for probing through 214 the immediate assign command of the SCSI-subsystem for probing through
215 all possible pun/lun combinations. a ldn is a "logical device number" 215 all possible pun/lun combinations. An ldn is a "logical device number"
216 which is used by IBM SCSI-subsystems to access some valid SCSI-device. 216 which is used by IBM SCSI-subsystems to access some valid SCSI-device.
217 At the beginning of the development of this driver, the following approach 217 At the beginning of the development of this driver, the following approach
218 was used: 218 was used:
@@ -251,9 +251,9 @@
251 lun>0 or to non-existing devices, in order to satisfy the subsystem, if 251 lun>0 or to non-existing devices, in order to satisfy the subsystem, if
252 there are less than 15 SCSI-devices connected. In the case of more than 15 252 there are less than 15 SCSI-devices connected. In the case of more than 15
253 devices, the dynamical mapping goes active. If the get_scsi[][] reports a 253 devices, the dynamical mapping goes active. If the get_scsi[][] reports a
254 device to be existant, but it has no ldn assigned, it gets a ldn out of 7 254 device to be existent, but it has no ldn assigned, it gets an ldn out of 7
255 to 14. The numbers are assigned in cyclic order. Therefore it takes 8 255 to 14. The numbers are assigned in cyclic order, therefore it takes 8
256 dynamical reassignments on the SCSI-devices, until a certain device 256 dynamical reassignments on the SCSI-devices until a certain device
257 loses its ldn again. This assures that dynamical remapping is avoided 257 loses its ldn again. This assures that dynamical remapping is avoided
258 during intense I/O between up to 15 SCSI-devices (means pun,lun 258 during intense I/O between up to 15 SCSI-devices (means pun,lun
259 combinations). A further advantage of this method is that people who 259 combinations). A further advantage of this method is that people who
@@ -551,7 +551,7 @@
551 than devices are available, they are assigned to non existing pun,lun 551 than devices are available, they are assigned to non existing pun,lun
552 combinations to satisfy the adapter. With this, the dynamical mapping 552 combinations to satisfy the adapter. With this, the dynamical mapping
553 was possible to implement. (For further info see the text in the 553 was possible to implement. (For further info see the text in the
554 source-code and in the description below. Read the description 554 source code and in the description below. Read the description
555 below BEFORE installing this driver on your system!) 555 below BEFORE installing this driver on your system!)
556 2) Changed the name IBMMCA_DRIVER_VERSION to IBMMCA_SCSI_DRIVER_VERSION. 556 2) Changed the name IBMMCA_DRIVER_VERSION to IBMMCA_SCSI_DRIVER_VERSION.
557 3) The LED-display shows on PS/2-95 no longer the ldn, but the SCSI-ID 557 3) The LED-display shows on PS/2-95 no longer the ldn, but the SCSI-ID
@@ -762,9 +762,9 @@
762 - Michael Lang 762 - Michael Lang
763 763
764 Apr 23, 2000 (v3.2pre1) 764 Apr 23, 2000 (v3.2pre1)
765 1) During a very long time, I collected a huge amount of bugreports from 765 1) During a very long time, I collected a huge amount of bug reports from
766 various people, trying really quite different things on their SCSI- 766 various people, trying really quite different things on their SCSI-
767 PS/2s. Today, all these bugreports are taken into account and should be 767 PS/2s. Today, all these bug reports are taken into account and should be
768 mostly solved. The major topics were: 768 mostly solved. The major topics were:
769 - Driver crashes during boottime by no obvious reason. 769 - Driver crashes during boottime by no obvious reason.
770 - Driver panics while the midlevel-SCSI-driver is trying to inquire 770 - Driver panics while the midlevel-SCSI-driver is trying to inquire
@@ -819,7 +819,7 @@
819 - Michael Lang 819 - Michael Lang
820 820
821 July 17, 2000 (v3.2pre8) 821 July 17, 2000 (v3.2pre8)
822 A long period of collecting bugreports from all corners of the world 822 A long period of collecting bug reports from all corners of the world
823 now lead to the following corrections to the code: 823 now lead to the following corrections to the code:
824 1) SCSI-2 F/W support crashed with a COMMAND ERROR. The reason for this 824 1) SCSI-2 F/W support crashed with a COMMAND ERROR. The reason for this
825 was that it is possible to disable Fast-SCSI for the external bus. 825 was that it is possible to disable Fast-SCSI for the external bus.
@@ -873,7 +873,7 @@
873 July 26, 2000 (v3.2pre11) 873 July 26, 2000 (v3.2pre11)
874 1) I passed a horrible weekend getting mad with NMIs on kernel 2.2.14 and 874 1) I passed a horrible weekend getting mad with NMIs on kernel 2.2.14 and
875 a model 9595. Asking around in the community, nobody except of me has 875 a model 9595. Asking around in the community, nobody except of me has
876 seen such errors. Weired, but I am trying to recompile everything on 876 seen such errors. Weird, but I am trying to recompile everything on
877 the model 9595. Maybe, as I use a specially modified gcc, that could 877 the model 9595. Maybe, as I use a specially modified gcc, that could
878 cause problems. But, it was not the reason. The true background was, 878 cause problems. But, it was not the reason. The true background was,
879 that the kernel was compiled for i386 and the 9595 has a 486DX-2. 879 that the kernel was compiled for i386 and the 9595 has a 486DX-2.
@@ -886,7 +886,7 @@
886 alive rotator during boottime. This makes sense, when no monitor is 886 alive rotator during boottime. This makes sense, when no monitor is
887 connected to the system. You can get rid of all display activity, if 887 connected to the system. You can get rid of all display activity, if
888 you do not use any parameter or just ibmmcascsi=activity, for the 888 you do not use any parameter or just ibmmcascsi=activity, for the
889 harddrive activity LED, existant on all PS/2, except models 8595-XXX. 889 harddrive activity LED, existent on all PS/2, except models 8595-XXX.
890 If no monitor is available, please use ibmmcascsi=display, which works 890 If no monitor is available, please use ibmmcascsi=display, which works
891 fine together with the linuxinfo utility for the LED-panel. 891 fine together with the linuxinfo utility for the LED-panel.
892 - Michael Lang 892 - Michael Lang
@@ -1115,7 +1115,7 @@
1115 If this really happens, do also send e-mail to the maintainer, as 1115 If this really happens, do also send e-mail to the maintainer, as
1116 forced detection should be never necessary. Forced detection is in 1116 forced detection should be never necessary. Forced detection is in
1117 principal some flaw of the driver adapter detection and goes into 1117 principal some flaw of the driver adapter detection and goes into
1118 bugreports. 1118 bug reports.
1119 Q: The driver screws up, if it starts to probe SCSI-devices, is there 1119 Q: The driver screws up, if it starts to probe SCSI-devices, is there
1120 some way out of it? 1120 some way out of it?
1121 A: Yes, that was some recognition problem of the correct SCSI-adapter 1121 A: Yes, that was some recognition problem of the correct SCSI-adapter
@@ -1172,7 +1172,7 @@
1172 recommended version is 3.2 or later. Here, the F/W support is in 1172 recommended version is 3.2 or later. Here, the F/W support is in
1173 a stable and reliable condition. Wide-addressing is in addition 1173 a stable and reliable condition. Wide-addressing is in addition
1174 supported. 1174 supported.
1175 Q: I get a Ooops message and something like "killing interrupt". 1175 Q: I get an Oops message and something like "killing interrupt".
1176 A: The reason for this is that the IBM SCSI-subsystem only sends a 1176 A: The reason for this is that the IBM SCSI-subsystem only sends a
1177 termination status back, if some error appeared. In former releases 1177 termination status back, if some error appeared. In former releases
1178 of the driver, it was not checked, if the termination status block 1178 of the driver, it was not checked, if the termination status block
@@ -1213,21 +1213,21 @@
1213 problem. Not yet tried, but guessing that it could work. To get this, 1213 problem. Not yet tried, but guessing that it could work. To get this,
1214 set unchecked_isa_dma argument of ibmmca.h from 0 to 1. 1214 set unchecked_isa_dma argument of ibmmca.h from 0 to 1.
1215 1215
1216 5.3 Bugreports 1216 5.3 Bug reports
1217 -------------- 1217 --------------
1218 If you really find bugs in the sourcecode or the driver will successfully 1218 If you really find bugs in the source code or the driver will successfully
1219 refuse to work on your machine, you should send a bug report to me. The 1219 refuse to work on your machine, you should send a bug report to me. The
1220 best for this is to follow the instructions on the WWW-page for this 1220 best for this is to follow the instructions on the WWW-page for this
1221 driver. Fill out the bug-report form, placed on the WWW-page and ship it, 1221 driver. Fill out the bug-report form, placed on the WWW-page and ship it,
1222 so the bugs can be taken into account with maximum efforts. But, please 1222 so the bugs can be taken into account with maximum efforts. But, please
1223 do not send bug reports about this driver to Linus Torvalds or Leonard 1223 do not send bug reports about this driver to Linus Torvalds or Leonard
1224 Zubkoff, as Linus is burried in E-Mail and Leonard is supervising all 1224 Zubkoff, as Linus is buried in E-Mail and Leonard is supervising all
1225 SCSI-drivers and won't have the time left to look inside every single 1225 SCSI-drivers and won't have the time left to look inside every single
1226 driver to fix a bug and especially DO NOT send modified code to Linus 1226 driver to fix a bug and especially DO NOT send modified code to Linus
1227 Torvalds or Alan J. Cox which has not been checked here!!! They are both 1227 Torvalds or Alan J. Cox which has not been checked here!!! They are both
1228 quite burried in E-mail (as me, sometimes, too) and one should first check 1228 quite buried in E-mail (as me, sometimes, too) and one should first check
1229 for problems on my local teststand. Recently, I got a lot of 1229 for problems on my local teststand. Recently, I got a lot of
1230 bugreports for errors in the ibmmca.c code, which I could not imagine, but 1230 bug reports for errors in the ibmmca.c code, which I could not imagine, but
1231 a look inside some Linux-distribution showed me quite often some modified 1231 a look inside some Linux-distribution showed me quite often some modified
1232 code, which did no longer work on most other machines than the one of the 1232 code, which did no longer work on most other machines than the one of the
1233 modifier. Ok, so now that there is maintenance service available for this 1233 modifier. Ok, so now that there is maintenance service available for this
@@ -1261,7 +1261,7 @@
1261 some e-mail directly, but at least with the same information as required by 1261 some e-mail directly, but at least with the same information as required by
1262 the formular. 1262 the formular.
1263 1263
1264 If you have extensive bugreports, including Ooops messages and 1264 If you have extensive bug reports, including Oops messages and
1265 screen-shots, please feel free to send it directly to the address 1265 screen-shots, please feel free to send it directly to the address
1266 of the maintainer, too. The current address of the maintainer is: 1266 of the maintainer, too. The current address of the maintainer is:
1267 1267
@@ -1318,7 +1318,7 @@
1318 detailed bug reports and ideas for this driver (and his 1318 detailed bug reports and ideas for this driver (and his
1319 patience ;-)). 1319 patience ;-)).
1320 Alan J. Cox 1320 Alan J. Cox
1321 for his bugreports and his bold activities in cross-checking 1321 for his bug reports and his bold activities in cross-checking
1322 the driver-code with his teststand. 1322 the driver-code with his teststand.
1323 1323
1324 7.2 Sponsors & Supporters 1324 7.2 Sponsors & Supporters
diff --git a/Documentation/sharedsubtree.txt b/Documentation/sharedsubtree.txt
index ccf1cebe744f..736540045dc7 100644
--- a/Documentation/sharedsubtree.txt
+++ b/Documentation/sharedsubtree.txt
@@ -153,6 +153,7 @@ replicas continue to be exactly same.
153 #include <stdio.h> 153 #include <stdio.h>
154 #include <stdlib.h> 154 #include <stdlib.h>
155 #include <unistd.h> 155 #include <unistd.h>
156 #include <string.h>
156 #include <sys/mount.h> 157 #include <sys/mount.h>
157 #include <sys/fsuid.h> 158 #include <sys/fsuid.h>
158 159
diff --git a/Documentation/sound/alsa/soc/DAI.txt b/Documentation/sound/alsa/soc/DAI.txt
index 58cbfd01ea8f..3feeb9ecdec4 100644
--- a/Documentation/sound/alsa/soc/DAI.txt
+++ b/Documentation/sound/alsa/soc/DAI.txt
@@ -20,12 +20,12 @@ I2S
20=== 20===
21 21
22 I2S is a common 4 wire DAI used in HiFi, STB and portable devices. The Tx and 22 I2S is a common 4 wire DAI used in HiFi, STB and portable devices. The Tx and
23Rx lines are used for audio transmision, whilst the bit clock (BCLK) and 23Rx lines are used for audio transmission, whilst the bit clock (BCLK) and
24left/right clock (LRC) synchronise the link. I2S is flexible in that either the 24left/right clock (LRC) synchronise the link. I2S is flexible in that either the
25controller or CODEC can drive (master) the BCLK and LRC clock lines. Bit clock 25controller or CODEC can drive (master) the BCLK and LRC clock lines. Bit clock
26usually varies depending on the sample rate and the master system clock 26usually varies depending on the sample rate and the master system clock
27(SYSCLK). LRCLK is the same as the sample rate. A few devices support separate 27(SYSCLK). LRCLK is the same as the sample rate. A few devices support separate
28ADC and DAC LRCLK's, this allows for similtanious capture and playback at 28ADC and DAC LRCLK's, this allows for simultaneous capture and playback at
29different sample rates. 29different sample rates.
30 30
31I2S has several different operating modes:- 31I2S has several different operating modes:-
@@ -41,12 +41,12 @@ I2S has several different operating modes:-
41PCM 41PCM
42=== 42===
43 43
44PCM is another 4 wire interface, very similar to I2S, that can support a more 44PCM is another 4 wire interface, very similar to I2S, which can support a more
45flexible protocol. It has bit clock (BCLK) and sync (SYNC) lines that are used 45flexible protocol. It has bit clock (BCLK) and sync (SYNC) lines that are used
46to synchronise the link whilst the Tx and Rx lines are used to transmit and 46to synchronise the link whilst the Tx and Rx lines are used to transmit and
47receive the audio data. Bit clock usually varies depending on sample rate 47receive the audio data. Bit clock usually varies depending on sample rate
48whilst sync runs at the sample rate. PCM also supports Time Division 48whilst sync runs at the sample rate. PCM also supports Time Division
49Multiplexing (TDM) in that several devices can use the bus similtaniuosly (This 49Multiplexing (TDM) in that several devices can use the bus simultaneously (this
50is sometimes referred to as network mode). 50is sometimes referred to as network mode).
51 51
52Common PCM operating modes:- 52Common PCM operating modes:-
diff --git a/Documentation/sound/alsa/soc/clocking.txt b/Documentation/sound/alsa/soc/clocking.txt
index e93960d53a1e..14930887c25f 100644
--- a/Documentation/sound/alsa/soc/clocking.txt
+++ b/Documentation/sound/alsa/soc/clocking.txt
@@ -2,20 +2,20 @@ Audio Clocking
2============== 2==============
3 3
4This text describes the audio clocking terms in ASoC and digital audio in 4This text describes the audio clocking terms in ASoC and digital audio in
5general. Note: Audio clocking can be complex ! 5general. Note: Audio clocking can be complex!
6 6
7 7
8Master Clock 8Master Clock
9------------ 9------------
10 10
11Every audio subsystem is driven by a master clock (sometimes refered to as MCLK 11Every audio subsystem is driven by a master clock (sometimes referred to as MCLK
12or SYSCLK). This audio master clock can be derived from a number of sources 12or SYSCLK). This audio master clock can be derived from a number of sources
13(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct 13(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct
14audio playback and capture sample rates. 14audio playback and capture sample rates.
15 15
16Some master clocks (e.g. PLL's and CPU based clocks) are configuarble in that 16Some master clocks (e.g. PLL's and CPU based clocks) are configurable in that
17their speed can be altered by software (depending on the system use and to save 17their speed can be altered by software (depending on the system use and to save
18power). Other master clocks are fixed at at set frequency (i.e. crystals). 18power). Other master clocks are fixed at a set frequency (i.e. crystals).
19 19
20 20
21DAI Clocks 21DAI Clocks
@@ -44,7 +44,7 @@ This relationship depends on the codec or SoC CPU in particular. In general
44it's best to configure BCLK to the lowest possible speed (depending on your 44it's best to configure BCLK to the lowest possible speed (depending on your
45rate, number of channels and wordsize) to save on power. 45rate, number of channels and wordsize) to save on power.
46 46
47It's also desireable to use the codec (if possible) to drive (or master) the 47It's also desirable to use the codec (if possible) to drive (or master) the
48audio clocks as it's usually gives more accurate sample rates than the CPU. 48audio clocks as it's usually gives more accurate sample rates than the CPU.
49 49
50 50
diff --git a/Documentation/sound/alsa/soc/codec.txt b/Documentation/sound/alsa/soc/codec.txt
index 48983c75aad9..1e766ad0ebd1 100644
--- a/Documentation/sound/alsa/soc/codec.txt
+++ b/Documentation/sound/alsa/soc/codec.txt
@@ -19,7 +19,7 @@ Optionally, codec drivers can also provide:-
19 6) DAPM event handler. 19 6) DAPM event handler.
20 7) DAC Digital mute control. 20 7) DAC Digital mute control.
21 21
22It's probably best to use this guide in conjuction with the existing codec 22It's probably best to use this guide in conjunction with the existing codec
23driver code in sound/soc/codecs/ 23driver code in sound/soc/codecs/
24 24
25ASoC Codec driver breakdown 25ASoC Codec driver breakdown
@@ -28,7 +28,7 @@ ASoC Codec driver breakdown
281 - Codec DAI and PCM configuration 281 - Codec DAI and PCM configuration
29----------------------------------- 29-----------------------------------
30Each codec driver must have a struct snd_soc_codec_dai to define it's DAI and 30Each codec driver must have a struct snd_soc_codec_dai to define it's DAI and
31PCM's capablities and operations. This struct is exported so that it can be 31PCM's capabilities and operations. This struct is exported so that it can be
32registered with the core by your machine driver. 32registered with the core by your machine driver.
33 33
34e.g. 34e.g.
@@ -67,7 +67,7 @@ EXPORT_SYMBOL_GPL(wm8731_dai);
67 67
682 - Codec control IO 682 - Codec control IO
69-------------------- 69--------------------
70The codec can ususally be controlled via an I2C or SPI style interface (AC97 70The codec can usually be controlled via an I2C or SPI style interface (AC97
71combines control with data in the DAI). The codec drivers will have to provide 71combines control with data in the DAI). The codec drivers will have to provide
72functions to read and write the codec registers along with supplying a register 72functions to read and write the codec registers along with supplying a register
73cache:- 73cache:-
diff --git a/Documentation/sound/alsa/soc/dapm.txt b/Documentation/sound/alsa/soc/dapm.txt
index c11877f5b4a1..ab0766fd7869 100644
--- a/Documentation/sound/alsa/soc/dapm.txt
+++ b/Documentation/sound/alsa/soc/dapm.txt
@@ -11,7 +11,7 @@ other PM systems.
11 11
12DAPM is also completely transparent to all user space applications as all power 12DAPM is also completely transparent to all user space applications as all power
13switching is done within the ASoC core. No code changes or recompiling are 13switching is done within the ASoC core. No code changes or recompiling are
14required for user space applications. DAPM makes power switching descisions based 14required for user space applications. DAPM makes power switching decisions based
15upon any audio stream (capture/playback) activity and audio mixer settings 15upon any audio stream (capture/playback) activity and audio mixer settings
16within the device. 16within the device.
17 17
@@ -38,7 +38,7 @@ There are 4 power domains within DAPM
38 Enabled and disabled when stream playback/capture is started and 38 Enabled and disabled when stream playback/capture is started and
39 stopped respectively. e.g. aplay, arecord. 39 stopped respectively. e.g. aplay, arecord.
40 40
41All DAPM power switching descisons are made automatically by consulting an audio 41All DAPM power switching decisions are made automatically by consulting an audio
42routing map of the whole machine. This map is specific to each machine and 42routing map of the whole machine. This map is specific to each machine and
43consists of the interconnections between every audio component (including 43consists of the interconnections between every audio component (including
44internal codec components). All audio components that effect power are called 44internal codec components). All audio components that effect power are called
diff --git a/Documentation/sound/alsa/soc/overview.txt b/Documentation/sound/alsa/soc/overview.txt
index 753c5cc5984a..c47ce9530677 100644
--- a/Documentation/sound/alsa/soc/overview.txt
+++ b/Documentation/sound/alsa/soc/overview.txt
@@ -2,18 +2,19 @@ ALSA SoC Layer
2============== 2==============
3 3
4The overall project goal of the ALSA System on Chip (ASoC) layer is to provide 4The overall project goal of the ALSA System on Chip (ASoC) layer is to provide
5better ALSA support for embedded system on chip procesors (e.g. pxa2xx, au1x00, 5better ALSA support for embedded system-on-chip processors (e.g. pxa2xx, au1x00,
6iMX, etc) and portable audio codecs. Currently there is some support in the 6iMX, etc) and portable audio codecs. Currently there is some support in the
7kernel for SoC audio, however it has some limitations:- 7kernel for SoC audio, however it has some limitations:-
8 8
9 * Currently, codec drivers are often tightly coupled to the underlying SoC 9 * Currently, codec drivers are often tightly coupled to the underlying SoC
10 cpu. This is not ideal and leads to code duplication i.e. Linux now has 4 10 CPU. This is not ideal and leads to code duplication i.e. Linux now has 4
11 different wm8731 drivers for 4 different SoC platforms. 11 different wm8731 drivers for 4 different SoC platforms.
12 12
13 * There is no standard method to signal user initiated audio events. 13 * There is no standard method to signal user initiated audio events (e.g.
14 e.g. Headphone/Mic insertion, Headphone/Mic detection after an insertion 14 Headphone/Mic insertion, Headphone/Mic detection after an insertion
15 event. These are quite common events on portable devices and ofter require 15 event). These are quite common events on portable devices and often require
16 machine specific code to re route audio, enable amps etc after such an event. 16 machine specific code to re-route audio, enable amps, etc., after such an
17 event.
17 18
18 * Current drivers tend to power up the entire codec when playing 19 * Current drivers tend to power up the entire codec when playing
19 (or recording) audio. This is fine for a PC, but tends to waste a lot of 20 (or recording) audio. This is fine for a PC, but tends to waste a lot of
@@ -44,7 +45,7 @@ features :-
44 signals the codec when to change power states. 45 signals the codec when to change power states.
45 46
46 * Machine specific controls: Allow machines to add controls to the sound card 47 * Machine specific controls: Allow machines to add controls to the sound card
47 e.g. volume control for speaker amp. 48 (e.g. volume control for speaker amp).
48 49
49To achieve all this, ASoC basically splits an embedded audio system into 3 50To achieve all this, ASoC basically splits an embedded audio system into 3
50components :- 51components :-
@@ -57,7 +58,7 @@ components :-
57 interface drivers (e.g. I2S, AC97, PCM) for that platform. 58 interface drivers (e.g. I2S, AC97, PCM) for that platform.
58 59
59 * Machine driver: The machine driver handles any machine specific controls and 60 * Machine driver: The machine driver handles any machine specific controls and
60 audio events. i.e. turing on an amp at start of playback. 61 audio events (e.g. turning on an amp at start of playback).
61 62
62 63
63Documentation 64Documentation
diff --git a/Documentation/sound/alsa/soc/platform.txt b/Documentation/sound/alsa/soc/platform.txt
index e95b16d5a53b..d4678b4dc6c6 100644
--- a/Documentation/sound/alsa/soc/platform.txt
+++ b/Documentation/sound/alsa/soc/platform.txt
@@ -20,7 +20,7 @@ struct snd_soc_ops {
20 int (*trigger)(struct snd_pcm_substream *, int); 20 int (*trigger)(struct snd_pcm_substream *, int);
21}; 21};
22 22
23The platform driver exports it's DMA functionailty via struct snd_soc_platform:- 23The platform driver exports its DMA functionality via struct snd_soc_platform:-
24 24
25struct snd_soc_platform { 25struct snd_soc_platform {
26 char *name; 26 char *name;
diff --git a/Documentation/sound/alsa/soc/pops_clicks.txt b/Documentation/sound/alsa/soc/pops_clicks.txt
index 2cf7ee5b3d74..3371bd9d7cfa 100644
--- a/Documentation/sound/alsa/soc/pops_clicks.txt
+++ b/Documentation/sound/alsa/soc/pops_clicks.txt
@@ -2,7 +2,7 @@ Audio Pops and Clicks
2===================== 2=====================
3 3
4Pops and clicks are unwanted audio artifacts caused by the powering up and down 4Pops and clicks are unwanted audio artifacts caused by the powering up and down
5of components within the audio subsystem. This is noticable on PC's when an 5of components within the audio subsystem. This is noticeable on PCs when an
6audio module is either loaded or unloaded (at module load time the sound card is 6audio module is either loaded or unloaded (at module load time the sound card is
7powered up and causes a popping noise on the speakers). 7powered up and causes a popping noise on the speakers).
8 8
@@ -16,7 +16,7 @@ Minimising Playback Pops and Clicks
16=================================== 16===================================
17 17
18Playback pops in portable audio subsystems cannot be completely eliminated atm, 18Playback pops in portable audio subsystems cannot be completely eliminated atm,
19however future audio codec hardware will have better pop and click supression. 19however future audio codec hardware will have better pop and click suppression.
20Pops can be reduced within playback by powering the audio components in a 20Pops can be reduced within playback by powering the audio components in a
21specific order. This order is different for startup and shutdown and follows 21specific order. This order is different for startup and shutdown and follows
22some basic rules:- 22some basic rules:-
@@ -33,7 +33,7 @@ Minimising Capture Pops and Clicks
33================================== 33==================================
34 34
35Capture artifacts are somewhat easier to get rid as we can delay activating the 35Capture artifacts are somewhat easier to get rid as we can delay activating the
36ADC until all the pops have occured. This follows similar power rules to 36ADC until all the pops have occurred. This follows similar power rules to
37playback in that components are powered in a sequence depending upon stream 37playback in that components are powered in a sequence depending upon stream
38startup or shutdown. 38startup or shutdown.
39 39
diff --git a/Documentation/sound/oss/es1371 b/Documentation/sound/oss/es1371
deleted file mode 100644
index c3151266771c..000000000000
--- a/Documentation/sound/oss/es1371
+++ /dev/null
@@ -1,64 +0,0 @@
1/proc/sound, /dev/sndstat
2-------------------------
3
4/proc/sound and /dev/sndstat is not supported by the
5driver. To find out whether the driver succeeded loading,
6check the kernel log (dmesg).
7
8
9ALaw/uLaw sample formats
10------------------------
11
12This driver does not support the ALaw/uLaw sample formats.
13ALaw is the default mode when opening a sound device
14using OSS/Free. The reason for the lack of support is
15that the hardware does not support these formats, and adding
16conversion routines to the kernel would lead to very ugly
17code in the presence of the mmap interface to the driver.
18And since xquake uses mmap, mmap is considered important :-)
19and no sane application uses ALaw/uLaw these days anyway.
20In short, playing a Sun .au file as follows:
21
22cat my_file.au > /dev/dsp
23
24does not work. Instead, you may use the play script from
25Chris Bagwell's sox-12.14 package (available from the URL
26below) to play many different audio file formats.
27The script automatically determines the audio format
28and does do audio conversions if necessary.
29http://home.sprynet.com/sprynet/cbagwell/projects.html
30
31
32Blocking vs. nonblocking IO
33---------------------------
34
35Unlike OSS/Free this driver honours the O_NONBLOCK file flag
36not only during open, but also during read and write.
37This is an effort to make the sound driver interface more
38regular. Timidity has problems with this; a patch
39is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html.
40(Timidity patched will also run on OSS/Free).
41
42
43MIDI UART
44---------
45
46The driver supports a simple MIDI UART interface, with
47no ioctl's supported.
48
49
50MIDI synthesizer
51----------------
52
53This soundcard does not have any hardware MIDI synthesizer;
54MIDI synthesis has to be done in software. To allow this
55the driver/soundcard supports two PCM (/dev/dsp) interfaces.
56
57There is a freely available software package that allows
58MIDI file playback on this soundcard called Timidity.
59See http://www.cgs.fi/~tt/timidity/.
60
61
62
63Thomas Sailer
64t.sailer@alumni.ethz.ch
diff --git a/Documentation/spi/pxa2xx b/Documentation/spi/pxa2xx
index 215e3b8e7266..f3853cc37bde 100644
--- a/Documentation/spi/pxa2xx
+++ b/Documentation/spi/pxa2xx
@@ -1,4 +1,4 @@
1PXA2xx SPI on SSP driver HOWTO 1PXA2xx SPI on SSP driver HOWTO
2=================================================== 2===================================================
3This a mini howto on the pxa2xx_spi driver. The driver turns a PXA2xx 3This a mini howto on the pxa2xx_spi driver. The driver turns a PXA2xx
4synchronous serial port into a SPI master controller 4synchronous serial port into a SPI master controller
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt
index 60953d6c919d..ec499265deca 100644
--- a/Documentation/thinkpad-acpi.txt
+++ b/Documentation/thinkpad-acpi.txt
@@ -105,10 +105,15 @@ The version of thinkpad-acpi's sysfs interface is exported by the driver
105as a driver attribute (see below). 105as a driver attribute (see below).
106 106
107Sysfs driver attributes are on the driver's sysfs attribute space, 107Sysfs driver attributes are on the driver's sysfs attribute space,
108for 2.6.20 this is /sys/bus/platform/drivers/thinkpad_acpi/. 108for 2.6.23 this is /sys/bus/platform/drivers/thinkpad_acpi/ and
109/sys/bus/platform/drivers/thinkpad_hwmon/
109 110
110Sysfs device attributes are on the driver's sysfs attribute space, 111Sysfs device attributes are on the thinkpad_acpi device sysfs attribute
111for 2.6.20 this is /sys/devices/platform/thinkpad_acpi/. 112space, for 2.6.23 this is /sys/devices/platform/thinkpad_acpi/.
113
114Sysfs device attributes for the sensors and fan are on the
115thinkpad_hwmon device's sysfs attribute space, but you should locate it
116looking for a hwmon device with the name attribute of "thinkpad".
112 117
113Driver version 118Driver version
114-------------- 119--------------
@@ -766,7 +771,7 @@ Temperature sensors
766------------------- 771-------------------
767 772
768procfs: /proc/acpi/ibm/thermal 773procfs: /proc/acpi/ibm/thermal
769sysfs device attributes: (hwmon) temp*_input 774sysfs device attributes: (hwmon "thinkpad") temp*_input
770 775
771Most ThinkPads include six or more separate temperature sensors but only 776Most ThinkPads include six or more separate temperature sensors but only
772expose the CPU temperature through the standard ACPI methods. This 777expose the CPU temperature through the standard ACPI methods. This
@@ -989,7 +994,9 @@ Fan control and monitoring: fan speed, fan enable/disable
989--------------------------------------------------------- 994---------------------------------------------------------
990 995
991procfs: /proc/acpi/ibm/fan 996procfs: /proc/acpi/ibm/fan
992sysfs device attributes: (hwmon) fan_input, pwm1, pwm1_enable 997sysfs device attributes: (hwmon "thinkpad") fan1_input, pwm1,
998 pwm1_enable
999sysfs hwmon driver attributes: fan_watchdog
993 1000
994NOTE NOTE NOTE: fan control operations are disabled by default for 1001NOTE NOTE NOTE: fan control operations are disabled by default for
995safety reasons. To enable them, the module parameter "fan_control=1" 1002safety reasons. To enable them, the module parameter "fan_control=1"
@@ -1028,7 +1035,7 @@ enable it if necessary to avoid overheating.
1028 1035
1029An enabled fan in level "auto" may stop spinning if the EC decides the 1036An enabled fan in level "auto" may stop spinning if the EC decides the
1030ThinkPad is cool enough and doesn't need the extra airflow. This is 1037ThinkPad is cool enough and doesn't need the extra airflow. This is
1031normal, and the EC will spin the fan up if the varios thermal readings 1038normal, and the EC will spin the fan up if the various thermal readings
1032rise too much. 1039rise too much.
1033 1040
1034On the X40, this seems to depend on the CPU and HDD temperatures. 1041On the X40, this seems to depend on the CPU and HDD temperatures.
@@ -1131,7 +1138,7 @@ hwmon device attribute fan1_input:
1131 which can take up to two minutes. May return rubbish on older 1138 which can take up to two minutes. May return rubbish on older
1132 ThinkPads. 1139 ThinkPads.
1133 1140
1134driver attribute fan_watchdog: 1141hwmon driver attribute fan_watchdog:
1135 Fan safety watchdog timer interval, in seconds. Minimum is 1142 Fan safety watchdog timer interval, in seconds. Minimum is
1136 1 second, maximum is 120 seconds. 0 disables the watchdog. 1143 1 second, maximum is 120 seconds. 0 disables the watchdog.
1137 1144
@@ -1196,7 +1203,7 @@ for example:
1196Enabling debugging output 1203Enabling debugging output
1197------------------------- 1204-------------------------
1198 1205
1199The module takes a debug paramater which can be used to selectively 1206The module takes a debug parameter which can be used to selectively
1200enable various classes of debugging output, for example: 1207enable various classes of debugging output, for example:
1201 1208
1202 modprobe ibm_acpi debug=0xffff 1209 modprobe ibm_acpi debug=0xffff
@@ -1233,3 +1240,9 @@ Sysfs interface changelog:
1233 layer, the radio switch generates input event EV_RADIO, 1240 layer, the radio switch generates input event EV_RADIO,
1234 and the driver enables hot key handling by default in 1241 and the driver enables hot key handling by default in
1235 the firmware. 1242 the firmware.
1243
12440x020000: ABI fix: added a separate hwmon platform device and
1245 driver, which must be located by name (thinkpad)
1246 and the hwmon class for libsensors4 (lm-sensors 3)
1247 compatibility. Moved all hwmon attributes to this
1248 new platform device.
diff --git a/Documentation/usb/usb-serial.txt b/Documentation/usb/usb-serial.txt
index 4e0b62b8566f..8b077e43eee7 100644
--- a/Documentation/usb/usb-serial.txt
+++ b/Documentation/usb/usb-serial.txt
@@ -338,7 +338,7 @@ MCT USB Single Port Serial Adapter U232
338 This driver is for the MCT USB-RS232 Converter (25 pin, Model No. 338 This driver is for the MCT USB-RS232 Converter (25 pin, Model No.
339 U232-P25) from Magic Control Technology Corp. (there is also a 9 pin 339 U232-P25) from Magic Control Technology Corp. (there is also a 9 pin
340 Model No. U232-P9). More information about this device can be found at 340 Model No. U232-P9). More information about this device can be found at
341 the manufacture's web-site: http://www.mct.com.tw. 341 the manufacturer's web-site: http://www.mct.com.tw.
342 342
343 The driver is generally working, though it still needs some more testing. 343 The driver is generally working, though it still needs some more testing.
344 It is derived from the Belkin USB Serial Adapter F5U103 driver and its 344 It is derived from the Belkin USB Serial Adapter F5U103 driver and its
diff --git a/MAINTAINERS b/MAINTAINERS
index 10deabeb3929..1fd6d02a79b8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1963,11 +1963,6 @@ M: adaplas@gmail.com
1963L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only) 1963L: linux-fbdev-devel@lists.sourceforge.net (subscribers-only)
1964S: Maintained 1964S: Maintained
1965 1965
1966INTEL APIC/IOAPIC, LOWLEVEL X86 SMP SUPPORT
1967P: Ingo Molnar
1968M: mingo@redhat.com
1969S: Maintained
1970
1971INTEL I8XX RANDOM NUMBER GENERATOR SUPPORT 1966INTEL I8XX RANDOM NUMBER GENERATOR SUPPORT
1972P: Jeff Garzik 1967P: Jeff Garzik
1973M: jgarzik@pobox.com 1968M: jgarzik@pobox.com
@@ -2178,7 +2173,7 @@ S: Maintained
2178KCONFIG 2173KCONFIG
2179P: Roman Zippel 2174P: Roman Zippel
2180M: zippel@linux-m68k.org 2175M: zippel@linux-m68k.org
2181L: kbuild-devel@lists.sourceforge.net 2176L: linux-kbuild@vger.kernel.org
2182S: Maintained 2177S: Maintained
2183 2178
2184KDUMP 2179KDUMP
@@ -2207,6 +2202,7 @@ KERNEL BUILD (kbuild: Makefile, scripts/Makefile.*)
2207P: Sam Ravnborg 2202P: Sam Ravnborg
2208M: sam@ravnborg.org 2203M: sam@ravnborg.org
2209T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git 2204T: git kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
2205L: linux-kbuild@vger.kernel.org
2210S: Maintained 2206S: Maintained
2211 2207
2212KERNEL JANITORS 2208KERNEL JANITORS
@@ -2234,7 +2230,7 @@ S: Supported
2234KEXEC 2230KEXEC
2235P: Eric Biederman 2231P: Eric Biederman
2236M: ebiederm@xmission.com 2232M: ebiederm@xmission.com
2237W: http://www.xmission.com/~ebiederm/files/kexec/ 2233W: http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
2238L: linux-kernel@vger.kernel.org 2234L: linux-kernel@vger.kernel.org
2239L: kexec@lists.infradead.org 2235L: kexec@lists.infradead.org
2240S: Maintained 2236S: Maintained
@@ -2940,13 +2936,6 @@ L: linux-kernel@vger.kernel.org
2940L: linux-pci@atrey.karlin.mff.cuni.cz 2936L: linux-pci@atrey.karlin.mff.cuni.cz
2941S: Supported 2937S: Supported
2942 2938
2943PCI SOUND DRIVERS (ES1370, ES1371 and SONICVIBES)
2944P: Thomas Sailer
2945M: sailer@ife.ee.ethz.ch
2946L: linux-sound@vger.kernel.org
2947W: http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html
2948S: Maintained
2949
2950PCI SUBSYSTEM 2939PCI SUBSYSTEM
2951P: Greg Kroah-Hartman 2940P: Greg Kroah-Hartman
2952M: gregkh@suse.de 2941M: gregkh@suse.de
@@ -4275,9 +4264,15 @@ M: jacmet@sunsite.dk
4275L: linux-serial@vger.kernel.org 4264L: linux-serial@vger.kernel.org
4276S: Maintained 4265S: Maintained
4277 4266
4278X86 3-LEVEL PAGING (PAE) SUPPORT 4267X86 ARCHITECTURE (32-BIT AND 64-BIT)
4268P: Thomas Gleixner
4269M: tglx@linutronix.de
4279P: Ingo Molnar 4270P: Ingo Molnar
4280M: mingo@redhat.com 4271M: mingo@redhat.com
4272P: H. Peter Anvin
4273M: hpa@zytor.com
4274L: linux-kernel@vger.kernel.org
4275T: git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
4281S: Maintained 4276S: Maintained
4282 4277
4283YAM DRIVER FOR AX.25 4278YAM DRIVER FOR AX.25
diff --git a/Makefile b/Makefile
index 529b9048d97e..50bb50defe18 100644
--- a/Makefile
+++ b/Makefile
@@ -774,6 +774,9 @@ vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o
774ifdef CONFIG_HEADERS_CHECK 774ifdef CONFIG_HEADERS_CHECK
775 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check 775 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
776endif 776endif
777ifdef CONFIG_SAMPLES
778 $(Q)$(MAKE) $(build)=samples
779endif
777 $(call vmlinux-modpost) 780 $(call vmlinux-modpost)
778 $(call if_changed_rule,vmlinux__) 781 $(call if_changed_rule,vmlinux__)
779 $(Q)rm -f .old_version 782 $(Q)rm -f .old_version
@@ -884,10 +887,7 @@ prepare2: prepare3 outputmakefile
884 887
885prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ 888prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
886 include/asm include/config/auto.conf 889 include/asm include/config/auto.conf
887ifneq ($(KBUILD_MODULES),) 890 $(cmd_crmodverdir)
888 $(Q)mkdir -p $(MODVERDIR)
889 $(Q)rm -f $(MODVERDIR)/*
890endif
891 891
892archprepare: prepare1 scripts_basic 892archprepare: prepare1 scripts_basic
893 893
@@ -903,14 +903,24 @@ prepare: prepare0
903 903
904export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) 904export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
905 905
906# FIXME: The asm symlink changes when $(ARCH) changes. That's 906# The asm symlink changes when $(ARCH) changes.
907# hard to detect, but I suppose "make mrproper" is a good idea 907# Detect this and ask user to run make mrproper
908# before switching between archs anyway. 908
909 909include/asm: FORCE
910include/asm: 910 $(Q)set -e; asmlink=`readlink include/asm | cut -d '-' -f 2`; \
911 @echo ' SYMLINK $@ -> include/asm-$(SRCARCH)' 911 if [ -L include/asm ]; then \
912 $(Q)if [ ! -d include ]; then mkdir -p include; fi; 912 if [ "$$asmlink" != "$(SRCARCH)" ]; then \
913 @ln -fsn asm-$(SRCARCH) $@ 913 echo "ERROR: the symlink $@ points to asm-$$asmlink but asm-$(SRCARCH) was expected"; \
914 echo " set ARCH or save .config and run 'make mrproper' to fix it"; \
915 exit 1; \
916 fi; \
917 else \
918 echo ' SYMLINK $@ -> include/asm-$(SRCARCH)'; \
919 if [ ! -d include ]; then \
920 mkdir -p include; \
921 fi; \
922 ln -fsn asm-$(SRCARCH) $@; \
923 fi
914 924
915# Generate some files 925# Generate some files
916# --------------------------------------------------------------------------- 926# ---------------------------------------------------------------------------
@@ -1020,19 +1030,12 @@ _modinst_:
1020 fi 1030 fi
1021 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1031 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1022 1032
1023# If System.map exists, run depmod. This deliberately does not have a 1033# This depmod is only for convenience to give the initial
1024# dependency on System.map since that would run the dependency tree on
1025# vmlinux. This depmod is only for convenience to give the initial
1026# boot a modules.dep even before / is mounted read-write. However the 1034# boot a modules.dep even before / is mounted read-write. However the
1027# boot script depmod is the master version. 1035# boot script depmod is the master version.
1028ifeq "$(strip $(INSTALL_MOD_PATH))" ""
1029depmod_opts :=
1030else
1031depmod_opts := -b $(INSTALL_MOD_PATH) -r
1032endif
1033PHONY += _modinst_post 1036PHONY += _modinst_post
1034_modinst_post: _modinst_ 1037_modinst_post: _modinst_
1035 if [ -r System.map -a -x $(DEPMOD) ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi 1038 $(call cmd,depmod)
1036 1039
1037else # CONFIG_MODULES 1040else # CONFIG_MODULES
1038 1041
@@ -1220,8 +1223,7 @@ else # KBUILD_EXTMOD
1220KBUILD_MODULES := 1 1223KBUILD_MODULES := 1
1221PHONY += crmodverdir 1224PHONY += crmodverdir
1222crmodverdir: 1225crmodverdir:
1223 $(Q)mkdir -p $(MODVERDIR) 1226 $(cmd_crmodverdir)
1224 $(Q)rm -f $(MODVERDIR)/*
1225 1227
1226PHONY += $(objtree)/Module.symvers 1228PHONY += $(objtree)/Module.symvers
1227$(objtree)/Module.symvers: 1229$(objtree)/Module.symvers:
@@ -1249,15 +1251,6 @@ _emodinst_:
1249 $(Q)mkdir -p $(MODLIB)/$(install-dir) 1251 $(Q)mkdir -p $(MODLIB)/$(install-dir)
1250 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 1252 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst
1251 1253
1252# Run depmod only is we have System.map and depmod is executable
1253quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1254 cmd_depmod = if [ -r System.map -a -x $(DEPMOD) ]; then \
1255 $(DEPMOD) -ae -F System.map \
1256 $(if $(strip $(INSTALL_MOD_PATH)), \
1257 -b $(INSTALL_MOD_PATH) -r) \
1258 $(KERNELRELEASE); \
1259 fi
1260
1261PHONY += _emodinst_post 1254PHONY += _emodinst_post
1262_emodinst_post: _emodinst_ 1255_emodinst_post: _emodinst_
1263 $(call cmd,depmod) 1256 $(call cmd,depmod)
@@ -1341,7 +1334,7 @@ define find-sources
1341 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ 1334 find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \
1342 -name $1 -print; \ 1335 -name $1 -print; \
1343 find $(__srctree) $(RCS_FIND_IGNORE) \ 1336 find $(__srctree) $(RCS_FIND_IGNORE) \
1344 \( -name include -o -name arch \) -prune -o \ 1337 \( -name include -o -name arch -o -name '.tmp_*' \) -prune -o \
1345 -name $1 -print; \ 1338 -name $1 -print; \
1346 ) 1339 )
1347endef 1340endef
@@ -1490,9 +1483,11 @@ endif
1490 1483
1491# Modules 1484# Modules
1492/ %/: prepare scripts FORCE 1485/ %/: prepare scripts FORCE
1486 $(cmd_crmodverdir)
1493 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1487 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1494 $(build)=$(build-dir) 1488 $(build)=$(build-dir)
1495%.ko: prepare scripts FORCE 1489%.ko: prepare scripts FORCE
1490 $(cmd_crmodverdir)
1496 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1491 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1497 $(build)=$(build-dir) $(@:.ko=.o) 1492 $(build)=$(build-dir) $(@:.ko=.o)
1498 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1493 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@@ -1506,6 +1501,19 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
1506quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) 1501quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)))
1507 cmd_rmfiles = rm -f $(rm-files) 1502 cmd_rmfiles = rm -f $(rm-files)
1508 1503
1504# Run depmod only is we have System.map and depmod is executable
1505# and we build for the host arch
1506quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1507 cmd_depmod = \
1508 if [ -r System.map -a -x $(DEPMOD) -a "$(SUBARCH)" = "$(ARCH)" ]; then \
1509 $(DEPMOD) -ae -F System.map \
1510 $(if $(strip $(INSTALL_MOD_PATH)), -b $(INSTALL_MOD_PATH) -r) \
1511 $(KERNELRELEASE); \
1512 fi
1513
1514# Create temporary dir for module support files
1515cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR); rm -f $(MODVERDIR)/*
1516
1509 1517
1510a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \ 1518a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
1511 $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \ 1519 $(NOSTDINC_FLAGS) $(KBUILD_CPPFLAGS) \
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 2a85dc33907c..4c002ba37e50 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -654,7 +654,7 @@ source "drivers/Kconfig"
654 654
655source "fs/Kconfig" 655source "fs/Kconfig"
656 656
657source "arch/alpha/oprofile/Kconfig" 657source "kernel/Kconfig.instrumentation"
658 658
659source "arch/alpha/Kconfig.debug" 659source "arch/alpha/Kconfig.debug"
660 660
diff --git a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c
index f2956ac8dccc..497877bf2012 100644
--- a/arch/alpha/kernel/err_marvel.c
+++ b/arch/alpha/kernel/err_marvel.c
@@ -1082,7 +1082,7 @@ marvel_machine_check(u64 vector, u64 la_ptr)
1082 } 1082 }
1083 1083
1084 /* 1084 /*
1085 * A system event or error has occured, handle it here. 1085 * A system event or error has occurred, handle it here.
1086 * 1086 *
1087 * Any errors in the logout frame have already been cleared by the 1087 * Any errors in the logout frame have already been cleared by the
1088 * PALcode, so just parse it. 1088 * PALcode, so just parse it.
diff --git a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c
index 543d96d7fa2b..6f3867877d9e 100644
--- a/arch/alpha/kernel/err_titan.c
+++ b/arch/alpha/kernel/err_titan.c
@@ -591,7 +591,7 @@ privateer_process_680_frame(struct el_common *mchk_header, int print)
591 (struct el_PRIVATEER_envdata_mcheck *) 591 (struct el_PRIVATEER_envdata_mcheck *)
592 ((unsigned long)mchk_header + mchk_header->sys_offset); 592 ((unsigned long)mchk_header + mchk_header->sys_offset);
593 593
594 /* TODO - catagorize errors, for now, no error */ 594 /* TODO - categorize errors, for now, no error */
595 595
596 if (!print) 596 if (!print)
597 return status; 597 return status;
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index ce857158c1ea..6413c5f23226 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -715,7 +715,7 @@ osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes,
715 /* 715 /*
716 * Alpha Architecture Handbook 4.7.7.3: 716 * Alpha Architecture Handbook 4.7.7.3:
717 * To be fully IEEE compiant, we must track the current IEEE 717 * To be fully IEEE compiant, we must track the current IEEE
718 * exception state in software, because spurrious bits can be 718 * exception state in software, because spurious bits can be
719 * set in the trap shadow of a software-complete insn. 719 * set in the trap shadow of a software-complete insn.
720 */ 720 */
721 721
diff --git a/arch/alpha/kernel/semaphore.c b/arch/alpha/kernel/semaphore.c
index 8c8aaa205eae..8d2982aa1b8d 100644
--- a/arch/alpha/kernel/semaphore.c
+++ b/arch/alpha/kernel/semaphore.c
@@ -69,7 +69,7 @@ __down_failed(struct semaphore *sem)
69 69
70#ifdef CONFIG_DEBUG_SEMAPHORE 70#ifdef CONFIG_DEBUG_SEMAPHORE
71 printk("%s(%d): down failed(%p)\n", 71 printk("%s(%d): down failed(%p)\n",
72 tsk->comm, tsk->pid, sem); 72 tsk->comm, task_pid_nr(tsk), sem);
73#endif 73#endif
74 74
75 tsk->state = TASK_UNINTERRUPTIBLE; 75 tsk->state = TASK_UNINTERRUPTIBLE;
@@ -98,7 +98,7 @@ __down_failed(struct semaphore *sem)
98 98
99#ifdef CONFIG_DEBUG_SEMAPHORE 99#ifdef CONFIG_DEBUG_SEMAPHORE
100 printk("%s(%d): down acquired(%p)\n", 100 printk("%s(%d): down acquired(%p)\n",
101 tsk->comm, tsk->pid, sem); 101 tsk->comm, task_pid_nr(tsk), sem);
102#endif 102#endif
103} 103}
104 104
@@ -111,7 +111,7 @@ __down_failed_interruptible(struct semaphore *sem)
111 111
112#ifdef CONFIG_DEBUG_SEMAPHORE 112#ifdef CONFIG_DEBUG_SEMAPHORE
113 printk("%s(%d): down failed(%p)\n", 113 printk("%s(%d): down failed(%p)\n",
114 tsk->comm, tsk->pid, sem); 114 tsk->comm, task_pid_nr(tsk), sem);
115#endif 115#endif
116 116
117 tsk->state = TASK_INTERRUPTIBLE; 117 tsk->state = TASK_INTERRUPTIBLE;
@@ -139,7 +139,7 @@ __down_failed_interruptible(struct semaphore *sem)
139 139
140#ifdef CONFIG_DEBUG_SEMAPHORE 140#ifdef CONFIG_DEBUG_SEMAPHORE
141 printk("%s(%d): down %s(%p)\n", 141 printk("%s(%d): down %s(%p)\n",
142 current->comm, current->pid, 142 current->comm, task_pid_nr(current),
143 (ret < 0 ? "interrupted" : "acquired"), sem); 143 (ret < 0 ? "interrupted" : "acquired"), sem);
144#endif 144#endif
145 return ret; 145 return ret;
@@ -168,7 +168,7 @@ down(struct semaphore *sem)
168#endif 168#endif
169#ifdef CONFIG_DEBUG_SEMAPHORE 169#ifdef CONFIG_DEBUG_SEMAPHORE
170 printk("%s(%d): down(%p) <count=%d> from %p\n", 170 printk("%s(%d): down(%p) <count=%d> from %p\n",
171 current->comm, current->pid, sem, 171 current->comm, task_pid_nr(current), sem,
172 atomic_read(&sem->count), __builtin_return_address(0)); 172 atomic_read(&sem->count), __builtin_return_address(0));
173#endif 173#endif
174 __down(sem); 174 __down(sem);
@@ -182,7 +182,7 @@ down_interruptible(struct semaphore *sem)
182#endif 182#endif
183#ifdef CONFIG_DEBUG_SEMAPHORE 183#ifdef CONFIG_DEBUG_SEMAPHORE
184 printk("%s(%d): down(%p) <count=%d> from %p\n", 184 printk("%s(%d): down(%p) <count=%d> from %p\n",
185 current->comm, current->pid, sem, 185 current->comm, task_pid_nr(current), sem,
186 atomic_read(&sem->count), __builtin_return_address(0)); 186 atomic_read(&sem->count), __builtin_return_address(0));
187#endif 187#endif
188 return __down_interruptible(sem); 188 return __down_interruptible(sem);
@@ -201,7 +201,7 @@ down_trylock(struct semaphore *sem)
201 201
202#ifdef CONFIG_DEBUG_SEMAPHORE 202#ifdef CONFIG_DEBUG_SEMAPHORE
203 printk("%s(%d): down_trylock %s from %p\n", 203 printk("%s(%d): down_trylock %s from %p\n",
204 current->comm, current->pid, 204 current->comm, task_pid_nr(current),
205 ret ? "failed" : "acquired", 205 ret ? "failed" : "acquired",
206 __builtin_return_address(0)); 206 __builtin_return_address(0));
207#endif 207#endif
@@ -217,7 +217,7 @@ up(struct semaphore *sem)
217#endif 217#endif
218#ifdef CONFIG_DEBUG_SEMAPHORE 218#ifdef CONFIG_DEBUG_SEMAPHORE
219 printk("%s(%d): up(%p) <count=%d> from %p\n", 219 printk("%s(%d): up(%p) <count=%d> from %p\n",
220 current->comm, current->pid, sem, 220 current->comm, task_pid_nr(current), sem,
221 atomic_read(&sem->count), __builtin_return_address(0)); 221 atomic_read(&sem->count), __builtin_return_address(0));
222#endif 222#endif
223 __up(sem); 223 __up(sem);
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index ad176441be55..f4ab233201b2 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -439,7 +439,6 @@ setup_smp(void)
439 ((char *)cpubase + i*hwrpb->processor_size); 439 ((char *)cpubase + i*hwrpb->processor_size);
440 if ((cpu->flags & 0x1cc) == 0x1cc) { 440 if ((cpu->flags & 0x1cc) == 0x1cc) {
441 smp_num_probed++; 441 smp_num_probed++;
442 /* Assume here that "whami" == index */
443 cpu_set(i, cpu_present_map); 442 cpu_set(i, cpu_present_map);
444 cpu->pal_revision = boot_cpu_palrev; 443 cpu->pal_revision = boot_cpu_palrev;
445 } 444 }
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c
index 49bedfbbd31b..d187d01d2a17 100644
--- a/arch/alpha/kernel/sys_alcor.c
+++ b/arch/alpha/kernel/sys_alcor.c
@@ -138,7 +138,7 @@ alcor_init_irq(void)
138 138
139 for (i = 16; i < 48; ++i) { 139 for (i = 16; i < 48; ++i) {
140 /* On Alcor, at least, lines 20..30 are not connected 140 /* On Alcor, at least, lines 20..30 are not connected
141 and can generate spurrious interrupts if we turn them 141 and can generate spurious interrupts if we turn them
142 on while IRQ probing. */ 142 on while IRQ probing. */
143 if (i >= 16+20 && i <= 16+30) 143 if (i >= 16+20 && i <= 16+30)
144 continue; 144 continue;
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index 14b5a753aba5..ee7b9009ebb4 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -78,7 +78,7 @@ alphabook1_init_arch(void)
78 * example, sound boards seem to like using IRQ 9. 78 * example, sound boards seem to like using IRQ 9.
79 * 79 *
80 * This is NOT how we should do it. PIRQ0-X should have 80 * This is NOT how we should do it. PIRQ0-X should have
81 * their own IRQ's, the way intel uses the IO-APIC irq's. 81 * their own IRQs, the way intel uses the IO-APIC IRQs.
82 */ 82 */
83 83
84static void __init 84static void __init
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index ec0f05e0d8ff..2dc7f9fed213 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -182,7 +182,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
182#ifdef CONFIG_SMP 182#ifdef CONFIG_SMP
183 printk("CPU %d ", hard_smp_processor_id()); 183 printk("CPU %d ", hard_smp_processor_id());
184#endif 184#endif
185 printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err); 185 printk("%s(%d): %s %ld\n", current->comm, task_pid_nr(current), str, err);
186 dik_show_regs(regs, r9_15); 186 dik_show_regs(regs, r9_15);
187 add_taint(TAINT_DIE); 187 add_taint(TAINT_DIE);
188 dik_show_trace((unsigned long *)(regs+1)); 188 dik_show_trace((unsigned long *)(regs+1));
@@ -646,7 +646,7 @@ got_exception:
646 lock_kernel(); 646 lock_kernel();
647 647
648 printk("%s(%d): unhandled unaligned exception\n", 648 printk("%s(%d): unhandled unaligned exception\n",
649 current->comm, current->pid); 649 current->comm, task_pid_nr(current));
650 650
651 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n", 651 printk("pc = [<%016lx>] ra = [<%016lx>] ps = %04lx\n",
652 pc, una_reg(26), regs->ps); 652 pc, una_reg(26), regs->ps);
@@ -786,7 +786,7 @@ do_entUnaUser(void __user * va, unsigned long opcode,
786 } 786 }
787 if (++cnt < 5) { 787 if (++cnt < 5) {
788 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", 788 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n",
789 current->comm, current->pid, 789 current->comm, task_pid_nr(current),
790 regs->pc - 4, va, opcode, reg); 790 regs->pc - 4, va, opcode, reg);
791 } 791 }
792 last_time = jiffies; 792 last_time = jiffies;
diff --git a/arch/alpha/lib/checksum.c b/arch/alpha/lib/checksum.c
index 8698e0746f9f..199f6efa83fa 100644
--- a/arch/alpha/lib/checksum.c
+++ b/arch/alpha/lib/checksum.c
@@ -5,7 +5,7 @@
5 * in an architecture-specific manner due to speed.. 5 * in an architecture-specific manner due to speed..
6 * Comments in other versions indicate that the algorithms are from RFC1071 6 * Comments in other versions indicate that the algorithms are from RFC1071
7 * 7 *
8 * accellerated versions (and 21264 assembly versions ) contributed by 8 * accelerated versions (and 21264 assembly versions ) contributed by
9 * Rick Gorton <rick.gorton@alpha-processor.com> 9 * Rick Gorton <rick.gorton@alpha-processor.com>
10 */ 10 */
11 11
diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
index 4ca75c74ce90..40736da9bea8 100644
--- a/arch/alpha/lib/csum_partial_copy.c
+++ b/arch/alpha/lib/csum_partial_copy.c
@@ -2,7 +2,7 @@
2 * csum_partial_copy - do IP checksumming and copy 2 * csum_partial_copy - do IP checksumming and copy
3 * 3 *
4 * (C) Copyright 1996 Linus Torvalds 4 * (C) Copyright 1996 Linus Torvalds
5 * accellerated versions (and 21264 assembly versions ) contributed by 5 * accelerated versions (and 21264 assembly versions ) contributed by
6 * Rick Gorton <rick.gorton@alpha-processor.com> 6 * Rick Gorton <rick.gorton@alpha-processor.com>
7 * 7 *
8 * Don't look at this too closely - you'll go mad. The things 8 * Don't look at this too closely - you'll go mad. The things
diff --git a/arch/alpha/lib/fls.c b/arch/alpha/lib/fls.c
index 7ad84ea0acf8..32afaa3fa686 100644
--- a/arch/alpha/lib/fls.c
+++ b/arch/alpha/lib/fls.c
@@ -3,7 +3,7 @@
3 */ 3 */
4 4
5#include <linux/module.h> 5#include <linux/module.h>
6#include <asm/bitops.h> 6#include <linux/bitops.h>
7 7
8/* This is fls(x)-1, except zero is held to zero. This allows most 8/* This is fls(x)-1, except zero is held to zero. This allows most
9 efficent input into extbl, plus it allows easy handling of fls(0)=0. */ 9 efficent input into extbl, plus it allows easy handling of fls(0)=0. */
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index 25154df3055a..4829f96585b1 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -188,13 +188,13 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
188 /* We ran out of memory, or some other thing happened to us that 188 /* We ran out of memory, or some other thing happened to us that
189 made us unable to handle the page fault gracefully. */ 189 made us unable to handle the page fault gracefully. */
190 out_of_memory: 190 out_of_memory:
191 if (is_init(current)) { 191 if (is_global_init(current)) {
192 yield(); 192 yield();
193 down_read(&mm->mmap_sem); 193 down_read(&mm->mmap_sem);
194 goto survive; 194 goto survive;
195 } 195 }
196 printk(KERN_ALERT "VM: killing process %s(%d)\n", 196 printk(KERN_ALERT "VM: killing process %s(%d)\n",
197 current->comm, current->pid); 197 current->comm, task_pid_nr(current));
198 if (!user_mode(regs)) 198 if (!user_mode(regs))
199 goto no_context; 199 goto no_context;
200 do_group_exit(SIGKILL); 200 do_group_exit(SIGKILL);
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 5e6da47779a4..40c15e7301de 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -235,7 +235,7 @@ callback_init(void * kernel_end)
235 unsigned long pfn = crb->map[i].pa >> PAGE_SHIFT; 235 unsigned long pfn = crb->map[i].pa >> PAGE_SHIFT;
236 crb->map[i].va = vaddr; 236 crb->map[i].va = vaddr;
237 for (j = 0; j < crb->map[i].count; ++j) { 237 for (j = 0; j < crb->map[i].count; ++j) {
238 /* Newer console's (especially on larger 238 /* Newer consoles (especially on larger
239 systems) may require more pages of 239 systems) may require more pages of
240 PTEs. Grab additional pages as needed. */ 240 PTEs. Grab additional pages as needed. */
241 if (pmd != pmd_offset(pgd, vaddr)) { 241 if (pmd != pmd_offset(pgd, vaddr)) {
diff --git a/arch/alpha/oprofile/Kconfig b/arch/alpha/oprofile/Kconfig
deleted file mode 100644
index 5ade19801b97..000000000000
--- a/arch/alpha/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/alpha/oprofile/op_impl.h b/arch/alpha/oprofile/op_impl.h
index 6b97893c1a80..b2b87ae9a353 100644
--- a/arch/alpha/oprofile/op_impl.h
+++ b/arch/alpha/oprofile/op_impl.h
@@ -38,7 +38,7 @@ struct op_register_config {
38 unsigned long need_reset; 38 unsigned long need_reset;
39}; 39};
40 40
41/* Per-architecture configury and hooks. */ 41/* Per-architecture configuration and hooks. */
42struct op_axp_model { 42struct op_axp_model {
43 void (*reg_setup) (struct op_register_config *, 43 void (*reg_setup) (struct op_register_config *,
44 struct op_counter_config *, 44 struct op_counter_config *,
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0a0c88d0039c..a0cdaafa115b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -851,7 +851,7 @@ config KEXEC
851 help 851 help
852 kexec is a system call that implements the ability to shutdown your 852 kexec is a system call that implements the ability to shutdown your
853 current kernel, and to start another kernel. It is like a reboot 853 current kernel, and to start another kernel. It is like a reboot
854 but it is indepedent of the system firmware. And like a reboot 854 but it is independent of the system firmware. And like a reboot
855 you can start any kernel with it, not just Linux. 855 you can start any kernel with it, not just Linux.
856 856
857 It is an ongoing process to be certain the hardware in a machine 857 It is an ongoing process to be certain the hardware in a machine
@@ -1068,7 +1068,7 @@ endmenu
1068 1068
1069source "fs/Kconfig" 1069source "fs/Kconfig"
1070 1070
1071source "arch/arm/oprofile/Kconfig" 1071source "kernel/Kconfig.instrumentation"
1072 1072
1073source "arch/arm/Kconfig.debug" 1073source "arch/arm/Kconfig.debug"
1074 1074
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
index 111a7fa5debe..5bba5255b119 100644
--- a/arch/arm/common/sharpsl_pm.c
+++ b/arch/arm/common/sharpsl_pm.c
@@ -24,6 +24,7 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/leds.h> 25#include <linux/leds.h>
26#include <linux/apm-emulation.h> 26#include <linux/apm-emulation.h>
27#include <linux/suspend.h>
27 28
28#include <asm/hardware.h> 29#include <asm/hardware.h>
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
@@ -765,9 +766,9 @@ static void sharpsl_apm_get_power_status(struct apm_power_info *info)
765 info->battery_life = sharpsl_pm.battstat.mainbat_percent; 766 info->battery_life = sharpsl_pm.battstat.mainbat_percent;
766} 767}
767 768
768static struct pm_ops sharpsl_pm_ops = { 769static struct platform_suspend_ops sharpsl_pm_ops = {
769 .enter = corgi_pxa_pm_enter, 770 .enter = corgi_pxa_pm_enter,
770 .valid = pm_valid_only_mem, 771 .valid = suspend_valid_only_mem,
771}; 772};
772 773
773static int __init sharpsl_pm_probe(struct platform_device *pdev) 774static int __init sharpsl_pm_probe(struct platform_device *pdev)
@@ -799,7 +800,7 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
799 800
800 apm_get_power_status = sharpsl_apm_get_power_status; 801 apm_get_power_status = sharpsl_apm_get_power_status;
801 802
802 pm_set_ops(&sharpsl_pm_ops); 803 suspend_set_ops(&sharpsl_pm_ops);
803 804
804 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250)); 805 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
805 806
@@ -808,7 +809,7 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
808 809
809static int sharpsl_pm_remove(struct platform_device *pdev) 810static int sharpsl_pm_remove(struct platform_device *pdev)
810{ 811{
811 pm_set_ops(NULL); 812 suspend_set_ops(NULL);
812 813
813 device_remove_file(&pdev->dev, &dev_attr_battery_percentage); 814 device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
814 device_remove_file(&pdev->dev, &dev_attr_battery_voltage); 815 device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 93b7f8e22dcc..4f1a03124a74 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -265,7 +265,7 @@ void __show_regs(struct pt_regs *regs)
265void show_regs(struct pt_regs * regs) 265void show_regs(struct pt_regs * regs)
266{ 266{
267 printk("\n"); 267 printk("\n");
268 printk("Pid: %d, comm: %20s\n", current->pid, current->comm); 268 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
269 __show_regs(regs); 269 __show_regs(regs);
270 __backtrace(); 270 __backtrace();
271} 271}
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 5feee722ea98..4b05dc5c1023 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -382,16 +382,16 @@ static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp)
382 382
383 if (ret != 2 || old_insn.thumb != BREAKINST_THUMB) 383 if (ret != 2 || old_insn.thumb != BREAKINST_THUMB)
384 printk(KERN_ERR "%s:%d: corrupted Thumb breakpoint at " 384 printk(KERN_ERR "%s:%d: corrupted Thumb breakpoint at "
385 "0x%08lx (0x%04x)\n", task->comm, task->pid, 385 "0x%08lx (0x%04x)\n", task->comm,
386 addr, old_insn.thumb); 386 task_pid_nr(task), addr, old_insn.thumb);
387 } else { 387 } else {
388 ret = swap_insn(task, addr & ~3, &old_insn.arm, 388 ret = swap_insn(task, addr & ~3, &old_insn.arm,
389 &bp->insn.arm, 4); 389 &bp->insn.arm, 4);
390 390
391 if (ret != 4 || old_insn.arm != BREAKINST_ARM) 391 if (ret != 4 || old_insn.arm != BREAKINST_ARM)
392 printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at " 392 printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
393 "0x%08lx (0x%08x)\n", task->comm, task->pid, 393 "0x%08lx (0x%08x)\n", task->comm,
394 addr, old_insn.arm); 394 task_pid_nr(task), addr, old_insn.arm);
395 } 395 }
396} 396}
397 397
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 8ad47619c079..4764bd9ccee8 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -223,7 +223,7 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p
223 print_modules(); 223 print_modules();
224 __show_regs(regs); 224 __show_regs(regs);
225 printk("Process %s (pid: %d, stack limit = 0x%p)\n", 225 printk("Process %s (pid: %d, stack limit = 0x%p)\n",
226 tsk->comm, tsk->pid, thread + 1); 226 tsk->comm, task_pid_nr(tsk), thread + 1);
227 227
228 if (!user_mode(regs) || in_interrupt()) { 228 if (!user_mode(regs) || in_interrupt()) {
229 dump_mem("Stack: ", regs->ARM_sp, 229 dump_mem("Stack: ", regs->ARM_sp,
@@ -337,7 +337,7 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
337#ifdef CONFIG_DEBUG_USER 337#ifdef CONFIG_DEBUG_USER
338 if (user_debug & UDBG_UNDEFINED) { 338 if (user_debug & UDBG_UNDEFINED) {
339 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", 339 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
340 current->comm, current->pid, pc); 340 current->comm, task_pid_nr(current), pc);
341 dump_instr(regs); 341 dump_instr(regs);
342 } 342 }
343#endif 343#endif
@@ -388,7 +388,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
388#ifdef CONFIG_DEBUG_USER 388#ifdef CONFIG_DEBUG_USER
389 if (user_debug & UDBG_SYSCALL) { 389 if (user_debug & UDBG_SYSCALL) {
390 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n", 390 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
391 current->pid, current->comm, n); 391 task_pid_nr(current), current->comm, n);
392 dump_instr(regs); 392 dump_instr(regs);
393 } 393 }
394#endif 394#endif
@@ -565,7 +565,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
565 */ 565 */
566 if (user_debug & UDBG_SYSCALL) { 566 if (user_debug & UDBG_SYSCALL) {
567 printk("[%d] %s: arm syscall %d\n", 567 printk("[%d] %s: arm syscall %d\n",
568 current->pid, current->comm, no); 568 task_pid_nr(current), current->comm, no);
569 dump_instr(regs); 569 dump_instr(regs);
570 if (user_mode(regs)) { 570 if (user_mode(regs)) {
571 __show_regs(regs); 571 __show_regs(regs);
@@ -642,7 +642,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
642#ifdef CONFIG_DEBUG_USER 642#ifdef CONFIG_DEBUG_USER
643 if (user_debug & UDBG_BADABORT) { 643 if (user_debug & UDBG_BADABORT) {
644 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n", 644 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
645 current->pid, current->comm, code, instr); 645 task_pid_nr(current), current->comm, code, instr);
646 dump_instr(regs); 646 dump_instr(regs);
647 show_pte(current->mm, addr); 647 show_pte(current->mm, addr);
648 } 648 }
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index ba4a1bb3ee40..aa2d365c93fb 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -439,7 +439,7 @@ void __init at91_gpio_irq_setup(void)
439 for (i = 0; i < 32; i++, pin++) { 439 for (i = 0; i < 32; i++, pin++) {
440 /* 440 /*
441 * Can use the "simple" and not "edge" handler since it's 441 * Can use the "simple" and not "edge" handler since it's
442 * shorter, and the AIC handles interupts sanely. 442 * shorter, and the AIC handles interrupts sanely.
443 */ 443 */
444 set_irq_chip(pin, &gpio_irqchip); 444 set_irq_chip(pin, &gpio_irqchip);
445 set_irq_handler(pin, handle_simple_irq); 445 set_irq_handler(pin, handle_simple_irq);
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index ddf9184d561d..98cb61482917 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -10,10 +10,9 @@
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/pm.h> 13#include <linux/suspend.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/proc_fs.h> 15#include <linux/proc_fs.h>
16#include <linux/pm.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
18#include <linux/sysfs.h> 17#include <linux/sysfs.h>
19#include <linux/module.h> 18#include <linux/module.h>
@@ -199,7 +198,7 @@ error:
199} 198}
200 199
201 200
202static struct pm_ops at91_pm_ops ={ 201static struct platform_suspend_ops at91_pm_ops ={
203 .valid = at91_pm_valid_state, 202 .valid = at91_pm_valid_state,
204 .set_target = at91_pm_set_target, 203 .set_target = at91_pm_set_target,
205 .enter = at91_pm_enter, 204 .enter = at91_pm_enter,
@@ -220,7 +219,7 @@ static int __init at91_pm_init(void)
220 /* Disable SDRAM low-power mode. Cannot be used with self-refresh. */ 219 /* Disable SDRAM low-power mode. Cannot be used with self-refresh. */
221 at91_sys_write(AT91_SDRAMC_LPR, 0); 220 at91_sys_write(AT91_SDRAMC_LPR, 0);
222 221
223 pm_set_ops(&at91_pm_ops); 222 suspend_set_ops(&at91_pm_ops);
224 223
225 return 0; 224 return 0;
226} 225}
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index 0733078940fa..1da9d59a0347 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2004 Nokia Corporation 6 * Copyright (C) 2004 Nokia Corporation
7 * Written by Tony Lindgren <tony@atomide.com> 7 * Written by Tony Lindgren <tony@atomide.com>
8 * Major cleanups by Juha Yrjölä <juha.yrjola@nokia.com> 8 * Major cleanups by Juha Yrjölä <juha.yrjola@nokia.com>
9 * 9 *
10 * Completely re-written to support various OMAP chips with bank specific 10 * Completely re-written to support various OMAP chips with bank specific
11 * interrupt handlers. 11 * interrupt handlers.
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 089b8208de0e..3bf01e28df33 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -35,10 +35,9 @@
35 * 675 Mass Ave, Cambridge, MA 02139, USA. 35 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 */ 36 */
37 37
38#include <linux/pm.h> 38#include <linux/suspend.h>
39#include <linux/sched.h> 39#include <linux/sched.h>
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/pm.h>
42#include <linux/interrupt.h> 41#include <linux/interrupt.h>
43#include <linux/sysfs.h> 42#include <linux/sysfs.h>
44#include <linux/module.h> 43#include <linux/module.h>
@@ -600,27 +599,15 @@ static void (*saved_idle)(void) = NULL;
600 599
601/* 600/*
602 * omap_pm_prepare - Do preliminary suspend work. 601 * omap_pm_prepare - Do preliminary suspend work.
603 * @state: suspend state we're entering.
604 * 602 *
605 */ 603 */
606static int omap_pm_prepare(suspend_state_t state) 604static int omap_pm_prepare(void)
607{ 605{
608 int error = 0;
609
610 /* We cannot sleep in idle until we have resumed */ 606 /* We cannot sleep in idle until we have resumed */
611 saved_idle = pm_idle; 607 saved_idle = pm_idle;
612 pm_idle = NULL; 608 pm_idle = NULL;
613 609
614 switch (state) 610 return 0;
615 {
616 case PM_SUSPEND_STANDBY:
617 case PM_SUSPEND_MEM:
618 break;
619 default:
620 return -EINVAL;
621 }
622
623 return error;
624} 611}
625 612
626 613
@@ -648,16 +635,14 @@ static int omap_pm_enter(suspend_state_t state)
648 635
649/** 636/**
650 * omap_pm_finish - Finish up suspend sequence. 637 * omap_pm_finish - Finish up suspend sequence.
651 * @state: State we're coming out of.
652 * 638 *
653 * This is called after we wake back up (or if entering the sleep state 639 * This is called after we wake back up (or if entering the sleep state
654 * failed). 640 * failed).
655 */ 641 */
656 642
657static int omap_pm_finish(suspend_state_t state) 643static void omap_pm_finish(void)
658{ 644{
659 pm_idle = saved_idle; 645 pm_idle = saved_idle;
660 return 0;
661} 646}
662 647
663 648
@@ -674,11 +659,11 @@ static struct irqaction omap_wakeup_irq = {
674 659
675 660
676 661
677static struct pm_ops omap_pm_ops ={ 662static struct platform_suspend_ops omap_pm_ops ={
678 .prepare = omap_pm_prepare, 663 .prepare = omap_pm_prepare,
679 .enter = omap_pm_enter, 664 .enter = omap_pm_enter,
680 .finish = omap_pm_finish, 665 .finish = omap_pm_finish,
681 .valid = pm_valid_only_mem, 666 .valid = suspend_valid_only_mem,
682}; 667};
683 668
684static int __init omap_pm_init(void) 669static int __init omap_pm_init(void)
@@ -735,7 +720,7 @@ static int __init omap_pm_init(void)
735 else if (cpu_is_omap16xx()) 720 else if (cpu_is_omap16xx())
736 omap_writel(OMAP1610_IDLECT3_VAL, OMAP1610_IDLECT3); 721 omap_writel(OMAP1610_IDLECT3_VAL, OMAP1610_IDLECT3);
737 722
738 pm_set_ops(&omap_pm_ops); 723 suspend_set_ops(&omap_pm_ops);
739 724
740#if defined(DEBUG) && defined(CONFIG_PROC_FS) 725#if defined(DEBUG) && defined(CONFIG_PROC_FS)
741 omap_pm_init_proc(); 726 omap_pm_init_proc();
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 6f4a5436d0ce..baf7d82b458b 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -16,10 +16,9 @@
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18
19#include <linux/pm.h> 19#include <linux/suspend.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/proc_fs.h> 21#include <linux/proc_fs.h>
22#include <linux/pm.h>
23#include <linux/interrupt.h> 22#include <linux/interrupt.h>
24#include <linux/sysfs.h> 23#include <linux/sysfs.h>
25#include <linux/module.h> 24#include <linux/module.h>
@@ -71,28 +70,12 @@ void omap2_pm_idle(void)
71 local_irq_enable(); 70 local_irq_enable();
72} 71}
73 72
74static int omap2_pm_prepare(suspend_state_t state) 73static int omap2_pm_prepare(void)
75{ 74{
76 int error = 0;
77
78 /* We cannot sleep in idle until we have resumed */ 75 /* We cannot sleep in idle until we have resumed */
79 saved_idle = pm_idle; 76 saved_idle = pm_idle;
80 pm_idle = NULL; 77 pm_idle = NULL;
81 78 return 0;
82 switch (state)
83 {
84 case PM_SUSPEND_STANDBY:
85 case PM_SUSPEND_MEM:
86 break;
87
88 case PM_SUSPEND_DISK:
89 return -ENOTSUPP;
90
91 default:
92 return -EINVAL;
93 }
94
95 return error;
96} 79}
97 80
98#define INT0_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_GPIO_BANK1) | \ 81#define INT0_WAKE_MASK (OMAP_IRQ_BIT(INT_24XX_GPIO_BANK1) | \
@@ -353,9 +336,6 @@ static int omap2_pm_enter(suspend_state_t state)
353 case PM_SUSPEND_MEM: 336 case PM_SUSPEND_MEM:
354 ret = omap2_pm_suspend(); 337 ret = omap2_pm_suspend();
355 break; 338 break;
356 case PM_SUSPEND_DISK:
357 ret = -ENOTSUPP;
358 break;
359 default: 339 default:
360 ret = -EINVAL; 340 ret = -EINVAL;
361 } 341 }
@@ -363,17 +343,16 @@ static int omap2_pm_enter(suspend_state_t state)
363 return ret; 343 return ret;
364} 344}
365 345
366static int omap2_pm_finish(suspend_state_t state) 346static void omap2_pm_finish(void)
367{ 347{
368 pm_idle = saved_idle; 348 pm_idle = saved_idle;
369 return 0;
370} 349}
371 350
372static struct pm_ops omap_pm_ops = { 351static struct platform_suspend_ops omap_pm_ops = {
373 .prepare = omap2_pm_prepare, 352 .prepare = omap2_pm_prepare,
374 .enter = omap2_pm_enter, 353 .enter = omap2_pm_enter,
375 .finish = omap2_pm_finish, 354 .finish = omap2_pm_finish,
376 .valid = pm_valid_only_mem, 355 .valid = suspend_valid_only_mem,
377}; 356};
378 357
379int __init omap2_pm_init(void) 358int __init omap2_pm_init(void)
@@ -397,7 +376,7 @@ int __init omap2_pm_init(void)
397 omap2_sram_suspend = omap_sram_push(omap24xx_cpu_suspend, 376 omap2_sram_suspend = omap_sram_push(omap24xx_cpu_suspend,
398 omap24xx_cpu_suspend_sz); 377 omap24xx_cpu_suspend_sz);
399 378
400 pm_set_ops(&omap_pm_ops); 379 suspend_set_ops(&omap_pm_ops);
401 pm_idle = omap2_pm_idle; 380 pm_idle = omap2_pm_idle;
402 381
403 pmdomain_init(); 382 pmdomain_init();
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 62e801ef9ad9..8d322c20ccae 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2005 Nokia Corporation 6 * Copyright (C) 2005 Nokia Corporation
7 * Author: Paul Mundt <paul.mundt@nokia.com> 7 * Author: Paul Mundt <paul.mundt@nokia.com>
8 * Juha Yrjölä <juha.yrjola@nokia.com> 8 * Juha Yrjölä <juha.yrjola@nokia.com>
9 * OMAP Dual-mode timer framework support by Timo Teras 9 * OMAP Dual-mode timer framework support by Timo Teras
10 * 10 *
11 * Some parts based off of TI's 24xx code: 11 * Some parts based off of TI's 24xx code:
diff --git a/arch/arm/mach-pnx4008/pm.c b/arch/arm/mach-pnx4008/pm.c
index 2a137f33f752..40116d254349 100644
--- a/arch/arm/mach-pnx4008/pm.c
+++ b/arch/arm/mach-pnx4008/pm.c
@@ -15,7 +15,7 @@
15#include <linux/rtc.h> 15#include <linux/rtc.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/pm.h> 18#include <linux/suspend.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21 21
@@ -117,7 +117,7 @@ static int pnx4008_pm_valid(suspend_state_t state)
117 (state == PM_SUSPEND_MEM); 117 (state == PM_SUSPEND_MEM);
118} 118}
119 119
120static struct pm_ops pnx4008_pm_ops = { 120static struct platform_suspend_ops pnx4008_pm_ops = {
121 .enter = pnx4008_pm_enter, 121 .enter = pnx4008_pm_enter,
122 .valid = pnx4008_pm_valid, 122 .valid = pnx4008_pm_valid,
123}; 123};
@@ -146,7 +146,7 @@ static int __init pnx4008_pm_init(void)
146 return -ENOMEM; 146 return -ENOMEM;
147 } 147 }
148 148
149 pm_set_ops(&pnx4008_pm_ops); 149 suspend_set_ops(&pnx4008_pm_ops);
150 return 0; 150 return 0;
151} 151}
152 152
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index b59a81a8e7d3..a941c71c7d06 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -86,7 +86,7 @@ static int pxa_pm_valid(suspend_state_t state)
86 return -EINVAL; 86 return -EINVAL;
87} 87}
88 88
89static struct pm_ops pxa_pm_ops = { 89static struct platform_suspend_ops pxa_pm_ops = {
90 .valid = pxa_pm_valid, 90 .valid = pxa_pm_valid,
91 .enter = pxa_pm_enter, 91 .enter = pxa_pm_enter,
92}; 92};
@@ -104,7 +104,7 @@ static int __init pxa_pm_init(void)
104 return -ENOMEM; 104 return -ENOMEM;
105 } 105 }
106 106
107 pm_set_ops(&pxa_pm_ops); 107 suspend_set_ops(&pxa_pm_ops);
108 return 0; 108 return 0;
109} 109}
110 110
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 0d6a72504caa..dcd81f8d0833 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -20,7 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/pm.h> 23#include <linux/suspend.h>
24 24
25#include <asm/hardware.h> 25#include <asm/hardware.h>
26#include <asm/arch/irqs.h> 26#include <asm/arch/irqs.h>
@@ -215,7 +215,7 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)
215 215
216static struct pxa_cpu_pm_fns pxa25x_cpu_pm_fns = { 216static struct pxa_cpu_pm_fns pxa25x_cpu_pm_fns = {
217 .save_size = SLEEP_SAVE_SIZE, 217 .save_size = SLEEP_SAVE_SIZE,
218 .valid = pm_valid_only_mem, 218 .valid = suspend_valid_only_mem,
219 .save = pxa25x_cpu_pm_save, 219 .save = pxa25x_cpu_pm_save,
220 .restore = pxa25x_cpu_pm_restore, 220 .restore = pxa25x_cpu_pm_restore,
221 .enter = pxa25x_cpu_pm_enter, 221 .enter = pxa25x_cpu_pm_enter,
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 2d7fc39732e4..d0f2b597db12 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -14,7 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/pm.h> 17#include <linux/suspend.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/hardware.h> 20#include <asm/hardware.h>
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index cab9d6265e9e..2bfaa6102025 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -238,7 +238,7 @@ int __init s3c2410_baseclk_add(void)
238 } 238 }
239 239
240 /* We must be careful disabling the clocks we are not intending to 240 /* We must be careful disabling the clocks we are not intending to
241 * be using at boot time, as subsytems such as the LCD which do 241 * be using at boot time, as subsystems such as the LCD which do
242 * their own DMA requests to the bus can cause the system to lockup 242 * their own DMA requests to the bus can cause the system to lockup
243 * if they where in the middle of requesting bus access. 243 * if they where in the middle of requesting bus access.
244 * 244 *
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 8543dd6df391..458993601897 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -689,7 +689,7 @@ int __init s3c2412_baseclk_add(void)
689 } 689 }
690 690
691 /* We must be careful disabling the clocks we are not intending to 691 /* We must be careful disabling the clocks we are not intending to
692 * be using at boot time, as subsytems such as the LCD which do 692 * be using at boot time, as subsystems such as the LCD which do
693 * their own DMA requests to the bus can cause the system to lockup 693 * their own DMA requests to the bus can cause the system to lockup
694 * if they where in the middle of requesting bus access. 694 * if they where in the middle of requesting bus access.
695 * 695 *
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index 58402948c47c..b42f956738d0 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -1005,7 +1005,7 @@ void __init s3c2443_init_clocks(int xtal)
1005 } 1005 }
1006 1006
1007 /* We must be careful disabling the clocks we are not intending to 1007 /* We must be careful disabling the clocks we are not intending to
1008 * be using at boot time, as subsytems such as the LCD which do 1008 * be using at boot time, as subsystems such as the LCD which do
1009 * their own DMA requests to the bus can cause the system to lockup 1009 * their own DMA requests to the bus can cause the system to lockup
1010 * if they where in the middle of requesting bus access. 1010 * if they where in the middle of requesting bus access.
1011 * 1011 *
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 01a37d3c0727..246c573e7252 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -122,14 +122,14 @@ unsigned long sleep_phys_sp(void *sp)
122 return virt_to_phys(sp); 122 return virt_to_phys(sp);
123} 123}
124 124
125static struct pm_ops sa11x0_pm_ops = { 125static struct platform_suspend_ops sa11x0_pm_ops = {
126 .enter = sa11x0_pm_enter, 126 .enter = sa11x0_pm_enter,
127 .valid = pm_valid_only_mem, 127 .valid = suspend_valid_only_mem,
128}; 128};
129 129
130static int __init sa11x0_pm_init(void) 130static int __init sa11x0_pm_init(void)
131{ 131{
132 pm_set_ops(&sa11x0_pm_ops); 132 suspend_set_ops(&sa11x0_pm_ops);
133 return 0; 133 return 0;
134} 134}
135 135
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 074b7cb07743..e162cca5917f 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -757,7 +757,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
757 if (ai_usermode & 1) 757 if (ai_usermode & 1)
758 printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx " 758 printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx "
759 "Address=0x%08lx FSR 0x%03x\n", current->comm, 759 "Address=0x%08lx FSR 0x%03x\n", current->comm,
760 current->pid, instrptr, 760 task_pid_nr(current), instrptr,
761 thumb_mode(regs) ? 4 : 8, 761 thumb_mode(regs) ? 4 : 8,
762 thumb_mode(regs) ? tinstr : instr, 762 thumb_mode(regs) ? tinstr : instr,
763 addr, fsr); 763 addr, fsr);
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index 59ed1d05b71b..a8a7dab757eb 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -197,7 +197,7 @@ survive:
197 return fault; 197 return fault;
198 198
199out_of_memory: 199out_of_memory:
200 if (!is_init(tsk)) 200 if (!is_global_init(tsk))
201 goto out; 201 goto out;
202 202
203 /* 203 /*
diff --git a/arch/arm/nwfpe/fpopcode.h b/arch/arm/nwfpe/fpopcode.h
index ec78e3517fc9..786e4c96156d 100644
--- a/arch/arm/nwfpe/fpopcode.h
+++ b/arch/arm/nwfpe/fpopcode.h
@@ -78,11 +78,11 @@ TABLE 1
78+-------------------------+---+---+---------+---------+ 78+-------------------------+---+---+---------+---------+
79| Precision | u | v | FPSR.EP | length | 79| Precision | u | v | FPSR.EP | length |
80+-------------------------+---+---+---------+---------+ 80+-------------------------+---+---+---------+---------+
81| Single | 0 ü 0 | x | 1 words | 81| Single | 0 | 0 | x | 1 words |
82| Double | 1 ü 1 | x | 2 words | 82| Double | 1 | 1 | x | 2 words |
83| Extended | 1 ü 1 | x | 3 words | 83| Extended | 1 | 1 | x | 3 words |
84| Packed decimal | 1 ü 1 | 0 | 3 words | 84| Packed decimal | 1 | 1 | 0 | 3 words |
85| Expanded packed decimal | 1 ü 1 | 1 | 4 words | 85| Expanded packed decimal | 1 | 1 | 1 | 4 words |
86+-------------------------+---+---+---------+---------+ 86+-------------------------+---+---+---------+---------+
87Note: x = don't care 87Note: x = don't care
88*/ 88*/
@@ -92,10 +92,10 @@ TABLE 2
92+---+---+---------------------------------+ 92+---+---+---------------------------------+
93| w | x | Number of registers to transfer | 93| w | x | Number of registers to transfer |
94+---+---+---------------------------------+ 94+---+---+---------------------------------+
95| 0 ü 1 | 1 | 95| 0 | 1 | 1 |
96| 1 ü 0 | 2 | 96| 1 | 0 | 2 |
97| 1 ü 1 | 3 | 97| 1 | 1 | 3 |
98| 0 ü 0 | 4 | 98| 0 | 0 | 4 |
99+---+---+---------------------------------+ 99+---+---+---------------------------------+
100*/ 100*/
101 101
@@ -156,10 +156,10 @@ TABLE 5
156+-------------------------+---+---+ 156+-------------------------+---+---+
157| Rounding Precision | e | f | 157| Rounding Precision | e | f |
158+-------------------------+---+---+ 158+-------------------------+---+---+
159| IEEE Single precision | 0 ü 0 | 159| IEEE Single precision | 0 | 0 |
160| IEEE Double precision | 0 ü 1 | 160| IEEE Double precision | 0 | 1 |
161| IEEE Extended precision | 1 ü 0 | 161| IEEE Extended precision | 1 | 0 |
162| undefined (trap) | 1 ü 1 | 162| undefined (trap) | 1 | 1 |
163+-------------------------+---+---+ 163+-------------------------+---+---+
164*/ 164*/
165 165
@@ -168,10 +168,10 @@ TABLE 5
168+---------------------------------+---+---+ 168+---------------------------------+---+---+
169| Rounding Mode | g | h | 169| Rounding Mode | g | h |
170+---------------------------------+---+---+ 170+---------------------------------+---+---+
171| Round to nearest (default) | 0 ü 0 | 171| Round to nearest (default) | 0 | 0 |
172| Round toward plus infinity | 0 ü 1 | 172| Round toward plus infinity | 0 | 1 |
173| Round toward negative infinity | 1 ü 0 | 173| Round toward negative infinity | 1 | 0 |
174| Round toward zero | 1 ü 1 | 174| Round toward zero | 1 | 1 |
175+---------------------------------+---+---+ 175+---------------------------------+---+---+
176*/ 176*/
177 177
@@ -369,20 +369,20 @@ TABLE 5
369#define getRoundingMode(opcode) ((opcode & MASK_ROUNDING_MODE) >> 5) 369#define getRoundingMode(opcode) ((opcode & MASK_ROUNDING_MODE) >> 5)
370 370
371#ifdef CONFIG_FPE_NWFPE_XP 371#ifdef CONFIG_FPE_NWFPE_XP
372static inline __attribute_pure__ floatx80 getExtendedConstant(const unsigned int nIndex) 372static inline floatx80 __pure getExtendedConstant(const unsigned int nIndex)
373{ 373{
374 extern const floatx80 floatx80Constant[]; 374 extern const floatx80 floatx80Constant[];
375 return floatx80Constant[nIndex]; 375 return floatx80Constant[nIndex];
376} 376}
377#endif 377#endif
378 378
379static inline __attribute_pure__ float64 getDoubleConstant(const unsigned int nIndex) 379static inline float64 __pure getDoubleConstant(const unsigned int nIndex)
380{ 380{
381 extern const float64 float64Constant[]; 381 extern const float64 float64Constant[];
382 return float64Constant[nIndex]; 382 return float64Constant[nIndex];
383} 383}
384 384
385static inline __attribute_pure__ float32 getSingleConstant(const unsigned int nIndex) 385static inline float32 __pure getSingleConstant(const unsigned int nIndex)
386{ 386{
387 extern const float32 float32Constant[]; 387 extern const float32 float32Constant[];
388 return float32Constant[nIndex]; 388 return float32Constant[nIndex];
diff --git a/arch/arm/oprofile/Kconfig b/arch/arm/oprofile/Kconfig
deleted file mode 100644
index afd93ad02feb..000000000000
--- a/arch/arm/oprofile/Kconfig
+++ /dev/null
@@ -1,42 +0,0 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22if OPROFILE
23
24config OPROFILE_ARMV6
25 bool
26 depends on CPU_V6 && !SMP
27 default y
28 select OPROFILE_ARM11_CORE
29
30config OPROFILE_MPCORE
31 bool
32 depends on CPU_V6 && SMP
33 default y
34 select OPROFILE_ARM11_CORE
35
36config OPROFILE_ARM11_CORE
37 bool
38
39endif
40
41endmenu
42
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 05a38498cbe0..dcbba07cf98a 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -2,7 +2,7 @@
2 * linux/arch/arm/plat-omap/dma.c 2 * linux/arch/arm/plat-omap/dma.c
3 * 3 *
4 * Copyright (C) 2003 Nokia Corporation 4 * Copyright (C) 2003 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com> 5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com> 6 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
7 * Graphics DMA and LCD DMA graphics tranformations 7 * Graphics DMA and LCD DMA graphics tranformations
8 * by Imre Deak <imre.deak@nokia.com> 8 * by Imre Deak <imre.deak@nokia.com>
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 337455dfe64d..6097753394ad 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -4,7 +4,7 @@
4 * Support functions for OMAP GPIO 4 * Support functions for OMAP GPIO
5 * 5 *
6 * Copyright (C) 2003-2005 Nokia Corporation 6 * Copyright (C) 2003-2005 Nokia Corporation
7 * Written by Juha Yrjölä <juha.yrjola@nokia.com> 7 * Written by Juha Yrjölä <juha.yrjola@nokia.com>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index eab1850616d8..4fdb3117744f 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -612,9 +612,9 @@ static int s3c2410_pm_enter(suspend_state_t state)
612 return 0; 612 return 0;
613} 613}
614 614
615static struct pm_ops s3c2410_pm_ops = { 615static struct platform_suspend_ops s3c2410_pm_ops = {
616 .enter = s3c2410_pm_enter, 616 .enter = s3c2410_pm_enter,
617 .valid = pm_valid_only_mem, 617 .valid = suspend_valid_only_mem,
618}; 618};
619 619
620/* s3c2410_pm_init 620/* s3c2410_pm_init
@@ -628,6 +628,6 @@ int __init s3c2410_pm_init(void)
628{ 628{
629 printk("S3C2410 Power Management, (c) 2004 Simtec Electronics\n"); 629 printk("S3C2410 Power Management, (c) 2004 Simtec Electronics\n");
630 630
631 pm_set_ops(&s3c2410_pm_ops); 631 suspend_set_ops(&s3c2410_pm_ops);
632 return 0; 632 return 0;
633} 633}
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index d12346aaa88b..bbecbd8469b5 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -189,7 +189,7 @@ config CMDLINE
189 189
190endmenu 190endmenu
191 191
192menu "Power managment options" 192menu "Power management options"
193 193
194menu "CPU Frequency scaling" 194menu "CPU Frequency scaling"
195 195
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c
index 9a73ce7eb50f..8a7caf8e7b45 100644
--- a/arch/avr32/kernel/traps.c
+++ b/arch/avr32/kernel/traps.c
@@ -89,7 +89,7 @@ void _exception(long signr, struct pt_regs *regs, int code,
89 * generate the same exception over and over again and we get 89 * generate the same exception over and over again and we get
90 * nowhere. Better to kill it and let the kernel panic. 90 * nowhere. Better to kill it and let the kernel panic.
91 */ 91 */
92 if (is_init(current)) { 92 if (is_global_init(current)) {
93 __sighandler_t handler; 93 __sighandler_t handler;
94 94
95 spin_lock_irq(&current->sighand->siglock); 95 spin_lock_irq(&current->sighand->siglock);
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
index 11472f8701bd..6560cb18b4e3 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -160,7 +160,7 @@ bad_area:
160 if (exception_trace && printk_ratelimit()) 160 if (exception_trace && printk_ratelimit())
161 printk("%s%s[%d]: segfault at %08lx pc %08lx " 161 printk("%s%s[%d]: segfault at %08lx pc %08lx "
162 "sp %08lx ecr %lu\n", 162 "sp %08lx ecr %lu\n",
163 is_init(tsk) ? KERN_EMERG : KERN_INFO, 163 is_global_init(tsk) ? KERN_EMERG : KERN_INFO,
164 tsk->comm, tsk->pid, address, regs->pc, 164 tsk->comm, tsk->pid, address, regs->pc,
165 regs->sp, ecr); 165 regs->sp, ecr);
166 _exception(SIGSEGV, regs, code, address); 166 _exception(SIGSEGV, regs, code, address);
@@ -209,7 +209,7 @@ no_context:
209 */ 209 */
210out_of_memory: 210out_of_memory:
211 up_read(&mm->mmap_sem); 211 up_read(&mm->mmap_sem);
212 if (is_init(current)) { 212 if (is_global_init(current)) {
213 yield(); 213 yield();
214 down_read(&mm->mmap_sem); 214 down_read(&mm->mmap_sem);
215 goto survive; 215 goto survive;
@@ -231,7 +231,7 @@ do_sigbus:
231 if (exception_trace) 231 if (exception_trace)
232 printk("%s%s[%d]: bus error at %08lx pc %08lx " 232 printk("%s%s[%d]: bus error at %08lx pc %08lx "
233 "sp %08lx ecr %lu\n", 233 "sp %08lx ecr %lu\n",
234 is_init(tsk) ? KERN_EMERG : KERN_INFO, 234 is_global_init(tsk) ? KERN_EMERG : KERN_INFO,
235 tsk->comm, tsk->pid, address, regs->pc, 235 tsk->comm, tsk->pid, address, regs->pc,
236 regs->sp, ecr); 236 regs->sp, ecr);
237 237
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index aa9db3073312..ad28dc76fc97 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -613,85 +613,86 @@ config I_ENTRY_L1
613 bool "Locate interrupt entry code in L1 Memory" 613 bool "Locate interrupt entry code in L1 Memory"
614 default y 614 default y
615 help 615 help
616 If enabled interrupt entry code (STORE/RESTORE CONTEXT) is linked 616 If enabled, interrupt entry code (STORE/RESTORE CONTEXT) is linked
617 into L1 instruction memory.(less latency) 617 into L1 instruction memory. (less latency)
618 618
619config EXCPT_IRQ_SYSC_L1 619config EXCPT_IRQ_SYSC_L1
620 bool "Locate entire ASM lowlevel excepetion / interrupt - Syscall and CPLB handler code in L1 Memory" 620 bool "Locate entire ASM lowlevel exception / interrupt - Syscall and CPLB handler code in L1 Memory"
621 default y 621 default y
622 help 622 help
623 If enabled entire ASM lowlevel exception and interrupt entry code (STORE/RESTORE CONTEXT) is linked 623 If enabled, the entire ASM lowlevel exception and interrupt entry code
624 into L1 instruction memory.(less latency) 624 (STORE/RESTORE CONTEXT) is linked into L1 instruction memory.
625 (less latency)
625 626
626config DO_IRQ_L1 627config DO_IRQ_L1
627 bool "Locate frequently called do_irq dispatcher function in L1 Memory" 628 bool "Locate frequently called do_irq dispatcher function in L1 Memory"
628 default y 629 default y
629 help 630 help
630 If enabled frequently called do_irq dispatcher function is linked 631 If enabled, the frequently called do_irq dispatcher function is linked
631 into L1 instruction memory.(less latency) 632 into L1 instruction memory. (less latency)
632 633
633config CORE_TIMER_IRQ_L1 634config CORE_TIMER_IRQ_L1
634 bool "Locate frequently called timer_interrupt() function in L1 Memory" 635 bool "Locate frequently called timer_interrupt() function in L1 Memory"
635 default y 636 default y
636 help 637 help
637 If enabled frequently called timer_interrupt() function is linked 638 If enabled, the frequently called timer_interrupt() function is linked
638 into L1 instruction memory.(less latency) 639 into L1 instruction memory. (less latency)
639 640
640config IDLE_L1 641config IDLE_L1
641 bool "Locate frequently idle function in L1 Memory" 642 bool "Locate frequently idle function in L1 Memory"
642 default y 643 default y
643 help 644 help
644 If enabled frequently called idle function is linked 645 If enabled, the frequently called idle function is linked
645 into L1 instruction memory.(less latency) 646 into L1 instruction memory. (less latency)
646 647
647config SCHEDULE_L1 648config SCHEDULE_L1
648 bool "Locate kernel schedule function in L1 Memory" 649 bool "Locate kernel schedule function in L1 Memory"
649 default y 650 default y
650 help 651 help
651 If enabled frequently called kernel schedule is linked 652 If enabled, the frequently called kernel schedule is linked
652 into L1 instruction memory.(less latency) 653 into L1 instruction memory. (less latency)
653 654
654config ARITHMETIC_OPS_L1 655config ARITHMETIC_OPS_L1
655 bool "Locate kernel owned arithmetic functions in L1 Memory" 656 bool "Locate kernel owned arithmetic functions in L1 Memory"
656 default y 657 default y
657 help 658 help
658 If enabled arithmetic functions are linked 659 If enabled, arithmetic functions are linked
659 into L1 instruction memory.(less latency) 660 into L1 instruction memory. (less latency)
660 661
661config ACCESS_OK_L1 662config ACCESS_OK_L1
662 bool "Locate access_ok function in L1 Memory" 663 bool "Locate access_ok function in L1 Memory"
663 default y 664 default y
664 help 665 help
665 If enabled access_ok function is linked 666 If enabled, the access_ok function is linked
666 into L1 instruction memory.(less latency) 667 into L1 instruction memory. (less latency)
667 668
668config MEMSET_L1 669config MEMSET_L1
669 bool "Locate memset function in L1 Memory" 670 bool "Locate memset function in L1 Memory"
670 default y 671 default y
671 help 672 help
672 If enabled memset function is linked 673 If enabled, the memset function is linked
673 into L1 instruction memory.(less latency) 674 into L1 instruction memory. (less latency)
674 675
675config MEMCPY_L1 676config MEMCPY_L1
676 bool "Locate memcpy function in L1 Memory" 677 bool "Locate memcpy function in L1 Memory"
677 default y 678 default y
678 help 679 help
679 If enabled memcpy function is linked 680 If enabled, the memcpy function is linked
680 into L1 instruction memory.(less latency) 681 into L1 instruction memory. (less latency)
681 682
682config SYS_BFIN_SPINLOCK_L1 683config SYS_BFIN_SPINLOCK_L1
683 bool "Locate sys_bfin_spinlock function in L1 Memory" 684 bool "Locate sys_bfin_spinlock function in L1 Memory"
684 default y 685 default y
685 help 686 help
686 If enabled sys_bfin_spinlock function is linked 687 If enabled, sys_bfin_spinlock function is linked
687 into L1 instruction memory.(less latency) 688 into L1 instruction memory. (less latency)
688 689
689config IP_CHECKSUM_L1 690config IP_CHECKSUM_L1
690 bool "Locate IP Checksum function in L1 Memory" 691 bool "Locate IP Checksum function in L1 Memory"
691 default n 692 default n
692 help 693 help
693 If enabled IP Checksum function is linked 694 If enabled, the IP Checksum function is linked
694 into L1 instruction memory.(less latency) 695 into L1 instruction memory. (less latency)
695 696
696config CACHELINE_ALIGNED_L1 697config CACHELINE_ALIGNED_L1
697 bool "Locate cacheline_aligned data to L1 Data Memory" 698 bool "Locate cacheline_aligned data to L1 Data Memory"
@@ -699,24 +700,24 @@ config CACHELINE_ALIGNED_L1
699 default n if BF54x 700 default n if BF54x
700 depends on !BF531 701 depends on !BF531
701 help 702 help
702 If enabled cacheline_anligned data is linked 703 If enabled, cacheline_anligned data is linked
703 into L1 data memory.(less latency) 704 into L1 data memory. (less latency)
704 705
705config SYSCALL_TAB_L1 706config SYSCALL_TAB_L1
706 bool "Locate Syscall Table L1 Data Memory" 707 bool "Locate Syscall Table L1 Data Memory"
707 default n 708 default n
708 depends on !BF531 709 depends on !BF531
709 help 710 help
710 If enabled the Syscall LUT is linked 711 If enabled, the Syscall LUT is linked
711 into L1 data memory.(less latency) 712 into L1 data memory. (less latency)
712 713
713config CPLB_SWITCH_TAB_L1 714config CPLB_SWITCH_TAB_L1
714 bool "Locate CPLB Switch Tables L1 Data Memory" 715 bool "Locate CPLB Switch Tables L1 Data Memory"
715 default n 716 default n
716 depends on !BF531 717 depends on !BF531
717 help 718 help
718 If enabled the CPLB Switch Tables are linked 719 If enabled, the CPLB Switch Tables are linked
719 into L1 data memory.(less latency) 720 into L1 data memory. (less latency)
720 721
721endmenu 722endmenu
722 723
@@ -1012,7 +1013,7 @@ source "drivers/Kconfig"
1012 1013
1013source "fs/Kconfig" 1014source "fs/Kconfig"
1014 1015
1015source "arch/blackfin/oprofile/Kconfig" 1016source "kernel/Kconfig.instrumentation"
1016 1017
1017menu "Kernel hacking" 1018menu "Kernel hacking"
1018 1019
@@ -1029,13 +1030,13 @@ config DEBUG_HWERR
1029 from. 1030 from.
1030 1031
1031config DEBUG_ICACHE_CHECK 1032config DEBUG_ICACHE_CHECK
1032 bool "Check Instruction cache coherancy" 1033 bool "Check Instruction cache coherency"
1033 depends on DEBUG_KERNEL 1034 depends on DEBUG_KERNEL
1034 depends on DEBUG_HWERR 1035 depends on DEBUG_HWERR
1035 help 1036 help
1036 Say Y here if you are getting wierd unexplained errors. This will 1037 Say Y here if you are getting weird unexplained errors. This will
1037 ensure that icache is what SDRAM says it should be, by doing a 1038 ensure that icache is what SDRAM says it should be by doing a
1038 byte wise comparision between SDRAM and instruction cache. This 1039 byte wise comparison between SDRAM and instruction cache. This
1039 also relocates the irq_panic() function to L1 memory, (which is 1040 also relocates the irq_panic() function to L1 memory, (which is
1040 un-cached). 1041 un-cached).
1041 1042
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index b10302722202..dac51fb06f22 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -32,7 +32,7 @@
32 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 32 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 */ 33 */
34 34
35#include <linux/pm.h> 35#include <linux/suspend.h>
36#include <linux/sched.h> 36#include <linux/sched.h>
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/io.h> 38#include <linux/io.h>
@@ -89,28 +89,15 @@ void bfin_pm_suspend_standby_enter(void)
89#endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */ 89#endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */
90} 90}
91 91
92
93/* 92/*
94 * bfin_pm_prepare - Do preliminary suspend work. 93 * bfin_pm_valid - Tell the PM core that we only support the standby sleep
95 * @state: suspend state we're entering. 94 * state
95 * @state: suspend state we're checking.
96 * 96 *
97 */ 97 */
98static int bfin_pm_prepare(suspend_state_t state) 98static int bfin_pm_valid(suspend_state_t state)
99{ 99{
100 int error = 0; 100 return (state == PM_SUSPEND_STANDBY);
101
102 switch (state) {
103 case PM_SUSPEND_STANDBY:
104 break;
105
106 case PM_SUSPEND_MEM:
107 return -ENOTSUPP;
108
109 default:
110 return -EINVAL;
111 }
112
113 return error;
114} 101}
115 102
116/* 103/*
@@ -135,44 +122,14 @@ static int bfin_pm_enter(suspend_state_t state)
135 return 0; 122 return 0;
136} 123}
137 124
138/* 125struct platform_suspend_ops bfin_pm_ops = {
139 * bfin_pm_finish - Finish up suspend sequence.
140 * @state: State we're coming out of.
141 *
142 * This is called after we wake back up (or if entering the sleep state
143 * failed).
144 */
145static int bfin_pm_finish(suspend_state_t state)
146{
147 switch (state) {
148 case PM_SUSPEND_STANDBY:
149 break;
150
151 case PM_SUSPEND_MEM:
152 return -ENOTSUPP;
153
154 default:
155 return -EINVAL;
156 }
157
158 return 0;
159}
160
161static int bfin_pm_valid(suspend_state_t state)
162{
163 return (state == PM_SUSPEND_STANDBY);
164}
165
166struct pm_ops bfin_pm_ops = {
167 .prepare = bfin_pm_prepare,
168 .enter = bfin_pm_enter, 126 .enter = bfin_pm_enter,
169 .finish = bfin_pm_finish,
170 .valid = bfin_pm_valid, 127 .valid = bfin_pm_valid,
171}; 128};
172 129
173static int __init bfin_pm_init(void) 130static int __init bfin_pm_init(void)
174{ 131{
175 pm_set_ops(&bfin_pm_ops); 132 suspend_set_ops(&bfin_pm_ops);
176 return 0; 133 return 0;
177} 134}
178 135
diff --git a/arch/blackfin/oprofile/Kconfig b/arch/blackfin/oprofile/Kconfig
deleted file mode 100644
index 0a2fd999c941..000000000000
--- a/arch/blackfin/oprofile/Kconfig
+++ /dev/null
@@ -1,29 +0,0 @@
1menu "Profiling support"
2depends on EXPERIMENTAL
3
4config PROFILING
5 bool "Profiling support (EXPERIMENTAL)"
6 help
7 Say Y here to enable the extended profiling support mechanisms used
8 by profilers such as OProfile.
9
10config OPROFILE
11 tristate "OProfile system profiling (EXPERIMENTAL)"
12 depends on PROFILING
13 help
14 OProfile is a profiling system capable of profiling the
15 whole system, include the kernel, kernel modules, libraries,
16 and applications.
17
18 If unsure, say N.
19
20config HARDWARE_PM
21 tristate "Hardware Performance Monitor Profiling"
22 depends on PROFILING
23 help
24 take use of hardware performance monitor to profiling the kernel
25 and application.
26
27 If unsure, say N.
28
29endmenu
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 6b4d026a00a1..21900a9378bb 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -196,6 +196,8 @@ source "sound/Kconfig"
196 196
197source "drivers/usb/Kconfig" 197source "drivers/usb/Kconfig"
198 198
199source "kernel/Kconfig.instrumentation"
200
199source "arch/cris/Kconfig.debug" 201source "arch/cris/Kconfig.debug"
200 202
201source "security/Kconfig" 203source "security/Kconfig"
diff --git a/arch/cris/arch-v10/Kconfig b/arch/cris/arch-v10/Kconfig
index c7ea9efd0104..f1ce6f64401d 100644
--- a/arch/cris/arch-v10/Kconfig
+++ b/arch/cris/arch-v10/Kconfig
@@ -182,7 +182,7 @@ config ETRAX_LED7G
182 set this to same as CONFIG_ETRAX_LED1G (normally 2). 182 set this to same as CONFIG_ETRAX_LED1G (normally 2).
183 183
184config ETRAX_LED8Y 184config ETRAX_LED8Y
185 int "Eigth yellow LED bit" 185 int "Eighth yellow LED bit"
186 depends on ETRAX_CSP0_LEDS 186 depends on ETRAX_CSP0_LEDS
187 default "2" 187 default "2"
188 help 188 help
diff --git a/arch/cris/arch-v10/boot/compressed/misc.c b/arch/cris/arch-v10/boot/compressed/misc.c
index ffb8d21b2f83..e205d2e7e089 100644
--- a/arch/cris/arch-v10/boot/compressed/misc.c
+++ b/arch/cris/arch-v10/boot/compressed/misc.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 9 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
10 * puts by Nick Holloway 1993, better puts by Martin Mares 1995 10 * puts by Nick Holloway 1993, better puts by Martin Mares 1995
11 * adoptation for Linux/CRIS Axis Communications AB, 1999 11 * adaptation for Linux/CRIS Axis Communications AB, 1999
12 * 12 *
13 */ 13 */
14 14
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index 1de0026bb94e..c263b8232dbc 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -4,7 +4,7 @@
4 * From Phillips' datasheet: 4 * From Phillips' datasheet:
5 * 5 *
6 * The PCF8563 is a CMOS real-time clock/calendar optimized for low power 6 * The PCF8563 is a CMOS real-time clock/calendar optimized for low power
7 * consumption. A programmable clock output, interupt output and voltage 7 * consumption. A programmable clock output, interrupt output and voltage
8 * low detector are also provided. All address and data are transferred 8 * low detector are also provided. All address and data are transferred
9 * serially via two-line bidirectional I2C-bus. Maximum bus speed is 9 * serially via two-line bidirectional I2C-bus. Maximum bus speed is
10 * 400 kbits/s. The built-in word address register is incremented 10 * 400 kbits/s. The built-in word address register is incremented
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index 2b536ca6f444..93679a48c791 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -83,7 +83,7 @@
83 * 83 *
84 * Revision 1.4 2002/11/19 14:35:24 starvik 84 * Revision 1.4 2002/11/19 14:35:24 starvik
85 * Changes from linux 2.4 85 * Changes from linux 2.4
86 * Changed struct initializer syntax to the currently prefered notation 86 * Changed struct initializer syntax to the currently preferred notation
87 * 87 *
88 * Revision 1.3 2002/11/06 09:47:03 starvik 88 * Revision 1.3 2002/11/06 09:47:03 starvik
89 * Modified for new interrupt macros 89 * Modified for new interrupt macros
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index ae45d4522e65..c5844cb70f09 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -97,7 +97,7 @@
97 * 97 *
98 * Revision 1.36 2001/11/22 13:36:36 bjornw 98 * Revision 1.36 2001/11/22 13:36:36 bjornw
99 * * In ret_from_intr, check regs->dccr for usermode reentrance instead of 99 * * In ret_from_intr, check regs->dccr for usermode reentrance instead of
100 * DCCR explicitely (because the latter might not reflect current reality) 100 * DCCR explicitly (because the latter might not reflect current reality)
101 * * In mmu_bus_fault, set $r9 _after_ calling the C-code instead of before 101 * * In mmu_bus_fault, set $r9 _after_ calling the C-code instead of before
102 * since $r9 is call-clobbered and is potentially needed afterwards 102 * since $r9 is call-clobbered and is potentially needed afterwards
103 * 103 *
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index 8cbdf594b369..d3ea052e5ee1 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -84,7 +84,7 @@
84 * with time based on jiffies and *R_TIMER0_DATA, uses a table 84 * with time based on jiffies and *R_TIMER0_DATA, uses a table
85 * for fast conversion of timer value to microseconds. 85 * for fast conversion of timer value to microseconds.
86 * (Much faster the standard do_gettimeofday() and we don't really 86 * (Much faster the standard do_gettimeofday() and we don't really
87 * wan't to use the true time - we wan't the "uptime" so timers don't screw up 87 * want to use the true time - we want the "uptime" so timers don't screw up
88 * when we change the time. 88 * when we change the time.
89 * TODO: Add efficient support for continuous timers as well. 89 * TODO: Add efficient support for continuous timers as well.
90 * 90 *
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index 96094cbf1255..845c95f6e871 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -169,7 +169,7 @@ init_IRQ(void)
169 for (i = 0; i < 256; i++) 169 for (i = 0; i < 256; i++)
170 etrax_irv->v[i] = weird_irq; 170 etrax_irv->v[i] = weird_irq;
171 171
172 /* Initialize IRQ handler descriptiors. */ 172 /* Initialize IRQ handler descriptors. */
173 for(i = 2; i < NR_IRQS; i++) { 173 for(i = 2; i < NR_IRQS; i++) {
174 irq_desc[i].chip = &crisv10_irq_type; 174 irq_desc[i].chip = &crisv10_irq_type;
175 set_int_vector(i, interrupt[i]); 175 set_int_vector(i, interrupt[i]);
diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c
index 07628a13c6c4..77f4b1423725 100644
--- a/arch/cris/arch-v10/kernel/kgdb.c
+++ b/arch/cris/arch-v10/kernel/kgdb.c
@@ -959,7 +959,7 @@ stub_is_stopped(int sigval)
959 959
960 /* Send register contents. We probably only need to send the 960 /* Send register contents. We probably only need to send the
961 * PC, frame pointer and stack pointer here. Other registers will be 961 * PC, frame pointer and stack pointer here. Other registers will be
962 * explicitely asked for. But for now, send all. 962 * explicitly asked for. But for now, send all.
963 */ 963 */
964 964
965 for (regno = R0; regno <= USP; regno++) { 965 for (regno = R0; regno <= USP; regno++) {
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index b6831ceb6a62..1a3760c94f85 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -64,7 +64,7 @@ void hard_reset_now (void)
64#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM) 64#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
65 cause_of_death = 0xbedead; 65 cause_of_death = 0xbedead;
66#else 66#else
67 /* Since we dont plan to keep on reseting the watchdog, 67 /* Since we dont plan to keep on resetting the watchdog,
68 the key can be arbitrary hence three */ 68 the key can be arbitrary hence three */
69 *R_WATCHDOG = IO_FIELD(R_WATCHDOG, key, 3) | 69 *R_WATCHDOG = IO_FIELD(R_WATCHDOG, key, 3) |
70 IO_STATE(R_WATCHDOG, enable, start); 70 IO_STATE(R_WATCHDOG, enable, start);
diff --git a/arch/cris/arch-v10/kernel/shadows.c b/arch/cris/arch-v10/kernel/shadows.c
index 38fd44dfbc5b..326178aef6ee 100644
--- a/arch/cris/arch-v10/kernel/shadows.c
+++ b/arch/cris/arch-v10/kernel/shadows.c
@@ -20,7 +20,7 @@ unsigned long r_timer_ctrl_shadow;
20 * These are only usable if there actually IS a latch connected 20 * These are only usable if there actually IS a latch connected
21 * to the corresponding external chip-select pin. 21 * to the corresponding external chip-select pin.
22 * 22 *
23 * A common usage is that CSP0 controls LED's and CSP4 video chips. 23 * A common usage is that CSP0 controls LEDs and CSP4 video chips.
24 */ 24 */
25 25
26unsigned long port_cse1_shadow; 26unsigned long port_cse1_shadow;
diff --git a/arch/cris/arch-v10/lib/dram_init.S b/arch/cris/arch-v10/lib/dram_init.S
index 9cf83932cd5d..6a6bdfd6984d 100644
--- a/arch/cris/arch-v10/lib/dram_init.S
+++ b/arch/cris/arch-v10/lib/dram_init.S
@@ -40,7 +40,7 @@
40 * Copy warning from head.S about r8 and r9 40 * Copy warning from head.S about r8 and r9
41 * 41 *
42 * Revision 1.7 2001/04/18 12:05:39 bjornw 42 * Revision 1.7 2001/04/18 12:05:39 bjornw
43 * Fixed comments, and explicitely include config.h to be sure its there 43 * Fixed comments, and explicitly include config.h to be sure its there
44 * 44 *
45 * Revision 1.6 2001/04/10 06:20:16 starvik 45 * Revision 1.6 2001/04/10 06:20:16 starvik
46 * Delay should be 200us, not 200ns 46 * Delay should be 200us, not 200ns
@@ -66,7 +66,7 @@
66 */ 66 */
67 67
68/* Just to be certain the config file is included, we include it here 68/* Just to be certain the config file is included, we include it here
69 * explicitely instead of depending on it being included in the file that 69 * explicitly instead of depending on it being included in the file that
70 * uses this code. 70 * uses this code.
71 */ 71 */
72 72
diff --git a/arch/cris/arch-v10/lib/string.c b/arch/cris/arch-v10/lib/string.c
index 8ffde4901b57..15d6662b03b1 100644
--- a/arch/cris/arch-v10/lib/string.c
+++ b/arch/cris/arch-v10/lib/string.c
@@ -41,7 +41,7 @@ void *memcpy(void *pdst,
41 Make sure the compiler is able to make something useful of this. 41 Make sure the compiler is able to make something useful of this.
42 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 42 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
43 43
44 If gcc was allright, it really would need no temporaries, and no 44 If gcc was alright, it really would need no temporaries, and no
45 stack space to save stuff on. */ 45 stack space to save stuff on. */
46 46
47 register void *return_dst __asm__ ("r10") = pdst; 47 register void *return_dst __asm__ ("r10") = pdst;
diff --git a/arch/cris/arch-v10/lib/usercopy.c b/arch/cris/arch-v10/lib/usercopy.c
index 43778d53c254..a12c708afc9a 100644
--- a/arch/cris/arch-v10/lib/usercopy.c
+++ b/arch/cris/arch-v10/lib/usercopy.c
@@ -38,7 +38,7 @@ __copy_user (void __user *pdst, const void *psrc, unsigned long pn)
38 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 38 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
39 39
40 FIXME: Comment for old gcc version. Check. 40 FIXME: Comment for old gcc version. Check.
41 If gcc was allright, it really would need no temporaries, and no 41 If gcc was alright, it really would need no temporaries, and no
42 stack space to save stuff on. */ 42 stack space to save stuff on. */
43 43
44 register char *dst __asm__ ("r13") = pdst; 44 register char *dst __asm__ ("r13") = pdst;
@@ -200,7 +200,7 @@ __copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn)
200 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 200 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
201 201
202 FIXME: Comment for old gcc version. Check. 202 FIXME: Comment for old gcc version. Check.
203 If gcc was allright, it really would need no temporaries, and no 203 If gcc was alright, it really would need no temporaries, and no
204 stack space to save stuff on. */ 204 stack space to save stuff on. */
205 205
206 register char *dst __asm__ ("r13") = pdst; 206 register char *dst __asm__ ("r13") = pdst;
@@ -380,7 +380,7 @@ __do_clear_user (void __user *pto, unsigned long pn)
380 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 380 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
381 381
382 FIXME: Comment for old gcc version. Check. 382 FIXME: Comment for old gcc version. Check.
383 If gcc was allright, it really would need no temporaries, and no 383 If gcc was alright, it really would need no temporaries, and no
384 stack space to save stuff on. */ 384 stack space to save stuff on. */
385 385
386 register char *dst __asm__ ("r13") = pto; 386 register char *dst __asm__ ("r13") = pto;
diff --git a/arch/cris/arch-v32/boot/compressed/misc.c b/arch/cris/arch-v32/boot/compressed/misc.c
index 11902697196d..0169ba1ca9c9 100644
--- a/arch/cris/arch-v32/boot/compressed/misc.c
+++ b/arch/cris/arch-v32/boot/compressed/misc.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 9 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
10 * puts by Nick Holloway 1993, better puts by Martin Mares 1995 10 * puts by Nick Holloway 1993, better puts by Martin Mares 1995
11 * adoptation for Linux/CRIS Axis Communications AB, 1999 11 * adaptation for Linux/CRIS Axis Communications AB, 1999
12 * 12 *
13 */ 13 */
14 14
@@ -151,7 +151,7 @@ serout(const char *s, reg_scope_instances regi_ser)
151 do { 151 do {
152 rs = REG_RD(ser, regi_ser, rs_stat_din); 152 rs = REG_RD(ser, regi_ser, rs_stat_din);
153 } 153 }
154 while (!rs.tr_rdy);/* Wait for tranceiver. */ 154 while (!rs.tr_rdy);/* Wait for transceiver. */
155 155
156 REG_WR(ser, regi_ser, rw_dout, dout); 156 REG_WR(ser, regi_ser, rw_dout, dout);
157} 157}
@@ -264,7 +264,7 @@ serial_setup(reg_scope_instances regi_ser)
264 tr_ctrl.stop_bits = 1; /* 2 stop bits. */ 264 tr_ctrl.stop_bits = 1; /* 2 stop bits. */
265 265
266 /* 266 /*
267 * The baudrate setup is a bit fishy, but in the end the tranceiver is 267 * The baudrate setup is a bit fishy, but in the end the transceiver is
268 * set to 4800 and the receiver to 115200. The magic value is 268 * set to 4800 and the receiver to 115200. The magic value is
269 * 29.493 MHz. 269 * 29.493 MHz.
270 */ 270 */
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
index 5180d45412fc..3ec12ea44e8e 100644
--- a/arch/cris/arch-v32/drivers/axisflashmap.c
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -205,7 +205,7 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
205/* 205/*
206 * Probe each chip select individually for flash chips. If there are chips on 206 * Probe each chip select individually for flash chips. If there are chips on
207 * both cse0 and cse1, the mtd_info structs will be concatenated to one struct 207 * both cse0 and cse1, the mtd_info structs will be concatenated to one struct
208 * so that MTD partitions can cross chip boundries. 208 * so that MTD partitions can cross chip boundaries.
209 * 209 *
210 * The only known restriction to how you can mount your chips is that each 210 * The only known restriction to how you can mount your chips is that each
211 * chip select must hold similar flash chips. But you need external hardware 211 * chip select must hold similar flash chips. But you need external hardware
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
index e12f6cc6f4a2..f1edd2e359b2 100644
--- a/arch/cris/arch-v32/drivers/i2c.c
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -275,7 +275,7 @@ i2c_getack(void)
275 ack = 0; 275 ack = 0;
276 i2c_delay(CLOCK_HIGH_TIME/2); 276 i2c_delay(CLOCK_HIGH_TIME/2);
277 if(!ack){ 277 if(!ack){
278 if(!i2c_getbit()) /* receiver pulld SDA low */ 278 if(!i2c_getbit()) /* receiver pulled SDA low */
279 ack = 1; 279 ack = 1;
280 i2c_delay(CLOCK_HIGH_TIME/2); 280 i2c_delay(CLOCK_HIGH_TIME/2);
281 } 281 }
diff --git a/arch/cris/arch-v32/drivers/nandflash.c b/arch/cris/arch-v32/drivers/nandflash.c
index 93ddea4d9564..5ce015c6bb0d 100644
--- a/arch/cris/arch-v32/drivers/nandflash.c
+++ b/arch/cris/arch-v32/drivers/nandflash.c
@@ -138,7 +138,7 @@ struct mtd_info* __init crisv32_nand_flash_probe (void)
138 /* Enable the following for a flash based bad block table */ 138 /* Enable the following for a flash based bad block table */
139 this->options = NAND_USE_FLASH_BBT; 139 this->options = NAND_USE_FLASH_BBT;
140 140
141 /* Scan to find existance of the device */ 141 /* Scan to find existence of the device */
142 if (nand_scan (crisv32_mtd, 1)) { 142 if (nand_scan (crisv32_mtd, 1)) {
143 err = -ENXIO; 143 err = -ENXIO;
144 goto out_ior; 144 goto out_ior;
diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
index da479a14f836..6dbd700d3d66 100644
--- a/arch/cris/arch-v32/drivers/pcf8563.c
+++ b/arch/cris/arch-v32/drivers/pcf8563.c
@@ -4,7 +4,7 @@
4 * From Phillips' datasheet: 4 * From Phillips' datasheet:
5 * 5 *
6 * The PCF8563 is a CMOS real-time clock/calendar optimized for low power 6 * The PCF8563 is a CMOS real-time clock/calendar optimized for low power
7 * consumption. A programmable clock output, interupt output and voltage 7 * consumption. A programmable clock output, interrupt output and voltage
8 * low detector are also provided. All address and data are transferred 8 * low detector are also provided. All address and data are transferred
9 * serially via two-line bidirectional I2C-bus. Maximum bus speed is 9 * serially via two-line bidirectional I2C-bus. Maximum bus speed is
10 * 400 kbits/s. The built-in word address register is incremented 10 * 400 kbits/s. The built-in word address register is incremented
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
index 79e1e4c2ca1d..b40551f9f40d 100644
--- a/arch/cris/arch-v32/kernel/fasttimer.c
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -97,7 +97,7 @@
97 * with time based on jiffies and *R_TIMER0_DATA, uses a table 97 * with time based on jiffies and *R_TIMER0_DATA, uses a table
98 * for fast conversion of timer value to microseconds. 98 * for fast conversion of timer value to microseconds.
99 * (Much faster the standard do_gettimeofday() and we don't really 99 * (Much faster the standard do_gettimeofday() and we don't really
100 * wan't to use the true time - we wan't the "uptime" so timers don't screw up 100 * want to use the true time - we want the "uptime" so timers don't screw up
101 * when we change the time. 101 * when we change the time.
102 * TODO: Add efficient support for continuous timers as well. 102 * TODO: Add efficient support for continuous timers as well.
103 * 103 *
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index cc361bf578ae..a9acaa270243 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -140,7 +140,7 @@ block_irq(int irq, int cpu)
140 spin_lock_irqsave(&irq_lock, flags); 140 spin_lock_irqsave(&irq_lock, flags);
141 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask); 141 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
142 142
143 /* Remember; 1 let thru, 0 block. */ 143 /* Remember; 1 let through, 0 block. */
144 intr_mask &= ~(1 << (irq - FIRST_IRQ)); 144 intr_mask &= ~(1 << (irq - FIRST_IRQ));
145 145
146 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask); 146 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask);
@@ -156,7 +156,7 @@ unblock_irq(int irq, int cpu)
156 spin_lock_irqsave(&irq_lock, flags); 156 spin_lock_irqsave(&irq_lock, flags);
157 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask); 157 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
158 158
159 /* Remember; 1 let thru, 0 block. */ 159 /* Remember; 1 let through, 0 block. */
160 intr_mask |= (1 << (irq - FIRST_IRQ)); 160 intr_mask |= (1 << (irq - FIRST_IRQ));
161 161
162 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask); 162 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask);
@@ -308,7 +308,7 @@ crisv32_do_multiple(struct pt_regs* regs)
308 */ 308 */
309 irq_enter(); 309 irq_enter();
310 310
311 /* Get which IRQs that happend. */ 311 /* Get which IRQs that happened. */
312 masked = REG_RD_INT(intr_vect, irq_regs[cpu], r_masked_vect); 312 masked = REG_RD_INT(intr_vect, irq_regs[cpu], r_masked_vect);
313 313
314 /* Calculate new IRQ mask with these IRQs disabled. */ 314 /* Calculate new IRQ mask with these IRQs disabled. */
@@ -366,7 +366,7 @@ init_IRQ(void)
366 for (i = 0; i < 256; i++) 366 for (i = 0; i < 256; i++)
367 etrax_irv->v[i] = weird_irq; 367 etrax_irv->v[i] = weird_irq;
368 368
369 /* Point all IRQ's to bad handlers. */ 369 /* Point all IRQs to bad handlers. */
370 for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) { 370 for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
371 irq_desc[j].chip = &crisv32_irq_type; 371 irq_desc[j].chip = &crisv32_irq_type;
372 set_exception_vector(i, interrupt[j]); 372 set_exception_vector(i, interrupt[j]);
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
index 6326351af252..b72a15580dc7 100644
--- a/arch/cris/arch-v32/kernel/process.c
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -162,7 +162,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
162 /* Put the switch stack right below the pt_regs. */ 162 /* Put the switch stack right below the pt_regs. */
163 swstack = ((struct switch_stack *) childregs) - 1; 163 swstack = ((struct switch_stack *) childregs) - 1;
164 164
165 /* Paramater to ret_from_sys_call. 0 is don't restart the syscall. */ 165 /* Parameter to ret_from_sys_call. 0 is don't restart the syscall. */
166 swstack->r9 = 0; 166 swstack->r9 = 0;
167 167
168 /* 168 /*
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index 7cd6ac803409..024cc6901974 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -347,7 +347,7 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
347/* Grab and setup a signal frame. 347/* Grab and setup a signal frame.
348 * 348 *
349 * Basically a lot of state-info is stacked, and arranged for the 349 * Basically a lot of state-info is stacked, and arranged for the
350 * user-mode program to return to the kernel using either a trampiline 350 * user-mode program to return to the kernel using either a trampoline
351 * which performs the syscall sigreturn(), or a provided user-mode 351 * which performs the syscall sigreturn(), or a provided user-mode
352 * trampoline. 352 * trampoline.
353 */ 353 */
@@ -641,7 +641,7 @@ ugdb_trap_user(struct thread_info *ti, int sig)
641 user_regs(ti)->spc = 0; 641 user_regs(ti)->spc = 0;
642 } 642 }
643 /* FIXME: Filter out false h/w breakpoint hits (i.e. EDA 643 /* FIXME: Filter out false h/w breakpoint hits (i.e. EDA
644 not withing any configured h/w breakpoint range). Synchronize with 644 not within any configured h/w breakpoint range). Synchronize with
645 what already exists for kernel debugging. */ 645 what already exists for kernel debugging. */
646 if (((user_regs(ti)->exs & 0xff00) >> 8) == BREAK_8_INTR_VECT) { 646 if (((user_regs(ti)->exs & 0xff00) >> 8) == BREAK_8_INTR_VECT) {
647 /* Break 8: subtract 2 from ERP unless in a delay slot. */ 647 /* Break 8: subtract 2 from ERP unless in a delay slot. */
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index 697494bc2de1..171c96e0a5d3 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -142,7 +142,7 @@ smp_boot_one_cpu(int cpuid)
142 return -1; 142 return -1;
143} 143}
144 144
145/* Secondary CPUs starts uing C here. Here we need to setup CPU 145/* Secondary CPUs starts using C here. Here we need to setup CPU
146 * specific stuff such as the local timer and the MMU. */ 146 * specific stuff such as the local timer and the MMU. */
147void __init smp_callin(void) 147void __init smp_callin(void)
148{ 148{
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
index be0a01657d4f..2f7e8e200f2c 100644
--- a/arch/cris/arch-v32/kernel/time.c
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -99,7 +99,7 @@ unsigned long do_slow_gettimeoffset(void)
99/* From timer MDS describing the hardware watchdog: 99/* From timer MDS describing the hardware watchdog:
100 * 4.3.1 Watchdog Operation 100 * 4.3.1 Watchdog Operation
101 * The watchdog timer is an 8-bit timer with a configurable start value. 101 * The watchdog timer is an 8-bit timer with a configurable start value.
102 * Once started the whatchdog counts downwards with a frequency of 763 Hz 102 * Once started the watchdog counts downwards with a frequency of 763 Hz
103 * (100/131072 MHz). When the watchdog counts down to 1, it generates an 103 * (100/131072 MHz). When the watchdog counts down to 1, it generates an
104 * NMI (Non Maskable Interrupt), and when it counts down to 0, it resets the 104 * NMI (Non Maskable Interrupt), and when it counts down to 0, it resets the
105 * chip. 105 * chip.
diff --git a/arch/cris/arch-v32/kernel/traps.c b/arch/cris/arch-v32/kernel/traps.c
index 2462b1ef1fbb..17fd3dbd1c80 100644
--- a/arch/cris/arch-v32/kernel/traps.c
+++ b/arch/cris/arch-v32/kernel/traps.c
@@ -105,7 +105,7 @@ bad_value:
105 105
106/* 106/*
107 * This gets called from entry.S when the watchdog has bitten. Show something 107 * This gets called from entry.S when the watchdog has bitten. Show something
108 * similiar to an Oops dump, and if the kernel if configured to be a nice doggy; 108 * similar to an Oops dump, and if the kernel is configured to be a nice doggy;
109 * halt instead of reboot. 109 * halt instead of reboot.
110 */ 110 */
111void 111void
diff --git a/arch/cris/arch-v32/lib/dram_init.S b/arch/cris/arch-v32/lib/dram_init.S
index 158b3dbb4d9d..218fbe259ee5 100644
--- a/arch/cris/arch-v32/lib/dram_init.S
+++ b/arch/cris/arch-v32/lib/dram_init.S
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14/* Just to be certain the config file is included, we include it here 14/* Just to be certain the config file is included, we include it here
15 * explicitely instead of depending on it being included in the file that 15 * explicitly instead of depending on it being included in the file that
16 * uses this code. 16 * uses this code.
17 */ 17 */
18 18
diff --git a/arch/cris/arch-v32/lib/string.c b/arch/cris/arch-v32/lib/string.c
index 98e282ac824a..6740b2cebae5 100644
--- a/arch/cris/arch-v32/lib/string.c
+++ b/arch/cris/arch-v32/lib/string.c
@@ -41,7 +41,7 @@ void *memcpy(void *pdst,
41 Make sure the compiler is able to make something useful of this. 41 Make sure the compiler is able to make something useful of this.
42 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 42 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
43 43
44 If gcc was allright, it really would need no temporaries, and no 44 If gcc was alright, it really would need no temporaries, and no
45 stack space to save stuff on. */ 45 stack space to save stuff on. */
46 46
47 register void *return_dst __asm__ ("r10") = pdst; 47 register void *return_dst __asm__ ("r10") = pdst;
diff --git a/arch/cris/arch-v32/lib/usercopy.c b/arch/cris/arch-v32/lib/usercopy.c
index f0b08460c1be..04d0cf35a276 100644
--- a/arch/cris/arch-v32/lib/usercopy.c
+++ b/arch/cris/arch-v32/lib/usercopy.c
@@ -34,7 +34,7 @@ __copy_user (void __user *pdst, const void *psrc, unsigned long pn)
34 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 34 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
35 35
36 FIXME: Comment for old gcc version. Check. 36 FIXME: Comment for old gcc version. Check.
37 If gcc was allright, it really would need no temporaries, and no 37 If gcc was alright, it really would need no temporaries, and no
38 stack space to save stuff on. */ 38 stack space to save stuff on. */
39 39
40 register char *dst __asm__ ("r13") = pdst; 40 register char *dst __asm__ ("r13") = pdst;
@@ -168,7 +168,7 @@ __copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn)
168 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 168 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
169 169
170 FIXME: Comment for old gcc version. Check. 170 FIXME: Comment for old gcc version. Check.
171 If gcc was allright, it really would need no temporaries, and no 171 If gcc was alright, it really would need no temporaries, and no
172 stack space to save stuff on. */ 172 stack space to save stuff on. */
173 173
174 register char *dst __asm__ ("r13") = pdst; 174 register char *dst __asm__ ("r13") = pdst;
@@ -332,7 +332,7 @@ __do_clear_user (void __user *pto, unsigned long pn)
332 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop). 332 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
333 333
334 FIXME: Comment for old gcc version. Check. 334 FIXME: Comment for old gcc version. Check.
335 If gcc was allright, it really would need no temporaries, and no 335 If gcc was alright, it really would need no temporaries, and no
336 stack space to save stuff on. */ 336 stack space to save stuff on. */
337 337
338 register char *dst __asm__ ("r13") = pto; 338 register char *dst __asm__ ("r13") = pto;
diff --git a/arch/cris/arch-v32/mm/tlb.c b/arch/cris/arch-v32/mm/tlb.c
index c2d12e9c40d7..a076ef6e9389 100644
--- a/arch/cris/arch-v32/mm/tlb.c
+++ b/arch/cris/arch-v32/mm/tlb.c
@@ -30,8 +30,8 @@ do { \
30 * The TLB can host up to 256 different mm contexts at the same time. The running 30 * The TLB can host up to 256 different mm contexts at the same time. The running
31 * context is found in the PID register. Each TLB entry contains a page_id that 31 * context is found in the PID register. Each TLB entry contains a page_id that
32 * has to match the PID register to give a hit. page_id_map keeps track of which 32 * has to match the PID register to give a hit. page_id_map keeps track of which
33 * mm's is assigned to which page_id's, making sure it's known when to 33 * mm is assigned to which page_id, making sure it's known when to invalidate TLB
34 * invalidate TLB entries. 34 * entries.
35 * 35 *
36 * The last page_id is never running, it is used as an invalid page_id so that 36 * The last page_id is never running, it is used as an invalid page_id so that
37 * it's possible to make TLB entries that will nerver match. 37 * it's possible to make TLB entries that will nerver match.
@@ -188,7 +188,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
188 spin_unlock(&mmu_context_lock); 188 spin_unlock(&mmu_context_lock);
189 189
190 /* 190 /*
191 * Remember the pgd for the fault handlers. Keep a seperate copy of it 191 * Remember the pgd for the fault handlers. Keep a separate copy of it
192 * because current and active_mm might be invalid at points where 192 * because current and active_mm might be invalid at points where
193 * there's still a need to derefer the pgd. 193 * there's still a need to derefer the pgd.
194 */ 194 */
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index 903ea62c6e21..5c27ff86121b 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -7,7 +7,7 @@
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
9 * This file contains the code used by various IRQ handling routines: 9 * This file contains the code used by various IRQ handling routines:
10 * asking for different IRQ's should be done through these routines 10 * asking for different IRQs should be done through these routines
11 * instead of just grabbing them. Thus setups with different IRQ numbers 11 * instead of just grabbing them. Thus setups with different IRQ numbers
12 * shouldn't result in any weird surprises, and installing new handlers 12 * shouldn't result in any weird surprises, and installing new handlers
13 * should be easier. 13 * should be easier.
@@ -15,7 +15,7 @@
15 */ 15 */
16 16
17/* 17/*
18 * IRQ's are in fact implemented a bit like signal handlers for the kernel. 18 * IRQs are in fact implemented a bit like signal handlers for the kernel.
19 * Naturally it's not a 1:1 relation, but there are similarities. 19 * Naturally it's not a 1:1 relation, but there are similarities.
20 */ 20 */
21 21
@@ -83,9 +83,9 @@ skip:
83 83
84 84
85/* called by the assembler IRQ entry functions defined in irq.h 85/* called by the assembler IRQ entry functions defined in irq.h
86 * to dispatch the interrupts to registred handlers 86 * to dispatch the interrupts to registered handlers
87 * interrupts are disabled upon entry - depending on if the 87 * interrupts are disabled upon entry - depending on if the
88 * interrupt was registred with IRQF_DISABLED or not, interrupts 88 * interrupt was registered with IRQF_DISABLED or not, interrupts
89 * are re-enabled or not. 89 * are re-enabled or not.
90 */ 90 */
91 91
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 8aab81430695..3034f3ff950c 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -13,7 +13,7 @@
13 * Fixed warning. 13 * Fixed warning.
14 * 14 *
15 * Revision 1.18 2005/01/12 08:10:14 starvik 15 * Revision 1.18 2005/01/12 08:10:14 starvik
16 * Readded the change of frametype when handling kernel page fault fixup 16 * Re-added the change of frametype when handling kernel page fault fixup
17 * for v10. This is necessary to avoid that the CPU remakes the faulting 17 * for v10. This is necessary to avoid that the CPU remakes the faulting
18 * access. 18 * access.
19 * 19 *
@@ -49,7 +49,7 @@
49 * 49 *
50 * Revision 1.8 2003/07/04 13:02:48 tobiasa 50 * Revision 1.8 2003/07/04 13:02:48 tobiasa
51 * Moved code snippet from arch/cris/mm/fault.c that searches for fixup code 51 * Moved code snippet from arch/cris/mm/fault.c that searches for fixup code
52 * to seperate function in arch-specific files. 52 * to separate function in arch-specific files.
53 * 53 *
54 * Revision 1.7 2003/01/22 06:48:38 starvik 54 * Revision 1.7 2003/01/22 06:48:38 starvik
55 * Fixed warnings issued by GCC 3.2.1 55 * Fixed warnings issued by GCC 3.2.1
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index b7842ff213a6..0c833d176226 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * $Log: init.c,v $ 9 * $Log: init.c,v $
10 * Revision 1.11 2004/05/28 09:28:56 starvik 10 * Revision 1.11 2004/05/28 09:28:56 starvik
11 * Calculation of loops_per_usec moved because initalization order has changed 11 * Calculation of loops_per_usec moved because initialization order has changed
12 * in Linux 2.6. 12 * in Linux 2.6.
13 * 13 *
14 * Revision 1.10 2004/05/14 07:58:05 starvik 14 * Revision 1.10 2004/05/14 07:58:05 starvik
diff --git a/arch/cris/mm/tlb.c b/arch/cris/mm/tlb.c
index c4a98e2e529e..b7f8de576777 100644
--- a/arch/cris/mm/tlb.c
+++ b/arch/cris/mm/tlb.c
@@ -16,7 +16,7 @@
16/* The TLB can host up to 64 different mm contexts at the same time. 16/* The TLB can host up to 64 different mm contexts at the same time.
17 * The running context is R_MMU_CONTEXT, and each TLB entry contains a 17 * The running context is R_MMU_CONTEXT, and each TLB entry contains a
18 * page_id that has to match to give a hit. In page_id_map, we keep track 18 * page_id that has to match to give a hit. In page_id_map, we keep track
19 * of which mm's we have assigned which page_id's, so that we know when 19 * of which mm we have assigned to which page_id, so that we know when
20 * to invalidate TLB entries. 20 * to invalidate TLB entries.
21 * 21 *
22 * The last page_id is never running - it is used as an invalid page_id 22 * The last page_id is never running - it is used as an invalid page_id
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 74eef7111f2b..43153e767bb1 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -375,6 +375,8 @@ source "drivers/Kconfig"
375 375
376source "fs/Kconfig" 376source "fs/Kconfig"
377 377
378source "kernel/Kconfig.instrumentation"
379
378source "arch/frv/Kconfig.debug" 380source "arch/frv/Kconfig.debug"
379 381
380source "security/Kconfig" 382source "security/Kconfig"
diff --git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c
index ad753c1e9b8f..9e38f99bbab8 100644
--- a/arch/frv/kernel/irq-mb93091.c
+++ b/arch/frv/kernel/irq-mb93091.c
@@ -17,10 +17,10 @@
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#include <linux/bitops.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/bitops.h>
24#include <asm/delay.h> 24#include <asm/delay.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/irc-regs.h> 26#include <asm/irc-regs.h>
diff --git a/arch/frv/kernel/irq-mb93093.c b/arch/frv/kernel/irq-mb93093.c
index e0983f6926ed..3c2752ca9775 100644
--- a/arch/frv/kernel/irq-mb93093.c
+++ b/arch/frv/kernel/irq-mb93093.c
@@ -17,10 +17,10 @@
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#include <linux/bitops.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/bitops.h>
24#include <asm/delay.h> 24#include <asm/delay.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/irc-regs.h> 26#include <asm/irc-regs.h>
diff --git a/arch/frv/kernel/irq-mb93493.c b/arch/frv/kernel/irq-mb93493.c
index c157eeff871d..7754c7338e4b 100644
--- a/arch/frv/kernel/irq-mb93493.c
+++ b/arch/frv/kernel/irq-mb93493.c
@@ -17,10 +17,10 @@
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#include <linux/bitops.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/system.h> 23#include <asm/system.h>
23#include <asm/bitops.h>
24#include <asm/delay.h> 24#include <asm/delay.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/irc-regs.h> 26#include <asm/irc-regs.h>
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index c7e59dcadee4..73abae767fdc 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -24,12 +24,12 @@
24#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
25#include <linux/seq_file.h> 25#include <linux/seq_file.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/bitops.h>
27 28
28#include <asm/atomic.h> 29#include <asm/atomic.h>
29#include <asm/io.h> 30#include <asm/io.h>
30#include <asm/smp.h> 31#include <asm/smp.h>
31#include <asm/system.h> 32#include <asm/system.h>
32#include <asm/bitops.h>
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34#include <asm/pgalloc.h> 34#include <asm/pgalloc.h>
35#include <asm/delay.h> 35#include <asm/delay.h>
@@ -134,7 +134,7 @@ static struct irq_chip frv_cpu_pic = {
134}; 134};
135 135
136/* 136/*
137 * handles all normal device IRQ's 137 * handles all normal device IRQs
138 * - registers are referred to by the __frame variable (GR28) 138 * - registers are referred to by the __frame variable (GR28)
139 * - IRQ distribution is complicated in this arch because of the many PICs, the 139 * - IRQ distribution is complicated in this arch because of the many PICs, the
140 * way they work and the way they cascade 140 * way they work and the way they cascade
diff --git a/arch/frv/kernel/semaphore.c b/arch/frv/kernel/semaphore.c
index 8e182ced1a0f..7ee3a147b471 100644
--- a/arch/frv/kernel/semaphore.c
+++ b/arch/frv/kernel/semaphore.c
@@ -139,7 +139,7 @@ void __up(struct semaphore *sem)
139 waiter = list_entry(sem->wait_list.next, struct sem_waiter, list); 139 waiter = list_entry(sem->wait_list.next, struct sem_waiter, list);
140 140
141 /* We must be careful not to touch 'waiter' after we set ->task = NULL. 141 /* We must be careful not to touch 'waiter' after we set ->task = NULL.
142 * It is an allocated on the waiter's stack and may become invalid at 142 * It is allocated on the waiter's stack and may become invalid at
143 * any time after that point (due to a wakeup from another source). 143 * any time after that point (due to a wakeup from another source).
144 */ 144 */
145 list_del_init(&waiter->list); 145 list_del_init(&waiter->list);
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index e83e0bccfab9..925fb0199a0f 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -66,7 +66,7 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
66 /* 66 /*
67 * Here we are in the timer irq handler. We just have irqs locally 67 * 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 68 * disabled but we don't know if the timer_bh is running on the other
69 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need 69 * CPU. We need to avoid to SMP race with it. NOTE: we don't need
70 * the irq version of write_lock because as just said we have irq 70 * the irq version of write_lock because as just said we have irq
71 * locally disabled. -arca 71 * locally disabled. -arca
72 */ 72 */
@@ -126,7 +126,7 @@ void time_init(void)
126 126
127 /* FIX by dqg : Set to zero for platforms that don't have tod */ 127 /* FIX by dqg : Set to zero for platforms that don't have tod */
128 /* without this time is undefined and can overflow time_t, causing */ 128 /* without this time is undefined and can overflow time_t, causing */
129 /* very stange errors */ 129 /* very strange errors */
130 year = 1980; 130 year = 1980;
131 mon = day = 1; 131 mon = day = 1;
132 hour = min = sec = 0; 132 hour = min = sec = 0;
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index e35f74e6e505..e2e9f57abe2e 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -223,6 +223,8 @@ endmenu
223 223
224source "fs/Kconfig" 224source "fs/Kconfig"
225 225
226source "kernel/Kconfig.instrumentation"
227
226source "arch/h8300/Kconfig.debug" 228source "arch/h8300/Kconfig.debug"
227 229
228source "security/Kconfig" 230source "security/Kconfig"
diff --git a/arch/h8300/Kconfig.debug b/arch/h8300/Kconfig.debug
index 996d97e953b0..ee671c3f2c74 100644
--- a/arch/h8300/Kconfig.debug
+++ b/arch/h8300/Kconfig.debug
@@ -42,16 +42,16 @@ config SH_STANDARD_BIOS
42 Require eCos/RedBoot 42 Require eCos/RedBoot
43 43
44config DEFAULT_CMDLINE 44config DEFAULT_CMDLINE
45 bool "Use buildin commandline" 45 bool "Use builtin commandline"
46 default n 46 default n
47 help 47 help
48 buildin kernel commandline enabled. 48 builtin kernel commandline enabled.
49 49
50config KERNEL_COMMAND 50config KERNEL_COMMAND
51 string "Buildin commmand string" 51 string "Buildin commmand string"
52 depends on DEFAULT_CMDLINE 52 depends on DEFAULT_CMDLINE
53 help 53 help
54 buildin kernel commandline strings. 54 builtin kernel commandline strings.
55 55
56config BLKDEV_RESERVE 56config BLKDEV_RESERVE
57 bool "BLKDEV Reserved Memory" 57 bool "BLKDEV Reserved Memory"
diff --git a/arch/h8300/kernel/irq.c b/arch/h8300/kernel/irq.c
index 43d21e93f41f..8dec4dd57b4e 100644
--- a/arch/h8300/kernel/irq.c
+++ b/arch/h8300/kernel/irq.c
@@ -68,7 +68,7 @@ static void h8300_shutdown_irq(unsigned int irq)
68} 68}
69 69
70/* 70/*
71 * h8300 interrupt controler implementation 71 * h8300 interrupt controller implementation
72 */ 72 */
73struct irq_chip h8300irq_chip = { 73struct irq_chip h8300irq_chip = {
74 .name = "H8300-INTC", 74 .name = "H8300-INTC",
diff --git a/arch/h8300/kernel/time.c b/arch/h8300/kernel/time.c
index 330638220a2e..e37c835e67cf 100644
--- a/arch/h8300/kernel/time.c
+++ b/arch/h8300/kernel/time.c
@@ -53,7 +53,7 @@ void time_init(void)
53 53
54 /* FIX by dqg : Set to zero for platforms that don't have tod */ 54 /* FIX by dqg : Set to zero for platforms that don't have tod */
55 /* without this time is undefined and can overflow time_t, causing */ 55 /* without this time is undefined and can overflow time_t, causing */
56 /* very stange errors */ 56 /* very strange errors */
57 year = 1980; 57 year = 1980;
58 mon = day = 1; 58 mon = day = 1;
59 hour = min = sec = 0; 59 hour = min = sec = 0;
diff --git a/arch/h8300/kernel/traps.c b/arch/h8300/kernel/traps.c
index f97183011c2c..f8f7d7ea97f1 100644
--- a/arch/h8300/kernel/traps.c
+++ b/arch/h8300/kernel/traps.c
@@ -5,7 +5,7 @@
5 * Cloned from Linux/m68k. 5 * Cloned from Linux/m68k.
6 * 6 *
7 * No original Copyright holder listed, 7 * No original Copyright holder listed,
8 * Probabily original (C) Roman Zippel (assigned DJD, 1999) 8 * Probable original (C) Roman Zippel (assigned DJD, 1999)
9 * 9 *
10 * Copyright 1999-2000 D. Jeff Dionne, <jeff@rt-control.com> 10 * Copyright 1999-2000 D. Jeff Dionne, <jeff@rt-control.com>
11 * 11 *
diff --git a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c
index a71d6e2a3919..551fd5f30d82 100644
--- a/arch/h8300/platform/h8s/ints.c
+++ b/arch/h8300/platform/h8s/ints.c
@@ -179,7 +179,7 @@ int request_irq(unsigned int irq,
179 if (use_kmalloc) 179 if (use_kmalloc)
180 irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC); 180 irq_handle = kmalloc(sizeof(irq_handler_t), GFP_ATOMIC);
181 else { 181 else {
182 /* use bootmem allocater */ 182 /* use bootmem allocator */
183 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t)); 183 irq_handle = (irq_handler_t *)alloc_bootmem(sizeof(irq_handler_t));
184 irq_handle = (irq_handler_t *)((unsigned long)irq_handle | 0x80000000); 184 irq_handle = (irq_handler_t *)((unsigned long)irq_handle | 0x80000000);
185 } 185 }
diff --git a/arch/h8300/platform/h8s/ints_h8s.c b/arch/h8300/platform/h8s/ints_h8s.c
index 93395d2a8a07..faa8a459d952 100644
--- a/arch/h8300/platform/h8s/ints_h8s.c
+++ b/arch/h8300/platform/h8s/ints_h8s.c
@@ -63,7 +63,7 @@ static const struct irq_pins irq_assign_table1[16]={
63 {H8300_GPIO_P2,H8300_GPIO_B6},{H8300_GPIO_P2,H8300_GPIO_B7}, 63 {H8300_GPIO_P2,H8300_GPIO_B6},{H8300_GPIO_P2,H8300_GPIO_B7},
64}; 64};
65 65
66/* IRQ to GPIO pinno transrate */ 66/* IRQ to GPIO pin translation */
67#define IRQ_GPIO_MAP(irqbit,irq,port,bit) \ 67#define IRQ_GPIO_MAP(irqbit,irq,port,bit) \
68do { \ 68do { \
69 if (*(volatile unsigned short *)ITSR & irqbit) { \ 69 if (*(volatile unsigned short *)ITSR & irqbit) { \
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index b84d5050e92e..f6e44fc5283c 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -392,7 +392,7 @@ config X86_MCE_NONFATAL
392 will look at the machine check registers to see if anything happened. 392 will look at the machine check registers to see if anything happened.
393 Non-fatal problems automatically get corrected (but still logged). 393 Non-fatal problems automatically get corrected (but still logged).
394 Disable this if you don't want to see these messages. 394 Disable this if you don't want to see these messages.
395 Seeing the messages this option prints out may be indicative of dying hardware, 395 Seeing the messages this option prints out may be indicative of dying
396 or out-of-spec (ie, overclocked) hardware. 396 or out-of-spec (ie, overclocked) hardware.
397 This option only does something on certain CPUs. 397 This option only does something on certain CPUs.
398 (AMD Athlon/Duron and Intel Pentium 4) 398 (AMD Athlon/Duron and Intel Pentium 4)
@@ -631,7 +631,7 @@ config NUMA
631 default n if X86_PC 631 default n if X86_PC
632 default y if (X86_NUMAQ || X86_SUMMIT) 632 default y if (X86_NUMAQ || X86_SUMMIT)
633 help 633 help
634 NUMA support for i386. This is currently high experimental 634 NUMA support for i386. This is currently highly experimental
635 and should be only used for kernel development. It might also 635 and should be only used for kernel development. It might also
636 cause boot failures. 636 cause boot failures.
637 637
@@ -1080,7 +1080,9 @@ config APM_REAL_MODE_POWER_OFF
1080 1080
1081endif # APM 1081endif # APM
1082 1082
1083source "arch/x86/kernel/cpu/cpufreq/Kconfig" 1083source "arch/x86/kernel/cpu/cpufreq/Kconfig_32"
1084
1085source "drivers/cpuidle/Kconfig"
1084 1086
1085endmenu 1087endmenu
1086 1088
@@ -1256,31 +1258,6 @@ source "drivers/Kconfig"
1256 1258
1257source "fs/Kconfig" 1259source "fs/Kconfig"
1258 1260
1259menuconfig INSTRUMENTATION
1260 bool "Instrumentation Support"
1261 default y
1262 ---help---
1263 Say Y here to get to see options related to performance measurement,
1264 debugging, and testing. This option alone does not add any kernel code.
1265
1266 If you say N, all options in this submenu will be skipped and disabled.
1267
1268if INSTRUMENTATION
1269
1270source "arch/x86/oprofile/Kconfig"
1271
1272config KPROBES
1273 bool "Kprobes"
1274 depends on KALLSYMS && MODULES
1275 help
1276 Kprobes allows you to trap at almost any kernel address and
1277 execute a callback function. register_kprobe() establishes
1278 a probepoint and specifies the callback. Kprobes is useful
1279 for kernel debugging, non-intrusive instrumentation and testing.
1280 If in doubt, say "N".
1281
1282endif # INSTRUMENTATION
1283
1284source "arch/i386/Kconfig.debug" 1261source "arch/i386/Kconfig.debug"
1285 1262
1286source "security/Kconfig" 1263source "security/Kconfig"
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index f036d2dee3de..b88e47ca3032 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -102,7 +102,7 @@ core-$(CONFIG_XEN) += arch/x86/xen/
102# default subarch .h files 102# default subarch .h files
103mflags-y += -Iinclude/asm-x86/mach-default 103mflags-y += -Iinclude/asm-x86/mach-default
104 104
105head-y := arch/x86/kernel/head_32.o arch/x86/kernel/init_task_32.o 105head-y := arch/x86/kernel/head_32.o arch/x86/kernel/init_task.o
106 106
107libs-y += arch/x86/lib/ 107libs-y += arch/x86/lib/
108core-y += arch/x86/kernel/ \ 108core-y += arch/x86/kernel/ \
@@ -131,9 +131,9 @@ all: bzImage
131zImage zlilo zdisk: KBUILD_IMAGE := arch/x86/boot/zImage 131zImage zlilo zdisk: KBUILD_IMAGE := arch/x86/boot/zImage
132 132
133zImage bzImage: vmlinux 133zImage bzImage: vmlinux
134 $(Q)mkdir -p $(objtree)/arch/i386/boot
135 $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage
136 $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE) 134 $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)
135 $(Q)mkdir -p $(objtree)/arch/i386/boot
136 $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/i386/boot/bzImage
137 137
138compressed: zImage 138compressed: zImage
139 139
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index c60532d93c54..bef47725d4ad 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -452,9 +452,9 @@ config IA64_PALINFO
452config IA64_MC_ERR_INJECT 452config IA64_MC_ERR_INJECT
453 tristate "MC error injection support" 453 tristate "MC error injection support"
454 help 454 help
455 Selets whether support for MC error injection. By enabling the 455 Adds support for MC error injection. If enabled, the kernel
456 support, kernel provide sysfs interface for user application to 456 will provide a sysfs interface for user applications to
457 call MC error injection PAL procedure to inject various errors. 457 call MC error injection PAL procedures to inject various errors.
458 This is a useful tool for MCA testing. 458 This is a useful tool for MCA testing.
459 459
460 If you're unsure, do not select this option. 460 If you're unsure, do not select this option.
@@ -491,7 +491,7 @@ config KEXEC
491 but it is independent of the system firmware. And like a reboot 491 but it is independent of the system firmware. And like a reboot
492 you can start any kernel with it, not just Linux. 492 you can start any kernel with it, not just Linux.
493 493
494 The name comes from the similiarity to the exec system call. 494 The name comes from the similarity to the exec system call.
495 495
496 It is an ongoing process to be certain the hardware in a machine 496 It is an ongoing process to be certain the hardware in a machine
497 is properly shutdown, so do not be surprised if this code does not 497 is properly shutdown, so do not be surprised if this code does not
@@ -592,20 +592,7 @@ config IRQ_PER_CPU
592 592
593source "arch/ia64/hp/sim/Kconfig" 593source "arch/ia64/hp/sim/Kconfig"
594 594
595menu "Instrumentation Support" 595source "kernel/Kconfig.instrumentation"
596
597source "arch/ia64/oprofile/Kconfig"
598
599config KPROBES
600 bool "Kprobes"
601 depends on KALLSYMS && MODULES
602 help
603 Kprobes allows you to trap at almost any kernel address and
604 execute a callback function. register_kprobe() establishes
605 a probepoint and specifies the callback. Kprobes is useful
606 for kernel debugging, non-intrusive instrumentation and testing.
607 If in doubt, say "N".
608endmenu
609 596
610source "arch/ia64/Kconfig.debug" 597source "arch/ia64/Kconfig.debug"
611 598
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 449d3e75bfc2..75fd90dc76a3 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_defconfig
@@ -26,6 +26,7 @@ CONFIG_TASK_IO_ACCOUNTING=y
26# CONFIG_AUDIT is not set 26# CONFIG_AUDIT is not set
27# CONFIG_IKCONFIG is not set 27# CONFIG_IKCONFIG is not set
28CONFIG_LOG_BUF_SHIFT=20 28CONFIG_LOG_BUF_SHIFT=20
29CONFIG_CGROUPS=y
29CONFIG_CPUSETS=y 30CONFIG_CPUSETS=y
30CONFIG_SYSFS_DEPRECATED=y 31CONFIG_SYSFS_DEPRECATED=y
31CONFIG_RELAY=y 32CONFIG_RELAY=y
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index a3405b3c1eef..d025a22eb225 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -773,7 +773,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
773 if (flags & MAP_SHARED) 773 if (flags & MAP_SHARED)
774 printk(KERN_INFO 774 printk(KERN_INFO
775 "%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n", 775 "%s(%d): emulate_mmap() can't share head (addr=0x%lx)\n",
776 current->comm, current->pid, start); 776 current->comm, task_pid_nr(current), start);
777 ret = mmap_subpage(file, start, min(PAGE_ALIGN(start), end), prot, flags, 777 ret = mmap_subpage(file, start, min(PAGE_ALIGN(start), end), prot, flags,
778 off); 778 off);
779 if (IS_ERR((void *) ret)) 779 if (IS_ERR((void *) ret))
@@ -786,7 +786,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
786 if (flags & MAP_SHARED) 786 if (flags & MAP_SHARED)
787 printk(KERN_INFO 787 printk(KERN_INFO
788 "%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n", 788 "%s(%d): emulate_mmap() can't share tail (end=0x%lx)\n",
789 current->comm, current->pid, end); 789 current->comm, task_pid_nr(current), end);
790 ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags, 790 ret = mmap_subpage(file, max(start, PAGE_START(end)), end, prot, flags,
791 (off + len) - offset_in_page(end)); 791 (off + len) - offset_in_page(end));
792 if (IS_ERR((void *) ret)) 792 if (IS_ERR((void *) ret))
@@ -816,7 +816,7 @@ emulate_mmap (struct file *file, unsigned long start, unsigned long len, int pro
816 816
817 if ((flags & MAP_SHARED) && !is_congruent) 817 if ((flags & MAP_SHARED) && !is_congruent)
818 printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap " 818 printk(KERN_INFO "%s(%d): emulate_mmap() can't share contents of incongruent mmap "
819 "(addr=0x%lx,off=0x%llx)\n", current->comm, current->pid, start, off); 819 "(addr=0x%lx,off=0x%llx)\n", current->comm, task_pid_nr(current), start, off);
820 820
821 DBG("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n", pstart, pend, 821 DBG("mmap_body: mapping [0x%lx-0x%lx) %s with poff 0x%llx\n", pstart, pend,
822 is_congruent ? "congruent" : "not congruent", poff); 822 is_congruent ? "congruent" : "not congruent", poff);
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 73ca86d03810..8e4894b205e2 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -967,7 +967,7 @@ find_memmap_space (void)
967 * to use. We can allocate partial granules only if the unavailable 967 * to use. We can allocate partial granules only if the unavailable
968 * parts exist, and are WB. 968 * parts exist, and are WB.
969 */ 969 */
970void 970unsigned long
971efi_memmap_init(unsigned long *s, unsigned long *e) 971efi_memmap_init(unsigned long *s, unsigned long *e)
972{ 972{
973 struct kern_memdesc *k, *prev = NULL; 973 struct kern_memdesc *k, *prev = NULL;
@@ -1084,6 +1084,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
1084 /* reserve the memory we are using for kern_memmap */ 1084 /* reserve the memory we are using for kern_memmap */
1085 *s = (u64)kern_memmap; 1085 *s = (u64)kern_memmap;
1086 *e = (u64)++k; 1086 *e = (u64)++k;
1087
1088 return total_mem;
1087} 1089}
1088 1090
1089void 1091void
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index f55fa07849c4..59169bf7145f 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -158,14 +158,14 @@
158 */ 158 */
159#define PROTECT_CTX(c, f) \ 159#define PROTECT_CTX(c, f) \
160 do { \ 160 do { \
161 DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, current->pid)); \ 161 DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, task_pid_nr(current))); \
162 spin_lock_irqsave(&(c)->ctx_lock, f); \ 162 spin_lock_irqsave(&(c)->ctx_lock, f); \
163 DPRINT(("spinlocked ctx %p by [%d]\n", c, current->pid)); \ 163 DPRINT(("spinlocked ctx %p by [%d]\n", c, task_pid_nr(current))); \
164 } while(0) 164 } while(0)
165 165
166#define UNPROTECT_CTX(c, f) \ 166#define UNPROTECT_CTX(c, f) \
167 do { \ 167 do { \
168 DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, current->pid)); \ 168 DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, task_pid_nr(current))); \
169 spin_unlock_irqrestore(&(c)->ctx_lock, f); \ 169 spin_unlock_irqrestore(&(c)->ctx_lock, f); \
170 } while(0) 170 } while(0)
171 171
@@ -227,12 +227,12 @@
227#ifdef PFM_DEBUGGING 227#ifdef PFM_DEBUGGING
228#define DPRINT(a) \ 228#define DPRINT(a) \
229 do { \ 229 do { \
230 if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \ 230 if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), task_pid_nr(current)); printk a; } \
231 } while (0) 231 } while (0)
232 232
233#define DPRINT_ovfl(a) \ 233#define DPRINT_ovfl(a) \
234 do { \ 234 do { \
235 if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), current->pid); printk a; } \ 235 if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __FUNCTION__, __LINE__, smp_processor_id(), task_pid_nr(current)); printk a; } \
236 } while (0) 236 } while (0)
237#endif 237#endif
238 238
@@ -913,7 +913,7 @@ pfm_mask_monitoring(struct task_struct *task)
913 unsigned long mask, val, ovfl_mask; 913 unsigned long mask, val, ovfl_mask;
914 int i; 914 int i;
915 915
916 DPRINT_ovfl(("masking monitoring for [%d]\n", task->pid)); 916 DPRINT_ovfl(("masking monitoring for [%d]\n", task_pid_nr(task)));
917 917
918 ovfl_mask = pmu_conf->ovfl_val; 918 ovfl_mask = pmu_conf->ovfl_val;
919 /* 919 /*
@@ -992,12 +992,12 @@ pfm_restore_monitoring(struct task_struct *task)
992 ovfl_mask = pmu_conf->ovfl_val; 992 ovfl_mask = pmu_conf->ovfl_val;
993 993
994 if (task != current) { 994 if (task != current) {
995 printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task->pid, current->pid); 995 printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task_pid_nr(task), task_pid_nr(current));
996 return; 996 return;
997 } 997 }
998 if (ctx->ctx_state != PFM_CTX_MASKED) { 998 if (ctx->ctx_state != PFM_CTX_MASKED) {
999 printk(KERN_ERR "perfmon.%d: task[%d] current[%d] invalid state=%d\n", __LINE__, 999 printk(KERN_ERR "perfmon.%d: task[%d] current[%d] invalid state=%d\n", __LINE__,
1000 task->pid, current->pid, ctx->ctx_state); 1000 task_pid_nr(task), task_pid_nr(current), ctx->ctx_state);
1001 return; 1001 return;
1002 } 1002 }
1003 psr = pfm_get_psr(); 1003 psr = pfm_get_psr();
@@ -1051,7 +1051,8 @@ pfm_restore_monitoring(struct task_struct *task)
1051 if ((mask & 0x1) == 0UL) continue; 1051 if ((mask & 0x1) == 0UL) continue;
1052 ctx->th_pmcs[i] = ctx->ctx_pmcs[i]; 1052 ctx->th_pmcs[i] = ctx->ctx_pmcs[i];
1053 ia64_set_pmc(i, ctx->th_pmcs[i]); 1053 ia64_set_pmc(i, ctx->th_pmcs[i]);
1054 DPRINT(("[%d] pmc[%d]=0x%lx\n", task->pid, i, ctx->th_pmcs[i])); 1054 DPRINT(("[%d] pmc[%d]=0x%lx\n",
1055 task_pid_nr(task), i, ctx->th_pmcs[i]));
1055 } 1056 }
1056 ia64_srlz_d(); 1057 ia64_srlz_d();
1057 1058
@@ -1370,7 +1371,7 @@ pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
1370 1371
1371error_conflict: 1372error_conflict:
1372 DPRINT(("system wide not possible, conflicting session [%d] on CPU%d\n", 1373 DPRINT(("system wide not possible, conflicting session [%d] on CPU%d\n",
1373 pfm_sessions.pfs_sys_session[cpu]->pid, 1374 task_pid_nr(pfm_sessions.pfs_sys_session[cpu]),
1374 cpu)); 1375 cpu));
1375abort: 1376abort:
1376 UNLOCK_PFS(flags); 1377 UNLOCK_PFS(flags);
@@ -1442,7 +1443,7 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz
1442 1443
1443 /* sanity checks */ 1444 /* sanity checks */
1444 if (task->mm == NULL || size == 0UL || vaddr == NULL) { 1445 if (task->mm == NULL || size == 0UL || vaddr == NULL) {
1445 printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task->pid, task->mm); 1446 printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task_pid_nr(task), task->mm);
1446 return -EINVAL; 1447 return -EINVAL;
1447 } 1448 }
1448 1449
@@ -1459,7 +1460,7 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz
1459 1460
1460 up_write(&task->mm->mmap_sem); 1461 up_write(&task->mm->mmap_sem);
1461 if (r !=0) { 1462 if (r !=0) {
1462 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task->pid, vaddr, size); 1463 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);
1463 } 1464 }
1464 1465
1465 DPRINT(("do_unmap(%p, %lu)=%d\n", vaddr, size, r)); 1466 DPRINT(("do_unmap(%p, %lu)=%d\n", vaddr, size, r));
@@ -1501,7 +1502,7 @@ pfm_free_smpl_buffer(pfm_context_t *ctx)
1501 return 0; 1502 return 0;
1502 1503
1503invalid_free: 1504invalid_free:
1504 printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", current->pid); 1505 printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", task_pid_nr(current));
1505 return -EINVAL; 1506 return -EINVAL;
1506} 1507}
1507#endif 1508#endif
@@ -1547,13 +1548,13 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
1547 unsigned long flags; 1548 unsigned long flags;
1548 DECLARE_WAITQUEUE(wait, current); 1549 DECLARE_WAITQUEUE(wait, current);
1549 if (PFM_IS_FILE(filp) == 0) { 1550 if (PFM_IS_FILE(filp) == 0) {
1550 printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid); 1551 printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
1551 return -EINVAL; 1552 return -EINVAL;
1552 } 1553 }
1553 1554
1554 ctx = (pfm_context_t *)filp->private_data; 1555 ctx = (pfm_context_t *)filp->private_data;
1555 if (ctx == NULL) { 1556 if (ctx == NULL) {
1556 printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", current->pid); 1557 printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", task_pid_nr(current));
1557 return -EINVAL; 1558 return -EINVAL;
1558 } 1559 }
1559 1560
@@ -1607,7 +1608,7 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
1607 1608
1608 PROTECT_CTX(ctx, flags); 1609 PROTECT_CTX(ctx, flags);
1609 } 1610 }
1610 DPRINT(("[%d] back to running ret=%ld\n", current->pid, ret)); 1611 DPRINT(("[%d] back to running ret=%ld\n", task_pid_nr(current), ret));
1611 set_current_state(TASK_RUNNING); 1612 set_current_state(TASK_RUNNING);
1612 remove_wait_queue(&ctx->ctx_msgq_wait, &wait); 1613 remove_wait_queue(&ctx->ctx_msgq_wait, &wait);
1613 1614
@@ -1616,7 +1617,7 @@ pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
1616 ret = -EINVAL; 1617 ret = -EINVAL;
1617 msg = pfm_get_next_msg(ctx); 1618 msg = pfm_get_next_msg(ctx);
1618 if (msg == NULL) { 1619 if (msg == NULL) {
1619 printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, current->pid); 1620 printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, task_pid_nr(current));
1620 goto abort_locked; 1621 goto abort_locked;
1621 } 1622 }
1622 1623
@@ -1647,13 +1648,13 @@ pfm_poll(struct file *filp, poll_table * wait)
1647 unsigned int mask = 0; 1648 unsigned int mask = 0;
1648 1649
1649 if (PFM_IS_FILE(filp) == 0) { 1650 if (PFM_IS_FILE(filp) == 0) {
1650 printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", current->pid); 1651 printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
1651 return 0; 1652 return 0;
1652 } 1653 }
1653 1654
1654 ctx = (pfm_context_t *)filp->private_data; 1655 ctx = (pfm_context_t *)filp->private_data;
1655 if (ctx == NULL) { 1656 if (ctx == NULL) {
1656 printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", current->pid); 1657 printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", task_pid_nr(current));
1657 return 0; 1658 return 0;
1658 } 1659 }
1659 1660
@@ -1692,7 +1693,7 @@ pfm_do_fasync(int fd, struct file *filp, pfm_context_t *ctx, int on)
1692 ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue); 1693 ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue);
1693 1694
1694 DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n", 1695 DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
1695 current->pid, 1696 task_pid_nr(current),
1696 fd, 1697 fd,
1697 on, 1698 on,
1698 ctx->ctx_async_queue, ret)); 1699 ctx->ctx_async_queue, ret));
@@ -1707,13 +1708,13 @@ pfm_fasync(int fd, struct file *filp, int on)
1707 int ret; 1708 int ret;
1708 1709
1709 if (PFM_IS_FILE(filp) == 0) { 1710 if (PFM_IS_FILE(filp) == 0) {
1710 printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", current->pid); 1711 printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", task_pid_nr(current));
1711 return -EBADF; 1712 return -EBADF;
1712 } 1713 }
1713 1714
1714 ctx = (pfm_context_t *)filp->private_data; 1715 ctx = (pfm_context_t *)filp->private_data;
1715 if (ctx == NULL) { 1716 if (ctx == NULL) {
1716 printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", current->pid); 1717 printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", task_pid_nr(current));
1717 return -EBADF; 1718 return -EBADF;
1718 } 1719 }
1719 /* 1720 /*
@@ -1759,7 +1760,7 @@ pfm_syswide_force_stop(void *info)
1759 if (owner != ctx->ctx_task) { 1760 if (owner != ctx->ctx_task) {
1760 printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected owner [%d] instead of [%d]\n", 1761 printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected owner [%d] instead of [%d]\n",
1761 smp_processor_id(), 1762 smp_processor_id(),
1762 owner->pid, ctx->ctx_task->pid); 1763 task_pid_nr(owner), task_pid_nr(ctx->ctx_task));
1763 return; 1764 return;
1764 } 1765 }
1765 if (GET_PMU_CTX() != ctx) { 1766 if (GET_PMU_CTX() != ctx) {
@@ -1769,7 +1770,7 @@ pfm_syswide_force_stop(void *info)
1769 return; 1770 return;
1770 } 1771 }
1771 1772
1772 DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), ctx->ctx_task->pid)); 1773 DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), task_pid_nr(ctx->ctx_task)));
1773 /* 1774 /*
1774 * the context is already protected in pfm_close(), we simply 1775 * the context is already protected in pfm_close(), we simply
1775 * need to mask interrupts to avoid a PMU interrupt race on 1776 * need to mask interrupts to avoid a PMU interrupt race on
@@ -1821,7 +1822,7 @@ pfm_flush(struct file *filp, fl_owner_t id)
1821 1822
1822 ctx = (pfm_context_t *)filp->private_data; 1823 ctx = (pfm_context_t *)filp->private_data;
1823 if (ctx == NULL) { 1824 if (ctx == NULL) {
1824 printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", current->pid); 1825 printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", task_pid_nr(current));
1825 return -EBADF; 1826 return -EBADF;
1826 } 1827 }
1827 1828
@@ -1969,7 +1970,7 @@ pfm_close(struct inode *inode, struct file *filp)
1969 1970
1970 ctx = (pfm_context_t *)filp->private_data; 1971 ctx = (pfm_context_t *)filp->private_data;
1971 if (ctx == NULL) { 1972 if (ctx == NULL) {
1972 printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", current->pid); 1973 printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", task_pid_nr(current));
1973 return -EBADF; 1974 return -EBADF;
1974 } 1975 }
1975 1976
@@ -2066,7 +2067,7 @@ pfm_close(struct inode *inode, struct file *filp)
2066 */ 2067 */
2067 ctx->ctx_state = PFM_CTX_ZOMBIE; 2068 ctx->ctx_state = PFM_CTX_ZOMBIE;
2068 2069
2069 DPRINT(("zombie ctx for [%d]\n", task->pid)); 2070 DPRINT(("zombie ctx for [%d]\n", task_pid_nr(task)));
2070 /* 2071 /*
2071 * cannot free the context on the spot. deferred until 2072 * cannot free the context on the spot. deferred until
2072 * the task notices the ZOMBIE state 2073 * the task notices the ZOMBIE state
@@ -2472,7 +2473,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t
2472 /* invoke and lock buffer format, if found */ 2473 /* invoke and lock buffer format, if found */
2473 fmt = pfm_find_buffer_fmt(arg->ctx_smpl_buf_id); 2474 fmt = pfm_find_buffer_fmt(arg->ctx_smpl_buf_id);
2474 if (fmt == NULL) { 2475 if (fmt == NULL) {
2475 DPRINT(("[%d] cannot find buffer format\n", task->pid)); 2476 DPRINT(("[%d] cannot find buffer format\n", task_pid_nr(task)));
2476 return -EINVAL; 2477 return -EINVAL;
2477 } 2478 }
2478 2479
@@ -2483,7 +2484,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t
2483 2484
2484 ret = pfm_buf_fmt_validate(fmt, task, ctx_flags, cpu, fmt_arg); 2485 ret = pfm_buf_fmt_validate(fmt, task, ctx_flags, cpu, fmt_arg);
2485 2486
2486 DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task->pid, ctx_flags, cpu, fmt_arg, ret)); 2487 DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task_pid_nr(task), ctx_flags, cpu, fmt_arg, ret));
2487 2488
2488 if (ret) goto error; 2489 if (ret) goto error;
2489 2490
@@ -2605,23 +2606,23 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
2605 * no kernel task or task not owner by caller 2606 * no kernel task or task not owner by caller
2606 */ 2607 */
2607 if (task->mm == NULL) { 2608 if (task->mm == NULL) {
2608 DPRINT(("task [%d] has not memory context (kernel thread)\n", task->pid)); 2609 DPRINT(("task [%d] has not memory context (kernel thread)\n", task_pid_nr(task)));
2609 return -EPERM; 2610 return -EPERM;
2610 } 2611 }
2611 if (pfm_bad_permissions(task)) { 2612 if (pfm_bad_permissions(task)) {
2612 DPRINT(("no permission to attach to [%d]\n", task->pid)); 2613 DPRINT(("no permission to attach to [%d]\n", task_pid_nr(task)));
2613 return -EPERM; 2614 return -EPERM;
2614 } 2615 }
2615 /* 2616 /*
2616 * cannot block in self-monitoring mode 2617 * cannot block in self-monitoring mode
2617 */ 2618 */
2618 if (CTX_OVFL_NOBLOCK(ctx) == 0 && task == current) { 2619 if (CTX_OVFL_NOBLOCK(ctx) == 0 && task == current) {
2619 DPRINT(("cannot load a blocking context on self for [%d]\n", task->pid)); 2620 DPRINT(("cannot load a blocking context on self for [%d]\n", task_pid_nr(task)));
2620 return -EINVAL; 2621 return -EINVAL;
2621 } 2622 }
2622 2623
2623 if (task->exit_state == EXIT_ZOMBIE) { 2624 if (task->exit_state == EXIT_ZOMBIE) {
2624 DPRINT(("cannot attach to zombie task [%d]\n", task->pid)); 2625 DPRINT(("cannot attach to zombie task [%d]\n", task_pid_nr(task)));
2625 return -EBUSY; 2626 return -EBUSY;
2626 } 2627 }
2627 2628
@@ -2631,7 +2632,7 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
2631 if (task == current) return 0; 2632 if (task == current) return 0;
2632 2633
2633 if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) { 2634 if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) {
2634 DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task->pid, task->state)); 2635 DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task_pid_nr(task), task->state));
2635 return -EBUSY; 2636 return -EBUSY;
2636 } 2637 }
2637 /* 2638 /*
@@ -3512,7 +3513,7 @@ pfm_use_debug_registers(struct task_struct *task)
3512 3513
3513 if (pmu_conf->use_rr_dbregs == 0) return 0; 3514 if (pmu_conf->use_rr_dbregs == 0) return 0;
3514 3515
3515 DPRINT(("called for [%d]\n", task->pid)); 3516 DPRINT(("called for [%d]\n", task_pid_nr(task)));
3516 3517
3517 /* 3518 /*
3518 * do it only once 3519 * do it only once
@@ -3543,7 +3544,7 @@ pfm_use_debug_registers(struct task_struct *task)
3543 DPRINT(("ptrace_use_dbregs=%u sys_use_dbregs=%u by [%d] ret = %d\n", 3544 DPRINT(("ptrace_use_dbregs=%u sys_use_dbregs=%u by [%d] ret = %d\n",
3544 pfm_sessions.pfs_ptrace_use_dbregs, 3545 pfm_sessions.pfs_ptrace_use_dbregs,
3545 pfm_sessions.pfs_sys_use_dbregs, 3546 pfm_sessions.pfs_sys_use_dbregs,
3546 task->pid, ret)); 3547 task_pid_nr(task), ret));
3547 3548
3548 UNLOCK_PFS(flags); 3549 UNLOCK_PFS(flags);
3549 3550
@@ -3568,7 +3569,7 @@ pfm_release_debug_registers(struct task_struct *task)
3568 3569
3569 LOCK_PFS(flags); 3570 LOCK_PFS(flags);
3570 if (pfm_sessions.pfs_ptrace_use_dbregs == 0) { 3571 if (pfm_sessions.pfs_ptrace_use_dbregs == 0) {
3571 printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task->pid); 3572 printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task_pid_nr(task));
3572 ret = -1; 3573 ret = -1;
3573 } else { 3574 } else {
3574 pfm_sessions.pfs_ptrace_use_dbregs--; 3575 pfm_sessions.pfs_ptrace_use_dbregs--;
@@ -3620,7 +3621,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
3620 3621
3621 /* sanity check */ 3622 /* sanity check */
3622 if (unlikely(task == NULL)) { 3623 if (unlikely(task == NULL)) {
3623 printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", current->pid); 3624 printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", task_pid_nr(current));
3624 return -EINVAL; 3625 return -EINVAL;
3625 } 3626 }
3626 3627
@@ -3629,7 +3630,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
3629 fmt = ctx->ctx_buf_fmt; 3630 fmt = ctx->ctx_buf_fmt;
3630 3631
3631 DPRINT(("restarting self %d ovfl=0x%lx\n", 3632 DPRINT(("restarting self %d ovfl=0x%lx\n",
3632 task->pid, 3633 task_pid_nr(task),
3633 ctx->ctx_ovfl_regs[0])); 3634 ctx->ctx_ovfl_regs[0]));
3634 3635
3635 if (CTX_HAS_SMPL(ctx)) { 3636 if (CTX_HAS_SMPL(ctx)) {
@@ -3653,11 +3654,11 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
3653 pfm_reset_regs(ctx, ctx->ctx_ovfl_regs, PFM_PMD_LONG_RESET); 3654 pfm_reset_regs(ctx, ctx->ctx_ovfl_regs, PFM_PMD_LONG_RESET);
3654 3655
3655 if (rst_ctrl.bits.mask_monitoring == 0) { 3656 if (rst_ctrl.bits.mask_monitoring == 0) {
3656 DPRINT(("resuming monitoring for [%d]\n", task->pid)); 3657 DPRINT(("resuming monitoring for [%d]\n", task_pid_nr(task)));
3657 3658
3658 if (state == PFM_CTX_MASKED) pfm_restore_monitoring(task); 3659 if (state == PFM_CTX_MASKED) pfm_restore_monitoring(task);
3659 } else { 3660 } else {
3660 DPRINT(("keeping monitoring stopped for [%d]\n", task->pid)); 3661 DPRINT(("keeping monitoring stopped for [%d]\n", task_pid_nr(task)));
3661 3662
3662 // cannot use pfm_stop_monitoring(task, regs); 3663 // cannot use pfm_stop_monitoring(task, regs);
3663 } 3664 }
@@ -3714,10 +3715,10 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
3714 * "self-monitoring". 3715 * "self-monitoring".
3715 */ 3716 */
3716 if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) { 3717 if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
3717 DPRINT(("unblocking [%d] \n", task->pid)); 3718 DPRINT(("unblocking [%d] \n", task_pid_nr(task)));
3718 complete(&ctx->ctx_restart_done); 3719 complete(&ctx->ctx_restart_done);
3719 } else { 3720 } else {
3720 DPRINT(("[%d] armed exit trap\n", task->pid)); 3721 DPRINT(("[%d] armed exit trap\n", task_pid_nr(task)));
3721 3722
3722 ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET; 3723 ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET;
3723 3724
@@ -3805,7 +3806,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_
3805 * don't bother if we are loaded and task is being debugged 3806 * don't bother if we are loaded and task is being debugged
3806 */ 3807 */
3807 if (is_loaded && (thread->flags & IA64_THREAD_DBG_VALID) != 0) { 3808 if (is_loaded && (thread->flags & IA64_THREAD_DBG_VALID) != 0) {
3808 DPRINT(("debug registers already in use for [%d]\n", task->pid)); 3809 DPRINT(("debug registers already in use for [%d]\n", task_pid_nr(task)));
3809 return -EBUSY; 3810 return -EBUSY;
3810 } 3811 }
3811 3812
@@ -3846,7 +3847,7 @@ pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_
3846 * is shared by all processes running on it 3847 * is shared by all processes running on it
3847 */ 3848 */
3848 if (first_time && can_access_pmu) { 3849 if (first_time && can_access_pmu) {
3849 DPRINT(("[%d] clearing ibrs, dbrs\n", task->pid)); 3850 DPRINT(("[%d] clearing ibrs, dbrs\n", task_pid_nr(task)));
3850 for (i=0; i < pmu_conf->num_ibrs; i++) { 3851 for (i=0; i < pmu_conf->num_ibrs; i++) {
3851 ia64_set_ibr(i, 0UL); 3852 ia64_set_ibr(i, 0UL);
3852 ia64_dv_serialize_instruction(); 3853 ia64_dv_serialize_instruction();
@@ -4035,7 +4036,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4035 return -EBUSY; 4036 return -EBUSY;
4036 } 4037 }
4037 DPRINT(("task [%d] ctx_state=%d is_system=%d\n", 4038 DPRINT(("task [%d] ctx_state=%d is_system=%d\n",
4038 PFM_CTX_TASK(ctx)->pid, 4039 task_pid_nr(PFM_CTX_TASK(ctx)),
4039 state, 4040 state,
4040 is_system)); 4041 is_system));
4041 /* 4042 /*
@@ -4093,7 +4094,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4093 * monitoring disabled in kernel at next reschedule 4094 * monitoring disabled in kernel at next reschedule
4094 */ 4095 */
4095 ctx->ctx_saved_psr_up = 0; 4096 ctx->ctx_saved_psr_up = 0;
4096 DPRINT(("task=[%d]\n", task->pid)); 4097 DPRINT(("task=[%d]\n", task_pid_nr(task)));
4097 } 4098 }
4098 return 0; 4099 return 0;
4099} 4100}
@@ -4298,11 +4299,12 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4298 4299
4299 if (is_system) { 4300 if (is_system) {
4300 if (pfm_sessions.pfs_ptrace_use_dbregs) { 4301 if (pfm_sessions.pfs_ptrace_use_dbregs) {
4301 DPRINT(("cannot load [%d] dbregs in use\n", task->pid)); 4302 DPRINT(("cannot load [%d] dbregs in use\n",
4303 task_pid_nr(task)));
4302 ret = -EBUSY; 4304 ret = -EBUSY;
4303 } else { 4305 } else {
4304 pfm_sessions.pfs_sys_use_dbregs++; 4306 pfm_sessions.pfs_sys_use_dbregs++;
4305 DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task->pid, pfm_sessions.pfs_sys_use_dbregs)); 4307 DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task_pid_nr(task), pfm_sessions.pfs_sys_use_dbregs));
4306 set_dbregs = 1; 4308 set_dbregs = 1;
4307 } 4309 }
4308 } 4310 }
@@ -4394,7 +4396,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4394 4396
4395 /* allow user level control */ 4397 /* allow user level control */
4396 ia64_psr(regs)->sp = 0; 4398 ia64_psr(regs)->sp = 0;
4397 DPRINT(("clearing psr.sp for [%d]\n", task->pid)); 4399 DPRINT(("clearing psr.sp for [%d]\n", task_pid_nr(task)));
4398 4400
4399 SET_LAST_CPU(ctx, smp_processor_id()); 4401 SET_LAST_CPU(ctx, smp_processor_id());
4400 INC_ACTIVATION(); 4402 INC_ACTIVATION();
@@ -4429,7 +4431,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4429 */ 4431 */
4430 SET_PMU_OWNER(task, ctx); 4432 SET_PMU_OWNER(task, ctx);
4431 4433
4432 DPRINT(("context loaded on PMU for [%d]\n", task->pid)); 4434 DPRINT(("context loaded on PMU for [%d]\n", task_pid_nr(task)));
4433 } else { 4435 } else {
4434 /* 4436 /*
4435 * when not current, task MUST be stopped, so this is safe 4437 * when not current, task MUST be stopped, so this is safe
@@ -4493,7 +4495,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
4493 int prev_state, is_system; 4495 int prev_state, is_system;
4494 int ret; 4496 int ret;
4495 4497
4496 DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task->pid : -1)); 4498 DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task_pid_nr(task) : -1));
4497 4499
4498 prev_state = ctx->ctx_state; 4500 prev_state = ctx->ctx_state;
4499 is_system = ctx->ctx_fl_system; 4501 is_system = ctx->ctx_fl_system;
@@ -4568,7 +4570,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
4568 */ 4570 */
4569 ia64_psr(regs)->sp = 1; 4571 ia64_psr(regs)->sp = 1;
4570 4572
4571 DPRINT(("setting psr.sp for [%d]\n", task->pid)); 4573 DPRINT(("setting psr.sp for [%d]\n", task_pid_nr(task)));
4572 } 4574 }
4573 /* 4575 /*
4574 * save PMDs to context 4576 * save PMDs to context
@@ -4608,7 +4610,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
4608 ctx->ctx_fl_can_restart = 0; 4610 ctx->ctx_fl_can_restart = 0;
4609 ctx->ctx_fl_going_zombie = 0; 4611 ctx->ctx_fl_going_zombie = 0;
4610 4612
4611 DPRINT(("disconnected [%d] from context\n", task->pid)); 4613 DPRINT(("disconnected [%d] from context\n", task_pid_nr(task)));
4612 4614
4613 return 0; 4615 return 0;
4614} 4616}
@@ -4631,7 +4633,7 @@ pfm_exit_thread(struct task_struct *task)
4631 4633
4632 PROTECT_CTX(ctx, flags); 4634 PROTECT_CTX(ctx, flags);
4633 4635
4634 DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task->pid)); 4636 DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task_pid_nr(task)));
4635 4637
4636 state = ctx->ctx_state; 4638 state = ctx->ctx_state;
4637 switch(state) { 4639 switch(state) {
@@ -4640,13 +4642,13 @@ pfm_exit_thread(struct task_struct *task)
4640 * only comes to this function if pfm_context is not NULL, i.e., cannot 4642 * only comes to this function if pfm_context is not NULL, i.e., cannot
4641 * be in unloaded state 4643 * be in unloaded state
4642 */ 4644 */
4643 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] ctx unloaded\n", task->pid); 4645 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] ctx unloaded\n", task_pid_nr(task));
4644 break; 4646 break;
4645 case PFM_CTX_LOADED: 4647 case PFM_CTX_LOADED:
4646 case PFM_CTX_MASKED: 4648 case PFM_CTX_MASKED:
4647 ret = pfm_context_unload(ctx, NULL, 0, regs); 4649 ret = pfm_context_unload(ctx, NULL, 0, regs);
4648 if (ret) { 4650 if (ret) {
4649 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task->pid, state, ret); 4651 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid_nr(task), state, ret);
4650 } 4652 }
4651 DPRINT(("ctx unloaded for current state was %d\n", state)); 4653 DPRINT(("ctx unloaded for current state was %d\n", state));
4652 4654
@@ -4655,12 +4657,12 @@ pfm_exit_thread(struct task_struct *task)
4655 case PFM_CTX_ZOMBIE: 4657 case PFM_CTX_ZOMBIE:
4656 ret = pfm_context_unload(ctx, NULL, 0, regs); 4658 ret = pfm_context_unload(ctx, NULL, 0, regs);
4657 if (ret) { 4659 if (ret) {
4658 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task->pid, state, ret); 4660 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid_nr(task), state, ret);
4659 } 4661 }
4660 free_ok = 1; 4662 free_ok = 1;
4661 break; 4663 break;
4662 default: 4664 default:
4663 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] unexpected state=%d\n", task->pid, state); 4665 printk(KERN_ERR "perfmon: pfm_exit_thread [%d] unexpected state=%d\n", task_pid_nr(task), state);
4664 break; 4666 break;
4665 } 4667 }
4666 UNPROTECT_CTX(ctx, flags); 4668 UNPROTECT_CTX(ctx, flags);
@@ -4744,7 +4746,7 @@ recheck:
4744 DPRINT(("context %d state=%d [%d] task_state=%ld must_stop=%d\n", 4746 DPRINT(("context %d state=%d [%d] task_state=%ld must_stop=%d\n",
4745 ctx->ctx_fd, 4747 ctx->ctx_fd,
4746 state, 4748 state,
4747 task->pid, 4749 task_pid_nr(task),
4748 task->state, PFM_CMD_STOPPED(cmd))); 4750 task->state, PFM_CMD_STOPPED(cmd)));
4749 4751
4750 /* 4752 /*
@@ -4791,7 +4793,7 @@ recheck:
4791 */ 4793 */
4792 if (PFM_CMD_STOPPED(cmd)) { 4794 if (PFM_CMD_STOPPED(cmd)) {
4793 if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) { 4795 if ((task->state != TASK_STOPPED) && (task->state != TASK_TRACED)) {
4794 DPRINT(("[%d] task not in stopped state\n", task->pid)); 4796 DPRINT(("[%d] task not in stopped state\n", task_pid_nr(task)));
4795 return -EBUSY; 4797 return -EBUSY;
4796 } 4798 }
4797 /* 4799 /*
@@ -4884,7 +4886,7 @@ restart_args:
4884 * limit abuse to min page size 4886 * limit abuse to min page size
4885 */ 4887 */
4886 if (unlikely(sz > PFM_MAX_ARGSIZE)) { 4888 if (unlikely(sz > PFM_MAX_ARGSIZE)) {
4887 printk(KERN_ERR "perfmon: [%d] argument too big %lu\n", current->pid, sz); 4889 printk(KERN_ERR "perfmon: [%d] argument too big %lu\n", task_pid_nr(current), sz);
4888 return -E2BIG; 4890 return -E2BIG;
4889 } 4891 }
4890 4892
@@ -5031,11 +5033,11 @@ pfm_context_force_terminate(pfm_context_t *ctx, struct pt_regs *regs)
5031{ 5033{
5032 int ret; 5034 int ret;
5033 5035
5034 DPRINT(("entering for [%d]\n", current->pid)); 5036 DPRINT(("entering for [%d]\n", task_pid_nr(current)));
5035 5037
5036 ret = pfm_context_unload(ctx, NULL, 0, regs); 5038 ret = pfm_context_unload(ctx, NULL, 0, regs);
5037 if (ret) { 5039 if (ret) {
5038 printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", current->pid, ret); 5040 printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", task_pid_nr(current), ret);
5039 } 5041 }
5040 5042
5041 /* 5043 /*
@@ -5072,7 +5074,7 @@ pfm_handle_work(void)
5072 5074
5073 ctx = PFM_GET_CTX(current); 5075 ctx = PFM_GET_CTX(current);
5074 if (ctx == NULL) { 5076 if (ctx == NULL) {
5075 printk(KERN_ERR "perfmon: [%d] has no PFM context\n", current->pid); 5077 printk(KERN_ERR "perfmon: [%d] has no PFM context\n", task_pid_nr(current));
5076 return; 5078 return;
5077 } 5079 }
5078 5080
@@ -5269,7 +5271,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
5269 DPRINT_ovfl(("pmc0=0x%lx pid=%d iip=0x%lx, %s " 5271 DPRINT_ovfl(("pmc0=0x%lx pid=%d iip=0x%lx, %s "
5270 "used_pmds=0x%lx\n", 5272 "used_pmds=0x%lx\n",
5271 pmc0, 5273 pmc0,
5272 task ? task->pid: -1, 5274 task ? task_pid_nr(task): -1,
5273 (regs ? regs->cr_iip : 0), 5275 (regs ? regs->cr_iip : 0),
5274 CTX_OVFL_NOBLOCK(ctx) ? "nonblocking" : "blocking", 5276 CTX_OVFL_NOBLOCK(ctx) ? "nonblocking" : "blocking",
5275 ctx->ctx_used_pmds[0])); 5277 ctx->ctx_used_pmds[0]));
@@ -5458,7 +5460,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
5458 } 5460 }
5459 5461
5460 DPRINT_ovfl(("owner [%d] pending=%ld reason=%u ovfl_pmds=0x%lx ovfl_notify=0x%lx masked=%d\n", 5462 DPRINT_ovfl(("owner [%d] pending=%ld reason=%u ovfl_pmds=0x%lx ovfl_notify=0x%lx masked=%d\n",
5461 GET_PMU_OWNER() ? GET_PMU_OWNER()->pid : -1, 5463 GET_PMU_OWNER() ? task_pid_nr(GET_PMU_OWNER()) : -1,
5462 PFM_GET_WORK_PENDING(task), 5464 PFM_GET_WORK_PENDING(task),
5463 ctx->ctx_fl_trap_reason, 5465 ctx->ctx_fl_trap_reason,
5464 ovfl_pmds, 5466 ovfl_pmds,
@@ -5483,7 +5485,7 @@ pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx, u64 pmc0, str
5483sanity_check: 5485sanity_check:
5484 printk(KERN_ERR "perfmon: CPU%d overflow handler [%d] pmc0=0x%lx\n", 5486 printk(KERN_ERR "perfmon: CPU%d overflow handler [%d] pmc0=0x%lx\n",
5485 smp_processor_id(), 5487 smp_processor_id(),
5486 task ? task->pid : -1, 5488 task ? task_pid_nr(task) : -1,
5487 pmc0); 5489 pmc0);
5488 return; 5490 return;
5489 5491
@@ -5516,7 +5518,7 @@ stop_monitoring:
5516 * 5518 *
5517 * Overall pretty hairy stuff.... 5519 * Overall pretty hairy stuff....
5518 */ 5520 */
5519 DPRINT(("ctx is zombie for [%d], converted to spurious\n", task ? task->pid: -1)); 5521 DPRINT(("ctx is zombie for [%d], converted to spurious\n", task ? task_pid_nr(task): -1));
5520 pfm_clear_psr_up(); 5522 pfm_clear_psr_up();
5521 ia64_psr(regs)->up = 0; 5523 ia64_psr(regs)->up = 0;
5522 ia64_psr(regs)->sp = 1; 5524 ia64_psr(regs)->sp = 1;
@@ -5577,13 +5579,13 @@ pfm_do_interrupt_handler(int irq, void *arg, struct pt_regs *regs)
5577 5579
5578report_spurious1: 5580report_spurious1:
5579 printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d has no PFM context\n", 5581 printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d has no PFM context\n",
5580 this_cpu, task->pid); 5582 this_cpu, task_pid_nr(task));
5581 pfm_unfreeze_pmu(); 5583 pfm_unfreeze_pmu();
5582 return -1; 5584 return -1;
5583report_spurious2: 5585report_spurious2:
5584 printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d, invalid flag\n", 5586 printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d, invalid flag\n",
5585 this_cpu, 5587 this_cpu,
5586 task->pid); 5588 task_pid_nr(task));
5587 pfm_unfreeze_pmu(); 5589 pfm_unfreeze_pmu();
5588 return -1; 5590 return -1;
5589} 5591}
@@ -5870,7 +5872,8 @@ pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs)
5870 ia64_psr(regs)->sp = 1; 5872 ia64_psr(regs)->sp = 1;
5871 5873
5872 if (GET_PMU_OWNER() == task) { 5874 if (GET_PMU_OWNER() == task) {
5873 DPRINT(("cleared ownership for [%d]\n", ctx->ctx_task->pid)); 5875 DPRINT(("cleared ownership for [%d]\n",
5876 task_pid_nr(ctx->ctx_task)));
5874 SET_PMU_OWNER(NULL, NULL); 5877 SET_PMU_OWNER(NULL, NULL);
5875 } 5878 }
5876 5879
@@ -5882,7 +5885,7 @@ pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs)
5882 task->thread.pfm_context = NULL; 5885 task->thread.pfm_context = NULL;
5883 task->thread.flags &= ~IA64_THREAD_PM_VALID; 5886 task->thread.flags &= ~IA64_THREAD_PM_VALID;
5884 5887
5885 DPRINT(("force cleanup for [%d]\n", task->pid)); 5888 DPRINT(("force cleanup for [%d]\n", task_pid_nr(task)));
5886} 5889}
5887 5890
5888 5891
@@ -6426,7 +6429,7 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)
6426 6429
6427 if (PMD_IS_COUNTING(i)) { 6430 if (PMD_IS_COUNTING(i)) {
6428 DPRINT(("[%d] pmd[%d] ctx_pmd=0x%lx hw_pmd=0x%lx\n", 6431 DPRINT(("[%d] pmd[%d] ctx_pmd=0x%lx hw_pmd=0x%lx\n",
6429 task->pid, 6432 task_pid_nr(task),
6430 i, 6433 i,
6431 ctx->ctx_pmds[i].val, 6434 ctx->ctx_pmds[i].val,
6432 val & ovfl_val)); 6435 val & ovfl_val));
@@ -6448,11 +6451,11 @@ pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)
6448 */ 6451 */
6449 if (pmc0 & (1UL << i)) { 6452 if (pmc0 & (1UL << i)) {
6450 val += 1 + ovfl_val; 6453 val += 1 + ovfl_val;
6451 DPRINT(("[%d] pmd[%d] overflowed\n", task->pid, i)); 6454 DPRINT(("[%d] pmd[%d] overflowed\n", task_pid_nr(task), i));
6452 } 6455 }
6453 } 6456 }
6454 6457
6455 DPRINT(("[%d] ctx_pmd[%d]=0x%lx pmd_val=0x%lx\n", task->pid, i, val, pmd_val)); 6458 DPRINT(("[%d] ctx_pmd[%d]=0x%lx pmd_val=0x%lx\n", task_pid_nr(task), i, val, pmd_val));
6456 6459
6457 if (is_self) ctx->th_pmds[i] = pmd_val; 6460 if (is_self) ctx->th_pmds[i] = pmd_val;
6458 6461
@@ -6793,14 +6796,14 @@ dump_pmu_state(const char *from)
6793 printk("CPU%d from %s() current [%d] iip=0x%lx %s\n", 6796 printk("CPU%d from %s() current [%d] iip=0x%lx %s\n",
6794 this_cpu, 6797 this_cpu,
6795 from, 6798 from,
6796 current->pid, 6799 task_pid_nr(current),
6797 regs->cr_iip, 6800 regs->cr_iip,
6798 current->comm); 6801 current->comm);
6799 6802
6800 task = GET_PMU_OWNER(); 6803 task = GET_PMU_OWNER();
6801 ctx = GET_PMU_CTX(); 6804 ctx = GET_PMU_CTX();
6802 6805
6803 printk("->CPU%d owner [%d] ctx=%p\n", this_cpu, task ? task->pid : -1, ctx); 6806 printk("->CPU%d owner [%d] ctx=%p\n", this_cpu, task ? task_pid_nr(task) : -1, ctx);
6804 6807
6805 psr = pfm_get_psr(); 6808 psr = pfm_get_psr();
6806 6809
@@ -6848,7 +6851,7 @@ pfm_inherit(struct task_struct *task, struct pt_regs *regs)
6848{ 6851{
6849 struct thread_struct *thread; 6852 struct thread_struct *thread;
6850 6853
6851 DPRINT(("perfmon: pfm_inherit clearing state for [%d]\n", task->pid)); 6854 DPRINT(("perfmon: pfm_inherit clearing state for [%d]\n", task_pid_nr(task)));
6852 6855
6853 thread = &task->thread; 6856 thread = &task->thread;
6854 6857
diff --git a/arch/ia64/kernel/perfmon_default_smpl.c b/arch/ia64/kernel/perfmon_default_smpl.c
index ff80eab83b38..a7af1cb419f9 100644
--- a/arch/ia64/kernel/perfmon_default_smpl.c
+++ b/arch/ia64/kernel/perfmon_default_smpl.c
@@ -44,11 +44,11 @@ default_validate(struct task_struct *task, unsigned int flags, int cpu, void *da
44 int ret = 0; 44 int ret = 0;
45 45
46 if (data == NULL) { 46 if (data == NULL) {
47 DPRINT(("[%d] no argument passed\n", task->pid)); 47 DPRINT(("[%d] no argument passed\n", task_pid_nr(task)));
48 return -EINVAL; 48 return -EINVAL;
49 } 49 }
50 50
51 DPRINT(("[%d] validate flags=0x%x CPU%d\n", task->pid, flags, cpu)); 51 DPRINT(("[%d] validate flags=0x%x CPU%d\n", task_pid_nr(task), flags, cpu));
52 52
53 /* 53 /*
54 * must hold at least the buffer header + one minimally sized entry 54 * must hold at least the buffer header + one minimally sized entry
@@ -88,7 +88,7 @@ default_init(struct task_struct *task, void *buf, unsigned int flags, int cpu, v
88 hdr->hdr_count = 0UL; 88 hdr->hdr_count = 0UL;
89 89
90 DPRINT(("[%d] buffer=%p buf_size=%lu hdr_size=%lu hdr_version=%u cur_offs=%lu\n", 90 DPRINT(("[%d] buffer=%p buf_size=%lu hdr_size=%lu hdr_version=%u cur_offs=%lu\n",
91 task->pid, 91 task_pid_nr(task),
92 buf, 92 buf,
93 hdr->hdr_buf_size, 93 hdr->hdr_buf_size,
94 sizeof(*hdr), 94 sizeof(*hdr),
@@ -245,7 +245,7 @@ default_restart(struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, stru
245static int 245static int
246default_exit(struct task_struct *task, void *buf, struct pt_regs *regs) 246default_exit(struct task_struct *task, void *buf, struct pt_regs *regs)
247{ 247{
248 DPRINT(("[%d] exit(%p)\n", task->pid, buf)); 248 DPRINT(("[%d] exit(%p)\n", task_pid_nr(task), buf));
249 return 0; 249 return 0;
250} 250}
251 251
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index c613fc0e91cc..2418289ee5ca 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -105,7 +105,8 @@ show_regs (struct pt_regs *regs)
105 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri; 105 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
106 106
107 print_modules(); 107 print_modules();
108 printk("\nPid: %d, CPU %d, comm: %20s\n", current->pid, smp_processor_id(), current->comm); 108 printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
109 smp_processor_id(), current->comm);
109 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n", 110 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s\n",
110 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted()); 111 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted());
111 print_symbol("ip is at %s\n", ip); 112 print_symbol("ip is at %s\n", ip);
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c5cfcfa4c87c..cbf67f1aa291 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -208,6 +208,48 @@ static int __init register_memory(void)
208 208
209__initcall(register_memory); 209__initcall(register_memory);
210 210
211
212#ifdef CONFIG_KEXEC
213static void __init setup_crashkernel(unsigned long total, int *n)
214{
215 unsigned long long base = 0, size = 0;
216 int ret;
217
218 ret = parse_crashkernel(boot_command_line, total,
219 &size, &base);
220 if (ret == 0 && size > 0) {
221 if (!base) {
222 sort_regions(rsvd_region, *n);
223 base = kdump_find_rsvd_region(size,
224 rsvd_region, *n);
225 }
226 if (base != ~0UL) {
227 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
228 "for crashkernel (System RAM: %ldMB)\n",
229 (unsigned long)(size >> 20),
230 (unsigned long)(base >> 20),
231 (unsigned long)(total >> 20));
232 rsvd_region[*n].start =
233 (unsigned long)__va(base);
234 rsvd_region[*n].end =
235 (unsigned long)__va(base + size);
236 (*n)++;
237 crashk_res.start = base;
238 crashk_res.end = base + size - 1;
239 }
240 }
241 efi_memmap_res.start = ia64_boot_param->efi_memmap;
242 efi_memmap_res.end = efi_memmap_res.start +
243 ia64_boot_param->efi_memmap_size;
244 boot_param_res.start = __pa(ia64_boot_param);
245 boot_param_res.end = boot_param_res.start +
246 sizeof(*ia64_boot_param);
247}
248#else
249static inline void __init setup_crashkernel(unsigned long total, int *n)
250{}
251#endif
252
211/** 253/**
212 * reserve_memory - setup reserved memory areas 254 * reserve_memory - setup reserved memory areas
213 * 255 *
@@ -219,6 +261,7 @@ void __init
219reserve_memory (void) 261reserve_memory (void)
220{ 262{
221 int n = 0; 263 int n = 0;
264 unsigned long total_memory;
222 265
223 /* 266 /*
224 * none of the entries in this table overlap 267 * none of the entries in this table overlap
@@ -254,50 +297,11 @@ reserve_memory (void)
254 n++; 297 n++;
255#endif 298#endif
256 299
257 efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end); 300 total_memory = efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
258 n++; 301 n++;
259 302
260#ifdef CONFIG_KEXEC 303 setup_crashkernel(total_memory, &n);
261 /* crashkernel=size@offset specifies the size to reserve for a crash 304
262 * kernel. If offset is 0, then it is determined automatically.
263 * By reserving this memory we guarantee that linux never set's it
264 * up as a DMA target.Useful for holding code to do something
265 * appropriate after a kernel panic.
266 */
267 {
268 char *from = strstr(boot_command_line, "crashkernel=");
269 unsigned long base, size;
270 if (from) {
271 size = memparse(from + 12, &from);
272 if (*from == '@')
273 base = memparse(from+1, &from);
274 else
275 base = 0;
276 if (size) {
277 if (!base) {
278 sort_regions(rsvd_region, n);
279 base = kdump_find_rsvd_region(size,
280 rsvd_region, n);
281 }
282 if (base != ~0UL) {
283 rsvd_region[n].start =
284 (unsigned long)__va(base);
285 rsvd_region[n].end =
286 (unsigned long)__va(base + size);
287 n++;
288 crashk_res.start = base;
289 crashk_res.end = base + size - 1;
290 }
291 }
292 }
293 efi_memmap_res.start = ia64_boot_param->efi_memmap;
294 efi_memmap_res.end = efi_memmap_res.start +
295 ia64_boot_param->efi_memmap_size;
296 boot_param_res.start = __pa(ia64_boot_param);
297 boot_param_res.end = boot_param_res.start +
298 sizeof(*ia64_boot_param);
299 }
300#endif
301 /* end of memory marker */ 305 /* end of memory marker */
302 rsvd_region[n].start = ~0UL; 306 rsvd_region[n].start = ~0UL;
303 rsvd_region[n].end = ~0UL; 307 rsvd_region[n].end = ~0UL;
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index aeec8184e862..cdb64cc4d9c8 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -227,7 +227,7 @@ ia64_rt_sigreturn (struct sigscratch *scr)
227 si.si_signo = SIGSEGV; 227 si.si_signo = SIGSEGV;
228 si.si_errno = 0; 228 si.si_errno = 0;
229 si.si_code = SI_KERNEL; 229 si.si_code = SI_KERNEL;
230 si.si_pid = current->pid; 230 si.si_pid = task_pid_vnr(current);
231 si.si_uid = current->uid; 231 si.si_uid = current->uid;
232 si.si_addr = sc; 232 si.si_addr = sc;
233 force_sig_info(SIGSEGV, &si, current); 233 force_sig_info(SIGSEGV, &si, current);
@@ -332,7 +332,7 @@ force_sigsegv_info (int sig, void __user *addr)
332 si.si_signo = SIGSEGV; 332 si.si_signo = SIGSEGV;
333 si.si_errno = 0; 333 si.si_errno = 0;
334 si.si_code = SI_KERNEL; 334 si.si_code = SI_KERNEL;
335 si.si_pid = current->pid; 335 si.si_pid = task_pid_vnr(current);
336 si.si_uid = current->uid; 336 si.si_uid = current->uid;
337 si.si_addr = addr; 337 si.si_addr = addr;
338 force_sig_info(SIGSEGV, &si, current); 338 force_sig_info(SIGSEGV, &si, current);
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 98cfc90cab1d..2bb84214e5f1 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -371,6 +371,11 @@ ia64_setup_printk_clock(void)
371 ia64_printk_clock = ia64_itc_printk_clock; 371 ia64_printk_clock = ia64_itc_printk_clock;
372} 372}
373 373
374/* IA64 doesn't cache the timezone */
375void update_vsyscall_tz(void)
376{
377}
378
374void update_vsyscall(struct timespec *wall, struct clocksource *c) 379void update_vsyscall(struct timespec *wall, struct clocksource *c)
375{ 380{
376 unsigned long flags; 381 unsigned long flags;
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 3aeaf15e468b..78d65cb947d2 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -61,7 +61,7 @@ die (const char *str, struct pt_regs *regs, long err)
61 61
62 if (++die.lock_owner_depth < 3) { 62 if (++die.lock_owner_depth < 3) {
63 printk("%s[%d]: %s %ld [%d]\n", 63 printk("%s[%d]: %s %ld [%d]\n",
64 current->comm, current->pid, str, err, ++die_counter); 64 current->comm, task_pid_nr(current), str, err, ++die_counter);
65 (void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 65 (void) notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
66 show_regs(regs); 66 show_regs(regs);
67 } else 67 } else
@@ -315,7 +315,7 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
315 last.time = current_jiffies + 5 * HZ; 315 last.time = current_jiffies + 5 * HZ;
316 printk(KERN_WARNING 316 printk(KERN_WARNING
317 "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n", 317 "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
318 current->comm, current->pid, regs->cr_iip + ia64_psr(regs)->ri, isr); 318 current->comm, task_pid_nr(current), regs->cr_iip + ia64_psr(regs)->ri, isr);
319 } 319 }
320 } 320 }
321 } 321 }
@@ -453,7 +453,7 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
453 if (code == 8) { 453 if (code == 8) {
454# ifdef CONFIG_IA64_PRINT_HAZARDS 454# ifdef CONFIG_IA64_PRINT_HAZARDS
455 printk("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n", 455 printk("%s[%d]: possible hazard @ ip=%016lx (pr = %016lx)\n",
456 current->comm, current->pid, 456 current->comm, task_pid_nr(current),
457 regs.cr_iip + ia64_psr(&regs)->ri, regs.pr); 457 regs.cr_iip + ia64_psr(&regs)->ri, regs.pr);
458# endif 458# endif
459 return; 459 return;
diff --git a/arch/ia64/kernel/unaligned.c b/arch/ia64/kernel/unaligned.c
index fe6aa5a9f8fa..2173de9fe917 100644
--- a/arch/ia64/kernel/unaligned.c
+++ b/arch/ia64/kernel/unaligned.c
@@ -1340,7 +1340,8 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1340 size_t len; 1340 size_t len;
1341 1341
1342 len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, " 1342 len = sprintf(buf, "%s(%d): unaligned access to 0x%016lx, "
1343 "ip=0x%016lx\n\r", current->comm, current->pid, 1343 "ip=0x%016lx\n\r", current->comm,
1344 task_pid_nr(current),
1344 ifa, regs->cr_iip + ipsr->ri); 1345 ifa, regs->cr_iip + ipsr->ri);
1345 /* 1346 /*
1346 * Don't call tty_write_message() if we're in the kernel; we might 1347 * Don't call tty_write_message() if we're in the kernel; we might
@@ -1363,7 +1364,7 @@ ia64_handle_unaligned (unsigned long ifa, struct pt_regs *regs)
1363 "administrator\n" 1364 "administrator\n"
1364 "echo 0 > /proc/sys/kernel/ignore-" 1365 "echo 0 > /proc/sys/kernel/ignore-"
1365 "unaligned-usertrap to re-enable\n", 1366 "unaligned-usertrap to re-enable\n",
1366 current->comm, current->pid); 1367 current->comm, task_pid_nr(current));
1367 } 1368 }
1368 } 1369 }
1369 } else { 1370 } else {
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 32f26253c4e8..7571076a16a1 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -274,7 +274,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
274 274
275 out_of_memory: 275 out_of_memory:
276 up_read(&mm->mmap_sem); 276 up_read(&mm->mmap_sem);
277 if (is_init(current)) { 277 if (is_global_init(current)) {
278 yield(); 278 yield();
279 down_read(&mm->mmap_sem); 279 down_read(&mm->mmap_sem);
280 goto survive; 280 goto survive;
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 3e10152abbf0..c6c19bf11bec 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -127,8 +127,8 @@ ia64_init_addr_space (void)
127 vma->vm_mm = current->mm; 127 vma->vm_mm = current->mm;
128 vma->vm_start = current->thread.rbs_bot & PAGE_MASK; 128 vma->vm_start = current->thread.rbs_bot & PAGE_MASK;
129 vma->vm_end = vma->vm_start + PAGE_SIZE; 129 vma->vm_end = vma->vm_start + PAGE_SIZE;
130 vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7];
131 vma->vm_flags = VM_DATA_DEFAULT_FLAGS|VM_GROWSUP|VM_ACCOUNT; 130 vma->vm_flags = VM_DATA_DEFAULT_FLAGS|VM_GROWSUP|VM_ACCOUNT;
131 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
132 down_write(&current->mm->mmap_sem); 132 down_write(&current->mm->mmap_sem);
133 if (insert_vm_struct(current->mm, vma)) { 133 if (insert_vm_struct(current->mm, vma)) {
134 up_write(&current->mm->mmap_sem); 134 up_write(&current->mm->mmap_sem);
diff --git a/arch/ia64/oprofile/Kconfig b/arch/ia64/oprofile/Kconfig
deleted file mode 100644
index 97271ab484dc..000000000000
--- a/arch/ia64/oprofile/Kconfig
+++ /dev/null
@@ -1,20 +0,0 @@
1config PROFILING
2 bool "Profiling support (EXPERIMENTAL)"
3 help
4 Say Y here to enable the extended profiling support mechanisms used
5 by profilers such as OProfile.
6
7config OPROFILE
8 tristate "OProfile system profiling (EXPERIMENTAL)"
9 depends on PROFILING
10 help
11 OProfile is a profiling system capable of profiling the
12 whole system, include the kernel, kernel modules, libraries,
13 and applications.
14
15 Due to firmware bugs, you may need to use the "nohalt" boot
16 option if you're using OProfile with the hardware performance
17 counters.
18
19 If unsure, say N.
20
diff --git a/arch/ia64/sn/kernel/xpnet.c b/arch/ia64/sn/kernel/xpnet.c
index e58fcadff2e9..a5df672d8392 100644
--- a/arch/ia64/sn/kernel/xpnet.c
+++ b/arch/ia64/sn/kernel/xpnet.c
@@ -269,8 +269,9 @@ xpnet_receive(partid_t partid, int channel, struct xpnet_message *msg)
269 skb->protocol = eth_type_trans(skb, xpnet_device); 269 skb->protocol = eth_type_trans(skb, xpnet_device);
270 skb->ip_summed = CHECKSUM_UNNECESSARY; 270 skb->ip_summed = CHECKSUM_UNNECESSARY;
271 271
272 dev_dbg(xpnet, "passing skb to network layer; \n\tskb->head=0x%p " 272 dev_dbg(xpnet, "passing skb to network layer\n"
273 "skb->data=0x%p skb->tail=0x%p skb->end=0x%p skb->len=%d\n", 273 KERN_DEBUG "\tskb->head=0x%p skb->data=0x%p skb->tail=0x%p "
274 "skb->end=0x%p skb->len=%d\n",
274 (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), 275 (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb),
275 skb_end_pointer(skb), skb->len); 276 skb_end_pointer(skb), skb->len);
276 277
@@ -576,10 +577,10 @@ xpnet_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
576 msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb); 577 msg->tailout_ignore = end_addr - (u64)skb_tail_pointer(skb);
577 msg->buf_pa = __pa(start_addr); 578 msg->buf_pa = __pa(start_addr);
578 579
579 dev_dbg(xpnet, "sending XPC message to %d:%d\nmsg->buf_pa=" 580 dev_dbg(xpnet, "sending XPC message to %d:%d\n"
580 "0x%lx, msg->size=%u, msg->leadin_ignore=%u, " 581 KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, "
581 "msg->tailout_ignore=%u\n", dest_partid, 582 "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n",
582 XPC_NET_CHANNEL, msg->buf_pa, msg->size, 583 dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size,
583 msg->leadin_ignore, msg->tailout_ignore); 584 msg->leadin_ignore, msg->tailout_ignore);
584 585
585 586
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index bd5fe76401f1..ab9a264cb194 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -426,7 +426,7 @@ source "drivers/Kconfig"
426 426
427source "fs/Kconfig" 427source "fs/Kconfig"
428 428
429source "arch/m32r/oprofile/Kconfig" 429source "kernel/Kconfig.instrumentation"
430 430
431source "arch/m32r/Kconfig.debug" 431source "arch/m32r/Kconfig.debug"
432 432
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c
index f8d8650383e0..d0c5b0b7da2f 100644
--- a/arch/m32r/kernel/irq.c
+++ b/arch/m32r/kernel/irq.c
@@ -71,7 +71,7 @@ skip:
71} 71}
72 72
73/* 73/*
74 * do_IRQ handles all normal device IRQ's (the special 74 * do_IRQ handles all normal device IRQs (the special
75 * SMP cross-CPU interrupts have their own specific 75 * SMP cross-CPU interrupts have their own specific
76 * handlers). 76 * handlers).
77 */ 77 */
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index 916faf6070af..a753d79c4e89 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -358,7 +358,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
358 358
359 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 359 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
360 if (signr > 0) { 360 if (signr > 0) {
361 /* Reenable any watchpoints before delivering the 361 /* Re-enable any watchpoints before delivering the
362 * signal to user space. The processor register will 362 * signal to user space. The processor register will
363 * have been cleared if the watchpoint triggered 363 * have been cleared if the watchpoint triggered
364 * inside the kernel. 364 * inside the kernel.
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index 360129174b2b..c837bc13b015 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -202,7 +202,7 @@ void smp_flush_cache_all_interrupt(void)
202} 202}
203 203
204/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 204/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
205/* TLB flush request Routins */ 205/* TLB flush request Routines */
206/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 206/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
207 207
208/*==========================================================================* 208/*==========================================================================*
@@ -378,7 +378,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
378 * Name: flush_tlb_others 378 * Name: flush_tlb_others
379 * 379 *
380 * Description: This routine requests other CPU to execute flush TLB. 380 * Description: This routine requests other CPU to execute flush TLB.
381 * 1.Setup parmeters. 381 * 1.Setup parameters.
382 * 2.Send 'INVALIDATE_TLB_IPI' to other CPU. 382 * 2.Send 'INVALIDATE_TLB_IPI' to other CPU.
383 * Request other CPU to execute 'smp_invalidate_interrupt()'. 383 * Request other CPU to execute 'smp_invalidate_interrupt()'.
384 * 3.Wait for other CPUs operation finished. 384 * 3.Wait for other CPUs operation finished.
@@ -502,7 +502,7 @@ void smp_invalidate_interrupt(void)
502} 502}
503 503
504/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 504/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
505/* Stop CPU request Routins */ 505/* Stop CPU request Routines */
506/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 506/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
507 507
508/*==========================================================================* 508/*==========================================================================*
@@ -566,7 +566,7 @@ static void stop_this_cpu(void *dummy)
566} 566}
567 567
568/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 568/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
569/* Call function Routins */ 569/* Call function Routines */
570/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 570/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
571 571
572/*==========================================================================* 572/*==========================================================================*
@@ -690,7 +690,7 @@ void smp_call_function_interrupt(void)
690} 690}
691 691
692/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 692/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
693/* Timer Routins */ 693/* Timer Routines */
694/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 694/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
695 695
696/*==========================================================================* 696/*==========================================================================*
@@ -802,7 +802,7 @@ void smp_local_timer_interrupt(void)
802} 802}
803 803
804/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 804/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
805/* Send IPI Routins */ 805/* Send IPI Routines */
806/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 806/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
807 807
808/*==========================================================================* 808/*==========================================================================*
@@ -814,7 +814,7 @@ void smp_local_timer_interrupt(void)
814 * 814 *
815 * Arguments: ipi_num - Number of IPI 815 * Arguments: ipi_num - Number of IPI
816 * try - 0 : Send IPI certainly. 816 * try - 0 : Send IPI certainly.
817 * !0 : The following IPI is not sended when Target CPU 817 * !0 : The following IPI is not sent when Target CPU
818 * has not received the before IPI. 818 * has not received the before IPI.
819 * 819 *
820 * Returns: void (cannot fail) 820 * Returns: void (cannot fail)
@@ -844,7 +844,7 @@ void send_IPI_allbutself(int ipi_num, int try)
844 * Arguments: cpu_mask - Bitmap of target CPUs logical ID 844 * Arguments: cpu_mask - Bitmap of target CPUs logical ID
845 * ipi_num - Number of IPI 845 * ipi_num - Number of IPI
846 * try - 0 : Send IPI certainly. 846 * try - 0 : Send IPI certainly.
847 * !0 : The following IPI is not sended when Target CPU 847 * !0 : The following IPI is not sent when Target CPU
848 * has not received the before IPI. 848 * has not received the before IPI.
849 * 849 *
850 * Returns: void (cannot fail) 850 * Returns: void (cannot fail)
@@ -885,7 +885,7 @@ static void send_IPI_mask(cpumask_t cpumask, int ipi_num, int try)
885 * Arguments: cpu_mask - Bitmap of target CPUs physical ID 885 * Arguments: cpu_mask - Bitmap of target CPUs physical ID
886 * ipi_num - Number of IPI 886 * ipi_num - Number of IPI
887 * try - 0 : Send IPI certainly. 887 * try - 0 : Send IPI certainly.
888 * !0 : The following IPI is not sended when Target CPU 888 * !0 : The following IPI is not sent when Target CPU
889 * has not received the before IPI. 889 * has not received the before IPI.
890 * 890 *
891 * Returns: IPICRi regster value. 891 * Returns: IPICRi regster value.
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index 9dae410014d8..0e383da158e9 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -133,7 +133,7 @@ static void map_cpu_to_physid(int, int);
133static void unmap_cpu_to_physid(int, int); 133static void unmap_cpu_to_physid(int, int);
134 134
135/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 135/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
136/* Boot up APs Routins : BSP */ 136/* Boot up APs Routines : BSP */
137/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 137/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
138void __devinit smp_prepare_boot_cpu(void) 138void __devinit smp_prepare_boot_cpu(void)
139{ 139{
@@ -404,7 +404,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
404} 404}
405 405
406/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 406/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
407/* Activate a secondary processor Routins */ 407/* Activate a secondary processor Routines */
408/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 408/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
409 409
410/*==========================================================================* 410/*==========================================================================*
@@ -509,7 +509,7 @@ static void __init smp_online(void)
509} 509}
510 510
511/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 511/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
512/* Boot up CPUs common Routins */ 512/* Boot up CPUs common Routines */
513/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ 513/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
514static void __init show_mp_info(int nr_cpu) 514static void __init show_mp_info(int nr_cpu)
515{ 515{
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index 0fc2efec18f6..6d7a80fdad48 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -214,7 +214,7 @@ asmlinkage int sys_uname(struct old_utsname __user * name)
214 214
215asmlinkage int sys_cacheflush(void *addr, int bytes, int cache) 215asmlinkage int sys_cacheflush(void *addr, int bytes, int cache)
216{ 216{
217 /* This should flush more selectivly ... */ 217 /* This should flush more selectively ... */
218 _flush_cache_all(); 218 _flush_cache_all();
219 return 0; 219 return 0;
220} 220}
diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index 97e0b1c0830e..89ba4a0b5d51 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -196,7 +196,7 @@ static void show_registers(struct pt_regs *regs)
196 printk("SPI: %08lx\n", sp); 196 printk("SPI: %08lx\n", sp);
197 } 197 }
198 printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)", 198 printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)",
199 current->comm, current->pid, 0xffff & i, 4096+(unsigned long)current); 199 current->comm, task_pid_nr(current), 0xffff & i, 4096+(unsigned long)current);
200 200
201 /* 201 /*
202 * When in-kernel, we also print out the stack and code at the 202 * When in-kernel, we also print out the stack and code at the
diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c
index 70a766aad3e0..4a71df4c1b30 100644
--- a/arch/m32r/mm/fault.c
+++ b/arch/m32r/mm/fault.c
@@ -271,7 +271,7 @@ no_context:
271 */ 271 */
272out_of_memory: 272out_of_memory:
273 up_read(&mm->mmap_sem); 273 up_read(&mm->mmap_sem);
274 if (is_init(tsk)) { 274 if (is_global_init(tsk)) {
275 yield(); 275 yield();
276 down_read(&mm->mmap_sem); 276 down_read(&mm->mmap_sem);
277 goto survive; 277 goto survive;
diff --git a/arch/m32r/oprofile/Kconfig b/arch/m32r/oprofile/Kconfig
deleted file mode 100644
index 19d37730b664..000000000000
--- a/arch/m32r/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 20a9c08e59c3..01dee84f840a 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -683,6 +683,8 @@ endmenu
683 683
684source "fs/Kconfig" 684source "fs/Kconfig"
685 685
686source "kernel/Kconfig.instrumentation"
687
686source "arch/m68k/Kconfig.debug" 688source "arch/m68k/Kconfig.debug"
687 689
688source "security/Kconfig" 690source "security/Kconfig"
diff --git a/arch/m68k/amiga/pcmcia.c b/arch/m68k/amiga/pcmcia.c
index fc57c6e72acf..186662ca1a89 100644
--- a/arch/m68k/amiga/pcmcia.c
+++ b/arch/m68k/amiga/pcmcia.c
@@ -33,7 +33,7 @@ void pcmcia_reset(void)
33 33
34 34
35/* copy a tuple, including tuple header. return nb bytes copied */ 35/* copy a tuple, including tuple header. return nb bytes copied */
36/* be carefull as this may trigger a GAYLE_IRQ_WR interrupt ! */ 36/* be careful as this may trigger a GAYLE_IRQ_WR interrupt ! */
37 37
38int pcmcia_copy_tuple(unsigned char tuple_id, void *tuple, int max_len) 38int pcmcia_copy_tuple(unsigned char tuple_id, void *tuple, int max_len)
39{ 39{
diff --git a/arch/m68k/ifpsp060/CHANGES b/arch/m68k/ifpsp060/CHANGES
index c1e712dfc2e7..ba96596910fd 100644
--- a/arch/m68k/ifpsp060/CHANGES
+++ b/arch/m68k/ifpsp060/CHANGES
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/MISC b/arch/m68k/ifpsp060/MISC
index b7e644b94ae2..1a63913daa16 100644
--- a/arch/m68k/ifpsp060/MISC
+++ b/arch/m68k/ifpsp060/MISC
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/README b/arch/m68k/ifpsp060/README
index e3bced429bd3..f6f8f5c59419 100644
--- a/arch/m68k/ifpsp060/README
+++ b/arch/m68k/ifpsp060/README
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/TEST.DOC b/arch/m68k/ifpsp060/TEST.DOC
index 5e5900cb2dc4..1ba3aef1500f 100644
--- a/arch/m68k/ifpsp060/TEST.DOC
+++ b/arch/m68k/ifpsp060/TEST.DOC
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/fplsp.doc b/arch/m68k/ifpsp060/fplsp.doc
index fb637c436762..89730a934c5e 100644
--- a/arch/m68k/ifpsp060/fplsp.doc
+++ b/arch/m68k/ifpsp060/fplsp.doc
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/fpsp.doc b/arch/m68k/ifpsp060/fpsp.doc
index 408315209e62..23d513f72ed9 100644
--- a/arch/m68k/ifpsp060/fpsp.doc
+++ b/arch/m68k/ifpsp060/fpsp.doc
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/fskeleton.S b/arch/m68k/ifpsp060/fskeleton.S
index a45a4ff9d2af..0a1ae4f44130 100644
--- a/arch/m68k/ifpsp060/fskeleton.S
+++ b/arch/m68k/ifpsp060/fskeleton.S
@@ -4,7 +4,7 @@
4|M68060 Software Package 4|M68060 Software Package
5|Production Release P1.00 -- October 10, 1994 5|Production Release P1.00 -- October 10, 1994
6| 6|
7|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8| 8|
9|THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9|THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10|To the maximum extent permitted by applicable law, 10|To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/ilsp.doc b/arch/m68k/ifpsp060/ilsp.doc
index f6fae6d900ae..4e6292f095aa 100644
--- a/arch/m68k/ifpsp060/ilsp.doc
+++ b/arch/m68k/ifpsp060/ilsp.doc
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/iskeleton.S b/arch/m68k/ifpsp060/iskeleton.S
index b2dbdf5ee309..91a9c65fee8a 100644
--- a/arch/m68k/ifpsp060/iskeleton.S
+++ b/arch/m68k/ifpsp060/iskeleton.S
@@ -4,7 +4,7 @@
4|M68060 Software Package 4|M68060 Software Package
5|Production Release P1.00 -- October 10, 1994 5|Production Release P1.00 -- October 10, 1994
6| 6|
7|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8| 8|
9|THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9|THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10|To the maximum extent permitted by applicable law, 10|To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/isp.doc b/arch/m68k/ifpsp060/isp.doc
index 5a90fded3f0b..9dadd727fc50 100644
--- a/arch/m68k/ifpsp060/isp.doc
+++ b/arch/m68k/ifpsp060/isp.doc
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/os.S b/arch/m68k/ifpsp060/os.S
index aa4df87a6c42..7a0d6e428066 100644
--- a/arch/m68k/ifpsp060/os.S
+++ b/arch/m68k/ifpsp060/os.S
@@ -4,7 +4,7 @@
4|M68060 Software Package 4|M68060 Software Package
5|Production Release P1.00 -- October 10, 1994 5|Production Release P1.00 -- October 10, 1994
6| 6|
7|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7|M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8| 8|
9|THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9|THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10|To the maximum extent permitted by applicable law, 10|To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/src/fplsp.S b/arch/m68k/ifpsp060/src/fplsp.S
index fdb79b927ef1..3b7ea2dc9f1b 100644
--- a/arch/m68k/ifpsp060/src/fplsp.S
+++ b/arch/m68k/ifpsp060/src/fplsp.S
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/src/fpsp.S b/arch/m68k/ifpsp060/src/fpsp.S
index 3b597a9bbf43..6c1a9a217887 100644
--- a/arch/m68k/ifpsp060/src/fpsp.S
+++ b/arch/m68k/ifpsp060/src/fpsp.S
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/src/ftest.S b/arch/m68k/ifpsp060/src/ftest.S
index 2edcbae0fd53..1f947915d81e 100644
--- a/arch/m68k/ifpsp060/src/ftest.S
+++ b/arch/m68k/ifpsp060/src/ftest.S
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/src/ilsp.S b/arch/m68k/ifpsp060/src/ilsp.S
index afa7422cddb5..970abaf3303e 100644
--- a/arch/m68k/ifpsp060/src/ilsp.S
+++ b/arch/m68k/ifpsp060/src/ilsp.S
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/src/isp.S b/arch/m68k/ifpsp060/src/isp.S
index b269091d9df6..6dccda766e22 100644
--- a/arch/m68k/ifpsp060/src/isp.S
+++ b/arch/m68k/ifpsp060/src/isp.S
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/src/itest.S b/arch/m68k/ifpsp060/src/itest.S
index ba4a30cbcbea..beca47e7d514 100644
--- a/arch/m68k/ifpsp060/src/itest.S
+++ b/arch/m68k/ifpsp060/src/itest.S
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/ifpsp060/src/pfpsp.S b/arch/m68k/ifpsp060/src/pfpsp.S
index 0c997c436beb..51b9f7d879dd 100644
--- a/arch/m68k/ifpsp060/src/pfpsp.S
+++ b/arch/m68k/ifpsp060/src/pfpsp.S
@@ -4,7 +4,7 @@ M68000 Hi-Performance Microprocessor Division
4M68060 Software Package 4M68060 Software Package
5Production Release P1.00 -- October 10, 1994 5Production Release P1.00 -- October 10, 1994
6 6
7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved. 7M68060 Software Package Copyright © 1993, 1994 Motorola Inc. All rights reserved.
8 8
9THE SOFTWARE is provided on an "AS IS" basis and without warranty. 9THE SOFTWARE is provided on an "AS IS" basis and without warranty.
10To the maximum extent permitted by applicable law, 10To the maximum extent permitted by applicable law,
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index 4e2752a0e89b..97f556fa4932 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -900,7 +900,7 @@ void show_registers(struct pt_regs *regs)
900 regs->d4, regs->d5, regs->a0, regs->a1); 900 regs->d4, regs->d5, regs->a0, regs->a1);
901 901
902 printk("Process %s (pid: %d, task=%p)\n", 902 printk("Process %s (pid: %d, task=%p)\n",
903 current->comm, current->pid, current); 903 current->comm, task_pid_nr(current), current);
904 addr = (unsigned long)&fp->un; 904 addr = (unsigned long)&fp->un;
905 printk("Frame format=%X ", regs->format); 905 printk("Frame format=%X ", regs->format);
906 switch (regs->format) { 906 switch (regs->format) {
@@ -1038,7 +1038,7 @@ void bad_super_trap (struct frame *fp)
1038 fp->un.fmtb.daddr, space_names[ssw & DFC], 1038 fp->un.fmtb.daddr, space_names[ssw & DFC],
1039 fp->ptregs.pc); 1039 fp->ptregs.pc);
1040 } 1040 }
1041 printk ("Current process id is %d\n", current->pid); 1041 printk ("Current process id is %d\n", task_pid_nr(current));
1042 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0); 1042 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
1043} 1043}
1044 1044
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 8547dbc5e8d7..01b468b9392e 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -284,7 +284,7 @@ static struct mac_model mac_data_table[] = {
284 }, 284 },
285 285
286 /* 286 /*
287 * Weirdified MacII hardware - all subtley different. Gee thanks 287 * Weirdified MacII hardware - all subtly different. Gee thanks
288 * Apple. All these boxes seem to have VIA2 in a different place to 288 * Apple. All these boxes seem to have VIA2 in a different place to
289 * the MacII (+1A000 rather than +4000) 289 * the MacII (+1A000 rather than +4000)
290 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html 290 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
@@ -707,7 +707,7 @@ static struct mac_model mac_data_table[] = {
707 * All of these probably have onboard SONIC in the Dock which 707 * All of these probably have onboard SONIC in the Dock which
708 * means we'll have to probe for it eventually. 708 * means we'll have to probe for it eventually.
709 * 709 *
710 * Are these reallly MAC_VIA_IIci? The developer notes for the 710 * Are these really MAC_VIA_IIci? The developer notes for the
711 * Duos show pretty much the same custom parts as in most of 711 * Duos show pretty much the same custom parts as in most of
712 * the other PowerBooks which would imply MAC_VIA_QUADRA. 712 * the other PowerBooks which would imply MAC_VIA_QUADRA.
713 */ 713 */
diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index 0cea21f58192..5b2799eb96a6 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -100,7 +100,7 @@
100 * finished; this function moves the message state to MSG_COMPLETE and signals 100 * finished; this function moves the message state to MSG_COMPLETE and signals
101 * the IOP. This two-step process is provided to allow the handler to defer 101 * the IOP. This two-step process is provided to allow the handler to defer
102 * message processing to a bottom-half handler if the processing will take 102 * message processing to a bottom-half handler if the processing will take
103 * a signifigant amount of time (handlers are called at interrupt time so they 103 * a significant amount of time (handlers are called at interrupt time so they
104 * should execute quickly.) 104 * should execute quickly.)
105 */ 105 */
106 106
@@ -120,7 +120,7 @@
120 120
121/*#define DEBUG_IOP*/ 121/*#define DEBUG_IOP*/
122 122
123/* Set to nonezero if the IOPs are present. Set by iop_init() */ 123/* Set to non-zero if the IOPs are present. Set by iop_init() */
124 124
125int iop_scc_present,iop_ism_present; 125int iop_scc_present,iop_ism_present;
126 126
diff --git a/arch/m68k/mac/oss.c b/arch/m68k/mac/oss.c
index d7be16917efd..50603d3dce84 100644
--- a/arch/m68k/mac/oss.c
+++ b/arch/m68k/mac/oss.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * 990502 (jmt) - Major rewrite for new interrupt architecture as well as some 9 * 990502 (jmt) - Major rewrite for new interrupt architecture as well as some
10 * recent insights into OSS operational details. 10 * recent insights into OSS operational details.
11 * 990610 (jmt) - Now taking fulll advantage of the OSS. Interrupts are mapped 11 * 990610 (jmt) - Now taking full advantage of the OSS. Interrupts are mapped
12 * to mostly match the A/UX interrupt scheme supported on the 12 * to mostly match the A/UX interrupt scheme supported on the
13 * VIA side. Also added support for enabling the ISM irq again 13 * VIA side. Also added support for enabling the ISM irq again
14 * since we now have a functional IOP manager. 14 * since we now have a functional IOP manager.
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index d5cac72eb3db..8df270e950fa 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * 6522 Versatile Interface Adapter (VIA) 2 * 6522 Versatile Interface Adapter (VIA)
3 * 3 *
4 * There are two of these on the Mac II. Some IRQ's are vectored 4 * There are two of these on the Mac II. Some IRQs are vectored
5 * via them as are assorted bits and bobs - eg RTC, ADB. 5 * via them as are assorted bits and bobs - eg RTC, ADB.
6 * 6 *
7 * CSA: Motorola seems to have removed documentation on the 6522 from 7 * CSA: Motorola seems to have removed documentation on the 6522 from
diff --git a/arch/m68k/math-emu/fp_log.c b/arch/m68k/math-emu/fp_log.c
index 87b4f0158560..b1033ae0d6f0 100644
--- a/arch/m68k/math-emu/fp_log.c
+++ b/arch/m68k/math-emu/fp_log.c
@@ -65,7 +65,7 @@ fp_fsqrt(struct fp_ext *dest, struct fp_ext *src)
65 fp_copy_ext(&src2, dest); 65 fp_copy_ext(&src2, dest);
66 66
67 /* 67 /*
68 * The taylor row arround a for sqrt(x) is: 68 * The taylor row around a for sqrt(x) is:
69 * sqrt(x) = sqrt(a) + 1/(2*sqrt(a))*(x-a) + R 69 * sqrt(x) = sqrt(a) + 1/(2*sqrt(a))*(x-a) + R
70 * With a=1 this gives: 70 * With a=1 this gives:
71 * sqrt(x) = 1 + 1/2*(x-1) 71 * sqrt(x) = 1 + 1/2*(x-1)
diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index eaa618681159..f493f03231d5 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -180,7 +180,7 @@ good_area:
180 */ 180 */
181out_of_memory: 181out_of_memory:
182 up_read(&mm->mmap_sem); 182 up_read(&mm->mmap_sem);
183 if (is_init(current)) { 183 if (is_global_init(current)) {
184 yield(); 184 yield();
185 down_read(&mm->mmap_sem); 185 down_read(&mm->mmap_sem);
186 goto survive; 186 goto survive;
diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
index ad3ed1fb8879..46161cef08b9 100644
--- a/arch/m68k/q40/q40ints.c
+++ b/arch/m68k/q40/q40ints.c
@@ -184,7 +184,7 @@ static struct IRQ_TABLE eirqs[] = {
184}; 184};
185 185
186/* complain only this many times about spurious ints : */ 186/* complain only this many times about spurious ints : */
187static int ccleirq=60; /* ISA dev IRQ's*/ 187static int ccleirq=60; /* ISA dev IRQs*/
188/*static int cclirq=60;*/ /* internal */ 188/*static int cclirq=60;*/ /* internal */
189 189
190/* FIXME: add shared ints,mask,unmask,probing.... */ 190/* FIXME: add shared ints,mask,unmask,probing.... */
@@ -234,7 +234,7 @@ static void q40_irq_handler(unsigned int irq, struct pt_regs *fp)
234 * There is a little mess wrt which IRQ really caused this irq request. The 234 * There is a little mess wrt which IRQ really caused this irq request. The
235 * main problem is that IIRQ_REG and EIRQ_REG reflect the state when they 235 * main problem is that IIRQ_REG and EIRQ_REG reflect the state when they
236 * are read - which is long after the request came in. In theory IRQs should 236 * are read - which is long after the request came in. In theory IRQs should
237 * not just go away but they occassionally do 237 * not just go away but they occasionally do
238 */ 238 */
239 if (irq > 4 && irq <= 15 && mext_disabled) { 239 if (irq > 4 && irq <= 15 && mext_disabled) {
240 /*aliased_irq++;*/ 240 /*aliased_irq++;*/
diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index 7a0e3a220687..fb0f6a20cc3c 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -239,7 +239,7 @@ void clear_context(unsigned long context)
239/* gets an empty context. if full, kills the next context listed to 239/* gets an empty context. if full, kills the next context listed to
240 die first */ 240 die first */
241/* This context invalidation scheme is, well, totally arbitrary, I'm 241/* This context invalidation scheme is, well, totally arbitrary, I'm
242 sure it could be much more intellegent... but it gets the job done 242 sure it could be much more intelligent... but it gets the job done
243 for now without much overhead in making it's decision. */ 243 for now without much overhead in making it's decision. */
244/* todo: come up with optimized scheme for flushing contexts */ 244/* todo: come up with optimized scheme for flushing contexts */
245unsigned long get_free_context(struct mm_struct *mm) 245unsigned long get_free_context(struct mm_struct *mm)
diff --git a/arch/m68k/tools/amiga/dmesg.c b/arch/m68k/tools/amiga/dmesg.c
index e892748e7386..7340f5b6cf6d 100644
--- a/arch/m68k/tools/amiga/dmesg.c
+++ b/arch/m68k/tools/amiga/dmesg.c
@@ -3,7 +3,7 @@
3 * in Chip RAM with the kernel command 3 * in Chip RAM with the kernel command
4 * line option `debug=mem'. 4 * line option `debug=mem'.
5 * 5 *
6 * © Copyright 1996 by Geert Uytterhoeven <geert@linux-m68k.org> 6 * © Copyright 1996 by Geert Uytterhoeven <geert@linux-m68k.org>
7 * 7 *
8 * 8 *
9 * Usage: 9 * Usage:
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 185906b54cb0..f52c627bdadd 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -696,6 +696,8 @@ source "drivers/Kconfig"
696 696
697source "fs/Kconfig" 697source "fs/Kconfig"
698 698
699source "kernel/Kconfig.instrumentation"
700
699source "arch/m68knommu/Kconfig.debug" 701source "arch/m68knommu/Kconfig.debug"
700 702
701source "security/Kconfig" 703source "security/Kconfig"
diff --git a/arch/m68knommu/platform/5307/pit.c b/arch/m68knommu/platform/5307/pit.c
index e53c446d10e4..f18352fa35a6 100644
--- a/arch/m68knommu/platform/5307/pit.c
+++ b/arch/m68knommu/platform/5307/pit.c
@@ -83,7 +83,7 @@ unsigned long coldfire_pit_offset(void)
83 83
84 /* 84 /*
85 * If we are still in the first half of the upcount and a 85 * If we are still in the first half of the upcount and a
86 * timer interupt is pending, then add on a ticks worth of time. 86 * timer interrupt is pending, then add on a ticks worth of time.
87 */ 87 */
88 offset = ((pmr - pcntr) * (1000000 / HZ)) / pmr; 88 offset = ((pmr - pcntr) * (1000000 / HZ)) / pmr;
89 if ((offset < (1000000 / HZ / 2)) && (*ipr & MCFPIT_IMR_IBIT)) 89 if ((offset < (1000000 / HZ / 2)) && (*ipr & MCFPIT_IMR_IBIT))
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 235d4514e0a9..3ecff5e9e4f3 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -21,6 +21,7 @@ config MACH_ALCHEMY
21 21
22config BASLER_EXCITE 22config BASLER_EXCITE
23 bool "Basler eXcite smart camera" 23 bool "Basler eXcite smart camera"
24 select CEVT_R4K
24 select DMA_COHERENT 25 select DMA_COHERENT
25 select HW_HAS_PCI 26 select HW_HAS_PCI
26 select IRQ_CPU 27 select IRQ_CPU
@@ -47,6 +48,7 @@ config BASLER_EXCITE_PROTOTYPE
47 48
48config BCM47XX 49config BCM47XX
49 bool "BCM47XX based boards" 50 bool "BCM47XX based boards"
51 select CEVT_R4K
50 select DMA_NONCOHERENT 52 select DMA_NONCOHERENT
51 select HW_HAS_PCI 53 select HW_HAS_PCI
52 select IRQ_CPU 54 select IRQ_CPU
@@ -63,6 +65,7 @@ config BCM47XX
63 65
64config MIPS_COBALT 66config MIPS_COBALT
65 bool "Cobalt Server" 67 bool "Cobalt Server"
68 select CEVT_R4K
66 select DMA_NONCOHERENT 69 select DMA_NONCOHERENT
67 select HW_HAS_PCI 70 select HW_HAS_PCI
68 select I8253 71 select I8253
@@ -80,6 +83,7 @@ config MIPS_COBALT
80config MACH_DECSTATION 83config MACH_DECSTATION
81 bool "DECstations" 84 bool "DECstations"
82 select BOOT_ELF32 85 select BOOT_ELF32
86 select CEVT_R4K
83 select DMA_NONCOHERENT 87 select DMA_NONCOHERENT
84 select NO_IOPORT 88 select NO_IOPORT
85 select IRQ_CPU 89 select IRQ_CPU
@@ -111,6 +115,7 @@ config MACH_JAZZ
111 select ARC 115 select ARC
112 select ARC32 116 select ARC32
113 select ARCH_MAY_HAVE_PC_FDC 117 select ARCH_MAY_HAVE_PC_FDC
118 select CEVT_R4K
114 select GENERIC_ISA_DMA 119 select GENERIC_ISA_DMA
115 select IRQ_CPU 120 select IRQ_CPU
116 select I8253 121 select I8253
@@ -130,6 +135,7 @@ config MACH_JAZZ
130 135
131config LASAT 136config LASAT
132 bool "LASAT Networks platforms" 137 bool "LASAT Networks platforms"
138 select CEVT_R4K
133 select DMA_NONCOHERENT 139 select DMA_NONCOHERENT
134 select SYS_HAS_EARLY_PRINTK 140 select SYS_HAS_EARLY_PRINTK
135 select HW_HAS_PCI 141 select HW_HAS_PCI
@@ -146,6 +152,7 @@ config LASAT
146config LEMOTE_FULONG 152config LEMOTE_FULONG
147 bool "Lemote Fulong mini-PC" 153 bool "Lemote Fulong mini-PC"
148 select ARCH_SPARSEMEM_ENABLE 154 select ARCH_SPARSEMEM_ENABLE
155 select CEVT_R4K
149 select SYS_HAS_CPU_LOONGSON2 156 select SYS_HAS_CPU_LOONGSON2
150 select DMA_NONCOHERENT 157 select DMA_NONCOHERENT
151 select BOOT_ELF32 158 select BOOT_ELF32
@@ -170,6 +177,7 @@ config LEMOTE_FULONG
170config MIPS_ATLAS 177config MIPS_ATLAS
171 bool "MIPS Atlas board" 178 bool "MIPS Atlas board"
172 select BOOT_ELF32 179 select BOOT_ELF32
180 select CEVT_R4K
173 select DMA_NONCOHERENT 181 select DMA_NONCOHERENT
174 select SYS_HAS_EARLY_PRINTK 182 select SYS_HAS_EARLY_PRINTK
175 select IRQ_CPU 183 select IRQ_CPU
@@ -200,6 +208,7 @@ config MIPS_MALTA
200 bool "MIPS Malta board" 208 bool "MIPS Malta board"
201 select ARCH_MAY_HAVE_PC_FDC 209 select ARCH_MAY_HAVE_PC_FDC
202 select BOOT_ELF32 210 select BOOT_ELF32
211 select CEVT_R4K
203 select DMA_NONCOHERENT 212 select DMA_NONCOHERENT
204 select GENERIC_ISA_DMA 213 select GENERIC_ISA_DMA
205 select IRQ_CPU 214 select IRQ_CPU
@@ -230,6 +239,7 @@ config MIPS_MALTA
230 239
231config MIPS_SEAD 240config MIPS_SEAD
232 bool "MIPS SEAD board" 241 bool "MIPS SEAD board"
242 select CEVT_R4K
233 select IRQ_CPU 243 select IRQ_CPU
234 select DMA_NONCOHERENT 244 select DMA_NONCOHERENT
235 select SYS_HAS_EARLY_PRINTK 245 select SYS_HAS_EARLY_PRINTK
@@ -248,6 +258,7 @@ config MIPS_SEAD
248 258
249config MIPS_SIM 259config MIPS_SIM
250 bool 'MIPS simulator (MIPSsim)' 260 bool 'MIPS simulator (MIPSsim)'
261 select CEVT_R4K
251 select DMA_NONCOHERENT 262 select DMA_NONCOHERENT
252 select SYS_HAS_EARLY_PRINTK 263 select SYS_HAS_EARLY_PRINTK
253 select IRQ_CPU 264 select IRQ_CPU
@@ -265,6 +276,7 @@ config MIPS_SIM
265 276
266config MARKEINS 277config MARKEINS
267 bool "NEC EMMA2RH Mark-eins" 278 bool "NEC EMMA2RH Mark-eins"
279 select CEVT_R4K
268 select DMA_NONCOHERENT 280 select DMA_NONCOHERENT
269 select HW_HAS_PCI 281 select HW_HAS_PCI
270 select IRQ_CPU 282 select IRQ_CPU
@@ -279,6 +291,7 @@ config MARKEINS
279 291
280config MACH_VR41XX 292config MACH_VR41XX
281 bool "NEC VR4100 series based machines" 293 bool "NEC VR4100 series based machines"
294 select CEVT_R4K
282 select SYS_HAS_CPU_VR41XX 295 select SYS_HAS_CPU_VR41XX
283 select GENERIC_HARDIRQS_NO__DO_IRQ 296 select GENERIC_HARDIRQS_NO__DO_IRQ
284 297
@@ -315,6 +328,7 @@ config PMC_MSP
315 328
316config PMC_YOSEMITE 329config PMC_YOSEMITE
317 bool "PMC-Sierra Yosemite eval board" 330 bool "PMC-Sierra Yosemite eval board"
331 select CEVT_R4K
318 select DMA_COHERENT 332 select DMA_COHERENT
319 select HW_HAS_PCI 333 select HW_HAS_PCI
320 select IRQ_CPU 334 select IRQ_CPU
@@ -335,6 +349,7 @@ config PMC_YOSEMITE
335 349
336config QEMU 350config QEMU
337 bool "Qemu" 351 bool "Qemu"
352 select CEVT_R4K
338 select DMA_COHERENT 353 select DMA_COHERENT
339 select GENERIC_ISA_DMA 354 select GENERIC_ISA_DMA
340 select HAVE_STD_PC_SERIAL_PORT 355 select HAVE_STD_PC_SERIAL_PORT
@@ -365,6 +380,7 @@ config SGI_IP22
365 select ARC 380 select ARC
366 select ARC32 381 select ARC32
367 select BOOT_ELF32 382 select BOOT_ELF32
383 select CEVT_R4K
368 select DMA_NONCOHERENT 384 select DMA_NONCOHERENT
369 select HW_HAS_EISA 385 select HW_HAS_EISA
370 select I8253 386 select I8253
@@ -409,6 +425,7 @@ config SGI_IP32
409 select ARC 425 select ARC
410 select ARC32 426 select ARC32
411 select BOOT_ELF32 427 select BOOT_ELF32
428 select CEVT_R4K
412 select DMA_NONCOHERENT 429 select DMA_NONCOHERENT
413 select HW_HAS_PCI 430 select HW_HAS_PCI
414 select IRQ_CPU 431 select IRQ_CPU
@@ -536,6 +553,7 @@ config SNI_RM
536 select ARC32 if CPU_LITTLE_ENDIAN 553 select ARC32 if CPU_LITTLE_ENDIAN
537 select ARCH_MAY_HAVE_PC_FDC 554 select ARCH_MAY_HAVE_PC_FDC
538 select BOOT_ELF32 555 select BOOT_ELF32
556 select CEVT_R4K
539 select DMA_NONCOHERENT 557 select DMA_NONCOHERENT
540 select GENERIC_ISA_DMA 558 select GENERIC_ISA_DMA
541 select HW_HAS_EISA 559 select HW_HAS_EISA
@@ -577,6 +595,7 @@ config TOSHIBA_JMR3927
577 595
578config TOSHIBA_RBTX4927 596config TOSHIBA_RBTX4927
579 bool "Toshiba RBTX49[23]7 board" 597 bool "Toshiba RBTX49[23]7 board"
598 select CEVT_R4K
580 select DMA_NONCOHERENT 599 select DMA_NONCOHERENT
581 select HAS_TXX9_SERIAL 600 select HAS_TXX9_SERIAL
582 select HW_HAS_PCI 601 select HW_HAS_PCI
@@ -597,6 +616,7 @@ config TOSHIBA_RBTX4927
597 616
598config TOSHIBA_RBTX4938 617config TOSHIBA_RBTX4938
599 bool "Toshiba RBTX4938 board" 618 bool "Toshiba RBTX4938 board"
619 select CEVT_R4K
600 select DMA_NONCOHERENT 620 select DMA_NONCOHERENT
601 select HAS_TXX9_SERIAL 621 select HAS_TXX9_SERIAL
602 select HW_HAS_PCI 622 select HW_HAS_PCI
@@ -616,6 +636,7 @@ config TOSHIBA_RBTX4938
616 636
617config WR_PPMC 637config WR_PPMC
618 bool "Wind River PPMC board" 638 bool "Wind River PPMC board"
639 select CEVT_R4K
619 select IRQ_CPU 640 select IRQ_CPU
620 select BOOT_ELF32 641 select BOOT_ELF32
621 select DMA_NONCOHERENT 642 select DMA_NONCOHERENT
@@ -708,6 +729,9 @@ config ARCH_MAY_HAVE_PC_FDC
708config BOOT_RAW 729config BOOT_RAW
709 bool 730 bool
710 731
732config CEVT_R4K
733 bool
734
711config CFE 735config CFE
712 bool 736 bool
713 737
@@ -1788,7 +1812,7 @@ config KEXEC
1788 but it is independent of the system firmware. And like a reboot 1812 but it is independent of the system firmware. And like a reboot
1789 you can start any kernel with it, not just Linux. 1813 you can start any kernel with it, not just Linux.
1790 1814
1791 The name comes from the similiarity to the exec system call. 1815 The name comes from the similarity to the exec system call.
1792 1816
1793 It is an ongoing process to be certain the hardware in a machine 1817 It is an ongoing process to be certain the hardware in a machine
1794 is properly shutdown, so do not be surprised if this code does not 1818 is properly shutdown, so do not be surprised if this code does not
@@ -1981,7 +2005,7 @@ source "drivers/Kconfig"
1981 2005
1982source "fs/Kconfig" 2006source "fs/Kconfig"
1983 2007
1984source "arch/mips/oprofile/Kconfig" 2008source "kernel/Kconfig.instrumentation"
1985 2009
1986source "arch/mips/Kconfig.debug" 2010source "arch/mips/Kconfig.debug"
1987 2011
diff --git a/arch/mips/au1000/Kconfig b/arch/mips/au1000/Kconfig
index a23d4154da01..b36cec58a9a8 100644
--- a/arch/mips/au1000/Kconfig
+++ b/arch/mips/au1000/Kconfig
@@ -137,6 +137,7 @@ config SOC_AU1200
137config SOC_AU1X00 137config SOC_AU1X00
138 bool 138 bool
139 select 64BIT_PHYS_ADDR 139 select 64BIT_PHYS_ADDR
140 select CEVT_R4K
140 select IRQ_CPU 141 select IRQ_CPU
141 select SYS_HAS_CPU_MIPS32_R1 142 select SYS_HAS_CPU_MIPS32_R1
142 select SYS_SUPPORTS_32BIT_KERNEL 143 select SYS_SUPPORTS_32BIT_KERNEL
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c
index 5f48b0603796..bdf00e2a35e4 100644
--- a/arch/mips/au1000/pb1200/irqmap.c
+++ b/arch/mips/au1000/pb1200/irqmap.c
@@ -36,8 +36,8 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/random.h> 37#include <linux/random.h>
38#include <linux/delay.h> 38#include <linux/delay.h>
39#include <linux/bitops.h>
39 40
40#include <asm/bitops.h>
41#include <asm/bootinfo.h> 41#include <asm/bootinfo.h>
42#include <asm/io.h> 42#include <asm/io.h>
43#include <asm/mipsregs.h> 43#include <asm/mipsregs.h>
diff --git a/arch/mips/basler/excite/excite_irq.c b/arch/mips/basler/excite/excite_irq.c
index 1ecab6350421..4903e067916b 100644
--- a/arch/mips/basler/excite/excite_irq.c
+++ b/arch/mips/basler/excite/excite_irq.c
@@ -29,7 +29,7 @@
29#include <linux/timex.h> 29#include <linux/timex.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/random.h> 31#include <linux/random.h>
32#include <asm/bitops.h> 32#include <linux/bitops.h>
33#include <asm/bootinfo.h> 33#include <asm/bootinfo.h>
34#include <asm/io.h> 34#include <asm/io.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
index 0ab4676c8bd3..0c6f47b3fd94 100644
--- a/arch/mips/bcm47xx/time.c
+++ b/arch/mips/bcm47xx/time.c
@@ -46,10 +46,3 @@ void __init plat_time_init(void)
46 /* Set MIPS counter frequency for fixed_rate_gettimeoffset() */ 46 /* Set MIPS counter frequency for fixed_rate_gettimeoffset() */
47 mips_hpt_frequency = hz; 47 mips_hpt_frequency = hz;
48} 48}
49
50void __init
51plat_timer_setup(struct irqaction *irq)
52{
53 /* Enable the timer interrupt */
54 setup_irq(7, irq);
55}
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 49bcc58929ba..892d4c38fd0d 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -175,6 +175,7 @@ CONFIG_POSIX_MQUEUE=y
175CONFIG_IKCONFIG=y 175CONFIG_IKCONFIG=y
176CONFIG_IKCONFIG_PROC=y 176CONFIG_IKCONFIG_PROC=y
177CONFIG_LOG_BUF_SHIFT=15 177CONFIG_LOG_BUF_SHIFT=15
178CONFIG_CGROUPS=y
178CONFIG_CPUSETS=y 179CONFIG_CPUSETS=y
179CONFIG_SYSFS_DEPRECATED=y 180CONFIG_SYSFS_DEPRECATED=y
180CONFIG_RELAY=y 181CONFIG_RELAY=y
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 86dcb7464353..61b72f5a953e 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -1,71 +1,68 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20 3# Linux kernel version: 2.6.23
4# Tue Feb 20 21:47:35 2007 4# Thu Oct 18 22:45:52 2007
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_ZONE_DMA=y 11# CONFIG_MACH_ALCHEMY is not set
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 12# CONFIG_BASLER_EXCITE is not set
13# CONFIG_BCM47XX is not set
26# CONFIG_MIPS_COBALT is not set 14# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set 15# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set 16# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set
29# CONFIG_MIPS_ATLAS is not set 19# CONFIG_MIPS_ATLAS is not set
30# CONFIG_MIPS_MALTA is not set 20# CONFIG_MIPS_MALTA is not set
31# CONFIG_MIPS_SEAD is not set 21# CONFIG_MIPS_SEAD is not set
32# CONFIG_WR_PPMC is not set
33CONFIG_MIPS_SIM=y 22CONFIG_MIPS_SIM=y
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 23# CONFIG_MARKEINS is not set
35# CONFIG_MIPS_XXS1500 is not set 24# CONFIG_MACH_VR41XX is not set
36# CONFIG_PNX8550_JBS is not set 25# CONFIG_PNX8550_JBS is not set
37# CONFIG_PNX8550_STB810 is not set 26# CONFIG_PNX8550_STB810 is not set
38# CONFIG_MACH_VR41XX is not set 27# CONFIG_PMC_MSP is not set
39# CONFIG_PMC_YOSEMITE is not set 28# CONFIG_PMC_YOSEMITE is not set
40# CONFIG_QEMU is not set 29# CONFIG_QEMU is not set
41# CONFIG_MARKEINS is not set
42# CONFIG_SGI_IP22 is not set 30# CONFIG_SGI_IP22 is not set
43# CONFIG_SGI_IP27 is not set 31# CONFIG_SGI_IP27 is not set
44# CONFIG_SGI_IP32 is not set 32# CONFIG_SGI_IP32 is not set
45# CONFIG_SIBYTE_BIGSUR 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
46# CONFIG_SIBYTE_SWARM is not set 37# CONFIG_SIBYTE_SWARM is not set
38# CONFIG_SIBYTE_LITTLESUR is not set
47# CONFIG_SIBYTE_SENTOSA is not set 39# CONFIG_SIBYTE_SENTOSA is not set
48# CONFIG_SIBYTE_RHONE is not set
49# CONFIG_SIBYTE_CARMEL is not set
50# CONFIG_SIBYTE_PTSWARM is not set 40# CONFIG_SIBYTE_PTSWARM is not set
51# CONFIG_SIBYTE_LITTLESUR is not set 41# CONFIG_SIBYTE_BIGSUR is not set
52# CONFIG_SIBYTE_CRHINE is not set
53# CONFIG_SIBYTE_CRHONE is not set
54# CONFIG_SNI_RM is not set 42# CONFIG_SNI_RM is not set
55# CONFIG_TOSHIBA_JMR3927 is not set 43# CONFIG_TOSHIBA_JMR3927 is not set
56# CONFIG_TOSHIBA_RBTX4927 is not set 44# CONFIG_TOSHIBA_RBTX4927 is not set
57# CONFIG_TOSHIBA_RBTX4938 is not set 45# CONFIG_TOSHIBA_RBTX4938 is not set
46# CONFIG_WR_PPMC is not set
58CONFIG_RWSEM_GENERIC_SPINLOCK=y 47CONFIG_RWSEM_GENERIC_SPINLOCK=y
59# CONFIG_ARCH_HAS_ILOG2_U32 is not set 48# CONFIG_ARCH_HAS_ILOG2_U32 is not set
60# CONFIG_ARCH_HAS_ILOG2_U64 is not set 49# CONFIG_ARCH_HAS_ILOG2_U64 is not set
61CONFIG_GENERIC_FIND_NEXT_BIT=y 50CONFIG_GENERIC_FIND_NEXT_BIT=y
62CONFIG_GENERIC_HWEIGHT=y 51CONFIG_GENERIC_HWEIGHT=y
63CONFIG_GENERIC_CALIBRATE_DELAY=y 52CONFIG_GENERIC_CALIBRATE_DELAY=y
53CONFIG_GENERIC_CLOCKEVENTS=y
64CONFIG_GENERIC_TIME=y 54CONFIG_GENERIC_TIME=y
55CONFIG_GENERIC_CMOS_UPDATE=y
65CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 56CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
66# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set 57# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
58CONFIG_BOOT_RAW=y
59CONFIG_CEVT_R4K=y
67CONFIG_DMA_NONCOHERENT=y 60CONFIG_DMA_NONCOHERENT=y
68CONFIG_DMA_NEED_PCI_MAP_STATE=y 61CONFIG_DMA_NEED_PCI_MAP_STATE=y
62CONFIG_EARLY_PRINTK=y
63CONFIG_SYS_HAS_EARLY_PRINTK=y
64# CONFIG_HOTPLUG_CPU is not set
65# CONFIG_NO_IOPORT is not set
69# CONFIG_CPU_BIG_ENDIAN is not set 66# CONFIG_CPU_BIG_ENDIAN is not set
70CONFIG_CPU_LITTLE_ENDIAN=y 67CONFIG_CPU_LITTLE_ENDIAN=y
71CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y 68CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
@@ -76,6 +73,11 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5
76# 73#
77# CPU selection 74# CPU selection
78# 75#
76# CONFIG_TICK_ONESHOT is not set
77# CONFIG_NO_HZ is not set
78# CONFIG_HIGH_RES_TIMERS is not set
79CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
80# CONFIG_CPU_LOONGSON2 is not set
79CONFIG_CPU_MIPS32_R1=y 81CONFIG_CPU_MIPS32_R1=y
80# CONFIG_CPU_MIPS32_R2 is not set 82# CONFIG_CPU_MIPS32_R2 is not set
81# CONFIG_CPU_MIPS64_R1 is not set 83# CONFIG_CPU_MIPS64_R1 is not set
@@ -115,8 +117,8 @@ CONFIG_CPU_HAS_PREFETCH=y
115CONFIG_MIPS_MT_DISABLED=y 117CONFIG_MIPS_MT_DISABLED=y
116# CONFIG_MIPS_MT_SMP is not set 118# CONFIG_MIPS_MT_SMP is not set
117# CONFIG_MIPS_MT_SMTC is not set 119# CONFIG_MIPS_MT_SMTC is not set
120CONFIG_SYS_SUPPORTS_MULTITHREADING=y
118# CONFIG_MIPS_VPE_LOADER is not set 121# CONFIG_MIPS_VPE_LOADER is not set
119# CONFIG_64BIT_PHYS_ADDR is not set
120CONFIG_CPU_HAS_LLSC=y 122CONFIG_CPU_HAS_LLSC=y
121CONFIG_CPU_HAS_SYNC=y 123CONFIG_CPU_HAS_SYNC=y
122CONFIG_GENERIC_HARDIRQS=y 124CONFIG_GENERIC_HARDIRQS=y
@@ -130,50 +132,52 @@ CONFIG_FLATMEM_MANUAL=y
130CONFIG_FLATMEM=y 132CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y 133CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set 134# CONFIG_SPARSEMEM_STATIC is not set
135# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4 136CONFIG_SPLIT_PTLOCK_CPUS=4
134# CONFIG_RESOURCES_64BIT is not set 137# CONFIG_RESOURCES_64BIT is not set
135CONFIG_ZONE_DMA_FLAG=1 138CONFIG_ZONE_DMA_FLAG=0
139CONFIG_VIRT_TO_BUS=y
136# CONFIG_HZ_48 is not set 140# CONFIG_HZ_48 is not set
137# CONFIG_HZ_100 is not set 141CONFIG_HZ_100=y
138# CONFIG_HZ_128 is not set 142# CONFIG_HZ_128 is not set
139# CONFIG_HZ_250 is not set 143# CONFIG_HZ_250 is not set
140# CONFIG_HZ_256 is not set 144# CONFIG_HZ_256 is not set
141CONFIG_HZ_1000=y 145# CONFIG_HZ_1000 is not set
142# CONFIG_HZ_1024 is not set 146# CONFIG_HZ_1024 is not set
143CONFIG_SYS_SUPPORTS_ARBIT_HZ=y 147CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
144CONFIG_HZ=1000 148CONFIG_HZ=100
145CONFIG_PREEMPT_NONE=y 149CONFIG_PREEMPT_NONE=y
146# CONFIG_PREEMPT_VOLUNTARY is not set 150# CONFIG_PREEMPT_VOLUNTARY is not set
147# CONFIG_PREEMPT is not set 151# CONFIG_PREEMPT is not set
148# CONFIG_KEXEC is not set 152# CONFIG_KEXEC is not set
153# CONFIG_SECCOMP is not set
149CONFIG_LOCKDEP_SUPPORT=y 154CONFIG_LOCKDEP_SUPPORT=y
150CONFIG_STACKTRACE_SUPPORT=y 155CONFIG_STACKTRACE_SUPPORT=y
151CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 156CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
152 157
153# 158#
154# Code maturity level options 159# General setup
155# 160#
156CONFIG_EXPERIMENTAL=y 161CONFIG_EXPERIMENTAL=y
157CONFIG_BROKEN_ON_SMP=y 162CONFIG_BROKEN_ON_SMP=y
158CONFIG_INIT_ENV_ARG_LIMIT=32 163CONFIG_INIT_ENV_ARG_LIMIT=32
159
160#
161# General setup
162#
163CONFIG_LOCALVERSION="" 164CONFIG_LOCALVERSION=""
164CONFIG_LOCALVERSION_AUTO=y 165CONFIG_LOCALVERSION_AUTO=y
165CONFIG_SWAP=y 166# CONFIG_SWAP is not set
166CONFIG_SYSVIPC=y 167CONFIG_SYSVIPC=y
167# CONFIG_IPC_NS is not set
168CONFIG_SYSVIPC_SYSCTL=y 168CONFIG_SYSVIPC_SYSCTL=y
169# CONFIG_POSIX_MQUEUE is not set 169# CONFIG_POSIX_MQUEUE is not set
170# CONFIG_BSD_PROCESS_ACCT is not set 170# CONFIG_BSD_PROCESS_ACCT is not set
171# CONFIG_TASKSTATS is not set 171# CONFIG_TASKSTATS is not set
172# CONFIG_UTS_NS is not set 172# CONFIG_USER_NS is not set
173# CONFIG_AUDIT is not set 173# CONFIG_AUDIT is not set
174# CONFIG_IKCONFIG is not set 174# CONFIG_IKCONFIG is not set
175CONFIG_LOG_BUF_SHIFT=14
176CONFIG_FAIR_GROUP_SCHED=y
177CONFIG_FAIR_USER_SCHED=y
175CONFIG_SYSFS_DEPRECATED=y 178CONFIG_SYSFS_DEPRECATED=y
176# CONFIG_RELAY is not set 179# CONFIG_RELAY is not set
180# CONFIG_BLK_DEV_INITRD is not set
177# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 181# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
178CONFIG_SYSCTL=y 182CONFIG_SYSCTL=y
179CONFIG_EMBEDDED=y 183CONFIG_EMBEDDED=y
@@ -187,31 +191,29 @@ CONFIG_BUG=y
187CONFIG_ELF_CORE=y 191CONFIG_ELF_CORE=y
188CONFIG_BASE_FULL=y 192CONFIG_BASE_FULL=y
189CONFIG_FUTEX=y 193CONFIG_FUTEX=y
194CONFIG_ANON_INODES=y
190CONFIG_EPOLL=y 195CONFIG_EPOLL=y
196CONFIG_SIGNALFD=y
197CONFIG_EVENTFD=y
191CONFIG_SHMEM=y 198CONFIG_SHMEM=y
192CONFIG_SLAB=y
193CONFIG_VM_EVENT_COUNTERS=y 199CONFIG_VM_EVENT_COUNTERS=y
200CONFIG_SLAB=y
201# CONFIG_SLUB is not set
202# CONFIG_SLOB is not set
194CONFIG_RT_MUTEXES=y 203CONFIG_RT_MUTEXES=y
195# CONFIG_TINY_SHMEM is not set 204# CONFIG_TINY_SHMEM is not set
196CONFIG_BASE_SMALL=0 205CONFIG_BASE_SMALL=0
197# CONFIG_SLOB is not set
198
199#
200# Loadable module support
201#
202CONFIG_MODULES=y 206CONFIG_MODULES=y
203CONFIG_MODULE_UNLOAD=y 207CONFIG_MODULE_UNLOAD=y
204# CONFIG_MODULE_FORCE_UNLOAD is not set 208# CONFIG_MODULE_FORCE_UNLOAD is not set
205CONFIG_MODVERSIONS=y 209CONFIG_MODVERSIONS=y
206CONFIG_MODULE_SRCVERSION_ALL=y 210CONFIG_MODULE_SRCVERSION_ALL=y
207CONFIG_KMOD=y 211CONFIG_KMOD=y
208
209#
210# Block layer
211#
212CONFIG_BLOCK=y 212CONFIG_BLOCK=y
213# CONFIG_LBD is not set 213# CONFIG_LBD is not set
214# CONFIG_BLK_DEV_IO_TRACE is not set
214# CONFIG_LSF is not set 215# CONFIG_LSF is not set
216# CONFIG_BLK_DEV_BSG is not set
215 217
216# 218#
217# IO Schedulers 219# IO Schedulers
@@ -229,18 +231,11 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
229# 231#
230# Bus options (PCI, PCMCIA, EISA, ISA, TC) 232# Bus options (PCI, PCMCIA, EISA, ISA, TC)
231# 233#
234# CONFIG_ARCH_SUPPORTS_MSI is not set
232CONFIG_MMU=y 235CONFIG_MMU=y
233
234#
235# PCCARD (PCMCIA/CardBus) support
236#
237# CONFIG_PCCARD is not set 236# CONFIG_PCCARD is not set
238 237
239# 238#
240# PCI Hotplug Support
241#
242
243#
244# Executable file formats 239# Executable file formats
245# 240#
246CONFIG_BINFMT_ELF=y 241CONFIG_BINFMT_ELF=y
@@ -250,9 +245,8 @@ CONFIG_TRAD_SIGNALS=y
250# 245#
251# Power management options 246# Power management options
252# 247#
253CONFIG_PM=y 248# CONFIG_PM is not set
254# CONFIG_PM_LEGACY is not set 249CONFIG_SUSPEND_UP_POSSIBLE=y
255# CONFIG_PM_DEBUG is not set
256 250
257# 251#
258# Networking 252# Networking
@@ -262,75 +256,50 @@ CONFIG_NET=y
262# 256#
263# Networking options 257# Networking options
264# 258#
265# CONFIG_NETDEBUG is not set
266CONFIG_PACKET=y 259CONFIG_PACKET=y
267CONFIG_PACKET_MMAP=y 260CONFIG_PACKET_MMAP=y
268CONFIG_UNIX=y 261CONFIG_UNIX=y
269CONFIG_XFRM=y 262# CONFIG_NET_KEY is not set
270# CONFIG_XFRM_USER is not set
271# CONFIG_XFRM_SUB_POLICY is not set
272CONFIG_XFRM_MIGRATE=y
273CONFIG_NET_KEY=y
274CONFIG_NET_KEY_MIGRATE=y
275CONFIG_INET=y 263CONFIG_INET=y
276CONFIG_IP_MULTICAST=y 264CONFIG_IP_MULTICAST=y
277CONFIG_IP_ADVANCED_ROUTER=y 265CONFIG_IP_ADVANCED_ROUTER=y
278CONFIG_ASK_IP_FIB_HASH=y 266CONFIG_ASK_IP_FIB_HASH=y
279# CONFIG_IP_FIB_TRIE is not set 267# CONFIG_IP_FIB_TRIE is not set
280CONFIG_IP_FIB_HASH=y 268CONFIG_IP_FIB_HASH=y
281CONFIG_IP_MULTIPLE_TABLES=y 269# CONFIG_IP_MULTIPLE_TABLES is not set
282CONFIG_IP_ROUTE_MULTIPATH=y 270# CONFIG_IP_ROUTE_MULTIPATH is not set
283# CONFIG_IP_ROUTE_MULTIPATH_CACHED is not set 271# CONFIG_IP_ROUTE_VERBOSE is not set
284CONFIG_IP_ROUTE_VERBOSE=y
285CONFIG_IP_PNP=y 272CONFIG_IP_PNP=y
286CONFIG_IP_PNP_DHCP=y 273CONFIG_IP_PNP_DHCP=y
287CONFIG_IP_PNP_BOOTP=y 274CONFIG_IP_PNP_BOOTP=y
288# CONFIG_IP_PNP_RARP is not set 275# CONFIG_IP_PNP_RARP is not set
289# CONFIG_NET_IPIP is not set 276# CONFIG_NET_IPIP is not set
290# CONFIG_NET_IPGRE is not set 277# CONFIG_NET_IPGRE is not set
291CONFIG_IP_MROUTE=y 278# CONFIG_IP_MROUTE is not set
292CONFIG_IP_PIMSM_V1=y
293CONFIG_IP_PIMSM_V2=y
294# CONFIG_ARPD is not set 279# CONFIG_ARPD is not set
295CONFIG_SYN_COOKIES=y 280# CONFIG_SYN_COOKIES is not set
296# CONFIG_INET_AH is not set 281# CONFIG_INET_AH is not set
297# CONFIG_INET_ESP is not set 282# CONFIG_INET_ESP is not set
298# CONFIG_INET_IPCOMP is not set 283# CONFIG_INET_IPCOMP is not set
299# CONFIG_INET_XFRM_TUNNEL is not set 284# CONFIG_INET_XFRM_TUNNEL is not set
300# CONFIG_INET_TUNNEL is not set 285# CONFIG_INET_TUNNEL is not set
301CONFIG_INET_XFRM_MODE_TRANSPORT=m 286# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
302CONFIG_INET_XFRM_MODE_TUNNEL=m 287# CONFIG_INET_XFRM_MODE_TUNNEL is not set
303CONFIG_INET_XFRM_MODE_BEET=m 288# CONFIG_INET_XFRM_MODE_BEET is not set
289# CONFIG_INET_LRO is not set
304CONFIG_INET_DIAG=y 290CONFIG_INET_DIAG=y
305CONFIG_INET_TCP_DIAG=y 291CONFIG_INET_TCP_DIAG=y
306# CONFIG_TCP_CONG_ADVANCED is not set 292# CONFIG_TCP_CONG_ADVANCED is not set
307CONFIG_TCP_CONG_CUBIC=y 293CONFIG_TCP_CONG_CUBIC=y
308CONFIG_DEFAULT_TCP_CONG="cubic" 294CONFIG_DEFAULT_TCP_CONG="cubic"
309CONFIG_TCP_MD5SIG=y 295# CONFIG_TCP_MD5SIG is not set
310# CONFIG_IPV6 is not set 296# CONFIG_IPV6 is not set
311# CONFIG_INET6_XFRM_TUNNEL is not set 297# CONFIG_INET6_XFRM_TUNNEL is not set
312# CONFIG_INET6_TUNNEL is not set 298# CONFIG_INET6_TUNNEL is not set
313CONFIG_NETWORK_SECMARK=y 299# CONFIG_NETWORK_SECMARK is not set
314# CONFIG_NETFILTER is not set 300# CONFIG_NETFILTER is not set
315
316#
317# DCCP Configuration (EXPERIMENTAL)
318#
319# CONFIG_IP_DCCP is not set 301# CONFIG_IP_DCCP is not set
320 302# CONFIG_IP_SCTP is not set
321#
322# SCTP Configuration (EXPERIMENTAL)
323#
324CONFIG_IP_SCTP=m
325# CONFIG_SCTP_DBG_MSG is not set
326# CONFIG_SCTP_DBG_OBJCNT is not set
327# CONFIG_SCTP_HMAC_NONE is not set
328# CONFIG_SCTP_HMAC_SHA1 is not set
329CONFIG_SCTP_HMAC_MD5=y
330
331#
332# TIPC Configuration (EXPERIMENTAL)
333#
334# CONFIG_TIPC is not set 303# CONFIG_TIPC is not set
335# CONFIG_ATM is not set 304# CONFIG_ATM is not set
336# CONFIG_BRIDGE is not set 305# CONFIG_BRIDGE is not set
@@ -347,44 +316,7 @@ CONFIG_SCTP_HMAC_MD5=y
347# 316#
348# QoS and/or fair queueing 317# QoS and/or fair queueing
349# 318#
350CONFIG_NET_SCHED=y 319# CONFIG_NET_SCHED is not set
351CONFIG_NET_SCH_FIFO=y
352CONFIG_NET_SCH_CLK_JIFFIES=y
353# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
354# CONFIG_NET_SCH_CLK_CPU is not set
355
356#
357# Queueing/Scheduling
358#
359CONFIG_NET_SCH_CBQ=m
360CONFIG_NET_SCH_HTB=m
361CONFIG_NET_SCH_HFSC=m
362CONFIG_NET_SCH_PRIO=m
363CONFIG_NET_SCH_RED=m
364CONFIG_NET_SCH_SFQ=m
365CONFIG_NET_SCH_TEQL=m
366CONFIG_NET_SCH_TBF=m
367CONFIG_NET_SCH_GRED=m
368CONFIG_NET_SCH_DSMARK=m
369CONFIG_NET_SCH_NETEM=m
370CONFIG_NET_SCH_INGRESS=m
371
372#
373# Classification
374#
375CONFIG_NET_CLS=y
376CONFIG_NET_CLS_BASIC=m
377CONFIG_NET_CLS_TCINDEX=m
378CONFIG_NET_CLS_ROUTE4=m
379CONFIG_NET_CLS_ROUTE=y
380# CONFIG_NET_CLS_FW is not set
381# CONFIG_NET_CLS_U32 is not set
382# CONFIG_NET_CLS_RSVP is not set
383# CONFIG_NET_CLS_RSVP6 is not set
384# CONFIG_NET_EMATCH is not set
385# CONFIG_NET_CLS_ACT is not set
386# CONFIG_NET_CLS_POLICE is not set
387CONFIG_NET_ESTIMATOR=y
388 320
389# 321#
390# Network testing 322# Network testing
@@ -393,8 +325,17 @@ CONFIG_NET_ESTIMATOR=y
393# CONFIG_HAMRADIO is not set 325# CONFIG_HAMRADIO is not set
394# CONFIG_IRDA is not set 326# CONFIG_IRDA is not set
395# CONFIG_BT is not set 327# CONFIG_BT is not set
328# CONFIG_AF_RXRPC is not set
329
330#
331# Wireless
332#
333# CONFIG_CFG80211 is not set
334# CONFIG_WIRELESS_EXT is not set
335# CONFIG_MAC80211 is not set
396# CONFIG_IEEE80211 is not set 336# CONFIG_IEEE80211 is not set
397CONFIG_FIB_RULES=y 337# CONFIG_RFKILL is not set
338# CONFIG_NET_9P is not set
398 339
399# 340#
400# Device Drivers 341# Device Drivers
@@ -403,52 +344,25 @@ CONFIG_FIB_RULES=y
403# 344#
404# Generic Driver Options 345# Generic Driver Options
405# 346#
347CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
406# CONFIG_STANDALONE is not set 348# CONFIG_STANDALONE is not set
407# CONFIG_PREVENT_FIRMWARE_BUILD is not set 349# CONFIG_PREVENT_FIRMWARE_BUILD is not set
408# CONFIG_FW_LOADER is not set 350# CONFIG_FW_LOADER is not set
409# CONFIG_DEBUG_DRIVER is not set 351# CONFIG_DEBUG_DRIVER is not set
410# CONFIG_DEBUG_DEVRES is not set 352# CONFIG_DEBUG_DEVRES is not set
411# CONFIG_SYS_HYPERVISOR is not set 353# CONFIG_SYS_HYPERVISOR is not set
412
413#
414# Connector - unified userspace <-> kernelspace linker
415#
416# CONFIG_CONNECTOR is not set 354# CONFIG_CONNECTOR is not set
417
418#
419# Memory Technology Devices (MTD)
420#
421# CONFIG_MTD is not set 355# CONFIG_MTD is not set
422
423#
424# Parallel port support
425#
426# CONFIG_PARPORT is not set 356# CONFIG_PARPORT is not set
427 357CONFIG_BLK_DEV=y
428#
429# Plug and Play support
430#
431# CONFIG_PNPACPI is not set
432
433#
434# Block devices
435#
436# CONFIG_BLK_DEV_COW_COMMON is not set 358# CONFIG_BLK_DEV_COW_COMMON is not set
437CONFIG_BLK_DEV_LOOP=y 359CONFIG_BLK_DEV_LOOP=y
438# CONFIG_BLK_DEV_CRYPTOLOOP is not set 360# CONFIG_BLK_DEV_CRYPTOLOOP is not set
439CONFIG_BLK_DEV_NBD=y 361CONFIG_BLK_DEV_NBD=y
440# CONFIG_BLK_DEV_RAM is not set 362# CONFIG_BLK_DEV_RAM is not set
441# CONFIG_BLK_DEV_INITRD is not set
442# CONFIG_CDROM_PKTCDVD is not set 363# CONFIG_CDROM_PKTCDVD is not set
443# CONFIG_ATA_OVER_ETH is not set 364# CONFIG_ATA_OVER_ETH is not set
444 365# CONFIG_MISC_DEVICES is not set
445#
446# Misc devices
447#
448
449#
450# ATA/ATAPI/MFM/RLL support
451#
452# CONFIG_IDE is not set 366# CONFIG_IDE is not set
453 367
454# 368#
@@ -456,48 +370,29 @@ CONFIG_BLK_DEV_NBD=y
456# 370#
457# CONFIG_RAID_ATTRS is not set 371# CONFIG_RAID_ATTRS is not set
458# CONFIG_SCSI is not set 372# CONFIG_SCSI is not set
373# CONFIG_SCSI_DMA is not set
459# CONFIG_SCSI_NETLINK is not set 374# CONFIG_SCSI_NETLINK is not set
460
461#
462# Serial ATA (prod) and Parallel ATA (experimental) drivers
463#
464# CONFIG_ATA is not set 375# CONFIG_ATA is not set
465
466#
467# Multi-device support (RAID and LVM)
468#
469# CONFIG_MD is not set 376# CONFIG_MD is not set
470
471#
472# Fusion MPT device support
473#
474# CONFIG_FUSION is not set
475
476#
477# IEEE 1394 (FireWire) support
478#
479
480#
481# I2O device support
482#
483
484#
485# Network device support
486#
487CONFIG_NETDEVICES=y 377CONFIG_NETDEVICES=y
378# CONFIG_NETDEVICES_MULTIQUEUE is not set
488# CONFIG_DUMMY is not set 379# CONFIG_DUMMY is not set
489# CONFIG_BONDING is not set 380# CONFIG_BONDING is not set
381# CONFIG_MACVLAN is not set
490# CONFIG_EQUALIZER is not set 382# CONFIG_EQUALIZER is not set
491# CONFIG_TUN is not set 383# CONFIG_TUN is not set
384# CONFIG_VETH is not set
492# CONFIG_PHYLIB is not set 385# CONFIG_PHYLIB is not set
493
494#
495# Ethernet (10 or 100Mbit)
496#
497CONFIG_NET_ETHERNET=y 386CONFIG_NET_ETHERNET=y
498# CONFIG_MII is not set 387# CONFIG_MII is not set
388# CONFIG_AX88796 is not set
499CONFIG_MIPS_SIM_NET=y 389CONFIG_MIPS_SIM_NET=y
500# CONFIG_DM9000 is not set 390# CONFIG_DM9000 is not set
391# CONFIG_IBM_NEW_EMAC_ZMII is not set
392# CONFIG_IBM_NEW_EMAC_RGMII is not set
393# CONFIG_IBM_NEW_EMAC_TAH is not set
394# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
395# CONFIG_B44 is not set
501# CONFIG_NETDEV_1000 is not set 396# CONFIG_NETDEV_1000 is not set
502# CONFIG_NETDEV_10000 is not set 397# CONFIG_NETDEV_10000 is not set
503 398
@@ -513,49 +408,18 @@ CONFIG_MIPS_SIM_NET=y
513# CONFIG_NETCONSOLE is not set 408# CONFIG_NETCONSOLE is not set
514# CONFIG_NETPOLL is not set 409# CONFIG_NETPOLL is not set
515# CONFIG_NET_POLL_CONTROLLER is not set 410# CONFIG_NET_POLL_CONTROLLER is not set
516
517#
518# ISDN subsystem
519#
520# CONFIG_ISDN is not set 411# CONFIG_ISDN is not set
521
522#
523# Telephony Support
524#
525# CONFIG_PHONE is not set 412# CONFIG_PHONE is not set
526 413
527# 414#
528# Input device support 415# Input device support
529# 416#
530CONFIG_INPUT=y 417# CONFIG_INPUT is not set
531# CONFIG_INPUT_FF_MEMLESS is not set
532
533#
534# Userland interfaces
535#
536# CONFIG_INPUT_MOUSEDEV is not set
537# CONFIG_INPUT_JOYDEV is not set
538# CONFIG_INPUT_TSDEV is not set
539# CONFIG_INPUT_EVDEV is not set
540# CONFIG_INPUT_EVBUG is not set
541
542#
543# Input Device Drivers
544#
545# CONFIG_INPUT_KEYBOARD is not set
546# CONFIG_INPUT_MOUSE is not set
547# CONFIG_INPUT_JOYSTICK is not set
548# CONFIG_INPUT_TOUCHSCREEN is not set
549# CONFIG_INPUT_MISC is not set
550 418
551# 419#
552# Hardware I/O ports 420# Hardware I/O ports
553# 421#
554CONFIG_SERIO=y 422# CONFIG_SERIO is not set
555# CONFIG_SERIO_I8042 is not set
556CONFIG_SERIO_SERPORT=y
557# CONFIG_SERIO_LIBPS2 is not set
558# CONFIG_SERIO_RAW is not set
559# CONFIG_GAMEPORT is not set 423# CONFIG_GAMEPORT is not set
560 424
561# 425#
@@ -581,31 +445,13 @@ CONFIG_SERIAL_CORE_CONSOLE=y
581CONFIG_UNIX98_PTYS=y 445CONFIG_UNIX98_PTYS=y
582CONFIG_LEGACY_PTYS=y 446CONFIG_LEGACY_PTYS=y
583CONFIG_LEGACY_PTY_COUNT=256 447CONFIG_LEGACY_PTY_COUNT=256
584
585#
586# IPMI
587#
588# CONFIG_IPMI_HANDLER is not set 448# CONFIG_IPMI_HANDLER is not set
589
590#
591# Watchdog Cards
592#
593# CONFIG_WATCHDOG is not set 449# CONFIG_WATCHDOG is not set
594# CONFIG_HW_RANDOM is not set 450# CONFIG_HW_RANDOM is not set
595# CONFIG_RTC is not set 451# CONFIG_RTC is not set
596# CONFIG_GEN_RTC is not set
597# CONFIG_DTLK is not set
598# CONFIG_R3964 is not set 452# CONFIG_R3964 is not set
599# CONFIG_RAW_DRIVER is not set 453# CONFIG_RAW_DRIVER is not set
600
601#
602# TPM devices
603#
604# CONFIG_TCG_TPM is not set 454# CONFIG_TCG_TPM is not set
605
606#
607# I2C support
608#
609# CONFIG_I2C is not set 455# CONFIG_I2C is not set
610 456
611# 457#
@@ -613,118 +459,60 @@ CONFIG_LEGACY_PTY_COUNT=256
613# 459#
614# CONFIG_SPI is not set 460# CONFIG_SPI is not set
615# CONFIG_SPI_MASTER is not set 461# CONFIG_SPI_MASTER is not set
462# CONFIG_W1 is not set
463# CONFIG_POWER_SUPPLY is not set
464# CONFIG_HWMON is not set
616 465
617# 466#
618# Dallas's 1-wire bus 467# Sonics Silicon Backplane
619# 468#
620# CONFIG_W1 is not set 469CONFIG_SSB_POSSIBLE=y
470# CONFIG_SSB is not set
621 471
622# 472#
623# Hardware Monitoring support 473# Multifunction device drivers
624# 474#
625# CONFIG_HWMON is not set 475# CONFIG_MFD_SM501 is not set
626# CONFIG_HWMON_VID is not set
627 476
628# 477#
629# Multimedia devices 478# Multimedia devices
630# 479#
631# CONFIG_VIDEO_DEV is not set 480# CONFIG_VIDEO_DEV is not set
632 481# CONFIG_DVB_CORE is not set
633# 482# CONFIG_DAB is not set
634# Digital Video Broadcasting Devices
635#
636# CONFIG_DVB is not set
637 483
638# 484#
639# Graphics support 485# Graphics support
640# 486#
641# CONFIG_FIRMWARE_EDID is not set 487# CONFIG_VGASTATE is not set
488# CONFIG_VIDEO_OUTPUT_CONTROL is not set
642# CONFIG_FB is not set 489# CONFIG_FB is not set
490# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
643 491
644# 492#
645# Sound 493# Display device support
646# 494#
647# CONFIG_SOUND is not set 495# CONFIG_DISPLAY_SUPPORT is not set
648 496
649# 497#
650# HID Devices 498# Sound
651#
652# CONFIG_HID is not set
653
654#
655# USB support
656#
657# CONFIG_USB_ARCH_HAS_HCD is not set
658# CONFIG_USB_ARCH_HAS_OHCI is not set
659# CONFIG_USB_ARCH_HAS_EHCI is not set
660
661#
662# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
663#
664
665#
666# USB Gadget Support
667#
668# CONFIG_USB_GADGET is not set
669
670#
671# MMC/SD Card support
672# 499#
500# CONFIG_SOUND is not set
501# CONFIG_USB_SUPPORT is not set
673# CONFIG_MMC is not set 502# CONFIG_MMC is not set
674
675#
676# LED devices
677#
678# CONFIG_NEW_LEDS is not set 503# CONFIG_NEW_LEDS is not set
679 504CONFIG_RTC_LIB=y
680#
681# LED drivers
682#
683
684#
685# LED Triggers
686#
687
688#
689# InfiniBand support
690#
691
692#
693# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
694#
695
696#
697# Real Time Clock
698#
699# CONFIG_RTC_CLASS is not set 505# CONFIG_RTC_CLASS is not set
700 506
701# 507#
702# DMA Engine support 508# Userspace I/O
703#
704# CONFIG_DMA_ENGINE is not set
705
706#
707# DMA Clients
708#
709
710#
711# DMA Devices
712#
713
714#
715# Auxiliary Display support
716#
717
718#
719# Virtualization
720# 509#
510# CONFIG_UIO is not set
721 511
722# 512#
723# File systems 513# File systems
724# 514#
725CONFIG_EXT2_FS=y 515# CONFIG_EXT2_FS is not set
726# CONFIG_EXT2_FS_XATTR is not set
727# CONFIG_EXT2_FS_XIP is not set
728# CONFIG_EXT3_FS is not set 516# CONFIG_EXT3_FS is not set
729# CONFIG_EXT4DEV_FS is not set 517# CONFIG_EXT4DEV_FS is not set
730# CONFIG_REISERFS_FS is not set 518# CONFIG_REISERFS_FS is not set
@@ -732,6 +520,7 @@ CONFIG_EXT2_FS=y
732# CONFIG_FS_POSIX_ACL is not set 520# CONFIG_FS_POSIX_ACL is not set
733# CONFIG_XFS_FS is not set 521# CONFIG_XFS_FS is not set
734# CONFIG_GFS2_FS is not set 522# CONFIG_GFS2_FS is not set
523# CONFIG_OCFS2_FS is not set
735# CONFIG_MINIX_FS is not set 524# CONFIG_MINIX_FS is not set
736CONFIG_ROMFS_FS=y 525CONFIG_ROMFS_FS=y
737# CONFIG_INOTIFY is not set 526# CONFIG_INOTIFY is not set
@@ -760,10 +549,11 @@ CONFIG_ROMFS_FS=y
760CONFIG_PROC_FS=y 549CONFIG_PROC_FS=y
761# CONFIG_PROC_KCORE is not set 550# CONFIG_PROC_KCORE is not set
762CONFIG_PROC_SYSCTL=y 551CONFIG_PROC_SYSCTL=y
763# CONFIG_SYSFS is not set 552CONFIG_SYSFS=y
764# CONFIG_TMPFS is not set 553CONFIG_TMPFS=y
554# CONFIG_TMPFS_POSIX_ACL is not set
765# CONFIG_HUGETLB_PAGE is not set 555# CONFIG_HUGETLB_PAGE is not set
766CONFIG_RAMFS=y 556# CONFIG_CONFIGFS_FS is not set
767 557
768# 558#
769# Miscellaneous filesystems 559# Miscellaneous filesystems
@@ -781,10 +571,7 @@ CONFIG_RAMFS=y
781# CONFIG_QNX4FS_FS is not set 571# CONFIG_QNX4FS_FS is not set
782# CONFIG_SYSV_FS is not set 572# CONFIG_SYSV_FS is not set
783# CONFIG_UFS_FS is not set 573# CONFIG_UFS_FS is not set
784 574CONFIG_NETWORK_FILESYSTEMS=y
785#
786# Network File Systems
787#
788CONFIG_NFS_FS=y 575CONFIG_NFS_FS=y
789CONFIG_NFS_V3=y 576CONFIG_NFS_V3=y
790# CONFIG_NFS_V3_ACL is not set 577# CONFIG_NFS_V3_ACL is not set
@@ -796,6 +583,7 @@ CONFIG_LOCKD=y
796CONFIG_LOCKD_V4=y 583CONFIG_LOCKD_V4=y
797CONFIG_NFS_COMMON=y 584CONFIG_NFS_COMMON=y
798CONFIG_SUNRPC=y 585CONFIG_SUNRPC=y
586# CONFIG_SUNRPC_BIND34 is not set
799# CONFIG_RPCSEC_GSS_KRB5 is not set 587# CONFIG_RPCSEC_GSS_KRB5 is not set
800# CONFIG_RPCSEC_GSS_SPKM3 is not set 588# CONFIG_RPCSEC_GSS_SPKM3 is not set
801# CONFIG_SMB_FS is not set 589# CONFIG_SMB_FS is not set
@@ -803,22 +591,14 @@ CONFIG_SUNRPC=y
803# CONFIG_NCP_FS is not set 591# CONFIG_NCP_FS is not set
804# CONFIG_CODA_FS is not set 592# CONFIG_CODA_FS is not set
805# CONFIG_AFS_FS is not set 593# CONFIG_AFS_FS is not set
806# CONFIG_9P_FS is not set
807 594
808# 595#
809# Partition Types 596# Partition Types
810# 597#
811# CONFIG_PARTITION_ADVANCED is not set 598# CONFIG_PARTITION_ADVANCED is not set
812CONFIG_MSDOS_PARTITION=y 599CONFIG_MSDOS_PARTITION=y
813
814#
815# Native Language Support
816#
817# CONFIG_NLS is not set 600# CONFIG_NLS is not set
818 601# CONFIG_DLM is not set
819#
820# Distributed Lock Manager
821#
822 602
823# 603#
824# Profiling support 604# Profiling support
@@ -833,20 +613,22 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y
833CONFIG_ENABLE_MUST_CHECK=y 613CONFIG_ENABLE_MUST_CHECK=y
834# CONFIG_MAGIC_SYSRQ is not set 614# CONFIG_MAGIC_SYSRQ is not set
835# CONFIG_UNUSED_SYMBOLS is not set 615# CONFIG_UNUSED_SYMBOLS is not set
616# CONFIG_DEBUG_FS is not set
836# CONFIG_HEADERS_CHECK is not set 617# CONFIG_HEADERS_CHECK is not set
837CONFIG_DEBUG_KERNEL=y 618CONFIG_DEBUG_KERNEL=y
838# CONFIG_DEBUG_SHIRQ is not set 619# CONFIG_DEBUG_SHIRQ is not set
839CONFIG_LOG_BUF_SHIFT=14
840# CONFIG_DETECT_SOFTLOCKUP is not set 620# CONFIG_DETECT_SOFTLOCKUP is not set
621# CONFIG_SCHED_DEBUG is not set
841# CONFIG_SCHEDSTATS is not set 622# CONFIG_SCHEDSTATS is not set
842# CONFIG_TIMER_STATS is not set 623# CONFIG_TIMER_STATS is not set
843# CONFIG_DEBUG_SLAB is not set 624# CONFIG_DEBUG_SLAB is not set
844# CONFIG_DEBUG_RT_MUTEXES is not set 625# CONFIG_DEBUG_RT_MUTEXES is not set
845# CONFIG_RT_MUTEX_TESTER is not set 626# CONFIG_RT_MUTEX_TESTER is not set
846# CONFIG_DEBUG_SPINLOCK is not set 627# CONFIG_DEBUG_SPINLOCK is not set
847CONFIG_DEBUG_MUTEXES=y 628# CONFIG_DEBUG_MUTEXES is not set
848# CONFIG_DEBUG_LOCK_ALLOC is not set 629# CONFIG_DEBUG_LOCK_ALLOC is not set
849# CONFIG_PROVE_LOCKING is not set 630# CONFIG_PROVE_LOCKING is not set
631# CONFIG_LOCK_STAT is not set
850# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 632# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
851# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 633# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
852# CONFIG_DEBUG_KOBJECT is not set 634# CONFIG_DEBUG_KOBJECT is not set
@@ -854,7 +636,9 @@ CONFIG_DEBUG_INFO=y
854# CONFIG_DEBUG_VM is not set 636# CONFIG_DEBUG_VM is not set
855# CONFIG_DEBUG_LIST is not set 637# CONFIG_DEBUG_LIST is not set
856CONFIG_FORCED_INLINING=y 638CONFIG_FORCED_INLINING=y
639# CONFIG_BOOT_PRINTK_DELAY is not set
857# CONFIG_RCU_TORTURE_TEST is not set 640# CONFIG_RCU_TORTURE_TEST is not set
641# CONFIG_FAULT_INJECTION is not set
858CONFIG_CROSSCOMPILE=y 642CONFIG_CROSSCOMPILE=y
859CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp" 643CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp"
860# CONFIG_DEBUG_STACK_USAGE is not set 644# CONFIG_DEBUG_STACK_USAGE is not set
@@ -865,60 +649,20 @@ CONFIG_CMDLINE="nfsroot=192.168.192.169:/u1/mipsel,timeo=20 ip=dhcp"
865# Security options 649# Security options
866# 650#
867# CONFIG_KEYS is not set 651# CONFIG_KEYS is not set
868 652# CONFIG_SECURITY is not set
869# 653# CONFIG_SECURITY_FILE_CAPABILITIES is not set
870# Cryptographic options 654# CONFIG_CRYPTO is not set
871#
872CONFIG_CRYPTO=y
873CONFIG_CRYPTO_ALGAPI=y
874CONFIG_CRYPTO_BLKCIPHER=m
875CONFIG_CRYPTO_HASH=y
876CONFIG_CRYPTO_MANAGER=y
877CONFIG_CRYPTO_HMAC=y
878CONFIG_CRYPTO_XCBC=m
879# CONFIG_CRYPTO_NULL is not set
880# CONFIG_CRYPTO_MD4 is not set
881CONFIG_CRYPTO_MD5=y
882# CONFIG_CRYPTO_SHA1 is not set
883# CONFIG_CRYPTO_SHA256 is not set
884# CONFIG_CRYPTO_SHA512 is not set
885# CONFIG_CRYPTO_WP512 is not set
886# CONFIG_CRYPTO_TGR192 is not set
887CONFIG_CRYPTO_GF128MUL=m
888CONFIG_CRYPTO_ECB=m
889CONFIG_CRYPTO_CBC=m
890CONFIG_CRYPTO_PCBC=m
891CONFIG_CRYPTO_LRW=m
892# CONFIG_CRYPTO_DES is not set
893CONFIG_CRYPTO_FCRYPT=m
894# CONFIG_CRYPTO_BLOWFISH is not set
895# CONFIG_CRYPTO_TWOFISH is not set
896# CONFIG_CRYPTO_SERPENT is not set
897# CONFIG_CRYPTO_AES is not set
898# CONFIG_CRYPTO_CAST5 is not set
899# CONFIG_CRYPTO_CAST6 is not set
900# CONFIG_CRYPTO_TEA is not set
901# CONFIG_CRYPTO_ARC4 is not set
902# CONFIG_CRYPTO_KHAZAD is not set
903# CONFIG_CRYPTO_ANUBIS is not set
904# CONFIG_CRYPTO_DEFLATE is not set
905# CONFIG_CRYPTO_MICHAEL_MIC is not set
906# CONFIG_CRYPTO_CRC32C is not set
907CONFIG_CRYPTO_CAMELLIA=m
908# CONFIG_CRYPTO_TEST is not set
909
910#
911# Hardware crypto devices
912#
913 655
914# 656#
915# Library routines 657# Library routines
916# 658#
917CONFIG_BITREVERSE=y
918# CONFIG_CRC_CCITT is not set 659# CONFIG_CRC_CCITT is not set
919CONFIG_CRC16=y 660# CONFIG_CRC16 is not set
920CONFIG_CRC32=y 661# CONFIG_CRC_ITU_T is not set
662# CONFIG_CRC32 is not set
663# CONFIG_CRC7 is not set
921# CONFIG_LIBCRC32C is not set 664# CONFIG_LIBCRC32C is not set
922CONFIG_PLIST=y 665CONFIG_PLIST=y
923CONFIG_HAS_IOMEM=y 666CONFIG_HAS_IOMEM=y
924CONFIG_HAS_IOPORT=y 667CONFIG_HAS_IOPORT=y
668CONFIG_HAS_DMA=y
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 3ed991ae0ebe..49dfcef2518c 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -196,6 +196,7 @@ CONFIG_SYSVIPC_SYSCTL=y
196# CONFIG_UTS_NS is not set 196# CONFIG_UTS_NS is not set
197# CONFIG_AUDIT is not set 197# CONFIG_AUDIT is not set
198# CONFIG_IKCONFIG is not set 198# CONFIG_IKCONFIG is not set
199CONFIG_CGROUPS=y
199CONFIG_CPUSETS=y 200CONFIG_CPUSETS=y
200CONFIG_SYSFS_DEPRECATED=y 201CONFIG_SYSFS_DEPRECATED=y
201CONFIG_RELAY=y 202CONFIG_RELAY=y
diff --git a/arch/mips/emma2rh/markeins/setup.c b/arch/mips/emma2rh/markeins/setup.c
index 5e1da53b04a7..82f9e9013e70 100644
--- a/arch/mips/emma2rh/markeins/setup.c
+++ b/arch/mips/emma2rh/markeins/setup.c
@@ -104,12 +104,6 @@ void __init plat_time_init(void)
104 mips_hpt_frequency = (bus_frequency * (4 + reg)) / 4 / 2; 104 mips_hpt_frequency = (bus_frequency * (4 + reg)) / 4 / 2;
105} 105}
106 106
107void __init plat_timer_setup(struct irqaction *irq)
108{
109 /* we are using the cpu counter for timer interrupts */
110 setup_irq(CPU_IRQ_BASE + 7, irq);
111}
112
113static void markeins_board_init(void); 107static void markeins_board_init(void);
114extern void markeins_irq_setup(void); 108extern void markeins_irq_setup(void);
115 109
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 835b056cea36..ae25b480723e 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -4,7 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 Linus Torvalds 6 * Copyright (C) 1992 Linus Torvalds
7 * Copyright (C) 1994 - 2001, 2003 Ralf Baechle 7 * Copyright (C) 1994 - 2001, 2003, 07 Ralf Baechle
8 */ 8 */
9#include <linux/clockchips.h> 9#include <linux/clockchips.h>
10#include <linux/init.h> 10#include <linux/init.h>
@@ -13,6 +13,7 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14 14
15#include <asm/irq_cpu.h> 15#include <asm/irq_cpu.h>
16#include <asm/i8253.h>
16#include <asm/i8259.h> 17#include <asm/i8259.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/jazz.h> 19#include <asm/jazz.h>
@@ -136,7 +137,7 @@ static struct irqaction r4030_timer_irqaction = {
136 .name = "timer", 137 .name = "timer",
137}; 138};
138 139
139void __init plat_timer_setup(struct irqaction *ignored) 140void __init plat_time_init(void)
140{ 141{
141 struct irqaction *irq = &r4030_timer_irqaction; 142 struct irqaction *irq = &r4030_timer_irqaction;
142 143
@@ -152,4 +153,5 @@ void __init plat_timer_setup(struct irqaction *ignored)
152 setup_irq(JAZZ_TIMER_IRQ, irq); 153 setup_irq(JAZZ_TIMER_IRQ, irq);
153 154
154 clockevents_register_device(&r4030_clockevent); 155 clockevents_register_device(&r4030_clockevent);
156 setup_pit_timer();
155} 157}
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c
index cfc7dce78dab..a7857973ca03 100644
--- a/arch/mips/jazz/setup.c
+++ b/arch/mips/jazz/setup.c
@@ -5,7 +5,7 @@
5 * License. See the file "COPYING" in the main directory of this archive 5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details. 6 * for more details.
7 * 7 *
8 * Copyright (C) 1996, 1997, 1998, 2001 by Ralf Baechle 8 * Copyright (C) 1996, 1997, 1998, 2001, 07 by Ralf Baechle
9 * Copyright (C) 2001 MIPS Technologies, Inc. 9 * Copyright (C) 2001 MIPS Technologies, Inc.
10 * Copyright (C) 2007 by Thomas Bogendoerfer 10 * Copyright (C) 2007 by Thomas Bogendoerfer
11 */ 11 */
@@ -25,7 +25,6 @@
25#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
26 26
27#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
28#include <asm/i8253.h>
29#include <asm/irq.h> 28#include <asm/irq.h>
30#include <asm/jazz.h> 29#include <asm/jazz.h>
31#include <asm/jazzdma.h> 30#include <asm/jazzdma.h>
@@ -64,11 +63,6 @@ static struct resource jazz_io_resources[] = {
64 } 63 }
65}; 64};
66 65
67void __init plat_time_init(void)
68{
69 setup_pit_timer();
70}
71
72void __init plat_mem_setup(void) 66void __init plat_mem_setup(void)
73{ 67{
74 int i; 68 int i;
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 0c7aee1682cd..edb9e59248ec 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -1,15 +1,4 @@
1/*********************************************************************** 1/*
2 *
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: MontaVista Software, Inc.
5 * ahennessy@mvista.com
6 *
7 * Based on arch/mips/ddb5xxx/ddb5477/setup.c
8 *
9 * Setup file for JMR3927.
10 *
11 * Copyright (C) 2000-2001 Toshiba Corporation
12 *
13 * This program is free software; you can redistribute it and/or modify it 2 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the 3 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your 4 * Free Software Foundation; either version 2 of the License, or (at your
@@ -30,9 +19,15 @@
30 * with this program; if not, write to the Free Software Foundation, Inc., 19 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA. 20 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 * 21 *
33 *********************************************************************** 22 * Copyright 2001 MontaVista Software Inc.
23 * Author: MontaVista Software, Inc.
24 * ahennessy@mvista.com
25 *
26 * Copyright (C) 2000-2001 Toshiba Corporation
27 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
34 */ 28 */
35 29
30#include <linux/clockchips.h>
36#include <linux/init.h> 31#include <linux/init.h>
37#include <linux/kernel.h> 32#include <linux/kernel.h>
38#include <linux/kdev_t.h> 33#include <linux/kdev_t.h>
@@ -104,27 +99,60 @@ static cycle_t jmr3927_hpt_read(void)
104 return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; 99 return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr;
105} 100}
106 101
107static void jmr3927_timer_ack(void) 102static void jmr3927_set_mode(enum clock_event_mode mode,
103 struct clock_event_device *evt)
104{
105 /* Nothing to do here */
106}
107
108struct clock_event_device jmr3927_clock_event_device = {
109 .name = "MIPS",
110 .features = CLOCK_EVT_FEAT_PERIODIC,
111 .shift = 32,
112 .rating = 300,
113 .cpumask = CPU_MASK_CPU0,
114 .irq = JMR3927_IRQ_TICK,
115 .set_mode = jmr3927_set_mode,
116};
117
118static irqreturn_t jmr3927_timer_interrupt(int irq, void *dev_id)
108{ 119{
120 struct clock_event_device *cd = &jmr3927_clock_event_device;
121
109 jmr3927_tmrptr->tisr = 0; /* ack interrupt */ 122 jmr3927_tmrptr->tisr = 0; /* ack interrupt */
123
124 cd->event_handler(cd);
125
126 return IRQ_HANDLED;
110} 127}
111 128
129static struct irqaction jmr3927_timer_irqaction = {
130 .handler = jmr3927_timer_interrupt,
131 .flags = IRQF_DISABLED | IRQF_PERCPU,
132 .name = "jmr3927-timer",
133};
134
112void __init plat_time_init(void) 135void __init plat_time_init(void)
113{ 136{
137 struct clock_event_device *cd;
138
114 clocksource_mips.read = jmr3927_hpt_read; 139 clocksource_mips.read = jmr3927_hpt_read;
115 mips_timer_ack = jmr3927_timer_ack;
116 mips_hpt_frequency = JMR3927_TIMER_CLK; 140 mips_hpt_frequency = JMR3927_TIMER_CLK;
117}
118 141
119void __init plat_timer_setup(struct irqaction *irq)
120{
121 jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ; 142 jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ;
122 jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE; 143 jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE;
123 jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD; 144 jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD;
124 jmr3927_tmrptr->tcr = 145 jmr3927_tmrptr->tcr =
125 TXx927_TMTCR_TCE | TXx927_TMTCR_CCDE | TXx927_TMTCR_TMODE_ITVL; 146 TXx927_TMTCR_TCE | TXx927_TMTCR_CCDE | TXx927_TMTCR_TMODE_ITVL;
126 147
127 setup_irq(JMR3927_IRQ_TICK, irq); 148 cd = &jmr3927_clock_event_device;
149 /* Calculate the min / max delta */
150 cd->mult = div_sc((unsigned long) JMR3927_IMCLK, NSEC_PER_SEC, 32);
151 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
152 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
153 clockevents_register_device(cd);
154
155 setup_irq(JMR3927_IRQ_TICK, &jmr3927_timer_irqaction);
128} 156}
129 157
130#define DO_WRITE_THROUGH 158#define DO_WRITE_THROUGH
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 95a356ef3910..a3afa39faae5 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -8,6 +8,8 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
8 ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \ 8 ptrace.o reset.o semaphore.o setup.o signal.o syscall.o \
9 time.o topology.o traps.o unaligned.o 9 time.o topology.o traps.o unaligned.o
10 10
11obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o
12
11binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ 13binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \
12 irix5sys.o sysirix.o 14 irix5sys.o sysirix.o
13 15
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
new file mode 100644
index 000000000000..a915e5693421
--- /dev/null
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -0,0 +1,273 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 MIPS Technologies, Inc.
7 * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org>
8 */
9#include <linux/clockchips.h>
10#include <linux/interrupt.h>
11#include <linux/percpu.h>
12
13#include <asm/smtc_ipi.h>
14#include <asm/time.h>
15
16static int mips_next_event(unsigned long delta,
17 struct clock_event_device *evt)
18{
19 unsigned int cnt;
20 int res;
21
22#ifdef CONFIG_MIPS_MT_SMTC
23 {
24 unsigned long flags, vpflags;
25 local_irq_save(flags);
26 vpflags = dvpe();
27#endif
28 cnt = read_c0_count();
29 cnt += delta;
30 write_c0_compare(cnt);
31 res = ((long)(read_c0_count() - cnt ) > 0) ? -ETIME : 0;
32#ifdef CONFIG_MIPS_MT_SMTC
33 evpe(vpflags);
34 local_irq_restore(flags);
35 }
36#endif
37 return res;
38}
39
40static void mips_set_mode(enum clock_event_mode mode,
41 struct clock_event_device *evt)
42{
43 /* Nothing to do ... */
44}
45
46static DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
47static int cp0_timer_irq_installed;
48
49/*
50 * Timer ack for an R4k-compatible timer of a known frequency.
51 */
52static void c0_timer_ack(void)
53{
54 write_c0_compare(read_c0_compare());
55}
56
57/*
58 * Possibly handle a performance counter interrupt.
59 * Return true if the timer interrupt should not be checked
60 */
61static inline int handle_perf_irq(int r2)
62{
63 /*
64 * The performance counter overflow interrupt may be shared with the
65 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
66 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
67 * and we can't reliably determine if a counter interrupt has also
68 * happened (!r2) then don't check for a timer interrupt.
69 */
70 return (cp0_perfcount_irq < 0) &&
71 perf_irq() == IRQ_HANDLED &&
72 !r2;
73}
74
75static irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
76{
77 const int r2 = cpu_has_mips_r2;
78 struct clock_event_device *cd;
79 int cpu = smp_processor_id();
80
81 /*
82 * Suckage alert:
83 * Before R2 of the architecture there was no way to see if a
84 * performance counter interrupt was pending, so we have to run
85 * the performance counter interrupt handler anyway.
86 */
87 if (handle_perf_irq(r2))
88 goto out;
89
90 /*
91 * The same applies to performance counter interrupts. But with the
92 * above we now know that the reason we got here must be a timer
93 * interrupt. Being the paranoiacs we are we check anyway.
94 */
95 if (!r2 || (read_c0_cause() & (1 << 30))) {
96 c0_timer_ack();
97#ifdef CONFIG_MIPS_MT_SMTC
98 if (cpu_data[cpu].vpe_id)
99 goto out;
100 cpu = 0;
101#endif
102 cd = &per_cpu(mips_clockevent_device, cpu);
103 cd->event_handler(cd);
104 }
105
106out:
107 return IRQ_HANDLED;
108}
109
110static struct irqaction c0_compare_irqaction = {
111 .handler = c0_compare_interrupt,
112#ifdef CONFIG_MIPS_MT_SMTC
113 .flags = IRQF_DISABLED,
114#else
115 .flags = IRQF_DISABLED | IRQF_PERCPU,
116#endif
117 .name = "timer",
118};
119
120#ifdef CONFIG_MIPS_MT_SMTC
121DEFINE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device);
122
123static void smtc_set_mode(enum clock_event_mode mode,
124 struct clock_event_device *evt)
125{
126}
127
128static void mips_broadcast(cpumask_t mask)
129{
130 unsigned int cpu;
131
132 for_each_cpu_mask(cpu, mask)
133 smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
134}
135
136static void setup_smtc_dummy_clockevent_device(void)
137{
138 //uint64_t mips_freq = mips_hpt_^frequency;
139 unsigned int cpu = smp_processor_id();
140 struct clock_event_device *cd;
141
142 cd = &per_cpu(smtc_dummy_clockevent_device, cpu);
143
144 cd->name = "SMTC";
145 cd->features = CLOCK_EVT_FEAT_DUMMY;
146
147 /* Calculate the min / max delta */
148 cd->mult = 0; //div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
149 cd->shift = 0; //32;
150 cd->max_delta_ns = 0; //clockevent_delta2ns(0x7fffffff, cd);
151 cd->min_delta_ns = 0; //clockevent_delta2ns(0x30, cd);
152
153 cd->rating = 200;
154 cd->irq = 17; //-1;
155// if (cpu)
156// cd->cpumask = CPU_MASK_ALL; // cpumask_of_cpu(cpu);
157// else
158 cd->cpumask = cpumask_of_cpu(cpu);
159
160 cd->set_mode = smtc_set_mode;
161
162 cd->broadcast = mips_broadcast;
163
164 clockevents_register_device(cd);
165}
166#endif
167
168static void mips_event_handler(struct clock_event_device *dev)
169{
170}
171
172/*
173 * FIXME: This doesn't hold for the relocated E9000 compare interrupt.
174 */
175static int c0_compare_int_pending(void)
176{
177 return (read_c0_cause() >> cp0_compare_irq) & 0x100;
178}
179
180static int c0_compare_int_usable(void)
181{
182 const unsigned int delta = 0x300000;
183 unsigned int cnt;
184
185 /*
186 * IP7 already pending? Try to clear it by acking the timer.
187 */
188 if (c0_compare_int_pending()) {
189 write_c0_compare(read_c0_compare());
190 irq_disable_hazard();
191 if (c0_compare_int_pending())
192 return 0;
193 }
194
195 cnt = read_c0_count();
196 cnt += delta;
197 write_c0_compare(cnt);
198
199 while ((long)(read_c0_count() - cnt) <= 0)
200 ; /* Wait for expiry */
201
202 if (!c0_compare_int_pending())
203 return 0;
204
205 write_c0_compare(read_c0_compare());
206 irq_disable_hazard();
207 if (c0_compare_int_pending())
208 return 0;
209
210 /*
211 * Feels like a real count / compare timer.
212 */
213 return 1;
214}
215
216void __cpuinit mips_clockevent_init(void)
217{
218 uint64_t mips_freq = mips_hpt_frequency;
219 unsigned int cpu = smp_processor_id();
220 struct clock_event_device *cd;
221 unsigned int irq = MIPS_CPU_IRQ_BASE + 7;
222
223 if (!cpu_has_counter)
224 return;
225
226#ifdef CONFIG_MIPS_MT_SMTC
227 setup_smtc_dummy_clockevent_device();
228
229 /*
230 * On SMTC we only register VPE0's compare interrupt as clockevent
231 * device.
232 */
233 if (cpu)
234 return;
235#endif
236
237 if (!c0_compare_int_usable())
238 return;
239
240 cd = &per_cpu(mips_clockevent_device, cpu);
241
242 cd->name = "MIPS";
243 cd->features = CLOCK_EVT_FEAT_ONESHOT;
244
245 /* Calculate the min / max delta */
246 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
247 cd->shift = 32;
248 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
249 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
250
251 cd->rating = 300;
252 cd->irq = irq;
253#ifdef CONFIG_MIPS_MT_SMTC
254 cd->cpumask = CPU_MASK_ALL;
255#else
256 cd->cpumask = cpumask_of_cpu(cpu);
257#endif
258 cd->set_next_event = mips_next_event;
259 cd->set_mode = mips_set_mode;
260 cd->event_handler = mips_event_handler;
261
262 clockevents_register_device(cd);
263
264 if (!cp0_timer_irq_installed) {
265#ifdef CONFIG_MIPS_MT_SMTC
266#define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq)
267 setup_irq_smtc(irq, &c0_compare_irqaction, CPUCTR_IMASKBIT);
268#else
269 setup_irq(irq, &c0_compare_irqaction);
270#endif /* CONFIG_MIPS_MT_SMTC */
271 cp0_timer_irq_installed = 1;
272 }
273}
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index bf164a562acb..236768731063 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -27,16 +27,6 @@
27 27
28#include <kernel-entry-init.h> 28#include <kernel-entry-init.h>
29 29
30 .macro ARC64_TWIDDLE_PC
31#if defined(CONFIG_ARC64) || defined(CONFIG_MAPPED_KERNEL)
32 /* We get launched at a XKPHYS address but the kernel is linked to
33 run at a KSEG0 address, so jump there. */
34 PTR_LA t0, \@f
35 jr t0
36\@:
37#endif
38 .endm
39
40 /* 30 /*
41 * inputs are the text nasid in t1, data nasid in t2. 31 * inputs are the text nasid in t1, data nasid in t2.
42 */ 32 */
@@ -157,7 +147,11 @@ NESTED(kernel_entry, 16, sp) # kernel entry point
157 147
158 setup_c0_status_pri 148 setup_c0_status_pri
159 149
160 ARC64_TWIDDLE_PC 150 /* We might not get launched at the address the kernel is linked to,
151 so we jump there. */
152 PTR_LA t0, 0f
153 jr t0
1540:
161 155
162#ifdef CONFIG_MIPS_MT_SMTC 156#ifdef CONFIG_MIPS_MT_SMTC
163 /* 157 /*
diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c
index b997af713eb3..7852c7cdf29e 100644
--- a/arch/mips/kernel/irixelf.c
+++ b/arch/mips/kernel/irixelf.c
@@ -1172,8 +1172,8 @@ static int irix_core_dump(long signr, struct pt_regs *regs, struct file *file, u
1172 prstatus.pr_sighold = current->blocked.sig[0]; 1172 prstatus.pr_sighold = current->blocked.sig[0];
1173 psinfo.pr_pid = prstatus.pr_pid = current->pid; 1173 psinfo.pr_pid = prstatus.pr_pid = current->pid;
1174 psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid; 1174 psinfo.pr_ppid = prstatus.pr_ppid = current->parent->pid;
1175 psinfo.pr_pgrp = prstatus.pr_pgrp = process_group(current); 1175 psinfo.pr_pgrp = prstatus.pr_pgrp = task_pgrp_nr(current);
1176 psinfo.pr_sid = prstatus.pr_sid = process_session(current); 1176 psinfo.pr_sid = prstatus.pr_sid = task_session_nr(current);
1177 if (current->pid == current->tgid) { 1177 if (current->pid == current->tgid) {
1178 /* 1178 /*
1179 * This is the record for the group leader. Add in the 1179 * This is the record for the group leader. Add in the
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 85c2e389edd6..a0a91056fda7 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -609,7 +609,7 @@ repeat:
609 p = list_entry(_p, struct task_struct, sibling); 609 p = list_entry(_p, struct task_struct, sibling);
610 if ((type == IRIX_P_PID) && p->pid != pid) 610 if ((type == IRIX_P_PID) && p->pid != pid)
611 continue; 611 continue;
612 if ((type == IRIX_P_PGID) && process_group(p) != pid) 612 if ((type == IRIX_P_PGID) && task_pgrp_nr(p) != pid)
613 continue; 613 continue;
614 if ((p->exit_signal != SIGCHLD)) 614 if ((p->exit_signal != SIGCHLD))
615 continue; 615 continue;
diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index cb0801437b66..e7ed0ac48537 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -381,7 +381,7 @@ const struct exception_table_entry *search_module_dbetables(unsigned long addr)
381 return e; 381 return e;
382} 382}
383 383
384/* Put in dbe list if neccessary. */ 384/* Put in dbe list if necessary. */
385int module_finalize(const Elf_Ehdr *hdr, 385int module_finalize(const Elf_Ehdr *hdr,
386 const Elf_Shdr *sechdrs, 386 const Elf_Shdr *sechdrs,
387 struct module *me) 387 struct module *me)
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index ee7790d9debe..4c477c7ff74a 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -763,11 +763,11 @@ asmlinkage int irix_setpgrp(int flags)
763 printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags); 763 printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags);
764#endif 764#endif
765 if(!flags) 765 if(!flags)
766 error = process_group(current); 766 error = task_pgrp_nr(current);
767 else 767 else
768 error = sys_setsid(); 768 error = sys_setsid();
769#ifdef DEBUG_PROCGRPS 769#ifdef DEBUG_PROCGRPS
770 printk("returning %d\n", process_group(current)); 770 printk("returning %d\n", task_pgrp_nr(current));
771#endif 771#endif
772 772
773 return error; 773 return error;
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index e4b5e647b142..c4e6866d5cbc 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -40,17 +40,6 @@
40#include <irq.h> 40#include <irq.h>
41 41
42/* 42/*
43 * The integer part of the number of usecs per jiffy is taken from tick,
44 * but the fractional part is not recorded, so we calculate it using the
45 * initial value of HZ. This aids systems where tick isn't really an
46 * integer (e.g. for HZ = 128).
47 */
48#define USECS_PER_JIFFY TICK_SIZE
49#define USECS_PER_JIFFY_FRAC ((unsigned long)(u32)((1000000ULL << 32) / HZ))
50
51#define TICK_SIZE (tick_nsec / 1000)
52
53/*
54 * forward reference 43 * forward reference
55 */ 44 */
56DEFINE_SPINLOCK(rtc_lock); 45DEFINE_SPINLOCK(rtc_lock);
@@ -72,14 +61,6 @@ int update_persistent_clock(struct timespec now)
72 return rtc_mips_set_mmss(now.tv_sec); 61 return rtc_mips_set_mmss(now.tv_sec);
73} 62}
74 63
75/* how many counter cycles in a jiffy */
76static unsigned long cycles_per_jiffy __read_mostly;
77
78/*
79 * Null timer ack for systems not needing one (e.g. i8254).
80 */
81static void null_timer_ack(void) { /* nothing */ }
82
83/* 64/*
84 * Null high precision timer functions for systems lacking one. 65 * Null high precision timer functions for systems lacking one.
85 */ 66 */
@@ -89,14 +70,6 @@ static cycle_t null_hpt_read(void)
89} 70}
90 71
91/* 72/*
92 * Timer ack for an R4k-compatible timer of a known frequency.
93 */
94static void c0_timer_ack(void)
95{
96 write_c0_compare(read_c0_compare());
97}
98
99/*
100 * High precision timer functions for a R4k-compatible timer. 73 * High precision timer functions for a R4k-compatible timer.
101 */ 74 */
102static cycle_t c0_hpt_read(void) 75static cycle_t c0_hpt_read(void)
@@ -105,7 +78,6 @@ static cycle_t c0_hpt_read(void)
105} 78}
106 79
107int (*mips_timer_state)(void); 80int (*mips_timer_state)(void);
108void (*mips_timer_ack)(void);
109 81
110/* 82/*
111 * local_timer_interrupt() does profiling and process accounting 83 * local_timer_interrupt() does profiling and process accounting
@@ -135,35 +107,6 @@ int (*perf_irq)(void) = null_perf_irq;
135EXPORT_SYMBOL(perf_irq); 107EXPORT_SYMBOL(perf_irq);
136 108
137/* 109/*
138 * Timer interrupt
139 */
140int cp0_compare_irq;
141
142/*
143 * Performance counter IRQ or -1 if shared with timer
144 */
145int cp0_perfcount_irq;
146EXPORT_SYMBOL_GPL(cp0_perfcount_irq);
147
148/*
149 * Possibly handle a performance counter interrupt.
150 * Return true if the timer interrupt should not be checked
151 */
152static inline int handle_perf_irq(int r2)
153{
154 /*
155 * The performance counter overflow interrupt may be shared with the
156 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
157 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
158 * and we can't reliably determine if a counter interrupt has also
159 * happened (!r2) then don't check for a timer interrupt.
160 */
161 return (cp0_perfcount_irq < 0) &&
162 perf_irq() == IRQ_HANDLED &&
163 !r2;
164}
165
166/*
167 * time_init() - it does the following things. 110 * time_init() - it does the following things.
168 * 111 *
169 * 1) plat_time_init() - 112 * 1) plat_time_init() -
@@ -228,270 +171,58 @@ struct clocksource clocksource_mips = {
228 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 171 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
229}; 172};
230 173
231static int mips_next_event(unsigned long delta, 174void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
232 struct clock_event_device *evt)
233{ 175{
234 unsigned int cnt; 176 u64 temp;
235 int res; 177 u32 shift;
236
237#ifdef CONFIG_MIPS_MT_SMTC
238 {
239 unsigned long flags, vpflags;
240 local_irq_save(flags);
241 vpflags = dvpe();
242#endif
243 cnt = read_c0_count();
244 cnt += delta;
245 write_c0_compare(cnt);
246 res = ((long)(read_c0_count() - cnt ) > 0) ? -ETIME : 0;
247#ifdef CONFIG_MIPS_MT_SMTC
248 evpe(vpflags);
249 local_irq_restore(flags);
250 }
251#endif
252 return res;
253}
254
255static void mips_set_mode(enum clock_event_mode mode,
256 struct clock_event_device *evt)
257{
258 /* Nothing to do ... */
259}
260
261static DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
262static int cp0_timer_irq_installed;
263
264static irqreturn_t timer_interrupt(int irq, void *dev_id)
265{
266 const int r2 = cpu_has_mips_r2;
267 struct clock_event_device *cd;
268 int cpu = smp_processor_id();
269
270 /*
271 * Suckage alert:
272 * Before R2 of the architecture there was no way to see if a
273 * performance counter interrupt was pending, so we have to run
274 * the performance counter interrupt handler anyway.
275 */
276 if (handle_perf_irq(r2))
277 goto out;
278 178
279 /* 179 /* Find a shift value */
280 * The same applies to performance counter interrupts. But with the 180 for (shift = 32; shift > 0; shift--) {
281 * above we now know that the reason we got here must be a timer 181 temp = (u64) NSEC_PER_SEC << shift;
282 * interrupt. Being the paranoiacs we are we check anyway. 182 do_div(temp, clock);
283 */ 183 if ((temp >> 32) == 0)
284 if (!r2 || (read_c0_cause() & (1 << 30))) { 184 break;
285 c0_timer_ack();
286#ifdef CONFIG_MIPS_MT_SMTC
287 if (cpu_data[cpu].vpe_id)
288 goto out;
289 cpu = 0;
290#endif
291 cd = &per_cpu(mips_clockevent_device, cpu);
292 cd->event_handler(cd);
293 } 185 }
294 186 cs->shift = shift;
295out: 187 cs->mult = (u32) temp;
296 return IRQ_HANDLED;
297} 188}
298 189
299static struct irqaction timer_irqaction = { 190void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
300 .handler = timer_interrupt, 191 unsigned int clock)
301#ifdef CONFIG_MIPS_MT_SMTC
302 .flags = IRQF_DISABLED,
303#else
304 .flags = IRQF_DISABLED | IRQF_PERCPU,
305#endif
306 .name = "timer",
307};
308
309static void __init init_mips_clocksource(void)
310{ 192{
311 u64 temp; 193 u64 temp;
312 u32 shift; 194 u32 shift;
313 195
314 if (!mips_hpt_frequency || clocksource_mips.read == null_hpt_read)
315 return;
316
317 /* Calclate a somewhat reasonable rating value */
318 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
319 /* Find a shift value */ 196 /* Find a shift value */
320 for (shift = 32; shift > 0; shift--) { 197 for (shift = 32; shift > 0; shift--) {
321 temp = (u64) NSEC_PER_SEC << shift; 198 temp = (u64) NSEC_PER_SEC << shift;
322 do_div(temp, mips_hpt_frequency); 199 do_div(temp, clock);
323 if ((temp >> 32) == 0) 200 if ((temp >> 32) == 0)
324 break; 201 break;
325 } 202 }
326 clocksource_mips.shift = shift; 203 cd->shift = shift;
327 clocksource_mips.mult = (u32)temp; 204 cd->mult = (u32) temp;
328
329 clocksource_register(&clocksource_mips);
330}
331
332void __init __weak plat_time_init(void)
333{
334} 205}
335 206
336void __init __weak plat_timer_setup(struct irqaction *irq) 207static void __init init_mips_clocksource(void)
337{
338}
339
340#ifdef CONFIG_MIPS_MT_SMTC
341DEFINE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device);
342
343static void smtc_set_mode(enum clock_event_mode mode,
344 struct clock_event_device *evt)
345{
346}
347
348int dummycnt[NR_CPUS];
349
350static void mips_broadcast(cpumask_t mask)
351{
352 unsigned int cpu;
353
354 for_each_cpu_mask(cpu, mask)
355 smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
356}
357
358static void setup_smtc_dummy_clockevent_device(void)
359{ 208{
360 //uint64_t mips_freq = mips_hpt_^frequency; 209 if (!mips_hpt_frequency || clocksource_mips.read == null_hpt_read)
361 unsigned int cpu = smp_processor_id(); 210 return;
362 struct clock_event_device *cd;
363
364 cd = &per_cpu(smtc_dummy_clockevent_device, cpu);
365
366 cd->name = "SMTC";
367 cd->features = CLOCK_EVT_FEAT_DUMMY;
368
369 /* Calculate the min / max delta */
370 cd->mult = 0; //div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
371 cd->shift = 0; //32;
372 cd->max_delta_ns = 0; //clockevent_delta2ns(0x7fffffff, cd);
373 cd->min_delta_ns = 0; //clockevent_delta2ns(0x30, cd);
374
375 cd->rating = 200;
376 cd->irq = 17; //-1;
377// if (cpu)
378// cd->cpumask = CPU_MASK_ALL; // cpumask_of_cpu(cpu);
379// else
380 cd->cpumask = cpumask_of_cpu(cpu);
381
382 cd->set_mode = smtc_set_mode;
383
384 cd->broadcast = mips_broadcast;
385 211
386 clockevents_register_device(cd); 212 /* Calclate a somewhat reasonable rating value */
387} 213 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
388#endif
389 214
390static void mips_event_handler(struct clock_event_device *dev) 215 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
391{
392}
393 216
394/* 217 clocksource_register(&clocksource_mips);
395 * FIXME: This doesn't hold for the relocated E9000 compare interrupt.
396 */
397static int c0_compare_int_pending(void)
398{
399 return (read_c0_cause() >> cp0_compare_irq) & 0x100;
400} 218}
401 219
402static int c0_compare_int_usable(void) 220void __init __weak plat_time_init(void)
403{ 221{
404 const unsigned int delta = 0x300000;
405 unsigned int cnt;
406
407 /*
408 * IP7 already pending? Try to clear it by acking the timer.
409 */
410 if (c0_compare_int_pending()) {
411 write_c0_compare(read_c0_compare());
412 irq_disable_hazard();
413 if (c0_compare_int_pending())
414 return 0;
415 }
416
417 cnt = read_c0_count();
418 cnt += delta;
419 write_c0_compare(cnt);
420
421 while ((long)(read_c0_count() - cnt) <= 0)
422 ; /* Wait for expiry */
423
424 if (!c0_compare_int_pending())
425 return 0;
426
427 write_c0_compare(read_c0_compare());
428 irq_disable_hazard();
429 if (c0_compare_int_pending())
430 return 0;
431
432 /*
433 * Feels like a real count / compare timer.
434 */
435 return 1;
436} 222}
437 223
438void __cpuinit mips_clockevent_init(void) 224void __init __weak plat_timer_setup(struct irqaction *irq)
439{ 225{
440 uint64_t mips_freq = mips_hpt_frequency;
441 unsigned int cpu = smp_processor_id();
442 struct clock_event_device *cd;
443 unsigned int irq = MIPS_CPU_IRQ_BASE + 7;
444
445 if (!cpu_has_counter)
446 return;
447
448#ifdef CONFIG_MIPS_MT_SMTC
449 setup_smtc_dummy_clockevent_device();
450
451 /*
452 * On SMTC we only register VPE0's compare interrupt as clockevent
453 * device.
454 */
455 if (cpu)
456 return;
457#endif
458
459 if (!c0_compare_int_usable())
460 return;
461
462 cd = &per_cpu(mips_clockevent_device, cpu);
463
464 cd->name = "MIPS";
465 cd->features = CLOCK_EVT_FEAT_ONESHOT;
466
467 /* Calculate the min / max delta */
468 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
469 cd->shift = 32;
470 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
471 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
472
473 cd->rating = 300;
474 cd->irq = irq;
475#ifdef CONFIG_MIPS_MT_SMTC
476 cd->cpumask = CPU_MASK_ALL;
477#else
478 cd->cpumask = cpumask_of_cpu(cpu);
479#endif
480 cd->set_next_event = mips_next_event;
481 cd->set_mode = mips_set_mode;
482 cd->event_handler = mips_event_handler;
483
484 clockevents_register_device(cd);
485
486 if (!cp0_timer_irq_installed) {
487#ifdef CONFIG_MIPS_MT_SMTC
488#define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq)
489 setup_irq_smtc(irq, &timer_irqaction, CPUCTR_IMASKBIT);
490#else
491 setup_irq(irq, &timer_irqaction);
492#endif /* CONFIG_MIPS_MT_SMTC */
493 cp0_timer_irq_installed = 1;
494 }
495} 226}
496 227
497void __init time_init(void) 228void __init time_init(void)
@@ -512,14 +243,6 @@ void __init time_init(void)
512 if (!clocksource_mips.read) { 243 if (!clocksource_mips.read) {
513 /* No external high precision timer -- use R4k. */ 244 /* No external high precision timer -- use R4k. */
514 clocksource_mips.read = c0_hpt_read; 245 clocksource_mips.read = c0_hpt_read;
515
516 if (!mips_timer_state) {
517 /* No external timer interrupt -- use R4k. */
518 mips_timer_ack = c0_timer_ack;
519 /* Calculate cache parameters. */
520 cycles_per_jiffy =
521 (mips_hpt_frequency + HZ / 2) / HZ;
522 }
523 } 246 }
524 if (!mips_hpt_frequency) 247 if (!mips_hpt_frequency)
525 mips_hpt_frequency = calibrate_hpt(); 248 mips_hpt_frequency = calibrate_hpt();
@@ -528,29 +251,8 @@ void __init time_init(void)
528 printk("Using %u.%03u MHz high precision timer.\n", 251 printk("Using %u.%03u MHz high precision timer.\n",
529 ((mips_hpt_frequency + 500) / 1000) / 1000, 252 ((mips_hpt_frequency + 500) / 1000) / 1000,
530 ((mips_hpt_frequency + 500) / 1000) % 1000); 253 ((mips_hpt_frequency + 500) / 1000) % 1000);
531
532#ifdef CONFIG_IRQ_CPU
533 setup_irq(MIPS_CPU_IRQ_BASE + 7, &timer_irqaction);
534#endif
535 } 254 }
536 255
537 if (!mips_timer_ack)
538 /* No timer interrupt ack (e.g. i8254). */
539 mips_timer_ack = null_timer_ack;
540
541 /*
542 * Call board specific timer interrupt setup.
543 *
544 * this pointer must be setup in machine setup routine.
545 *
546 * Even if a machine chooses to use a low-level timer interrupt,
547 * it still needs to setup the timer_irqaction.
548 * In that case, it might be better to set timer_irqaction.handler
549 * to be NULL function so that we are sure the high-level code
550 * is not invoked accidentally.
551 */
552 plat_timer_setup(&timer_irqaction);
553
554 init_mips_clocksource(); 256 init_mips_clocksource();
555 mips_clockevent_init(); 257 mips_clockevent_init();
556} 258}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index bbf01b81a4ff..fa500787152d 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -314,7 +314,7 @@ void show_registers(const struct pt_regs *regs)
314 __show_regs(regs); 314 __show_regs(regs);
315 print_modules(); 315 print_modules();
316 printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n", 316 printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
317 current->comm, current->pid, current_thread_info(), current); 317 current->comm, task_pid_nr(current), current_thread_info(), current);
318 show_stacktrace(current, regs); 318 show_stacktrace(current, regs);
319 show_code((unsigned int __user *) regs->cp0_epc); 319 show_code((unsigned int __user *) regs->cp0_epc);
320 printk("\n"); 320 printk("\n");
@@ -1336,6 +1336,17 @@ extern void cpu_cache_init(void);
1336extern void tlb_init(void); 1336extern void tlb_init(void);
1337extern void flush_tlb_handlers(void); 1337extern void flush_tlb_handlers(void);
1338 1338
1339/*
1340 * Timer interrupt
1341 */
1342int cp0_compare_irq;
1343
1344/*
1345 * Performance counter IRQ or -1 if shared with timer
1346 */
1347int cp0_perfcount_irq;
1348EXPORT_SYMBOL_GPL(cp0_perfcount_irq);
1349
1339void __init per_cpu_trap_init(void) 1350void __init per_cpu_trap_init(void)
1340{ 1351{
1341 unsigned int cpu = smp_processor_id(); 1352 unsigned int cpu = smp_processor_id();
diff --git a/arch/mips/lemote/lm2e/setup.c b/arch/mips/lemote/lm2e/setup.c
index 09314a20f9fb..2cc6745991ab 100644
--- a/arch/mips/lemote/lm2e/setup.c
+++ b/arch/mips/lemote/lm2e/setup.c
@@ -53,11 +53,6 @@ unsigned long bus_clock;
53unsigned int memsize; 53unsigned int memsize;
54unsigned int highmemsize = 0; 54unsigned int highmemsize = 0;
55 55
56void __init plat_timer_setup(struct irqaction *irq)
57{
58 setup_irq(MIPS_CPU_IRQ_BASE + 7, irq);
59}
60
61void __init plat_time_init(void) 56void __init plat_time_init(void)
62{ 57{
63 /* setup mips r4k timer */ 58 /* setup mips r4k timer */
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 5699c7713e2f..fa636fc6b7b9 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -173,7 +173,7 @@ no_context:
173 */ 173 */
174out_of_memory: 174out_of_memory:
175 up_read(&mm->mmap_sem); 175 up_read(&mm->mmap_sem);
176 if (is_init(tsk)) { 176 if (is_global_init(tsk)) {
177 yield(); 177 yield();
178 down_read(&mm->mmap_sem); 178 down_read(&mm->mmap_sem);
179 goto survive; 179 goto survive;
diff --git a/arch/mips/oprofile/Kconfig b/arch/mips/oprofile/Kconfig
deleted file mode 100644
index fb6f235348b0..000000000000
--- a/arch/mips/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING && !MIPS_MT_SMTC && EXPERIMENTAL
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/mips/pci/pci-excite.c b/arch/mips/pci/pci-excite.c
index 3c86c77cb74f..8a56876afcc6 100644
--- a/arch/mips/pci/pci-excite.c
+++ b/arch/mips/pci/pci-excite.c
@@ -131,7 +131,7 @@ static int __init basler_excite_pci_setup(void)
131 ocd_writel(0x00000000, bar + 0x100); 131 ocd_writel(0x00000000, bar + 0x100);
132 } 132 }
133 133
134 /* Finally, enable the PCI interupt */ 134 /* Finally, enable the PCI interrupt */
135#if USB_IRQ > 7 135#if USB_IRQ > 7
136 set_c0_intcontrol(1 << USB_IRQ); 136 set_c0_intcontrol(1 << USB_IRQ);
137#else 137#else
diff --git a/arch/mips/pmc-sierra/Kconfig b/arch/mips/pmc-sierra/Kconfig
index abbd0bbfabd7..6b293ce0935f 100644
--- a/arch/mips/pmc-sierra/Kconfig
+++ b/arch/mips/pmc-sierra/Kconfig
@@ -4,11 +4,13 @@ choice
4 4
5config PMC_MSP4200_EVAL 5config PMC_MSP4200_EVAL
6 bool "PMC-Sierra MSP4200 Eval Board" 6 bool "PMC-Sierra MSP4200 Eval Board"
7 select CEVT_R4K
7 select IRQ_MSP_SLP 8 select IRQ_MSP_SLP
8 select HW_HAS_PCI 9 select HW_HAS_PCI
9 10
10config PMC_MSP4200_GW 11config PMC_MSP4200_GW
11 bool "PMC-Sierra MSP4200 VoIP Gateway" 12 bool "PMC-Sierra MSP4200 VoIP Gateway"
13 select CEVT_R4K
12 select IRQ_MSP_SLP 14 select IRQ_MSP_SLP
13 select HW_HAS_PCI 15 select HW_HAS_PCI
14 16
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_time.c b/arch/mips/pmc-sierra/msp71xx/msp_time.c
index f221d4763625..7cfeda5a651b 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_time.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_time.c
@@ -86,8 +86,5 @@ void __init plat_timer_setup(struct irqaction *irq)
86#ifdef CONFIG_IRQ_MSP_CIC 86#ifdef CONFIG_IRQ_MSP_CIC
87 /* we are using the vpe0 counter for timer interrupts */ 87 /* we are using the vpe0 counter for timer interrupts */
88 setup_irq(MSP_INT_VPE0_TIMER, irq); 88 setup_irq(MSP_INT_VPE0_TIMER, irq);
89#else
90 /* we are using the mips counter for timer interrupts */
91 setup_irq(MSP_INT_TIMER, irq);
92#endif 89#endif
93} 90}
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 015fcc363dc0..855977ca51cd 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -137,11 +137,6 @@ int rtc_mips_set_time(unsigned long tim)
137 return 0; 137 return 0;
138} 138}
139 139
140void __init plat_timer_setup(struct irqaction *irq)
141{
142 setup_irq(7, irq);
143}
144
145void __init plat_time_init(void) 140void __init plat_time_init(void)
146{ 141{
147 mips_hpt_frequency = cpu_clock_freq / 2; 142 mips_hpt_frequency = cpu_clock_freq / 2;
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 856649cf9f1e..1bb692a3b319 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -374,14 +374,13 @@ int __devinit request_bridge_irq(struct bridge_controller *bc)
374 return irq; 374 return irq;
375} 375}
376 376
377extern void ip27_rt_timer_interrupt(void);
378
379asmlinkage void plat_irq_dispatch(void) 377asmlinkage void plat_irq_dispatch(void)
380{ 378{
381 unsigned long pending = read_c0_cause() & read_c0_status(); 379 unsigned long pending = read_c0_cause() & read_c0_status();
380 extern unsigned int rt_timer_irq;
382 381
383 if (pending & CAUSEF_IP4) 382 if (pending & CAUSEF_IP4)
384 ip27_rt_timer_interrupt(); 383 do_IRQ(rt_timer_irq);
385 else if (pending & CAUSEF_IP2) /* PI_INT_PEND_0 or CC_PEND_{A|B} */ 384 else if (pending & CAUSEF_IP2) /* PI_INT_PEND_0 or CC_PEND_{A|B} */
386 ip27_do_irq_mask0(); 385 ip27_do_irq_mask0();
387 else if (pending & CAUSEF_IP3) /* PI_INT_PEND_1 */ 386 else if (pending & CAUSEF_IP3) /* PI_INT_PEND_1 */
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c
index b7b3479b6bce..d467bf4f6c3f 100644
--- a/arch/mips/sgi-ip27/ip27-timer.c
+++ b/arch/mips/sgi-ip27/ip27-timer.c
@@ -3,6 +3,7 @@
3 * Copytight (C) 1999, 2000 Silicon Graphics, Inc. 3 * Copytight (C) 1999, 2000 Silicon Graphics, Inc.
4 */ 4 */
5#include <linux/bcd.h> 5#include <linux/bcd.h>
6#include <linux/clockchips.h>
6#include <linux/init.h> 7#include <linux/init.h>
7#include <linux/kernel.h> 8#include <linux/kernel.h>
8#include <linux/sched.h> 9#include <linux/sched.h>
@@ -25,22 +26,8 @@
25#include <asm/sn/sn0/ip27.h> 26#include <asm/sn/sn0/ip27.h>
26#include <asm/sn/sn0/hub.h> 27#include <asm/sn/sn0/hub.h>
27 28
28/*
29 * This is a hack; we really need to figure these values out dynamically
30 *
31 * Since 800 ns works very well with various HUB frequencies, such as
32 * 360, 380, 390 and 400 MHZ, we use 800 ns rtc cycle time.
33 *
34 * Ralf: which clock rate is used to feed the counter?
35 */
36#define NSEC_PER_CYCLE 800
37#define CYCLES_PER_SEC (NSEC_PER_SEC/NSEC_PER_CYCLE)
38#define CYCLES_PER_JIFFY (CYCLES_PER_SEC/HZ)
39
40#define TICK_SIZE (tick_nsec / 1000) 29#define TICK_SIZE (tick_nsec / 1000)
41 30
42static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */
43
44#if 0 31#if 0
45static int set_rtc_mmss(unsigned long nowtime) 32static int set_rtc_mmss(unsigned long nowtime)
46{ 33{
@@ -86,36 +73,6 @@ static int set_rtc_mmss(unsigned long nowtime)
86} 73}
87#endif 74#endif
88 75
89static unsigned int rt_timer_irq;
90
91void ip27_rt_timer_interrupt(void)
92{
93 int cpu = smp_processor_id();
94 int cpuA = cputoslice(cpu) == 0;
95 unsigned int irq = rt_timer_irq;
96
97 irq_enter();
98 write_seqlock(&xtime_lock);
99
100again:
101 LOCAL_HUB_S(cpuA ? PI_RT_PEND_A : PI_RT_PEND_B, 0); /* Ack */
102 ct_cur[cpu] += CYCLES_PER_JIFFY;
103 LOCAL_HUB_S(cpuA ? PI_RT_COMPARE_A : PI_RT_COMPARE_B, ct_cur[cpu]);
104
105 if (LOCAL_HUB_L(PI_RT_COUNT) >= ct_cur[cpu])
106 goto again;
107
108 kstat_this_cpu.irqs[irq]++; /* kstat only for bootcpu? */
109
110 if (cpu == 0)
111 do_timer(1);
112
113 update_process_times(user_mode(get_irq_regs()));
114
115 write_sequnlock(&xtime_lock);
116 irq_exit();
117}
118
119/* Includes for ioc3_init(). */ 76/* Includes for ioc3_init(). */
120#include <asm/sn/types.h> 77#include <asm/sn/types.h>
121#include <asm/sn/sn0/addrs.h> 78#include <asm/sn/sn0/addrs.h>
@@ -154,6 +111,46 @@ unsigned long read_persistent_clock(void)
154 return mktime(year, month, date, hour, min, sec); 111 return mktime(year, month, date, hour, min, sec);
155} 112}
156 113
114static int rt_set_next_event(unsigned long delta,
115 struct clock_event_device *evt)
116{
117 unsigned int cpu = smp_processor_id();
118 int slice = cputoslice(cpu) == 0;
119 unsigned long cnt;
120
121 cnt = LOCAL_HUB_L(PI_RT_COUNT);
122 cnt += delta;
123 LOCAL_HUB_S(slice ? PI_RT_COMPARE_A : PI_RT_COMPARE_B, cnt);
124
125 return LOCAL_HUB_L(PI_RT_COUNT) >= cnt ? -ETIME : 0;
126}
127
128static void rt_set_mode(enum clock_event_mode mode,
129 struct clock_event_device *evt)
130{
131 switch (mode) {
132 case CLOCK_EVT_MODE_PERIODIC:
133 /* The only mode supported */
134 break;
135
136 case CLOCK_EVT_MODE_UNUSED:
137 case CLOCK_EVT_MODE_SHUTDOWN:
138 case CLOCK_EVT_MODE_ONESHOT:
139 case CLOCK_EVT_MODE_RESUME:
140 /* Nothing to do */
141 break;
142 }
143}
144
145struct clock_event_device rt_clock_event_device = {
146 .name = "HUB-RT",
147 .features = CLOCK_EVT_FEAT_ONESHOT,
148
149 .rating = 300,
150 .set_next_event = rt_set_next_event,
151 .set_mode = rt_set_mode,
152};
153
157static void enable_rt_irq(unsigned int irq) 154static void enable_rt_irq(unsigned int irq)
158{ 155{
159} 156}
@@ -171,6 +168,20 @@ static struct irq_chip rt_irq_type = {
171 .eoi = enable_rt_irq, 168 .eoi = enable_rt_irq,
172}; 169};
173 170
171unsigned int rt_timer_irq;
172
173static irqreturn_t ip27_rt_timer_interrupt(int irq, void *dev_id)
174{
175 struct clock_event_device *cd = &rt_clock_event_device;
176 unsigned int cpu = smp_processor_id();
177 int slice = cputoslice(cpu) == 0;
178
179 LOCAL_HUB_S(slice ? PI_RT_PEND_A : PI_RT_PEND_B, 0); /* Ack */
180 cd->event_handler(cd);
181
182 return IRQ_HANDLED;
183}
184
174static struct irqaction rt_irqaction = { 185static struct irqaction rt_irqaction = {
175 .handler = (irq_handler_t) ip27_rt_timer_interrupt, 186 .handler = (irq_handler_t) ip27_rt_timer_interrupt,
176 .flags = IRQF_DISABLED, 187 .flags = IRQF_DISABLED,
@@ -178,26 +189,43 @@ static struct irqaction rt_irqaction = {
178 .name = "timer" 189 .name = "timer"
179}; 190};
180 191
181void __init plat_timer_setup(struct irqaction *irq) 192/*
193 * This is a hack; we really need to figure these values out dynamically
194 *
195 * Since 800 ns works very well with various HUB frequencies, such as
196 * 360, 380, 390 and 400 MHZ, we use 800 ns rtc cycle time.
197 *
198 * Ralf: which clock rate is used to feed the counter?
199 */
200#define NSEC_PER_CYCLE 800
201#define CYCLES_PER_SEC (NSEC_PER_SEC / NSEC_PER_CYCLE)
202
203static void __init ip27_rt_clock_event_init(void)
182{ 204{
183 int irqno = allocate_irqno(); 205 struct clock_event_device *cd = &rt_clock_event_device;
206 unsigned int cpu = smp_processor_id();
207 int irq = allocate_irqno();
184 208
185 if (irqno < 0) 209 if (irq < 0)
186 panic("Can't allocate interrupt number for timer interrupt"); 210 panic("Can't allocate interrupt number for timer interrupt");
187 211
188 set_irq_chip_and_handler(irqno, &rt_irq_type, handle_percpu_irq); 212 rt_timer_irq = irq;
189 213
190 /* over-write the handler, we use our own way */ 214 cd->irq = irq,
191 irq->handler = no_action; 215 cd->cpumask = cpumask_of_cpu(cpu),
192 216
193 /* setup irqaction */
194 irq_desc[irqno].status |= IRQ_PER_CPU;
195
196 rt_timer_irq = irqno;
197 /* 217 /*
198 * Only needed to get /proc/interrupt to display timer irq stats 218 * Calculate the min / max delta
199 */ 219 */
200 setup_irq(irqno, &rt_irqaction); 220 cd->mult =
221 div_sc((unsigned long) CYCLES_PER_SEC, NSEC_PER_SEC, 32);
222 cd->shift = 32;
223 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
224 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
225 clockevents_register_device(cd);
226
227 set_irq_chip_and_handler(irq, &rt_irq_type, handle_percpu_irq);
228 setup_irq(irq, &rt_irqaction);
201} 229}
202 230
203static cycle_t hub_rt_read(void) 231static cycle_t hub_rt_read(void)
@@ -206,7 +234,7 @@ static cycle_t hub_rt_read(void)
206} 234}
207 235
208struct clocksource ht_rt_clocksource = { 236struct clocksource ht_rt_clocksource = {
209 .name = "HUB", 237 .name = "HUB-RT",
210 .rating = 200, 238 .rating = 200,
211 .read = hub_rt_read, 239 .read = hub_rt_read,
212 .mask = CLOCKSOURCE_MASK(52), 240 .mask = CLOCKSOURCE_MASK(52),
@@ -214,11 +242,17 @@ struct clocksource ht_rt_clocksource = {
214 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 242 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
215}; 243};
216 244
217void __init plat_time_init(void) 245static void __init ip27_rt_clocksource_init(void)
218{ 246{
219 clocksource_register(&ht_rt_clocksource); 247 clocksource_register(&ht_rt_clocksource);
220} 248}
221 249
250void __init plat_time_init(void)
251{
252 ip27_rt_clock_event_init();
253 ip27_rt_clocksource_init();
254}
255
222void __init cpu_time_init(void) 256void __init cpu_time_init(void)
223{ 257{
224 lboard_t *board; 258 lboard_t *board;
@@ -248,17 +282,12 @@ void __init hub_rtc_init(cnodeid_t cnode)
248 * node and timeouts will not happen there. 282 * node and timeouts will not happen there.
249 */ 283 */
250 if (get_compact_nodeid() == cnode) { 284 if (get_compact_nodeid() == cnode) {
251 int cpu = smp_processor_id();
252 LOCAL_HUB_S(PI_RT_EN_A, 1); 285 LOCAL_HUB_S(PI_RT_EN_A, 1);
253 LOCAL_HUB_S(PI_RT_EN_B, 1); 286 LOCAL_HUB_S(PI_RT_EN_B, 1);
254 LOCAL_HUB_S(PI_PROF_EN_A, 0); 287 LOCAL_HUB_S(PI_PROF_EN_A, 0);
255 LOCAL_HUB_S(PI_PROF_EN_B, 0); 288 LOCAL_HUB_S(PI_PROF_EN_B, 0);
256 ct_cur[cpu] = CYCLES_PER_JIFFY;
257 LOCAL_HUB_S(PI_RT_COMPARE_A, ct_cur[cpu]);
258 LOCAL_HUB_S(PI_RT_COUNT, 0); 289 LOCAL_HUB_S(PI_RT_COUNT, 0);
259 LOCAL_HUB_S(PI_RT_PEND_A, 0); 290 LOCAL_HUB_S(PI_RT_PEND_A, 0);
260 LOCAL_HUB_S(PI_RT_COMPARE_B, ct_cur[cpu]);
261 LOCAL_HUB_S(PI_RT_COUNT, 0);
262 LOCAL_HUB_S(PI_RT_PEND_B, 0); 291 LOCAL_HUB_S(PI_RT_PEND_B, 0);
263 } 292 }
264} 293}
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index fc75bfcb0c0e..1024bf40bd9e 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -80,12 +80,6 @@ void __init plat_time_init(void)
80 printk("%d MHz CPU detected\n", mips_hpt_frequency * 2 / 1000000); 80 printk("%d MHz CPU detected\n", mips_hpt_frequency * 2 / 1000000);
81} 81}
82 82
83void __init plat_timer_setup(struct irqaction *irq)
84{
85 irq->handler = no_action;
86 setup_irq(MIPS_CPU_IRQ_BASE + 7, irq);
87}
88
89void __init plat_mem_setup(void) 83void __init plat_mem_setup(void)
90{ 84{
91 board_be_init = ip32_be_init; 85 board_be_init = ip32_be_init;
diff --git a/arch/mips/sibyte/bcm1480/smp.c b/arch/mips/sibyte/bcm1480/smp.c
index 6eac36d1b8c8..02b266a31c46 100644
--- a/arch/mips/sibyte/bcm1480/smp.c
+++ b/arch/mips/sibyte/bcm1480/smp.c
@@ -69,8 +69,9 @@ void bcm1480_smp_init(void)
69 69
70void bcm1480_smp_finish(void) 70void bcm1480_smp_finish(void)
71{ 71{
72 extern void bcm1480_time_init(void); 72 extern void sb1480_clockevent_init(void);
73 bcm1480_time_init(); 73
74 sb1480_clockevent_init();
74 local_irq_enable(); 75 local_irq_enable();
75} 76}
76 77
diff --git a/arch/mips/sibyte/bcm1480/time.c b/arch/mips/sibyte/bcm1480/time.c
index 5b4bfbbb5a24..c730744aa474 100644
--- a/arch/mips/sibyte/bcm1480/time.c
+++ b/arch/mips/sibyte/bcm1480/time.c
@@ -27,9 +27,8 @@
27 */ 27 */
28#include <linux/clockchips.h> 28#include <linux/clockchips.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/sched.h> 30#include <linux/percpu.h>
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/kernel_stat.h>
33 32
34#include <asm/irq.h> 33#include <asm/irq.h>
35#include <asm/addrspace.h> 34#include <asm/addrspace.h>
@@ -101,25 +100,36 @@ static void sibyte_set_mode(enum clock_event_mode mode,
101 break; 100 break;
102 101
103 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */ 102 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */
103 case CLOCK_EVT_MODE_RESUME:
104 ; 104 ;
105 } 105 }
106} 106}
107 107
108struct clock_event_device sibyte_hpt_clockevent = { 108static int sibyte_next_event(unsigned long delta, struct clock_event_device *cd)
109 .name = "bcm1480-counter", 109{
110 .features = CLOCK_EVT_FEAT_PERIODIC, 110 unsigned int cpu = smp_processor_id();
111 .set_mode = sibyte_set_mode, 111 void __iomem *timer_init;
112 .shift = 32, 112 unsigned int cnt;
113 .irq = 0, 113 int res;
114}; 114
115 timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
116 cnt = __raw_readq(timer_init);
117 cnt += delta;
118 __raw_writeq(cnt, timer_init);
119 res = ((long)(__raw_readq(timer_init) - cnt ) > 0) ? -ETIME : 0;
120
121 return res;
122}
123
124static DEFINE_PER_CPU(struct clock_event_device, sibyte_hpt_clockevent);
115 125
116static irqreturn_t sibyte_counter_handler(int irq, void *dev_id) 126static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
117{ 127{
118 struct clock_event_device *cd = &sibyte_hpt_clockevent;
119 unsigned int cpu = smp_processor_id(); 128 unsigned int cpu = smp_processor_id();
129 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
120 130
121 /* Reset the timer */ 131 /* Reset the timer */
122 __raw_writeq(M_SCD_TIMER_ENABLE|M_SCD_TIMER_MODE_CONTINUOUS, 132 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
123 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG))); 133 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
124 cd->event_handler(cd); 134 cd->event_handler(cd);
125 135
@@ -140,24 +150,21 @@ static struct irqaction sibyte_counter_irqaction = {
140 * called directly from irq_handler.S when IP[4] is set during an 150 * called directly from irq_handler.S when IP[4] is set during an
141 * interrupt 151 * interrupt
142 */ 152 */
143static void __init sb1480_clockevent_init(void) 153void __cpuinit sb1480_clockevent_init(void)
144{ 154{
145 unsigned int cpu = smp_processor_id(); 155 unsigned int cpu = smp_processor_id();
146 unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu; 156 unsigned int irq = K_BCM1480_INT_TIMER_0 + cpu;
157 struct clock_event_device *cd = &per_cpu(sibyte_hpt_clockevent, cpu);
147 158
148 setup_irq(irq, &sibyte_counter_irqaction); 159 cd->name = "bcm1480-counter";
149} 160 cd->features = CLOCK_EVT_FEAT_PERIODIC |
161 CLOCK_EVT_MODE_ONESHOT;
162 cd->set_next_event = sibyte_next_event;
163 cd->set_mode = sibyte_set_mode;
164 cd->irq = irq;
165 clockevent_set_clock(cd, BCM1480_HPT_VALUE);
150 166
151void bcm1480_timer_interrupt(void) 167 setup_irq(irq, &sibyte_counter_irqaction);
152{
153 int cpu = smp_processor_id();
154 int irq = K_BCM1480_INT_TIMER_0 + cpu;
155
156 /* Reset the timer */
157 __raw_writeq(M_SCD_TIMER_ENABLE|M_SCD_TIMER_MODE_CONTINUOUS,
158 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
159
160 ll_timer_interrupt(irq);
161} 168}
162 169
163static cycle_t bcm1480_hpt_read(void) 170static cycle_t bcm1480_hpt_read(void)
@@ -168,9 +175,26 @@ static cycle_t bcm1480_hpt_read(void)
168 return (jiffies + 1) * (BCM1480_HPT_VALUE / HZ) - count; 175 return (jiffies + 1) * (BCM1480_HPT_VALUE / HZ) - count;
169} 176}
170 177
178struct clocksource bcm1480_clocksource = {
179 .name = "MIPS",
180 .rating = 200,
181 .read = bcm1480_hpt_read,
182 .mask = CLOCKSOURCE_MASK(32),
183 .shift = 32,
184 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
185};
186
187void __init sb1480_clocksource_init(void)
188{
189 struct clocksource *cs = &bcm1480_clocksource;
190
191 clocksource_set_clock(cs, BCM1480_HPT_VALUE);
192 clocksource_register(cs);
193}
194
171void __init bcm1480_hpt_setup(void) 195void __init bcm1480_hpt_setup(void)
172{ 196{
173 clocksource_mips.read = bcm1480_hpt_read;
174 mips_hpt_frequency = BCM1480_HPT_VALUE; 197 mips_hpt_frequency = BCM1480_HPT_VALUE;
198 sb1480_clocksource_init();
175 sb1480_clockevent_init(); 199 sb1480_clockevent_init();
176} 200}
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index 7659174819c6..500d17e84c09 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -400,43 +400,11 @@ static void sb1250_kgdb_interrupt(void)
400 400
401#endif /* CONFIG_KGDB */ 401#endif /* CONFIG_KGDB */
402 402
403static inline void sb1250_timer_interrupt(void)
404{
405 int cpu = smp_processor_id();
406 int irq = K_INT_TIMER_0 + cpu;
407
408 irq_enter();
409 kstat_this_cpu.irqs[irq]++;
410
411 write_seqlock(&xtime_lock);
412
413 /* ACK interrupt */
414 ____raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
415 IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG)));
416
417 /*
418 * call the generic timer interrupt handling
419 */
420 do_timer(1);
421
422 write_sequnlock(&xtime_lock);
423
424 /*
425 * In UP mode, we call local_timer_interrupt() to do profiling
426 * and process accouting.
427 *
428 * In SMP mode, local_timer_interrupt() is invoked by appropriate
429 * low-level local timer interrupt handler.
430 */
431 local_timer_interrupt(irq);
432
433 irq_exit();
434}
435
436extern void sb1250_mailbox_interrupt(void); 403extern void sb1250_mailbox_interrupt(void);
437 404
438asmlinkage void plat_irq_dispatch(void) 405asmlinkage void plat_irq_dispatch(void)
439{ 406{
407 unsigned int cpu = smp_processor_id();
440 unsigned int pending; 408 unsigned int pending;
441 409
442 /* 410 /*
@@ -454,7 +422,7 @@ asmlinkage void plat_irq_dispatch(void)
454 if (pending & CAUSEF_IP7) /* CPU performance counter interrupt */ 422 if (pending & CAUSEF_IP7) /* CPU performance counter interrupt */
455 do_IRQ(MIPS_CPU_IRQ_BASE + 7); 423 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
456 else if (pending & CAUSEF_IP4) 424 else if (pending & CAUSEF_IP4)
457 sb1250_timer_interrupt(); 425 do_IRQ(K_INT_TIMER_0 + cpu); /* sb1250_timer_interrupt() */
458 426
459#ifdef CONFIG_SMP 427#ifdef CONFIG_SMP
460 else if (pending & CAUSEF_IP3) 428 else if (pending & CAUSEF_IP3)
diff --git a/arch/mips/sibyte/sb1250/smp.c b/arch/mips/sibyte/sb1250/smp.c
index c38e1f34460d..aaa4f30dda79 100644
--- a/arch/mips/sibyte/sb1250/smp.c
+++ b/arch/mips/sibyte/sb1250/smp.c
@@ -57,8 +57,9 @@ void sb1250_smp_init(void)
57 57
58void sb1250_smp_finish(void) 58void sb1250_smp_finish(void)
59{ 59{
60 extern void sb1250_time_init(void); 60 extern void sb1250_clockevent_init(void);
61 sb1250_time_init(); 61
62 sb1250_clockevent_init();
62 local_irq_enable(); 63 local_irq_enable();
63} 64}
64 65
diff --git a/arch/mips/sibyte/sb1250/time.c b/arch/mips/sibyte/sb1250/time.c
index fe11fed8e0d7..9ef54628bc9c 100644
--- a/arch/mips/sibyte/sb1250/time.c
+++ b/arch/mips/sibyte/sb1250/time.c
@@ -100,6 +100,7 @@ static void sibyte_set_mode(enum clock_event_mode mode,
100 break; 100 break;
101 101
102 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */ 102 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */
103 case CLOCK_EVT_MODE_RESUME:
103 ; 104 ;
104 } 105 }
105} 106}
@@ -144,79 +145,7 @@ static struct irqaction sibyte_irqaction = {
144 .name = "timer", 145 .name = "timer",
145}; 146};
146 147
147/* 148void __cpuinit sb1250_clockevent_init(void)
148 * The general purpose timer ticks at 1 Mhz independent if
149 * the rest of the system
150 */
151static void sibyte_set_mode(enum clock_event_mode mode,
152 struct clock_event_device *evt)
153{
154 unsigned int cpu = smp_processor_id();
155 void __iomem *timer_cfg, *timer_init;
156
157 timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
158 timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
159
160 switch (mode) {
161 case CLOCK_EVT_MODE_PERIODIC:
162 __raw_writeq(0, timer_cfg);
163 __raw_writeq((V_SCD_TIMER_FREQ / HZ) - 1, timer_init);
164 __raw_writeq(M_SCD_TIMER_ENABLE | M_SCD_TIMER_MODE_CONTINUOUS,
165 timer_cfg);
166 break;
167
168 case CLOCK_EVT_MODE_ONESHOT:
169 /* Stop the timer until we actually program a shot */
170 case CLOCK_EVT_MODE_SHUTDOWN:
171 __raw_writeq(0, timer_cfg);
172 break;
173
174 case CLOCK_EVT_MODE_UNUSED: /* shuddup gcc */
175 ;
176 }
177}
178
179static int
180sibyte_next_event(unsigned long delta, struct clock_event_device *evt)
181{
182 unsigned int cpu = smp_processor_id();
183 void __iomem *timer_cfg, *timer_init;
184
185 timer_cfg = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG));
186 timer_init = IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT));
187
188 __raw_writeq(0, timer_cfg);
189 __raw_writeq(delta, timer_init);
190 __raw_writeq(M_SCD_TIMER_ENABLE, timer_cfg);
191
192 return 0;
193}
194
195struct clock_event_device sibyte_hpt_clockevent = {
196 .name = "sb1250-counter",
197 .features = CLOCK_EVT_FEAT_PERIODIC,
198 .set_mode = sibyte_set_mode,
199 .set_next_event = sibyte_next_event,
200 .shift = 32,
201 .irq = 0,
202};
203
204static irqreturn_t sibyte_counter_handler(int irq, void *dev_id)
205{
206 struct clock_event_device *cd = &sibyte_hpt_clockevent;
207
208 cd->event_handler(cd);
209
210 return IRQ_HANDLED;
211}
212
213static struct irqaction sibyte_irqaction = {
214 .handler = sibyte_counter_handler,
215 .flags = IRQF_DISABLED | IRQF_PERCPU,
216 .name = "timer",
217};
218
219static void __init sb1250_clockevent_init(void)
220{ 149{
221 struct clock_event_device *cd = &sibyte_hpt_clockevent; 150 struct clock_event_device *cd = &sibyte_hpt_clockevent;
222 unsigned int cpu = smp_processor_id(); 151 unsigned int cpu = smp_processor_id();
@@ -249,12 +178,6 @@ static void __init sb1250_clockevent_init(void)
249 clockevents_register_device(cd); 178 clockevents_register_device(cd);
250} 179}
251 180
252void __init plat_time_init(void)
253{
254 sb1250_clocksource_init();
255 sb1250_clockevent_init();
256}
257
258/* 181/*
259 * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over 182 * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
260 * again. 183 * again.
@@ -267,3 +190,26 @@ static cycle_t sb1250_hpt_read(void)
267 190
268 return SB1250_HPT_VALUE - count; 191 return SB1250_HPT_VALUE - count;
269} 192}
193
194struct clocksource bcm1250_clocksource = {
195 .name = "MIPS",
196 .rating = 200,
197 .read = sb1250_hpt_read,
198 .mask = CLOCKSOURCE_MASK(32),
199 .shift = 32,
200 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
201};
202
203void __init sb1250_clocksource_init(void)
204{
205 struct clocksource *cs = &bcm1250_clocksource;
206
207 clocksource_set_clock(cs, V_SCD_TIMER_FREQ);
208 clocksource_register(cs);
209}
210
211void __init plat_time_init(void)
212{
213 sb1250_clocksource_init();
214 sb1250_clockevent_init();
215}
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index 8b3ef0e4cd55..080c966263b7 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -69,31 +69,6 @@ const char *get_system_type(void)
69 return "SiByte " SIBYTE_BOARD_NAME; 69 return "SiByte " SIBYTE_BOARD_NAME;
70} 70}
71 71
72void __init plat_time_init(void)
73{
74#if defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
75 /* Setup HPT */
76 sb1250_hpt_setup();
77#endif
78}
79
80void __init plat_timer_setup(struct irqaction *irq)
81{
82 /*
83 * we don't set up irqaction, because we will deliver timer
84 * interrupts through low-level (direct) meachanism.
85 */
86
87 /* We only need to setup the generic timer */
88#if defined(CONFIG_SIBYTE_BCM1x55) || defined(CONFIG_SIBYTE_BCM1x80)
89 bcm1480_time_init();
90#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
91 sb1250_time_init();
92#else
93#error invalid SiByte board configuration
94#endif
95}
96
97int swarm_be_handler(struct pt_regs *regs, int is_fixup) 72int swarm_be_handler(struct pt_regs *regs, int is_fixup)
98{ 73{
99 if (!is_fixup && (regs->cp0_cause & 4)) { 74 if (!is_fixup && (regs->cp0_cause & 4)) {
diff --git a/arch/mips/sni/pcimt.c b/arch/mips/sni/pcimt.c
index 39bb15f1f2a6..4df070f2ff5d 100644
--- a/arch/mips/sni/pcimt.c
+++ b/arch/mips/sni/pcimt.c
@@ -246,7 +246,7 @@ static void pcimt_hwint1(void)
246 /* 246 /*
247 * Note: ASIC PCI's builtin interrupt achknowledge feature is 247 * Note: ASIC PCI's builtin interrupt achknowledge feature is
248 * broken. Using it may result in loss of some or all i8259 248 * broken. Using it may result in loss of some or all i8259
249 * interupts, so don't use PCIMT_INT_ACKNOWLEDGE ... 249 * interrupts, so don't use PCIMT_INT_ACKNOWLEDGE ...
250 */ 250 */
251 irq = i8259_irq(); 251 irq = i8259_irq();
252 if (unlikely(irq < 0)) 252 if (unlikely(irq < 0))
diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c
index b80877349d38..0910b35cb71f 100644
--- a/arch/mips/sni/time.c
+++ b/arch/mips/sni/time.c
@@ -121,15 +121,6 @@ void __init plat_time_init(void)
121 setup_pit_timer(); 121 setup_pit_timer();
122} 122}
123 123
124/*
125 * R4k counter based timer interrupt. Works on RM200-225 and possibly
126 * others but not on RM400
127 */
128static void __init sni_cpu_timer_setup(struct irqaction *irq)
129{
130 setup_irq(SNI_MIPS_IRQ_CPU_TIMER, irq);
131}
132
133void __init plat_timer_setup(struct irqaction *irq) 124void __init plat_timer_setup(struct irqaction *irq)
134{ 125{
135 switch (sni_brd_type) { 126 switch (sni_brd_type) {
@@ -139,15 +130,6 @@ void __init plat_timer_setup(struct irqaction *irq)
139 case SNI_BRD_MINITOWER: 130 case SNI_BRD_MINITOWER:
140 sni_a20r_timer_setup(irq); 131 sni_a20r_timer_setup(irq);
141 break; 132 break;
142
143 case SNI_BRD_PCI_TOWER:
144 case SNI_BRD_RM200:
145 case SNI_BRD_PCI_MTOWER:
146 case SNI_BRD_PCI_DESKTOP:
147 case SNI_BRD_PCI_TOWER_CPLUS:
148 case SNI_BRD_PCI_MTOWER_CPLUS:
149 sni_cpu_timer_setup(irq);
150 break;
151 } 133 }
152} 134}
153 135
diff --git a/arch/mips/tx4927/common/tx4927_setup.c b/arch/mips/tx4927/common/tx4927_setup.c
index 8ce0989671d8..36c5f200eb3d 100644
--- a/arch/mips/tx4927/common/tx4927_setup.c
+++ b/arch/mips/tx4927/common/tx4927_setup.c
@@ -72,22 +72,6 @@ void __init plat_time_init(void)
72#endif 72#endif
73} 73}
74 74
75void __init plat_timer_setup(struct irqaction *irq)
76{
77 setup_irq(TX4927_IRQ_CPU_TIMER, irq);
78
79#ifdef CONFIG_TOSHIBA_RBTX4927
80 {
81 extern void toshiba_rbtx4927_timer_setup(struct irqaction
82 *irq);
83 toshiba_rbtx4927_timer_setup(irq);
84 }
85#endif
86
87 return;
88}
89
90
91#ifdef DEBUG 75#ifdef DEBUG
92void print_cp0(char *key, int num, char *name, u32 val) 76void print_cp0(char *key, int num, char *name, u32 val)
93{ 77{
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index b97102a1c635..c7470fba6180 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -94,7 +94,6 @@
94#define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 ) 94#define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 )
95#define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 ) 95#define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 )
96#define TOSHIBA_RBTX4927_SETUP_TIME_INIT ( 1 << 5 ) 96#define TOSHIBA_RBTX4927_SETUP_TIME_INIT ( 1 << 5 )
97#define TOSHIBA_RBTX4927_SETUP_TIMER_SETUP ( 1 << 6 )
98#define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 ) 97#define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 )
99#define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 ) 98#define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 )
100#define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 ) 99#define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 )
@@ -108,7 +107,6 @@ static const u32 toshiba_rbtx4927_setup_debug_flag =
108 (TOSHIBA_RBTX4927_SETUP_NONE | TOSHIBA_RBTX4927_SETUP_INFO | 107 (TOSHIBA_RBTX4927_SETUP_NONE | TOSHIBA_RBTX4927_SETUP_INFO |
109 TOSHIBA_RBTX4927_SETUP_WARN | TOSHIBA_RBTX4927_SETUP_EROR | 108 TOSHIBA_RBTX4927_SETUP_WARN | TOSHIBA_RBTX4927_SETUP_EROR |
110 TOSHIBA_RBTX4927_SETUP_EFWFU | TOSHIBA_RBTX4927_SETUP_SETUP | 109 TOSHIBA_RBTX4927_SETUP_EFWFU | TOSHIBA_RBTX4927_SETUP_SETUP |
111 TOSHIBA_RBTX4927_SETUP_TIME_INIT | TOSHIBA_RBTX4927_SETUP_TIMER_SETUP
112 | TOSHIBA_RBTX4927_SETUP_PCIBIOS | TOSHIBA_RBTX4927_SETUP_PCI1 | 110 | TOSHIBA_RBTX4927_SETUP_PCIBIOS | TOSHIBA_RBTX4927_SETUP_PCI1 |
113 TOSHIBA_RBTX4927_SETUP_PCI2 | TOSHIBA_RBTX4927_SETUP_PCI66); 111 TOSHIBA_RBTX4927_SETUP_PCI2 | TOSHIBA_RBTX4927_SETUP_PCI66);
114#endif 112#endif
@@ -947,14 +945,6 @@ toshiba_rbtx4927_time_init(void)
947 945
948} 946}
949 947
950void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq)
951{
952 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
953 "-\n");
954 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP,
955 "+\n");
956}
957
958static int __init toshiba_rbtx4927_rtc_init(void) 948static int __init toshiba_rbtx4927_rtc_init(void)
959{ 949{
960 static struct resource __initdata res = { 950 static struct resource __initdata res = {
diff --git a/arch/mips/tx4938/common/setup.c b/arch/mips/tx4938/common/setup.c
index ab4082267553..3ba4101d141e 100644
--- a/arch/mips/tx4938/common/setup.c
+++ b/arch/mips/tx4938/common/setup.c
@@ -24,7 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/random.h> 25#include <linux/random.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <asm/bitops.h> 27#include <linux/bitops.h>
28#include <asm/bootinfo.h> 28#include <asm/bootinfo.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
@@ -43,8 +43,3 @@ plat_mem_setup(void)
43{ 43{
44 toshiba_rbtx4938_setup(); 44 toshiba_rbtx4938_setup();
45} 45}
46
47void __init plat_timer_setup(struct irqaction *irq)
48{
49 setup_irq(TX4938_IRQ_CPU_TIMER, irq);
50}
diff --git a/arch/mips/vr41xx/Kconfig b/arch/mips/vr41xx/Kconfig
index 8f4d3e74c230..eeb089f20c0d 100644
--- a/arch/mips/vr41xx/Kconfig
+++ b/arch/mips/vr41xx/Kconfig
@@ -5,6 +5,7 @@ choice
5 5
6config CASIO_E55 6config CASIO_E55
7 bool "CASIO CASSIOPEIA E-10/15/55/65" 7 bool "CASIO CASSIOPEIA E-10/15/55/65"
8 select CEVT_R4K
8 select DMA_NONCOHERENT 9 select DMA_NONCOHERENT
9 select IRQ_CPU 10 select IRQ_CPU
10 select ISA 11 select ISA
@@ -13,6 +14,7 @@ config CASIO_E55
13 14
14config IBM_WORKPAD 15config IBM_WORKPAD
15 bool "IBM WorkPad z50" 16 bool "IBM WorkPad z50"
17 select CEVT_R4K
16 select DMA_NONCOHERENT 18 select DMA_NONCOHERENT
17 select IRQ_CPU 19 select IRQ_CPU
18 select ISA 20 select ISA
@@ -21,6 +23,7 @@ config IBM_WORKPAD
21 23
22config NEC_CMBVR4133 24config NEC_CMBVR4133
23 bool "NEC CMB-VR4133" 25 bool "NEC CMB-VR4133"
26 select CEVT_R4K
24 select DMA_NONCOHERENT 27 select DMA_NONCOHERENT
25 select IRQ_CPU 28 select IRQ_CPU
26 select HW_HAS_PCI 29 select HW_HAS_PCI
@@ -29,6 +32,7 @@ config NEC_CMBVR4133
29 32
30config TANBAC_TB022X 33config TANBAC_TB022X
31 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM" 34 bool "TANBAC VR4131 multichip module and TANBAC VR4131DIMM"
35 select CEVT_R4K
32 select DMA_NONCOHERENT 36 select DMA_NONCOHERENT
33 select IRQ_CPU 37 select IRQ_CPU
34 select HW_HAS_PCI 38 select HW_HAS_PCI
@@ -43,6 +47,7 @@ config TANBAC_TB022X
43 47
44config VICTOR_MPC30X 48config VICTOR_MPC30X
45 bool "Victor MP-C303/304" 49 bool "Victor MP-C303/304"
50 select CEVT_R4K
46 select DMA_NONCOHERENT 51 select DMA_NONCOHERENT
47 select IRQ_CPU 52 select IRQ_CPU
48 select HW_HAS_PCI 53 select HW_HAS_PCI
@@ -52,6 +57,7 @@ config VICTOR_MPC30X
52 57
53config ZAO_CAPCELLA 58config ZAO_CAPCELLA
54 bool "ZAO Networks Capcella" 59 bool "ZAO Networks Capcella"
60 select CEVT_R4K
55 select DMA_NONCOHERENT 61 select DMA_NONCOHERENT
56 select IRQ_CPU 62 select IRQ_CPU
57 select HW_HAS_PCI 63 select HW_HAS_PCI
diff --git a/arch/mips/vr41xx/common/init.c b/arch/mips/vr41xx/common/init.c
index 407cec203b29..8d760df686c4 100644
--- a/arch/mips/vr41xx/common/init.c
+++ b/arch/mips/vr41xx/common/init.c
@@ -48,11 +48,6 @@ void __init plat_time_init(void)
48 mips_hpt_frequency = tclock / 4; 48 mips_hpt_frequency = tclock / 4;
49} 49}
50 50
51void __init plat_timer_setup(struct irqaction *irq)
52{
53 setup_irq(TIMER_IRQ, irq);
54}
55
56void __init plat_mem_setup(void) 51void __init plat_mem_setup(void)
57{ 52{
58 vr41xx_calculate_clock_frequency(); 53 vr41xx_calculate_clock_frequency();
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 3d73545e8c48..b8ef1787a191 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -267,7 +267,7 @@ source "drivers/Kconfig"
267 267
268source "fs/Kconfig" 268source "fs/Kconfig"
269 269
270source "arch/parisc/oprofile/Kconfig" 270source "kernel/Kconfig.instrumentation"
271 271
272source "arch/parisc/Kconfig.debug" 272source "arch/parisc/Kconfig.debug"
273 273
diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
index fb35ebc0c4da..2ce3806f02e1 100644
--- a/arch/parisc/kernel/signal.c
+++ b/arch/parisc/kernel/signal.c
@@ -181,7 +181,7 @@ give_sigsegv:
181 si.si_signo = SIGSEGV; 181 si.si_signo = SIGSEGV;
182 si.si_errno = 0; 182 si.si_errno = 0;
183 si.si_code = SI_KERNEL; 183 si.si_code = SI_KERNEL;
184 si.si_pid = current->pid; 184 si.si_pid = task_pid_vnr(current);
185 si.si_uid = current->uid; 185 si.si_uid = current->uid;
186 si.si_addr = &frame->uc; 186 si.si_addr = &frame->uc;
187 force_sig_info(SIGSEGV, &si, current); 187 force_sig_info(SIGSEGV, &si, current);
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
index bbf029a184ac..99fd56939afa 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
@@ -219,7 +219,7 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err)
219 return; /* STFU */ 219 return; /* STFU */
220 220
221 printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n", 221 printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
222 current->comm, current->pid, str, err, regs->iaoq[0]); 222 current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
223#ifdef PRINT_USER_FAULTS 223#ifdef PRINT_USER_FAULTS
224 /* XXX for debugging only */ 224 /* XXX for debugging only */
225 show_regs(regs); 225 show_regs(regs);
@@ -252,7 +252,7 @@ KERN_CRIT " || ||\n");
252 252
253 if (err) 253 if (err)
254 printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n", 254 printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
255 current->comm, current->pid, str, err); 255 current->comm, task_pid_nr(current), str, err);
256 256
257 /* Wot's wrong wif bein' racy? */ 257 /* Wot's wrong wif bein' racy? */
258 if (current->thread.flags & PARISC_KERNEL_DEATH) { 258 if (current->thread.flags & PARISC_KERNEL_DEATH) {
@@ -317,7 +317,7 @@ static void handle_break(struct pt_regs *regs)
317 if (unlikely(iir != GDB_BREAK_INSN)) { 317 if (unlikely(iir != GDB_BREAK_INSN)) {
318 printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n", 318 printk(KERN_DEBUG "break %d,%d: pid=%d command='%s'\n",
319 iir & 31, (iir>>13) & ((1<<13)-1), 319 iir & 31, (iir>>13) & ((1<<13)-1),
320 current->pid, current->comm); 320 task_pid_nr(current), current->comm);
321 show_regs(regs); 321 show_regs(regs);
322 } 322 }
323#endif 323#endif
@@ -747,7 +747,7 @@ void handle_interruption(int code, struct pt_regs *regs)
747 if (user_mode(regs)) { 747 if (user_mode(regs)) {
748#ifdef PRINT_USER_FAULTS 748#ifdef PRINT_USER_FAULTS
749 printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n", 749 printk(KERN_DEBUG "\nhandle_interruption() pid=%d command='%s'\n",
750 current->pid, current->comm); 750 task_pid_nr(current), current->comm);
751 show_regs(regs); 751 show_regs(regs);
752#endif 752#endif
753 /* SIGBUS, for lack of a better one. */ 753 /* SIGBUS, for lack of a better one. */
@@ -772,7 +772,7 @@ void handle_interruption(int code, struct pt_regs *regs)
772 else 772 else
773 printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ", 773 printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ",
774 code); 774 code);
775 printk("pid=%d command='%s'\n", current->pid, current->comm); 775 printk("pid=%d command='%s'\n", task_pid_nr(current), current->comm);
776 show_regs(regs); 776 show_regs(regs);
777#endif 777#endif
778 si.si_signo = SIGSEGV; 778 si.si_signo = SIGSEGV;
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index 347bb922e6d0..aebf3c168871 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -469,7 +469,7 @@ void handle_unaligned(struct pt_regs *regs)
469 && ++unaligned_count < 5) { 469 && ++unaligned_count < 5) {
470 char buf[256]; 470 char buf[256];
471 sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n", 471 sprintf(buf, "%s(%d): unaligned access to 0x" RFMT " at ip=0x" RFMT "\n",
472 current->comm, current->pid, regs->ior, regs->iaoq[0]); 472 current->comm, task_pid_nr(current), regs->ior, regs->iaoq[0]);
473 printk(KERN_WARNING "%s", buf); 473 printk(KERN_WARNING "%s", buf);
474#ifdef DEBUG_UNALIGNED 474#ifdef DEBUG_UNALIGNED
475 show_regs(regs); 475 show_regs(regs);
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 1c091b415cd9..b2e3e9a8cece 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -211,7 +211,7 @@ bad_area:
211#ifdef PRINT_USER_FAULTS 211#ifdef PRINT_USER_FAULTS
212 printk(KERN_DEBUG "\n"); 212 printk(KERN_DEBUG "\n");
213 printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n", 213 printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
214 tsk->pid, tsk->comm, code, address); 214 task_pid_nr(tsk), tsk->comm, code, address);
215 if (vma) { 215 if (vma) {
216 printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n", 216 printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
217 vma->vm_start, vma->vm_end); 217 vma->vm_start, vma->vm_end);
diff --git a/arch/parisc/oprofile/Kconfig b/arch/parisc/oprofile/Kconfig
deleted file mode 100644
index 5ade19801b97..000000000000
--- a/arch/parisc/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 3763f681ce4c..18f397ca05ef 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -669,20 +669,7 @@ source "arch/powerpc/sysdev/qe_lib/Kconfig"
669 669
670source "lib/Kconfig" 670source "lib/Kconfig"
671 671
672menu "Instrumentation Support" 672source "kernel/Kconfig.instrumentation"
673
674source "arch/powerpc/oprofile/Kconfig"
675
676config KPROBES
677 bool "Kprobes"
678 depends on !BOOKE && !4xx && KALLSYMS && MODULES
679 help
680 Kprobes allows you to trap at almost any kernel address and
681 execute a callback function. register_kprobe() establishes
682 a probepoint and specifies the callback. Kprobes is useful
683 for kernel debugging, non-intrusive instrumentation and testing.
684 If in doubt, say "N".
685endmenu
686 673
687source "arch/powerpc/Kconfig.debug" 674source "arch/powerpc/Kconfig.debug"
688 675
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index 8b47c846421c..dcd7c02727c2 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_defconfig
@@ -68,6 +68,7 @@ CONFIG_SYSVIPC_SYSCTL=y
68CONFIG_IKCONFIG=y 68CONFIG_IKCONFIG=y
69CONFIG_IKCONFIG_PROC=y 69CONFIG_IKCONFIG_PROC=y
70CONFIG_LOG_BUF_SHIFT=15 70CONFIG_LOG_BUF_SHIFT=15
71CONFIG_CGROUPS=y
71CONFIG_CPUSETS=y 72CONFIG_CPUSETS=y
72CONFIG_SYSFS_DEPRECATED=y 73CONFIG_SYSFS_DEPRECATED=y
73# CONFIG_RELAY is not set 74# CONFIG_RELAY is not set
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
index 95b823b60c97..8e5988c4a164 100644
--- a/arch/powerpc/configs/pmac32_defconfig
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -209,7 +209,6 @@ CONFIG_PM=y
209# CONFIG_PM_LEGACY is not set 209# CONFIG_PM_LEGACY is not set
210CONFIG_PM_DEBUG=y 210CONFIG_PM_DEBUG=y
211# CONFIG_PM_VERBOSE is not set 211# CONFIG_PM_VERBOSE is not set
212# CONFIG_DISABLE_CONSOLE_SUSPEND is not set
213CONFIG_PM_SLEEP=y 212CONFIG_PM_SLEEP=y
214CONFIG_SUSPEND=y 213CONFIG_SUSPEND=y
215CONFIG_HIBERNATION=y 214CONFIG_HIBERNATION=y
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index bb8d4e46f0c5..05582af50c5b 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_defconfig
@@ -71,6 +71,7 @@ CONFIG_TASK_DELAY_ACCT=y
71CONFIG_IKCONFIG=y 71CONFIG_IKCONFIG=y
72CONFIG_IKCONFIG_PROC=y 72CONFIG_IKCONFIG_PROC=y
73CONFIG_LOG_BUF_SHIFT=17 73CONFIG_LOG_BUF_SHIFT=17
74CONFIG_CGROUPS=y
74CONFIG_CPUSETS=y 75CONFIG_CPUSETS=y
75CONFIG_SYSFS_DEPRECATED=y 76CONFIG_SYSFS_DEPRECATED=y
76CONFIG_RELAY=y 77CONFIG_RELAY=y
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index c09eb8cfbe71..62a38406b62f 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_defconfig
@@ -71,6 +71,7 @@ CONFIG_AUDITSYSCALL=y
71CONFIG_IKCONFIG=y 71CONFIG_IKCONFIG=y
72CONFIG_IKCONFIG_PROC=y 72CONFIG_IKCONFIG_PROC=y
73CONFIG_LOG_BUF_SHIFT=17 73CONFIG_LOG_BUF_SHIFT=17
74CONFIG_CGROUPS=y
74CONFIG_CPUSETS=y 75CONFIG_CPUSETS=y
75CONFIG_SYSFS_DEPRECATED=y 76CONFIG_SYSFS_DEPRECATED=y
76# CONFIG_RELAY is not set 77# CONFIG_RELAY is not set
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 0ae5d57b9368..2c8e756d19a3 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -141,6 +141,7 @@ int main(void)
141 DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr)); 141 DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
142 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id)); 142 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
143 DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); 143 DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr));
144 DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
144 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); 145 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
145 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 146 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
146 DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); 147 DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr));
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 8b4a4ee85eca..f1ee0b3f78f2 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -113,7 +113,7 @@ setup_604_hid0:
113 * around #3 and with the same fix we use. We may want to 113 * around #3 and with the same fix we use. We may want to
114 * check if the CPU is using 60x bus mode in which case 114 * check if the CPU is using 60x bus mode in which case
115 * the workaround for errata #4 is useless. Also, we may 115 * the workaround for errata #4 is useless. Also, we may
116 * want to explicitely clear HID0_NOPDST as this is not 116 * want to explicitly clear HID0_NOPDST as this is not
117 * needed once we have applied workaround #5 (though it's 117 * needed once we have applied workaround #5 (though it's
118 * not set by Apple's firmware at least). 118 * not set by Apple's firmware at least).
119 */ 119 */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 2250f9e6c5ca..b0e5deb4274f 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -491,7 +491,7 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
491 491
492 /* Legacy flags are left to default at this point, 492 /* Legacy flags are left to default at this point,
493 * one can then use irq_create_mapping() to 493 * one can then use irq_create_mapping() to
494 * explicitely change them 494 * explicitly change them
495 */ 495 */
496 ops->map(host, i, i); 496 ops->map(host, i, i);
497 } 497 }
diff --git a/arch/powerpc/kernel/l2cr_6xx.S b/arch/powerpc/kernel/l2cr_6xx.S
index 858f28ac8a06..2a2f3c3f6d80 100644
--- a/arch/powerpc/kernel/l2cr_6xx.S
+++ b/arch/powerpc/kernel/l2cr_6xx.S
@@ -1,6 +1,6 @@
1/* 1/*
2 L2CR functions 2 L2CR functions
3 Copyright © 1997-1998 by PowerLogix R & D, Inc. 3 Copyright © 1997-1998 by PowerLogix R & D, Inc.
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index e60a0c544d63..c0c8e8c3ced9 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -61,45 +61,39 @@ NORET_TYPE void machine_kexec(struct kimage *image)
61 for(;;); 61 for(;;);
62} 62}
63 63
64static int __init early_parse_crashk(char *p)
65{
66 unsigned long size;
67
68 if (!p)
69 return 1;
70
71 size = memparse(p, &p);
72
73 if (*p == '@')
74 crashk_res.start = memparse(p + 1, &p);
75 else
76 crashk_res.start = KDUMP_KERNELBASE;
77
78 crashk_res.end = crashk_res.start + size - 1;
79
80 return 0;
81}
82early_param("crashkernel", early_parse_crashk);
83
84void __init reserve_crashkernel(void) 64void __init reserve_crashkernel(void)
85{ 65{
86 unsigned long size; 66 unsigned long long crash_size, crash_base;
67 int ret;
68
69 /* this is necessary because of lmb_phys_mem_size() */
70 lmb_analyze();
71
72 /* use common parsing */
73 ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(),
74 &crash_size, &crash_base);
75 if (ret == 0 && crash_size > 0) {
76 if (crash_base == 0)
77 crash_base = KDUMP_KERNELBASE;
78 crashk_res.start = crash_base;
79 } else {
80 /* handle the device tree */
81 crash_size = crashk_res.end - crashk_res.start + 1;
82 }
87 83
88 if (crashk_res.start == 0) 84 if (crash_size == 0)
89 return; 85 return;
90 86
91 /* We might have got these values via the command line or the 87 /* We might have got these values via the command line or the
92 * device tree, either way sanitise them now. */ 88 * device tree, either way sanitise them now. */
93 89
94 size = crashk_res.end - crashk_res.start + 1;
95
96 if (crashk_res.start != KDUMP_KERNELBASE) 90 if (crashk_res.start != KDUMP_KERNELBASE)
97 printk("Crash kernel location must be 0x%x\n", 91 printk("Crash kernel location must be 0x%x\n",
98 KDUMP_KERNELBASE); 92 KDUMP_KERNELBASE);
99 93
100 crashk_res.start = KDUMP_KERNELBASE; 94 crashk_res.start = KDUMP_KERNELBASE;
101 size = PAGE_ALIGN(size); 95 crash_size = PAGE_ALIGN(crash_size);
102 crashk_res.end = crashk_res.start + size - 1; 96 crashk_res.end = crashk_res.start + crash_size - 1;
103 97
104 /* Crash kernel trumps memory limit */ 98 /* Crash kernel trumps memory limit */
105 if (memory_limit && memory_limit <= crashk_res.end) { 99 if (memory_limit && memory_limit <= crashk_res.end) {
@@ -108,7 +102,13 @@ void __init reserve_crashkernel(void)
108 memory_limit); 102 memory_limit);
109 } 103 }
110 104
111 lmb_reserve(crashk_res.start, size); 105 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
106 "for crashkernel (System RAM: %ldMB)\n",
107 (unsigned long)(crash_size >> 20),
108 (unsigned long)(crashk_res.start >> 20),
109 (unsigned long)(lmb_phys_mem_size() >> 20));
110
111 lmb_reserve(crashk_res.start, crash_size);
112} 112}
113 113
114int overlaps_crashkernel(unsigned long start, unsigned long size) 114int overlaps_crashkernel(unsigned long start, unsigned long size)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index ea6ad7a2a7e3..b9d88374f14f 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -459,7 +459,7 @@ void show_regs(struct pt_regs * regs)
459 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr); 459 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
460#endif 460#endif
461 printk("TASK = %p[%d] '%s' THREAD: %p", 461 printk("TASK = %p[%d] '%s' THREAD: %p",
462 current, current->pid, 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", smp_processor_id());
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 863a5d6d9b18..9eb3284deac4 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -212,23 +212,44 @@ static u64 read_purr(void)
212} 212}
213 213
214/* 214/*
215 * Read the SPURR on systems that have it, otherwise the purr
216 */
217static u64 read_spurr(u64 purr)
218{
219 if (cpu_has_feature(CPU_FTR_SPURR))
220 return mfspr(SPRN_SPURR);
221 return purr;
222}
223
224/*
215 * Account time for a transition between system, hard irq 225 * Account time for a transition between system, hard irq
216 * or soft irq state. 226 * or soft irq state.
217 */ 227 */
218void account_system_vtime(struct task_struct *tsk) 228void account_system_vtime(struct task_struct *tsk)
219{ 229{
220 u64 now, delta; 230 u64 now, nowscaled, delta, deltascaled;
221 unsigned long flags; 231 unsigned long flags;
222 232
223 local_irq_save(flags); 233 local_irq_save(flags);
224 now = read_purr(); 234 now = read_purr();
225 delta = now - get_paca()->startpurr; 235 delta = now - get_paca()->startpurr;
226 get_paca()->startpurr = now; 236 get_paca()->startpurr = now;
237 nowscaled = read_spurr(now);
238 deltascaled = nowscaled - get_paca()->startspurr;
239 get_paca()->startspurr = nowscaled;
227 if (!in_interrupt()) { 240 if (!in_interrupt()) {
241 /* deltascaled includes both user and system time.
242 * Hence scale it based on the purr ratio to estimate
243 * the system time */
244 deltascaled = deltascaled * get_paca()->system_time /
245 (get_paca()->system_time + get_paca()->user_time);
228 delta += get_paca()->system_time; 246 delta += get_paca()->system_time;
229 get_paca()->system_time = 0; 247 get_paca()->system_time = 0;
230 } 248 }
231 account_system_time(tsk, 0, delta); 249 account_system_time(tsk, 0, delta);
250 get_paca()->purrdelta = delta;
251 account_system_time_scaled(tsk, deltascaled);
252 get_paca()->spurrdelta = deltascaled;
232 local_irq_restore(flags); 253 local_irq_restore(flags);
233} 254}
234 255
@@ -240,11 +261,17 @@ void account_system_vtime(struct task_struct *tsk)
240 */ 261 */
241void account_process_vtime(struct task_struct *tsk) 262void account_process_vtime(struct task_struct *tsk)
242{ 263{
243 cputime_t utime; 264 cputime_t utime, utimescaled;
244 265
245 utime = get_paca()->user_time; 266 utime = get_paca()->user_time;
246 get_paca()->user_time = 0; 267 get_paca()->user_time = 0;
247 account_user_time(tsk, utime); 268 account_user_time(tsk, utime);
269
270 /* Estimate the scaled utime by scaling the real utime based
271 * on the last spurr to purr ratio */
272 utimescaled = utime * get_paca()->spurrdelta / get_paca()->purrdelta;
273 get_paca()->spurrdelta = get_paca()->purrdelta = 0;
274 account_user_time_scaled(tsk, utimescaled);
248} 275}
249 276
250static void account_process_time(struct pt_regs *regs) 277static void account_process_time(struct pt_regs *regs)
@@ -266,6 +293,7 @@ struct cpu_purr_data {
266 int initialized; /* thread is running */ 293 int initialized; /* thread is running */
267 u64 tb; /* last TB value read */ 294 u64 tb; /* last TB value read */
268 u64 purr; /* last PURR value read */ 295 u64 purr; /* last PURR value read */
296 u64 spurr; /* last SPURR value read */
269}; 297};
270 298
271/* 299/*
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index bf9e39c6e296..59c464e26f38 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -201,7 +201,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
201 * generate the same exception over and over again and we get 201 * generate the same exception over and over again and we get
202 * nowhere. Better to kill it and let the kernel panic. 202 * nowhere. Better to kill it and let the kernel panic.
203 */ 203 */
204 if (is_init(current)) { 204 if (is_global_init(current)) {
205 __sighandler_t handler; 205 __sighandler_t handler;
206 206
207 spin_lock_irq(&current->sighand->siglock); 207 spin_lock_irq(&current->sighand->siglock);
@@ -881,7 +881,7 @@ void nonrecoverable_exception(struct pt_regs *regs)
881void trace_syscall(struct pt_regs *regs) 881void trace_syscall(struct pt_regs *regs)
882{ 882{
883 printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n", 883 printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
884 current, current->pid, regs->nip, regs->link, regs->gpr[0], 884 current, task_pid_nr(current), regs->nip, regs->link, regs->gpr[0],
885 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted()); 885 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
886} 886}
887 887
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index ab3546c5ac3a..a18fda361cc0 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -375,7 +375,7 @@ bad_area_nosemaphore:
375 */ 375 */
376out_of_memory: 376out_of_memory:
377 up_read(&mm->mmap_sem); 377 up_read(&mm->mmap_sem);
378 if (is_init(current)) { 378 if (is_global_init(current)) {
379 yield(); 379 yield();
380 down_read(&mm->mmap_sem); 380 down_read(&mm->mmap_sem);
381 goto survive; 381 goto survive;
diff --git a/arch/powerpc/oprofile/Kconfig b/arch/powerpc/oprofile/Kconfig
deleted file mode 100644
index 7089e79689b9..000000000000
--- a/arch/powerpc/oprofile/Kconfig
+++ /dev/null
@@ -1,24 +0,0 @@
1config PROFILING
2 bool "Profiling support (EXPERIMENTAL)"
3 help
4 Say Y here to enable the extended profiling support mechanisms used
5 by profilers such as OProfile.
6
7
8config OPROFILE
9 tristate "OProfile system profiling (EXPERIMENTAL)"
10 depends on PROFILING
11 help
12 OProfile is a profiling system capable of profiling the
13 whole system, include the kernel, kernel modules, libraries,
14 and applications.
15
16 If unsure, say N.
17
18config OPROFILE_CELL
19 bool "OProfile for Cell Broadband Engine"
20 depends on (SPU_FS = y && OPROFILE = m) || (SPU_FS = y && OPROFILE = y) || (SPU_FS = m && OPROFILE = m)
21 default y
22 help
23 Profiling of Cell BE SPUs requires special support enabled
24 by this option.
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c
index f26afcd41757..ffa14aff5248 100644
--- a/arch/powerpc/platforms/52xx/lite5200_pm.c
+++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
@@ -1,5 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/pm.h> 2#include <linux/suspend.h>
3#include <asm/io.h> 3#include <asm/io.h>
4#include <asm/time.h> 4#include <asm/time.h>
5#include <asm/mpc52xx.h> 5#include <asm/mpc52xx.h>
@@ -18,6 +18,8 @@ static void __iomem *sram;
18static const int sram_size = 0x4000; /* 16 kBytes */ 18static const int sram_size = 0x4000; /* 16 kBytes */
19static void __iomem *mbar; 19static void __iomem *mbar;
20 20
21static suspend_state_t lite5200_pm_target_state;
22
21static int lite5200_pm_valid(suspend_state_t state) 23static int lite5200_pm_valid(suspend_state_t state)
22{ 24{
23 switch (state) { 25 switch (state) {
@@ -29,13 +31,22 @@ static int lite5200_pm_valid(suspend_state_t state)
29 } 31 }
30} 32}
31 33
32static int lite5200_pm_prepare(suspend_state_t state) 34static int lite5200_pm_set_target(suspend_state_t state)
35{
36 if (lite5200_pm_valid(state)) {
37 lite5200_pm_target_state = state;
38 return 0;
39 }
40 return -EINVAL;
41}
42
43static int lite5200_pm_prepare(void)
33{ 44{
34 /* deep sleep? let mpc52xx code handle that */ 45 /* deep sleep? let mpc52xx code handle that */
35 if (state == PM_SUSPEND_STANDBY) 46 if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
36 return mpc52xx_pm_prepare(state); 47 return mpc52xx_pm_prepare();
37 48
38 if (state != PM_SUSPEND_MEM) 49 if (lite5200_pm_target_state != PM_SUSPEND_MEM)
39 return -EINVAL; 50 return -EINVAL;
40 51
41 /* map registers */ 52 /* map registers */
@@ -190,17 +201,16 @@ static int lite5200_pm_enter(suspend_state_t state)
190 return 0; 201 return 0;
191} 202}
192 203
193static int lite5200_pm_finish(suspend_state_t state) 204static void lite5200_pm_finish(void)
194{ 205{
195 /* deep sleep? let mpc52xx code handle that */ 206 /* deep sleep? let mpc52xx code handle that */
196 if (state == PM_SUSPEND_STANDBY) { 207 if (lite5200_pm_target_state == PM_SUSPEND_STANDBY)
197 return mpc52xx_pm_finish(state); 208 mpc52xx_pm_finish();
198 }
199 return 0;
200} 209}
201 210
202static struct pm_ops lite5200_pm_ops = { 211static struct platform_suspend_ops lite5200_pm_ops = {
203 .valid = lite5200_pm_valid, 212 .valid = lite5200_pm_valid,
213 .set_target = lite5200_pm_set_target,
204 .prepare = lite5200_pm_prepare, 214 .prepare = lite5200_pm_prepare,
205 .enter = lite5200_pm_enter, 215 .enter = lite5200_pm_enter,
206 .finish = lite5200_pm_finish, 216 .finish = lite5200_pm_finish,
@@ -208,6 +218,6 @@ static struct pm_ops lite5200_pm_ops = {
208 218
209int __init lite5200_pm_init(void) 219int __init lite5200_pm_init(void)
210{ 220{
211 pm_set_ops(&lite5200_pm_ops); 221 suspend_set_ops(&lite5200_pm_ops);
212 return 0; 222 return 0;
213} 223}
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
index ee2e7639c63e..7ffa7babf254 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
@@ -1,5 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/pm.h> 2#include <linux/suspend.h>
3#include <linux/io.h> 3#include <linux/io.h>
4#include <asm/time.h> 4#include <asm/time.h>
5#include <asm/cacheflush.h> 5#include <asm/cacheflush.h>
@@ -57,11 +57,8 @@ int mpc52xx_set_wakeup_gpio(u8 pin, u8 level)
57 return 0; 57 return 0;
58} 58}
59 59
60int mpc52xx_pm_prepare(suspend_state_t state) 60int mpc52xx_pm_prepare(void)
61{ 61{
62 if (state != PM_SUSPEND_STANDBY)
63 return -EINVAL;
64
65 /* map the whole register space */ 62 /* map the whole register space */
66 mbar = mpc52xx_find_and_map("mpc5200"); 63 mbar = mpc52xx_find_and_map("mpc5200");
67 if (!mbar) { 64 if (!mbar) {
@@ -166,18 +163,16 @@ int mpc52xx_pm_enter(suspend_state_t state)
166 return 0; 163 return 0;
167} 164}
168 165
169int mpc52xx_pm_finish(suspend_state_t state) 166void mpc52xx_pm_finish(void)
170{ 167{
171 /* call board resume code */ 168 /* call board resume code */
172 if (mpc52xx_suspend.board_resume_finish) 169 if (mpc52xx_suspend.board_resume_finish)
173 mpc52xx_suspend.board_resume_finish(mbar); 170 mpc52xx_suspend.board_resume_finish(mbar);
174 171
175 iounmap(mbar); 172 iounmap(mbar);
176
177 return 0;
178} 173}
179 174
180static struct pm_ops mpc52xx_pm_ops = { 175static struct platform_suspend_ops mpc52xx_pm_ops = {
181 .valid = mpc52xx_pm_valid, 176 .valid = mpc52xx_pm_valid,
182 .prepare = mpc52xx_pm_prepare, 177 .prepare = mpc52xx_pm_prepare,
183 .enter = mpc52xx_pm_enter, 178 .enter = mpc52xx_pm_enter,
@@ -186,6 +181,6 @@ static struct pm_ops mpc52xx_pm_ops = {
186 181
187int __init mpc52xx_pm_init(void) 182int __init mpc52xx_pm_init(void)
188{ 183{
189 pm_set_ops(&mpc52xx_pm_ops); 184 suspend_set_ops(&mpc52xx_pm_ops);
190 return 0; 185 return 0;
191} 186}
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 229d355ed86a..ea22cad2cd0a 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -120,7 +120,7 @@ config PPC_PMI
120 depends on PPC_IBM_CELL_BLADE 120 depends on PPC_IBM_CELL_BLADE
121 help 121 help
122 PMI (Platform Management Interrupt) is a way to 122 PMI (Platform Management Interrupt) is a way to
123 communicate with the BMC (Baseboard Mangement Controller). 123 communicate with the BMC (Baseboard Management Controller).
124 It is used in some IBM Cell blades. 124 It is used in some IBM Cell blades.
125 default m 125 default m
126 126
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index d72b16d6816e..d9e56a503795 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -748,7 +748,7 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
748 if (count) 748 if (count)
749 goto out; 749 goto out;
750 750
751 /* write aѕ much as possible */ 751 /* write as much as possible */
752 for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) { 752 for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) {
753 int ret; 753 int ret;
754 ret = __get_user(wbox_data, udata); 754 ret = __get_user(wbox_data, udata);
diff --git a/arch/powerpc/platforms/celleb/scc_uhc.c b/arch/powerpc/platforms/celleb/scc_uhc.c
index a7c548bde2e3..b59c38a06e3e 100644
--- a/arch/powerpc/platforms/celleb/scc_uhc.c
+++ b/arch/powerpc/platforms/celleb/scc_uhc.c
@@ -36,7 +36,7 @@ static inline int uhc_clkctrl_ready(u32 val)
36} 36}
37 37
38/* 38/*
39 * UHC(usb host controler) enable function. 39 * UHC(usb host controller) enable function.
40 * affect to both of OHCI and EHCI core module. 40 * affect to both of OHCI and EHCI core module.
41 */ 41 */
42static void enable_scc_uhc(struct pci_dev *dev) 42static void enable_scc_uhc(struct pci_dev *dev)
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 354c05861629..144177d77cf1 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -41,13 +41,13 @@
41#include <linux/root_dev.h> 41#include <linux/root_dev.h>
42#include <linux/serial.h> 42#include <linux/serial.h>
43#include <linux/smp.h> 43#include <linux/smp.h>
44#include <linux/bitops.h>
44 45
45#include <asm/processor.h> 46#include <asm/processor.h>
46#include <asm/sections.h> 47#include <asm/sections.h>
47#include <asm/prom.h> 48#include <asm/prom.h>
48#include <asm/system.h> 49#include <asm/system.h>
49#include <asm/pgtable.h> 50#include <asm/pgtable.h>
50#include <asm/bitops.h>
51#include <asm/io.h> 51#include <asm/io.h>
52#include <asm/kexec.h> 52#include <asm/kexec.h>
53#include <asm/pci-bridge.h> 53#include <asm/pci-bridge.h>
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 3a393c7f390e..a1ab25c7082f 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -332,7 +332,7 @@ static int recover_mce(struct pt_regs *regs, struct rtas_error_log * err)
332 err->disposition == RTAS_DISP_NOT_RECOVERED && 332 err->disposition == RTAS_DISP_NOT_RECOVERED &&
333 err->target == RTAS_TARGET_MEMORY && 333 err->target == RTAS_TARGET_MEMORY &&
334 err->type == RTAS_TYPE_ECC_UNCORR && 334 err->type == RTAS_TYPE_ECC_UNCORR &&
335 !(current->pid == 0 || is_init(current))) { 335 !(current->pid == 0 || is_global_init(current))) {
336 /* Kill off a user process with an ECC error */ 336 /* Kill off a user process with an ECC error */
337 printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n", 337 printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
338 current->pid); 338 current->pid);
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 607925c8a99e..6473fa7cb4b9 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -1317,7 +1317,7 @@ endmenu
1317 1317
1318source "lib/Kconfig" 1318source "lib/Kconfig"
1319 1319
1320source "arch/powerpc/oprofile/Kconfig" 1320source "kernel/Kconfig.instrumentation"
1321 1321
1322source "arch/ppc/Kconfig.debug" 1322source "arch/ppc/Kconfig.debug"
1323 1323
diff --git a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
index 487dc66dcc74..500497e3c72d 100644
--- a/arch/ppc/boot/Makefile
+++ b/arch/ppc/boot/Makefile
@@ -13,6 +13,8 @@
13# modified by Cort (cort@cs.nmt.edu) 13# modified by Cort (cort@cs.nmt.edu)
14# 14#
15 15
16# KBUILD_CFLAGS used when building rest of boot (takes effect recursively)
17KBUILD_CFLAGS += -fno-builtin -D__BOOTER__ -Iarch/$(ARCH)/boot/include
16HOSTCFLAGS += -Iarch/$(ARCH)/boot/include 18HOSTCFLAGS += -Iarch/$(ARCH)/boot/include
17 19
18BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd 20BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
index 3f3b292eb773..c78568905c3b 100644
--- a/arch/ppc/kernel/traps.c
+++ b/arch/ppc/kernel/traps.c
@@ -121,7 +121,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
121 * generate the same exception over and over again and we get 121 * generate the same exception over and over again and we get
122 * nowhere. Better to kill it and let the kernel panic. 122 * nowhere. Better to kill it and let the kernel panic.
123 */ 123 */
124 if (is_init(current)) { 124 if (is_global_init(current)) {
125 __sighandler_t handler; 125 __sighandler_t handler;
126 126
127 spin_lock_irq(&current->sighand->siglock); 127 spin_lock_irq(&current->sighand->siglock);
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
index 94913ddcf76e..254c23b755e6 100644
--- a/arch/ppc/mm/fault.c
+++ b/arch/ppc/mm/fault.c
@@ -290,7 +290,7 @@ bad_area:
290 */ 290 */
291out_of_memory: 291out_of_memory:
292 up_read(&mm->mmap_sem); 292 up_read(&mm->mmap_sem);
293 if (is_init(current)) { 293 if (is_global_init(current)) {
294 yield(); 294 yield();
295 down_read(&mm->mmap_sem); 295 down_read(&mm->mmap_sem);
296 goto survive; 296 goto survive;
diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c
index 248684f50dd9..dcd6070b85eb 100644
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -49,7 +49,6 @@ extern void gen550_progress(char *, unsigned short);
49extern void gen550_init(int, struct uart_port *); 49extern void gen550_init(int, struct uart_port *);
50extern void mv64360_pcibios_fixup(mv64x60_handle_t *bh); 50extern void mv64360_pcibios_fixup(mv64x60_handle_t *bh);
51 51
52#define BIT(x) (1<<x)
53#define CHESTNUT_PRESERVE_MASK (BIT(MV64x60_CPU2DEV_0_WIN) | \ 52#define CHESTNUT_PRESERVE_MASK (BIT(MV64x60_CPU2DEV_0_WIN) | \
54 BIT(MV64x60_CPU2DEV_1_WIN) | \ 53 BIT(MV64x60_CPU2DEV_1_WIN) | \
55 BIT(MV64x60_CPU2DEV_2_WIN) | \ 54 BIT(MV64x60_CPU2DEV_2_WIN) | \
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index b71132166f60..4ec716d8c1a6 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -529,21 +529,7 @@ source "drivers/Kconfig"
529 529
530source "fs/Kconfig" 530source "fs/Kconfig"
531 531
532menu "Instrumentation Support" 532source "kernel/Kconfig.instrumentation"
533
534source "arch/s390/oprofile/Kconfig"
535
536config KPROBES
537 bool "Kprobes (EXPERIMENTAL)"
538 depends on EXPERIMENTAL && MODULES
539 help
540 Kprobes allows you to trap at almost any kernel address and
541 execute a callback function. register_kprobe() establishes
542 a probepoint and specifies the callback. Kprobes is useful
543 for kernel debugging, non-intrusive instrumentation and testing.
544 If in doubt, say "N".
545
546endmenu
547 533
548source "arch/s390/Kconfig.debug" 534source "arch/s390/Kconfig.debug"
549 535
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index abb447a3e472..70c57378f426 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -166,7 +166,7 @@ void show_regs(struct pt_regs *regs)
166 166
167 printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted()); 167 printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted());
168 printk("Process %s (pid: %d, task: %p, ksp: %p)\n", 168 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
169 current->comm, current->pid, (void *) tsk, 169 current->comm, task_pid_nr(current), (void *) tsk,
170 (void *) tsk->thread.ksp); 170 (void *) tsk->thread.ksp);
171 171
172 show_registers(regs); 172 show_registers(regs);
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index 60604b2819b2..b159a9d65680 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -64,7 +64,7 @@ out:
64 64
65out_of_memory: 65out_of_memory:
66 up_read(&mm->mmap_sem); 66 up_read(&mm->mmap_sem);
67 if (is_init(current)) { 67 if (is_global_init(current)) {
68 yield(); 68 yield();
69 down_read(&mm->mmap_sem); 69 down_read(&mm->mmap_sem);
70 goto survive; 70 goto survive;
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 14c241ccdd4d..2456b52ed068 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -211,7 +211,7 @@ static int do_out_of_memory(struct pt_regs *regs, unsigned long error_code,
211 struct mm_struct *mm = tsk->mm; 211 struct mm_struct *mm = tsk->mm;
212 212
213 up_read(&mm->mmap_sem); 213 up_read(&mm->mmap_sem);
214 if (is_init(tsk)) { 214 if (is_global_init(tsk)) {
215 yield(); 215 yield();
216 down_read(&mm->mmap_sem); 216 down_read(&mm->mmap_sem);
217 return 1; 217 return 1;
diff --git a/arch/s390/oprofile/Kconfig b/arch/s390/oprofile/Kconfig
deleted file mode 100644
index 208220a5f23f..000000000000
--- a/arch/s390/oprofile/Kconfig
+++ /dev/null
@@ -1,22 +0,0 @@
1
2menu "Profiling support"
3
4config PROFILING
5 bool "Profiling support"
6 help
7 Say Y here to enable profiling support mechanisms used by
8 profilers such as readprofile or OProfile.
9
10
11config OPROFILE
12 tristate "OProfile system profiling"
13 depends on PROFILING
14 help
15 OProfile is a profiling system capable of profiling the
16 whole system, include the kernel, kernel modules, libraries,
17 and applications.
18
19 If unsure, say N.
20
21endmenu
22
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 44982c1dfa23..247f8a65e733 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -758,7 +758,7 @@ source "drivers/Kconfig"
758 758
759source "fs/Kconfig" 759source "fs/Kconfig"
760 760
761source "arch/sh/oprofile/Kconfig" 761source "kernel/Kconfig.instrumentation"
762 762
763source "arch/sh/Kconfig.debug" 763source "arch/sh/Kconfig.debug"
764 764
diff --git a/arch/sh/boards/hp6xx/pm.c b/arch/sh/boards/hp6xx/pm.c
index 8143d1b948e7..d22f6eac9cca 100644
--- a/arch/sh/boards/hp6xx/pm.c
+++ b/arch/sh/boards/hp6xx/pm.c
@@ -67,14 +67,14 @@ static int hp6x0_pm_enter(suspend_state_t state)
67 return 0; 67 return 0;
68} 68}
69 69
70static struct pm_ops hp6x0_pm_ops = { 70static struct platform_suspend_ops hp6x0_pm_ops = {
71 .enter = hp6x0_pm_enter, 71 .enter = hp6x0_pm_enter,
72 .valid = pm_valid_only_mem, 72 .valid = suspend_valid_only_mem,
73}; 73};
74 74
75static int __init hp6x0_pm_init(void) 75static int __init hp6x0_pm_init(void)
76{ 76{
77 pm_set_ops(&hp6x0_pm_ops); 77 suspend_set_ops(&hp6x0_pm_ops);
78 return 0; 78 return 0;
79} 79}
80 80
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index 790ed69b8666..5c17de51987e 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -104,24 +104,3 @@ NORET_TYPE void machine_kexec(struct kimage *image)
104 (*rnk)(page_list, reboot_code_buffer, image->start, vbr_reg); 104 (*rnk)(page_list, reboot_code_buffer, image->start, vbr_reg);
105} 105}
106 106
107/* crashkernel=size@addr specifies the location to reserve for
108 * a crash kernel. By reserving this memory we guarantee
109 * that linux never sets it up as a DMA target.
110 * Useful for holding code to do something appropriate
111 * after a kernel panic.
112 */
113static int __init parse_crashkernel(char *arg)
114{
115 unsigned long size, base;
116 size = memparse(arg, &arg);
117 if (*arg == '@') {
118 base = memparse(arg+1, &arg);
119 /* FIXME: Do I want a sanity check
120 * to validate the memory range?
121 */
122 crashk_res.start = base;
123 crashk_res.end = base + size - 1;
124 }
125 return 0;
126}
127early_param("crashkernel", parse_crashkernel);
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index b4469992d6b2..6d7f2b07e491 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -121,7 +121,7 @@ void machine_power_off(void)
121void show_regs(struct pt_regs * regs) 121void show_regs(struct pt_regs * regs)
122{ 122{
123 printk("\n"); 123 printk("\n");
124 printk("Pid : %d, Comm: %20s\n", current->pid, current->comm); 124 printk("Pid : %d, Comm: %20s\n", task_pid_nr(current), current->comm);
125 print_symbol("PC is at %s\n", instruction_pointer(regs)); 125 print_symbol("PC is at %s\n", instruction_pointer(regs));
126 printk("PC : %08lx SP : %08lx SR : %08lx ", 126 printk("PC : %08lx SP : %08lx SR : %08lx ",
127 regs->pc, regs->regs[15], regs->sr); 127 regs->pc, regs->regs[15], regs->sr);
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index b3027a6775b9..b749403f6b38 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -128,6 +128,37 @@ static void __init register_bootmem_low_pages(void)
128 free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(pages)); 128 free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(pages));
129} 129}
130 130
131#ifdef CONFIG_KEXEC
132static void __init reserve_crashkernel(void)
133{
134 unsigned long long free_mem;
135 unsigned long long crash_size, crash_base;
136 int ret;
137
138 free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT;
139
140 ret = parse_crashkernel(boot_command_line, free_mem,
141 &crash_size, &crash_base);
142 if (ret == 0 && crash_size) {
143 if (crash_base > 0) {
144 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
145 "for crashkernel (System RAM: %ldMB)\n",
146 (unsigned long)(crash_size >> 20),
147 (unsigned long)(crash_base >> 20),
148 (unsigned long)(free_mem >> 20));
149 crashk_res.start = crash_base;
150 crashk_res.end = crash_base + crash_size - 1;
151 reserve_bootmem(crash_base, crash_size);
152 } else
153 printk(KERN_INFO "crashkernel reservation failed - "
154 "you have to specify a base address\n");
155 }
156}
157#else
158static inline void __init reserve_crashkernel(void)
159{}
160#endif
161
131void __init setup_bootmem_allocator(unsigned long free_pfn) 162void __init setup_bootmem_allocator(unsigned long free_pfn)
132{ 163{
133 unsigned long bootmap_size; 164 unsigned long bootmap_size;
@@ -189,11 +220,8 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
189 } 220 }
190 } 221 }
191#endif 222#endif
192#ifdef CONFIG_KEXEC 223
193 if (crashk_res.start != crashk_res.end) 224 reserve_crashkernel();
194 reserve_bootmem(crashk_res.start,
195 crashk_res.end - crashk_res.start + 1);
196#endif
197} 225}
198 226
199#ifndef CONFIG_NEED_MULTIPLE_NODES 227#ifndef CONFIG_NEED_MULTIPLE_NODES
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 2f42442cf164..ca754fd42437 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -382,7 +382,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
382 set_fs(USER_DS); 382 set_fs(USER_DS);
383 383
384 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", 384 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
385 current->comm, current->pid, frame, regs->pc, regs->pr); 385 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
386 386
387 flush_cache_sigtramp(regs->pr); 387 flush_cache_sigtramp(regs->pr);
388 388
@@ -462,7 +462,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
462 set_fs(USER_DS); 462 set_fs(USER_DS);
463 463
464 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n", 464 pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
465 current->comm, current->pid, frame, regs->pc, regs->pr); 465 current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);
466 466
467 flush_cache_sigtramp(regs->pr); 467 flush_cache_sigtramp(regs->pr);
468 468
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index dcb46e71da1c..cf99111cb33f 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -95,8 +95,8 @@ void die(const char * str, struct pt_regs * regs, long err)
95 print_modules(); 95 print_modules();
96 show_regs(regs); 96 show_regs(regs);
97 97
98 printk("Process: %s (pid: %d, stack limit = %p)\n", 98 printk("Process: %s (pid: %d, stack limit = %p)\n", current->comm,
99 current->comm, current->pid, task_stack_page(current) + 1); 99 task_pid_nr(current), task_stack_page(current) + 1);
100 100
101 if (!user_mode(regs) || in_interrupt()) 101 if (!user_mode(regs) || in_interrupt())
102 dump_mem("Stack: ", regs->regs[15], THREAD_SIZE + 102 dump_mem("Stack: ", regs->regs[15], THREAD_SIZE +
@@ -386,7 +386,8 @@ static int handle_unaligned_access(u16 instruction, struct pt_regs *regs)
386 386
387 printk(KERN_NOTICE "Fixing up unaligned userspace access " 387 printk(KERN_NOTICE "Fixing up unaligned userspace access "
388 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", 388 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
389 current->comm,current->pid,(u16*)regs->pc,instruction); 389 current->comm, task_pid_nr(current),
390 (u16 *)regs->pc, instruction);
390 } 391 }
391 392
392 ret = -EFAULT; 393 ret = -EFAULT;
diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index 4729668ce5bf..f33cedb353fc 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -207,7 +207,7 @@ no_context:
207 */ 207 */
208out_of_memory: 208out_of_memory:
209 up_read(&mm->mmap_sem); 209 up_read(&mm->mmap_sem);
210 if (is_init(current)) { 210 if (is_global_init(current)) {
211 yield(); 211 yield();
212 down_read(&mm->mmap_sem); 212 down_read(&mm->mmap_sem);
213 goto survive; 213 goto survive;
diff --git a/arch/sh/oprofile/Kconfig b/arch/sh/oprofile/Kconfig
deleted file mode 100644
index 5ade19801b97..000000000000
--- a/arch/sh/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig
index b3327ce8e82f..ba204bac49df 100644
--- a/arch/sh64/Kconfig
+++ b/arch/sh64/Kconfig
@@ -284,7 +284,7 @@ source "drivers/Kconfig"
284 284
285source "fs/Kconfig" 285source "fs/Kconfig"
286 286
287source "arch/sh64/oprofile/Kconfig" 287source "kernel/Kconfig.instrumentation"
288 288
289source "arch/sh64/Kconfig.debug" 289source "arch/sh64/Kconfig.debug"
290 290
diff --git a/arch/sh64/kernel/pci_sh5.c b/arch/sh64/kernel/pci_sh5.c
index 388bb711f1b0..b4d9534d2b0e 100644
--- a/arch/sh64/kernel/pci_sh5.c
+++ b/arch/sh64/kernel/pci_sh5.c
@@ -480,7 +480,7 @@ static int __init pcibios_init(void)
480 return -EINVAL; 480 return -EINVAL;
481 } 481 }
482 482
483 /* The pci subsytem needs to know where memory is and how much 483 /* The pci subsystem needs to know where memory is and how much
484 * of it there is. I've simply made these globals. A better mechanism 484 * of it there is. I've simply made these globals. A better mechanism
485 * is probably needed. 485 * is probably needed.
486 */ 486 */
diff --git a/arch/sh64/kernel/traps.c b/arch/sh64/kernel/traps.c
index 9d0d58fb29fa..c03101fab467 100644
--- a/arch/sh64/kernel/traps.c
+++ b/arch/sh64/kernel/traps.c
@@ -764,7 +764,7 @@ static int misaligned_fixup(struct pt_regs *regs)
764 --user_mode_unaligned_fixup_count; 764 --user_mode_unaligned_fixup_count;
765 /* Only do 'count' worth of these reports, to remove a potential DoS against syslog */ 765 /* Only do 'count' worth of these reports, to remove a potential DoS against syslog */
766 printk("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n", 766 printk("Fixing up unaligned userspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n",
767 current->comm, current->pid, (__u32)regs->pc, opcode); 767 current->comm, task_pid_nr(current), (__u32)regs->pc, opcode);
768 } else 768 } else
769#endif 769#endif
770 if (!user_mode(regs) && (kernel_mode_unaligned_fixup_count > 0)) { 770 if (!user_mode(regs) && (kernel_mode_unaligned_fixup_count > 0)) {
@@ -774,7 +774,7 @@ static int misaligned_fixup(struct pt_regs *regs)
774 (__u32)regs->pc, opcode); 774 (__u32)regs->pc, opcode);
775 } else { 775 } else {
776 printk("Fixing up unaligned kernelspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n", 776 printk("Fixing up unaligned kernelspace access in \"%s\" pid=%d pc=0x%08x ins=0x%08lx\n",
777 current->comm, current->pid, (__u32)regs->pc, opcode); 777 current->comm, task_pid_nr(current), (__u32)regs->pc, opcode);
778 } 778 }
779 } 779 }
780 780
diff --git a/arch/sh64/mm/fault.c b/arch/sh64/mm/fault.c
index dd81c669c79b..7c79a1ba8059 100644
--- a/arch/sh64/mm/fault.c
+++ b/arch/sh64/mm/fault.c
@@ -81,7 +81,7 @@ static inline void print_vma(struct vm_area_struct *vma)
81 81
82static inline void print_task(struct task_struct *tsk) 82static inline void print_task(struct task_struct *tsk)
83{ 83{
84 printk("Task pid %d\n", tsk->pid); 84 printk("Task pid %d\n", task_pid_nr(tsk));
85} 85}
86 86
87static pte_t *lookup_pte(struct mm_struct *mm, unsigned long address) 87static pte_t *lookup_pte(struct mm_struct *mm, unsigned long address)
@@ -272,13 +272,13 @@ bad_area:
272 * usermode, so only need a few */ 272 * usermode, so only need a few */
273 count++; 273 count++;
274 printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n", 274 printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n",
275 address, current->pid, current->comm, 275 address, task_pid_nr(current), current->comm,
276 (unsigned long) regs->pc); 276 (unsigned long) regs->pc);
277#if 0 277#if 0
278 show_regs(regs); 278 show_regs(regs);
279#endif 279#endif
280 } 280 }
281 if (is_init(tsk)) { 281 if (is_global_init(tsk)) {
282 panic("INIT had user mode bad_area\n"); 282 panic("INIT had user mode bad_area\n");
283 } 283 }
284 tsk->thread.address = address; 284 tsk->thread.address = address;
@@ -320,14 +320,14 @@ no_context:
320 * us unable to handle the page fault gracefully. 320 * us unable to handle the page fault gracefully.
321 */ 321 */
322out_of_memory: 322out_of_memory:
323 if (is_init(current)) { 323 if (is_global_init(current)) {
324 panic("INIT out of memory\n"); 324 panic("INIT out of memory\n");
325 yield(); 325 yield();
326 goto survive; 326 goto survive;
327 } 327 }
328 printk("fault:Out of memory\n"); 328 printk("fault:Out of memory\n");
329 up_read(&mm->mmap_sem); 329 up_read(&mm->mmap_sem);
330 if (is_init(current)) { 330 if (is_global_init(current)) {
331 yield(); 331 yield();
332 down_read(&mm->mmap_sem); 332 down_read(&mm->mmap_sem);
333 goto survive; 333 goto survive;
diff --git a/arch/sh64/oprofile/Kconfig b/arch/sh64/oprofile/Kconfig
deleted file mode 100644
index 19d37730b664..000000000000
--- a/arch/sh64/oprofile/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING
6 bool "Profiling support (EXPERIMENTAL)"
7 help
8 Say Y here to enable the extended profiling support mechanisms used
9 by profilers such as OProfile.
10
11
12config OPROFILE
13 tristate "OProfile system profiling (EXPERIMENTAL)"
14 depends on PROFILING
15 help
16 OProfile is a profiling system capable of profiling the
17 whole system, include the kernel, kernel modules, libraries,
18 and applications.
19
20 If unsure, say N.
21
22endmenu
23
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c0f4ba109daa..527adc808ad6 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -320,11 +320,7 @@ endmenu
320 320
321source "fs/Kconfig" 321source "fs/Kconfig"
322 322
323menu "Instrumentation Support" 323source "kernel/Kconfig.instrumentation"
324
325source "arch/sparc/oprofile/Kconfig"
326
327endmenu
328 324
329source "arch/sparc/Kconfig.debug" 325source "arch/sparc/Kconfig.debug"
330 326
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index fb2caef79cec..3ea000d15e3a 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -585,24 +585,6 @@ static int __init of_debug(char *str)
585 585
586__setup("of_debug=", of_debug); 586__setup("of_debug=", of_debug);
587 587
588int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
589{
590 /* initialize common driver fields */
591 if (!drv->driver.name)
592 drv->driver.name = drv->name;
593 if (!drv->driver.owner)
594 drv->driver.owner = drv->owner;
595 drv->driver.bus = bus;
596
597 /* register with core */
598 return driver_register(&drv->driver);
599}
600
601void of_unregister_driver(struct of_platform_driver *drv)
602{
603 driver_unregister(&drv->driver);
604}
605
606struct of_device* of_platform_device_create(struct device_node *np, 588struct of_device* of_platform_device_create(struct device_node *np,
607 const char *bus_id, 589 const char *bus_id,
608 struct device *parent, 590 struct device *parent,
@@ -628,6 +610,4 @@ struct of_device* of_platform_device_create(struct device_node *np,
628 return dev; 610 return dev;
629} 611}
630 612
631EXPORT_SYMBOL(of_register_driver);
632EXPORT_SYMBOL(of_unregister_driver);
633EXPORT_SYMBOL(of_platform_device_create); 613EXPORT_SYMBOL(of_platform_device_create);
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index 003f8eed32f4..fe562db475e9 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -155,7 +155,7 @@ static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset,
155 /* Rest of them are completely unsupported. */ 155 /* Rest of them are completely unsupported. */
156 default: 156 default:
157 printk("%s [%d]: Wants to read user offset %ld\n", 157 printk("%s [%d]: Wants to read user offset %ld\n",
158 current->comm, current->pid, offset); 158 current->comm, task_pid_nr(current), offset);
159 pt_error_return(regs, EIO); 159 pt_error_return(regs, EIO);
160 return; 160 return;
161 } 161 }
@@ -222,7 +222,7 @@ static inline void write_sunos_user(struct pt_regs *regs, unsigned long offset,
222 /* Rest of them are completely unsupported or "no-touch". */ 222 /* Rest of them are completely unsupported or "no-touch". */
223 default: 223 default:
224 printk("%s [%d]: Wants to write user offset %ld\n", 224 printk("%s [%d]: Wants to write user offset %ld\n",
225 current->comm, current->pid, offset); 225 current->comm, task_pid_nr(current), offset);
226 goto failure; 226 goto failure;
227 } 227 }
228success: 228success:
diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c
index 6c0221e9a9f5..42bf09db9a81 100644
--- a/arch/sparc/kernel/sys_sparc.c
+++ b/arch/sparc/kernel/sys_sparc.c
@@ -357,7 +357,7 @@ c_sys_nis_syscall (struct pt_regs *regs)
357 if (count++ > 5) 357 if (count++ > 5)
358 return -ENOSYS; 358 return -ENOSYS;
359 printk ("%s[%d]: Unimplemented SPARC system call %d\n", 359 printk ("%s[%d]: Unimplemented SPARC system call %d\n",
360 current->comm, current->pid, (int)regs->u_regs[1]); 360 current->comm, task_pid_nr(current), (int)regs->u_regs[1]);
361#ifdef DEBUG_UNIMP_SYSCALL 361#ifdef DEBUG_UNIMP_SYSCALL
362 show_regs (regs); 362 show_regs (regs);
363#endif 363#endif
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index f807172cab0e..28c187c5d9fd 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -866,7 +866,7 @@ asmlinkage int sunos_killpg(int pgrp, int sig)
866 rcu_read_lock(); 866 rcu_read_lock();
867 ret = -EINVAL; 867 ret = -EINVAL;
868 if (pgrp > 0) 868 if (pgrp > 0)
869 ret = kill_pgrp(find_pid(pgrp), sig, 0); 869 ret = kill_pgrp(find_vpid(pgrp), sig, 0);
870 rcu_read_unlock(); 870 rcu_read_unlock();
871 871
872 return ret; 872 return ret;
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 3bc3bff51e08..d404e7994527 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -38,7 +38,7 @@ struct trap_trace_entry trapbuf[1024];
38 38
39void syscall_trace_entry(struct pt_regs *regs) 39void syscall_trace_entry(struct pt_regs *regs)
40{ 40{
41 printk("%s[%d]: ", current->comm, current->pid); 41 printk("%s[%d]: ", current->comm, task_pid_nr(current));
42 printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1], 42 printk("scall<%d> (could be %d)\n", (int) regs->u_regs[UREG_G1],
43 (int) regs->u_regs[UREG_I0]); 43 (int) regs->u_regs[UREG_I0]);
44} 44}
@@ -99,7 +99,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
99" /_| \\__/ |_\\\n" 99" /_| \\__/ |_\\\n"
100" \\__U_/\n"); 100" \\__U_/\n");
101 101
102 printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter); 102 printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
103 show_regs(regs); 103 show_regs(regs);
104 add_taint(TAINT_DIE); 104 add_taint(TAINT_DIE);
105 105
diff --git a/arch/sparc/oprofile/Kconfig b/arch/sparc/oprofile/Kconfig
deleted file mode 100644
index d8a84088471a..000000000000
--- a/arch/sparc/oprofile/Kconfig
+++ /dev/null
@@ -1,17 +0,0 @@
1config PROFILING
2 bool "Profiling support (EXPERIMENTAL)"
3 help
4 Say Y here to enable the extended profiling support mechanisms used
5 by profilers such as OProfile.
6
7
8config OPROFILE
9 tristate "OProfile system profiling (EXPERIMENTAL)"
10 depends on PROFILING
11 help
12 OProfile is a profiling system capable of profiling the
13 whole system, include the kernel, kernel modules, libraries,
14 and applications.
15
16 If unsure, say N.
17
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 59c4d752d286..c7a74e376985 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -460,20 +460,7 @@ source "drivers/fc4/Kconfig"
460 460
461source "fs/Kconfig" 461source "fs/Kconfig"
462 462
463menu "Instrumentation Support" 463source "kernel/Kconfig.instrumentation"
464
465source "arch/sparc64/oprofile/Kconfig"
466
467config KPROBES
468 bool "Kprobes (EXPERIMENTAL)"
469 depends on KALLSYMS && EXPERIMENTAL && MODULES
470 help
471 Kprobes allows you to trap at almost any kernel address and
472 execute a callback function. register_kprobe() establishes
473 a probepoint and specifies the callback. Kprobes is useful
474 for kernel debugging, non-intrusive instrumentation and testing.
475 If in doubt, say "N".
476endmenu
477 464
478source "arch/sparc64/Kconfig.debug" 465source "arch/sparc64/Kconfig.debug"
479 466
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index f3922e5a89f6..2c3bea228159 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -877,7 +877,7 @@ void __cpuinit sun4v_register_mondo_queues(int this_cpu)
877static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask) 877static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask)
878{ 878{
879 unsigned long size = PAGE_ALIGN(qmask + 1); 879 unsigned long size = PAGE_ALIGN(qmask + 1);
880 void *p = __alloc_bootmem_low(size, size, 0); 880 void *p = __alloc_bootmem(size, size, 0);
881 if (!p) { 881 if (!p) {
882 prom_printf("SUN4V: Error, cannot allocate mondo queue.\n"); 882 prom_printf("SUN4V: Error, cannot allocate mondo queue.\n");
883 prom_halt(); 883 prom_halt();
@@ -889,7 +889,7 @@ static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask)
889static void __init alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask) 889static void __init alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask)
890{ 890{
891 unsigned long size = PAGE_ALIGN(qmask + 1); 891 unsigned long size = PAGE_ALIGN(qmask + 1);
892 void *p = __alloc_bootmem_low(size, size, 0); 892 void *p = __alloc_bootmem(size, size, 0);
893 893
894 if (!p) { 894 if (!p) {
895 prom_printf("SUN4V: Error, cannot allocate kbuf page.\n"); 895 prom_printf("SUN4V: Error, cannot allocate kbuf page.\n");
@@ -906,7 +906,7 @@ static void __init init_cpu_send_mondo_info(struct trap_per_cpu *tb)
906 906
907 BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64)); 907 BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64));
908 908
909 page = alloc_bootmem_low_pages(PAGE_SIZE); 909 page = alloc_bootmem_pages(PAGE_SIZE);
910 if (!page) { 910 if (!page) {
911 prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n"); 911 prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n");
912 prom_halt(); 912 prom_halt();
@@ -953,7 +953,7 @@ void __init init_IRQ(void)
953 kill_prom_timer(); 953 kill_prom_timer();
954 954
955 size = sizeof(struct ino_bucket) * NUM_IVECS; 955 size = sizeof(struct ino_bucket) * NUM_IVECS;
956 ivector_table = alloc_bootmem_low(size); 956 ivector_table = alloc_bootmem(size);
957 if (!ivector_table) { 957 if (!ivector_table) {
958 prom_printf("Fatal error, cannot allocate ivector_table\n"); 958 prom_printf("Fatal error, cannot allocate ivector_table\n");
959 prom_halt(); 959 prom_halt();
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index 42d779866fba..fc5c0cc793b8 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -869,26 +869,6 @@ static int __init of_debug(char *str)
869 869
870__setup("of_debug=", of_debug); 870__setup("of_debug=", of_debug);
871 871
872int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
873{
874 /* initialize common driver fields */
875 if (!drv->driver.name)
876 drv->driver.name = drv->name;
877 if (!drv->driver.owner)
878 drv->driver.owner = drv->owner;
879 drv->driver.bus = bus;
880
881 /* register with core */
882 return driver_register(&drv->driver);
883}
884EXPORT_SYMBOL(of_register_driver);
885
886void of_unregister_driver(struct of_platform_driver *drv)
887{
888 driver_unregister(&drv->driver);
889}
890EXPORT_SYMBOL(of_unregister_driver);
891
892struct of_device* of_platform_device_create(struct device_node *np, 872struct of_device* of_platform_device_create(struct device_node *np,
893 const char *bus_id, 873 const char *bus_id,
894 struct device *parent, 874 struct device *parent,
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index c76bfbb7da08..923e0bcc3bfd 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -396,6 +396,13 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm)
396 396
397 saw_mem = saw_io = 0; 397 saw_mem = saw_io = 0;
398 pbm_ranges = of_get_property(pbm->prom_node, "ranges", &i); 398 pbm_ranges = of_get_property(pbm->prom_node, "ranges", &i);
399 if (!pbm_ranges) {
400 prom_printf("PCI: Fatal error, missing PBM ranges property "
401 " for %s\n",
402 pbm->name);
403 prom_halt();
404 }
405
399 num_pbm_ranges = i / sizeof(*pbm_ranges); 406 num_pbm_ranges = i / sizeof(*pbm_ranges);
400 407
401 for (i = 0; i < num_pbm_ranges; i++) { 408 for (i = 0; i < num_pbm_ranges; i++) {
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index 8f7a06e2c7e7..170d6ca8de6f 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -831,7 +831,7 @@ asmlinkage int sunos_killpg(int pgrp, int sig)
831 rcu_read_lock(); 831 rcu_read_lock();
832 ret = -EINVAL; 832 ret = -EINVAL;
833 if (pgrp > 0) 833 if (pgrp > 0)
834 ret = kill_pgrp(find_pid(pgrp), sig, 0); 834 ret = kill_pgrp(find_vpid(pgrp), sig, 0);
835 rcu_read_unlock(); 835 rcu_read_unlock();
836 836
837 return ret; 837 return ret;
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 34573a55b6e5..e9c7e4f07abf 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -2225,7 +2225,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
2225" /_| \\__/ |_\\\n" 2225" /_| \\__/ |_\\\n"
2226" \\__U_/\n"); 2226" \\__U_/\n");
2227 2227
2228 printk("%s(%d): %s [#%d]\n", current->comm, current->pid, str, ++die_counter); 2228 printk("%s(%d): %s [#%d]\n", current->comm, task_pid_nr(current), str, ++die_counter);
2229 notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV); 2229 notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV);
2230 __asm__ __volatile__("flushw"); 2230 __asm__ __volatile__("flushw");
2231 __show_regs(regs); 2231 __show_regs(regs);
diff --git a/arch/sparc64/lib/atomic.S b/arch/sparc64/lib/atomic.S
index 9633750167d0..70ac4186f62b 100644
--- a/arch/sparc64/lib/atomic.S
+++ b/arch/sparc64/lib/atomic.S
@@ -1,10 +1,10 @@
1/* $Id: atomic.S,v 1.4 2001/11/18 00:12:56 davem Exp $ 1/* atomic.S: These things are too big to do inline.
2 * atomic.S: These things are too big to do inline.
3 * 2 *
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 3 * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#include <asm/asi.h> 6#include <asm/asi.h>
7#include <asm/backoff.h>
8 8
9 .text 9 .text
10 10
@@ -16,27 +16,31 @@
16 .globl atomic_add 16 .globl atomic_add
17 .type atomic_add,#function 17 .type atomic_add,#function
18atomic_add: /* %o0 = increment, %o1 = atomic_ptr */ 18atomic_add: /* %o0 = increment, %o1 = atomic_ptr */
19 BACKOFF_SETUP(%o2)
191: lduw [%o1], %g1 201: lduw [%o1], %g1
20 add %g1, %o0, %g7 21 add %g1, %o0, %g7
21 cas [%o1], %g1, %g7 22 cas [%o1], %g1, %g7
22 cmp %g1, %g7 23 cmp %g1, %g7
23 bne,pn %icc, 1b 24 bne,pn %icc, 2f
24 nop 25 nop
25 retl 26 retl
26 nop 27 nop
282: BACKOFF_SPIN(%o2, %o3, 1b)
27 .size atomic_add, .-atomic_add 29 .size atomic_add, .-atomic_add
28 30
29 .globl atomic_sub 31 .globl atomic_sub
30 .type atomic_sub,#function 32 .type atomic_sub,#function
31atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */ 33atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
34 BACKOFF_SETUP(%o2)
321: lduw [%o1], %g1 351: lduw [%o1], %g1
33 sub %g1, %o0, %g7 36 sub %g1, %o0, %g7
34 cas [%o1], %g1, %g7 37 cas [%o1], %g1, %g7
35 cmp %g1, %g7 38 cmp %g1, %g7
36 bne,pn %icc, 1b 39 bne,pn %icc, 2f
37 nop 40 nop
38 retl 41 retl
39 nop 42 nop
432: BACKOFF_SPIN(%o2, %o3, 1b)
40 .size atomic_sub, .-atomic_sub 44 .size atomic_sub, .-atomic_sub
41 45
42 /* On SMP we need to use memory barriers to ensure 46 /* On SMP we need to use memory barriers to ensure
@@ -60,89 +64,101 @@ atomic_sub: /* %o0 = decrement, %o1 = atomic_ptr */
60 .globl atomic_add_ret 64 .globl atomic_add_ret
61 .type atomic_add_ret,#function 65 .type atomic_add_ret,#function
62atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 66atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
67 BACKOFF_SETUP(%o2)
63 ATOMIC_PRE_BARRIER 68 ATOMIC_PRE_BARRIER
641: lduw [%o1], %g1 691: lduw [%o1], %g1
65 add %g1, %o0, %g7 70 add %g1, %o0, %g7
66 cas [%o1], %g1, %g7 71 cas [%o1], %g1, %g7
67 cmp %g1, %g7 72 cmp %g1, %g7
68 bne,pn %icc, 1b 73 bne,pn %icc, 2f
69 add %g7, %o0, %g7 74 add %g7, %o0, %g7
70 sra %g7, 0, %o0 75 sra %g7, 0, %o0
71 ATOMIC_POST_BARRIER 76 ATOMIC_POST_BARRIER
72 retl 77 retl
73 nop 78 nop
792: BACKOFF_SPIN(%o2, %o3, 1b)
74 .size atomic_add_ret, .-atomic_add_ret 80 .size atomic_add_ret, .-atomic_add_ret
75 81
76 .globl atomic_sub_ret 82 .globl atomic_sub_ret
77 .type atomic_sub_ret,#function 83 .type atomic_sub_ret,#function
78atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 84atomic_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
85 BACKOFF_SETUP(%o2)
79 ATOMIC_PRE_BARRIER 86 ATOMIC_PRE_BARRIER
801: lduw [%o1], %g1 871: lduw [%o1], %g1
81 sub %g1, %o0, %g7 88 sub %g1, %o0, %g7
82 cas [%o1], %g1, %g7 89 cas [%o1], %g1, %g7
83 cmp %g1, %g7 90 cmp %g1, %g7
84 bne,pn %icc, 1b 91 bne,pn %icc, 2f
85 sub %g7, %o0, %g7 92 sub %g7, %o0, %g7
86 sra %g7, 0, %o0 93 sra %g7, 0, %o0
87 ATOMIC_POST_BARRIER 94 ATOMIC_POST_BARRIER
88 retl 95 retl
89 nop 96 nop
972: BACKOFF_SPIN(%o2, %o3, 1b)
90 .size atomic_sub_ret, .-atomic_sub_ret 98 .size atomic_sub_ret, .-atomic_sub_ret
91 99
92 .globl atomic64_add 100 .globl atomic64_add
93 .type atomic64_add,#function 101 .type atomic64_add,#function
94atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */ 102atomic64_add: /* %o0 = increment, %o1 = atomic_ptr */
103 BACKOFF_SETUP(%o2)
951: ldx [%o1], %g1 1041: ldx [%o1], %g1
96 add %g1, %o0, %g7 105 add %g1, %o0, %g7
97 casx [%o1], %g1, %g7 106 casx [%o1], %g1, %g7
98 cmp %g1, %g7 107 cmp %g1, %g7
99 bne,pn %xcc, 1b 108 bne,pn %xcc, 2f
100 nop 109 nop
101 retl 110 retl
102 nop 111 nop
1122: BACKOFF_SPIN(%o2, %o3, 1b)
103 .size atomic64_add, .-atomic64_add 113 .size atomic64_add, .-atomic64_add
104 114
105 .globl atomic64_sub 115 .globl atomic64_sub
106 .type atomic64_sub,#function 116 .type atomic64_sub,#function
107atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */ 117atomic64_sub: /* %o0 = decrement, %o1 = atomic_ptr */
118 BACKOFF_SETUP(%o2)
1081: ldx [%o1], %g1 1191: ldx [%o1], %g1
109 sub %g1, %o0, %g7 120 sub %g1, %o0, %g7
110 casx [%o1], %g1, %g7 121 casx [%o1], %g1, %g7
111 cmp %g1, %g7 122 cmp %g1, %g7
112 bne,pn %xcc, 1b 123 bne,pn %xcc, 2f
113 nop 124 nop
114 retl 125 retl
115 nop 126 nop
1272: BACKOFF_SPIN(%o2, %o3, 1b)
116 .size atomic64_sub, .-atomic64_sub 128 .size atomic64_sub, .-atomic64_sub
117 129
118 .globl atomic64_add_ret 130 .globl atomic64_add_ret
119 .type atomic64_add_ret,#function 131 .type atomic64_add_ret,#function
120atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ 132atomic64_add_ret: /* %o0 = increment, %o1 = atomic_ptr */
133 BACKOFF_SETUP(%o2)
121 ATOMIC_PRE_BARRIER 134 ATOMIC_PRE_BARRIER
1221: ldx [%o1], %g1 1351: ldx [%o1], %g1
123 add %g1, %o0, %g7 136 add %g1, %o0, %g7
124 casx [%o1], %g1, %g7 137 casx [%o1], %g1, %g7
125 cmp %g1, %g7 138 cmp %g1, %g7
126 bne,pn %xcc, 1b 139 bne,pn %xcc, 2f
127 add %g7, %o0, %g7 140 add %g7, %o0, %g7
128 mov %g7, %o0 141 mov %g7, %o0
129 ATOMIC_POST_BARRIER 142 ATOMIC_POST_BARRIER
130 retl 143 retl
131 nop 144 nop
1452: BACKOFF_SPIN(%o2, %o3, 1b)
132 .size atomic64_add_ret, .-atomic64_add_ret 146 .size atomic64_add_ret, .-atomic64_add_ret
133 147
134 .globl atomic64_sub_ret 148 .globl atomic64_sub_ret
135 .type atomic64_sub_ret,#function 149 .type atomic64_sub_ret,#function
136atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */ 150atomic64_sub_ret: /* %o0 = decrement, %o1 = atomic_ptr */
151 BACKOFF_SETUP(%o2)
137 ATOMIC_PRE_BARRIER 152 ATOMIC_PRE_BARRIER
1381: ldx [%o1], %g1 1531: ldx [%o1], %g1
139 sub %g1, %o0, %g7 154 sub %g1, %o0, %g7
140 casx [%o1], %g1, %g7 155 casx [%o1], %g1, %g7
141 cmp %g1, %g7 156 cmp %g1, %g7
142 bne,pn %xcc, 1b 157 bne,pn %xcc, 2f
143 sub %g7, %o0, %g7 158 sub %g7, %o0, %g7
144 mov %g7, %o0 159 mov %g7, %o0
145 ATOMIC_POST_BARRIER 160 ATOMIC_POST_BARRIER
146 retl 161 retl
147 nop 162 nop
1632: BACKOFF_SPIN(%o2, %o3, 1b)
148 .size atomic64_sub_ret, .-atomic64_sub_ret 164 .size atomic64_sub_ret, .-atomic64_sub_ret
diff --git a/arch/sparc64/lib/bitops.S b/arch/sparc64/lib/bitops.S
index 892431a82131..6b015a6eefb5 100644
--- a/arch/sparc64/lib/bitops.S
+++ b/arch/sparc64/lib/bitops.S
@@ -1,10 +1,10 @@
1/* $Id: bitops.S,v 1.3 2001/11/18 00:12:56 davem Exp $ 1/* bitops.S: Sparc64 atomic bit operations.
2 * bitops.S: Sparc64 atomic bit operations.
3 * 2 *
4 * Copyright (C) 2000 David S. Miller (davem@redhat.com) 3 * Copyright (C) 2000, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#include <asm/asi.h> 6#include <asm/asi.h>
7#include <asm/backoff.h>
8 8
9 .text 9 .text
10 10
@@ -29,6 +29,7 @@
29 .globl test_and_set_bit 29 .globl test_and_set_bit
30 .type test_and_set_bit,#function 30 .type test_and_set_bit,#function
31test_and_set_bit: /* %o0=nr, %o1=addr */ 31test_and_set_bit: /* %o0=nr, %o1=addr */
32 BACKOFF_SETUP(%o3)
32 BITOP_PRE_BARRIER 33 BITOP_PRE_BARRIER
33 srlx %o0, 6, %g1 34 srlx %o0, 6, %g1
34 mov 1, %o2 35 mov 1, %o2
@@ -40,18 +41,20 @@ test_and_set_bit: /* %o0=nr, %o1=addr */
40 or %g7, %o2, %g1 41 or %g7, %o2, %g1
41 casx [%o1], %g7, %g1 42 casx [%o1], %g7, %g1
42 cmp %g7, %g1 43 cmp %g7, %g1
43 bne,pn %xcc, 1b 44 bne,pn %xcc, 2f
44 and %g7, %o2, %g2 45 and %g7, %o2, %g2
45 clr %o0 46 clr %o0
46 movrne %g2, 1, %o0 47 movrne %g2, 1, %o0
47 BITOP_POST_BARRIER 48 BITOP_POST_BARRIER
48 retl 49 retl
49 nop 50 nop
512: BACKOFF_SPIN(%o3, %o4, 1b)
50 .size test_and_set_bit, .-test_and_set_bit 52 .size test_and_set_bit, .-test_and_set_bit
51 53
52 .globl test_and_clear_bit 54 .globl test_and_clear_bit
53 .type test_and_clear_bit,#function 55 .type test_and_clear_bit,#function
54test_and_clear_bit: /* %o0=nr, %o1=addr */ 56test_and_clear_bit: /* %o0=nr, %o1=addr */
57 BACKOFF_SETUP(%o3)
55 BITOP_PRE_BARRIER 58 BITOP_PRE_BARRIER
56 srlx %o0, 6, %g1 59 srlx %o0, 6, %g1
57 mov 1, %o2 60 mov 1, %o2
@@ -63,18 +66,20 @@ test_and_clear_bit: /* %o0=nr, %o1=addr */
63 andn %g7, %o2, %g1 66 andn %g7, %o2, %g1
64 casx [%o1], %g7, %g1 67 casx [%o1], %g7, %g1
65 cmp %g7, %g1 68 cmp %g7, %g1
66 bne,pn %xcc, 1b 69 bne,pn %xcc, 2f
67 and %g7, %o2, %g2 70 and %g7, %o2, %g2
68 clr %o0 71 clr %o0
69 movrne %g2, 1, %o0 72 movrne %g2, 1, %o0
70 BITOP_POST_BARRIER 73 BITOP_POST_BARRIER
71 retl 74 retl
72 nop 75 nop
762: BACKOFF_SPIN(%o3, %o4, 1b)
73 .size test_and_clear_bit, .-test_and_clear_bit 77 .size test_and_clear_bit, .-test_and_clear_bit
74 78
75 .globl test_and_change_bit 79 .globl test_and_change_bit
76 .type test_and_change_bit,#function 80 .type test_and_change_bit,#function
77test_and_change_bit: /* %o0=nr, %o1=addr */ 81test_and_change_bit: /* %o0=nr, %o1=addr */
82 BACKOFF_SETUP(%o3)
78 BITOP_PRE_BARRIER 83 BITOP_PRE_BARRIER
79 srlx %o0, 6, %g1 84 srlx %o0, 6, %g1
80 mov 1, %o2 85 mov 1, %o2
@@ -86,18 +91,20 @@ test_and_change_bit: /* %o0=nr, %o1=addr */
86 xor %g7, %o2, %g1 91 xor %g7, %o2, %g1
87 casx [%o1], %g7, %g1 92 casx [%o1], %g7, %g1
88 cmp %g7, %g1 93 cmp %g7, %g1
89 bne,pn %xcc, 1b 94 bne,pn %xcc, 2f
90 and %g7, %o2, %g2 95 and %g7, %o2, %g2
91 clr %o0 96 clr %o0
92 movrne %g2, 1, %o0 97 movrne %g2, 1, %o0
93 BITOP_POST_BARRIER 98 BITOP_POST_BARRIER
94 retl 99 retl
95 nop 100 nop
1012: BACKOFF_SPIN(%o3, %o4, 1b)
96 .size test_and_change_bit, .-test_and_change_bit 102 .size test_and_change_bit, .-test_and_change_bit
97 103
98 .globl set_bit 104 .globl set_bit
99 .type set_bit,#function 105 .type set_bit,#function
100set_bit: /* %o0=nr, %o1=addr */ 106set_bit: /* %o0=nr, %o1=addr */
107 BACKOFF_SETUP(%o3)
101 srlx %o0, 6, %g1 108 srlx %o0, 6, %g1
102 mov 1, %o2 109 mov 1, %o2
103 sllx %g1, 3, %g3 110 sllx %g1, 3, %g3
@@ -108,15 +115,17 @@ set_bit: /* %o0=nr, %o1=addr */
108 or %g7, %o2, %g1 115 or %g7, %o2, %g1
109 casx [%o1], %g7, %g1 116 casx [%o1], %g7, %g1
110 cmp %g7, %g1 117 cmp %g7, %g1
111 bne,pn %xcc, 1b 118 bne,pn %xcc, 2f
112 nop 119 nop
113 retl 120 retl
114 nop 121 nop
1222: BACKOFF_SPIN(%o3, %o4, 1b)
115 .size set_bit, .-set_bit 123 .size set_bit, .-set_bit
116 124
117 .globl clear_bit 125 .globl clear_bit
118 .type clear_bit,#function 126 .type clear_bit,#function
119clear_bit: /* %o0=nr, %o1=addr */ 127clear_bit: /* %o0=nr, %o1=addr */
128 BACKOFF_SETUP(%o3)
120 srlx %o0, 6, %g1 129 srlx %o0, 6, %g1
121 mov 1, %o2 130 mov 1, %o2
122 sllx %g1, 3, %g3 131 sllx %g1, 3, %g3
@@ -127,15 +136,17 @@ clear_bit: /* %o0=nr, %o1=addr */
127 andn %g7, %o2, %g1 136 andn %g7, %o2, %g1
128 casx [%o1], %g7, %g1 137 casx [%o1], %g7, %g1
129 cmp %g7, %g1 138 cmp %g7, %g1
130 bne,pn %xcc, 1b 139 bne,pn %xcc, 2f
131 nop 140 nop
132 retl 141 retl
133 nop 142 nop
1432: BACKOFF_SPIN(%o3, %o4, 1b)
134 .size clear_bit, .-clear_bit 144 .size clear_bit, .-clear_bit
135 145
136 .globl change_bit 146 .globl change_bit
137 .type change_bit,#function 147 .type change_bit,#function
138change_bit: /* %o0=nr, %o1=addr */ 148change_bit: /* %o0=nr, %o1=addr */
149 BACKOFF_SETUP(%o3)
139 srlx %o0, 6, %g1 150 srlx %o0, 6, %g1
140 mov 1, %o2 151 mov 1, %o2
141 sllx %g1, 3, %g3 152 sllx %g1, 3, %g3
@@ -146,8 +157,9 @@ change_bit: /* %o0=nr, %o1=addr */
146 xor %g7, %o2, %g1 157 xor %g7, %o2, %g1
147 casx [%o1], %g7, %g1 158 casx [%o1], %g7, %g1
148 cmp %g7, %g1 159 cmp %g7, %g1
149 bne,pn %xcc, 1b 160 bne,pn %xcc, 2f
150 nop 161 nop
151 retl 162 retl
152 nop 163 nop
1642: BACKOFF_SPIN(%o3, %o4, 1b)
153 .size change_bit, .-change_bit 165 .size change_bit, .-change_bit
diff --git a/arch/sparc64/oprofile/Kconfig b/arch/sparc64/oprofile/Kconfig
deleted file mode 100644
index d8a84088471a..000000000000
--- a/arch/sparc64/oprofile/Kconfig
+++ /dev/null
@@ -1,17 +0,0 @@
1config PROFILING
2 bool "Profiling support (EXPERIMENTAL)"
3 help
4 Say Y here to enable the extended profiling support mechanisms used
5 by profilers such as OProfile.
6
7
8config OPROFILE
9 tristate "OProfile system profiling (EXPERIMENTAL)"
10 depends on PROFILING
11 help
12 OProfile is a profiling system capable of profiling the
13 whole system, include the kernel, kernel modules, libraries,
14 and applications.
15
16 If unsure, say N.
17
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index 3b67de7455f1..c86cb3091a8e 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -415,7 +415,7 @@ asmlinkage int solaris_procids(int cmd, s32 pid, s32 pgid)
415 415
416 switch (cmd) { 416 switch (cmd) {
417 case 0: /* getpgrp */ 417 case 0: /* getpgrp */
418 return process_group(current); 418 return task_pgrp_nr(current);
419 case 1: /* setpgrp */ 419 case 1: /* setpgrp */
420 { 420 {
421 int (*sys_setpgid)(pid_t,pid_t) = 421 int (*sys_setpgid)(pid_t,pid_t) =
@@ -426,7 +426,7 @@ asmlinkage int solaris_procids(int cmd, s32 pid, s32 pgid)
426 ret = sys_setpgid(0, 0); 426 ret = sys_setpgid(0, 0);
427 if (ret) return ret; 427 if (ret) return ret;
428 proc_clear_tty(current); 428 proc_clear_tty(current);
429 return process_group(current); 429 return task_pgrp_nr(current);
430 } 430 }
431 case 2: /* getsid */ 431 case 2: /* getsid */
432 { 432 {
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 740d8a922e48..dd1689b814cb 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -3,7 +3,7 @@ config DEFCONFIG_LIST
3 option defconfig_list 3 option defconfig_list
4 default "arch/$ARCH/defconfig" 4 default "arch/$ARCH/defconfig"
5 5
6# UML uses the generic IRQ sugsystem 6# UML uses the generic IRQ subsystem
7config GENERIC_HARDIRQS 7config GENERIC_HARDIRQS
8 bool 8 bool
9 default y 9 default y
@@ -289,4 +289,6 @@ config INPUT
289 bool 289 bool
290 default n 290 default n
291 291
292source "kernel/Kconfig.instrumentation"
293
292source "arch/um/Kconfig.debug" 294source "arch/um/Kconfig.debug"
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 76fe0b0da996..83bf15a3dda8 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -35,7 +35,7 @@ static void line_timer_cb(struct work_struct *work)
35/* 35/*
36 * Returns the free space inside the ring buffer of this line. 36 * Returns the free space inside the ring buffer of this line.
37 * 37 *
38 * Should be called while holding line->lock (this does not modify datas). 38 * Should be called while holding line->lock (this does not modify data).
39 */ 39 */
40static int write_room(struct line *line) 40static int write_room(struct line *line)
41{ 41{
diff --git a/arch/um/drivers/null.c b/arch/um/drivers/null.c
index 21ad3d7932b3..2b45a1446c86 100644
--- a/arch/um/drivers/null.c
+++ b/arch/um/drivers/null.c
@@ -9,7 +9,7 @@
9#include "chan_user.h" 9#include "chan_user.h"
10#include "os.h" 10#include "os.h"
11 11
12/* This address is used only as a unique identifer */ 12/* This address is used only as a unique identifier */
13static int null_chan; 13static int null_chan;
14 14
15static void *null_init(char *str, int device, const struct chan_opts *opts) 15static void *null_init(char *str, int device, const struct chan_opts *opts)
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c
index ae67e7158e71..6b4a0f9e38de 100644
--- a/arch/um/drivers/slip_kern.c
+++ b/arch/um/drivers/slip_kern.c
@@ -31,10 +31,8 @@ void slip_init(struct net_device *dev, void *data)
31 slip_proto_init(&spri->slip); 31 slip_proto_init(&spri->slip);
32 32
33 dev->init = NULL; 33 dev->init = NULL;
34 dev->header_cache_update = NULL;
35 dev->hard_header_cache = NULL;
36 dev->hard_header = NULL;
37 dev->hard_header_len = 0; 34 dev->hard_header_len = 0;
35 dev->header_ops = NULL;
38 dev->addr_len = 0; 36 dev->addr_len = 0;
39 dev->type = ARPHRD_SLIP; 37 dev->type = ARPHRD_SLIP;
40 dev->tx_queue_len = 256; 38 dev->tx_queue_len = 256;
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c
index 240ee650865d..d987af277db9 100644
--- a/arch/um/drivers/slirp_kern.c
+++ b/arch/um/drivers/slirp_kern.c
@@ -34,9 +34,7 @@ void slirp_init(struct net_device *dev, void *data)
34 34
35 dev->init = NULL; 35 dev->init = NULL;
36 dev->hard_header_len = 0; 36 dev->hard_header_len = 0;
37 dev->header_cache_update = NULL; 37 dev->header_ops = NULL;
38 dev->hard_header_cache = NULL;
39 dev->hard_header = NULL;
40 dev->addr_len = 0; 38 dev->addr_len = 0;
41 dev->type = ARPHRD_SLIP; 39 dev->type = ARPHRD_SLIP;
42 dev->tx_queue_len = 256; 40 dev->tx_queue_len = 256;
diff --git a/arch/um/drivers/stderr_console.c b/arch/um/drivers/stderr_console.c
index 4739dd527b43..d07a97f8b994 100644
--- a/arch/um/drivers/stderr_console.c
+++ b/arch/um/drivers/stderr_console.c
@@ -8,7 +8,7 @@
8/* trivial console driver -- simply dump everything to stderr */ 8/* trivial console driver -- simply dump everything to stderr */
9 9
10/* 10/*
11 * Don't register by default -- as this registeres very early in the 11 * Don't register by default -- as this registers very early in the
12 * boot process it becomes the default console. 12 * boot process it becomes the default console.
13 * 13 *
14 * Initialized at init time. 14 * Initialized at init time.
diff --git a/arch/um/kernel/gmon_syms.c b/arch/um/kernel/gmon_syms.c
index 13aa115cd1b4..734f873cab12 100644
--- a/arch/um/kernel/gmon_syms.c
+++ b/arch/um/kernel/gmon_syms.c
@@ -12,8 +12,8 @@ EXPORT_SYMBOL(__bb_init_func);
12 * versions in libgcov. 12 * versions in libgcov.
13 * 13 *
14 * Since SuSE backported the fix, we cannot handle it depending on GCC version. 14 * Since SuSE backported the fix, we cannot handle it depending on GCC version.
15 * So, unconditinally export it. But also give it a weak declaration, which will 15 * So, unconditionally export it. But also give it a weak declaration, which will
16 * be overriden by any other one. 16 * be overridden by any other one.
17 */ 17 */
18 18
19extern void __gcov_init(void *) __attribute__((weak)); 19extern void __gcov_init(void *) __attribute__((weak));
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 277fce17b088..70c2d625b070 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -326,7 +326,7 @@ int deactivate_all_fds(void)
326} 326}
327 327
328/* 328/*
329 * do_IRQ handles all normal device IRQ's (the special 329 * do_IRQ handles all normal device IRQs (the special
330 * SMP cross-CPU interrupts have their own specific 330 * SMP cross-CPU interrupts have their own specific
331 * handlers). 331 * handlers).
332 */ 332 */
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index a0eba0833068..47b57b497d55 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -237,7 +237,7 @@ void send_sigtrap(struct task_struct *tsk, struct uml_pt_regs *regs,
237 /* User-mode eip? */ 237 /* User-mode eip? */
238 info.si_addr = UPT_IS_USER(regs) ? (void __user *) UPT_IP(regs) : NULL; 238 info.si_addr = UPT_IS_USER(regs) ? (void __user *) UPT_IP(regs) : NULL;
239 239
240 /* Send us the fakey SIGTRAP */ 240 /* Send us the fake SIGTRAP */
241 force_sig_info(SIGTRAP, &info, tsk); 241 force_sig_info(SIGTRAP, &info, tsk);
242} 242}
243 243
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index bd060551e619..cb3321f8e0a9 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -108,7 +108,7 @@ out_nosemaphore:
108 * us unable to handle the page fault gracefully. 108 * us unable to handle the page fault gracefully.
109 */ 109 */
110out_of_memory: 110out_of_memory:
111 if (is_init(current)) { 111 if (is_global_init(current)) {
112 up_read(&mm->mmap_sem); 112 up_read(&mm->mmap_sem);
113 yield(); 113 yield();
114 down_read(&mm->mmap_sem); 114 down_read(&mm->mmap_sem);
diff --git a/arch/um/sys-i386/bug.c b/arch/um/sys-i386/bug.c
index 200c8ba2879b..a4360b5207db 100644
--- a/arch/um/sys-i386/bug.c
+++ b/arch/um/sys-i386/bug.c
@@ -6,7 +6,7 @@
6#include <linux/uaccess.h> 6#include <linux/uaccess.h>
7 7
8/* Mostly copied from i386/x86_86 - eliminated the eip < PAGE_OFFSET because 8/* Mostly copied from i386/x86_86 - eliminated the eip < PAGE_OFFSET because
9 * that's not relevent in skas mode. 9 * that's not relevant in skas mode.
10 */ 10 */
11 11
12int is_valid_bugaddr(unsigned long eip) 12int is_valid_bugaddr(unsigned long eip)
diff --git a/arch/um/sys-i386/tls.c b/arch/um/sys-i386/tls.c
index b02266ab5c55..fcaff86b000c 100644
--- a/arch/um/sys-i386/tls.c
+++ b/arch/um/sys-i386/tls.c
@@ -45,7 +45,7 @@ int do_get_thread_area(struct user_desc *info)
45 * XXX: Consider leaving one free slot for glibc usage at first place. This must 45 * XXX: Consider leaving one free slot for glibc usage at first place. This must
46 * be done here (and by changing GDT_ENTRY_TLS_* macros) and nowhere else. 46 * be done here (and by changing GDT_ENTRY_TLS_* macros) and nowhere else.
47 * 47 *
48 * Also, this must be tested when compiling in SKAS mode with dinamic linking 48 * Also, this must be tested when compiling in SKAS mode with dynamic linking
49 * and running against NPTL. 49 * and running against NPTL.
50 */ 50 */
51static int get_free_idx(struct task_struct* task) 51static int get_free_idx(struct task_struct* task)
diff --git a/arch/um/sys-x86_64/bug.c b/arch/um/sys-x86_64/bug.c
index 200c8ba2879b..a4360b5207db 100644
--- a/arch/um/sys-x86_64/bug.c
+++ b/arch/um/sys-x86_64/bug.c
@@ -6,7 +6,7 @@
6#include <linux/uaccess.h> 6#include <linux/uaccess.h>
7 7
8/* Mostly copied from i386/x86_86 - eliminated the eip < PAGE_OFFSET because 8/* Mostly copied from i386/x86_86 - eliminated the eip < PAGE_OFFSET because
9 * that's not relevent in skas mode. 9 * that's not relevant in skas mode.
10 */ 10 */
11 11
12int is_valid_bugaddr(unsigned long eip) 12int is_valid_bugaddr(unsigned long eip)
diff --git a/arch/um/sys-x86_64/sysrq.c b/arch/um/sys-x86_64/sysrq.c
index ce3e07fcf283..765444031819 100644
--- a/arch/um/sys-x86_64/sysrq.c
+++ b/arch/um/sys-x86_64/sysrq.c
@@ -15,8 +15,8 @@ void __show_regs(struct pt_regs * regs)
15{ 15{
16 printk("\n"); 16 printk("\n");
17 print_modules(); 17 print_modules();
18 printk("Pid: %d, comm: %.20s %s %s\n", 18 printk("Pid: %d, comm: %.20s %s %s\n", task_pid_nr(current),
19 current->pid, current->comm, print_tainted(), init_utsname()->release); 19 current->comm, print_tainted(), init_utsname()->release);
20 printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff, 20 printk("RIP: %04lx:[<%016lx>] ", PT_REGS_CS(regs) & 0xffff,
21 PT_REGS_RIP(regs)); 21 PT_REGS_RIP(regs));
22 printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs), 22 printk("\nRSP: %016lx EFLAGS: %08lx\n", PT_REGS_RSP(regs),
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig
index ace479ab273f..b6a50b8b38de 100644
--- a/arch/v850/Kconfig
+++ b/arch/v850/Kconfig
@@ -331,6 +331,8 @@ source "sound/Kconfig"
331 331
332source "drivers/usb/Kconfig" 332source "drivers/usb/Kconfig"
333 333
334source "kernel/Kconfig.instrumentation"
335
334source "arch/v850/Kconfig.debug" 336source "arch/v850/Kconfig.debug"
335 337
336source "security/Kconfig" 338source "security/Kconfig"
diff --git a/arch/v850/kernel/me2.c b/arch/v850/kernel/me2.c
index 38be5c194f6b..007115dc9ce0 100644
--- a/arch/v850/kernel/me2.c
+++ b/arch/v850/kernel/me2.c
@@ -58,13 +58,13 @@ void __init me2_init_irqs (void)
58void me2_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud) 58void me2_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
59{ 59{
60 if (chan == 0) { 60 if (chan == 0) {
61 /* Specify that the relevent pins on the chip should do 61 /* Specify that the relevant pins on the chip should do
62 serial I/O, not direct I/O. */ 62 serial I/O, not direct I/O. */
63 ME2_PORT1_PMC |= 0xC; 63 ME2_PORT1_PMC |= 0xC;
64 /* Specify that we're using the UART, not the CSI device. */ 64 /* Specify that we're using the UART, not the CSI device. */
65 ME2_PORT1_PFC |= 0xC; 65 ME2_PORT1_PFC |= 0xC;
66 } else if (chan == 1) { 66 } else if (chan == 1) {
67 /* Specify that the relevent pins on the chip should do 67 /* Specify that the relevant pins on the chip should do
68 serial I/O, not direct I/O. */ 68 serial I/O, not direct I/O. */
69 ME2_PORT2_PMC |= 0x6; 69 ME2_PORT2_PMC |= 0x6;
70 /* Specify that we're using the UART, not the CSI device. */ 70 /* Specify that we're using the UART, not the CSI device. */
diff --git a/arch/v850/kernel/rte_mb_a_pci.c b/arch/v850/kernel/rte_mb_a_pci.c
index 35a4bd5515cb..7165478824e7 100644
--- a/arch/v850/kernel/rte_mb_a_pci.c
+++ b/arch/v850/kernel/rte_mb_a_pci.c
@@ -179,7 +179,7 @@ static int __devinit pcibios_init (void)
179 default uses. */ 179 default uses. */
180 180
181 /* Significant address bits used for decoding PCI GCS5 space 181 /* Significant address bits used for decoding PCI GCS5 space
182 accessess. */ 182 accesses. */
183 MB_A_PCI_DMRR = ~(MB_A_PCI_MEM_SIZE - 1); 183 MB_A_PCI_DMRR = ~(MB_A_PCI_MEM_SIZE - 1);
184 184
185 /* I don't understand this, but the SolutionGear example code 185 /* I don't understand this, but the SolutionGear example code
@@ -775,7 +775,7 @@ pci_alloc_consistent (struct pci_dev *pdev, size_t size, dma_addr_t *dma_addr)
775/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must 775/* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
776 be values that were returned from pci_alloc_consistent. SIZE must be 776 be values that were returned from pci_alloc_consistent. SIZE must be
777 the same as what as passed into pci_alloc_consistent. References to 777 the same as what as passed into pci_alloc_consistent. References to
778 the memory and mappings assosciated with CPU_ADDR or DMA_ADDR past 778 the memory and mappings associated with CPU_ADDR or DMA_ADDR past
779 this call are illegal. */ 779 this call are illegal. */
780void 780void
781pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr, 781pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
diff --git a/arch/x86/boot/compressed/misc_32.c b/arch/x86/boot/compressed/misc_32.c
index b28505c544c9..1dc1e19c0a9f 100644
--- a/arch/x86/boot/compressed/misc_32.c
+++ b/arch/x86/boot/compressed/misc_32.c
@@ -25,7 +25,7 @@
25 25
26/* 26/*
27 * Getting to provable safe in place decompression is hard. 27 * Getting to provable safe in place decompression is hard.
28 * Worst case behaviours need to be analized. 28 * Worst case behaviours need to be analyzed.
29 * Background information: 29 * Background information:
30 * 30 *
31 * The file layout is: 31 * The file layout is:
@@ -94,7 +94,7 @@
94 * Adding 32768 instead of 32767 just makes for round numbers. 94 * Adding 32768 instead of 32767 just makes for round numbers.
95 * Adding the decompressor_size is necessary as it musht live after all 95 * Adding the decompressor_size is necessary as it musht live after all
96 * of the data as well. Last I measured the decompressor is about 14K. 96 * of the data as well. Last I measured the decompressor is about 14K.
97 * 10K of actuall data and 4K of bss. 97 * 10K of actual data and 4K of bss.
98 * 98 *
99 */ 99 */
100 100
diff --git a/arch/x86/boot/compressed/misc_64.c b/arch/x86/boot/compressed/misc_64.c
index f932b0e89096..6ea015aa65e4 100644
--- a/arch/x86/boot/compressed/misc_64.c
+++ b/arch/x86/boot/compressed/misc_64.c
@@ -25,7 +25,7 @@
25 25
26/* 26/*
27 * Getting to provable safe in place decompression is hard. 27 * Getting to provable safe in place decompression is hard.
28 * Worst case behaviours need to be analized. 28 * Worst case behaviours need to be analyzed.
29 * Background information: 29 * Background information:
30 * 30 *
31 * The file layout is: 31 * The file layout is:
@@ -94,7 +94,7 @@
94 * Adding 32768 instead of 32767 just makes for round numbers. 94 * Adding 32768 instead of 32767 just makes for round numbers.
95 * Adding the decompressor_size is necessary as it musht live after all 95 * Adding the decompressor_size is necessary as it musht live after all
96 * of the data as well. Last I measured the decompressor is about 14K. 96 * of the data as well. Last I measured the decompressor is about 14K.
97 * 10K of actuall data and 4K of bss. 97 * 10K of actual data and 4K of bss.
98 * 98 *
99 */ 99 */
100 100
diff --git a/arch/x86/ia32/ia32_binfmt.c b/arch/x86/ia32/ia32_binfmt.c
index 118b9f9ff499..55822d2cf053 100644
--- a/arch/x86/ia32/ia32_binfmt.c
+++ b/arch/x86/ia32/ia32_binfmt.c
@@ -5,10 +5,6 @@
5 * This tricks binfmt_elf.c into loading 32bit binaries using lots 5 * This tricks binfmt_elf.c into loading 32bit binaries using lots
6 * of ugly preprocessor tricks. Talk about very very poor man's inheritance. 6 * of ugly preprocessor tricks. Talk about very very poor man's inheritance.
7 */ 7 */
8#define __ASM_X86_64_ELF_H 1
9
10#undef ELF_CLASS
11#define ELF_CLASS ELFCLASS32
12 8
13#include <linux/types.h> 9#include <linux/types.h>
14#include <linux/stddef.h> 10#include <linux/stddef.h>
@@ -19,6 +15,7 @@
19#include <linux/binfmts.h> 15#include <linux/binfmts.h>
20#include <linux/mm.h> 16#include <linux/mm.h>
21#include <linux/security.h> 17#include <linux/security.h>
18#include <linux/elfcore-compat.h>
22 19
23#include <asm/segment.h> 20#include <asm/segment.h>
24#include <asm/ptrace.h> 21#include <asm/ptrace.h>
@@ -31,6 +28,20 @@
31#include <asm/ia32.h> 28#include <asm/ia32.h>
32#include <asm/vsyscall32.h> 29#include <asm/vsyscall32.h>
33 30
31#undef ELF_ARCH
32#undef ELF_CLASS
33#define ELF_CLASS ELFCLASS32
34#define ELF_ARCH EM_386
35
36#undef elfhdr
37#undef elf_phdr
38#undef elf_note
39#undef elf_addr_t
40#define elfhdr elf32_hdr
41#define elf_phdr elf32_phdr
42#define elf_note elf32_note
43#define elf_addr_t Elf32_Off
44
34#define ELF_NAME "elf/i386" 45#define ELF_NAME "elf/i386"
35 46
36#define AT_SYSINFO 32 47#define AT_SYSINFO 32
@@ -48,74 +59,20 @@ int sysctl_vsyscall32 = 1;
48} while(0) 59} while(0)
49 60
50struct file; 61struct file;
51struct elf_phdr;
52 62
53#define IA32_EMULATOR 1 63#define IA32_EMULATOR 1
54 64
55#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000) 65#undef ELF_ET_DYN_BASE
56
57#undef ELF_ARCH
58#define ELF_ARCH EM_386
59
60#define ELF_DATA ELFDATA2LSB
61 66
62#define USE_ELF_CORE_DUMP 1 67#define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE + 0x1000000)
63
64/* Override elfcore.h */
65#define _LINUX_ELFCORE_H 1
66typedef unsigned int elf_greg_t;
67
68#define ELF_NGREG (sizeof (struct user_regs_struct32) / sizeof(elf_greg_t))
69typedef elf_greg_t elf_gregset_t[ELF_NGREG];
70
71struct elf_siginfo
72{
73 int si_signo; /* signal number */
74 int si_code; /* extra code */
75 int si_errno; /* errno */
76};
77 68
78#define jiffies_to_timeval(a,b) do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; }while(0) 69#define jiffies_to_timeval(a,b) do { (b)->tv_usec = 0; (b)->tv_sec = (a)/HZ; }while(0)
79 70
80struct elf_prstatus
81{
82 struct elf_siginfo pr_info; /* Info associated with signal */
83 short pr_cursig; /* Current signal */
84 unsigned int pr_sigpend; /* Set of pending signals */
85 unsigned int pr_sighold; /* Set of held signals */
86 pid_t pr_pid;
87 pid_t pr_ppid;
88 pid_t pr_pgrp;
89 pid_t pr_sid;
90 struct compat_timeval pr_utime; /* User time */
91 struct compat_timeval pr_stime; /* System time */
92 struct compat_timeval pr_cutime; /* Cumulative user time */
93 struct compat_timeval pr_cstime; /* Cumulative system time */
94 elf_gregset_t pr_reg; /* GP registers */
95 int pr_fpvalid; /* True if math co-processor being used. */
96};
97
98#define ELF_PRARGSZ (80) /* Number of chars for args */
99
100struct elf_prpsinfo
101{
102 char pr_state; /* numeric process state */
103 char pr_sname; /* char for pr_state */
104 char pr_zomb; /* zombie */
105 char pr_nice; /* nice val */
106 unsigned int pr_flag; /* flags */
107 __u16 pr_uid;
108 __u16 pr_gid;
109 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
110 /* Lots missing */
111 char pr_fname[16]; /* filename of executable */
112 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
113};
114
115#define _GET_SEG(x) \ 71#define _GET_SEG(x) \
116 ({ __u32 seg; asm("movl %%" __stringify(x) ",%0" : "=r"(seg)); seg; }) 72 ({ __u32 seg; asm("movl %%" __stringify(x) ",%0" : "=r"(seg)); seg; })
117 73
118/* Assumes current==process to be dumped */ 74/* Assumes current==process to be dumped */
75#undef ELF_CORE_COPY_REGS
119#define ELF_CORE_COPY_REGS(pr_reg, regs) \ 76#define ELF_CORE_COPY_REGS(pr_reg, regs) \
120 pr_reg[0] = regs->rbx; \ 77 pr_reg[0] = regs->rbx; \
121 pr_reg[1] = regs->rcx; \ 78 pr_reg[1] = regs->rcx; \
@@ -135,36 +92,41 @@ struct elf_prpsinfo
135 pr_reg[15] = regs->rsp; \ 92 pr_reg[15] = regs->rsp; \
136 pr_reg[16] = regs->ss; 93 pr_reg[16] = regs->ss;
137 94
138#define user user32 95
96#define elf_prstatus compat_elf_prstatus
97#define elf_prpsinfo compat_elf_prpsinfo
98#define elf_fpregset_t struct user_i387_ia32_struct
99#define elf_fpxregset_t struct user32_fxsr_struct
100#define user user32
139 101
140#undef elf_read_implies_exec 102#undef elf_read_implies_exec
141#define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X) 103#define elf_read_implies_exec(ex, executable_stack) (executable_stack != EXSTACK_DISABLE_X)
142//#include <asm/ia32.h>
143#include <linux/elf.h>
144
145typedef struct user_i387_ia32_struct elf_fpregset_t;
146typedef struct user32_fxsr_struct elf_fpxregset_t;
147
148 104
149static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs) 105#define elf_core_copy_regs elf32_core_copy_regs
106static inline void elf32_core_copy_regs(compat_elf_gregset_t *elfregs,
107 struct pt_regs *regs)
150{ 108{
151 ELF_CORE_COPY_REGS((*elfregs), regs) 109 ELF_CORE_COPY_REGS((&elfregs->ebx), regs)
152} 110}
153 111
154static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) 112#define elf_core_copy_task_regs elf32_core_copy_task_regs
113static inline int elf32_core_copy_task_regs(struct task_struct *t,
114 compat_elf_gregset_t* elfregs)
155{ 115{
156 struct pt_regs *pp = task_pt_regs(t); 116 struct pt_regs *pp = task_pt_regs(t);
157 ELF_CORE_COPY_REGS((*elfregs), pp); 117 ELF_CORE_COPY_REGS((&elfregs->ebx), pp);
158 /* fix wrong segments */ 118 /* fix wrong segments */
159 (*elfregs)[7] = t->thread.ds; 119 elfregs->ds = t->thread.ds;
160 (*elfregs)[9] = t->thread.fsindex; 120 elfregs->fs = t->thread.fsindex;
161 (*elfregs)[10] = t->thread.gsindex; 121 elfregs->gs = t->thread.gsindex;
162 (*elfregs)[8] = t->thread.es; 122 elfregs->es = t->thread.es;
163 return 1; 123 return 1;
164} 124}
165 125
126#define elf_core_copy_task_fpregs elf32_core_copy_task_fpregs
166static inline int 127static inline int
167elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpregset_t *fpu) 128elf32_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs,
129 elf_fpregset_t *fpu)
168{ 130{
169 struct _fpstate_ia32 *fpstate = (void*)fpu; 131 struct _fpstate_ia32 *fpstate = (void*)fpu;
170 mm_segment_t oldfs = get_fs(); 132 mm_segment_t oldfs = get_fs();
@@ -186,8 +148,9 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
186 148
187#define ELF_CORE_COPY_XFPREGS 1 149#define ELF_CORE_COPY_XFPREGS 1
188#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG 150#define ELF_CORE_XFPREG_TYPE NT_PRXFPREG
151#define elf_core_copy_task_xfpregs elf32_core_copy_task_xfpregs
189static inline int 152static inline int
190elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) 153elf32_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
191{ 154{
192 struct pt_regs *regs = task_pt_regs(t); 155 struct pt_regs *regs = task_pt_regs(t);
193 if (!tsk_used_math(t)) 156 if (!tsk_used_math(t))
@@ -206,6 +169,10 @@ elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
206 169
207extern int force_personality32; 170extern int force_personality32;
208 171
172#undef ELF_EXEC_PAGESIZE
173#undef ELF_HWCAP
174#undef ELF_PLATFORM
175#undef SET_PERSONALITY
209#define ELF_EXEC_PAGESIZE PAGE_SIZE 176#define ELF_EXEC_PAGESIZE PAGE_SIZE
210#define ELF_HWCAP (boot_cpu_data.x86_capability[0]) 177#define ELF_HWCAP (boot_cpu_data.x86_capability[0])
211#define ELF_PLATFORM ("i686") 178#define ELF_PLATFORM ("i686")
@@ -231,6 +198,7 @@ do { \
231 198
232#define load_elf_binary load_elf32_binary 199#define load_elf_binary load_elf32_binary
233 200
201#undef ELF_PLAT_INIT
234#define ELF_PLAT_INIT(r, load_addr) elf32_init(r) 202#define ELF_PLAT_INIT(r, load_addr) elf32_init(r)
235 203
236#undef start_thread 204#undef start_thread
@@ -289,7 +257,6 @@ static void elf32_init(struct pt_regs *regs)
289 257
290static ctl_table abi_table2[] = { 258static ctl_table abi_table2[] = {
291 { 259 {
292 .ctl_name = 99,
293 .procname = "vsyscall32", 260 .procname = "vsyscall32",
294 .data = &sysctl_vsyscall32, 261 .data = &sysctl_vsyscall32,
295 .maxlen = sizeof(int), 262 .maxlen = sizeof(int),
diff --git a/arch/x86/kernel/Makefile_32 b/arch/x86/kernel/Makefile_32
index a3fa11f8f460..ccea590bbb92 100644
--- a/arch/x86/kernel/Makefile_32
+++ b/arch/x86/kernel/Makefile_32
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head_32.o init_task_32.o vmlinux.lds 5extra-y := head_32.o init_task.o vmlinux.lds
6 6
7obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \ 7obj-y := process_32.o signal_32.o entry_32.o traps_32.o irq_32.o \
8 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \ 8 ptrace_32.o time_32.o ioport_32.o ldt_32.o setup_32.o i8259_32.o sys_i386_32.o \
@@ -17,6 +17,7 @@ obj-$(CONFIG_MCA) += mca_32.o
17obj-$(CONFIG_X86_MSR) += msr.o 17obj-$(CONFIG_X86_MSR) += msr.o
18obj-$(CONFIG_X86_CPUID) += cpuid.o 18obj-$(CONFIG_X86_CPUID) += cpuid.o
19obj-$(CONFIG_MICROCODE) += microcode.o 19obj-$(CONFIG_MICROCODE) += microcode.o
20obj-$(CONFIG_PCI) += early-quirks.o
20obj-$(CONFIG_APM) += apm_32.o 21obj-$(CONFIG_APM) += apm_32.o
21obj-$(CONFIG_X86_SMP) += smp_32.o smpboot_32.o tsc_sync.o 22obj-$(CONFIG_X86_SMP) += smp_32.o smpboot_32.o tsc_sync.o
22obj-$(CONFIG_SMP) += smpcommon_32.o 23obj-$(CONFIG_SMP) += smpcommon_32.o
diff --git a/arch/x86/kernel/Makefile_64 b/arch/x86/kernel/Makefile_64
index 43da66213a47..dec06e769281 100644
--- a/arch/x86/kernel/Makefile_64
+++ b/arch/x86/kernel/Makefile_64
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head_64.o head64.o init_task_64.o vmlinux.lds 5extra-y := head_64.o head64.o init_task.o vmlinux.lds
6EXTRA_AFLAGS := -traditional 6EXTRA_AFLAGS := -traditional
7obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \ 7obj-y := process_64.o signal_64.o entry_64.o traps_64.o irq_64.o \
8 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \ 8 ptrace_64.o time_64.o ioport_64.o ldt_64.o setup_64.o i8259_64.o sys_x86_64.o \
@@ -39,7 +39,7 @@ obj-$(CONFIG_K8_NB) += k8.o
39obj-$(CONFIG_AUDIT) += audit_64.o 39obj-$(CONFIG_AUDIT) += audit_64.o
40 40
41obj-$(CONFIG_MODULES) += module_64.o 41obj-$(CONFIG_MODULES) += module_64.o
42obj-$(CONFIG_PCI) += early-quirks_64.o 42obj-$(CONFIG_PCI) += early-quirks.o
43 43
44obj-y += topology.o 44obj-y += topology.o
45obj-y += intel_cacheinfo.o 45obj-y += intel_cacheinfo.o
diff --git a/arch/x86/kernel/acpi/Makefile_32 b/arch/x86/kernel/acpi/Makefile_32
index a4852a2e9190..045dd54b33e0 100644
--- a/arch/x86/kernel/acpi/Makefile_32
+++ b/arch/x86/kernel/acpi/Makefile_32
@@ -1,7 +1,4 @@
1obj-$(CONFIG_ACPI) += boot.o 1obj-$(CONFIG_ACPI) += boot.o
2ifneq ($(CONFIG_PCI),)
3obj-$(CONFIG_X86_IO_APIC) += earlyquirk_32.o
4endif
5obj-$(CONFIG_ACPI_SLEEP) += sleep_32.o wakeup_32.o 2obj-$(CONFIG_ACPI_SLEEP) += sleep_32.o wakeup_32.o
6 3
7ifneq ($(CONFIG_ACPI_PROCESSOR),) 4ifneq ($(CONFIG_ACPI_PROCESSOR),)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index afd2afe9102d..289247d974c6 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -99,7 +99,7 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
99 99
100/* 100/*
101 * The default interrupt routing model is PIC (8259). This gets 101 * The default interrupt routing model is PIC (8259). This gets
102 * overriden if IOAPICs are enumerated (below). 102 * overridden if IOAPICs are enumerated (below).
103 */ 103 */
104enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; 104enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC;
105 105
@@ -414,8 +414,8 @@ acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end
414 * 414 *
415 * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers 415 * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
416 * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge. 416 * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge.
417 * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0) 417 * ECLR1 is IRQs 0-7 (IRQ 0, 1, 2 must be 0)
418 * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) 418 * ECLR2 is IRQs 8-15 (IRQ 8, 13 must be 0)
419 */ 419 */
420 420
421void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) 421void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
@@ -427,7 +427,7 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
427 old = inb(0x4d0) | (inb(0x4d1) << 8); 427 old = inb(0x4d0) | (inb(0x4d1) << 8);
428 428
429 /* 429 /*
430 * If we use ACPI to set PCI irq's, then we should clear ELCR 430 * If we use ACPI to set PCI IRQs, then we should clear ELCR
431 * since we will set it correctly as we enable the PCI irq 431 * since we will set it correctly as we enable the PCI irq
432 * routing. 432 * routing.
433 */ 433 */
@@ -555,7 +555,7 @@ EXPORT_SYMBOL(acpi_map_lsapic);
555 555
556int acpi_unmap_lsapic(int cpu) 556int acpi_unmap_lsapic(int cpu)
557{ 557{
558 x86_cpu_to_apicid[cpu] = -1; 558 per_cpu(x86_cpu_to_apicid, cpu) = -1;
559 cpu_clear(cpu, cpu_present_map); 559 cpu_clear(cpu, cpu_present_map);
560 num_processors--; 560 num_processors--;
561 561
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 2d39f55d29a8..10b67170b133 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -29,7 +29,7 @@
29void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, 29void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
30 unsigned int cpu) 30 unsigned int cpu)
31{ 31{
32 struct cpuinfo_x86 *c = cpu_data + cpu; 32 struct cpuinfo_x86 *c = &cpu_data(cpu);
33 33
34 flags->bm_check = 0; 34 flags->bm_check = 0;
35 if (num_online_cpus() == 1) 35 if (num_online_cpus() == 1)
@@ -72,7 +72,7 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
72 struct acpi_processor_cx *cx, struct acpi_power_register *reg) 72 struct acpi_processor_cx *cx, struct acpi_power_register *reg)
73{ 73{
74 struct cstate_entry *percpu_entry; 74 struct cstate_entry *percpu_entry;
75 struct cpuinfo_x86 *c = cpu_data + cpu; 75 struct cpuinfo_x86 *c = &cpu_data(cpu);
76 76
77 cpumask_t saved_mask; 77 cpumask_t saved_mask;
78 int retval; 78 int retval;
diff --git a/arch/x86/kernel/acpi/earlyquirk_32.c b/arch/x86/kernel/acpi/earlyquirk_32.c
deleted file mode 100644
index 23f78efc577d..000000000000
--- a/arch/x86/kernel/acpi/earlyquirk_32.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * Do early PCI probing for bug detection when the main PCI subsystem is
3 * not up yet.
4 */
5#include <linux/init.h>
6#include <linux/kernel.h>
7#include <linux/pci.h>
8#include <linux/acpi.h>
9
10#include <asm/pci-direct.h>
11#include <asm/acpi.h>
12#include <asm/apic.h>
13
14#ifdef CONFIG_ACPI
15
16static int __init nvidia_hpet_check(struct acpi_table_header *header)
17{
18 return 0;
19}
20#endif
21
22static int __init check_bridge(int vendor, int device)
23{
24#ifdef CONFIG_ACPI
25 static int warned;
26 /* According to Nvidia all timer overrides are bogus unless HPET
27 is enabled. */
28 if (!acpi_use_timer_override && vendor == PCI_VENDOR_ID_NVIDIA) {
29 if (!warned && acpi_table_parse(ACPI_SIG_HPET,
30 nvidia_hpet_check)) {
31 warned = 1;
32 acpi_skip_timer_override = 1;
33 printk(KERN_INFO "Nvidia board "
34 "detected. Ignoring ACPI "
35 "timer override.\n");
36 printk(KERN_INFO "If you got timer trouble "
37 "try acpi_use_timer_override\n");
38
39 }
40 }
41#endif
42 if (vendor == PCI_VENDOR_ID_ATI && timer_over_8254 == 1) {
43 timer_over_8254 = 0;
44 printk(KERN_INFO "ATI board detected. Disabling timer routing "
45 "over 8254.\n");
46 }
47 return 0;
48}
49
50void __init check_acpi_pci(void)
51{
52 int num, slot, func;
53
54 /* Assume the machine supports type 1. If not it will
55 always read ffffffff and should not have any side effect.
56 Actually a few buggy systems can machine check. Allow the user
57 to disable it by command line option at least -AK */
58 if (!early_pci_allowed())
59 return;
60
61 /* Poor man's PCI discovery */
62 for (num = 0; num < 32; num++) {
63 for (slot = 0; slot < 32; slot++) {
64 for (func = 0; func < 8; func++) {
65 u32 class;
66 u32 vendor;
67 class = read_pci_config(num, slot, func,
68 PCI_CLASS_REVISION);
69 if (class == 0xffffffff)
70 break;
71
72 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
73 continue;
74
75 vendor = read_pci_config(num, slot, func,
76 PCI_VENDOR_ID);
77
78 if (check_bridge(vendor & 0xffff, vendor >> 16))
79 return;
80 }
81
82 }
83 }
84}
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c
index b54fded49834..2ed0a4ce62f0 100644
--- a/arch/x86/kernel/acpi/processor.c
+++ b/arch/x86/kernel/acpi/processor.c
@@ -63,7 +63,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
63void arch_acpi_processor_init_pdc(struct acpi_processor *pr) 63void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
64{ 64{
65 unsigned int cpu = pr->id; 65 unsigned int cpu = pr->id;
66 struct cpuinfo_x86 *c = cpu_data + cpu; 66 struct cpuinfo_x86 *c = &cpu_data(cpu);
67 67
68 pr->pdc = NULL; 68 pr->pdc = NULL;
69 if (c->x86_vendor == X86_VENDOR_INTEL) 69 if (c->x86_vendor == X86_VENDOR_INTEL)
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
index f22ba8534d26..a97313b1270e 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
@@ -11,7 +11,7 @@
11# 11#
12# If physical address of wakeup_code is 0x12345, BIOS should call us with 12# If physical address of wakeup_code is 0x12345, BIOS should call us with
13# cs = 0x1234, eip = 0x05 13# cs = 0x1234, eip = 0x05
14# 14#
15 15
16#define BEEP \ 16#define BEEP \
17 inb $97, %al; \ 17 inb $97, %al; \
@@ -52,7 +52,6 @@ wakeup_code:
52 BEEP 52 BEEP
531: 531:
54 mov $(wakeup_stack - wakeup_code), %sp # Private stack is needed for ASUS board 54 mov $(wakeup_stack - wakeup_code), %sp # Private stack is needed for ASUS board
55 movw $0x0e00 + 'S', %fs:(0x12)
56 55
57 pushl $0 # Kill any dangerous flags 56 pushl $0 # Kill any dangerous flags
58 popfl 57 popfl
@@ -90,9 +89,6 @@ wakeup_code:
90 # make sure %cr4 is set correctly (features, etc) 89 # make sure %cr4 is set correctly (features, etc)
91 movl real_save_cr4 - wakeup_code, %eax 90 movl real_save_cr4 - wakeup_code, %eax
92 movl %eax, %cr4 91 movl %eax, %cr4
93 movw $0xb800, %ax
94 movw %ax,%fs
95 movw $0x0e00 + 'i', %fs:(0x12)
96 92
97 # need a gdt -- use lgdtl to force 32-bit operands, in case 93 # need a gdt -- use lgdtl to force 32-bit operands, in case
98 # the GDT is located past 16 megabytes. 94 # the GDT is located past 16 megabytes.
@@ -102,8 +98,6 @@ wakeup_code:
102 movl %eax, %cr0 98 movl %eax, %cr0
103 jmp 1f 99 jmp 1f
1041: 1001:
105 movw $0x0e00 + 'n', %fs:(0x14)
106
107 movl real_magic - wakeup_code, %eax 101 movl real_magic - wakeup_code, %eax
108 cmpl $0x12345678, %eax 102 cmpl $0x12345678, %eax
109 jne bogus_real_magic 103 jne bogus_real_magic
@@ -122,13 +116,11 @@ real_save_cr4: .long 0
122real_magic: .long 0 116real_magic: .long 0
123video_mode: .long 0 117video_mode: .long 0
124realmode_flags: .long 0 118realmode_flags: .long 0
125beep_flags: .long 0
126real_efer_save_restore: .long 0 119real_efer_save_restore: .long 0
127real_save_efer_edx: .long 0 120real_save_efer_edx: .long 0
128real_save_efer_eax: .long 0 121real_save_efer_eax: .long 0
129 122
130bogus_real_magic: 123bogus_real_magic:
131 movw $0x0e00 + 'B', %fs:(0x12)
132 jmp bogus_real_magic 124 jmp bogus_real_magic
133 125
134/* This code uses an extended set of video mode numbers. These include: 126/* This code uses an extended set of video mode numbers. These include:
@@ -194,7 +186,6 @@ wakeup_pmode_return:
194 movw %ax, %es 186 movw %ax, %es
195 movw %ax, %fs 187 movw %ax, %fs
196 movw %ax, %gs 188 movw %ax, %gs
197 movw $0x0e00 + 'u', 0xb8016
198 189
199 # reload the gdt, as we need the full 32 bit address 190 # reload the gdt, as we need the full 32 bit address
200 lgdt saved_gdt 191 lgdt saved_gdt
@@ -218,7 +209,6 @@ wakeup_pmode_return:
218 jmp *%eax 209 jmp *%eax
219 210
220bogus_magic: 211bogus_magic:
221 movw $0x0e00 + 'B', 0xb8018
222 jmp bogus_magic 212 jmp bogus_magic
223 213
224 214
diff --git a/arch/x86/kernel/acpi/wakeup_64.S b/arch/x86/kernel/acpi/wakeup_64.S
index 8b4357e1efe0..55608ec2ed72 100644
--- a/arch/x86/kernel/acpi/wakeup_64.S
+++ b/arch/x86/kernel/acpi/wakeup_64.S
@@ -41,7 +41,6 @@ wakeup_code:
41 41
42# Running in *copy* of this code, somewhere in low 1MB. 42# Running in *copy* of this code, somewhere in low 1MB.
43 43
44 movb $0xa1, %al ; outb %al, $0x80
45 cli 44 cli
46 cld 45 cld
47 # setup data segment 46 # setup data segment
@@ -65,11 +64,6 @@ wakeup_code:
65 cmpl $0x12345678, %eax 64 cmpl $0x12345678, %eax
66 jne bogus_real_magic 65 jne bogus_real_magic
67 66
68 call verify_cpu # Verify the cpu supports long
69 # mode
70 testl %eax, %eax
71 jnz no_longmode
72
73 testl $1, realmode_flags - wakeup_code 67 testl $1, realmode_flags - wakeup_code
74 jz 1f 68 jz 1f
75 lcall $0xc000,$3 69 lcall $0xc000,$3
@@ -84,12 +78,6 @@ wakeup_code:
84 call mode_set 78 call mode_set
851: 791:
86 80
87 movw $0xb800, %ax
88 movw %ax,%fs
89 movw $0x0e00 + 'L', %fs:(0x10)
90
91 movb $0xa2, %al ; outb %al, $0x80
92
93 mov %ds, %ax # Find 32bit wakeup_code addr 81 mov %ds, %ax # Find 32bit wakeup_code addr
94 movzx %ax, %esi # (Convert %ds:gdt to a liner ptr) 82 movzx %ax, %esi # (Convert %ds:gdt to a liner ptr)
95 shll $4, %esi 83 shll $4, %esi
@@ -117,14 +105,10 @@ wakeup_32_vector:
117 .code32 105 .code32
118wakeup_32: 106wakeup_32:
119# Running in this code, but at low address; paging is not yet turned on. 107# Running in this code, but at low address; paging is not yet turned on.
120 movb $0xa5, %al ; outb %al, $0x80
121 108
122 movl $__KERNEL_DS, %eax 109 movl $__KERNEL_DS, %eax
123 movl %eax, %ds 110 movl %eax, %ds
124 111
125 movw $0x0e00 + 'i', %ds:(0xb8012)
126 movb $0xa8, %al ; outb %al, $0x80;
127
128 /* 112 /*
129 * Prepare for entering 64bits mode 113 * Prepare for entering 64bits mode
130 */ 114 */
@@ -200,16 +184,11 @@ wakeup_long64:
200 */ 184 */
201 lgdt cpu_gdt_descr 185 lgdt cpu_gdt_descr
202 186
203 movw $0x0e00 + 'n', %ds:(0xb8014)
204 movb $0xa9, %al ; outb %al, $0x80
205
206 movq saved_magic, %rax 187 movq saved_magic, %rax
207 movq $0x123456789abcdef0, %rdx 188 movq $0x123456789abcdef0, %rdx
208 cmpq %rdx, %rax 189 cmpq %rdx, %rax
209 jne bogus_64_magic 190 jne bogus_64_magic
210 191
211 movw $0x0e00 + 'u', %ds:(0xb8016)
212
213 nop 192 nop
214 nop 193 nop
215 movw $__KERNEL_DS, %ax 194 movw $__KERNEL_DS, %ax
@@ -220,13 +199,11 @@ wakeup_long64:
220 movw %ax, %gs 199 movw %ax, %gs
221 movq saved_rsp, %rsp 200 movq saved_rsp, %rsp
222 201
223 movw $0x0e00 + 'x', %ds:(0xb8018)
224 movq saved_rbx, %rbx 202 movq saved_rbx, %rbx
225 movq saved_rdi, %rdi 203 movq saved_rdi, %rdi
226 movq saved_rsi, %rsi 204 movq saved_rsi, %rsi
227 movq saved_rbp, %rbp 205 movq saved_rbp, %rbp
228 206
229 movw $0x0e00 + '!', %ds:(0xb801a)
230 movq saved_rip, %rax 207 movq saved_rip, %rax
231 jmp *%rax 208 jmp *%rax
232 209
@@ -256,21 +233,12 @@ realmode_flags: .quad 0
256 233
257.code16 234.code16
258bogus_real_magic: 235bogus_real_magic:
259 movb $0xba,%al ; outb %al,$0x80
260 jmp bogus_real_magic 236 jmp bogus_real_magic
261 237
262.code64 238.code64
263bogus_64_magic: 239bogus_64_magic:
264 movb $0xb3,%al ; outb %al,$0x80
265 jmp bogus_64_magic 240 jmp bogus_64_magic
266 241
267.code16
268no_longmode:
269 movb $0xbc,%al ; outb %al,$0x80
270 jmp no_longmode
271
272#include "../verify_cpu_64.S"
273
274/* This code uses an extended set of video mode numbers. These include: 242/* This code uses an extended set of video mode numbers. These include:
275 * Aliases for standard modes 243 * Aliases for standard modes
276 * NORMAL_VGA (-1) 244 * NORMAL_VGA (-1)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 3bd2688bd443..d6405e0842b5 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -357,14 +357,14 @@ void alternatives_smp_switch(int smp)
357 if (smp) { 357 if (smp) {
358 printk(KERN_INFO "SMP alternatives: switching to SMP code\n"); 358 printk(KERN_INFO "SMP alternatives: switching to SMP code\n");
359 clear_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); 359 clear_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
360 clear_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); 360 clear_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
361 list_for_each_entry(mod, &smp_alt_modules, next) 361 list_for_each_entry(mod, &smp_alt_modules, next)
362 alternatives_smp_lock(mod->locks, mod->locks_end, 362 alternatives_smp_lock(mod->locks, mod->locks_end,
363 mod->text, mod->text_end); 363 mod->text, mod->text_end);
364 } else { 364 } else {
365 printk(KERN_INFO "SMP alternatives: switching to UP code\n"); 365 printk(KERN_INFO "SMP alternatives: switching to UP code\n");
366 set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); 366 set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
367 set_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); 367 set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
368 list_for_each_entry(mod, &smp_alt_modules, next) 368 list_for_each_entry(mod, &smp_alt_modules, next)
369 alternatives_smp_unlock(mod->locks, mod->locks_end, 369 alternatives_smp_unlock(mod->locks, mod->locks_end,
370 mod->text, mod->text_end); 370 mod->text, mod->text_end);
@@ -432,7 +432,7 @@ void __init alternative_instructions(void)
432 if (1 == num_possible_cpus()) { 432 if (1 == num_possible_cpus()) {
433 printk(KERN_INFO "SMP alternatives: switching to UP code\n"); 433 printk(KERN_INFO "SMP alternatives: switching to UP code\n");
434 set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability); 434 set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
435 set_bit(X86_FEATURE_UP, cpu_data[0].x86_capability); 435 set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
436 alternatives_smp_unlock(__smp_locks, __smp_locks_end, 436 alternatives_smp_unlock(__smp_locks, __smp_locks_end,
437 _text, _etext); 437 _text, _etext);
438 } 438 }
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 793341fffc81..08b07c176962 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -947,7 +947,7 @@ void __devinit setup_local_APIC(void)
947 * Set up LVT0, LVT1: 947 * Set up LVT0, LVT1:
948 * 948 *
949 * set up through-local-APIC on the BP's LINT0. This is not 949 * set up through-local-APIC on the BP's LINT0. This is not
950 * strictly necessery in pure symmetric-IO mode, but sometimes 950 * strictly necessary in pure symmetric-IO mode, but sometimes
951 * we delegate interrupts to the 8259A. 951 * we delegate interrupts to the 8259A.
952 */ 952 */
953 /* 953 /*
@@ -998,7 +998,7 @@ void __devinit setup_local_APIC(void)
998 } else { 998 } else {
999 if (esr_disable) 999 if (esr_disable)
1000 /* 1000 /*
1001 * Something untraceble is creating bad interrupts on 1001 * Something untraceable is creating bad interrupts on
1002 * secondary quads ... for the moment, just leave the 1002 * secondary quads ... for the moment, just leave the
1003 * ESR disabled - we can't do anything useful with the 1003 * ESR disabled - we can't do anything useful with the
1004 * errors anyway - mbligh 1004 * errors anyway - mbligh
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 32f2365c26ed..17089a041028 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -57,7 +57,7 @@
57 * screen-blanking and gpm (Stephen Rothwell); Linux 1.99.4 57 * screen-blanking and gpm (Stephen Rothwell); Linux 1.99.4
58 * 1.2a:Simple change to stop mysterious bug reports with SMP also added 58 * 1.2a:Simple change to stop mysterious bug reports with SMP also added
59 * levels to the printk calls. APM is not defined for SMP machines. 59 * levels to the printk calls. APM is not defined for SMP machines.
60 * The new replacment for it is, but Linux doesn't yet support this. 60 * The new replacement for it is, but Linux doesn't yet support this.
61 * Alan Cox Linux 2.1.55 61 * Alan Cox Linux 2.1.55
62 * 1.3: Set up a valid data descriptor 0x40 for buggy BIOS's 62 * 1.3: Set up a valid data descriptor 0x40 for buggy BIOS's
63 * 1.4: Upgraded to support APM 1.2. Integrated ThinkPad suspend patch by 63 * 1.4: Upgraded to support APM 1.2. Integrated ThinkPad suspend patch by
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 5f8af875f457..1ff88c7f45cf 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -266,7 +266,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
266#ifdef CONFIG_X86_HT 266#ifdef CONFIG_X86_HT
267 /* 267 /*
268 * On a AMD multi core setup the lower bits of the APIC id 268 * On a AMD multi core setup the lower bits of the APIC id
269 * distingush the cores. 269 * distinguish the cores.
270 */ 270 */
271 if (c->x86_max_cores > 1) { 271 if (c->x86_max_cores > 1) {
272 int cpu = smp_processor_id(); 272 int cpu = smp_processor_id();
diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index 473eac883c7b..9681fa15ddf0 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -53,7 +53,7 @@ static u32 __cpuinit ramtop(void) /* 16388 */
53 continue; 53 continue;
54 /* 54 /*
55 * Don't MCR over reserved space. Ignore the ISA hole 55 * Don't MCR over reserved space. Ignore the ISA hole
56 * we frob around that catastrophy already 56 * we frob around that catastrophe already
57 */ 57 */
58 58
59 if (e820.map[i].type == E820_RESERVED) 59 if (e820.map[i].type == E820_RESERVED)
@@ -287,7 +287,7 @@ static void __cpuinit init_c3(struct cpuinfo_x86 *c)
287 c->x86_capability[5] = cpuid_edx(0xC0000001); 287 c->x86_capability[5] = cpuid_edx(0xC0000001);
288 } 288 }
289 289
290 /* Cyrix III family needs CX8 & PGE explicity enabled. */ 290 /* Cyrix III family needs CX8 & PGE explicitly enabled. */
291 if (c->x86_model >=6 && c->x86_model <= 9) { 291 if (c->x86_model >=6 && c->x86_model <= 9) {
292 rdmsr (MSR_VIA_FCR, lo, hi); 292 rdmsr (MSR_VIA_FCR, lo, hi);
293 lo |= (1<<1 | 1<<7); 293 lo |= (1<<1 | 1<<7);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d506201d397c..e2fcf2051bdb 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -207,7 +207,7 @@ static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c, int early)
207 207
208static int __init x86_fxsr_setup(char * s) 208static int __init x86_fxsr_setup(char * s)
209{ 209{
210 /* Tell all the other CPU's to not use it... */ 210 /* Tell all the other CPUs to not use it... */
211 disable_x86_fxsr = 1; 211 disable_x86_fxsr = 1;
212 212
213 /* 213 /*
diff --git a/arch/x86/kernel/cpu/cpufreq/Kconfig b/arch/x86/kernel/cpu/cpufreq/Kconfig_32
index d8c6f132dc7a..d8c6f132dc7a 100644
--- a/arch/x86/kernel/cpu/cpufreq/Kconfig
+++ b/arch/x86/kernel/cpu/cpufreq/Kconfig_32
diff --git a/arch/x86/kernel/cpufreq/Kconfig b/arch/x86/kernel/cpu/cpufreq/Kconfig_64
index a3fd51926cbd..9c9699fdcf52 100644
--- a/arch/x86/kernel/cpufreq/Kconfig
+++ b/arch/x86/kernel/cpu/cpufreq/Kconfig_64
@@ -19,7 +19,7 @@ config X86_POWERNOW_K8
19 To compile this driver as a module, choose M here: the 19 To compile this driver as a module, choose M here: the
20 module will be called powernow-k8. 20 module will be called powernow-k8.
21 21
22 For details, take a look at <file:Documentation/cpu-freq/>. 22 For details, take a look at <file:Documentation/cpu-freq/>.
23 23
24 If in doubt, say N. 24 If in doubt, say N.
25 25
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 2ca43ba32bc0..fea0af0476b9 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -77,7 +77,7 @@ static unsigned int acpi_pstate_strict;
77 77
78static int check_est_cpu(unsigned int cpuid) 78static int check_est_cpu(unsigned int cpuid)
79{ 79{
80 struct cpuinfo_x86 *cpu = &cpu_data[cpuid]; 80 struct cpuinfo_x86 *cpu = &cpu_data(cpuid);
81 81
82 if (cpu->x86_vendor != X86_VENDOR_INTEL || 82 if (cpu->x86_vendor != X86_VENDOR_INTEL ||
83 !cpu_has(cpu, X86_FEATURE_EST)) 83 !cpu_has(cpu, X86_FEATURE_EST))
@@ -560,7 +560,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
560 unsigned int cpu = policy->cpu; 560 unsigned int cpu = policy->cpu;
561 struct acpi_cpufreq_data *data; 561 struct acpi_cpufreq_data *data;
562 unsigned int result = 0; 562 unsigned int result = 0;
563 struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; 563 struct cpuinfo_x86 *c = &cpu_data(policy->cpu);
564 struct acpi_processor_performance *perf; 564 struct acpi_processor_performance *perf;
565 565
566 dprintk("acpi_cpufreq_cpu_init\n"); 566 dprintk("acpi_cpufreq_cpu_init\n");
diff --git a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
index 32f0bda3fc95..f03e9153618e 100644
--- a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
+++ b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
@@ -260,7 +260,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
260 260
261 freqs.old = nforce2_get(policy->cpu); 261 freqs.old = nforce2_get(policy->cpu);
262 freqs.new = target_fsb * fid * 100; 262 freqs.new = target_fsb * fid * 100;
263 freqs.cpu = 0; /* Only one CPU on nForce2 plattforms */ 263 freqs.cpu = 0; /* Only one CPU on nForce2 platforms */
264 264
265 if (freqs.old == freqs.new) 265 if (freqs.old == freqs.new)
266 return 0; 266 return 0;
diff --git a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c
index c11baaf9f2b4..326a4c81f684 100644
--- a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c
+++ b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c
@@ -305,7 +305,7 @@ static struct cpufreq_driver eps_driver = {
305 305
306static int __init eps_init(void) 306static int __init eps_init(void)
307{ 307{
308 struct cpuinfo_x86 *c = cpu_data; 308 struct cpuinfo_x86 *c = &cpu_data(0);
309 309
310 /* This driver will work only on Centaur C7 processors with 310 /* This driver will work only on Centaur C7 processors with
311 * Enhanced SpeedStep/PowerSaver registers */ 311 * Enhanced SpeedStep/PowerSaver registers */
diff --git a/arch/x86/kernel/cpu/cpufreq/elanfreq.c b/arch/x86/kernel/cpu/cpufreq/elanfreq.c
index 1e7ae7dafcf6..94619c22f563 100644
--- a/arch/x86/kernel/cpu/cpufreq/elanfreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/elanfreq.c
@@ -199,7 +199,7 @@ static int elanfreq_target (struct cpufreq_policy *policy,
199 199
200static int elanfreq_cpu_init(struct cpufreq_policy *policy) 200static int elanfreq_cpu_init(struct cpufreq_policy *policy)
201{ 201{
202 struct cpuinfo_x86 *c = cpu_data; 202 struct cpuinfo_x86 *c = &cpu_data(0);
203 unsigned int i; 203 unsigned int i;
204 int result; 204 int result;
205 205
@@ -280,7 +280,7 @@ static struct cpufreq_driver elanfreq_driver = {
280 280
281static int __init elanfreq_init(void) 281static int __init elanfreq_init(void)
282{ 282{
283 struct cpuinfo_x86 *c = cpu_data; 283 struct cpuinfo_x86 *c = &cpu_data(0);
284 284
285 /* Test if we have the right hardware */ 285 /* Test if we have the right hardware */
286 if ((c->x86_vendor != X86_VENDOR_AMD) || 286 if ((c->x86_vendor != X86_VENDOR_AMD) ||
diff --git a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
index ed2bda127c44..2ed7db2fd257 100644
--- a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
@@ -12,12 +12,12 @@
12 * of any nature resulting due to the use of this software. This 12 * of any nature resulting due to the use of this software. This
13 * software is provided AS-IS with no warranties. 13 * software is provided AS-IS with no warranties.
14 * 14 *
15 * Theoritical note: 15 * Theoretical note:
16 * 16 *
17 * (see Geode(tm) CS5530 manual (rev.4.1) page.56) 17 * (see Geode(tm) CS5530 manual (rev.4.1) page.56)
18 * 18 *
19 * CPU frequency control on NatSemi Geode GX1/GXLV processor and CS55x0 19 * CPU frequency control on NatSemi Geode GX1/GXLV processor and CS55x0
20 * are based on Suspend Moduration. 20 * are based on Suspend Modulation.
21 * 21 *
22 * Suspend Modulation works by asserting and de-asserting the SUSP# pin 22 * Suspend Modulation works by asserting and de-asserting the SUSP# pin
23 * to CPU(GX1/GXLV) for configurable durations. When asserting SUSP# 23 * to CPU(GX1/GXLV) for configurable durations. When asserting SUSP#
@@ -101,11 +101,11 @@
101 101
102/* SUSCFG bits */ 102/* SUSCFG bits */
103#define SUSMOD (1<<0) /* enable/disable suspend modulation */ 103#define SUSMOD (1<<0) /* enable/disable suspend modulation */
104/* the belows support only with cs5530 (after rev.1.2)/cs5530A */ 104/* the below is supported only with cs5530 (after rev.1.2)/cs5530A */
105#define SMISPDUP (1<<1) /* select how SMI re-enable suspend modulation: */ 105#define SMISPDUP (1<<1) /* select how SMI re-enable suspend modulation: */
106 /* IRQTC timer or read SMI speedup disable reg.(F1BAR[08-09h]) */ 106 /* IRQTC timer or read SMI speedup disable reg.(F1BAR[08-09h]) */
107#define SUSCFG (1<<2) /* enable powering down a GXLV processor. "Special 3Volt Suspend" mode */ 107#define SUSCFG (1<<2) /* enable powering down a GXLV processor. "Special 3Volt Suspend" mode */
108/* the belows support only with cs5530A */ 108/* the below is supported only with cs5530A */
109#define PWRSVE_ISA (1<<3) /* stop ISA clock */ 109#define PWRSVE_ISA (1<<3) /* stop ISA clock */
110#define PWRSVE (1<<4) /* active idle */ 110#define PWRSVE (1<<4) /* active idle */
111 111
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c
index 5045f5d583c8..749d00cb2ebd 100644
--- a/arch/x86/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c
@@ -780,7 +780,7 @@ static int longhaul_setup_southbridge(void)
780 780
781static int __init longhaul_cpu_init(struct cpufreq_policy *policy) 781static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
782{ 782{
783 struct cpuinfo_x86 *c = cpu_data; 783 struct cpuinfo_x86 *c = &cpu_data(0);
784 char *cpuname=NULL; 784 char *cpuname=NULL;
785 int ret; 785 int ret;
786 u32 lo, hi; 786 u32 lo, hi;
@@ -959,7 +959,7 @@ static struct cpufreq_driver longhaul_driver = {
959 959
960static int __init longhaul_init(void) 960static int __init longhaul_init(void)
961{ 961{
962 struct cpuinfo_x86 *c = cpu_data; 962 struct cpuinfo_x86 *c = &cpu_data(0);
963 963
964 if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6) 964 if (c->x86_vendor != X86_VENDOR_CENTAUR || c->x86 != 6)
965 return -ENODEV; 965 return -ENODEV;
diff --git a/arch/x86/kernel/cpu/cpufreq/longrun.c b/arch/x86/kernel/cpu/cpufreq/longrun.c
index b2689514295a..af4a867a097c 100644
--- a/arch/x86/kernel/cpu/cpufreq/longrun.c
+++ b/arch/x86/kernel/cpu/cpufreq/longrun.c
@@ -172,7 +172,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
172 u32 save_lo, save_hi; 172 u32 save_lo, save_hi;
173 u32 eax, ebx, ecx, edx; 173 u32 eax, ebx, ecx, edx;
174 u32 try_hi; 174 u32 try_hi;
175 struct cpuinfo_x86 *c = cpu_data; 175 struct cpuinfo_x86 *c = &cpu_data(0);
176 176
177 if (!low_freq || !high_freq) 177 if (!low_freq || !high_freq)
178 return -EINVAL; 178 return -EINVAL;
@@ -298,7 +298,7 @@ static struct cpufreq_driver longrun_driver = {
298 */ 298 */
299static int __init longrun_init(void) 299static int __init longrun_init(void)
300{ 300{
301 struct cpuinfo_x86 *c = cpu_data; 301 struct cpuinfo_x86 *c = &cpu_data(0);
302 302
303 if (c->x86_vendor != X86_VENDOR_TRANSMETA || 303 if (c->x86_vendor != X86_VENDOR_TRANSMETA ||
304 !cpu_has(c, X86_FEATURE_LONGRUN)) 304 !cpu_has(c, X86_FEATURE_LONGRUN))
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index 793eae854f4f..14791ec55cfd 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -195,7 +195,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
195 195
196static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) 196static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
197{ 197{
198 struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; 198 struct cpuinfo_x86 *c = &cpu_data(policy->cpu);
199 int cpuid = 0; 199 int cpuid = 0;
200 unsigned int i; 200 unsigned int i;
201 201
@@ -279,7 +279,7 @@ static struct cpufreq_driver p4clockmod_driver = {
279 279
280static int __init cpufreq_p4_init(void) 280static int __init cpufreq_p4_init(void)
281{ 281{
282 struct cpuinfo_x86 *c = cpu_data; 282 struct cpuinfo_x86 *c = &cpu_data(0);
283 int ret; 283 int ret;
284 284
285 /* 285 /*
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
index 6d0285339317..eb9b62b0830c 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * This file was based upon code in Powertweak Linux (http://powertweak.sf.net) 2 * This file was based upon code in Powertweak Linux (http://powertweak.sf.net)
3 * (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pänkälä, Dominik Brodowski. 3 * (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pänkälä, Dominik Brodowski.
4 * 4 *
5 * Licensed under the terms of the GNU GPL License version 2. 5 * Licensed under the terms of the GNU GPL License version 2.
6 * 6 *
@@ -215,7 +215,7 @@ static struct cpufreq_driver powernow_k6_driver = {
215 */ 215 */
216static int __init powernow_k6_init(void) 216static int __init powernow_k6_init(void)
217{ 217{
218 struct cpuinfo_x86 *c = cpu_data; 218 struct cpuinfo_x86 *c = &cpu_data(0);
219 219
220 if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) || 220 if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 5) ||
221 ((c->x86_model != 12) && (c->x86_model != 13))) 221 ((c->x86_model != 12) && (c->x86_model != 13)))
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
index f3686a5f2308..b5a9863d6cdc 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
@@ -114,7 +114,7 @@ static int check_fsb(unsigned int fsbspeed)
114 114
115static int check_powernow(void) 115static int check_powernow(void)
116{ 116{
117 struct cpuinfo_x86 *c = cpu_data; 117 struct cpuinfo_x86 *c = &cpu_data(0);
118 unsigned int maxei, eax, ebx, ecx, edx; 118 unsigned int maxei, eax, ebx, ecx, edx;
119 119
120 if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) { 120 if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) {
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index c06ac680c9ca..9c36a53676b7 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -168,7 +168,7 @@ static void count_off_irt(struct powernow_k8_data *data)
168 return; 168 return;
169} 169}
170 170
171/* the voltage stabalization time */ 171/* the voltage stabilization time */
172static void count_off_vst(struct powernow_k8_data *data) 172static void count_off_vst(struct powernow_k8_data *data)
173{ 173{
174 udelay(data->vstable * VST_UNITS_20US); 174 udelay(data->vstable * VST_UNITS_20US);
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
index b06c812208ca..7c4f6e0faed4 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
@@ -148,10 +148,10 @@ struct powernow_k8_data {
148#define PLL_LOCK_CONVERSION (1000/5) /* ms to ns, then divide by clock period */ 148#define PLL_LOCK_CONVERSION (1000/5) /* ms to ns, then divide by clock period */
149 149
150#define MAXIMUM_VID_STEPS 1 /* Current cpus only allow a single step of 25mV */ 150#define MAXIMUM_VID_STEPS 1 /* Current cpus only allow a single step of 25mV */
151#define VST_UNITS_20US 20 /* Voltage Stabalization Time is in units of 20us */ 151#define VST_UNITS_20US 20 /* Voltage Stabilization Time is in units of 20us */
152 152
153/* 153/*
154 * Most values of interest are enocoded in a single field of the _PSS 154 * Most values of interest are encoded in a single field of the _PSS
155 * entries: the "control" value. 155 * entries: the "control" value.
156 */ 156 */
157 157
diff --git a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c
index d9f3e90a7ae0..42da9bd677d6 100644
--- a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c
+++ b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c
@@ -102,7 +102,7 @@ static int sc520_freq_target (struct cpufreq_policy *policy,
102 102
103static int sc520_freq_cpu_init(struct cpufreq_policy *policy) 103static int sc520_freq_cpu_init(struct cpufreq_policy *policy)
104{ 104{
105 struct cpuinfo_x86 *c = cpu_data; 105 struct cpuinfo_x86 *c = &cpu_data(0);
106 int result; 106 int result;
107 107
108 /* capability check */ 108 /* capability check */
@@ -151,7 +151,7 @@ static struct cpufreq_driver sc520_freq_driver = {
151 151
152static int __init sc520_freq_init(void) 152static int __init sc520_freq_init(void)
153{ 153{
154 struct cpuinfo_x86 *c = cpu_data; 154 struct cpuinfo_x86 *c = &cpu_data(0);
155 int err; 155 int err;
156 156
157 /* Test if we have the right hardware */ 157 /* Test if we have the right hardware */
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
index 811d47438546..3031f1196192 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -230,7 +230,7 @@ static struct cpu_model models[] =
230 230
231static int centrino_cpu_init_table(struct cpufreq_policy *policy) 231static int centrino_cpu_init_table(struct cpufreq_policy *policy)
232{ 232{
233 struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; 233 struct cpuinfo_x86 *cpu = &cpu_data(policy->cpu);
234 struct cpu_model *model; 234 struct cpu_model *model;
235 235
236 for(model = models; model->cpu_id != NULL; model++) 236 for(model = models; model->cpu_id != NULL; model++)
@@ -340,7 +340,7 @@ static unsigned int get_cur_freq(unsigned int cpu)
340 340
341static int centrino_cpu_init(struct cpufreq_policy *policy) 341static int centrino_cpu_init(struct cpufreq_policy *policy)
342{ 342{
343 struct cpuinfo_x86 *cpu = &cpu_data[policy->cpu]; 343 struct cpuinfo_x86 *cpu = &cpu_data(policy->cpu);
344 unsigned freq; 344 unsigned freq;
345 unsigned l, h; 345 unsigned l, h;
346 int ret; 346 int ret;
@@ -612,7 +612,7 @@ static struct cpufreq_driver centrino_driver = {
612 */ 612 */
613static int __init centrino_init(void) 613static int __init centrino_init(void)
614{ 614{
615 struct cpuinfo_x86 *cpu = cpu_data; 615 struct cpuinfo_x86 *cpu = &cpu_data(0);
616 616
617 if (!cpu_has(cpu, X86_FEATURE_EST)) 617 if (!cpu_has(cpu, X86_FEATURE_EST))
618 return -ENODEV; 618 return -ENODEV;
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
index b1acc8ce3167..76c3ab0da468 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
@@ -228,7 +228,7 @@ EXPORT_SYMBOL_GPL(speedstep_get_processor_frequency);
228 228
229unsigned int speedstep_detect_processor (void) 229unsigned int speedstep_detect_processor (void)
230{ 230{
231 struct cpuinfo_x86 *c = cpu_data; 231 struct cpuinfo_x86 *c = &cpu_data(0);
232 u32 ebx, msr_lo, msr_hi; 232 u32 ebx, msr_lo, msr_hi;
233 233
234 dprintk("x86: %x, model: %x\n", c->x86, c->x86_model); 234 dprintk("x86: %x, model: %x\n", c->x86, c->x86_model);
diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index 122d2d75aa9f..88d66fb8411d 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -93,7 +93,7 @@ static void __cpuinit check_cx686_slop(struct cpuinfo_x86 *c)
93 93
94 local_irq_save(flags); 94 local_irq_save(flags);
95 ccr3 = getCx86(CX86_CCR3); 95 ccr3 = getCx86(CX86_CCR3);
96 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */ 96 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
97 ccr5 = getCx86(CX86_CCR5); 97 ccr5 = getCx86(CX86_CCR5);
98 if (ccr5 & 2) 98 if (ccr5 & 2)
99 setCx86(CX86_CCR5, ccr5 & 0xfd); /* reset SLOP */ 99 setCx86(CX86_CCR5, ccr5 & 0xfd); /* reset SLOP */
@@ -115,9 +115,9 @@ static void __cpuinit set_cx86_reorder(void)
115 115
116 printk(KERN_INFO "Enable Memory access reorder on Cyrix/NSC processor.\n"); 116 printk(KERN_INFO "Enable Memory access reorder on Cyrix/NSC processor.\n");
117 ccr3 = getCx86(CX86_CCR3); 117 ccr3 = getCx86(CX86_CCR3);
118 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN  */ 118 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
119 119
120 /* Load/Store Serialize to mem access disable (=reorder it)  */ 120 /* Load/Store Serialize to mem access disable (=reorder it) */
121 setCx86(CX86_PCR0, getCx86(CX86_PCR0) & ~0x80); 121 setCx86(CX86_PCR0, getCx86(CX86_PCR0) & ~0x80);
122 /* set load/store serialize from 1GB to 4GB */ 122 /* set load/store serialize from 1GB to 4GB */
123 ccr3 |= 0xe0; 123 ccr3 |= 0xe0;
@@ -146,7 +146,7 @@ static void __cpuinit set_cx86_inc(void)
146 printk(KERN_INFO "Enable Incrementor on Cyrix/NSC processor.\n"); 146 printk(KERN_INFO "Enable Incrementor on Cyrix/NSC processor.\n");
147 147
148 ccr3 = getCx86(CX86_CCR3); 148 ccr3 = getCx86(CX86_CCR3);
149 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN  */ 149 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
150 /* PCR1 -- Performance Control */ 150 /* PCR1 -- Performance Control */
151 /* Incrementor on, whatever that is */ 151 /* Incrementor on, whatever that is */
152 setCx86(CX86_PCR1, getCx86(CX86_PCR1) | 0x02); 152 setCx86(CX86_PCR1, getCx86(CX86_PCR1) | 0x02);
@@ -256,7 +256,7 @@ static void __cpuinit init_cyrix(struct cpuinfo_x86 *c)
256 u32 vendor, device; 256 u32 vendor, device;
257 /* It isn't really a PCI quirk directly, but the cure is the 257 /* It isn't really a PCI quirk directly, but the cure is the
258 same. The MediaGX has deep magic SMM stuff that handles the 258 same. The MediaGX has deep magic SMM stuff that handles the
259 SB emulation. It thows away the fifo on disable_dma() which 259 SB emulation. It throws away the fifo on disable_dma() which
260 is wrong and ruins the audio. 260 is wrong and ruins the audio.
261 261
262 Bug2: VSA1 has a wrap bug so that using maximum sized DMA 262 Bug2: VSA1 has a wrap bug so that using maximum sized DMA
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 1826395ebeeb..9921b01fe199 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -295,7 +295,7 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
295 unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ 295 unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
296 unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb; 296 unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
297#ifdef CONFIG_X86_HT 297#ifdef CONFIG_X86_HT
298 unsigned int cpu = (c == &boot_cpu_data) ? 0 : (c - cpu_data); 298 unsigned int cpu = c->cpu_index;
299#endif 299#endif
300 300
301 if (c->cpuid_level > 3) { 301 if (c->cpuid_level > 3) {
@@ -417,14 +417,14 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
417 if (new_l2) { 417 if (new_l2) {
418 l2 = new_l2; 418 l2 = new_l2;
419#ifdef CONFIG_X86_HT 419#ifdef CONFIG_X86_HT
420 cpu_llc_id[cpu] = l2_id; 420 per_cpu(cpu_llc_id, cpu) = l2_id;
421#endif 421#endif
422 } 422 }
423 423
424 if (new_l3) { 424 if (new_l3) {
425 l3 = new_l3; 425 l3 = new_l3;
426#ifdef CONFIG_X86_HT 426#ifdef CONFIG_X86_HT
427 cpu_llc_id[cpu] = l3_id; 427 per_cpu(cpu_llc_id, cpu) = l3_id;
428#endif 428#endif
429 } 429 }
430 430
@@ -459,7 +459,7 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
459 struct _cpuid4_info *this_leaf, *sibling_leaf; 459 struct _cpuid4_info *this_leaf, *sibling_leaf;
460 unsigned long num_threads_sharing; 460 unsigned long num_threads_sharing;
461 int index_msb, i; 461 int index_msb, i;
462 struct cpuinfo_x86 *c = cpu_data; 462 struct cpuinfo_x86 *c = &cpu_data(cpu);
463 463
464 this_leaf = CPUID4_INFO_IDX(cpu, index); 464 this_leaf = CPUID4_INFO_IDX(cpu, index);
465 num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing; 465 num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing;
@@ -470,8 +470,8 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
470 index_msb = get_count_order(num_threads_sharing); 470 index_msb = get_count_order(num_threads_sharing);
471 471
472 for_each_online_cpu(i) { 472 for_each_online_cpu(i) {
473 if (c[i].apicid >> index_msb == 473 if (cpu_data(i).apicid >> index_msb ==
474 c[cpu].apicid >> index_msb) { 474 c->apicid >> index_msb) {
475 cpu_set(i, this_leaf->shared_cpu_map); 475 cpu_set(i, this_leaf->shared_cpu_map);
476 if (i != cpu && cpuid4_info[i]) { 476 if (i != cpu && cpuid4_info[i]) {
477 sibling_leaf = CPUID4_INFO_IDX(i, index); 477 sibling_leaf = CPUID4_INFO_IDX(i, index);
@@ -499,6 +499,11 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index) {
499 499
500static void free_cache_attributes(unsigned int cpu) 500static void free_cache_attributes(unsigned int cpu)
501{ 501{
502 int i;
503
504 for (i = 0; i < num_cache_leaves; i++)
505 cache_remove_shared_cpu_map(cpu, i);
506
502 kfree(cpuid4_info[cpu]); 507 kfree(cpuid4_info[cpu]);
503 cpuid4_info[cpu] = NULL; 508 cpuid4_info[cpu] = NULL;
504} 509}
@@ -506,8 +511,8 @@ static void free_cache_attributes(unsigned int cpu)
506static int __cpuinit detect_cache_attributes(unsigned int cpu) 511static int __cpuinit detect_cache_attributes(unsigned int cpu)
507{ 512{
508 struct _cpuid4_info *this_leaf; 513 struct _cpuid4_info *this_leaf;
509 unsigned long j; 514 unsigned long j;
510 int retval; 515 int retval;
511 cpumask_t oldmask; 516 cpumask_t oldmask;
512 517
513 if (num_cache_leaves == 0) 518 if (num_cache_leaves == 0)
@@ -524,19 +529,26 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
524 goto out; 529 goto out;
525 530
526 /* Do cpuid and store the results */ 531 /* Do cpuid and store the results */
527 retval = 0;
528 for (j = 0; j < num_cache_leaves; j++) { 532 for (j = 0; j < num_cache_leaves; j++) {
529 this_leaf = CPUID4_INFO_IDX(cpu, j); 533 this_leaf = CPUID4_INFO_IDX(cpu, j);
530 retval = cpuid4_cache_lookup(j, this_leaf); 534 retval = cpuid4_cache_lookup(j, this_leaf);
531 if (unlikely(retval < 0)) 535 if (unlikely(retval < 0)) {
536 int i;
537
538 for (i = 0; i < j; i++)
539 cache_remove_shared_cpu_map(cpu, i);
532 break; 540 break;
541 }
533 cache_shared_cpu_map_setup(cpu, j); 542 cache_shared_cpu_map_setup(cpu, j);
534 } 543 }
535 set_cpus_allowed(current, oldmask); 544 set_cpus_allowed(current, oldmask);
536 545
537out: 546out:
538 if (retval) 547 if (retval) {
539 free_cache_attributes(cpu); 548 kfree(cpuid4_info[cpu]);
549 cpuid4_info[cpu] = NULL;
550 }
551
540 return retval; 552 return retval;
541} 553}
542 554
@@ -669,7 +681,7 @@ static struct kobj_type ktype_percpu_entry = {
669 .sysfs_ops = &sysfs_ops, 681 .sysfs_ops = &sysfs_ops,
670}; 682};
671 683
672static void cpuid4_cache_sysfs_exit(unsigned int cpu) 684static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu)
673{ 685{
674 kfree(cache_kobject[cpu]); 686 kfree(cache_kobject[cpu]);
675 kfree(index_kobject[cpu]); 687 kfree(index_kobject[cpu]);
@@ -680,13 +692,14 @@ static void cpuid4_cache_sysfs_exit(unsigned int cpu)
680 692
681static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu) 693static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu)
682{ 694{
695 int err;
683 696
684 if (num_cache_leaves == 0) 697 if (num_cache_leaves == 0)
685 return -ENOENT; 698 return -ENOENT;
686 699
687 detect_cache_attributes(cpu); 700 err = detect_cache_attributes(cpu);
688 if (cpuid4_info[cpu] == NULL) 701 if (err)
689 return -ENOENT; 702 return err;
690 703
691 /* Allocate all required memory */ 704 /* Allocate all required memory */
692 cache_kobject[cpu] = kzalloc(sizeof(struct kobject), GFP_KERNEL); 705 cache_kobject[cpu] = kzalloc(sizeof(struct kobject), GFP_KERNEL);
@@ -705,13 +718,15 @@ err_out:
705 return -ENOMEM; 718 return -ENOMEM;
706} 719}
707 720
721static cpumask_t cache_dev_map = CPU_MASK_NONE;
722
708/* Add/Remove cache interface for CPU device */ 723/* Add/Remove cache interface for CPU device */
709static int __cpuinit cache_add_dev(struct sys_device * sys_dev) 724static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
710{ 725{
711 unsigned int cpu = sys_dev->id; 726 unsigned int cpu = sys_dev->id;
712 unsigned long i, j; 727 unsigned long i, j;
713 struct _index_kobject *this_object; 728 struct _index_kobject *this_object;
714 int retval = 0; 729 int retval;
715 730
716 retval = cpuid4_cache_sysfs_init(cpu); 731 retval = cpuid4_cache_sysfs_init(cpu);
717 if (unlikely(retval < 0)) 732 if (unlikely(retval < 0))
@@ -721,6 +736,10 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
721 kobject_set_name(cache_kobject[cpu], "%s", "cache"); 736 kobject_set_name(cache_kobject[cpu], "%s", "cache");
722 cache_kobject[cpu]->ktype = &ktype_percpu_entry; 737 cache_kobject[cpu]->ktype = &ktype_percpu_entry;
723 retval = kobject_register(cache_kobject[cpu]); 738 retval = kobject_register(cache_kobject[cpu]);
739 if (retval < 0) {
740 cpuid4_cache_sysfs_exit(cpu);
741 return retval;
742 }
724 743
725 for (i = 0; i < num_cache_leaves; i++) { 744 for (i = 0; i < num_cache_leaves; i++) {
726 this_object = INDEX_KOBJECT_PTR(cpu,i); 745 this_object = INDEX_KOBJECT_PTR(cpu,i);
@@ -740,6 +759,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
740 break; 759 break;
741 } 760 }
742 } 761 }
762 if (!retval)
763 cpu_set(cpu, cache_dev_map);
764
743 return retval; 765 return retval;
744} 766}
745 767
@@ -750,13 +772,14 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
750 772
751 if (cpuid4_info[cpu] == NULL) 773 if (cpuid4_info[cpu] == NULL)
752 return; 774 return;
753 for (i = 0; i < num_cache_leaves; i++) { 775 if (!cpu_isset(cpu, cache_dev_map))
754 cache_remove_shared_cpu_map(cpu, i); 776 return;
777 cpu_clear(cpu, cache_dev_map);
778
779 for (i = 0; i < num_cache_leaves; i++)
755 kobject_unregister(&(INDEX_KOBJECT_PTR(cpu,i)->kobj)); 780 kobject_unregister(&(INDEX_KOBJECT_PTR(cpu,i)->kobj));
756 }
757 kobject_unregister(cache_kobject[cpu]); 781 kobject_unregister(cache_kobject[cpu]);
758 cpuid4_cache_sysfs_exit(cpu); 782 cpuid4_cache_sysfs_exit(cpu);
759 return;
760} 783}
761 784
762static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb, 785static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
@@ -781,7 +804,7 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
781 804
782static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier = 805static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier =
783{ 806{
784 .notifier_call = cacheinfo_cpu_callback, 807 .notifier_call = cacheinfo_cpu_callback,
785}; 808};
786 809
787static int __cpuinit cache_sysfs_init(void) 810static int __cpuinit cache_sysfs_init(void)
@@ -791,14 +814,15 @@ static int __cpuinit cache_sysfs_init(void)
791 if (num_cache_leaves == 0) 814 if (num_cache_leaves == 0)
792 return 0; 815 return 0;
793 816
794 register_hotcpu_notifier(&cacheinfo_cpu_notifier);
795
796 for_each_online_cpu(i) { 817 for_each_online_cpu(i) {
797 struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); 818 int err;
819 struct sys_device *sys_dev = get_cpu_sysdev(i);
798 820
799 cache_add_dev(sys_dev); 821 err = cache_add_dev(sys_dev);
822 if (err)
823 return err;
800 } 824 }
801 825 register_hotcpu_notifier(&cacheinfo_cpu_notifier);
802 return 0; 826 return 0;
803} 827}
804 828
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 494d320d909b..24885be5c48c 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -131,17 +131,19 @@ static __cpuinit int thermal_throttle_cpu_callback(struct notifier_block *nfb,
131{ 131{
132 unsigned int cpu = (unsigned long)hcpu; 132 unsigned int cpu = (unsigned long)hcpu;
133 struct sys_device *sys_dev; 133 struct sys_device *sys_dev;
134 int err; 134 int err = 0;
135 135
136 sys_dev = get_cpu_sysdev(cpu); 136 sys_dev = get_cpu_sysdev(cpu);
137 switch (action) { 137 switch (action) {
138 case CPU_ONLINE: 138 case CPU_UP_PREPARE:
139 case CPU_ONLINE_FROZEN: 139 case CPU_UP_PREPARE_FROZEN:
140 mutex_lock(&therm_cpu_lock); 140 mutex_lock(&therm_cpu_lock);
141 err = thermal_throttle_add_dev(sys_dev); 141 err = thermal_throttle_add_dev(sys_dev);
142 mutex_unlock(&therm_cpu_lock); 142 mutex_unlock(&therm_cpu_lock);
143 WARN_ON(err); 143 WARN_ON(err);
144 break; 144 break;
145 case CPU_UP_CANCELED:
146 case CPU_UP_CANCELED_FROZEN:
145 case CPU_DEAD: 147 case CPU_DEAD:
146 case CPU_DEAD_FROZEN: 148 case CPU_DEAD_FROZEN:
147 mutex_lock(&therm_cpu_lock); 149 mutex_lock(&therm_cpu_lock);
@@ -149,7 +151,7 @@ static __cpuinit int thermal_throttle_cpu_callback(struct notifier_block *nfb,
149 mutex_unlock(&therm_cpu_lock); 151 mutex_unlock(&therm_cpu_lock);
150 break; 152 break;
151 } 153 }
152 return NOTIFY_OK; 154 return err ? NOTIFY_BAD : NOTIFY_OK;
153} 155}
154 156
155static struct notifier_block thermal_throttle_cpu_notifier __cpuinitdata = 157static struct notifier_block thermal_throttle_cpu_notifier __cpuinitdata =
diff --git a/arch/x86/kernel/cpu/mtrr/cyrix.c b/arch/x86/kernel/cpu/mtrr/cyrix.c
index 2287d4863a8a..9964be3de2b7 100644
--- a/arch/x86/kernel/cpu/mtrr/cyrix.c
+++ b/arch/x86/kernel/cpu/mtrr/cyrix.c
@@ -147,10 +147,10 @@ static void prepare_set(void)
147 write_cr0(cr0); 147 write_cr0(cr0);
148 wbinvd(); 148 wbinvd();
149 149
150 /* Cyrix ARRs - everything else were excluded at the top */ 150 /* Cyrix ARRs - everything else was excluded at the top */
151 ccr3 = getCx86(CX86_CCR3); 151 ccr3 = getCx86(CX86_CCR3);
152 152
153 /* Cyrix ARRs - everything else were excluded at the top */ 153 /* Cyrix ARRs - everything else was excluded at the top */
154 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); 154 setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);
155 155
156} 156}
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 56f64e34829f..992f08dfbb6c 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -182,7 +182,7 @@ static inline void k8_enable_fixed_iorrs(void)
182 182
183/** 183/**
184 * Checks and updates an fixed-range MTRR if it differs from the value it 184 * Checks and updates an fixed-range MTRR if it differs from the value it
185 * should have. If K8 extenstions are wanted, update the K8 SYSCFG MSR also. 185 * should have. If K8 extentions are wanted, update the K8 SYSCFG MSR also.
186 * see AMD publication no. 24593, chapter 7.8.1, page 233 for more information 186 * see AMD publication no. 24593, chapter 7.8.1, page 233 for more information
187 * \param msr MSR address of the MTTR which should be checked and updated 187 * \param msr MSR address of the MTTR which should be checked and updated
188 * \param changed pointer which indicates whether the MTRR needed to be changed 188 * \param changed pointer which indicates whether the MTRR needed to be changed
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 5e4be30ff903..9abbdf7562c5 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -748,7 +748,7 @@ static int __init mtrr_init_finialize(void)
748 if (use_intel()) 748 if (use_intel())
749 mtrr_state_warn(); 749 mtrr_state_warn();
750 else { 750 else {
751 /* The CPUs haven't MTRR and seemes not support SMP. They have 751 /* The CPUs haven't MTRR and seem to not support SMP. They have
752 * specific drivers, we use a tricky method to support 752 * specific drivers, we use a tricky method to support
753 * suspend/resume for them. 753 * suspend/resume for them.
754 * TBD: is there any system with such CPU which supports 754 * TBD: is there any system with such CPU which supports
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 54cdbf1a40f1..c02541e6e653 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -120,7 +120,9 @@ int reserve_perfctr_nmi(unsigned int msr)
120 unsigned int counter; 120 unsigned int counter;
121 121
122 counter = nmi_perfctr_msr_to_bit(msr); 122 counter = nmi_perfctr_msr_to_bit(msr);
123 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 123 /* register not managed by the allocator? */
124 if (counter > NMI_MAX_COUNTER_BITS)
125 return 1;
124 126
125 if (!test_and_set_bit(counter, perfctr_nmi_owner)) 127 if (!test_and_set_bit(counter, perfctr_nmi_owner))
126 return 1; 128 return 1;
@@ -132,7 +134,9 @@ void release_perfctr_nmi(unsigned int msr)
132 unsigned int counter; 134 unsigned int counter;
133 135
134 counter = nmi_perfctr_msr_to_bit(msr); 136 counter = nmi_perfctr_msr_to_bit(msr);
135 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 137 /* register not managed by the allocator? */
138 if (counter > NMI_MAX_COUNTER_BITS)
139 return;
136 140
137 clear_bit(counter, perfctr_nmi_owner); 141 clear_bit(counter, perfctr_nmi_owner);
138} 142}
@@ -142,7 +146,9 @@ int reserve_evntsel_nmi(unsigned int msr)
142 unsigned int counter; 146 unsigned int counter;
143 147
144 counter = nmi_evntsel_msr_to_bit(msr); 148 counter = nmi_evntsel_msr_to_bit(msr);
145 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 149 /* register not managed by the allocator? */
150 if (counter > NMI_MAX_COUNTER_BITS)
151 return 1;
146 152
147 if (!test_and_set_bit(counter, evntsel_nmi_owner)) 153 if (!test_and_set_bit(counter, evntsel_nmi_owner))
148 return 1; 154 return 1;
@@ -154,7 +160,9 @@ void release_evntsel_nmi(unsigned int msr)
154 unsigned int counter; 160 unsigned int counter;
155 161
156 counter = nmi_evntsel_msr_to_bit(msr); 162 counter = nmi_evntsel_msr_to_bit(msr);
157 BUG_ON(counter > NMI_MAX_COUNTER_BITS); 163 /* register not managed by the allocator? */
164 if (counter > NMI_MAX_COUNTER_BITS)
165 return;
158 166
159 clear_bit(counter, evntsel_nmi_owner); 167 clear_bit(counter, evntsel_nmi_owner);
160} 168}
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 879a0f789b1e..2d42b414b777 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -85,12 +85,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)
85 /* nothing */ 85 /* nothing */
86 }; 86 };
87 struct cpuinfo_x86 *c = v; 87 struct cpuinfo_x86 *c = v;
88 int i, n = c - cpu_data; 88 int i, n = 0;
89 int fpu_exception; 89 int fpu_exception;
90 90
91#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
92 if (!cpu_online(n)) 92 if (!cpu_online(n))
93 return 0; 93 return 0;
94 n = c->cpu_index;
94#endif 95#endif
95 seq_printf(m, "processor\t: %d\n" 96 seq_printf(m, "processor\t: %d\n"
96 "vendor_id\t: %s\n" 97 "vendor_id\t: %s\n"
@@ -175,11 +176,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
175 176
176static void *c_start(struct seq_file *m, loff_t *pos) 177static void *c_start(struct seq_file *m, loff_t *pos)
177{ 178{
178 return *pos < NR_CPUS ? cpu_data + *pos : NULL; 179 if (*pos == 0) /* just in case, cpu 0 is not the first */
180 *pos = first_cpu(cpu_possible_map);
181 if ((*pos) < NR_CPUS && cpu_possible(*pos))
182 return &cpu_data(*pos);
183 return NULL;
179} 184}
180static void *c_next(struct seq_file *m, void *v, loff_t *pos) 185static void *c_next(struct seq_file *m, void *v, loff_t *pos)
181{ 186{
182 ++*pos; 187 *pos = next_cpu(*pos, cpu_possible_map);
183 return c_start(m, pos); 188 return c_start(m, pos);
184} 189}
185static void c_stop(struct seq_file *m, void *v) 190static void c_stop(struct seq_file *m, void *v)
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 70dcf912d9fb..05c9936a16cc 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -114,7 +114,7 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
114static int cpuid_open(struct inode *inode, struct file *file) 114static int cpuid_open(struct inode *inode, struct file *file)
115{ 115{
116 unsigned int cpu = iminor(file->f_path.dentry->d_inode); 116 unsigned int cpu = iminor(file->f_path.dentry->d_inode);
117 struct cpuinfo_x86 *c = &(cpu_data)[cpu]; 117 struct cpuinfo_x86 *c = &cpu_data(cpu);
118 118
119 if (cpu >= NR_CPUS || !cpu_online(cpu)) 119 if (cpu >= NR_CPUS || !cpu_online(cpu))
120 return -ENXIO; /* No such CPU */ 120 return -ENXIO; /* No such CPU */
@@ -134,15 +134,18 @@ static const struct file_operations cpuid_fops = {
134 .open = cpuid_open, 134 .open = cpuid_open,
135}; 135};
136 136
137static int __cpuinit cpuid_device_create(int i) 137static __cpuinit int cpuid_device_create(int cpu)
138{ 138{
139 int err = 0;
140 struct device *dev; 139 struct device *dev;
141 140
142 dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, i), "cpu%d",i); 141 dev = device_create(cpuid_class, NULL, MKDEV(CPUID_MAJOR, cpu),
143 if (IS_ERR(dev)) 142 "cpu%d", cpu);
144 err = PTR_ERR(dev); 143 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
145 return err; 144}
145
146static void cpuid_device_destroy(int cpu)
147{
148 device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu));
146} 149}
147 150
148static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb, 151static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,
@@ -150,18 +153,21 @@ static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,
150 void *hcpu) 153 void *hcpu)
151{ 154{
152 unsigned int cpu = (unsigned long)hcpu; 155 unsigned int cpu = (unsigned long)hcpu;
156 int err = 0;
153 157
154 switch (action) { 158 switch (action) {
155 case CPU_ONLINE: 159 case CPU_UP_PREPARE:
156 case CPU_ONLINE_FROZEN: 160 case CPU_UP_PREPARE_FROZEN:
157 cpuid_device_create(cpu); 161 err = cpuid_device_create(cpu);
158 break; 162 break;
163 case CPU_UP_CANCELED:
164 case CPU_UP_CANCELED_FROZEN:
159 case CPU_DEAD: 165 case CPU_DEAD:
160 case CPU_DEAD_FROZEN: 166 case CPU_DEAD_FROZEN:
161 device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); 167 cpuid_device_destroy(cpu);
162 break; 168 break;
163 } 169 }
164 return NOTIFY_OK; 170 return err ? NOTIFY_BAD : NOTIFY_OK;
165} 171}
166 172
167static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier = 173static struct notifier_block __cpuinitdata cpuid_class_cpu_notifier =
@@ -198,7 +204,7 @@ static int __init cpuid_init(void)
198out_class: 204out_class:
199 i = 0; 205 i = 0;
200 for_each_online_cpu(i) { 206 for_each_online_cpu(i) {
201 device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, i)); 207 cpuid_device_destroy(i);
202 } 208 }
203 class_destroy(cpuid_class); 209 class_destroy(cpuid_class);
204out_chrdev: 210out_chrdev:
@@ -212,7 +218,7 @@ static void __exit cpuid_exit(void)
212 int cpu = 0; 218 int cpu = 0;
213 219
214 for_each_online_cpu(cpu) 220 for_each_online_cpu(cpu)
215 device_destroy(cpuid_class, MKDEV(CPUID_MAJOR, cpu)); 221 cpuid_device_destroy(cpu);
216 class_destroy(cpuid_class); 222 class_destroy(cpuid_class);
217 unregister_chrdev(CPUID_MAJOR, "cpu/cpuid"); 223 unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
218 unregister_hotcpu_notifier(&cpuid_class_cpu_notifier); 224 unregister_hotcpu_notifier(&cpuid_class_cpu_notifier);
diff --git a/arch/x86/kernel/crash_dump_32.c b/arch/x86/kernel/crash_dump_32.c
index 32e75d0731a9..72d0c56c1b48 100644
--- a/arch/x86/kernel/crash_dump_32.c
+++ b/arch/x86/kernel/crash_dump_32.c
@@ -47,6 +47,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
47 if (!kdump_buf_page) { 47 if (!kdump_buf_page) {
48 printk(KERN_WARNING "Kdump: Kdump buffer page not" 48 printk(KERN_WARNING "Kdump: Kdump buffer page not"
49 " allocated\n"); 49 " allocated\n");
50 kunmap_atomic(vaddr, KM_PTE0);
50 return -EFAULT; 51 return -EFAULT;
51 } 52 }
52 copy_page(kdump_buf_page, vaddr); 53 copy_page(kdump_buf_page, vaddr);
diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c
index 3c86b979a40a..58fd54eb5577 100644
--- a/arch/x86/kernel/e820_32.c
+++ b/arch/x86/kernel/e820_32.c
@@ -288,7 +288,8 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat
288 request_resource(res, code_resource); 288 request_resource(res, code_resource);
289 request_resource(res, data_resource); 289 request_resource(res, data_resource);
290#ifdef CONFIG_KEXEC 290#ifdef CONFIG_KEXEC
291 request_resource(res, &crashk_res); 291 if (crashk_res.start != crashk_res.end)
292 request_resource(res, &crashk_res);
292#endif 293#endif
293 } 294 }
294 } 295 }
@@ -705,7 +706,7 @@ void __init e820_register_memory(void)
705 int i; 706 int i;
706 707
707 /* 708 /*
708 * Search for the bigest gap in the low 32 bits of the e820 709 * Search for the biggest gap in the low 32 bits of the e820
709 * memory space. 710 * memory space.
710 */ 711 */
711 last = 0x100000000ull; 712 last = 0x100000000ull;
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index e422b8159f69..57616865d8a0 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -226,7 +226,8 @@ void __init e820_reserve_resources(void)
226 request_resource(res, &code_resource); 226 request_resource(res, &code_resource);
227 request_resource(res, &data_resource); 227 request_resource(res, &data_resource);
228#ifdef CONFIG_KEXEC 228#ifdef CONFIG_KEXEC
229 request_resource(res, &crashk_res); 229 if (crashk_res.start != crashk_res.end)
230 request_resource(res, &crashk_res);
230#endif 231#endif
231 } 232 }
232 } 233 }
diff --git a/arch/x86/kernel/early-quirks_64.c b/arch/x86/kernel/early-quirks.c
index 13aa4fd728f3..dc34acbd54aa 100644
--- a/arch/x86/kernel/early-quirks_64.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -13,9 +13,13 @@
13#include <linux/acpi.h> 13#include <linux/acpi.h>
14#include <linux/pci_ids.h> 14#include <linux/pci_ids.h>
15#include <asm/pci-direct.h> 15#include <asm/pci-direct.h>
16#include <asm/proto.h>
17#include <asm/iommu.h>
18#include <asm/dma.h> 16#include <asm/dma.h>
17#include <asm/io_apic.h>
18#include <asm/apic.h>
19
20#ifdef CONFIG_IOMMU
21#include <asm/iommu.h>
22#endif
19 23
20static void __init via_bugs(void) 24static void __init via_bugs(void)
21{ 25{
@@ -23,7 +27,8 @@ static void __init via_bugs(void)
23 if ((end_pfn > MAX_DMA32_PFN || force_iommu) && 27 if ((end_pfn > MAX_DMA32_PFN || force_iommu) &&
24 !iommu_aperture_allowed) { 28 !iommu_aperture_allowed) {
25 printk(KERN_INFO 29 printk(KERN_INFO
26 "Looks like a VIA chipset. Disabling IOMMU. Override with iommu=allowed\n"); 30 "Looks like a VIA chipset. Disabling IOMMU."
31 " Override with iommu=allowed\n");
27 iommu_aperture_disabled = 1; 32 iommu_aperture_disabled = 1;
28 } 33 }
29#endif 34#endif
@@ -40,6 +45,7 @@ static int __init nvidia_hpet_check(struct acpi_table_header *header)
40static void __init nvidia_bugs(void) 45static void __init nvidia_bugs(void)
41{ 46{
42#ifdef CONFIG_ACPI 47#ifdef CONFIG_ACPI
48#ifdef CONFIG_X86_IO_APIC
43 /* 49 /*
44 * All timer overrides on Nvidia are 50 * All timer overrides on Nvidia are
45 * wrong unless HPET is enabled. 51 * wrong unless HPET is enabled.
@@ -59,17 +65,20 @@ static void __init nvidia_bugs(void)
59 "try acpi_use_timer_override\n"); 65 "try acpi_use_timer_override\n");
60 } 66 }
61#endif 67#endif
68#endif
62 /* RED-PEN skip them on mptables too? */ 69 /* RED-PEN skip them on mptables too? */
63 70
64} 71}
65 72
66static void __init ati_bugs(void) 73static void __init ati_bugs(void)
67{ 74{
75#ifdef CONFIG_X86_IO_APIC
68 if (timer_over_8254 == 1) { 76 if (timer_over_8254 == 1) {
69 timer_over_8254 = 0; 77 timer_over_8254 = 0;
70 printk(KERN_INFO 78 printk(KERN_INFO
71 "ATI board detected. Disabling timer routing over 8254.\n"); 79 "ATI board detected. Disabling timer routing over 8254.\n");
72 } 80 }
81#endif
73} 82}
74 83
75struct chipset { 84struct chipset {
@@ -104,7 +113,7 @@ void __init early_quirks(void)
104 if (class == 0xffffffff) 113 if (class == 0xffffffff)
105 break; 114 break;
106 115
107 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI) 116 if ((class >> 16) != PCI_CLASS_BRIDGE_PCI)
108 continue; 117 continue;
109 118
110 vendor = read_pci_config(num, slot, func, 119 vendor = read_pci_config(num, slot, func,
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index 4ae03e3e8294..ce703e21c912 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -24,10 +24,19 @@
24#include <acpi/acpi_bus.h> 24#include <acpi/acpi_bus.h>
25#endif 25#endif
26 26
27/* which logical CPU number maps to which CPU (physical APIC ID) */ 27/*
28u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly 28 * which logical CPU number maps to which CPU (physical APIC ID)
29 *
30 * The following static array is used during kernel startup
31 * and the x86_cpu_to_apicid_ptr contains the address of the
32 * array during this time. Is it zeroed when the per_cpu
33 * data area is removed.
34 */
35u8 x86_cpu_to_apicid_init[NR_CPUS] __initdata
29 = { [0 ... NR_CPUS-1] = BAD_APICID }; 36 = { [0 ... NR_CPUS-1] = BAD_APICID };
30EXPORT_SYMBOL(x86_cpu_to_apicid); 37void *x86_cpu_to_apicid_ptr;
38DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID;
39EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
31 40
32struct genapic __read_mostly *genapic = &apic_flat; 41struct genapic __read_mostly *genapic = &apic_flat;
33 42
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index 91c7526768ee..07352b74bda6 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -172,7 +172,7 @@ static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask)
172 */ 172 */
173 cpu = first_cpu(cpumask); 173 cpu = first_cpu(cpumask);
174 if ((unsigned)cpu < NR_CPUS) 174 if ((unsigned)cpu < NR_CPUS)
175 return x86_cpu_to_apicid[cpu]; 175 return per_cpu(x86_cpu_to_apicid, cpu);
176 else 176 else
177 return BAD_APICID; 177 return BAD_APICID;
178} 178}
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index a7eee0a4751d..6b3469311e42 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -58,7 +58,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
58 58
59 for (i = 0; i < IDT_ENTRIES; i++) 59 for (i = 0; i < IDT_ENTRIES; i++)
60 set_intr_gate(i, early_idt_handler); 60 set_intr_gate(i, early_idt_handler);
61 asm volatile("lidt %0" :: "m" (idt_descr)); 61 load_idt((const struct desc_ptr *)&idt_descr);
62 62
63 early_printk("Kernel alive\n"); 63 early_printk("Kernel alive\n");
64 64
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index f8367074da0d..53303f2e5475 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -69,12 +69,15 @@ static inline void hpet_clear_mapping(void)
69 * HPET command line enable / disable 69 * HPET command line enable / disable
70 */ 70 */
71static int boot_hpet_disable; 71static int boot_hpet_disable;
72int hpet_force_user;
72 73
73static int __init hpet_setup(char* str) 74static int __init hpet_setup(char* str)
74{ 75{
75 if (str) { 76 if (str) {
76 if (!strncmp("disable", str, 7)) 77 if (!strncmp("disable", str, 7))
77 boot_hpet_disable = 1; 78 boot_hpet_disable = 1;
79 if (!strncmp("force", str, 5))
80 hpet_force_user = 1;
78 } 81 }
79 return 1; 82 return 1;
80} 83}
@@ -350,7 +353,7 @@ static int hpet_clocksource_register(void)
350 * 353 *
351 * hpet period is in femto seconds per cycle 354 * hpet period is in femto seconds per cycle
352 * so we need to convert this to ns/cyc units 355 * so we need to convert this to ns/cyc units
353 * aproximated by mult/2^shift 356 * approximated by mult/2^shift
354 * 357 *
355 * fsec/cyc * 1nsec/1000000fsec = nsec/cyc = mult/2^shift 358 * fsec/cyc * 1nsec/1000000fsec = nsec/cyc = mult/2^shift
356 * fsec/cyc * 1ns/1000000fsec * 2^shift = mult 359 * fsec/cyc * 1ns/1000000fsec * 2^shift = mult
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index 5cc8841ca2c6..a42c80745325 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -86,7 +86,7 @@ static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
86 * On UP the PIT can serve all of the possible timer functions. On SMP systems 86 * On UP the PIT can serve all of the possible timer functions. On SMP systems
87 * it can be solely used for the global tick. 87 * it can be solely used for the global tick.
88 * 88 *
89 * The profiling and update capabilites are switched off once the local apic is 89 * The profiling and update capabilities are switched off once the local apic is
90 * registered. This mechanism replaces the previous #ifdef LOCAL_APIC - 90 * registered. This mechanism replaces the previous #ifdef LOCAL_APIC -
91 * !using_apic_timer decisions in do_timer_interrupt_hook() 91 * !using_apic_timer decisions in do_timer_interrupt_hook()
92 */ 92 */
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index d34a10cc13a7..f634fc715c99 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -403,7 +403,8 @@ void __init native_init_IRQ(void)
403 int vector = FIRST_EXTERNAL_VECTOR + i; 403 int vector = FIRST_EXTERNAL_VECTOR + i;
404 if (i >= NR_IRQS) 404 if (i >= NR_IRQS)
405 break; 405 break;
406 if (vector != SYSCALL_VECTOR) 406 /* SYSCALL_VECTOR was reserved in trap_init. */
407 if (!test_bit(vector, used_vectors))
407 set_intr_gate(vector, interrupt[i]); 408 set_intr_gate(vector, interrupt[i]);
408 } 409 }
409 410
diff --git a/arch/x86/kernel/init_task_32.c b/arch/x86/kernel/init_task.c
index d26fc063a760..468c9c437842 100644
--- a/arch/x86/kernel/init_task_32.c
+++ b/arch/x86/kernel/init_task.c
@@ -15,7 +15,6 @@ static struct files_struct init_files = INIT_FILES;
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm); 17struct mm_struct init_mm = INIT_MM(init_mm);
18
19EXPORT_SYMBOL(init_mm); 18EXPORT_SYMBOL(init_mm);
20 19
21/* 20/*
@@ -25,7 +24,7 @@ EXPORT_SYMBOL(init_mm);
25 * way process stacks are handled. This is done by having a special 24 * way process stacks are handled. This is done by having a special
26 * "init_task" linker map entry.. 25 * "init_task" linker map entry..
27 */ 26 */
28union thread_union init_thread_union 27union thread_union init_thread_union
29 __attribute__((__section__(".data.init_task"))) = 28 __attribute__((__section__(".data.init_task"))) =
30 { INIT_THREAD_INFO(init_task) }; 29 { INIT_THREAD_INFO(init_task) };
31 30
@@ -35,12 +34,14 @@ union thread_union init_thread_union
35 * All other task structs will be allocated on slabs in fork.c 34 * All other task structs will be allocated on slabs in fork.c
36 */ 35 */
37struct task_struct init_task = INIT_TASK(init_task); 36struct task_struct init_task = INIT_TASK(init_task);
38
39EXPORT_SYMBOL(init_task); 37EXPORT_SYMBOL(init_task);
40 38
41/* 39/*
42 * per-CPU TSS segments. Threads are completely 'soft' on Linux, 40 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
43 * no more per-task TSS's. 41 * no more per-task TSS's. The TSS size is kept cacheline-aligned
44 */ 42 * so they are allowed to end up in the .data.cacheline_aligned
43 * section. Since TSS's are completely CPU-local, we want them
44 * on exact cacheline boundaries, to eliminate cacheline ping-pong.
45 */
45DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; 46DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
46 47
diff --git a/arch/x86/kernel/init_task_64.c b/arch/x86/kernel/init_task_64.c
deleted file mode 100644
index 4ff33d4f8551..000000000000
--- a/arch/x86/kernel/init_task_64.c
+++ /dev/null
@@ -1,54 +0,0 @@
1#include <linux/mm.h>
2#include <linux/module.h>
3#include <linux/sched.h>
4#include <linux/init.h>
5#include <linux/init_task.h>
6#include <linux/fs.h>
7#include <linux/mqueue.h>
8
9#include <asm/uaccess.h>
10#include <asm/pgtable.h>
11#include <asm/desc.h>
12
13static struct fs_struct init_fs = INIT_FS;
14static struct files_struct init_files = INIT_FILES;
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm);
18
19EXPORT_SYMBOL(init_mm);
20
21/*
22 * Initial task structure.
23 *
24 * We need to make sure that this is 8192-byte aligned due to the
25 * way process stacks are handled. This is done by having a special
26 * "init_task" linker map entry..
27 */
28union thread_union init_thread_union
29 __attribute__((__section__(".data.init_task"))) =
30 { INIT_THREAD_INFO(init_task) };
31
32/*
33 * Initial task structure.
34 *
35 * All other task structs will be allocated on slabs in fork.c
36 */
37struct task_struct init_task = INIT_TASK(init_task);
38
39EXPORT_SYMBOL(init_task);
40/*
41 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
42 * no more per-task TSS's. The TSS size is kept cacheline-aligned
43 * so they are allowed to end up in the .data.cacheline_aligned
44 * section. Since TSS's are completely CPU-local, we want them
45 * on exact cacheline boundaries, to eliminate cacheline ping-pong.
46 */
47DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
48
49/* Copies of the original ist values from the tss are only accessed during
50 * debugging, no special alignment required.
51 */
52DEFINE_PER_CPU(struct orig_ist, orig_ist);
53
54#define ALIGN_TO_4K __attribute__((section(".data.init_task")))
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 5f10c7189534..f35c6eb33da9 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -584,7 +584,7 @@ tryanotherirq:
584 584
585 imbalance = move_this_load; 585 imbalance = move_this_load;
586 586
587 /* For physical_balance case, we accumlated both load 587 /* For physical_balance case, we accumulated both load
588 * values in the one of the siblings cpu_irq[], 588 * values in the one of the siblings cpu_irq[],
589 * to use the same code for physical and logical processors 589 * to use the same code for physical and logical processors
590 * as much as possible. 590 * as much as possible.
@@ -1198,7 +1198,7 @@ static u8 irq_vector[NR_IRQ_VECTORS] __read_mostly = { FIRST_DEVICE_VECTOR , 0 }
1198static int __assign_irq_vector(int irq) 1198static int __assign_irq_vector(int irq)
1199{ 1199{
1200 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0; 1200 static int current_vector = FIRST_DEVICE_VECTOR, current_offset = 0;
1201 int vector, offset, i; 1201 int vector, offset;
1202 1202
1203 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS); 1203 BUG_ON((unsigned)irq >= NR_IRQ_VECTORS);
1204 1204
@@ -1215,11 +1215,8 @@ next:
1215 } 1215 }
1216 if (vector == current_vector) 1216 if (vector == current_vector)
1217 return -ENOSPC; 1217 return -ENOSPC;
1218 if (vector == SYSCALL_VECTOR) 1218 if (test_and_set_bit(vector, used_vectors))
1219 goto next; 1219 goto next;
1220 for (i = 0; i < NR_IRQ_VECTORS; i++)
1221 if (irq_vector[i] == vector)
1222 goto next;
1223 1220
1224 current_vector = vector; 1221 current_vector = vector;
1225 current_offset = offset; 1222 current_offset = offset;
@@ -2295,6 +2292,12 @@ static inline void __init check_timer(void)
2295 2292
2296void __init setup_IO_APIC(void) 2293void __init setup_IO_APIC(void)
2297{ 2294{
2295 int i;
2296
2297 /* Reserve all the system vectors. */
2298 for (i = FIRST_SYSTEM_VECTOR; i < NR_VECTORS; i++)
2299 set_bit(i, used_vectors);
2300
2298 enable_IO_APIC(); 2301 enable_IO_APIC();
2299 2302
2300 if (acpi_ioapic) 2303 if (acpi_ioapic)
@@ -2472,7 +2475,7 @@ void destroy_irq(unsigned int irq)
2472} 2475}
2473 2476
2474/* 2477/*
2475 * MSI mesage composition 2478 * MSI message composition
2476 */ 2479 */
2477#ifdef CONFIG_PCI_MSI 2480#ifdef CONFIG_PCI_MSI
2478static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) 2481static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 1c2c7bf6a9d3..b3c2d268d708 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1770,7 +1770,7 @@ __setup("no_timer_check", notimercheck);
1770 1770
1771/* 1771/*
1772 * 1772 *
1773 * IRQ's that are handled by the PIC in the MPS IOAPIC case. 1773 * IRQs that are handled by the PIC in the MPS IOAPIC case.
1774 * - IRQ2 is the cascade IRQ, and cannot be a io-apic IRQ. 1774 * - IRQ2 is the cascade IRQ, and cannot be a io-apic IRQ.
1775 * Linux doesn't really care, as it's not actually used 1775 * Linux doesn't really care, as it's not actually used
1776 * for any interrupt handling anyway. 1776 * for any interrupt handling anyway.
@@ -1921,7 +1921,7 @@ void destroy_irq(unsigned int irq)
1921} 1921}
1922 1922
1923/* 1923/*
1924 * MSI mesage composition 1924 * MSI message composition
1925 */ 1925 */
1926#ifdef CONFIG_PCI_MSI 1926#ifdef CONFIG_PCI_MSI
1927static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg) 1927static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 8459ca64bc2f..11b935f4f886 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -149,28 +149,6 @@ NORET_TYPE void machine_kexec(struct kimage *image)
149 image->start, cpu_has_pae); 149 image->start, cpu_has_pae);
150} 150}
151 151
152/* crashkernel=size@addr specifies the location to reserve for
153 * a crash kernel. By reserving this memory we guarantee
154 * that linux never sets it up as a DMA target.
155 * Useful for holding code to do something appropriate
156 * after a kernel panic.
157 */
158static int __init parse_crashkernel(char *arg)
159{
160 unsigned long size, base;
161 size = memparse(arg, &arg);
162 if (*arg == '@') {
163 base = memparse(arg+1, &arg);
164 /* FIXME: Do I want a sanity check
165 * to validate the memory range?
166 */
167 crashk_res.start = base;
168 crashk_res.end = base + size - 1;
169 }
170 return 0;
171}
172early_param("crashkernel", parse_crashkernel);
173
174void arch_crash_save_vmcoreinfo(void) 152void arch_crash_save_vmcoreinfo(void)
175{ 153{
176#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE 154#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 7450b69710b5..0d8577f05422 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -231,33 +231,6 @@ NORET_TYPE void machine_kexec(struct kimage *image)
231 image->start); 231 image->start);
232} 232}
233 233
234/* crashkernel=size@addr specifies the location to reserve for
235 * a crash kernel. By reserving this memory we guarantee
236 * that linux never set's it up as a DMA target.
237 * Useful for holding code to do something appropriate
238 * after a kernel panic.
239 */
240static int __init setup_crashkernel(char *arg)
241{
242 unsigned long size, base;
243 char *p;
244 if (!arg)
245 return -EINVAL;
246 size = memparse(arg, &p);
247 if (arg == p)
248 return -EINVAL;
249 if (*p == '@') {
250 base = memparse(p+1, &p);
251 /* FIXME: Do I want a sanity check to validate the
252 * memory range? Yes you do, but it's too early for
253 * e820 -AK */
254 crashk_res.start = base;
255 crashk_res.end = base + size - 1;
256 }
257 return 0;
258}
259early_param("crashkernel", setup_crashkernel);
260
261void arch_crash_save_vmcoreinfo(void) 234void arch_crash_save_vmcoreinfo(void)
262{ 235{
263#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE 236#ifdef CONFIG_ARCH_DISCONTIGMEM_ENABLE
diff --git a/arch/x86/kernel/mce_64.c b/arch/x86/kernel/mce_64.c
index 8ca8f8648969..07bbfe7aa7f7 100644
--- a/arch/x86/kernel/mce_64.c
+++ b/arch/x86/kernel/mce_64.c
@@ -320,7 +320,7 @@ void do_machine_check(struct pt_regs * regs, long error_code)
320#ifdef CONFIG_X86_MCE_INTEL 320#ifdef CONFIG_X86_MCE_INTEL
321/*** 321/***
322 * mce_log_therm_throt_event - Logs the thermal throttling event to mcelog 322 * mce_log_therm_throt_event - Logs the thermal throttling event to mcelog
323 * @cpu: The CPU on which the event occured. 323 * @cpu: The CPU on which the event occurred.
324 * @status: Event status information 324 * @status: Event status information
325 * 325 *
326 * This function should be called by the thermal interrupt after the 326 * This function should be called by the thermal interrupt after the
@@ -688,7 +688,7 @@ static int __init mcheck_disable(char *str)
688 return 1; 688 return 1;
689} 689}
690 690
691/* mce=off disables machine check. Note you can reenable it later 691/* mce=off disables machine check. Note you can re-enable it later
692 using sysfs. 692 using sysfs.
693 mce=TOLERANCELEVEL (number, see above) 693 mce=TOLERANCELEVEL (number, see above)
694 mce=bootlog Log MCEs from before booting. Disabled by default on AMD. 694 mce=bootlog Log MCEs from before booting. Disabled by default on AMD.
@@ -799,19 +799,33 @@ static __cpuinit int mce_create_device(unsigned int cpu)
799{ 799{
800 int err; 800 int err;
801 int i; 801 int i;
802 if (!mce_available(&cpu_data[cpu])) 802
803 if (!mce_available(&cpu_data(cpu)))
803 return -EIO; 804 return -EIO;
804 805
806 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
805 per_cpu(device_mce,cpu).id = cpu; 807 per_cpu(device_mce,cpu).id = cpu;
806 per_cpu(device_mce,cpu).cls = &mce_sysclass; 808 per_cpu(device_mce,cpu).cls = &mce_sysclass;
807 809
808 err = sysdev_register(&per_cpu(device_mce,cpu)); 810 err = sysdev_register(&per_cpu(device_mce,cpu));
811 if (err)
812 return err;
813
814 for (i = 0; mce_attributes[i]; i++) {
815 err = sysdev_create_file(&per_cpu(device_mce,cpu),
816 mce_attributes[i]);
817 if (err)
818 goto error;
819 }
809 820
810 if (!err) { 821 return 0;
811 for (i = 0; mce_attributes[i]; i++) 822error:
812 sysdev_create_file(&per_cpu(device_mce,cpu), 823 while (i--) {
813 mce_attributes[i]); 824 sysdev_remove_file(&per_cpu(device_mce,cpu),
825 mce_attributes[i]);
814 } 826 }
827 sysdev_unregister(&per_cpu(device_mce,cpu));
828
815 return err; 829 return err;
816} 830}
817 831
@@ -823,7 +837,6 @@ static void mce_remove_device(unsigned int cpu)
823 sysdev_remove_file(&per_cpu(device_mce,cpu), 837 sysdev_remove_file(&per_cpu(device_mce,cpu),
824 mce_attributes[i]); 838 mce_attributes[i]);
825 sysdev_unregister(&per_cpu(device_mce,cpu)); 839 sysdev_unregister(&per_cpu(device_mce,cpu));
826 memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject));
827} 840}
828 841
829/* Get notified when a cpu comes on/off. Be hotplug friendly. */ 842/* Get notified when a cpu comes on/off. Be hotplug friendly. */
@@ -831,18 +844,21 @@ static int
831mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) 844mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
832{ 845{
833 unsigned int cpu = (unsigned long)hcpu; 846 unsigned int cpu = (unsigned long)hcpu;
847 int err = 0;
834 848
835 switch (action) { 849 switch (action) {
836 case CPU_ONLINE: 850 case CPU_UP_PREPARE:
837 case CPU_ONLINE_FROZEN: 851 case CPU_UP_PREPARE_FROZEN:
838 mce_create_device(cpu); 852 err = mce_create_device(cpu);
839 break; 853 break;
854 case CPU_UP_CANCELED:
855 case CPU_UP_CANCELED_FROZEN:
840 case CPU_DEAD: 856 case CPU_DEAD:
841 case CPU_DEAD_FROZEN: 857 case CPU_DEAD_FROZEN:
842 mce_remove_device(cpu); 858 mce_remove_device(cpu);
843 break; 859 break;
844 } 860 }
845 return NOTIFY_OK; 861 return err ? NOTIFY_BAD : NOTIFY_OK;
846} 862}
847 863
848static struct notifier_block mce_cpu_notifier = { 864static struct notifier_block mce_cpu_notifier = {
@@ -857,9 +873,13 @@ static __init int mce_init_device(void)
857 if (!mce_available(&boot_cpu_data)) 873 if (!mce_available(&boot_cpu_data))
858 return -EIO; 874 return -EIO;
859 err = sysdev_class_register(&mce_sysclass); 875 err = sysdev_class_register(&mce_sysclass);
876 if (err)
877 return err;
860 878
861 for_each_online_cpu(i) { 879 for_each_online_cpu(i) {
862 mce_create_device(i); 880 err = mce_create_device(i);
881 if (err)
882 return err;
863 } 883 }
864 884
865 register_hotcpu_notifier(&mce_cpu_notifier); 885 register_hotcpu_notifier(&mce_cpu_notifier);
diff --git a/arch/x86/kernel/mce_amd_64.c b/arch/x86/kernel/mce_amd_64.c
index 0d2afd96aca4..752fb16a817d 100644
--- a/arch/x86/kernel/mce_amd_64.c
+++ b/arch/x86/kernel/mce_amd_64.c
@@ -472,11 +472,11 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
472 sprintf(name, "threshold_bank%i", bank); 472 sprintf(name, "threshold_bank%i", bank);
473 473
474#ifdef CONFIG_SMP 474#ifdef CONFIG_SMP
475 if (cpu_data[cpu].cpu_core_id && shared_bank[bank]) { /* symlink */ 475 if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */
476 i = first_cpu(per_cpu(cpu_core_map, cpu)); 476 i = first_cpu(per_cpu(cpu_core_map, cpu));
477 477
478 /* first core not up yet */ 478 /* first core not up yet */
479 if (cpu_data[i].cpu_core_id) 479 if (cpu_data(i).cpu_core_id)
480 goto out; 480 goto out;
481 481
482 /* already linked */ 482 /* already linked */
diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
index 09cf78110358..09c315214a5e 100644
--- a/arch/x86/kernel/microcode.c
+++ b/arch/x86/kernel/microcode.c
@@ -132,7 +132,7 @@ static struct ucode_cpu_info {
132 132
133static void collect_cpu_info(int cpu_num) 133static void collect_cpu_info(int cpu_num)
134{ 134{
135 struct cpuinfo_x86 *c = cpu_data + cpu_num; 135 struct cpuinfo_x86 *c = &cpu_data(cpu_num);
136 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 136 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
137 unsigned int val[2]; 137 unsigned int val[2];
138 138
@@ -522,7 +522,7 @@ static struct platform_device *microcode_pdev;
522static int cpu_request_microcode(int cpu) 522static int cpu_request_microcode(int cpu)
523{ 523{
524 char name[30]; 524 char name[30];
525 struct cpuinfo_x86 *c = cpu_data + cpu; 525 struct cpuinfo_x86 *c = &cpu_data(cpu);
526 const struct firmware *firmware; 526 const struct firmware *firmware;
527 void *buf; 527 void *buf;
528 unsigned long size; 528 unsigned long size;
@@ -570,7 +570,7 @@ static int cpu_request_microcode(int cpu)
570 570
571static int apply_microcode_check_cpu(int cpu) 571static int apply_microcode_check_cpu(int cpu)
572{ 572{
573 struct cpuinfo_x86 *c = cpu_data + cpu; 573 struct cpuinfo_x86 *c = &cpu_data(cpu);
574 struct ucode_cpu_info *uci = ucode_cpu_info + cpu; 574 struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
575 cpumask_t old; 575 cpumask_t old;
576 unsigned int val[2]; 576 unsigned int val[2];
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c
index 13abb4ebfb79..7a05a7f6099a 100644
--- a/arch/x86/kernel/mpparse_32.c
+++ b/arch/x86/kernel/mpparse_32.c
@@ -1001,7 +1001,7 @@ void __init mp_config_acpi_legacy_irqs (void)
1001 1001
1002 /* 1002 /*
1003 * Use the default configuration for the IRQs 0-15. Unless 1003 * Use the default configuration for the IRQs 0-15. Unless
1004 * overriden by (MADT) interrupt source override entries. 1004 * overridden by (MADT) interrupt source override entries.
1005 */ 1005 */
1006 for (i = 0; i < 16; i++) { 1006 for (i = 0; i < 16; i++) {
1007 int idx; 1007 int idx;
diff --git a/arch/x86/kernel/mpparse_64.c b/arch/x86/kernel/mpparse_64.c
index 8bf0ca03ac8e..ef4aab123581 100644
--- a/arch/x86/kernel/mpparse_64.c
+++ b/arch/x86/kernel/mpparse_64.c
@@ -57,6 +57,8 @@ unsigned long mp_lapic_addr = 0;
57 57
58/* Processor that is doing the boot up */ 58/* Processor that is doing the boot up */
59unsigned int boot_cpu_id = -1U; 59unsigned int boot_cpu_id = -1U;
60EXPORT_SYMBOL(boot_cpu_id);
61
60/* Internal processor count */ 62/* Internal processor count */
61unsigned int num_processors __cpuinitdata = 0; 63unsigned int num_processors __cpuinitdata = 0;
62 64
@@ -86,7 +88,7 @@ static int __init mpf_checksum(unsigned char *mp, int len)
86 return sum & 0xFF; 88 return sum & 0xFF;
87} 89}
88 90
89static void __cpuinit MP_processor_info (struct mpc_config_processor *m) 91static void __cpuinit MP_processor_info(struct mpc_config_processor *m)
90{ 92{
91 int cpu; 93 int cpu;
92 cpumask_t tmp_map; 94 cpumask_t tmp_map;
@@ -123,7 +125,18 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m)
123 cpu = 0; 125 cpu = 0;
124 } 126 }
125 bios_cpu_apicid[cpu] = m->mpc_apicid; 127 bios_cpu_apicid[cpu] = m->mpc_apicid;
126 x86_cpu_to_apicid[cpu] = m->mpc_apicid; 128 /*
129 * We get called early in the the start_kernel initialization
130 * process when the per_cpu data area is not yet setup, so we
131 * use a static array that is removed after the per_cpu data
132 * area is created.
133 */
134 if (x86_cpu_to_apicid_ptr) {
135 u8 *x86_cpu_to_apicid = (u8 *)x86_cpu_to_apicid_ptr;
136 x86_cpu_to_apicid[cpu] = m->mpc_apicid;
137 } else {
138 per_cpu(x86_cpu_to_apicid, cpu) = m->mpc_apicid;
139 }
127 140
128 cpu_set(cpu, cpu_possible_map); 141 cpu_set(cpu, cpu_possible_map);
129 cpu_set(cpu, cpu_present_map); 142 cpu_set(cpu, cpu_present_map);
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index df85c9c13601..ee6eba4ecfea 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -112,7 +112,7 @@ static ssize_t msr_write(struct file *file, const char __user *buf,
112static int msr_open(struct inode *inode, struct file *file) 112static int msr_open(struct inode *inode, struct file *file)
113{ 113{
114 unsigned int cpu = iminor(file->f_path.dentry->d_inode); 114 unsigned int cpu = iminor(file->f_path.dentry->d_inode);
115 struct cpuinfo_x86 *c = &(cpu_data)[cpu]; 115 struct cpuinfo_x86 *c = &cpu_data(cpu);
116 116
117 if (cpu >= NR_CPUS || !cpu_online(cpu)) 117 if (cpu >= NR_CPUS || !cpu_online(cpu))
118 return -ENXIO; /* No such CPU */ 118 return -ENXIO; /* No such CPU */
@@ -133,37 +133,42 @@ static const struct file_operations msr_fops = {
133 .open = msr_open, 133 .open = msr_open,
134}; 134};
135 135
136static int __cpuinit msr_device_create(int i) 136static int __cpuinit msr_device_create(int cpu)
137{ 137{
138 int err = 0;
139 struct device *dev; 138 struct device *dev;
140 139
141 dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, i), "msr%d",i); 140 dev = device_create(msr_class, NULL, MKDEV(MSR_MAJOR, cpu),
142 if (IS_ERR(dev)) 141 "msr%d", cpu);
143 err = PTR_ERR(dev); 142 return IS_ERR(dev) ? PTR_ERR(dev) : 0;
144 return err; 143}
144
145static void msr_device_destroy(int cpu)
146{
147 device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu));
145} 148}
146 149
147static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb, 150static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb,
148 unsigned long action, void *hcpu) 151 unsigned long action, void *hcpu)
149{ 152{
150 unsigned int cpu = (unsigned long)hcpu; 153 unsigned int cpu = (unsigned long)hcpu;
154 int err = 0;
151 155
152 switch (action) { 156 switch (action) {
153 case CPU_ONLINE: 157 case CPU_UP_PREPARE:
154 case CPU_ONLINE_FROZEN: 158 case CPU_UP_PREPARE_FROZEN:
155 msr_device_create(cpu); 159 err = msr_device_create(cpu);
156 break; 160 break;
161 case CPU_UP_CANCELED:
162 case CPU_UP_CANCELED_FROZEN:
157 case CPU_DEAD: 163 case CPU_DEAD:
158 case CPU_DEAD_FROZEN: 164 case CPU_DEAD_FROZEN:
159 device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); 165 msr_device_destroy(cpu);
160 break; 166 break;
161 } 167 }
162 return NOTIFY_OK; 168 return err ? NOTIFY_BAD : NOTIFY_OK;
163} 169}
164 170
165static struct notifier_block __cpuinitdata msr_class_cpu_notifier = 171static struct notifier_block __cpuinitdata msr_class_cpu_notifier = {
166{
167 .notifier_call = msr_class_cpu_callback, 172 .notifier_call = msr_class_cpu_callback,
168}; 173};
169 174
@@ -196,7 +201,7 @@ static int __init msr_init(void)
196out_class: 201out_class:
197 i = 0; 202 i = 0;
198 for_each_online_cpu(i) 203 for_each_online_cpu(i)
199 device_destroy(msr_class, MKDEV(MSR_MAJOR, i)); 204 msr_device_destroy(i);
200 class_destroy(msr_class); 205 class_destroy(msr_class);
201out_chrdev: 206out_chrdev:
202 unregister_chrdev(MSR_MAJOR, "cpu/msr"); 207 unregister_chrdev(MSR_MAJOR, "cpu/msr");
@@ -208,7 +213,7 @@ static void __exit msr_exit(void)
208{ 213{
209 int cpu = 0; 214 int cpu = 0;
210 for_each_online_cpu(cpu) 215 for_each_online_cpu(cpu)
211 device_destroy(msr_class, MKDEV(MSR_MAJOR, cpu)); 216 msr_device_destroy(cpu);
212 class_destroy(msr_class); 217 class_destroy(msr_class);
213 unregister_chrdev(MSR_MAJOR, "cpu/msr"); 218 unregister_chrdev(MSR_MAJOR, "cpu/msr");
214 unregister_hotcpu_notifier(&msr_class_cpu_notifier); 219 unregister_hotcpu_notifier(&msr_class_cpu_notifier);
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c
index b2b42bdb0a15..afaf9f12c032 100644
--- a/arch/x86/kernel/pci-dma_64.c
+++ b/arch/x86/kernel/pci-dma_64.c
@@ -11,7 +11,7 @@
11#include <asm/iommu.h> 11#include <asm/iommu.h>
12#include <asm/calgary.h> 12#include <asm/calgary.h>
13 13
14int iommu_merge __read_mostly = 0; 14int iommu_merge __read_mostly = 1;
15EXPORT_SYMBOL(iommu_merge); 15EXPORT_SYMBOL(iommu_merge);
16 16
17dma_addr_t bad_dma_address __read_mostly; 17dma_addr_t bad_dma_address __read_mostly;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 097aeafce5ff..7b899584d290 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -295,34 +295,52 @@ static int __init idle_setup(char *str)
295} 295}
296early_param("idle", idle_setup); 296early_param("idle", idle_setup);
297 297
298void show_regs(struct pt_regs * regs) 298void __show_registers(struct pt_regs *regs, int all)
299{ 299{
300 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; 300 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L;
301 unsigned long d0, d1, d2, d3, d6, d7; 301 unsigned long d0, d1, d2, d3, d6, d7;
302 unsigned long esp;
303 unsigned short ss, gs;
304
305 if (user_mode_vm(regs)) {
306 esp = regs->esp;
307 ss = regs->xss & 0xffff;
308 savesegment(gs, gs);
309 } else {
310 esp = (unsigned long) (&regs->esp);
311 savesegment(ss, ss);
312 savesegment(gs, gs);
313 }
302 314
303 printk("\n"); 315 printk("\n");
304 printk("Pid: %d, comm: %20s\n", current->pid, current->comm); 316 printk("Pid: %d, comm: %s %s (%s %.*s)\n",
305 printk("EIP: %04x:[<%08lx>] CPU: %d\n",0xffff & regs->xcs,regs->eip, smp_processor_id()); 317 task_pid_nr(current), current->comm,
318 print_tainted(), init_utsname()->release,
319 (int)strcspn(init_utsname()->version, " "),
320 init_utsname()->version);
321
322 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
323 0xffff & regs->xcs, regs->eip, regs->eflags,
324 smp_processor_id());
306 print_symbol("EIP is at %s\n", regs->eip); 325 print_symbol("EIP is at %s\n", regs->eip);
307 326
308 if (user_mode_vm(regs))
309 printk(" ESP: %04x:%08lx",0xffff & regs->xss,regs->esp);
310 printk(" EFLAGS: %08lx %s (%s %.*s)\n",
311 regs->eflags, print_tainted(), init_utsname()->release,
312 (int)strcspn(init_utsname()->version, " "),
313 init_utsname()->version);
314 printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n", 327 printk("EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
315 regs->eax,regs->ebx,regs->ecx,regs->edx); 328 regs->eax, regs->ebx, regs->ecx, regs->edx);
316 printk("ESI: %08lx EDI: %08lx EBP: %08lx", 329 printk("ESI: %08lx EDI: %08lx EBP: %08lx ESP: %08lx\n",
317 regs->esi, regs->edi, regs->ebp); 330 regs->esi, regs->edi, regs->ebp, esp);
318 printk(" DS: %04x ES: %04x FS: %04x\n", 331 printk(" DS: %04x ES: %04x FS: %04x GS: %04x SS: %04x\n",
319 0xffff & regs->xds,0xffff & regs->xes, 0xffff & regs->xfs); 332 regs->xds & 0xffff, regs->xes & 0xffff,
333 regs->xfs & 0xffff, gs, ss);
334
335 if (!all)
336 return;
320 337
321 cr0 = read_cr0(); 338 cr0 = read_cr0();
322 cr2 = read_cr2(); 339 cr2 = read_cr2();
323 cr3 = read_cr3(); 340 cr3 = read_cr3();
324 cr4 = read_cr4_safe(); 341 cr4 = read_cr4_safe();
325 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); 342 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n",
343 cr0, cr2, cr3, cr4);
326 344
327 get_debugreg(d0, 0); 345 get_debugreg(d0, 0);
328 get_debugreg(d1, 1); 346 get_debugreg(d1, 1);
@@ -330,10 +348,16 @@ void show_regs(struct pt_regs * regs)
330 get_debugreg(d3, 3); 348 get_debugreg(d3, 3);
331 printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n", 349 printk("DR0: %08lx DR1: %08lx DR2: %08lx DR3: %08lx\n",
332 d0, d1, d2, d3); 350 d0, d1, d2, d3);
351
333 get_debugreg(d6, 6); 352 get_debugreg(d6, 6);
334 get_debugreg(d7, 7); 353 get_debugreg(d7, 7);
335 printk("DR6: %08lx DR7: %08lx\n", d6, d7); 354 printk("DR6: %08lx DR7: %08lx\n",
355 d6, d7);
356}
336 357
358void show_regs(struct pt_regs *regs)
359{
360 __show_registers(regs, 1);
337 show_trace(NULL, regs, &regs->esp); 361 show_trace(NULL, regs, &regs->esp);
338} 362}
339 363
diff --git a/arch/x86/kernel/ptrace_32.c b/arch/x86/kernel/ptrace_32.c
index 99102ec5fade..ff5431cc03ee 100644
--- a/arch/x86/kernel/ptrace_32.c
+++ b/arch/x86/kernel/ptrace_32.c
@@ -632,7 +632,7 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
632 /* User-mode eip? */ 632 /* User-mode eip? */
633 info.si_addr = user_mode_vm(regs) ? (void __user *) regs->eip : NULL; 633 info.si_addr = user_mode_vm(regs) ? (void __user *) regs->eip : NULL;
634 634
635 /* Send us the fakey SIGTRAP */ 635 /* Send us the fake SIGTRAP */
636 force_sig_info(SIGTRAP, &info, tsk); 636 force_sig_info(SIGTRAP, &info, tsk);
637} 637}
638 638
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index d769e204f942..a4ce1911efdf 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -45,9 +45,12 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev)
45 if (!(config & 0x2)) 45 if (!(config & 0x2))
46 pci_write_config_byte(dev, 0xf4, config); 46 pci_write_config_byte(dev, 0xf4, config);
47} 47}
48DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); 48DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH,
49DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH, quirk_intel_irqbalance); 49 quirk_intel_irqbalance);
50DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH, quirk_intel_irqbalance); 50DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7525_MCH,
51 quirk_intel_irqbalance);
52DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7520_MCH,
53 quirk_intel_irqbalance);
51#endif 54#endif
52 55
53#if defined(CONFIG_HPET_TIMER) 56#if defined(CONFIG_HPET_TIMER)
@@ -56,7 +59,8 @@ unsigned long force_hpet_address;
56static enum { 59static enum {
57 NONE_FORCE_HPET_RESUME, 60 NONE_FORCE_HPET_RESUME,
58 OLD_ICH_FORCE_HPET_RESUME, 61 OLD_ICH_FORCE_HPET_RESUME,
59 ICH_FORCE_HPET_RESUME 62 ICH_FORCE_HPET_RESUME,
63 VT8237_FORCE_HPET_RESUME
60} force_hpet_resume_type; 64} force_hpet_resume_type;
61 65
62static void __iomem *rcba_base; 66static void __iomem *rcba_base;
@@ -146,17 +150,17 @@ static void ich_force_enable_hpet(struct pci_dev *dev)
146} 150}
147 151
148DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0, 152DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0,
149 ich_force_enable_hpet); 153 ich_force_enable_hpet);
150DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, 154DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1,
151 ich_force_enable_hpet); 155 ich_force_enable_hpet);
152DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, 156DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0,
153 ich_force_enable_hpet); 157 ich_force_enable_hpet);
154DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, 158DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1,
155 ich_force_enable_hpet); 159 ich_force_enable_hpet);
156DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, 160DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31,
157 ich_force_enable_hpet); 161 ich_force_enable_hpet);
158DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1, 162DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_1,
159 ich_force_enable_hpet); 163 ich_force_enable_hpet);
160 164
161 165
162static struct pci_dev *cached_dev; 166static struct pci_dev *cached_dev;
@@ -232,10 +236,91 @@ static void old_ich_force_enable_hpet(struct pci_dev *dev)
232 printk(KERN_DEBUG "Failed to force enable HPET\n"); 236 printk(KERN_DEBUG "Failed to force enable HPET\n");
233} 237}
234 238
239/*
240 * Undocumented chipset features. Make sure that the user enforced
241 * this.
242 */
243static void old_ich_force_enable_hpet_user(struct pci_dev *dev)
244{
245 if (hpet_force_user)
246 old_ich_force_enable_hpet(dev);
247}
248
249DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0,
250 old_ich_force_enable_hpet_user);
251DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12,
252 old_ich_force_enable_hpet_user);
253DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0,
254 old_ich_force_enable_hpet_user);
255DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12,
256 old_ich_force_enable_hpet_user);
235DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, 257DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0,
236 old_ich_force_enable_hpet); 258 old_ich_force_enable_hpet);
237DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12, 259DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_12,
238 old_ich_force_enable_hpet); 260 old_ich_force_enable_hpet);
261
262
263static void vt8237_force_hpet_resume(void)
264{
265 u32 val;
266
267 if (!force_hpet_address || !cached_dev)
268 return;
269
270 val = 0xfed00000 | 0x80;
271 pci_write_config_dword(cached_dev, 0x68, val);
272
273 pci_read_config_dword(cached_dev, 0x68, &val);
274 if (val & 0x80)
275 printk(KERN_DEBUG "Force enabled HPET at resume\n");
276 else
277 BUG();
278}
279
280static void vt8237_force_enable_hpet(struct pci_dev *dev)
281{
282 u32 uninitialized_var(val);
283
284 if (!hpet_force_user || hpet_address || force_hpet_address)
285 return;
286
287 pci_read_config_dword(dev, 0x68, &val);
288 /*
289 * Bit 7 is HPET enable bit.
290 * Bit 31:10 is HPET base address (contrary to what datasheet claims)
291 */
292 if (val & 0x80) {
293 force_hpet_address = (val & ~0x3ff);
294 printk(KERN_DEBUG "HPET at base address 0x%lx\n",
295 force_hpet_address);
296 return;
297 }
298
299 /*
300 * HPET is disabled. Trying enabling at FED00000 and check
301 * whether it sticks
302 */
303 val = 0xfed00000 | 0x80;
304 pci_write_config_dword(dev, 0x68, val);
305
306 pci_read_config_dword(dev, 0x68, &val);
307 if (val & 0x80) {
308 force_hpet_address = (val & ~0x3ff);
309 printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
310 force_hpet_address);
311 cached_dev = dev;
312 force_hpet_resume_type = VT8237_FORCE_HPET_RESUME;
313 return;
314 }
315
316 printk(KERN_DEBUG "Failed to force enable HPET\n");
317}
318
319DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235,
320 vt8237_force_enable_hpet);
321DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
322 vt8237_force_enable_hpet);
323
239 324
240void force_hpet_resume(void) 325void force_hpet_resume(void)
241{ 326{
@@ -246,6 +331,9 @@ void force_hpet_resume(void)
246 case OLD_ICH_FORCE_HPET_RESUME: 331 case OLD_ICH_FORCE_HPET_RESUME:
247 return old_ich_force_hpet_resume(); 332 return old_ich_force_hpet_resume();
248 333
334 case VT8237_FORCE_HPET_RESUME:
335 return vt8237_force_hpet_resume();
336
249 default: 337 default:
250 break; 338 break;
251 } 339 }
diff --git a/arch/x86/kernel/reboot_64.c b/arch/x86/kernel/reboot_64.c
index 368db2b9c5ac..776eb06b6512 100644
--- a/arch/x86/kernel/reboot_64.c
+++ b/arch/x86/kernel/reboot_64.c
@@ -11,6 +11,7 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <asm/io.h> 12#include <asm/io.h>
13#include <asm/delay.h> 13#include <asm/delay.h>
14#include <asm/desc.h>
14#include <asm/hw_irq.h> 15#include <asm/hw_irq.h>
15#include <asm/system.h> 16#include <asm/system.h>
16#include <asm/pgtable.h> 17#include <asm/pgtable.h>
@@ -136,7 +137,7 @@ void machine_emergency_restart(void)
136 } 137 }
137 138
138 case BOOT_TRIPLE: 139 case BOOT_TRIPLE:
139 __asm__ __volatile__("lidt (%0)": :"r" (&no_idt)); 140 load_idt((const struct desc_ptr *)&no_idt);
140 __asm__ __volatile__("int3"); 141 __asm__ __volatile__("int3");
141 142
142 reboot_type = BOOT_KBD; 143 reboot_type = BOOT_KBD;
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
index 8b30b26ad069..1a07bbea7be3 100644
--- a/arch/x86/kernel/reboot_fixups_32.c
+++ b/arch/x86/kernel/reboot_fixups_32.c
@@ -12,6 +12,7 @@
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <asm/reboot_fixups.h> 13#include <asm/reboot_fixups.h>
14#include <asm/msr.h> 14#include <asm/msr.h>
15#include <asm/geode.h>
15 16
16static void cs5530a_warm_reset(struct pci_dev *dev) 17static void cs5530a_warm_reset(struct pci_dev *dev)
17{ 18{
@@ -24,11 +25,8 @@ static void cs5530a_warm_reset(struct pci_dev *dev)
24 25
25static void cs5536_warm_reset(struct pci_dev *dev) 26static void cs5536_warm_reset(struct pci_dev *dev)
26{ 27{
27 /* 28 /* writing 1 to the LSB of this MSR causes a hard reset */
28 * 6.6.2.12 Soft Reset (DIVIL_SOFT_RESET) 29 wrmsrl(MSR_DIVIL_SOFT_RESET, 1ULL);
29 * writing 1 to the LSB of this MSR causes a hard reset.
30 */
31 wrmsrl(0x51400017, 1ULL);
32 udelay(50); /* shouldn't get here but be safe and spin a while */ 30 udelay(50); /* shouldn't get here but be safe and spin a while */
33} 31}
34 32
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
index ba9188235057..3558ac78c926 100644
--- a/arch/x86/kernel/setup64.c
+++ b/arch/x86/kernel/setup64.c
@@ -185,6 +185,12 @@ void __cpuinit check_efer(void)
185unsigned long kernel_eflags; 185unsigned long kernel_eflags;
186 186
187/* 187/*
188 * Copies of the original ist values from the tss are only accessed during
189 * debugging, no special alignment required.
190 */
191DEFINE_PER_CPU(struct orig_ist, orig_ist);
192
193/*
188 * cpu_init() initializes state that is per-CPU. Some data is already 194 * cpu_init() initializes state that is per-CPU. Some data is already
189 * initialized (naturally) in the bootstrap process, such as the GDT 195 * initialized (naturally) in the bootstrap process, such as the GDT
190 * and IDT. We reload them nevertheless, this function acts as a 196 * and IDT. We reload them nevertheless, this function acts as a
@@ -224,8 +230,8 @@ void __cpuinit cpu_init (void)
224 memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE); 230 memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE);
225 231
226 cpu_gdt_descr[cpu].size = GDT_SIZE; 232 cpu_gdt_descr[cpu].size = GDT_SIZE;
227 asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu])); 233 load_gdt((const struct desc_ptr *)&cpu_gdt_descr[cpu]);
228 asm volatile("lidt %0" :: "m" (idt_descr)); 234 load_idt((const struct desc_ptr *)&idt_descr);
229 235
230 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8); 236 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
231 syscall_init(); 237 syscall_init();
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index b87a6fd5ba48..ba2e165a8a0f 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -378,6 +378,49 @@ extern unsigned long __init setup_memory(void);
378extern void zone_sizes_init(void); 378extern void zone_sizes_init(void);
379#endif /* !CONFIG_NEED_MULTIPLE_NODES */ 379#endif /* !CONFIG_NEED_MULTIPLE_NODES */
380 380
381static inline unsigned long long get_total_mem(void)
382{
383 unsigned long long total;
384
385 total = max_low_pfn - min_low_pfn;
386#ifdef CONFIG_HIGHMEM
387 total += highend_pfn - highstart_pfn;
388#endif
389
390 return total << PAGE_SHIFT;
391}
392
393#ifdef CONFIG_KEXEC
394static void __init reserve_crashkernel(void)
395{
396 unsigned long long total_mem;
397 unsigned long long crash_size, crash_base;
398 int ret;
399
400 total_mem = get_total_mem();
401
402 ret = parse_crashkernel(boot_command_line, total_mem,
403 &crash_size, &crash_base);
404 if (ret == 0 && crash_size > 0) {
405 if (crash_base > 0) {
406 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
407 "for crashkernel (System RAM: %ldMB)\n",
408 (unsigned long)(crash_size >> 20),
409 (unsigned long)(crash_base >> 20),
410 (unsigned long)(total_mem >> 20));
411 crashk_res.start = crash_base;
412 crashk_res.end = crash_base + crash_size - 1;
413 reserve_bootmem(crash_base, crash_size);
414 } else
415 printk(KERN_INFO "crashkernel reservation failed - "
416 "you have to specify a base address\n");
417 }
418}
419#else
420static inline void __init reserve_crashkernel(void)
421{}
422#endif
423
381void __init setup_bootmem_allocator(void) 424void __init setup_bootmem_allocator(void)
382{ 425{
383 unsigned long bootmap_size; 426 unsigned long bootmap_size;
@@ -453,11 +496,7 @@ void __init setup_bootmem_allocator(void)
453 } 496 }
454 } 497 }
455#endif 498#endif
456#ifdef CONFIG_KEXEC 499 reserve_crashkernel();
457 if (crashk_res.start != crashk_res.end)
458 reserve_bootmem(crashk_res.start,
459 crashk_res.end - crashk_res.start + 1);
460#endif
461} 500}
462 501
463/* 502/*
@@ -585,7 +624,7 @@ void __init setup_arch(char **cmdline_p)
585 /* 624 /*
586 * NOTE: before this point _nobody_ is allowed to allocate 625 * NOTE: before this point _nobody_ is allowed to allocate
587 * any memory using the bootmem allocator. Although the 626 * any memory using the bootmem allocator. Although the
588 * alloctor is now initialised only the first 8Mb of the kernel 627 * allocator is now initialised only the first 8Mb of the kernel
589 * virtual address space has been mapped. All allocations before 628 * virtual address space has been mapped. All allocations before
590 * paging_init() has completed must use the alloc_bootmem_low_pages() 629 * paging_init() has completed must use the alloc_bootmem_low_pages()
591 * variant (which allocates DMA'able memory) and care must be taken 630 * variant (which allocates DMA'able memory) and care must be taken
@@ -622,9 +661,7 @@ void __init setup_arch(char **cmdline_p)
622#endif 661#endif
623 662
624#ifdef CONFIG_PCI 663#ifdef CONFIG_PCI
625#ifdef CONFIG_X86_IO_APIC 664 early_quirks();
626 check_acpi_pci(); /* Checks more than just ACPI actually */
627#endif
628#endif 665#endif
629 666
630#ifdef CONFIG_ACPI 667#ifdef CONFIG_ACPI
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 5a19f0cc5b67..31322d42eaae 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -191,6 +191,37 @@ static inline void copy_edd(void)
191} 191}
192#endif 192#endif
193 193
194#ifdef CONFIG_KEXEC
195static void __init reserve_crashkernel(void)
196{
197 unsigned long long free_mem;
198 unsigned long long crash_size, crash_base;
199 int ret;
200
201 free_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT;
202
203 ret = parse_crashkernel(boot_command_line, free_mem,
204 &crash_size, &crash_base);
205 if (ret == 0 && crash_size) {
206 if (crash_base > 0) {
207 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
208 "for crashkernel (System RAM: %ldMB)\n",
209 (unsigned long)(crash_size >> 20),
210 (unsigned long)(crash_base >> 20),
211 (unsigned long)(free_mem >> 20));
212 crashk_res.start = crash_base;
213 crashk_res.end = crash_base + crash_size - 1;
214 reserve_bootmem(crash_base, crash_size);
215 } else
216 printk(KERN_INFO "crashkernel reservation failed - "
217 "you have to specify a base address\n");
218 }
219}
220#else
221static inline void __init reserve_crashkernel(void)
222{}
223#endif
224
194#define EBDA_ADDR_POINTER 0x40E 225#define EBDA_ADDR_POINTER 0x40E
195 226
196unsigned __initdata ebda_addr; 227unsigned __initdata ebda_addr;
@@ -271,6 +302,11 @@ void __init setup_arch(char **cmdline_p)
271 302
272 dmi_scan_machine(); 303 dmi_scan_machine();
273 304
305#ifdef CONFIG_SMP
306 /* setup to use the static apicid table during kernel startup */
307 x86_cpu_to_apicid_ptr = (void *)&x86_cpu_to_apicid_init;
308#endif
309
274#ifdef CONFIG_ACPI 310#ifdef CONFIG_ACPI
275 /* 311 /*
276 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT). 312 * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
@@ -357,13 +393,7 @@ void __init setup_arch(char **cmdline_p)
357 } 393 }
358 } 394 }
359#endif 395#endif
360#ifdef CONFIG_KEXEC 396 reserve_crashkernel();
361 if (crashk_res.start != crashk_res.end) {
362 reserve_bootmem_generic(crashk_res.start,
363 crashk_res.end - crashk_res.start + 1);
364 }
365#endif
366
367 paging_init(); 397 paging_init();
368 398
369#ifdef CONFIG_PCI 399#ifdef CONFIG_PCI
@@ -529,7 +559,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
529 but in the same order as the HT nodeids. 559 but in the same order as the HT nodeids.
530 If that doesn't result in a usable node fall back to the 560 If that doesn't result in a usable node fall back to the
531 path for the previous case. */ 561 path for the previous case. */
532 int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits); 562 int ht_nodeid = apicid - (cpu_data(0).phys_proc_id << bits);
533 if (ht_nodeid >= 0 && 563 if (ht_nodeid >= 0 &&
534 apicid_to_node[ht_nodeid] != NUMA_NO_NODE) 564 apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
535 node = apicid_to_node[ht_nodeid]; 565 node = apicid_to_node[ht_nodeid];
@@ -853,6 +883,7 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
853 883
854#ifdef CONFIG_SMP 884#ifdef CONFIG_SMP
855 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; 885 c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
886 c->cpu_index = 0;
856#endif 887#endif
857} 888}
858 889
@@ -959,6 +990,7 @@ void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
959static int show_cpuinfo(struct seq_file *m, void *v) 990static int show_cpuinfo(struct seq_file *m, void *v)
960{ 991{
961 struct cpuinfo_x86 *c = v; 992 struct cpuinfo_x86 *c = v;
993 int cpu = 0;
962 994
963 /* 995 /*
964 * These flag bits must match the definitions in <asm/cpufeature.h>. 996 * These flag bits must match the definitions in <asm/cpufeature.h>.
@@ -1037,8 +1069,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1037 1069
1038 1070
1039#ifdef CONFIG_SMP 1071#ifdef CONFIG_SMP
1040 if (!cpu_online(c-cpu_data)) 1072 if (!cpu_online(c->cpu_index))
1041 return 0; 1073 return 0;
1074 cpu = c->cpu_index;
1042#endif 1075#endif
1043 1076
1044 seq_printf(m,"processor\t: %u\n" 1077 seq_printf(m,"processor\t: %u\n"
@@ -1046,7 +1079,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1046 "cpu family\t: %d\n" 1079 "cpu family\t: %d\n"
1047 "model\t\t: %d\n" 1080 "model\t\t: %d\n"
1048 "model name\t: %s\n", 1081 "model name\t: %s\n",
1049 (unsigned)(c-cpu_data), 1082 (unsigned)cpu,
1050 c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", 1083 c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
1051 c->x86, 1084 c->x86,
1052 (int)c->x86_model, 1085 (int)c->x86_model,
@@ -1058,7 +1091,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1058 seq_printf(m, "stepping\t: unknown\n"); 1091 seq_printf(m, "stepping\t: unknown\n");
1059 1092
1060 if (cpu_has(c,X86_FEATURE_TSC)) { 1093 if (cpu_has(c,X86_FEATURE_TSC)) {
1061 unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); 1094 unsigned int freq = cpufreq_quick_get((unsigned)cpu);
1062 if (!freq) 1095 if (!freq)
1063 freq = cpu_khz; 1096 freq = cpu_khz;
1064 seq_printf(m, "cpu MHz\t\t: %u.%03u\n", 1097 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
@@ -1071,7 +1104,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1071 1104
1072#ifdef CONFIG_SMP 1105#ifdef CONFIG_SMP
1073 if (smp_num_siblings * c->x86_max_cores > 1) { 1106 if (smp_num_siblings * c->x86_max_cores > 1) {
1074 int cpu = c - cpu_data;
1075 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); 1107 seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
1076 seq_printf(m, "siblings\t: %d\n", 1108 seq_printf(m, "siblings\t: %d\n",
1077 cpus_weight(per_cpu(cpu_core_map, cpu))); 1109 cpus_weight(per_cpu(cpu_core_map, cpu)));
@@ -1129,12 +1161,16 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1129 1161
1130static void *c_start(struct seq_file *m, loff_t *pos) 1162static void *c_start(struct seq_file *m, loff_t *pos)
1131{ 1163{
1132 return *pos < NR_CPUS ? cpu_data + *pos : NULL; 1164 if (*pos == 0) /* just in case, cpu 0 is not the first */
1165 *pos = first_cpu(cpu_possible_map);
1166 if ((*pos) < NR_CPUS && cpu_possible(*pos))
1167 return &cpu_data(*pos);
1168 return NULL;
1133} 1169}
1134 1170
1135static void *c_next(struct seq_file *m, void *v, loff_t *pos) 1171static void *c_next(struct seq_file *m, void *v, loff_t *pos)
1136{ 1172{
1137 ++*pos; 1173 *pos = next_cpu(*pos, cpu_possible_map);
1138 return c_start(m, pos); 1174 return c_start(m, pos);
1139} 1175}
1140 1176
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index 0d79df3c5631..9bdd83022f5f 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -200,8 +200,8 @@ badframe:
200 if (show_unhandled_signals && printk_ratelimit()) 200 if (show_unhandled_signals && printk_ratelimit())
201 printk("%s%s[%d] bad frame in sigreturn frame:%p eip:%lx" 201 printk("%s%s[%d] bad frame in sigreturn frame:%p eip:%lx"
202 " esp:%lx oeax:%lx\n", 202 " esp:%lx oeax:%lx\n",
203 current->pid > 1 ? KERN_INFO : KERN_EMERG, 203 task_pid_nr(current) > 1 ? KERN_INFO : KERN_EMERG,
204 current->comm, current->pid, frame, regs->eip, 204 current->comm, task_pid_nr(current), frame, regs->eip,
205 regs->esp, regs->orig_eax); 205 regs->esp, regs->orig_eax);
206 206
207 force_sig(SIGSEGV, current); 207 force_sig(SIGSEGV, current);
@@ -594,7 +594,7 @@ static void fastcall do_signal(struct pt_regs *regs)
594 594
595 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 595 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
596 if (signr > 0) { 596 if (signr > 0) {
597 /* Reenable any watchpoints before delivering the 597 /* Re-enable any watchpoints before delivering the
598 * signal to user space. The processor register will 598 * signal to user space. The processor register will
599 * have been cleared if the watchpoint triggered 599 * have been cleared if the watchpoint triggered
600 * inside the kernel. 600 * inside the kernel.
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 683802bec419..ab086b0357fc 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -410,7 +410,7 @@ static void do_signal(struct pt_regs *regs)
410 410
411 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 411 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
412 if (signr > 0) { 412 if (signr > 0) {
413 /* Reenable any watchpoints before delivering the 413 /* Re-enable any watchpoints before delivering the
414 * signal to user space. The processor register will 414 * signal to user space. The processor register will
415 * have been cleared if the watchpoint triggered 415 * have been cleared if the watchpoint triggered
416 * inside the kernel. 416 * inside the kernel.
diff --git a/arch/x86/kernel/smp_32.c b/arch/x86/kernel/smp_32.c
index 791d9f8036ae..f32115308399 100644
--- a/arch/x86/kernel/smp_32.c
+++ b/arch/x86/kernel/smp_32.c
@@ -69,7 +69,7 @@
69 * 69 *
70 * B stepping CPUs may hang. There are hardware work arounds 70 * B stepping CPUs may hang. There are hardware work arounds
71 * for this. We warn about it in case your board doesn't have the work 71 * for this. We warn about it in case your board doesn't have the work
72 * arounds. Basically thats so I can tell anyone with a B stepping 72 * arounds. Basically that's so I can tell anyone with a B stepping
73 * CPU and SMP problems "tough". 73 * CPU and SMP problems "tough".
74 * 74 *
75 * Specific items [From Pentium Processor Specification Update] 75 * Specific items [From Pentium Processor Specification Update]
@@ -273,7 +273,7 @@ void leave_mm(unsigned long cpu)
273 * 1a1) cpu_clear(cpu, old_mm->cpu_vm_mask); 273 * 1a1) cpu_clear(cpu, old_mm->cpu_vm_mask);
274 * Stop ipi delivery for the old mm. This is not synchronized with 274 * Stop ipi delivery for the old mm. This is not synchronized with
275 * the other cpus, but smp_invalidate_interrupt ignore flush ipis 275 * the other cpus, but smp_invalidate_interrupt ignore flush ipis
276 * for the wrong mm, and in the worst case we perform a superflous 276 * for the wrong mm, and in the worst case we perform a superfluous
277 * tlb flush. 277 * tlb flush.
278 * 1a2) set cpu_tlbstate to TLBSTATE_OK 278 * 1a2) set cpu_tlbstate to TLBSTATE_OK
279 * Now the smp_invalidate_interrupt won't call leave_mm if cpu0 279 * Now the smp_invalidate_interrupt won't call leave_mm if cpu0
@@ -610,7 +610,7 @@ static void stop_this_cpu (void * dummy)
610 */ 610 */
611 cpu_clear(smp_processor_id(), cpu_online_map); 611 cpu_clear(smp_processor_id(), cpu_online_map);
612 disable_local_APIC(); 612 disable_local_APIC();
613 if (cpu_data[smp_processor_id()].hlt_works_ok) 613 if (cpu_data(smp_processor_id()).hlt_works_ok)
614 for(;;) halt(); 614 for(;;) halt();
615 for (;;); 615 for (;;);
616} 616}
@@ -676,7 +676,7 @@ static int convert_apicid_to_cpu(int apic_id)
676 int i; 676 int i;
677 677
678 for (i = 0; i < NR_CPUS; i++) { 678 for (i = 0; i < NR_CPUS; i++) {
679 if (x86_cpu_to_apicid[i] == apic_id) 679 if (per_cpu(x86_cpu_to_apicid, i) == apic_id)
680 return i; 680 return i;
681 } 681 }
682 return -1; 682 return -1;
diff --git a/arch/x86/kernel/smp_64.c b/arch/x86/kernel/smp_64.c
index 5c2964727d19..03fa6ed559c6 100644
--- a/arch/x86/kernel/smp_64.c
+++ b/arch/x86/kernel/smp_64.c
@@ -322,17 +322,27 @@ void unlock_ipi_call_lock(void)
322} 322}
323 323
324/* 324/*
325 * this function sends a 'generic call function' IPI to one other CPU 325 * this function sends a 'generic call function' IPI to all other CPU
326 * in the system. 326 * of the system defined in the mask.
327 *
328 * cpu is a standard Linux logical CPU number.
329 */ 327 */
330static void 328
331__smp_call_function_single(int cpu, void (*func) (void *info), void *info, 329static int
332 int nonatomic, int wait) 330__smp_call_function_mask(cpumask_t mask,
331 void (*func)(void *), void *info,
332 int wait)
333{ 333{
334 struct call_data_struct data; 334 struct call_data_struct data;
335 int cpus = 1; 335 cpumask_t allbutself;
336 int cpus;
337
338 allbutself = cpu_online_map;
339 cpu_clear(smp_processor_id(), allbutself);
340
341 cpus_and(mask, mask, allbutself);
342 cpus = cpus_weight(mask);
343
344 if (!cpus)
345 return 0;
336 346
337 data.func = func; 347 data.func = func;
338 data.info = info; 348 data.info = info;
@@ -343,19 +353,55 @@ __smp_call_function_single(int cpu, void (*func) (void *info), void *info,
343 353
344 call_data = &data; 354 call_data = &data;
345 wmb(); 355 wmb();
346 /* Send a message to all other CPUs and wait for them to respond */ 356
347 send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); 357 /* Send a message to other CPUs */
358 if (cpus_equal(mask, allbutself))
359 send_IPI_allbutself(CALL_FUNCTION_VECTOR);
360 else
361 send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
348 362
349 /* Wait for response */ 363 /* Wait for response */
350 while (atomic_read(&data.started) != cpus) 364 while (atomic_read(&data.started) != cpus)
351 cpu_relax(); 365 cpu_relax();
352 366
353 if (!wait) 367 if (!wait)
354 return; 368 return 0;
355 369
356 while (atomic_read(&data.finished) != cpus) 370 while (atomic_read(&data.finished) != cpus)
357 cpu_relax(); 371 cpu_relax();
372
373 return 0;
374}
375/**
376 * smp_call_function_mask(): Run a function on a set of other CPUs.
377 * @mask: The set of cpus to run on. Must not include the current cpu.
378 * @func: The function to run. This must be fast and non-blocking.
379 * @info: An arbitrary pointer to pass to the function.
380 * @wait: If true, wait (atomically) until function has completed on other CPUs.
381 *
382 * Returns 0 on success, else a negative status code.
383 *
384 * If @wait is true, then returns once @func has returned; otherwise
385 * it returns just before the target cpu calls @func.
386 *
387 * You must not call this function with disabled interrupts or from a
388 * hardware interrupt handler or from a bottom half handler.
389 */
390int smp_call_function_mask(cpumask_t mask,
391 void (*func)(void *), void *info,
392 int wait)
393{
394 int ret;
395
396 /* Can deadlock when called with interrupts disabled */
397 WARN_ON(irqs_disabled());
398
399 spin_lock(&call_lock);
400 ret = __smp_call_function_mask(mask, func, info, wait);
401 spin_unlock(&call_lock);
402 return ret;
358} 403}
404EXPORT_SYMBOL(smp_call_function_mask);
359 405
360/* 406/*
361 * smp_call_function_single - Run a function on a specific CPU 407 * smp_call_function_single - Run a function on a specific CPU
@@ -374,6 +420,7 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
374 int nonatomic, int wait) 420 int nonatomic, int wait)
375{ 421{
376 /* prevent preemption and reschedule on another processor */ 422 /* prevent preemption and reschedule on another processor */
423 int ret;
377 int me = get_cpu(); 424 int me = get_cpu();
378 425
379 /* Can deadlock when called with interrupts disabled */ 426 /* Can deadlock when called with interrupts disabled */
@@ -387,51 +434,14 @@ int smp_call_function_single (int cpu, void (*func) (void *info), void *info,
387 return 0; 434 return 0;
388 } 435 }
389 436
390 spin_lock(&call_lock); 437 ret = smp_call_function_mask(cpumask_of_cpu(cpu), func, info, wait);
391 __smp_call_function_single(cpu, func, info, nonatomic, wait); 438
392 spin_unlock(&call_lock);
393 put_cpu(); 439 put_cpu();
394 return 0; 440 return ret;
395} 441}
396EXPORT_SYMBOL(smp_call_function_single); 442EXPORT_SYMBOL(smp_call_function_single);
397 443
398/* 444/*
399 * this function sends a 'generic call function' IPI to all other CPUs
400 * in the system.
401 */
402static void __smp_call_function (void (*func) (void *info), void *info,
403 int nonatomic, int wait)
404{
405 struct call_data_struct data;
406 int cpus = num_online_cpus()-1;
407
408 if (!cpus)
409 return;
410
411 data.func = func;
412 data.info = info;
413 atomic_set(&data.started, 0);
414 data.wait = wait;
415 if (wait)
416 atomic_set(&data.finished, 0);
417
418 call_data = &data;
419 wmb();
420 /* Send a message to all other CPUs and wait for them to respond */
421 send_IPI_allbutself(CALL_FUNCTION_VECTOR);
422
423 /* Wait for response */
424 while (atomic_read(&data.started) != cpus)
425 cpu_relax();
426
427 if (!wait)
428 return;
429
430 while (atomic_read(&data.finished) != cpus)
431 cpu_relax();
432}
433
434/*
435 * smp_call_function - run a function on all other CPUs. 445 * smp_call_function - run a function on all other CPUs.
436 * @func: The function to run. This must be fast and non-blocking. 446 * @func: The function to run. This must be fast and non-blocking.
437 * @info: An arbitrary pointer to pass to the function. 447 * @info: An arbitrary pointer to pass to the function.
@@ -449,10 +459,7 @@ static void __smp_call_function (void (*func) (void *info), void *info,
449int smp_call_function (void (*func) (void *info), void *info, int nonatomic, 459int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
450 int wait) 460 int wait)
451{ 461{
452 spin_lock(&call_lock); 462 return smp_call_function_mask(cpu_online_map, func, info, wait);
453 __smp_call_function(func,info,nonatomic,wait);
454 spin_unlock(&call_lock);
455 return 0;
456} 463}
457EXPORT_SYMBOL(smp_call_function); 464EXPORT_SYMBOL(smp_call_function);
458 465
@@ -479,7 +486,7 @@ void smp_send_stop(void)
479 /* Don't deadlock on the call lock in panic */ 486 /* Don't deadlock on the call lock in panic */
480 nolock = !spin_trylock(&call_lock); 487 nolock = !spin_trylock(&call_lock);
481 local_irq_save(flags); 488 local_irq_save(flags);
482 __smp_call_function(stop_this_cpu, NULL, 0, 0); 489 __smp_call_function_mask(cpu_online_map, stop_this_cpu, NULL, 0);
483 if (!nolock) 490 if (!nolock)
484 spin_unlock(&call_lock); 491 spin_unlock(&call_lock);
485 disable_local_APIC(); 492 disable_local_APIC();
diff --git a/arch/x86/kernel/smpboot_32.c b/arch/x86/kernel/smpboot_32.c
index be3faac04719..ef0f34ede1ab 100644
--- a/arch/x86/kernel/smpboot_32.c
+++ b/arch/x86/kernel/smpboot_32.c
@@ -67,7 +67,7 @@ int smp_num_siblings = 1;
67EXPORT_SYMBOL(smp_num_siblings); 67EXPORT_SYMBOL(smp_num_siblings);
68 68
69/* Last level cache ID of each logical CPU */ 69/* Last level cache ID of each logical CPU */
70int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; 70DEFINE_PER_CPU(u8, cpu_llc_id) = BAD_APICID;
71 71
72/* representing HT siblings of each logical CPU */ 72/* representing HT siblings of each logical CPU */
73DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); 73DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
@@ -89,12 +89,20 @@ EXPORT_SYMBOL(cpu_possible_map);
89static cpumask_t smp_commenced_mask; 89static cpumask_t smp_commenced_mask;
90 90
91/* Per CPU bogomips and other parameters */ 91/* Per CPU bogomips and other parameters */
92struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; 92DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
93EXPORT_SYMBOL(cpu_data); 93EXPORT_PER_CPU_SYMBOL(cpu_info);
94 94
95u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly = 95/*
96 { [0 ... NR_CPUS-1] = 0xff }; 96 * The following static array is used during kernel startup
97EXPORT_SYMBOL(x86_cpu_to_apicid); 97 * and the x86_cpu_to_apicid_ptr contains the address of the
98 * array during this time. Is it zeroed when the per_cpu
99 * data area is removed.
100 */
101u8 x86_cpu_to_apicid_init[NR_CPUS] __initdata =
102 { [0 ... NR_CPUS-1] = BAD_APICID };
103void *x86_cpu_to_apicid_ptr;
104DEFINE_PER_CPU(u8, x86_cpu_to_apicid) = BAD_APICID;
105EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid);
98 106
99u8 apicid_2_node[MAX_APICID]; 107u8 apicid_2_node[MAX_APICID];
100 108
@@ -150,9 +158,10 @@ void __init smp_alloc_memory(void)
150 158
151void __cpuinit smp_store_cpu_info(int id) 159void __cpuinit smp_store_cpu_info(int id)
152{ 160{
153 struct cpuinfo_x86 *c = cpu_data + id; 161 struct cpuinfo_x86 *c = &cpu_data(id);
154 162
155 *c = boot_cpu_data; 163 *c = boot_cpu_data;
164 c->cpu_index = id;
156 if (id!=0) 165 if (id!=0)
157 identify_secondary_cpu(c); 166 identify_secondary_cpu(c);
158 /* 167 /*
@@ -294,7 +303,7 @@ static int cpucount;
294/* maps the cpu to the sched domain representing multi-core */ 303/* maps the cpu to the sched domain representing multi-core */
295cpumask_t cpu_coregroup_map(int cpu) 304cpumask_t cpu_coregroup_map(int cpu)
296{ 305{
297 struct cpuinfo_x86 *c = cpu_data + cpu; 306 struct cpuinfo_x86 *c = &cpu_data(cpu);
298 /* 307 /*
299 * For perf, we return last level cache shared map. 308 * For perf, we return last level cache shared map.
300 * And for power savings, we return cpu_core_map 309 * And for power savings, we return cpu_core_map
@@ -311,41 +320,41 @@ static cpumask_t cpu_sibling_setup_map;
311void __cpuinit set_cpu_sibling_map(int cpu) 320void __cpuinit set_cpu_sibling_map(int cpu)
312{ 321{
313 int i; 322 int i;
314 struct cpuinfo_x86 *c = cpu_data; 323 struct cpuinfo_x86 *c = &cpu_data(cpu);
315 324
316 cpu_set(cpu, cpu_sibling_setup_map); 325 cpu_set(cpu, cpu_sibling_setup_map);
317 326
318 if (smp_num_siblings > 1) { 327 if (smp_num_siblings > 1) {
319 for_each_cpu_mask(i, cpu_sibling_setup_map) { 328 for_each_cpu_mask(i, cpu_sibling_setup_map) {
320 if (c[cpu].phys_proc_id == c[i].phys_proc_id && 329 if (c->phys_proc_id == cpu_data(i).phys_proc_id &&
321 c[cpu].cpu_core_id == c[i].cpu_core_id) { 330 c->cpu_core_id == cpu_data(i).cpu_core_id) {
322 cpu_set(i, per_cpu(cpu_sibling_map, cpu)); 331 cpu_set(i, per_cpu(cpu_sibling_map, cpu));
323 cpu_set(cpu, per_cpu(cpu_sibling_map, i)); 332 cpu_set(cpu, per_cpu(cpu_sibling_map, i));
324 cpu_set(i, per_cpu(cpu_core_map, cpu)); 333 cpu_set(i, per_cpu(cpu_core_map, cpu));
325 cpu_set(cpu, per_cpu(cpu_core_map, i)); 334 cpu_set(cpu, per_cpu(cpu_core_map, i));
326 cpu_set(i, c[cpu].llc_shared_map); 335 cpu_set(i, c->llc_shared_map);
327 cpu_set(cpu, c[i].llc_shared_map); 336 cpu_set(cpu, cpu_data(i).llc_shared_map);
328 } 337 }
329 } 338 }
330 } else { 339 } else {
331 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); 340 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
332 } 341 }
333 342
334 cpu_set(cpu, c[cpu].llc_shared_map); 343 cpu_set(cpu, c->llc_shared_map);
335 344
336 if (current_cpu_data.x86_max_cores == 1) { 345 if (current_cpu_data.x86_max_cores == 1) {
337 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); 346 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
338 c[cpu].booted_cores = 1; 347 c->booted_cores = 1;
339 return; 348 return;
340 } 349 }
341 350
342 for_each_cpu_mask(i, cpu_sibling_setup_map) { 351 for_each_cpu_mask(i, cpu_sibling_setup_map) {
343 if (cpu_llc_id[cpu] != BAD_APICID && 352 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
344 cpu_llc_id[cpu] == cpu_llc_id[i]) { 353 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
345 cpu_set(i, c[cpu].llc_shared_map); 354 cpu_set(i, c->llc_shared_map);
346 cpu_set(cpu, c[i].llc_shared_map); 355 cpu_set(cpu, cpu_data(i).llc_shared_map);
347 } 356 }
348 if (c[cpu].phys_proc_id == c[i].phys_proc_id) { 357 if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
349 cpu_set(i, per_cpu(cpu_core_map, cpu)); 358 cpu_set(i, per_cpu(cpu_core_map, cpu));
350 cpu_set(cpu, per_cpu(cpu_core_map, i)); 359 cpu_set(cpu, per_cpu(cpu_core_map, i));
351 /* 360 /*
@@ -357,15 +366,15 @@ void __cpuinit set_cpu_sibling_map(int cpu)
357 * the booted_cores for this new cpu 366 * the booted_cores for this new cpu
358 */ 367 */
359 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) 368 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i)
360 c[cpu].booted_cores++; 369 c->booted_cores++;
361 /* 370 /*
362 * increment the core count for all 371 * increment the core count for all
363 * the other cpus in this package 372 * the other cpus in this package
364 */ 373 */
365 if (i != cpu) 374 if (i != cpu)
366 c[i].booted_cores++; 375 cpu_data(i).booted_cores++;
367 } else if (i != cpu && !c[cpu].booted_cores) 376 } else if (i != cpu && !c->booted_cores)
368 c[cpu].booted_cores = c[i].booted_cores; 377 c->booted_cores = cpu_data(i).booted_cores;
369 } 378 }
370 } 379 }
371} 380}
@@ -412,7 +421,7 @@ static void __cpuinit start_secondary(void *unused)
412 /* 421 /*
413 * We need to hold call_lock, so there is no inconsistency 422 * We need to hold call_lock, so there is no inconsistency
414 * between the time smp_call_function() determines number of 423 * between the time smp_call_function() determines number of
415 * IPI receipients, and the time when the determination is made 424 * IPI recipients, and the time when the determination is made
416 * for which cpus receive the IPI. Holding this 425 * for which cpus receive the IPI. Holding this
417 * lock helps us to not include this cpu in a currently in progress 426 * lock helps us to not include this cpu in a currently in progress
418 * smp_call_function(). 427 * smp_call_function().
@@ -804,7 +813,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
804 813
805 irq_ctx_init(cpu); 814 irq_ctx_init(cpu);
806 815
807 x86_cpu_to_apicid[cpu] = apicid; 816 per_cpu(x86_cpu_to_apicid, cpu) = apicid;
808 /* 817 /*
809 * This grunge runs the startup process for 818 * This grunge runs the startup process for
810 * the targeted processor. 819 * the targeted processor.
@@ -844,7 +853,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
844 /* number CPUs logically, starting from 1 (BSP is 0) */ 853 /* number CPUs logically, starting from 1 (BSP is 0) */
845 Dprintk("OK.\n"); 854 Dprintk("OK.\n");
846 printk("CPU%d: ", cpu); 855 printk("CPU%d: ", cpu);
847 print_cpu_info(&cpu_data[cpu]); 856 print_cpu_info(&cpu_data(cpu));
848 Dprintk("CPU has booted.\n"); 857 Dprintk("CPU has booted.\n");
849 } else { 858 } else {
850 boot_error= 1; 859 boot_error= 1;
@@ -866,7 +875,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
866 cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */ 875 cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */
867 cpucount--; 876 cpucount--;
868 } else { 877 } else {
869 x86_cpu_to_apicid[cpu] = apicid; 878 per_cpu(x86_cpu_to_apicid, cpu) = apicid;
870 cpu_set(cpu, cpu_present_map); 879 cpu_set(cpu, cpu_present_map);
871 } 880 }
872 881
@@ -915,7 +924,7 @@ static int __cpuinit __smp_prepare_cpu(int cpu)
915 struct warm_boot_cpu_info info; 924 struct warm_boot_cpu_info info;
916 int apicid, ret; 925 int apicid, ret;
917 926
918 apicid = x86_cpu_to_apicid[cpu]; 927 apicid = per_cpu(x86_cpu_to_apicid, cpu);
919 if (apicid == BAD_APICID) { 928 if (apicid == BAD_APICID) {
920 ret = -ENODEV; 929 ret = -ENODEV;
921 goto exit; 930 goto exit;
@@ -961,11 +970,11 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
961 */ 970 */
962 smp_store_cpu_info(0); /* Final full version of the data */ 971 smp_store_cpu_info(0); /* Final full version of the data */
963 printk("CPU%d: ", 0); 972 printk("CPU%d: ", 0);
964 print_cpu_info(&cpu_data[0]); 973 print_cpu_info(&cpu_data(0));
965 974
966 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 975 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
967 boot_cpu_logical_apicid = logical_smp_processor_id(); 976 boot_cpu_logical_apicid = logical_smp_processor_id();
968 x86_cpu_to_apicid[0] = boot_cpu_physical_apicid; 977 per_cpu(x86_cpu_to_apicid, 0) = boot_cpu_physical_apicid;
969 978
970 current_thread_info()->cpu = 0; 979 current_thread_info()->cpu = 0;
971 980
@@ -1008,6 +1017,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1008 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); 1017 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
1009 smpboot_clear_io_apic_irqs(); 1018 smpboot_clear_io_apic_irqs();
1010 phys_cpu_present_map = physid_mask_of_physid(0); 1019 phys_cpu_present_map = physid_mask_of_physid(0);
1020 map_cpu_to_logical_apicid();
1011 cpu_set(0, per_cpu(cpu_sibling_map, 0)); 1021 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1012 cpu_set(0, per_cpu(cpu_core_map, 0)); 1022 cpu_set(0, per_cpu(cpu_core_map, 0));
1013 return; 1023 return;
@@ -1029,6 +1039,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1029 } 1039 }
1030 smpboot_clear_io_apic_irqs(); 1040 smpboot_clear_io_apic_irqs();
1031 phys_cpu_present_map = physid_mask_of_physid(0); 1041 phys_cpu_present_map = physid_mask_of_physid(0);
1042 map_cpu_to_logical_apicid();
1032 cpu_set(0, per_cpu(cpu_sibling_map, 0)); 1043 cpu_set(0, per_cpu(cpu_sibling_map, 0));
1033 cpu_set(0, per_cpu(cpu_core_map, 0)); 1044 cpu_set(0, per_cpu(cpu_core_map, 0));
1034 return; 1045 return;
@@ -1082,7 +1093,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
1082 Dprintk("Before bogomips.\n"); 1093 Dprintk("Before bogomips.\n");
1083 for (cpu = 0; cpu < NR_CPUS; cpu++) 1094 for (cpu = 0; cpu < NR_CPUS; cpu++)
1084 if (cpu_isset(cpu, cpu_callout_map)) 1095 if (cpu_isset(cpu, cpu_callout_map))
1085 bogosum += cpu_data[cpu].loops_per_jiffy; 1096 bogosum += cpu_data(cpu).loops_per_jiffy;
1086 printk(KERN_INFO 1097 printk(KERN_INFO
1087 "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", 1098 "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
1088 cpucount+1, 1099 cpucount+1,
@@ -1152,7 +1163,7 @@ void __init native_smp_prepare_boot_cpu(void)
1152void remove_siblinginfo(int cpu) 1163void remove_siblinginfo(int cpu)
1153{ 1164{
1154 int sibling; 1165 int sibling;
1155 struct cpuinfo_x86 *c = cpu_data; 1166 struct cpuinfo_x86 *c = &cpu_data(cpu);
1156 1167
1157 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { 1168 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
1158 cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); 1169 cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
@@ -1160,15 +1171,15 @@ void remove_siblinginfo(int cpu)
1160 * last thread sibling in this cpu core going down 1171 * last thread sibling in this cpu core going down
1161 */ 1172 */
1162 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) 1173 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
1163 c[sibling].booted_cores--; 1174 cpu_data(sibling).booted_cores--;
1164 } 1175 }
1165 1176
1166 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) 1177 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
1167 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); 1178 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
1168 cpus_clear(per_cpu(cpu_sibling_map, cpu)); 1179 cpus_clear(per_cpu(cpu_sibling_map, cpu));
1169 cpus_clear(per_cpu(cpu_core_map, cpu)); 1180 cpus_clear(per_cpu(cpu_core_map, cpu));
1170 c[cpu].phys_proc_id = 0; 1181 c->phys_proc_id = 0;
1171 c[cpu].cpu_core_id = 0; 1182 c->cpu_core_id = 0;
1172 cpu_clear(cpu, cpu_sibling_setup_map); 1183 cpu_clear(cpu, cpu_sibling_setup_map);
1173} 1184}
1174 1185
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index e351ac4ab5b1..b7e768dd87c9 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -65,7 +65,7 @@ int smp_num_siblings = 1;
65EXPORT_SYMBOL(smp_num_siblings); 65EXPORT_SYMBOL(smp_num_siblings);
66 66
67/* Last level cache ID of each logical CPU */ 67/* Last level cache ID of each logical CPU */
68u8 cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID}; 68DEFINE_PER_CPU(u8, cpu_llc_id) = BAD_APICID;
69 69
70/* Bitmask of currently online CPUs */ 70/* Bitmask of currently online CPUs */
71cpumask_t cpu_online_map __read_mostly; 71cpumask_t cpu_online_map __read_mostly;
@@ -84,8 +84,8 @@ cpumask_t cpu_possible_map;
84EXPORT_SYMBOL(cpu_possible_map); 84EXPORT_SYMBOL(cpu_possible_map);
85 85
86/* Per CPU bogomips and other parameters */ 86/* Per CPU bogomips and other parameters */
87struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; 87DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
88EXPORT_SYMBOL(cpu_data); 88EXPORT_PER_CPU_SYMBOL(cpu_info);
89 89
90/* Set when the idlers are all forked */ 90/* Set when the idlers are all forked */
91int smp_threads_ready; 91int smp_threads_ready;
@@ -138,9 +138,10 @@ static unsigned long __cpuinit setup_trampoline(void)
138 138
139static void __cpuinit smp_store_cpu_info(int id) 139static void __cpuinit smp_store_cpu_info(int id)
140{ 140{
141 struct cpuinfo_x86 *c = cpu_data + id; 141 struct cpuinfo_x86 *c = &cpu_data(id);
142 142
143 *c = boot_cpu_data; 143 *c = boot_cpu_data;
144 c->cpu_index = id;
144 identify_cpu(c); 145 identify_cpu(c);
145 print_cpu_info(c); 146 print_cpu_info(c);
146} 147}
@@ -237,7 +238,7 @@ void __cpuinit smp_callin(void)
237/* maps the cpu to the sched domain representing multi-core */ 238/* maps the cpu to the sched domain representing multi-core */
238cpumask_t cpu_coregroup_map(int cpu) 239cpumask_t cpu_coregroup_map(int cpu)
239{ 240{
240 struct cpuinfo_x86 *c = cpu_data + cpu; 241 struct cpuinfo_x86 *c = &cpu_data(cpu);
241 /* 242 /*
242 * For perf, we return last level cache shared map. 243 * For perf, we return last level cache shared map.
243 * And for power savings, we return cpu_core_map 244 * And for power savings, we return cpu_core_map
@@ -254,41 +255,41 @@ static cpumask_t cpu_sibling_setup_map;
254static inline void set_cpu_sibling_map(int cpu) 255static inline void set_cpu_sibling_map(int cpu)
255{ 256{
256 int i; 257 int i;
257 struct cpuinfo_x86 *c = cpu_data; 258 struct cpuinfo_x86 *c = &cpu_data(cpu);
258 259
259 cpu_set(cpu, cpu_sibling_setup_map); 260 cpu_set(cpu, cpu_sibling_setup_map);
260 261
261 if (smp_num_siblings > 1) { 262 if (smp_num_siblings > 1) {
262 for_each_cpu_mask(i, cpu_sibling_setup_map) { 263 for_each_cpu_mask(i, cpu_sibling_setup_map) {
263 if (c[cpu].phys_proc_id == c[i].phys_proc_id && 264 if (c->phys_proc_id == cpu_data(i).phys_proc_id &&
264 c[cpu].cpu_core_id == c[i].cpu_core_id) { 265 c->cpu_core_id == cpu_data(i).cpu_core_id) {
265 cpu_set(i, per_cpu(cpu_sibling_map, cpu)); 266 cpu_set(i, per_cpu(cpu_sibling_map, cpu));
266 cpu_set(cpu, per_cpu(cpu_sibling_map, i)); 267 cpu_set(cpu, per_cpu(cpu_sibling_map, i));
267 cpu_set(i, per_cpu(cpu_core_map, cpu)); 268 cpu_set(i, per_cpu(cpu_core_map, cpu));
268 cpu_set(cpu, per_cpu(cpu_core_map, i)); 269 cpu_set(cpu, per_cpu(cpu_core_map, i));
269 cpu_set(i, c[cpu].llc_shared_map); 270 cpu_set(i, c->llc_shared_map);
270 cpu_set(cpu, c[i].llc_shared_map); 271 cpu_set(cpu, cpu_data(i).llc_shared_map);
271 } 272 }
272 } 273 }
273 } else { 274 } else {
274 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); 275 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu));
275 } 276 }
276 277
277 cpu_set(cpu, c[cpu].llc_shared_map); 278 cpu_set(cpu, c->llc_shared_map);
278 279
279 if (current_cpu_data.x86_max_cores == 1) { 280 if (current_cpu_data.x86_max_cores == 1) {
280 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); 281 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu);
281 c[cpu].booted_cores = 1; 282 c->booted_cores = 1;
282 return; 283 return;
283 } 284 }
284 285
285 for_each_cpu_mask(i, cpu_sibling_setup_map) { 286 for_each_cpu_mask(i, cpu_sibling_setup_map) {
286 if (cpu_llc_id[cpu] != BAD_APICID && 287 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
287 cpu_llc_id[cpu] == cpu_llc_id[i]) { 288 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
288 cpu_set(i, c[cpu].llc_shared_map); 289 cpu_set(i, c->llc_shared_map);
289 cpu_set(cpu, c[i].llc_shared_map); 290 cpu_set(cpu, cpu_data(i).llc_shared_map);
290 } 291 }
291 if (c[cpu].phys_proc_id == c[i].phys_proc_id) { 292 if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
292 cpu_set(i, per_cpu(cpu_core_map, cpu)); 293 cpu_set(i, per_cpu(cpu_core_map, cpu));
293 cpu_set(cpu, per_cpu(cpu_core_map, i)); 294 cpu_set(cpu, per_cpu(cpu_core_map, i));
294 /* 295 /*
@@ -300,15 +301,15 @@ static inline void set_cpu_sibling_map(int cpu)
300 * the booted_cores for this new cpu 301 * the booted_cores for this new cpu
301 */ 302 */
302 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) 303 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i)
303 c[cpu].booted_cores++; 304 c->booted_cores++;
304 /* 305 /*
305 * increment the core count for all 306 * increment the core count for all
306 * the other cpus in this package 307 * the other cpus in this package
307 */ 308 */
308 if (i != cpu) 309 if (i != cpu)
309 c[i].booted_cores++; 310 cpu_data(i).booted_cores++;
310 } else if (i != cpu && !c[cpu].booted_cores) 311 } else if (i != cpu && !c->booted_cores)
311 c[cpu].booted_cores = c[i].booted_cores; 312 c->booted_cores = cpu_data(i).booted_cores;
312 } 313 }
313 } 314 }
314} 315}
@@ -350,7 +351,7 @@ void __cpuinit start_secondary(void)
350 /* 351 /*
351 * We need to hold call_lock, so there is no inconsistency 352 * We need to hold call_lock, so there is no inconsistency
352 * between the time smp_call_function() determines number of 353 * between the time smp_call_function() determines number of
353 * IPI receipients, and the time when the determination is made 354 * IPI recipients, and the time when the determination is made
354 * for which cpus receive the IPI in genapic_flat.c. Holding this 355 * for which cpus receive the IPI in genapic_flat.c. Holding this
355 * lock helps us to not include this cpu in a currently in progress 356 * lock helps us to not include this cpu in a currently in progress
356 * smp_call_function(). 357 * smp_call_function().
@@ -694,7 +695,7 @@ do_rest:
694 clear_node_cpumask(cpu); /* was set by numa_add_cpu */ 695 clear_node_cpumask(cpu); /* was set by numa_add_cpu */
695 cpu_clear(cpu, cpu_present_map); 696 cpu_clear(cpu, cpu_present_map);
696 cpu_clear(cpu, cpu_possible_map); 697 cpu_clear(cpu, cpu_possible_map);
697 x86_cpu_to_apicid[cpu] = BAD_APICID; 698 per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
698 return -EIO; 699 return -EIO;
699 } 700 }
700 701
@@ -841,6 +842,26 @@ static int __init smp_sanity_check(unsigned max_cpus)
841} 842}
842 843
843/* 844/*
845 * Copy apicid's found by MP_processor_info from initial array to the per cpu
846 * data area. The x86_cpu_to_apicid_init array is then expendable and the
847 * x86_cpu_to_apicid_ptr is zeroed indicating that the static array is no
848 * longer available.
849 */
850void __init smp_set_apicids(void)
851{
852 int cpu;
853
854 for_each_cpu_mask(cpu, cpu_possible_map) {
855 if (per_cpu_offset(cpu))
856 per_cpu(x86_cpu_to_apicid, cpu) =
857 x86_cpu_to_apicid_init[cpu];
858 }
859
860 /* indicate the static array will be going away soon */
861 x86_cpu_to_apicid_ptr = NULL;
862}
863
864/*
844 * Prepare for SMP bootup. The MP table or ACPI has been read 865 * Prepare for SMP bootup. The MP table or ACPI has been read
845 * earlier. Just do some sanity checking here and enable APIC mode. 866 * earlier. Just do some sanity checking here and enable APIC mode.
846 */ 867 */
@@ -849,6 +870,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
849 nmi_watchdog_default(); 870 nmi_watchdog_default();
850 current_cpu_data = boot_cpu_data; 871 current_cpu_data = boot_cpu_data;
851 current_thread_info()->cpu = 0; /* needed? */ 872 current_thread_info()->cpu = 0; /* needed? */
873 smp_set_apicids();
852 set_cpu_sibling_map(0); 874 set_cpu_sibling_map(0);
853 875
854 if (smp_sanity_check(max_cpus) < 0) { 876 if (smp_sanity_check(max_cpus) < 0) {
@@ -968,7 +990,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
968static void remove_siblinginfo(int cpu) 990static void remove_siblinginfo(int cpu)
969{ 991{
970 int sibling; 992 int sibling;
971 struct cpuinfo_x86 *c = cpu_data; 993 struct cpuinfo_x86 *c = &cpu_data(cpu);
972 994
973 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) { 995 for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
974 cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); 996 cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
@@ -976,15 +998,15 @@ static void remove_siblinginfo(int cpu)
976 * last thread sibling in this cpu core going down 998 * last thread sibling in this cpu core going down
977 */ 999 */
978 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) 1000 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1)
979 c[sibling].booted_cores--; 1001 cpu_data(sibling).booted_cores--;
980 } 1002 }
981 1003
982 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) 1004 for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
983 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); 1005 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
984 cpus_clear(per_cpu(cpu_sibling_map, cpu)); 1006 cpus_clear(per_cpu(cpu_sibling_map, cpu));
985 cpus_clear(per_cpu(cpu_core_map, cpu)); 1007 cpus_clear(per_cpu(cpu_core_map, cpu));
986 c[cpu].phys_proc_id = 0; 1008 c->phys_proc_id = 0;
987 c[cpu].cpu_core_id = 0; 1009 c->cpu_core_id = 0;
988 cpu_clear(cpu, cpu_sibling_setup_map); 1010 cpu_clear(cpu, cpu_sibling_setup_map);
989} 1011}
990 1012
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index 91c7acc8d999..72f463401592 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -64,7 +64,7 @@ static int __init setup_pci_node_map_for_wpeg(int wpeg_num, int last_bus)
64 64
65 switch (rio_devs[wpeg_num]->type){ 65 switch (rio_devs[wpeg_num]->type){
66 case CompatWPEG: 66 case CompatWPEG:
67 /* The Compatability Winnipeg controls the 2 legacy buses, 67 /* The Compatibility Winnipeg controls the 2 legacy buses,
68 * the 66MHz PCI bus [2 slots] and the 2 "extra" buses in case 68 * the 66MHz PCI bus [2 slots] and the 2 "extra" buses in case
69 * a PCI-PCI bridge card is used in either slot: total 5 buses. 69 * a PCI-PCI bridge card is used in either slot: total 5 buses.
70 */ 70 */
diff --git a/arch/x86/kernel/suspend_64.c b/arch/x86/kernel/suspend_64.c
index 573c0a6e0ac6..bc9f59c246fd 100644
--- a/arch/x86/kernel/suspend_64.c
+++ b/arch/x86/kernel/suspend_64.c
@@ -32,9 +32,9 @@ void __save_processor_state(struct saved_context *ctxt)
32 /* 32 /*
33 * descriptor tables 33 * descriptor tables
34 */ 34 */
35 asm volatile ("sgdt %0" : "=m" (ctxt->gdt_limit)); 35 store_gdt((struct desc_ptr *)&ctxt->gdt_limit);
36 asm volatile ("sidt %0" : "=m" (ctxt->idt_limit)); 36 store_idt((struct desc_ptr *)&ctxt->idt_limit);
37 asm volatile ("str %0" : "=m" (ctxt->tr)); 37 store_tr(ctxt->tr);
38 38
39 /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */ 39 /* XMM0..XMM15 should be handled by kernel_fpu_begin(). */
40 /* 40 /*
@@ -91,8 +91,9 @@ void __restore_processor_state(struct saved_context *ctxt)
91 * now restore the descriptor tables to their proper values 91 * now restore the descriptor tables to their proper values
92 * ltr is done i fix_processor_context(). 92 * ltr is done i fix_processor_context().
93 */ 93 */
94 asm volatile ("lgdt %0" :: "m" (ctxt->gdt_limit)); 94 load_gdt((const struct desc_ptr *)&ctxt->gdt_limit);
95 asm volatile ("lidt %0" :: "m" (ctxt->idt_limit)); 95 load_idt((const struct desc_ptr *)&ctxt->idt_limit);
96
96 97
97 /* 98 /*
98 * segment registers 99 * segment registers
@@ -123,7 +124,7 @@ void fix_processor_context(void)
123 int cpu = smp_processor_id(); 124 int cpu = smp_processor_id();
124 struct tss_struct *t = &per_cpu(init_tss, cpu); 125 struct tss_struct *t = &per_cpu(init_tss, cpu);
125 126
126 set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */ 127 set_tss_desc(cpu,t); /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
127 128
128 cpu_gdt(cpu)[GDT_ENTRY_TSS].type = 9; 129 cpu_gdt(cpu)[GDT_ENTRY_TSS].type = 9;
129 130
@@ -150,8 +151,22 @@ void fix_processor_context(void)
150/* Defined in arch/x86_64/kernel/suspend_asm.S */ 151/* Defined in arch/x86_64/kernel/suspend_asm.S */
151extern int restore_image(void); 152extern int restore_image(void);
152 153
154/*
155 * Address to jump to in the last phase of restore in order to get to the image
156 * kernel's text (this value is passed in the image header).
157 */
158unsigned long restore_jump_address;
159
160/*
161 * Value of the cr3 register from before the hibernation (this value is passed
162 * in the image header).
163 */
164unsigned long restore_cr3;
165
153pgd_t *temp_level4_pgt; 166pgd_t *temp_level4_pgt;
154 167
168void *relocated_restore_code;
169
155static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) 170static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
156{ 171{
157 long i, j; 172 long i, j;
@@ -175,7 +190,7 @@ static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long en
175 190
176 if (paddr >= end) 191 if (paddr >= end)
177 break; 192 break;
178 pe = _PAGE_NX | _PAGE_PSE | _KERNPG_TABLE | paddr; 193 pe = __PAGE_KERNEL_LARGE_EXEC | paddr;
179 pe &= __supported_pte_mask; 194 pe &= __supported_pte_mask;
180 set_pmd(pmd, __pmd(pe)); 195 set_pmd(pmd, __pmd(pe));
181 } 196 }
@@ -183,25 +198,42 @@ static int res_phys_pud_init(pud_t *pud, unsigned long address, unsigned long en
183 return 0; 198 return 0;
184} 199}
185 200
201static int res_kernel_text_pud_init(pud_t *pud, unsigned long start)
202{
203 pmd_t *pmd;
204 unsigned long paddr;
205
206 pmd = (pmd_t *)get_safe_page(GFP_ATOMIC);
207 if (!pmd)
208 return -ENOMEM;
209 set_pud(pud + pud_index(start), __pud(__pa(pmd) | _KERNPG_TABLE));
210 for (paddr = 0; paddr < KERNEL_TEXT_SIZE; pmd++, paddr += PMD_SIZE) {
211 unsigned long pe;
212
213 pe = __PAGE_KERNEL_LARGE_EXEC | _PAGE_GLOBAL | paddr;
214 pe &= __supported_pte_mask;
215 set_pmd(pmd, __pmd(pe));
216 }
217
218 return 0;
219}
220
186static int set_up_temporary_mappings(void) 221static int set_up_temporary_mappings(void)
187{ 222{
188 unsigned long start, end, next; 223 unsigned long start, end, next;
224 pud_t *pud;
189 int error; 225 int error;
190 226
191 temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC); 227 temp_level4_pgt = (pgd_t *)get_safe_page(GFP_ATOMIC);
192 if (!temp_level4_pgt) 228 if (!temp_level4_pgt)
193 return -ENOMEM; 229 return -ENOMEM;
194 230
195 /* It is safe to reuse the original kernel mapping */
196 set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
197 init_level4_pgt[pgd_index(__START_KERNEL_map)]);
198
199 /* Set up the direct mapping from scratch */ 231 /* Set up the direct mapping from scratch */
200 start = (unsigned long)pfn_to_kaddr(0); 232 start = (unsigned long)pfn_to_kaddr(0);
201 end = (unsigned long)pfn_to_kaddr(end_pfn); 233 end = (unsigned long)pfn_to_kaddr(end_pfn);
202 234
203 for (; start < end; start = next) { 235 for (; start < end; start = next) {
204 pud_t *pud = (pud_t *)get_safe_page(GFP_ATOMIC); 236 pud = (pud_t *)get_safe_page(GFP_ATOMIC);
205 if (!pud) 237 if (!pud)
206 return -ENOMEM; 238 return -ENOMEM;
207 next = start + PGDIR_SIZE; 239 next = start + PGDIR_SIZE;
@@ -212,7 +244,17 @@ static int set_up_temporary_mappings(void)
212 set_pgd(temp_level4_pgt + pgd_index(start), 244 set_pgd(temp_level4_pgt + pgd_index(start),
213 mk_kernel_pgd(__pa(pud))); 245 mk_kernel_pgd(__pa(pud)));
214 } 246 }
215 return 0; 247
248 /* Set up the kernel text mapping from scratch */
249 pud = (pud_t *)get_safe_page(GFP_ATOMIC);
250 if (!pud)
251 return -ENOMEM;
252 error = res_kernel_text_pud_init(pud, __START_KERNEL_map);
253 if (!error)
254 set_pgd(temp_level4_pgt + pgd_index(__START_KERNEL_map),
255 __pgd(__pa(pud) | _PAGE_TABLE));
256
257 return error;
216} 258}
217 259
218int swsusp_arch_resume(void) 260int swsusp_arch_resume(void)
@@ -222,6 +264,13 @@ int swsusp_arch_resume(void)
222 /* We have got enough memory and from now on we cannot recover */ 264 /* We have got enough memory and from now on we cannot recover */
223 if ((error = set_up_temporary_mappings())) 265 if ((error = set_up_temporary_mappings()))
224 return error; 266 return error;
267
268 relocated_restore_code = (void *)get_safe_page(GFP_ATOMIC);
269 if (!relocated_restore_code)
270 return -ENOMEM;
271 memcpy(relocated_restore_code, &core_restore_code,
272 &restore_registers - &core_restore_code);
273
225 restore_image(); 274 restore_image();
226 return 0; 275 return 0;
227} 276}
@@ -236,4 +285,43 @@ int pfn_is_nosave(unsigned long pfn)
236 unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT; 285 unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
237 return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn); 286 return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
238} 287}
288
289struct restore_data_record {
290 unsigned long jump_address;
291 unsigned long cr3;
292 unsigned long magic;
293};
294
295#define RESTORE_MAGIC 0x0123456789ABCDEFUL
296
297/**
298 * arch_hibernation_header_save - populate the architecture specific part
299 * of a hibernation image header
300 * @addr: address to save the data at
301 */
302int arch_hibernation_header_save(void *addr, unsigned int max_size)
303{
304 struct restore_data_record *rdr = addr;
305
306 if (max_size < sizeof(struct restore_data_record))
307 return -EOVERFLOW;
308 rdr->jump_address = restore_jump_address;
309 rdr->cr3 = restore_cr3;
310 rdr->magic = RESTORE_MAGIC;
311 return 0;
312}
313
314/**
315 * arch_hibernation_header_restore - read the architecture specific data
316 * from the hibernation image header
317 * @addr: address to read the data from
318 */
319int arch_hibernation_header_restore(void *addr)
320{
321 struct restore_data_record *rdr = addr;
322
323 restore_jump_address = rdr->jump_address;
324 restore_cr3 = rdr->cr3;
325 return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL;
326}
239#endif /* CONFIG_HIBERNATION */ 327#endif /* CONFIG_HIBERNATION */
diff --git a/arch/x86/kernel/suspend_asm_64.S b/arch/x86/kernel/suspend_asm_64.S
index 16d183f67bc1..48344b666d2c 100644
--- a/arch/x86/kernel/suspend_asm_64.S
+++ b/arch/x86/kernel/suspend_asm_64.S
@@ -2,8 +2,8 @@
2 * 2 *
3 * Distribute under GPLv2. 3 * Distribute under GPLv2.
4 * 4 *
5 * swsusp_arch_resume may not use any stack, nor any variable that is 5 * swsusp_arch_resume must not use any stack or any nonlocal variables while
6 * not "NoSave" during copying pages: 6 * copying pages:
7 * 7 *
8 * Its rewriting one kernel image with another. What is stack in "old" 8 * Its rewriting one kernel image with another. What is stack in "old"
9 * image could very well be data page in "new" image, and overwriting 9 * image could very well be data page in "new" image, and overwriting
@@ -36,6 +36,13 @@ ENTRY(swsusp_arch_suspend)
36 movq %r15, saved_context_r15(%rip) 36 movq %r15, saved_context_r15(%rip)
37 pushfq ; popq saved_context_eflags(%rip) 37 pushfq ; popq saved_context_eflags(%rip)
38 38
39 /* save the address of restore_registers */
40 movq $restore_registers, %rax
41 movq %rax, restore_jump_address(%rip)
42 /* save cr3 */
43 movq %cr3, %rax
44 movq %rax, restore_cr3(%rip)
45
39 call swsusp_save 46 call swsusp_save
40 ret 47 ret
41 48
@@ -54,7 +61,17 @@ ENTRY(restore_image)
54 movq %rcx, %cr3; 61 movq %rcx, %cr3;
55 movq %rax, %cr4; # turn PGE back on 62 movq %rax, %cr4; # turn PGE back on
56 63
64 /* prepare to jump to the image kernel */
65 movq restore_jump_address(%rip), %rax
66 movq restore_cr3(%rip), %rbx
67
68 /* prepare to copy image data to their original locations */
57 movq restore_pblist(%rip), %rdx 69 movq restore_pblist(%rip), %rdx
70 movq relocated_restore_code(%rip), %rcx
71 jmpq *%rcx
72
73 /* code below has been relocated to a safe page */
74ENTRY(core_restore_code)
58loop: 75loop:
59 testq %rdx, %rdx 76 testq %rdx, %rdx
60 jz done 77 jz done
@@ -62,7 +79,7 @@ loop:
62 /* get addresses from the pbe and copy the page */ 79 /* get addresses from the pbe and copy the page */
63 movq pbe_address(%rdx), %rsi 80 movq pbe_address(%rdx), %rsi
64 movq pbe_orig_address(%rdx), %rdi 81 movq pbe_orig_address(%rdx), %rdi
65 movq $512, %rcx 82 movq $(PAGE_SIZE >> 3), %rcx
66 rep 83 rep
67 movsq 84 movsq
68 85
@@ -70,10 +87,22 @@ loop:
70 movq pbe_next(%rdx), %rdx 87 movq pbe_next(%rdx), %rdx
71 jmp loop 88 jmp loop
72done: 89done:
90 /* jump to the restore_registers address from the image header */
91 jmpq *%rax
92 /*
93 * NOTE: This assumes that the boot kernel's text mapping covers the
94 * image kernel's page containing restore_registers and the address of
95 * this page is the same as in the image kernel's text mapping (it
96 * should always be true, because the text mapping is linear, starting
97 * from 0, and is supposed to cover the entire kernel text for every
98 * kernel).
99 *
100 * code below belongs to the image kernel
101 */
102
103ENTRY(restore_registers)
73 /* go back to the original page tables */ 104 /* go back to the original page tables */
74 movq $(init_level4_pgt - __START_KERNEL_map), %rax 105 movq %rbx, %cr3
75 addq phys_base(%rip), %rax
76 movq %rax, %cr3
77 106
78 /* Flush TLB, including "global" things (vmalloc) */ 107 /* Flush TLB, including "global" things (vmalloc) */
79 movq mmu_cr4_features(%rip), %rax 108 movq mmu_cr4_features(%rip), %rax
@@ -84,12 +113,9 @@ done:
84 movq %rcx, %cr3 113 movq %rcx, %cr3
85 movq %rax, %cr4; # turn PGE back on 114 movq %rax, %cr4; # turn PGE back on
86 115
87 movl $24, %eax
88 movl %eax, %ds
89
90 movq saved_context_esp(%rip), %rsp 116 movq saved_context_esp(%rip), %rsp
91 movq saved_context_ebp(%rip), %rbp 117 movq saved_context_ebp(%rip), %rbp
92 /* Don't restore %rax, it must be 0 anyway */ 118 /* restore GPRs (we don't restore %rax, it must be 0 anyway) */
93 movq saved_context_ebx(%rip), %rbx 119 movq saved_context_ebx(%rip), %rbx
94 movq saved_context_ecx(%rip), %rcx 120 movq saved_context_ecx(%rip), %rcx
95 movq saved_context_edx(%rip), %rdx 121 movq saved_context_edx(%rip), %rdx
@@ -107,4 +133,7 @@ done:
107 133
108 xorq %rax, %rax 134 xorq %rax, %rax
109 135
136 /* tell the hibernation core that we've just restored the memory */
137 movq %rax, in_suspend(%rip)
138
110 ret 139 ret
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index b132d3957dfc..cc9acace7e23 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -63,6 +63,9 @@
63 63
64int panic_on_unrecovered_nmi; 64int panic_on_unrecovered_nmi;
65 65
66DECLARE_BITMAP(used_vectors, NR_VECTORS);
67EXPORT_SYMBOL_GPL(used_vectors);
68
66asmlinkage int system_call(void); 69asmlinkage int system_call(void);
67 70
68/* Do we ignore FPU interrupts ? */ 71/* Do we ignore FPU interrupts ? */
@@ -288,48 +291,24 @@ EXPORT_SYMBOL(dump_stack);
288void show_registers(struct pt_regs *regs) 291void show_registers(struct pt_regs *regs)
289{ 292{
290 int i; 293 int i;
291 int in_kernel = 1; 294
292 unsigned long esp;
293 unsigned short ss, gs;
294
295 esp = (unsigned long) (&regs->esp);
296 savesegment(ss, ss);
297 savesegment(gs, gs);
298 if (user_mode_vm(regs)) {
299 in_kernel = 0;
300 esp = regs->esp;
301 ss = regs->xss & 0xffff;
302 }
303 print_modules(); 295 print_modules();
304 printk(KERN_EMERG "CPU: %d\n" 296 __show_registers(regs, 0);
305 KERN_EMERG "EIP: %04x:[<%08lx>] %s VLI\n"
306 KERN_EMERG "EFLAGS: %08lx (%s %.*s)\n",
307 smp_processor_id(), 0xffff & regs->xcs, regs->eip,
308 print_tainted(), regs->eflags, init_utsname()->release,
309 (int)strcspn(init_utsname()->version, " "),
310 init_utsname()->version);
311 print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip);
312 printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
313 regs->eax, regs->ebx, regs->ecx, regs->edx);
314 printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
315 regs->esi, regs->edi, regs->ebp, esp);
316 printk(KERN_EMERG "ds: %04x es: %04x fs: %04x gs: %04x ss: %04x\n",
317 regs->xds & 0xffff, regs->xes & 0xffff, regs->xfs & 0xffff, gs, ss);
318 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)", 297 printk(KERN_EMERG "Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)",
319 TASK_COMM_LEN, current->comm, current->pid, 298 TASK_COMM_LEN, current->comm, task_pid_nr(current),
320 current_thread_info(), current, task_thread_info(current)); 299 current_thread_info(), current, task_thread_info(current));
321 /* 300 /*
322 * When in-kernel, we also print out the stack and code at the 301 * When in-kernel, we also print out the stack and code at the
323 * time of the fault.. 302 * time of the fault..
324 */ 303 */
325 if (in_kernel) { 304 if (!user_mode_vm(regs)) {
326 u8 *eip; 305 u8 *eip;
327 unsigned int code_prologue = code_bytes * 43 / 64; 306 unsigned int code_prologue = code_bytes * 43 / 64;
328 unsigned int code_len = code_bytes; 307 unsigned int code_len = code_bytes;
329 unsigned char c; 308 unsigned char c;
330 309
331 printk("\n" KERN_EMERG "Stack: "); 310 printk("\n" KERN_EMERG "Stack: ");
332 show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG); 311 show_stack_log_lvl(NULL, regs, &regs->esp, KERN_EMERG);
333 312
334 printk(KERN_EMERG "Code: "); 313 printk(KERN_EMERG "Code: ");
335 314
@@ -374,11 +353,11 @@ int is_valid_bugaddr(unsigned long eip)
374void die(const char * str, struct pt_regs * regs, long err) 353void die(const char * str, struct pt_regs * regs, long err)
375{ 354{
376 static struct { 355 static struct {
377 spinlock_t lock; 356 raw_spinlock_t lock;
378 u32 lock_owner; 357 u32 lock_owner;
379 int lock_owner_depth; 358 int lock_owner_depth;
380 } die = { 359 } die = {
381 .lock = __SPIN_LOCK_UNLOCKED(die.lock), 360 .lock = __RAW_SPIN_LOCK_UNLOCKED,
382 .lock_owner = -1, 361 .lock_owner = -1,
383 .lock_owner_depth = 0 362 .lock_owner_depth = 0
384 }; 363 };
@@ -389,13 +368,14 @@ void die(const char * str, struct pt_regs * regs, long err)
389 368
390 if (die.lock_owner != raw_smp_processor_id()) { 369 if (die.lock_owner != raw_smp_processor_id()) {
391 console_verbose(); 370 console_verbose();
392 spin_lock_irqsave(&die.lock, flags); 371 __raw_spin_lock(&die.lock);
372 raw_local_save_flags(flags);
393 die.lock_owner = smp_processor_id(); 373 die.lock_owner = smp_processor_id();
394 die.lock_owner_depth = 0; 374 die.lock_owner_depth = 0;
395 bust_spinlocks(1); 375 bust_spinlocks(1);
396 } 376 }
397 else 377 else
398 local_save_flags(flags); 378 raw_local_save_flags(flags);
399 379
400 if (++die.lock_owner_depth < 3) { 380 if (++die.lock_owner_depth < 3) {
401 unsigned long esp; 381 unsigned long esp;
@@ -439,7 +419,8 @@ void die(const char * str, struct pt_regs * regs, long err)
439 bust_spinlocks(0); 419 bust_spinlocks(0);
440 die.lock_owner = -1; 420 die.lock_owner = -1;
441 add_taint(TAINT_DIE); 421 add_taint(TAINT_DIE);
442 spin_unlock_irqrestore(&die.lock, flags); 422 __raw_spin_unlock(&die.lock);
423 raw_local_irq_restore(flags);
443 424
444 if (!regs) 425 if (!regs)
445 return; 426 return;
@@ -622,7 +603,7 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs,
622 printk_ratelimit()) 603 printk_ratelimit())
623 printk(KERN_INFO 604 printk(KERN_INFO
624 "%s[%d] general protection eip:%lx esp:%lx error:%lx\n", 605 "%s[%d] general protection eip:%lx esp:%lx error:%lx\n",
625 current->comm, current->pid, 606 current->comm, task_pid_nr(current),
626 regs->eip, regs->esp, error_code); 607 regs->eip, regs->esp, error_code);
627 608
628 force_sig(SIGSEGV, current); 609 force_sig(SIGSEGV, current);
@@ -1142,6 +1123,8 @@ static void __init set_task_gate(unsigned int n, unsigned int gdt_entry)
1142 1123
1143void __init trap_init(void) 1124void __init trap_init(void)
1144{ 1125{
1126 int i;
1127
1145#ifdef CONFIG_EISA 1128#ifdef CONFIG_EISA
1146 void __iomem *p = ioremap(0x0FFFD9, 4); 1129 void __iomem *p = ioremap(0x0FFFD9, 4);
1147 if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) { 1130 if (readl(p) == 'E'+('I'<<8)+('S'<<16)+('A'<<24)) {
@@ -1201,6 +1184,11 @@ void __init trap_init(void)
1201 1184
1202 set_system_gate(SYSCALL_VECTOR,&system_call); 1185 set_system_gate(SYSCALL_VECTOR,&system_call);
1203 1186
1187 /* Reserve all the builtin and the syscall vector. */
1188 for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++)
1189 set_bit(i, used_vectors);
1190 set_bit(SYSCALL_VECTOR, used_vectors);
1191
1204 /* 1192 /*
1205 * Should be a barrier for any external CPU state. 1193 * Should be a barrier for any external CPU state.
1206 */ 1194 */
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index b4a9b3db1994..d0c2bc7ab2ec 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -201,7 +201,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
201#define MSG(txt) ops->warning(data, txt) 201#define MSG(txt) ops->warning(data, txt)
202 202
203/* 203/*
204 * x86-64 can have upto three kernel stacks: 204 * x86-64 can have up to three kernel stacks:
205 * process stack 205 * process stack
206 * interrupt stack 206 * interrupt stack
207 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack 207 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
@@ -462,7 +462,7 @@ void out_of_line_bug(void)
462EXPORT_SYMBOL(out_of_line_bug); 462EXPORT_SYMBOL(out_of_line_bug);
463#endif 463#endif
464 464
465static DEFINE_SPINLOCK(die_lock); 465static raw_spinlock_t die_lock = __RAW_SPIN_LOCK_UNLOCKED;
466static int die_owner = -1; 466static int die_owner = -1;
467static unsigned int die_nest_count; 467static unsigned int die_nest_count;
468 468
@@ -474,13 +474,13 @@ unsigned __kprobes long oops_begin(void)
474 oops_enter(); 474 oops_enter();
475 475
476 /* racy, but better than risking deadlock. */ 476 /* racy, but better than risking deadlock. */
477 local_irq_save(flags); 477 raw_local_irq_save(flags);
478 cpu = smp_processor_id(); 478 cpu = smp_processor_id();
479 if (!spin_trylock(&die_lock)) { 479 if (!__raw_spin_trylock(&die_lock)) {
480 if (cpu == die_owner) 480 if (cpu == die_owner)
481 /* nested oops. should stop eventually */; 481 /* nested oops. should stop eventually */;
482 else 482 else
483 spin_lock(&die_lock); 483 __raw_spin_lock(&die_lock);
484 } 484 }
485 die_nest_count++; 485 die_nest_count++;
486 die_owner = cpu; 486 die_owner = cpu;
@@ -494,12 +494,10 @@ void __kprobes oops_end(unsigned long flags)
494 die_owner = -1; 494 die_owner = -1;
495 bust_spinlocks(0); 495 bust_spinlocks(0);
496 die_nest_count--; 496 die_nest_count--;
497 if (die_nest_count) 497 if (!die_nest_count)
498 /* We still own the lock */
499 local_irq_restore(flags);
500 else
501 /* Nest count reaches zero, release the lock. */ 498 /* Nest count reaches zero, release the lock. */
502 spin_unlock_irqrestore(&die_lock, flags); 499 __raw_spin_unlock(&die_lock);
500 raw_local_irq_restore(flags);
503 if (panic_on_oops) 501 if (panic_on_oops)
504 panic("Fatal exception"); 502 panic("Fatal exception");
505 oops_exit(); 503 oops_exit();
diff --git a/arch/x86/kernel/tsc_32.c b/arch/x86/kernel/tsc_32.c
index e87a3939ed40..d78444c788a3 100644
--- a/arch/x86/kernel/tsc_32.c
+++ b/arch/x86/kernel/tsc_32.c
@@ -59,7 +59,7 @@ int check_tsc_unstable(void)
59} 59}
60EXPORT_SYMBOL_GPL(check_tsc_unstable); 60EXPORT_SYMBOL_GPL(check_tsc_unstable);
61 61
62/* Accellerators for sched_clock() 62/* Accelerators for sched_clock()
63 * convert from cycles(64bits) => nanoseconds (64bits) 63 * convert from cycles(64bits) => nanoseconds (64bits)
64 * basic equation: 64 * basic equation:
65 * ns = cycles / (freq / ns_per_sec) 65 * ns = cycles / (freq / ns_per_sec)
@@ -74,7 +74,7 @@ EXPORT_SYMBOL_GPL(check_tsc_unstable);
74 * And since SC is a constant power of two, we can convert the div 74 * And since SC is a constant power of two, we can convert the div
75 * into a shift. 75 * into a shift.
76 * 76 *
77 * We can use khz divisor instead of mhz to keep a better percision, since 77 * We can use khz divisor instead of mhz to keep a better precision, since
78 * cyc2ns_scale is limited to 10^6 * 2^10, which fits in 32 bits. 78 * cyc2ns_scale is limited to 10^6 * 2^10, which fits in 32 bits.
79 * (mathieu.desnoyers@polymtl.ca) 79 * (mathieu.desnoyers@polymtl.ca)
80 * 80 *
@@ -181,8 +181,8 @@ int recalibrate_cpu_khz(void)
181 if (cpu_has_tsc) { 181 if (cpu_has_tsc) {
182 cpu_khz = calculate_cpu_khz(); 182 cpu_khz = calculate_cpu_khz();
183 tsc_khz = cpu_khz; 183 tsc_khz = cpu_khz;
184 cpu_data[0].loops_per_jiffy = 184 cpu_data(0).loops_per_jiffy =
185 cpufreq_scale(cpu_data[0].loops_per_jiffy, 185 cpufreq_scale(cpu_data(0).loops_per_jiffy,
186 cpu_khz_old, cpu_khz); 186 cpu_khz_old, cpu_khz);
187 return 0; 187 return 0;
188 } else 188 } else
@@ -215,7 +215,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
215 return 0; 215 return 0;
216 } 216 }
217 ref_freq = freq->old; 217 ref_freq = freq->old;
218 loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy; 218 loops_per_jiffy_ref = cpu_data(freq->cpu).loops_per_jiffy;
219 cpu_khz_ref = cpu_khz; 219 cpu_khz_ref = cpu_khz;
220 } 220 }
221 221
@@ -223,7 +223,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
223 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) || 223 (val == CPUFREQ_POSTCHANGE && freq->old > freq->new) ||
224 (val == CPUFREQ_RESUMECHANGE)) { 224 (val == CPUFREQ_RESUMECHANGE)) {
225 if (!(freq->flags & CPUFREQ_CONST_LOOPS)) 225 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
226 cpu_data[freq->cpu].loops_per_jiffy = 226 cpu_data(freq->cpu).loops_per_jiffy =
227 cpufreq_scale(loops_per_jiffy_ref, 227 cpufreq_scale(loops_per_jiffy_ref,
228 ref_freq, freq->new); 228 ref_freq, freq->new);
229 229
diff --git a/arch/x86/kernel/tsc_64.c b/arch/x86/kernel/tsc_64.c
index 9f22e542c374..9c70af45b42b 100644
--- a/arch/x86/kernel/tsc_64.c
+++ b/arch/x86/kernel/tsc_64.c
@@ -73,13 +73,13 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
73 struct cpufreq_freqs *freq = data; 73 struct cpufreq_freqs *freq = data;
74 unsigned long *lpj, dummy; 74 unsigned long *lpj, dummy;
75 75
76 if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC)) 76 if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC))
77 return 0; 77 return 0;
78 78
79 lpj = &dummy; 79 lpj = &dummy;
80 if (!(freq->flags & CPUFREQ_CONST_LOOPS)) 80 if (!(freq->flags & CPUFREQ_CONST_LOOPS))
81#ifdef CONFIG_SMP 81#ifdef CONFIG_SMP
82 lpj = &cpu_data[freq->cpu].loops_per_jiffy; 82 lpj = &cpu_data(freq->cpu).loops_per_jiffy;
83#else 83#else
84 lpj = &boot_cpu_data.loops_per_jiffy; 84 lpj = &boot_cpu_data.loops_per_jiffy;
85#endif 85#endif
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 8a67e282cb5e..ad4005c6d4a1 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -48,12 +48,12 @@
48 ({unsigned long v; \ 48 ({unsigned long v; \
49 extern char __vsyscall_0; \ 49 extern char __vsyscall_0; \
50 asm("" : "=r" (v) : "0" (x)); \ 50 asm("" : "=r" (v) : "0" (x)); \
51 ((v - VSYSCALL_FIRST_PAGE) + __pa_symbol(&__vsyscall_0)); }) 51 ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); })
52 52
53/* 53/*
54 * vsyscall_gtod_data contains data that is : 54 * vsyscall_gtod_data contains data that is :
55 * - readonly from vsyscalls 55 * - readonly from vsyscalls
56 * - writen by timer interrupt or systcl (/proc/sys/kernel/vsyscall64) 56 * - written by timer interrupt or systcl (/proc/sys/kernel/vsyscall64)
57 * Try to keep this structure as small as possible to avoid cache line ping pongs 57 * Try to keep this structure as small as possible to avoid cache line ping pongs
58 */ 58 */
59int __vgetcpu_mode __section_vgetcpu_mode; 59int __vgetcpu_mode __section_vgetcpu_mode;
@@ -64,6 +64,16 @@ struct vsyscall_gtod_data __vsyscall_gtod_data __section_vsyscall_gtod_data =
64 .sysctl_enabled = 1, 64 .sysctl_enabled = 1,
65}; 65};
66 66
67void update_vsyscall_tz(void)
68{
69 unsigned long flags;
70
71 write_seqlock_irqsave(&vsyscall_gtod_data.lock, flags);
72 /* sys_tz has changed */
73 vsyscall_gtod_data.sys_tz = sys_tz;
74 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
75}
76
67void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) 77void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
68{ 78{
69 unsigned long flags; 79 unsigned long flags;
@@ -77,7 +87,6 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
77 vsyscall_gtod_data.clock.shift = clock->shift; 87 vsyscall_gtod_data.clock.shift = clock->shift;
78 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; 88 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
79 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; 89 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
80 vsyscall_gtod_data.sys_tz = sys_tz;
81 vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; 90 vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic;
82 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); 91 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
83} 92}
@@ -163,7 +172,7 @@ time_t __vsyscall(1) vtime(time_t *t)
163 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) 172 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled))
164 return time_syscall(t); 173 return time_syscall(t);
165 174
166 vgettimeofday(&tv, 0); 175 vgettimeofday(&tv, NULL);
167 result = tv.tv_sec; 176 result = tv.tv_sec;
168 if (t) 177 if (t)
169 *t = result; 178 *t = result;
@@ -257,18 +266,10 @@ out:
257 return ret; 266 return ret;
258} 267}
259 268
260static int vsyscall_sysctl_nostrat(ctl_table *t, int __user *name, int nlen,
261 void __user *oldval, size_t __user *oldlenp,
262 void __user *newval, size_t newlen)
263{
264 return -ENOSYS;
265}
266
267static ctl_table kernel_table2[] = { 269static ctl_table kernel_table2[] = {
268 { .ctl_name = 99, .procname = "vsyscall64", 270 { .procname = "vsyscall64",
269 .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int), 271 .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int),
270 .mode = 0644, 272 .mode = 0644,
271 .strategy = vsyscall_sysctl_nostrat,
272 .proc_handler = vsyscall_sysctl_change }, 273 .proc_handler = vsyscall_sysctl_change },
273 {} 274 {}
274}; 275};
@@ -290,7 +291,7 @@ static void __cpuinit vsyscall_set_cpu(int cpu)
290#ifdef CONFIG_NUMA 291#ifdef CONFIG_NUMA
291 node = cpu_to_node(cpu); 292 node = cpu_to_node(cpu);
292#endif 293#endif
293 if (cpu_has(&cpu_data[cpu], X86_FEATURE_RDTSCP)) 294 if (cpu_has(&cpu_data(cpu), X86_FEATURE_RDTSCP))
294 write_rdtscp_aux((node << 12) | cpu); 295 write_rdtscp_aux((node << 12) | cpu);
295 296
296 /* Store cpu number in limit so that it can be loaded quickly 297 /* Store cpu number in limit so that it can be loaded quickly
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c
index f6edb11364df..952e7a89c2ac 100644
--- a/arch/x86/lib/delay_32.c
+++ b/arch/x86/lib/delay_32.c
@@ -82,7 +82,7 @@ inline void __const_udelay(unsigned long xloops)
82 __asm__("mull %0" 82 __asm__("mull %0"
83 :"=d" (xloops), "=&a" (d0) 83 :"=d" (xloops), "=&a" (d0)
84 :"1" (xloops), "0" 84 :"1" (xloops), "0"
85 (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4))); 85 (cpu_data(raw_smp_processor_id()).loops_per_jiffy * (HZ/4)));
86 86
87 __delay(++xloops); 87 __delay(++xloops);
88} 88}
diff --git a/arch/x86/lib/delay_64.c b/arch/x86/lib/delay_64.c
index 2dbebd308347..0ebbfb9e7c7f 100644
--- a/arch/x86/lib/delay_64.c
+++ b/arch/x86/lib/delay_64.c
@@ -40,7 +40,8 @@ EXPORT_SYMBOL(__delay);
40 40
41inline void __const_udelay(unsigned long xloops) 41inline void __const_udelay(unsigned long xloops)
42{ 42{
43 __delay(((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) + 1); 43 __delay(((xloops * HZ *
44 cpu_data(raw_smp_processor_id()).loops_per_jiffy) >> 32) + 1);
44} 45}
45EXPORT_SYMBOL(__const_udelay); 46EXPORT_SYMBOL(__const_udelay);
46 47
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index 9f38b12b4af1..8bab2b2efaff 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -748,7 +748,7 @@ survive:
748 retval = get_user_pages(current, current->mm, 748 retval = get_user_pages(current, current->mm,
749 (unsigned long )to, 1, 1, 0, &pg, NULL); 749 (unsigned long )to, 1, 1, 0, &pg, NULL);
750 750
751 if (retval == -ENOMEM && is_init(current)) { 751 if (retval == -ENOMEM && is_global_init(current)) {
752 up_read(&current->mm->mmap_sem); 752 up_read(&current->mm->mmap_sem);
753 congestion_wait(WRITE, HZ/50); 753 congestion_wait(WRITE, HZ/50);
754 goto survive; 754 goto survive;
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c
index 3f08010f3517..0c28a071824c 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -108,7 +108,7 @@ void __init time_init_hook(void)
108 * mca_nmi_hook - hook into MCA specific NMI chain 108 * mca_nmi_hook - hook into MCA specific NMI chain
109 * 109 *
110 * Description: 110 * Description:
111 * The MCA (Microchannel Arcitecture) has an NMI chain for NMI sources 111 * The MCA (Microchannel Architecture) has an NMI chain for NMI sources
112 * along the MCA bus. Use this to hook into that chain if you will need 112 * along the MCA bus. Use this to hook into that chain if you will need
113 * it. 113 * it.
114 **/ 114 **/
@@ -131,7 +131,7 @@ static __init int no_ipi_broadcast(char *str)
131 return 1; 131 return 1;
132} 132}
133 133
134__setup("no_ipi_broadcast", no_ipi_broadcast); 134__setup("no_ipi_broadcast=", no_ipi_broadcast);
135 135
136static int __init print_ipi_mode(void) 136static int __init print_ipi_mode(void)
137{ 137{
diff --git a/arch/x86/mach-generic/default.c b/arch/x86/mach-generic/default.c
index 8685208d8512..1af0cc7648f0 100644
--- a/arch/x86/mach-generic/default.c
+++ b/arch/x86/mach-generic/default.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Default generic APIC driver. This handles upto 8 CPUs. 2 * Default generic APIC driver. This handles up to 8 CPUs.
3 */ 3 */
4#define APIC_DEFINITION 1 4#define APIC_DEFINITION 1
5#include <linux/threads.h> 5#include <linux/threads.h>
diff --git a/arch/x86/mach-generic/probe.c b/arch/x86/mach-generic/probe.c
index 4121d1551800..f410d3cb5659 100644
--- a/arch/x86/mach-generic/probe.c
+++ b/arch/x86/mach-generic/probe.c
@@ -56,7 +56,7 @@ void __init generic_bigsmp_probe(void)
56 /* 56 /*
57 * This routine is used to switch to bigsmp mode when 57 * This routine is used to switch to bigsmp mode when
58 * - There is no apic= option specified by the user 58 * - There is no apic= option specified by the user
59 * - generic_apic_probe() has choosen apic_default as the sub_arch 59 * - generic_apic_probe() has chosen apic_default as the sub_arch
60 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support 60 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
61 */ 61 */
62 62
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index e4928aa6bdfb..361ac5107b33 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -36,8 +36,8 @@ static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = { [0 ... NR
36 36
37/* per CPU data structure (for /proc/cpuinfo et al), visible externally 37/* per CPU data structure (for /proc/cpuinfo et al), visible externally
38 * indexed physically */ 38 * indexed physically */
39struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; 39DEFINE_PER_CPU(cpuinfo_x86, cpu_info) __cacheline_aligned;
40EXPORT_SYMBOL(cpu_data); 40EXPORT_PER_CPU_SYMBOL(cpu_info);
41 41
42/* physical ID of the CPU used to boot the system */ 42/* physical ID of the CPU used to boot the system */
43unsigned char boot_cpu_id; 43unsigned char boot_cpu_id;
@@ -389,7 +389,7 @@ find_smp_config(void)
389 389
390 /* The boot CPU must be extended */ 390 /* The boot CPU must be extended */
391 voyager_extended_vic_processors = 1<<boot_cpu_id; 391 voyager_extended_vic_processors = 1<<boot_cpu_id;
392 /* initially, all of the first 8 cpu's can boot */ 392 /* initially, all of the first 8 CPUs can boot */
393 voyager_allowed_boot_processors = 0xff; 393 voyager_allowed_boot_processors = 0xff;
394 /* set up everything for just this CPU, we can alter 394 /* set up everything for just this CPU, we can alter
395 * this as we start the other CPUs later */ 395 * this as we start the other CPUs later */
@@ -430,7 +430,7 @@ find_smp_config(void)
430void __init 430void __init
431smp_store_cpu_info(int id) 431smp_store_cpu_info(int id)
432{ 432{
433 struct cpuinfo_x86 *c=&cpu_data[id]; 433 struct cpuinfo_x86 *c = &cpu_data(id);
434 434
435 *c = boot_cpu_data; 435 *c = boot_cpu_data;
436 436
@@ -634,7 +634,7 @@ do_boot_cpu(__u8 cpu)
634 cpu, smp_processor_id())); 634 cpu, smp_processor_id()));
635 635
636 printk("CPU%d: ", cpu); 636 printk("CPU%d: ", cpu);
637 print_cpu_info(&cpu_data[cpu]); 637 print_cpu_info(&cpu_data(cpu));
638 wmb(); 638 wmb();
639 cpu_set(cpu, cpu_callout_map); 639 cpu_set(cpu, cpu_callout_map);
640 cpu_set(cpu, cpu_present_map); 640 cpu_set(cpu, cpu_present_map);
@@ -683,7 +683,7 @@ smp_boot_cpus(void)
683 */ 683 */
684 smp_store_cpu_info(boot_cpu_id); 684 smp_store_cpu_info(boot_cpu_id);
685 printk("CPU%d: ", boot_cpu_id); 685 printk("CPU%d: ", boot_cpu_id);
686 print_cpu_info(&cpu_data[boot_cpu_id]); 686 print_cpu_info(&cpu_data(boot_cpu_id));
687 687
688 if(is_cpu_quad()) { 688 if(is_cpu_quad()) {
689 /* booting on a Quad CPU */ 689 /* booting on a Quad CPU */
@@ -714,7 +714,7 @@ smp_boot_cpus(void)
714 unsigned long bogosum = 0; 714 unsigned long bogosum = 0;
715 for (i = 0; i < NR_CPUS; i++) 715 for (i = 0; i < NR_CPUS; i++)
716 if (cpu_isset(i, cpu_online_map)) 716 if (cpu_isset(i, cpu_online_map))
717 bogosum += cpu_data[i].loops_per_jiffy; 717 bogosum += cpu_data(i).loops_per_jiffy;
718 printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", 718 printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
719 cpucount+1, 719 cpucount+1,
720 bogosum/(500000/HZ), 720 bogosum/(500000/HZ),
@@ -1010,7 +1010,7 @@ static struct call_data_struct * call_data;
1010 1010
1011/* execute a thread on a new CPU. The function to be called must be 1011/* execute a thread on a new CPU. The function to be called must be
1012 * previously set up. This is used to schedule a function for 1012 * previously set up. This is used to schedule a function for
1013 * execution on all CPU's - set up the function then broadcast a 1013 * execution on all CPUs - set up the function then broadcast a
1014 * function_interrupt CPI to come here on each CPU */ 1014 * function_interrupt CPI to come here on each CPU */
1015static void 1015static void
1016smp_call_function_interrupt(void) 1016smp_call_function_interrupt(void)
@@ -1095,7 +1095,7 @@ voyager_smp_call_function_mask (cpumask_t cpumask,
1095 * CPI here. We don't use this actually for counting so losing 1095 * CPI here. We don't use this actually for counting so losing
1096 * ticks doesn't matter 1096 * ticks doesn't matter
1097 * 1097 *
1098 * FIXME: For those CPU's which actually have a local APIC, we could 1098 * FIXME: For those CPUs which actually have a local APIC, we could
1099 * try to use it to trigger this interrupt instead of having to 1099 * try to use it to trigger this interrupt instead of having to
1100 * broadcast the timer tick. Unfortunately, all my pentium DYADs have 1100 * broadcast the timer tick. Unfortunately, all my pentium DYADs have
1101 * no local APIC, so I can't do this 1101 * no local APIC, so I can't do this
@@ -1287,7 +1287,7 @@ smp_local_timer_interrupt(void)
1287 1287
1288 /* 1288 /*
1289 * We take the 'long' return path, and there every subsystem 1289 * We take the 'long' return path, and there every subsystem
1290 * grabs the apropriate locks (kernel lock/ irq lock). 1290 * grabs the appropriate locks (kernel lock/ irq lock).
1291 * 1291 *
1292 * we might want to decouple profiling from the 'long path', 1292 * we might want to decouple profiling from the 'long path',
1293 * and do the profiling totally in assembly. 1293 * and do the profiling totally in assembly.
@@ -1759,7 +1759,7 @@ set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
1759 real_mask = cpus_addr(mask)[0] & voyager_extended_vic_processors; 1759 real_mask = cpus_addr(mask)[0] & voyager_extended_vic_processors;
1760 1760
1761 if(cpus_addr(mask)[0] == 0) 1761 if(cpus_addr(mask)[0] == 0)
1762 /* can't have no cpu's to accept the interrupt -- extremely 1762 /* can't have no CPUs to accept the interrupt -- extremely
1763 * bad things will happen */ 1763 * bad things will happen */
1764 return; 1764 return;
1765 1765
@@ -1791,7 +1791,7 @@ set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
1791 } 1791 }
1792 /* this is magic, we now have the correct affinity maps, so 1792 /* this is magic, we now have the correct affinity maps, so
1793 * enable the interrupt. This will send an enable CPI to 1793 * enable the interrupt. This will send an enable CPI to
1794 * those cpu's who need to enable it in their local masks, 1794 * those CPUs who need to enable it in their local masks,
1795 * causing them to correct for the new affinity . If the 1795 * causing them to correct for the new affinity . If the
1796 * interrupt is currently globally disabled, it will simply be 1796 * interrupt is currently globally disabled, it will simply be
1797 * disabled again as it comes in (voyager lazy disable). If 1797 * disabled again as it comes in (voyager lazy disable). If
diff --git a/arch/x86/mach-voyager/voyager_thread.c b/arch/x86/mach-voyager/voyager_thread.c
index f9d595338159..50f9366c411e 100644
--- a/arch/x86/mach-voyager/voyager_thread.c
+++ b/arch/x86/mach-voyager/voyager_thread.c
@@ -64,7 +64,7 @@ check_from_kernel(void)
64{ 64{
65 if(voyager_status.switch_off) { 65 if(voyager_status.switch_off) {
66 66
67 /* FIXME: This should be configureable via proc */ 67 /* FIXME: This should be configurable via proc */
68 execute("umask 600; echo 0 > /etc/initrunlvl; kill -HUP 1"); 68 execute("umask 600; echo 0 > /etc/initrunlvl; kill -HUP 1");
69 } else if(voyager_status.power_fail) { 69 } else if(voyager_status.power_fail) {
70 VDEBUG(("Voyager daemon detected AC power failure\n")); 70 VDEBUG(("Voyager daemon detected AC power failure\n"));
diff --git a/arch/x86/mm/boot_ioremap_32.c b/arch/x86/mm/boot_ioremap_32.c
index 4de95a17a7d4..f14da2a53ece 100644
--- a/arch/x86/mm/boot_ioremap_32.c
+++ b/arch/x86/mm/boot_ioremap_32.c
@@ -10,7 +10,7 @@
10 10
11/* 11/*
12 * We need to use the 2-level pagetable functions, but CONFIG_X86_PAE 12 * We need to use the 2-level pagetable functions, but CONFIG_X86_PAE
13 * keeps that from happenning. If anyone has a better way, I'm listening. 13 * keeps that from happening. If anyone has a better way, I'm listening.
14 * 14 *
15 * boot_pte_t is defined only if this all works correctly 15 * boot_pte_t is defined only if this all works correctly
16 */ 16 */
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 13893772cc48..fe608a45ffb6 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -273,7 +273,7 @@ unsigned long __init setup_memory(void)
273 * When mapping a NUMA machine we allocate the node_mem_map arrays 273 * When mapping a NUMA machine we allocate the node_mem_map arrays
274 * from node local memory. They are then mapped directly into KVA 274 * from node local memory. They are then mapped directly into KVA
275 * between zone normal and vmalloc space. Calculate the size of 275 * between zone normal and vmalloc space. Calculate the size of
276 * this space and use it to adjust the boundry between ZONE_NORMAL 276 * this space and use it to adjust the boundary between ZONE_NORMAL
277 * and ZONE_HIGHMEM. 277 * and ZONE_HIGHMEM.
278 */ 278 */
279 find_max_pfn(); 279 find_max_pfn();
diff --git a/arch/x86/mm/fault_32.c b/arch/x86/mm/fault_32.c
index 6555c3d14371..503dfc05111b 100644
--- a/arch/x86/mm/fault_32.c
+++ b/arch/x86/mm/fault_32.c
@@ -354,7 +354,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
354 354
355 /* When running in the kernel we expect faults to occur only to 355 /* When running in the kernel we expect faults to occur only to
356 * addresses in user space. All other faults represent errors in the 356 * addresses in user space. All other faults represent errors in the
357 * kernel and should generate an OOPS. Unfortunatly, in the case of an 357 * kernel and should generate an OOPS. Unfortunately, in the case of an
358 * erroneous fault occurring in a code path which already holds mmap_sem 358 * erroneous fault occurring in a code path which already holds mmap_sem
359 * we will deadlock attempting to validate the fault against the 359 * we will deadlock attempting to validate the fault against the
360 * address space. Luckily the kernel only validly references user 360 * address space. Luckily the kernel only validly references user
@@ -362,7 +362,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
362 * exceptions table. 362 * exceptions table.
363 * 363 *
364 * As the vast majority of faults will be valid we will only perform 364 * As the vast majority of faults will be valid we will only perform
365 * the source reference check when there is a possibilty of a deadlock. 365 * the source reference check when there is a possibility of a deadlock.
366 * Attempt to lock the address space, if we cannot we then validate the 366 * Attempt to lock the address space, if we cannot we then validate the
367 * source. If this is invalid we can skip the address space check, 367 * source. If this is invalid we can skip the address space check,
368 * thus avoiding the deadlock. 368 * thus avoiding the deadlock.
@@ -471,8 +471,8 @@ bad_area_nosemaphore:
471 printk_ratelimit()) { 471 printk_ratelimit()) {
472 printk("%s%s[%d]: segfault at %08lx eip %08lx " 472 printk("%s%s[%d]: segfault at %08lx eip %08lx "
473 "esp %08lx error %lx\n", 473 "esp %08lx error %lx\n",
474 tsk->pid > 1 ? KERN_INFO : KERN_EMERG, 474 task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG,
475 tsk->comm, tsk->pid, address, regs->eip, 475 tsk->comm, task_pid_nr(tsk), address, regs->eip,
476 regs->esp, error_code); 476 regs->esp, error_code);
477 } 477 }
478 tsk->thread.cr2 = address; 478 tsk->thread.cr2 = address;
@@ -564,7 +564,8 @@ no_context:
564 * it's allocated already. 564 * it's allocated already.
565 */ 565 */
566 if ((page >> PAGE_SHIFT) < max_low_pfn 566 if ((page >> PAGE_SHIFT) < max_low_pfn
567 && (page & _PAGE_PRESENT)) { 567 && (page & _PAGE_PRESENT)
568 && !(page & _PAGE_PSE)) {
568 page &= PAGE_MASK; 569 page &= PAGE_MASK;
569 page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT) 570 page = ((__typeof__(page) *) __va(page))[(address >> PAGE_SHIFT)
570 & (PTRS_PER_PTE - 1)]; 571 & (PTRS_PER_PTE - 1)];
@@ -587,7 +588,7 @@ no_context:
587 */ 588 */
588out_of_memory: 589out_of_memory:
589 up_read(&mm->mmap_sem); 590 up_read(&mm->mmap_sem);
590 if (is_init(tsk)) { 591 if (is_global_init(tsk)) {
591 yield(); 592 yield();
592 down_read(&mm->mmap_sem); 593 down_read(&mm->mmap_sem);
593 goto survive; 594 goto survive;
diff --git a/arch/x86/mm/fault_64.c b/arch/x86/mm/fault_64.c
index 5e0e54906c48..644b4f7ece10 100644
--- a/arch/x86/mm/fault_64.c
+++ b/arch/x86/mm/fault_64.c
@@ -169,7 +169,7 @@ void dump_pagetable(unsigned long address)
169 pmd = pmd_offset(pud, address); 169 pmd = pmd_offset(pud, address);
170 if (bad_address(pmd)) goto bad; 170 if (bad_address(pmd)) goto bad;
171 printk("PMD %lx ", pmd_val(*pmd)); 171 printk("PMD %lx ", pmd_val(*pmd));
172 if (!pmd_present(*pmd)) goto ret; 172 if (!pmd_present(*pmd) || pmd_large(*pmd)) goto ret;
173 173
174 pte = pte_offset_kernel(pmd, address); 174 pte = pte_offset_kernel(pmd, address);
175 if (bad_address(pte)) goto bad; 175 if (bad_address(pte)) goto bad;
@@ -285,7 +285,6 @@ static int vmalloc_fault(unsigned long address)
285 return 0; 285 return 0;
286} 286}
287 287
288static int page_fault_trace;
289int show_unhandled_signals = 1; 288int show_unhandled_signals = 1;
290 289
291/* 290/*
@@ -354,10 +353,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
354 if (likely(regs->eflags & X86_EFLAGS_IF)) 353 if (likely(regs->eflags & X86_EFLAGS_IF))
355 local_irq_enable(); 354 local_irq_enable();
356 355
357 if (unlikely(page_fault_trace))
358 printk("pagefault rip:%lx rsp:%lx cs:%lu ss:%lu address %lx error %lx\n",
359 regs->rip,regs->rsp,regs->cs,regs->ss,address,error_code);
360
361 if (unlikely(error_code & PF_RSVD)) 356 if (unlikely(error_code & PF_RSVD))
362 pgtable_bad(address, regs, error_code); 357 pgtable_bad(address, regs, error_code);
363 358
@@ -378,7 +373,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
378 again: 373 again:
379 /* When running in the kernel we expect faults to occur only to 374 /* When running in the kernel we expect faults to occur only to
380 * addresses in user space. All other faults represent errors in the 375 * addresses in user space. All other faults represent errors in the
381 * kernel and should generate an OOPS. Unfortunatly, in the case of an 376 * kernel and should generate an OOPS. Unfortunately, in the case of an
382 * erroneous fault occurring in a code path which already holds mmap_sem 377 * erroneous fault occurring in a code path which already holds mmap_sem
383 * we will deadlock attempting to validate the fault against the 378 * we will deadlock attempting to validate the fault against the
384 * address space. Luckily the kernel only validly references user 379 * address space. Luckily the kernel only validly references user
@@ -386,7 +381,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
386 * exceptions table. 381 * exceptions table.
387 * 382 *
388 * As the vast majority of faults will be valid we will only perform 383 * As the vast majority of faults will be valid we will only perform
389 * the source reference check when there is a possibilty of a deadlock. 384 * the source reference check when there is a possibility of a deadlock.
390 * Attempt to lock the address space, if we cannot we then validate the 385 * Attempt to lock the address space, if we cannot we then validate the
391 * source. If this is invalid we can skip the address space check, 386 * source. If this is invalid we can skip the address space check,
392 * thus avoiding the deadlock. 387 * thus avoiding the deadlock.
@@ -488,7 +483,7 @@ bad_area_nosemaphore:
488 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && 483 if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) &&
489 printk_ratelimit()) { 484 printk_ratelimit()) {
490 printk( 485 printk(
491 "%s%s[%d]: segfault at %016lx rip %016lx rsp %016lx error %lx\n", 486 "%s%s[%d]: segfault at %lx rip %lx rsp %lx error %lx\n",
492 tsk->pid > 1 ? KERN_INFO : KERN_EMERG, 487 tsk->pid > 1 ? KERN_INFO : KERN_EMERG,
493 tsk->comm, tsk->pid, address, regs->rip, 488 tsk->comm, tsk->pid, address, regs->rip,
494 regs->rsp, error_code); 489 regs->rsp, error_code);
@@ -554,7 +549,7 @@ no_context:
554 */ 549 */
555out_of_memory: 550out_of_memory:
556 up_read(&mm->mmap_sem); 551 up_read(&mm->mmap_sem);
557 if (is_init(current)) { 552 if (is_global_init(current)) {
558 yield(); 553 yield();
559 goto again; 554 goto again;
560 } 555 }
@@ -621,10 +616,3 @@ void vmalloc_sync_all(void)
621 BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) == 616 BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) ==
622 (__START_KERNEL & PGDIR_MASK))); 617 (__START_KERNEL & PGDIR_MASK)));
623} 618}
624
625static int __init enable_pagefaulttrace(char *str)
626{
627 page_fault_trace = 1;
628 return 1;
629}
630__setup("pagefaulttrace", enable_pagefaulttrace);
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 5eec5e56d07f..3d6926ba8995 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -612,7 +612,7 @@ void __init init_cpu_to_node(void)
612{ 612{
613 int i; 613 int i;
614 for (i = 0; i < NR_CPUS; i++) { 614 for (i = 0; i < NR_CPUS; i++) {
615 u8 apicid = x86_cpu_to_apicid[i]; 615 u8 apicid = x86_cpu_to_apicid_init[i];
616 if (apicid == BAD_APICID) 616 if (apicid == BAD_APICID)
617 continue; 617 continue;
618 if (apicid_to_node[apicid] == NUMA_NO_NODE) 618 if (apicid_to_node[apicid] == NUMA_NO_NODE)
diff --git a/arch/x86/mm/pageattr_64.c b/arch/x86/mm/pageattr_64.c
index 8a4f65bf956e..c7b7dfe1d405 100644
--- a/arch/x86/mm/pageattr_64.c
+++ b/arch/x86/mm/pageattr_64.c
@@ -230,9 +230,14 @@ void global_flush_tlb(void)
230 struct page *pg, *next; 230 struct page *pg, *next;
231 struct list_head l; 231 struct list_head l;
232 232
233 down_read(&init_mm.mmap_sem); 233 /*
234 * Write-protect the semaphore, to exclude two contexts
235 * doing a list_replace_init() call in parallel and to
236 * exclude new additions to the deferred_pages list:
237 */
238 down_write(&init_mm.mmap_sem);
234 list_replace_init(&deferred_pages, &l); 239 list_replace_init(&deferred_pages, &l);
235 up_read(&init_mm.mmap_sem); 240 up_write(&init_mm.mmap_sem);
236 241
237 flush_map(&l); 242 flush_map(&l);
238 243
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 56089ccc3949..ea85172fc0cc 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -218,7 +218,7 @@ static inline int save_add_info(void) {return 0;}
218/* 218/*
219 * Update nodes_add and decide if to include add are in the zone. 219 * Update nodes_add and decide if to include add are in the zone.
220 * Both SPARSE and RESERVE need nodes_add infomation. 220 * Both SPARSE and RESERVE need nodes_add infomation.
221 * This code supports one contigious hot add area per node. 221 * This code supports one contiguous hot add area per node.
222 */ 222 */
223static int reserve_hotadd(int node, unsigned long start, unsigned long end) 223static int reserve_hotadd(int node, unsigned long start, unsigned long end)
224{ 224{
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index c049ce414f01..0ed046a187f7 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
@@ -13,25 +13,45 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <asm/ptrace.h> 14#include <asm/ptrace.h>
15#include <asm/uaccess.h> 15#include <asm/uaccess.h>
16#include <asm/stacktrace.h>
16 17
17struct frame_head { 18static void backtrace_warning_symbol(void *data, char *msg,
18 struct frame_head * ebp; 19 unsigned long symbol)
19 unsigned long ret; 20{
20} __attribute__((packed)); 21 /* Ignore warnings */
22}
21 23
22static struct frame_head * 24static void backtrace_warning(void *data, char *msg)
23dump_kernel_backtrace(struct frame_head * head)
24{ 25{
25 oprofile_add_trace(head->ret); 26 /* Ignore warnings */
27}
26 28
27 /* frame pointers should strictly progress back up the stack 29static int backtrace_stack(void *data, char *name)
28 * (towards higher addresses) */ 30{
29 if (head >= head->ebp) 31 /* Yes, we want all stacks */
30 return NULL; 32 return 0;
33}
34
35static void backtrace_address(void *data, unsigned long addr)
36{
37 unsigned int *depth = data;
31 38
32 return head->ebp; 39 if ((*depth)--)
40 oprofile_add_trace(addr);
33} 41}
34 42
43static struct stacktrace_ops backtrace_ops = {
44 .warning = backtrace_warning,
45 .warning_symbol = backtrace_warning_symbol,
46 .stack = backtrace_stack,
47 .address = backtrace_address,
48};
49
50struct frame_head {
51 struct frame_head *ebp;
52 unsigned long ret;
53} __attribute__((packed));
54
35static struct frame_head * 55static struct frame_head *
36dump_user_backtrace(struct frame_head * head) 56dump_user_backtrace(struct frame_head * head)
37{ 57{
@@ -53,72 +73,16 @@ dump_user_backtrace(struct frame_head * head)
53 return bufhead[0].ebp; 73 return bufhead[0].ebp;
54} 74}
55 75
56/*
57 * | | /\ Higher addresses
58 * | |
59 * --------------- stack base (address of current_thread_info)
60 * | thread info |
61 * . .
62 * | stack |
63 * --------------- saved regs->ebp value if valid (frame_head address)
64 * . .
65 * --------------- saved regs->rsp value if x86_64
66 * | |
67 * --------------- struct pt_regs * stored on stack if 32-bit
68 * | |
69 * . .
70 * | |
71 * --------------- %esp
72 * | |
73 * | | \/ Lower addresses
74 *
75 * Thus, regs (or regs->rsp for x86_64) <-> stack base restricts the
76 * valid(ish) ebp values. Note: (1) for x86_64, NMI and several other
77 * exceptions use special stacks, maintained by the interrupt stack table
78 * (IST). These stacks are set up in trap_init() in
79 * arch/x86_64/kernel/traps.c. Thus, for x86_64, regs now does not point
80 * to the kernel stack; instead, it points to some location on the NMI
81 * stack. On the other hand, regs->rsp is the stack pointer saved when the
82 * NMI occurred. (2) For 32-bit, regs->esp is not valid because the
83 * processor does not save %esp on the kernel stack when interrupts occur
84 * in the kernel mode.
85 */
86#ifdef CONFIG_FRAME_POINTER
87static int valid_kernel_stack(struct frame_head * head, struct pt_regs * regs)
88{
89 unsigned long headaddr = (unsigned long)head;
90#ifdef CONFIG_X86_64
91 unsigned long stack = (unsigned long)regs->rsp;
92#else
93 unsigned long stack = (unsigned long)regs;
94#endif
95 unsigned long stack_base = (stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE;
96
97 return headaddr > stack && headaddr < stack_base;
98}
99#else
100/* without fp, it's just junk */
101static int valid_kernel_stack(struct frame_head * head, struct pt_regs * regs)
102{
103 return 0;
104}
105#endif
106
107
108void 76void
109x86_backtrace(struct pt_regs * const regs, unsigned int depth) 77x86_backtrace(struct pt_regs * const regs, unsigned int depth)
110{ 78{
111 struct frame_head *head; 79 struct frame_head *head = (struct frame_head *)frame_pointer(regs);
112 80 unsigned long stack = stack_pointer(regs);
113#ifdef CONFIG_X86_64
114 head = (struct frame_head *)regs->rbp;
115#else
116 head = (struct frame_head *)regs->ebp;
117#endif
118 81
119 if (!user_mode_vm(regs)) { 82 if (!user_mode_vm(regs)) {
120 while (depth-- && valid_kernel_stack(head, regs)) 83 if (depth)
121 head = dump_kernel_backtrace(head); 84 dump_trace(NULL, regs, (unsigned long *)stack,
85 &backtrace_ops, &depth);
122 return; 86 return;
123 } 87 }
124 88
diff --git a/arch/x86/oprofile/op_x86_model.h b/arch/x86/oprofile/op_x86_model.h
index abb1aa95b979..45b605fa71d0 100644
--- a/arch/x86/oprofile/op_x86_model.h
+++ b/arch/x86/oprofile/op_x86_model.h
@@ -29,7 +29,7 @@ struct op_msrs {
29struct pt_regs; 29struct pt_regs;
30 30
31/* The model vtable abstracts the differences between 31/* The model vtable abstracts the differences between
32 * various x86 CPU model's perfctr support. 32 * various x86 CPU models' perfctr support.
33 */ 33 */
34struct op_x86_model_spec { 34struct op_x86_model_spec {
35 unsigned int const num_counters; 35 unsigned int const num_counters;
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index c52150fdf82b..88d8f5c0ecb5 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -169,7 +169,7 @@ void eisa_set_level_irq(unsigned int irq)
169} 169}
170 170
171/* 171/*
172 * Common IRQ routing practice: nybbles in config space, 172 * Common IRQ routing practice: nibbles in config space,
173 * offset by some magic constant. 173 * offset by some magic constant.
174 */ 174 */
175static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr) 175static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr)
@@ -585,7 +585,7 @@ static __init int via_router_probe(struct irq_router *r,
585 /* FIXME: We should move some of the quirk fixup stuff here */ 585 /* FIXME: We should move some of the quirk fixup stuff here */
586 586
587 /* 587 /*
588 * work arounds for some buggy BIOSes 588 * workarounds for some buggy BIOSes
589 */ 589 */
590 if (device == PCI_DEVICE_ID_VIA_82C586_0) { 590 if (device == PCI_DEVICE_ID_VIA_82C586_0) {
591 switch(router->device) { 591 switch(router->device) {
diff --git a/arch/x86_64/.gitignore b/arch/x86_64/.gitignore
new file mode 100644
index 000000000000..36ef4c374d25
--- /dev/null
+++ b/arch/x86_64/.gitignore
@@ -0,0 +1 @@
boot
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 43fafe9e9c08..aab25f3ba3ce 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -716,9 +716,16 @@ menu "Power management options"
716 716
717source kernel/power/Kconfig 717source kernel/power/Kconfig
718 718
719config ARCH_HIBERNATION_HEADER
720 bool
721 depends on HIBERNATION
722 default y
723
719source "drivers/acpi/Kconfig" 724source "drivers/acpi/Kconfig"
720 725
721source "arch/x86/kernel/cpufreq/Kconfig" 726source "arch/x86/kernel/cpu/cpufreq/Kconfig_64"
727
728source "drivers/cpuidle/Kconfig"
722 729
723endmenu 730endmenu
724 731
@@ -761,9 +768,9 @@ source "fs/Kconfig.binfmt"
761config IA32_EMULATION 768config IA32_EMULATION
762 bool "IA32 Emulation" 769 bool "IA32 Emulation"
763 help 770 help
764 Include code to run 32-bit programs under a 64-bit kernel. You should likely 771 Include code to run 32-bit programs under a 64-bit kernel. You should
765 turn this on, unless you're 100% sure that you don't have any 32-bit programs 772 likely turn this on, unless you're 100% sure that you don't have any
766 left. 773 32-bit programs left.
767 774
768config IA32_AOUT 775config IA32_AOUT
769 tristate "IA32 a.out support" 776 tristate "IA32 a.out support"
@@ -794,21 +801,6 @@ source "drivers/firmware/Kconfig"
794 801
795source fs/Kconfig 802source fs/Kconfig
796 803
797menu "Instrumentation Support"
798
799source "arch/x86/oprofile/Kconfig"
800
801config KPROBES
802 bool "Kprobes"
803 depends on KALLSYMS && MODULES
804 help
805 Kprobes allows you to trap at almost any kernel address and
806 execute a callback function. register_kprobe() establishes
807 a probepoint and specifies the callback. Kprobes is useful
808 for kernel debugging, non-intrusive instrumentation and testing.
809 If in doubt, say "N".
810endmenu
811
812source "arch/x86_64/Kconfig.debug" 804source "arch/x86_64/Kconfig.debug"
813 805
814source "security/Kconfig" 806source "security/Kconfig"
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 03e1ede27b85..6d89ab762ffc 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -74,7 +74,7 @@ KBUILD_CFLAGS += $(cflags-y)
74CFLAGS_KERNEL += $(cflags-kernel-y) 74CFLAGS_KERNEL += $(cflags-kernel-y)
75KBUILD_AFLAGS += -m64 75KBUILD_AFLAGS += -m64
76 76
77head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task_64.o 77head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task.o
78 78
79libs-y += arch/x86/lib/ 79libs-y += arch/x86/lib/
80core-y += arch/x86/kernel/ \ 80core-y += arch/x86/kernel/ \
@@ -97,9 +97,9 @@ BOOTIMAGE := arch/x86/boot/bzImage
97KBUILD_IMAGE := $(BOOTIMAGE) 97KBUILD_IMAGE := $(BOOTIMAGE)
98 98
99bzImage: vmlinux 99bzImage: vmlinux
100 $(Q)mkdir -p $(objtree)/arch/x86_64/boot
101 $(Q)ln -fsn $(objtree)/arch/x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage
102 $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE) 100 $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE)
101 $(Q)mkdir -p $(objtree)/arch/x86_64/boot
102 $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage
103 103
104bzlilo: vmlinux 104bzlilo: vmlinux
105 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo 105 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 7fbb44bea37f..85ffbb491490 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -251,6 +251,8 @@ config EMBEDDED_RAMDISK_IMAGE
251 provide one yourself. 251 provide one yourself.
252endmenu 252endmenu
253 253
254source "kernel/Kconfig.instrumentation"
255
254source "arch/xtensa/Kconfig.debug" 256source "arch/xtensa/Kconfig.debug"
255 257
256source "security/Kconfig" 258source "security/Kconfig"
diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile
index 9c5185f605b6..40aa55b485be 100644
--- a/arch/xtensa/boot/Makefile
+++ b/arch/xtensa/boot/Makefile
@@ -8,7 +8,8 @@
8# 8#
9 9
10 10
11EXTRA_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include 11# KBUILD_CFLAGS used when building rest of boot (takes effect recursively)
12KBUILD_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
12HOSTFLAGS += -Iarch/$(ARCH)/boot/include 13HOSTFLAGS += -Iarch/$(ARCH)/boot/include
13 14
14BIG_ENDIAN := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#") 15BIG_ENDIAN := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 8be99c777d9d..397bcd6ad08d 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -176,7 +176,7 @@ void do_unhandled(struct pt_regs *regs, unsigned long exccause)
176 printk("Caught unhandled exception in '%s' " 176 printk("Caught unhandled exception in '%s' "
177 "(pid = %d, pc = %#010lx) - should not happen\n" 177 "(pid = %d, pc = %#010lx) - should not happen\n"
178 "\tEXCCAUSE is %ld\n", 178 "\tEXCCAUSE is %ld\n",
179 current->comm, current->pid, regs->pc, exccause); 179 current->comm, task_pid_nr(current), regs->pc, exccause);
180 force_sig(SIGILL, current); 180 force_sig(SIGILL, current);
181} 181}
182 182
@@ -228,7 +228,7 @@ do_illegal_instruction(struct pt_regs *regs)
228 /* If in user mode, send SIGILL signal to current process. */ 228 /* If in user mode, send SIGILL signal to current process. */
229 229
230 printk("Illegal Instruction in '%s' (pid = %d, pc = %#010lx)\n", 230 printk("Illegal Instruction in '%s' (pid = %d, pc = %#010lx)\n",
231 current->comm, current->pid, regs->pc); 231 current->comm, task_pid_nr(current), regs->pc);
232 force_sig(SIGILL, current); 232 force_sig(SIGILL, current);
233} 233}
234 234
@@ -254,7 +254,7 @@ do_unaligned_user (struct pt_regs *regs)
254 current->thread.error_code = -3; 254 current->thread.error_code = -3;
255 printk("Unaligned memory access to %08lx in '%s' " 255 printk("Unaligned memory access to %08lx in '%s' "
256 "(pid = %d, pc = %#010lx)\n", 256 "(pid = %d, pc = %#010lx)\n",
257 regs->excvaddr, current->comm, current->pid, regs->pc); 257 regs->excvaddr, current->comm, task_pid_nr(current), regs->pc);
258 info.si_signo = SIGBUS; 258 info.si_signo = SIGBUS;
259 info.si_errno = 0; 259 info.si_errno = 0;
260 info.si_code = BUS_ADRALN; 260 info.si_code = BUS_ADRALN;
diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c
index 2f842859948f..33f366be323f 100644
--- a/arch/xtensa/mm/fault.c
+++ b/arch/xtensa/mm/fault.c
@@ -145,7 +145,7 @@ bad_area:
145 */ 145 */
146out_of_memory: 146out_of_memory:
147 up_read(&mm->mmap_sem); 147 up_read(&mm->mmap_sem);
148 if (is_init(current)) { 148 if (is_global_init(current)) {
149 yield(); 149 yield();
150 down_read(&mm->mmap_sem); 150 down_read(&mm->mmap_sem);
151 goto survive; 151 goto survive;
diff --git a/arch/xtensa/platform-iss/network.c b/arch/xtensa/platform-iss/network.c
index f09962fa98c0..b61fb36674e7 100644
--- a/arch/xtensa/platform-iss/network.c
+++ b/arch/xtensa/platform-iss/network.c
@@ -798,7 +798,7 @@ static int iss_net_setup(char *str)
798 798
799#undef ERR 799#undef ERR
800 800
801__setup("eth", iss_net_setup); 801__setup("eth=", iss_net_setup);
802 802
803/* 803/*
804 * Initialize all ISS Ethernet devices previously registered in iss_net_setup. 804 * Initialize all ISS Ethernet devices previously registered in iss_net_setup.
diff --git a/block/elevator.c b/block/elevator.c
index 952aee04a68a..446aea2a3cfb 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -390,7 +390,7 @@ EXPORT_SYMBOL(elv_rb_find);
390 390
391/* 391/*
392 * Insert rq into dispatch queue of q. Queue lock must be held on 392 * Insert rq into dispatch queue of q. Queue lock must be held on
393 * entry. rq is sort insted into the dispatch queue. To be used by 393 * entry. rq is sort instead into the dispatch queue. To be used by
394 * specific elevators. 394 * specific elevators.
395 */ 395 */
396void elv_dispatch_sort(struct request_queue *q, struct request *rq) 396void elv_dispatch_sort(struct request_queue *q, struct request *rq)
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 3935469e3662..8025d646ab30 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3367,7 +3367,7 @@ void submit_bio(int rw, struct bio *bio)
3367 if (unlikely(block_dump)) { 3367 if (unlikely(block_dump)) {
3368 char b[BDEVNAME_SIZE]; 3368 char b[BDEVNAME_SIZE];
3369 printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n", 3369 printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
3370 current->comm, current->pid, 3370 current->comm, task_pid_nr(current),
3371 (rw & WRITE) ? "WRITE" : "READ", 3371 (rw & WRITE) ? "WRITE" : "READ",
3372 (unsigned long long)bio->bi_sector, 3372 (unsigned long long)bio->bi_sector,
3373 bdevname(bio->bi_bdev,b)); 3373 bdevname(bio->bi_bdev,b));
@@ -3739,7 +3739,7 @@ EXPORT_SYMBOL(end_dequeued_request);
3739 3739
3740/** 3740/**
3741 * end_request - end I/O on the current segment of the request 3741 * end_request - end I/O on the current segment of the request
3742 * @rq: the request being processed 3742 * @req: the request being processed
3743 * @uptodate: error value or 0/1 uptodate flag 3743 * @uptodate: error value or 0/1 uptodate flag
3744 * 3744 *
3745 * Description: 3745 * Description:
diff --git a/crypto/api.c b/crypto/api.c
index 4ccc5af6c265..1f5c72477356 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -6,7 +6,7 @@
6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au> 6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
7 * 7 *
8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no> 8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>
9 * and Nettle, by Niels Möller. 9 * and Nettle, by Niels Möller.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free 12 * under the terms of the GNU General Public License as published by the Free
diff --git a/crypto/fcrypt.c b/crypto/fcrypt.c
index 9c2bb535b09a..d161949fdb94 100644
--- a/crypto/fcrypt.c
+++ b/crypto/fcrypt.c
@@ -10,7 +10,7 @@
10 * 10 *
11 * Based on code: 11 * Based on code:
12 * 12 *
13 * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan 13 * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
14 * (Royal Institute of Technology, Stockholm, Sweden). 14 * (Royal Institute of Technology, Stockholm, Sweden).
15 * All rights reserved. 15 * All rights reserved.
16 * 16 *
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 4fb134d50da7..34f40ea0ba60 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -58,6 +58,8 @@ source "drivers/power/Kconfig"
58 58
59source "drivers/hwmon/Kconfig" 59source "drivers/hwmon/Kconfig"
60 60
61source "drivers/watchdog/Kconfig"
62
61source "drivers/ssb/Kconfig" 63source "drivers/ssb/Kconfig"
62 64
63source "drivers/mfd/Kconfig" 65source "drivers/mfd/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 174c27eb4430..cfe38ffff28a 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -66,7 +66,7 @@ obj-y += i2c/
66obj-$(CONFIG_W1) += w1/ 66obj-$(CONFIG_W1) += w1/
67obj-$(CONFIG_POWER_SUPPLY) += power/ 67obj-$(CONFIG_POWER_SUPPLY) += power/
68obj-$(CONFIG_HWMON) += hwmon/ 68obj-$(CONFIG_HWMON) += hwmon/
69obj-$(CONFIG_WATCHDOG) += char/watchdog/ 69obj-$(CONFIG_WATCHDOG) += watchdog/
70obj-$(CONFIG_PHONE) += telephony/ 70obj-$(CONFIG_PHONE) += telephony/
71obj-$(CONFIG_MD) += md/ 71obj-$(CONFIG_MD) += md/
72obj-$(CONFIG_BT) += bluetooth/ 72obj-$(CONFIG_BT) += bluetooth/
@@ -76,6 +76,7 @@ obj-$(CONFIG_MCA) += mca/
76obj-$(CONFIG_EISA) += eisa/ 76obj-$(CONFIG_EISA) += eisa/
77obj-$(CONFIG_LGUEST_GUEST) += lguest/ 77obj-$(CONFIG_LGUEST_GUEST) += lguest/
78obj-$(CONFIG_CPU_FREQ) += cpufreq/ 78obj-$(CONFIG_CPU_FREQ) += cpufreq/
79obj-$(CONFIG_CPU_IDLE) += cpuidle/
79obj-$(CONFIG_MMC) += mmc/ 80obj-$(CONFIG_MMC) += mmc/
80obj-$(CONFIG_NEW_LEDS) += leds/ 81obj-$(CONFIG_NEW_LEDS) += leds/
81obj-$(CONFIG_INFINIBAND) += infiniband/ 82obj-$(CONFIG_INFINIBAND) += infiniband/
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 4875f0149eb4..5d0e26a5c34c 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -52,7 +52,7 @@ config ACPI_PROCFS
52 depends on PROC_FS 52 depends on PROC_FS
53 ---help--- 53 ---help---
54 For backwards compatibility, this option allows 54 For backwards compatibility, this option allows
55 depricated /proc/acpi/ files to exist, even when 55 deprecated /proc/acpi/ files to exist, even when
56 they have been replaced by functions in /sys. 56 they have been replaced by functions in /sys.
57 The deprecated files (and their replacements) include: 57 The deprecated files (and their replacements) include:
58 58
@@ -88,7 +88,7 @@ config ACPI_PROC_EVENT
88 88
89config ACPI_AC 89config ACPI_AC
90 tristate "AC Adapter" 90 tristate "AC Adapter"
91 depends on X86 91 depends on X86 && POWER_SUPPLY
92 default y 92 default y
93 help 93 help
94 This driver adds support for the AC Adapter object, which indicates 94 This driver adds support for the AC Adapter object, which indicates
@@ -97,7 +97,7 @@ config ACPI_AC
97 97
98config ACPI_BATTERY 98config ACPI_BATTERY
99 tristate "Battery" 99 tristate "Battery"
100 depends on X86 100 depends on X86 && POWER_SUPPLY
101 default y 101 default y
102 help 102 help
103 This driver adds support for battery information through 103 This driver adds support for battery information through
@@ -117,6 +117,7 @@ config ACPI_BUTTON
117config ACPI_VIDEO 117config ACPI_VIDEO
118 tristate "Video" 118 tristate "Video"
119 depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL 119 depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL
120 depends on INPUT
120 help 121 help
121 This driver implement the ACPI Extensions For Display Adapters 122 This driver implement the ACPI Extensions For Display Adapters
122 for integrated graphics devices on motherboard, as specified in 123 for integrated graphics devices on motherboard, as specified in
@@ -349,12 +350,11 @@ config ACPI_HOTPLUG_MEMORY
349 $>modprobe acpi_memhotplug 350 $>modprobe acpi_memhotplug
350 351
351config ACPI_SBS 352config ACPI_SBS
352 tristate "Smart Battery System (EXPERIMENTAL)" 353 tristate "Smart Battery System"
353 depends on X86 354 depends on X86
354 depends on EXPERIMENTAL 355 depends on POWER_SUPPLY
355 help 356 help
356 This driver adds support for the Smart Battery System. 357 This driver adds support for the Smart Battery System, another
357 A "Smart Battery" is quite old and quite rare compared 358 type of access to battery information, found on some laptops.
358 to today's ACPI "Control Method" battery.
359 359
360endif # ACPI 360endif # ACPI
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index d4336f1730e9..54e3ab0e5fc0 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -60,3 +60,4 @@ obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o 60obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o
61obj-y += cm_sbs.o 61obj-y += cm_sbs.o
62obj-$(CONFIG_ACPI_SBS) += sbs.o 62obj-$(CONFIG_ACPI_SBS) += sbs.o
63obj-$(CONFIG_ACPI_SBS) += sbshc.o
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 26d70702b313..e03de37a750d 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -29,6 +29,7 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/seq_file.h> 31#include <linux/seq_file.h>
32#include <linux/power_supply.h>
32#include <acpi/acpi_bus.h> 33#include <acpi/acpi_bus.h>
33#include <acpi/acpi_drivers.h> 34#include <acpi/acpi_drivers.h>
34 35
@@ -72,16 +73,37 @@ static struct acpi_driver acpi_ac_driver = {
72}; 73};
73 74
74struct acpi_ac { 75struct acpi_ac {
76 struct power_supply charger;
75 struct acpi_device * device; 77 struct acpi_device * device;
76 unsigned long state; 78 unsigned long state;
77}; 79};
78 80
81#define to_acpi_ac(x) container_of(x, struct acpi_ac, charger);
82
79static const struct file_operations acpi_ac_fops = { 83static const struct file_operations acpi_ac_fops = {
80 .open = acpi_ac_open_fs, 84 .open = acpi_ac_open_fs,
81 .read = seq_read, 85 .read = seq_read,
82 .llseek = seq_lseek, 86 .llseek = seq_lseek,
83 .release = single_release, 87 .release = single_release,
84}; 88};
89static int get_ac_property(struct power_supply *psy,
90 enum power_supply_property psp,
91 union power_supply_propval *val)
92{
93 struct acpi_ac *ac = to_acpi_ac(psy);
94 switch (psp) {
95 case POWER_SUPPLY_PROP_ONLINE:
96 val->intval = ac->state;
97 break;
98 default:
99 return -EINVAL;
100 }
101 return 0;
102}
103
104static enum power_supply_property ac_props[] = {
105 POWER_SUPPLY_PROP_ONLINE,
106};
85 107
86/* -------------------------------------------------------------------------- 108/* --------------------------------------------------------------------------
87 AC Adapter Management 109 AC Adapter Management
@@ -208,6 +230,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
208 acpi_bus_generate_netlink_event(device->pnp.device_class, 230 acpi_bus_generate_netlink_event(device->pnp.device_class,
209 device->dev.bus_id, event, 231 device->dev.bus_id, event,
210 (u32) ac->state); 232 (u32) ac->state);
233 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
211 break; 234 break;
212 default: 235 default:
213 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 236 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -244,7 +267,12 @@ static int acpi_ac_add(struct acpi_device *device)
244 result = acpi_ac_add_fs(device); 267 result = acpi_ac_add_fs(device);
245 if (result) 268 if (result)
246 goto end; 269 goto end;
247 270 ac->charger.name = acpi_device_bid(device);
271 ac->charger.type = POWER_SUPPLY_TYPE_MAINS;
272 ac->charger.properties = ac_props;
273 ac->charger.num_properties = ARRAY_SIZE(ac_props);
274 ac->charger.get_property = get_ac_property;
275 power_supply_register(&ac->device->dev, &ac->charger);
248 status = acpi_install_notify_handler(device->handle, 276 status = acpi_install_notify_handler(device->handle,
249 ACPI_ALL_NOTIFY, acpi_ac_notify, 277 ACPI_ALL_NOTIFY, acpi_ac_notify,
250 ac); 278 ac);
@@ -279,7 +307,8 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
279 307
280 status = acpi_remove_notify_handler(device->handle, 308 status = acpi_remove_notify_handler(device->handle,
281 ACPI_ALL_NOTIFY, acpi_ac_notify); 309 ACPI_ALL_NOTIFY, acpi_ac_notify);
282 310 if (ac->charger.dev)
311 power_supply_unregister(&ac->charger);
283 acpi_ac_remove_fs(device); 312 acpi_ac_remove_fs(device);
284 313
285 kfree(ac); 314 kfree(ac);
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9b2c0f74f869..681e26b56b11 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * acpi_battery.c - ACPI Battery Driver ($Revision: 37 $) 2 * battery.c - ACPI Battery Driver (Revision: 2.0)
3 * 3 *
4 * Copyright (C) 2007 Alexey Starikovskiy <astarikovskiy@suse.de>
5 * Copyright (C) 2004-2007 Vladimir Lebedev <vladimir.p.lebedev@intel.com>
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> 6 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> 7 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * 8 *
@@ -27,244 +29,288 @@
27#include <linux/module.h> 29#include <linux/module.h>
28#include <linux/init.h> 30#include <linux/init.h>
29#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/jiffies.h>
33
34#ifdef CONFIG_ACPI_PROCFS
30#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
31#include <linux/seq_file.h> 36#include <linux/seq_file.h>
32#include <asm/uaccess.h> 37#include <asm/uaccess.h>
38#endif
33 39
34#include <acpi/acpi_bus.h> 40#include <acpi/acpi_bus.h>
35#include <acpi/acpi_drivers.h> 41#include <acpi/acpi_drivers.h>
36 42
37#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF 43#include <linux/power_supply.h>
38 44
39#define ACPI_BATTERY_FORMAT_BIF "NNNNNNNNNSSSS" 45#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
40#define ACPI_BATTERY_FORMAT_BST "NNNN"
41 46
42#define ACPI_BATTERY_COMPONENT 0x00040000 47#define ACPI_BATTERY_COMPONENT 0x00040000
43#define ACPI_BATTERY_CLASS "battery" 48#define ACPI_BATTERY_CLASS "battery"
44#define ACPI_BATTERY_DEVICE_NAME "Battery" 49#define ACPI_BATTERY_DEVICE_NAME "Battery"
45#define ACPI_BATTERY_NOTIFY_STATUS 0x80 50#define ACPI_BATTERY_NOTIFY_STATUS 0x80
46#define ACPI_BATTERY_NOTIFY_INFO 0x81 51#define ACPI_BATTERY_NOTIFY_INFO 0x81
47#define ACPI_BATTERY_UNITS_WATTS "mW"
48#define ACPI_BATTERY_UNITS_AMPS "mA"
49 52
50#define _COMPONENT ACPI_BATTERY_COMPONENT 53#define _COMPONENT ACPI_BATTERY_COMPONENT
51 54
52#define ACPI_BATTERY_UPDATE_TIME 0
53
54#define ACPI_BATTERY_NONE_UPDATE 0
55#define ACPI_BATTERY_EASY_UPDATE 1
56#define ACPI_BATTERY_INIT_UPDATE 2
57
58ACPI_MODULE_NAME("battery"); 55ACPI_MODULE_NAME("battery");
59 56
60MODULE_AUTHOR("Paul Diefenbaugh"); 57MODULE_AUTHOR("Paul Diefenbaugh");
58MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>");
61MODULE_DESCRIPTION("ACPI Battery Driver"); 59MODULE_DESCRIPTION("ACPI Battery Driver");
62MODULE_LICENSE("GPL"); 60MODULE_LICENSE("GPL");
63 61
64static unsigned int update_time = ACPI_BATTERY_UPDATE_TIME; 62static unsigned int cache_time = 1000;
65 63module_param(cache_time, uint, 0644);
66/* 0 - every time, > 0 - by update_time */ 64MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
67module_param(update_time, uint, 0644);
68 65
66#ifdef CONFIG_ACPI_PROCFS
69extern struct proc_dir_entry *acpi_lock_battery_dir(void); 67extern struct proc_dir_entry *acpi_lock_battery_dir(void);
70extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); 68extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
71 69
72static int acpi_battery_add(struct acpi_device *device); 70enum acpi_battery_files {
73static int acpi_battery_remove(struct acpi_device *device, int type); 71 info_tag = 0,
74static int acpi_battery_resume(struct acpi_device *device); 72 state_tag,
73 alarm_tag,
74 ACPI_BATTERY_NUMFILES,
75};
76
77#endif
75 78
76static const struct acpi_device_id battery_device_ids[] = { 79static const struct acpi_device_id battery_device_ids[] = {
77 {"PNP0C0A", 0}, 80 {"PNP0C0A", 0},
78 {"", 0}, 81 {"", 0},
79}; 82};
80MODULE_DEVICE_TABLE(acpi, battery_device_ids);
81
82static struct acpi_driver acpi_battery_driver = {
83 .name = "battery",
84 .class = ACPI_BATTERY_CLASS,
85 .ids = battery_device_ids,
86 .ops = {
87 .add = acpi_battery_add,
88 .resume = acpi_battery_resume,
89 .remove = acpi_battery_remove,
90 },
91};
92 83
93struct acpi_battery_state { 84MODULE_DEVICE_TABLE(acpi, battery_device_ids);
94 acpi_integer state;
95 acpi_integer present_rate;
96 acpi_integer remaining_capacity;
97 acpi_integer present_voltage;
98};
99
100struct acpi_battery_info {
101 acpi_integer power_unit;
102 acpi_integer design_capacity;
103 acpi_integer last_full_capacity;
104 acpi_integer battery_technology;
105 acpi_integer design_voltage;
106 acpi_integer design_capacity_warning;
107 acpi_integer design_capacity_low;
108 acpi_integer battery_capacity_granularity_1;
109 acpi_integer battery_capacity_granularity_2;
110 acpi_string model_number;
111 acpi_string serial_number;
112 acpi_string battery_type;
113 acpi_string oem_info;
114};
115
116enum acpi_battery_files{
117 ACPI_BATTERY_INFO = 0,
118 ACPI_BATTERY_STATE,
119 ACPI_BATTERY_ALARM,
120 ACPI_BATTERY_NUMFILES,
121};
122 85
123struct acpi_battery_flags {
124 u8 battery_present_prev;
125 u8 alarm_present;
126 u8 init_update;
127 u8 update[ACPI_BATTERY_NUMFILES];
128 u8 power_unit;
129};
130 86
131struct acpi_battery { 87struct acpi_battery {
132 struct mutex mutex; 88 struct mutex lock;
89 struct power_supply bat;
133 struct acpi_device *device; 90 struct acpi_device *device;
134 struct acpi_battery_flags flags; 91 unsigned long update_time;
135 struct acpi_buffer bif_data; 92 int current_now;
136 struct acpi_buffer bst_data; 93 int capacity_now;
137 unsigned long alarm; 94 int voltage_now;
138 unsigned long update_time[ACPI_BATTERY_NUMFILES]; 95 int design_capacity;
96 int full_charge_capacity;
97 int technology;
98 int design_voltage;
99 int design_capacity_warning;
100 int design_capacity_low;
101 int capacity_granularity_1;
102 int capacity_granularity_2;
103 int alarm;
104 char model_number[32];
105 char serial_number[32];
106 char type[32];
107 char oem_info[32];
108 int state;
109 int power_unit;
110 u8 alarm_present;
139}; 111};
140 112
113#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
114
141inline int acpi_battery_present(struct acpi_battery *battery) 115inline int acpi_battery_present(struct acpi_battery *battery)
142{ 116{
143 return battery->device->status.battery_present; 117 return battery->device->status.battery_present;
144} 118}
145inline char *acpi_battery_power_units(struct acpi_battery *battery)
146{
147 if (battery->flags.power_unit)
148 return ACPI_BATTERY_UNITS_AMPS;
149 else
150 return ACPI_BATTERY_UNITS_WATTS;
151}
152 119
153inline acpi_handle acpi_battery_handle(struct acpi_battery *battery) 120static int acpi_battery_technology(struct acpi_battery *battery)
154{ 121{
155 return battery->device->handle; 122 if (!strcasecmp("NiCd", battery->type))
123 return POWER_SUPPLY_TECHNOLOGY_NiCd;
124 if (!strcasecmp("NiMH", battery->type))
125 return POWER_SUPPLY_TECHNOLOGY_NiMH;
126 if (!strcasecmp("LION", battery->type))
127 return POWER_SUPPLY_TECHNOLOGY_LION;
128 if (!strcasecmp("LiP", battery->type))
129 return POWER_SUPPLY_TECHNOLOGY_LIPO;
130 return POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
156} 131}
157 132
158/* -------------------------------------------------------------------------- 133static int acpi_battery_get_property(struct power_supply *psy,
159 Battery Management 134 enum power_supply_property psp,
160 -------------------------------------------------------------------------- */ 135 union power_supply_propval *val)
161
162static void acpi_battery_check_result(struct acpi_battery *battery, int result)
163{ 136{
164 if (!battery) 137 struct acpi_battery *battery = to_acpi_battery(psy);
165 return;
166 138
167 if (result) { 139 if ((!acpi_battery_present(battery)) &&
168 battery->flags.init_update = 1; 140 psp != POWER_SUPPLY_PROP_PRESENT)
141 return -ENODEV;
142 switch (psp) {
143 case POWER_SUPPLY_PROP_STATUS:
144 if (battery->state & 0x01)
145 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
146 else if (battery->state & 0x02)
147 val->intval = POWER_SUPPLY_STATUS_CHARGING;
148 else if (battery->state == 0)
149 val->intval = POWER_SUPPLY_STATUS_FULL;
150 break;
151 case POWER_SUPPLY_PROP_PRESENT:
152 val->intval = acpi_battery_present(battery);
153 break;
154 case POWER_SUPPLY_PROP_TECHNOLOGY:
155 val->intval = acpi_battery_technology(battery);
156 break;
157 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
158 val->intval = battery->design_voltage * 1000;
159 break;
160 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
161 val->intval = battery->voltage_now * 1000;
162 break;
163 case POWER_SUPPLY_PROP_CURRENT_NOW:
164 val->intval = battery->current_now * 1000;
165 break;
166 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
167 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
168 val->intval = battery->design_capacity * 1000;
169 break;
170 case POWER_SUPPLY_PROP_CHARGE_FULL:
171 case POWER_SUPPLY_PROP_ENERGY_FULL:
172 val->intval = battery->full_charge_capacity * 1000;
173 break;
174 case POWER_SUPPLY_PROP_CHARGE_NOW:
175 case POWER_SUPPLY_PROP_ENERGY_NOW:
176 val->intval = battery->capacity_now * 1000;
177 break;
178 case POWER_SUPPLY_PROP_MODEL_NAME:
179 val->strval = battery->model_number;
180 break;
181 case POWER_SUPPLY_PROP_MANUFACTURER:
182 val->strval = battery->oem_info;
183 break;
184 default:
185 return -EINVAL;
169 } 186 }
187 return 0;
170} 188}
171 189
172static int acpi_battery_extract_package(struct acpi_battery *battery, 190static enum power_supply_property charge_battery_props[] = {
173 union acpi_object *package, 191 POWER_SUPPLY_PROP_STATUS,
174 struct acpi_buffer *format, 192 POWER_SUPPLY_PROP_PRESENT,
175 struct acpi_buffer *data, 193 POWER_SUPPLY_PROP_TECHNOLOGY,
176 char *package_name) 194 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
195 POWER_SUPPLY_PROP_VOLTAGE_NOW,
196 POWER_SUPPLY_PROP_CURRENT_NOW,
197 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
198 POWER_SUPPLY_PROP_CHARGE_FULL,
199 POWER_SUPPLY_PROP_CHARGE_NOW,
200 POWER_SUPPLY_PROP_MODEL_NAME,
201 POWER_SUPPLY_PROP_MANUFACTURER,
202};
203
204static enum power_supply_property energy_battery_props[] = {
205 POWER_SUPPLY_PROP_STATUS,
206 POWER_SUPPLY_PROP_PRESENT,
207 POWER_SUPPLY_PROP_TECHNOLOGY,
208 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
209 POWER_SUPPLY_PROP_VOLTAGE_NOW,
210 POWER_SUPPLY_PROP_CURRENT_NOW,
211 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
212 POWER_SUPPLY_PROP_ENERGY_FULL,
213 POWER_SUPPLY_PROP_ENERGY_NOW,
214 POWER_SUPPLY_PROP_MODEL_NAME,
215 POWER_SUPPLY_PROP_MANUFACTURER,
216};
217
218#ifdef CONFIG_ACPI_PROCFS
219inline char *acpi_battery_units(struct acpi_battery *battery)
177{ 220{
178 acpi_status status = AE_OK; 221 return (battery->power_unit)?"mA":"mW";
179 struct acpi_buffer data_null = { 0, NULL }; 222}
223#endif
180 224
181 status = acpi_extract_package(package, format, &data_null); 225/* --------------------------------------------------------------------------
182 if (status != AE_BUFFER_OVERFLOW) { 226 Battery Management
183 ACPI_EXCEPTION((AE_INFO, status, "Extracting size %s", 227 -------------------------------------------------------------------------- */
184 package_name)); 228struct acpi_offsets {
185 return -ENODEV; 229 size_t offset; /* offset inside struct acpi_sbs_battery */
186 } 230 u8 mode; /* int or string? */
231};
187 232
188 if (data_null.length != data->length) { 233static struct acpi_offsets state_offsets[] = {
189 kfree(data->pointer); 234 {offsetof(struct acpi_battery, state), 0},
190 data->pointer = kzalloc(data_null.length, GFP_KERNEL); 235 {offsetof(struct acpi_battery, current_now), 0},
191 if (!data->pointer) { 236 {offsetof(struct acpi_battery, capacity_now), 0},
192 ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, "kzalloc()")); 237 {offsetof(struct acpi_battery, voltage_now), 0},
193 return -ENOMEM; 238};
194 }
195 data->length = data_null.length;
196 }
197 239
198 status = acpi_extract_package(package, format, data); 240static struct acpi_offsets info_offsets[] = {
199 if (ACPI_FAILURE(status)) { 241 {offsetof(struct acpi_battery, power_unit), 0},
200 ACPI_EXCEPTION((AE_INFO, status, "Extracting %s", 242 {offsetof(struct acpi_battery, design_capacity), 0},
201 package_name)); 243 {offsetof(struct acpi_battery, full_charge_capacity), 0},
202 return -ENODEV; 244 {offsetof(struct acpi_battery, technology), 0},
203 } 245 {offsetof(struct acpi_battery, design_voltage), 0},
246 {offsetof(struct acpi_battery, design_capacity_warning), 0},
247 {offsetof(struct acpi_battery, design_capacity_low), 0},
248 {offsetof(struct acpi_battery, capacity_granularity_1), 0},
249 {offsetof(struct acpi_battery, capacity_granularity_2), 0},
250 {offsetof(struct acpi_battery, model_number), 1},
251 {offsetof(struct acpi_battery, serial_number), 1},
252 {offsetof(struct acpi_battery, type), 1},
253 {offsetof(struct acpi_battery, oem_info), 1},
254};
204 255
256static int extract_package(struct acpi_battery *battery,
257 union acpi_object *package,
258 struct acpi_offsets *offsets, int num)
259{
260 int i, *x;
261 union acpi_object *element;
262 if (package->type != ACPI_TYPE_PACKAGE)
263 return -EFAULT;
264 for (i = 0; i < num; ++i) {
265 if (package->package.count <= i)
266 return -EFAULT;
267 element = &package->package.elements[i];
268 if (offsets[i].mode) {
269 if (element->type != ACPI_TYPE_STRING &&
270 element->type != ACPI_TYPE_BUFFER)
271 return -EFAULT;
272 strncpy((u8 *)battery + offsets[i].offset,
273 element->string.pointer, 32);
274 } else {
275 if (element->type != ACPI_TYPE_INTEGER)
276 return -EFAULT;
277 x = (int *)((u8 *)battery + offsets[i].offset);
278 *x = element->integer.value;
279 }
280 }
205 return 0; 281 return 0;
206} 282}
207 283
208static int acpi_battery_get_status(struct acpi_battery *battery) 284static int acpi_battery_get_status(struct acpi_battery *battery)
209{ 285{
210 int result = 0; 286 if (acpi_bus_get_status(battery->device)) {
211
212 result = acpi_bus_get_status(battery->device);
213 if (result) {
214 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Evaluating _STA")); 287 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Evaluating _STA"));
215 return -ENODEV; 288 return -ENODEV;
216 } 289 }
217 return result; 290 return 0;
218} 291}
219 292
220static int acpi_battery_get_info(struct acpi_battery *battery) 293static int acpi_battery_get_info(struct acpi_battery *battery)
221{ 294{
222 int result = 0; 295 int result = -EFAULT;
223 acpi_status status = 0; 296 acpi_status status = 0;
224 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 297 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
225 struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF),
226 ACPI_BATTERY_FORMAT_BIF
227 };
228 union acpi_object *package = NULL;
229 struct acpi_buffer *data = NULL;
230 struct acpi_battery_info *bif = NULL;
231
232 battery->update_time[ACPI_BATTERY_INFO] = get_seconds();
233 298
234 if (!acpi_battery_present(battery)) 299 if (!acpi_battery_present(battery))
235 return 0; 300 return 0;
301 mutex_lock(&battery->lock);
302 status = acpi_evaluate_object(battery->device->handle, "_BIF",
303 NULL, &buffer);
304 mutex_unlock(&battery->lock);
236 305
237 /* Evaluate _BIF */
238
239 status =
240 acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL,
241 &buffer);
242 if (ACPI_FAILURE(status)) { 306 if (ACPI_FAILURE(status)) {
243 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); 307 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
244 return -ENODEV; 308 return -ENODEV;
245 } 309 }
246 310
247 package = buffer.pointer; 311 result = extract_package(battery, buffer.pointer,
248 312 info_offsets, ARRAY_SIZE(info_offsets));
249 data = &battery->bif_data;
250
251 /* Extract Package Data */
252
253 result =
254 acpi_battery_extract_package(battery, package, &format, data,
255 "_BIF");
256 if (result)
257 goto end;
258
259 end:
260
261 kfree(buffer.pointer); 313 kfree(buffer.pointer);
262
263 if (!result) {
264 bif = data->pointer;
265 battery->flags.power_unit = bif->power_unit;
266 }
267
268 return result; 314 return result;
269} 315}
270 316
@@ -273,342 +319,203 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
273 int result = 0; 319 int result = 0;
274 acpi_status status = 0; 320 acpi_status status = 0;
275 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 321 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
276 struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST),
277 ACPI_BATTERY_FORMAT_BST
278 };
279 union acpi_object *package = NULL;
280 struct acpi_buffer *data = NULL;
281
282 battery->update_time[ACPI_BATTERY_STATE] = get_seconds();
283 322
284 if (!acpi_battery_present(battery)) 323 if (!acpi_battery_present(battery))
285 return 0; 324 return 0;
286 325
287 /* Evaluate _BST */ 326 if (battery->update_time &&
327 time_before(jiffies, battery->update_time +
328 msecs_to_jiffies(cache_time)))
329 return 0;
330
331 mutex_lock(&battery->lock);
332 status = acpi_evaluate_object(battery->device->handle, "_BST",
333 NULL, &buffer);
334 mutex_unlock(&battery->lock);
288 335
289 status =
290 acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL,
291 &buffer);
292 if (ACPI_FAILURE(status)) { 336 if (ACPI_FAILURE(status)) {
293 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 337 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
294 return -ENODEV; 338 return -ENODEV;
295 } 339 }
296 340
297 package = buffer.pointer; 341 result = extract_package(battery, buffer.pointer,
298 342 state_offsets, ARRAY_SIZE(state_offsets));
299 data = &battery->bst_data; 343 battery->update_time = jiffies;
300
301 /* Extract Package Data */
302
303 result =
304 acpi_battery_extract_package(battery, package, &format, data,
305 "_BST");
306 if (result)
307 goto end;
308
309 end:
310 kfree(buffer.pointer); 344 kfree(buffer.pointer);
311
312 return result; 345 return result;
313} 346}
314 347
315static int acpi_battery_get_alarm(struct acpi_battery *battery) 348static int acpi_battery_set_alarm(struct acpi_battery *battery)
316{
317 battery->update_time[ACPI_BATTERY_ALARM] = get_seconds();
318
319 return 0;
320}
321
322static int acpi_battery_set_alarm(struct acpi_battery *battery,
323 unsigned long alarm)
324{ 349{
325 acpi_status status = 0; 350 acpi_status status = 0;
326 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 351 union acpi_object arg0 = { .type = ACPI_TYPE_INTEGER };
327 struct acpi_object_list arg_list = { 1, &arg0 }; 352 struct acpi_object_list arg_list = { 1, &arg0 };
328 353
329 battery->update_time[ACPI_BATTERY_ALARM] = get_seconds(); 354 if (!acpi_battery_present(battery)|| !battery->alarm_present)
330
331 if (!acpi_battery_present(battery))
332 return -ENODEV; 355 return -ENODEV;
333 356
334 if (!battery->flags.alarm_present) 357 arg0.integer.value = battery->alarm;
335 return -ENODEV;
336
337 arg0.integer.value = alarm;
338 358
339 status = 359 mutex_lock(&battery->lock);
340 acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", 360 status = acpi_evaluate_object(battery->device->handle, "_BTP",
341 &arg_list, NULL); 361 &arg_list, NULL);
362 mutex_unlock(&battery->lock);
363
342 if (ACPI_FAILURE(status)) 364 if (ACPI_FAILURE(status))
343 return -ENODEV; 365 return -ENODEV;
344 366
345 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", (u32) alarm)); 367 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Alarm set to %d\n", battery->alarm));
346
347 battery->alarm = alarm;
348
349 return 0; 368 return 0;
350} 369}
351 370
352static int acpi_battery_init_alarm(struct acpi_battery *battery) 371static int acpi_battery_init_alarm(struct acpi_battery *battery)
353{ 372{
354 int result = 0;
355 acpi_status status = AE_OK; 373 acpi_status status = AE_OK;
356 acpi_handle handle = NULL; 374 acpi_handle handle = NULL;
357 struct acpi_battery_info *bif = battery->bif_data.pointer;
358 unsigned long alarm = battery->alarm;
359 375
360 /* See if alarms are supported, and if so, set default */ 376 /* See if alarms are supported, and if so, set default */
361 377 status = acpi_get_handle(battery->device->handle, "_BTP", &handle);
362 status = acpi_get_handle(acpi_battery_handle(battery), "_BTP", &handle); 378 if (ACPI_FAILURE(status)) {
363 if (ACPI_SUCCESS(status)) { 379 battery->alarm_present = 0;
364 battery->flags.alarm_present = 1; 380 return 0;
365 if (!alarm && bif) {
366 alarm = bif->design_capacity_warning;
367 }
368 result = acpi_battery_set_alarm(battery, alarm);
369 if (result)
370 goto end;
371 } else {
372 battery->flags.alarm_present = 0;
373 } 381 }
374 382 battery->alarm_present = 1;
375 end: 383 if (!battery->alarm)
376 384 battery->alarm = battery->design_capacity_warning;
377 return result; 385 return acpi_battery_set_alarm(battery);
378} 386}
379 387
380static int acpi_battery_init_update(struct acpi_battery *battery) 388static int acpi_battery_update(struct acpi_battery *battery)
381{ 389{
382 int result = 0; 390 int saved_present = acpi_battery_present(battery);
383 391 int result = acpi_battery_get_status(battery);
384 result = acpi_battery_get_status(battery); 392 if (result || !acpi_battery_present(battery))
385 if (result)
386 return result; 393 return result;
387 394 if (saved_present != acpi_battery_present(battery) ||
388 battery->flags.battery_present_prev = acpi_battery_present(battery); 395 !battery->update_time) {
389 396 battery->update_time = 0;
390 if (acpi_battery_present(battery)) {
391 result = acpi_battery_get_info(battery); 397 result = acpi_battery_get_info(battery);
392 if (result) 398 if (result)
393 return result; 399 return result;
394 result = acpi_battery_get_state(battery); 400 if (battery->power_unit) {
395 if (result) 401 battery->bat.properties = charge_battery_props;
396 return result; 402 battery->bat.num_properties =
397 403 ARRAY_SIZE(charge_battery_props);
398 acpi_battery_init_alarm(battery);
399 }
400
401 return result;
402}
403
404static int acpi_battery_update(struct acpi_battery *battery,
405 int update, int *update_result_ptr)
406{
407 int result = 0;
408 int update_result = ACPI_BATTERY_NONE_UPDATE;
409
410 if (!acpi_battery_present(battery)) {
411 update = 1;
412 }
413
414 if (battery->flags.init_update) {
415 result = acpi_battery_init_update(battery);
416 if (result)
417 goto end;
418 update_result = ACPI_BATTERY_INIT_UPDATE;
419 } else if (update) {
420 result = acpi_battery_get_status(battery);
421 if (result)
422 goto end;
423 if ((!battery->flags.battery_present_prev & acpi_battery_present(battery))
424 || (battery->flags.battery_present_prev & !acpi_battery_present(battery))) {
425 result = acpi_battery_init_update(battery);
426 if (result)
427 goto end;
428 update_result = ACPI_BATTERY_INIT_UPDATE;
429 } else { 404 } else {
430 update_result = ACPI_BATTERY_EASY_UPDATE; 405 battery->bat.properties = energy_battery_props;
406 battery->bat.num_properties =
407 ARRAY_SIZE(energy_battery_props);
431 } 408 }
409 acpi_battery_init_alarm(battery);
432 } 410 }
433 411 return acpi_battery_get_state(battery);
434 end:
435
436 battery->flags.init_update = (result != 0);
437
438 *update_result_ptr = update_result;
439
440 return result;
441}
442
443static void acpi_battery_notify_update(struct acpi_battery *battery)
444{
445 acpi_battery_get_status(battery);
446
447 if (battery->flags.init_update) {
448 return;
449 }
450
451 if ((!battery->flags.battery_present_prev &
452 acpi_battery_present(battery)) ||
453 (battery->flags.battery_present_prev &
454 !acpi_battery_present(battery))) {
455 battery->flags.init_update = 1;
456 } else {
457 battery->flags.update[ACPI_BATTERY_INFO] = 1;
458 battery->flags.update[ACPI_BATTERY_STATE] = 1;
459 battery->flags.update[ACPI_BATTERY_ALARM] = 1;
460 }
461} 412}
462 413
463/* -------------------------------------------------------------------------- 414/* --------------------------------------------------------------------------
464 FS Interface (/proc) 415 FS Interface (/proc)
465 -------------------------------------------------------------------------- */ 416 -------------------------------------------------------------------------- */
466 417
418#ifdef CONFIG_ACPI_PROCFS
467static struct proc_dir_entry *acpi_battery_dir; 419static struct proc_dir_entry *acpi_battery_dir;
468 420
469static int acpi_battery_print_info(struct seq_file *seq, int result) 421static int acpi_battery_print_info(struct seq_file *seq, int result)
470{ 422{
471 struct acpi_battery *battery = seq->private; 423 struct acpi_battery *battery = seq->private;
472 struct acpi_battery_info *bif = NULL;
473 char *units = "?";
474 424
475 if (result) 425 if (result)
476 goto end; 426 goto end;
477 427
478 if (acpi_battery_present(battery)) 428 seq_printf(seq, "present: %s\n",
479 seq_printf(seq, "present: yes\n"); 429 acpi_battery_present(battery)?"yes":"no");
480 else { 430 if (!acpi_battery_present(battery))
481 seq_printf(seq, "present: no\n");
482 goto end;
483 }
484
485 bif = battery->bif_data.pointer;
486 if (!bif) {
487 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "BIF buffer is NULL"));
488 result = -ENODEV;
489 goto end; 431 goto end;
490 } 432 if (battery->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
491
492 /* Battery Units */
493
494 units = acpi_battery_power_units(battery);
495
496 if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
497 seq_printf(seq, "design capacity: unknown\n"); 433 seq_printf(seq, "design capacity: unknown\n");
498 else 434 else
499 seq_printf(seq, "design capacity: %d %sh\n", 435 seq_printf(seq, "design capacity: %d %sh\n",
500 (u32) bif->design_capacity, units); 436 battery->design_capacity,
437 acpi_battery_units(battery));
501 438
502 if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN) 439 if (battery->full_charge_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
503 seq_printf(seq, "last full capacity: unknown\n"); 440 seq_printf(seq, "last full capacity: unknown\n");
504 else 441 else
505 seq_printf(seq, "last full capacity: %d %sh\n", 442 seq_printf(seq, "last full capacity: %d %sh\n",
506 (u32) bif->last_full_capacity, units); 443 battery->full_charge_capacity,
444 acpi_battery_units(battery));
507 445
508 switch ((u32) bif->battery_technology) { 446 seq_printf(seq, "battery technology: %srechargeable\n",
509 case 0: 447 (!battery->technology)?"non-":"");
510 seq_printf(seq, "battery technology: non-rechargeable\n");
511 break;
512 case 1:
513 seq_printf(seq, "battery technology: rechargeable\n");
514 break;
515 default:
516 seq_printf(seq, "battery technology: unknown\n");
517 break;
518 }
519 448
520 if (bif->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN) 449 if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
521 seq_printf(seq, "design voltage: unknown\n"); 450 seq_printf(seq, "design voltage: unknown\n");
522 else 451 else
523 seq_printf(seq, "design voltage: %d mV\n", 452 seq_printf(seq, "design voltage: %d mV\n",
524 (u32) bif->design_voltage); 453 battery->design_voltage);
525 seq_printf(seq, "design capacity warning: %d %sh\n", 454 seq_printf(seq, "design capacity warning: %d %sh\n",
526 (u32) bif->design_capacity_warning, units); 455 battery->design_capacity_warning,
456 acpi_battery_units(battery));
527 seq_printf(seq, "design capacity low: %d %sh\n", 457 seq_printf(seq, "design capacity low: %d %sh\n",
528 (u32) bif->design_capacity_low, units); 458 battery->design_capacity_low,
459 acpi_battery_units(battery));
529 seq_printf(seq, "capacity granularity 1: %d %sh\n", 460 seq_printf(seq, "capacity granularity 1: %d %sh\n",
530 (u32) bif->battery_capacity_granularity_1, units); 461 battery->capacity_granularity_1,
462 acpi_battery_units(battery));
531 seq_printf(seq, "capacity granularity 2: %d %sh\n", 463 seq_printf(seq, "capacity granularity 2: %d %sh\n",
532 (u32) bif->battery_capacity_granularity_2, units); 464 battery->capacity_granularity_2,
533 seq_printf(seq, "model number: %s\n", bif->model_number); 465 acpi_battery_units(battery));
534 seq_printf(seq, "serial number: %s\n", bif->serial_number); 466 seq_printf(seq, "model number: %s\n", battery->model_number);
535 seq_printf(seq, "battery type: %s\n", bif->battery_type); 467 seq_printf(seq, "serial number: %s\n", battery->serial_number);
536 seq_printf(seq, "OEM info: %s\n", bif->oem_info); 468 seq_printf(seq, "battery type: %s\n", battery->type);
537 469 seq_printf(seq, "OEM info: %s\n", battery->oem_info);
538 end: 470 end:
539
540 if (result) 471 if (result)
541 seq_printf(seq, "ERROR: Unable to read battery info\n"); 472 seq_printf(seq, "ERROR: Unable to read battery info\n");
542
543 return result; 473 return result;
544} 474}
545 475
546static int acpi_battery_print_state(struct seq_file *seq, int result) 476static int acpi_battery_print_state(struct seq_file *seq, int result)
547{ 477{
548 struct acpi_battery *battery = seq->private; 478 struct acpi_battery *battery = seq->private;
549 struct acpi_battery_state *bst = NULL;
550 char *units = "?";
551 479
552 if (result) 480 if (result)
553 goto end; 481 goto end;
554 482
555 if (acpi_battery_present(battery)) 483 seq_printf(seq, "present: %s\n",
556 seq_printf(seq, "present: yes\n"); 484 acpi_battery_present(battery)?"yes":"no");
557 else { 485 if (!acpi_battery_present(battery))
558 seq_printf(seq, "present: no\n");
559 goto end;
560 }
561
562 bst = battery->bst_data.pointer;
563 if (!bst) {
564 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "BST buffer is NULL"));
565 result = -ENODEV;
566 goto end; 486 goto end;
567 }
568
569 /* Battery Units */
570
571 units = acpi_battery_power_units(battery);
572
573 if (!(bst->state & 0x04))
574 seq_printf(seq, "capacity state: ok\n");
575 else
576 seq_printf(seq, "capacity state: critical\n");
577 487
578 if ((bst->state & 0x01) && (bst->state & 0x02)) { 488 seq_printf(seq, "capacity state: %s\n",
489 (battery->state & 0x04)?"critical":"ok");
490 if ((battery->state & 0x01) && (battery->state & 0x02))
579 seq_printf(seq, 491 seq_printf(seq,
580 "charging state: charging/discharging\n"); 492 "charging state: charging/discharging\n");
581 } else if (bst->state & 0x01) 493 else if (battery->state & 0x01)
582 seq_printf(seq, "charging state: discharging\n"); 494 seq_printf(seq, "charging state: discharging\n");
583 else if (bst->state & 0x02) 495 else if (battery->state & 0x02)
584 seq_printf(seq, "charging state: charging\n"); 496 seq_printf(seq, "charging state: charging\n");
585 else { 497 else
586 seq_printf(seq, "charging state: charged\n"); 498 seq_printf(seq, "charging state: charged\n");
587 }
588 499
589 if (bst->present_rate == ACPI_BATTERY_VALUE_UNKNOWN) 500 if (battery->current_now == ACPI_BATTERY_VALUE_UNKNOWN)
590 seq_printf(seq, "present rate: unknown\n"); 501 seq_printf(seq, "present rate: unknown\n");
591 else 502 else
592 seq_printf(seq, "present rate: %d %s\n", 503 seq_printf(seq, "present rate: %d %s\n",
593 (u32) bst->present_rate, units); 504 battery->current_now, acpi_battery_units(battery));
594 505
595 if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN) 506 if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN)
596 seq_printf(seq, "remaining capacity: unknown\n"); 507 seq_printf(seq, "remaining capacity: unknown\n");
597 else 508 else
598 seq_printf(seq, "remaining capacity: %d %sh\n", 509 seq_printf(seq, "remaining capacity: %d %sh\n",
599 (u32) bst->remaining_capacity, units); 510 battery->capacity_now, acpi_battery_units(battery));
600 511 if (battery->voltage_now == ACPI_BATTERY_VALUE_UNKNOWN)
601 if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
602 seq_printf(seq, "present voltage: unknown\n"); 512 seq_printf(seq, "present voltage: unknown\n");
603 else 513 else
604 seq_printf(seq, "present voltage: %d mV\n", 514 seq_printf(seq, "present voltage: %d mV\n",
605 (u32) bst->present_voltage); 515 battery->voltage_now);
606
607 end: 516 end:
608 517 if (result)
609 if (result) {
610 seq_printf(seq, "ERROR: Unable to read battery state\n"); 518 seq_printf(seq, "ERROR: Unable to read battery state\n");
611 }
612 519
613 return result; 520 return result;
614} 521}
@@ -616,7 +523,6 @@ static int acpi_battery_print_state(struct seq_file *seq, int result)
616static int acpi_battery_print_alarm(struct seq_file *seq, int result) 523static int acpi_battery_print_alarm(struct seq_file *seq, int result)
617{ 524{
618 struct acpi_battery *battery = seq->private; 525 struct acpi_battery *battery = seq->private;
619 char *units = "?";
620 526
621 if (result) 527 if (result)
622 goto end; 528 goto end;
@@ -625,189 +531,121 @@ static int acpi_battery_print_alarm(struct seq_file *seq, int result)
625 seq_printf(seq, "present: no\n"); 531 seq_printf(seq, "present: no\n");
626 goto end; 532 goto end;
627 } 533 }
628
629 /* Battery Units */
630
631 units = acpi_battery_power_units(battery);
632
633 seq_printf(seq, "alarm: "); 534 seq_printf(seq, "alarm: ");
634 if (!battery->alarm) 535 if (!battery->alarm)
635 seq_printf(seq, "unsupported\n"); 536 seq_printf(seq, "unsupported\n");
636 else 537 else
637 seq_printf(seq, "%lu %sh\n", battery->alarm, units); 538 seq_printf(seq, "%u %sh\n", battery->alarm,
638 539 acpi_battery_units(battery));
639 end: 540 end:
640
641 if (result) 541 if (result)
642 seq_printf(seq, "ERROR: Unable to read battery alarm\n"); 542 seq_printf(seq, "ERROR: Unable to read battery alarm\n");
643
644 return result; 543 return result;
645} 544}
646 545
647static ssize_t 546static ssize_t acpi_battery_write_alarm(struct file *file,
648acpi_battery_write_alarm(struct file *file, 547 const char __user * buffer,
649 const char __user * buffer, 548 size_t count, loff_t * ppos)
650 size_t count, loff_t * ppos)
651{ 549{
652 int result = 0; 550 int result = 0;
653 char alarm_string[12] = { '\0' }; 551 char alarm_string[12] = { '\0' };
654 struct seq_file *m = file->private_data; 552 struct seq_file *m = file->private_data;
655 struct acpi_battery *battery = m->private; 553 struct acpi_battery *battery = m->private;
656 int update_result = ACPI_BATTERY_NONE_UPDATE;
657 554
658 if (!battery || (count > sizeof(alarm_string) - 1)) 555 if (!battery || (count > sizeof(alarm_string) - 1))
659 return -EINVAL; 556 return -EINVAL;
660
661 mutex_lock(&battery->mutex);
662
663 result = acpi_battery_update(battery, 1, &update_result);
664 if (result) { 557 if (result) {
665 result = -ENODEV; 558 result = -ENODEV;
666 goto end; 559 goto end;
667 } 560 }
668
669 if (!acpi_battery_present(battery)) { 561 if (!acpi_battery_present(battery)) {
670 result = -ENODEV; 562 result = -ENODEV;
671 goto end; 563 goto end;
672 } 564 }
673
674 if (copy_from_user(alarm_string, buffer, count)) { 565 if (copy_from_user(alarm_string, buffer, count)) {
675 result = -EFAULT; 566 result = -EFAULT;
676 goto end; 567 goto end;
677 } 568 }
678
679 alarm_string[count] = '\0'; 569 alarm_string[count] = '\0';
680 570 battery->alarm = simple_strtol(alarm_string, NULL, 0);
681 result = acpi_battery_set_alarm(battery, 571 result = acpi_battery_set_alarm(battery);
682 simple_strtoul(alarm_string, NULL, 0));
683 if (result)
684 goto end;
685
686 end: 572 end:
687
688 acpi_battery_check_result(battery, result);
689
690 if (!result) 573 if (!result)
691 result = count; 574 return count;
692
693 mutex_unlock(&battery->mutex);
694
695 return result; 575 return result;
696} 576}
697 577
698typedef int(*print_func)(struct seq_file *seq, int result); 578typedef int(*print_func)(struct seq_file *seq, int result);
699typedef int(*get_func)(struct acpi_battery *battery); 579
700 580static print_func acpi_print_funcs[ACPI_BATTERY_NUMFILES] = {
701static struct acpi_read_mux { 581 acpi_battery_print_info,
702 print_func print; 582 acpi_battery_print_state,
703 get_func get; 583 acpi_battery_print_alarm,
704} acpi_read_funcs[ACPI_BATTERY_NUMFILES] = {
705 {.get = acpi_battery_get_info, .print = acpi_battery_print_info},
706 {.get = acpi_battery_get_state, .print = acpi_battery_print_state},
707 {.get = acpi_battery_get_alarm, .print = acpi_battery_print_alarm},
708}; 584};
709 585
710static int acpi_battery_read(int fid, struct seq_file *seq) 586static int acpi_battery_read(int fid, struct seq_file *seq)
711{ 587{
712 struct acpi_battery *battery = seq->private; 588 struct acpi_battery *battery = seq->private;
713 int result = 0; 589 int result = acpi_battery_update(battery);
714 int update_result = ACPI_BATTERY_NONE_UPDATE; 590 return acpi_print_funcs[fid](seq, result);
715 int update = 0; 591}
716 592
717 mutex_lock(&battery->mutex); 593#define DECLARE_FILE_FUNCTIONS(_name) \
718 594static int acpi_battery_read_##_name(struct seq_file *seq, void *offset) \
719 update = (get_seconds() - battery->update_time[fid] >= update_time); 595{ \
720 update = (update | battery->flags.update[fid]); 596 return acpi_battery_read(_name##_tag, seq); \
721 597} \
722 result = acpi_battery_update(battery, update, &update_result); 598static int acpi_battery_##_name##_open_fs(struct inode *inode, struct file *file) \
723 if (result) 599{ \
724 goto end; 600 return single_open(file, acpi_battery_read_##_name, PDE(inode)->data); \
725 601}
726 if (update_result == ACPI_BATTERY_EASY_UPDATE) { 602
727 result = acpi_read_funcs[fid].get(battery); 603DECLARE_FILE_FUNCTIONS(info);
728 if (result) 604DECLARE_FILE_FUNCTIONS(state);
729 goto end; 605DECLARE_FILE_FUNCTIONS(alarm);
606
607#undef DECLARE_FILE_FUNCTIONS
608
609#define FILE_DESCRIPTION_RO(_name) \
610 { \
611 .name = __stringify(_name), \
612 .mode = S_IRUGO, \
613 .ops = { \
614 .open = acpi_battery_##_name##_open_fs, \
615 .read = seq_read, \
616 .llseek = seq_lseek, \
617 .release = single_release, \
618 .owner = THIS_MODULE, \
619 }, \
620 }
621
622#define FILE_DESCRIPTION_RW(_name) \
623 { \
624 .name = __stringify(_name), \
625 .mode = S_IFREG | S_IRUGO | S_IWUSR, \
626 .ops = { \
627 .open = acpi_battery_##_name##_open_fs, \
628 .read = seq_read, \
629 .llseek = seq_lseek, \
630 .write = acpi_battery_write_##_name, \
631 .release = single_release, \
632 .owner = THIS_MODULE, \
633 }, \
730 } 634 }
731 635
732 end:
733 result = acpi_read_funcs[fid].print(seq, result);
734 acpi_battery_check_result(battery, result);
735 battery->flags.update[fid] = result;
736 mutex_unlock(&battery->mutex);
737 return result;
738}
739
740static int acpi_battery_read_info(struct seq_file *seq, void *offset)
741{
742 return acpi_battery_read(ACPI_BATTERY_INFO, seq);
743}
744
745static int acpi_battery_read_state(struct seq_file *seq, void *offset)
746{
747 return acpi_battery_read(ACPI_BATTERY_STATE, seq);
748}
749
750static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
751{
752 return acpi_battery_read(ACPI_BATTERY_ALARM, seq);
753}
754
755static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
756{
757 return single_open(file, acpi_battery_read_info, PDE(inode)->data);
758}
759
760static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
761{
762 return single_open(file, acpi_battery_read_state, PDE(inode)->data);
763}
764
765static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
766{
767 return single_open(file, acpi_battery_read_alarm, PDE(inode)->data);
768}
769
770static struct battery_file { 636static struct battery_file {
771 struct file_operations ops; 637 struct file_operations ops;
772 mode_t mode; 638 mode_t mode;
773 char *name; 639 char *name;
774} acpi_battery_file[] = { 640} acpi_battery_file[] = {
775 { 641 FILE_DESCRIPTION_RO(info),
776 .name = "info", 642 FILE_DESCRIPTION_RO(state),
777 .mode = S_IRUGO, 643 FILE_DESCRIPTION_RW(alarm),
778 .ops = {
779 .open = acpi_battery_info_open_fs,
780 .read = seq_read,
781 .llseek = seq_lseek,
782 .release = single_release,
783 .owner = THIS_MODULE,
784 },
785 },
786 {
787 .name = "state",
788 .mode = S_IRUGO,
789 .ops = {
790 .open = acpi_battery_state_open_fs,
791 .read = seq_read,
792 .llseek = seq_lseek,
793 .release = single_release,
794 .owner = THIS_MODULE,
795 },
796 },
797 {
798 .name = "alarm",
799 .mode = S_IFREG | S_IRUGO | S_IWUSR,
800 .ops = {
801 .open = acpi_battery_alarm_open_fs,
802 .read = seq_read,
803 .write = acpi_battery_write_alarm,
804 .llseek = seq_lseek,
805 .release = single_release,
806 .owner = THIS_MODULE,
807 },
808 },
809}; 644};
810 645
646#undef FILE_DESCRIPTION_RO
647#undef FILE_DESCRIPTION_RW
648
811static int acpi_battery_add_fs(struct acpi_device *device) 649static int acpi_battery_add_fs(struct acpi_device *device)
812{ 650{
813 struct proc_dir_entry *entry = NULL; 651 struct proc_dir_entry *entry = NULL;
@@ -832,25 +670,51 @@ static int acpi_battery_add_fs(struct acpi_device *device)
832 entry->owner = THIS_MODULE; 670 entry->owner = THIS_MODULE;
833 } 671 }
834 } 672 }
835
836 return 0; 673 return 0;
837} 674}
838 675
839static int acpi_battery_remove_fs(struct acpi_device *device) 676static void acpi_battery_remove_fs(struct acpi_device *device)
840{ 677{
841 int i; 678 int i;
842 if (acpi_device_dir(device)) { 679 if (!acpi_device_dir(device))
843 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) { 680 return;
844 remove_proc_entry(acpi_battery_file[i].name, 681 for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i)
682 remove_proc_entry(acpi_battery_file[i].name,
845 acpi_device_dir(device)); 683 acpi_device_dir(device));
846 }
847 remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
848 acpi_device_dir(device) = NULL;
849 }
850 684
851 return 0; 685 remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
686 acpi_device_dir(device) = NULL;
687}
688
689#endif
690
691static ssize_t acpi_battery_alarm_show(struct device *dev,
692 struct device_attribute *attr,
693 char *buf)
694{
695 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
696 return sprintf(buf, "%d\n", battery->alarm * 1000);
697}
698
699static ssize_t acpi_battery_alarm_store(struct device *dev,
700 struct device_attribute *attr,
701 const char *buf, size_t count)
702{
703 unsigned long x;
704 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
705 if (sscanf(buf, "%ld\n", &x) == 1)
706 battery->alarm = x/1000;
707 if (acpi_battery_present(battery))
708 acpi_battery_set_alarm(battery);
709 return count;
852} 710}
853 711
712static struct device_attribute alarm_attr = {
713 .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE},
714 .show = acpi_battery_alarm_show,
715 .store = acpi_battery_alarm_store,
716};
717
854/* -------------------------------------------------------------------------- 718/* --------------------------------------------------------------------------
855 Driver Interface 719 Driver Interface
856 -------------------------------------------------------------------------- */ 720 -------------------------------------------------------------------------- */
@@ -858,33 +722,17 @@ static int acpi_battery_remove_fs(struct acpi_device *device)
858static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) 722static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
859{ 723{
860 struct acpi_battery *battery = data; 724 struct acpi_battery *battery = data;
861 struct acpi_device *device = NULL; 725 struct acpi_device *device;
862
863 if (!battery) 726 if (!battery)
864 return; 727 return;
865
866 device = battery->device; 728 device = battery->device;
867 729 acpi_battery_update(battery);
868 switch (event) { 730 acpi_bus_generate_proc_event(device, event,
869 case ACPI_BATTERY_NOTIFY_STATUS: 731 acpi_battery_present(battery));
870 case ACPI_BATTERY_NOTIFY_INFO: 732 acpi_bus_generate_netlink_event(device->pnp.device_class,
871 case ACPI_NOTIFY_BUS_CHECK: 733 device->dev.bus_id, event,
872 case ACPI_NOTIFY_DEVICE_CHECK:
873 device = battery->device;
874 acpi_battery_notify_update(battery);
875 acpi_bus_generate_proc_event(device, event,
876 acpi_battery_present(battery)); 734 acpi_battery_present(battery));
877 acpi_bus_generate_netlink_event(device->pnp.device_class, 735 kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE);
878 device->dev.bus_id, event,
879 acpi_battery_present(battery));
880 break;
881 default:
882 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
883 "Unsupported event [0x%x]\n", event));
884 break;
885 }
886
887 return;
888} 736}
889 737
890static int acpi_battery_add(struct acpi_device *device) 738static int acpi_battery_add(struct acpi_device *device)
@@ -892,33 +740,27 @@ static int acpi_battery_add(struct acpi_device *device)
892 int result = 0; 740 int result = 0;
893 acpi_status status = 0; 741 acpi_status status = 0;
894 struct acpi_battery *battery = NULL; 742 struct acpi_battery *battery = NULL;
895
896 if (!device) 743 if (!device)
897 return -EINVAL; 744 return -EINVAL;
898
899 battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL); 745 battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL);
900 if (!battery) 746 if (!battery)
901 return -ENOMEM; 747 return -ENOMEM;
902
903 mutex_init(&battery->mutex);
904
905 mutex_lock(&battery->mutex);
906
907 battery->device = device; 748 battery->device = device;
908 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 749 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
909 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 750 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
910 acpi_driver_data(device) = battery; 751 acpi_driver_data(device) = battery;
911 752 mutex_init(&battery->lock);
912 result = acpi_battery_get_status(battery); 753 acpi_battery_update(battery);
913 if (result) 754#ifdef CONFIG_ACPI_PROCFS
914 goto end;
915
916 battery->flags.init_update = 1;
917
918 result = acpi_battery_add_fs(device); 755 result = acpi_battery_add_fs(device);
919 if (result) 756 if (result)
920 goto end; 757 goto end;
921 758#endif
759 battery->bat.name = acpi_device_bid(device);
760 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
761 battery->bat.get_property = acpi_battery_get_property;
762 result = power_supply_register(&battery->device->dev, &battery->bat);
763 result = device_create_file(battery->bat.dev, &alarm_attr);
922 status = acpi_install_notify_handler(device->handle, 764 status = acpi_install_notify_handler(device->handle,
923 ACPI_ALL_NOTIFY, 765 ACPI_ALL_NOTIFY,
924 acpi_battery_notify, battery); 766 acpi_battery_notify, battery);
@@ -927,20 +769,16 @@ static int acpi_battery_add(struct acpi_device *device)
927 result = -ENODEV; 769 result = -ENODEV;
928 goto end; 770 goto end;
929 } 771 }
930
931 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", 772 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
932 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), 773 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
933 device->status.battery_present ? "present" : "absent"); 774 device->status.battery_present ? "present" : "absent");
934
935 end: 775 end:
936
937 if (result) { 776 if (result) {
777#ifdef CONFIG_ACPI_PROCFS
938 acpi_battery_remove_fs(device); 778 acpi_battery_remove_fs(device);
779#endif
939 kfree(battery); 780 kfree(battery);
940 } 781 }
941
942 mutex_unlock(&battery->mutex);
943
944 return result; 782 return result;
945} 783}
946 784
@@ -951,27 +789,19 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
951 789
952 if (!device || !acpi_driver_data(device)) 790 if (!device || !acpi_driver_data(device))
953 return -EINVAL; 791 return -EINVAL;
954
955 battery = acpi_driver_data(device); 792 battery = acpi_driver_data(device);
956
957 mutex_lock(&battery->mutex);
958
959 status = acpi_remove_notify_handler(device->handle, 793 status = acpi_remove_notify_handler(device->handle,
960 ACPI_ALL_NOTIFY, 794 ACPI_ALL_NOTIFY,
961 acpi_battery_notify); 795 acpi_battery_notify);
962 796#ifdef CONFIG_ACPI_PROCFS
963 acpi_battery_remove_fs(device); 797 acpi_battery_remove_fs(device);
964 798#endif
965 kfree(battery->bif_data.pointer); 799 if (battery->bat.dev) {
966 800 device_remove_file(battery->bat.dev, &alarm_attr);
967 kfree(battery->bst_data.pointer); 801 power_supply_unregister(&battery->bat);
968 802 }
969 mutex_unlock(&battery->mutex); 803 mutex_destroy(&battery->lock);
970
971 mutex_destroy(&battery->mutex);
972
973 kfree(battery); 804 kfree(battery);
974
975 return 0; 805 return 0;
976} 806}
977 807
@@ -979,44 +809,48 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
979static int acpi_battery_resume(struct acpi_device *device) 809static int acpi_battery_resume(struct acpi_device *device)
980{ 810{
981 struct acpi_battery *battery; 811 struct acpi_battery *battery;
982
983 if (!device) 812 if (!device)
984 return -EINVAL; 813 return -EINVAL;
985 814 battery = acpi_driver_data(device);
986 battery = device->driver_data; 815 battery->update_time = 0;
987
988 battery->flags.init_update = 1;
989
990 return 0; 816 return 0;
991} 817}
992 818
819static struct acpi_driver acpi_battery_driver = {
820 .name = "battery",
821 .class = ACPI_BATTERY_CLASS,
822 .ids = battery_device_ids,
823 .ops = {
824 .add = acpi_battery_add,
825 .resume = acpi_battery_resume,
826 .remove = acpi_battery_remove,
827 },
828};
829
993static int __init acpi_battery_init(void) 830static int __init acpi_battery_init(void)
994{ 831{
995 int result;
996
997 if (acpi_disabled) 832 if (acpi_disabled)
998 return -ENODEV; 833 return -ENODEV;
999 834#ifdef CONFIG_ACPI_PROCFS
1000 acpi_battery_dir = acpi_lock_battery_dir(); 835 acpi_battery_dir = acpi_lock_battery_dir();
1001 if (!acpi_battery_dir) 836 if (!acpi_battery_dir)
1002 return -ENODEV; 837 return -ENODEV;
1003 838#endif
1004 result = acpi_bus_register_driver(&acpi_battery_driver); 839 if (acpi_bus_register_driver(&acpi_battery_driver) < 0) {
1005 if (result < 0) { 840#ifdef CONFIG_ACPI_PROCFS
1006 acpi_unlock_battery_dir(acpi_battery_dir); 841 acpi_unlock_battery_dir(acpi_battery_dir);
842#endif
1007 return -ENODEV; 843 return -ENODEV;
1008 } 844 }
1009
1010 return 0; 845 return 0;
1011} 846}
1012 847
1013static void __exit acpi_battery_exit(void) 848static void __exit acpi_battery_exit(void)
1014{ 849{
1015 acpi_bus_unregister_driver(&acpi_battery_driver); 850 acpi_bus_unregister_driver(&acpi_battery_driver);
1016 851#ifdef CONFIG_ACPI_PROCFS
1017 acpi_unlock_battery_dir(acpi_battery_dir); 852 acpi_unlock_battery_dir(acpi_battery_dir);
1018 853#endif
1019 return;
1020} 854}
1021 855
1022module_init(acpi_battery_init); 856module_init(acpi_battery_init);
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index cbfc81579c9a..fb2cff9a2d24 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -286,15 +286,11 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
286 286
287extern int event_is_open; 287extern int event_is_open;
288 288
289int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) 289int acpi_bus_generate_proc_event4(const char *device_class, const char *bus_id, u8 type, int data)
290{ 290{
291 struct acpi_bus_event *event = NULL; 291 struct acpi_bus_event *event;
292 unsigned long flags = 0; 292 unsigned long flags = 0;
293 293
294
295 if (!device)
296 return -EINVAL;
297
298 /* drop event on the floor if no one's listening */ 294 /* drop event on the floor if no one's listening */
299 if (!event_is_open) 295 if (!event_is_open)
300 return 0; 296 return 0;
@@ -303,8 +299,8 @@ int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
303 if (!event) 299 if (!event)
304 return -ENOMEM; 300 return -ENOMEM;
305 301
306 strcpy(event->device_class, device->pnp.device_class); 302 strcpy(event->device_class, device_class);
307 strcpy(event->bus_id, device->pnp.bus_id); 303 strcpy(event->bus_id, bus_id);
308 event->type = type; 304 event->type = type;
309 event->data = data; 305 event->data = data;
310 306
@@ -315,6 +311,17 @@ int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
315 wake_up_interruptible(&acpi_bus_event_queue); 311 wake_up_interruptible(&acpi_bus_event_queue);
316 312
317 return 0; 313 return 0;
314
315}
316
317EXPORT_SYMBOL_GPL(acpi_bus_generate_proc_event4);
318
319int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
320{
321 if (!device)
322 return -EINVAL;
323 return acpi_bus_generate_proc_event4(device->pnp.device_class,
324 device->pnp.bus_id, type, data);
318} 325}
319 326
320EXPORT_SYMBOL(acpi_bus_generate_proc_event); 327EXPORT_SYMBOL(acpi_bus_generate_proc_event);
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 2e79a3395ecf..301e832e6961 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -434,18 +434,18 @@ static int acpi_button_add(struct acpi_device *device)
434 switch (button->type) { 434 switch (button->type) {
435 case ACPI_BUTTON_TYPE_POWER: 435 case ACPI_BUTTON_TYPE_POWER:
436 case ACPI_BUTTON_TYPE_POWERF: 436 case ACPI_BUTTON_TYPE_POWERF:
437 input->evbit[0] = BIT(EV_KEY); 437 input->evbit[0] = BIT_MASK(EV_KEY);
438 set_bit(KEY_POWER, input->keybit); 438 set_bit(KEY_POWER, input->keybit);
439 break; 439 break;
440 440
441 case ACPI_BUTTON_TYPE_SLEEP: 441 case ACPI_BUTTON_TYPE_SLEEP:
442 case ACPI_BUTTON_TYPE_SLEEPF: 442 case ACPI_BUTTON_TYPE_SLEEPF:
443 input->evbit[0] = BIT(EV_KEY); 443 input->evbit[0] = BIT_MASK(EV_KEY);
444 set_bit(KEY_SLEEP, input->keybit); 444 set_bit(KEY_SLEEP, input->keybit);
445 break; 445 break;
446 446
447 case ACPI_BUTTON_TYPE_LID: 447 case ACPI_BUTTON_TYPE_LID:
448 input->evbit[0] = BIT(EV_SW); 448 input->evbit[0] = BIT_MASK(EV_SW);
449 set_bit(SW_LID, input->swbit); 449 set_bit(SW_LID, input->swbit);
450 break; 450 break;
451 } 451 }
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 3f7935ab0cf5..7b4178393e34 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -121,6 +121,7 @@ static struct acpi_ec {
121 atomic_t event_count; 121 atomic_t event_count;
122 wait_queue_head_t wait; 122 wait_queue_head_t wait;
123 struct list_head list; 123 struct list_head list;
124 u8 handlers_installed;
124} *boot_ec, *first_ec; 125} *boot_ec, *first_ec;
125 126
126/* -------------------------------------------------------------------------- 127/* --------------------------------------------------------------------------
@@ -425,7 +426,7 @@ int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
425 handler->func = func; 426 handler->func = func;
426 handler->data = data; 427 handler->data = data;
427 mutex_lock(&ec->lock); 428 mutex_lock(&ec->lock);
428 list_add_tail(&handler->node, &ec->list); 429 list_add(&handler->node, &ec->list);
429 mutex_unlock(&ec->lock); 430 mutex_unlock(&ec->lock);
430 return 0; 431 return 0;
431} 432}
@@ -440,7 +441,6 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
440 if (query_bit == handler->query_bit) { 441 if (query_bit == handler->query_bit) {
441 list_del(&handler->node); 442 list_del(&handler->node);
442 kfree(handler); 443 kfree(handler);
443 break;
444 } 444 }
445 } 445 }
446 mutex_unlock(&ec->lock); 446 mutex_unlock(&ec->lock);
@@ -680,32 +680,50 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
680 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); 680 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
681 if (ACPI_FAILURE(status)) 681 if (ACPI_FAILURE(status))
682 return status; 682 return status;
683
684 /* Find and register all query methods */ 683 /* Find and register all query methods */
685 acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, 684 acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
686 acpi_ec_register_query_methods, ec, NULL); 685 acpi_ec_register_query_methods, ec, NULL);
687
688 /* Use the global lock for all EC transactions? */ 686 /* Use the global lock for all EC transactions? */
689 acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); 687 acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
690
691 ec->handle = handle; 688 ec->handle = handle;
692
693 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
694 ec->gpe, ec->command_addr, ec->data_addr);
695
696 return AE_CTRL_TERMINATE; 689 return AE_CTRL_TERMINATE;
697} 690}
698 691
692static void ec_remove_handlers(struct acpi_ec *ec)
693{
694 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
695 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
696 printk(KERN_ERR PREFIX "failed to remove space handler\n");
697 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
698 &acpi_ec_gpe_handler)))
699 printk(KERN_ERR PREFIX "failed to remove gpe handler\n");
700 ec->handlers_installed = 0;
701}
702
699static int acpi_ec_add(struct acpi_device *device) 703static int acpi_ec_add(struct acpi_device *device)
700{ 704{
701 struct acpi_ec *ec = NULL; 705 struct acpi_ec *ec = NULL;
702 706
703 if (!device) 707 if (!device)
704 return -EINVAL; 708 return -EINVAL;
705
706 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); 709 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
707 strcpy(acpi_device_class(device), ACPI_EC_CLASS); 710 strcpy(acpi_device_class(device), ACPI_EC_CLASS);
708 711
712 /* Check for boot EC */
713 if (boot_ec) {
714 if (boot_ec->handle == device->handle) {
715 /* Pre-loaded EC from DSDT, just move pointer */
716 ec = boot_ec;
717 boot_ec = NULL;
718 goto end;
719 } else if (boot_ec->handle == ACPI_ROOT_OBJECT) {
720 /* ECDT-based EC, time to shut it down */
721 ec_remove_handlers(boot_ec);
722 kfree(boot_ec);
723 first_ec = boot_ec = NULL;
724 }
725 }
726
709 ec = make_acpi_ec(); 727 ec = make_acpi_ec();
710 if (!ec) 728 if (!ec)
711 return -ENOMEM; 729 return -ENOMEM;
@@ -715,25 +733,14 @@ static int acpi_ec_add(struct acpi_device *device)
715 kfree(ec); 733 kfree(ec);
716 return -EINVAL; 734 return -EINVAL;
717 } 735 }
718
719 /* Check if we found the boot EC */
720 if (boot_ec) {
721 if (boot_ec->gpe == ec->gpe) {
722 /* We might have incorrect info for GL at boot time */
723 mutex_lock(&boot_ec->lock);
724 boot_ec->global_lock = ec->global_lock;
725 /* Copy handlers from new ec into boot ec */
726 list_splice(&ec->list, &boot_ec->list);
727 mutex_unlock(&boot_ec->lock);
728 kfree(ec);
729 ec = boot_ec;
730 }
731 } else
732 first_ec = ec;
733 ec->handle = device->handle; 736 ec->handle = device->handle;
737 end:
738 if (!first_ec)
739 first_ec = ec;
734 acpi_driver_data(device) = ec; 740 acpi_driver_data(device) = ec;
735
736 acpi_ec_add_fs(device); 741 acpi_ec_add_fs(device);
742 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
743 ec->gpe, ec->command_addr, ec->data_addr);
737 return 0; 744 return 0;
738} 745}
739 746
@@ -756,10 +763,7 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
756 acpi_driver_data(device) = NULL; 763 acpi_driver_data(device) = NULL;
757 if (ec == first_ec) 764 if (ec == first_ec)
758 first_ec = NULL; 765 first_ec = NULL;
759 766 kfree(ec);
760 /* Don't touch boot EC */
761 if (boot_ec != ec)
762 kfree(ec);
763 return 0; 767 return 0;
764} 768}
765 769
@@ -789,6 +793,8 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context)
789static int ec_install_handlers(struct acpi_ec *ec) 793static int ec_install_handlers(struct acpi_ec *ec)
790{ 794{
791 acpi_status status; 795 acpi_status status;
796 if (ec->handlers_installed)
797 return 0;
792 status = acpi_install_gpe_handler(NULL, ec->gpe, 798 status = acpi_install_gpe_handler(NULL, ec->gpe,
793 ACPI_GPE_EDGE_TRIGGERED, 799 ACPI_GPE_EDGE_TRIGGERED,
794 &acpi_ec_gpe_handler, ec); 800 &acpi_ec_gpe_handler, ec);
@@ -807,6 +813,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
807 return -ENODEV; 813 return -ENODEV;
808 } 814 }
809 815
816 ec->handlers_installed = 1;
810 return 0; 817 return 0;
811} 818}
812 819
@@ -823,41 +830,22 @@ static int acpi_ec_start(struct acpi_device *device)
823 if (!ec) 830 if (!ec)
824 return -EINVAL; 831 return -EINVAL;
825 832
826 /* Boot EC is already working */ 833 ret = ec_install_handlers(ec);
827 if (ec != boot_ec)
828 ret = ec_install_handlers(ec);
829 834
830 /* EC is fully operational, allow queries */ 835 /* EC is fully operational, allow queries */
831 atomic_set(&ec->query_pending, 0); 836 atomic_set(&ec->query_pending, 0);
832
833 return ret; 837 return ret;
834} 838}
835 839
836static int acpi_ec_stop(struct acpi_device *device, int type) 840static int acpi_ec_stop(struct acpi_device *device, int type)
837{ 841{
838 acpi_status status;
839 struct acpi_ec *ec; 842 struct acpi_ec *ec;
840
841 if (!device) 843 if (!device)
842 return -EINVAL; 844 return -EINVAL;
843
844 ec = acpi_driver_data(device); 845 ec = acpi_driver_data(device);
845 if (!ec) 846 if (!ec)
846 return -EINVAL; 847 return -EINVAL;
847 848 ec_remove_handlers(ec);
848 /* Don't touch boot EC */
849 if (ec == boot_ec)
850 return 0;
851
852 status = acpi_remove_address_space_handler(ec->handle,
853 ACPI_ADR_SPACE_EC,
854 &acpi_ec_space_handler);
855 if (ACPI_FAILURE(status))
856 return -ENODEV;
857
858 status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
859 if (ACPI_FAILURE(status))
860 return -ENODEV;
861 849
862 return 0; 850 return 0;
863} 851}
@@ -877,7 +865,7 @@ int __init acpi_ec_ecdt_probe(void)
877 status = acpi_get_table(ACPI_SIG_ECDT, 1, 865 status = acpi_get_table(ACPI_SIG_ECDT, 1,
878 (struct acpi_table_header **)&ecdt_ptr); 866 (struct acpi_table_header **)&ecdt_ptr);
879 if (ACPI_SUCCESS(status)) { 867 if (ACPI_SUCCESS(status)) {
880 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n\n"); 868 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n");
881 boot_ec->command_addr = ecdt_ptr->control.address; 869 boot_ec->command_addr = ecdt_ptr->control.address;
882 boot_ec->data_addr = ecdt_ptr->data.address; 870 boot_ec->data_addr = ecdt_ptr->data.address;
883 boot_ec->gpe = ecdt_ptr->gpe; 871 boot_ec->gpe = ecdt_ptr->gpe;
@@ -899,7 +887,6 @@ int __init acpi_ec_ecdt_probe(void)
899 error: 887 error:
900 kfree(boot_ec); 888 kfree(boot_ec);
901 boot_ec = NULL; 889 boot_ec = NULL;
902
903 return -ENODEV; 890 return -ENODEV;
904} 891}
905 892
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c
index a1f87b5def2a..e41287815ea1 100644
--- a/drivers/acpi/events/evevent.c
+++ b/drivers/acpi/events/evevent.c
@@ -239,10 +239,8 @@ u32 acpi_ev_fixed_event_detect(void)
239 * Read the fixed feature status and enable registers, as all the cases 239 * Read the fixed feature status and enable registers, as all the cases
240 * depend on their values. Ignore errors here. 240 * depend on their values. Ignore errors here.
241 */ 241 */
242 (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 242 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS, &fixed_status);
243 ACPI_REGISTER_PM1_STATUS, &fixed_status); 243 (void)acpi_hw_register_read(ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
244 (void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
245 ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
246 244
247 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS, 245 ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
248 "Fixed Event Block: Enable %08X Status %08X\n", 246 "Fixed Event Block: Enable %08X Status %08X\n",
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c
index 1d371fa663f2..73f9c5fb1ba7 100644
--- a/drivers/acpi/hardware/hwregs.c
+++ b/drivers/acpi/hardware/hwregs.c
@@ -75,8 +75,7 @@ acpi_status acpi_hw_clear_acpi_status(void)
75 75
76 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); 76 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
77 77
78 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 78 status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
79 ACPI_REGISTER_PM1_STATUS,
80 ACPI_BITMASK_ALL_FIXED_STATUS); 79 ACPI_BITMASK_ALL_FIXED_STATUS);
81 if (ACPI_FAILURE(status)) { 80 if (ACPI_FAILURE(status)) {
82 goto unlock_and_exit; 81 goto unlock_and_exit;
@@ -259,7 +258,7 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
259 * 258 *
260 ******************************************************************************/ 259 ******************************************************************************/
261 260
262acpi_status acpi_get_register(u32 register_id, u32 * return_value) 261acpi_status acpi_get_register_unlocked(u32 register_id, u32 * return_value)
263{ 262{
264 u32 register_value = 0; 263 u32 register_value = 0;
265 struct acpi_bit_register_info *bit_reg_info; 264 struct acpi_bit_register_info *bit_reg_info;
@@ -276,8 +275,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value)
276 275
277 /* Read from the register */ 276 /* Read from the register */
278 277
279 status = acpi_hw_register_read(ACPI_MTX_LOCK, 278 status = acpi_hw_register_read(bit_reg_info->parent_register,
280 bit_reg_info->parent_register,
281 &register_value); 279 &register_value);
282 280
283 if (ACPI_SUCCESS(status)) { 281 if (ACPI_SUCCESS(status)) {
@@ -298,6 +296,16 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value)
298 return_ACPI_STATUS(status); 296 return_ACPI_STATUS(status);
299} 297}
300 298
299acpi_status acpi_get_register(u32 register_id, u32 * return_value)
300{
301 acpi_status status;
302 acpi_cpu_flags flags;
303 flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
304 status = acpi_get_register_unlocked(register_id, return_value);
305 acpi_os_release_lock(acpi_gbl_hardware_lock, flags);
306 return status;
307}
308
301ACPI_EXPORT_SYMBOL(acpi_get_register) 309ACPI_EXPORT_SYMBOL(acpi_get_register)
302 310
303/******************************************************************************* 311/*******************************************************************************
@@ -335,8 +343,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
335 343
336 /* Always do a register read first so we can insert the new bits */ 344 /* Always do a register read first so we can insert the new bits */
337 345
338 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 346 status = acpi_hw_register_read(bit_reg_info->parent_register,
339 bit_reg_info->parent_register,
340 &register_value); 347 &register_value);
341 if (ACPI_FAILURE(status)) { 348 if (ACPI_FAILURE(status)) {
342 goto unlock_and_exit; 349 goto unlock_and_exit;
@@ -363,8 +370,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
363 bit_reg_info-> 370 bit_reg_info->
364 access_bit_mask); 371 access_bit_mask);
365 if (value) { 372 if (value) {
366 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 373 status = acpi_hw_register_write(ACPI_REGISTER_PM1_STATUS,
367 ACPI_REGISTER_PM1_STATUS,
368 (u16) value); 374 (u16) value);
369 register_value = 0; 375 register_value = 0;
370 } 376 }
@@ -377,8 +383,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
377 bit_reg_info->access_bit_mask, 383 bit_reg_info->access_bit_mask,
378 value); 384 value);
379 385
380 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 386 status = acpi_hw_register_write(ACPI_REGISTER_PM1_ENABLE,
381 ACPI_REGISTER_PM1_ENABLE,
382 (u16) register_value); 387 (u16) register_value);
383 break; 388 break;
384 389
@@ -397,15 +402,13 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
397 bit_reg_info->access_bit_mask, 402 bit_reg_info->access_bit_mask,
398 value); 403 value);
399 404
400 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 405 status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
401 ACPI_REGISTER_PM1_CONTROL,
402 (u16) register_value); 406 (u16) register_value);
403 break; 407 break;
404 408
405 case ACPI_REGISTER_PM2_CONTROL: 409 case ACPI_REGISTER_PM2_CONTROL:
406 410
407 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 411 status = acpi_hw_register_read(ACPI_REGISTER_PM2_CONTROL,
408 ACPI_REGISTER_PM2_CONTROL,
409 &register_value); 412 &register_value);
410 if (ACPI_FAILURE(status)) { 413 if (ACPI_FAILURE(status)) {
411 goto unlock_and_exit; 414 goto unlock_and_exit;
@@ -430,8 +433,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value)
430 xpm2_control_block. 433 xpm2_control_block.
431 address))); 434 address)));
432 435
433 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 436 status = acpi_hw_register_write(ACPI_REGISTER_PM2_CONTROL,
434 ACPI_REGISTER_PM2_CONTROL,
435 (u8) (register_value)); 437 (u8) (register_value));
436 break; 438 break;
437 439
@@ -461,8 +463,7 @@ ACPI_EXPORT_SYMBOL(acpi_set_register)
461 * 463 *
462 * FUNCTION: acpi_hw_register_read 464 * FUNCTION: acpi_hw_register_read
463 * 465 *
464 * PARAMETERS: use_lock - Lock hardware? True/False 466 * PARAMETERS: register_id - ACPI Register ID
465 * register_id - ACPI Register ID
466 * return_value - Where the register value is returned 467 * return_value - Where the register value is returned
467 * 468 *
468 * RETURN: Status and the value read. 469 * RETURN: Status and the value read.
@@ -471,19 +472,14 @@ ACPI_EXPORT_SYMBOL(acpi_set_register)
471 * 472 *
472 ******************************************************************************/ 473 ******************************************************************************/
473acpi_status 474acpi_status
474acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) 475acpi_hw_register_read(u32 register_id, u32 * return_value)
475{ 476{
476 u32 value1 = 0; 477 u32 value1 = 0;
477 u32 value2 = 0; 478 u32 value2 = 0;
478 acpi_status status; 479 acpi_status status;
479 acpi_cpu_flags lock_flags = 0;
480 480
481 ACPI_FUNCTION_TRACE(hw_register_read); 481 ACPI_FUNCTION_TRACE(hw_register_read);
482 482
483 if (ACPI_MTX_LOCK == use_lock) {
484 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
485 }
486
487 switch (register_id) { 483 switch (register_id) {
488 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ 484 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
489 485
@@ -491,7 +487,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
491 acpi_hw_low_level_read(16, &value1, 487 acpi_hw_low_level_read(16, &value1,
492 &acpi_gbl_FADT.xpm1a_event_block); 488 &acpi_gbl_FADT.xpm1a_event_block);
493 if (ACPI_FAILURE(status)) { 489 if (ACPI_FAILURE(status)) {
494 goto unlock_and_exit; 490 goto exit;
495 } 491 }
496 492
497 /* PM1B is optional */ 493 /* PM1B is optional */
@@ -507,7 +503,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
507 status = 503 status =
508 acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable); 504 acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
509 if (ACPI_FAILURE(status)) { 505 if (ACPI_FAILURE(status)) {
510 goto unlock_and_exit; 506 goto exit;
511 } 507 }
512 508
513 /* PM1B is optional */ 509 /* PM1B is optional */
@@ -523,7 +519,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
523 acpi_hw_low_level_read(16, &value1, 519 acpi_hw_low_level_read(16, &value1,
524 &acpi_gbl_FADT.xpm1a_control_block); 520 &acpi_gbl_FADT.xpm1a_control_block);
525 if (ACPI_FAILURE(status)) { 521 if (ACPI_FAILURE(status)) {
526 goto unlock_and_exit; 522 goto exit;
527 } 523 }
528 524
529 status = 525 status =
@@ -558,10 +554,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
558 break; 554 break;
559 } 555 }
560 556
561 unlock_and_exit: 557 exit:
562 if (ACPI_MTX_LOCK == use_lock) {
563 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
564 }
565 558
566 if (ACPI_SUCCESS(status)) { 559 if (ACPI_SUCCESS(status)) {
567 *return_value = value1; 560 *return_value = value1;
@@ -574,8 +567,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
574 * 567 *
575 * FUNCTION: acpi_hw_register_write 568 * FUNCTION: acpi_hw_register_write
576 * 569 *
577 * PARAMETERS: use_lock - Lock hardware? True/False 570 * PARAMETERS: register_id - ACPI Register ID
578 * register_id - ACPI Register ID
579 * Value - The value to write 571 * Value - The value to write
580 * 572 *
581 * RETURN: Status 573 * RETURN: Status
@@ -597,28 +589,22 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
597 * 589 *
598 ******************************************************************************/ 590 ******************************************************************************/
599 591
600acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) 592acpi_status acpi_hw_register_write(u32 register_id, u32 value)
601{ 593{
602 acpi_status status; 594 acpi_status status;
603 acpi_cpu_flags lock_flags = 0;
604 u32 read_value; 595 u32 read_value;
605 596
606 ACPI_FUNCTION_TRACE(hw_register_write); 597 ACPI_FUNCTION_TRACE(hw_register_write);
607 598
608 if (ACPI_MTX_LOCK == use_lock) {
609 lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock);
610 }
611
612 switch (register_id) { 599 switch (register_id) {
613 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ 600 case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
614 601
615 /* Perform a read first to preserve certain bits (per ACPI spec) */ 602 /* Perform a read first to preserve certain bits (per ACPI spec) */
616 603
617 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 604 status = acpi_hw_register_read(ACPI_REGISTER_PM1_STATUS,
618 ACPI_REGISTER_PM1_STATUS,
619 &read_value); 605 &read_value);
620 if (ACPI_FAILURE(status)) { 606 if (ACPI_FAILURE(status)) {
621 goto unlock_and_exit; 607 goto exit;
622 } 608 }
623 609
624 /* Insert the bits to be preserved */ 610 /* Insert the bits to be preserved */
@@ -632,7 +618,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
632 acpi_hw_low_level_write(16, value, 618 acpi_hw_low_level_write(16, value,
633 &acpi_gbl_FADT.xpm1a_event_block); 619 &acpi_gbl_FADT.xpm1a_event_block);
634 if (ACPI_FAILURE(status)) { 620 if (ACPI_FAILURE(status)) {
635 goto unlock_and_exit; 621 goto exit;
636 } 622 }
637 623
638 /* PM1B is optional */ 624 /* PM1B is optional */
@@ -647,7 +633,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
647 status = 633 status =
648 acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable); 634 acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
649 if (ACPI_FAILURE(status)) { 635 if (ACPI_FAILURE(status)) {
650 goto unlock_and_exit; 636 goto exit;
651 } 637 }
652 638
653 /* PM1B is optional */ 639 /* PM1B is optional */
@@ -661,11 +647,10 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
661 /* 647 /*
662 * Perform a read first to preserve certain bits (per ACPI spec) 648 * Perform a read first to preserve certain bits (per ACPI spec)
663 */ 649 */
664 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 650 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
665 ACPI_REGISTER_PM1_CONTROL,
666 &read_value); 651 &read_value);
667 if (ACPI_FAILURE(status)) { 652 if (ACPI_FAILURE(status)) {
668 goto unlock_and_exit; 653 goto exit;
669 } 654 }
670 655
671 /* Insert the bits to be preserved */ 656 /* Insert the bits to be preserved */
@@ -679,7 +664,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
679 acpi_hw_low_level_write(16, value, 664 acpi_hw_low_level_write(16, value,
680 &acpi_gbl_FADT.xpm1a_control_block); 665 &acpi_gbl_FADT.xpm1a_control_block);
681 if (ACPI_FAILURE(status)) { 666 if (ACPI_FAILURE(status)) {
682 goto unlock_and_exit; 667 goto exit;
683 } 668 }
684 669
685 status = 670 status =
@@ -728,11 +713,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
728 break; 713 break;
729 } 714 }
730 715
731 unlock_and_exit: 716 exit:
732 if (ACPI_MTX_LOCK == use_lock) {
733 acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags);
734 }
735
736 return_ACPI_STATUS(status); 717 return_ACPI_STATUS(status);
737} 718}
738 719
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index cf69c0040a39..81b248429703 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -234,15 +234,11 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
234 "While executing method _SST")); 234 "While executing method _SST"));
235 } 235 }
236 236
237 /* 237 /* Disable/Clear all GPEs */
238 * 1) Disable/Clear all GPEs 238
239 */
240 status = acpi_hw_disable_all_gpes(); 239 status = acpi_hw_disable_all_gpes();
241 if (ACPI_FAILURE(status)) {
242 return_ACPI_STATUS(status);
243 }
244 240
245 return_ACPI_STATUS(AE_OK); 241 return_ACPI_STATUS(status);
246} 242}
247 243
248ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) 244ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
@@ -313,8 +309,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
313 309
314 /* Get current value of PM1A control */ 310 /* Get current value of PM1A control */
315 311
316 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 312 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
317 ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
318 if (ACPI_FAILURE(status)) { 313 if (ACPI_FAILURE(status)) {
319 return_ACPI_STATUS(status); 314 return_ACPI_STATUS(status);
320 } 315 }
@@ -341,15 +336,13 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
341 336
342 /* Write #1: fill in SLP_TYP data */ 337 /* Write #1: fill in SLP_TYP data */
343 338
344 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 339 status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
345 ACPI_REGISTER_PM1A_CONTROL,
346 PM1Acontrol); 340 PM1Acontrol);
347 if (ACPI_FAILURE(status)) { 341 if (ACPI_FAILURE(status)) {
348 return_ACPI_STATUS(status); 342 return_ACPI_STATUS(status);
349 } 343 }
350 344
351 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 345 status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
352 ACPI_REGISTER_PM1B_CONTROL,
353 PM1Bcontrol); 346 PM1Bcontrol);
354 if (ACPI_FAILURE(status)) { 347 if (ACPI_FAILURE(status)) {
355 return_ACPI_STATUS(status); 348 return_ACPI_STATUS(status);
@@ -364,15 +357,13 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
364 357
365 ACPI_FLUSH_CPU_CACHE(); 358 ACPI_FLUSH_CPU_CACHE();
366 359
367 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 360 status = acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
368 ACPI_REGISTER_PM1A_CONTROL,
369 PM1Acontrol); 361 PM1Acontrol);
370 if (ACPI_FAILURE(status)) { 362 if (ACPI_FAILURE(status)) {
371 return_ACPI_STATUS(status); 363 return_ACPI_STATUS(status);
372 } 364 }
373 365
374 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 366 status = acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
375 ACPI_REGISTER_PM1B_CONTROL,
376 PM1Bcontrol); 367 PM1Bcontrol);
377 if (ACPI_FAILURE(status)) { 368 if (ACPI_FAILURE(status)) {
378 return_ACPI_STATUS(status); 369 return_ACPI_STATUS(status);
@@ -392,8 +383,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
392 */ 383 */
393 acpi_os_stall(10000000); 384 acpi_os_stall(10000000);
394 385
395 status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 386 status = acpi_hw_register_write(ACPI_REGISTER_PM1_CONTROL,
396 ACPI_REGISTER_PM1_CONTROL,
397 sleep_enable_reg_info-> 387 sleep_enable_reg_info->
398 access_bit_mask); 388 access_bit_mask);
399 if (ACPI_FAILURE(status)) { 389 if (ACPI_FAILURE(status)) {
@@ -404,7 +394,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
404 /* Wait until we enter sleep state */ 394 /* Wait until we enter sleep state */
405 395
406 do { 396 do {
407 status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value); 397 status = acpi_get_register_unlocked(ACPI_BITREG_WAKE_STATUS,
398 &in_value);
408 if (ACPI_FAILURE(status)) { 399 if (ACPI_FAILURE(status)) {
409 return_ACPI_STATUS(status); 400 return_ACPI_STATUS(status);
410 } 401 }
@@ -520,8 +511,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
520 511
521 /* Get current value of PM1A control */ 512 /* Get current value of PM1A control */
522 513
523 status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, 514 status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL,
524 ACPI_REGISTER_PM1_CONTROL,
525 &PM1Acontrol); 515 &PM1Acontrol);
526 if (ACPI_SUCCESS(status)) { 516 if (ACPI_SUCCESS(status)) {
527 517
@@ -543,11 +533,9 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
543 533
544 /* Just ignore any errors */ 534 /* Just ignore any errors */
545 535
546 (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 536 (void)acpi_hw_register_write(ACPI_REGISTER_PM1A_CONTROL,
547 ACPI_REGISTER_PM1A_CONTROL,
548 PM1Acontrol); 537 PM1Acontrol);
549 (void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, 538 (void)acpi_hw_register_write(ACPI_REGISTER_PM1B_CONTROL,
550 ACPI_REGISTER_PM1B_CONTROL,
551 PM1Bcontrol); 539 PM1Bcontrol);
552 } 540 }
553 } 541 }
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 352cf81af581..aabc6ca4a81c 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1043,14 +1043,6 @@ static int __init acpi_wake_gpes_always_on_setup(char *str)
1043__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); 1043__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
1044 1044
1045/* 1045/*
1046 * max_cstate is defined in the base kernel so modules can
1047 * change it w/o depending on the state of the processor module.
1048 */
1049unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
1050
1051EXPORT_SYMBOL(max_cstate);
1052
1053/*
1054 * Acquire a spinlock. 1046 * Acquire a spinlock.
1055 * 1047 *
1056 * handle is a pointer to the spinlock_t. 1048 * handle is a pointer to the spinlock_t.
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 9f11dc296cdd..235a51e328c3 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -44,6 +44,7 @@
44#include <linux/seq_file.h> 44#include <linux/seq_file.h>
45#include <linux/dmi.h> 45#include <linux/dmi.h>
46#include <linux/moduleparam.h> 46#include <linux/moduleparam.h>
47#include <linux/cpuidle.h>
47 48
48#include <asm/io.h> 49#include <asm/io.h>
49#include <asm/system.h> 50#include <asm/system.h>
@@ -421,12 +422,6 @@ static int map_lsapic_id(struct acpi_subtable_header *entry,
421 return 0; 422 return 0;
422} 423}
423 424
424#ifdef CONFIG_IA64
425#define arch_cpu_to_apicid ia64_cpu_to_sapicid
426#else
427#define arch_cpu_to_apicid x86_cpu_to_apicid
428#endif
429
430static int map_madt_entry(u32 acpi_id) 425static int map_madt_entry(u32 acpi_id)
431{ 426{
432 unsigned long madt_end, entry; 427 unsigned long madt_end, entry;
@@ -500,7 +495,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id)
500 return apic_id; 495 return apic_id;
501 496
502 for (i = 0; i < NR_CPUS; ++i) { 497 for (i = 0; i < NR_CPUS; ++i) {
503 if (arch_cpu_to_apicid[i] == apic_id) 498 if (cpu_physical_id(i) == apic_id)
504 return i; 499 return i;
505 } 500 }
506 return -1; 501 return -1;
@@ -1049,11 +1044,13 @@ static int __init acpi_processor_init(void)
1049 return -ENOMEM; 1044 return -ENOMEM;
1050 acpi_processor_dir->owner = THIS_MODULE; 1045 acpi_processor_dir->owner = THIS_MODULE;
1051 1046
1047 result = cpuidle_register_driver(&acpi_idle_driver);
1048 if (result < 0)
1049 goto out_proc;
1050
1052 result = acpi_bus_register_driver(&acpi_processor_driver); 1051 result = acpi_bus_register_driver(&acpi_processor_driver);
1053 if (result < 0) { 1052 if (result < 0)
1054 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 1053 goto out_cpuidle;
1055 return result;
1056 }
1057 1054
1058 acpi_processor_install_hotplug_notify(); 1055 acpi_processor_install_hotplug_notify();
1059 1056
@@ -1062,11 +1059,18 @@ static int __init acpi_processor_init(void)
1062 acpi_processor_ppc_init(); 1059 acpi_processor_ppc_init();
1063 1060
1064 return 0; 1061 return 0;
1062
1063out_cpuidle:
1064 cpuidle_unregister_driver(&acpi_idle_driver);
1065
1066out_proc:
1067 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
1068
1069 return result;
1065} 1070}
1066 1071
1067static void __exit acpi_processor_exit(void) 1072static void __exit acpi_processor_exit(void)
1068{ 1073{
1069
1070 acpi_processor_ppc_exit(); 1074 acpi_processor_ppc_exit();
1071 1075
1072 acpi_thermal_cpufreq_exit(); 1076 acpi_thermal_cpufreq_exit();
@@ -1075,6 +1079,8 @@ static void __exit acpi_processor_exit(void)
1075 1079
1076 acpi_bus_unregister_driver(&acpi_processor_driver); 1080 acpi_bus_unregister_driver(&acpi_processor_driver);
1077 1081
1082 cpuidle_unregister_driver(&acpi_idle_driver);
1083
1078 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir); 1084 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
1079 1085
1080 return; 1086 return;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 1f6fb38de017..f996d0e37689 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -40,6 +40,7 @@
40#include <linux/sched.h> /* need_resched() */ 40#include <linux/sched.h> /* need_resched() */
41#include <linux/latency.h> 41#include <linux/latency.h>
42#include <linux/clockchips.h> 42#include <linux/clockchips.h>
43#include <linux/cpuidle.h>
43 44
44/* 45/*
45 * Include the apic definitions for x86 to have the APIC timer related defines 46 * Include the apic definitions for x86 to have the APIC timer related defines
@@ -64,14 +65,22 @@ ACPI_MODULE_NAME("processor_idle");
64#define ACPI_PROCESSOR_FILE_POWER "power" 65#define ACPI_PROCESSOR_FILE_POWER "power"
65#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) 66#define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
66#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY) 67#define PM_TIMER_TICK_NS (1000000000ULL/PM_TIMER_FREQUENCY)
68#ifndef CONFIG_CPU_IDLE
67#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 69#define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */
68#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ 70#define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */
69static void (*pm_idle_save) (void) __read_mostly; 71static void (*pm_idle_save) (void) __read_mostly;
70module_param(max_cstate, uint, 0644); 72#else
73#define C2_OVERHEAD 1 /* 1us */
74#define C3_OVERHEAD 1 /* 1us */
75#endif
76#define PM_TIMER_TICKS_TO_US(p) (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
71 77
78static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
79module_param(max_cstate, uint, 0000);
72static unsigned int nocst __read_mostly; 80static unsigned int nocst __read_mostly;
73module_param(nocst, uint, 0000); 81module_param(nocst, uint, 0000);
74 82
83#ifndef CONFIG_CPU_IDLE
75/* 84/*
76 * bm_history -- bit-mask with a bit per jiffy of bus-master activity 85 * bm_history -- bit-mask with a bit per jiffy of bus-master activity
77 * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms 86 * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms
@@ -82,9 +91,10 @@ module_param(nocst, uint, 0000);
82static unsigned int bm_history __read_mostly = 91static unsigned int bm_history __read_mostly =
83 (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); 92 (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
84module_param(bm_history, uint, 0644); 93module_param(bm_history, uint, 0644);
85/* -------------------------------------------------------------------------- 94
86 Power Management 95static int acpi_processor_set_power_policy(struct acpi_processor *pr);
87 -------------------------------------------------------------------------- */ 96
97#endif
88 98
89/* 99/*
90 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3. 100 * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
@@ -177,6 +187,18 @@ static inline u32 ticks_elapsed(u32 t1, u32 t2)
177 return ((0xFFFFFFFF - t1) + t2); 187 return ((0xFFFFFFFF - t1) + t2);
178} 188}
179 189
190static inline u32 ticks_elapsed_in_us(u32 t1, u32 t2)
191{
192 if (t2 >= t1)
193 return PM_TIMER_TICKS_TO_US(t2 - t1);
194 else if (!(acpi_gbl_FADT.flags & ACPI_FADT_32BIT_TIMER))
195 return PM_TIMER_TICKS_TO_US(((0x00FFFFFF - t1) + t2) & 0x00FFFFFF);
196 else
197 return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2);
198}
199
200#ifndef CONFIG_CPU_IDLE
201
180static void 202static void
181acpi_processor_power_activate(struct acpi_processor *pr, 203acpi_processor_power_activate(struct acpi_processor *pr,
182 struct acpi_processor_cx *new) 204 struct acpi_processor_cx *new)
@@ -248,6 +270,7 @@ static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
248 unused = inl(acpi_gbl_FADT.xpm_timer_block.address); 270 unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
249 } 271 }
250} 272}
273#endif /* !CONFIG_CPU_IDLE */
251 274
252#ifdef ARCH_APICTIMER_STOPS_ON_C3 275#ifdef ARCH_APICTIMER_STOPS_ON_C3
253 276
@@ -330,6 +353,7 @@ int acpi_processor_resume(struct acpi_device * device)
330 return 0; 353 return 0;
331} 354}
332 355
356#ifndef CONFIG_CPU_IDLE
333static void acpi_processor_idle(void) 357static void acpi_processor_idle(void)
334{ 358{
335 struct acpi_processor *pr = NULL; 359 struct acpi_processor *pr = NULL;
@@ -427,7 +451,7 @@ static void acpi_processor_idle(void)
427 * an SMP system. We do it here instead of doing it at _CST/P_LVL 451 * an SMP system. We do it here instead of doing it at _CST/P_LVL
428 * detection phase, to work cleanly with logical CPU hotplug. 452 * detection phase, to work cleanly with logical CPU hotplug.
429 */ 453 */
430 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && 454 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
431 !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 455 !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
432 cx = &pr->power.states[ACPI_STATE_C1]; 456 cx = &pr->power.states[ACPI_STATE_C1];
433#endif 457#endif
@@ -727,6 +751,7 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr)
727 751
728 return 0; 752 return 0;
729} 753}
754#endif /* !CONFIG_CPU_IDLE */
730 755
731static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) 756static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
732{ 757{
@@ -744,7 +769,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
744#ifndef CONFIG_HOTPLUG_CPU 769#ifndef CONFIG_HOTPLUG_CPU
745 /* 770 /*
746 * Check for P_LVL2_UP flag before entering C2 and above on 771 * Check for P_LVL2_UP flag before entering C2 and above on
747 * an SMP system. 772 * an SMP system.
748 */ 773 */
749 if ((num_online_cpus() > 1) && 774 if ((num_online_cpus() > 1) &&
750 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 775 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
@@ -945,7 +970,12 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
945 * Normalize the C2 latency to expidite policy 970 * Normalize the C2 latency to expidite policy
946 */ 971 */
947 cx->valid = 1; 972 cx->valid = 1;
973
974#ifndef CONFIG_CPU_IDLE
948 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); 975 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
976#else
977 cx->latency_ticks = cx->latency;
978#endif
949 979
950 return; 980 return;
951} 981}
@@ -1025,7 +1055,12 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
1025 * use this in our C3 policy 1055 * use this in our C3 policy
1026 */ 1056 */
1027 cx->valid = 1; 1057 cx->valid = 1;
1058
1059#ifndef CONFIG_CPU_IDLE
1028 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); 1060 cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
1061#else
1062 cx->latency_ticks = cx->latency;
1063#endif
1029 1064
1030 return; 1065 return;
1031} 1066}
@@ -1090,6 +1125,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
1090 1125
1091 pr->power.count = acpi_processor_power_verify(pr); 1126 pr->power.count = acpi_processor_power_verify(pr);
1092 1127
1128#ifndef CONFIG_CPU_IDLE
1093 /* 1129 /*
1094 * Set Default Policy 1130 * Set Default Policy
1095 * ------------------ 1131 * ------------------
@@ -1101,6 +1137,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
1101 result = acpi_processor_set_power_policy(pr); 1137 result = acpi_processor_set_power_policy(pr);
1102 if (result) 1138 if (result)
1103 return result; 1139 return result;
1140#endif
1104 1141
1105 /* 1142 /*
1106 * if one state of type C2 or C3 is available, mark this 1143 * if one state of type C2 or C3 is available, mark this
@@ -1117,35 +1154,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
1117 return 0; 1154 return 0;
1118} 1155}
1119 1156
1120int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1121{
1122 int result = 0;
1123
1124
1125 if (!pr)
1126 return -EINVAL;
1127
1128 if (nocst) {
1129 return -ENODEV;
1130 }
1131
1132 if (!pr->flags.power_setup_done)
1133 return -ENODEV;
1134
1135 /* Fall back to the default idle loop */
1136 pm_idle = pm_idle_save;
1137 synchronize_sched(); /* Relies on interrupts forcing exit from idle. */
1138
1139 pr->flags.power = 0;
1140 result = acpi_processor_get_power_info(pr);
1141 if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
1142 pm_idle = acpi_processor_idle;
1143
1144 return result;
1145}
1146
1147/* proc interface */
1148
1149static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset) 1157static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
1150{ 1158{
1151 struct acpi_processor *pr = seq->private; 1159 struct acpi_processor *pr = seq->private;
@@ -1227,6 +1235,35 @@ static const struct file_operations acpi_processor_power_fops = {
1227 .release = single_release, 1235 .release = single_release,
1228}; 1236};
1229 1237
1238#ifndef CONFIG_CPU_IDLE
1239
1240int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1241{
1242 int result = 0;
1243
1244
1245 if (!pr)
1246 return -EINVAL;
1247
1248 if (nocst) {
1249 return -ENODEV;
1250 }
1251
1252 if (!pr->flags.power_setup_done)
1253 return -ENODEV;
1254
1255 /* Fall back to the default idle loop */
1256 pm_idle = pm_idle_save;
1257 synchronize_sched(); /* Relies on interrupts forcing exit from idle. */
1258
1259 pr->flags.power = 0;
1260 result = acpi_processor_get_power_info(pr);
1261 if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
1262 pm_idle = acpi_processor_idle;
1263
1264 return result;
1265}
1266
1230#ifdef CONFIG_SMP 1267#ifdef CONFIG_SMP
1231static void smp_callback(void *v) 1268static void smp_callback(void *v)
1232{ 1269{
@@ -1249,7 +1286,366 @@ static int acpi_processor_latency_notify(struct notifier_block *b,
1249static struct notifier_block acpi_processor_latency_notifier = { 1286static struct notifier_block acpi_processor_latency_notifier = {
1250 .notifier_call = acpi_processor_latency_notify, 1287 .notifier_call = acpi_processor_latency_notify,
1251}; 1288};
1289
1290#endif
1291
1292#else /* CONFIG_CPU_IDLE */
1293
1294/**
1295 * acpi_idle_bm_check - checks if bus master activity was detected
1296 */
1297static int acpi_idle_bm_check(void)
1298{
1299 u32 bm_status = 0;
1300
1301 acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
1302 if (bm_status)
1303 acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
1304 /*
1305 * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect
1306 * the true state of bus mastering activity; forcing us to
1307 * manually check the BMIDEA bit of each IDE channel.
1308 */
1309 else if (errata.piix4.bmisx) {
1310 if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01)
1311 || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01))
1312 bm_status = 1;
1313 }
1314 return bm_status;
1315}
1316
1317/**
1318 * acpi_idle_update_bm_rld - updates the BM_RLD bit depending on target state
1319 * @pr: the processor
1320 * @target: the new target state
1321 */
1322static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr,
1323 struct acpi_processor_cx *target)
1324{
1325 if (pr->flags.bm_rld_set && target->type != ACPI_STATE_C3) {
1326 acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
1327 pr->flags.bm_rld_set = 0;
1328 }
1329
1330 if (!pr->flags.bm_rld_set && target->type == ACPI_STATE_C3) {
1331 acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
1332 pr->flags.bm_rld_set = 1;
1333 }
1334}
1335
1336/**
1337 * acpi_idle_do_entry - a helper function that does C2 and C3 type entry
1338 * @cx: cstate data
1339 */
1340static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
1341{
1342 if (cx->space_id == ACPI_CSTATE_FFH) {
1343 /* Call into architectural FFH based C-state */
1344 acpi_processor_ffh_cstate_enter(cx);
1345 } else {
1346 int unused;
1347 /* IO port based C-state */
1348 inb(cx->address);
1349 /* Dummy wait op - must do something useless after P_LVL2 read
1350 because chipsets cannot guarantee that STPCLK# signal
1351 gets asserted in time to freeze execution properly. */
1352 unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
1353 }
1354}
1355
1356/**
1357 * acpi_idle_enter_c1 - enters an ACPI C1 state-type
1358 * @dev: the target CPU
1359 * @state: the state data
1360 *
1361 * This is equivalent to the HALT instruction.
1362 */
1363static int acpi_idle_enter_c1(struct cpuidle_device *dev,
1364 struct cpuidle_state *state)
1365{
1366 struct acpi_processor *pr;
1367 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1368 pr = processors[smp_processor_id()];
1369
1370 if (unlikely(!pr))
1371 return 0;
1372
1373 if (pr->flags.bm_check)
1374 acpi_idle_update_bm_rld(pr, cx);
1375
1376 current_thread_info()->status &= ~TS_POLLING;
1377 /*
1378 * TS_POLLING-cleared state must be visible before we test
1379 * NEED_RESCHED:
1380 */
1381 smp_mb();
1382 if (!need_resched())
1383 safe_halt();
1384 current_thread_info()->status |= TS_POLLING;
1385
1386 cx->usage++;
1387
1388 return 0;
1389}
1390
1391/**
1392 * acpi_idle_enter_simple - enters an ACPI state without BM handling
1393 * @dev: the target CPU
1394 * @state: the state data
1395 */
1396static int acpi_idle_enter_simple(struct cpuidle_device *dev,
1397 struct cpuidle_state *state)
1398{
1399 struct acpi_processor *pr;
1400 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1401 u32 t1, t2;
1402 pr = processors[smp_processor_id()];
1403
1404 if (unlikely(!pr))
1405 return 0;
1406
1407 if (acpi_idle_suspend)
1408 return(acpi_idle_enter_c1(dev, state));
1409
1410 if (pr->flags.bm_check)
1411 acpi_idle_update_bm_rld(pr, cx);
1412
1413 local_irq_disable();
1414 current_thread_info()->status &= ~TS_POLLING;
1415 /*
1416 * TS_POLLING-cleared state must be visible before we test
1417 * NEED_RESCHED:
1418 */
1419 smp_mb();
1420
1421 if (unlikely(need_resched())) {
1422 current_thread_info()->status |= TS_POLLING;
1423 local_irq_enable();
1424 return 0;
1425 }
1426
1427 if (cx->type == ACPI_STATE_C3)
1428 ACPI_FLUSH_CPU_CACHE();
1429
1430 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1431 acpi_state_timer_broadcast(pr, cx, 1);
1432 acpi_idle_do_entry(cx);
1433 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1434
1435#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC)
1436 /* TSC could halt in idle, so notify users */
1437 mark_tsc_unstable("TSC halts in idle");;
1438#endif
1439
1440 local_irq_enable();
1441 current_thread_info()->status |= TS_POLLING;
1442
1443 cx->usage++;
1444
1445 acpi_state_timer_broadcast(pr, cx, 0);
1446 cx->time += ticks_elapsed(t1, t2);
1447 return ticks_elapsed_in_us(t1, t2);
1448}
1449
1450static int c3_cpu_count;
1451static DEFINE_SPINLOCK(c3_lock);
1452
1453/**
1454 * acpi_idle_enter_bm - enters C3 with proper BM handling
1455 * @dev: the target CPU
1456 * @state: the state data
1457 *
1458 * If BM is detected, the deepest non-C3 idle state is entered instead.
1459 */
1460static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1461 struct cpuidle_state *state)
1462{
1463 struct acpi_processor *pr;
1464 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
1465 u32 t1, t2;
1466 pr = processors[smp_processor_id()];
1467
1468 if (unlikely(!pr))
1469 return 0;
1470
1471 if (acpi_idle_suspend)
1472 return(acpi_idle_enter_c1(dev, state));
1473
1474 local_irq_disable();
1475 current_thread_info()->status &= ~TS_POLLING;
1476 /*
1477 * TS_POLLING-cleared state must be visible before we test
1478 * NEED_RESCHED:
1479 */
1480 smp_mb();
1481
1482 if (unlikely(need_resched())) {
1483 current_thread_info()->status |= TS_POLLING;
1484 local_irq_enable();
1485 return 0;
1486 }
1487
1488 /*
1489 * Must be done before busmaster disable as we might need to
1490 * access HPET !
1491 */
1492 acpi_state_timer_broadcast(pr, cx, 1);
1493
1494 if (acpi_idle_bm_check()) {
1495 cx = pr->power.bm_state;
1496
1497 acpi_idle_update_bm_rld(pr, cx);
1498
1499 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1500 acpi_idle_do_entry(cx);
1501 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1502 } else {
1503 acpi_idle_update_bm_rld(pr, cx);
1504
1505 spin_lock(&c3_lock);
1506 c3_cpu_count++;
1507 /* Disable bus master arbitration when all CPUs are in C3 */
1508 if (c3_cpu_count == num_online_cpus())
1509 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
1510 spin_unlock(&c3_lock);
1511
1512 t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1513 acpi_idle_do_entry(cx);
1514 t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
1515
1516 spin_lock(&c3_lock);
1517 /* Re-enable bus master arbitration */
1518 if (c3_cpu_count == num_online_cpus())
1519 acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
1520 c3_cpu_count--;
1521 spin_unlock(&c3_lock);
1522 }
1523
1524#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC)
1525 /* TSC could halt in idle, so notify users */
1526 mark_tsc_unstable("TSC halts in idle");
1527#endif
1528
1529 local_irq_enable();
1530 current_thread_info()->status |= TS_POLLING;
1531
1532 cx->usage++;
1533
1534 acpi_state_timer_broadcast(pr, cx, 0);
1535 cx->time += ticks_elapsed(t1, t2);
1536 return ticks_elapsed_in_us(t1, t2);
1537}
1538
1539struct cpuidle_driver acpi_idle_driver = {
1540 .name = "acpi_idle",
1541 .owner = THIS_MODULE,
1542};
1543
1544/**
1545 * acpi_processor_setup_cpuidle - prepares and configures CPUIDLE
1546 * @pr: the ACPI processor
1547 */
1548static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
1549{
1550 int i, count = 0;
1551 struct acpi_processor_cx *cx;
1552 struct cpuidle_state *state;
1553 struct cpuidle_device *dev = &pr->power.dev;
1554
1555 if (!pr->flags.power_setup_done)
1556 return -EINVAL;
1557
1558 if (pr->flags.power == 0) {
1559 return -EINVAL;
1560 }
1561
1562 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
1563 cx = &pr->power.states[i];
1564 state = &dev->states[count];
1565
1566 if (!cx->valid)
1567 continue;
1568
1569#ifdef CONFIG_HOTPLUG_CPU
1570 if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
1571 !pr->flags.has_cst &&
1572 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
1573 continue;
1252#endif 1574#endif
1575 cpuidle_set_statedata(state, cx);
1576
1577 snprintf(state->name, CPUIDLE_NAME_LEN, "C%d", i);
1578 state->exit_latency = cx->latency;
1579 state->target_residency = cx->latency * 6;
1580 state->power_usage = cx->power;
1581
1582 state->flags = 0;
1583 switch (cx->type) {
1584 case ACPI_STATE_C1:
1585 state->flags |= CPUIDLE_FLAG_SHALLOW;
1586 state->enter = acpi_idle_enter_c1;
1587 break;
1588
1589 case ACPI_STATE_C2:
1590 state->flags |= CPUIDLE_FLAG_BALANCED;
1591 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1592 state->enter = acpi_idle_enter_simple;
1593 break;
1594
1595 case ACPI_STATE_C3:
1596 state->flags |= CPUIDLE_FLAG_DEEP;
1597 state->flags |= CPUIDLE_FLAG_TIME_VALID;
1598 state->flags |= CPUIDLE_FLAG_CHECK_BM;
1599 state->enter = pr->flags.bm_check ?
1600 acpi_idle_enter_bm :
1601 acpi_idle_enter_simple;
1602 break;
1603 }
1604
1605 count++;
1606 }
1607
1608 dev->state_count = count;
1609
1610 if (!count)
1611 return -EINVAL;
1612
1613 /* find the deepest state that can handle active BM */
1614 if (pr->flags.bm_check) {
1615 for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++)
1616 if (pr->power.states[i].type == ACPI_STATE_C3)
1617 break;
1618 pr->power.bm_state = &pr->power.states[i-1];
1619 }
1620
1621 return 0;
1622}
1623
1624int acpi_processor_cst_has_changed(struct acpi_processor *pr)
1625{
1626 int ret;
1627
1628 if (!pr)
1629 return -EINVAL;
1630
1631 if (nocst) {
1632 return -ENODEV;
1633 }
1634
1635 if (!pr->flags.power_setup_done)
1636 return -ENODEV;
1637
1638 cpuidle_pause_and_lock();
1639 cpuidle_disable_device(&pr->power.dev);
1640 acpi_processor_get_power_info(pr);
1641 acpi_processor_setup_cpuidle(pr);
1642 ret = cpuidle_enable_device(&pr->power.dev);
1643 cpuidle_resume_and_unlock();
1644
1645 return ret;
1646}
1647
1648#endif /* CONFIG_CPU_IDLE */
1253 1649
1254int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, 1650int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1255 struct acpi_device *device) 1651 struct acpi_device *device)
@@ -1267,7 +1663,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1267 "ACPI: processor limited to max C-state %d\n", 1663 "ACPI: processor limited to max C-state %d\n",
1268 max_cstate); 1664 max_cstate);
1269 first_run++; 1665 first_run++;
1270#ifdef CONFIG_SMP 1666#if !defined (CONFIG_CPU_IDLE) && defined (CONFIG_SMP)
1271 register_latency_notifier(&acpi_processor_latency_notifier); 1667 register_latency_notifier(&acpi_processor_latency_notifier);
1272#endif 1668#endif
1273 } 1669 }
@@ -1285,6 +1681,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1285 } 1681 }
1286 1682
1287 acpi_processor_get_power_info(pr); 1683 acpi_processor_get_power_info(pr);
1684 pr->flags.power_setup_done = 1;
1288 1685
1289 /* 1686 /*
1290 * Install the idle handler if processor power management is supported. 1687 * Install the idle handler if processor power management is supported.
@@ -1292,6 +1689,13 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1292 * platforms that only support C1. 1689 * platforms that only support C1.
1293 */ 1690 */
1294 if ((pr->flags.power) && (!boot_option_idle_override)) { 1691 if ((pr->flags.power) && (!boot_option_idle_override)) {
1692#ifdef CONFIG_CPU_IDLE
1693 acpi_processor_setup_cpuidle(pr);
1694 pr->power.dev.cpu = pr->id;
1695 if (cpuidle_register_device(&pr->power.dev))
1696 return -EIO;
1697#endif
1698
1295 printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id); 1699 printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id);
1296 for (i = 1; i <= pr->power.count; i++) 1700 for (i = 1; i <= pr->power.count; i++)
1297 if (pr->power.states[i].valid) 1701 if (pr->power.states[i].valid)
@@ -1299,10 +1703,12 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1299 pr->power.states[i].type); 1703 pr->power.states[i].type);
1300 printk(")\n"); 1704 printk(")\n");
1301 1705
1706#ifndef CONFIG_CPU_IDLE
1302 if (pr->id == 0) { 1707 if (pr->id == 0) {
1303 pm_idle_save = pm_idle; 1708 pm_idle_save = pm_idle;
1304 pm_idle = acpi_processor_idle; 1709 pm_idle = acpi_processor_idle;
1305 } 1710 }
1711#endif
1306 } 1712 }
1307 1713
1308 /* 'power' [R] */ 1714 /* 'power' [R] */
@@ -1316,21 +1722,24 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
1316 entry->owner = THIS_MODULE; 1722 entry->owner = THIS_MODULE;
1317 } 1723 }
1318 1724
1319 pr->flags.power_setup_done = 1;
1320
1321 return 0; 1725 return 0;
1322} 1726}
1323 1727
1324int acpi_processor_power_exit(struct acpi_processor *pr, 1728int acpi_processor_power_exit(struct acpi_processor *pr,
1325 struct acpi_device *device) 1729 struct acpi_device *device)
1326{ 1730{
1327 1731#ifdef CONFIG_CPU_IDLE
1732 if ((pr->flags.power) && (!boot_option_idle_override))
1733 cpuidle_unregister_device(&pr->power.dev);
1734#endif
1328 pr->flags.power_setup_done = 0; 1735 pr->flags.power_setup_done = 0;
1329 1736
1330 if (acpi_device_dir(device)) 1737 if (acpi_device_dir(device))
1331 remove_proc_entry(ACPI_PROCESSOR_FILE_POWER, 1738 remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,
1332 acpi_device_dir(device)); 1739 acpi_device_dir(device));
1333 1740
1741#ifndef CONFIG_CPU_IDLE
1742
1334 /* Unregister the idle handler when processor #0 is removed. */ 1743 /* Unregister the idle handler when processor #0 is removed. */
1335 if (pr->id == 0) { 1744 if (pr->id == 0) {
1336 pm_idle = pm_idle_save; 1745 pm_idle = pm_idle_save;
@@ -1345,6 +1754,7 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
1345 unregister_latency_notifier(&acpi_processor_latency_notifier); 1754 unregister_latency_notifier(&acpi_processor_latency_notifier);
1346#endif 1755#endif
1347 } 1756 }
1757#endif
1348 1758
1349 return 0; 1759 return 0;
1350} 1760}
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index a578986e3214..90fd09c65f95 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * acpi_sbs.c - ACPI Smart Battery System Driver ($Revision: 1.16 $) 2 * sbs.c - ACPI Smart Battery System Driver ($Revision: 2.0 $)
3 * 3 *
4 * Copyright (c) 2007 Alexey Starikovskiy <astarikovskiy@suse.de>
5 * Copyright (c) 2005-2007 Vladimir Lebedev <vladimir.p.lebedev@intel.com>
4 * Copyright (c) 2005 Rich Townsend <rhdt@bartol.udel.edu> 6 * Copyright (c) 2005 Rich Townsend <rhdt@bartol.udel.edu>
5 * 7 *
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -26,15 +28,22 @@
26#include <linux/module.h> 28#include <linux/module.h>
27#include <linux/moduleparam.h> 29#include <linux/moduleparam.h>
28#include <linux/kernel.h> 30#include <linux/kernel.h>
31
32#ifdef CONFIG_ACPI_PROCFS
29#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
30#include <linux/seq_file.h> 34#include <linux/seq_file.h>
31#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36#endif
37
32#include <linux/acpi.h> 38#include <linux/acpi.h>
33#include <linux/timer.h> 39#include <linux/timer.h>
34#include <linux/jiffies.h> 40#include <linux/jiffies.h>
35#include <linux/delay.h> 41#include <linux/delay.h>
36 42
37#define ACPI_SBS_COMPONENT 0x00080000 43#include <linux/power_supply.h>
44
45#include "sbshc.h"
46
38#define ACPI_SBS_CLASS "sbs" 47#define ACPI_SBS_CLASS "sbs"
39#define ACPI_AC_CLASS "ac_adapter" 48#define ACPI_AC_CLASS "ac_adapter"
40#define ACPI_BATTERY_CLASS "battery" 49#define ACPI_BATTERY_CLASS "battery"
@@ -44,836 +53,436 @@
44#define ACPI_SBS_FILE_ALARM "alarm" 53#define ACPI_SBS_FILE_ALARM "alarm"
45#define ACPI_BATTERY_DIR_NAME "BAT%i" 54#define ACPI_BATTERY_DIR_NAME "BAT%i"
46#define ACPI_AC_DIR_NAME "AC0" 55#define ACPI_AC_DIR_NAME "AC0"
47#define ACPI_SBC_SMBUS_ADDR 0x9
48#define ACPI_SBSM_SMBUS_ADDR 0xa
49#define ACPI_SB_SMBUS_ADDR 0xb
50#define ACPI_SBS_AC_NOTIFY_STATUS 0x80
51#define ACPI_SBS_BATTERY_NOTIFY_STATUS 0x80
52#define ACPI_SBS_BATTERY_NOTIFY_INFO 0x81
53 56
54#define _COMPONENT ACPI_SBS_COMPONENT 57enum acpi_sbs_device_addr {
58 ACPI_SBS_CHARGER = 0x9,
59 ACPI_SBS_MANAGER = 0xa,
60 ACPI_SBS_BATTERY = 0xb,
61};
55 62
56ACPI_MODULE_NAME("sbs"); 63#define ACPI_SBS_NOTIFY_STATUS 0x80
64#define ACPI_SBS_NOTIFY_INFO 0x81
57 65
58MODULE_AUTHOR("Rich Townsend"); 66MODULE_AUTHOR("Alexey Starikovskiy <astarikovskiy@suse.de>");
59MODULE_DESCRIPTION("Smart Battery System ACPI interface driver"); 67MODULE_DESCRIPTION("Smart Battery System ACPI interface driver");
60MODULE_LICENSE("GPL"); 68MODULE_LICENSE("GPL");
61 69
62#define xmsleep(t) msleep(t) 70static unsigned int cache_time = 1000;
63 71module_param(cache_time, uint, 0644);
64#define ACPI_EC_SMB_PRTCL 0x00 /* protocol, PEC */ 72MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
65
66#define ACPI_EC_SMB_STS 0x01 /* status */
67#define ACPI_EC_SMB_ADDR 0x02 /* address */
68#define ACPI_EC_SMB_CMD 0x03 /* command */
69#define ACPI_EC_SMB_DATA 0x04 /* 32 data registers */
70#define ACPI_EC_SMB_BCNT 0x24 /* number of data bytes */
71
72#define ACPI_EC_SMB_STS_DONE 0x80
73#define ACPI_EC_SMB_STS_STATUS 0x1f
74
75#define ACPI_EC_SMB_PRTCL_WRITE 0x00
76#define ACPI_EC_SMB_PRTCL_READ 0x01
77#define ACPI_EC_SMB_PRTCL_WORD_DATA 0x08
78#define ACPI_EC_SMB_PRTCL_BLOCK_DATA 0x0a
79
80#define ACPI_EC_SMB_TRANSACTION_SLEEP 1
81#define ACPI_EC_SMB_ACCESS_SLEEP1 1
82#define ACPI_EC_SMB_ACCESS_SLEEP2 10
83
84#define DEF_CAPACITY_UNIT 3
85#define MAH_CAPACITY_UNIT 1
86#define MWH_CAPACITY_UNIT 2
87#define CAPACITY_UNIT DEF_CAPACITY_UNIT
88
89#define REQUEST_UPDATE_MODE 1
90#define QUEUE_UPDATE_MODE 2
91
92#define DATA_TYPE_COMMON 0
93#define DATA_TYPE_INFO 1
94#define DATA_TYPE_STATE 2
95#define DATA_TYPE_ALARM 3
96#define DATA_TYPE_AC_STATE 4
97 73
98extern struct proc_dir_entry *acpi_lock_ac_dir(void); 74extern struct proc_dir_entry *acpi_lock_ac_dir(void);
99extern struct proc_dir_entry *acpi_lock_battery_dir(void); 75extern struct proc_dir_entry *acpi_lock_battery_dir(void);
100extern void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); 76extern void acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir);
101extern void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); 77extern void acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir);
102 78
103#define MAX_SBS_BAT 4 79#define MAX_SBS_BAT 4
104#define ACPI_SBS_BLOCK_MAX 32 80#define ACPI_SBS_BLOCK_MAX 32
105 81
106#define ACPI_SBS_SMBUS_READ 1
107#define ACPI_SBS_SMBUS_WRITE 2
108
109#define ACPI_SBS_WORD_DATA 1
110#define ACPI_SBS_BLOCK_DATA 2
111
112#define UPDATE_DELAY 10
113
114/* 0 - every time, > 0 - by update_time */
115static unsigned int update_time = 120;
116
117static unsigned int capacity_mode = CAPACITY_UNIT;
118
119module_param(update_time, uint, 0644);
120module_param(capacity_mode, uint, 0444);
121
122static int acpi_sbs_add(struct acpi_device *device);
123static int acpi_sbs_remove(struct acpi_device *device, int type);
124static int acpi_sbs_resume(struct acpi_device *device);
125
126static const struct acpi_device_id sbs_device_ids[] = { 82static const struct acpi_device_id sbs_device_ids[] = {
127 {"ACPI0001", 0}, 83 {"ACPI0002", 0},
128 {"ACPI0005", 0},
129 {"", 0}, 84 {"", 0},
130}; 85};
131MODULE_DEVICE_TABLE(acpi, sbs_device_ids); 86MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
132 87
133static struct acpi_driver acpi_sbs_driver = {
134 .name = "sbs",
135 .class = ACPI_SBS_CLASS,
136 .ids = sbs_device_ids,
137 .ops = {
138 .add = acpi_sbs_add,
139 .remove = acpi_sbs_remove,
140 .resume = acpi_sbs_resume,
141 },
142};
143
144struct acpi_ac {
145 int ac_present;
146};
147
148struct acpi_battery_info {
149 int capacity_mode;
150 s16 full_charge_capacity;
151 s16 design_capacity;
152 s16 design_voltage;
153 int vscale;
154 int ipscale;
155 s16 serial_number;
156 char manufacturer_name[ACPI_SBS_BLOCK_MAX + 3];
157 char device_name[ACPI_SBS_BLOCK_MAX + 3];
158 char device_chemistry[ACPI_SBS_BLOCK_MAX + 3];
159};
160
161struct acpi_battery_state {
162 s16 voltage;
163 s16 amperage;
164 s16 remaining_capacity;
165 s16 battery_state;
166};
167
168struct acpi_battery_alarm {
169 s16 remaining_capacity;
170};
171
172struct acpi_battery { 88struct acpi_battery {
173 int alive; 89 struct power_supply bat;
174 int id;
175 int init_state;
176 int battery_present;
177 struct acpi_sbs *sbs; 90 struct acpi_sbs *sbs;
178 struct acpi_battery_info info; 91#ifdef CONFIG_ACPI_PROCFS
179 struct acpi_battery_state state; 92 struct proc_dir_entry *proc_entry;
180 struct acpi_battery_alarm alarm; 93#endif
181 struct proc_dir_entry *battery_entry; 94 unsigned long update_time;
95 char name[8];
96 char manufacturer_name[ACPI_SBS_BLOCK_MAX];
97 char device_name[ACPI_SBS_BLOCK_MAX];
98 char device_chemistry[ACPI_SBS_BLOCK_MAX];
99 u16 alarm_capacity;
100 u16 full_charge_capacity;
101 u16 design_capacity;
102 u16 design_voltage;
103 u16 serial_number;
104 u16 cycle_count;
105 u16 temp_now;
106 u16 voltage_now;
107 s16 current_now;
108 s16 current_avg;
109 u16 capacity_now;
110 u16 state_of_charge;
111 u16 state;
112 u16 mode;
113 u16 spec;
114 u8 id;
115 u8 present:1;
182}; 116};
183 117
118#define to_acpi_battery(x) container_of(x, struct acpi_battery, bat);
119
184struct acpi_sbs { 120struct acpi_sbs {
185 int base; 121 struct power_supply charger;
186 struct acpi_device *device; 122 struct acpi_device *device;
187 struct mutex mutex; 123 struct acpi_smb_hc *hc;
188 int sbsm_present; 124 struct mutex lock;
189 int sbsm_batteries_supported; 125#ifdef CONFIG_ACPI_PROCFS
190 struct proc_dir_entry *ac_entry; 126 struct proc_dir_entry *charger_entry;
191 struct acpi_ac ac; 127#endif
192 struct acpi_battery battery[MAX_SBS_BAT]; 128 struct acpi_battery battery[MAX_SBS_BAT];
193 int zombie; 129 u8 batteries_supported:4;
194 struct timer_list update_timer; 130 u8 manager_present:1;
195 int run_cnt; 131 u8 charger_present:1;
196 int update_proc_flg;
197}; 132};
198 133
199static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type); 134#define to_acpi_sbs(x) container_of(x, struct acpi_sbs, charger)
200static void acpi_sbs_update_time(void *data);
201 135
202union sbs_rw_data { 136static inline int battery_scale(int log)
203 u16 word;
204 u8 block[ACPI_SBS_BLOCK_MAX + 2];
205};
206
207static int acpi_ec_sbs_access(struct acpi_sbs *sbs, u16 addr,
208 char read_write, u8 command, int size,
209 union sbs_rw_data *data);
210
211/* --------------------------------------------------------------------------
212 SMBus Communication
213 -------------------------------------------------------------------------- */
214
215static int acpi_ec_sbs_read(struct acpi_sbs *sbs, u8 address, u8 * data)
216{ 137{
217 u8 val; 138 int scale = 1;
218 int err; 139 while (log--)
219 140 scale *= 10;
220 err = ec_read(sbs->base + address, &val); 141 return scale;
221 if (!err) {
222 *data = val;
223 }
224 xmsleep(ACPI_EC_SMB_TRANSACTION_SLEEP);
225 return (err);
226}
227
228static int acpi_ec_sbs_write(struct acpi_sbs *sbs, u8 address, u8 data)
229{
230 int err;
231
232 err = ec_write(sbs->base + address, data);
233 return (err);
234}
235
236static int
237acpi_ec_sbs_access(struct acpi_sbs *sbs, u16 addr,
238 char read_write, u8 command, int size,
239 union sbs_rw_data *data)
240{
241 unsigned char protocol, len = 0, temp[2] = { 0, 0 };
242 int i;
243
244 if (read_write == ACPI_SBS_SMBUS_READ) {
245 protocol = ACPI_EC_SMB_PRTCL_READ;
246 } else {
247 protocol = ACPI_EC_SMB_PRTCL_WRITE;
248 }
249
250 switch (size) {
251
252 case ACPI_SBS_WORD_DATA:
253 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_CMD, command);
254 if (read_write == ACPI_SBS_SMBUS_WRITE) {
255 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_DATA, data->word);
256 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_DATA + 1,
257 data->word >> 8);
258 }
259 protocol |= ACPI_EC_SMB_PRTCL_WORD_DATA;
260 break;
261 case ACPI_SBS_BLOCK_DATA:
262 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_CMD, command);
263 if (read_write == ACPI_SBS_SMBUS_WRITE) {
264 len = min_t(u8, data->block[0], 32);
265 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_BCNT, len);
266 for (i = 0; i < len; i++)
267 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_DATA + i,
268 data->block[i + 1]);
269 }
270 protocol |= ACPI_EC_SMB_PRTCL_BLOCK_DATA;
271 break;
272 default:
273 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
274 "unsupported transaction %d", size));
275 return (-1);
276 }
277
278 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_ADDR, addr << 1);
279 acpi_ec_sbs_write(sbs, ACPI_EC_SMB_PRTCL, protocol);
280
281 acpi_ec_sbs_read(sbs, ACPI_EC_SMB_STS, temp);
282
283 if (~temp[0] & ACPI_EC_SMB_STS_DONE) {
284 xmsleep(ACPI_EC_SMB_ACCESS_SLEEP1);
285 acpi_ec_sbs_read(sbs, ACPI_EC_SMB_STS, temp);
286 }
287 if (~temp[0] & ACPI_EC_SMB_STS_DONE) {
288 xmsleep(ACPI_EC_SMB_ACCESS_SLEEP2);
289 acpi_ec_sbs_read(sbs, ACPI_EC_SMB_STS, temp);
290 }
291 if ((~temp[0] & ACPI_EC_SMB_STS_DONE)
292 || (temp[0] & ACPI_EC_SMB_STS_STATUS)) {
293 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
294 "transaction %d error", size));
295 return (-1);
296 }
297
298 if (read_write == ACPI_SBS_SMBUS_WRITE) {
299 return (0);
300 }
301
302 switch (size) {
303
304 case ACPI_SBS_WORD_DATA:
305 acpi_ec_sbs_read(sbs, ACPI_EC_SMB_DATA, temp);
306 acpi_ec_sbs_read(sbs, ACPI_EC_SMB_DATA + 1, temp + 1);
307 data->word = (temp[1] << 8) | temp[0];
308 break;
309
310 case ACPI_SBS_BLOCK_DATA:
311 len = 0;
312 acpi_ec_sbs_read(sbs, ACPI_EC_SMB_BCNT, &len);
313 len = min_t(u8, len, 32);
314 for (i = 0; i < len; i++)
315 acpi_ec_sbs_read(sbs, ACPI_EC_SMB_DATA + i,
316 data->block + i + 1);
317 data->block[0] = len;
318 break;
319 default:
320 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
321 "unsupported transaction %d", size));
322 return (-1);
323 }
324
325 return (0);
326} 142}
327 143
328static int 144static inline int acpi_battery_vscale(struct acpi_battery *battery)
329acpi_sbs_read_word(struct acpi_sbs *sbs, int addr, int func, u16 * word)
330{ 145{
331 union sbs_rw_data data; 146 return battery_scale((battery->spec & 0x0f00) >> 8);
332 int result = 0;
333
334 result = acpi_ec_sbs_access(sbs, addr,
335 ACPI_SBS_SMBUS_READ, func,
336 ACPI_SBS_WORD_DATA, &data);
337 if (result) {
338 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
339 "acpi_ec_sbs_access() failed"));
340 } else {
341 *word = data.word;
342 }
343
344 return result;
345} 147}
346 148
347static int 149static inline int acpi_battery_ipscale(struct acpi_battery *battery)
348acpi_sbs_read_str(struct acpi_sbs *sbs, int addr, int func, char *str)
349{ 150{
350 union sbs_rw_data data; 151 return battery_scale((battery->spec & 0xf000) >> 12);
351 int result = 0;
352
353 result = acpi_ec_sbs_access(sbs, addr,
354 ACPI_SBS_SMBUS_READ, func,
355 ACPI_SBS_BLOCK_DATA, &data);
356 if (result) {
357 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
358 "acpi_ec_sbs_access() failed"));
359 } else {
360 strncpy(str, (const char *)data.block + 1, data.block[0]);
361 str[data.block[0]] = 0;
362 }
363
364 return result;
365} 152}
366 153
367static int 154static inline int acpi_battery_mode(struct acpi_battery *battery)
368acpi_sbs_write_word(struct acpi_sbs *sbs, int addr, int func, int word)
369{ 155{
370 union sbs_rw_data data; 156 return (battery->mode & 0x8000);
371 int result = 0;
372
373 data.word = word;
374
375 result = acpi_ec_sbs_access(sbs, addr,
376 ACPI_SBS_SMBUS_WRITE, func,
377 ACPI_SBS_WORD_DATA, &data);
378 if (result) {
379 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
380 "acpi_ec_sbs_access() failed"));
381 }
382
383 return result;
384} 157}
385 158
386static int sbs_zombie(struct acpi_sbs *sbs) 159static inline int acpi_battery_scale(struct acpi_battery *battery)
387{ 160{
388 return (sbs->zombie); 161 return (acpi_battery_mode(battery) ? 10 : 1) *
162 acpi_battery_ipscale(battery);
389} 163}
390 164
391static int sbs_mutex_lock(struct acpi_sbs *sbs) 165static int sbs_get_ac_property(struct power_supply *psy,
166 enum power_supply_property psp,
167 union power_supply_propval *val)
392{ 168{
393 if (sbs_zombie(sbs)) { 169 struct acpi_sbs *sbs = to_acpi_sbs(psy);
394 return -ENODEV; 170 switch (psp) {
171 case POWER_SUPPLY_PROP_ONLINE:
172 val->intval = sbs->charger_present;
173 break;
174 default:
175 return -EINVAL;
395 } 176 }
396 mutex_lock(&sbs->mutex);
397 return 0; 177 return 0;
398} 178}
399 179
400static void sbs_mutex_unlock(struct acpi_sbs *sbs) 180static int acpi_battery_technology(struct acpi_battery *battery)
401{ 181{
402 mutex_unlock(&sbs->mutex); 182 if (!strcasecmp("NiCd", battery->device_chemistry))
183 return POWER_SUPPLY_TECHNOLOGY_NiCd;
184 if (!strcasecmp("NiMH", battery->device_chemistry))
185 return POWER_SUPPLY_TECHNOLOGY_NiMH;
186 if (!strcasecmp("LION", battery->device_chemistry))
187 return POWER_SUPPLY_TECHNOLOGY_LION;
188 if (!strcasecmp("LiP", battery->device_chemistry))
189 return POWER_SUPPLY_TECHNOLOGY_LIPO;
190 return POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
403} 191}
404 192
405/* -------------------------------------------------------------------------- 193static int acpi_sbs_battery_get_property(struct power_supply *psy,
406 Smart Battery System Management 194 enum power_supply_property psp,
407 -------------------------------------------------------------------------- */ 195 union power_supply_propval *val)
408
409static int acpi_check_update_proc(struct acpi_sbs *sbs)
410{ 196{
411 acpi_status status = AE_OK; 197 struct acpi_battery *battery = to_acpi_battery(psy);
412 198
413 if (update_time == 0) { 199 if ((!battery->present) && psp != POWER_SUPPLY_PROP_PRESENT)
414 sbs->update_proc_flg = 0; 200 return -ENODEV;
415 return 0; 201 switch (psp) {
416 } 202 case POWER_SUPPLY_PROP_STATUS:
417 if (sbs->update_proc_flg == 0) { 203 if (battery->current_now < 0)
418 status = acpi_os_execute(OSL_GPE_HANDLER, 204 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
419 acpi_sbs_update_time, sbs); 205 else if (battery->current_now > 0)
420 if (status != AE_OK) { 206 val->intval = POWER_SUPPLY_STATUS_CHARGING;
421 ACPI_EXCEPTION((AE_INFO, status, 207 else
422 "acpi_os_execute() failed")); 208 val->intval = POWER_SUPPLY_STATUS_FULL;
423 return 1; 209 break;
424 } 210 case POWER_SUPPLY_PROP_PRESENT:
425 sbs->update_proc_flg = 1; 211 val->intval = battery->present;
212 break;
213 case POWER_SUPPLY_PROP_TECHNOLOGY:
214 val->intval = acpi_battery_technology(battery);
215 break;
216 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
217 val->intval = battery->design_voltage *
218 acpi_battery_vscale(battery) * 1000;
219 break;
220 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
221 val->intval = battery->voltage_now *
222 acpi_battery_vscale(battery) * 1000;
223 break;
224 case POWER_SUPPLY_PROP_CURRENT_NOW:
225 val->intval = abs(battery->current_now) *
226 acpi_battery_ipscale(battery) * 1000;
227 break;
228 case POWER_SUPPLY_PROP_CURRENT_AVG:
229 val->intval = abs(battery->current_avg) *
230 acpi_battery_ipscale(battery) * 1000;
231 break;
232 case POWER_SUPPLY_PROP_CAPACITY:
233 val->intval = battery->state_of_charge;
234 break;
235 case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
236 case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
237 val->intval = battery->design_capacity *
238 acpi_battery_scale(battery) * 1000;
239 break;
240 case POWER_SUPPLY_PROP_CHARGE_FULL:
241 case POWER_SUPPLY_PROP_ENERGY_FULL:
242 val->intval = battery->full_charge_capacity *
243 acpi_battery_scale(battery) * 1000;
244 break;
245 case POWER_SUPPLY_PROP_CHARGE_NOW:
246 case POWER_SUPPLY_PROP_ENERGY_NOW:
247 val->intval = battery->capacity_now *
248 acpi_battery_scale(battery) * 1000;
249 break;
250 case POWER_SUPPLY_PROP_TEMP:
251 val->intval = battery->temp_now - 2730; // dK -> dC
252 break;
253 case POWER_SUPPLY_PROP_MODEL_NAME:
254 val->strval = battery->device_name;
255 break;
256 case POWER_SUPPLY_PROP_MANUFACTURER:
257 val->strval = battery->manufacturer_name;
258 break;
259 default:
260 return -EINVAL;
426 } 261 }
427 return 0; 262 return 0;
428} 263}
429 264
430static int acpi_sbs_generate_event(struct acpi_device *device, 265static enum power_supply_property sbs_ac_props[] = {
431 int event, int state, char *bid, char *class) 266 POWER_SUPPLY_PROP_ONLINE,
432{ 267};
433 char bid_saved[5];
434 char class_saved[20];
435 int result = 0;
436
437 strcpy(bid_saved, acpi_device_bid(device));
438 strcpy(class_saved, acpi_device_class(device));
439
440 strcpy(acpi_device_bid(device), bid);
441 strcpy(acpi_device_class(device), class);
442
443 result = acpi_bus_generate_proc_event(device, event, state);
444
445 strcpy(acpi_device_bid(device), bid_saved);
446 strcpy(acpi_device_class(device), class_saved);
447
448 acpi_bus_generate_netlink_event(class, bid, event, state);
449 return result;
450}
451
452static int acpi_battery_get_present(struct acpi_battery *battery)
453{
454 s16 state;
455 int result = 0;
456 int is_present = 0;
457
458 result = acpi_sbs_read_word(battery->sbs,
459 ACPI_SBSM_SMBUS_ADDR, 0x01, &state);
460 if (result) {
461 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
462 "acpi_sbs_read_word() failed"));
463 }
464 if (!result) {
465 is_present = (state & 0x000f) & (1 << battery->id);
466 }
467 battery->battery_present = is_present;
468
469 return result;
470}
471 268
472static int acpi_battery_select(struct acpi_battery *battery) 269static enum power_supply_property sbs_charge_battery_props[] = {
473{ 270 POWER_SUPPLY_PROP_STATUS,
474 struct acpi_sbs *sbs = battery->sbs; 271 POWER_SUPPLY_PROP_PRESENT,
475 int result = 0; 272 POWER_SUPPLY_PROP_TECHNOLOGY,
476 s16 state; 273 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
477 int foo; 274 POWER_SUPPLY_PROP_VOLTAGE_NOW,
275 POWER_SUPPLY_PROP_CURRENT_NOW,
276 POWER_SUPPLY_PROP_CURRENT_AVG,
277 POWER_SUPPLY_PROP_CAPACITY,
278 POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
279 POWER_SUPPLY_PROP_CHARGE_FULL,
280 POWER_SUPPLY_PROP_CHARGE_NOW,
281 POWER_SUPPLY_PROP_TEMP,
282 POWER_SUPPLY_PROP_MODEL_NAME,
283 POWER_SUPPLY_PROP_MANUFACTURER,
284};
478 285
479 if (sbs->sbsm_present) { 286static enum power_supply_property sbs_energy_battery_props[] = {
287 POWER_SUPPLY_PROP_STATUS,
288 POWER_SUPPLY_PROP_PRESENT,
289 POWER_SUPPLY_PROP_TECHNOLOGY,
290 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
291 POWER_SUPPLY_PROP_VOLTAGE_NOW,
292 POWER_SUPPLY_PROP_CURRENT_NOW,
293 POWER_SUPPLY_PROP_CURRENT_AVG,
294 POWER_SUPPLY_PROP_CAPACITY,
295 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
296 POWER_SUPPLY_PROP_ENERGY_FULL,
297 POWER_SUPPLY_PROP_ENERGY_NOW,
298 POWER_SUPPLY_PROP_TEMP,
299 POWER_SUPPLY_PROP_MODEL_NAME,
300 POWER_SUPPLY_PROP_MANUFACTURER,
301};
480 302
481 /* Take special care not to knobble other nibbles of 303/* --------------------------------------------------------------------------
482 * state (aka selector_state), since 304 Smart Battery System Management
483 * it causes charging to halt on SBSELs */ 305 -------------------------------------------------------------------------- */
484 306
485 result = 307struct acpi_battery_reader {
486 acpi_sbs_read_word(sbs, ACPI_SBSM_SMBUS_ADDR, 0x01, &state); 308 u8 command; /* command for battery */
487 if (result) { 309 u8 mode; /* word or block? */
488 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 310 size_t offset; /* offset inside struct acpi_sbs_battery */
489 "acpi_sbs_read_word() failed")); 311};
490 goto end;
491 }
492 312
493 foo = (state & 0x0fff) | (1 << (battery->id + 12)); 313static struct acpi_battery_reader info_readers[] = {
494 result = 314 {0x01, SMBUS_READ_WORD, offsetof(struct acpi_battery, alarm_capacity)},
495 acpi_sbs_write_word(sbs, ACPI_SBSM_SMBUS_ADDR, 0x01, foo); 315 {0x03, SMBUS_READ_WORD, offsetof(struct acpi_battery, mode)},
496 if (result) { 316 {0x10, SMBUS_READ_WORD, offsetof(struct acpi_battery, full_charge_capacity)},
497 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 317 {0x17, SMBUS_READ_WORD, offsetof(struct acpi_battery, cycle_count)},
498 "acpi_sbs_write_word() failed")); 318 {0x18, SMBUS_READ_WORD, offsetof(struct acpi_battery, design_capacity)},
499 goto end; 319 {0x19, SMBUS_READ_WORD, offsetof(struct acpi_battery, design_voltage)},
500 } 320 {0x1a, SMBUS_READ_WORD, offsetof(struct acpi_battery, spec)},
501 } 321 {0x1c, SMBUS_READ_WORD, offsetof(struct acpi_battery, serial_number)},
322 {0x20, SMBUS_READ_BLOCK, offsetof(struct acpi_battery, manufacturer_name)},
323 {0x21, SMBUS_READ_BLOCK, offsetof(struct acpi_battery, device_name)},
324 {0x22, SMBUS_READ_BLOCK, offsetof(struct acpi_battery, device_chemistry)},
325};
502 326
503 end: 327static struct acpi_battery_reader state_readers[] = {
504 return result; 328 {0x08, SMBUS_READ_WORD, offsetof(struct acpi_battery, temp_now)},
505} 329 {0x09, SMBUS_READ_WORD, offsetof(struct acpi_battery, voltage_now)},
330 {0x0a, SMBUS_READ_WORD, offsetof(struct acpi_battery, current_now)},
331 {0x0b, SMBUS_READ_WORD, offsetof(struct acpi_battery, current_avg)},
332 {0x0f, SMBUS_READ_WORD, offsetof(struct acpi_battery, capacity_now)},
333 {0x0e, SMBUS_READ_WORD, offsetof(struct acpi_battery, state_of_charge)},
334 {0x16, SMBUS_READ_WORD, offsetof(struct acpi_battery, state)},
335};
506 336
507static int acpi_sbsm_get_info(struct acpi_sbs *sbs) 337static int acpi_manager_get_info(struct acpi_sbs *sbs)
508{ 338{
509 int result = 0; 339 int result = 0;
510 s16 battery_system_info; 340 u16 battery_system_info;
511
512 result = acpi_sbs_read_word(sbs, ACPI_SBSM_SMBUS_ADDR, 0x04,
513 &battery_system_info);
514 if (result) {
515 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
516 "acpi_sbs_read_word() failed"));
517 goto end;
518 }
519 sbs->sbsm_present = 1;
520 sbs->sbsm_batteries_supported = battery_system_info & 0x000f;
521
522 end:
523 341
342 result = acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBS_MANAGER,
343 0x04, (u8 *)&battery_system_info);
344 if (!result)
345 sbs->batteries_supported = battery_system_info & 0x000f;
524 return result; 346 return result;
525} 347}
526 348
527static int acpi_battery_get_info(struct acpi_battery *battery) 349static int acpi_battery_get_info(struct acpi_battery *battery)
528{ 350{
529 struct acpi_sbs *sbs = battery->sbs; 351 int i, result = 0;
530 int result = 0; 352
531 s16 battery_mode; 353 for (i = 0; i < ARRAY_SIZE(info_readers); ++i) {
532 s16 specification_info; 354 result = acpi_smbus_read(battery->sbs->hc,
533 355 info_readers[i].mode,
534 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x03, 356 ACPI_SBS_BATTERY,
535 &battery_mode); 357 info_readers[i].command,
536 if (result) { 358 (u8 *) battery +
537 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 359 info_readers[i].offset);
538 "acpi_sbs_read_word() failed")); 360 if (result)
539 goto end; 361 break;
540 }
541 battery->info.capacity_mode = (battery_mode & 0x8000) >> 15;
542
543 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x10,
544 &battery->info.full_charge_capacity);
545 if (result) {
546 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
547 "acpi_sbs_read_word() failed"));
548 goto end;
549 }
550
551 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x18,
552 &battery->info.design_capacity);
553
554 if (result) {
555 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
556 "acpi_sbs_read_word() failed"));
557 goto end;
558 }
559
560 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x19,
561 &battery->info.design_voltage);
562 if (result) {
563 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
564 "acpi_sbs_read_word() failed"));
565 goto end;
566 } 362 }
567
568 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x1a,
569 &specification_info);
570 if (result) {
571 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
572 "acpi_sbs_read_word() failed"));
573 goto end;
574 }
575
576 switch ((specification_info & 0x0f00) >> 8) {
577 case 1:
578 battery->info.vscale = 10;
579 break;
580 case 2:
581 battery->info.vscale = 100;
582 break;
583 case 3:
584 battery->info.vscale = 1000;
585 break;
586 default:
587 battery->info.vscale = 1;
588 }
589
590 switch ((specification_info & 0xf000) >> 12) {
591 case 1:
592 battery->info.ipscale = 10;
593 break;
594 case 2:
595 battery->info.ipscale = 100;
596 break;
597 case 3:
598 battery->info.ipscale = 1000;
599 break;
600 default:
601 battery->info.ipscale = 1;
602 }
603
604 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x1c,
605 &battery->info.serial_number);
606 if (result) {
607 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
608 "acpi_sbs_read_word() failed"));
609 goto end;
610 }
611
612 result = acpi_sbs_read_str(sbs, ACPI_SB_SMBUS_ADDR, 0x20,
613 battery->info.manufacturer_name);
614 if (result) {
615 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
616 "acpi_sbs_read_str() failed"));
617 goto end;
618 }
619
620 result = acpi_sbs_read_str(sbs, ACPI_SB_SMBUS_ADDR, 0x21,
621 battery->info.device_name);
622 if (result) {
623 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
624 "acpi_sbs_read_str() failed"));
625 goto end;
626 }
627
628 result = acpi_sbs_read_str(sbs, ACPI_SB_SMBUS_ADDR, 0x22,
629 battery->info.device_chemistry);
630 if (result) {
631 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
632 "acpi_sbs_read_str() failed"));
633 goto end;
634 }
635
636 end:
637 return result; 363 return result;
638} 364}
639 365
640static int acpi_battery_get_state(struct acpi_battery *battery) 366static int acpi_battery_get_state(struct acpi_battery *battery)
641{ 367{
642 struct acpi_sbs *sbs = battery->sbs; 368 int i, result = 0;
643 int result = 0;
644 369
645 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x09, 370 if (battery->update_time &&
646 &battery->state.voltage); 371 time_before(jiffies, battery->update_time +
647 if (result) { 372 msecs_to_jiffies(cache_time)))
648 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 373 return 0;
649 "acpi_sbs_read_word() failed")); 374 for (i = 0; i < ARRAY_SIZE(state_readers); ++i) {
650 goto end; 375 result = acpi_smbus_read(battery->sbs->hc,
651 } 376 state_readers[i].mode,
652 377 ACPI_SBS_BATTERY,
653 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x0a, 378 state_readers[i].command,
654 &battery->state.amperage); 379 (u8 *)battery +
655 if (result) { 380 state_readers[i].offset);
656 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 381 if (result)
657 "acpi_sbs_read_word() failed")); 382 goto end;
658 goto end;
659 }
660
661 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x0f,
662 &battery->state.remaining_capacity);
663 if (result) {
664 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
665 "acpi_sbs_read_word() failed"));
666 goto end;
667 }
668
669 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x16,
670 &battery->state.battery_state);
671 if (result) {
672 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
673 "acpi_sbs_read_word() failed"));
674 goto end;
675 } 383 }
676
677 end: 384 end:
385 battery->update_time = jiffies;
678 return result; 386 return result;
679} 387}
680 388
681static int acpi_battery_get_alarm(struct acpi_battery *battery) 389static int acpi_battery_get_alarm(struct acpi_battery *battery)
682{ 390{
683 struct acpi_sbs *sbs = battery->sbs; 391 return acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD,
684 int result = 0; 392 ACPI_SBS_BATTERY, 0x01,
685 393 (u8 *)&battery->alarm_capacity);
686 result = acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x01,
687 &battery->alarm.remaining_capacity);
688 if (result) {
689 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
690 "acpi_sbs_read_word() failed"));
691 goto end;
692 }
693
694 end:
695
696 return result;
697} 394}
698 395
699static int acpi_battery_set_alarm(struct acpi_battery *battery, 396static int acpi_battery_set_alarm(struct acpi_battery *battery)
700 unsigned long alarm)
701{ 397{
702 struct acpi_sbs *sbs = battery->sbs; 398 struct acpi_sbs *sbs = battery->sbs;
703 int result = 0; 399 u16 value, sel = 1 << (battery->id + 12);
704 s16 battery_mode;
705 int foo;
706 400
707 result = acpi_battery_select(battery); 401 int ret;
708 if (result) {
709 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
710 "acpi_battery_select() failed"));
711 goto end;
712 }
713 402
714 /* If necessary, enable the alarm */
715 403
716 if (alarm > 0) { 404 if (sbs->manager_present) {
717 result = 405 ret = acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBS_MANAGER,
718 acpi_sbs_read_word(sbs, ACPI_SB_SMBUS_ADDR, 0x03, 406 0x01, (u8 *)&value);
719 &battery_mode); 407 if (ret)
720 if (result) {
721 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
722 "acpi_sbs_read_word() failed"));
723 goto end; 408 goto end;
724 } 409 if ((value & 0xf000) != sel) {
725 410 value &= 0x0fff;
726 result = 411 value |= sel;
727 acpi_sbs_write_word(sbs, ACPI_SB_SMBUS_ADDR, 0x01, 412 ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD,
728 battery_mode & 0xbfff); 413 ACPI_SBS_MANAGER,
729 if (result) { 414 0x01, (u8 *)&value, 2);
730 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 415 if (ret)
731 "acpi_sbs_write_word() failed"));
732 goto end; 416 goto end;
733 } 417 }
734 } 418 }
735 419 ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY,
736 foo = alarm / (battery->info.capacity_mode ? 10 : 1); 420 0x01, (u8 *)&battery->alarm_capacity, 2);
737 result = acpi_sbs_write_word(sbs, ACPI_SB_SMBUS_ADDR, 0x01, foo);
738 if (result) {
739 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
740 "acpi_sbs_write_word() failed"));
741 goto end;
742 }
743
744 end: 421 end:
745 422 return ret;
746 return result;
747} 423}
748 424
749static int acpi_battery_set_mode(struct acpi_battery *battery) 425static int acpi_ac_get_present(struct acpi_sbs *sbs)
750{ 426{
751 struct acpi_sbs *sbs = battery->sbs; 427 int result;
752 int result = 0; 428 u16 status;
753 s16 battery_mode;
754
755 if (capacity_mode == DEF_CAPACITY_UNIT) {
756 goto end;
757 }
758
759 result = acpi_sbs_read_word(sbs,
760 ACPI_SB_SMBUS_ADDR, 0x03, &battery_mode);
761 if (result) {
762 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
763 "acpi_sbs_read_word() failed"));
764 goto end;
765 }
766
767 if (capacity_mode == MAH_CAPACITY_UNIT) {
768 battery_mode &= 0x7fff;
769 } else {
770 battery_mode |= 0x8000;
771 }
772 result = acpi_sbs_write_word(sbs,
773 ACPI_SB_SMBUS_ADDR, 0x03, battery_mode);
774 if (result) {
775 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
776 "acpi_sbs_write_word() failed"));
777 goto end;
778 }
779
780 result = acpi_sbs_read_word(sbs,
781 ACPI_SB_SMBUS_ADDR, 0x03, &battery_mode);
782 if (result) {
783 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
784 "acpi_sbs_read_word() failed"));
785 goto end;
786 }
787 429
788 end: 430 result = acpi_smbus_read(sbs->hc, SMBUS_READ_WORD, ACPI_SBS_CHARGER,
431 0x13, (u8 *) & status);
432 if (!result)
433 sbs->charger_present = (status >> 15) & 0x1;
789 return result; 434 return result;
790} 435}
791 436
792static int acpi_battery_init(struct acpi_battery *battery) 437static ssize_t acpi_battery_alarm_show(struct device *dev,
438 struct device_attribute *attr,
439 char *buf)
793{ 440{
794 int result = 0; 441 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
795 442 acpi_battery_get_alarm(battery);
796 result = acpi_battery_select(battery); 443 return sprintf(buf, "%d\n", battery->alarm_capacity *
797 if (result) { 444 acpi_battery_scale(battery) * 1000);
798 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
799 "acpi_battery_select() failed"));
800 goto end;
801 }
802
803 result = acpi_battery_set_mode(battery);
804 if (result) {
805 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
806 "acpi_battery_set_mode() failed"));
807 goto end;
808 }
809
810 result = acpi_battery_get_info(battery);
811 if (result) {
812 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
813 "acpi_battery_get_info() failed"));
814 goto end;
815 }
816
817 result = acpi_battery_get_state(battery);
818 if (result) {
819 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
820 "acpi_battery_get_state() failed"));
821 goto end;
822 }
823
824 result = acpi_battery_get_alarm(battery);
825 if (result) {
826 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
827 "acpi_battery_get_alarm() failed"));
828 goto end;
829 }
830
831 end:
832 return result;
833} 445}
834 446
835static int acpi_ac_get_present(struct acpi_sbs *sbs) 447static ssize_t acpi_battery_alarm_store(struct device *dev,
448 struct device_attribute *attr,
449 const char *buf, size_t count)
836{ 450{
837 int result = 0; 451 unsigned long x;
838 s16 charger_status; 452 struct acpi_battery *battery = to_acpi_battery(dev_get_drvdata(dev));
839 453 if (sscanf(buf, "%ld\n", &x) == 1)
840 result = acpi_sbs_read_word(sbs, ACPI_SBC_SMBUS_ADDR, 0x13, 454 battery->alarm_capacity = x /
841 &charger_status); 455 (1000 * acpi_battery_scale(battery));
842 456 if (battery->present)
843 if (result) { 457 acpi_battery_set_alarm(battery);
844 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 458 return count;
845 "acpi_sbs_read_word() failed"));
846 goto end;
847 }
848
849 sbs->ac.ac_present = (charger_status & 0x8000) >> 15;
850
851 end:
852
853 return result;
854} 459}
855 460
461static struct device_attribute alarm_attr = {
462 .attr = {.name = "alarm", .mode = 0644, .owner = THIS_MODULE},
463 .show = acpi_battery_alarm_show,
464 .store = acpi_battery_alarm_store,
465};
466
856/* -------------------------------------------------------------------------- 467/* --------------------------------------------------------------------------
857 FS Interface (/proc/acpi) 468 FS Interface (/proc/acpi)
858 -------------------------------------------------------------------------- */ 469 -------------------------------------------------------------------------- */
859 470
471#ifdef CONFIG_ACPI_PROCFS
860/* Generic Routines */ 472/* Generic Routines */
861
862static int 473static int
863acpi_sbs_generic_add_fs(struct proc_dir_entry **dir, 474acpi_sbs_add_fs(struct proc_dir_entry **dir,
864 struct proc_dir_entry *parent_dir, 475 struct proc_dir_entry *parent_dir,
865 char *dir_name, 476 char *dir_name,
866 struct file_operations *info_fops, 477 struct file_operations *info_fops,
867 struct file_operations *state_fops, 478 struct file_operations *state_fops,
868 struct file_operations *alarm_fops, void *data) 479 struct file_operations *alarm_fops, void *data)
869{ 480{
870 struct proc_dir_entry *entry = NULL; 481 struct proc_dir_entry *entry = NULL;
871 482
872 if (!*dir) { 483 if (!*dir) {
873 *dir = proc_mkdir(dir_name, parent_dir); 484 *dir = proc_mkdir(dir_name, parent_dir);
874 if (!*dir) { 485 if (!*dir) {
875 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
876 "proc_mkdir() failed"));
877 return -ENODEV; 486 return -ENODEV;
878 } 487 }
879 (*dir)->owner = THIS_MODULE; 488 (*dir)->owner = THIS_MODULE;
@@ -882,10 +491,7 @@ acpi_sbs_generic_add_fs(struct proc_dir_entry **dir,
882 /* 'info' [R] */ 491 /* 'info' [R] */
883 if (info_fops) { 492 if (info_fops) {
884 entry = create_proc_entry(ACPI_SBS_FILE_INFO, S_IRUGO, *dir); 493 entry = create_proc_entry(ACPI_SBS_FILE_INFO, S_IRUGO, *dir);
885 if (!entry) { 494 if (entry) {
886 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
887 "create_proc_entry() failed"));
888 } else {
889 entry->proc_fops = info_fops; 495 entry->proc_fops = info_fops;
890 entry->data = data; 496 entry->data = data;
891 entry->owner = THIS_MODULE; 497 entry->owner = THIS_MODULE;
@@ -895,10 +501,7 @@ acpi_sbs_generic_add_fs(struct proc_dir_entry **dir,
895 /* 'state' [R] */ 501 /* 'state' [R] */
896 if (state_fops) { 502 if (state_fops) {
897 entry = create_proc_entry(ACPI_SBS_FILE_STATE, S_IRUGO, *dir); 503 entry = create_proc_entry(ACPI_SBS_FILE_STATE, S_IRUGO, *dir);
898 if (!entry) { 504 if (entry) {
899 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
900 "create_proc_entry() failed"));
901 } else {
902 entry->proc_fops = state_fops; 505 entry->proc_fops = state_fops;
903 entry->data = data; 506 entry->data = data;
904 entry->owner = THIS_MODULE; 507 entry->owner = THIS_MODULE;
@@ -908,24 +511,19 @@ acpi_sbs_generic_add_fs(struct proc_dir_entry **dir,
908 /* 'alarm' [R/W] */ 511 /* 'alarm' [R/W] */
909 if (alarm_fops) { 512 if (alarm_fops) {
910 entry = create_proc_entry(ACPI_SBS_FILE_ALARM, S_IRUGO, *dir); 513 entry = create_proc_entry(ACPI_SBS_FILE_ALARM, S_IRUGO, *dir);
911 if (!entry) { 514 if (entry) {
912 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
913 "create_proc_entry() failed"));
914 } else {
915 entry->proc_fops = alarm_fops; 515 entry->proc_fops = alarm_fops;
916 entry->data = data; 516 entry->data = data;
917 entry->owner = THIS_MODULE; 517 entry->owner = THIS_MODULE;
918 } 518 }
919 } 519 }
920
921 return 0; 520 return 0;
922} 521}
923 522
924static void 523static void
925acpi_sbs_generic_remove_fs(struct proc_dir_entry **dir, 524acpi_sbs_remove_fs(struct proc_dir_entry **dir,
926 struct proc_dir_entry *parent_dir) 525 struct proc_dir_entry *parent_dir)
927{ 526{
928
929 if (*dir) { 527 if (*dir) {
930 remove_proc_entry(ACPI_SBS_FILE_INFO, *dir); 528 remove_proc_entry(ACPI_SBS_FILE_INFO, *dir);
931 remove_proc_entry(ACPI_SBS_FILE_STATE, *dir); 529 remove_proc_entry(ACPI_SBS_FILE_STATE, *dir);
@@ -933,82 +531,52 @@ acpi_sbs_generic_remove_fs(struct proc_dir_entry **dir,
933 remove_proc_entry((*dir)->name, parent_dir); 531 remove_proc_entry((*dir)->name, parent_dir);
934 *dir = NULL; 532 *dir = NULL;
935 } 533 }
936
937} 534}
938 535
939/* Smart Battery Interface */ 536/* Smart Battery Interface */
940
941static struct proc_dir_entry *acpi_battery_dir = NULL; 537static struct proc_dir_entry *acpi_battery_dir = NULL;
942 538
539static inline char *acpi_battery_units(struct acpi_battery *battery)
540{
541 return acpi_battery_mode(battery) ? " mWh" : " mAh";
542}
543
544
943static int acpi_battery_read_info(struct seq_file *seq, void *offset) 545static int acpi_battery_read_info(struct seq_file *seq, void *offset)
944{ 546{
945 struct acpi_battery *battery = seq->private; 547 struct acpi_battery *battery = seq->private;
946 struct acpi_sbs *sbs = battery->sbs; 548 struct acpi_sbs *sbs = battery->sbs;
947 int cscale;
948 int result = 0; 549 int result = 0;
949 550
950 if (sbs_mutex_lock(sbs)) { 551 mutex_lock(&sbs->lock);
951 return -ENODEV;
952 }
953
954 result = acpi_check_update_proc(sbs);
955 if (result)
956 goto end;
957
958 if (update_time == 0) {
959 result = acpi_sbs_update_run(sbs, battery->id, DATA_TYPE_INFO);
960 if (result) {
961 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
962 "acpi_sbs_update_run() failed"));
963 }
964 }
965 552
966 if (battery->battery_present) { 553 seq_printf(seq, "present: %s\n",
967 seq_printf(seq, "present: yes\n"); 554 (battery->present) ? "yes" : "no");
968 } else { 555 if (!battery->present)
969 seq_printf(seq, "present: no\n");
970 goto end; 556 goto end;
971 }
972 557
973 if (battery->info.capacity_mode) {
974 cscale = battery->info.vscale * battery->info.ipscale;
975 } else {
976 cscale = battery->info.ipscale;
977 }
978 seq_printf(seq, "design capacity: %i%s\n", 558 seq_printf(seq, "design capacity: %i%s\n",
979 battery->info.design_capacity * cscale, 559 battery->design_capacity * acpi_battery_scale(battery),
980 battery->info.capacity_mode ? "0 mWh" : " mAh"); 560 acpi_battery_units(battery));
981
982 seq_printf(seq, "last full capacity: %i%s\n", 561 seq_printf(seq, "last full capacity: %i%s\n",
983 battery->info.full_charge_capacity * cscale, 562 battery->full_charge_capacity * acpi_battery_scale(battery),
984 battery->info.capacity_mode ? "0 mWh" : " mAh"); 563 acpi_battery_units(battery));
985
986 seq_printf(seq, "battery technology: rechargeable\n"); 564 seq_printf(seq, "battery technology: rechargeable\n");
987
988 seq_printf(seq, "design voltage: %i mV\n", 565 seq_printf(seq, "design voltage: %i mV\n",
989 battery->info.design_voltage * battery->info.vscale); 566 battery->design_voltage * acpi_battery_vscale(battery));
990
991 seq_printf(seq, "design capacity warning: unknown\n"); 567 seq_printf(seq, "design capacity warning: unknown\n");
992 seq_printf(seq, "design capacity low: unknown\n"); 568 seq_printf(seq, "design capacity low: unknown\n");
993 seq_printf(seq, "capacity granularity 1: unknown\n"); 569 seq_printf(seq, "capacity granularity 1: unknown\n");
994 seq_printf(seq, "capacity granularity 2: unknown\n"); 570 seq_printf(seq, "capacity granularity 2: unknown\n");
995 571 seq_printf(seq, "model number: %s\n", battery->device_name);
996 seq_printf(seq, "model number: %s\n",
997 battery->info.device_name);
998
999 seq_printf(seq, "serial number: %i\n", 572 seq_printf(seq, "serial number: %i\n",
1000 battery->info.serial_number); 573 battery->serial_number);
1001
1002 seq_printf(seq, "battery type: %s\n", 574 seq_printf(seq, "battery type: %s\n",
1003 battery->info.device_chemistry); 575 battery->device_chemistry);
1004
1005 seq_printf(seq, "OEM info: %s\n", 576 seq_printf(seq, "OEM info: %s\n",
1006 battery->info.manufacturer_name); 577 battery->manufacturer_name);
1007
1008 end: 578 end:
1009 579 mutex_unlock(&sbs->lock);
1010 sbs_mutex_unlock(sbs);
1011
1012 return result; 580 return result;
1013} 581}
1014 582
@@ -1022,73 +590,29 @@ static int acpi_battery_read_state(struct seq_file *seq, void *offset)
1022 struct acpi_battery *battery = seq->private; 590 struct acpi_battery *battery = seq->private;
1023 struct acpi_sbs *sbs = battery->sbs; 591 struct acpi_sbs *sbs = battery->sbs;
1024 int result = 0; 592 int result = 0;
1025 int cscale;
1026 int foo;
1027
1028 if (sbs_mutex_lock(sbs)) {
1029 return -ENODEV;
1030 }
1031 593
1032 result = acpi_check_update_proc(sbs); 594 mutex_lock(&sbs->lock);
1033 if (result) 595 seq_printf(seq, "present: %s\n",
596 (battery->present) ? "yes" : "no");
597 if (!battery->present)
1034 goto end; 598 goto end;
1035 599
1036 if (update_time == 0) { 600 acpi_battery_get_state(battery);
1037 result = acpi_sbs_update_run(sbs, battery->id, DATA_TYPE_STATE); 601 seq_printf(seq, "capacity state: %s\n",
1038 if (result) { 602 (battery->state & 0x0010) ? "critical" : "ok");
1039 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 603 seq_printf(seq, "charging state: %s\n",
1040 "acpi_sbs_update_run() failed")); 604 (battery->current_now < 0) ? "discharging" :
1041 } 605 ((battery->current_now > 0) ? "charging" : "charged"));
1042 } 606 seq_printf(seq, "present rate: %d mA\n",
1043 607 abs(battery->current_now) * acpi_battery_ipscale(battery));
1044 if (battery->battery_present) {
1045 seq_printf(seq, "present: yes\n");
1046 } else {
1047 seq_printf(seq, "present: no\n");
1048 goto end;
1049 }
1050
1051 if (battery->info.capacity_mode) {
1052 cscale = battery->info.vscale * battery->info.ipscale;
1053 } else {
1054 cscale = battery->info.ipscale;
1055 }
1056
1057 if (battery->state.battery_state & 0x0010) {
1058 seq_printf(seq, "capacity state: critical\n");
1059 } else {
1060 seq_printf(seq, "capacity state: ok\n");
1061 }
1062
1063 foo = (s16) battery->state.amperage * battery->info.ipscale;
1064 if (battery->info.capacity_mode) {
1065 foo = foo * battery->info.design_voltage / 1000;
1066 }
1067 if (battery->state.amperage < 0) {
1068 seq_printf(seq, "charging state: discharging\n");
1069 seq_printf(seq, "present rate: %d %s\n",
1070 -foo, battery->info.capacity_mode ? "mW" : "mA");
1071 } else if (battery->state.amperage > 0) {
1072 seq_printf(seq, "charging state: charging\n");
1073 seq_printf(seq, "present rate: %d %s\n",
1074 foo, battery->info.capacity_mode ? "mW" : "mA");
1075 } else {
1076 seq_printf(seq, "charging state: charged\n");
1077 seq_printf(seq, "present rate: 0 %s\n",
1078 battery->info.capacity_mode ? "mW" : "mA");
1079 }
1080
1081 seq_printf(seq, "remaining capacity: %i%s\n", 608 seq_printf(seq, "remaining capacity: %i%s\n",
1082 battery->state.remaining_capacity * cscale, 609 battery->capacity_now * acpi_battery_scale(battery),
1083 battery->info.capacity_mode ? "0 mWh" : " mAh"); 610 acpi_battery_units(battery));
1084
1085 seq_printf(seq, "present voltage: %i mV\n", 611 seq_printf(seq, "present voltage: %i mV\n",
1086 battery->state.voltage * battery->info.vscale); 612 battery->voltage_now * acpi_battery_vscale(battery));
1087 613
1088 end: 614 end:
1089 615 mutex_unlock(&sbs->lock);
1090 sbs_mutex_unlock(sbs);
1091
1092 return result; 616 return result;
1093} 617}
1094 618
@@ -1102,48 +626,25 @@ static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
1102 struct acpi_battery *battery = seq->private; 626 struct acpi_battery *battery = seq->private;
1103 struct acpi_sbs *sbs = battery->sbs; 627 struct acpi_sbs *sbs = battery->sbs;
1104 int result = 0; 628 int result = 0;
1105 int cscale;
1106
1107 if (sbs_mutex_lock(sbs)) {
1108 return -ENODEV;
1109 }
1110
1111 result = acpi_check_update_proc(sbs);
1112 if (result)
1113 goto end;
1114 629
1115 if (update_time == 0) { 630 mutex_lock(&sbs->lock);
1116 result = acpi_sbs_update_run(sbs, battery->id, DATA_TYPE_ALARM);
1117 if (result) {
1118 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1119 "acpi_sbs_update_run() failed"));
1120 }
1121 }
1122 631
1123 if (!battery->battery_present) { 632 if (!battery->present) {
1124 seq_printf(seq, "present: no\n"); 633 seq_printf(seq, "present: no\n");
1125 goto end; 634 goto end;
1126 } 635 }
1127 636
1128 if (battery->info.capacity_mode) { 637 acpi_battery_get_alarm(battery);
1129 cscale = battery->info.vscale * battery->info.ipscale;
1130 } else {
1131 cscale = battery->info.ipscale;
1132 }
1133
1134 seq_printf(seq, "alarm: "); 638 seq_printf(seq, "alarm: ");
1135 if (battery->alarm.remaining_capacity) { 639 if (battery->alarm_capacity)
1136 seq_printf(seq, "%i%s\n", 640 seq_printf(seq, "%i%s\n",
1137 battery->alarm.remaining_capacity * cscale, 641 battery->alarm_capacity *
1138 battery->info.capacity_mode ? "0 mWh" : " mAh"); 642 acpi_battery_scale(battery),
1139 } else { 643 acpi_battery_units(battery));
644 else
1140 seq_printf(seq, "disabled\n"); 645 seq_printf(seq, "disabled\n");
1141 }
1142
1143 end: 646 end:
1144 647 mutex_unlock(&sbs->lock);
1145 sbs_mutex_unlock(sbs);
1146
1147 return result; 648 return result;
1148} 649}
1149 650
@@ -1155,59 +656,29 @@ acpi_battery_write_alarm(struct file *file, const char __user * buffer,
1155 struct acpi_battery *battery = seq->private; 656 struct acpi_battery *battery = seq->private;
1156 struct acpi_sbs *sbs = battery->sbs; 657 struct acpi_sbs *sbs = battery->sbs;
1157 char alarm_string[12] = { '\0' }; 658 char alarm_string[12] = { '\0' };
1158 int result, old_alarm, new_alarm; 659 int result = 0;
1159 660 mutex_lock(&sbs->lock);
1160 if (sbs_mutex_lock(sbs)) { 661 if (!battery->present) {
1161 return -ENODEV;
1162 }
1163
1164 result = acpi_check_update_proc(sbs);
1165 if (result)
1166 goto end;
1167
1168 if (!battery->battery_present) {
1169 result = -ENODEV; 662 result = -ENODEV;
1170 goto end; 663 goto end;
1171 } 664 }
1172
1173 if (count > sizeof(alarm_string) - 1) { 665 if (count > sizeof(alarm_string) - 1) {
1174 result = -EINVAL; 666 result = -EINVAL;
1175 goto end; 667 goto end;
1176 } 668 }
1177
1178 if (copy_from_user(alarm_string, buffer, count)) { 669 if (copy_from_user(alarm_string, buffer, count)) {
1179 result = -EFAULT; 670 result = -EFAULT;
1180 goto end; 671 goto end;
1181 } 672 }
1182
1183 alarm_string[count] = 0; 673 alarm_string[count] = 0;
1184 674 battery->alarm_capacity = simple_strtoul(alarm_string, NULL, 0) /
1185 old_alarm = battery->alarm.remaining_capacity; 675 acpi_battery_scale(battery);
1186 new_alarm = simple_strtoul(alarm_string, NULL, 0); 676 acpi_battery_set_alarm(battery);
1187
1188 result = acpi_battery_set_alarm(battery, new_alarm);
1189 if (result) {
1190 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1191 "acpi_battery_set_alarm() failed"));
1192 acpi_battery_set_alarm(battery, old_alarm);
1193 goto end;
1194 }
1195 result = acpi_battery_get_alarm(battery);
1196 if (result) {
1197 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1198 "acpi_battery_get_alarm() failed"));
1199 acpi_battery_set_alarm(battery, old_alarm);
1200 goto end;
1201 }
1202
1203 end: 677 end:
1204 sbs_mutex_unlock(sbs); 678 mutex_unlock(&sbs->lock);
1205 679 if (result)
1206 if (result) {
1207 return result; 680 return result;
1208 } else { 681 return count;
1209 return count;
1210 }
1211} 682}
1212 683
1213static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file) 684static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
@@ -1246,26 +717,15 @@ static struct proc_dir_entry *acpi_ac_dir = NULL;
1246 717
1247static int acpi_ac_read_state(struct seq_file *seq, void *offset) 718static int acpi_ac_read_state(struct seq_file *seq, void *offset)
1248{ 719{
1249 struct acpi_sbs *sbs = seq->private;
1250 int result;
1251 720
1252 if (sbs_mutex_lock(sbs)) { 721 struct acpi_sbs *sbs = seq->private;
1253 return -ENODEV;
1254 }
1255 722
1256 if (update_time == 0) { 723 mutex_lock(&sbs->lock);
1257 result = acpi_sbs_update_run(sbs, -1, DATA_TYPE_AC_STATE);
1258 if (result) {
1259 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1260 "acpi_sbs_update_run() failed"));
1261 }
1262 }
1263 724
1264 seq_printf(seq, "state: %s\n", 725 seq_printf(seq, "state: %s\n",
1265 sbs->ac.ac_present ? "on-line" : "off-line"); 726 sbs->charger_present ? "on-line" : "off-line");
1266
1267 sbs_mutex_unlock(sbs);
1268 727
728 mutex_unlock(&sbs->lock);
1269 return 0; 729 return 0;
1270} 730}
1271 731
@@ -1282,429 +742,203 @@ static struct file_operations acpi_ac_state_fops = {
1282 .owner = THIS_MODULE, 742 .owner = THIS_MODULE,
1283}; 743};
1284 744
745#endif
746
1285/* -------------------------------------------------------------------------- 747/* --------------------------------------------------------------------------
1286 Driver Interface 748 Driver Interface
1287 -------------------------------------------------------------------------- */ 749 -------------------------------------------------------------------------- */
750static int acpi_battery_read(struct acpi_battery *battery)
751{
752 int result = 0, saved_present = battery->present;
753 u16 state;
754
755 if (battery->sbs->manager_present) {
756 result = acpi_smbus_read(battery->sbs->hc, SMBUS_READ_WORD,
757 ACPI_SBS_MANAGER, 0x01, (u8 *)&state);
758 if (!result)
759 battery->present = state & (1 << battery->id);
760 state &= 0x0fff;
761 state |= 1 << (battery->id + 12);
762 acpi_smbus_write(battery->sbs->hc, SMBUS_WRITE_WORD,
763 ACPI_SBS_MANAGER, 0x01, (u8 *)&state, 2);
764 } else if (battery->id == 0)
765 battery->present = 1;
766 if (result || !battery->present)
767 return result;
1288 768
1289/* Smart Battery */ 769 if (saved_present != battery->present) {
770 battery->update_time = 0;
771 result = acpi_battery_get_info(battery);
772 if (result)
773 return result;
774 }
775 result = acpi_battery_get_state(battery);
776 return result;
777}
1290 778
779/* Smart Battery */
1291static int acpi_battery_add(struct acpi_sbs *sbs, int id) 780static int acpi_battery_add(struct acpi_sbs *sbs, int id)
1292{ 781{
1293 int is_present; 782 struct acpi_battery *battery = &sbs->battery[id];
1294 int result; 783 int result;
1295 char dir_name[32];
1296 struct acpi_battery *battery;
1297
1298 battery = &sbs->battery[id];
1299
1300 battery->alive = 0;
1301 784
1302 battery->init_state = 0;
1303 battery->id = id; 785 battery->id = id;
1304 battery->sbs = sbs; 786 battery->sbs = sbs;
787 result = acpi_battery_read(battery);
788 if (result)
789 return result;
1305 790
1306 result = acpi_battery_select(battery); 791 sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id);
1307 if (result) { 792#ifdef CONFIG_ACPI_PROCFS
1308 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 793 acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir,
1309 "acpi_battery_select() failed")); 794 battery->name, &acpi_battery_info_fops,
1310 goto end; 795 &acpi_battery_state_fops, &acpi_battery_alarm_fops,
1311 } 796 battery);
1312 797#endif
1313 result = acpi_battery_get_present(battery); 798 battery->bat.name = battery->name;
1314 if (result) { 799 battery->bat.type = POWER_SUPPLY_TYPE_BATTERY;
1315 ACPI_EXCEPTION((AE_INFO, AE_ERROR, 800 if (!acpi_battery_mode(battery)) {
1316 "acpi_battery_get_present() failed")); 801 battery->bat.properties = sbs_charge_battery_props;
1317 goto end; 802 battery->bat.num_properties =
1318 } 803 ARRAY_SIZE(sbs_charge_battery_props);
1319 804 } else {
1320 is_present = battery->battery_present; 805 battery->bat.properties = sbs_energy_battery_props;
1321 806 battery->bat.num_properties =
1322 if (is_present) { 807 ARRAY_SIZE(sbs_energy_battery_props);
1323 result = acpi_battery_init(battery);
1324 if (result) {
1325 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1326 "acpi_battery_init() failed"));
1327 goto end;
1328 }
1329 battery->init_state = 1;
1330 }
1331
1332 sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id);
1333
1334 result = acpi_sbs_generic_add_fs(&battery->battery_entry,
1335 acpi_battery_dir,
1336 dir_name,
1337 &acpi_battery_info_fops,
1338 &acpi_battery_state_fops,
1339 &acpi_battery_alarm_fops, battery);
1340 if (result) {
1341 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1342 "acpi_sbs_generic_add_fs() failed"));
1343 goto end;
1344 } 808 }
1345 battery->alive = 1; 809 battery->bat.get_property = acpi_sbs_battery_get_property;
1346 810 result = power_supply_register(&sbs->device->dev, &battery->bat);
811 device_create_file(battery->bat.dev, &alarm_attr);
1347 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", 812 printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n",
1348 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), dir_name, 813 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
1349 sbs->battery->battery_present ? "present" : "absent"); 814 battery->name, sbs->battery->present ? "present" : "absent");
1350
1351 end:
1352 return result; 815 return result;
1353} 816}
1354 817
1355static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 818static void acpi_battery_remove(struct acpi_sbs *sbs, int id)
1356{ 819{
1357 820 if (sbs->battery[id].bat.dev)
1358 if (sbs->battery[id].battery_entry) { 821 device_remove_file(sbs->battery[id].bat.dev, &alarm_attr);
1359 acpi_sbs_generic_remove_fs(&(sbs->battery[id].battery_entry), 822 power_supply_unregister(&sbs->battery[id].bat);
1360 acpi_battery_dir); 823#ifdef CONFIG_ACPI_PROCFS
1361 } 824 if (sbs->battery[id].proc_entry) {
825 acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry),
826 acpi_battery_dir);
827 }
828#endif
1362} 829}
1363 830
1364static int acpi_ac_add(struct acpi_sbs *sbs) 831static int acpi_charger_add(struct acpi_sbs *sbs)
1365{ 832{
1366 int result; 833 int result;
1367 834
1368 result = acpi_ac_get_present(sbs); 835 result = acpi_ac_get_present(sbs);
1369 if (result) { 836 if (result)
1370 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1371 "acpi_ac_get_present() failed"));
1372 goto end; 837 goto end;
1373 } 838#ifdef CONFIG_ACPI_PROCFS
1374 839 result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir,
1375 result = acpi_sbs_generic_add_fs(&sbs->ac_entry, 840 ACPI_AC_DIR_NAME, NULL,
1376 acpi_ac_dir, 841 &acpi_ac_state_fops, NULL, sbs);
1377 ACPI_AC_DIR_NAME, 842 if (result)
1378 NULL, &acpi_ac_state_fops, NULL, sbs);
1379 if (result) {
1380 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1381 "acpi_sbs_generic_add_fs() failed"));
1382 goto end; 843 goto end;
1383 } 844#endif
1384 845 sbs->charger.name = "sbs-charger";
846 sbs->charger.type = POWER_SUPPLY_TYPE_MAINS;
847 sbs->charger.properties = sbs_ac_props;
848 sbs->charger.num_properties = ARRAY_SIZE(sbs_ac_props);
849 sbs->charger.get_property = sbs_get_ac_property;
850 power_supply_register(&sbs->device->dev, &sbs->charger);
1385 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n", 851 printk(KERN_INFO PREFIX "%s [%s]: AC Adapter [%s] (%s)\n",
1386 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), 852 ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device),
1387 ACPI_AC_DIR_NAME, sbs->ac.ac_present ? "on-line" : "off-line"); 853 ACPI_AC_DIR_NAME, sbs->charger_present ? "on-line" : "off-line");
1388
1389 end: 854 end:
1390
1391 return result; 855 return result;
1392} 856}
1393 857
1394static void acpi_ac_remove(struct acpi_sbs *sbs) 858static void acpi_charger_remove(struct acpi_sbs *sbs)
1395{ 859{
1396 860 if (sbs->charger.dev)
1397 if (sbs->ac_entry) { 861 power_supply_unregister(&sbs->charger);
1398 acpi_sbs_generic_remove_fs(&sbs->ac_entry, acpi_ac_dir); 862#ifdef CONFIG_ACPI_PROCFS
1399 } 863 if (sbs->charger_entry)
864 acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir);
865#endif
1400} 866}
1401 867
1402static void acpi_sbs_update_time_run(unsigned long data) 868void acpi_sbs_callback(void *context)
1403{ 869{
1404 acpi_os_execute(OSL_GPE_HANDLER, acpi_sbs_update_time, (void *)data); 870 int id;
1405} 871 struct acpi_sbs *sbs = context;
1406 872 struct acpi_battery *bat;
1407static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type) 873 u8 saved_charger_state = sbs->charger_present;
1408{ 874 u8 saved_battery_state;
1409 struct acpi_battery *battery; 875 acpi_ac_get_present(sbs);
1410 int result = 0, cnt; 876 if (sbs->charger_present != saved_charger_state) {
1411 int old_ac_present = -1; 877#ifdef CONFIG_ACPI_PROC_EVENT
1412 int old_battery_present = -1; 878 acpi_bus_generate_proc_event4(ACPI_AC_CLASS, ACPI_AC_DIR_NAME,
1413 int new_ac_present = -1; 879 ACPI_SBS_NOTIFY_STATUS,
1414 int new_battery_present = -1; 880 sbs->charger_present);
1415 int id_min = 0, id_max = MAX_SBS_BAT - 1; 881#endif
1416 char dir_name[32]; 882 kobject_uevent(&sbs->charger.dev->kobj, KOBJ_CHANGE);
1417 int do_battery_init = 0, do_ac_init = 0; 883 }
1418 int old_remaining_capacity = 0; 884 if (sbs->manager_present) {
1419 int update_battery = 1; 885 for (id = 0; id < MAX_SBS_BAT; ++id) {
1420 int up_tm = update_time; 886 if (!(sbs->batteries_supported & (1 << id)))
1421 887 continue;
1422 if (sbs_zombie(sbs)) { 888 bat = &sbs->battery[id];
1423 goto end; 889 saved_battery_state = bat->present;
1424 } 890 acpi_battery_read(bat);
1425 891 if (saved_battery_state == bat->present)
1426 if (id >= 0) { 892 continue;
1427 id_min = id_max = id; 893#ifdef CONFIG_ACPI_PROC_EVENT
1428 } 894 acpi_bus_generate_proc_event4(ACPI_BATTERY_CLASS,
1429 895 bat->name,
1430 if (data_type == DATA_TYPE_COMMON && up_tm > 0) { 896 ACPI_SBS_NOTIFY_STATUS,
1431 cnt = up_tm / (up_tm > UPDATE_DELAY ? UPDATE_DELAY : up_tm); 897 bat->present);
1432 if (sbs->run_cnt % cnt != 0) { 898#endif
1433 update_battery = 0; 899 kobject_uevent(&bat->bat.dev->kobj, KOBJ_CHANGE);
1434 }
1435 }
1436
1437 sbs->run_cnt++;
1438
1439 old_ac_present = sbs->ac.ac_present;
1440
1441 result = acpi_ac_get_present(sbs);
1442 if (result) {
1443 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1444 "acpi_ac_get_present() failed"));
1445 }
1446
1447 new_ac_present = sbs->ac.ac_present;
1448
1449 do_ac_init = (old_ac_present != new_ac_present);
1450 if (sbs->run_cnt == 1 && data_type == DATA_TYPE_COMMON) {
1451 do_ac_init = 1;
1452 }
1453
1454 if (do_ac_init) {
1455 result = acpi_sbs_generate_event(sbs->device,
1456 ACPI_SBS_AC_NOTIFY_STATUS,
1457 new_ac_present,
1458 ACPI_AC_DIR_NAME,
1459 ACPI_AC_CLASS);
1460 if (result) {
1461 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1462 "acpi_sbs_generate_event() failed"));
1463 }
1464 }
1465
1466 if (data_type == DATA_TYPE_COMMON) {
1467 if (!do_ac_init && !update_battery) {
1468 goto end;
1469 }
1470 }
1471
1472 if (data_type == DATA_TYPE_AC_STATE && !do_ac_init) {
1473 goto end;
1474 }
1475
1476 for (id = id_min; id <= id_max; id++) {
1477 battery = &sbs->battery[id];
1478 if (battery->alive == 0) {
1479 continue;
1480 }
1481
1482 old_remaining_capacity = battery->state.remaining_capacity;
1483
1484 old_battery_present = battery->battery_present;
1485
1486 result = acpi_battery_select(battery);
1487 if (result) {
1488 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1489 "acpi_battery_select() failed"));
1490 }
1491
1492 result = acpi_battery_get_present(battery);
1493 if (result) {
1494 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1495 "acpi_battery_get_present() failed"));
1496 }
1497
1498 new_battery_present = battery->battery_present;
1499
1500 do_battery_init = ((old_battery_present != new_battery_present)
1501 && new_battery_present);
1502 if (!new_battery_present)
1503 goto event;
1504 if (do_ac_init || do_battery_init) {
1505 result = acpi_battery_init(battery);
1506 if (result) {
1507 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1508 "acpi_battery_init() "
1509 "failed"));
1510 }
1511 }
1512 if (sbs_zombie(sbs)) {
1513 goto end;
1514 }
1515
1516 if ((data_type == DATA_TYPE_COMMON
1517 || data_type == DATA_TYPE_INFO)
1518 && new_battery_present) {
1519 result = acpi_battery_get_info(battery);
1520 if (result) {
1521 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1522 "acpi_battery_get_info() failed"));
1523 }
1524 }
1525 if (data_type == DATA_TYPE_INFO) {
1526 continue;
1527 }
1528 if (sbs_zombie(sbs)) {
1529 goto end;
1530 }
1531
1532 if ((data_type == DATA_TYPE_COMMON
1533 || data_type == DATA_TYPE_STATE)
1534 && new_battery_present) {
1535 result = acpi_battery_get_state(battery);
1536 if (result) {
1537 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1538 "acpi_battery_get_state() failed"));
1539 }
1540 }
1541 if (data_type == DATA_TYPE_STATE) {
1542 goto event;
1543 }
1544 if (sbs_zombie(sbs)) {
1545 goto end;
1546 }
1547
1548 if ((data_type == DATA_TYPE_COMMON
1549 || data_type == DATA_TYPE_ALARM)
1550 && new_battery_present) {
1551 result = acpi_battery_get_alarm(battery);
1552 if (result) {
1553 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1554 "acpi_battery_get_alarm() "
1555 "failed"));
1556 }
1557 }
1558 if (data_type == DATA_TYPE_ALARM) {
1559 continue;
1560 }
1561 if (sbs_zombie(sbs)) {
1562 goto end;
1563 }
1564
1565 event:
1566
1567 if (old_battery_present != new_battery_present || do_ac_init ||
1568 old_remaining_capacity !=
1569 battery->state.remaining_capacity) {
1570 sprintf(dir_name, ACPI_BATTERY_DIR_NAME, id);
1571 result = acpi_sbs_generate_event(sbs->device,
1572 ACPI_SBS_BATTERY_NOTIFY_STATUS,
1573 new_battery_present,
1574 dir_name,
1575 ACPI_BATTERY_CLASS);
1576 if (result) {
1577 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1578 "acpi_sbs_generate_event() "
1579 "failed"));
1580 }
1581 } 900 }
1582 } 901 }
1583
1584 end:
1585
1586 return result;
1587} 902}
1588 903
1589static void acpi_sbs_update_time(void *data) 904static int acpi_sbs_remove(struct acpi_device *device, int type);
1590{
1591 struct acpi_sbs *sbs = data;
1592 unsigned long delay = -1;
1593 int result;
1594 unsigned int up_tm = update_time;
1595
1596 if (sbs_mutex_lock(sbs))
1597 return;
1598
1599 result = acpi_sbs_update_run(sbs, -1, DATA_TYPE_COMMON);
1600 if (result) {
1601 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1602 "acpi_sbs_update_run() failed"));
1603 }
1604
1605 if (sbs_zombie(sbs)) {
1606 goto end;
1607 }
1608
1609 if (!up_tm) {
1610 if (timer_pending(&sbs->update_timer))
1611 del_timer(&sbs->update_timer);
1612 } else {
1613 delay = (up_tm > UPDATE_DELAY ? UPDATE_DELAY : up_tm);
1614 delay = jiffies + HZ * delay;
1615 if (timer_pending(&sbs->update_timer)) {
1616 mod_timer(&sbs->update_timer, delay);
1617 } else {
1618 sbs->update_timer.data = (unsigned long)data;
1619 sbs->update_timer.function = acpi_sbs_update_time_run;
1620 sbs->update_timer.expires = delay;
1621 add_timer(&sbs->update_timer);
1622 }
1623 }
1624
1625 end:
1626
1627 sbs_mutex_unlock(sbs);
1628}
1629 905
1630static int acpi_sbs_add(struct acpi_device *device) 906static int acpi_sbs_add(struct acpi_device *device)
1631{ 907{
1632 struct acpi_sbs *sbs = NULL; 908 struct acpi_sbs *sbs;
1633 int result = 0, remove_result = 0; 909 int result = 0;
1634 int id; 910 int id;
1635 acpi_status status = AE_OK;
1636 unsigned long val;
1637
1638 status =
1639 acpi_evaluate_integer(device->handle, "_EC", NULL, &val);
1640 if (ACPI_FAILURE(status)) {
1641 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "Error obtaining _EC"));
1642 return -EIO;
1643 }
1644 911
1645 sbs = kzalloc(sizeof(struct acpi_sbs), GFP_KERNEL); 912 sbs = kzalloc(sizeof(struct acpi_sbs), GFP_KERNEL);
1646 if (!sbs) { 913 if (!sbs) {
1647 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "kzalloc() failed"));
1648 result = -ENOMEM; 914 result = -ENOMEM;
1649 goto end; 915 goto end;
1650 } 916 }
1651 917
1652 mutex_init(&sbs->mutex); 918 mutex_init(&sbs->lock);
1653
1654 sbs_mutex_lock(sbs);
1655 919
1656 sbs->base = 0xff & (val >> 8); 920 sbs->hc = acpi_driver_data(device->parent);
1657 sbs->device = device; 921 sbs->device = device;
1658
1659 strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME); 922 strcpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME);
1660 strcpy(acpi_device_class(device), ACPI_SBS_CLASS); 923 strcpy(acpi_device_class(device), ACPI_SBS_CLASS);
1661 acpi_driver_data(device) = sbs; 924 acpi_driver_data(device) = sbs;
1662 925
1663 result = acpi_ac_add(sbs); 926 result = acpi_charger_add(sbs);
1664 if (result) {
1665 ACPI_EXCEPTION((AE_INFO, AE_ERROR, "acpi_ac_add() failed"));
1666 goto end;
1667 }
1668
1669 acpi_sbsm_get_info(sbs);
1670
1671 if (!sbs->sbsm_present) {
1672 result = acpi_battery_add(sbs, 0);
1673 if (result) {
1674 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1675 "acpi_battery_add() failed"));
1676 goto end;
1677 }
1678 } else {
1679 for (id = 0; id < MAX_SBS_BAT; id++) {
1680 if ((sbs->sbsm_batteries_supported & (1 << id))) {
1681 result = acpi_battery_add(sbs, id);
1682 if (result) {
1683 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1684 "acpi_battery_add() failed"));
1685 goto end;
1686 }
1687 }
1688 }
1689 }
1690
1691 init_timer(&sbs->update_timer);
1692 result = acpi_check_update_proc(sbs);
1693 if (result) 927 if (result)
1694 goto end; 928 goto end;
1695 929
930 result = acpi_manager_get_info(sbs);
931 if (!result) {
932 sbs->manager_present = 1;
933 for (id = 0; id < MAX_SBS_BAT; ++id)
934 if ((sbs->batteries_supported & (1 << id)))
935 acpi_battery_add(sbs, id);
936 } else
937 acpi_battery_add(sbs, 0);
938 acpi_smbus_register_callback(sbs->hc, acpi_sbs_callback, sbs);
1696 end: 939 end:
1697 940 if (result)
1698 sbs_mutex_unlock(sbs); 941 acpi_sbs_remove(device, 0);
1699
1700 if (result) {
1701 remove_result = acpi_sbs_remove(device, 0);
1702 if (remove_result) {
1703 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1704 "acpi_sbs_remove() failed"));
1705 }
1706 }
1707
1708 return result; 942 return result;
1709} 943}
1710 944
@@ -1713,39 +947,25 @@ static int acpi_sbs_remove(struct acpi_device *device, int type)
1713 struct acpi_sbs *sbs; 947 struct acpi_sbs *sbs;
1714 int id; 948 int id;
1715 949
1716 if (!device) { 950 if (!device)
1717 return -EINVAL; 951 return -EINVAL;
1718 }
1719
1720 sbs = acpi_driver_data(device); 952 sbs = acpi_driver_data(device);
1721 if (!sbs) { 953 if (!sbs)
1722 return -EINVAL; 954 return -EINVAL;
1723 } 955 mutex_lock(&sbs->lock);
1724 956 acpi_smbus_unregister_callback(sbs->hc);
1725 sbs_mutex_lock(sbs); 957 for (id = 0; id < MAX_SBS_BAT; ++id)
1726
1727 sbs->zombie = 1;
1728 del_timer_sync(&sbs->update_timer);
1729 acpi_os_wait_events_complete(NULL);
1730 del_timer_sync(&sbs->update_timer);
1731
1732 for (id = 0; id < MAX_SBS_BAT; id++) {
1733 acpi_battery_remove(sbs, id); 958 acpi_battery_remove(sbs, id);
1734 } 959 acpi_charger_remove(sbs);
1735 960 mutex_unlock(&sbs->lock);
1736 acpi_ac_remove(sbs); 961 mutex_destroy(&sbs->lock);
1737
1738 sbs_mutex_unlock(sbs);
1739
1740 mutex_destroy(&sbs->mutex);
1741
1742 kfree(sbs); 962 kfree(sbs);
1743
1744 return 0; 963 return 0;
1745} 964}
1746 965
1747static void acpi_sbs_rmdirs(void) 966static void acpi_sbs_rmdirs(void)
1748{ 967{
968#ifdef CONFIG_ACPI_PROCFS
1749 if (acpi_ac_dir) { 969 if (acpi_ac_dir) {
1750 acpi_unlock_ac_dir(acpi_ac_dir); 970 acpi_unlock_ac_dir(acpi_ac_dir);
1751 acpi_ac_dir = NULL; 971 acpi_ac_dir = NULL;
@@ -1754,69 +974,58 @@ static void acpi_sbs_rmdirs(void)
1754 acpi_unlock_battery_dir(acpi_battery_dir); 974 acpi_unlock_battery_dir(acpi_battery_dir);
1755 acpi_battery_dir = NULL; 975 acpi_battery_dir = NULL;
1756 } 976 }
977#endif
1757} 978}
1758 979
1759static int acpi_sbs_resume(struct acpi_device *device) 980static int acpi_sbs_resume(struct acpi_device *device)
1760{ 981{
1761 struct acpi_sbs *sbs; 982 struct acpi_sbs *sbs;
1762
1763 if (!device) 983 if (!device)
1764 return -EINVAL; 984 return -EINVAL;
1765
1766 sbs = device->driver_data; 985 sbs = device->driver_data;
1767 986 acpi_sbs_callback(sbs);
1768 sbs->run_cnt = 0;
1769
1770 return 0; 987 return 0;
1771} 988}
1772 989
990static struct acpi_driver acpi_sbs_driver = {
991 .name = "sbs",
992 .class = ACPI_SBS_CLASS,
993 .ids = sbs_device_ids,
994 .ops = {
995 .add = acpi_sbs_add,
996 .remove = acpi_sbs_remove,
997 .resume = acpi_sbs_resume,
998 },
999};
1000
1773static int __init acpi_sbs_init(void) 1001static int __init acpi_sbs_init(void)
1774{ 1002{
1775 int result = 0; 1003 int result = 0;
1776 1004
1777 if (acpi_disabled) 1005 if (acpi_disabled)
1778 return -ENODEV; 1006 return -ENODEV;
1779 1007#ifdef CONFIG_ACPI_PROCFS
1780 if (capacity_mode != DEF_CAPACITY_UNIT
1781 && capacity_mode != MAH_CAPACITY_UNIT
1782 && capacity_mode != MWH_CAPACITY_UNIT) {
1783 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1784 "invalid capacity_mode = %d", capacity_mode));
1785 return -EINVAL;
1786 }
1787
1788 acpi_ac_dir = acpi_lock_ac_dir(); 1008 acpi_ac_dir = acpi_lock_ac_dir();
1789 if (!acpi_ac_dir) { 1009 if (!acpi_ac_dir)
1790 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1791 "acpi_lock_ac_dir() failed"));
1792 return -ENODEV; 1010 return -ENODEV;
1793 }
1794
1795 acpi_battery_dir = acpi_lock_battery_dir(); 1011 acpi_battery_dir = acpi_lock_battery_dir();
1796 if (!acpi_battery_dir) { 1012 if (!acpi_battery_dir) {
1797 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1798 "acpi_lock_battery_dir() failed"));
1799 acpi_sbs_rmdirs(); 1013 acpi_sbs_rmdirs();
1800 return -ENODEV; 1014 return -ENODEV;
1801 } 1015 }
1802 1016#endif
1803 result = acpi_bus_register_driver(&acpi_sbs_driver); 1017 result = acpi_bus_register_driver(&acpi_sbs_driver);
1804 if (result < 0) { 1018 if (result < 0) {
1805 ACPI_EXCEPTION((AE_INFO, AE_ERROR,
1806 "acpi_bus_register_driver() failed"));
1807 acpi_sbs_rmdirs(); 1019 acpi_sbs_rmdirs();
1808 return -ENODEV; 1020 return -ENODEV;
1809 } 1021 }
1810
1811 return 0; 1022 return 0;
1812} 1023}
1813 1024
1814static void __exit acpi_sbs_exit(void) 1025static void __exit acpi_sbs_exit(void)
1815{ 1026{
1816 acpi_bus_unregister_driver(&acpi_sbs_driver); 1027 acpi_bus_unregister_driver(&acpi_sbs_driver);
1817
1818 acpi_sbs_rmdirs(); 1028 acpi_sbs_rmdirs();
1819
1820 return; 1029 return;
1821} 1030}
1822 1031
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
new file mode 100644
index 000000000000..046d7c3ed356
--- /dev/null
+++ b/drivers/acpi/sbshc.c
@@ -0,0 +1,309 @@
1/*
2 * SMBus driver for ACPI Embedded Controller (v0.1)
3 *
4 * Copyright (c) 2007 Alexey Starikovskiy
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation version 2.
9 */
10
11#include <acpi/acpi_bus.h>
12#include <acpi/acpi_drivers.h>
13#include <acpi/actypes.h>
14#include <linux/wait.h>
15#include <linux/delay.h>
16#include <linux/interrupt.h>
17#include "sbshc.h"
18
19#define ACPI_SMB_HC_CLASS "smbus_host_controller"
20#define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC"
21
22struct acpi_smb_hc {
23 struct acpi_ec *ec;
24 struct mutex lock;
25 wait_queue_head_t wait;
26 u8 offset;
27 u8 query_bit;
28 smbus_alarm_callback callback;
29 void *context;
30};
31
32static int acpi_smbus_hc_add(struct acpi_device *device);
33static int acpi_smbus_hc_remove(struct acpi_device *device, int type);
34
35static const struct acpi_device_id sbs_device_ids[] = {
36 {"ACPI0001", 0},
37 {"ACPI0005", 0},
38 {"", 0},
39};
40
41MODULE_DEVICE_TABLE(acpi, sbs_device_ids);
42
43static struct acpi_driver acpi_smb_hc_driver = {
44 .name = "smbus_hc",
45 .class = ACPI_SMB_HC_CLASS,
46 .ids = sbs_device_ids,
47 .ops = {
48 .add = acpi_smbus_hc_add,
49 .remove = acpi_smbus_hc_remove,
50 },
51};
52
53union acpi_smb_status {
54 u8 raw;
55 struct {
56 u8 status:5;
57 u8 reserved:1;
58 u8 alarm:1;
59 u8 done:1;
60 } fields;
61};
62
63enum acpi_smb_status_codes {
64 SMBUS_OK = 0,
65 SMBUS_UNKNOWN_FAILURE = 0x07,
66 SMBUS_DEVICE_ADDRESS_NACK = 0x10,
67 SMBUS_DEVICE_ERROR = 0x11,
68 SMBUS_DEVICE_COMMAND_ACCESS_DENIED = 0x12,
69 SMBUS_UNKNOWN_ERROR = 0x13,
70 SMBUS_DEVICE_ACCESS_DENIED = 0x17,
71 SMBUS_TIMEOUT = 0x18,
72 SMBUS_HOST_UNSUPPORTED_PROTOCOL = 0x19,
73 SMBUS_BUSY = 0x1a,
74 SMBUS_PEC_ERROR = 0x1f,
75};
76
77enum acpi_smb_offset {
78 ACPI_SMB_PROTOCOL = 0, /* protocol, PEC */
79 ACPI_SMB_STATUS = 1, /* status */
80 ACPI_SMB_ADDRESS = 2, /* address */
81 ACPI_SMB_COMMAND = 3, /* command */
82 ACPI_SMB_DATA = 4, /* 32 data registers */
83 ACPI_SMB_BLOCK_COUNT = 0x24, /* number of data bytes */
84 ACPI_SMB_ALARM_ADDRESS = 0x25, /* alarm address */
85 ACPI_SMB_ALARM_DATA = 0x26, /* 2 bytes alarm data */
86};
87
88static inline int smb_hc_read(struct acpi_smb_hc *hc, u8 address, u8 *data)
89{
90 return ec_read(hc->offset + address, data);
91}
92
93static inline int smb_hc_write(struct acpi_smb_hc *hc, u8 address, u8 data)
94{
95 return ec_write(hc->offset + address, data);
96}
97
98static inline int smb_check_done(struct acpi_smb_hc *hc)
99{
100 union acpi_smb_status status = {.raw = 0};
101 smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw);
102 return status.fields.done && (status.fields.status == SMBUS_OK);
103}
104
105static int wait_transaction_complete(struct acpi_smb_hc *hc, int timeout)
106{
107 if (wait_event_timeout(hc->wait, smb_check_done(hc),
108 msecs_to_jiffies(timeout)))
109 return 0;
110 else
111 return -ETIME;
112}
113
114int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol, u8 address,
115 u8 command, u8 *data, u8 length)
116{
117 int ret = -EFAULT, i;
118 u8 temp, sz = 0;
119
120 mutex_lock(&hc->lock);
121 if (smb_hc_read(hc, ACPI_SMB_PROTOCOL, &temp))
122 goto end;
123 if (temp) {
124 ret = -EBUSY;
125 goto end;
126 }
127 smb_hc_write(hc, ACPI_SMB_COMMAND, command);
128 smb_hc_write(hc, ACPI_SMB_COMMAND, command);
129 if (!(protocol & 0x01)) {
130 smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length);
131 for (i = 0; i < length; ++i)
132 smb_hc_write(hc, ACPI_SMB_DATA + i, data[i]);
133 }
134 smb_hc_write(hc, ACPI_SMB_ADDRESS, address << 1);
135 smb_hc_write(hc, ACPI_SMB_PROTOCOL, protocol);
136 /*
137 * Wait for completion. Save the status code, data size,
138 * and data into the return package (if required by the protocol).
139 */
140 ret = wait_transaction_complete(hc, 1000);
141 if (ret || !(protocol & 0x01))
142 goto end;
143 switch (protocol) {
144 case SMBUS_RECEIVE_BYTE:
145 case SMBUS_READ_BYTE:
146 sz = 1;
147 break;
148 case SMBUS_READ_WORD:
149 sz = 2;
150 break;
151 case SMBUS_READ_BLOCK:
152 if (smb_hc_read(hc, ACPI_SMB_BLOCK_COUNT, &sz)) {
153 ret = -EFAULT;
154 goto end;
155 }
156 sz &= 0x1f;
157 break;
158 }
159 for (i = 0; i < sz; ++i)
160 smb_hc_read(hc, ACPI_SMB_DATA + i, &data[i]);
161 end:
162 mutex_unlock(&hc->lock);
163 return ret;
164}
165
166int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address,
167 u8 command, u8 *data)
168{
169 return acpi_smbus_transaction(hc, protocol, address, command, data, 0);
170}
171
172EXPORT_SYMBOL_GPL(acpi_smbus_read);
173
174int acpi_smbus_write(struct acpi_smb_hc *hc, u8 protocol, u8 address,
175 u8 command, u8 *data, u8 length)
176{
177 return acpi_smbus_transaction(hc, protocol, address, command, data, length);
178}
179
180EXPORT_SYMBOL_GPL(acpi_smbus_write);
181
182int acpi_smbus_register_callback(struct acpi_smb_hc *hc,
183 smbus_alarm_callback callback, void *context)
184{
185 mutex_lock(&hc->lock);
186 hc->callback = callback;
187 hc->context = context;
188 mutex_unlock(&hc->lock);
189 return 0;
190}
191
192EXPORT_SYMBOL_GPL(acpi_smbus_register_callback);
193
194int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc)
195{
196 mutex_lock(&hc->lock);
197 hc->callback = NULL;
198 hc->context = NULL;
199 mutex_unlock(&hc->lock);
200 return 0;
201}
202
203EXPORT_SYMBOL_GPL(acpi_smbus_unregister_callback);
204
205static void acpi_smbus_callback(void *context)
206{
207 struct acpi_smb_hc *hc = context;
208
209 if (hc->callback)
210 hc->callback(hc->context);
211}
212
213static int smbus_alarm(void *context)
214{
215 struct acpi_smb_hc *hc = context;
216 union acpi_smb_status status;
217 if (smb_hc_read(hc, ACPI_SMB_STATUS, &status.raw))
218 return 0;
219 /* Check if it is only a completion notify */
220 if (status.fields.done)
221 wake_up(&hc->wait);
222 if (!status.fields.alarm)
223 return 0;
224 mutex_lock(&hc->lock);
225 smb_hc_write(hc, ACPI_SMB_STATUS, status.raw);
226 if (hc->callback)
227 acpi_os_execute(OSL_GPE_HANDLER, acpi_smbus_callback, hc);
228 mutex_unlock(&hc->lock);
229 return 0;
230}
231
232typedef int (*acpi_ec_query_func) (void *data);
233
234extern int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
235 acpi_handle handle, acpi_ec_query_func func,
236 void *data);
237
238static int acpi_smbus_hc_add(struct acpi_device *device)
239{
240 int status;
241 unsigned long val;
242 struct acpi_smb_hc *hc;
243
244 if (!device)
245 return -EINVAL;
246
247 status = acpi_evaluate_integer(device->handle, "_EC", NULL, &val);
248 if (ACPI_FAILURE(status)) {
249 printk(KERN_ERR PREFIX "error obtaining _EC.\n");
250 return -EIO;
251 }
252
253 strcpy(acpi_device_name(device), ACPI_SMB_HC_DEVICE_NAME);
254 strcpy(acpi_device_class(device), ACPI_SMB_HC_CLASS);
255
256 hc = kzalloc(sizeof(struct acpi_smb_hc), GFP_KERNEL);
257 if (!hc)
258 return -ENOMEM;
259 mutex_init(&hc->lock);
260 init_waitqueue_head(&hc->wait);
261
262 hc->ec = acpi_driver_data(device->parent);
263 hc->offset = (val >> 8) & 0xff;
264 hc->query_bit = val & 0xff;
265 acpi_driver_data(device) = hc;
266
267 acpi_ec_add_query_handler(hc->ec, hc->query_bit, NULL, smbus_alarm, hc);
268 printk(KERN_INFO PREFIX "SBS HC: EC = 0x%p, offset = 0x%0x, query_bit = 0x%0x\n",
269 hc->ec, hc->offset, hc->query_bit);
270
271 return 0;
272}
273
274extern void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
275
276static int acpi_smbus_hc_remove(struct acpi_device *device, int type)
277{
278 struct acpi_smb_hc *hc;
279
280 if (!device)
281 return -EINVAL;
282
283 hc = acpi_driver_data(device);
284 acpi_ec_remove_query_handler(hc->ec, hc->query_bit);
285 kfree(hc);
286 return 0;
287}
288
289static int __init acpi_smb_hc_init(void)
290{
291 int result;
292
293 result = acpi_bus_register_driver(&acpi_smb_hc_driver);
294 if (result < 0)
295 return -ENODEV;
296 return 0;
297}
298
299static void __exit acpi_smb_hc_exit(void)
300{
301 acpi_bus_unregister_driver(&acpi_smb_hc_driver);
302}
303
304module_init(acpi_smb_hc_init);
305module_exit(acpi_smb_hc_exit);
306
307MODULE_LICENSE("GPL");
308MODULE_AUTHOR("Alexey Starikovskiy");
309MODULE_DESCRIPTION("ACPI SMBus HC driver");
diff --git a/drivers/acpi/sbshc.h b/drivers/acpi/sbshc.h
new file mode 100644
index 000000000000..3bda3491a97b
--- /dev/null
+++ b/drivers/acpi/sbshc.h
@@ -0,0 +1,27 @@
1struct acpi_smb_hc;
2enum acpi_smb_protocol {
3 SMBUS_WRITE_QUICK = 2,
4 SMBUS_READ_QUICK = 3,
5 SMBUS_SEND_BYTE = 4,
6 SMBUS_RECEIVE_BYTE = 5,
7 SMBUS_WRITE_BYTE = 6,
8 SMBUS_READ_BYTE = 7,
9 SMBUS_WRITE_WORD = 8,
10 SMBUS_READ_WORD = 9,
11 SMBUS_WRITE_BLOCK = 0xa,
12 SMBUS_READ_BLOCK = 0xb,
13 SMBUS_PROCESS_CALL = 0xc,
14 SMBUS_BLOCK_PROCESS_CALL = 0xd,
15};
16
17static const u8 SMBUS_PEC = 0x80;
18
19typedef void (*smbus_alarm_callback)(void *context);
20
21extern int acpi_smbus_read(struct acpi_smb_hc *hc, u8 protocol, u8 address,
22 u8 command, u8 * data);
23extern int acpi_smbus_write(struct acpi_smb_hc *hc, u8 protocol, u8 slave_address,
24 u8 command, u8 * data, u8 length);
25extern int acpi_smbus_register_callback(struct acpi_smb_hc *hc,
26 smbus_alarm_callback callback, void *context);
27extern int acpi_smbus_unregister_callback(struct acpi_smb_hc *hc);
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index 5055acf2163c..f3d3867303ec 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -44,13 +44,12 @@ int acpi_sleep_prepare(u32 acpi_state)
44 ACPI_FLUSH_CPU_CACHE(); 44 ACPI_FLUSH_CPU_CACHE();
45 acpi_enable_wakeup_device_prep(acpi_state); 45 acpi_enable_wakeup_device_prep(acpi_state);
46#endif 46#endif
47 acpi_gpe_sleep_prepare(acpi_state);
48 acpi_enter_sleep_state_prep(acpi_state); 47 acpi_enter_sleep_state_prep(acpi_state);
49 return 0; 48 return 0;
50} 49}
51 50
52#ifdef CONFIG_SUSPEND 51#ifdef CONFIG_SUSPEND
53static struct pm_ops acpi_pm_ops; 52static struct platform_suspend_ops acpi_pm_ops;
54 53
55extern void do_suspend_lowlevel(void); 54extern void do_suspend_lowlevel(void);
56 55
@@ -85,13 +84,12 @@ static int acpi_pm_set_target(suspend_state_t pm_state)
85 84
86/** 85/**
87 * acpi_pm_prepare - Do preliminary suspend work. 86 * acpi_pm_prepare - Do preliminary suspend work.
88 * @pm_state: ignored
89 * 87 *
90 * If necessary, set the firmware waking vector and do arch-specific 88 * If necessary, set the firmware waking vector and do arch-specific
91 * nastiness to get the wakeup code to the waking vector. 89 * nastiness to get the wakeup code to the waking vector.
92 */ 90 */
93 91
94static int acpi_pm_prepare(suspend_state_t pm_state) 92static int acpi_pm_prepare(void)
95{ 93{
96 int error = acpi_sleep_prepare(acpi_target_sleep_state); 94 int error = acpi_sleep_prepare(acpi_target_sleep_state);
97 95
@@ -160,13 +158,12 @@ static int acpi_pm_enter(suspend_state_t pm_state)
160 158
161/** 159/**
162 * acpi_pm_finish - Finish up suspend sequence. 160 * acpi_pm_finish - Finish up suspend sequence.
163 * @pm_state: ignored
164 * 161 *
165 * This is called after we wake back up (or if entering the sleep state 162 * This is called after we wake back up (or if entering the sleep state
166 * failed). 163 * failed).
167 */ 164 */
168 165
169static int acpi_pm_finish(suspend_state_t pm_state) 166static void acpi_pm_finish(void)
170{ 167{
171 u32 acpi_state = acpi_target_sleep_state; 168 u32 acpi_state = acpi_target_sleep_state;
172 169
@@ -184,7 +181,6 @@ static int acpi_pm_finish(suspend_state_t pm_state)
184 init_8259A(0); 181 init_8259A(0);
185 } 182 }
186#endif 183#endif
187 return 0;
188} 184}
189 185
190static int acpi_pm_state_valid(suspend_state_t pm_state) 186static int acpi_pm_state_valid(suspend_state_t pm_state)
@@ -203,7 +199,7 @@ static int acpi_pm_state_valid(suspend_state_t pm_state)
203 } 199 }
204} 200}
205 201
206static struct pm_ops acpi_pm_ops = { 202static struct platform_suspend_ops acpi_pm_ops = {
207 .valid = acpi_pm_state_valid, 203 .valid = acpi_pm_state_valid,
208 .set_target = acpi_pm_set_target, 204 .set_target = acpi_pm_set_target,
209 .prepare = acpi_pm_prepare, 205 .prepare = acpi_pm_prepare,
@@ -233,6 +229,12 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
233#endif /* CONFIG_SUSPEND */ 229#endif /* CONFIG_SUSPEND */
234 230
235#ifdef CONFIG_HIBERNATION 231#ifdef CONFIG_HIBERNATION
232static int acpi_hibernation_start(void)
233{
234 acpi_target_sleep_state = ACPI_STATE_S4;
235 return 0;
236}
237
236static int acpi_hibernation_prepare(void) 238static int acpi_hibernation_prepare(void)
237{ 239{
238 return acpi_sleep_prepare(ACPI_STATE_S4); 240 return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -254,13 +256,29 @@ static int acpi_hibernation_enter(void)
254 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 256 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
255} 257}
256 258
259static void acpi_hibernation_leave(void)
260{
261 /*
262 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
263 * enable it here.
264 */
265 acpi_enable();
266}
267
257static void acpi_hibernation_finish(void) 268static void acpi_hibernation_finish(void)
258{ 269{
270 /*
271 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
272 * enable it here.
273 */
274 acpi_enable();
259 acpi_leave_sleep_state(ACPI_STATE_S4); 275 acpi_leave_sleep_state(ACPI_STATE_S4);
260 acpi_disable_wakeup_device(ACPI_STATE_S4); 276 acpi_disable_wakeup_device(ACPI_STATE_S4);
261 277
262 /* reset firmware waking vector */ 278 /* reset firmware waking vector */
263 acpi_set_firmware_waking_vector((acpi_physical_address) 0); 279 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
280
281 acpi_target_sleep_state = ACPI_STATE_S0;
264} 282}
265 283
266static int acpi_hibernation_pre_restore(void) 284static int acpi_hibernation_pre_restore(void)
@@ -277,10 +295,13 @@ static void acpi_hibernation_restore_cleanup(void)
277 acpi_hw_enable_all_runtime_gpes(); 295 acpi_hw_enable_all_runtime_gpes();
278} 296}
279 297
280static struct hibernation_ops acpi_hibernation_ops = { 298static struct platform_hibernation_ops acpi_hibernation_ops = {
299 .start = acpi_hibernation_start,
300 .pre_snapshot = acpi_hibernation_prepare,
301 .finish = acpi_hibernation_finish,
281 .prepare = acpi_hibernation_prepare, 302 .prepare = acpi_hibernation_prepare,
282 .enter = acpi_hibernation_enter, 303 .enter = acpi_hibernation_enter,
283 .finish = acpi_hibernation_finish, 304 .leave = acpi_hibernation_leave,
284 .pre_restore = acpi_hibernation_pre_restore, 305 .pre_restore = acpi_hibernation_pre_restore,
285 .restore_cleanup = acpi_hibernation_restore_cleanup, 306 .restore_cleanup = acpi_hibernation_restore_cleanup,
286}; 307};
@@ -417,7 +438,7 @@ int __init acpi_sleep_init(void)
417 } 438 }
418 } 439 }
419 440
420 pm_set_ops(&acpi_pm_ops); 441 suspend_set_ops(&acpi_pm_ops);
421#endif 442#endif
422 443
423#ifdef CONFIG_HIBERNATION 444#ifdef CONFIG_HIBERNATION
diff --git a/drivers/acpi/sleep/sleep.h b/drivers/acpi/sleep/sleep.h
index ff1f8504f497..a2ea125ae2d0 100644
--- a/drivers/acpi/sleep/sleep.h
+++ b/drivers/acpi/sleep/sleep.h
@@ -5,6 +5,5 @@ extern int acpi_suspend (u32 state);
5extern void acpi_enable_wakeup_device_prep(u8 sleep_state); 5extern void acpi_enable_wakeup_device_prep(u8 sleep_state);
6extern void acpi_enable_wakeup_device(u8 sleep_state); 6extern void acpi_enable_wakeup_device(u8 sleep_state);
7extern void acpi_disable_wakeup_device(u8 sleep_state); 7extern void acpi_disable_wakeup_device(u8 sleep_state);
8extern void acpi_gpe_sleep_prepare(u32 sleep_state);
9 8
10extern int acpi_sleep_prepare(u32 acpi_state); 9extern int acpi_sleep_prepare(u32 acpi_state);
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c
index 97c27ddb144d..ed8e41becf0c 100644
--- a/drivers/acpi/sleep/wakeup.c
+++ b/drivers/acpi/sleep/wakeup.c
@@ -64,36 +64,29 @@ void acpi_enable_wakeup_device(u8 sleep_state)
64 ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device"); 64 ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device");
65 spin_lock(&acpi_device_lock); 65 spin_lock(&acpi_device_lock);
66 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 66 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
67 struct acpi_device *dev = container_of(node, 67 struct acpi_device *dev =
68 struct acpi_device, 68 container_of(node, struct acpi_device, wakeup_list);
69 wakeup_list); 69 if (!dev->wakeup.flags.valid)
70 70 continue;
71 /* If users want to disable run-wake GPE, 71 /* If users want to disable run-wake GPE,
72 * we only disable it for wake and leave it for runtime 72 * we only disable it for wake and leave it for runtime
73 */ 73 */
74 if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) { 74 if (!dev->wakeup.state.enabled ||
75 spin_unlock(&acpi_device_lock); 75 sleep_state > (u32) dev->wakeup.sleep_state) {
76 acpi_set_gpe_type(dev->wakeup.gpe_device, 76 if (dev->wakeup.flags.run_wake) {
77 dev->wakeup.gpe_number, 77 spin_unlock(&acpi_device_lock);
78 ACPI_GPE_TYPE_RUNTIME); 78 /* set_gpe_type will disable GPE, leave it like that */
79 /* Re-enable it, since set_gpe_type will disable it */ 79 acpi_set_gpe_type(dev->wakeup.gpe_device,
80 acpi_enable_gpe(dev->wakeup.gpe_device, 80 dev->wakeup.gpe_number,
81 dev->wakeup.gpe_number, ACPI_ISR); 81 ACPI_GPE_TYPE_RUNTIME);
82 spin_lock(&acpi_device_lock); 82 spin_lock(&acpi_device_lock);
83 }
83 continue; 84 continue;
84 } 85 }
85
86 if (!dev->wakeup.flags.valid ||
87 !dev->wakeup.state.enabled ||
88 (sleep_state > (u32) dev->wakeup.sleep_state))
89 continue;
90
91 spin_unlock(&acpi_device_lock); 86 spin_unlock(&acpi_device_lock);
92 /* run-wake GPE has been enabled */
93 if (!dev->wakeup.flags.run_wake) 87 if (!dev->wakeup.flags.run_wake)
94 acpi_enable_gpe(dev->wakeup.gpe_device, 88 acpi_enable_gpe(dev->wakeup.gpe_device,
95 dev->wakeup.gpe_number, ACPI_ISR); 89 dev->wakeup.gpe_number, ACPI_ISR);
96 dev->wakeup.state.active = 1;
97 spin_lock(&acpi_device_lock); 90 spin_lock(&acpi_device_lock);
98 } 91 }
99 spin_unlock(&acpi_device_lock); 92 spin_unlock(&acpi_device_lock);
@@ -112,26 +105,25 @@ void acpi_disable_wakeup_device(u8 sleep_state)
112 105
113 spin_lock(&acpi_device_lock); 106 spin_lock(&acpi_device_lock);
114 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 107 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
115 struct acpi_device *dev = container_of(node, 108 struct acpi_device *dev =
116 struct acpi_device, 109 container_of(node, struct acpi_device, wakeup_list);
117 wakeup_list);
118 110
119 if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) { 111 if (!dev->wakeup.flags.valid)
120 spin_unlock(&acpi_device_lock);
121 acpi_set_gpe_type(dev->wakeup.gpe_device,
122 dev->wakeup.gpe_number,
123 ACPI_GPE_TYPE_WAKE_RUN);
124 /* Re-enable it, since set_gpe_type will disable it */
125 acpi_enable_gpe(dev->wakeup.gpe_device,
126 dev->wakeup.gpe_number, ACPI_NOT_ISR);
127 spin_lock(&acpi_device_lock);
128 continue; 112 continue;
129 } 113 if (!dev->wakeup.state.enabled ||
130 114 sleep_state > (u32) dev->wakeup.sleep_state) {
131 if (!dev->wakeup.flags.valid || 115 if (dev->wakeup.flags.run_wake) {
132 !dev->wakeup.state.active || 116 spin_unlock(&acpi_device_lock);
133 (sleep_state > (u32) dev->wakeup.sleep_state)) 117 acpi_set_gpe_type(dev->wakeup.gpe_device,
118 dev->wakeup.gpe_number,
119 ACPI_GPE_TYPE_WAKE_RUN);
120 /* Re-enable it, since set_gpe_type will disable it */
121 acpi_enable_gpe(dev->wakeup.gpe_device,
122 dev->wakeup.gpe_number, ACPI_NOT_ISR);
123 spin_lock(&acpi_device_lock);
124 }
134 continue; 125 continue;
126 }
135 127
136 spin_unlock(&acpi_device_lock); 128 spin_unlock(&acpi_device_lock);
137 acpi_disable_wakeup_device_power(dev); 129 acpi_disable_wakeup_device_power(dev);
@@ -142,7 +134,6 @@ void acpi_disable_wakeup_device(u8 sleep_state)
142 acpi_clear_gpe(dev->wakeup.gpe_device, 134 acpi_clear_gpe(dev->wakeup.gpe_device,
143 dev->wakeup.gpe_number, ACPI_NOT_ISR); 135 dev->wakeup.gpe_number, ACPI_NOT_ISR);
144 } 136 }
145 dev->wakeup.state.active = 0;
146 spin_lock(&acpi_device_lock); 137 spin_lock(&acpi_device_lock);
147 } 138 }
148 spin_unlock(&acpi_device_lock); 139 spin_unlock(&acpi_device_lock);
@@ -160,48 +151,20 @@ static int __init acpi_wakeup_device_init(void)
160 struct acpi_device *dev = container_of(node, 151 struct acpi_device *dev = container_of(node,
161 struct acpi_device, 152 struct acpi_device,
162 wakeup_list); 153 wakeup_list);
163
164 /* In case user doesn't load button driver */ 154 /* In case user doesn't load button driver */
165 if (dev->wakeup.flags.run_wake && !dev->wakeup.state.enabled) { 155 if (!dev->wakeup.flags.run_wake || dev->wakeup.state.enabled)
166 spin_unlock(&acpi_device_lock); 156 continue;
167 acpi_set_gpe_type(dev->wakeup.gpe_device, 157 spin_unlock(&acpi_device_lock);
168 dev->wakeup.gpe_number, 158 acpi_set_gpe_type(dev->wakeup.gpe_device,
169 ACPI_GPE_TYPE_WAKE_RUN); 159 dev->wakeup.gpe_number,
170 acpi_enable_gpe(dev->wakeup.gpe_device, 160 ACPI_GPE_TYPE_WAKE_RUN);
171 dev->wakeup.gpe_number, ACPI_NOT_ISR); 161 acpi_enable_gpe(dev->wakeup.gpe_device,
172 dev->wakeup.state.enabled = 1; 162 dev->wakeup.gpe_number, ACPI_NOT_ISR);
173 spin_lock(&acpi_device_lock); 163 dev->wakeup.state.enabled = 1;
174 } 164 spin_lock(&acpi_device_lock);
175 } 165 }
176 spin_unlock(&acpi_device_lock); 166 spin_unlock(&acpi_device_lock);
177
178 return 0; 167 return 0;
179} 168}
180 169
181late_initcall(acpi_wakeup_device_init); 170late_initcall(acpi_wakeup_device_init);
182
183/*
184 * Disable all wakeup GPEs before entering requested sleep state.
185 * @sleep_state: ACPI state
186 * Since acpi_enter_sleep_state() will disable all
187 * RUNTIME GPEs, we simply mark all GPES that
188 * are not enabled for wakeup from requested state as RUNTIME.
189 */
190void acpi_gpe_sleep_prepare(u32 sleep_state)
191{
192 struct list_head *node, *next;
193
194 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
195 struct acpi_device *dev = container_of(node,
196 struct acpi_device,
197 wakeup_list);
198
199 /* The GPE can wakeup system from this state, don't touch it */
200 if ((u32) dev->wakeup.sleep_state >= sleep_state)
201 continue;
202 /* acpi_set_gpe_type will automatically disable GPE */
203 acpi_set_gpe_type(dev->wakeup.gpe_device,
204 dev->wakeup.gpe_number,
205 ACPI_GPE_TYPE_RUNTIME);
206 }
207}
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 8cc9492ffbf2..5f1d85f2ffe4 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -400,7 +400,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
400 u32 table_count; 400 u32 table_count;
401 struct acpi_table_header *table; 401 struct acpi_table_header *table;
402 acpi_physical_address address; 402 acpi_physical_address address;
403 acpi_physical_address rsdt_address; 403 acpi_physical_address uninitialized_var(rsdt_address);
404 u32 length; 404 u32 length;
405 u8 *table_entry; 405 u8 *table_entry;
406 acpi_status status; 406 acpi_status status;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index ad898e10c1a9..5f79b4451212 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -195,6 +195,7 @@ struct acpi_thermal {
195 struct acpi_thermal_trips trips; 195 struct acpi_thermal_trips trips;
196 struct acpi_handle_list devices; 196 struct acpi_handle_list devices;
197 struct timer_list timer; 197 struct timer_list timer;
198 struct mutex lock;
198}; 199};
199 200
200static const struct file_operations acpi_thermal_state_fops = { 201static const struct file_operations acpi_thermal_state_fops = {
@@ -711,6 +712,7 @@ static void acpi_thermal_check(void *data)
711 int result = 0; 712 int result = 0;
712 struct acpi_thermal *tz = data; 713 struct acpi_thermal *tz = data;
713 unsigned long sleep_time = 0; 714 unsigned long sleep_time = 0;
715 unsigned long timeout_jiffies = 0;
714 int i = 0; 716 int i = 0;
715 struct acpi_thermal_state state; 717 struct acpi_thermal_state state;
716 718
@@ -720,11 +722,15 @@ static void acpi_thermal_check(void *data)
720 return; 722 return;
721 } 723 }
722 724
725 /* Check if someone else is already running */
726 if (!mutex_trylock(&tz->lock))
727 return;
728
723 state = tz->state; 729 state = tz->state;
724 730
725 result = acpi_thermal_get_temperature(tz); 731 result = acpi_thermal_get_temperature(tz);
726 if (result) 732 if (result)
727 return; 733 goto unlock;
728 734
729 memset(&tz->state, 0, sizeof(tz->state)); 735 memset(&tz->state, 0, sizeof(tz->state));
730 736
@@ -787,10 +793,13 @@ static void acpi_thermal_check(void *data)
787 * a thermal event occurs). Note that _TSP and _TZD values are 793 * a thermal event occurs). Note that _TSP and _TZD values are
788 * given in 1/10th seconds (we must covert to milliseconds). 794 * given in 1/10th seconds (we must covert to milliseconds).
789 */ 795 */
790 if (tz->state.passive) 796 if (tz->state.passive) {
791 sleep_time = tz->trips.passive.tsp * 100; 797 sleep_time = tz->trips.passive.tsp * 100;
792 else if (tz->polling_frequency > 0) 798 timeout_jiffies = jiffies + (HZ * sleep_time) / 1000;
799 } else if (tz->polling_frequency > 0) {
793 sleep_time = tz->polling_frequency * 100; 800 sleep_time = tz->polling_frequency * 100;
801 timeout_jiffies = round_jiffies(jiffies + (HZ * sleep_time) / 1000);
802 }
794 803
795 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n", 804 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s: temperature[%lu] sleep[%lu]\n",
796 tz->name, tz->temperature, sleep_time)); 805 tz->name, tz->temperature, sleep_time));
@@ -804,17 +813,16 @@ static void acpi_thermal_check(void *data)
804 del_timer(&(tz->timer)); 813 del_timer(&(tz->timer));
805 } else { 814 } else {
806 if (timer_pending(&(tz->timer))) 815 if (timer_pending(&(tz->timer)))
807 mod_timer(&(tz->timer), 816 mod_timer(&(tz->timer), timeout_jiffies);
808 jiffies + (HZ * sleep_time) / 1000);
809 else { 817 else {
810 tz->timer.data = (unsigned long)tz; 818 tz->timer.data = (unsigned long)tz;
811 tz->timer.function = acpi_thermal_run; 819 tz->timer.function = acpi_thermal_run;
812 tz->timer.expires = jiffies + (HZ * sleep_time) / 1000; 820 tz->timer.expires = timeout_jiffies;
813 add_timer(&(tz->timer)); 821 add_timer(&(tz->timer));
814 } 822 }
815 } 823 }
816 824 unlock:
817 return; 825 mutex_unlock(&tz->lock);
818} 826}
819 827
820/* -------------------------------------------------------------------------- 828/* --------------------------------------------------------------------------
@@ -1251,7 +1259,7 @@ static int acpi_thermal_add(struct acpi_device *device)
1251 strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME); 1259 strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
1252 strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS); 1260 strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
1253 acpi_driver_data(device) = tz; 1261 acpi_driver_data(device) = tz;
1254 1262 mutex_init(&tz->lock);
1255 result = acpi_thermal_get_info(tz); 1263 result = acpi_thermal_get_info(tz);
1256 if (result) 1264 if (result)
1257 goto end; 1265 goto end;
@@ -1321,7 +1329,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1321 } 1329 }
1322 1330
1323 acpi_thermal_remove_fs(device); 1331 acpi_thermal_remove_fs(device);
1324 1332 mutex_destroy(&tz->lock);
1325 kfree(tz); 1333 kfree(tz);
1326 return 0; 1334 return 0;
1327} 1335}
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index b8a2095cb5ee..bac956b30c57 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -409,14 +409,17 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
409static int 409static int
410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level) 410acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
411{ 411{
412 int status; 412 int status = AE_OK;
413 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 413 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
414 struct acpi_object_list args = { 1, &arg0 }; 414 struct acpi_object_list args = { 1, &arg0 };
415 415
416 416
417 arg0.integer.value = level; 417 arg0.integer.value = level;
418 status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
419 418
419 if (device->cap._BCM)
420 status = acpi_evaluate_object(device->dev->handle, "_BCM",
421 &args, NULL);
422 device->brightness->curr = level;
420 return status; 423 return status;
421} 424}
422 425
@@ -424,11 +427,11 @@ static int
424acpi_video_device_lcd_get_level_current(struct acpi_video_device *device, 427acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
425 unsigned long *level) 428 unsigned long *level)
426{ 429{
427 int status; 430 if (device->cap._BQC)
428 431 return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
429 status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level); 432 level);
430 433 *level = device->brightness->curr;
431 return status; 434 return AE_OK;
432} 435}
433 436
434static int 437static int
@@ -1633,9 +1636,20 @@ static int
1633acpi_video_get_next_level(struct acpi_video_device *device, 1636acpi_video_get_next_level(struct acpi_video_device *device,
1634 u32 level_current, u32 event) 1637 u32 level_current, u32 event)
1635{ 1638{
1636 int min, max, min_above, max_below, i, l; 1639 int min, max, min_above, max_below, i, l, delta = 255;
1637 max = max_below = 0; 1640 max = max_below = 0;
1638 min = min_above = 255; 1641 min = min_above = 255;
1642 /* Find closest level to level_current */
1643 for (i = 0; i < device->brightness->count; i++) {
1644 l = device->brightness->levels[i];
1645 if (abs(l - level_current) < abs(delta)) {
1646 delta = l - level_current;
1647 if (!delta)
1648 break;
1649 }
1650 }
1651 /* Ajust level_current to closest available level */
1652 level_current += delta;
1639 for (i = 0; i < device->brightness->count; i++) { 1653 for (i = 0; i < device->brightness->count; i++) {
1640 l = device->brightness->levels[i]; 1654 l = device->brightness->levels[i];
1641 if (l < min) 1655 if (l < min)
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 33f5eb038773..ba63619ae5df 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -182,6 +182,15 @@ config PATA_ACPI
182 firmware in the BIOS. This driver can sometimes handle 182 firmware in the BIOS. This driver can sometimes handle
183 otherwise unsupported hardware. 183 otherwise unsupported hardware.
184 184
185config SATA_FSL
186 tristate "Freescale 3.0Gbps SATA support"
187 depends on PPC_MPC837x
188 help
189 This option enables support for Freescale 3.0Gbps SATA controller.
190 It can be found on MPC837x and MPC8315.
191
192 If unsure, say N.
193
185config PATA_ALI 194config PATA_ALI
186 tristate "ALi PATA support (Experimental)" 195 tristate "ALi PATA support (Experimental)"
187 depends on PCI && EXPERIMENTAL 196 depends on PCI && EXPERIMENTAL
@@ -641,11 +650,4 @@ config PATA_BF54X
641 650
642 If unsure, say N. 651 If unsure, say N.
643 652
644config PATA_BF54X_DMA
645 bool "DMA mode"
646 depends on PATA_BF54X
647 default y
648 help
649 Enable DMA mode for Blackfin ATAPI controller.
650
651endif # ATA 653endif # ATA
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 6bdc307649e6..b13feb2c5dae 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_SATA_ULI) += sata_uli.o
17obj-$(CONFIG_SATA_MV) += sata_mv.o 17obj-$(CONFIG_SATA_MV) += sata_mv.o
18obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o 18obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o
19obj-$(CONFIG_PDC_ADMA) += pdc_adma.o 19obj-$(CONFIG_PDC_ADMA) += pdc_adma.o
20obj-$(CONFIG_SATA_FSL) += sata_fsl.o
20 21
21obj-$(CONFIG_PATA_ALI) += pata_ali.o 22obj-$(CONFIG_PATA_ALI) += pata_ali.o
22obj-$(CONFIG_PATA_AMD) += pata_amd.o 23obj-$(CONFIG_PATA_AMD) += pata_amd.o
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 10bc3f64c453..47c806040524 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1479,7 +1479,7 @@ static void ahci_port_intr(struct ata_port *ap)
1479 return; 1479 return;
1480 } 1480 }
1481 1481
1482 /* hmmm... a spurious interupt */ 1482 /* hmmm... a spurious interrupt */
1483 1483
1484 /* if !NCQ, ignore. No modern ATA device has broken HSM 1484 /* if !NCQ, ignore. No modern ATA device has broken HSM
1485 * implementation for non-NCQ commands. 1485 * implementation for non-NCQ commands.
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index bbaa545ea999..629eadbd0ec0 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1392,7 +1392,7 @@ static void ata_qc_complete_internal(struct ata_queued_cmd *qc)
1392 * @tf: Taskfile registers for the command and the result 1392 * @tf: Taskfile registers for the command and the result
1393 * @cdb: CDB for packet command 1393 * @cdb: CDB for packet command
1394 * @dma_dir: Data tranfer direction of the command 1394 * @dma_dir: Data tranfer direction of the command
1395 * @sg: sg list for the data buffer of the command 1395 * @sgl: sg list for the data buffer of the command
1396 * @n_elem: Number of sg entries 1396 * @n_elem: Number of sg entries
1397 * @timeout: Timeout in msecs (0 for default) 1397 * @timeout: Timeout in msecs (0 for default)
1398 * 1398 *
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 026439e05afe..8227c45109ec 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -156,7 +156,7 @@ void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
156{ 156{
157 struct ata_ioports *ioaddr = &ap->ioaddr; 157 struct ata_ioports *ioaddr = &ap->ioaddr;
158 158
159 tf->command = ata_check_status(ap); 159 tf->command = ata_chk_status(ap);
160 tf->feature = ioread8(ioaddr->error_addr); 160 tf->feature = ioread8(ioaddr->error_addr);
161 tf->nsect = ioread8(ioaddr->nsect_addr); 161 tf->nsect = ioread8(ioaddr->nsect_addr);
162 tf->lbal = ioread8(ioaddr->lbal_addr); 162 tf->lbal = ioread8(ioaddr->lbal_addr);
@@ -856,7 +856,7 @@ err_out:
856 * @pdev: PCI device 856 * @pdev: PCI device
857 * 857 *
858 * Some PCI ATA devices report simplex mode but in fact can be told to 858 * Some PCI ATA devices report simplex mode but in fact can be told to
859 * enter non simplex mode. This implements the neccessary logic to 859 * enter non simplex mode. This implements the necessary logic to
860 * perform the task on such devices. Calling it on other devices will 860 * perform the task on such devices. Calling it on other devices will
861 * have -undefined- behaviour. 861 * have -undefined- behaviour.
862 */ 862 */
@@ -882,7 +882,7 @@ unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer
882 /* Filter out DMA modes if the device has been configured by 882 /* Filter out DMA modes if the device has been configured by
883 the BIOS as PIO only */ 883 the BIOS as PIO only */
884 884
885 if (adev->link->ap->ioaddr.bmdma_addr == 0) 885 if (adev->link->ap->ioaddr.bmdma_addr == NULL)
886 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 886 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
887 return xfer_mask; 887 return xfer_mask;
888} 888}
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c
index 5d3920f6fd69..0f6f7bcc3def 100644
--- a/drivers/ata/pata_acpi.c
+++ b/drivers/ata/pata_acpi.c
@@ -370,8 +370,10 @@ static struct pci_driver pacpi_pci_driver = {
370 .id_table = pacpi_pci_tbl, 370 .id_table = pacpi_pci_tbl,
371 .probe = pacpi_init_one, 371 .probe = pacpi_init_one,
372 .remove = ata_pci_remove_one, 372 .remove = ata_pci_remove_one,
373#ifdef CONFIG_PM
373 .suspend = ata_pci_device_suspend, 374 .suspend = ata_pci_device_suspend,
374 .resume = ata_pci_device_resume, 375 .resume = ata_pci_device_resume,
376#endif
375}; 377};
376 378
377static int __init pacpi_init(void) 379static int __init pacpi_init(void)
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index 747549e4563a..b5e38426b815 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1092,14 +1092,15 @@ static unsigned int bfin_bus_softreset(struct ata_port *ap,
1092 * Note: Original code is ata_std_softreset(). 1092 * Note: Original code is ata_std_softreset().
1093 */ 1093 */
1094 1094
1095static int bfin_std_softreset(struct ata_port *ap, unsigned int *classes, 1095static int bfin_std_softreset(struct ata_link *link, unsigned int *classes,
1096 unsigned long deadline) 1096 unsigned long deadline)
1097{ 1097{
1098 struct ata_port *ap = link->ap;
1098 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; 1099 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
1099 unsigned int devmask = 0, err_mask; 1100 unsigned int devmask = 0, err_mask;
1100 u8 err; 1101 u8 err;
1101 1102
1102 if (ata_port_offline(ap)) { 1103 if (ata_link_offline(link)) {
1103 classes[0] = ATA_DEV_NONE; 1104 classes[0] = ATA_DEV_NONE;
1104 goto out; 1105 goto out;
1105 } 1106 }
@@ -1122,9 +1123,11 @@ static int bfin_std_softreset(struct ata_port *ap, unsigned int *classes,
1122 } 1123 }
1123 1124
1124 /* determine by signature whether we have ATA or ATAPI devices */ 1125 /* determine by signature whether we have ATA or ATAPI devices */
1125 classes[0] = ata_dev_try_classify(ap, 0, &err); 1126 classes[0] = ata_dev_try_classify(&ap->link.device[0],
1127 devmask & (1 << 0), &err);
1126 if (slave_possible && err != 0x81) 1128 if (slave_possible && err != 0x81)
1127 classes[1] = ata_dev_try_classify(ap, 1, &err); 1129 classes[1] = ata_dev_try_classify(&ap->link.device[1],
1130 devmask & (1 << 1), &err);
1128 1131
1129 out: 1132 out:
1130 return 0; 1133 return 0;
@@ -1167,7 +1170,7 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap)
1167static void bfin_data_xfer(struct ata_device *adev, unsigned char *buf, 1170static void bfin_data_xfer(struct ata_device *adev, unsigned char *buf,
1168 unsigned int buflen, int write_data) 1171 unsigned int buflen, int write_data)
1169{ 1172{
1170 struct ata_port *ap = adev->ap; 1173 struct ata_port *ap = adev->link->ap;
1171 unsigned int words = buflen >> 1; 1174 unsigned int words = buflen >> 1;
1172 unsigned short *buf16 = (u16 *) buf; 1175 unsigned short *buf16 = (u16 *) buf;
1173 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; 1176 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
@@ -1206,7 +1209,10 @@ static void bfin_irq_clear(struct ata_port *ap)
1206 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; 1209 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
1207 1210
1208 pr_debug("in atapi irq clear\n"); 1211 pr_debug("in atapi irq clear\n");
1209 ATAPI_SET_INT_STATUS(base, 0x1FF); 1212
1213 ATAPI_SET_INT_STATUS(base, ATAPI_GET_INT_STATUS(base)|ATAPI_DEV_INT
1214 | MULTI_DONE_INT | UDMAIN_DONE_INT | UDMAOUT_DONE_INT
1215 | MULTI_TERM_INT | UDMAIN_TERM_INT | UDMAOUT_TERM_INT);
1210} 1216}
1211 1217
1212/** 1218/**
@@ -1234,33 +1240,6 @@ static unsigned char bfin_irq_on(struct ata_port *ap)
1234} 1240}
1235 1241
1236/** 1242/**
1237 * bfin_irq_ack - Acknowledge a device interrupt.
1238 * @ap: Port on which interrupts are enabled.
1239 *
1240 * Note: Original code is ata_irq_ack().
1241 */
1242
1243static unsigned char bfin_irq_ack(struct ata_port *ap, unsigned int chk_drq)
1244{
1245 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
1246 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
1247 unsigned char status;
1248
1249 pr_debug("in atapi irq ack\n");
1250 status = ata_busy_wait(ap, bits, 1000);
1251 if (status & bits)
1252 if (ata_msg_err(ap))
1253 dev_err(ap->dev, "abnormal status 0x%X\n", status);
1254
1255 /* get controller status; clear intr, err bits */
1256 ATAPI_SET_INT_STATUS(base, ATAPI_GET_INT_STATUS(base)|ATAPI_DEV_INT
1257 | MULTI_DONE_INT | UDMAIN_DONE_INT | UDMAOUT_DONE_INT
1258 | MULTI_TERM_INT | UDMAIN_TERM_INT | UDMAOUT_TERM_INT);
1259
1260 return bfin_bmdma_status(ap);
1261}
1262
1263/**
1264 * bfin_bmdma_freeze - Freeze DMA controller port 1243 * bfin_bmdma_freeze - Freeze DMA controller port
1265 * @ap: port to freeze 1244 * @ap: port to freeze
1266 * 1245 *
@@ -1308,8 +1287,9 @@ void bfin_bmdma_thaw(struct ata_port *ap)
1308 * Note: Original code is ata_std_postreset(). 1287 * Note: Original code is ata_std_postreset().
1309 */ 1288 */
1310 1289
1311static void bfin_std_postreset(struct ata_port *ap, unsigned int *classes) 1290static void bfin_std_postreset(struct ata_link *link, unsigned int *classes)
1312{ 1291{
1292 struct ata_port *ap = link->ap;
1313 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; 1293 void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
1314 1294
1315 /* re-enable interrupts */ 1295 /* re-enable interrupts */
@@ -1395,7 +1375,6 @@ static struct scsi_host_template bfin_sht = {
1395}; 1375};
1396 1376
1397static const struct ata_port_operations bfin_pata_ops = { 1377static const struct ata_port_operations bfin_pata_ops = {
1398 .port_disable = ata_port_disable,
1399 .set_piomode = bfin_set_piomode, 1378 .set_piomode = bfin_set_piomode,
1400 .set_dmamode = bfin_set_dmamode, 1379 .set_dmamode = bfin_set_dmamode,
1401 1380
@@ -1423,7 +1402,6 @@ static const struct ata_port_operations bfin_pata_ops = {
1423 .irq_handler = ata_interrupt, 1402 .irq_handler = ata_interrupt,
1424 .irq_clear = bfin_irq_clear, 1403 .irq_clear = bfin_irq_clear,
1425 .irq_on = bfin_irq_on, 1404 .irq_on = bfin_irq_on,
1426 .irq_ack = bfin_irq_ack,
1427 1405
1428 .port_start = bfin_port_start, 1406 .port_start = bfin_port_start,
1429 .port_stop = bfin_port_stop, 1407 .port_stop = bfin_port_stop,
@@ -1437,11 +1415,7 @@ static struct ata_port_info bfin_port_info[] = {
1437 | ATA_FLAG_NO_LEGACY, 1415 | ATA_FLAG_NO_LEGACY,
1438 .pio_mask = 0x1f, /* pio0-4 */ 1416 .pio_mask = 0x1f, /* pio0-4 */
1439 .mwdma_mask = 0, 1417 .mwdma_mask = 0,
1440#ifdef CONFIG_PATA_BF54X_DMA
1441 .udma_mask = ATA_UDMA5,
1442#else
1443 .udma_mask = 0, 1418 .udma_mask = 0,
1444#endif
1445 .port_ops = &bfin_pata_ops, 1419 .port_ops = &bfin_pata_ops,
1446 }, 1420 },
1447}; 1421};
@@ -1607,9 +1581,25 @@ static struct platform_driver bfin_atapi_driver = {
1607 }, 1581 },
1608}; 1582};
1609 1583
1584#define ATAPI_MODE_SIZE 10
1585static char bfin_atapi_mode[ATAPI_MODE_SIZE];
1586
1610static int __init bfin_atapi_init(void) 1587static int __init bfin_atapi_init(void)
1611{ 1588{
1612 pr_info("register bfin atapi driver\n"); 1589 pr_info("register bfin atapi driver\n");
1590
1591 switch(bfin_atapi_mode[0]) {
1592 case 'p':
1593 case 'P':
1594 break;
1595 case 'm':
1596 case 'M':
1597 bfin_port_info[0].mwdma_mask = ATA_MWDMA2;
1598 break;
1599 default:
1600 bfin_port_info[0].udma_mask = ATA_UDMA5;
1601 };
1602
1613 return platform_driver_register(&bfin_atapi_driver); 1603 return platform_driver_register(&bfin_atapi_driver);
1614} 1604}
1615 1605
@@ -1620,6 +1610,13 @@ static void __exit bfin_atapi_exit(void)
1620 1610
1621module_init(bfin_atapi_init); 1611module_init(bfin_atapi_init);
1622module_exit(bfin_atapi_exit); 1612module_exit(bfin_atapi_exit);
1613/*
1614 * ATAPI mode:
1615 * pio/PIO
1616 * udma/UDMA (default)
1617 * mwdma/MWDMA
1618 */
1619module_param_string(bfin_atapi_mode, bfin_atapi_mode, ATAPI_MODE_SIZE, 0);
1623 1620
1624MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); 1621MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>");
1625MODULE_DESCRIPTION("PATA driver for blackfin 54x ATAPI controller"); 1622MODULE_DESCRIPTION("PATA driver for blackfin 54x ATAPI controller");
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
index 9e412c26b2a3..7acbbd9ee469 100644
--- a/drivers/ata/pata_cmd64x.c
+++ b/drivers/ata/pata_cmd64x.c
@@ -215,7 +215,7 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
215 regU &= ~(0x05 << adev->devno); 215 regU &= ~(0x05 << adev->devno);
216 216
217 if (adev->dma_mode >= XFER_UDMA_0) { 217 if (adev->dma_mode >= XFER_UDMA_0) {
218 /* Merge thge timing value */ 218 /* Merge the timing value */
219 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift; 219 regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift;
220 /* Merge the control bits */ 220 /* Merge the control bits */
221 regU |= 1 << adev->devno; /* UDMA on */ 221 regU |= 1 << adev->devno; /* UDMA on */
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c
index 57e827e4109e..e1818fdd9159 100644
--- a/drivers/ata/pata_cs5530.c
+++ b/drivers/ata/pata_cs5530.c
@@ -138,7 +138,7 @@ static void cs5530_set_dmamode(struct ata_port *ap, struct ata_device *adev)
138 * 138 *
139 * Called when the libata layer is about to issue a command. We wrap 139 * Called when the libata layer is about to issue a command. We wrap
140 * this interface so that we can load the correct ATA timings if 140 * this interface so that we can load the correct ATA timings if
141 * neccessary. Specifically we have a problem that there is only 141 * necessary. Specifically we have a problem that there is only
142 * one MWDMA/UDMA bit. 142 * one MWDMA/UDMA bit.
143 */ 143 */
144 144
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c
index 3578593a882b..01324530d052 100644
--- a/drivers/ata/pata_cs5535.c
+++ b/drivers/ata/pata_cs5535.c
@@ -25,7 +25,7 @@
25 * Documentation: 25 * Documentation:
26 * Available from AMD web site. 26 * Available from AMD web site.
27 * TODO 27 * TODO
28 * Review errata to see if serializing is neccessary 28 * Review errata to see if serializing is necessary
29 */ 29 */
30 30
31#include <linux/kernel.h> 31#include <linux/kernel.h>
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c
index 53070f6b1fc4..d753e568588e 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.5" 43#define DRV_VERSION "0.0.6"
44 44
45enum { 45enum {
46 CFG = 0, 46 CFG = 0,
@@ -214,7 +214,7 @@ static void cs5536_set_dmamode(struct ata_port *ap, struct ata_device *adev)
214 cs5536_read(pdev, DTC, &dtc); 214 cs5536_read(pdev, DTC, &dtc);
215 215
216 dtc &= ~(IDE_DRV_MASK << dshift); 216 dtc &= ~(IDE_DRV_MASK << dshift);
217 dtc |= mwdma_timings[mode] << dshift; 217 dtc |= mwdma_timings[mode - XFER_MW_DMA_0] << dshift;
218 218
219 cs5536_write(pdev, DTC, dtc); 219 cs5536_write(pdev, DTC, dtc);
220 } 220 }
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index 988ef736b936..ca9aae09daed 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -105,7 +105,7 @@ struct it821x_dev
105 105
106/* 106/*
107 * We allow users to force the card into non raid mode without 107 * We allow users to force the card into non raid mode without
108 * flashing the alternative BIOS. This is also neccessary right now 108 * flashing the alternative BIOS. This is also necessary right now
109 * for embedded platforms that cannot run a PC BIOS but are using this 109 * for embedded platforms that cannot run a PC BIOS but are using this
110 * device. 110 * device.
111 */ 111 */
@@ -383,7 +383,7 @@ static void it821x_passthru_bmdma_stop(struct ata_queued_cmd *qc)
383 * @ap: ATA port 383 * @ap: ATA port
384 * @device: Device number (not pointer) 384 * @device: Device number (not pointer)
385 * 385 *
386 * Device selection hook. If neccessary perform clock switching 386 * Device selection hook. If necessary perform clock switching
387 */ 387 */
388 388
389static void it821x_passthru_dev_select(struct ata_port *ap, 389static void it821x_passthru_dev_select(struct ata_port *ap,
diff --git a/drivers/ata/pata_mpiix.c b/drivers/ata/pata_mpiix.c
index d5483087a3fa..c0d9e0cf208c 100644
--- a/drivers/ata/pata_mpiix.c
+++ b/drivers/ata/pata_mpiix.c
@@ -129,7 +129,7 @@ static void mpiix_set_piomode(struct ata_port *ap, struct ata_device *adev)
129 * 129 *
130 * Called when the libata layer is about to issue a command. We wrap 130 * Called when the libata layer is about to issue a command. We wrap
131 * this interface so that we can load the correct ATA timings if 131 * this interface so that we can load the correct ATA timings if
132 * neccessary. Our logic also clears TIME0/TIME1 for the other device so 132 * necessary. Our logic also clears TIME0/TIME1 for the other device so
133 * that, even if we get this wrong, cycles to the other device will 133 * that, even if we get this wrong, cycles to the other device will
134 * be made PIO0. 134 * be made PIO0.
135 */ 135 */
diff --git a/drivers/ata/pata_ns87410.c b/drivers/ata/pata_ns87410.c
index 6e8e55745b7b..9fe66fd75017 100644
--- a/drivers/ata/pata_ns87410.c
+++ b/drivers/ata/pata_ns87410.c
@@ -124,7 +124,7 @@ static void ns87410_set_piomode(struct ata_port *ap, struct ata_device *adev)
124 * 124 *
125 * Called when the libata layer is about to issue a command. We wrap 125 * Called when the libata layer is about to issue a command. We wrap
126 * this interface so that we can load the correct ATA timings if 126 * this interface so that we can load the correct ATA timings if
127 * neccessary. 127 * necessary.
128 */ 128 */
129 129
130static unsigned int ns87410_qc_issue_prot(struct ata_queued_cmd *qc) 130static unsigned int ns87410_qc_issue_prot(struct ata_queued_cmd *qc)
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c
index 3cd5eb2b6c91..44da09ace52c 100644
--- a/drivers/ata/pata_oldpiix.c
+++ b/drivers/ata/pata_oldpiix.c
@@ -200,7 +200,7 @@ static void oldpiix_set_dmamode (struct ata_port *ap, struct ata_device *adev)
200 * 200 *
201 * Called when the libata layer is about to issue a command. We wrap 201 * Called when the libata layer is about to issue a command. We wrap
202 * this interface so that we can load the correct ATA timings if 202 * this interface so that we can load the correct ATA timings if
203 * neccessary. Our logic also clears TIME0/TIME1 for the other device so 203 * necessary. Our logic also clears TIME0/TIME1 for the other device so
204 * that, even if we get this wrong, cycles to the other device will 204 * that, even if we get this wrong, cycles to the other device will
205 * be made PIO0. 205 * be made PIO0.
206 */ 206 */
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c
index d5b76497f4a2..8109b08fc024 100644
--- a/drivers/ata/pata_radisys.c
+++ b/drivers/ata/pata_radisys.c
@@ -161,7 +161,7 @@ static void radisys_set_dmamode (struct ata_port *ap, struct ata_device *adev)
161 * 161 *
162 * Called when the libata layer is about to issue a command. We wrap 162 * Called when the libata layer is about to issue a command. We wrap
163 * this interface so that we can load the correct ATA timings if 163 * this interface so that we can load the correct ATA timings if
164 * neccessary. Our logic also clears TIME0/TIME1 for the other device so 164 * necessary. Our logic also clears TIME0/TIME1 for the other device so
165 * that, even if we get this wrong, cycles to the other device will 165 * that, even if we get this wrong, cycles to the other device will
166 * be made PIO0. 166 * be made PIO0.
167 */ 167 */
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c
index 21ebc485ca4b..725a8586cd6e 100644
--- a/drivers/ata/pata_sc1200.c
+++ b/drivers/ata/pata_sc1200.c
@@ -156,7 +156,7 @@ static void sc1200_set_dmamode(struct ata_port *ap, struct ata_device *adev)
156 * 156 *
157 * Called when the libata layer is about to issue a command. We wrap 157 * Called when the libata layer is about to issue a command. We wrap
158 * this interface so that we can load the correct ATA timings if 158 * this interface so that we can load the correct ATA timings if
159 * neccessary. Specifically we have a problem that there is only 159 * necessary. Specifically we have a problem that there is only
160 * one MWDMA/UDMA bit. 160 * one MWDMA/UDMA bit.
161 */ 161 */
162 162
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index 4dc2e73298fd..5c1e9cb59ecb 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -16,7 +16,7 @@
16 * 16 *
17 * If you have strange problems with nVidia chipset systems please 17 * If you have strange problems with nVidia chipset systems please
18 * see the SI support documentation and update your system BIOS 18 * see the SI support documentation and update your system BIOS
19 * if neccessary 19 * if necessary
20 * 20 *
21 * TODO 21 * TODO
22 * If we know all our devices are LBA28 (or LBA28 sized) we could use 22 * If we know all our devices are LBA28 (or LBA28 sized) we could use
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index 5d41b6612d7f..ea7a9a652e61 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -420,7 +420,7 @@ static struct ata_port_operations via_port_ops_noirq = {
420 * @pdev: PCI device 420 * @pdev: PCI device
421 * @flags: configuration flags 421 * @flags: configuration flags
422 * 422 *
423 * Set the FIFO properties for this device if neccessary. Used both on 423 * Set the FIFO properties for this device if necessary. Used both on
424 * set up and on and the resume path 424 * set up and on and the resume path
425 */ 425 */
426 426
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c
index 8d1b03d5bcb1..199f7e150eb3 100644
--- a/drivers/ata/pdc_adma.c
+++ b/drivers/ata/pdc_adma.c
@@ -318,7 +318,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
318 struct scatterlist *sg; 318 struct scatterlist *sg;
319 struct ata_port *ap = qc->ap; 319 struct ata_port *ap = qc->ap;
320 struct adma_port_priv *pp = ap->private_data; 320 struct adma_port_priv *pp = ap->private_data;
321 u8 *buf = pp->pkt; 321 u8 *buf = pp->pkt, *last_buf = NULL;
322 int i = (2 + buf[3]) * 8; 322 int i = (2 + buf[3]) * 8;
323 u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); 323 u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0);
324 324
@@ -334,8 +334,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
334 *(__le32 *)(buf + i) = cpu_to_le32(len); 334 *(__le32 *)(buf + i) = cpu_to_le32(len);
335 i += 4; 335 i += 4;
336 336
337 if (ata_sg_is_last(sg, qc)) 337 last_buf = &buf[i];
338 pFLAGS |= pEND;
339 buf[i++] = pFLAGS; 338 buf[i++] = pFLAGS;
340 buf[i++] = qc->dev->dma_mode & 0xf; 339 buf[i++] = qc->dev->dma_mode & 0xf;
341 buf[i++] = 0; /* pPKLW */ 340 buf[i++] = 0; /* pPKLW */
@@ -348,6 +347,10 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
348 VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, 347 VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4,
349 (unsigned long)addr, len); 348 (unsigned long)addr, len);
350 } 349 }
350
351 if (likely(last_buf))
352 *last_buf |= pEND;
353
351 return i; 354 return i;
352} 355}
353 356
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
new file mode 100644
index 000000000000..b4c37b9e413c
--- /dev/null
+++ b/drivers/ata/sata_fsl.c
@@ -0,0 +1,1490 @@
1/*
2 * drivers/ata/sata_fsl.c
3 *
4 * Freescale 3.0Gbps SATA device driver
5 *
6 * Author: Ashish Kalra <ashish.kalra@freescale.com>
7 * Li Yang <leoli@freescale.com>
8 *
9 * Copyright (c) 2006-2007 Freescale Semiconductor, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 */
17
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/platform_device.h>
21
22#include <scsi/scsi_host.h>
23#include <scsi/scsi_cmnd.h>
24#include <linux/libata.h>
25#include <asm/io.h>
26#include <linux/of_platform.h>
27
28/* Controller information */
29enum {
30 SATA_FSL_QUEUE_DEPTH = 16,
31 SATA_FSL_MAX_PRD = 63,
32 SATA_FSL_MAX_PRD_USABLE = SATA_FSL_MAX_PRD - 1,
33 SATA_FSL_MAX_PRD_DIRECT = 16, /* Direct PRDT entries */
34
35 SATA_FSL_HOST_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
36 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
37 ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY),
38
39 SATA_FSL_MAX_CMDS = SATA_FSL_QUEUE_DEPTH,
40 SATA_FSL_CMD_HDR_SIZE = 16, /* 4 DWORDS */
41 SATA_FSL_CMD_SLOT_SIZE = (SATA_FSL_MAX_CMDS * SATA_FSL_CMD_HDR_SIZE),
42
43 /*
44 * SATA-FSL host controller supports a max. of (15+1) direct PRDEs, and
45 * chained indirect PRDEs upto a max count of 63.
46 * We are allocating an array of 63 PRDEs contigiously, but PRDE#15 will
47 * be setup as an indirect descriptor, pointing to it's next
48 * (contigious) PRDE. Though chained indirect PRDE arrays are
49 * supported,it will be more efficient to use a direct PRDT and
50 * a single chain/link to indirect PRDE array/PRDT.
51 */
52
53 SATA_FSL_CMD_DESC_CFIS_SZ = 32,
54 SATA_FSL_CMD_DESC_SFIS_SZ = 32,
55 SATA_FSL_CMD_DESC_ACMD_SZ = 16,
56 SATA_FSL_CMD_DESC_RSRVD = 16,
57
58 SATA_FSL_CMD_DESC_SIZE = (SATA_FSL_CMD_DESC_CFIS_SZ +
59 SATA_FSL_CMD_DESC_SFIS_SZ +
60 SATA_FSL_CMD_DESC_ACMD_SZ +
61 SATA_FSL_CMD_DESC_RSRVD +
62 SATA_FSL_MAX_PRD * 16),
63
64 SATA_FSL_CMD_DESC_OFFSET_TO_PRDT =
65 (SATA_FSL_CMD_DESC_CFIS_SZ +
66 SATA_FSL_CMD_DESC_SFIS_SZ +
67 SATA_FSL_CMD_DESC_ACMD_SZ +
68 SATA_FSL_CMD_DESC_RSRVD),
69
70 SATA_FSL_CMD_DESC_AR_SZ = (SATA_FSL_CMD_DESC_SIZE * SATA_FSL_MAX_CMDS),
71 SATA_FSL_PORT_PRIV_DMA_SZ = (SATA_FSL_CMD_SLOT_SIZE +
72 SATA_FSL_CMD_DESC_AR_SZ),
73
74 /*
75 * MPC8315 has two SATA controllers, SATA1 & SATA2
76 * (one port per controller)
77 * MPC837x has 2/4 controllers, one port per controller
78 */
79
80 SATA_FSL_MAX_PORTS = 1,
81
82 SATA_FSL_IRQ_FLAG = IRQF_SHARED,
83};
84
85/*
86* Host Controller command register set - per port
87*/
88enum {
89 CQ = 0,
90 CA = 8,
91 CC = 0x10,
92 CE = 0x18,
93 DE = 0x20,
94 CHBA = 0x24,
95 HSTATUS = 0x28,
96 HCONTROL = 0x2C,
97 CQPMP = 0x30,
98 SIGNATURE = 0x34,
99 ICC = 0x38,
100
101 /*
102 * Host Status Register (HStatus) bitdefs
103 */
104 ONLINE = (1 << 31),
105 GOING_OFFLINE = (1 << 30),
106 BIST_ERR = (1 << 29),
107
108 FATAL_ERR_HC_MASTER_ERR = (1 << 18),
109 FATAL_ERR_PARITY_ERR_TX = (1 << 17),
110 FATAL_ERR_PARITY_ERR_RX = (1 << 16),
111 FATAL_ERR_DATA_UNDERRUN = (1 << 13),
112 FATAL_ERR_DATA_OVERRUN = (1 << 12),
113 FATAL_ERR_CRC_ERR_TX = (1 << 11),
114 FATAL_ERR_CRC_ERR_RX = (1 << 10),
115 FATAL_ERR_FIFO_OVRFL_TX = (1 << 9),
116 FATAL_ERR_FIFO_OVRFL_RX = (1 << 8),
117
118 FATAL_ERROR_DECODE = FATAL_ERR_HC_MASTER_ERR |
119 FATAL_ERR_PARITY_ERR_TX |
120 FATAL_ERR_PARITY_ERR_RX |
121 FATAL_ERR_DATA_UNDERRUN |
122 FATAL_ERR_DATA_OVERRUN |
123 FATAL_ERR_CRC_ERR_TX |
124 FATAL_ERR_CRC_ERR_RX |
125 FATAL_ERR_FIFO_OVRFL_TX | FATAL_ERR_FIFO_OVRFL_RX,
126
127 INT_ON_FATAL_ERR = (1 << 5),
128 INT_ON_PHYRDY_CHG = (1 << 4),
129
130 INT_ON_SIGNATURE_UPDATE = (1 << 3),
131 INT_ON_SNOTIFY_UPDATE = (1 << 2),
132 INT_ON_SINGL_DEVICE_ERR = (1 << 1),
133 INT_ON_CMD_COMPLETE = 1,
134
135 INT_ON_ERROR = INT_ON_FATAL_ERR |
136 INT_ON_PHYRDY_CHG | INT_ON_SINGL_DEVICE_ERR,
137
138 /*
139 * Host Control Register (HControl) bitdefs
140 */
141 HCONTROL_ONLINE_PHY_RST = (1 << 31),
142 HCONTROL_FORCE_OFFLINE = (1 << 30),
143 HCONTROL_PARITY_PROT_MOD = (1 << 14),
144 HCONTROL_DPATH_PARITY = (1 << 12),
145 HCONTROL_SNOOP_ENABLE = (1 << 10),
146 HCONTROL_PMP_ATTACHED = (1 << 9),
147 HCONTROL_COPYOUT_STATFIS = (1 << 8),
148 IE_ON_FATAL_ERR = (1 << 5),
149 IE_ON_PHYRDY_CHG = (1 << 4),
150 IE_ON_SIGNATURE_UPDATE = (1 << 3),
151 IE_ON_SNOTIFY_UPDATE = (1 << 2),
152 IE_ON_SINGL_DEVICE_ERR = (1 << 1),
153 IE_ON_CMD_COMPLETE = 1,
154
155 DEFAULT_PORT_IRQ_ENABLE_MASK = IE_ON_FATAL_ERR | IE_ON_PHYRDY_CHG |
156 IE_ON_SIGNATURE_UPDATE |
157 IE_ON_SINGL_DEVICE_ERR | IE_ON_CMD_COMPLETE,
158
159 EXT_INDIRECT_SEG_PRD_FLAG = (1 << 31),
160 DATA_SNOOP_ENABLE = (1 << 22),
161};
162
163/*
164 * SATA Superset Registers
165 */
166enum {
167 SSTATUS = 0,
168 SERROR = 4,
169 SCONTROL = 8,
170 SNOTIFY = 0xC,
171};
172
173/*
174 * Control Status Register Set
175 */
176enum {
177 TRANSCFG = 0,
178 TRANSSTATUS = 4,
179 LINKCFG = 8,
180 LINKCFG1 = 0xC,
181 LINKCFG2 = 0x10,
182 LINKSTATUS = 0x14,
183 LINKSTATUS1 = 0x18,
184 PHYCTRLCFG = 0x1C,
185 COMMANDSTAT = 0x20,
186};
187
188/* PHY (link-layer) configuration control */
189enum {
190 PHY_BIST_ENABLE = 0x01,
191};
192
193/*
194 * Command Header Table entry, i.e, command slot
195 * 4 Dwords per command slot, command header size == 64 Dwords.
196 */
197struct cmdhdr_tbl_entry {
198 u32 cda;
199 u32 prde_fis_len;
200 u32 ttl;
201 u32 desc_info;
202};
203
204/*
205 * Description information bitdefs
206 */
207enum {
208 VENDOR_SPECIFIC_BIST = (1 << 10),
209 CMD_DESC_SNOOP_ENABLE = (1 << 9),
210 FPDMA_QUEUED_CMD = (1 << 8),
211 SRST_CMD = (1 << 7),
212 BIST = (1 << 6),
213 ATAPI_CMD = (1 << 5),
214};
215
216/*
217 * Command Descriptor
218 */
219struct command_desc {
220 u8 cfis[8 * 4];
221 u8 sfis[8 * 4];
222 u8 acmd[4 * 4];
223 u8 fill[4 * 4];
224 u32 prdt[SATA_FSL_MAX_PRD_DIRECT * 4];
225 u32 prdt_indirect[(SATA_FSL_MAX_PRD - SATA_FSL_MAX_PRD_DIRECT) * 4];
226};
227
228/*
229 * Physical region table descriptor(PRD)
230 */
231
232struct prde {
233 u32 dba;
234 u8 fill[2 * 4];
235 u32 ddc_and_ext;
236};
237
238/*
239 * ata_port private data
240 * This is our per-port instance data.
241 */
242struct sata_fsl_port_priv {
243 struct cmdhdr_tbl_entry *cmdslot;
244 dma_addr_t cmdslot_paddr;
245 struct command_desc *cmdentry;
246 dma_addr_t cmdentry_paddr;
247
248 /*
249 * SATA FSL controller has a Status FIS which should contain the
250 * received D2H FIS & taskfile registers. This SFIS is present in
251 * the command descriptor, and to have a ready reference to it,
252 * we are caching it here, quite similar to what is done in H/W on
253 * AHCI compliant devices by copying taskfile fields to a 32-bit
254 * register.
255 */
256
257 struct ata_taskfile tf;
258};
259
260/*
261 * ata_port->host_set private data
262 */
263struct sata_fsl_host_priv {
264 void __iomem *hcr_base;
265 void __iomem *ssr_base;
266 void __iomem *csr_base;
267};
268
269static inline unsigned int sata_fsl_tag(unsigned int tag,
270 void __iomem * hcr_base)
271{
272 /* We let libATA core do actual (queue) tag allocation */
273
274 /* all non NCQ/queued commands should have tag#0 */
275 if (ata_tag_internal(tag)) {
276 DPRINTK("mapping internal cmds to tag#0\n");
277 return 0;
278 }
279
280 if (unlikely(tag >= SATA_FSL_QUEUE_DEPTH)) {
281 DPRINTK("tag %d invalid : out of range\n", tag);
282 return 0;
283 }
284
285 if (unlikely((ioread32(hcr_base + CQ)) & (1 << tag))) {
286 DPRINTK("tag %d invalid : in use!!\n", tag);
287 return 0;
288 }
289
290 return tag;
291}
292
293static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
294 unsigned int tag, u32 desc_info,
295 u32 data_xfer_len, u8 num_prde,
296 u8 fis_len)
297{
298 dma_addr_t cmd_descriptor_address;
299
300 cmd_descriptor_address = pp->cmdentry_paddr +
301 tag * SATA_FSL_CMD_DESC_SIZE;
302
303 /* NOTE: both data_xfer_len & fis_len are Dword counts */
304
305 pp->cmdslot[tag].cda = cpu_to_le32(cmd_descriptor_address);
306 pp->cmdslot[tag].prde_fis_len =
307 cpu_to_le32((num_prde << 16) | (fis_len << 2));
308 pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03);
309 pp->cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag & 0x1F)));
310
311 VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n",
312 pp->cmdslot[tag].cda,
313 pp->cmdslot[tag].prde_fis_len,
314 pp->cmdslot[tag].ttl, pp->cmdslot[tag].desc_info);
315
316}
317
318static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
319 u32 * ttl, dma_addr_t cmd_desc_paddr)
320{
321 struct scatterlist *sg;
322 unsigned int num_prde = 0;
323 u32 ttl_dwords = 0;
324
325 /*
326 * NOTE : direct & indirect prdt's are contigiously allocated
327 */
328 struct prde *prd = (struct prde *)&((struct command_desc *)
329 cmd_desc)->prdt;
330
331 struct prde *prd_ptr_to_indirect_ext = NULL;
332 unsigned indirect_ext_segment_sz = 0;
333 dma_addr_t indirect_ext_segment_paddr;
334
335 VPRINTK("SATA FSL : cd = 0x%x, prd = 0x%x\n", cmd_desc, prd);
336
337 indirect_ext_segment_paddr = cmd_desc_paddr +
338 SATA_FSL_CMD_DESC_OFFSET_TO_PRDT + SATA_FSL_MAX_PRD_DIRECT * 16;
339
340 ata_for_each_sg(sg, qc) {
341 dma_addr_t sg_addr = sg_dma_address(sg);
342 u32 sg_len = sg_dma_len(sg);
343
344 VPRINTK("SATA FSL : fill_sg, sg_addr = 0x%x, sg_len = %d\n",
345 sg_addr, sg_len);
346
347 /* warn if each s/g element is not dword aligned */
348 if (sg_addr & 0x03)
349 ata_port_printk(qc->ap, KERN_ERR,
350 "s/g addr unaligned : 0x%x\n", sg_addr);
351 if (sg_len & 0x03)
352 ata_port_printk(qc->ap, KERN_ERR,
353 "s/g len unaligned : 0x%x\n", sg_len);
354
355 if ((num_prde == (SATA_FSL_MAX_PRD_DIRECT - 1)) &&
356 !ata_sg_is_last(sg, qc)) {
357 VPRINTK("setting indirect prde\n");
358 prd_ptr_to_indirect_ext = prd;
359 prd->dba = cpu_to_le32(indirect_ext_segment_paddr);
360 indirect_ext_segment_sz = 0;
361 ++prd;
362 ++num_prde;
363 }
364
365 ttl_dwords += sg_len;
366 prd->dba = cpu_to_le32(sg_addr);
367 prd->ddc_and_ext =
368 cpu_to_le32(DATA_SNOOP_ENABLE | (sg_len & ~0x03));
369
370 VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n",
371 ttl_dwords, prd->dba, prd->ddc_and_ext);
372
373 ++num_prde;
374 ++prd;
375 if (prd_ptr_to_indirect_ext)
376 indirect_ext_segment_sz += sg_len;
377 }
378
379 if (prd_ptr_to_indirect_ext) {
380 /* set indirect extension flag along with indirect ext. size */
381 prd_ptr_to_indirect_ext->ddc_and_ext =
382 cpu_to_le32((EXT_INDIRECT_SEG_PRD_FLAG |
383 DATA_SNOOP_ENABLE |
384 (indirect_ext_segment_sz & ~0x03)));
385 }
386
387 *ttl = ttl_dwords;
388 return num_prde;
389}
390
391static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
392{
393 struct ata_port *ap = qc->ap;
394 struct sata_fsl_port_priv *pp = ap->private_data;
395 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
396 void __iomem *hcr_base = host_priv->hcr_base;
397 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
398 struct command_desc *cd;
399 u32 desc_info = CMD_DESC_SNOOP_ENABLE;
400 u32 num_prde = 0;
401 u32 ttl_dwords = 0;
402 dma_addr_t cd_paddr;
403
404 cd = (struct command_desc *)pp->cmdentry + tag;
405 cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE;
406
407 ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) & cd->cfis);
408
409 VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
410 cd->cfis[0], cd->cfis[1], cd->cfis[2]);
411
412 if (qc->tf.protocol == ATA_PROT_NCQ) {
413 VPRINTK("FPDMA xfer,Sctor cnt[0:7],[8:15] = %d,%d\n",
414 cd->cfis[3], cd->cfis[11]);
415 }
416
417 /* setup "ACMD - atapi command" in cmd. desc. if this is ATAPI cmd */
418 if (is_atapi_taskfile(&qc->tf)) {
419 desc_info |= ATAPI_CMD;
420 memset((void *)&cd->acmd, 0, 32);
421 memcpy((void *)&cd->acmd, qc->cdb, qc->dev->cdb_len);
422 }
423
424 if (qc->flags & ATA_QCFLAG_DMAMAP)
425 num_prde = sata_fsl_fill_sg(qc, (void *)cd,
426 &ttl_dwords, cd_paddr);
427
428 if (qc->tf.protocol == ATA_PROT_NCQ)
429 desc_info |= FPDMA_QUEUED_CMD;
430
431 sata_fsl_setup_cmd_hdr_entry(pp, tag, desc_info, ttl_dwords,
432 num_prde, 5);
433
434 VPRINTK("SATA FSL : xx_qc_prep, di = 0x%x, ttl = %d, num_prde = %d\n",
435 desc_info, ttl_dwords, num_prde);
436}
437
438static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc)
439{
440 struct ata_port *ap = qc->ap;
441 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
442 void __iomem *hcr_base = host_priv->hcr_base;
443 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
444
445 VPRINTK("xx_qc_issue called,CQ=0x%x,CA=0x%x,CE=0x%x,CC=0x%x\n",
446 ioread32(CQ + hcr_base),
447 ioread32(CA + hcr_base),
448 ioread32(CE + hcr_base), ioread32(CC + hcr_base));
449
450 /* Simply queue command to the controller/device */
451 iowrite32(1 << tag, CQ + hcr_base);
452
453 VPRINTK("xx_qc_issue called, tag=%d, CQ=0x%x, CA=0x%x\n",
454 tag, ioread32(CQ + hcr_base), ioread32(CA + hcr_base));
455
456 VPRINTK("CE=0x%x, DE=0x%x, CC=0x%x, CmdStat = 0x%x\n",
457 ioread32(CE + hcr_base),
458 ioread32(DE + hcr_base),
459 ioread32(CC + hcr_base), ioread32(COMMANDSTAT + csr_base));
460
461 return 0;
462}
463
464static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
465 u32 val)
466{
467 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
468 void __iomem *ssr_base = host_priv->ssr_base;
469 unsigned int sc_reg;
470
471 switch (sc_reg_in) {
472 case SCR_STATUS:
473 sc_reg = 0;
474 break;
475 case SCR_ERROR:
476 sc_reg = 1;
477 break;
478 case SCR_CONTROL:
479 sc_reg = 2;
480 break;
481 case SCR_ACTIVE:
482 sc_reg = 3;
483 break;
484 default:
485 return -EINVAL;
486 }
487
488 VPRINTK("xx_scr_write, reg_in = %d\n", sc_reg);
489
490 iowrite32(val, (void __iomem *)ssr_base + (sc_reg * 4));
491 return 0;
492}
493
494static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in,
495 u32 *val)
496{
497 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
498 void __iomem *ssr_base = host_priv->ssr_base;
499 unsigned int sc_reg;
500
501 switch (sc_reg_in) {
502 case SCR_STATUS:
503 sc_reg = 0;
504 break;
505 case SCR_ERROR:
506 sc_reg = 1;
507 break;
508 case SCR_CONTROL:
509 sc_reg = 2;
510 break;
511 case SCR_ACTIVE:
512 sc_reg = 3;
513 break;
514 default:
515 return -EINVAL;
516 }
517
518 VPRINTK("xx_scr_read, reg_in = %d\n", sc_reg);
519
520 *val = ioread32((void __iomem *)ssr_base + (sc_reg * 4));
521 return 0;
522}
523
524static void sata_fsl_freeze(struct ata_port *ap)
525{
526 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
527 void __iomem *hcr_base = host_priv->hcr_base;
528 u32 temp;
529
530 VPRINTK("xx_freeze, CQ=0x%x, CA=0x%x, CE=0x%x, DE=0x%x\n",
531 ioread32(CQ + hcr_base),
532 ioread32(CA + hcr_base),
533 ioread32(CE + hcr_base), ioread32(DE + hcr_base));
534 VPRINTK("CmdStat = 0x%x\n", ioread32(csr_base + COMMANDSTAT));
535
536 /* disable interrupts on the controller/port */
537 temp = ioread32(hcr_base + HCONTROL);
538 iowrite32((temp & ~0x3F), hcr_base + HCONTROL);
539
540 VPRINTK("in xx_freeze : HControl = 0x%x, HStatus = 0x%x\n",
541 ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS));
542}
543
544static void sata_fsl_thaw(struct ata_port *ap)
545{
546 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
547 void __iomem *hcr_base = host_priv->hcr_base;
548 u32 temp;
549
550 /* ack. any pending IRQs for this controller/port */
551 temp = ioread32(hcr_base + HSTATUS);
552
553 VPRINTK("xx_thaw, pending IRQs = 0x%x\n", (temp & 0x3F));
554
555 if (temp & 0x3F)
556 iowrite32((temp & 0x3F), hcr_base + HSTATUS);
557
558 /* enable interrupts on the controller/port */
559 temp = ioread32(hcr_base + HCONTROL);
560 iowrite32((temp | DEFAULT_PORT_IRQ_ENABLE_MASK), hcr_base + HCONTROL);
561
562 VPRINTK("xx_thaw : HControl = 0x%x, HStatus = 0x%x\n",
563 ioread32(hcr_base + HCONTROL), ioread32(hcr_base + HSTATUS));
564}
565
566/*
567 * NOTE : 1st D2H FIS from device does not update sfis in command descriptor.
568 */
569static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
570 *qc,
571 struct ata_port *ap)
572{
573 struct sata_fsl_port_priv *pp = ap->private_data;
574 u8 fis[6 * 4];
575 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
576 void __iomem *hcr_base = host_priv->hcr_base;
577 unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
578 struct command_desc *cd;
579
580 cd = pp->cmdentry + tag;
581
582 memcpy(fis, &cd->sfis, 6 * 4); /* should we use memcpy_from_io() */
583 ata_tf_from_fis(fis, &pp->tf);
584}
585
586static u8 sata_fsl_check_status(struct ata_port *ap)
587{
588 struct sata_fsl_port_priv *pp = ap->private_data;
589
590 return pp->tf.command;
591}
592
593static void sata_fsl_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
594{
595 struct sata_fsl_port_priv *pp = ap->private_data;
596
597 *tf = pp->tf;
598}
599
600static int sata_fsl_port_start(struct ata_port *ap)
601{
602 struct device *dev = ap->host->dev;
603 struct sata_fsl_port_priv *pp;
604 int retval;
605 void *mem;
606 dma_addr_t mem_dma;
607 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
608 void __iomem *hcr_base = host_priv->hcr_base;
609 u32 temp;
610
611 pp = kzalloc(sizeof(*pp), GFP_KERNEL);
612 if (!pp)
613 return -ENOMEM;
614
615 /*
616 * allocate per command dma alignment pad buffer, which is used
617 * internally by libATA to ensure that all transfers ending on
618 * unaligned boundaries are padded, to align on Dword boundaries
619 */
620 retval = ata_pad_alloc(ap, dev);
621 if (retval) {
622 kfree(pp);
623 return retval;
624 }
625
626 mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
627 GFP_KERNEL);
628 if (!mem) {
629 ata_pad_free(ap, dev);
630 kfree(pp);
631 return -ENOMEM;
632 }
633 memset(mem, 0, SATA_FSL_PORT_PRIV_DMA_SZ);
634
635 pp->cmdslot = mem;
636 pp->cmdslot_paddr = mem_dma;
637
638 mem += SATA_FSL_CMD_SLOT_SIZE;
639 mem_dma += SATA_FSL_CMD_SLOT_SIZE;
640
641 pp->cmdentry = mem;
642 pp->cmdentry_paddr = mem_dma;
643
644 ap->private_data = pp;
645
646 VPRINTK("CHBA = 0x%x, cmdentry_phys = 0x%x\n",
647 pp->cmdslot_paddr, pp->cmdentry_paddr);
648
649 /* Now, update the CHBA register in host controller cmd register set */
650 iowrite32(pp->cmdslot_paddr & 0xffffffff, hcr_base + CHBA);
651
652 /*
653 * Now, we can bring the controller on-line & also initiate
654 * the COMINIT sequence, we simply return here and the boot-probing
655 * & device discovery process is re-initiated by libATA using a
656 * Softreset EH (dummy) session. Hence, boot probing and device
657 * discovey will be part of sata_fsl_softreset() callback.
658 */
659
660 temp = ioread32(hcr_base + HCONTROL);
661 iowrite32((temp | HCONTROL_ONLINE_PHY_RST), hcr_base + HCONTROL);
662
663 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
664 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
665 VPRINTK("CHBA = 0x%x\n", ioread32(hcr_base + CHBA));
666
667 /*
668 * Workaround for 8315DS board 3gbps link-up issue,
669 * currently limit SATA port to GEN1 speed
670 */
671 sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
672 temp &= ~(0xF << 4);
673 temp |= (0x1 << 4);
674 sata_fsl_scr_write(ap, SCR_CONTROL, temp);
675
676 sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
677 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
678 temp);
679
680 return 0;
681}
682
683static void sata_fsl_port_stop(struct ata_port *ap)
684{
685 struct device *dev = ap->host->dev;
686 struct sata_fsl_port_priv *pp = ap->private_data;
687 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
688 void __iomem *hcr_base = host_priv->hcr_base;
689 u32 temp;
690
691 /*
692 * Force host controller to go off-line, aborting current operations
693 */
694 temp = ioread32(hcr_base + HCONTROL);
695 temp &= ~HCONTROL_ONLINE_PHY_RST;
696 temp |= HCONTROL_FORCE_OFFLINE;
697 iowrite32(temp, hcr_base + HCONTROL);
698
699 /* Poll for controller to go offline - should happen immediately */
700 ata_wait_register(hcr_base + HSTATUS, ONLINE, ONLINE, 1, 1);
701
702 ap->private_data = NULL;
703 dma_free_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ,
704 pp->cmdslot, pp->cmdslot_paddr);
705
706 ata_pad_free(ap, dev);
707 kfree(pp);
708}
709
710static unsigned int sata_fsl_dev_classify(struct ata_port *ap)
711{
712 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
713 void __iomem *hcr_base = host_priv->hcr_base;
714 struct ata_taskfile tf;
715 u32 temp;
716
717 temp = ioread32(hcr_base + SIGNATURE);
718
719 VPRINTK("raw sig = 0x%x\n", temp);
720 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
721 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
722
723 tf.lbah = (temp >> 24) & 0xff;
724 tf.lbam = (temp >> 16) & 0xff;
725 tf.lbal = (temp >> 8) & 0xff;
726 tf.nsect = temp & 0xff;
727
728 return ata_dev_classify(&tf);
729}
730
731static int sata_fsl_softreset(struct ata_port *ap, unsigned int *class,
732 unsigned long deadline)
733{
734 struct sata_fsl_port_priv *pp = ap->private_data;
735 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
736 void __iomem *hcr_base = host_priv->hcr_base;
737 u32 temp;
738 struct ata_taskfile tf;
739 u8 *cfis;
740 u32 Serror;
741 int i = 0;
742 struct ata_queued_cmd qc;
743 u8 *buf;
744 dma_addr_t dma_address;
745 struct scatterlist *sg;
746 unsigned long start_jiffies;
747
748 DPRINTK("in xx_softreset\n");
749
750try_offline_again:
751 /*
752 * Force host controller to go off-line, aborting current operations
753 */
754 temp = ioread32(hcr_base + HCONTROL);
755 temp &= ~HCONTROL_ONLINE_PHY_RST;
756 iowrite32(temp, hcr_base + HCONTROL);
757
758 /* Poll for controller to go offline */
759 temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, ONLINE, 1, 500);
760
761 if (temp & ONLINE) {
762 ata_port_printk(ap, KERN_ERR,
763 "Softreset failed, not off-lined %d\n", i);
764
765 /*
766 * Try to offline controller atleast twice
767 */
768 i++;
769 if (i == 2)
770 goto err;
771 else
772 goto try_offline_again;
773 }
774
775 DPRINTK("softreset, controller off-lined\n");
776 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
777 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
778
779 /*
780 * PHY reset should remain asserted for atleast 1ms
781 */
782 msleep(1);
783
784 /*
785 * Now, bring the host controller online again, this can take time
786 * as PHY reset and communication establishment, 1st D2H FIS and
787 * device signature update is done, on safe side assume 500ms
788 * NOTE : Host online status may be indicated immediately!!
789 */
790
791 temp = ioread32(hcr_base + HCONTROL);
792 temp |= (HCONTROL_ONLINE_PHY_RST | HCONTROL_SNOOP_ENABLE);
793 iowrite32(temp, hcr_base + HCONTROL);
794
795 temp = ata_wait_register(hcr_base + HSTATUS, ONLINE, 0, 1, 500);
796
797 if (!(temp & ONLINE)) {
798 ata_port_printk(ap, KERN_ERR,
799 "Softreset failed, not on-lined\n");
800 goto err;
801 }
802
803 DPRINTK("softreset, controller off-lined & on-lined\n");
804 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
805 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
806
807 /*
808 * First, wait for the PHYRDY change to occur before waiting for
809 * the signature, and also verify if SStatus indicates device
810 * presence
811 */
812
813 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0, 1, 500);
814 if ((!(temp & 0x10)) || ata_port_offline(ap)) {
815 ata_port_printk(ap, KERN_WARNING,
816 "No Device OR PHYRDY change,Hstatus = 0x%x\n",
817 ioread32(hcr_base + HSTATUS));
818 goto err;
819 }
820
821 /*
822 * Wait for the first D2H from device,i.e,signature update notification
823 */
824 start_jiffies = jiffies;
825 temp = ata_wait_register(hcr_base + HSTATUS, 0xFF, 0x10,
826 500, jiffies_to_msecs(deadline - start_jiffies));
827
828 if ((temp & 0xFF) != 0x18) {
829 ata_port_printk(ap, KERN_WARNING, "No Signature Update\n");
830 goto err;
831 } else {
832 ata_port_printk(ap, KERN_INFO,
833 "Signature Update detected @ %d msecs\n",
834 jiffies_to_msecs(jiffies - start_jiffies));
835 }
836
837 /*
838 * Send a device reset (SRST) explicitly on command slot #0
839 * Check : will the command queue (reg) be cleared during offlining ??
840 * Also we will be online only if Phy commn. has been established
841 * and device presence has been detected, therefore if we have
842 * reached here, we can send a command to the target device
843 */
844
845 if (ap->sactive)
846 goto skip_srst_do_ncq_error_handling;
847
848 DPRINTK("Sending SRST/device reset\n");
849
850 ata_tf_init(ap->device, &tf);
851 cfis = (u8 *) & pp->cmdentry->cfis;
852
853 /* device reset/SRST is a control register update FIS, uses tag0 */
854 sata_fsl_setup_cmd_hdr_entry(pp, 0,
855 SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
856
857 tf.ctl |= ATA_SRST; /* setup SRST bit in taskfile control reg */
858 ata_tf_to_fis(&tf, 0, 0, cfis);
859
860 DPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x, 0x%x\n",
861 cfis[0], cfis[1], cfis[2], cfis[3]);
862
863 /*
864 * Queue SRST command to the controller/device, ensure that no
865 * other commands are active on the controller/device
866 */
867
868 DPRINTK("@Softreset, CQ = 0x%x, CA = 0x%x, CC = 0x%x\n",
869 ioread32(CQ + hcr_base),
870 ioread32(CA + hcr_base), ioread32(CC + hcr_base));
871
872 iowrite32(0xFFFF, CC + hcr_base);
873 iowrite32(1, CQ + hcr_base);
874
875 temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
876 if (temp & 0x1) {
877 ata_port_printk(ap, KERN_WARNING, "ATA_SRST issue failed\n");
878
879 DPRINTK("Softreset@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
880 ioread32(CQ + hcr_base),
881 ioread32(CA + hcr_base), ioread32(CC + hcr_base));
882
883 sata_fsl_scr_read(ap, SCR_ERROR, &Serror);
884
885 DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
886 DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
887 DPRINTK("Serror = 0x%x\n", Serror);
888 goto err;
889 }
890
891 msleep(1);
892
893 /*
894 * SATA device enters reset state after receving a Control register
895 * FIS with SRST bit asserted and it awaits another H2D Control reg.
896 * FIS with SRST bit cleared, then the device does internal diags &
897 * initialization, followed by indicating it's initialization status
898 * using ATA signature D2H register FIS to the host controller.
899 */
900
901 sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
902
903 tf.ctl &= ~ATA_SRST; /* 2nd H2D Ctl. register FIS */
904 ata_tf_to_fis(&tf, 0, 0, cfis);
905
906 iowrite32(1, CQ + hcr_base);
907 msleep(150); /* ?? */
908
909 /*
910 * The above command would have signalled an interrupt on command
911 * complete, which needs special handling, by clearing the Nth
912 * command bit of the CCreg
913 */
914 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
915 goto check_device_signature;
916
917skip_srst_do_ncq_error_handling:
918
919 VPRINTK("Sending read log ext(10h) command\n");
920
921 memset(&qc, 0, sizeof(struct ata_queued_cmd));
922 ata_tf_init(ap->device, &tf);
923
924 tf.command = ATA_CMD_READ_LOG_EXT;
925 tf.lbal = ATA_LOG_SATA_NCQ;
926 tf.nsect = 1;
927 tf.hob_nsect = 0;
928 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
929 tf.protocol = ATA_PROT_PIO;
930
931 qc.tag = ATA_TAG_INTERNAL;
932 qc.scsicmd = NULL;
933 qc.ap = ap;
934 qc.dev = ap->device;
935
936 qc.tf = tf;
937 qc.flags |= ATA_QCFLAG_RESULT_TF;
938 qc.dma_dir = DMA_FROM_DEVICE;
939
940 buf = ap->sector_buf;
941 ata_sg_init_one(&qc, buf, 1 * ATA_SECT_SIZE);
942
943 /*
944 * Need to DMA-map the memory buffer associated with the command
945 */
946
947 sg = qc.__sg;
948 dma_address = dma_map_single(ap->dev, qc.buf_virt,
949 sg->length, DMA_FROM_DEVICE);
950
951 sg_dma_address(sg) = dma_address;
952 sg_dma_len(sg) = sg->length;
953
954 VPRINTK("EH, addr = 0x%x, len = 0x%x\n", dma_address, sg->length);
955
956 sata_fsl_qc_prep(&qc);
957 sata_fsl_qc_issue(&qc);
958
959 temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
960 if (temp & 0x1) {
961 VPRINTK("READ_LOG_EXT_10H issue failed\n");
962
963 VPRINTK("READ_LOG@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
964 ioread32(CQ + hcr_base),
965 ioread32(CA + hcr_base), ioread32(CC + hcr_base));
966
967 sata_fsl_scr_read(ap, SCR_ERROR, &Serror);
968
969 VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
970 VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
971 VPRINTK("Serror = 0x%x\n", Serror);
972 goto err;
973 }
974
975 iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
976
977 check_device_signature:
978
979 DPRINTK("SATA FSL : Now checking device signature\n");
980
981 *class = ATA_DEV_NONE;
982
983 /* Verify if SStatus indicates device presence */
984 if (ata_port_online(ap)) {
985 /*
986 * if we are here, device presence has been detected,
987 * 1st D2H FIS would have been received, but sfis in
988 * command desc. is not updated, but signature register
989 * would have been updated
990 */
991
992 *class = sata_fsl_dev_classify(ap);
993
994 DPRINTK("class = %d\n", *class);
995 VPRINTK("ccreg = 0x%x\n", ioread32(hcr_base + CC));
996 VPRINTK("cereg = 0x%x\n", ioread32(hcr_base + CE));
997 }
998
999 return 0;
1000
1001err:
1002 return -EIO;
1003}
1004
1005static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class,
1006 unsigned long deadline)
1007{
1008 int retval;
1009
1010 retval = sata_std_hardreset(ap, class, deadline);
1011
1012 DPRINTK("SATA FSL : in xx_hardreset, retval = 0x%d\n", retval);
1013
1014 return retval;
1015}
1016
1017static void sata_fsl_error_handler(struct ata_port *ap)
1018{
1019
1020 DPRINTK("in xx_error_handler\n");
1021
1022 /* perform recovery */
1023 ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset,
1024 ata_std_postreset);
1025}
1026
1027static void sata_fsl_post_internal_cmd(struct ata_queued_cmd *qc)
1028{
1029 if (qc->flags & ATA_QCFLAG_FAILED)
1030 qc->err_mask |= AC_ERR_OTHER;
1031
1032 if (qc->err_mask) {
1033 /* make DMA engine forget about the failed command */
1034
1035 }
1036}
1037
1038static void sata_fsl_irq_clear(struct ata_port *ap)
1039{
1040 /* unused */
1041}
1042
1043static void sata_fsl_error_intr(struct ata_port *ap)
1044{
1045 struct ata_eh_info *ehi = &ap->eh_info;
1046 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1047 void __iomem *hcr_base = host_priv->hcr_base;
1048 u32 hstatus, dereg, cereg = 0, SError = 0;
1049 unsigned int err_mask = 0, action = 0;
1050 struct ata_queued_cmd *qc;
1051 int freeze = 0;
1052
1053 hstatus = ioread32(hcr_base + HSTATUS);
1054 cereg = ioread32(hcr_base + CE);
1055
1056 ata_ehi_clear_desc(ehi);
1057
1058 /*
1059 * Handle & Clear SError
1060 */
1061
1062 sata_fsl_scr_read(ap, SCR_ERROR, &SError);
1063 if (unlikely(SError & 0xFFFF0000)) {
1064 sata_fsl_scr_write(ap, SCR_ERROR, SError);
1065 err_mask |= AC_ERR_ATA_BUS;
1066 }
1067
1068 DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n",
1069 hstatus, cereg, ioread32(hcr_base + DE), SError);
1070
1071 /* handle single device errors */
1072 if (cereg) {
1073 /*
1074 * clear the command error, also clears queue to the device
1075 * in error, and we can (re)issue commands to this device.
1076 * When a device is in error all commands queued into the
1077 * host controller and at the device are considered aborted
1078 * and the queue for that device is stopped. Now, after
1079 * clearing the device error, we can issue commands to the
1080 * device to interrogate it to find the source of the error.
1081 */
1082 dereg = ioread32(hcr_base + DE);
1083 iowrite32(dereg, hcr_base + DE);
1084 iowrite32(cereg, hcr_base + CE);
1085
1086 DPRINTK("single device error, CE=0x%x, DE=0x%x\n",
1087 ioread32(hcr_base + CE), ioread32(hcr_base + DE));
1088 /*
1089 * We should consider this as non fatal error, and TF must
1090 * be updated as done below.
1091 */
1092
1093 err_mask |= AC_ERR_DEV;
1094 }
1095
1096 /* handle fatal errors */
1097 if (hstatus & FATAL_ERROR_DECODE) {
1098 err_mask |= AC_ERR_ATA_BUS;
1099 action |= ATA_EH_SOFTRESET;
1100 /* how will fatal error interrupts be completed ?? */
1101 freeze = 1;
1102 }
1103
1104 /* Handle PHYRDY change notification */
1105 if (hstatus & INT_ON_PHYRDY_CHG) {
1106 DPRINTK("SATA FSL: PHYRDY change indication\n");
1107
1108 /* Setup a soft-reset EH action */
1109 ata_ehi_hotplugged(ehi);
1110 freeze = 1;
1111 }
1112
1113 /* record error info */
1114 qc = ata_qc_from_tag(ap, ap->active_tag);
1115
1116 if (qc) {
1117 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
1118 qc->err_mask |= err_mask;
1119 } else
1120 ehi->err_mask |= err_mask;
1121
1122 ehi->action |= action;
1123 ehi->serror |= SError;
1124
1125 /* freeze or abort */
1126 if (freeze)
1127 ata_port_freeze(ap);
1128 else
1129 ata_port_abort(ap);
1130}
1131
1132static void sata_fsl_qc_complete(struct ata_queued_cmd *qc)
1133{
1134 if (qc->flags & ATA_QCFLAG_RESULT_TF) {
1135 DPRINTK("xx_qc_complete called\n");
1136 sata_fsl_cache_taskfile_from_d2h_fis(qc, qc->ap);
1137 }
1138}
1139
1140static void sata_fsl_host_intr(struct ata_port *ap)
1141{
1142 struct sata_fsl_host_priv *host_priv = ap->host->private_data;
1143 void __iomem *hcr_base = host_priv->hcr_base;
1144 u32 hstatus, qc_active = 0;
1145 struct ata_queued_cmd *qc;
1146 u32 SError;
1147
1148 hstatus = ioread32(hcr_base + HSTATUS);
1149
1150 sata_fsl_scr_read(ap, SCR_ERROR, &SError);
1151
1152 if (unlikely(SError & 0xFFFF0000)) {
1153 DPRINTK("serror @host_intr : 0x%x\n", SError);
1154 sata_fsl_error_intr(ap);
1155
1156 }
1157
1158 if (unlikely(hstatus & INT_ON_ERROR)) {
1159 DPRINTK("error interrupt!!\n");
1160 sata_fsl_error_intr(ap);
1161 return;
1162 }
1163
1164 if (ap->sactive) { /* only true for NCQ commands */
1165 int i;
1166 /* Read command completed register */
1167 qc_active = ioread32(hcr_base + CC);
1168 /* clear CC bit, this will also complete the interrupt */
1169 iowrite32(qc_active, hcr_base + CC);
1170
1171 DPRINTK("Status of all queues :\n");
1172 DPRINTK("qc_active/CC = 0x%x, CA = 0x%x, CE=0x%x\n",
1173 qc_active, ioread32(hcr_base + CA),
1174 ioread32(hcr_base + CE));
1175
1176 for (i = 0; i < SATA_FSL_QUEUE_DEPTH; i++) {
1177 if (qc_active & (1 << i)) {
1178 qc = ata_qc_from_tag(ap, i);
1179 if (qc) {
1180 sata_fsl_qc_complete(qc);
1181 ata_qc_complete(qc);
1182 }
1183 DPRINTK
1184 ("completing ncq cmd,tag=%d,CC=0x%x,CA=0x%x\n",
1185 i, ioread32(hcr_base + CC),
1186 ioread32(hcr_base + CA));
1187 }
1188 }
1189 return;
1190
1191 } else if (ap->qc_active) {
1192 iowrite32(1, hcr_base + CC);
1193 qc = ata_qc_from_tag(ap, ap->active_tag);
1194
1195 DPRINTK("completing non-ncq cmd, tag=%d,CC=0x%x\n",
1196 ap->active_tag, ioread32(hcr_base + CC));
1197
1198 if (qc) {
1199 sata_fsl_qc_complete(qc);
1200 ata_qc_complete(qc);
1201 }
1202 } else {
1203 /* Spurious Interrupt!! */
1204 DPRINTK("spurious interrupt!!, CC = 0x%x\n",
1205 ioread32(hcr_base + CC));
1206 return;
1207 }
1208}
1209
1210static irqreturn_t sata_fsl_interrupt(int irq, void *dev_instance)
1211{
1212 struct ata_host *host = dev_instance;
1213 struct sata_fsl_host_priv *host_priv = host->private_data;
1214 void __iomem *hcr_base = host_priv->hcr_base;
1215 u32 interrupt_enables;
1216 unsigned handled = 0;
1217 struct ata_port *ap;
1218
1219 /* ack. any pending IRQs for this controller/port */
1220 interrupt_enables = ioread32(hcr_base + HSTATUS);
1221 interrupt_enables &= 0x3F;
1222
1223 DPRINTK("interrupt status 0x%x\n", interrupt_enables);
1224
1225 if (!interrupt_enables)
1226 return IRQ_NONE;
1227
1228 spin_lock(&host->lock);
1229
1230 /* Assuming one port per host controller */
1231
1232 ap = host->ports[0];
1233 if (ap) {
1234 sata_fsl_host_intr(ap);
1235 } else {
1236 dev_printk(KERN_WARNING, host->dev,
1237 "interrupt on disabled port 0\n");
1238 }
1239
1240 iowrite32(interrupt_enables, hcr_base + HSTATUS);
1241 handled = 1;
1242
1243 spin_unlock(&host->lock);
1244
1245 return IRQ_RETVAL(handled);
1246}
1247
1248/*
1249 * Multiple ports are represented by multiple SATA controllers with
1250 * one port per controller
1251 */
1252static int sata_fsl_init_controller(struct ata_host *host)
1253{
1254 struct sata_fsl_host_priv *host_priv = host->private_data;
1255 void __iomem *hcr_base = host_priv->hcr_base;
1256 u32 temp;
1257
1258 /*
1259 * NOTE : We cannot bring the controller online before setting
1260 * the CHBA, hence main controller initialization is done as
1261 * part of the port_start() callback
1262 */
1263
1264 /* ack. any pending IRQs for this controller/port */
1265 temp = ioread32(hcr_base + HSTATUS);
1266 if (temp & 0x3F)
1267 iowrite32((temp & 0x3F), hcr_base + HSTATUS);
1268
1269 /* Keep interrupts disabled on the controller */
1270 temp = ioread32(hcr_base + HCONTROL);
1271 iowrite32((temp & ~0x3F), hcr_base + HCONTROL);
1272
1273 /* Disable interrupt coalescing control(icc), for the moment */
1274 DPRINTK("icc = 0x%x\n", ioread32(hcr_base + ICC));
1275 iowrite32(0x01000000, hcr_base + ICC);
1276
1277 /* clear error registers, SError is cleared by libATA */
1278 iowrite32(0x00000FFFF, hcr_base + CE);
1279 iowrite32(0x00000FFFF, hcr_base + DE);
1280
1281 /* initially assuming no Port multiplier, set CQPMP to 0 */
1282 iowrite32(0x0, hcr_base + CQPMP);
1283
1284 /*
1285 * host controller will be brought on-line, during xx_port_start()
1286 * callback, that should also initiate the OOB, COMINIT sequence
1287 */
1288
1289 DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
1290 DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
1291
1292 return 0;
1293}
1294
1295/*
1296 * scsi mid-layer and libata interface structures
1297 */
1298static struct scsi_host_template sata_fsl_sht = {
1299 .module = THIS_MODULE,
1300 .name = "sata_fsl",
1301 .ioctl = ata_scsi_ioctl,
1302 .queuecommand = ata_scsi_queuecmd,
1303 .change_queue_depth = ata_scsi_change_queue_depth,
1304 .can_queue = SATA_FSL_QUEUE_DEPTH,
1305 .this_id = ATA_SHT_THIS_ID,
1306 .sg_tablesize = SATA_FSL_MAX_PRD_USABLE,
1307 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
1308 .emulated = ATA_SHT_EMULATED,
1309 .use_clustering = ATA_SHT_USE_CLUSTERING,
1310 .proc_name = "sata_fsl",
1311 .dma_boundary = ATA_DMA_BOUNDARY,
1312 .slave_configure = ata_scsi_slave_config,
1313 .slave_destroy = ata_scsi_slave_destroy,
1314 .bios_param = ata_std_bios_param,
1315#ifdef CONFIG_PM
1316 .suspend = ata_scsi_device_suspend,
1317 .resume = ata_scsi_device_resume,
1318#endif
1319};
1320
1321static const struct ata_port_operations sata_fsl_ops = {
1322 .port_disable = ata_port_disable,
1323
1324 .check_status = sata_fsl_check_status,
1325 .check_altstatus = sata_fsl_check_status,
1326 .dev_select = ata_noop_dev_select,
1327
1328 .tf_read = sata_fsl_tf_read,
1329
1330 .qc_prep = sata_fsl_qc_prep,
1331 .qc_issue = sata_fsl_qc_issue,
1332 .irq_clear = sata_fsl_irq_clear,
1333 .irq_on = ata_dummy_irq_on,
1334 .irq_ack = ata_dummy_irq_ack,
1335
1336 .scr_read = sata_fsl_scr_read,
1337 .scr_write = sata_fsl_scr_write,
1338
1339 .freeze = sata_fsl_freeze,
1340 .thaw = sata_fsl_thaw,
1341 .error_handler = sata_fsl_error_handler,
1342 .post_internal_cmd = sata_fsl_post_internal_cmd,
1343
1344 .port_start = sata_fsl_port_start,
1345 .port_stop = sata_fsl_port_stop,
1346};
1347
1348static const struct ata_port_info sata_fsl_port_info[] = {
1349 {
1350 .flags = SATA_FSL_HOST_FLAGS,
1351 .pio_mask = 0x1f, /* pio 0-4 */
1352 .udma_mask = 0x7f, /* udma 0-6 */
1353 .port_ops = &sata_fsl_ops,
1354 },
1355};
1356
1357static int sata_fsl_probe(struct of_device *ofdev,
1358 const struct of_device_id *match)
1359{
1360 int retval = 0;
1361 void __iomem *hcr_base = NULL;
1362 void __iomem *ssr_base = NULL;
1363 void __iomem *csr_base = NULL;
1364 struct sata_fsl_host_priv *host_priv = NULL;
1365 struct resource *r;
1366 int irq;
1367 struct ata_host *host;
1368
1369 struct ata_port_info pi = sata_fsl_port_info[0];
1370 const struct ata_port_info *ppi[] = { &pi, NULL };
1371
1372 dev_printk(KERN_INFO, &ofdev->dev,
1373 "Sata FSL Platform/CSB Driver init\n");
1374
1375 r = kmalloc(sizeof(struct resource), GFP_KERNEL);
1376
1377 hcr_base = of_iomap(ofdev->node, 0);
1378 if (!hcr_base)
1379 goto error_exit_with_cleanup;
1380
1381 ssr_base = hcr_base + 0x100;
1382 csr_base = hcr_base + 0x140;
1383
1384 DPRINTK("@reset i/o = 0x%x\n", ioread32(csr_base + TRANSCFG));
1385 DPRINTK("sizeof(cmd_desc) = %d\n", sizeof(struct command_desc));
1386 DPRINTK("sizeof(#define cmd_desc) = %d\n", SATA_FSL_CMD_DESC_SIZE);
1387
1388 host_priv = kzalloc(sizeof(struct sata_fsl_host_priv), GFP_KERNEL);
1389 if (!host_priv)
1390 goto error_exit_with_cleanup;
1391
1392 host_priv->hcr_base = hcr_base;
1393 host_priv->ssr_base = ssr_base;
1394 host_priv->csr_base = csr_base;
1395
1396 irq = irq_of_parse_and_map(ofdev->node, 0);
1397 if (irq < 0) {
1398 dev_printk(KERN_ERR, &ofdev->dev, "invalid irq from platform\n");
1399 goto error_exit_with_cleanup;
1400 }
1401
1402 /* allocate host structure */
1403 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS);
1404
1405 /* host->iomap is not used currently */
1406 host->private_data = host_priv;
1407
1408 /* setup port(s) */
1409
1410 host->ports[0]->ioaddr.cmd_addr = host_priv->hcr_base;
1411 host->ports[0]->ioaddr.scr_addr = host_priv->ssr_base;
1412
1413 /* initialize host controller */
1414 sata_fsl_init_controller(host);
1415
1416 /*
1417 * Now, register with libATA core, this will also initiate the
1418 * device discovery process, invoking our port_start() handler &
1419 * error_handler() to execute a dummy Softreset EH session
1420 */
1421 ata_host_activate(host, irq, sata_fsl_interrupt, SATA_FSL_IRQ_FLAG,
1422 &sata_fsl_sht);
1423
1424 dev_set_drvdata(&ofdev->dev, host);
1425
1426 return 0;
1427
1428error_exit_with_cleanup:
1429
1430 if (hcr_base)
1431 iounmap(hcr_base);
1432 if (host_priv)
1433 kfree(host_priv);
1434
1435 return retval;
1436}
1437
1438static int sata_fsl_remove(struct of_device *ofdev)
1439{
1440 struct ata_host *host = dev_get_drvdata(&ofdev->dev);
1441 struct sata_fsl_host_priv *host_priv = host->private_data;
1442
1443 ata_host_detach(host);
1444
1445 dev_set_drvdata(&ofdev->dev, NULL);
1446
1447 irq_dispose_mapping(host->irq);
1448 iounmap(host_priv->hcr_base);
1449 kfree(host_priv);
1450
1451 return 0;
1452}
1453
1454static struct of_device_id fsl_sata_match[] = {
1455 {
1456 .compatible = "fsl,mpc8315-sata",
1457 },
1458 {
1459 .compatible = "fsl,mpc8379-sata",
1460 },
1461 {},
1462};
1463
1464MODULE_DEVICE_TABLE(of, fsl_sata_match);
1465
1466static struct of_platform_driver fsl_sata_driver = {
1467 .name = "fsl-sata",
1468 .match_table = fsl_sata_match,
1469 .probe = sata_fsl_probe,
1470 .remove = sata_fsl_remove,
1471};
1472
1473static int __init sata_fsl_init(void)
1474{
1475 of_register_platform_driver(&fsl_sata_driver);
1476 return 0;
1477}
1478
1479static void __exit sata_fsl_exit(void)
1480{
1481 of_unregister_platform_driver(&fsl_sata_driver);
1482}
1483
1484MODULE_LICENSE("GPL");
1485MODULE_AUTHOR("Ashish Kalra, Freescale Semiconductor");
1486MODULE_DESCRIPTION("Freescale 3.0Gbps SATA controller low level driver");
1487MODULE_VERSION("1.10");
1488
1489module_init(sata_fsl_init);
1490module_exit(sata_fsl_exit);
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 4df8311968e9..7f1b13e89cf7 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -421,7 +421,6 @@ static void mv_error_handler(struct ata_port *ap);
421static void mv_post_int_cmd(struct ata_queued_cmd *qc); 421static void mv_post_int_cmd(struct ata_queued_cmd *qc);
422static void mv_eh_freeze(struct ata_port *ap); 422static void mv_eh_freeze(struct ata_port *ap);
423static void mv_eh_thaw(struct ata_port *ap); 423static void mv_eh_thaw(struct ata_port *ap);
424static int mv_slave_config(struct scsi_device *sdev);
425static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 424static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
426 425
427static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, 426static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
@@ -459,7 +458,7 @@ static struct scsi_host_template mv5_sht = {
459 .use_clustering = 1, 458 .use_clustering = 1,
460 .proc_name = DRV_NAME, 459 .proc_name = DRV_NAME,
461 .dma_boundary = MV_DMA_BOUNDARY, 460 .dma_boundary = MV_DMA_BOUNDARY,
462 .slave_configure = mv_slave_config, 461 .slave_configure = ata_scsi_slave_config,
463 .slave_destroy = ata_scsi_slave_destroy, 462 .slave_destroy = ata_scsi_slave_destroy,
464 .bios_param = ata_std_bios_param, 463 .bios_param = ata_std_bios_param,
465}; 464};
@@ -477,7 +476,7 @@ static struct scsi_host_template mv6_sht = {
477 .use_clustering = 1, 476 .use_clustering = 1,
478 .proc_name = DRV_NAME, 477 .proc_name = DRV_NAME,
479 .dma_boundary = MV_DMA_BOUNDARY, 478 .dma_boundary = MV_DMA_BOUNDARY,
480 .slave_configure = mv_slave_config, 479 .slave_configure = ata_scsi_slave_config,
481 .slave_destroy = ata_scsi_slave_destroy, 480 .slave_destroy = ata_scsi_slave_destroy,
482 .bios_param = ata_std_bios_param, 481 .bios_param = ata_std_bios_param,
483}; 482};
@@ -756,17 +755,6 @@ static void mv_irq_clear(struct ata_port *ap)
756{ 755{
757} 756}
758 757
759static int mv_slave_config(struct scsi_device *sdev)
760{
761 int rc = ata_scsi_slave_config(sdev);
762 if (rc)
763 return rc;
764
765 blk_queue_max_phys_segments(sdev->request_queue, MV_MAX_SG_CT / 2);
766
767 return 0; /* scsi layer doesn't check return value, sigh */
768}
769
770static void mv_set_edma_ptrs(void __iomem *port_mmio, 758static void mv_set_edma_ptrs(void __iomem *port_mmio,
771 struct mv_host_priv *hpriv, 759 struct mv_host_priv *hpriv,
772 struct mv_port_priv *pp) 760 struct mv_port_priv *pp)
@@ -1138,7 +1126,7 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
1138{ 1126{
1139 struct mv_port_priv *pp = qc->ap->private_data; 1127 struct mv_port_priv *pp = qc->ap->private_data;
1140 struct scatterlist *sg; 1128 struct scatterlist *sg;
1141 struct mv_sg *mv_sg; 1129 struct mv_sg *mv_sg, *last_sg = NULL;
1142 1130
1143 mv_sg = pp->sg_tbl; 1131 mv_sg = pp->sg_tbl;
1144 ata_for_each_sg(sg, qc) { 1132 ata_for_each_sg(sg, qc) {
@@ -1159,13 +1147,13 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
1159 sg_len -= len; 1147 sg_len -= len;
1160 addr += len; 1148 addr += len;
1161 1149
1162 if (!sg_len && ata_sg_is_last(sg, qc)) 1150 last_sg = mv_sg;
1163 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1164
1165 mv_sg++; 1151 mv_sg++;
1166 } 1152 }
1167
1168 } 1153 }
1154
1155 if (likely(last_sg))
1156 last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1169} 1157}
1170 1158
1171static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) 1159static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index b0619278454a..26ebffc10f3e 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -796,16 +796,19 @@ static inline void sil24_fill_sg(struct ata_queued_cmd *qc,
796 struct sil24_sge *sge) 796 struct sil24_sge *sge)
797{ 797{
798 struct scatterlist *sg; 798 struct scatterlist *sg;
799 struct sil24_sge *last_sge = NULL;
799 800
800 ata_for_each_sg(sg, qc) { 801 ata_for_each_sg(sg, qc) {
801 sge->addr = cpu_to_le64(sg_dma_address(sg)); 802 sge->addr = cpu_to_le64(sg_dma_address(sg));
802 sge->cnt = cpu_to_le32(sg_dma_len(sg)); 803 sge->cnt = cpu_to_le32(sg_dma_len(sg));
803 if (ata_sg_is_last(sg, qc)) 804 sge->flags = 0;
804 sge->flags = cpu_to_le32(SGE_TRM); 805
805 else 806 last_sge = sge;
806 sge->flags = 0;
807 sge++; 807 sge++;
808 } 808 }
809
810 if (likely(last_sge))
811 last_sge->flags = cpu_to_le32(SGE_TRM);
809} 812}
810 813
811static int sil24_qc_defer(struct ata_queued_cmd *qc) 814static int sil24_qc_defer(struct ata_queued_cmd *qc)
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 8d98a9fb0a42..f147dc7bf464 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -92,7 +92,7 @@ static struct scsi_host_template sis_sht = {
92 .queuecommand = ata_scsi_queuecmd, 92 .queuecommand = ata_scsi_queuecmd,
93 .can_queue = ATA_DEF_QUEUE, 93 .can_queue = ATA_DEF_QUEUE,
94 .this_id = ATA_SHT_THIS_ID, 94 .this_id = ATA_SHT_THIS_ID,
95 .sg_tablesize = ATA_MAX_PRD, 95 .sg_tablesize = LIBATA_MAX_PRD,
96 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 96 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
97 .emulated = ATA_SHT_EMULATED, 97 .emulated = ATA_SHT_EMULATED,
98 .use_clustering = ATA_SHT_USE_CLUSTERING, 98 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -166,11 +166,11 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
166 return addr; 166 return addr;
167} 167}
168 168
169static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg) 169static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg, u32 *val)
170{ 170{
171 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 171 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
172 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 172 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg);
173 u32 val, val2 = 0; 173 u32 val2 = 0;
174 u8 pmr; 174 u8 pmr;
175 175
176 if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */ 176 if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
@@ -178,13 +178,16 @@ static u32 sis_scr_cfg_read (struct ata_port *ap, unsigned int sc_reg)
178 178
179 pci_read_config_byte(pdev, SIS_PMR, &pmr); 179 pci_read_config_byte(pdev, SIS_PMR, &pmr);
180 180
181 pci_read_config_dword(pdev, cfg_addr, &val); 181 pci_read_config_dword(pdev, cfg_addr, val);
182 182
183 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || 183 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
184 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED)) 184 (pdev->device == 0x1182) || (pmr & SIS_PMR_COMBINED))
185 pci_read_config_dword(pdev, cfg_addr+0x10, &val2); 185 pci_read_config_dword(pdev, cfg_addr+0x10, &val2);
186 186
187 return (val|val2) & 0xfffffffb; /* avoid problems with powerdowned ports */ 187 *val |= val2;
188 *val &= 0xfffffffb; /* avoid problems with powerdowned ports */
189
190 return 0;
188} 191}
189 192
190static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val) 193static void sis_scr_cfg_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
@@ -214,7 +217,7 @@ static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
214 return -EINVAL; 217 return -EINVAL;
215 218
216 if (ap->flags & SIS_FLAG_CFGSCR) 219 if (ap->flags & SIS_FLAG_CFGSCR)
217 return sis_scr_cfg_read(ap, sc_reg); 220 return sis_scr_cfg_read(ap, sc_reg, val);
218 221
219 pci_read_config_byte(pdev, SIS_PMR, &pmr); 222 pci_read_config_byte(pdev, SIS_PMR, &pmr);
220 223
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 94ebc9dc40fd..f8f7139c07c1 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1596,7 +1596,7 @@ static irqreturn_t fs_irq (int irq, void *dev_id)
1596 1596
1597 /* print the bits in the ISR register. */ 1597 /* print the bits in the ISR register. */
1598 if (fs_debug & FS_DEBUG_IRQ) { 1598 if (fs_debug & FS_DEBUG_IRQ) {
1599 /* The FS_DEBUG things are unneccesary here. But this way it is 1599 /* The FS_DEBUG things are unnecessary here. But this way it is
1600 clear for grep that these are debug prints. */ 1600 clear for grep that these are debug prints. */
1601 fs_dprintk (FS_DEBUG_IRQ, "IRQ status:"); 1601 fs_dprintk (FS_DEBUG_IRQ, "IRQ status:");
1602 for (i=0;i<27;i++) 1602 for (i=0;i<27;i++)
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index fbae8674e491..5beddc322e6f 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -366,7 +366,7 @@ dma_pool_free (struct dma_pool *pool, void *vaddr, dma_addr_t dma)
366 unsigned long flags; 366 unsigned long flags;
367 int map, block; 367 int map, block;
368 368
369 if ((page = pool_find_page (pool, dma)) == 0) { 369 if ((page = pool_find_page(pool, dma)) == NULL) {
370 if (pool->dev) 370 if (pool->dev)
371 dev_err(pool->dev, "dma_pool_free %s, %p/%lx (bad dma)\n", 371 dev_err(pool->dev, "dma_pool_free %s, %p/%lx (bad dma)\n",
372 pool->name, vaddr, (unsigned long) dma); 372 pool->name, vaddr, (unsigned long) dma);
diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
index 2b0c601e422e..2b4b392dcbc1 100644
--- a/drivers/base/power/trace.c
+++ b/drivers/base/power/trace.c
@@ -114,7 +114,7 @@ static unsigned int read_magic_time(void)
114 get_rtc_time(&time); 114 get_rtc_time(&time);
115 printk("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n", 115 printk("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n",
116 time.tm_hour, time.tm_min, time.tm_sec, 116 time.tm_hour, time.tm_min, time.tm_sec,
117 time.tm_mon, time.tm_mday, time.tm_year); 117 time.tm_mon + 1, time.tm_mday, time.tm_year % 100);
118 val = time.tm_year; /* 100 years */ 118 val = time.tm_year; /* 100 years */
119 if (val > 100) 119 if (val > 100)
120 val -= 100; 120 val -= 100;
diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 8d8cdfec6529..e1d3ad4db2f0 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -94,27 +94,18 @@ static struct attribute_group topology_attr_group = {
94 .name = "topology" 94 .name = "topology"
95}; 95};
96 96
97static cpumask_t topology_dev_map = CPU_MASK_NONE;
98
99/* Add/Remove cpu_topology interface for CPU device */ 97/* Add/Remove cpu_topology interface for CPU device */
100static int __cpuinit topology_add_dev(unsigned int cpu) 98static int __cpuinit topology_add_dev(unsigned int cpu)
101{ 99{
102 int rc;
103 struct sys_device *sys_dev = get_cpu_sysdev(cpu); 100 struct sys_device *sys_dev = get_cpu_sysdev(cpu);
104 101
105 rc = sysfs_create_group(&sys_dev->kobj, &topology_attr_group); 102 return sysfs_create_group(&sys_dev->kobj, &topology_attr_group);
106 if (!rc)
107 cpu_set(cpu, topology_dev_map);
108 return rc;
109} 103}
110 104
111static void __cpuinit topology_remove_dev(unsigned int cpu) 105static void __cpuinit topology_remove_dev(unsigned int cpu)
112{ 106{
113 struct sys_device *sys_dev = get_cpu_sysdev(cpu); 107 struct sys_device *sys_dev = get_cpu_sysdev(cpu);
114 108
115 if (!cpu_isset(cpu, topology_dev_map))
116 return;
117 cpu_clear(cpu, topology_dev_map);
118 sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); 109 sysfs_remove_group(&sys_dev->kobj, &topology_attr_group);
119} 110}
120 111
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index ca4d7f0d09b7..ce4b1e484e64 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -204,23 +204,6 @@ config BLK_DEV_COW_COMMON
204 bool 204 bool
205 default BLK_DEV_UBD 205 default BLK_DEV_UBD
206 206
207config MMAPPER
208 tristate "Example IO memory driver (BROKEN)"
209 depends on UML && BROKEN
210 ---help---
211 The User-Mode Linux port can provide support for IO Memory
212 emulation with this option. This allows a host file to be
213 specified as an I/O region on the kernel command line. That file
214 will be mapped into UML's kernel address space where a driver can
215 locate it and do whatever it wants with the memory, including
216 providing an interface to it for UML processes to use.
217
218 For more information, see
219 <http://user-mode-linux.sourceforge.net/iomem.html>.
220
221 If you'd like to be able to provide a simulated IO port space for
222 User-Mode Linux processes, say Y. If unsure, say N.
223
224config BLK_DEV_LOOP 207config BLK_DEV_LOOP
225 tristate "Loopback device support" 208 tristate "Loopback device support"
226 ---help--- 209 ---help---
@@ -351,7 +334,7 @@ config BLK_DEV_RAM_COUNT
351 default "16" 334 default "16"
352 depends on BLK_DEV_RAM 335 depends on BLK_DEV_RAM
353 help 336 help
354 The default value is 16 RAM disks. Change this if you know what 337 The default value is 16 RAM disks. Change this if you know what you
355 are doing. If you boot from a filesystem that needs to be extracted 338 are doing. If you boot from a filesystem that needs to be extracted
356 in memory, you will need at least one RAM disk (e.g. root on cramfs). 339 in memory, you will need at least one RAM disk (e.g. root on cramfs).
357 340
@@ -361,7 +344,7 @@ config BLK_DEV_RAM_SIZE
361 default "4096" 344 default "4096"
362 help 345 help
363 The default value is 4096 kilobytes. Only change this if you know 346 The default value is 4096 kilobytes. Only change this if you know
364 what are you doing. 347 what you are doing.
365 348
366config BLK_DEV_RAM_BLOCKSIZE 349config BLK_DEV_RAM_BLOCKSIZE
367 int "Default RAM disk block size (bytes)" 350 int "Default RAM disk block size (bytes)"
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 589cbbd9cd4f..56e23042728a 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -29,7 +29,7 @@
29 * 29 *
30 * Maximum number of loop devices when compiled-in now selectable by passing 30 * Maximum number of loop devices when compiled-in now selectable by passing
31 * max_loop=<1-255> to the kernel on boot. 31 * max_loop=<1-255> to the kernel on boot.
32 * Erik I. Bolsø, <eriki@himolde.no>, Oct 31, 1999 32 * Erik I. Bolsø, <eriki@himolde.no>, Oct 31, 1999
33 * 33 *
34 * Completely rewrite request handling to be make_request_fn style and 34 * Completely rewrite request handling to be make_request_fn style and
35 * non blocking, pushing work to a helper thread. Lots of fixes from 35 * non blocking, pushing work to a helper thread. Lots of fixes from
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index cb136a919f2a..6332acad078c 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -188,7 +188,7 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
188 if (signal_pending(current)) { 188 if (signal_pending(current)) {
189 siginfo_t info; 189 siginfo_t info;
190 printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n", 190 printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n",
191 current->pid, current->comm, 191 task_pid_nr(current), current->comm,
192 dequeue_signal_lock(current, &current->blocked, &info)); 192 dequeue_signal_lock(current, &current->blocked, &info));
193 result = -EINTR; 193 result = -EINTR;
194 sock_shutdown(lo, !send); 194 sock_shutdown(lo, !send);
@@ -508,7 +508,6 @@ error_out:
508 nbd_end_request(req); 508 nbd_end_request(req);
509 spin_lock(q->queue_lock); 509 spin_lock(q->queue_lock);
510 } 510 }
511 return;
512} 511}
513 512
514static int nbd_ioctl(struct inode *inode, struct file *file, 513static int nbd_ioctl(struct inode *inode, struct file *file,
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index 08176d23a46c..47f8ac6cce57 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -365,7 +365,7 @@ static int rd_open(struct inode *inode, struct file *filp)
365 /* 365 /*
366 * Deep badness. rd_blkdev_pagecache_IO() needs to allocate 366 * Deep badness. rd_blkdev_pagecache_IO() needs to allocate
367 * pagecache pages within a request_fn. We cannot recur back 367 * pagecache pages within a request_fn. We cannot recur back
368 * into the filesytem which is mounted atop the ramdisk, because 368 * into the filesystem which is mounted atop the ramdisk, because
369 * that would deadlock on fs locks. And we really don't want 369 * that would deadlock on fs locks. And we really don't want
370 * to reenter rd_blkdev_pagecache_IO when we're already within 370 * to reenter rd_blkdev_pagecache_IO when we're already within
371 * that function. 371 * that function.
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 9e7652dcde6c..82effce97c51 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -390,8 +390,8 @@ static inline void ace_dump_mem(void *base, int len)
390static void ace_dump_regs(struct ace_device *ace) 390static void ace_dump_regs(struct ace_device *ace)
391{ 391{
392 dev_info(ace->dev, " ctrl: %.8x seccnt/cmd: %.4x ver:%.4x\n" 392 dev_info(ace->dev, " ctrl: %.8x seccnt/cmd: %.4x ver:%.4x\n"
393 " status:%.8x mpu_lba:%.8x busmode:%4x\n" 393 KERN_INFO " status:%.8x mpu_lba:%.8x busmode:%4x\n"
394 " error: %.8x cfg_lba:%.8x fatstat:%.4x\n", 394 KERN_INFO " error: %.8x cfg_lba:%.8x fatstat:%.4x\n",
395 ace_in32(ace, ACE_CTRL), 395 ace_in32(ace, ACE_CTRL),
396 ace_in(ace, ACE_SECCNTCMD), 396 ace_in(ace, ACE_SECCNTCMD),
397 ace_in(ace, ACE_VERSION), 397 ace_in(ace, ACE_VERSION),
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 79245714f0a7..af0561053167 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1107,7 +1107,7 @@ int open_for_data(struct cdrom_device_info * cdi)
1107 is the default case! */ 1107 is the default case! */
1108 cdinfo(CD_OPEN, "bummer. wrong media type.\n"); 1108 cdinfo(CD_OPEN, "bummer. wrong media type.\n");
1109 cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n", 1109 cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n",
1110 (unsigned int)current->pid); 1110 (unsigned int)task_pid_nr(current));
1111 ret=-EMEDIUMTYPE; 1111 ret=-EMEDIUMTYPE;
1112 goto clean_up_and_return; 1112 goto clean_up_and_return;
1113 } 1113 }
@@ -3458,47 +3458,19 @@ static void cdrom_update_settings(void)
3458static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp, 3458static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
3459 void __user *buffer, size_t *lenp, loff_t *ppos) 3459 void __user *buffer, size_t *lenp, loff_t *ppos)
3460{ 3460{
3461 int *valp = ctl->data;
3462 int val = *valp;
3463 int ret; 3461 int ret;
3464 3462
3465 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 3463 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
3466 3464
3467 if (write && *valp != val) { 3465 if (write) {
3468 3466
3469 /* we only care for 1 or 0. */ 3467 /* we only care for 1 or 0. */
3470 if (*valp) 3468 autoclose = !!cdrom_sysctl_settings.autoclose;
3471 *valp = 1; 3469 autoeject = !!cdrom_sysctl_settings.autoeject;
3472 else 3470 debug = !!cdrom_sysctl_settings.debug;
3473 *valp = 0; 3471 lockdoor = !!cdrom_sysctl_settings.lock;
3472 check_media_type = !!cdrom_sysctl_settings.check;
3474 3473
3475 switch (ctl->ctl_name) {
3476 case DEV_CDROM_AUTOCLOSE: {
3477 if (valp == &cdrom_sysctl_settings.autoclose)
3478 autoclose = cdrom_sysctl_settings.autoclose;
3479 break;
3480 }
3481 case DEV_CDROM_AUTOEJECT: {
3482 if (valp == &cdrom_sysctl_settings.autoeject)
3483 autoeject = cdrom_sysctl_settings.autoeject;
3484 break;
3485 }
3486 case DEV_CDROM_DEBUG: {
3487 if (valp == &cdrom_sysctl_settings.debug)
3488 debug = cdrom_sysctl_settings.debug;
3489 break;
3490 }
3491 case DEV_CDROM_LOCK: {
3492 if (valp == &cdrom_sysctl_settings.lock)
3493 lockdoor = cdrom_sysctl_settings.lock;
3494 break;
3495 }
3496 case DEV_CDROM_CHECK_MEDIA: {
3497 if (valp == &cdrom_sysctl_settings.check)
3498 check_media_type = cdrom_sysctl_settings.check;
3499 break;
3500 }
3501 }
3502 /* update the option flags according to the changes. we 3474 /* update the option flags according to the changes. we
3503 don't have per device options through sysctl yet, 3475 don't have per device options through sysctl yet,
3504 but we will have and then this will disappear. */ 3476 but we will have and then this will disappear. */
@@ -3511,7 +3483,6 @@ static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
3511/* Place files in /proc/sys/dev/cdrom */ 3483/* Place files in /proc/sys/dev/cdrom */
3512static ctl_table cdrom_table[] = { 3484static ctl_table cdrom_table[] = {
3513 { 3485 {
3514 .ctl_name = DEV_CDROM_INFO,
3515 .procname = "info", 3486 .procname = "info",
3516 .data = &cdrom_sysctl_settings.info, 3487 .data = &cdrom_sysctl_settings.info,
3517 .maxlen = CDROM_STR_SIZE, 3488 .maxlen = CDROM_STR_SIZE,
@@ -3519,7 +3490,6 @@ static ctl_table cdrom_table[] = {
3519 .proc_handler = &cdrom_sysctl_info, 3490 .proc_handler = &cdrom_sysctl_info,
3520 }, 3491 },
3521 { 3492 {
3522 .ctl_name = DEV_CDROM_AUTOCLOSE,
3523 .procname = "autoclose", 3493 .procname = "autoclose",
3524 .data = &cdrom_sysctl_settings.autoclose, 3494 .data = &cdrom_sysctl_settings.autoclose,
3525 .maxlen = sizeof(int), 3495 .maxlen = sizeof(int),
@@ -3527,7 +3497,6 @@ static ctl_table cdrom_table[] = {
3527 .proc_handler = &cdrom_sysctl_handler, 3497 .proc_handler = &cdrom_sysctl_handler,
3528 }, 3498 },
3529 { 3499 {
3530 .ctl_name = DEV_CDROM_AUTOEJECT,
3531 .procname = "autoeject", 3500 .procname = "autoeject",
3532 .data = &cdrom_sysctl_settings.autoeject, 3501 .data = &cdrom_sysctl_settings.autoeject,
3533 .maxlen = sizeof(int), 3502 .maxlen = sizeof(int),
@@ -3535,7 +3504,6 @@ static ctl_table cdrom_table[] = {
3535 .proc_handler = &cdrom_sysctl_handler, 3504 .proc_handler = &cdrom_sysctl_handler,
3536 }, 3505 },
3537 { 3506 {
3538 .ctl_name = DEV_CDROM_DEBUG,
3539 .procname = "debug", 3507 .procname = "debug",
3540 .data = &cdrom_sysctl_settings.debug, 3508 .data = &cdrom_sysctl_settings.debug,
3541 .maxlen = sizeof(int), 3509 .maxlen = sizeof(int),
@@ -3543,7 +3511,6 @@ static ctl_table cdrom_table[] = {
3543 .proc_handler = &cdrom_sysctl_handler, 3511 .proc_handler = &cdrom_sysctl_handler,
3544 }, 3512 },
3545 { 3513 {
3546 .ctl_name = DEV_CDROM_LOCK,
3547 .procname = "lock", 3514 .procname = "lock",
3548 .data = &cdrom_sysctl_settings.lock, 3515 .data = &cdrom_sysctl_settings.lock,
3549 .maxlen = sizeof(int), 3516 .maxlen = sizeof(int),
@@ -3551,7 +3518,6 @@ static ctl_table cdrom_table[] = {
3551 .proc_handler = &cdrom_sysctl_handler, 3518 .proc_handler = &cdrom_sysctl_handler,
3552 }, 3519 },
3553 { 3520 {
3554 .ctl_name = DEV_CDROM_CHECK_MEDIA,
3555 .procname = "check_media", 3521 .procname = "check_media",
3556 .data = &cdrom_sysctl_settings.check, 3522 .data = &cdrom_sysctl_settings.check,
3557 .maxlen = sizeof(int), 3523 .maxlen = sizeof(int),
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 204d53e506de..65491103e0fb 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -36,23 +36,6 @@ config VT
36 If unsure, say Y, or else you won't be able to do much with your new 36 If unsure, say Y, or else you won't be able to do much with your new
37 shiny Linux system :-) 37 shiny Linux system :-)
38 38
39config VT_UNICODE
40 bool "Virtual console is Unicode by default"
41 depends on VT
42 default n
43 ---help---
44 If you say Y here, the virtual terminal will be in UTF-8 by default,
45 and the keyboard will run in unicode mode.
46
47 If you say N here, the virtual terminal will not be in UTF-8 by
48 default, and the keyboard will run in XLATE mode.
49
50 This can also be changed by passing 'default_utf8=<0|1>' on the
51 kernel command line.
52
53 Historically, the kernel has defaulted to non-UTF8 and XLATE mode.
54 If unsure, say N here.
55
56config VT_CONSOLE 39config VT_CONSOLE
57 bool "Support for console on virtual terminal" if EMBEDDED 40 bool "Support for console on virtual terminal" if EMBEDDED
58 depends on VT 41 depends on VT
@@ -649,8 +632,6 @@ config HVCS
649 632
650source "drivers/char/ipmi/Kconfig" 633source "drivers/char/ipmi/Kconfig"
651 634
652source "drivers/char/watchdog/Kconfig"
653
654config DS1620 635config DS1620
655 tristate "NetWinder thermometer support" 636 tristate "NetWinder thermometer support"
656 depends on ARCH_NETWINDER 637 depends on ARCH_NETWINDER
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c
index ec116df919d9..c99e43b837f5 100644
--- a/drivers/char/apm-emulation.c
+++ b/drivers/char/apm-emulation.c
@@ -18,7 +18,7 @@
18#include <linux/apm_bios.h> 18#include <linux/apm_bios.h>
19#include <linux/capability.h> 19#include <linux/capability.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/pm.h> 21#include <linux/suspend.h>
22#include <linux/apm-emulation.h> 22#include <linux/apm-emulation.h>
23#include <linux/freezer.h> 23#include <linux/freezer.h>
24#include <linux/device.h> 24#include <linux/device.h>
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 9e0adfe27c12..d1bd0f08a331 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -359,7 +359,7 @@
359 * 359 *
360 * Revision 1.36.3.8 1996/06/07 16:29:00 bentson 360 * Revision 1.36.3.8 1996/06/07 16:29:00 bentson
361 * starting minor number at zero; added missing verify_area 361 * starting minor number at zero; added missing verify_area
362 * as noted by Heiko Eissfeldt <heiko@colossus.escape.de> 362 * as noted by Heiko Eißfeldt <heiko@colossus.escape.de>
363 * 363 *
364 * Revision 1.36.3.7 1996/04/19 21:06:18 bentson 364 * Revision 1.36.3.7 1996/04/19 21:06:18 bentson
365 * remove unneeded boot message & fix CLOCAL hardware flow 365 * remove unneeded boot message & fix CLOCAL hardware flow
@@ -662,7 +662,7 @@
662static void cy_throttle(struct tty_struct *tty); 662static void cy_throttle(struct tty_struct *tty);
663static void cy_send_xchar(struct tty_struct *tty, char ch); 663static void cy_send_xchar(struct tty_struct *tty, char ch);
664 664
665#define IS_CYC_Z(card) ((card).num_chips == -1) 665#define IS_CYC_Z(card) ((card).num_chips == (unsigned int)-1)
666 666
667#define Z_FPGA_CHECK(card) \ 667#define Z_FPGA_CHECK(card) \
668 ((readl(&((struct RUNTIME_9060 __iomem *) \ 668 ((readl(&((struct RUNTIME_9060 __iomem *) \
@@ -727,8 +727,6 @@ static struct tty_driver *cy_serial_driver;
727 driver to probe addresses at a different address, add it to 727 driver to probe addresses at a different address, add it to
728 this table. If the driver is probing some other board and 728 this table. If the driver is probing some other board and
729 causing problems, remove the offending address from this table. 729 causing problems, remove the offending address from this table.
730 The cy_setup function extracts additional addresses from the
731 boot options line. The form is "cyclades=address,address..."
732*/ 730*/
733 731
734static unsigned int cy_isa_addresses[] = { 732static unsigned int cy_isa_addresses[] = {
@@ -897,71 +895,6 @@ static inline int serial_paranoia_check(struct cyclades_port *info,
897 return 0; 895 return 0;
898} /* serial_paranoia_check */ 896} /* serial_paranoia_check */
899 897
900/*
901 * This routine is used by the interrupt handler to schedule
902 * processing in the software interrupt portion of the driver
903 * (also known as the "bottom half"). This can be called any
904 * number of times for any channel without harm.
905 */
906static inline void cy_sched_event(struct cyclades_port *info, int event)
907{
908 info->event |= 1 << event; /* remember what kind of event and who */
909 schedule_work(&info->tqueue);
910} /* cy_sched_event */
911
912/*
913 * This routine is used to handle the "bottom half" processing for the
914 * serial driver, known also the "software interrupt" processing.
915 * This processing is done at the kernel interrupt level, after the
916 * cy#/_interrupt() has returned, BUT WITH INTERRUPTS TURNED ON. This
917 * is where time-consuming activities which can not be done in the
918 * interrupt driver proper are done; the interrupt driver schedules
919 * them using cy_sched_event(), and they get done here.
920 *
921 * This is done through one level of indirection--the task queue.
922 * When a hardware interrupt service routine wants service by the
923 * driver's bottom half, it enqueues the appropriate tq_struct (one
924 * per port) to the keventd work queue and sets a request flag
925 * that the work queue be processed.
926 *
927 * Although this may seem unwieldy, it gives the system a way to
928 * pass an argument (in this case the pointer to the cyclades_port
929 * structure) to the bottom half of the driver. Previous kernels
930 * had to poll every port to see if that port needed servicing.
931 */
932static void
933do_softint(struct work_struct *work)
934{
935 struct cyclades_port *info =
936 container_of(work, struct cyclades_port, tqueue);
937 struct tty_struct *tty;
938
939 tty = info->tty;
940 if (!tty)
941 return;
942
943 if (test_and_clear_bit(Cy_EVENT_HANGUP, &info->event)) {
944 tty_hangup(info->tty);
945 wake_up_interruptible(&info->open_wait);
946 info->flags &= ~ASYNC_NORMAL_ACTIVE;
947 }
948 if (test_and_clear_bit(Cy_EVENT_OPEN_WAKEUP, &info->event))
949 wake_up_interruptible(&info->open_wait);
950#ifdef CONFIG_CYZ_INTR
951 if (test_and_clear_bit(Cy_EVENT_Z_RX_FULL, &info->event) &&
952 !timer_pending(&cyz_rx_full_timer[info->line]))
953 mod_timer(&cyz_rx_full_timer[info->line], jiffies + 1);
954#endif
955 if (test_and_clear_bit(Cy_EVENT_DELTA_WAKEUP, &info->event))
956 wake_up_interruptible(&info->delta_msr_wait);
957 tty_wakeup(tty);
958#ifdef Z_WAKE
959 if (test_and_clear_bit(Cy_EVENT_SHUTDOWN_WAKEUP, &info->event))
960 complete(&info->shutdown_wait);
961#endif
962} /* do_softint */
963
964
965/***********************************************************/ 898/***********************************************************/
966/********* Start of block of Cyclom-Y specific code ********/ 899/********* Start of block of Cyclom-Y specific code ********/
967 900
@@ -1045,382 +978,332 @@ static unsigned detect_isa_irq(void __iomem * address)
1045} 978}
1046#endif /* CONFIG_ISA */ 979#endif /* CONFIG_ISA */
1047 980
1048static void cyy_intr_chip(struct cyclades_card *cinfo, int chip, 981static void cyy_chip_rx(struct cyclades_card *cinfo, int chip,
1049 void __iomem * base_addr, int status, int index) 982 void __iomem *base_addr)
1050{ 983{
1051 struct cyclades_port *info; 984 struct cyclades_port *info;
1052 struct tty_struct *tty; 985 struct tty_struct *tty;
1053 int char_count; 986 int len, index = cinfo->bus_index;
1054 int j, len, mdm_change, mdm_status, outch; 987 u8 save_xir, channel, save_car, data, char_count;
1055 int save_xir, channel, save_car;
1056 char data;
1057 988
1058 if (status & CySRReceive) { /* reception interrupt */
1059#ifdef CY_DEBUG_INTERRUPTS 989#ifdef CY_DEBUG_INTERRUPTS
1060 printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip); 990 printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip);
1061#endif 991#endif
1062 /* determine the channel & change to that context */ 992 /* determine the channel & change to that context */
1063 spin_lock(&cinfo->card_lock); 993 save_xir = readb(base_addr + (CyRIR << index));
1064 save_xir = (u_char) readb(base_addr + (CyRIR << index)); 994 channel = save_xir & CyIRChannel;
1065 channel = (u_short) (save_xir & CyIRChannel); 995 info = &cinfo->ports[channel + chip * 4];
1066 info = &cinfo->ports[channel + chip * 4]; 996 save_car = readb(base_addr + (CyCAR << index));
1067 save_car = readb(base_addr + (CyCAR << index)); 997 cy_writeb(base_addr + (CyCAR << index), save_xir);
1068 cy_writeb(base_addr + (CyCAR << index), save_xir); 998
1069 999 /* if there is nowhere to put the data, discard it */
1070 /* if there is nowhere to put the data, discard it */ 1000 if (info->tty == NULL) {
1071 if (info->tty == NULL) { 1001 if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
1072 j = (readb(base_addr + (CyRIVR << index)) & 1002 CyIVRRxEx) { /* exception */
1073 CyIVRMask); 1003 data = readb(base_addr + (CyRDSR << index));
1074 if (j == CyIVRRxEx) { /* exception */ 1004 } else { /* normal character reception */
1005 char_count = readb(base_addr + (CyRDCR << index));
1006 while (char_count--)
1075 data = readb(base_addr + (CyRDSR << index)); 1007 data = readb(base_addr + (CyRDSR << index));
1076 } else { /* normal character reception */ 1008 }
1077 char_count = readb(base_addr + 1009 goto end;
1078 (CyRDCR << index)); 1010 }
1079 while (char_count--) { 1011 /* there is an open port for this data */
1080 data = readb(base_addr + 1012 tty = info->tty;
1081 (CyRDSR << index)); 1013 if ((readb(base_addr + (CyRIVR << index)) & CyIVRMask) ==
1082 } 1014 CyIVRRxEx) { /* exception */
1083 } 1015 data = readb(base_addr + (CyRDSR << index));
1084 } else { /* there is an open port for this data */ 1016
1085 tty = info->tty; 1017 /* For statistics only */
1086 j = (readb(base_addr + (CyRIVR << index)) & 1018 if (data & CyBREAK)
1087 CyIVRMask); 1019 info->icount.brk++;
1088 if (j == CyIVRRxEx) { /* exception */ 1020 else if (data & CyFRAME)
1089 data = readb(base_addr + (CyRDSR << index)); 1021 info->icount.frame++;
1090 1022 else if (data & CyPARITY)
1091 /* For statistics only */ 1023 info->icount.parity++;
1092 if (data & CyBREAK) 1024 else if (data & CyOVERRUN)
1093 info->icount.brk++; 1025 info->icount.overrun++;
1094 else if (data & CyFRAME) 1026
1095 info->icount.frame++; 1027 if (data & info->ignore_status_mask) {
1096 else if (data & CyPARITY) 1028 info->icount.rx++;
1097 info->icount.parity++; 1029 return;
1098 else if (data & CyOVERRUN) 1030 }
1099 info->icount.overrun++; 1031 if (tty_buffer_request_room(tty, 1)) {
1100 1032 if (data & info->read_status_mask) {
1101 if (data & info->ignore_status_mask) { 1033 if (data & CyBREAK) {
1034 tty_insert_flip_char(tty,
1035 readb(base_addr + (CyRDSR <<
1036 index)), TTY_BREAK);
1037 info->icount.rx++;
1038 if (info->flags & ASYNC_SAK)
1039 do_SAK(tty);
1040 } else if (data & CyFRAME) {
1041 tty_insert_flip_char( tty,
1042 readb(base_addr + (CyRDSR <<
1043 index)), TTY_FRAME);
1044 info->icount.rx++;
1045 info->idle_stats.frame_errs++;
1046 } else if (data & CyPARITY) {
1047 /* Pieces of seven... */
1048 tty_insert_flip_char(tty,
1049 readb(base_addr + (CyRDSR <<
1050 index)), TTY_PARITY);
1051 info->icount.rx++;
1052 info->idle_stats.parity_errs++;
1053 } else if (data & CyOVERRUN) {
1054 tty_insert_flip_char(tty, 0,
1055 TTY_OVERRUN);
1056 info->icount.rx++;
1057 /* If the flip buffer itself is
1058 overflowing, we still lose
1059 the next incoming character.
1060 */
1061 tty_insert_flip_char(tty,
1062 readb(base_addr + (CyRDSR <<
1063 index)), TTY_FRAME);
1102 info->icount.rx++; 1064 info->icount.rx++;
1103 spin_unlock(&cinfo->card_lock);
1104 return;
1105 }
1106 if (tty_buffer_request_room(tty, 1)) {
1107 if (data & info->read_status_mask) {
1108 if (data & CyBREAK) {
1109 tty_insert_flip_char(
1110 tty,
1111 readb(
1112 base_addr +
1113 (CyRDSR <<
1114 index)),
1115 TTY_BREAK);
1116 info->icount.rx++;
1117 if (info->flags &
1118 ASYNC_SAK) {
1119 do_SAK(tty);
1120 }
1121 } else if (data & CyFRAME) {
1122 tty_insert_flip_char(
1123 tty,
1124 readb(
1125 base_addr +
1126 (CyRDSR <<
1127 index)),
1128 TTY_FRAME);
1129 info->icount.rx++;
1130 info->idle_stats.
1131 frame_errs++;
1132 } else if (data & CyPARITY) {
1133 /* Pieces of seven... */
1134 tty_insert_flip_char(
1135 tty,
1136 readb(
1137 base_addr +
1138 (CyRDSR <<
1139 index)),
1140 TTY_PARITY);
1141 info->icount.rx++;
1142 info->idle_stats.
1143 parity_errs++;
1144 } else if (data & CyOVERRUN) {
1145 tty_insert_flip_char(
1146 tty, 0,
1147 TTY_OVERRUN);
1148 info->icount.rx++;
1149 /* If the flip buffer itself is
1150 overflowing, we still lose
1151 the next incoming character.
1152 */
1153 tty_insert_flip_char(
1154 tty,
1155 readb(
1156 base_addr +
1157 (CyRDSR <<
1158 index)),
1159 TTY_FRAME);
1160 info->icount.rx++;
1161 info->idle_stats.
1162 overruns++;
1163 /* These two conditions may imply */
1164 /* a normal read should be done. */
1165 /* }else if(data & CyTIMEOUT){ */
1166 /* }else if(data & CySPECHAR){ */
1167 } else {
1168 tty_insert_flip_char(
1169 tty, 0,
1170 TTY_NORMAL);
1171 info->icount.rx++;
1172 }
1173 } else {
1174 tty_insert_flip_char(tty, 0,
1175 TTY_NORMAL);
1176 info->icount.rx++;
1177 }
1178 } else {
1179 /* there was a software buffer
1180 overrun and nothing could be
1181 done about it!!! */
1182 info->icount.buf_overrun++;
1183 info->idle_stats.overruns++; 1065 info->idle_stats.overruns++;
1066 /* These two conditions may imply */
1067 /* a normal read should be done. */
1068 /* } else if(data & CyTIMEOUT) { */
1069 /* } else if(data & CySPECHAR) { */
1070 } else {
1071 tty_insert_flip_char(tty, 0,
1072 TTY_NORMAL);
1073 info->icount.rx++;
1184 } 1074 }
1185 } else { /* normal character reception */ 1075 } else {
1186 /* load # chars available from the chip */ 1076 tty_insert_flip_char(tty, 0, TTY_NORMAL);
1187 char_count = readb(base_addr + 1077 info->icount.rx++;
1188 (CyRDCR << index)); 1078 }
1079 } else {
1080 /* there was a software buffer overrun and nothing
1081 * could be done about it!!! */
1082 info->icount.buf_overrun++;
1083 info->idle_stats.overruns++;
1084 }
1085 } else { /* normal character reception */
1086 /* load # chars available from the chip */
1087 char_count = readb(base_addr + (CyRDCR << index));
1189 1088
1190#ifdef CY_ENABLE_MONITORING 1089#ifdef CY_ENABLE_MONITORING
1191 ++info->mon.int_count; 1090 ++info->mon.int_count;
1192 info->mon.char_count += char_count; 1091 info->mon.char_count += char_count;
1193 if (char_count > info->mon.char_max) 1092 if (char_count > info->mon.char_max)
1194 info->mon.char_max = char_count; 1093 info->mon.char_max = char_count;
1195 info->mon.char_last = char_count; 1094 info->mon.char_last = char_count;
1196#endif 1095#endif
1197 len = tty_buffer_request_room(tty, char_count); 1096 len = tty_buffer_request_room(tty, char_count);
1198 while (len--) { 1097 while (len--) {
1199 data = readb(base_addr + 1098 data = readb(base_addr + (CyRDSR << index));
1200 (CyRDSR << index)); 1099 tty_insert_flip_char(tty, data, TTY_NORMAL);
1201 tty_insert_flip_char(tty, data, 1100 info->idle_stats.recv_bytes++;
1202 TTY_NORMAL); 1101 info->icount.rx++;
1203 info->idle_stats.recv_bytes++;
1204 info->icount.rx++;
1205#ifdef CY_16Y_HACK 1102#ifdef CY_16Y_HACK
1206 udelay(10L); 1103 udelay(10L);
1207#endif 1104#endif
1208 }
1209 info->idle_stats.recv_idle = jiffies;
1210 }
1211 tty_schedule_flip(tty);
1212 } 1105 }
1213 /* end of service */ 1106 info->idle_stats.recv_idle = jiffies;
1214 cy_writeb(base_addr + (CyRIR << index), (save_xir & 0x3f));
1215 cy_writeb(base_addr + (CyCAR << index), (save_car));
1216 spin_unlock(&cinfo->card_lock);
1217 } 1107 }
1108 tty_schedule_flip(tty);
1109end:
1110 /* end of service */
1111 cy_writeb(base_addr + (CyRIR << index), save_xir & 0x3f);
1112 cy_writeb(base_addr + (CyCAR << index), save_car);
1113}
1114
1115static void cyy_chip_tx(struct cyclades_card *cinfo, unsigned int chip,
1116 void __iomem *base_addr)
1117{
1118 struct cyclades_port *info;
1119 int char_count, index = cinfo->bus_index;
1120 u8 save_xir, channel, save_car, outch;
1218 1121
1219 if (status & CySRTransmit) { /* transmission interrupt */ 1122 /* Since we only get here when the transmit buffer
1220 /* Since we only get here when the transmit buffer 1123 is empty, we know we can always stuff a dozen
1221 is empty, we know we can always stuff a dozen 1124 characters. */
1222 characters. */
1223#ifdef CY_DEBUG_INTERRUPTS 1125#ifdef CY_DEBUG_INTERRUPTS
1224 printk(KERN_DEBUG "cyy_interrupt: xmit intr, chip %d\n", chip); 1126 printk(KERN_DEBUG "cyy_interrupt: xmit intr, chip %d\n", chip);
1225#endif 1127#endif
1226 1128
1227 /* determine the channel & change to that context */ 1129 /* determine the channel & change to that context */
1228 spin_lock(&cinfo->card_lock); 1130 save_xir = readb(base_addr + (CyTIR << index));
1229 save_xir = (u_char) readb(base_addr + (CyTIR << index)); 1131 channel = save_xir & CyIRChannel;
1230 channel = (u_short) (save_xir & CyIRChannel); 1132 save_car = readb(base_addr + (CyCAR << index));
1231 save_car = readb(base_addr + (CyCAR << index)); 1133 cy_writeb(base_addr + (CyCAR << index), save_xir);
1232 cy_writeb(base_addr + (CyCAR << index), save_xir);
1233 1134
1234 /* validate the port# (as configured and open) */ 1135 /* validate the port# (as configured and open) */
1235 if (channel + chip * 4 >= cinfo->nports) { 1136 if (channel + chip * 4 >= cinfo->nports) {
1236 cy_writeb(base_addr + (CySRER << index), 1137 cy_writeb(base_addr + (CySRER << index),
1237 readb(base_addr + (CySRER << index)) & 1138 readb(base_addr + (CySRER << index)) & ~CyTxRdy);
1238 ~CyTxRdy); 1139 goto end;
1239 goto txend; 1140 }
1240 } 1141 info = &cinfo->ports[channel + chip * 4];
1241 info = &cinfo->ports[channel + chip * 4]; 1142 if (info->tty == NULL) {
1242 if (info->tty == NULL) { 1143 cy_writeb(base_addr + (CySRER << index),
1243 cy_writeb(base_addr + (CySRER << index), 1144 readb(base_addr + (CySRER << index)) & ~CyTxRdy);
1244 readb(base_addr + (CySRER << index)) & 1145 goto end;
1245 ~CyTxRdy); 1146 }
1246 goto txdone;
1247 }
1248 1147
1249 /* load the on-chip space for outbound data */ 1148 /* load the on-chip space for outbound data */
1250 char_count = info->xmit_fifo_size; 1149 char_count = info->xmit_fifo_size;
1251 1150
1252 if (info->x_char) { /* send special char */ 1151 if (info->x_char) { /* send special char */
1253 outch = info->x_char; 1152 outch = info->x_char;
1254 cy_writeb(base_addr + (CyTDR << index), outch); 1153 cy_writeb(base_addr + (CyTDR << index), outch);
1255 char_count--; 1154 char_count--;
1256 info->icount.tx++; 1155 info->icount.tx++;
1257 info->x_char = 0; 1156 info->x_char = 0;
1258 } 1157 }
1259 1158
1260 if (info->breakon || info->breakoff) { 1159 if (info->breakon || info->breakoff) {
1261 if (info->breakon) { 1160 if (info->breakon) {
1262 cy_writeb(base_addr + (CyTDR << index), 0); 1161 cy_writeb(base_addr + (CyTDR << index), 0);
1263 cy_writeb(base_addr + (CyTDR << index), 0x81); 1162 cy_writeb(base_addr + (CyTDR << index), 0x81);
1264 info->breakon = 0; 1163 info->breakon = 0;
1265 char_count -= 2; 1164 char_count -= 2;
1266 } 1165 }
1267 if (info->breakoff) { 1166 if (info->breakoff) {
1268 cy_writeb(base_addr + (CyTDR << index), 0); 1167 cy_writeb(base_addr + (CyTDR << index), 0);
1269 cy_writeb(base_addr + (CyTDR << index), 0x83); 1168 cy_writeb(base_addr + (CyTDR << index), 0x83);
1270 info->breakoff = 0; 1169 info->breakoff = 0;
1271 char_count -= 2; 1170 char_count -= 2;
1272 }
1273 } 1171 }
1172 }
1274 1173
1275 while (char_count-- > 0) { 1174 while (char_count-- > 0) {
1276 if (!info->xmit_cnt) { 1175 if (!info->xmit_cnt) {
1277 if (readb(base_addr + (CySRER << index)) & 1176 if (readb(base_addr + (CySRER << index)) & CyTxMpty) {
1278 CyTxMpty) { 1177 cy_writeb(base_addr + (CySRER << index),
1279 cy_writeb(base_addr + (CySRER << index), 1178 readb(base_addr + (CySRER << index)) &
1280 readb(base_addr +
1281 (CySRER << index)) &
1282 ~CyTxMpty); 1179 ~CyTxMpty);
1283 } else { 1180 } else {
1284 cy_writeb(base_addr + (CySRER << index), 1181 cy_writeb(base_addr + (CySRER << index),
1285 (readb(base_addr + 1182 (readb(base_addr + (CySRER << index)) &
1286 (CySRER << index)) &
1287 ~CyTxRdy) | CyTxMpty); 1183 ~CyTxRdy) | CyTxMpty);
1288 }
1289 goto txdone;
1290 } 1184 }
1291 if (info->xmit_buf == NULL) { 1185 goto done;
1292 cy_writeb(base_addr + (CySRER << index), 1186 }
1293 readb(base_addr + (CySRER << index)) & 1187 if (info->xmit_buf == NULL) {
1188 cy_writeb(base_addr + (CySRER << index),
1189 readb(base_addr + (CySRER << index)) &
1294 ~CyTxRdy); 1190 ~CyTxRdy);
1295 goto txdone; 1191 goto done;
1296 } 1192 }
1297 if (info->tty->stopped || info->tty->hw_stopped) { 1193 if (info->tty->stopped || info->tty->hw_stopped) {
1298 cy_writeb(base_addr + (CySRER << index), 1194 cy_writeb(base_addr + (CySRER << index),
1299 readb(base_addr + (CySRER << index)) & 1195 readb(base_addr + (CySRER << index)) &
1300 ~CyTxRdy); 1196 ~CyTxRdy);
1301 goto txdone; 1197 goto done;
1302 } 1198 }
1303 /* Because the Embedded Transmit Commands have 1199 /* Because the Embedded Transmit Commands have been enabled,
1304 been enabled, we must check to see if the 1200 * we must check to see if the escape character, NULL, is being
1305 escape character, NULL, is being sent. If it 1201 * sent. If it is, we must ensure that there is room for it to
1306 is, we must ensure that there is room for it 1202 * be doubled in the output stream. Therefore we no longer
1307 to be doubled in the output stream. Therefore 1203 * advance the pointer when the character is fetched, but
1308 we no longer advance the pointer when the 1204 * rather wait until after the check for a NULL output
1309 character is fetched, but rather wait until 1205 * character. This is necessary because there may not be room
1310 after the check for a NULL output character. 1206 * for the two chars needed to send a NULL.)
1311 This is necessary because there may not be 1207 */
1312 room for the two chars needed to send a NULL.) 1208 outch = info->xmit_buf[info->xmit_tail];
1313 */ 1209 if (outch) {
1314 outch = info->xmit_buf[info->xmit_tail]; 1210 info->xmit_cnt--;
1315 if (outch) { 1211 info->xmit_tail = (info->xmit_tail + 1) &
1212 (SERIAL_XMIT_SIZE - 1);
1213 cy_writeb(base_addr + (CyTDR << index), outch);
1214 info->icount.tx++;
1215 } else {
1216 if (char_count > 1) {
1316 info->xmit_cnt--; 1217 info->xmit_cnt--;
1317 info->xmit_tail = (info->xmit_tail + 1) & 1218 info->xmit_tail = (info->xmit_tail + 1) &
1318 (SERIAL_XMIT_SIZE - 1); 1219 (SERIAL_XMIT_SIZE - 1);
1319 cy_writeb(base_addr + (CyTDR << index), outch); 1220 cy_writeb(base_addr + (CyTDR << index), outch);
1221 cy_writeb(base_addr + (CyTDR << index), 0);
1320 info->icount.tx++; 1222 info->icount.tx++;
1321 } else { 1223 char_count--;
1322 if (char_count > 1) {
1323 info->xmit_cnt--;
1324 info->xmit_tail = (info->xmit_tail + 1)&
1325 (SERIAL_XMIT_SIZE - 1);
1326 cy_writeb(base_addr + (CyTDR << index),
1327 outch);
1328 cy_writeb(base_addr + (CyTDR << index),
1329 0);
1330 info->icount.tx++;
1331 char_count--;
1332 }
1333 } 1224 }
1334 } 1225 }
1335
1336txdone:
1337 if (info->xmit_cnt < WAKEUP_CHARS) {
1338 cy_sched_event(info, Cy_EVENT_WRITE_WAKEUP);
1339 }
1340txend:
1341 /* end of service */
1342 cy_writeb(base_addr + (CyTIR << index), (save_xir & 0x3f));
1343 cy_writeb(base_addr + (CyCAR << index), (save_car));
1344 spin_unlock(&cinfo->card_lock);
1345 } 1226 }
1346 1227
1347 if (status & CySRModem) { /* modem interrupt */ 1228done:
1229 tty_wakeup(info->tty);
1230end:
1231 /* end of service */
1232 cy_writeb(base_addr + (CyTIR << index), save_xir & 0x3f);
1233 cy_writeb(base_addr + (CyCAR << index), save_car);
1234}
1348 1235
1349 /* determine the channel & change to that context */ 1236static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
1350 spin_lock(&cinfo->card_lock); 1237 void __iomem *base_addr)
1351 save_xir = (u_char) readb(base_addr + (CyMIR << index)); 1238{
1352 channel = (u_short) (save_xir & CyIRChannel); 1239 struct cyclades_port *info;
1353 info = &cinfo->ports[channel + chip * 4]; 1240 int index = cinfo->bus_index;
1354 save_car = readb(base_addr + (CyCAR << index)); 1241 u8 save_xir, channel, save_car, mdm_change, mdm_status;
1355 cy_writeb(base_addr + (CyCAR << index), save_xir);
1356 1242
1357 mdm_change = readb(base_addr + (CyMISR << index)); 1243 /* determine the channel & change to that context */
1358 mdm_status = readb(base_addr + (CyMSVR1 << index)); 1244 save_xir = readb(base_addr + (CyMIR << index));
1245 channel = save_xir & CyIRChannel;
1246 info = &cinfo->ports[channel + chip * 4];
1247 save_car = readb(base_addr + (CyCAR << index));
1248 cy_writeb(base_addr + (CyCAR << index), save_xir);
1359 1249
1360 if (info->tty) { 1250 mdm_change = readb(base_addr + (CyMISR << index));
1361 if (mdm_change & CyANY_DELTA) { 1251 mdm_status = readb(base_addr + (CyMSVR1 << index));
1362 /* For statistics only */
1363 if (mdm_change & CyDCD)
1364 info->icount.dcd++;
1365 if (mdm_change & CyCTS)
1366 info->icount.cts++;
1367 if (mdm_change & CyDSR)
1368 info->icount.dsr++;
1369 if (mdm_change & CyRI)
1370 info->icount.rng++;
1371
1372 cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP);
1373 }
1374 1252
1375 if ((mdm_change & CyDCD) && 1253 if (!info->tty)
1376 (info->flags & ASYNC_CHECK_CD)) { 1254 goto end;
1377 if (mdm_status & CyDCD) { 1255
1378 cy_sched_event(info, 1256 if (mdm_change & CyANY_DELTA) {
1379 Cy_EVENT_OPEN_WAKEUP); 1257 /* For statistics only */
1380 } else { 1258 if (mdm_change & CyDCD)
1381 cy_sched_event(info, Cy_EVENT_HANGUP); 1259 info->icount.dcd++;
1382 } 1260 if (mdm_change & CyCTS)
1383 } 1261 info->icount.cts++;
1384 if ((mdm_change & CyCTS) && 1262 if (mdm_change & CyDSR)
1385 (info->flags & ASYNC_CTS_FLOW)) { 1263 info->icount.dsr++;
1386 if (info->tty->hw_stopped) { 1264 if (mdm_change & CyRI)
1387 if (mdm_status & CyCTS) { 1265 info->icount.rng++;
1388 /* cy_start isn't used 1266
1389 because... !!! */ 1267 wake_up_interruptible(&info->delta_msr_wait);
1390 info->tty->hw_stopped = 0; 1268 }
1391 cy_writeb(base_addr + 1269
1392 (CySRER << index), 1270 if ((mdm_change & CyDCD) && (info->flags & ASYNC_CHECK_CD)) {
1393 readb(base_addr + 1271 if (!(mdm_status & CyDCD)) {
1394 (CySRER << 1272 tty_hangup(info->tty);
1395 index))| 1273 info->flags &= ~ASYNC_NORMAL_ACTIVE;
1396 CyTxRdy); 1274 }
1397 cy_sched_event(info, 1275 wake_up_interruptible(&info->open_wait);
1398 Cy_EVENT_WRITE_WAKEUP); 1276 }
1399 } 1277 if ((mdm_change & CyCTS) && (info->flags & ASYNC_CTS_FLOW)) {
1400 } else { 1278 if (info->tty->hw_stopped) {
1401 if (!(mdm_status & CyCTS)) { 1279 if (mdm_status & CyCTS) {
1402 /* cy_stop isn't used 1280 /* cy_start isn't used
1403 because ... !!! */ 1281 because... !!! */
1404 info->tty->hw_stopped = 1; 1282 info->tty->hw_stopped = 0;
1405 cy_writeb(base_addr + 1283 cy_writeb(base_addr + (CySRER << index),
1406 (CySRER << index), 1284 readb(base_addr + (CySRER << index)) |
1407 readb(base_addr + 1285 CyTxRdy);
1408 (CySRER << 1286 tty_wakeup(info->tty);
1409 index)) &
1410 ~CyTxRdy);
1411 }
1412 }
1413 } 1287 }
1414/* if (mdm_change & CyDSR) { 1288 } else {
1289 if (!(mdm_status & CyCTS)) {
1290 /* cy_stop isn't used
1291 because ... !!! */
1292 info->tty->hw_stopped = 1;
1293 cy_writeb(base_addr + (CySRER << index),
1294 readb(base_addr + (CySRER << index)) &
1295 ~CyTxRdy);
1415 } 1296 }
1416 if (mdm_change & CyRI) {
1417 }*/
1418 } 1297 }
1419 /* end of service */
1420 cy_writeb(base_addr + (CyMIR << index), (save_xir & 0x3f));
1421 cy_writeb(base_addr + (CyCAR << index), save_car);
1422 spin_unlock(&cinfo->card_lock);
1423 } 1298 }
1299/* if (mdm_change & CyDSR) {
1300 }
1301 if (mdm_change & CyRI) {
1302 }*/
1303end:
1304 /* end of service */
1305 cy_writeb(base_addr + (CyMIR << index), save_xir & 0x3f);
1306 cy_writeb(base_addr + (CyCAR << index), save_car);
1424} 1307}
1425 1308
1426/* The real interrupt service routine is called 1309/* The real interrupt service routine is called
@@ -1432,10 +1315,8 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id)
1432 int status; 1315 int status;
1433 struct cyclades_card *cinfo = dev_id; 1316 struct cyclades_card *cinfo = dev_id;
1434 void __iomem *base_addr, *card_base_addr; 1317 void __iomem *base_addr, *card_base_addr;
1435 int chip; 1318 unsigned int chip, too_many, had_work;
1436 int index; 1319 int index;
1437 int too_many;
1438 int had_work;
1439 1320
1440 if (unlikely(cinfo == NULL)) { 1321 if (unlikely(cinfo == NULL)) {
1441#ifdef CY_DEBUG_INTERRUPTS 1322#ifdef CY_DEBUG_INTERRUPTS
@@ -1470,11 +1351,16 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id)
1470 chips to be checked in a round-robin fashion (after 1351 chips to be checked in a round-robin fashion (after
1471 draining each of a bunch (1000) of characters). 1352 draining each of a bunch (1000) of characters).
1472 */ 1353 */
1473 if (1000 < too_many++) { 1354 if (1000 < too_many++)
1474 break; 1355 break;
1475 } 1356 spin_lock(&cinfo->card_lock);
1476 cyy_intr_chip(cinfo, chip, base_addr, status, 1357 if (status & CySRReceive) /* rx intr */
1477 index); 1358 cyy_chip_rx(cinfo, chip, base_addr);
1359 if (status & CySRTransmit) /* tx intr */
1360 cyy_chip_tx(cinfo, chip, base_addr);
1361 if (status & CySRModem) /* modem intr */
1362 cyy_chip_modem(cinfo, chip, base_addr);
1363 spin_unlock(&cinfo->card_lock);
1478 } 1364 }
1479 } 1365 }
1480 } while (had_work); 1366 } while (had_work);
@@ -1529,7 +1415,7 @@ cyz_issue_cmd(struct cyclades_card *cinfo,
1529 struct ZFW_CTRL __iomem *zfw_ctrl; 1415 struct ZFW_CTRL __iomem *zfw_ctrl;
1530 struct BOARD_CTRL __iomem *board_ctrl; 1416 struct BOARD_CTRL __iomem *board_ctrl;
1531 __u32 __iomem *pci_doorbell; 1417 __u32 __iomem *pci_doorbell;
1532 int index; 1418 unsigned int index;
1533 1419
1534 firm_id = cinfo->base_addr + ID_ADDRESS; 1420 firm_id = cinfo->base_addr + ID_ADDRESS;
1535 if (!ISZLOADED(*cinfo)) { 1421 if (!ISZLOADED(*cinfo)) {
@@ -1554,13 +1440,12 @@ cyz_issue_cmd(struct cyclades_card *cinfo,
1554 return 0; 1440 return 0;
1555} /* cyz_issue_cmd */ 1441} /* cyz_issue_cmd */
1556 1442
1557static void 1443static void cyz_handle_rx(struct cyclades_port *info,
1558cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
1559 struct BUF_CTRL __iomem *buf_ctrl) 1444 struct BUF_CTRL __iomem *buf_ctrl)
1560{ 1445{
1561 struct cyclades_card *cinfo = info->card; 1446 struct cyclades_card *cinfo = info->card;
1562 struct tty_struct *tty = info->tty; 1447 struct tty_struct *tty = info->tty;
1563 int char_count; 1448 unsigned int char_count;
1564 int len; 1449 int len;
1565#ifdef BLOCKMOVE 1450#ifdef BLOCKMOVE
1566 unsigned char *buf; 1451 unsigned char *buf;
@@ -1633,9 +1518,11 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
1633 char_count = rx_put - rx_get; 1518 char_count = rx_put - rx_get;
1634 else 1519 else
1635 char_count = rx_put - rx_get + rx_bufsize; 1520 char_count = rx_put - rx_get + rx_bufsize;
1636 if (char_count >= (int)readl(&buf_ctrl->rx_threshold)) { 1521 if (char_count >= readl(&buf_ctrl->rx_threshold) &&
1637 cy_sched_event(info, Cy_EVENT_Z_RX_FULL); 1522 !timer_pending(&cyz_rx_full_timer[
1638 } 1523 info->line]))
1524 mod_timer(&cyz_rx_full_timer[info->line],
1525 jiffies + 1);
1639#endif 1526#endif
1640 info->idle_stats.recv_idle = jiffies; 1527 info->idle_stats.recv_idle = jiffies;
1641 tty_schedule_flip(tty); 1528 tty_schedule_flip(tty);
@@ -1645,14 +1532,13 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
1645 } 1532 }
1646} 1533}
1647 1534
1648static void 1535static void cyz_handle_tx(struct cyclades_port *info,
1649cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
1650 struct BUF_CTRL __iomem *buf_ctrl) 1536 struct BUF_CTRL __iomem *buf_ctrl)
1651{ 1537{
1652 struct cyclades_card *cinfo = info->card; 1538 struct cyclades_card *cinfo = info->card;
1653 struct tty_struct *tty = info->tty; 1539 struct tty_struct *tty = info->tty;
1654 char data; 1540 u8 data;
1655 int char_count; 1541 unsigned int char_count;
1656#ifdef BLOCKMOVE 1542#ifdef BLOCKMOVE
1657 int small_count; 1543 int small_count;
1658#endif 1544#endif
@@ -1717,9 +1603,7 @@ cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
1717 } 1603 }
1718#endif 1604#endif
1719ztxdone: 1605ztxdone:
1720 if (info->xmit_cnt < WAKEUP_CHARS) { 1606 tty_wakeup(tty);
1721 cy_sched_event(info, Cy_EVENT_WRITE_WAKEUP);
1722 }
1723 /* Update tx_put */ 1607 /* Update tx_put */
1724 cy_writel(&buf_ctrl->tx_put, tx_put); 1608 cy_writel(&buf_ctrl->tx_put, tx_put);
1725 } 1609 }
@@ -1781,10 +1665,11 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1781 if ((fw_ver > 241 ? ((u_long) param) : 1665 if ((fw_ver > 241 ? ((u_long) param) :
1782 readl(&ch_ctrl->rs_status)) & 1666 readl(&ch_ctrl->rs_status)) &
1783 C_RS_DCD) { 1667 C_RS_DCD) {
1784 cy_sched_event(info, 1668 wake_up_interruptible(&info->open_wait);
1785 Cy_EVENT_OPEN_WAKEUP);
1786 } else { 1669 } else {
1787 cy_sched_event(info, Cy_EVENT_HANGUP); 1670 tty_hangup(info->tty);
1671 wake_up_interruptible(&info->open_wait);
1672 info->flags &= ~ASYNC_NORMAL_ACTIVE;
1788 } 1673 }
1789 } 1674 }
1790 break; 1675 break;
@@ -1802,7 +1687,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1802 break; 1687 break;
1803#ifdef Z_WAKE 1688#ifdef Z_WAKE
1804 case C_CM_IOCTLW: 1689 case C_CM_IOCTLW:
1805 cy_sched_event(info, Cy_EVENT_SHUTDOWN_WAKEUP); 1690 complete(&info->shutdown_wait);
1806 break; 1691 break;
1807#endif 1692#endif
1808#ifdef CONFIG_CYZ_INTR 1693#ifdef CONFIG_CYZ_INTR
@@ -1814,7 +1699,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1814 printk(KERN_DEBUG "cyz_interrupt: rcvd intr, card %d, " 1699 printk(KERN_DEBUG "cyz_interrupt: rcvd intr, card %d, "
1815 "port %ld\n", info->card, channel); 1700 "port %ld\n", info->card, channel);
1816#endif 1701#endif
1817 cyz_handle_rx(info, ch_ctrl, buf_ctrl); 1702 cyz_handle_rx(info, buf_ctrl);
1818 break; 1703 break;
1819 case C_CM_TXBEMPTY: 1704 case C_CM_TXBEMPTY:
1820 case C_CM_TXLOWWM: 1705 case C_CM_TXLOWWM:
@@ -1824,7 +1709,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1824 printk(KERN_DEBUG "cyz_interrupt: xmit intr, card %d, " 1709 printk(KERN_DEBUG "cyz_interrupt: xmit intr, card %d, "
1825 "port %ld\n", info->card, channel); 1710 "port %ld\n", info->card, channel);
1826#endif 1711#endif
1827 cyz_handle_tx(info, ch_ctrl, buf_ctrl); 1712 cyz_handle_tx(info, buf_ctrl);
1828 break; 1713 break;
1829#endif /* CONFIG_CYZ_INTR */ 1714#endif /* CONFIG_CYZ_INTR */
1830 case C_CM_FATAL: 1715 case C_CM_FATAL:
@@ -1834,7 +1719,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
1834 break; 1719 break;
1835 } 1720 }
1836 if (delta_count) 1721 if (delta_count)
1837 cy_sched_event(info, Cy_EVENT_DELTA_WAKEUP); 1722 wake_up_interruptible(&info->delta_msr_wait);
1838 if (special_count) 1723 if (special_count)
1839 tty_schedule_flip(tty); 1724 tty_schedule_flip(tty);
1840 } 1725 }
@@ -1893,10 +1778,9 @@ static void cyz_poll(unsigned long arg)
1893 struct FIRM_ID __iomem *firm_id; 1778 struct FIRM_ID __iomem *firm_id;
1894 struct ZFW_CTRL __iomem *zfw_ctrl; 1779 struct ZFW_CTRL __iomem *zfw_ctrl;
1895 struct BOARD_CTRL __iomem *board_ctrl; 1780 struct BOARD_CTRL __iomem *board_ctrl;
1896 struct CH_CTRL __iomem *ch_ctrl;
1897 struct BUF_CTRL __iomem *buf_ctrl; 1781 struct BUF_CTRL __iomem *buf_ctrl;
1898 unsigned long expires = jiffies + HZ; 1782 unsigned long expires = jiffies + HZ;
1899 int card, port; 1783 unsigned int port, card;
1900 1784
1901 for (card = 0; card < NR_CARDS; card++) { 1785 for (card = 0; card < NR_CARDS; card++) {
1902 cinfo = &cy_card[card]; 1786 cinfo = &cy_card[card];
@@ -1923,12 +1807,11 @@ static void cyz_poll(unsigned long arg)
1923 for (port = 0; port < cinfo->nports; port++) { 1807 for (port = 0; port < cinfo->nports; port++) {
1924 info = &cinfo->ports[port]; 1808 info = &cinfo->ports[port];
1925 tty = info->tty; 1809 tty = info->tty;
1926 ch_ctrl = &(zfw_ctrl->ch_ctrl[port]);
1927 buf_ctrl = &(zfw_ctrl->buf_ctrl[port]); 1810 buf_ctrl = &(zfw_ctrl->buf_ctrl[port]);
1928 1811
1929 if (!info->throttle) 1812 if (!info->throttle)
1930 cyz_handle_rx(info, ch_ctrl, buf_ctrl); 1813 cyz_handle_rx(info, buf_ctrl);
1931 cyz_handle_tx(info, ch_ctrl, buf_ctrl); 1814 cyz_handle_tx(info, buf_ctrl);
1932 } 1815 }
1933 /* poll every 'cyz_polling_cycle' period */ 1816 /* poll every 'cyz_polling_cycle' period */
1934 expires = jiffies + cyz_polling_cycle; 1817 expires = jiffies + cyz_polling_cycle;
@@ -2491,11 +2374,11 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
2491static int cy_open(struct tty_struct *tty, struct file *filp) 2374static int cy_open(struct tty_struct *tty, struct file *filp)
2492{ 2375{
2493 struct cyclades_port *info; 2376 struct cyclades_port *info;
2494 unsigned int i; 2377 unsigned int i, line;
2495 int retval, line; 2378 int retval;
2496 2379
2497 line = tty->index; 2380 line = tty->index;
2498 if ((line < 0) || (NR_PORTS <= line)) { 2381 if ((tty->index < 0) || (NR_PORTS <= line)) {
2499 return -ENODEV; 2382 return -ENODEV;
2500 } 2383 }
2501 for (i = 0; i < NR_CARDS; i++) 2384 for (i = 0; i < NR_CARDS; i++)
@@ -2812,7 +2695,6 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
2812 spin_lock_irqsave(&card->card_lock, flags); 2695 spin_lock_irqsave(&card->card_lock, flags);
2813 2696
2814 tty->closing = 0; 2697 tty->closing = 0;
2815 info->event = 0;
2816 info->tty = NULL; 2698 info->tty = NULL;
2817 if (info->blocked_open) { 2699 if (info->blocked_open) {
2818 spin_unlock_irqrestore(&card->card_lock, flags); 2700 spin_unlock_irqrestore(&card->card_lock, flags);
@@ -4444,7 +4326,6 @@ static void cy_hangup(struct tty_struct *tty)
4444 4326
4445 cy_flush_buffer(tty); 4327 cy_flush_buffer(tty);
4446 shutdown(info); 4328 shutdown(info);
4447 info->event = 0;
4448 info->count = 0; 4329 info->count = 0;
4449#ifdef CY_DEBUG_COUNT 4330#ifdef CY_DEBUG_COUNT
4450 printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n", 4331 printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n",
@@ -4467,9 +4348,9 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4467{ 4348{
4468 struct cyclades_port *info; 4349 struct cyclades_port *info;
4469 u32 uninitialized_var(mailbox); 4350 u32 uninitialized_var(mailbox);
4470 unsigned int nports; 4351 unsigned int nports, port;
4471 unsigned short chip_number; 4352 unsigned short chip_number;
4472 int uninitialized_var(index), port; 4353 int uninitialized_var(index);
4473 4354
4474 spin_lock_init(&cinfo->card_lock); 4355 spin_lock_init(&cinfo->card_lock);
4475 4356
@@ -4502,7 +4383,6 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
4502 info->closing_wait = CLOSING_WAIT_DELAY; 4383 info->closing_wait = CLOSING_WAIT_DELAY;
4503 info->close_delay = 5 * HZ / 10; 4384 info->close_delay = 5 * HZ / 10;
4504 4385
4505 INIT_WORK(&info->tqueue, do_softint);
4506 init_waitqueue_head(&info->open_wait); 4386 init_waitqueue_head(&info->open_wait);
4507 init_waitqueue_head(&info->close_wait); 4387 init_waitqueue_head(&info->close_wait);
4508 init_completion(&info->shutdown_wait); 4388 init_completion(&info->shutdown_wait);
@@ -5236,7 +5116,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
5236 } 5116 }
5237 } 5117 }
5238#endif /* CONFIG_CYZ_INTR */ 5118#endif /* CONFIG_CYZ_INTR */
5239 cy_card[card_no].num_chips = -1; 5119 cy_card[card_no].num_chips = (unsigned int)-1;
5240 } 5120 }
5241 5121
5242 /* set cy_card */ 5122 /* set cy_card */
@@ -5480,13 +5360,13 @@ static int __init cy_init(void)
5480#ifdef CONFIG_PCI 5360#ifdef CONFIG_PCI
5481 /* look for pci boards */ 5361 /* look for pci boards */
5482 retval = pci_register_driver(&cy_pci_driver); 5362 retval = pci_register_driver(&cy_pci_driver);
5483 if (retval && !nboards) 5363 if (retval && !nboards) {
5484 goto err_unr; 5364 tty_unregister_driver(cy_serial_driver);
5365 goto err_frtty;
5366 }
5485#endif 5367#endif
5486 5368
5487 return 0; 5369 return 0;
5488err_unr:
5489 tty_unregister_driver(cy_serial_driver);
5490err_frtty: 5370err_frtty:
5491 put_tty_driver(cy_serial_driver); 5371 put_tty_driver(cy_serial_driver);
5492err: 5372err:
@@ -5496,7 +5376,7 @@ err:
5496static void __exit cy_cleanup_module(void) 5376static void __exit cy_cleanup_module(void)
5497{ 5377{
5498 struct cyclades_card *card; 5378 struct cyclades_card *card;
5499 int i, e1; 5379 unsigned int i, e1;
5500 5380
5501#ifndef CONFIG_CYZ_INTR 5381#ifndef CONFIG_CYZ_INTR
5502 del_timer_sync(&cyz_timerlist); 5382 del_timer_sync(&cyz_timerlist);
@@ -5524,8 +5404,7 @@ static void __exit cy_cleanup_module(void)
5524#endif /* CONFIG_CYZ_INTR */ 5404#endif /* CONFIG_CYZ_INTR */
5525 ) 5405 )
5526 free_irq(card->irq, card); 5406 free_irq(card->irq, card);
5527 for (e1 = card->first_line; 5407 for (e1 = card->first_line; e1 < card->first_line +
5528 e1 < card->first_line +
5529 card->nports; e1++) 5408 card->nports; e1++)
5530 tty_unregister_device(cy_serial_driver, e1); 5409 tty_unregister_device(cy_serial_driver, e1);
5531 kfree(card->ports); 5410 kfree(card->ports);
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index 856774fbe025..d24a6c2c2c24 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -1456,7 +1456,7 @@ int drm_freebufs(struct drm_device *dev, void *data,
1456 buf = dma->buflist[idx]; 1456 buf = dma->buflist[idx];
1457 if (buf->file_priv != file_priv) { 1457 if (buf->file_priv != file_priv) {
1458 DRM_ERROR("Process %d freeing buffer not owned\n", 1458 DRM_ERROR("Process %d freeing buffer not owned\n",
1459 current->pid); 1459 task_pid_nr(current));
1460 return -EINVAL; 1460 return -EINVAL;
1461 } 1461 }
1462 drm_free_buffer(dev, buf); 1462 drm_free_buffer(dev, buf);
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index 72668b15e5ce..44a46268b02b 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -463,7 +463,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
463 ++file_priv->ioctl_count; 463 ++file_priv->ioctl_count;
464 464
465 DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", 465 DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
466 current->pid, cmd, nr, 466 task_pid_nr(current), cmd, nr,
467 (long)old_encode_dev(file_priv->head->device), 467 (long)old_encode_dev(file_priv->head->device),
468 file_priv->authenticated); 468 file_priv->authenticated);
469 469
diff --git a/drivers/char/drm/drm_fops.c b/drivers/char/drm/drm_fops.c
index f383fc37190c..3992f73299cc 100644
--- a/drivers/char/drm/drm_fops.c
+++ b/drivers/char/drm/drm_fops.c
@@ -234,7 +234,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
234 if (!drm_cpu_valid()) 234 if (!drm_cpu_valid())
235 return -EINVAL; 235 return -EINVAL;
236 236
237 DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); 237 DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor);
238 238
239 priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); 239 priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES);
240 if (!priv) 240 if (!priv)
@@ -244,7 +244,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
244 filp->private_data = priv; 244 filp->private_data = priv;
245 priv->filp = filp; 245 priv->filp = filp;
246 priv->uid = current->euid; 246 priv->uid = current->euid;
247 priv->pid = current->pid; 247 priv->pid = task_pid_nr(current);
248 priv->minor = minor; 248 priv->minor = minor;
249 priv->head = drm_heads[minor]; 249 priv->head = drm_heads[minor];
250 priv->ioctl_count = 0; 250 priv->ioctl_count = 0;
@@ -339,7 +339,8 @@ int drm_release(struct inode *inode, struct file *filp)
339 */ 339 */
340 340
341 DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", 341 DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
342 current->pid, (long)old_encode_dev(file_priv->head->device), 342 task_pid_nr(current),
343 (long)old_encode_dev(file_priv->head->device),
343 dev->open_count); 344 dev->open_count);
344 345
345 if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) { 346 if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
diff --git a/drivers/char/drm/drm_hashtab.c b/drivers/char/drm/drm_hashtab.c
index 3ad319070704..4b8e7db5a232 100644
--- a/drivers/char/drm/drm_hashtab.c
+++ b/drivers/char/drm/drm_hashtab.c
@@ -29,7 +29,7 @@
29 * Simple open hash tab implementation. 29 * Simple open hash tab implementation.
30 * 30 *
31 * Authors: 31 * Authors:
32 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 32 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
33 */ 33 */
34 34
35#include "drmP.h" 35#include "drmP.h"
diff --git a/drivers/char/drm/drm_hashtab.h b/drivers/char/drm/drm_hashtab.h
index 0f1376774168..573e333ac457 100644
--- a/drivers/char/drm/drm_hashtab.h
+++ b/drivers/char/drm/drm_hashtab.h
@@ -29,7 +29,7 @@
29 * Simple open hash tab implementation. 29 * Simple open hash tab implementation.
30 * 30 *
31 * Authors: 31 * Authors:
32 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 32 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
33 */ 33 */
34 34
35#ifndef DRM_HASHTAB_H 35#ifndef DRM_HASHTAB_H
diff --git a/drivers/char/drm/drm_lock.c b/drivers/char/drm/drm_lock.c
index c6b73e744d67..bea2a7d5b2b2 100644
--- a/drivers/char/drm/drm_lock.c
+++ b/drivers/char/drm/drm_lock.c
@@ -58,12 +58,12 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
58 58
59 if (lock->context == DRM_KERNEL_CONTEXT) { 59 if (lock->context == DRM_KERNEL_CONTEXT) {
60 DRM_ERROR("Process %d using kernel context %d\n", 60 DRM_ERROR("Process %d using kernel context %d\n",
61 current->pid, lock->context); 61 task_pid_nr(current), lock->context);
62 return -EINVAL; 62 return -EINVAL;
63 } 63 }
64 64
65 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", 65 DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
66 lock->context, current->pid, 66 lock->context, task_pid_nr(current),
67 dev->lock.hw_lock->lock, lock->flags); 67 dev->lock.hw_lock->lock, lock->flags);
68 68
69 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)) 69 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
@@ -153,7 +153,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
153 153
154 if (lock->context == DRM_KERNEL_CONTEXT) { 154 if (lock->context == DRM_KERNEL_CONTEXT) {
155 DRM_ERROR("Process %d using kernel context %d\n", 155 DRM_ERROR("Process %d using kernel context %d\n",
156 current->pid, lock->context); 156 task_pid_nr(current), lock->context);
157 return -EINVAL; 157 return -EINVAL;
158 } 158 }
159 159
diff --git a/drivers/char/drm/drm_mm.c b/drivers/char/drm/drm_mm.c
index 3e6bc14f7441..86f4eb61a6a4 100644
--- a/drivers/char/drm/drm_mm.c
+++ b/drivers/char/drm/drm_mm.c
@@ -38,7 +38,7 @@
38 * Aligned allocations can also see improvement. 38 * Aligned allocations can also see improvement.
39 * 39 *
40 * Authors: 40 * Authors:
41 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 41 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
42 */ 42 */
43 43
44#include "drmP.h" 44#include "drmP.h"
diff --git a/drivers/char/drm/drm_os_linux.h b/drivers/char/drm/drm_os_linux.h
index 114e54e0f61b..76e44ac94fb5 100644
--- a/drivers/char/drm/drm_os_linux.h
+++ b/drivers/char/drm/drm_os_linux.h
@@ -7,7 +7,7 @@
7#include <linux/delay.h> 7#include <linux/delay.h>
8 8
9/** Current process ID */ 9/** Current process ID */
10#define DRM_CURRENTPID current->pid 10#define DRM_CURRENTPID task_pid_nr(current)
11#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) 11#define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
12#define DRM_UDELAY(d) udelay(d) 12#define DRM_UDELAY(d) udelay(d)
13/** Read a byte from a MMIO region */ 13/** Read a byte from a MMIO region */
diff --git a/drivers/char/drm/drm_pci.c b/drivers/char/drm/drm_pci.c
index e292bb0eaca2..b55d5bc6ea61 100644
--- a/drivers/char/drm/drm_pci.c
+++ b/drivers/char/drm/drm_pci.c
@@ -8,12 +8,12 @@
8 * \todo Implement the remaining ioctl's for the PCI pools. 8 * \todo Implement the remaining ioctl's for the PCI pools.
9 * \todo The wrappers here are so thin that they would be better off inlined.. 9 * \todo The wrappers here are so thin that they would be better off inlined..
10 * 10 *
11 * \author Jose Fonseca <jrfonseca@tungstengraphics.com> 11 * \author José Fonseca <jrfonseca@tungstengraphics.com>
12 * \author Leif Delgass <ldelgass@retinalburn.net> 12 * \author Leif Delgass <ldelgass@retinalburn.net>
13 */ 13 */
14 14
15/* 15/*
16 * Copyright 2003 Jos�Fonseca. 16 * Copyright 2003 José Fonseca.
17 * Copyright 2003 Leif Delgass. 17 * Copyright 2003 Leif Delgass.
18 * All Rights Reserved. 18 * All Rights Reserved.
19 * 19 *
diff --git a/drivers/char/drm/drm_sarea.h b/drivers/char/drm/drm_sarea.h
index f5466966081e..e040f47f369f 100644
--- a/drivers/char/drm/drm_sarea.h
+++ b/drivers/char/drm/drm_sarea.h
@@ -2,7 +2,7 @@
2 * \file drm_sarea.h 2 * \file drm_sarea.h
3 * \brief SAREA definitions 3 * \brief SAREA definitions
4 * 4 *
5 * \author Michel Dänzer <michel@daenzer.net> 5 * \author Michel Dänzer <michel@daenzer.net>
6 */ 6 */
7 7
8/* 8/*
diff --git a/drivers/char/drm/drm_sman.c b/drivers/char/drm/drm_sman.c
index 8421a93946d8..926f146390ce 100644
--- a/drivers/char/drm/drm_sman.c
+++ b/drivers/char/drm/drm_sman.c
@@ -33,7 +33,7 @@
33 * struct or a context identifier. 33 * struct or a context identifier.
34 * 34 *
35 * Authors: 35 * Authors:
36 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 36 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
37 */ 37 */
38 38
39#include "drm_sman.h" 39#include "drm_sman.h"
diff --git a/drivers/char/drm/drm_sman.h b/drivers/char/drm/drm_sman.h
index 39a39fefeef1..08ecf83ad5d4 100644
--- a/drivers/char/drm/drm_sman.h
+++ b/drivers/char/drm/drm_sman.h
@@ -33,7 +33,7 @@
33 * struct or a context identifier. 33 * struct or a context identifier.
34 * 34 *
35 * Authors: 35 * Authors:
36 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 36 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
37 */ 37 */
38 38
39#ifndef DRM_SMAN_H 39#ifndef DRM_SMAN_H
diff --git a/drivers/char/drm/i810_dma.c b/drivers/char/drm/i810_dma.c
index 8e841bdee6dc..eb381a7c5bee 100644
--- a/drivers/char/drm/i810_dma.c
+++ b/drivers/char/drm/i810_dma.c
@@ -1024,7 +1024,7 @@ static int i810_getbuf(struct drm_device *dev, void *data,
1024 retcode = i810_dma_get_buffer(dev, d, file_priv); 1024 retcode = i810_dma_get_buffer(dev, d, file_priv);
1025 1025
1026 DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n", 1026 DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n",
1027 current->pid, retcode, d->granted); 1027 task_pid_nr(current), retcode, d->granted);
1028 1028
1029 sarea_priv->last_dispatch = (int)hw_status[5]; 1029 sarea_priv->last_dispatch = (int)hw_status[5];
1030 1030
diff --git a/drivers/char/drm/i830_dma.c b/drivers/char/drm/i830_dma.c
index 43a1f78712d6..69a363edb0d2 100644
--- a/drivers/char/drm/i830_dma.c
+++ b/drivers/char/drm/i830_dma.c
@@ -1409,7 +1409,7 @@ static int i830_getbuf(struct drm_device *dev, void *data,
1409 retcode = i830_dma_get_buffer(dev, d, file_priv); 1409 retcode = i830_dma_get_buffer(dev, d, file_priv);
1410 1410
1411 DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n", 1411 DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n",
1412 current->pid, retcode, d->granted); 1412 task_pid_nr(current), retcode, d->granted);
1413 1413
1414 sarea_priv->last_dispatch = (int)hw_status[5]; 1414 sarea_priv->last_dispatch = (int)hw_status[5];
1415 1415
diff --git a/drivers/char/drm/r128_drv.h b/drivers/char/drm/r128_drv.h
index 250d2aa46581..5041bd8dbed8 100644
--- a/drivers/char/drm/r128_drv.h
+++ b/drivers/char/drm/r128_drv.h
@@ -29,7 +29,7 @@
29 * Rickard E. (Rik) Faith <faith@valinux.com> 29 * Rickard E. (Rik) Faith <faith@valinux.com>
30 * Kevin E. Martin <martin@valinux.com> 30 * Kevin E. Martin <martin@valinux.com>
31 * Gareth Hughes <gareth@valinux.com> 31 * Gareth Hughes <gareth@valinux.com>
32 * Michel D�zer <daenzerm@student.ethz.ch> 32 * Michel Dänzer <daenzerm@student.ethz.ch>
33 */ 33 */
34 34
35#ifndef __R128_DRV_H__ 35#ifndef __R128_DRV_H__
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c
index 2b2407ee490e..84f5bc36252b 100644
--- a/drivers/char/drm/radeon_irq.c
+++ b/drivers/char/drm/radeon_irq.c
@@ -27,7 +27,7 @@
27 * 27 *
28 * Authors: 28 * Authors:
29 * Keith Whitwell <keith@tungstengraphics.com> 29 * Keith Whitwell <keith@tungstengraphics.com>
30 * Michel D�zer <michel@daenzer.net> 30 * Michel Dänzer <michel@daenzer.net>
31 */ 31 */
32 32
33#include "drmP.h" 33#include "drmP.h"
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index 69c9f2febf43..f824f2f5fdc2 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -3005,7 +3005,7 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
3005 /* 3005 /*
3006 * This ioctl() doesn't work on 64-bit platforms because hw_lock is a 3006 * This ioctl() doesn't work on 64-bit platforms because hw_lock is a
3007 * pointer which can't fit into an int-sized variable. According to 3007 * pointer which can't fit into an int-sized variable. According to
3008 * Michel Dänzer, the ioctl() is only used on embedded platforms, so 3008 * Michel Dänzer, the ioctl() is only used on embedded platforms, so
3009 * not supporting it shouldn't be a problem. If the same functionality 3009 * not supporting it shouldn't be a problem. If the same functionality
3010 * is needed on 64-bit platforms, a new ioctl() would have to be added, 3010 * is needed on 64-bit platforms, a new ioctl() would have to be added,
3011 * so backwards-compatibility for the embedded platforms can be 3011 * so backwards-compatibility for the embedded platforms can be
diff --git a/drivers/char/drm/sis_mm.c b/drivers/char/drm/sis_mm.c
index 8c66838ff515..6be1c5757580 100644
--- a/drivers/char/drm/sis_mm.c
+++ b/drivers/char/drm/sis_mm.c
@@ -28,7 +28,7 @@
28 28
29/* 29/*
30 * Authors: 30 * Authors:
31 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 31 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
32 */ 32 */
33 33
34#include "drmP.h" 34#include "drmP.h"
diff --git a/drivers/char/drm/via_mm.c b/drivers/char/drm/via_mm.c
index 9afc1684348d..3ffbf8649833 100644
--- a/drivers/char/drm/via_mm.c
+++ b/drivers/char/drm/via_mm.c
@@ -22,7 +22,7 @@
22 * DEALINGS IN THE SOFTWARE. 22 * DEALINGS IN THE SOFTWARE.
23 */ 23 */
24/* 24/*
25 * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com> 25 * Authors: Thomas Hellström <thomas-at-tungstengraphics-dot-com>
26 */ 26 */
27 27
28#include "drmP.h" 28#include "drmP.h"
diff --git a/drivers/char/drm/via_verifier.h b/drivers/char/drm/via_verifier.h
index 28b50296a7bd..d6f8214b69f5 100644
--- a/drivers/char/drm/via_verifier.h
+++ b/drivers/char/drm/via_verifier.h
@@ -20,7 +20,7 @@
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE. 21 * DEALINGS IN THE SOFTWARE.
22 * 22 *
23 * Author: Thomas Hellström 2004. 23 * Author: Thomas Hellström 2004.
24 */ 24 */
25 25
26#ifndef _VIA_VERIFIER_H_ 26#ifndef _VIA_VERIFIER_H_
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index 2e7ae42a5503..28607763ae64 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -19,7 +19,7 @@
19 * 19 *
20 * rs_set_termios fixed to look also for changes of the input 20 * rs_set_termios fixed to look also for changes of the input
21 * flags INPCK, BRKINT, PARMRK, IGNPAR and IGNBRK. 21 * flags INPCK, BRKINT, PARMRK, IGNPAR and IGNBRK.
22 * Bernd Anh�pl 05/17/96. 22 * Bernd Anhäupl 05/17/96.
23 * 23 *
24 * --- End of notices from serial.c --- 24 * --- End of notices from serial.c ---
25 * 25 *
@@ -58,10 +58,10 @@
58#include <linux/mm.h> 58#include <linux/mm.h>
59#include <linux/init.h> 59#include <linux/init.h>
60#include <linux/delay.h> 60#include <linux/delay.h>
61#include <linux/bitops.h>
61 62
62#include <asm/system.h> 63#include <asm/system.h>
63#include <asm/io.h> 64#include <asm/io.h>
64#include <asm/bitops.h>
65 65
66#include <asm/dma.h> 66#include <asm/dma.h>
67#include <linux/slab.h> 67#include <linux/slab.h>
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index e13dd1892bfd..3f35a1c562b1 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -10,7 +10,7 @@
10 * Mostly based on original driver: 10 * Mostly based on original driver:
11 * 11 *
12 * Copyright (C) 2005 Nokia Corporation 12 * Copyright (C) 2005 Nokia Corporation
13 * Author: Juha Yrj��<juha.yrjola@nokia.com> 13 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
14 * 14 *
15 * This file is licensed under the terms of the GNU General Public 15 * This file is licensed under the terms of the GNU General Public
16 * License version 2. This program is licensed "as is" without any 16 * License version 2. This program is licensed "as is" without any
diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c
index cd406416effd..30e564516422 100644
--- a/drivers/char/i8k.c
+++ b/drivers/char/i8k.c
@@ -371,14 +371,14 @@ static int i8k_proc_show(struct seq_file *seq, void *offset)
371 int fn_key, cpu_temp, ac_power; 371 int fn_key, cpu_temp, ac_power;
372 int left_fan, right_fan, left_speed, right_speed; 372 int left_fan, right_fan, left_speed, right_speed;
373 373
374 cpu_temp = i8k_get_temp(0); /* 11100 µs */ 374 cpu_temp = i8k_get_temp(0); /* 11100 µs */
375 left_fan = i8k_get_fan_status(I8K_FAN_LEFT); /* 580 µs */ 375 left_fan = i8k_get_fan_status(I8K_FAN_LEFT); /* 580 µs */
376 right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); /* 580 µs */ 376 right_fan = i8k_get_fan_status(I8K_FAN_RIGHT); /* 580 µs */
377 left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); /* 580 µs */ 377 left_speed = i8k_get_fan_speed(I8K_FAN_LEFT); /* 580 µs */
378 right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); /* 580 µs */ 378 right_speed = i8k_get_fan_speed(I8K_FAN_RIGHT); /* 580 µs */
379 fn_key = i8k_get_fn_status(); /* 750 µs */ 379 fn_key = i8k_get_fn_status(); /* 750 µs */
380 if (power_status) 380 if (power_status)
381 ac_power = i8k_get_power_status(); /* 14700 µs */ 381 ac_power = i8k_get_power_status(); /* 14700 µs */
382 else 382 else
383 ac_power = -1; 383 ac_power = -1;
384 384
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 8435fba73daf..5dc1265ce1d5 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -221,10 +221,8 @@ struct ipmi_smi
221 void *send_info; 221 void *send_info;
222 222
223#ifdef CONFIG_PROC_FS 223#ifdef CONFIG_PROC_FS
224 /* A list of proc entries for this interface. This does not 224 /* A list of proc entries for this interface. */
225 need a lock, only one thread creates it and only one thread 225 struct mutex proc_entry_lock;
226 destroys it. */
227 spinlock_t proc_entry_lock;
228 struct ipmi_proc_entry *proc_entries; 226 struct ipmi_proc_entry *proc_entries;
229#endif 227#endif
230 228
@@ -1891,11 +1889,11 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
1891 file->write_proc = write_proc; 1889 file->write_proc = write_proc;
1892 file->owner = owner; 1890 file->owner = owner;
1893 1891
1894 spin_lock(&smi->proc_entry_lock); 1892 mutex_lock(&smi->proc_entry_lock);
1895 /* Stick it on the list. */ 1893 /* Stick it on the list. */
1896 entry->next = smi->proc_entries; 1894 entry->next = smi->proc_entries;
1897 smi->proc_entries = entry; 1895 smi->proc_entries = entry;
1898 spin_unlock(&smi->proc_entry_lock); 1896 mutex_unlock(&smi->proc_entry_lock);
1899 } 1897 }
1900#endif /* CONFIG_PROC_FS */ 1898#endif /* CONFIG_PROC_FS */
1901 1899
@@ -1939,7 +1937,7 @@ static void remove_proc_entries(ipmi_smi_t smi)
1939#ifdef CONFIG_PROC_FS 1937#ifdef CONFIG_PROC_FS
1940 struct ipmi_proc_entry *entry; 1938 struct ipmi_proc_entry *entry;
1941 1939
1942 spin_lock(&smi->proc_entry_lock); 1940 mutex_lock(&smi->proc_entry_lock);
1943 while (smi->proc_entries) { 1941 while (smi->proc_entries) {
1944 entry = smi->proc_entries; 1942 entry = smi->proc_entries;
1945 smi->proc_entries = entry->next; 1943 smi->proc_entries = entry->next;
@@ -1948,7 +1946,7 @@ static void remove_proc_entries(ipmi_smi_t smi)
1948 kfree(entry->name); 1946 kfree(entry->name);
1949 kfree(entry); 1947 kfree(entry);
1950 } 1948 }
1951 spin_unlock(&smi->proc_entry_lock); 1949 mutex_unlock(&smi->proc_entry_lock);
1952 remove_proc_entry(smi->proc_dir_name, proc_ipmi_root); 1950 remove_proc_entry(smi->proc_dir_name, proc_ipmi_root);
1953#endif /* CONFIG_PROC_FS */ 1951#endif /* CONFIG_PROC_FS */
1954} 1952}
@@ -2614,6 +2612,14 @@ channel_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
2614 return; 2612 return;
2615} 2613}
2616 2614
2615void ipmi_poll_interface(ipmi_user_t user)
2616{
2617 ipmi_smi_t intf = user->intf;
2618
2619 if (intf->handlers->poll)
2620 intf->handlers->poll(intf->send_info);
2621}
2622
2617int ipmi_register_smi(struct ipmi_smi_handlers *handlers, 2623int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
2618 void *send_info, 2624 void *send_info,
2619 struct ipmi_device_id *device_id, 2625 struct ipmi_device_id *device_id,
@@ -2671,7 +2677,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
2671 } 2677 }
2672 intf->curr_seq = 0; 2678 intf->curr_seq = 0;
2673#ifdef CONFIG_PROC_FS 2679#ifdef CONFIG_PROC_FS
2674 spin_lock_init(&intf->proc_entry_lock); 2680 mutex_init(&intf->proc_entry_lock);
2675#endif 2681#endif
2676 spin_lock_init(&intf->waiting_msgs_lock); 2682 spin_lock_init(&intf->waiting_msgs_lock);
2677 INIT_LIST_HEAD(&intf->waiting_msgs); 2683 INIT_LIST_HEAD(&intf->waiting_msgs);
@@ -4166,6 +4172,7 @@ EXPORT_SYMBOL(ipmi_destroy_user);
4166EXPORT_SYMBOL(ipmi_get_version); 4172EXPORT_SYMBOL(ipmi_get_version);
4167EXPORT_SYMBOL(ipmi_request_settime); 4173EXPORT_SYMBOL(ipmi_request_settime);
4168EXPORT_SYMBOL(ipmi_request_supply_msgs); 4174EXPORT_SYMBOL(ipmi_request_supply_msgs);
4175EXPORT_SYMBOL(ipmi_poll_interface);
4169EXPORT_SYMBOL(ipmi_register_smi); 4176EXPORT_SYMBOL(ipmi_register_smi);
4170EXPORT_SYMBOL(ipmi_unregister_smi); 4177EXPORT_SYMBOL(ipmi_unregister_smi);
4171EXPORT_SYMBOL(ipmi_register_for_cmd); 4178EXPORT_SYMBOL(ipmi_register_for_cmd);
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index c1222e98525d..4f560d0bb808 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -675,7 +675,8 @@ static void handle_transaction_done(struct smi_info *smi_info)
675} 675}
676 676
677/* Called on timeouts and events. Timeouts should pass the elapsed 677/* Called on timeouts and events. Timeouts should pass the elapsed
678 time, interrupts should pass in zero. */ 678 time, interrupts should pass in zero. Must be called with
679 si_lock held and interrupts disabled. */
679static enum si_sm_result smi_event_handler(struct smi_info *smi_info, 680static enum si_sm_result smi_event_handler(struct smi_info *smi_info,
680 int time) 681 int time)
681{ 682{
@@ -892,13 +893,16 @@ static int ipmi_thread(void *data)
892static void poll(void *send_info) 893static void poll(void *send_info)
893{ 894{
894 struct smi_info *smi_info = send_info; 895 struct smi_info *smi_info = send_info;
896 unsigned long flags;
895 897
896 /* 898 /*
897 * Make sure there is some delay in the poll loop so we can 899 * Make sure there is some delay in the poll loop so we can
898 * drive time forward and timeout things. 900 * drive time forward and timeout things.
899 */ 901 */
900 udelay(10); 902 udelay(10);
903 spin_lock_irqsave(&smi_info->si_lock, flags);
901 smi_event_handler(smi_info, 10); 904 smi_event_handler(smi_info, 10);
905 spin_unlock_irqrestore(&smi_info->si_lock, flags);
902} 906}
903 907
904static void request_events(void *send_info) 908static void request_events(void *send_info)
@@ -1006,6 +1010,10 @@ static int smi_start_processing(void *send_info,
1006 1010
1007 new_smi->intf = intf; 1011 new_smi->intf = intf;
1008 1012
1013 /* Try to claim any interrupts. */
1014 if (new_smi->irq_setup)
1015 new_smi->irq_setup(new_smi);
1016
1009 /* Set up the timer that drives the interface. */ 1017 /* Set up the timer that drives the interface. */
1010 setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); 1018 setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi);
1011 new_smi->last_timeout_jiffies = jiffies; 1019 new_smi->last_timeout_jiffies = jiffies;
@@ -2372,20 +2380,9 @@ static int try_get_dev_id(struct smi_info *smi_info)
2372 /* Otherwise, we got some data. */ 2380 /* Otherwise, we got some data. */
2373 resp_len = smi_info->handlers->get_result(smi_info->si_sm, 2381 resp_len = smi_info->handlers->get_result(smi_info->si_sm,
2374 resp, IPMI_MAX_MSG_LENGTH); 2382 resp, IPMI_MAX_MSG_LENGTH);
2375 if (resp_len < 14) {
2376 /* That's odd, it should be longer. */
2377 rv = -EINVAL;
2378 goto out;
2379 }
2380 2383
2381 if ((resp[1] != IPMI_GET_DEVICE_ID_CMD) || (resp[2] != 0)) { 2384 /* Check and record info from the get device id, in case we need it. */
2382 /* That's odd, it shouldn't be able to fail. */ 2385 rv = ipmi_demangle_device_id(resp, resp_len, &smi_info->device_id);
2383 rv = -EINVAL;
2384 goto out;
2385 }
2386
2387 /* Record info from the get device id, in case we need it. */
2388 ipmi_demangle_device_id(resp+3, resp_len-3, &smi_info->device_id);
2389 2386
2390 out: 2387 out:
2391 kfree(resp); 2388 kfree(resp);
@@ -2765,10 +2762,6 @@ static int try_smi_init(struct smi_info *new_smi)
2765 setup_oem_data_handler(new_smi); 2762 setup_oem_data_handler(new_smi);
2766 setup_xaction_handlers(new_smi); 2763 setup_xaction_handlers(new_smi);
2767 2764
2768 /* Try to claim any interrupts. */
2769 if (new_smi->irq_setup)
2770 new_smi->irq_setup(new_smi);
2771
2772 INIT_LIST_HEAD(&(new_smi->xmit_msgs)); 2765 INIT_LIST_HEAD(&(new_smi->xmit_msgs));
2773 INIT_LIST_HEAD(&(new_smi->hp_xmit_msgs)); 2766 INIT_LIST_HEAD(&(new_smi->hp_xmit_msgs));
2774 new_smi->curr_msg = NULL; 2767 new_smi->curr_msg = NULL;
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index 41f78e2c158f..e686fc925168 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -50,10 +50,19 @@
50#include <linux/poll.h> 50#include <linux/poll.h>
51#include <linux/string.h> 51#include <linux/string.h>
52#include <linux/ctype.h> 52#include <linux/ctype.h>
53#include <linux/delay.h>
53#include <asm/atomic.h> 54#include <asm/atomic.h>
54 55
55#ifdef CONFIG_X86_LOCAL_APIC 56#ifdef CONFIG_X86
56#include <asm/apic.h> 57/* This is ugly, but I've determined that x86 is the only architecture
58 that can reasonably support the IPMI NMI watchdog timeout at this
59 time. If another architecture adds this capability somehow, it
60 will have to be a somewhat different mechanism and I have no idea
61 how it will work. So in the unlikely event that another
62 architecture supports this, we can figure out a good generic
63 mechanism for it at that time. */
64#include <asm/kdebug.h>
65#define HAVE_DIE_NMI
57#endif 66#endif
58 67
59#define PFX "IPMI Watchdog: " 68#define PFX "IPMI Watchdog: "
@@ -166,8 +175,6 @@ static char expect_close;
166 175
167static int ifnum_to_use = -1; 176static int ifnum_to_use = -1;
168 177
169static DECLARE_RWSEM(register_sem);
170
171/* Parameters to ipmi_set_timeout */ 178/* Parameters to ipmi_set_timeout */
172#define IPMI_SET_TIMEOUT_NO_HB 0 179#define IPMI_SET_TIMEOUT_NO_HB 0
173#define IPMI_SET_TIMEOUT_HB_IF_NECESSARY 1 180#define IPMI_SET_TIMEOUT_HB_IF_NECESSARY 1
@@ -193,11 +200,9 @@ static int set_param_int(const char *val, struct kernel_param *kp)
193 if (endp == val) 200 if (endp == val)
194 return -EINVAL; 201 return -EINVAL;
195 202
196 down_read(&register_sem);
197 *((int *)kp->arg) = l; 203 *((int *)kp->arg) = l;
198 if (watchdog_user) 204 if (watchdog_user)
199 rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); 205 rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
200 up_read(&register_sem);
201 206
202 return rv; 207 return rv;
203} 208}
@@ -226,17 +231,15 @@ static int set_param_str(const char *val, struct kernel_param *kp)
226 231
227 s = strstrip(valcp); 232 s = strstrip(valcp);
228 233
229 down_read(&register_sem);
230 rv = fn(s, NULL); 234 rv = fn(s, NULL);
231 if (rv) 235 if (rv)
232 goto out_unlock; 236 goto out;
233 237
234 check_parms(); 238 check_parms();
235 if (watchdog_user) 239 if (watchdog_user)
236 rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); 240 rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
237 241
238 out_unlock: 242 out:
239 up_read(&register_sem);
240 return rv; 243 return rv;
241} 244}
242 245
@@ -319,9 +322,12 @@ static unsigned char ipmi_version_minor;
319/* If a pretimeout occurs, this is used to allow only one panic to happen. */ 322/* If a pretimeout occurs, this is used to allow only one panic to happen. */
320static atomic_t preop_panic_excl = ATOMIC_INIT(-1); 323static atomic_t preop_panic_excl = ATOMIC_INIT(-1);
321 324
322static int ipmi_heartbeat(void); 325#ifdef HAVE_DIE_NMI
323static void panic_halt_ipmi_heartbeat(void); 326static int testing_nmi;
327static int nmi_handler_registered;
328#endif
324 329
330static int ipmi_heartbeat(void);
325 331
326/* We use a mutex to make sure that only one thing can send a set 332/* We use a mutex to make sure that only one thing can send a set
327 timeout at one time, because we only have one copy of the data. 333 timeout at one time, because we only have one copy of the data.
@@ -360,6 +366,9 @@ static int i_ipmi_set_timeout(struct ipmi_smi_msg *smi_msg,
360 int hbnow = 0; 366 int hbnow = 0;
361 367
362 368
369 /* These can be cleared as we are setting the timeout. */
370 pretimeout_since_last_heartbeat = 0;
371
363 data[0] = 0; 372 data[0] = 0;
364 WDOG_SET_TIMER_USE(data[0], WDOG_TIMER_USE_SMS_OS); 373 WDOG_SET_TIMER_USE(data[0], WDOG_TIMER_USE_SMS_OS);
365 374
@@ -434,31 +443,75 @@ static int ipmi_set_timeout(int do_heartbeat)
434 443
435 wait_for_completion(&set_timeout_wait); 444 wait_for_completion(&set_timeout_wait);
436 445
446 mutex_unlock(&set_timeout_lock);
447
437 if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB) 448 if ((do_heartbeat == IPMI_SET_TIMEOUT_FORCE_HB)
438 || ((send_heartbeat_now) 449 || ((send_heartbeat_now)
439 && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY))) 450 && (do_heartbeat == IPMI_SET_TIMEOUT_HB_IF_NECESSARY)))
440 {
441 rv = ipmi_heartbeat(); 451 rv = ipmi_heartbeat();
442 }
443 mutex_unlock(&set_timeout_lock);
444 452
445out: 453out:
446 return rv; 454 return rv;
447} 455}
448 456
449static void dummy_smi_free(struct ipmi_smi_msg *msg) 457static atomic_t panic_done_count = ATOMIC_INIT(0);
458
459static void panic_smi_free(struct ipmi_smi_msg *msg)
450{ 460{
461 atomic_dec(&panic_done_count);
451} 462}
452static void dummy_recv_free(struct ipmi_recv_msg *msg) 463static void panic_recv_free(struct ipmi_recv_msg *msg)
453{ 464{
465 atomic_dec(&panic_done_count);
466}
467
468static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =
469{
470 .done = panic_smi_free
471};
472static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =
473{
474 .done = panic_recv_free
475};
476
477static void panic_halt_ipmi_heartbeat(void)
478{
479 struct kernel_ipmi_msg msg;
480 struct ipmi_system_interface_addr addr;
481 int rv;
482
483 /* Don't reset the timer if we have the timer turned off, that
484 re-enables the watchdog. */
485 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE)
486 return;
487
488 addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
489 addr.channel = IPMI_BMC_CHANNEL;
490 addr.lun = 0;
491
492 msg.netfn = 0x06;
493 msg.cmd = IPMI_WDOG_RESET_TIMER;
494 msg.data = NULL;
495 msg.data_len = 0;
496 rv = ipmi_request_supply_msgs(watchdog_user,
497 (struct ipmi_addr *) &addr,
498 0,
499 &msg,
500 NULL,
501 &panic_halt_heartbeat_smi_msg,
502 &panic_halt_heartbeat_recv_msg,
503 1);
504 if (!rv)
505 atomic_add(2, &panic_done_count);
454} 506}
507
455static struct ipmi_smi_msg panic_halt_smi_msg = 508static struct ipmi_smi_msg panic_halt_smi_msg =
456{ 509{
457 .done = dummy_smi_free 510 .done = panic_smi_free
458}; 511};
459static struct ipmi_recv_msg panic_halt_recv_msg = 512static struct ipmi_recv_msg panic_halt_recv_msg =
460{ 513{
461 .done = dummy_recv_free 514 .done = panic_recv_free
462}; 515};
463 516
464/* Special call, doesn't claim any locks. This is only to be called 517/* Special call, doesn't claim any locks. This is only to be called
@@ -470,13 +523,21 @@ static void panic_halt_ipmi_set_timeout(void)
470 int send_heartbeat_now; 523 int send_heartbeat_now;
471 int rv; 524 int rv;
472 525
526 /* Wait for the messages to be free. */
527 while (atomic_read(&panic_done_count) != 0)
528 ipmi_poll_interface(watchdog_user);
473 rv = i_ipmi_set_timeout(&panic_halt_smi_msg, 529 rv = i_ipmi_set_timeout(&panic_halt_smi_msg,
474 &panic_halt_recv_msg, 530 &panic_halt_recv_msg,
475 &send_heartbeat_now); 531 &send_heartbeat_now);
476 if (!rv) { 532 if (!rv) {
533 atomic_add(2, &panic_done_count);
477 if (send_heartbeat_now) 534 if (send_heartbeat_now)
478 panic_halt_ipmi_heartbeat(); 535 panic_halt_ipmi_heartbeat();
479 } 536 } else
537 printk(KERN_WARNING PFX
538 "Unable to extend the watchdog timeout.");
539 while (atomic_read(&panic_done_count) != 0)
540 ipmi_poll_interface(watchdog_user);
480} 541}
481 542
482/* We use a semaphore to make sure that only one thing can send a 543/* We use a semaphore to make sure that only one thing can send a
@@ -505,24 +566,14 @@ static struct ipmi_recv_msg heartbeat_recv_msg =
505 .done = heartbeat_free_recv 566 .done = heartbeat_free_recv
506}; 567};
507 568
508static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg =
509{
510 .done = dummy_smi_free
511};
512static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =
513{
514 .done = dummy_recv_free
515};
516
517static int ipmi_heartbeat(void) 569static int ipmi_heartbeat(void)
518{ 570{
519 struct kernel_ipmi_msg msg; 571 struct kernel_ipmi_msg msg;
520 int rv; 572 int rv;
521 struct ipmi_system_interface_addr addr; 573 struct ipmi_system_interface_addr addr;
522 574
523 if (ipmi_ignore_heartbeat) { 575 if (ipmi_ignore_heartbeat)
524 return 0; 576 return 0;
525 }
526 577
527 if (ipmi_start_timer_on_heartbeat) { 578 if (ipmi_start_timer_on_heartbeat) {
528 ipmi_start_timer_on_heartbeat = 0; 579 ipmi_start_timer_on_heartbeat = 0;
@@ -533,7 +584,6 @@ static int ipmi_heartbeat(void)
533 We don't want to set the action, though, we want to 584 We don't want to set the action, though, we want to
534 leave that alone (thus it can't be combined with the 585 leave that alone (thus it can't be combined with the
535 above operation. */ 586 above operation. */
536 pretimeout_since_last_heartbeat = 0;
537 return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); 587 return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY);
538 } 588 }
539 589
@@ -586,35 +636,6 @@ static int ipmi_heartbeat(void)
586 return rv; 636 return rv;
587} 637}
588 638
589static void panic_halt_ipmi_heartbeat(void)
590{
591 struct kernel_ipmi_msg msg;
592 struct ipmi_system_interface_addr addr;
593
594
595 /* Don't reset the timer if we have the timer turned off, that
596 re-enables the watchdog. */
597 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE)
598 return;
599
600 addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
601 addr.channel = IPMI_BMC_CHANNEL;
602 addr.lun = 0;
603
604 msg.netfn = 0x06;
605 msg.cmd = IPMI_WDOG_RESET_TIMER;
606 msg.data = NULL;
607 msg.data_len = 0;
608 ipmi_request_supply_msgs(watchdog_user,
609 (struct ipmi_addr *) &addr,
610 0,
611 &msg,
612 NULL,
613 &panic_halt_heartbeat_smi_msg,
614 &panic_halt_heartbeat_recv_msg,
615 1);
616}
617
618static struct watchdog_info ident = 639static struct watchdog_info ident =
619{ 640{
620 .options = 0, /* WDIOF_SETTIMEOUT, */ 641 .options = 0, /* WDIOF_SETTIMEOUT, */
@@ -895,7 +916,6 @@ static void ipmi_register_watchdog(int ipmi_intf)
895{ 916{
896 int rv = -EBUSY; 917 int rv = -EBUSY;
897 918
898 down_write(&register_sem);
899 if (watchdog_user) 919 if (watchdog_user)
900 goto out; 920 goto out;
901 921
@@ -921,15 +941,56 @@ static void ipmi_register_watchdog(int ipmi_intf)
921 printk(KERN_CRIT PFX "Unable to register misc device\n"); 941 printk(KERN_CRIT PFX "Unable to register misc device\n");
922 } 942 }
923 943
924 out: 944#ifdef HAVE_DIE_NMI
925 up_write(&register_sem); 945 if (nmi_handler_registered) {
946 int old_pretimeout = pretimeout;
947 int old_timeout = timeout;
948 int old_preop_val = preop_val;
949
950 /* Set the pretimeout to go off in a second and give
951 ourselves plenty of time to stop the timer. */
952 ipmi_watchdog_state = WDOG_TIMEOUT_RESET;
953 preop_val = WDOG_PREOP_NONE; /* Make sure nothing happens */
954 pretimeout = 99;
955 timeout = 100;
956
957 testing_nmi = 1;
958
959 rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB);
960 if (rv) {
961 printk(KERN_WARNING PFX "Error starting timer to"
962 " test NMI: 0x%x. The NMI pretimeout will"
963 " likely not work\n", rv);
964 rv = 0;
965 goto out_restore;
966 }
967
968 msleep(1500);
926 969
970 if (testing_nmi != 2) {
971 printk(KERN_WARNING PFX "IPMI NMI didn't seem to"
972 " occur. The NMI pretimeout will"
973 " likely not work\n");
974 }
975 out_restore:
976 testing_nmi = 0;
977 preop_val = old_preop_val;
978 pretimeout = old_pretimeout;
979 timeout = old_timeout;
980 }
981#endif
982
983 out:
927 if ((start_now) && (rv == 0)) { 984 if ((start_now) && (rv == 0)) {
928 /* Run from startup, so start the timer now. */ 985 /* Run from startup, so start the timer now. */
929 start_now = 0; /* Disable this function after first startup. */ 986 start_now = 0; /* Disable this function after first startup. */
930 ipmi_watchdog_state = action_val; 987 ipmi_watchdog_state = action_val;
931 ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB); 988 ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB);
932 printk(KERN_INFO PFX "Starting now!\n"); 989 printk(KERN_INFO PFX "Starting now!\n");
990 } else {
991 /* Stop the timer now. */
992 ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
993 ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
933 } 994 }
934} 995}
935 996
@@ -937,8 +998,6 @@ static void ipmi_unregister_watchdog(int ipmi_intf)
937{ 998{
938 int rv; 999 int rv;
939 1000
940 down_write(&register_sem);
941
942 if (!watchdog_user) 1001 if (!watchdog_user)
943 goto out; 1002 goto out;
944 1003
@@ -963,20 +1022,44 @@ static void ipmi_unregister_watchdog(int ipmi_intf)
963 watchdog_user = NULL; 1022 watchdog_user = NULL;
964 1023
965 out: 1024 out:
966 up_write(&register_sem); 1025 return;
967} 1026}
968 1027
969#ifdef HAVE_NMI_HANDLER 1028#ifdef HAVE_DIE_NMI
970static int 1029static int
971ipmi_nmi(void *dev_id, int cpu, int handled) 1030ipmi_nmi(struct notifier_block *self, unsigned long val, void *data)
972{ 1031{
1032 struct die_args *args = data;
1033
1034 if (val != DIE_NMI)
1035 return NOTIFY_OK;
1036
1037 /* Hack, if it's a memory or I/O error, ignore it. */
1038 if (args->err & 0xc0)
1039 return NOTIFY_OK;
1040
1041 /*
1042 * If we get here, it's an NMI that's not a memory or I/O
1043 * error. We can't truly tell if it's from IPMI or not
1044 * without sending a message, and sending a message is almost
1045 * impossible because of locking.
1046 */
1047
1048 if (testing_nmi) {
1049 testing_nmi = 2;
1050 return NOTIFY_STOP;
1051 }
1052
973 /* If we are not expecting a timeout, ignore it. */ 1053 /* If we are not expecting a timeout, ignore it. */
974 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) 1054 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE)
975 return NOTIFY_DONE; 1055 return NOTIFY_OK;
1056
1057 if (preaction_val != WDOG_PRETIMEOUT_NMI)
1058 return NOTIFY_OK;
976 1059
977 /* If no one else handled the NMI, we assume it was the IPMI 1060 /* If no one else handled the NMI, we assume it was the IPMI
978 watchdog. */ 1061 watchdog. */
979 if ((!handled) && (preop_val == WDOG_PREOP_PANIC)) { 1062 if (preop_val == WDOG_PREOP_PANIC) {
980 /* On some machines, the heartbeat will give 1063 /* On some machines, the heartbeat will give
981 an error and not work unless we re-enable 1064 an error and not work unless we re-enable
982 the timer. So do so. */ 1065 the timer. So do so. */
@@ -985,18 +1068,12 @@ ipmi_nmi(void *dev_id, int cpu, int handled)
985 panic(PFX "pre-timeout"); 1068 panic(PFX "pre-timeout");
986 } 1069 }
987 1070
988 return NOTIFY_DONE; 1071 return NOTIFY_STOP;
989} 1072}
990 1073
991static struct nmi_handler ipmi_nmi_handler = 1074static struct notifier_block ipmi_nmi_handler = {
992{ 1075 .notifier_call = ipmi_nmi
993 .link = LIST_HEAD_INIT(ipmi_nmi_handler.link),
994 .dev_name = "ipmi_watchdog",
995 .dev_id = NULL,
996 .handler = ipmi_nmi,
997 .priority = 0, /* Call us last. */
998}; 1076};
999int nmi_handler_registered;
1000#endif 1077#endif
1001 1078
1002static int wdog_reboot_handler(struct notifier_block *this, 1079static int wdog_reboot_handler(struct notifier_block *this,
@@ -1009,7 +1086,7 @@ static int wdog_reboot_handler(struct notifier_block *this,
1009 /* Make sure we only do this once. */ 1086 /* Make sure we only do this once. */
1010 reboot_event_handled = 1; 1087 reboot_event_handled = 1;
1011 1088
1012 if (code == SYS_DOWN || code == SYS_HALT) { 1089 if (code == SYS_POWER_OFF || code == SYS_HALT) {
1013 /* Disable the WDT if we are shutting down. */ 1090 /* Disable the WDT if we are shutting down. */
1014 ipmi_watchdog_state = WDOG_TIMEOUT_NONE; 1091 ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
1015 panic_halt_ipmi_set_timeout(); 1092 panic_halt_ipmi_set_timeout();
@@ -1113,7 +1190,7 @@ static int preaction_op(const char *inval, char *outval)
1113 preaction_val = WDOG_PRETIMEOUT_NONE; 1190 preaction_val = WDOG_PRETIMEOUT_NONE;
1114 else if (strcmp(inval, "pre_smi") == 0) 1191 else if (strcmp(inval, "pre_smi") == 0)
1115 preaction_val = WDOG_PRETIMEOUT_SMI; 1192 preaction_val = WDOG_PRETIMEOUT_SMI;
1116#ifdef HAVE_NMI_HANDLER 1193#ifdef HAVE_DIE_NMI
1117 else if (strcmp(inval, "pre_nmi") == 0) 1194 else if (strcmp(inval, "pre_nmi") == 0)
1118 preaction_val = WDOG_PRETIMEOUT_NMI; 1195 preaction_val = WDOG_PRETIMEOUT_NMI;
1119#endif 1196#endif
@@ -1147,7 +1224,7 @@ static int preop_op(const char *inval, char *outval)
1147 1224
1148static void check_parms(void) 1225static void check_parms(void)
1149{ 1226{
1150#ifdef HAVE_NMI_HANDLER 1227#ifdef HAVE_DIE_NMI
1151 int do_nmi = 0; 1228 int do_nmi = 0;
1152 int rv; 1229 int rv;
1153 1230
@@ -1160,20 +1237,9 @@ static void check_parms(void)
1160 preop_op("preop_none", NULL); 1237 preop_op("preop_none", NULL);
1161 do_nmi = 0; 1238 do_nmi = 0;
1162 } 1239 }
1163#ifdef CONFIG_X86_LOCAL_APIC
1164 if (nmi_watchdog == NMI_IO_APIC) {
1165 printk(KERN_WARNING PFX "nmi_watchdog is set to IO APIC"
1166 " mode (value is %d), that is incompatible"
1167 " with using NMI in the IPMI watchdog."
1168 " Disabling IPMI nmi pretimeout.\n",
1169 nmi_watchdog);
1170 preaction_val = WDOG_PRETIMEOUT_NONE;
1171 do_nmi = 0;
1172 }
1173#endif
1174 } 1240 }
1175 if (do_nmi && !nmi_handler_registered) { 1241 if (do_nmi && !nmi_handler_registered) {
1176 rv = request_nmi(&ipmi_nmi_handler); 1242 rv = register_die_notifier(&ipmi_nmi_handler);
1177 if (rv) { 1243 if (rv) {
1178 printk(KERN_WARNING PFX 1244 printk(KERN_WARNING PFX
1179 "Can't register nmi handler\n"); 1245 "Can't register nmi handler\n");
@@ -1181,7 +1247,7 @@ static void check_parms(void)
1181 } else 1247 } else
1182 nmi_handler_registered = 1; 1248 nmi_handler_registered = 1;
1183 } else if (!do_nmi && nmi_handler_registered) { 1249 } else if (!do_nmi && nmi_handler_registered) {
1184 release_nmi(&ipmi_nmi_handler); 1250 unregister_die_notifier(&ipmi_nmi_handler);
1185 nmi_handler_registered = 0; 1251 nmi_handler_registered = 0;
1186 } 1252 }
1187#endif 1253#endif
@@ -1217,9 +1283,9 @@ static int __init ipmi_wdog_init(void)
1217 1283
1218 rv = ipmi_smi_watcher_register(&smi_watcher); 1284 rv = ipmi_smi_watcher_register(&smi_watcher);
1219 if (rv) { 1285 if (rv) {
1220#ifdef HAVE_NMI_HANDLER 1286#ifdef HAVE_DIE_NMI
1221 if (preaction_val == WDOG_PRETIMEOUT_NMI) 1287 if (nmi_handler_registered)
1222 release_nmi(&ipmi_nmi_handler); 1288 unregister_die_notifier(&ipmi_nmi_handler);
1223#endif 1289#endif
1224 atomic_notifier_chain_unregister(&panic_notifier_list, 1290 atomic_notifier_chain_unregister(&panic_notifier_list,
1225 &wdog_panic_notifier); 1291 &wdog_panic_notifier);
@@ -1238,9 +1304,9 @@ static void __exit ipmi_wdog_exit(void)
1238 ipmi_smi_watcher_unregister(&smi_watcher); 1304 ipmi_smi_watcher_unregister(&smi_watcher);
1239 ipmi_unregister_watchdog(watchdog_ifnum); 1305 ipmi_unregister_watchdog(watchdog_ifnum);
1240 1306
1241#ifdef HAVE_NMI_HANDLER 1307#ifdef HAVE_DIE_NMI
1242 if (nmi_handler_registered) 1308 if (nmi_handler_registered)
1243 release_nmi(&ipmi_nmi_handler); 1309 unregister_die_notifier(&ipmi_nmi_handler);
1244#endif 1310#endif
1245 1311
1246 atomic_notifier_chain_unregister(&panic_notifier_list, 1312 atomic_notifier_chain_unregister(&panic_notifier_list,
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 77a7a4a06620..85d596a3c18c 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1529,7 +1529,7 @@ static int __devinit reset_card(struct pci_dev *pdev,
1529 portcount = inw(base + 0x2); 1529 portcount = inw(base + 0x2);
1530 if (!inw(base + 0xe) & 0x1 || (portcount != 0 && portcount != 4 && 1530 if (!inw(base + 0xe) & 0x1 || (portcount != 0 && portcount != 4 &&
1531 portcount != 8 && portcount != 16)) { 1531 portcount != 8 && portcount != 16)) {
1532 dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.", 1532 dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.\n",
1533 card + 1); 1533 card + 1);
1534 retval = -EIO; 1534 retval = -EIO;
1535 goto end; 1535 goto end;
@@ -1622,7 +1622,9 @@ static int __devinit load_firmware(struct pci_dev *pdev,
1622 1622
1623 if ((status = inw(base + 0x4)) != 0) { 1623 if ((status = inw(base + 0x4)) != 0) {
1624 dev_warn(&pdev->dev, "Card%d rejected load header:\n" 1624 dev_warn(&pdev->dev, "Card%d rejected load header:\n"
1625 "Address:0x%x\nCount:0x%x\nStatus:0x%x\n", 1625 KERN_WARNING "Address:0x%x\n"
1626 KERN_WARNING "Count:0x%x\n"
1627 KERN_WARNING "Status:0x%x\n",
1626 index + 1, frame->addr, frame->count, status); 1628 index + 1, frame->addr, frame->count, status);
1627 goto errrelfw; 1629 goto errrelfw;
1628 } 1630 }
@@ -1666,7 +1668,9 @@ static int __devinit load_firmware(struct pci_dev *pdev,
1666 1668
1667 if ((status = inw(base + 0x4)) != 0) { 1669 if ((status = inw(base + 0x4)) != 0) {
1668 dev_warn(&pdev->dev, "Card%d rejected verify header:\n" 1670 dev_warn(&pdev->dev, "Card%d rejected verify header:\n"
1669 "Address:0x%x\nCount:0x%x\nStatus: 0x%x\n", 1671 KERN_WARNING "Address:0x%x\n"
1672 KERN_WARNING "Count:0x%x\n"
1673 KERN_WARNING "Status: 0x%x\n",
1670 index + 1, frame->addr, frame->count, status); 1674 index + 1, frame->addr, frame->count, status);
1671 goto errrelfw; 1675 goto errrelfw;
1672 } 1676 }
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 212276affa1f..fc54d234507a 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -42,6 +42,7 @@
42#include <linux/sysrq.h> 42#include <linux/sysrq.h>
43#include <linux/input.h> 43#include <linux/input.h>
44#include <linux/reboot.h> 44#include <linux/reboot.h>
45#include <linux/notifier.h>
45 46
46extern void ctrl_alt_del(void); 47extern void ctrl_alt_del(void);
47 48
@@ -81,7 +82,8 @@ void compute_shiftstate(void);
81typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value, 82typedef void (k_handler_fn)(struct vc_data *vc, unsigned char value,
82 char up_flag); 83 char up_flag);
83static k_handler_fn K_HANDLERS; 84static k_handler_fn K_HANDLERS;
84static k_handler_fn *k_handler[16] = { K_HANDLERS }; 85k_handler_fn *k_handler[16] = { K_HANDLERS };
86EXPORT_SYMBOL_GPL(k_handler);
85 87
86#define FN_HANDLERS\ 88#define FN_HANDLERS\
87 fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\ 89 fn_null, fn_enter, fn_show_ptregs, fn_show_mem,\
@@ -127,7 +129,7 @@ int shift_state = 0;
127 */ 129 */
128 130
129static struct input_handler kbd_handler; 131static struct input_handler kbd_handler;
130static unsigned long key_down[NBITS(KEY_MAX)]; /* keyboard key bitmap */ 132static unsigned long key_down[BITS_TO_LONGS(KEY_CNT)]; /* keyboard key bitmap */
131static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ 133static unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */
132static int dead_key_next; 134static int dead_key_next;
133static int npadch = -1; /* -1 or number assembled on pad */ 135static int npadch = -1; /* -1 or number assembled on pad */
@@ -160,6 +162,23 @@ static int sysrq_alt_use;
160static int sysrq_alt; 162static int sysrq_alt;
161 163
162/* 164/*
165 * Notifier list for console keyboard events
166 */
167static ATOMIC_NOTIFIER_HEAD(keyboard_notifier_list);
168
169int register_keyboard_notifier(struct notifier_block *nb)
170{
171 return atomic_notifier_chain_register(&keyboard_notifier_list, nb);
172}
173EXPORT_SYMBOL_GPL(register_keyboard_notifier);
174
175int unregister_keyboard_notifier(struct notifier_block *nb)
176{
177 return atomic_notifier_chain_unregister(&keyboard_notifier_list, nb);
178}
179EXPORT_SYMBOL_GPL(unregister_keyboard_notifier);
180
181/*
163 * Translation of scancodes to keycodes. We set them on only the first 182 * Translation of scancodes to keycodes. We set them on only the first
164 * keyboard in the list that accepts the scancode and keycode. 183 * keyboard in the list that accepts the scancode and keycode.
165 * Explanation for not choosing the first attached keyboard anymore: 184 * Explanation for not choosing the first attached keyboard anymore:
@@ -1130,6 +1149,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1130 unsigned char type, raw_mode; 1149 unsigned char type, raw_mode;
1131 struct tty_struct *tty; 1150 struct tty_struct *tty;
1132 int shift_final; 1151 int shift_final;
1152 struct keyboard_notifier_param param = { .vc = vc, .value = keycode, .down = down };
1133 1153
1134 tty = vc->vc_tty; 1154 tty = vc->vc_tty;
1135 1155
@@ -1217,10 +1237,11 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1217 return; 1237 return;
1218 } 1238 }
1219 1239
1220 shift_final = (shift_state | kbd->slockstate) ^ kbd->lockstate; 1240 param.shift = shift_final = (shift_state | kbd->slockstate) ^ kbd->lockstate;
1221 key_map = key_maps[shift_final]; 1241 key_map = key_maps[shift_final];
1222 1242
1223 if (!key_map) { 1243 if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_KEYCODE, &param) == NOTIFY_STOP || !key_map) {
1244 atomic_notifier_call_chain(&keyboard_notifier_list, KBD_UNBOUND_KEYCODE, &param);
1224 compute_shiftstate(); 1245 compute_shiftstate();
1225 kbd->slockstate = 0; 1246 kbd->slockstate = 0;
1226 return; 1247 return;
@@ -1237,6 +1258,9 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1237 type = KTYP(keysym); 1258 type = KTYP(keysym);
1238 1259
1239 if (type < 0xf0) { 1260 if (type < 0xf0) {
1261 param.value = keysym;
1262 if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_UNICODE, &param) == NOTIFY_STOP)
1263 return;
1240 if (down && !raw_mode) 1264 if (down && !raw_mode)
1241 to_utf8(vc, keysym); 1265 to_utf8(vc, keysym);
1242 return; 1266 return;
@@ -1244,9 +1268,6 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1244 1268
1245 type -= 0xf0; 1269 type -= 0xf0;
1246 1270
1247 if (raw_mode && type != KT_SPEC && type != KT_SHIFT)
1248 return;
1249
1250 if (type == KT_LETTER) { 1271 if (type == KT_LETTER) {
1251 type = KT_LATIN; 1272 type = KT_LATIN;
1252 if (vc_kbd_led(kbd, VC_CAPSLOCK)) { 1273 if (vc_kbd_led(kbd, VC_CAPSLOCK)) {
@@ -1255,9 +1276,18 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
1255 keysym = key_map[keycode]; 1276 keysym = key_map[keycode];
1256 } 1277 }
1257 } 1278 }
1279 param.value = keysym;
1280
1281 if (atomic_notifier_call_chain(&keyboard_notifier_list, KBD_KEYSYM, &param) == NOTIFY_STOP)
1282 return;
1283
1284 if (raw_mode && type != KT_SPEC && type != KT_SHIFT)
1285 return;
1258 1286
1259 (*k_handler[type])(vc, keysym & 0xff, !down); 1287 (*k_handler[type])(vc, keysym & 0xff, !down);
1260 1288
1289 atomic_notifier_call_chain(&keyboard_notifier_list, KBD_POST_KEYSYM, &param);
1290
1261 if (type != KT_SLOCK) 1291 if (type != KT_SLOCK)
1262 kbd->slockstate = 0; 1292 kbd->slockstate = 0;
1263} 1293}
@@ -1347,12 +1377,12 @@ static void kbd_start(struct input_handle *handle)
1347static const struct input_device_id kbd_ids[] = { 1377static const struct input_device_id kbd_ids[] = {
1348 { 1378 {
1349 .flags = INPUT_DEVICE_ID_MATCH_EVBIT, 1379 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
1350 .evbit = { BIT(EV_KEY) }, 1380 .evbit = { BIT_MASK(EV_KEY) },
1351 }, 1381 },
1352 1382
1353 { 1383 {
1354 .flags = INPUT_DEVICE_ID_MATCH_EVBIT, 1384 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
1355 .evbit = { BIT(EV_SND) }, 1385 .evbit = { BIT_MASK(EV_SND) },
1356 }, 1386 },
1357 1387
1358 { }, /* Terminating entry */ 1388 { }, /* Terminating entry */
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
index ed76f0a127fd..2fc255a21486 100644
--- a/drivers/char/moxa.c
+++ b/drivers/char/moxa.c
@@ -41,6 +41,7 @@
41#include <linux/pci.h> 41#include <linux/pci.h>
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/bitops.h> 43#include <linux/bitops.h>
44#include <linux/completion.h>
44 45
45#include <asm/system.h> 46#include <asm/system.h>
46#include <asm/io.h> 47#include <asm/io.h>
@@ -142,7 +143,7 @@ struct moxa_port {
142 struct tty_struct *tty; 143 struct tty_struct *tty;
143 int cflag; 144 int cflag;
144 wait_queue_head_t open_wait; 145 wait_queue_head_t open_wait;
145 wait_queue_head_t close_wait; 146 struct completion close_wait;
146 147
147 struct timer_list emptyTimer; 148 struct timer_list emptyTimer;
148 149
@@ -166,7 +167,6 @@ struct moxa_port {
166 167
167#define WAKEUP_CHARS 256 168#define WAKEUP_CHARS 256
168 169
169static int verbose = 0;
170static int ttymajor = MOXAMAJOR; 170static int ttymajor = MOXAMAJOR;
171/* Variables for insmod */ 171/* Variables for insmod */
172#ifdef MODULE 172#ifdef MODULE
@@ -184,7 +184,6 @@ module_param_array(baseaddr, int, NULL, 0);
184module_param_array(numports, int, NULL, 0); 184module_param_array(numports, int, NULL, 0);
185#endif 185#endif
186module_param(ttymajor, int, 0); 186module_param(ttymajor, int, 0);
187module_param(verbose, bool, 0644);
188 187
189/* 188/*
190 * static functions: 189 * static functions:
@@ -208,13 +207,13 @@ static int moxa_tiocmget(struct tty_struct *tty, struct file *file);
208static int moxa_tiocmset(struct tty_struct *tty, struct file *file, 207static int moxa_tiocmset(struct tty_struct *tty, struct file *file,
209 unsigned int set, unsigned int clear); 208 unsigned int set, unsigned int clear);
210static void moxa_poll(unsigned long); 209static void moxa_poll(unsigned long);
211static void set_tty_param(struct tty_struct *); 210static void moxa_set_tty_param(struct tty_struct *);
212static int block_till_ready(struct tty_struct *, struct file *, 211static int moxa_block_till_ready(struct tty_struct *, struct file *,
213 struct moxa_port *); 212 struct moxa_port *);
214static void setup_empty_event(struct tty_struct *); 213static void moxa_setup_empty_event(struct tty_struct *);
215static void check_xmit_empty(unsigned long); 214static void moxa_check_xmit_empty(unsigned long);
216static void shut_down(struct moxa_port *); 215static void moxa_shut_down(struct moxa_port *);
217static void receive_data(struct moxa_port *); 216static void moxa_receive_data(struct moxa_port *);
218/* 217/*
219 * moxa board interface functions: 218 * moxa board interface functions:
220 */ 219 */
@@ -283,8 +282,10 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev,
283 int retval; 282 int retval;
284 283
285 retval = pci_enable_device(pdev); 284 retval = pci_enable_device(pdev);
286 if (retval) 285 if (retval) {
286 dev_err(&pdev->dev, "can't enable pci device\n");
287 goto err; 287 goto err;
288 }
288 289
289 for (i = 0; i < MAX_BOARDS; i++) 290 for (i = 0; i < MAX_BOARDS; i++)
290 if (moxa_boards[i].basemem == NULL) 291 if (moxa_boards[i].basemem == NULL)
@@ -292,16 +293,17 @@ static int __devinit moxa_pci_probe(struct pci_dev *pdev,
292 293
293 retval = -ENODEV; 294 retval = -ENODEV;
294 if (i >= MAX_BOARDS) { 295 if (i >= MAX_BOARDS) {
295 if (verbose) 296 dev_warn(&pdev->dev, "more than %u MOXA Intellio family boards "
296 printk("More than %d MOXA Intellio family boards "
297 "found. Board is ignored.\n", MAX_BOARDS); 297 "found. Board is ignored.\n", MAX_BOARDS);
298 goto err; 298 goto err;
299 } 299 }
300 300
301 board = &moxa_boards[i]; 301 board = &moxa_boards[i];
302 board->basemem = pci_iomap(pdev, 2, 0x4000); 302 board->basemem = pci_iomap(pdev, 2, 0x4000);
303 if (board->basemem == NULL) 303 if (board->basemem == NULL) {
304 dev_err(&pdev->dev, "can't remap io space 2\n");
304 goto err; 305 goto err;
306 }
305 307
306 board->boardType = board_type; 308 board->boardType = board_type;
307 switch (board_type) { 309 switch (board_type) {
@@ -347,7 +349,8 @@ static int __init moxa_init(void)
347 int i, numBoards, retval = 0; 349 int i, numBoards, retval = 0;
348 struct moxa_port *ch; 350 struct moxa_port *ch;
349 351
350 printk(KERN_INFO "MOXA Intellio family driver version %s\n", MOXA_VERSION); 352 printk(KERN_INFO "MOXA Intellio family driver version %s\n",
353 MOXA_VERSION);
351 moxaDriver = alloc_tty_driver(MAX_PORTS + 1); 354 moxaDriver = alloc_tty_driver(MAX_PORTS + 1);
352 if (!moxaDriver) 355 if (!moxaDriver)
353 return -ENOMEM; 356 return -ENOMEM;
@@ -372,13 +375,13 @@ static int __init moxa_init(void)
372 ch->closing_wait = 30 * HZ; 375 ch->closing_wait = 30 * HZ;
373 ch->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL; 376 ch->cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
374 init_waitqueue_head(&ch->open_wait); 377 init_waitqueue_head(&ch->open_wait);
375 init_waitqueue_head(&ch->close_wait); 378 init_completion(&ch->close_wait);
376 379
377 setup_timer(&ch->emptyTimer, check_xmit_empty, 380 setup_timer(&ch->emptyTimer, moxa_check_xmit_empty,
378 (unsigned long)ch); 381 (unsigned long)ch);
379 } 382 }
380 383
381 printk("Tty devices major number = %d\n", ttymajor); 384 pr_debug("Moxa tty devices major number = %d\n", ttymajor);
382 385
383 if (tty_register_driver(moxaDriver)) { 386 if (tty_register_driver(moxaDriver)) {
384 printk(KERN_ERR "Couldn't install MOXA Smartio family driver !\n"); 387 printk(KERN_ERR "Couldn't install MOXA Smartio family driver !\n");
@@ -400,11 +403,10 @@ static int __init moxa_init(void)
400 moxa_boards[numBoards].numPorts = moxa_isa_boards[i].numPorts; 403 moxa_boards[numBoards].numPorts = moxa_isa_boards[i].numPorts;
401 moxa_boards[numBoards].busType = MOXA_BUS_TYPE_ISA; 404 moxa_boards[numBoards].busType = MOXA_BUS_TYPE_ISA;
402 moxa_boards[numBoards].baseAddr = moxa_isa_boards[i].baseAddr; 405 moxa_boards[numBoards].baseAddr = moxa_isa_boards[i].baseAddr;
403 if (verbose) 406 pr_debug("Moxa board %2d: %s board(baseAddr=%lx)\n",
404 printk("Board %2d: %s board(baseAddr=%lx)\n", 407 numBoards + 1,
405 numBoards + 1, 408 moxa_brdname[moxa_boards[numBoards].boardType-1],
406 moxa_brdname[moxa_boards[numBoards].boardType - 1], 409 moxa_boards[numBoards].baseAddr);
407 moxa_boards[numBoards].baseAddr);
408 numBoards++; 410 numBoards++;
409 } 411 }
410 } 412 }
@@ -413,14 +415,13 @@ static int __init moxa_init(void)
413 for (i = 0; i < MAX_BOARDS; i++) { 415 for (i = 0; i < MAX_BOARDS; i++) {
414 if ((type[i] == MOXA_BOARD_C218_ISA) || 416 if ((type[i] == MOXA_BOARD_C218_ISA) ||
415 (type[i] == MOXA_BOARD_C320_ISA)) { 417 (type[i] == MOXA_BOARD_C320_ISA)) {
416 if (verbose) 418 pr_debug("Moxa board %2d: %s board(baseAddr=%lx)\n",
417 printk("Board %2d: %s board(baseAddr=%lx)\n", 419 numBoards + 1, moxa_brdname[type[i] - 1],
418 numBoards + 1, 420 (unsigned long)baseaddr[i]);
419 moxa_brdname[type[i] - 1],
420 (unsigned long) baseaddr[i]);
421 if (numBoards >= MAX_BOARDS) { 421 if (numBoards >= MAX_BOARDS) {
422 if (verbose) 422 printk(KERN_WARNING "More than %d MOXA "
423 printk("More than %d MOXA Intellio family boards found. Board is ignored.", MAX_BOARDS); 423 "Intellio family boards found. Board "
424 "is ignored.\n", MAX_BOARDS);
424 continue; 425 continue;
425 } 426 }
426 moxa_boards[numBoards].boardType = type[i]; 427 moxa_boards[numBoards].boardType = type[i];
@@ -456,16 +457,14 @@ static void __exit moxa_exit(void)
456{ 457{
457 int i; 458 int i;
458 459
459 if (verbose)
460 printk("Unloading module moxa ...\n");
461
462 del_timer_sync(&moxaTimer); 460 del_timer_sync(&moxaTimer);
463 461
464 for (i = 0; i < MAX_PORTS; i++) 462 for (i = 0; i < MAX_PORTS; i++)
465 del_timer_sync(&moxa_ports[i].emptyTimer); 463 del_timer_sync(&moxa_ports[i].emptyTimer);
466 464
467 if (tty_unregister_driver(moxaDriver)) 465 if (tty_unregister_driver(moxaDriver))
468 printk("Couldn't unregister MOXA Intellio family serial driver\n"); 466 printk(KERN_ERR "Couldn't unregister MOXA Intellio family "
467 "serial driver\n");
469 put_tty_driver(moxaDriver); 468 put_tty_driver(moxaDriver);
470 469
471#ifdef CONFIG_PCI 470#ifdef CONFIG_PCI
@@ -475,9 +474,6 @@ static void __exit moxa_exit(void)
475 for (i = 0; i < MAX_BOARDS; i++) 474 for (i = 0; i < MAX_BOARDS; i++)
476 if (moxa_boards[i].basemem) 475 if (moxa_boards[i].basemem)
477 iounmap(moxa_boards[i].basemem); 476 iounmap(moxa_boards[i].basemem);
478
479 if (verbose)
480 printk("Done\n");
481} 477}
482 478
483module_init(moxa_init); 479module_init(moxa_init);
@@ -504,12 +500,12 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
504 ch->tty = tty; 500 ch->tty = tty;
505 if (!(ch->asyncflags & ASYNC_INITIALIZED)) { 501 if (!(ch->asyncflags & ASYNC_INITIALIZED)) {
506 ch->statusflags = 0; 502 ch->statusflags = 0;
507 set_tty_param(tty); 503 moxa_set_tty_param(tty);
508 MoxaPortLineCtrl(ch->port, 1, 1); 504 MoxaPortLineCtrl(ch->port, 1, 1);
509 MoxaPortEnable(ch->port); 505 MoxaPortEnable(ch->port);
510 ch->asyncflags |= ASYNC_INITIALIZED; 506 ch->asyncflags |= ASYNC_INITIALIZED;
511 } 507 }
512 retval = block_till_ready(tty, filp, ch); 508 retval = moxa_block_till_ready(tty, filp, ch);
513 509
514 moxa_unthrottle(tty); 510 moxa_unthrottle(tty);
515 511
@@ -532,9 +528,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
532 return; 528 return;
533 } 529 }
534 if (!MoxaPortIsValid(port)) { 530 if (!MoxaPortIsValid(port)) {
535#ifdef SERIAL_DEBUG_CLOSE 531 pr_debug("Invalid portno in moxa_close\n");
536 printk("Invalid portno in moxa_close\n");
537#endif
538 tty->driver_data = NULL; 532 tty->driver_data = NULL;
539 return; 533 return;
540 } 534 }
@@ -547,13 +541,13 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
547 ch = (struct moxa_port *) tty->driver_data; 541 ch = (struct moxa_port *) tty->driver_data;
548 542
549 if ((tty->count == 1) && (ch->count != 1)) { 543 if ((tty->count == 1) && (ch->count != 1)) {
550 printk("moxa_close: bad serial port count; tty->count is 1, " 544 printk(KERN_WARNING "moxa_close: bad serial port count; "
551 "ch->count is %d\n", ch->count); 545 "tty->count is 1, ch->count is %d\n", ch->count);
552 ch->count = 1; 546 ch->count = 1;
553 } 547 }
554 if (--ch->count < 0) { 548 if (--ch->count < 0) {
555 printk("moxa_close: bad serial port count, device=%s\n", 549 printk(KERN_WARNING "moxa_close: bad serial port count, "
556 tty->name); 550 "device=%s\n", tty->name);
557 ch->count = 0; 551 ch->count = 0;
558 } 552 }
559 if (ch->count) { 553 if (ch->count) {
@@ -563,11 +557,11 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
563 557
564 ch->cflag = tty->termios->c_cflag; 558 ch->cflag = tty->termios->c_cflag;
565 if (ch->asyncflags & ASYNC_INITIALIZED) { 559 if (ch->asyncflags & ASYNC_INITIALIZED) {
566 setup_empty_event(tty); 560 moxa_setup_empty_event(tty);
567 tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */ 561 tty_wait_until_sent(tty, 30 * HZ); /* 30 seconds timeout */
568 del_timer_sync(&moxa_ports[ch->port].emptyTimer); 562 del_timer_sync(&moxa_ports[ch->port].emptyTimer);
569 } 563 }
570 shut_down(ch); 564 moxa_shut_down(ch);
571 MoxaPortFlushData(port, 2); 565 MoxaPortFlushData(port, 2);
572 566
573 if (tty->driver->flush_buffer) 567 if (tty->driver->flush_buffer)
@@ -584,7 +578,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp)
584 wake_up_interruptible(&ch->open_wait); 578 wake_up_interruptible(&ch->open_wait);
585 } 579 }
586 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING); 580 ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
587 wake_up_interruptible(&ch->close_wait); 581 complete_all(&ch->close_wait);
588} 582}
589 583
590static int moxa_write(struct tty_struct *tty, 584static int moxa_write(struct tty_struct *tty,
@@ -653,7 +647,7 @@ static int moxa_chars_in_buffer(struct tty_struct *tty)
653 * in tty_ioctl.c, etc. 647 * in tty_ioctl.c, etc.
654 */ 648 */
655 if (!(ch->statusflags & EMPTYWAIT)) 649 if (!(ch->statusflags & EMPTYWAIT))
656 setup_empty_event(tty); 650 moxa_setup_empty_event(tty);
657 } 651 }
658 return (chars); 652 return (chars);
659} 653}
@@ -751,7 +745,7 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file,
751 retval = tty_check_change(tty); 745 retval = tty_check_change(tty);
752 if (retval) 746 if (retval)
753 return (retval); 747 return (retval);
754 setup_empty_event(tty); 748 moxa_setup_empty_event(tty);
755 tty_wait_until_sent(tty, 0); 749 tty_wait_until_sent(tty, 0);
756 if (!arg) 750 if (!arg)
757 MoxaPortSendBreak(ch->port, 0); 751 MoxaPortSendBreak(ch->port, 0);
@@ -760,7 +754,7 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file,
760 retval = tty_check_change(tty); 754 retval = tty_check_change(tty);
761 if (retval) 755 if (retval)
762 return (retval); 756 return (retval);
763 setup_empty_event(tty); 757 moxa_setup_empty_event(tty);
764 tty_wait_until_sent(tty, 0); 758 tty_wait_until_sent(tty, 0);
765 MoxaPortSendBreak(ch->port, arg); 759 MoxaPortSendBreak(ch->port, arg);
766 return (0); 760 return (0);
@@ -809,7 +803,7 @@ static void moxa_set_termios(struct tty_struct *tty,
809 803
810 if (ch == NULL) 804 if (ch == NULL)
811 return; 805 return;
812 set_tty_param(tty); 806 moxa_set_tty_param(tty);
813 if (!(old_termios->c_cflag & CLOCAL) && 807 if (!(old_termios->c_cflag & CLOCAL) &&
814 (tty->termios->c_cflag & CLOCAL)) 808 (tty->termios->c_cflag & CLOCAL))
815 wake_up_interruptible(&ch->open_wait); 809 wake_up_interruptible(&ch->open_wait);
@@ -845,7 +839,7 @@ static void moxa_hangup(struct tty_struct *tty)
845 struct moxa_port *ch = (struct moxa_port *) tty->driver_data; 839 struct moxa_port *ch = (struct moxa_port *) tty->driver_data;
846 840
847 moxa_flush_buffer(tty); 841 moxa_flush_buffer(tty);
848 shut_down(ch); 842 moxa_shut_down(ch);
849 ch->event = 0; 843 ch->event = 0;
850 ch->count = 0; 844 ch->count = 0;
851 ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; 845 ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE;
@@ -875,7 +869,7 @@ static void moxa_poll(unsigned long ignored)
875 continue; 869 continue;
876 if (!(ch->statusflags & THROTTLE) && 870 if (!(ch->statusflags & THROTTLE) &&
877 (MoxaPortRxQueue(ch->port) > 0)) 871 (MoxaPortRxQueue(ch->port) > 0))
878 receive_data(ch); 872 moxa_receive_data(ch);
879 if ((tp = ch->tty) == 0) 873 if ((tp = ch->tty) == 0)
880 continue; 874 continue;
881 if (ch->statusflags & LOWWAIT) { 875 if (ch->statusflags & LOWWAIT) {
@@ -909,7 +903,7 @@ static void moxa_poll(unsigned long ignored)
909 903
910/******************************************************************************/ 904/******************************************************************************/
911 905
912static void set_tty_param(struct tty_struct *tty) 906static void moxa_set_tty_param(struct tty_struct *tty)
913{ 907{
914 register struct ktermios *ts; 908 register struct ktermios *ts;
915 struct moxa_port *ch; 909 struct moxa_port *ch;
@@ -934,7 +928,7 @@ static void set_tty_param(struct tty_struct *tty)
934 MoxaPortSetTermio(ch->port, ts, tty_get_baud_rate(tty)); 928 MoxaPortSetTermio(ch->port, ts, tty_get_baud_rate(tty));
935} 929}
936 930
937static int block_till_ready(struct tty_struct *tty, struct file *filp, 931static int moxa_block_till_ready(struct tty_struct *tty, struct file *filp,
938 struct moxa_port *ch) 932 struct moxa_port *ch)
939{ 933{
940 DECLARE_WAITQUEUE(wait,current); 934 DECLARE_WAITQUEUE(wait,current);
@@ -948,7 +942,7 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp,
948 */ 942 */
949 if (tty_hung_up_p(filp) || (ch->asyncflags & ASYNC_CLOSING)) { 943 if (tty_hung_up_p(filp) || (ch->asyncflags & ASYNC_CLOSING)) {
950 if (ch->asyncflags & ASYNC_CLOSING) 944 if (ch->asyncflags & ASYNC_CLOSING)
951 interruptible_sleep_on(&ch->close_wait); 945 wait_for_completion_interruptible(&ch->close_wait);
952#ifdef SERIAL_DO_RESTART 946#ifdef SERIAL_DO_RESTART
953 if (ch->asyncflags & ASYNC_HUP_NOTIFY) 947 if (ch->asyncflags & ASYNC_HUP_NOTIFY)
954 return (-EAGAIN); 948 return (-EAGAIN);
@@ -971,10 +965,8 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp,
971 */ 965 */
972 retval = 0; 966 retval = 0;
973 add_wait_queue(&ch->open_wait, &wait); 967 add_wait_queue(&ch->open_wait, &wait);
974#ifdef SERIAL_DEBUG_OPEN 968 pr_debug("block_til_ready before block: ttys%d, count = %d\n",
975 printk("block_til_ready before block: ttys%d, count = %d\n", 969 ch->port, ch->count);
976 ch->line, ch->count);
977#endif
978 spin_lock_irqsave(&moxa_lock, flags); 970 spin_lock_irqsave(&moxa_lock, flags);
979 if (!tty_hung_up_p(filp)) 971 if (!tty_hung_up_p(filp))
980 ch->count--; 972 ch->count--;
@@ -1013,10 +1005,8 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp,
1013 ch->count++; 1005 ch->count++;
1014 ch->blocked_open--; 1006 ch->blocked_open--;
1015 spin_unlock_irqrestore(&moxa_lock, flags); 1007 spin_unlock_irqrestore(&moxa_lock, flags);
1016#ifdef SERIAL_DEBUG_OPEN 1008 pr_debug("block_til_ready after blocking: ttys%d, count = %d\n",
1017 printk("block_til_ready after blocking: ttys%d, count = %d\n", 1009 ch->port, ch->count);
1018 ch->line, ch->count);
1019#endif
1020 if (retval) 1010 if (retval)
1021 return (retval); 1011 return (retval);
1022 /* FIXME: review to see if we need to use set_bit on these */ 1012 /* FIXME: review to see if we need to use set_bit on these */
@@ -1024,7 +1014,7 @@ static int block_till_ready(struct tty_struct *tty, struct file *filp,
1024 return 0; 1014 return 0;
1025} 1015}
1026 1016
1027static void setup_empty_event(struct tty_struct *tty) 1017static void moxa_setup_empty_event(struct tty_struct *tty)
1028{ 1018{
1029 struct moxa_port *ch = tty->driver_data; 1019 struct moxa_port *ch = tty->driver_data;
1030 unsigned long flags; 1020 unsigned long flags;
@@ -1035,24 +1025,24 @@ static void setup_empty_event(struct tty_struct *tty)
1035 spin_unlock_irqrestore(&moxa_lock, flags); 1025 spin_unlock_irqrestore(&moxa_lock, flags);
1036} 1026}
1037 1027
1038static void check_xmit_empty(unsigned long data) 1028static void moxa_check_xmit_empty(unsigned long data)
1039{ 1029{
1040 struct moxa_port *ch; 1030 struct moxa_port *ch;
1041 1031
1042 ch = (struct moxa_port *) data; 1032 ch = (struct moxa_port *) data;
1043 del_timer_sync(&moxa_ports[ch->port].emptyTimer);
1044 if (ch->tty && (ch->statusflags & EMPTYWAIT)) { 1033 if (ch->tty && (ch->statusflags & EMPTYWAIT)) {
1045 if (MoxaPortTxQueue(ch->port) == 0) { 1034 if (MoxaPortTxQueue(ch->port) == 0) {
1046 ch->statusflags &= ~EMPTYWAIT; 1035 ch->statusflags &= ~EMPTYWAIT;
1047 tty_wakeup(ch->tty); 1036 tty_wakeup(ch->tty);
1048 return; 1037 return;
1049 } 1038 }
1050 mod_timer(&moxa_ports[ch->port].emptyTimer, jiffies + HZ); 1039 mod_timer(&moxa_ports[ch->port].emptyTimer,
1040 round_jiffies(jiffies + HZ));
1051 } else 1041 } else
1052 ch->statusflags &= ~EMPTYWAIT; 1042 ch->statusflags &= ~EMPTYWAIT;
1053} 1043}
1054 1044
1055static void shut_down(struct moxa_port *ch) 1045static void moxa_shut_down(struct moxa_port *ch)
1056{ 1046{
1057 struct tty_struct *tp; 1047 struct tty_struct *tp;
1058 1048
@@ -1072,7 +1062,7 @@ static void shut_down(struct moxa_port *ch)
1072 ch->asyncflags &= ~ASYNC_INITIALIZED; 1062 ch->asyncflags &= ~ASYNC_INITIALIZED;
1073} 1063}
1074 1064
1075static void receive_data(struct moxa_port *ch) 1065static void moxa_receive_data(struct moxa_port *ch)
1076{ 1066{
1077 struct tty_struct *tp; 1067 struct tty_struct *tp;
1078 struct ktermios *ts; 1068 struct ktermios *ts;
@@ -1406,8 +1396,8 @@ static struct mon_str moxaLog;
1406static int moxaFuncTout = HZ / 2; 1396static int moxaFuncTout = HZ / 2;
1407 1397
1408static void moxafunc(void __iomem *, int, ushort); 1398static void moxafunc(void __iomem *, int, ushort);
1409static void wait_finish(void __iomem *); 1399static void moxa_wait_finish(void __iomem *);
1410static void low_water_check(void __iomem *); 1400static void moxa_low_water_check(void __iomem *);
1411static int moxaloadbios(int, unsigned char __user *, int); 1401static int moxaloadbios(int, unsigned char __user *, int);
1412static int moxafindcard(int); 1402static int moxafindcard(int);
1413static int moxaload320b(int, unsigned char __user *, int); 1403static int moxaload320b(int, unsigned char __user *, int);
@@ -1473,7 +1463,7 @@ void MoxaPortFlushData(int port, int mode)
1473 moxafunc(ofsAddr, FC_FlushQueue, mode); 1463 moxafunc(ofsAddr, FC_FlushQueue, mode);
1474 if (mode != 1) { 1464 if (mode != 1) {
1475 moxa_ports[port].lowChkFlag = 0; 1465 moxa_ports[port].lowChkFlag = 0;
1476 low_water_check(ofsAddr); 1466 moxa_low_water_check(ofsAddr);
1477 } 1467 }
1478} 1468}
1479 1469
@@ -1654,7 +1644,7 @@ int MoxaDriverPoll(void)
1654 if (moxa_ports[p].lowChkFlag) { 1644 if (moxa_ports[p].lowChkFlag) {
1655 moxa_ports[p].lowChkFlag = 0; 1645 moxa_ports[p].lowChkFlag = 0;
1656 ofsAddr = moxa_ports[p].tableAddr; 1646 ofsAddr = moxa_ports[p].tableAddr;
1657 low_water_check(ofsAddr); 1647 moxa_low_water_check(ofsAddr);
1658 } 1648 }
1659 } 1649 }
1660 } 1650 }
@@ -2081,7 +2071,7 @@ int MoxaPortSetTermio(int port, struct ktermios *termio, speed_t baud)
2081 writeb(termio->c_cc[VSTART], ofsAddr + FuncArg); 2071 writeb(termio->c_cc[VSTART], ofsAddr + FuncArg);
2082 writeb(termio->c_cc[VSTOP], ofsAddr + FuncArg1); 2072 writeb(termio->c_cc[VSTOP], ofsAddr + FuncArg1);
2083 writeb(FC_SetXonXoff, ofsAddr + FuncCode); 2073 writeb(FC_SetXonXoff, ofsAddr + FuncCode);
2084 wait_finish(ofsAddr); 2074 moxa_wait_finish(ofsAddr);
2085 2075
2086 } 2076 }
2087 return (0); 2077 return (0);
@@ -2480,10 +2470,10 @@ static void moxafunc(void __iomem *ofsAddr, int cmd, ushort arg)
2480 2470
2481 writew(arg, ofsAddr + FuncArg); 2471 writew(arg, ofsAddr + FuncArg);
2482 writew(cmd, ofsAddr + FuncCode); 2472 writew(cmd, ofsAddr + FuncCode);
2483 wait_finish(ofsAddr); 2473 moxa_wait_finish(ofsAddr);
2484} 2474}
2485 2475
2486static void wait_finish(void __iomem *ofsAddr) 2476static void moxa_wait_finish(void __iomem *ofsAddr)
2487{ 2477{
2488 unsigned long i, j; 2478 unsigned long i, j;
2489 2479
@@ -2496,7 +2486,7 @@ static void wait_finish(void __iomem *ofsAddr)
2496 } 2486 }
2497} 2487}
2498 2488
2499static void low_water_check(void __iomem *ofsAddr) 2489static void moxa_low_water_check(void __iomem *ofsAddr)
2500{ 2490{
2501 int len; 2491 int len;
2502 ushort rptr, wptr, mask; 2492 ushort rptr, wptr, mask;
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 2aee3fef0416..fd0abef7ee08 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -56,11 +56,11 @@
56#include <linux/mm.h> 56#include <linux/mm.h>
57#include <linux/delay.h> 57#include <linux/delay.h>
58#include <linux/pci.h> 58#include <linux/pci.h>
59#include <linux/bitops.h>
59 60
60#include <asm/system.h> 61#include <asm/system.h>
61#include <asm/io.h> 62#include <asm/io.h>
62#include <asm/irq.h> 63#include <asm/irq.h>
63#include <asm/bitops.h>
64#include <asm/uaccess.h> 64#include <asm/uaccess.h>
65 65
66#include "mxser.h" 66#include "mxser.h"
@@ -383,7 +383,6 @@ static int mxser_init(void);
383 383
384/* static void mxser_poll(unsigned long); */ 384/* static void mxser_poll(unsigned long); */
385static int mxser_get_ISA_conf(int, struct mxser_hwconf *); 385static int mxser_get_ISA_conf(int, struct mxser_hwconf *);
386static int mxser_get_PCI_conf(int, int, int, struct mxser_hwconf *);
387static void mxser_do_softint(struct work_struct *); 386static void mxser_do_softint(struct work_struct *);
388static int mxser_open(struct tty_struct *, struct file *); 387static int mxser_open(struct tty_struct *, struct file *);
389static void mxser_close(struct tty_struct *, struct file *); 388static void mxser_close(struct tty_struct *, struct file *);
@@ -422,7 +421,7 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout);
422static void mxser_startrx(struct tty_struct *tty); 421static void mxser_startrx(struct tty_struct *tty);
423static void mxser_stoprx(struct tty_struct *tty); 422static void mxser_stoprx(struct tty_struct *tty);
424 423
425 424#ifdef CONFIG_PCI
426static int CheckIsMoxaMust(int io) 425static int CheckIsMoxaMust(int io)
427{ 426{
428 u8 oldmcr, hwid; 427 u8 oldmcr, hwid;
@@ -445,6 +444,7 @@ static int CheckIsMoxaMust(int io)
445 } 444 }
446 return MOXA_OTHER_UART; 445 return MOXA_OTHER_UART;
447} 446}
447#endif
448 448
449/* above is modified by Victor Yu. 08-15-2002 */ 449/* above is modified by Victor Yu. 08-15-2002 */
450 450
@@ -1938,14 +1938,6 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id)
1938 inb(info->base + UART_MSR); 1938 inb(info->base + UART_MSR);
1939 continue; 1939 continue;
1940 } 1940 }
1941 /* above add by Victor Yu. 09-13-2002 */
1942 /*
1943 if (info->tty->flip.count < TTY_FLIPBUF_SIZE / 4) {
1944 info->IER |= MOXA_MUST_RECV_ISR;
1945 outb(info->IER, info->base + UART_IER);
1946 }
1947 */
1948
1949 1941
1950 /* mask by Victor Yu. 09-13-2002 1942 /* mask by Victor Yu. 09-13-2002
1951 if ( !info->tty || 1943 if ( !info->tty ||
@@ -2599,19 +2591,8 @@ static int mxser_change_speed(struct mxser_struct *info, struct ktermios *old_te
2599 info->IER |= UART_IER_MSI; 2591 info->IER |= UART_IER_MSI;
2600 if ((info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) { 2592 if ((info->type == PORT_16550A) || (info->IsMoxaMustChipFlag)) {
2601 info->MCR |= UART_MCR_AFE; 2593 info->MCR |= UART_MCR_AFE;
2602 /* status = mxser_get_msr(info->base, 0, info->port); */
2603/*
2604 save_flags(flags);
2605 cli();
2606 status = inb(baseaddr + UART_MSR);
2607 restore_flags(flags);
2608*/
2609 /* mxser_check_modem_status(info, status); */
2610 } else { 2594 } else {
2611 /* status = mxser_get_msr(info->base, 0, info->port); */
2612 /* MX_LOCK(&info->slock); */
2613 status = inb(info->base + UART_MSR); 2595 status = inb(info->base + UART_MSR);
2614 /* MX_UNLOCK(&info->slock); */
2615 if (info->tty->hw_stopped) { 2596 if (info->tty->hw_stopped) {
2616 if (status & UART_MSR_CTS) { 2597 if (status & UART_MSR_CTS) {
2617 info->tty->hw_stopped = 0; 2598 info->tty->hw_stopped = 0;
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 6a563932ba19..081c84c7b548 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -2,7 +2,7 @@
2 * mxser.c -- MOXA Smartio/Industio family multiport serial driver. 2 * mxser.c -- MOXA Smartio/Industio family multiport serial driver.
3 * 3 *
4 * Copyright (C) 1999-2006 Moxa Technologies (support@moxa.com.tw). 4 * Copyright (C) 1999-2006 Moxa Technologies (support@moxa.com.tw).
5 * Copyright (C) 2006 Jiri Slaby <jirislaby@gmail.com> 5 * Copyright (C) 2006-2007 Jiri Slaby <jirislaby@gmail.com>
6 * 6 *
7 * This code is loosely based on the 1.8 moxa driver which is based on 7 * This code is loosely based on the 1.8 moxa driver which is based on
8 * Linux serial driver, written by Linus Torvalds, Theodore T'so and 8 * Linux serial driver, written by Linus Torvalds, Theodore T'so and
@@ -39,16 +39,16 @@
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/pci.h> 41#include <linux/pci.h>
42#include <linux/bitops.h>
42 43
43#include <asm/system.h> 44#include <asm/system.h>
44#include <asm/io.h> 45#include <asm/io.h>
45#include <asm/irq.h> 46#include <asm/irq.h>
46#include <asm/bitops.h>
47#include <asm/uaccess.h> 47#include <asm/uaccess.h>
48 48
49#include "mxser_new.h" 49#include "mxser_new.h"
50 50
51#define MXSER_VERSION "2.0.1" /* 1.9.15 */ 51#define MXSER_VERSION "2.0.2" /* 1.10 */
52#define MXSERMAJOR 174 52#define MXSERMAJOR 174
53#define MXSERCUMAJOR 175 53#define MXSERCUMAJOR 175
54 54
@@ -72,6 +72,12 @@
72#define UART_MCR_AFE 0x20 72#define UART_MCR_AFE 0x20
73#define UART_LSR_SPECIAL 0x1E 73#define UART_LSR_SPECIAL 0x1E
74 74
75#define PCI_DEVICE_ID_CB108 0x1080
76#define PCI_DEVICE_ID_CB114 0x1142
77#define PCI_DEVICE_ID_CB134I 0x1341
78#define PCI_DEVICE_ID_CP138U 0x1380
79#define PCI_DEVICE_ID_POS104UL 0x1044
80
75 81
76#define C168_ASIC_ID 1 82#define C168_ASIC_ID 1
77#define C104_ASIC_ID 2 83#define C104_ASIC_ID 2
@@ -107,71 +113,63 @@ struct mxser_cardinfo {
107}; 113};
108 114
109static const struct mxser_cardinfo mxser_cards[] = { 115static const struct mxser_cardinfo mxser_cards[] = {
110 { 8, "C168 series", }, /* C168-ISA */ 116/* 0*/ { 8, "C168 series", },
111 { 4, "C104 series", }, /* C104-ISA */ 117 { 4, "C104 series", },
112 { 4, "CI-104J series", }, /* CI104J */ 118 { 4, "CI-104J series", },
113 { 8, "C168H/PCI series", }, /* C168-PCI */ 119 { 8, "C168H/PCI series", },
114 { 4, "C104H/PCI series", }, /* C104-PCI */ 120 { 4, "C104H/PCI series", },
115 { 4, "C102 series", MXSER_HAS2 }, /* C102-ISA */ 121/* 5*/ { 4, "C102 series", MXSER_HAS2 }, /* C102-ISA */
116 { 4, "CI-132 series", MXSER_HAS2 }, /* CI132 */ 122 { 4, "CI-132 series", MXSER_HAS2 },
117 { 4, "CI-134 series", }, /* CI134 */ 123 { 4, "CI-134 series", },
118 { 2, "CP-132 series", }, /* CP132 */ 124 { 2, "CP-132 series", },
119 { 4, "CP-114 series", }, /* CP114 */ 125 { 4, "CP-114 series", },
120 { 4, "CT-114 series", }, /* CT114 */ 126/*10*/ { 4, "CT-114 series", },
121 { 2, "CP-102 series", MXSER_HIGHBAUD }, /* CP102 */ 127 { 2, "CP-102 series", MXSER_HIGHBAUD },
122 { 4, "CP-104U series", }, /* CP104U */ 128 { 4, "CP-104U series", },
123 { 8, "CP-168U series", }, /* CP168U */ 129 { 8, "CP-168U series", },
124 { 2, "CP-132U series", }, /* CP132U */ 130 { 2, "CP-132U series", },
125 { 4, "CP-134U series", }, /* CP134U */ 131/*15*/ { 4, "CP-134U series", },
126 { 4, "CP-104JU series", }, /* CP104JU */ 132 { 4, "CP-104JU series", },
127 { 8, "Moxa UC7000 Serial", }, /* RC7000 */ 133 { 8, "Moxa UC7000 Serial", }, /* RC7000 */
128 { 8, "CP-118U series", }, /* CP118U */ 134 { 8, "CP-118U series", },
129 { 2, "CP-102UL series", }, /* CP102UL */ 135 { 2, "CP-102UL series", },
130 { 2, "CP-102U series", }, /* CP102U */ 136/*20*/ { 2, "CP-102U series", },
131 { 8, "CP-118EL series", }, /* CP118EL */ 137 { 8, "CP-118EL series", },
132 { 8, "CP-168EL series", }, /* CP168EL */ 138 { 8, "CP-168EL series", },
133 { 4, "CP-104EL series", } /* CP104EL */ 139 { 4, "CP-104EL series", },
140 { 8, "CB-108 series", },
141/*25*/ { 4, "CB-114 series", },
142 { 4, "CB-134I series", },
143 { 8, "CP-138U series", },
144 { 4, "POS-104UL series", }
134}; 145};
135 146
136/* driver_data correspond to the lines in the structure above 147/* driver_data correspond to the lines in the structure above
137 see also ISA probe function before you change something */ 148 see also ISA probe function before you change something */
138static struct pci_device_id mxser_pcibrds[] = { 149static struct pci_device_id mxser_pcibrds[] = {
139 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_C168), 150 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C168), .driver_data = 3 },
140 .driver_data = 3 }, 151 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104), .driver_data = 4 },
141 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_C104), 152 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132), .driver_data = 8 },
142 .driver_data = 4 }, 153 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114), .driver_data = 9 },
143 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132), 154 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CT114), .driver_data = 10 },
144 .driver_data = 8 }, 155 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102), .driver_data = 11 },
145 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP114), 156 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104U), .driver_data = 12 },
146 .driver_data = 9 }, 157 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168U), .driver_data = 13 },
147 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CT114), 158 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132U), .driver_data = 14 },
148 .driver_data = 10 }, 159 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134U), .driver_data = 15 },
149 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102), 160 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104JU),.driver_data = 16 },
150 .driver_data = 11 }, 161 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_RC7000), .driver_data = 17 },
151 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104U), 162 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118U), .driver_data = 18 },
152 .driver_data = 12 }, 163 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102UL),.driver_data = 19 },
153 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168U), 164 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102U), .driver_data = 20 },
154 .driver_data = 13 }, 165 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL),.driver_data = 21 },
155 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132U), 166 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL),.driver_data = 22 },
156 .driver_data = 14 }, 167 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL),.driver_data = 23 },
157 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP134U), 168 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB108), .driver_data = 24 },
158 .driver_data = 15 }, 169 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB114), .driver_data = 25 },
159 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104JU), 170 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CB134I), .driver_data = 26 },
160 .driver_data = 16 }, 171 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_CP138U), .driver_data = 27 },
161 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_RC7000), 172 { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_POS104UL), .driver_data = 28 },
162 .driver_data = 17 },
163 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118U),
164 .driver_data = 18 },
165 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102UL),
166 .driver_data = 19 },
167 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102U),
168 .driver_data = 20 },
169 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118EL),
170 .driver_data = 21 },
171 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168EL),
172 .driver_data = 22 },
173 { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104EL),
174 .driver_data = 23 },
175 { } 173 { }
176}; 174};
177MODULE_DEVICE_TABLE(pci, mxser_pcibrds); 175MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 038056911934..596c7173997b 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -437,7 +437,7 @@ static inline void finish_erasing(struct tty_struct *tty)
437 * @c: character input 437 * @c: character input
438 * @tty: terminal device 438 * @tty: terminal device
439 * 439 *
440 * Perform erase and neccessary output when an erase character is 440 * Perform erase and necessary output when an erase character is
441 * present in the stream from the driver layer. Handles the complexities 441 * present in the stream from the driver layer. Handles the complexities
442 * of UTF-8 multibyte symbols. 442 * of UTF-8 multibyte symbols.
443 */ 443 */
@@ -657,7 +657,7 @@ static inline void n_tty_receive_overrun(struct tty_struct *tty)
657 * @c: character 657 * @c: character
658 * 658 *
659 * Process a parity error and queue the right data to indicate 659 * Process a parity error and queue the right data to indicate
660 * the error case if neccessary. Locking as per n_tty_receive_buf. 660 * the error case if necessary. Locking as per n_tty_receive_buf.
661 */ 661 */
662static inline void n_tty_receive_parity_error(struct tty_struct *tty, 662static inline void n_tty_receive_parity_error(struct tty_struct *tty,
663 unsigned char c) 663 unsigned char c)
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 73de77105fea..706ff34728f1 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -318,7 +318,7 @@ int pty_limit = NR_UNIX98_PTY_DEFAULT;
318static int pty_limit_min = 0; 318static int pty_limit_min = 0;
319static int pty_limit_max = NR_UNIX98_PTY_MAX; 319static int pty_limit_max = NR_UNIX98_PTY_MAX;
320 320
321ctl_table pty_table[] = { 321static struct ctl_table pty_table[] = {
322 { 322 {
323 .ctl_name = PTY_MAX, 323 .ctl_name = PTY_MAX,
324 .procname = "max", 324 .procname = "max",
@@ -340,6 +340,27 @@ ctl_table pty_table[] = {
340 } 340 }
341}; 341};
342 342
343static struct ctl_table pty_kern_table[] = {
344 {
345 .ctl_name = KERN_PTY,
346 .procname = "pty",
347 .mode = 0555,
348 .child = pty_table,
349 },
350 {}
351};
352
353static struct ctl_table pty_root_table[] = {
354 {
355 .ctl_name = CTL_KERN,
356 .procname = "kernel",
357 .mode = 0555,
358 .child = pty_kern_table,
359 },
360 {}
361};
362
363
343static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file, 364static int pty_unix98_ioctl(struct tty_struct *tty, struct file *file,
344 unsigned int cmd, unsigned long arg) 365 unsigned int cmd, unsigned long arg)
345{ 366{
@@ -404,6 +425,7 @@ static void __init unix98_pty_init(void)
404 panic("Couldn't register Unix98 pts driver"); 425 panic("Couldn't register Unix98 pts driver");
405 426
406 pty_table[1].data = &ptm_driver->refcount; 427 pty_table[1].data = &ptm_driver->refcount;
428 register_sysctl_table(pty_root_table);
407} 429}
408#else 430#else
409static inline void unix98_pty_init(void) { } 431static inline void unix98_pty_init(void) { }
diff --git a/drivers/char/random.c b/drivers/char/random.c
index af274e5a25ee..1756b1f7cb72 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -649,7 +649,7 @@ EXPORT_SYMBOL_GPL(add_input_randomness);
649 649
650void add_interrupt_randomness(int irq) 650void add_interrupt_randomness(int irq)
651{ 651{
652 if (irq >= NR_IRQS || irq_timer_state[irq] == 0) 652 if (irq >= NR_IRQS || irq_timer_state[irq] == NULL)
653 return; 653 return;
654 654
655 DEBUG_ENT("irq event %d\n", irq); 655 DEBUG_ENT("irq event %d\n", irq);
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 56cbba7b6ec0..d83419c3857e 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -84,6 +84,7 @@
84#include <linux/mutex.h> 84#include <linux/mutex.h>
85#include <linux/ioport.h> 85#include <linux/ioport.h>
86#include <linux/delay.h> 86#include <linux/delay.h>
87#include <linux/completion.h>
87#include <linux/wait.h> 88#include <linux/wait.h>
88#include <linux/pci.h> 89#include <linux/pci.h>
89#include <asm/uaccess.h> 90#include <asm/uaccess.h>
@@ -548,8 +549,8 @@ static void rp_handle_port(struct r_port *info)
548static void rp_do_poll(unsigned long dummy) 549static void rp_do_poll(unsigned long dummy)
549{ 550{
550 CONTROLLER_t *ctlp; 551 CONTROLLER_t *ctlp;
551 int ctrl, aiop, ch, line, i; 552 int ctrl, aiop, ch, line;
552 unsigned int xmitmask; 553 unsigned int xmitmask, i;
553 unsigned int CtlMask; 554 unsigned int CtlMask;
554 unsigned char AiopMask; 555 unsigned char AiopMask;
555 Word_t bit; 556 Word_t bit;
@@ -562,7 +563,7 @@ static void rp_do_poll(unsigned long dummy)
562 /* Get a ptr to the board's control struct */ 563 /* Get a ptr to the board's control struct */
563 ctlp = sCtlNumToCtlPtr(ctrl); 564 ctlp = sCtlNumToCtlPtr(ctrl);
564 565
565 /* Get the interupt status from the board */ 566 /* Get the interrupt status from the board */
566#ifdef CONFIG_PCI 567#ifdef CONFIG_PCI
567 if (ctlp->BusType == isPCI) 568 if (ctlp->BusType == isPCI)
568 CtlMask = sPCIGetControllerIntStatus(ctlp); 569 CtlMask = sPCIGetControllerIntStatus(ctlp);
@@ -650,7 +651,7 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
650 info->closing_wait = 3000; 651 info->closing_wait = 3000;
651 info->close_delay = 50; 652 info->close_delay = 50;
652 init_waitqueue_head(&info->open_wait); 653 init_waitqueue_head(&info->open_wait);
653 init_waitqueue_head(&info->close_wait); 654 init_completion(&info->close_wait);
654 info->flags &= ~ROCKET_MODE_MASK; 655 info->flags &= ~ROCKET_MODE_MASK;
655 switch (pc104[board][line]) { 656 switch (pc104[board][line]) {
656 case 422: 657 case 422:
@@ -699,8 +700,8 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
699 spin_lock_init(&info->slock); 700 spin_lock_init(&info->slock);
700 mutex_init(&info->write_mtx); 701 mutex_init(&info->write_mtx);
701 rp_table[line] = info; 702 rp_table[line] = info;
702 if (pci_dev) 703 tty_register_device(rocket_driver, line, pci_dev ? &pci_dev->dev :
703 tty_register_device(rocket_driver, line, &pci_dev->dev); 704 NULL);
704} 705}
705 706
706/* 707/*
@@ -878,7 +879,8 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
878 if (tty_hung_up_p(filp)) 879 if (tty_hung_up_p(filp))
879 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); 880 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS);
880 if (info->flags & ROCKET_CLOSING) { 881 if (info->flags & ROCKET_CLOSING) {
881 interruptible_sleep_on(&info->close_wait); 882 if (wait_for_completion_interruptible(&info->close_wait))
883 return -ERESTARTSYS;
882 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); 884 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS);
883 } 885 }
884 886
@@ -983,8 +985,10 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
983 return -ENOMEM; 985 return -ENOMEM;
984 986
985 if (info->flags & ROCKET_CLOSING) { 987 if (info->flags & ROCKET_CLOSING) {
986 interruptible_sleep_on(&info->close_wait); 988 retval = wait_for_completion_interruptible(&info->close_wait);
987 free_page(page); 989 free_page(page);
990 if (retval)
991 return retval;
988 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS); 992 return ((info->flags & ROCKET_HUP_NOTIFY) ? -EAGAIN : -ERESTARTSYS);
989 } 993 }
990 994
@@ -1176,7 +1180,7 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
1176 } 1180 }
1177 info->flags &= ~(ROCKET_INITIALIZED | ROCKET_CLOSING | ROCKET_NORMAL_ACTIVE); 1181 info->flags &= ~(ROCKET_INITIALIZED | ROCKET_CLOSING | ROCKET_NORMAL_ACTIVE);
1178 tty->closing = 0; 1182 tty->closing = 0;
1179 wake_up_interruptible(&info->close_wait); 1183 complete_all(&info->close_wait);
1180 atomic_dec(&rp_num_ports_open); 1184 atomic_dec(&rp_num_ports_open);
1181 1185
1182#ifdef ROCKET_DEBUG_OPEN 1186#ifdef ROCKET_DEBUG_OPEN
@@ -1869,8 +1873,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)
1869 int fast_clock = 0; 1873 int fast_clock = 0;
1870 int altChanRingIndicator = 0; 1874 int altChanRingIndicator = 0;
1871 int ports_per_aiop = 8; 1875 int ports_per_aiop = 8;
1872 int ret;
1873 unsigned int class_rev;
1874 WordIO_t ConfigIO = 0; 1876 WordIO_t ConfigIO = 0;
1875 ByteIO_t UPCIRingInd = 0; 1877 ByteIO_t UPCIRingInd = 0;
1876 1878
@@ -1878,12 +1880,6 @@ static __init int register_PCI(int i, struct pci_dev *dev)
1878 return 0; 1880 return 0;
1879 1881
1880 rcktpt_io_addr[i] = pci_resource_start(dev, 0); 1882 rcktpt_io_addr[i] = pci_resource_start(dev, 0);
1881 ret = pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
1882
1883 if (ret) {
1884 printk(KERN_INFO " Error during register_PCI(), unable to read config dword \n");
1885 return 0;
1886 }
1887 1883
1888 rcktpt_type[i] = ROCKET_TYPE_NORMAL; 1884 rcktpt_type[i] = ROCKET_TYPE_NORMAL;
1889 rocketModel[i].loadrm2 = 0; 1885 rocketModel[i].loadrm2 = 0;
@@ -2037,8 +2033,9 @@ static __init int register_PCI(int i, struct pci_dev *dev)
2037 ports_per_aiop = 6; 2033 ports_per_aiop = 6;
2038 str = "6-port"; 2034 str = "6-port";
2039 2035
2040 /* If class_rev is 1, the rocketmodem flash must be loaded. If it is 2 it is a "socketed" version. */ 2036 /* If revision is 1, the rocketmodem flash must be loaded.
2041 if ((class_rev & 0xFF) == 1) { 2037 * If it is 2 it is a "socketed" version. */
2038 if (dev->revision == 1) {
2042 rcktpt_type[i] = ROCKET_TYPE_MODEMII; 2039 rcktpt_type[i] = ROCKET_TYPE_MODEMII;
2043 rocketModel[i].loadrm2 = 1; 2040 rocketModel[i].loadrm2 = 1;
2044 } else { 2041 } else {
@@ -2053,7 +2050,7 @@ static __init int register_PCI(int i, struct pci_dev *dev)
2053 max_num_aiops = 1; 2050 max_num_aiops = 1;
2054 ports_per_aiop = 4; 2051 ports_per_aiop = 4;
2055 str = "4-port"; 2052 str = "4-port";
2056 if ((class_rev & 0xFF) == 1) { 2053 if (dev->revision == 1) {
2057 rcktpt_type[i] = ROCKET_TYPE_MODEMII; 2054 rcktpt_type[i] = ROCKET_TYPE_MODEMII;
2058 rocketModel[i].loadrm2 = 1; 2055 rocketModel[i].loadrm2 = 1;
2059 } else { 2056 } else {
@@ -2362,26 +2359,14 @@ static const struct tty_operations rocket_ops = {
2362 */ 2359 */
2363static int __init rp_init(void) 2360static int __init rp_init(void)
2364{ 2361{
2365 int retval, pci_boards_found, isa_boards_found, i; 2362 int ret = -ENOMEM, pci_boards_found, isa_boards_found, i;
2366 2363
2367 printk(KERN_INFO "RocketPort device driver module, version %s, %s\n", 2364 printk(KERN_INFO "RocketPort device driver module, version %s, %s\n",
2368 ROCKET_VERSION, ROCKET_DATE); 2365 ROCKET_VERSION, ROCKET_DATE);
2369 2366
2370 rocket_driver = alloc_tty_driver(MAX_RP_PORTS); 2367 rocket_driver = alloc_tty_driver(MAX_RP_PORTS);
2371 if (!rocket_driver) 2368 if (!rocket_driver)
2372 return -ENOMEM; 2369 goto err;
2373
2374 /*
2375 * Initialize the array of pointers to our own internal state
2376 * structures.
2377 */
2378 memset(rp_table, 0, sizeof (rp_table));
2379 memset(xmit_flags, 0, sizeof (xmit_flags));
2380
2381 for (i = 0; i < MAX_RP_PORTS; i++)
2382 lineNumbers[i] = 0;
2383 nextLineNumber = 0;
2384 memset(rocketModel, 0, sizeof (rocketModel));
2385 2370
2386 /* 2371 /*
2387 * If board 1 is non-zero, there is at least one ISA configured. If controller is 2372 * If board 1 is non-zero, there is at least one ISA configured. If controller is
@@ -2396,8 +2381,11 @@ static int __init rp_init(void)
2396 2381
2397 /* If an ISA card is configured, reserve the 4 byte IO space for the Mudbac controller */ 2382 /* If an ISA card is configured, reserve the 4 byte IO space for the Mudbac controller */
2398 if (controller && (!request_region(controller, 4, "Comtrol RocketPort"))) { 2383 if (controller && (!request_region(controller, 4, "Comtrol RocketPort"))) {
2399 printk(KERN_INFO "Unable to reserve IO region for first configured ISA RocketPort controller 0x%lx. Driver exiting \n", controller); 2384 printk(KERN_ERR "Unable to reserve IO region for first "
2400 return -EBUSY; 2385 "configured ISA RocketPort controller 0x%lx. "
2386 "Driver exiting\n", controller);
2387 ret = -EBUSY;
2388 goto err_tty;
2401 } 2389 }
2402 2390
2403 /* Store ISA variable retrieved from command line or .conf file. */ 2391 /* Store ISA variable retrieved from command line or .conf file. */
@@ -2434,15 +2422,14 @@ static int __init rp_init(void)
2434 rocket_driver->init_termios.c_ispeed = 9600; 2422 rocket_driver->init_termios.c_ispeed = 9600;
2435 rocket_driver->init_termios.c_ospeed = 9600; 2423 rocket_driver->init_termios.c_ospeed = 9600;
2436#ifdef ROCKET_SOFT_FLOW 2424#ifdef ROCKET_SOFT_FLOW
2437 rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; 2425 rocket_driver->flags |= TTY_DRIVER_REAL_RAW;
2438#endif 2426#endif
2439 tty_set_operations(rocket_driver, &rocket_ops); 2427 tty_set_operations(rocket_driver, &rocket_ops);
2440 2428
2441 retval = tty_register_driver(rocket_driver); 2429 ret = tty_register_driver(rocket_driver);
2442 if (retval < 0) { 2430 if (ret < 0) {
2443 printk(KERN_INFO "Couldn't install tty RocketPort driver (error %d)\n", -retval); 2431 printk(KERN_ERR "Couldn't install tty RocketPort driver\n");
2444 put_tty_driver(rocket_driver); 2432 goto err_tty;
2445 return -1;
2446 } 2433 }
2447 2434
2448#ifdef ROCKET_DEBUG_OPEN 2435#ifdef ROCKET_DEBUG_OPEN
@@ -2469,14 +2456,18 @@ static int __init rp_init(void)
2469 max_board = pci_boards_found + isa_boards_found; 2456 max_board = pci_boards_found + isa_boards_found;
2470 2457
2471 if (max_board == 0) { 2458 if (max_board == 0) {
2472 printk(KERN_INFO "No rocketport ports found; unloading driver.\n"); 2459 printk(KERN_ERR "No rocketport ports found; unloading driver\n");
2473 del_timer_sync(&rocket_timer); 2460 ret = -ENXIO;
2474 tty_unregister_driver(rocket_driver); 2461 goto err_ttyu;
2475 put_tty_driver(rocket_driver);
2476 return -ENXIO;
2477 } 2462 }
2478 2463
2479 return 0; 2464 return 0;
2465err_ttyu:
2466 tty_unregister_driver(rocket_driver);
2467err_tty:
2468 put_tty_driver(rocket_driver);
2469err:
2470 return ret;
2480} 2471}
2481 2472
2482 2473
@@ -2491,10 +2482,14 @@ static void rp_cleanup_module(void)
2491 if (retval) 2482 if (retval)
2492 printk(KERN_INFO "Error %d while trying to unregister " 2483 printk(KERN_INFO "Error %d while trying to unregister "
2493 "rocketport driver\n", -retval); 2484 "rocketport driver\n", -retval);
2494 put_tty_driver(rocket_driver);
2495 2485
2496 for (i = 0; i < MAX_RP_PORTS; i++) 2486 for (i = 0; i < MAX_RP_PORTS; i++)
2497 kfree(rp_table[i]); 2487 if (rp_table[i]) {
2488 tty_unregister_device(rocket_driver, i);
2489 kfree(rp_table[i]);
2490 }
2491
2492 put_tty_driver(rocket_driver);
2498 2493
2499 for (i = 0; i < NUM_BOARDS; i++) { 2494 for (i = 0; i < NUM_BOARDS; i++) {
2500 if (rcktpt_io_addr[i] <= 0 || is_PCI[i]) 2495 if (rcktpt_io_addr[i] <= 0 || is_PCI[i])
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index b4c53dfa7951..55b8f2d71a96 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1163,13 +1163,8 @@ struct r_port {
1163 int read_status_mask; 1163 int read_status_mask;
1164 int cps; 1164 int cps;
1165 1165
1166#ifdef DECLARE_WAITQUEUE
1167 wait_queue_head_t open_wait; 1166 wait_queue_head_t open_wait;
1168 wait_queue_head_t close_wait; 1167 struct completion close_wait;
1169#else
1170 struct wait_queue *open_wait;
1171 struct wait_queue *close_wait;
1172#endif
1173 spinlock_t slock; 1168 spinlock_t slock;
1174 struct mutex write_mtx; 1169 struct mutex write_mtx;
1175}; 1170};
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 859858561ab6..877e53dcb996 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org> 8 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
9 * 9 *
10 * Copyright (C) 2001-2002 Alcôve <www.alcove.com> 10 * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
11 * 11 *
12 * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au> 12 * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
13 * 13 *
@@ -1178,9 +1178,9 @@ static int __devinit sonypi_create_input_devices(void)
1178 jog_dev->id.bustype = BUS_ISA; 1178 jog_dev->id.bustype = BUS_ISA;
1179 jog_dev->id.vendor = PCI_VENDOR_ID_SONY; 1179 jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
1180 1180
1181 jog_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 1181 jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
1182 jog_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE); 1182 jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE);
1183 jog_dev->relbit[0] = BIT(REL_WHEEL); 1183 jog_dev->relbit[0] = BIT_MASK(REL_WHEEL);
1184 1184
1185 sonypi_device.input_key_dev = key_dev = input_allocate_device(); 1185 sonypi_device.input_key_dev = key_dev = input_allocate_device();
1186 if (!key_dev) { 1186 if (!key_dev) {
@@ -1193,7 +1193,7 @@ static int __devinit sonypi_create_input_devices(void)
1193 key_dev->id.vendor = PCI_VENDOR_ID_SONY; 1193 key_dev->id.vendor = PCI_VENDOR_ID_SONY;
1194 1194
1195 /* Initialize the Input Drivers: special keys */ 1195 /* Initialize the Input Drivers: special keys */
1196 key_dev->evbit[0] = BIT(EV_KEY); 1196 key_dev->evbit[0] = BIT_MASK(EV_KEY);
1197 for (i = 0; sonypi_inputkeys[i].sonypiev; i++) 1197 for (i = 0; sonypi_inputkeys[i].sonypiev; i++)
1198 if (sonypi_inputkeys[i].inputev) 1198 if (sonypi_inputkeys[i].inputev)
1199 set_bit(sonypi_inputkeys[i].inputev, key_dev->keybit); 1199 set_bit(sonypi_inputkeys[i].inputev, key_dev->keybit);
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 85a23283dff5..a6e1c9ba1217 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1467,7 +1467,7 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
1467 1467
1468 line = tty->index; 1468 line = tty->index;
1469 sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, " 1469 sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, "
1470 "np=%d)\n", current->pid, line, tty, 1470 "np=%d)\n", task_pid_nr(current), line, tty,
1471 current->signal->tty, sx_nports); 1471 current->signal->tty, sx_nports);
1472 1472
1473 if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports)) 1473 if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports))
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index 78d14935f2b8..de60e1ea4fb3 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -251,7 +251,7 @@ static void send_sig_all(int sig)
251 struct task_struct *p; 251 struct task_struct *p;
252 252
253 for_each_process(p) { 253 for_each_process(p) {
254 if (p->mm && !is_init(p)) 254 if (p->mm && !is_global_init(p))
255 /* Not swapper, init nor kernel thread */ 255 /* Not swapper, init nor kernel thread */
256 force_sig(sig, p); 256 force_sig(sig, p);
257 } 257 }
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 9c867cf6de64..f36fecd3fd26 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -103,6 +103,7 @@
103#include <linux/selection.h> 103#include <linux/selection.h>
104 104
105#include <linux/kmod.h> 105#include <linux/kmod.h>
106#include <linux/nsproxy.h>
106 107
107#undef TTY_DEBUG_HANGUP 108#undef TTY_DEBUG_HANGUP
108 109
@@ -942,7 +943,7 @@ EXPORT_SYMBOL_GPL(tty_ldisc_deref);
942 * @tty: terminal to activate ldisc on 943 * @tty: terminal to activate ldisc on
943 * 944 *
944 * Set the TTY_LDISC flag when the line discipline can be called 945 * Set the TTY_LDISC flag when the line discipline can be called
945 * again. Do neccessary wakeups for existing sleepers. 946 * again. Do necessary wakeups for existing sleepers.
946 * 947 *
947 * Note: nobody should set this bit except via this function. Clearing 948 * Note: nobody should set this bit except via this function. Clearing
948 * directly is allowed. 949 * directly is allowed.
@@ -1503,7 +1504,7 @@ EXPORT_SYMBOL(tty_hangup);
1503 * 1504 *
1504 * The user has asked via system call for the terminal to be hung up. 1505 * The user has asked via system call for the terminal to be hung up.
1505 * We do this synchronously so that when the syscall returns the process 1506 * We do this synchronously so that when the syscall returns the process
1506 * is complete. That guarantee is neccessary for security reasons. 1507 * is complete. That guarantee is necessary for security reasons.
1507 */ 1508 */
1508 1509
1509void tty_vhangup(struct tty_struct * tty) 1510void tty_vhangup(struct tty_struct * tty)
@@ -1690,7 +1691,7 @@ EXPORT_SYMBOL(stop_tty);
1690 * @tty: tty to start 1691 * @tty: tty to start
1691 * 1692 *
1692 * Start a tty that has been stopped if at all possible. Perform 1693 * Start a tty that has been stopped if at all possible. Perform
1693 * any neccessary wakeups and propagate the TIOCPKT status. If this 1694 * any necessary wakeups and propagate the TIOCPKT status. If this
1694 * is the tty was previous stopped and is being started then the 1695 * is the tty was previous stopped and is being started then the
1695 * driver start method is invoked and the line discipline woken. 1696 * driver start method is invoked and the line discipline woken.
1696 * 1697 *
@@ -2876,7 +2877,7 @@ static int tty_fasync(int fd, struct file * filp, int on)
2876 * @tty: tty to fake input into 2877 * @tty: tty to fake input into
2877 * @p: pointer to character 2878 * @p: pointer to character
2878 * 2879 *
2879 * Fake input to a tty device. Does the neccessary locking and 2880 * Fake input to a tty device. Does the necessary locking and
2880 * input management. 2881 * input management.
2881 * 2882 *
2882 * FIXME: does not honour flow control ?? 2883 * FIXME: does not honour flow control ??
@@ -3107,7 +3108,7 @@ static int tiocgpgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
3107 */ 3108 */
3108 if (tty == real_tty && current->signal->tty != real_tty) 3109 if (tty == real_tty && current->signal->tty != real_tty)
3109 return -ENOTTY; 3110 return -ENOTTY;
3110 return put_user(pid_nr(real_tty->pgrp), p); 3111 return put_user(pid_vnr(real_tty->pgrp), p);
3111} 3112}
3112 3113
3113/** 3114/**
@@ -3141,7 +3142,7 @@ static int tiocspgrp(struct tty_struct *tty, struct tty_struct *real_tty, pid_t
3141 if (pgrp_nr < 0) 3142 if (pgrp_nr < 0)
3142 return -EINVAL; 3143 return -EINVAL;
3143 rcu_read_lock(); 3144 rcu_read_lock();
3144 pgrp = find_pid(pgrp_nr); 3145 pgrp = find_vpid(pgrp_nr);
3145 retval = -ESRCH; 3146 retval = -ESRCH;
3146 if (!pgrp) 3147 if (!pgrp)
3147 goto out_unlock; 3148 goto out_unlock;
@@ -3178,7 +3179,7 @@ static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t _
3178 return -ENOTTY; 3179 return -ENOTTY;
3179 if (!real_tty->session) 3180 if (!real_tty->session)
3180 return -ENOTTY; 3181 return -ENOTTY;
3181 return put_user(pid_nr(real_tty->session), p); 3182 return put_user(pid_vnr(real_tty->session), p);
3182} 3183}
3183 3184
3184/** 3185/**
@@ -3528,8 +3529,8 @@ void __do_SAK(struct tty_struct *tty)
3528 /* Kill the entire session */ 3529 /* Kill the entire session */
3529 do_each_pid_task(session, PIDTYPE_SID, p) { 3530 do_each_pid_task(session, PIDTYPE_SID, p) {
3530 printk(KERN_NOTICE "SAK: killed process %d" 3531 printk(KERN_NOTICE "SAK: killed process %d"
3531 " (%s): process_session(p)==tty->session\n", 3532 " (%s): task_session_nr(p)==tty->session\n",
3532 p->pid, p->comm); 3533 task_pid_nr(p), p->comm);
3533 send_sig(SIGKILL, p, 1); 3534 send_sig(SIGKILL, p, 1);
3534 } while_each_pid_task(session, PIDTYPE_SID, p); 3535 } while_each_pid_task(session, PIDTYPE_SID, p);
3535 /* Now kill any processes that happen to have the 3536 /* Now kill any processes that happen to have the
@@ -3538,8 +3539,8 @@ void __do_SAK(struct tty_struct *tty)
3538 do_each_thread(g, p) { 3539 do_each_thread(g, p) {
3539 if (p->signal->tty == tty) { 3540 if (p->signal->tty == tty) {
3540 printk(KERN_NOTICE "SAK: killed process %d" 3541 printk(KERN_NOTICE "SAK: killed process %d"
3541 " (%s): process_session(p)==tty->session\n", 3542 " (%s): task_session_nr(p)==tty->session\n",
3542 p->pid, p->comm); 3543 task_pid_nr(p), p->comm);
3543 send_sig(SIGKILL, p, 1); 3544 send_sig(SIGKILL, p, 1);
3544 continue; 3545 continue;
3545 } 3546 }
@@ -3559,7 +3560,7 @@ void __do_SAK(struct tty_struct *tty)
3559 filp->private_data == tty) { 3560 filp->private_data == tty) {
3560 printk(KERN_NOTICE "SAK: killed process %d" 3561 printk(KERN_NOTICE "SAK: killed process %d"
3561 " (%s): fd#%d opened to the tty\n", 3562 " (%s): fd#%d opened to the tty\n",
3562 p->pid, p->comm, i); 3563 task_pid_nr(p), p->comm, i);
3563 force_sig(SIGKILL, p); 3564 force_sig(SIGKILL, p);
3564 break; 3565 break;
3565 } 3566 }
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 745d552620bf..7a003504c265 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -228,7 +228,8 @@ EXPORT_SYMBOL(tty_termios_input_baud_rate);
228 * and will all go away once this is done. 228 * and will all go away once this is done.
229 */ 229 */
230 230
231void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) 231void tty_termios_encode_baud_rate(struct ktermios *termios,
232 speed_t ibaud, speed_t obaud)
232{ 233{
233 int i = 0; 234 int i = 0;
234 int ifound = -1, ofound = -1; 235 int ifound = -1, ofound = -1;
@@ -263,11 +264,15 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed
263 */ 264 */
264 265
265 do { 266 do {
266 if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) { 267 if (obaud - oclose <= baud_table[i] &&
268 obaud + oclose >= baud_table[i]) {
267 termios->c_cflag |= baud_bits[i]; 269 termios->c_cflag |= baud_bits[i];
268 ofound = i; 270 ofound = i;
269 } 271 }
270 if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) { 272 if (ibaud - iclose <= baud_table[i] &&
273 ibaud + iclose >= baud_table[i]) {
274 /* For the case input == output don't set IBAUD bits
275 if the user didn't do so */
271 if (ofound == i && !ibinput) 276 if (ofound == i && !ibinput)
272 ifound = i; 277 ifound = i;
273#ifdef IBSHIFT 278#ifdef IBSHIFT
@@ -439,7 +444,7 @@ static void change_termios(struct tty_struct * tty, struct ktermios * new_termio
439 * @arg: user data 444 * @arg: user data
440 * @opt: option information 445 * @opt: option information
441 * 446 *
442 * Helper function to prepare termios data and run neccessary other 447 * Helper function to prepare termios data and run necessary other
443 * functions before using change_termios to do the actual changes. 448 * functions before using change_termios to do the actual changes.
444 * 449 *
445 * Locking: 450 * Locking:
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 645ad9808982..7a5badfb7d84 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -99,6 +99,7 @@
99#include <linux/pm.h> 99#include <linux/pm.h>
100#include <linux/font.h> 100#include <linux/font.h>
101#include <linux/bitops.h> 101#include <linux/bitops.h>
102#include <linux/notifier.h>
102 103
103#include <asm/io.h> 104#include <asm/io.h>
104#include <asm/system.h> 105#include <asm/system.h>
@@ -158,11 +159,7 @@ static void blank_screen_t(unsigned long dummy);
158static void set_palette(struct vc_data *vc); 159static void set_palette(struct vc_data *vc);
159 160
160static int printable; /* Is console ready for printing? */ 161static int printable; /* Is console ready for printing? */
161#ifdef CONFIG_VT_UNICODE 162int default_utf8 = true;
162int default_utf8 = 1;
163#else
164int default_utf8;
165#endif
166module_param(default_utf8, int, S_IRUGO | S_IWUSR); 163module_param(default_utf8, int, S_IRUGO | S_IWUSR);
167 164
168/* 165/*
@@ -227,6 +224,35 @@ enum {
227}; 224};
228 225
229/* 226/*
227 * Notifier list for console events.
228 */
229static ATOMIC_NOTIFIER_HEAD(vt_notifier_list);
230
231int register_vt_notifier(struct notifier_block *nb)
232{
233 return atomic_notifier_chain_register(&vt_notifier_list, nb);
234}
235EXPORT_SYMBOL_GPL(register_vt_notifier);
236
237int unregister_vt_notifier(struct notifier_block *nb)
238{
239 return atomic_notifier_chain_unregister(&vt_notifier_list, nb);
240}
241EXPORT_SYMBOL_GPL(unregister_vt_notifier);
242
243static void notify_write(struct vc_data *vc, unsigned int unicode)
244{
245 struct vt_notifier_param param = { .vc = vc, unicode = unicode };
246 atomic_notifier_call_chain(&vt_notifier_list, VT_WRITE, &param);
247}
248
249static void notify_update(struct vc_data *vc)
250{
251 struct vt_notifier_param param = { .vc = vc };
252 atomic_notifier_call_chain(&vt_notifier_list, VT_UPDATE, &param);
253}
254
255/*
230 * Low-Level Functions 256 * Low-Level Functions
231 */ 257 */
232 258
@@ -722,6 +748,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
722 return -ENXIO; 748 return -ENXIO;
723 if (!vc_cons[currcons].d) { 749 if (!vc_cons[currcons].d) {
724 struct vc_data *vc; 750 struct vc_data *vc;
751 struct vt_notifier_param param;
725 752
726 /* prevent users from taking too much memory */ 753 /* prevent users from taking too much memory */
727 if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE)) 754 if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE))
@@ -733,7 +760,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
733 /* although the numbers above are not valid since long ago, the 760 /* although the numbers above are not valid since long ago, the
734 point is still up-to-date and the comment still has its value 761 point is still up-to-date and the comment still has its value
735 even if only as a historical artifact. --mj, July 1998 */ 762 even if only as a historical artifact. --mj, July 1998 */
736 vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL); 763 param.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL);
737 if (!vc) 764 if (!vc)
738 return -ENOMEM; 765 return -ENOMEM;
739 vc_cons[currcons].d = vc; 766 vc_cons[currcons].d = vc;
@@ -750,6 +777,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
750 } 777 }
751 vc->vc_kmalloced = 1; 778 vc->vc_kmalloced = 1;
752 vc_init(vc, vc->vc_rows, vc->vc_cols, 1); 779 vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
780 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param);
753 } 781 }
754 return 0; 782 return 0;
755} 783}
@@ -911,6 +939,8 @@ void vc_deallocate(unsigned int currcons)
911 939
912 if (vc_cons_allocated(currcons)) { 940 if (vc_cons_allocated(currcons)) {
913 struct vc_data *vc = vc_cons[currcons].d; 941 struct vc_data *vc = vc_cons[currcons].d;
942 struct vt_notifier_param param = { .vc = vc };
943 atomic_notifier_call_chain(&vt_notifier_list, VT_DEALLOCATE, &param);
914 vc->vc_sw->con_deinit(vc); 944 vc->vc_sw->con_deinit(vc);
915 put_pid(vc->vt_pid); 945 put_pid(vc->vt_pid);
916 module_put(vc->vc_sw->owner); 946 module_put(vc->vc_sw->owner);
@@ -1023,6 +1053,7 @@ static void lf(struct vc_data *vc)
1023 vc->vc_pos += vc->vc_size_row; 1053 vc->vc_pos += vc->vc_size_row;
1024 } 1054 }
1025 vc->vc_need_wrap = 0; 1055 vc->vc_need_wrap = 0;
1056 notify_write(vc, '\n');
1026} 1057}
1027 1058
1028static void ri(struct vc_data *vc) 1059static void ri(struct vc_data *vc)
@@ -1043,6 +1074,7 @@ static inline void cr(struct vc_data *vc)
1043{ 1074{
1044 vc->vc_pos -= vc->vc_x << 1; 1075 vc->vc_pos -= vc->vc_x << 1;
1045 vc->vc_need_wrap = vc->vc_x = 0; 1076 vc->vc_need_wrap = vc->vc_x = 0;
1077 notify_write(vc, '\r');
1046} 1078}
1047 1079
1048static inline void bs(struct vc_data *vc) 1080static inline void bs(struct vc_data *vc)
@@ -1051,6 +1083,7 @@ static inline void bs(struct vc_data *vc)
1051 vc->vc_pos -= 2; 1083 vc->vc_pos -= 2;
1052 vc->vc_x--; 1084 vc->vc_x--;
1053 vc->vc_need_wrap = 0; 1085 vc->vc_need_wrap = 0;
1086 notify_write(vc, '\b');
1054 } 1087 }
1055} 1088}
1056 1089
@@ -1597,6 +1630,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
1597 break; 1630 break;
1598 } 1631 }
1599 vc->vc_pos += (vc->vc_x << 1); 1632 vc->vc_pos += (vc->vc_x << 1);
1633 notify_write(vc, '\t');
1600 return; 1634 return;
1601 case 10: case 11: case 12: 1635 case 10: case 11: case 12:
1602 lf(vc); 1636 lf(vc);
@@ -2256,6 +2290,7 @@ rescan_last_byte:
2256 tc = conv_uni_to_pc(vc, ' '); /* A space is printed in the second column */ 2290 tc = conv_uni_to_pc(vc, ' '); /* A space is printed in the second column */
2257 if (tc < 0) tc = ' '; 2291 if (tc < 0) tc = ' ';
2258 } 2292 }
2293 notify_write(vc, c);
2259 2294
2260 if (inverse) { 2295 if (inverse) {
2261 FLUSH 2296 FLUSH
@@ -2278,6 +2313,7 @@ rescan_last_byte:
2278 release_console_sem(); 2313 release_console_sem();
2279 2314
2280out: 2315out:
2316 notify_update(vc);
2281 return n; 2317 return n;
2282#undef FLUSH 2318#undef FLUSH
2283} 2319}
@@ -2321,6 +2357,7 @@ static void console_callback(struct work_struct *ignored)
2321 do_blank_screen(0); 2357 do_blank_screen(0);
2322 blank_timer_expired = 0; 2358 blank_timer_expired = 0;
2323 } 2359 }
2360 notify_update(vc_cons[fg_console].d);
2324 2361
2325 release_console_sem(); 2362 release_console_sem();
2326} 2363}
@@ -2422,6 +2459,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
2422 continue; 2459 continue;
2423 } 2460 }
2424 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos); 2461 scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
2462 notify_write(vc, c);
2425 cnt++; 2463 cnt++;
2426 if (myx == vc->vc_cols - 1) { 2464 if (myx == vc->vc_cols - 1) {
2427 vc->vc_need_wrap = 1; 2465 vc->vc_need_wrap = 1;
@@ -2440,6 +2478,7 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
2440 } 2478 }
2441 } 2479 }
2442 set_cursor(vc); 2480 set_cursor(vc);
2481 notify_update(vc);
2443 2482
2444quit: 2483quit:
2445 clear_bit(0, &printing); 2484 clear_bit(0, &printing);
diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
new file mode 100644
index 000000000000..3bed4127d4ad
--- /dev/null
+++ b/drivers/cpuidle/Kconfig
@@ -0,0 +1,20 @@
1
2config CPU_IDLE
3 bool "CPU idle PM support"
4 help
5 CPU idle is a generic framework for supporting software-controlled
6 idle processor power management. It includes modular cross-platform
7 governors that can be swapped during runtime.
8
9 If you're using a mobile platform that supports CPU idle PM (e.g.
10 an ACPI-capable notebook), you should say Y here.
11
12config CPU_IDLE_GOV_LADDER
13 bool
14 depends on CPU_IDLE
15 default y
16
17config CPU_IDLE_GOV_MENU
18 bool
19 depends on CPU_IDLE && NO_HZ
20 default y
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
new file mode 100644
index 000000000000..5634f88379df
--- /dev/null
+++ b/drivers/cpuidle/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for cpuidle.
3#
4
5obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
new file mode 100644
index 000000000000..fdf4106b817b
--- /dev/null
+++ b/drivers/cpuidle/cpuidle.c
@@ -0,0 +1,295 @@
1/*
2 * cpuidle.c - core cpuidle infrastructure
3 *
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.
9 */
10
11#include <linux/kernel.h>
12#include <linux/mutex.h>
13#include <linux/sched.h>
14#include <linux/notifier.h>
15#include <linux/latency.h>
16#include <linux/cpu.h>
17#include <linux/cpuidle.h>
18
19#include "cpuidle.h"
20
21DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
22EXPORT_PER_CPU_SYMBOL_GPL(cpuidle_devices);
23
24DEFINE_MUTEX(cpuidle_lock);
25LIST_HEAD(cpuidle_detected_devices);
26static void (*pm_idle_old)(void);
27
28static int enabled_devices;
29
30/**
31 * cpuidle_idle_call - the main idle loop
32 *
33 * NOTE: no locks or semaphores should be used here
34 */
35static void cpuidle_idle_call(void)
36{
37 struct cpuidle_device *dev = __get_cpu_var(cpuidle_devices);
38 struct cpuidle_state *target_state;
39 int next_state;
40
41 /* check if the device is ready */
42 if (!dev || !dev->enabled) {
43 if (pm_idle_old)
44 pm_idle_old();
45 else
46 local_irq_enable();
47 return;
48 }
49
50 /* ask the governor for the next state */
51 next_state = cpuidle_curr_governor->select(dev);
52 if (need_resched())
53 return;
54 target_state = &dev->states[next_state];
55
56 /* enter the state and update stats */
57 dev->last_residency = target_state->enter(dev, target_state);
58 dev->last_state = target_state;
59 target_state->time += dev->last_residency;
60 target_state->usage++;
61
62 /* give the governor an opportunity to reflect on the outcome */
63 if (cpuidle_curr_governor->reflect)
64 cpuidle_curr_governor->reflect(dev);
65}
66
67/**
68 * cpuidle_install_idle_handler - installs the cpuidle idle loop handler
69 */
70void cpuidle_install_idle_handler(void)
71{
72 if (enabled_devices && (pm_idle != cpuidle_idle_call)) {
73 /* Make sure all changes finished before we switch to new idle */
74 smp_wmb();
75 pm_idle = cpuidle_idle_call;
76 }
77}
78
79/**
80 * cpuidle_uninstall_idle_handler - uninstalls the cpuidle idle loop handler
81 */
82void cpuidle_uninstall_idle_handler(void)
83{
84 if (enabled_devices && (pm_idle != pm_idle_old)) {
85 pm_idle = pm_idle_old;
86 cpu_idle_wait();
87 }
88}
89
90/**
91 * cpuidle_pause_and_lock - temporarily disables CPUIDLE
92 */
93void cpuidle_pause_and_lock(void)
94{
95 mutex_lock(&cpuidle_lock);
96 cpuidle_uninstall_idle_handler();
97}
98
99EXPORT_SYMBOL_GPL(cpuidle_pause_and_lock);
100
101/**
102 * cpuidle_resume_and_unlock - resumes CPUIDLE operation
103 */
104void cpuidle_resume_and_unlock(void)
105{
106 cpuidle_install_idle_handler();
107 mutex_unlock(&cpuidle_lock);
108}
109
110EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);
111
112/**
113 * cpuidle_enable_device - enables idle PM for a CPU
114 * @dev: the CPU
115 *
116 * This function must be called between cpuidle_pause_and_lock and
117 * cpuidle_resume_and_unlock when used externally.
118 */
119int cpuidle_enable_device(struct cpuidle_device *dev)
120{
121 int ret, i;
122
123 if (dev->enabled)
124 return 0;
125 if (!cpuidle_curr_driver || !cpuidle_curr_governor)
126 return -EIO;
127 if (!dev->state_count)
128 return -EINVAL;
129
130 if ((ret = cpuidle_add_state_sysfs(dev)))
131 return ret;
132
133 if (cpuidle_curr_governor->enable &&
134 (ret = cpuidle_curr_governor->enable(dev)))
135 goto fail_sysfs;
136
137 for (i = 0; i < dev->state_count; i++) {
138 dev->states[i].usage = 0;
139 dev->states[i].time = 0;
140 }
141 dev->last_residency = 0;
142 dev->last_state = NULL;
143
144 smp_wmb();
145
146 dev->enabled = 1;
147
148 enabled_devices++;
149 return 0;
150
151fail_sysfs:
152 cpuidle_remove_state_sysfs(dev);
153
154 return ret;
155}
156
157EXPORT_SYMBOL_GPL(cpuidle_enable_device);
158
159/**
160 * cpuidle_disable_device - disables idle PM for a CPU
161 * @dev: the CPU
162 *
163 * This function must be called between cpuidle_pause_and_lock and
164 * cpuidle_resume_and_unlock when used externally.
165 */
166void cpuidle_disable_device(struct cpuidle_device *dev)
167{
168 if (!dev->enabled)
169 return;
170 if (!cpuidle_curr_driver || !cpuidle_curr_governor)
171 return;
172
173 dev->enabled = 0;
174
175 if (cpuidle_curr_governor->disable)
176 cpuidle_curr_governor->disable(dev);
177
178 cpuidle_remove_state_sysfs(dev);
179 enabled_devices--;
180}
181
182EXPORT_SYMBOL_GPL(cpuidle_disable_device);
183
184/**
185 * cpuidle_register_device - registers a CPU's idle PM feature
186 * @dev: the cpu
187 */
188int cpuidle_register_device(struct cpuidle_device *dev)
189{
190 int ret;
191 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
192
193 if (!sys_dev)
194 return -EINVAL;
195 if (!try_module_get(cpuidle_curr_driver->owner))
196 return -EINVAL;
197
198 init_completion(&dev->kobj_unregister);
199
200 mutex_lock(&cpuidle_lock);
201
202 per_cpu(cpuidle_devices, dev->cpu) = dev;
203 list_add(&dev->device_list, &cpuidle_detected_devices);
204 if ((ret = cpuidle_add_sysfs(sys_dev))) {
205 mutex_unlock(&cpuidle_lock);
206 module_put(cpuidle_curr_driver->owner);
207 return ret;
208 }
209
210 cpuidle_enable_device(dev);
211 cpuidle_install_idle_handler();
212
213 mutex_unlock(&cpuidle_lock);
214
215 return 0;
216
217}
218
219EXPORT_SYMBOL_GPL(cpuidle_register_device);
220
221/**
222 * cpuidle_unregister_device - unregisters a CPU's idle PM feature
223 * @dev: the cpu
224 */
225void cpuidle_unregister_device(struct cpuidle_device *dev)
226{
227 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu);
228
229 cpuidle_pause_and_lock();
230
231 cpuidle_disable_device(dev);
232
233 cpuidle_remove_sysfs(sys_dev);
234 list_del(&dev->device_list);
235 wait_for_completion(&dev->kobj_unregister);
236 per_cpu(cpuidle_devices, dev->cpu) = NULL;
237
238 cpuidle_resume_and_unlock();
239
240 module_put(cpuidle_curr_driver->owner);
241}
242
243EXPORT_SYMBOL_GPL(cpuidle_unregister_device);
244
245#ifdef CONFIG_SMP
246
247static void smp_callback(void *v)
248{
249 /* we already woke the CPU up, nothing more to do */
250}
251
252/*
253 * This function gets called when a part of the kernel has a new latency
254 * requirement. This means we need to get all processors out of their C-state,
255 * and then recalculate a new suitable C-state. Just do a cross-cpu IPI; that
256 * wakes them all right up.
257 */
258static int cpuidle_latency_notify(struct notifier_block *b,
259 unsigned long l, void *v)
260{
261 smp_call_function(smp_callback, NULL, 0, 1);
262 return NOTIFY_OK;
263}
264
265static struct notifier_block cpuidle_latency_notifier = {
266 .notifier_call = cpuidle_latency_notify,
267};
268
269#define latency_notifier_init(x) do { register_latency_notifier(x); } while (0)
270
271#else /* CONFIG_SMP */
272
273#define latency_notifier_init(x) do { } while (0)
274
275#endif /* CONFIG_SMP */
276
277/**
278 * cpuidle_init - core initializer
279 */
280static int __init cpuidle_init(void)
281{
282 int ret;
283
284 pm_idle_old = pm_idle;
285
286 ret = cpuidle_add_class_sysfs(&cpu_sysdev_class);
287 if (ret)
288 return ret;
289
290 latency_notifier_init(&cpuidle_latency_notifier);
291
292 return 0;
293}
294
295core_initcall(cpuidle_init);
diff --git a/drivers/cpuidle/cpuidle.h b/drivers/cpuidle/cpuidle.h
new file mode 100644
index 000000000000..9476ba33ee2c
--- /dev/null
+++ b/drivers/cpuidle/cpuidle.h
@@ -0,0 +1,33 @@
1/*
2 * cpuidle.h - The internal header file
3 */
4
5#ifndef __DRIVER_CPUIDLE_H
6#define __DRIVER_CPUIDLE_H
7
8#include <linux/sysdev.h>
9
10/* For internal use only */
11extern struct cpuidle_governor *cpuidle_curr_governor;
12extern struct cpuidle_driver *cpuidle_curr_driver;
13extern struct list_head cpuidle_governors;
14extern struct list_head cpuidle_detected_devices;
15extern struct mutex cpuidle_lock;
16extern spinlock_t cpuidle_driver_lock;
17
18/* idle loop */
19extern void cpuidle_install_idle_handler(void);
20extern void cpuidle_uninstall_idle_handler(void);
21
22/* governors */
23extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
24
25/* sysfs */
26extern int cpuidle_add_class_sysfs(struct sysdev_class *cls);
27extern void cpuidle_remove_class_sysfs(struct sysdev_class *cls);
28extern int cpuidle_add_state_sysfs(struct cpuidle_device *device);
29extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device);
30extern int cpuidle_add_sysfs(struct sys_device *sysdev);
31extern void cpuidle_remove_sysfs(struct sys_device *sysdev);
32
33#endif /* __DRIVER_CPUIDLE_H */
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
new file mode 100644
index 000000000000..2257004fe33d
--- /dev/null
+++ b/drivers/cpuidle/driver.c
@@ -0,0 +1,56 @@
1/*
2 * driver.c - driver support
3 *
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.
9 */
10
11#include <linux/mutex.h>
12#include <linux/module.h>
13#include <linux/cpuidle.h>
14
15#include "cpuidle.h"
16
17struct cpuidle_driver *cpuidle_curr_driver;
18DEFINE_SPINLOCK(cpuidle_driver_lock);
19
20/**
21 * cpuidle_register_driver - registers a driver
22 * @drv: the driver
23 */
24int cpuidle_register_driver(struct cpuidle_driver *drv)
25{
26 if (!drv)
27 return -EINVAL;
28
29 spin_lock(&cpuidle_driver_lock);
30 if (cpuidle_curr_driver) {
31 spin_unlock(&cpuidle_driver_lock);
32 return -EBUSY;
33 }
34 cpuidle_curr_driver = drv;
35 spin_unlock(&cpuidle_driver_lock);
36
37 return 0;
38}
39
40EXPORT_SYMBOL_GPL(cpuidle_register_driver);
41
42/**
43 * cpuidle_unregister_driver - unregisters a driver
44 * @drv: the driver
45 */
46void cpuidle_unregister_driver(struct cpuidle_driver *drv)
47{
48 if (!drv)
49 return;
50
51 spin_lock(&cpuidle_driver_lock);
52 cpuidle_curr_driver = NULL;
53 spin_unlock(&cpuidle_driver_lock);
54}
55
56EXPORT_SYMBOL_GPL(cpuidle_unregister_driver);
diff --git a/drivers/cpuidle/governor.c b/drivers/cpuidle/governor.c
new file mode 100644
index 000000000000..bb699cb2dc5a
--- /dev/null
+++ b/drivers/cpuidle/governor.c
@@ -0,0 +1,141 @@
1/*
2 * governor.c - governor support
3 *
4 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.
9 */
10
11#include <linux/mutex.h>
12#include <linux/module.h>
13#include <linux/cpuidle.h>
14
15#include "cpuidle.h"
16
17LIST_HEAD(cpuidle_governors);
18struct cpuidle_governor *cpuidle_curr_governor;
19
20/**
21 * __cpuidle_find_governor - finds a governor of the specified name
22 * @str: the name
23 *
24 * Must be called with cpuidle_lock aquired.
25 */
26static struct cpuidle_governor * __cpuidle_find_governor(const char *str)
27{
28 struct cpuidle_governor *gov;
29
30 list_for_each_entry(gov, &cpuidle_governors, governor_list)
31 if (!strnicmp(str, gov->name, CPUIDLE_NAME_LEN))
32 return gov;
33
34 return NULL;
35}
36
37/**
38 * cpuidle_switch_governor - changes the governor
39 * @gov: the new target governor
40 *
41 * NOTE: "gov" can be NULL to specify disabled
42 * Must be called with cpuidle_lock aquired.
43 */
44int cpuidle_switch_governor(struct cpuidle_governor *gov)
45{
46 struct cpuidle_device *dev;
47
48 if (gov == cpuidle_curr_governor)
49 return 0;
50
51 cpuidle_uninstall_idle_handler();
52
53 if (cpuidle_curr_governor) {
54 list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
55 cpuidle_disable_device(dev);
56 module_put(cpuidle_curr_governor->owner);
57 }
58
59 cpuidle_curr_governor = gov;
60
61 if (gov) {
62 if (!try_module_get(cpuidle_curr_governor->owner))
63 return -EINVAL;
64 list_for_each_entry(dev, &cpuidle_detected_devices, device_list)
65 cpuidle_enable_device(dev);
66 cpuidle_install_idle_handler();
67 printk(KERN_INFO "cpuidle: using governor %s\n", gov->name);
68 }
69
70 return 0;
71}
72
73/**
74 * cpuidle_register_governor - registers a governor
75 * @gov: the governor
76 */
77int cpuidle_register_governor(struct cpuidle_governor *gov)
78{
79 int ret = -EEXIST;
80
81 if (!gov || !gov->select)
82 return -EINVAL;
83
84 mutex_lock(&cpuidle_lock);
85 if (__cpuidle_find_governor(gov->name) == NULL) {
86 ret = 0;
87 list_add_tail(&gov->governor_list, &cpuidle_governors);
88 if (!cpuidle_curr_governor ||
89 cpuidle_curr_governor->rating < gov->rating)
90 cpuidle_switch_governor(gov);
91 }
92 mutex_unlock(&cpuidle_lock);
93
94 return ret;
95}
96
97EXPORT_SYMBOL_GPL(cpuidle_register_governor);
98
99/**
100 * cpuidle_replace_governor - find a replacement governor
101 * @exclude_rating: the rating that will be skipped while looking for
102 * new governor.
103 */
104static struct cpuidle_governor *cpuidle_replace_governor(int exclude_rating)
105{
106 struct cpuidle_governor *gov;
107 struct cpuidle_governor *ret_gov = NULL;
108 unsigned int max_rating = 0;
109
110 list_for_each_entry(gov, &cpuidle_governors, governor_list) {
111 if (gov->rating == exclude_rating)
112 continue;
113 if (gov->rating > max_rating) {
114 max_rating = gov->rating;
115 ret_gov = gov;
116 }
117 }
118
119 return ret_gov;
120}
121
122/**
123 * cpuidle_unregister_governor - unregisters a governor
124 * @gov: the governor
125 */
126void cpuidle_unregister_governor(struct cpuidle_governor *gov)
127{
128 if (!gov)
129 return;
130
131 mutex_lock(&cpuidle_lock);
132 if (gov == cpuidle_curr_governor) {
133 struct cpuidle_governor *new_gov;
134 new_gov = cpuidle_replace_governor(gov->rating);
135 cpuidle_switch_governor(new_gov);
136 }
137 list_del(&gov->governor_list);
138 mutex_unlock(&cpuidle_lock);
139}
140
141EXPORT_SYMBOL_GPL(cpuidle_unregister_governor);
diff --git a/drivers/cpuidle/governors/Makefile b/drivers/cpuidle/governors/Makefile
new file mode 100644
index 000000000000..1b512722689f
--- /dev/null
+++ b/drivers/cpuidle/governors/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for cpuidle governors.
3#
4
5obj-$(CONFIG_CPU_IDLE_GOV_LADDER) += ladder.o
6obj-$(CONFIG_CPU_IDLE_GOV_MENU) += menu.o
diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c
new file mode 100644
index 000000000000..eb666ecae7c9
--- /dev/null
+++ b/drivers/cpuidle/governors/ladder.c
@@ -0,0 +1,166 @@
1/*
2 * ladder.c - the residency ladder algorithm
3 *
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * Copyright (C) 2004, 2005 Dominik Brodowski <linux@brodo.de>
7 *
8 * (C) 2006-2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
9 * Shaohua Li <shaohua.li@intel.com>
10 * Adam Belay <abelay@novell.com>
11 *
12 * This code is licenced under the GPL.
13 */
14
15#include <linux/kernel.h>
16#include <linux/cpuidle.h>
17#include <linux/latency.h>
18#include <linux/moduleparam.h>
19#include <linux/jiffies.h>
20
21#include <asm/io.h>
22#include <asm/uaccess.h>
23
24#define PROMOTION_COUNT 4
25#define DEMOTION_COUNT 1
26
27struct ladder_device_state {
28 struct {
29 u32 promotion_count;
30 u32 demotion_count;
31 u32 promotion_time;
32 u32 demotion_time;
33 } threshold;
34 struct {
35 int promotion_count;
36 int demotion_count;
37 } stats;
38};
39
40struct ladder_device {
41 struct ladder_device_state states[CPUIDLE_STATE_MAX];
42 int last_state_idx;
43};
44
45static DEFINE_PER_CPU(struct ladder_device, ladder_devices);
46
47/**
48 * ladder_do_selection - prepares private data for a state change
49 * @ldev: the ladder device
50 * @old_idx: the current state index
51 * @new_idx: the new target state index
52 */
53static inline void ladder_do_selection(struct ladder_device *ldev,
54 int old_idx, int new_idx)
55{
56 ldev->states[old_idx].stats.promotion_count = 0;
57 ldev->states[old_idx].stats.demotion_count = 0;
58 ldev->last_state_idx = new_idx;
59}
60
61/**
62 * ladder_select_state - selects the next state to enter
63 * @dev: the CPU
64 */
65static int ladder_select_state(struct cpuidle_device *dev)
66{
67 struct ladder_device *ldev = &__get_cpu_var(ladder_devices);
68 struct ladder_device_state *last_state;
69 int last_residency, last_idx = ldev->last_state_idx;
70
71 if (unlikely(!ldev))
72 return 0;
73
74 last_state = &ldev->states[last_idx];
75
76 if (dev->states[last_idx].flags & CPUIDLE_FLAG_TIME_VALID)
77 last_residency = cpuidle_get_last_residency(dev) - dev->states[last_idx].exit_latency;
78 else
79 last_residency = last_state->threshold.promotion_time + 1;
80
81 /* consider promotion */
82 if (last_idx < dev->state_count - 1 &&
83 last_residency > last_state->threshold.promotion_time &&
84 dev->states[last_idx + 1].exit_latency <= system_latency_constraint()) {
85 last_state->stats.promotion_count++;
86 last_state->stats.demotion_count = 0;
87 if (last_state->stats.promotion_count >= last_state->threshold.promotion_count) {
88 ladder_do_selection(ldev, last_idx, last_idx + 1);
89 return last_idx + 1;
90 }
91 }
92
93 /* consider demotion */
94 if (last_idx > 0 &&
95 last_residency < last_state->threshold.demotion_time) {
96 last_state->stats.demotion_count++;
97 last_state->stats.promotion_count = 0;
98 if (last_state->stats.demotion_count >= last_state->threshold.demotion_count) {
99 ladder_do_selection(ldev, last_idx, last_idx - 1);
100 return last_idx - 1;
101 }
102 }
103
104 /* otherwise remain at the current state */
105 return last_idx;
106}
107
108/**
109 * ladder_enable_device - setup for the governor
110 * @dev: the CPU
111 */
112static int ladder_enable_device(struct cpuidle_device *dev)
113{
114 int i;
115 struct ladder_device *ldev = &per_cpu(ladder_devices, dev->cpu);
116 struct ladder_device_state *lstate;
117 struct cpuidle_state *state;
118
119 ldev->last_state_idx = 0;
120
121 for (i = 0; i < dev->state_count; i++) {
122 state = &dev->states[i];
123 lstate = &ldev->states[i];
124
125 lstate->stats.promotion_count = 0;
126 lstate->stats.demotion_count = 0;
127
128 lstate->threshold.promotion_count = PROMOTION_COUNT;
129 lstate->threshold.demotion_count = DEMOTION_COUNT;
130
131 if (i < dev->state_count - 1)
132 lstate->threshold.promotion_time = state->exit_latency;
133 if (i > 0)
134 lstate->threshold.demotion_time = state->exit_latency;
135 }
136
137 return 0;
138}
139
140static struct cpuidle_governor ladder_governor = {
141 .name = "ladder",
142 .rating = 10,
143 .enable = ladder_enable_device,
144 .select = ladder_select_state,
145 .owner = THIS_MODULE,
146};
147
148/**
149 * init_ladder - initializes the governor
150 */
151static int __init init_ladder(void)
152{
153 return cpuidle_register_governor(&ladder_governor);
154}
155
156/**
157 * exit_ladder - exits the governor
158 */
159static void __exit exit_ladder(void)
160{
161 cpuidle_unregister_governor(&ladder_governor);
162}
163
164MODULE_LICENSE("GPL");
165module_init(init_ladder);
166module_exit(exit_ladder);
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
new file mode 100644
index 000000000000..299d45c3bdd2
--- /dev/null
+++ b/drivers/cpuidle/governors/menu.c
@@ -0,0 +1,137 @@
1/*
2 * menu.c - the menu idle governor
3 *
4 * Copyright (C) 2006-2007 Adam Belay <abelay@novell.com>
5 *
6 * This code is licenced under the GPL.
7 */
8
9#include <linux/kernel.h>
10#include <linux/cpuidle.h>
11#include <linux/latency.h>
12#include <linux/time.h>
13#include <linux/ktime.h>
14#include <linux/hrtimer.h>
15#include <linux/tick.h>
16
17#define BREAK_FUZZ 4 /* 4 us */
18
19struct menu_device {
20 int last_state_idx;
21
22 unsigned int expected_us;
23 unsigned int predicted_us;
24 unsigned int last_measured_us;
25 unsigned int elapsed_us;
26};
27
28static DEFINE_PER_CPU(struct menu_device, menu_devices);
29
30/**
31 * menu_select - selects the next idle state to enter
32 * @dev: the CPU
33 */
34static int menu_select(struct cpuidle_device *dev)
35{
36 struct menu_device *data = &__get_cpu_var(menu_devices);
37 int i;
38
39 /* determine the expected residency time */
40 data->expected_us =
41 (u32) ktime_to_ns(tick_nohz_get_sleep_length()) / 1000;
42
43 /* find the deepest idle state that satisfies our constraints */
44 for (i = 1; i < dev->state_count; i++) {
45 struct cpuidle_state *s = &dev->states[i];
46
47 if (s->target_residency > data->expected_us)
48 break;
49 if (s->target_residency > data->predicted_us)
50 break;
51 if (s->exit_latency > system_latency_constraint())
52 break;
53 }
54
55 data->last_state_idx = i - 1;
56 return i - 1;
57}
58
59/**
60 * menu_reflect - attempts to guess what happened after entry
61 * @dev: the CPU
62 *
63 * NOTE: it's important to be fast here because this operation will add to
64 * the overall exit latency.
65 */
66static void menu_reflect(struct cpuidle_device *dev)
67{
68 struct menu_device *data = &__get_cpu_var(menu_devices);
69 int last_idx = data->last_state_idx;
70 unsigned int measured_us =
71 cpuidle_get_last_residency(dev) + data->elapsed_us;
72 struct cpuidle_state *target = &dev->states[last_idx];
73
74 /*
75 * Ugh, this idle state doesn't support residency measurements, so we
76 * are basically lost in the dark. As a compromise, assume we slept
77 * for one full standard timer tick. However, be aware that this
78 * could potentially result in a suboptimal state transition.
79 */
80 if (!(target->flags & CPUIDLE_FLAG_TIME_VALID))
81 measured_us = USEC_PER_SEC / HZ;
82
83 /* Predict time remaining until next break event */
84 if (measured_us + BREAK_FUZZ < data->expected_us - target->exit_latency) {
85 data->predicted_us = max(measured_us, data->last_measured_us);
86 data->last_measured_us = measured_us;
87 data->elapsed_us = 0;
88 } else {
89 if (data->elapsed_us < data->elapsed_us + measured_us)
90 data->elapsed_us = measured_us;
91 else
92 data->elapsed_us = -1;
93 data->predicted_us = max(measured_us, data->last_measured_us);
94 }
95}
96
97/**
98 * menu_enable_device - scans a CPU's states and does setup
99 * @dev: the CPU
100 */
101static int menu_enable_device(struct cpuidle_device *dev)
102{
103 struct menu_device *data = &per_cpu(menu_devices, dev->cpu);
104
105 memset(data, 0, sizeof(struct menu_device));
106
107 return 0;
108}
109
110static struct cpuidle_governor menu_governor = {
111 .name = "menu",
112 .rating = 20,
113 .enable = menu_enable_device,
114 .select = menu_select,
115 .reflect = menu_reflect,
116 .owner = THIS_MODULE,
117};
118
119/**
120 * init_menu - initializes the governor
121 */
122static int __init init_menu(void)
123{
124 return cpuidle_register_governor(&menu_governor);
125}
126
127/**
128 * exit_menu - exits the governor
129 */
130static void __exit exit_menu(void)
131{
132 cpuidle_unregister_governor(&menu_governor);
133}
134
135MODULE_LICENSE("GPL");
136module_init(init_menu);
137module_exit(exit_menu);
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
new file mode 100644
index 000000000000..0f3515e77d4b
--- /dev/null
+++ b/drivers/cpuidle/sysfs.c
@@ -0,0 +1,361 @@
1/*
2 * sysfs.c - sysfs support
3 *
4 * (C) 2006-2007 Shaohua Li <shaohua.li@intel.com>
5 *
6 * This code is licenced under the GPL.
7 */
8
9#include <linux/kernel.h>
10#include <linux/cpuidle.h>
11#include <linux/sysfs.h>
12#include <linux/cpu.h>
13
14#include "cpuidle.h"
15
16static unsigned int sysfs_switch;
17static int __init cpuidle_sysfs_setup(char *unused)
18{
19 sysfs_switch = 1;
20 return 1;
21}
22__setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
23
24static ssize_t show_available_governors(struct sys_device *dev, char *buf)
25{
26 ssize_t i = 0;
27 struct cpuidle_governor *tmp;
28
29 mutex_lock(&cpuidle_lock);
30 list_for_each_entry(tmp, &cpuidle_governors, governor_list) {
31 if (i >= (ssize_t) ((PAGE_SIZE/sizeof(char)) - CPUIDLE_NAME_LEN - 2))
32 goto out;
33 i += scnprintf(&buf[i], CPUIDLE_NAME_LEN, "%s ", tmp->name);
34 }
35
36out:
37 i+= sprintf(&buf[i], "\n");
38 mutex_unlock(&cpuidle_lock);
39 return i;
40}
41
42static ssize_t show_current_driver(struct sys_device *dev, char *buf)
43{
44 ssize_t ret;
45
46 spin_lock(&cpuidle_driver_lock);
47 if (cpuidle_curr_driver)
48 ret = sprintf(buf, "%s\n", cpuidle_curr_driver->name);
49 else
50 ret = sprintf(buf, "none\n");
51 spin_unlock(&cpuidle_driver_lock);
52
53 return ret;
54}
55
56static ssize_t show_current_governor(struct sys_device *dev, char *buf)
57{
58 ssize_t ret;
59
60 mutex_lock(&cpuidle_lock);
61 if (cpuidle_curr_governor)
62 ret = sprintf(buf, "%s\n", cpuidle_curr_governor->name);
63 else
64 ret = sprintf(buf, "none\n");
65 mutex_unlock(&cpuidle_lock);
66
67 return ret;
68}
69
70static ssize_t store_current_governor(struct sys_device *dev,
71 const char *buf, size_t count)
72{
73 char gov_name[CPUIDLE_NAME_LEN];
74 int ret = -EINVAL;
75 size_t len = count;
76 struct cpuidle_governor *gov;
77
78 if (!len || len >= sizeof(gov_name))
79 return -EINVAL;
80
81 memcpy(gov_name, buf, len);
82 gov_name[len] = '\0';
83 if (gov_name[len - 1] == '\n')
84 gov_name[--len] = '\0';
85
86 mutex_lock(&cpuidle_lock);
87
88 list_for_each_entry(gov, &cpuidle_governors, governor_list) {
89 if (strlen(gov->name) == len && !strcmp(gov->name, gov_name)) {
90 ret = cpuidle_switch_governor(gov);
91 break;
92 }
93 }
94
95 mutex_unlock(&cpuidle_lock);
96
97 if (ret)
98 return ret;
99 else
100 return count;
101}
102
103static SYSDEV_ATTR(current_driver, 0444, show_current_driver, NULL);
104static SYSDEV_ATTR(current_governor_ro, 0444, show_current_governor, NULL);
105
106static struct attribute *cpuclass_default_attrs[] = {
107 &attr_current_driver.attr,
108 &attr_current_governor_ro.attr,
109 NULL
110};
111
112static SYSDEV_ATTR(available_governors, 0444, show_available_governors, NULL);
113static SYSDEV_ATTR(current_governor, 0644, show_current_governor,
114 store_current_governor);
115
116static struct attribute *cpuclass_switch_attrs[] = {
117 &attr_available_governors.attr,
118 &attr_current_driver.attr,
119 &attr_current_governor.attr,
120 NULL
121};
122
123static struct attribute_group cpuclass_attr_group = {
124 .attrs = cpuclass_default_attrs,
125 .name = "cpuidle",
126};
127
128/**
129 * cpuidle_add_class_sysfs - add CPU global sysfs attributes
130 */
131int cpuidle_add_class_sysfs(struct sysdev_class *cls)
132{
133 if (sysfs_switch)
134 cpuclass_attr_group.attrs = cpuclass_switch_attrs;
135
136 return sysfs_create_group(&cls->kset.kobj, &cpuclass_attr_group);
137}
138
139/**
140 * cpuidle_remove_class_sysfs - remove CPU global sysfs attributes
141 */
142void cpuidle_remove_class_sysfs(struct sysdev_class *cls)
143{
144 sysfs_remove_group(&cls->kset.kobj, &cpuclass_attr_group);
145}
146
147struct cpuidle_attr {
148 struct attribute attr;
149 ssize_t (*show)(struct cpuidle_device *, char *);
150 ssize_t (*store)(struct cpuidle_device *, const char *, size_t count);
151};
152
153#define define_one_ro(_name, show) \
154 static struct cpuidle_attr attr_##_name = __ATTR(_name, 0444, show, NULL)
155#define define_one_rw(_name, show, store) \
156 static struct cpuidle_attr attr_##_name = __ATTR(_name, 0644, show, store)
157
158#define kobj_to_cpuidledev(k) container_of(k, struct cpuidle_device, kobj)
159#define attr_to_cpuidleattr(a) container_of(a, struct cpuidle_attr, attr)
160static ssize_t cpuidle_show(struct kobject * kobj, struct attribute * attr ,char * buf)
161{
162 int ret = -EIO;
163 struct cpuidle_device *dev = kobj_to_cpuidledev(kobj);
164 struct cpuidle_attr * cattr = attr_to_cpuidleattr(attr);
165
166 if (cattr->show) {
167 mutex_lock(&cpuidle_lock);
168 ret = cattr->show(dev, buf);
169 mutex_unlock(&cpuidle_lock);
170 }
171 return ret;
172}
173
174static ssize_t cpuidle_store(struct kobject * kobj, struct attribute * attr,
175 const char * buf, size_t count)
176{
177 int ret = -EIO;
178 struct cpuidle_device *dev = kobj_to_cpuidledev(kobj);
179 struct cpuidle_attr * cattr = attr_to_cpuidleattr(attr);
180
181 if (cattr->store) {
182 mutex_lock(&cpuidle_lock);
183 ret = cattr->store(dev, buf, count);
184 mutex_unlock(&cpuidle_lock);
185 }
186 return ret;
187}
188
189static struct sysfs_ops cpuidle_sysfs_ops = {
190 .show = cpuidle_show,
191 .store = cpuidle_store,
192};
193
194static void cpuidle_sysfs_release(struct kobject *kobj)
195{
196 struct cpuidle_device *dev = kobj_to_cpuidledev(kobj);
197
198 complete(&dev->kobj_unregister);
199}
200
201static struct kobj_type ktype_cpuidle = {
202 .sysfs_ops = &cpuidle_sysfs_ops,
203 .release = cpuidle_sysfs_release,
204};
205
206struct cpuidle_state_attr {
207 struct attribute attr;
208 ssize_t (*show)(struct cpuidle_state *, char *);
209 ssize_t (*store)(struct cpuidle_state *, const char *, size_t);
210};
211
212#define define_one_state_ro(_name, show) \
213static struct cpuidle_state_attr attr_##_name = __ATTR(_name, 0444, show, NULL)
214
215#define define_show_state_function(_name) \
216static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
217{ \
218 return sprintf(buf, "%u\n", state->_name);\
219}
220
221static ssize_t show_state_name(struct cpuidle_state *state, char *buf)
222{
223 return sprintf(buf, "%s\n", state->name);
224}
225
226define_show_state_function(exit_latency)
227define_show_state_function(power_usage)
228define_show_state_function(usage)
229define_show_state_function(time)
230define_one_state_ro(name, show_state_name);
231define_one_state_ro(latency, show_state_exit_latency);
232define_one_state_ro(power, show_state_power_usage);
233define_one_state_ro(usage, show_state_usage);
234define_one_state_ro(time, show_state_time);
235
236static struct attribute *cpuidle_state_default_attrs[] = {
237 &attr_name.attr,
238 &attr_latency.attr,
239 &attr_power.attr,
240 &attr_usage.attr,
241 &attr_time.attr,
242 NULL
243};
244
245#define kobj_to_state_obj(k) container_of(k, struct cpuidle_state_kobj, kobj)
246#define kobj_to_state(k) (kobj_to_state_obj(k)->state)
247#define attr_to_stateattr(a) container_of(a, struct cpuidle_state_attr, attr)
248static ssize_t cpuidle_state_show(struct kobject * kobj,
249 struct attribute * attr ,char * buf)
250{
251 int ret = -EIO;
252 struct cpuidle_state *state = kobj_to_state(kobj);
253 struct cpuidle_state_attr * cattr = attr_to_stateattr(attr);
254
255 if (cattr->show)
256 ret = cattr->show(state, buf);
257
258 return ret;
259}
260
261static struct sysfs_ops cpuidle_state_sysfs_ops = {
262 .show = cpuidle_state_show,
263};
264
265static void cpuidle_state_sysfs_release(struct kobject *kobj)
266{
267 struct cpuidle_state_kobj *state_obj = kobj_to_state_obj(kobj);
268
269 complete(&state_obj->kobj_unregister);
270}
271
272static struct kobj_type ktype_state_cpuidle = {
273 .sysfs_ops = &cpuidle_state_sysfs_ops,
274 .default_attrs = cpuidle_state_default_attrs,
275 .release = cpuidle_state_sysfs_release,
276};
277
278static void inline cpuidle_free_state_kobj(struct cpuidle_device *device, int i)
279{
280 kobject_unregister(&device->kobjs[i]->kobj);
281 wait_for_completion(&device->kobjs[i]->kobj_unregister);
282 kfree(device->kobjs[i]);
283 device->kobjs[i] = NULL;
284}
285
286/**
287 * cpuidle_add_driver_sysfs - adds driver-specific sysfs attributes
288 * @device: the target device
289 */
290int cpuidle_add_state_sysfs(struct cpuidle_device *device)
291{
292 int i, ret = -ENOMEM;
293 struct cpuidle_state_kobj *kobj;
294
295 /* state statistics */
296 for (i = 0; i < device->state_count; i++) {
297 kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL);
298 if (!kobj)
299 goto error_state;
300 kobj->state = &device->states[i];
301 init_completion(&kobj->kobj_unregister);
302
303 kobj->kobj.parent = &device->kobj;
304 kobj->kobj.ktype = &ktype_state_cpuidle;
305 kobject_set_name(&kobj->kobj, "state%d", i);
306 ret = kobject_register(&kobj->kobj);
307 if (ret) {
308 kfree(kobj);
309 goto error_state;
310 }
311 device->kobjs[i] = kobj;
312 }
313
314 return 0;
315
316error_state:
317 for (i = i - 1; i >= 0; i--)
318 cpuidle_free_state_kobj(device, i);
319 return ret;
320}
321
322/**
323 * cpuidle_remove_driver_sysfs - removes driver-specific sysfs attributes
324 * @device: the target device
325 */
326void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
327{
328 int i;
329
330 for (i = 0; i < device->state_count; i++)
331 cpuidle_free_state_kobj(device, i);
332}
333
334/**
335 * cpuidle_add_sysfs - creates a sysfs instance for the target device
336 * @sysdev: the target device
337 */
338int cpuidle_add_sysfs(struct sys_device *sysdev)
339{
340 int cpu = sysdev->id;
341 struct cpuidle_device *dev;
342
343 dev = per_cpu(cpuidle_devices, cpu);
344 dev->kobj.parent = &sysdev->kobj;
345 dev->kobj.ktype = &ktype_cpuidle;
346 kobject_set_name(&dev->kobj, "%s", "cpuidle");
347 return kobject_register(&dev->kobj);
348}
349
350/**
351 * cpuidle_remove_sysfs - deletes a sysfs instance on the target device
352 * @sysdev: the target device
353 */
354void cpuidle_remove_sysfs(struct sys_device *sysdev)
355{
356 int cpu = sysdev->id;
357 struct cpuidle_device *dev;
358
359 dev = per_cpu(cpuidle_devices, cpu);
360 kobject_unregister(&dev->kobj);
361}
diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c
index f7276bf2fe7e..f204c39fb412 100644
--- a/drivers/dma/ioat.c
+++ b/drivers/dma/ioat.c
@@ -34,7 +34,7 @@
34#include "ioatdma_registers.h" 34#include "ioatdma_registers.h"
35#include "ioatdma_hw.h" 35#include "ioatdma_hw.h"
36 36
37MODULE_VERSION("1.24"); 37MODULE_VERSION(IOAT_DMA_VERSION);
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39MODULE_AUTHOR("Intel Corporation"); 39MODULE_AUTHOR("Intel Corporation");
40 40
@@ -55,9 +55,7 @@ struct ioat_device {
55 55
56static int __devinit ioat_probe(struct pci_dev *pdev, 56static int __devinit ioat_probe(struct pci_dev *pdev,
57 const struct pci_device_id *id); 57 const struct pci_device_id *id);
58#ifdef IOAT_DMA_REMOVE
59static void __devexit ioat_remove(struct pci_dev *pdev); 58static void __devexit ioat_remove(struct pci_dev *pdev);
60#endif
61 59
62static int ioat_dca_enabled = 1; 60static int ioat_dca_enabled = 1;
63module_param(ioat_dca_enabled, int, 0644); 61module_param(ioat_dca_enabled, int, 0644);
@@ -73,7 +71,7 @@ static int ioat_setup_functionality(struct pci_dev *pdev, void __iomem *iobase)
73 switch (version) { 71 switch (version) {
74 case IOAT_VER_1_2: 72 case IOAT_VER_1_2:
75 device->dma = ioat_dma_probe(pdev, iobase); 73 device->dma = ioat_dma_probe(pdev, iobase);
76 if (ioat_dca_enabled) 74 if (device->dma && ioat_dca_enabled)
77 device->dca = ioat_dca_init(pdev, iobase); 75 device->dca = ioat_dca_init(pdev, iobase);
78 break; 76 break;
79 default: 77 default:
@@ -87,27 +85,25 @@ static void ioat_shutdown_functionality(struct pci_dev *pdev)
87{ 85{
88 struct ioat_device *device = pci_get_drvdata(pdev); 86 struct ioat_device *device = pci_get_drvdata(pdev);
89 87
90 if (device->dma) { 88 dev_err(&pdev->dev, "Removing dma and dca services\n");
91 ioat_dma_remove(device->dma);
92 device->dma = NULL;
93 }
94
95 if (device->dca) { 89 if (device->dca) {
96 unregister_dca_provider(device->dca); 90 unregister_dca_provider(device->dca);
97 free_dca_provider(device->dca); 91 free_dca_provider(device->dca);
98 device->dca = NULL; 92 device->dca = NULL;
99 } 93 }
100 94
95 if (device->dma) {
96 ioat_dma_remove(device->dma);
97 device->dma = NULL;
98 }
101} 99}
102 100
103static struct pci_driver ioat_pci_drv = { 101static struct pci_driver ioat_pci_driver = {
104 .name = "ioatdma", 102 .name = "ioatdma",
105 .id_table = ioat_pci_tbl, 103 .id_table = ioat_pci_tbl,
106 .probe = ioat_probe, 104 .probe = ioat_probe,
107 .shutdown = ioat_shutdown_functionality, 105 .shutdown = ioat_shutdown_functionality,
108#ifdef IOAT_DMA_REMOVE
109 .remove = __devexit_p(ioat_remove), 106 .remove = __devexit_p(ioat_remove),
110#endif
111}; 107};
112 108
113static int __devinit ioat_probe(struct pci_dev *pdev, 109static int __devinit ioat_probe(struct pci_dev *pdev,
@@ -122,7 +118,7 @@ static int __devinit ioat_probe(struct pci_dev *pdev,
122 if (err) 118 if (err)
123 goto err_enable_device; 119 goto err_enable_device;
124 120
125 err = pci_request_regions(pdev, ioat_pci_drv.name); 121 err = pci_request_regions(pdev, ioat_pci_driver.name);
126 if (err) 122 if (err)
127 goto err_request_regions; 123 goto err_request_regions;
128 124
@@ -176,13 +172,11 @@ err_enable_device:
176 return err; 172 return err;
177} 173}
178 174
179#ifdef IOAT_DMA_REMOVE
180/* 175/*
181 * It is unsafe to remove this module: if removed while a requested 176 * It is unsafe to remove this module: if removed while a requested
182 * dma is outstanding, esp. from tcp, it is possible to hang while 177 * dma is outstanding, esp. from tcp, it is possible to hang while
183 * waiting for something that will never finish, thus hanging at 178 * waiting for something that will never finish. However, if you're
184 * least one cpu. However, if you're feeling lucky and need to do 179 * feeling lucky, this usually works just fine.
185 * some testing, this usually works just fine.
186 */ 180 */
187static void __devexit ioat_remove(struct pci_dev *pdev) 181static void __devexit ioat_remove(struct pci_dev *pdev)
188{ 182{
@@ -191,21 +185,16 @@ static void __devexit ioat_remove(struct pci_dev *pdev)
191 ioat_shutdown_functionality(pdev); 185 ioat_shutdown_functionality(pdev);
192 186
193 kfree(device); 187 kfree(device);
194
195 iounmap(device->iobase);
196 pci_release_regions(pdev);
197 pci_disable_device(pdev);
198} 188}
199#endif
200 189
201static int __init ioat_init_module(void) 190static int __init ioat_init_module(void)
202{ 191{
203 return pci_register_driver(&ioat_pci_drv); 192 return pci_register_driver(&ioat_pci_driver);
204} 193}
205module_init(ioat_init_module); 194module_init(ioat_init_module);
206 195
207static void __exit ioat_exit_module(void) 196static void __exit ioat_exit_module(void)
208{ 197{
209 pci_unregister_driver(&ioat_pci_drv); 198 pci_unregister_driver(&ioat_pci_driver);
210} 199}
211module_exit(ioat_exit_module); 200module_exit(ioat_exit_module);
diff --git a/drivers/dma/ioat_dca.c b/drivers/dma/ioat_dca.c
index 2ae04c30edeb..ba985715b803 100644
--- a/drivers/dma/ioat_dca.c
+++ b/drivers/dma/ioat_dca.c
@@ -65,7 +65,7 @@ static inline u16 dcaid_from_pcidev(struct pci_dev *pci)
65 return (pci->bus->number << 8) | pci->devfn; 65 return (pci->bus->number << 8) | pci->devfn;
66} 66}
67 67
68static int dca_enabled_in_bios(void) 68static int dca_enabled_in_bios(struct pci_dev *pdev)
69{ 69{
70 /* CPUID level 9 returns DCA configuration */ 70 /* CPUID level 9 returns DCA configuration */
71 /* Bit 0 indicates DCA enabled by the BIOS */ 71 /* Bit 0 indicates DCA enabled by the BIOS */
@@ -75,17 +75,17 @@ static int dca_enabled_in_bios(void)
75 cpuid_level_9 = cpuid_eax(9); 75 cpuid_level_9 = cpuid_eax(9);
76 res = test_bit(0, &cpuid_level_9); 76 res = test_bit(0, &cpuid_level_9);
77 if (!res) 77 if (!res)
78 printk(KERN_ERR "ioat dma: DCA is disabled in BIOS\n"); 78 dev_err(&pdev->dev, "DCA is disabled in BIOS\n");
79 79
80 return res; 80 return res;
81} 81}
82 82
83static int system_has_dca_enabled(void) 83static int system_has_dca_enabled(struct pci_dev *pdev)
84{ 84{
85 if (boot_cpu_has(X86_FEATURE_DCA)) 85 if (boot_cpu_has(X86_FEATURE_DCA))
86 return dca_enabled_in_bios(); 86 return dca_enabled_in_bios(pdev);
87 87
88 printk(KERN_ERR "ioat dma: boot cpu doesn't have X86_FEATURE_DCA\n"); 88 dev_err(&pdev->dev, "boot cpu doesn't have X86_FEATURE_DCA\n");
89 return 0; 89 return 0;
90} 90}
91 91
@@ -208,7 +208,7 @@ struct dca_provider *ioat_dca_init(struct pci_dev *pdev, void __iomem *iobase)
208 int i; 208 int i;
209 int err; 209 int err;
210 210
211 if (!system_has_dca_enabled()) 211 if (!system_has_dca_enabled(pdev))
212 return NULL; 212 return NULL;
213 213
214 /* I/OAT v1 systems must have a known tag_map to support DCA */ 214 /* I/OAT v1 systems must have a known tag_map to support DCA */
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 66c5bb53211b..7e4a785c2dff 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -46,9 +46,12 @@
46/* internal functions */ 46/* internal functions */
47static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan); 47static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan);
48static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan); 48static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan);
49static struct ioat_desc_sw *
50ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan);
49 51
50static struct ioat_dma_chan *ioat_lookup_chan_by_index(struct ioatdma_device *device, 52static inline struct ioat_dma_chan *ioat_lookup_chan_by_index(
51 int index) 53 struct ioatdma_device *device,
54 int index)
52{ 55{
53 return device->idx[index]; 56 return device->idx[index];
54} 57}
@@ -148,57 +151,102 @@ static void ioat_set_src(dma_addr_t addr,
148 struct dma_async_tx_descriptor *tx, 151 struct dma_async_tx_descriptor *tx,
149 int index) 152 int index)
150{ 153{
151 struct ioat_desc_sw *iter, *desc = tx_to_ioat_desc(tx); 154 tx_to_ioat_desc(tx)->src = addr;
152 struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan);
153
154 pci_unmap_addr_set(desc, src, addr);
155
156 list_for_each_entry(iter, &desc->async_tx.tx_list, node) {
157 iter->hw->src_addr = addr;
158 addr += ioat_chan->xfercap;
159 }
160
161} 155}
162 156
163static void ioat_set_dest(dma_addr_t addr, 157static void ioat_set_dest(dma_addr_t addr,
164 struct dma_async_tx_descriptor *tx, 158 struct dma_async_tx_descriptor *tx,
165 int index) 159 int index)
166{ 160{
167 struct ioat_desc_sw *iter, *desc = tx_to_ioat_desc(tx); 161 tx_to_ioat_desc(tx)->dst = addr;
168 struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan);
169
170 pci_unmap_addr_set(desc, dst, addr);
171
172 list_for_each_entry(iter, &desc->async_tx.tx_list, node) {
173 iter->hw->dst_addr = addr;
174 addr += ioat_chan->xfercap;
175 }
176} 162}
177 163
178static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx) 164static dma_cookie_t ioat_tx_submit(struct dma_async_tx_descriptor *tx)
179{ 165{
180 struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan); 166 struct ioat_dma_chan *ioat_chan = to_ioat_chan(tx->chan);
181 struct ioat_desc_sw *desc = tx_to_ioat_desc(tx); 167 struct ioat_desc_sw *first = tx_to_ioat_desc(tx);
168 struct ioat_desc_sw *prev, *new;
169 struct ioat_dma_descriptor *hw;
182 int append = 0; 170 int append = 0;
183 dma_cookie_t cookie; 171 dma_cookie_t cookie;
184 struct ioat_desc_sw *group_start; 172 LIST_HEAD(new_chain);
173 u32 copy;
174 size_t len;
175 dma_addr_t src, dst;
176 int orig_ack;
177 unsigned int desc_count = 0;
178
179 /* src and dest and len are stored in the initial descriptor */
180 len = first->len;
181 src = first->src;
182 dst = first->dst;
183 orig_ack = first->async_tx.ack;
184 new = first;
185 185
186 group_start = list_entry(desc->async_tx.tx_list.next,
187 struct ioat_desc_sw, node);
188 spin_lock_bh(&ioat_chan->desc_lock); 186 spin_lock_bh(&ioat_chan->desc_lock);
187 prev = to_ioat_desc(ioat_chan->used_desc.prev);
188 prefetch(prev->hw);
189 do {
190 copy = min((u32) len, ioat_chan->xfercap);
191
192 new->async_tx.ack = 1;
193
194 hw = new->hw;
195 hw->size = copy;
196 hw->ctl = 0;
197 hw->src_addr = src;
198 hw->dst_addr = dst;
199 hw->next = 0;
200
201 /* chain together the physical address list for the HW */
202 wmb();
203 prev->hw->next = (u64) new->async_tx.phys;
204
205 len -= copy;
206 dst += copy;
207 src += copy;
208
209 list_add_tail(&new->node, &new_chain);
210 desc_count++;
211 prev = new;
212 } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan)));
213
214 hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
215 if (new->async_tx.callback) {
216 hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN;
217 if (first != new) {
218 /* move callback into to last desc */
219 new->async_tx.callback = first->async_tx.callback;
220 new->async_tx.callback_param
221 = first->async_tx.callback_param;
222 first->async_tx.callback = NULL;
223 first->async_tx.callback_param = NULL;
224 }
225 }
226
227 new->tx_cnt = desc_count;
228 new->async_tx.ack = orig_ack; /* client is in control of this ack */
229
230 /* store the original values for use in later cleanup */
231 if (new != first) {
232 new->src = first->src;
233 new->dst = first->dst;
234 new->len = first->len;
235 }
236
189 /* cookie incr and addition to used_list must be atomic */ 237 /* cookie incr and addition to used_list must be atomic */
190 cookie = ioat_chan->common.cookie; 238 cookie = ioat_chan->common.cookie;
191 cookie++; 239 cookie++;
192 if (cookie < 0) 240 if (cookie < 0)
193 cookie = 1; 241 cookie = 1;
194 ioat_chan->common.cookie = desc->async_tx.cookie = cookie; 242 ioat_chan->common.cookie = new->async_tx.cookie = cookie;
195 243
196 /* write address into NextDescriptor field of last desc in chain */ 244 /* write address into NextDescriptor field of last desc in chain */
197 to_ioat_desc(ioat_chan->used_desc.prev)->hw->next = 245 to_ioat_desc(ioat_chan->used_desc.prev)->hw->next =
198 group_start->async_tx.phys; 246 first->async_tx.phys;
199 list_splice_init(&desc->async_tx.tx_list, ioat_chan->used_desc.prev); 247 __list_splice(&new_chain, ioat_chan->used_desc.prev);
200 248
201 ioat_chan->pending += desc->tx_cnt; 249 ioat_chan->pending += desc_count;
202 if (ioat_chan->pending >= 4) { 250 if (ioat_chan->pending >= 4) {
203 append = 1; 251 append = 1;
204 ioat_chan->pending = 0; 252 ioat_chan->pending = 0;
@@ -267,7 +315,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
267 chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET); 315 chanerr = readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
268 if (chanerr) { 316 if (chanerr) {
269 dev_err(&ioat_chan->device->pdev->dev, 317 dev_err(&ioat_chan->device->pdev->dev,
270 "ioatdma: CHANERR = %x, clearing\n", chanerr); 318 "CHANERR = %x, clearing\n", chanerr);
271 writel(chanerr, ioat_chan->reg_base + IOAT_CHANERR_OFFSET); 319 writel(chanerr, ioat_chan->reg_base + IOAT_CHANERR_OFFSET);
272 } 320 }
273 321
@@ -276,7 +324,7 @@ static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
276 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL); 324 desc = ioat_dma_alloc_descriptor(ioat_chan, GFP_KERNEL);
277 if (!desc) { 325 if (!desc) {
278 dev_err(&ioat_chan->device->pdev->dev, 326 dev_err(&ioat_chan->device->pdev->dev,
279 "ioatdma: Only %d initial descriptors\n", i); 327 "Only %d initial descriptors\n", i);
280 break; 328 break;
281 } 329 }
282 list_add_tail(&desc->node, &tmp_list); 330 list_add_tail(&desc->node, &tmp_list);
@@ -342,12 +390,13 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
342 /* one is ok since we left it on there on purpose */ 390 /* one is ok since we left it on there on purpose */
343 if (in_use_descs > 1) 391 if (in_use_descs > 1)
344 dev_err(&ioat_chan->device->pdev->dev, 392 dev_err(&ioat_chan->device->pdev->dev,
345 "ioatdma: Freeing %d in use descriptors!\n", 393 "Freeing %d in use descriptors!\n",
346 in_use_descs - 1); 394 in_use_descs - 1);
347 395
348 ioat_chan->last_completion = ioat_chan->completion_addr = 0; 396 ioat_chan->last_completion = ioat_chan->completion_addr = 0;
349 ioat_chan->pending = 0; 397 ioat_chan->pending = 0;
350} 398}
399
351/** 400/**
352 * ioat_dma_get_next_descriptor - return the next available descriptor 401 * ioat_dma_get_next_descriptor - return the next available descriptor
353 * @ioat_chan: IOAT DMA channel handle 402 * @ioat_chan: IOAT DMA channel handle
@@ -356,8 +405,8 @@ static void ioat_dma_free_chan_resources(struct dma_chan *chan)
356 * channel's desc_lock held. Allocates more descriptors if the channel 405 * channel's desc_lock held. Allocates more descriptors if the channel
357 * has run out. 406 * has run out.
358 */ 407 */
359static struct ioat_desc_sw *ioat_dma_get_next_descriptor( 408static struct ioat_desc_sw *
360 struct ioat_dma_chan *ioat_chan) 409ioat_dma_get_next_descriptor(struct ioat_dma_chan *ioat_chan)
361{ 410{
362 struct ioat_desc_sw *new = NULL; 411 struct ioat_desc_sw *new = NULL;
363 412
@@ -382,51 +431,11 @@ static struct dma_async_tx_descriptor *ioat_dma_prep_memcpy(
382 int int_en) 431 int int_en)
383{ 432{
384 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); 433 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
385 struct ioat_desc_sw *first, *prev, *new; 434 struct ioat_desc_sw *new;
386 LIST_HEAD(new_chain);
387 u32 copy;
388 size_t orig_len;
389 int desc_count = 0;
390
391 if (!len)
392 return NULL;
393
394 orig_len = len;
395
396 first = NULL;
397 prev = NULL;
398 435
399 spin_lock_bh(&ioat_chan->desc_lock); 436 spin_lock_bh(&ioat_chan->desc_lock);
400 while (len) { 437 new = ioat_dma_get_next_descriptor(ioat_chan);
401 new = ioat_dma_get_next_descriptor(ioat_chan); 438 new->len = len;
402 copy = min((u32) len, ioat_chan->xfercap);
403
404 new->hw->size = copy;
405 new->hw->ctl = 0;
406 new->async_tx.cookie = 0;
407 new->async_tx.ack = 1;
408
409 /* chain together the physical address list for the HW */
410 if (!first)
411 first = new;
412 else
413 prev->hw->next = (u64) new->async_tx.phys;
414
415 prev = new;
416 len -= copy;
417 list_add_tail(&new->node, &new_chain);
418 desc_count++;
419 }
420
421 list_splice(&new_chain, &new->async_tx.tx_list);
422
423 new->hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
424 new->hw->next = 0;
425 new->tx_cnt = desc_count;
426 new->async_tx.ack = 0; /* client is in control of this ack */
427 new->async_tx.cookie = -EBUSY;
428
429 pci_unmap_len_set(new, len, orig_len);
430 spin_unlock_bh(&ioat_chan->desc_lock); 439 spin_unlock_bh(&ioat_chan->desc_lock);
431 440
432 return new ? &new->async_tx : NULL; 441 return new ? &new->async_tx : NULL;
@@ -464,7 +473,7 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
464 473
465 prefetch(ioat_chan->completion_virt); 474 prefetch(ioat_chan->completion_virt);
466 475
467 if (!spin_trylock(&ioat_chan->cleanup_lock)) 476 if (!spin_trylock_bh(&ioat_chan->cleanup_lock))
468 return; 477 return;
469 478
470 /* The completion writeback can happen at any time, 479 /* The completion writeback can happen at any time,
@@ -474,22 +483,25 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
474 483
475#if (BITS_PER_LONG == 64) 484#if (BITS_PER_LONG == 64)
476 phys_complete = 485 phys_complete =
477 ioat_chan->completion_virt->full & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR; 486 ioat_chan->completion_virt->full
487 & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_ADDR;
478#else 488#else
479 phys_complete = ioat_chan->completion_virt->low & IOAT_LOW_COMPLETION_MASK; 489 phys_complete =
490 ioat_chan->completion_virt->low & IOAT_LOW_COMPLETION_MASK;
480#endif 491#endif
481 492
482 if ((ioat_chan->completion_virt->full & IOAT_CHANSTS_DMA_TRANSFER_STATUS) == 493 if ((ioat_chan->completion_virt->full
494 & IOAT_CHANSTS_DMA_TRANSFER_STATUS) ==
483 IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED) { 495 IOAT_CHANSTS_DMA_TRANSFER_STATUS_HALTED) {
484 dev_err(&ioat_chan->device->pdev->dev, 496 dev_err(&ioat_chan->device->pdev->dev,
485 "ioatdma: Channel halted, chanerr = %x\n", 497 "Channel halted, chanerr = %x\n",
486 readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET)); 498 readl(ioat_chan->reg_base + IOAT_CHANERR_OFFSET));
487 499
488 /* TODO do something to salvage the situation */ 500 /* TODO do something to salvage the situation */
489 } 501 }
490 502
491 if (phys_complete == ioat_chan->last_completion) { 503 if (phys_complete == ioat_chan->last_completion) {
492 spin_unlock(&ioat_chan->cleanup_lock); 504 spin_unlock_bh(&ioat_chan->cleanup_lock);
493 return; 505 return;
494 } 506 }
495 507
@@ -517,6 +529,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
517 pci_unmap_addr(desc, src), 529 pci_unmap_addr(desc, src),
518 pci_unmap_len(desc, len), 530 pci_unmap_len(desc, len),
519 PCI_DMA_TODEVICE); 531 PCI_DMA_TODEVICE);
532 if (desc->async_tx.callback) {
533 desc->async_tx.callback(
534 desc->async_tx.callback_param);
535 desc->async_tx.callback = NULL;
536 }
520 } 537 }
521 538
522 if (desc->async_tx.phys != phys_complete) { 539 if (desc->async_tx.phys != phys_complete) {
@@ -548,7 +565,7 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan *ioat_chan)
548 if (cookie != 0) 565 if (cookie != 0)
549 ioat_chan->completed_cookie = cookie; 566 ioat_chan->completed_cookie = cookie;
550 567
551 spin_unlock(&ioat_chan->cleanup_lock); 568 spin_unlock_bh(&ioat_chan->cleanup_lock);
552} 569}
553 570
554static void ioat_dma_dependency_added(struct dma_chan *chan) 571static void ioat_dma_dependency_added(struct dma_chan *chan)
@@ -613,8 +630,13 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
613 spin_lock_bh(&ioat_chan->desc_lock); 630 spin_lock_bh(&ioat_chan->desc_lock);
614 631
615 desc = ioat_dma_get_next_descriptor(ioat_chan); 632 desc = ioat_dma_get_next_descriptor(ioat_chan);
616 desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL; 633 desc->hw->ctl = IOAT_DMA_DESCRIPTOR_NUL
634 | IOAT_DMA_DESCRIPTOR_CTL_INT_GN
635 | IOAT_DMA_DESCRIPTOR_CTL_CP_STS;
617 desc->hw->next = 0; 636 desc->hw->next = 0;
637 desc->hw->size = 0;
638 desc->hw->src_addr = 0;
639 desc->hw->dst_addr = 0;
618 desc->async_tx.ack = 1; 640 desc->async_tx.ack = 1;
619 641
620 list_add_tail(&desc->node, &ioat_chan->used_desc); 642 list_add_tail(&desc->node, &ioat_chan->used_desc);
@@ -633,6 +655,12 @@ static void ioat_dma_start_null_desc(struct ioat_dma_chan *ioat_chan)
633 */ 655 */
634#define IOAT_TEST_SIZE 2000 656#define IOAT_TEST_SIZE 2000
635 657
658static void ioat_dma_test_callback(void *dma_async_param)
659{
660 printk(KERN_ERR "ioatdma: ioat_dma_test_callback(%p)\n",
661 dma_async_param);
662}
663
636/** 664/**
637 * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works. 665 * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works.
638 * @device: device to be tested 666 * @device: device to be tested
@@ -643,7 +671,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
643 u8 *src; 671 u8 *src;
644 u8 *dest; 672 u8 *dest;
645 struct dma_chan *dma_chan; 673 struct dma_chan *dma_chan;
646 struct dma_async_tx_descriptor *tx; 674 struct dma_async_tx_descriptor *tx = NULL;
647 dma_addr_t addr; 675 dma_addr_t addr;
648 dma_cookie_t cookie; 676 dma_cookie_t cookie;
649 int err = 0; 677 int err = 0;
@@ -673,6 +701,13 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
673 } 701 }
674 702
675 tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0); 703 tx = ioat_dma_prep_memcpy(dma_chan, IOAT_TEST_SIZE, 0);
704 if (!tx) {
705 dev_err(&device->pdev->dev,
706 "Self-test prep failed, disabling\n");
707 err = -ENODEV;
708 goto free_resources;
709 }
710
676 async_tx_ack(tx); 711 async_tx_ack(tx);
677 addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE, 712 addr = dma_map_single(dma_chan->device->dev, src, IOAT_TEST_SIZE,
678 DMA_TO_DEVICE); 713 DMA_TO_DEVICE);
@@ -680,19 +715,27 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
680 addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, 715 addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE,
681 DMA_FROM_DEVICE); 716 DMA_FROM_DEVICE);
682 ioat_set_dest(addr, tx, 0); 717 ioat_set_dest(addr, tx, 0);
718 tx->callback = ioat_dma_test_callback;
719 tx->callback_param = (void *)0x8086;
683 cookie = ioat_tx_submit(tx); 720 cookie = ioat_tx_submit(tx);
721 if (cookie < 0) {
722 dev_err(&device->pdev->dev,
723 "Self-test setup failed, disabling\n");
724 err = -ENODEV;
725 goto free_resources;
726 }
684 ioat_dma_memcpy_issue_pending(dma_chan); 727 ioat_dma_memcpy_issue_pending(dma_chan);
685 msleep(1); 728 msleep(1);
686 729
687 if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) { 730 if (ioat_dma_is_complete(dma_chan, cookie, NULL, NULL) != DMA_SUCCESS) {
688 dev_err(&device->pdev->dev, 731 dev_err(&device->pdev->dev,
689 "ioatdma: Self-test copy timed out, disabling\n"); 732 "Self-test copy timed out, disabling\n");
690 err = -ENODEV; 733 err = -ENODEV;
691 goto free_resources; 734 goto free_resources;
692 } 735 }
693 if (memcmp(src, dest, IOAT_TEST_SIZE)) { 736 if (memcmp(src, dest, IOAT_TEST_SIZE)) {
694 dev_err(&device->pdev->dev, 737 dev_err(&device->pdev->dev,
695 "ioatdma: Self-test copy failed compare, disabling\n"); 738 "Self-test copy failed compare, disabling\n");
696 err = -ENODEV; 739 err = -ENODEV;
697 goto free_resources; 740 goto free_resources;
698 } 741 }
@@ -730,6 +773,9 @@ static int ioat_dma_setup_interrupts(struct ioatdma_device *device)
730 goto msi; 773 goto msi;
731 if (!strcmp(ioat_interrupt_style, "intx")) 774 if (!strcmp(ioat_interrupt_style, "intx"))
732 goto intx; 775 goto intx;
776 dev_err(&device->pdev->dev, "invalid ioat_interrupt_style %s\n",
777 ioat_interrupt_style);
778 goto err_no_irq;
733 779
734msix: 780msix:
735 /* The number of MSI-X vectors should equal the number of channels */ 781 /* The number of MSI-X vectors should equal the number of channels */
@@ -906,9 +952,9 @@ struct ioatdma_device *ioat_dma_probe(struct pci_dev *pdev,
906 device->common.device_dependency_added = ioat_dma_dependency_added; 952 device->common.device_dependency_added = ioat_dma_dependency_added;
907 device->common.dev = &pdev->dev; 953 device->common.dev = &pdev->dev;
908 dev_err(&device->pdev->dev, 954 dev_err(&device->pdev->dev,
909 "ioatdma: Intel(R) I/OAT DMA Engine found," 955 "Intel(R) I/OAT DMA Engine found,"
910 " %d channels, device version 0x%02x\n", 956 " %d channels, device version 0x%02x, driver version %s\n",
911 device->common.chancnt, device->version); 957 device->common.chancnt, device->version, IOAT_DMA_VERSION);
912 958
913 err = ioat_dma_setup_interrupts(device); 959 err = ioat_dma_setup_interrupts(device);
914 if (err) 960 if (err)
@@ -931,9 +977,8 @@ err_completion_pool:
931err_dma_pool: 977err_dma_pool:
932 kfree(device); 978 kfree(device);
933err_kzalloc: 979err_kzalloc:
934 iounmap(iobase);
935 dev_err(&device->pdev->dev, 980 dev_err(&device->pdev->dev,
936 "ioatdma: Intel(R) I/OAT DMA Engine initialization failed\n"); 981 "Intel(R) I/OAT DMA Engine initialization failed\n");
937 return NULL; 982 return NULL;
938} 983}
939 984
@@ -942,13 +987,17 @@ void ioat_dma_remove(struct ioatdma_device *device)
942 struct dma_chan *chan, *_chan; 987 struct dma_chan *chan, *_chan;
943 struct ioat_dma_chan *ioat_chan; 988 struct ioat_dma_chan *ioat_chan;
944 989
945 dma_async_device_unregister(&device->common);
946
947 ioat_dma_remove_interrupts(device); 990 ioat_dma_remove_interrupts(device);
948 991
992 dma_async_device_unregister(&device->common);
993
949 pci_pool_destroy(device->dma_pool); 994 pci_pool_destroy(device->dma_pool);
950 pci_pool_destroy(device->completion_pool); 995 pci_pool_destroy(device->completion_pool);
951 996
997 iounmap(device->reg_base);
998 pci_release_regions(device->pdev);
999 pci_disable_device(device->pdev);
1000
952 list_for_each_entry_safe(chan, _chan, 1001 list_for_each_entry_safe(chan, _chan,
953 &device->common.channels, device_node) { 1002 &device->common.channels, device_node) {
954 ioat_chan = to_ioat_chan(chan); 1003 ioat_chan = to_ioat_chan(chan);
diff --git a/drivers/dma/ioatdma.h b/drivers/dma/ioatdma.h
index 2a319e124ece..5f9881e7b0ed 100644
--- a/drivers/dma/ioatdma.h
+++ b/drivers/dma/ioatdma.h
@@ -28,6 +28,8 @@
28#include <linux/cache.h> 28#include <linux/cache.h>
29#include <linux/pci_ids.h> 29#include <linux/pci_ids.h>
30 30
31#define IOAT_DMA_VERSION "1.26"
32
31enum ioat_interrupt { 33enum ioat_interrupt {
32 none = 0, 34 none = 0,
33 msix_multi_vector = 1, 35 msix_multi_vector = 1,
@@ -122,9 +124,9 @@ struct ioat_desc_sw {
122 struct ioat_dma_descriptor *hw; 124 struct ioat_dma_descriptor *hw;
123 struct list_head node; 125 struct list_head node;
124 int tx_cnt; 126 int tx_cnt;
125 DECLARE_PCI_UNMAP_LEN(len) 127 size_t len;
126 DECLARE_PCI_UNMAP_ADDR(src) 128 dma_addr_t src;
127 DECLARE_PCI_UNMAP_ADDR(dst) 129 dma_addr_t dst;
128 struct dma_async_tx_descriptor async_tx; 130 struct dma_async_tx_descriptor async_tx;
129}; 131};
130 132
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index e80af67664cc..2d23e304f5ec 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -94,8 +94,6 @@ extern int edac_debug_level;
94 94
95#endif /* !CONFIG_EDAC_DEBUG */ 95#endif /* !CONFIG_EDAC_DEBUG */
96 96
97#define BIT(x) (1 << (x))
98
99#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \ 97#define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
100 PCI_DEVICE_ID_ ## vend ## _ ## dev 98 PCI_DEVICE_ID_ ## vend ## _ ## dev
101 99
diff --git a/drivers/edac/pasemi_edac.c b/drivers/edac/pasemi_edac.c
index e66cdd42a392..9007d0677220 100644
--- a/drivers/edac/pasemi_edac.c
+++ b/drivers/edac/pasemi_edac.c
@@ -270,6 +270,7 @@ static void __devexit pasemi_edac_remove(struct pci_dev *pdev)
270 270
271static const struct pci_device_id pasemi_edac_pci_tbl[] = { 271static const struct pci_device_id pasemi_edac_pci_tbl[] = {
272 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa00a) }, 272 { PCI_DEVICE(PCI_VENDOR_ID_PASEMI, 0xa00a) },
273 { }
273}; 274};
274 275
275MODULE_DEVICE_TABLE(pci, pasemi_edac_pci_tbl); 276MODULE_DEVICE_TABLE(pci, pasemi_edac_pci_tbl);
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 9959b799dbe2..c00d4a9b39e5 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -228,7 +228,7 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
228 * 228 *
229 * @param card the card from which to send the request 229 * @param card the card from which to send the request
230 * @param tcode the tcode for this transaction. Do not use 230 * @param tcode the tcode for this transaction. Do not use
231 * TCODE_LOCK_REQUEST directly, insted use TCODE_LOCK_MASK_SWAP 231 * TCODE_LOCK_REQUEST directly, instead use TCODE_LOCK_MASK_SWAP
232 * etc. to specify tcode and ext_tcode. 232 * etc. to specify tcode and ext_tcode.
233 * @param node_id the destination node ID (bus ID and PHY ID concatenated) 233 * @param node_id the destination node ID (bus ID and PHY ID concatenated)
234 * @param generation the generation for which node_id is valid 234 * @param generation the generation for which node_id is valid
diff --git a/drivers/firmware/dcdbas.h b/drivers/firmware/dcdbas.h
index dcdba0f1b32c..87bc3417de27 100644
--- a/drivers/firmware/dcdbas.h
+++ b/drivers/firmware/dcdbas.h
@@ -17,7 +17,6 @@
17#define _DCDBAS_H_ 17#define _DCDBAS_H_
18 18
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/input.h>
21#include <linux/sysfs.h> 20#include <linux/sysfs.h>
22#include <linux/types.h> 21#include <linux/types.h>
23 22
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index a702e2f6da7d..1ca6f4635eeb 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -113,13 +113,13 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
113 113
114 if (count > HID_MIN_BUFFER_SIZE) { 114 if (count > HID_MIN_BUFFER_SIZE) {
115 printk(KERN_WARNING "hidraw: pid %d passed too large report\n", 115 printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
116 current->pid); 116 task_pid_nr(current));
117 return -EINVAL; 117 return -EINVAL;
118 } 118 }
119 119
120 if (count < 2) { 120 if (count < 2) {
121 printk(KERN_WARNING "hidraw: pid %d passed too short report\n", 121 printk(KERN_WARNING "hidraw: pid %d passed too short report\n",
122 current->pid); 122 task_pid_nr(current));
123 return -EINVAL; 123 return -EINVAL;
124 } 124 }
125 125
diff --git a/drivers/hid/usbhid/hid-ff.c b/drivers/hid/usbhid/hid-ff.c
index 22329feb3b5a..4c210e16b1b4 100644
--- a/drivers/hid/usbhid/hid-ff.c
+++ b/drivers/hid/usbhid/hid-ff.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: hid-ff.c,v 1.2 2002/04/18 22:02:47 jdeneux Exp $
3 *
4 * Force feedback support for hid devices. 2 * Force feedback support for hid devices.
5 * Not all hid devices use the same protocol. For example, some use PID, 3 * Not all hid devices use the same protocol. For example, some use PID,
6 * other use their own proprietary procotol. 4 * other use their own proprietary procotol.
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
index b76b02f7b52d..775a1ef28a29 100644
--- a/drivers/hid/usbhid/usbkbd.c
+++ b/drivers/hid/usbhid/usbkbd.c
@@ -274,8 +274,11 @@ static int usb_kbd_probe(struct usb_interface *iface,
274 274
275 input_set_drvdata(input_dev, kbd); 275 input_set_drvdata(input_dev, kbd);
276 276
277 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); 277 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_LED) |
278 input_dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL) | BIT(LED_COMPOSE) | BIT(LED_KANA); 278 BIT_MASK(EV_REP);
279 input_dev->ledbit[0] = BIT_MASK(LED_NUML) | BIT_MASK(LED_CAPSL) |
280 BIT_MASK(LED_SCROLLL) | BIT_MASK(LED_COMPOSE) |
281 BIT_MASK(LED_KANA);
279 282
280 for (i = 0; i < 255; i++) 283 for (i = 0; i < 255; i++)
281 set_bit(usb_kbd_keycode[i], input_dev->keybit); 284 set_bit(usb_kbd_keycode[i], input_dev->keybit);
diff --git a/drivers/hid/usbhid/usbmouse.c b/drivers/hid/usbhid/usbmouse.c
index 5345c73bcf62..f8ad6910d3d9 100644
--- a/drivers/hid/usbhid/usbmouse.c
+++ b/drivers/hid/usbhid/usbmouse.c
@@ -173,11 +173,13 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i
173 usb_to_input_id(dev, &input_dev->id); 173 usb_to_input_id(dev, &input_dev->id);
174 input_dev->dev.parent = &intf->dev; 174 input_dev->dev.parent = &intf->dev;
175 175
176 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 176 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
177 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 177 input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
178 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 178 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
179 input_dev->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_SIDE) | BIT(BTN_EXTRA); 179 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
180 input_dev->relbit[0] |= BIT(REL_WHEEL); 180 input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_SIDE) |
181 BIT_MASK(BTN_EXTRA);
182 input_dev->relbit[0] |= BIT_MASK(REL_WHEEL);
181 183
182 input_set_drvdata(input_dev, mouse); 184 input_set_drvdata(input_dev, mouse);
183 185
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c
index aa875ca50d9b..3e63c1486770 100644
--- a/drivers/hwmon/adm1026.c
+++ b/drivers/hwmon/adm1026.c
@@ -1651,7 +1651,7 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address,
1651 break; 1651 break;
1652 default : 1652 default :
1653 dev_err(&adapter->dev, ": Internal error, invalid " 1653 dev_err(&adapter->dev, ": Internal error, invalid "
1654 "kind (%d)!", kind); 1654 "kind (%d)!\n", kind);
1655 err = -EFAULT; 1655 err = -EFAULT;
1656 goto exitfree; 1656 goto exitfree;
1657 } 1657 }
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 4879125b4cdc..1001d2e122a2 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -1099,7 +1099,7 @@ static int applesmc_create_accelerometer(void)
1099 idev->name = "applesmc"; 1099 idev->name = "applesmc";
1100 idev->id.bustype = BUS_HOST; 1100 idev->id.bustype = BUS_HOST;
1101 idev->dev.parent = &pdev->dev; 1101 idev->dev.parent = &pdev->dev;
1102 idev->evbit[0] = BIT(EV_ABS); 1102 idev->evbit[0] = BIT_MASK(EV_ABS);
1103 input_set_abs_params(idev, ABS_X, 1103 input_set_abs_params(idev, ABS_X,
1104 -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT); 1104 -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
1105 input_set_abs_params(idev, ABS_Y, 1105 input_set_abs_params(idev, ABS_Y,
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
index 6f66551d9e51..5c82ec7f8bbd 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
@@ -150,7 +150,7 @@ static struct coretemp_data *coretemp_update_device(struct device *dev)
150static int __devinit coretemp_probe(struct platform_device *pdev) 150static int __devinit coretemp_probe(struct platform_device *pdev)
151{ 151{
152 struct coretemp_data *data; 152 struct coretemp_data *data;
153 struct cpuinfo_x86 *c = &(cpu_data)[pdev->id]; 153 struct cpuinfo_x86 *c = &cpu_data(pdev->id);
154 int err; 154 int err;
155 u32 eax, edx; 155 u32 eax, edx;
156 156
@@ -359,7 +359,7 @@ static int __init coretemp_init(void)
359 struct pdev_entry *p, *n; 359 struct pdev_entry *p, *n;
360 360
361 /* quick check if we run Intel */ 361 /* quick check if we run Intel */
362 if (cpu_data[0].x86_vendor != X86_VENDOR_INTEL) 362 if (cpu_data(0).x86_vendor != X86_VENDOR_INTEL)
363 goto exit; 363 goto exit;
364 364
365 err = platform_driver_register(&coretemp_driver); 365 err = platform_driver_register(&coretemp_driver);
@@ -367,7 +367,7 @@ static int __init coretemp_init(void)
367 goto exit; 367 goto exit;
368 368
369 for_each_online_cpu(i) { 369 for_each_online_cpu(i) {
370 struct cpuinfo_x86 *c = &(cpu_data)[i]; 370 struct cpuinfo_x86 *c = &cpu_data(i);
371 371
372 /* check if family 6, models e, f, 16 */ 372 /* check if family 6, models e, f, 16 */
373 if ((c->cpuid_level < 0) || (c->x86 != 0x6) || 373 if ((c->cpuid_level < 0) || (c->x86 != 0x6) ||
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c
index a3b56c816e11..2d39d8fc2389 100644
--- a/drivers/hwmon/gl520sm.c
+++ b/drivers/hwmon/gl520sm.c
@@ -2,7 +2,7 @@
2 gl520sm.c - Part of lm_sensors, Linux kernel modules for hardware 2 gl520sm.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring 3 monitoring
4 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>, 4 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>,
5 Kyösti Mälkki <kmalkki@cc.hut.fi> 5 Kyösti Mälkki <kmalkki@cc.hut.fi>
6 Copyright (c) 2005 Maarten Deprez <maartendeprez@users.sourceforge.net> 6 Copyright (c) 2005 Maarten Deprez <maartendeprez@users.sourceforge.net>
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
@@ -805,7 +805,7 @@ static void __exit sensors_gl520sm_exit(void)
805 805
806 806
807MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, " 807MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
808 "Kyösti Mälkki <kmalkki@cc.hut.fi>, " 808 "Kyösti Mälkki <kmalkki@cc.hut.fi>, "
809 "Maarten Deprez <maartendeprez@users.sourceforge.net>"); 809 "Maarten Deprez <maartendeprez@users.sourceforge.net>");
810MODULE_DESCRIPTION("GL520SM driver"); 810MODULE_DESCRIPTION("GL520SM driver");
811MODULE_LICENSE("GPL"); 811MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index 8a7ae03aeee4..bab5fd2e4dfd 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -574,7 +574,7 @@ static int __init hdaps_init(void)
574 idev = hdaps_idev->input; 574 idev = hdaps_idev->input;
575 idev->name = "hdaps"; 575 idev->name = "hdaps";
576 idev->dev.parent = &pdev->dev; 576 idev->dev.parent = &pdev->dev;
577 idev->evbit[0] = BIT(EV_ABS); 577 idev->evbit[0] = BIT_MASK(EV_ABS);
578 input_set_abs_params(idev, ABS_X, 578 input_set_abs_params(idev, ABS_X,
579 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); 579 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
580 input_set_abs_params(idev, ABS_Y, 580 input_set_abs_params(idev, ABS_Y,
diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c
index f17e771e42f8..3330667280b9 100644
--- a/drivers/hwmon/hwmon-vid.c
+++ b/drivers/hwmon/hwmon-vid.c
@@ -200,7 +200,7 @@ static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor)
200 200
201u8 vid_which_vrm(void) 201u8 vid_which_vrm(void)
202{ 202{
203 struct cpuinfo_x86 *c = cpu_data; 203 struct cpuinfo_x86 *c = &cpu_data(0);
204 u32 eax; 204 u32 eax;
205 u8 eff_family, eff_model, eff_stepping, vrm_ret; 205 u8 eff_family, eff_model, eff_stepping, vrm_ret;
206 206
diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c
index f207434730de..650b07d5b902 100644
--- a/drivers/hwmon/lm63.c
+++ b/drivers/hwmon/lm63.c
@@ -533,7 +533,7 @@ static void lm63_init_client(struct i2c_client *client)
533 533
534 /* Start converting if needed */ 534 /* Start converting if needed */
535 if (data->config & 0x40) { /* standby */ 535 if (data->config & 0x40) { /* standby */
536 dev_dbg(&client->dev, "Switching to operational mode"); 536 dev_dbg(&client->dev, "Switching to operational mode\n");
537 data->config &= 0xA7; 537 data->config &= 0xA7;
538 i2c_smbus_write_byte_data(client, LM63_REG_CONFIG1, 538 i2c_smbus_write_byte_data(client, LM63_REG_CONFIG1,
539 data->config); 539 data->config);
diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c
index 860b71ccbb86..7e2d9787babc 100644
--- a/drivers/hwmon/sis5595.c
+++ b/drivers/hwmon/sis5595.c
@@ -3,7 +3,7 @@
3 for hardware monitoring 3 for hardware monitoring
4 4
5 Copyright (C) 1998 - 2001 Frodo Looijaard <frodol@dds.nl>, 5 Copyright (C) 1998 - 2001 Frodo Looijaard <frodol@dds.nl>,
6 Kyösti Mälkki <kmalkki@cc.hut.fi>, and 6 Kyösti Mälkki <kmalkki@cc.hut.fi>, and
7 Mark D. Studebaker <mdsxyz123@yahoo.com> 7 Mark D. Studebaker <mdsxyz123@yahoo.com>
8 Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with 8 Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with
9 the help of Jean Delvare <khali@linux-fr.org> 9 the help of Jean Delvare <khali@linux-fr.org>
diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c
index 8f63dada6019..2635bba1e3fc 100644
--- a/drivers/hwmon/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -3,7 +3,7 @@
3 for hardware monitoring 3 for hardware monitoring
4 4
5 Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, 5 Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>,
6 Kyösti Mälkki <kmalkki@cc.hut.fi>, 6 Kyösti Mälkki <kmalkki@cc.hut.fi>,
7 Mark Studebaker <mdsxyz123@yahoo.com>, 7 Mark Studebaker <mdsxyz123@yahoo.com>,
8 and Bob Dougherty <bobd@stanford.edu> 8 and Bob Dougherty <bobd@stanford.edu>
9 (Some conversion-factor data were contributed by Jonathan Teh Soon Yew 9 (Some conversion-factor data were contributed by Jonathan Teh Soon Yew
@@ -866,7 +866,7 @@ static void __exit sm_via686a_exit(void)
866 } 866 }
867} 867}
868 868
869MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>, " 869MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>, "
870 "Mark Studebaker <mdsxyz123@yahoo.com> " 870 "Mark Studebaker <mdsxyz123@yahoo.com> "
871 "and Bob Dougherty <bobd@stanford.edu>"); 871 "and Bob Dougherty <bobd@stanford.edu>");
872MODULE_DESCRIPTION("VIA 686A Sensor device"); 872MODULE_DESCRIPTION("VIA 686A Sensor device");
diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c
index e69416465e6d..7dfcc8dd316d 100644
--- a/drivers/hwmon/vt1211.c
+++ b/drivers/hwmon/vt1211.c
@@ -795,7 +795,7 @@ static ssize_t set_pwm_auto_point_pwm(struct device *dev,
795 795
796 if ((val < 0) || (val > 255)) { 796 if ((val < 0) || (val > 255)) {
797 dev_err(dev, "pwm value %ld is out of range. " 797 dev_err(dev, "pwm value %ld is out of range. "
798 "Choose a value between 0 and 255." , val); 798 "Choose a value between 0 and 255.\n" , val);
799 return -EINVAL; 799 return -EINVAL;
800 } 800 }
801 801
diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
index b6f2ebf9f9cf..a9c01a6f0057 100644
--- a/drivers/hwmon/w83791d.c
+++ b/drivers/hwmon/w83791d.c
@@ -1096,7 +1096,7 @@ static int w83791d_detect(struct i2c_adapter *adapter, int address, int kind)
1096 if (kind == w83791d) { 1096 if (kind == w83791d) {
1097 client_name = "w83791d"; 1097 client_name = "w83791d";
1098 } else { 1098 } else {
1099 dev_err(dev, "w83791d: Internal error: unknown kind (%d)?!?", 1099 dev_err(dev, "w83791d: Internal error: unknown kind (%d)?!?\n",
1100 kind); 1100 kind);
1101 goto error1; 1101 goto error1;
1102 } 1102 }
diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c
index f836198b705c..007449d3e16e 100644
--- a/drivers/hwmon/w83792d.c
+++ b/drivers/hwmon/w83792d.c
@@ -1385,8 +1385,8 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind)
1385 if (kind == w83792d) { 1385 if (kind == w83792d) {
1386 client_name = "w83792d"; 1386 client_name = "w83792d";
1387 } else { 1387 } else {
1388 dev_err(dev, "w83792d: Internal error: unknown" 1388 dev_err(dev, "w83792d: Internal error: unknown kind (%d)?!?\n",
1389 " kind (%d)?!?", kind); 1389 kind);
1390 goto ERROR1; 1390 goto ERROR1;
1391 } 1391 }
1392 1392
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 7f0a0a62cf60..a37cb6b8593c 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -18,7 +18,7 @@
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19/* ------------------------------------------------------------------------- */ 19/* ------------------------------------------------------------------------- */
20 20
21/* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki 21/* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki
22 <kmalkki@cc.hut.fi> and Jean Delvare <khali@linux-fr.org> */ 22 <kmalkki@cc.hut.fi> and Jean Delvare <khali@linux-fr.org> */
23 23
24#include <linux/kernel.h> 24#include <linux/kernel.h>
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index 36fdf971f080..2a16211f12e5 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -350,7 +350,7 @@ static int pca_init(struct i2c_algo_pca_data *adap)
350 pca_outw(adap, I2C_PCA_ADR, own << 1); 350 pca_outw(adap, I2C_PCA_ADR, own << 1);
351 351
352 pca_set_con(adap, I2C_PCA_CON_ENSIO | clock); 352 pca_set_con(adap, I2C_PCA_CON_ENSIO | clock);
353 udelay(500); /* 500 µs for oscilator to stabilise */ 353 udelay(500); /* 500 µs for oscilator to stabilise */
354 354
355 return 0; 355 return 0;
356} 356}
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
index ecb2c2d7d540..ab2e6f3498b4 100644
--- a/drivers/i2c/algos/i2c-algo-pcf.c
+++ b/drivers/i2c/algos/i2c-algo-pcf.c
@@ -19,7 +19,7 @@
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20/* ------------------------------------------------------------------------- */ 20/* ------------------------------------------------------------------------- */
21 21
22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and 22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
23 Frodo Looijaard <frodol@dds.nl> ,and also from Martin Bailey 23 Frodo Looijaard <frodol@dds.nl> ,and also from Martin Bailey
24 <mbailey@littlefeet-inc.com> */ 24 <mbailey@littlefeet-inc.com> */
25 25
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index de95c75efb41..c466c6cfc2e5 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -278,7 +278,7 @@ config I2C_IXP2000
278 depends on ARCH_IXP2000 278 depends on ARCH_IXP2000
279 select I2C_ALGOBIT 279 select I2C_ALGOBIT
280 help 280 help
281 Say Y here if you have an Intel IXP2000(2400, 2800, 2850) based 281 Say Y here if you have an Intel IXP2000 (2400, 2800, 2850) based
282 system and are using GPIO lines for an I2C bus. 282 system and are using GPIO lines for an I2C bus.
283 283
284 This support is also available as a module. If so, the module 284 This support is also available as a module. If so, the module
@@ -293,8 +293,8 @@ config I2C_POWERMAC
293 default y 293 default y
294 help 294 help
295 This exposes the various PowerMac i2c interfaces to the linux i2c 295 This exposes the various PowerMac i2c interfaces to the linux i2c
296 layer and to userland. It is used by various drivers on the powemac 296 layer and to userland. It is used by various drivers on the PowerMac
297 platform, thus should generally be enabled. 297 platform, and should generally be enabled.
298 298
299 This support is also available as a module. If so, the module 299 This support is also available as a module. If so, the module
300 will be called i2c-powermac. 300 will be called i2c-powermac.
@@ -438,12 +438,12 @@ config I2C_SIMTEC
438 tristate "Simtec Generic I2C interface" 438 tristate "Simtec Generic I2C interface"
439 select I2C_ALGOBIT 439 select I2C_ALGOBIT
440 help 440 help
441 If you say yes to this option, support will be inclyded for 441 If you say yes to this option, support will be included for
442 the Simtec Generic I2C interface. This driver is for the 442 the Simtec Generic I2C interface. This driver is for the
443 simple I2C bus used on newer Simtec products for general 443 simple I2C bus used on newer Simtec products for general
444 I2C, such as DDC on the Simtec BBD2016A. 444 I2C, such as DDC on the Simtec BBD2016A.
445 445
446 This driver can also be build as a module. If so, the module 446 This driver can also be built as a module. If so, the module
447 will be called i2c-simtec. 447 will be called i2c-simtec.
448 448
449config SCx200_I2C 449config SCx200_I2C
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
index 804f0a551c05..b7a9977b025f 100644
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -19,7 +19,7 @@
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20/* ------------------------------------------------------------------------- */ 20/* ------------------------------------------------------------------------- */
21 21
22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even 22/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
23 Frodo Looijaard <frodol@dds.nl> */ 23 Frodo Looijaard <frodol@dds.nl> */
24 24
25/* Partialy rewriten by Oleg I. Vdovikin for mmapped support of 25/* Partialy rewriten by Oleg I. Vdovikin for mmapped support of
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c
index 9832f773651d..f9972f9651e4 100644
--- a/drivers/i2c/busses/i2c-hydra.c
+++ b/drivers/i2c/busses/i2c-hydra.c
@@ -7,7 +7,7 @@
7 Copyright (c) 1999-2004 Geert Uytterhoeven <geert@linux-m68k.org> 7 Copyright (c) 1999-2004 Geert Uytterhoeven <geert@linux-m68k.org>
8 8
9 Based on i2c Support for Via Technologies 82C586B South Bridge 9 Based on i2c Support for Via Technologies 82C586B South Bridge
10 Copyright (c) 1998, 1999 Kyösti Mälkki <kmalkki@cc.hut.fi> 10 Copyright (c) 1998, 1999 Kyösti Mälkki <kmalkki@cc.hut.fi>
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 13 it under the terms of the GNU General Public License as published by
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index e08bacadd6bc..9b43ff7270d0 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -18,7 +18,7 @@
18 * Copyright 1995-97 Simon G. Vogl 18 * Copyright 1995-97 Simon G. Vogl
19 * 1998-99 Hans Berglund 19 * 1998-99 Hans Berglund
20 * 20 *
21 * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> 21 * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>
22 * and even Frodo Looijaard <frodol@dds.nl> 22 * and even Frodo Looijaard <frodol@dds.nl>
23 * 23 *
24 * This program is free software; you can redistribute it and/or modify it 24 * This program is free software; you can redistribute it and/or modify it
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index e471e3bfdc1e..89a30028ddb6 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -8,7 +8,7 @@
8 * Tony Lindgren <tony@atomide.com> and Imre Deak <imre.deak@nokia.com> 8 * Tony Lindgren <tony@atomide.com> and Imre Deak <imre.deak@nokia.com>
9 * Copyright (C) 2005 Nokia Corporation 9 * Copyright (C) 2005 Nokia Corporation
10 * 10 *
11 * Cleaned up by Juha Yrjölä <juha.yrjola@nokia.com> 11 * Cleaned up by Juha Yrjölä <juha.yrjola@nokia.com>
12 * 12 *
13 * This program is free software; you can redistribute it and/or modify 13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 14 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 49a95e2887bc..c6faf9bdad18 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -7,7 +7,7 @@
7 Copyright (C) 1995-2000 Simon G. Vogl 7 Copyright (C) 1995-2000 Simon G. Vogl
8 With some changes from: 8 With some changes from:
9 Frodo Looijaard <frodol@dds.nl> 9 Frodo Looijaard <frodol@dds.nl>
10 Kyösti Mälkki <kmalkki@cc.hut.fi> 10 Kyösti Mälkki <kmalkki@cc.hut.fi>
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 13 it under the terms of the GNU General Public License as published by
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index 039a07fde908..59ba2086d2f9 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -7,7 +7,7 @@
7 Copyright (C) 1995-2000 Simon G. Vogl 7 Copyright (C) 1995-2000 Simon G. Vogl
8 With some changes from: 8 With some changes from:
9 Frodo Looijaard <frodol@dds.nl> 9 Frodo Looijaard <frodol@dds.nl>
10 Kyösti Mälkki <kmalkki@cc.hut.fi> 10 Kyösti Mälkki <kmalkki@cc.hut.fi>
11 11
12 This program is free software; you can redistribute it and/or modify 12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by 13 it under the terms of the GNU General Public License as published by
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c
index 17cecf1ea797..be99c02ecac5 100644
--- a/drivers/i2c/busses/i2c-pmcmsp.c
+++ b/drivers/i2c/busses/i2c-pmcmsp.c
@@ -591,18 +591,18 @@ static int pmcmsptwi_master_xfer(struct i2c_adapter *adap,
591 if (msg->flags & I2C_M_TEN) 591 if (msg->flags & I2C_M_TEN)
592 pmcmsptwi_set_twi_config(&oldcfg, data); 592 pmcmsptwi_set_twi_config(&oldcfg, data);
593 593
594 dev_dbg(&adap->dev, "I2C %s of %d bytes ", 594 dev_dbg(&adap->dev, "I2C %s of %d bytes %s\n",
595 (msg->flags & I2C_M_RD) ? "read" : "write", msg->len); 595 (msg->flags & I2C_M_RD) ? "read" : "write", msg->len,
596 (ret == MSP_TWI_XFER_OK) ? "succeeded" : "failed");
597
596 if (ret != MSP_TWI_XFER_OK) { 598 if (ret != MSP_TWI_XFER_OK) {
597 /* 599 /*
598 * TODO: We could potentially loop and retry in the case 600 * TODO: We could potentially loop and retry in the case
599 * of MSP_TWI_XFER_TIMEOUT. 601 * of MSP_TWI_XFER_TIMEOUT.
600 */ 602 */
601 dev_dbg(&adap->dev, "failed\n");
602 return -1; 603 return -1;
603 } 604 }
604 605
605 dev_dbg(&adap->dev, "succeeded\n");
606 return 0; 606 return 0;
607} 607}
608 608
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 17376feb1acc..f8d0dff0de7e 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -575,7 +575,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
575 else { 575 else {
576 freq_mhz = PNX_DEFAULT_FREQ; 576 freq_mhz = PNX_DEFAULT_FREQ;
577 dev_info(&pdev->dev, "Setting bus frequency to default value: " 577 dev_info(&pdev->dev, "Setting bus frequency to default value: "
578 "%d MHz", freq_mhz); 578 "%d MHz\n", freq_mhz);
579 } 579 }
580 580
581 i2c_pnx->adapter->algo = &pnx_algorithm; 581 i2c_pnx->adapter->algo = &pnx_algorithm;
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 00fad11733ad..6426a61f8d4d 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -85,7 +85,7 @@ struct bits {
85 const char *set; 85 const char *set;
86 const char *unset; 86 const char *unset;
87}; 87};
88#define BIT(m, s, u) { .mask = m, .set = s, .unset = u } 88#define PXA_BIT(m, s, u) { .mask = m, .set = s, .unset = u }
89 89
90static inline void 90static inline void
91decode_bits(const char *prefix, const struct bits *bits, int num, u32 val) 91decode_bits(const char *prefix, const struct bits *bits, int num, u32 val)
@@ -100,17 +100,17 @@ decode_bits(const char *prefix, const struct bits *bits, int num, u32 val)
100} 100}
101 101
102static const struct bits isr_bits[] = { 102static const struct bits isr_bits[] = {
103 BIT(ISR_RWM, "RX", "TX"), 103 PXA_BIT(ISR_RWM, "RX", "TX"),
104 BIT(ISR_ACKNAK, "NAK", "ACK"), 104 PXA_BIT(ISR_ACKNAK, "NAK", "ACK"),
105 BIT(ISR_UB, "Bsy", "Rdy"), 105 PXA_BIT(ISR_UB, "Bsy", "Rdy"),
106 BIT(ISR_IBB, "BusBsy", "BusRdy"), 106 PXA_BIT(ISR_IBB, "BusBsy", "BusRdy"),
107 BIT(ISR_SSD, "SlaveStop", NULL), 107 PXA_BIT(ISR_SSD, "SlaveStop", NULL),
108 BIT(ISR_ALD, "ALD", NULL), 108 PXA_BIT(ISR_ALD, "ALD", NULL),
109 BIT(ISR_ITE, "TxEmpty", NULL), 109 PXA_BIT(ISR_ITE, "TxEmpty", NULL),
110 BIT(ISR_IRF, "RxFull", NULL), 110 PXA_BIT(ISR_IRF, "RxFull", NULL),
111 BIT(ISR_GCAD, "GenCall", NULL), 111 PXA_BIT(ISR_GCAD, "GenCall", NULL),
112 BIT(ISR_SAD, "SlaveAddr", NULL), 112 PXA_BIT(ISR_SAD, "SlaveAddr", NULL),
113 BIT(ISR_BED, "BusErr", NULL), 113 PXA_BIT(ISR_BED, "BusErr", NULL),
114}; 114};
115 115
116static void decode_ISR(unsigned int val) 116static void decode_ISR(unsigned int val)
@@ -120,21 +120,21 @@ static void decode_ISR(unsigned int val)
120} 120}
121 121
122static const struct bits icr_bits[] = { 122static const struct bits icr_bits[] = {
123 BIT(ICR_START, "START", NULL), 123 PXA_BIT(ICR_START, "START", NULL),
124 BIT(ICR_STOP, "STOP", NULL), 124 PXA_BIT(ICR_STOP, "STOP", NULL),
125 BIT(ICR_ACKNAK, "ACKNAK", NULL), 125 PXA_BIT(ICR_ACKNAK, "ACKNAK", NULL),
126 BIT(ICR_TB, "TB", NULL), 126 PXA_BIT(ICR_TB, "TB", NULL),
127 BIT(ICR_MA, "MA", NULL), 127 PXA_BIT(ICR_MA, "MA", NULL),
128 BIT(ICR_SCLE, "SCLE", "scle"), 128 PXA_BIT(ICR_SCLE, "SCLE", "scle"),
129 BIT(ICR_IUE, "IUE", "iue"), 129 PXA_BIT(ICR_IUE, "IUE", "iue"),
130 BIT(ICR_GCD, "GCD", NULL), 130 PXA_BIT(ICR_GCD, "GCD", NULL),
131 BIT(ICR_ITEIE, "ITEIE", NULL), 131 PXA_BIT(ICR_ITEIE, "ITEIE", NULL),
132 BIT(ICR_IRFIE, "IRFIE", NULL), 132 PXA_BIT(ICR_IRFIE, "IRFIE", NULL),
133 BIT(ICR_BEIE, "BEIE", NULL), 133 PXA_BIT(ICR_BEIE, "BEIE", NULL),
134 BIT(ICR_SSDIE, "SSDIE", NULL), 134 PXA_BIT(ICR_SSDIE, "SSDIE", NULL),
135 BIT(ICR_ALDIE, "ALDIE", NULL), 135 PXA_BIT(ICR_ALDIE, "ALDIE", NULL),
136 BIT(ICR_SADIE, "SADIE", NULL), 136 PXA_BIT(ICR_SADIE, "SADIE", NULL),
137 BIT(ICR_UR, "UR", "ur"), 137 PXA_BIT(ICR_UR, "UR", "ur"),
138}; 138};
139 139
140static void decode_ICR(unsigned int val) 140static void decode_ICR(unsigned int val)
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
index 81520868797b..61716f6b14dc 100644
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -4,7 +4,7 @@
4 4
5 i2c Support for Via Technologies 82C586B South Bridge 5 i2c Support for Via Technologies 82C586B South Bridge
6 6
7 Copyright (c) 1998, 1999 Kyösti Mälkki <kmalkki@cc.hut.fi> 7 Copyright (c) 1998, 1999 Kyösti Mälkki <kmalkki@cc.hut.fi>
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
@@ -176,7 +176,7 @@ static void __exit i2c_vt586b_exit(void)
176} 176}
177 177
178 178
179MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>"); 179MODULE_AUTHOR("Kyösti Mälkki <kmalkki@cc.hut.fi>");
180MODULE_DESCRIPTION("i2c for Via vt82c586b southbridge"); 180MODULE_DESCRIPTION("i2c for Via vt82c586b southbridge");
181MODULE_LICENSE("GPL"); 181MODULE_LICENSE("GPL");
182 182
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index edc275002f80..c9ce77f13c0e 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -2,7 +2,7 @@
2 i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware 2 i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware
3 monitoring 3 monitoring
4 Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, 4 Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>,
5 Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, 5 Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>,
6 Mark D. Studebaker <mdsxyz123@yahoo.com> 6 Mark D. Studebaker <mdsxyz123@yahoo.com>
7 Copyright (C) 2005 - 2007 Jean Delvare <khali@linux-fr.org> 7 Copyright (C) 2005 - 2007 Jean Delvare <khali@linux-fr.org>
8 8
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c
index 66436bae11ac..2dea0123a958 100644
--- a/drivers/i2c/chips/menelaus.c
+++ b/drivers/i2c/chips/menelaus.c
@@ -1195,7 +1195,7 @@ static int menelaus_probe(struct i2c_client *client)
1195 err = request_irq(client->irq, menelaus_irq, IRQF_DISABLED, 1195 err = request_irq(client->irq, menelaus_irq, IRQF_DISABLED,
1196 DRIVER_NAME, menelaus); 1196 DRIVER_NAME, menelaus);
1197 if (err) { 1197 if (err) {
1198 dev_dbg(&client->dev, "can't get IRQ %d, err %d", 1198 dev_dbg(&client->dev, "can't get IRQ %d, err %d\n",
1199 client->irq, err); 1199 client->irq, err);
1200 goto fail1; 1200 goto fail1;
1201 } 1201 }
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e73d58c43f38..1a4e8dc03b36 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -17,7 +17,7 @@
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
18/* ------------------------------------------------------------------------- */ 18/* ------------------------------------------------------------------------- */
19 19
20/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>. 20/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>.
21 All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl> 21 All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl>
22 SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> and 22 SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> and
23 Jean Delvare <khali@linux-fr.org> */ 23 Jean Delvare <khali@linux-fr.org> */
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 6d9fd92763f4..6eaece96524e 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -1056,6 +1056,9 @@ endif
1056config BLK_DEV_IDEDMA 1056config BLK_DEV_IDEDMA
1057 def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 1057 def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
1058 1058
1059config IDE_ARCH_OBSOLETE_INIT
1060 def_bool ALPHA || (ARM && !ARCH_L7200) || BLACKFIN || X86 || IA64 || M32R || MIPS || PARISC || PPC || (SUPERH64 && BLK_DEV_IDEPCI) || SPARC
1061
1059endif 1062endif
1060 1063
1061config BLK_DEV_HD_ONLY 1064config BLK_DEV_HD_ONLY
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c
index f7449d04114a..48db6167bb90 100644
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -45,7 +45,7 @@ bastide_register(unsigned int base, unsigned int aux, int irq,
45 hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); 45 hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
46 hw.irq = irq; 46 hw.irq = irq;
47 47
48 ide_register_hw(&hw, 0, hwif); 48 ide_register_hw(&hw, NULL, 0, hwif);
49 49
50 return 0; 50 return 0;
51} 51}
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index e4875cef78bb..410a0d13e35e 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -316,27 +316,29 @@ static int icside_dma_end(ide_drive_t *drive)
316 316
317 drive->waiting_for_dma = 0; 317 drive->waiting_for_dma = 0;
318 318
319 disable_dma(hwif->hw.dma); 319 disable_dma(state->dev->dma);
320 320
321 /* Teardown mappings after DMA has completed. */ 321 /* Teardown mappings after DMA has completed. */
322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents, 322 dma_unmap_sg(state->dev, hwif->sg_table, hwif->sg_nents,
323 hwif->sg_dma_direction); 323 hwif->sg_dma_direction);
324 324
325 return get_dma_residue(hwif->hw.dma) != 0; 325 return get_dma_residue(state->dev->dma) != 0;
326} 326}
327 327
328static void icside_dma_start(ide_drive_t *drive) 328static void icside_dma_start(ide_drive_t *drive)
329{ 329{
330 ide_hwif_t *hwif = HWIF(drive); 330 ide_hwif_t *hwif = HWIF(drive);
331 struct icside_state *state = hwif->hwif_data;
331 332
332 /* We can not enable DMA on both channels simultaneously. */ 333 /* We can not enable DMA on both channels simultaneously. */
333 BUG_ON(dma_channel_active(hwif->hw.dma)); 334 BUG_ON(dma_channel_active(state->dev->dma));
334 enable_dma(hwif->hw.dma); 335 enable_dma(state->dev->dma);
335} 336}
336 337
337static int icside_dma_setup(ide_drive_t *drive) 338static int icside_dma_setup(ide_drive_t *drive)
338{ 339{
339 ide_hwif_t *hwif = HWIF(drive); 340 ide_hwif_t *hwif = HWIF(drive);
341 struct icside_state *state = hwif->hwif_data;
340 struct request *rq = hwif->hwgroup->rq; 342 struct request *rq = hwif->hwgroup->rq;
341 unsigned int dma_mode; 343 unsigned int dma_mode;
342 344
@@ -348,7 +350,7 @@ static int icside_dma_setup(ide_drive_t *drive)
348 /* 350 /*
349 * We can not enable DMA on both channels. 351 * We can not enable DMA on both channels.
350 */ 352 */
351 BUG_ON(dma_channel_active(hwif->hw.dma)); 353 BUG_ON(dma_channel_active(state->dev->dma));
352 354
353 icside_build_sglist(drive, rq); 355 icside_build_sglist(drive, rq);
354 356
@@ -365,14 +367,14 @@ static int icside_dma_setup(ide_drive_t *drive)
365 /* 367 /*
366 * Select the correct timing for this drive. 368 * Select the correct timing for this drive.
367 */ 369 */
368 set_dma_speed(hwif->hw.dma, drive->drive_data); 370 set_dma_speed(state->dev->dma, drive->drive_data);
369 371
370 /* 372 /*
371 * Tell the DMA engine about the SG table and 373 * Tell the DMA engine about the SG table and
372 * data direction. 374 * data direction.
373 */ 375 */
374 set_dma_sg(hwif->hw.dma, hwif->sg_table, hwif->sg_nents); 376 set_dma_sg(state->dev->dma, hwif->sg_table, hwif->sg_nents);
375 set_dma_mode(hwif->hw.dma, dma_mode); 377 set_dma_mode(state->dev->dma, dma_mode);
376 378
377 drive->waiting_for_dma = 1; 379 drive->waiting_for_dma = 1;
378 380
@@ -415,7 +417,6 @@ static void icside_dma_lost_irq(ide_drive_t *drive)
415 417
416static void icside_dma_init(ide_hwif_t *hwif) 418static void icside_dma_init(ide_hwif_t *hwif)
417{ 419{
418 hwif->atapi_dma = 1;
419 hwif->mwdma_mask = 7; /* MW0..2 */ 420 hwif->mwdma_mask = 7; /* MW0..2 */
420 hwif->swdma_mask = 7; /* SW0..2 */ 421 hwif->swdma_mask = 7; /* SW0..2 */
421 422
@@ -439,40 +440,16 @@ static void icside_dma_init(ide_hwif_t *hwif)
439#define icside_dma_init(hwif) (0) 440#define icside_dma_init(hwif) (0)
440#endif 441#endif
441 442
442static ide_hwif_t *icside_find_hwif(unsigned long dataport)
443{
444 ide_hwif_t *hwif;
445 int index;
446
447 for (index = 0; index < MAX_HWIFS; ++index) {
448 hwif = &ide_hwifs[index];
449 if (hwif->io_ports[IDE_DATA_OFFSET] == dataport)
450 goto found;
451 }
452
453 for (index = 0; index < MAX_HWIFS; ++index) {
454 hwif = &ide_hwifs[index];
455 if (!hwif->io_ports[IDE_DATA_OFFSET])
456 goto found;
457 }
458
459 hwif = NULL;
460found:
461 return hwif;
462}
463
464static ide_hwif_t * 443static ide_hwif_t *
465icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) 444icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec)
466{ 445{
467 unsigned long port = (unsigned long)base + info->dataoffset; 446 unsigned long port = (unsigned long)base + info->dataoffset;
468 ide_hwif_t *hwif; 447 ide_hwif_t *hwif;
469 448
470 hwif = icside_find_hwif(port); 449 hwif = ide_find_port(port);
471 if (hwif) { 450 if (hwif) {
472 int i; 451 int i;
473 452
474 memset(&hwif->hw, 0, sizeof(hw_regs_t));
475
476 /* 453 /*
477 * Ensure we're using MMIO 454 * Ensure we're using MMIO
478 */ 455 */
@@ -480,13 +457,10 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e
480 hwif->mmio = 1; 457 hwif->mmio = 1;
481 458
482 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 459 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
483 hwif->hw.io_ports[i] = port;
484 hwif->io_ports[i] = port; 460 hwif->io_ports[i] = port;
485 port += 1 << info->stepping; 461 port += 1 << info->stepping;
486 } 462 }
487 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset;
488 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; 463 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset;
489 hwif->hw.irq = ec->irq;
490 hwif->irq = ec->irq; 464 hwif->irq = ec->irq;
491 hwif->noprobe = 0; 465 hwif->noprobe = 0;
492 hwif->chipset = ide_acorn; 466 hwif->chipset = ide_acorn;
@@ -501,6 +475,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
501{ 475{
502 ide_hwif_t *hwif; 476 ide_hwif_t *hwif;
503 void __iomem *base; 477 void __iomem *base;
478 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
504 479
505 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); 480 base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
506 if (!base) 481 if (!base)
@@ -524,9 +499,9 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)
524 499
525 state->hwif[0] = hwif; 500 state->hwif[0] = hwif;
526 501
527 probe_hwif_init(hwif); 502 idx[0] = hwif->index;
528 503
529 ide_proc_register_port(hwif); 504 ide_device_add(idx);
530 505
531 return 0; 506 return 0;
532} 507}
@@ -538,6 +513,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
538 void __iomem *ioc_base, *easi_base; 513 void __iomem *ioc_base, *easi_base;
539 unsigned int sel = 0; 514 unsigned int sel = 0;
540 int ret; 515 int ret;
516 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
541 517
542 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); 518 ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
543 if (!ioc_base) { 519 if (!ioc_base) {
@@ -593,7 +569,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
593 hwif->serialized = 1; 569 hwif->serialized = 1;
594 hwif->config_data = (unsigned long)ioc_base; 570 hwif->config_data = (unsigned long)ioc_base;
595 hwif->select_data = sel; 571 hwif->select_data = sel;
596 hwif->hw.dma = ec->dma;
597 572
598 mate->maskproc = icside_maskproc; 573 mate->maskproc = icside_maskproc;
599 mate->channel = 1; 574 mate->channel = 1;
@@ -602,18 +577,16 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
602 mate->serialized = 1; 577 mate->serialized = 1;
603 mate->config_data = (unsigned long)ioc_base; 578 mate->config_data = (unsigned long)ioc_base;
604 mate->select_data = sel | 1; 579 mate->select_data = sel | 1;
605 mate->hw.dma = ec->dma;
606 580
607 if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { 581 if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) {
608 icside_dma_init(hwif); 582 icside_dma_init(hwif);
609 icside_dma_init(mate); 583 icside_dma_init(mate);
610 } 584 }
611 585
612 probe_hwif_init(hwif); 586 idx[0] = hwif->index;
613 probe_hwif_init(mate); 587 idx[1] = mate->index;
614 588
615 ide_proc_register_port(hwif); 589 ide_device_add(idx);
616 ide_proc_register_port(mate);
617 590
618 return 0; 591 return 0;
619 592
diff --git a/drivers/ide/arm/ide_arm.c b/drivers/ide/arm/ide_arm.c
index bce2bec81413..8957cbadf5c2 100644
--- a/drivers/ide/arm/ide_arm.c
+++ b/drivers/ide/arm/ide_arm.c
@@ -31,5 +31,5 @@ void __init ide_arm_init(void)
31 memset(&hw, 0, sizeof(hw)); 31 memset(&hw, 0, sizeof(hw));
32 ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206); 32 ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
33 hw.irq = IDE_ARM_IRQ; 33 hw.irq = IDE_ARM_IRQ;
34 ide_register_hw(&hw, 1, NULL); 34 ide_register_hw(&hw, NULL, 1, NULL);
35} 35}
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 83811af11610..0775a3afef48 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -13,42 +13,25 @@
13 13
14#include <asm/ecard.h> 14#include <asm/ecard.h>
15 15
16/*
17 * Something like this really should be in generic code, but isn't.
18 */
19static ide_hwif_t * 16static ide_hwif_t *
20rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq) 17rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
21{ 18{
22 unsigned long port = (unsigned long)base; 19 unsigned long port = (unsigned long)base;
23 ide_hwif_t *hwif; 20 ide_hwif_t *hwif = ide_find_port(port);
24 int index, i; 21 int i;
25
26 for (index = 0; index < MAX_HWIFS; ++index) {
27 hwif = ide_hwifs + index;
28 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
29 goto found;
30 }
31
32 for (index = 0; index < MAX_HWIFS; ++index) {
33 hwif = ide_hwifs + index;
34 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
35 goto found;
36 }
37 22
38 return NULL; 23 if (hwif == NULL)
24 goto out;
39 25
40 found:
41 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 26 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
42 hwif->hw.io_ports[i] = port;
43 hwif->io_ports[i] = port; 27 hwif->io_ports[i] = port;
44 port += sz; 28 port += sz;
45 } 29 }
46 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
47 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; 30 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
48 hwif->hw.irq = hwif->irq = irq; 31 hwif->irq = irq;
49 hwif->mmio = 1; 32 hwif->mmio = 1;
50 default_hwif_mmiops(hwif); 33 default_hwif_mmiops(hwif);
51 34out:
52 return hwif; 35 return hwif;
53} 36}
54 37
@@ -58,6 +41,7 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
58 ide_hwif_t *hwif; 41 ide_hwif_t *hwif;
59 void __iomem *base; 42 void __iomem *base;
60 int ret; 43 int ret;
44 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
61 45
62 ret = ecard_request_resources(ec); 46 ret = ecard_request_resources(ec);
63 if (ret) 47 if (ret)
@@ -74,8 +58,11 @@ rapide_probe(struct expansion_card *ec, const struct ecard_id *id)
74 hwif->hwif_data = base; 58 hwif->hwif_data = base;
75 hwif->gendev.parent = &ec->dev; 59 hwif->gendev.parent = &ec->dev;
76 hwif->noprobe = 0; 60 hwif->noprobe = 0;
77 probe_hwif_init(hwif); 61
78 ide_proc_register_port(hwif); 62 idx[0] = hwif->index;
63
64 ide_device_add(idx);
65
79 ecard_set_drvdata(ec, hwif); 66 ecard_set_drvdata(ec, hwif);
80 goto out; 67 goto out;
81 } 68 }
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index 06c75f18eb88..ff20377b4c82 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -782,7 +782,7 @@ init_e100_ide (void)
782 ide_offsets, 782 ide_offsets,
783 0, 0, cris_ide_ack_intr, 783 0, 0, cris_ide_ack_intr,
784 ide_default_irq(0)); 784 ide_default_irq(0));
785 ide_register_hw(&hw, 1, &hwif); 785 ide_register_hw(&hw, NULL, 1, &hwif);
786 hwif->mmio = 1; 786 hwif->mmio = 1;
787 hwif->chipset = ide_etrax100; 787 hwif->chipset = ide_etrax100;
788 hwif->set_pio_mode = &cris_set_pio_mode; 788 hwif->set_pio_mode = &cris_set_pio_mode;
@@ -805,6 +805,7 @@ init_e100_ide (void)
805 hwif->dma_host_on = &cris_dma_on; 805 hwif->dma_host_on = &cris_dma_on;
806 hwif->dma_off_quietly = &cris_dma_off; 806 hwif->dma_off_quietly = &cris_dma_off;
807 hwif->cbl = ATA_CBL_PATA40; 807 hwif->cbl = ATA_CBL_PATA40;
808 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
808 hwif->pio_mask = ATA_PIO4, 809 hwif->pio_mask = ATA_PIO4,
809 hwif->drives[0].autotune = 1; 810 hwif->drives[0].autotune = 1;
810 hwif->drives[1].autotune = 1; 811 hwif->drives[1].autotune = 1;
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 6d26ad7360d5..4a49b5c59acb 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -68,7 +68,6 @@ static inline void hw_setup(hw_regs_t *hw)
68 hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i; 68 hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i;
69 hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT; 69 hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT;
70 hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ; 70 hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ;
71 hw->dma = NO_DMA;
72 hw->chipset = ide_generic; 71 hw->chipset = ide_generic;
73} 72}
74 73
@@ -101,7 +100,7 @@ void __init h8300_ide_init(void)
101 hw_setup(&hw); 100 hw_setup(&hw);
102 101
103 /* register if */ 102 /* register if */
104 idx = ide_register_hw(&hw, 1, &hwif); 103 idx = ide_register_hw(&hw, NULL, 1, &hwif);
105 if (idx == -1) { 104 if (idx == -1) {
106 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); 105 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
107 return; 106 return;
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 1d5f6823101c..89df48fdc69d 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -350,7 +350,7 @@ static int taskfile_load_raw(ide_drive_t *drive,
350 350
351 memset(&args, 0, sizeof(ide_task_t)); 351 memset(&args, 0, sizeof(ide_task_t));
352 args.command_type = IDE_DRIVE_TASK_NO_DATA; 352 args.command_type = IDE_DRIVE_TASK_NO_DATA;
353 args.data_phase = TASKFILE_IN; 353 args.data_phase = TASKFILE_NO_DATA;
354 args.handler = &task_no_data_intr; 354 args.handler = &task_no_data_intr;
355 355
356 /* convert gtf to IDE Taskfile */ 356 /* convert gtf to IDE Taskfile */
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index ca843522f91d..57a5f63d6ae3 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -120,7 +120,7 @@
120 * Reformat to match kernel tabbing style. 120 * Reformat to match kernel tabbing style.
121 * Add CDROM_GET_UPC ioctl. 121 * Add CDROM_GET_UPC ioctl.
122 * 3.10 Apr 10, 1996 -- Fix compilation error with STANDARD_ATAPI. 122 * 3.10 Apr 10, 1996 -- Fix compilation error with STANDARD_ATAPI.
123 * 3.11 Apr 29, 1996 -- Patch from Heiko Eissfeldt <heiko@colossus.escape.de> 123 * 3.11 Apr 29, 1996 -- Patch from Heiko Eißfeldt <heiko@colossus.escape.de>
124 * to remove redundant verify_area calls. 124 * to remove redundant verify_area calls.
125 * 3.12 May 7, 1996 -- Rudimentary changer support. Based on patches 125 * 3.12 May 7, 1996 -- Rudimentary changer support. Based on patches
126 * from Gerhard Zuber <zuber@berlin.snafu.de>. 126 * from Gerhard Zuber <zuber@berlin.snafu.de>.
@@ -256,7 +256,7 @@
256 * - Minimize the TOC reading - only do it when we 256 * - Minimize the TOC reading - only do it when we
257 * know a media change has occurred. 257 * know a media change has occurred.
258 * - Moved all the CDROMREADx ioctls to the Uniform layer. 258 * - Moved all the CDROMREADx ioctls to the Uniform layer.
259 * - Heiko Eissfeldt <heiko@colossus.escape.de> supplied 259 * - Heiko Eißfeldt <heiko@colossus.escape.de> supplied
260 * some fixes for CDI. 260 * some fixes for CDI.
261 * - CD-ROM leaving door locked fix from Andries 261 * - CD-ROM leaving door locked fix from Andries
262 * Brouwer <Andries.Brouwer@cwi.nl> 262 * Brouwer <Andries.Brouwer@cwi.nl>
@@ -2341,7 +2341,7 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
2341 If we get an error for the regular case, we assume 2341 If we get an error for the regular case, we assume
2342 a CDI without additional audio tracks. In this case 2342 a CDI without additional audio tracks. In this case
2343 the readable TOC is empty (CDI tracks are not included) 2343 the readable TOC is empty (CDI tracks are not included)
2344 and only holds the Leadout entry. Heiko Eißfeldt */ 2344 and only holds the Leadout entry. Heiko Eißfeldt */
2345 ntracks = 0; 2345 ntracks = 0;
2346 stat = cdrom_read_tocentry(drive, CDROM_LEADOUT, 1, 0, 2346 stat = cdrom_read_tocentry(drive, CDROM_LEADOUT, 1, 0,
2347 (char *)&toc->hdr, 2347 (char *)&toc->hdr,
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 92177ca48b4d..00123d99527a 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -169,7 +169,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
169 169
170 nsectors.all = (u16) rq->nr_sectors; 170 nsectors.all = (u16) rq->nr_sectors;
171 171
172 if (hwif->no_lba48_dma && lba48 && dma) { 172 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
173 if (block + rq->nr_sectors > 1ULL << 28) 173 if (block + rq->nr_sectors > 1ULL << 28)
174 dma = 0; 174 dma = 0;
175 else 175 else
@@ -593,28 +593,12 @@ static int smart_enable(ide_drive_t *drive)
593 return ide_raw_taskfile(drive, &args, NULL); 593 return ide_raw_taskfile(drive, &args, NULL);
594} 594}
595 595
596static int get_smart_values(ide_drive_t *drive, u8 *buf) 596static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
597{ 597{
598 ide_task_t args; 598 ide_task_t args;
599 599
600 memset(&args, 0, sizeof(ide_task_t)); 600 memset(&args, 0, sizeof(ide_task_t));
601 args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_VALUES; 601 args.tfRegister[IDE_FEATURE_OFFSET] = sub_cmd;
602 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
603 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
604 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
605 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART;
606 args.command_type = IDE_DRIVE_TASK_IN;
607 args.data_phase = TASKFILE_IN;
608 args.handler = &task_in_intr;
609 (void) smart_enable(drive);
610 return ide_raw_taskfile(drive, &args, buf);
611}
612
613static int get_smart_thresholds(ide_drive_t *drive, u8 *buf)
614{
615 ide_task_t args;
616 memset(&args, 0, sizeof(ide_task_t));
617 args.tfRegister[IDE_FEATURE_OFFSET] = SMART_READ_THRESHOLDS;
618 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; 602 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01;
619 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; 603 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS;
620 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; 604 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS;
@@ -656,7 +640,7 @@ static int proc_idedisk_read_smart_thresholds
656 ide_drive_t *drive = (ide_drive_t *)data; 640 ide_drive_t *drive = (ide_drive_t *)data;
657 int len = 0, i = 0; 641 int len = 0, i = 0;
658 642
659 if (!get_smart_thresholds(drive, page)) { 643 if (get_smart_data(drive, page, SMART_READ_THRESHOLDS) == 0) {
660 unsigned short *val = (unsigned short *) page; 644 unsigned short *val = (unsigned short *) page;
661 char *out = ((char *)val) + (SECTOR_WORDS * 4); 645 char *out = ((char *)val) + (SECTOR_WORDS * 4);
662 page = out; 646 page = out;
@@ -675,7 +659,7 @@ static int proc_idedisk_read_smart_values
675 ide_drive_t *drive = (ide_drive_t *)data; 659 ide_drive_t *drive = (ide_drive_t *)data;
676 int len = 0, i = 0; 660 int len = 0, i = 0;
677 661
678 if (!get_smart_values(drive, page)) { 662 if (get_smart_data(drive, page, SMART_READ_VALUES) == 0) {
679 unsigned short *val = (unsigned short *) page; 663 unsigned short *val = (unsigned short *) page;
680 char *out = ((char *)val) + (SECTOR_WORDS * 4); 664 char *out = ((char *)val) + (SECTOR_WORDS * 4);
681 page = out; 665 page = out;
@@ -856,7 +840,7 @@ static int set_lba_addressing(ide_drive_t *drive, int arg)
856 840
857 drive->addressing = 0; 841 drive->addressing = 0;
858 842
859 if (HWIF(drive)->no_lba48) 843 if (drive->hwif->host_flags & IDE_HFLAG_NO_LBA48)
860 return 0; 844 return 0;
861 845
862 if (!idedisk_supports_lba48(drive->id)) 846 if (!idedisk_supports_lba48(drive->id))
@@ -889,6 +873,7 @@ static inline void idedisk_add_settings(ide_drive_t *drive) { ; }
889 873
890static void idedisk_setup (ide_drive_t *drive) 874static void idedisk_setup (ide_drive_t *drive)
891{ 875{
876 ide_hwif_t *hwif = drive->hwif;
892 struct hd_driveid *id = drive->id; 877 struct hd_driveid *id = drive->id;
893 unsigned long long capacity; 878 unsigned long long capacity;
894 879
@@ -909,7 +894,6 @@ static void idedisk_setup (ide_drive_t *drive)
909 (void)set_lba_addressing(drive, 1); 894 (void)set_lba_addressing(drive, 1);
910 895
911 if (drive->addressing == 1) { 896 if (drive->addressing == 1) {
912 ide_hwif_t *hwif = HWIF(drive);
913 int max_s = 2048; 897 int max_s = 2048;
914 898
915 if (max_s > hwif->rqsize) 899 if (max_s > hwif->rqsize)
@@ -932,7 +916,7 @@ static void idedisk_setup (ide_drive_t *drive)
932 drive->capacity64 = 1ULL << 28; 916 drive->capacity64 = 1ULL << 28;
933 } 917 }
934 918
935 if (drive->hwif->no_lba48_dma && drive->addressing) { 919 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && drive->addressing) {
936 if (drive->capacity64 > 1ULL << 28) { 920 if (drive->capacity64 > 1ULL << 28) {
937 printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode will" 921 printk(KERN_INFO "%s: cannot use LBA48 DMA - PIO mode will"
938 " be used for accessing sectors > %u\n", 922 " be used for accessing sectors > %u\n",
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index bc57ce6bf0b3..428f7a8a00b6 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -338,8 +338,10 @@ static int config_drive_for_dma (ide_drive_t *drive)
338 ide_hwif_t *hwif = drive->hwif; 338 ide_hwif_t *hwif = drive->hwif;
339 struct hd_driveid *id = drive->id; 339 struct hd_driveid *id = drive->id;
340 340
341 if (drive->media != ide_disk && hwif->atapi_dma == 0) 341 if (drive->media != ide_disk) {
342 return 0; 342 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
343 return -1;
344 }
343 345
344 /* 346 /*
345 * Enable DMA on any drive that has 347 * Enable DMA on any drive that has
@@ -726,8 +728,10 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
726 int x, i; 728 int x, i;
727 u8 mode = 0; 729 u8 mode = 0;
728 730
729 if (drive->media != ide_disk && hwif->atapi_dma == 0) 731 if (drive->media != ide_disk) {
730 return 0; 732 if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA)
733 return 0;
734 }
731 735
732 for (i = 0; i < ARRAY_SIZE(xfer_mode_bases); i++) { 736 for (i = 0; i < ARRAY_SIZE(xfer_mode_bases); i++) {
733 if (req_mode < xfer_mode_bases[i]) 737 if (req_mode < xfer_mode_bases[i])
@@ -897,10 +901,7 @@ void ide_dma_timeout (ide_drive_t *drive)
897 901
898EXPORT_SYMBOL(ide_dma_timeout); 902EXPORT_SYMBOL(ide_dma_timeout);
899 903
900/* 904static void ide_release_dma_engine(ide_hwif_t *hwif)
901 * Needed for allowing full modular support of ide-driver
902 */
903static int ide_release_dma_engine(ide_hwif_t *hwif)
904{ 905{
905 if (hwif->dmatable_cpu) { 906 if (hwif->dmatable_cpu) {
906 pci_free_consistent(hwif->pci_dev, 907 pci_free_consistent(hwif->pci_dev,
@@ -909,7 +910,6 @@ static int ide_release_dma_engine(ide_hwif_t *hwif)
909 hwif->dmatable_dma); 910 hwif->dmatable_dma);
910 hwif->dmatable_cpu = NULL; 911 hwif->dmatable_cpu = NULL;
911 } 912 }
912 return 1;
913} 913}
914 914
915static int ide_release_iomio_dma(ide_hwif_t *hwif) 915static int ide_release_iomio_dma(ide_hwif_t *hwif)
@@ -952,12 +952,6 @@ static int ide_mapped_mmio_dma(ide_hwif_t *hwif, unsigned long base, unsigned in
952{ 952{
953 printk(KERN_INFO " %s: MMIO-DMA ", hwif->name); 953 printk(KERN_INFO " %s: MMIO-DMA ", hwif->name);
954 954
955 hwif->dma_base = base;
956
957 if(hwif->mate)
958 hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
959 else
960 hwif->dma_master = base;
961 return 0; 955 return 0;
962} 956}
963 957
@@ -971,8 +965,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port
971 return 1; 965 return 1;
972 } 966 }
973 967
974 hwif->dma_base = base;
975
976 if (hwif->cds->extra) { 968 if (hwif->cds->extra) {
977 hwif->extra_base = base + (hwif->channel ? 8 : 16); 969 hwif->extra_base = base + (hwif->channel ? 8 : 16);
978 970
@@ -987,10 +979,6 @@ static int ide_iomio_dma(ide_hwif_t *hwif, unsigned long base, unsigned int port
987 } 979 }
988 } 980 }
989 981
990 if(hwif->mate)
991 hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base:base;
992 else
993 hwif->dma_master = base;
994 return 0; 982 return 0;
995} 983}
996 984
@@ -1002,12 +990,9 @@ static int ide_dma_iobase(ide_hwif_t *hwif, unsigned long base, unsigned int por
1002 return ide_iomio_dma(hwif, base, ports); 990 return ide_iomio_dma(hwif, base, ports);
1003} 991}
1004 992
1005/* 993void ide_setup_dma(ide_hwif_t *hwif, unsigned long base, unsigned num_ports)
1006 * This can be called for a dynamically installed interface. Don't __init it
1007 */
1008void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports)
1009{ 994{
1010 if (ide_dma_iobase(hwif, dma_base, num_ports)) 995 if (ide_dma_iobase(hwif, base, num_ports))
1011 return; 996 return;
1012 997
1013 if (ide_allocate_dma_engine(hwif)) { 998 if (ide_allocate_dma_engine(hwif)) {
@@ -1015,6 +1000,13 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
1015 return; 1000 return;
1016 } 1001 }
1017 1002
1003 hwif->dma_base = base;
1004
1005 if (hwif->mate)
1006 hwif->dma_master = hwif->channel ? hwif->mate->dma_base : base;
1007 else
1008 hwif->dma_master = base;
1009
1018 if (!(hwif->dma_command)) 1010 if (!(hwif->dma_command))
1019 hwif->dma_command = hwif->dma_base; 1011 hwif->dma_command = hwif->dma_base;
1020 if (!(hwif->dma_vendor1)) 1012 if (!(hwif->dma_vendor1))
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index ec835e37e729..c89f0d3058e9 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -47,15 +47,15 @@
47#include <linux/device.h> 47#include <linux/device.h>
48#include <linux/kmod.h> 48#include <linux/kmod.h>
49#include <linux/scatterlist.h> 49#include <linux/scatterlist.h>
50#include <linux/bitops.h>
50 51
51#include <asm/byteorder.h> 52#include <asm/byteorder.h>
52#include <asm/irq.h> 53#include <asm/irq.h>
53#include <asm/uaccess.h> 54#include <asm/uaccess.h>
54#include <asm/io.h> 55#include <asm/io.h>
55#include <asm/bitops.h>
56 56
57static int __ide_end_request(ide_drive_t *drive, struct request *rq, 57static int __ide_end_request(ide_drive_t *drive, struct request *rq,
58 int uptodate, unsigned int nr_bytes) 58 int uptodate, unsigned int nr_bytes, int dequeue)
59{ 59{
60 int ret = 1; 60 int ret = 1;
61 61
@@ -80,9 +80,11 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
80 80
81 if (!end_that_request_chunk(rq, uptodate, nr_bytes)) { 81 if (!end_that_request_chunk(rq, uptodate, nr_bytes)) {
82 add_disk_randomness(rq->rq_disk); 82 add_disk_randomness(rq->rq_disk);
83 if (!list_empty(&rq->queuelist)) 83 if (dequeue) {
84 blkdev_dequeue_request(rq); 84 if (!list_empty(&rq->queuelist))
85 HWGROUP(drive)->rq = NULL; 85 blkdev_dequeue_request(rq);
86 HWGROUP(drive)->rq = NULL;
87 }
86 end_that_request_last(rq, uptodate); 88 end_that_request_last(rq, uptodate);
87 ret = 0; 89 ret = 0;
88 } 90 }
@@ -122,7 +124,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
122 nr_bytes = rq->hard_cur_sectors << 9; 124 nr_bytes = rq->hard_cur_sectors << 9;
123 } 125 }
124 126
125 ret = __ide_end_request(drive, rq, uptodate, nr_bytes); 127 ret = __ide_end_request(drive, rq, uptodate, nr_bytes, 1);
126 128
127 spin_unlock_irqrestore(&ide_lock, flags); 129 spin_unlock_irqrestore(&ide_lock, flags);
128 return ret; 130 return ret;
@@ -255,39 +257,13 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
255 int uptodate, int nr_sectors) 257 int uptodate, int nr_sectors)
256{ 258{
257 unsigned long flags; 259 unsigned long flags;
258 int ret = 1; 260 int ret;
259 261
260 spin_lock_irqsave(&ide_lock, flags); 262 spin_lock_irqsave(&ide_lock, flags);
261
262 BUG_ON(!blk_rq_started(rq)); 263 BUG_ON(!blk_rq_started(rq));
263 264 ret = __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0);
264 /*
265 * if failfast is set on a request, override number of sectors and
266 * complete the whole request right now
267 */
268 if (blk_noretry_request(rq) && end_io_error(uptodate))
269 nr_sectors = rq->hard_nr_sectors;
270
271 if (!blk_fs_request(rq) && end_io_error(uptodate) && !rq->errors)
272 rq->errors = -EIO;
273
274 /*
275 * decide whether to reenable DMA -- 3 is a random magic for now,
276 * if we DMA timeout more than 3 times, just stay in PIO
277 */
278 if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
279 drive->state = 0;
280 HWGROUP(drive)->hwif->ide_dma_on(drive);
281 }
282
283 if (!end_that_request_first(rq, uptodate, nr_sectors)) {
284 add_disk_randomness(rq->rq_disk);
285 if (blk_rq_tagged(rq))
286 blk_queue_end_tag(drive->queue, rq);
287 end_that_request_last(rq, uptodate);
288 ret = 0;
289 }
290 spin_unlock_irqrestore(&ide_lock, flags); 265 spin_unlock_irqrestore(&ide_lock, flags);
266
291 return ret; 267 return ret;
292} 268}
293EXPORT_SYMBOL_GPL(ide_end_dequeued_request); 269EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
@@ -484,7 +460,8 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
484 } 460 }
485 } 461 }
486 462
487 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) 463 if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ &&
464 (hwif->host_flags & IDE_HFLAG_ERROR_STOPS_FIFO) == 0)
488 try_to_flush_leftover_data(drive); 465 try_to_flush_leftover_data(drive);
489 466
490 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) { 467 if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) {
@@ -799,7 +776,20 @@ static ide_startstop_t do_special (ide_drive_t *drive)
799 s->b.set_tune = 0; 776 s->b.set_tune = 0;
800 777
801 if (set_pio_mode_abuse(drive->hwif, req_pio)) { 778 if (set_pio_mode_abuse(drive->hwif, req_pio)) {
802 if (hwif->set_pio_mode) 779
780 if (hwif->set_pio_mode == NULL)
781 return ide_stopped;
782
783 /*
784 * take ide_lock for drive->[no_]unmask/[no_]io_32bit
785 */
786 if (req_pio == 8 || req_pio == 9) {
787 unsigned long flags;
788
789 spin_lock_irqsave(&ide_lock, flags);
790 hwif->set_pio_mode(drive, req_pio);
791 spin_unlock_irqrestore(&ide_lock, flags);
792 } else
803 hwif->set_pio_mode(drive, req_pio); 793 hwif->set_pio_mode(drive, req_pio);
804 } else { 794 } else {
805 int keep_dma = drive->using_dma; 795 int keep_dma = drive->using_dma;
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index d4d790f91f91..95168833d069 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -693,35 +693,16 @@ static u8 ide_auto_reduce_xfer (ide_drive_t *drive)
693} 693}
694#endif /* CONFIG_BLK_DEV_IDEDMA */ 694#endif /* CONFIG_BLK_DEV_IDEDMA */
695 695
696/* 696int ide_driveid_update(ide_drive_t *drive)
697 * Update the
698 */
699int ide_driveid_update (ide_drive_t *drive)
700{ 697{
701 ide_hwif_t *hwif = HWIF(drive); 698 ide_hwif_t *hwif = drive->hwif;
702 struct hd_driveid *id; 699 struct hd_driveid *id;
703#if 0 700 unsigned long timeout, flags;
704 id = kmalloc(SECTOR_WORDS*4, GFP_ATOMIC);
705 if (!id)
706 return 0;
707
708 taskfile_lib_get_identify(drive, (char *)&id);
709 701
710 ide_fix_driveid(id);
711 if (id) {
712 drive->id->dma_ultra = id->dma_ultra;
713 drive->id->dma_mword = id->dma_mword;
714 drive->id->dma_1word = id->dma_1word;
715 /* anything more ? */
716 kfree(id);
717 }
718 return 1;
719#else
720 /* 702 /*
721 * Re-read drive->id for possible DMA mode 703 * Re-read drive->id for possible DMA mode
722 * change (copied from ide-probe.c) 704 * change (copied from ide-probe.c)
723 */ 705 */
724 unsigned long timeout, flags;
725 706
726 SELECT_MASK(drive, 1); 707 SELECT_MASK(drive, 1);
727 if (IDE_CONTROL_REG) 708 if (IDE_CONTROL_REG)
@@ -763,7 +744,6 @@ int ide_driveid_update (ide_drive_t *drive)
763 } 744 }
764 745
765 return 1; 746 return 1;
766#endif
767} 747}
768 748
769int ide_config_drive_speed(ide_drive_t *drive, u8 speed) 749int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c
index 2b8009c50e91..e245521af7b5 100644
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -40,9 +40,8 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
40 ide_std_init_ports(&hw, pnp_port_start(dev, 0), 40 ide_std_init_ports(&hw, pnp_port_start(dev, 0),
41 pnp_port_start(dev, 1)); 41 pnp_port_start(dev, 1));
42 hw.irq = pnp_irq(dev, 0); 42 hw.irq = pnp_irq(dev, 0);
43 hw.dma = NO_DMA;
44 43
45 index = ide_register_hw(&hw, 1, &hwif); 44 index = ide_register_hw(&hw, NULL, 1, &hwif);
46 45
47 if (index != -1) { 46 if (index != -1) {
48 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index); 47 printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 3c945d64d845..d5146c57e5b3 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -717,7 +717,7 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave);
717 * This routine only knows how to look for drive units 0 and 1 717 * This routine only knows how to look for drive units 0 and 1
718 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. 718 * on an interface, so any setting of MAX_DRIVES > 2 won't work here.
719 */ 719 */
720static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 720static void probe_hwif(ide_hwif_t *hwif)
721{ 721{
722 unsigned long flags; 722 unsigned long flags;
723 unsigned int irqd; 723 unsigned int irqd;
@@ -819,8 +819,8 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
819 return; 819 return;
820 } 820 }
821 821
822 if (fixup) 822 if (hwif->fixup)
823 fixup(hwif); 823 hwif->fixup(hwif);
824 824
825 for (unit = 0; unit < MAX_DRIVES; ++unit) { 825 for (unit = 0; unit < MAX_DRIVES; ++unit) {
826 ide_drive_t *drive = &hwif->drives[unit]; 826 ide_drive_t *drive = &hwif->drives[unit];
@@ -859,10 +859,11 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
859} 859}
860 860
861static int hwif_init(ide_hwif_t *hwif); 861static int hwif_init(ide_hwif_t *hwif);
862static void hwif_register_devices(ide_hwif_t *hwif);
862 863
863int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 864static int probe_hwif_init(ide_hwif_t *hwif)
864{ 865{
865 probe_hwif(hwif, fixup); 866 probe_hwif(hwif);
866 867
867 if (!hwif_init(hwif)) { 868 if (!hwif_init(hwif)) {
868 printk(KERN_INFO "%s: failed to initialize IDE interface\n", 869 printk(KERN_INFO "%s: failed to initialize IDE interface\n",
@@ -870,34 +871,12 @@ int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)
870 return -1; 871 return -1;
871 } 872 }
872 873
873 if (hwif->present) { 874 if (hwif->present)
874 u16 unit = 0; 875 hwif_register_devices(hwif);
875 int ret;
876 876
877 for (unit = 0; unit < MAX_DRIVES; ++unit) {
878 ide_drive_t *drive = &hwif->drives[unit];
879 /* For now don't attach absent drives, we may
880 want them on default or a new "empty" class
881 for hotplug reprobing ? */
882 if (drive->present) {
883 ret = device_register(&drive->gendev);
884 if (ret < 0)
885 printk(KERN_WARNING "IDE: %s: "
886 "device_register error: %d\n",
887 __FUNCTION__, ret);
888 }
889 }
890 }
891 return 0; 877 return 0;
892} 878}
893 879
894int probe_hwif_init(ide_hwif_t *hwif)
895{
896 return probe_hwif_init_with_fixup(hwif, NULL);
897}
898
899EXPORT_SYMBOL(probe_hwif_init);
900
901#if MAX_HWIFS > 1 880#if MAX_HWIFS > 1
902/* 881/*
903 * save_match() is used to simplify logic in init_irq() below. 882 * save_match() is used to simplify logic in init_irq() below.
@@ -951,7 +930,8 @@ static int ide_init_queue(ide_drive_t *drive)
951 blk_queue_segment_boundary(q, 0xffff); 930 blk_queue_segment_boundary(q, 0xffff);
952 931
953 if (!hwif->rqsize) { 932 if (!hwif->rqsize) {
954 if (hwif->no_lba48 || hwif->no_lba48_dma) 933 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) ||
934 (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA))
955 hwif->rqsize = 256; 935 hwif->rqsize = 256;
956 else 936 else
957 hwif->rqsize = 65536; 937 hwif->rqsize = 65536;
@@ -1378,6 +1358,24 @@ out:
1378 return 0; 1358 return 0;
1379} 1359}
1380 1360
1361static void hwif_register_devices(ide_hwif_t *hwif)
1362{
1363 unsigned int i;
1364
1365 for (i = 0; i < MAX_DRIVES; i++) {
1366 ide_drive_t *drive = &hwif->drives[i];
1367
1368 if (drive->present) {
1369 int ret = device_register(&drive->gendev);
1370
1371 if (ret < 0)
1372 printk(KERN_WARNING "IDE: %s: "
1373 "device_register error: %d\n",
1374 __FUNCTION__, ret);
1375 }
1376 }
1377}
1378
1381int ideprobe_init (void) 1379int ideprobe_init (void)
1382{ 1380{
1383 unsigned int index; 1381 unsigned int index;
@@ -1389,27 +1387,18 @@ int ideprobe_init (void)
1389 1387
1390 for (index = 0; index < MAX_HWIFS; ++index) 1388 for (index = 0; index < MAX_HWIFS; ++index)
1391 if (probe[index]) 1389 if (probe[index])
1392 probe_hwif(&ide_hwifs[index], NULL); 1390 probe_hwif(&ide_hwifs[index]);
1393 for (index = 0; index < MAX_HWIFS; ++index) 1391 for (index = 0; index < MAX_HWIFS; ++index)
1394 if (probe[index]) 1392 if (probe[index])
1395 hwif_init(&ide_hwifs[index]); 1393 hwif_init(&ide_hwifs[index]);
1396 for (index = 0; index < MAX_HWIFS; ++index) { 1394 for (index = 0; index < MAX_HWIFS; ++index) {
1397 if (probe[index]) { 1395 if (probe[index]) {
1398 ide_hwif_t *hwif = &ide_hwifs[index]; 1396 ide_hwif_t *hwif = &ide_hwifs[index];
1399 int unit;
1400 if (!hwif->present) 1397 if (!hwif->present)
1401 continue; 1398 continue;
1402 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced) 1399 if (hwif->chipset == ide_unknown || hwif->chipset == ide_forced)
1403 hwif->chipset = ide_generic; 1400 hwif->chipset = ide_generic;
1404 for (unit = 0; unit < MAX_DRIVES; ++unit) 1401 hwif_register_devices(hwif);
1405 if (hwif->drives[unit].present) {
1406 int ret = device_register(
1407 &hwif->drives[unit].gendev);
1408 if (ret < 0)
1409 printk(KERN_WARNING "IDE: %s: "
1410 "device_register error: %d\n",
1411 __FUNCTION__, ret);
1412 }
1413 } 1402 }
1414 } 1403 }
1415 for (index = 0; index < MAX_HWIFS; ++index) 1404 for (index = 0; index < MAX_HWIFS; ++index)
@@ -1419,3 +1408,22 @@ int ideprobe_init (void)
1419} 1408}
1420 1409
1421EXPORT_SYMBOL_GPL(ideprobe_init); 1410EXPORT_SYMBOL_GPL(ideprobe_init);
1411
1412int ide_device_add(u8 idx[4])
1413{
1414 int i, rc = 0;
1415
1416 for (i = 0; i < 4; i++) {
1417 if (idx[i] != 0xff)
1418 rc |= probe_hwif_init(&ide_hwifs[idx[i]]);
1419 }
1420
1421 for (i = 0; i < 4; i++) {
1422 if (idx[i] != 0xff)
1423 ide_proc_register_port(&ide_hwifs[idx[i]]);
1424 }
1425
1426 return rc;
1427}
1428
1429EXPORT_SYMBOL_GPL(ide_device_add);
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index fc1d8ae6a803..a4007d30da52 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -804,8 +804,6 @@ void ide_proc_register_port(ide_hwif_t *hwif)
804 create_proc_ide_drives(hwif); 804 create_proc_ide_drives(hwif);
805} 805}
806 806
807EXPORT_SYMBOL_GPL(ide_proc_register_port);
808
809#ifdef CONFIG_BLK_DEV_IDEPCI 807#ifdef CONFIG_BLK_DEV_IDEPCI
810void ide_pci_create_host_proc(const char *name, get_info_t *get_info) 808void ide_pci_create_host_proc(const char *name, get_info_t *get_info)
811{ 809{
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 1fa57947bca0..7b9181b5469d 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -565,7 +565,7 @@ typedef struct os_dat_s {
565 * The following parameter is used to select the point in the internal 565 * The following parameter is used to select the point in the internal
566 * tape fifo in which we will start to refill the buffer. Decreasing 566 * tape fifo in which we will start to refill the buffer. Decreasing
567 * the following parameter will improve the system's latency and 567 * the following parameter will improve the system's latency and
568 * interactive response, while using a high value might improve sytem 568 * interactive response, while using a high value might improve system
569 * throughput. 569 * throughput.
570 */ 570 */
571#define IDETAPE_FIFO_THRESHOLD 2 571#define IDETAPE_FIFO_THRESHOLD 2
@@ -621,7 +621,6 @@ typedef struct os_dat_s {
621 */ 621 */
622#define USE_IOTRACE 0 622#define USE_IOTRACE 0
623#if USE_IOTRACE 623#if USE_IOTRACE
624#include <linux/io_trace.h>
625#define IO_IDETAPE_FIFO 500 624#define IO_IDETAPE_FIFO 500
626#endif 625#endif
627 626
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 2a3c8d498343..73ef6bf5fbcc 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -8,23 +8,6 @@
8 * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz 8 * Copyright (C) 2003-2004 Bartlomiej Zolnierkiewicz
9 * 9 *
10 * The big the bad and the ugly. 10 * The big the bad and the ugly.
11 *
12 * Problems to be fixed because of BH interface or the lack therefore.
13 *
14 * Fill me in stupid !!!
15 *
16 * HOST:
17 * General refers to the Controller and Driver "pair".
18 * DATA HANDLER:
19 * Under the context of Linux it generally refers to an interrupt handler.
20 * However, it correctly describes the 'HOST'
21 * DATA BLOCK:
22 * The amount of data needed to be transfered as predefined in the
23 * setup of the device.
24 * STORAGE ATOMIC:
25 * The 'DATA BLOCK' associated to the 'DATA HANDLER', and can be as
26 * small as a single sector or as large as the entire command block
27 * request.
28 */ 11 */
29 12
30#include <linux/module.h> 13#include <linux/module.h>
@@ -695,9 +678,6 @@ int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors,
695 return ide_do_drive_cmd(drive, &rq, ide_wait); 678 return ide_do_drive_cmd(drive, &rq, ide_wait);
696} 679}
697 680
698/*
699 * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
700 */
701int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 681int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
702{ 682{
703 int err = 0; 683 int err = 0;
@@ -761,9 +741,6 @@ static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf)
761 return ide_do_drive_cmd(drive, &rq, ide_wait); 741 return ide_do_drive_cmd(drive, &rq, ide_wait);
762} 742}
763 743
764/*
765 * FIXME : this needs to map into at taskfile. <andre@linux-ide.org>
766 */
767int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) 744int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
768{ 745{
769 void __user *p = (void __user *)arg; 746 void __user *p = (void __user *)arg;
@@ -860,9 +837,14 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
860 case TASKFILE_OUT_DMA: 837 case TASKFILE_OUT_DMA:
861 case TASKFILE_IN_DMAQ: 838 case TASKFILE_IN_DMAQ:
862 case TASKFILE_IN_DMA: 839 case TASKFILE_IN_DMA:
863 hwif->dma_setup(drive); 840 if (!drive->using_dma)
864 hwif->dma_exec_cmd(drive, taskfile->command); 841 break;
865 hwif->dma_start(drive); 842
843 if (!hwif->dma_setup(drive)) {
844 hwif->dma_exec_cmd(drive, taskfile->command);
845 hwif->dma_start(drive);
846 return ide_started;
847 }
866 break; 848 break;
867 849
868 default: 850 default:
@@ -876,7 +858,8 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
876 return task->prehandler(drive, task->rq); 858 return task->prehandler(drive, task->rq);
877 } 859 }
878 ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); 860 ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL);
861 return ide_started;
879 } 862 }
880 863
881 return ide_started; 864 return ide_stopped;
882} 865}
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 5b090662683e..674a65c1a130 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -134,8 +134,6 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)
134 134
135 hwif->bus_state = BUSSTATE_ON; 135 hwif->bus_state = BUSSTATE_ON;
136 136
137 hwif->atapi_dma = 0; /* disable all atapi dma */
138
139 init_completion(&hwif->gendev_rel_comp); 137 init_completion(&hwif->gendev_rel_comp);
140 138
141 default_hwif_iops(hwif); 139 default_hwif_iops(hwif);
@@ -170,7 +168,6 @@ static void init_hwif_default(ide_hwif_t *hwif, unsigned int index)
170 168
171 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq); 169 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, &hwif->irq);
172 170
173 memcpy(&hwif->hw, &hw, sizeof(hw));
174 memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports)); 171 memcpy(hwif->io_ports, hw.io_ports, sizeof(hw.io_ports));
175 172
176 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 173 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
@@ -216,7 +213,7 @@ static void __init init_ide_data (void)
216 init_hwif_data(hwif, index); 213 init_hwif_data(hwif, index);
217 init_hwif_default(hwif, index); 214 init_hwif_default(hwif, index);
218#if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI) 215#if !defined(CONFIG_PPC32) || !defined(CONFIG_PCI)
219 hwif->irq = hwif->hw.irq = 216 hwif->irq =
220 ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); 217 ide_init_default_irq(hwif->io_ports[IDE_DATA_OFFSET]);
221#endif 218#endif
222 } 219 }
@@ -267,6 +264,30 @@ static int ide_system_bus_speed(void)
267 return system_bus_speed; 264 return system_bus_speed;
268} 265}
269 266
267ide_hwif_t * ide_find_port(unsigned long base)
268{
269 ide_hwif_t *hwif;
270 int i;
271
272 for (i = 0; i < MAX_HWIFS; i++) {
273 hwif = &ide_hwifs[i];
274 if (hwif->io_ports[IDE_DATA_OFFSET] == base)
275 goto found;
276 }
277
278 for (i = 0; i < MAX_HWIFS; i++) {
279 hwif = &ide_hwifs[i];
280 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
281 goto found;
282 }
283
284 hwif = NULL;
285found:
286 return hwif;
287}
288
289EXPORT_SYMBOL_GPL(ide_find_port);
290
270static struct resource* hwif_request_region(ide_hwif_t *hwif, 291static struct resource* hwif_request_region(ide_hwif_t *hwif,
271 unsigned long addr, int num) 292 unsigned long addr, int num)
272{ 293{
@@ -379,7 +400,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
379 400
380 hwif->pio_mask = tmp_hwif->pio_mask; 401 hwif->pio_mask = tmp_hwif->pio_mask;
381 402
382 hwif->atapi_dma = tmp_hwif->atapi_dma;
383 hwif->ultra_mask = tmp_hwif->ultra_mask; 403 hwif->ultra_mask = tmp_hwif->ultra_mask;
384 hwif->mwdma_mask = tmp_hwif->mwdma_mask; 404 hwif->mwdma_mask = tmp_hwif->mwdma_mask;
385 hwif->swdma_mask = tmp_hwif->swdma_mask; 405 hwif->swdma_mask = tmp_hwif->swdma_mask;
@@ -394,6 +414,8 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
394 hwif->cds = tmp_hwif->cds; 414 hwif->cds = tmp_hwif->cds;
395#endif 415#endif
396 416
417 hwif->fixup = tmp_hwif->fixup;
418
397 hwif->set_pio_mode = tmp_hwif->set_pio_mode; 419 hwif->set_pio_mode = tmp_hwif->set_pio_mode;
398 hwif->set_dma_mode = tmp_hwif->set_dma_mode; 420 hwif->set_dma_mode = tmp_hwif->set_dma_mode;
399 hwif->mdma_filter = tmp_hwif->mdma_filter; 421 hwif->mdma_filter = tmp_hwif->mdma_filter;
@@ -440,7 +462,6 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
440 462
441 hwif->mmio = tmp_hwif->mmio; 463 hwif->mmio = tmp_hwif->mmio;
442 hwif->rqsize = tmp_hwif->rqsize; 464 hwif->rqsize = tmp_hwif->rqsize;
443 hwif->no_lba48 = tmp_hwif->no_lba48;
444 465
445#ifndef CONFIG_BLK_DEV_IDECS 466#ifndef CONFIG_BLK_DEV_IDECS
446 hwif->irq = tmp_hwif->irq; 467 hwif->irq = tmp_hwif->irq;
@@ -656,7 +677,6 @@ void ide_setup_ports ( hw_regs_t *hw,
656 } 677 }
657 } 678 }
658 hw->irq = irq; 679 hw->irq = irq;
659 hw->dma = NO_DMA;
660 hw->ack_intr = ack_intr; 680 hw->ack_intr = ack_intr;
661/* 681/*
662 * hw->iops = iops; 682 * hw->iops = iops;
@@ -664,11 +684,11 @@ void ide_setup_ports ( hw_regs_t *hw,
664} 684}
665 685
666/** 686/**
667 * ide_register_hw_with_fixup - register IDE interface 687 * ide_register_hw - register IDE interface
668 * @hw: hardware registers 688 * @hw: hardware registers
689 * @fixup: fixup function
669 * @initializing: set while initializing built-in drivers 690 * @initializing: set while initializing built-in drivers
670 * @hwifp: pointer to returned hwif 691 * @hwifp: pointer to returned hwif
671 * @fixup: fixup function
672 * 692 *
673 * Register an IDE interface, specifying exactly the registers etc. 693 * Register an IDE interface, specifying exactly the registers etc.
674 * Set init=1 iff calling before probes have taken place. 694 * Set init=1 iff calling before probes have taken place.
@@ -676,9 +696,8 @@ void ide_setup_ports ( hw_regs_t *hw,
676 * Returns -1 on error. 696 * Returns -1 on error.
677 */ 697 */
678 698
679int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing, 699int ide_register_hw(hw_regs_t *hw, void (*fixup)(ide_hwif_t *),
680 ide_hwif_t **hwifp, 700 int initializing, ide_hwif_t **hwifp)
681 void(*fixup)(ide_hwif_t *hwif))
682{ 701{
683 int index, retry = 1; 702 int index, retry = 1;
684 ide_hwif_t *hwif; 703 ide_hwif_t *hwif;
@@ -686,7 +705,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
686 do { 705 do {
687 for (index = 0; index < MAX_HWIFS; ++index) { 706 for (index = 0; index < MAX_HWIFS; ++index) {
688 hwif = &ide_hwifs[index]; 707 hwif = &ide_hwifs[index];
689 if (hwif->hw.io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET]) 708 if (hwif->io_ports[IDE_DATA_OFFSET] == hw->io_ports[IDE_DATA_OFFSET])
690 goto found; 709 goto found;
691 } 710 }
692 for (index = 0; index < MAX_HWIFS; ++index) { 711 for (index = 0; index < MAX_HWIFS; ++index) {
@@ -694,7 +713,7 @@ int ide_register_hw_with_fixup(hw_regs_t *hw, int initializing,
694 if (hwif->hold) 713 if (hwif->hold)
695 continue; 714 continue;
696 if ((!hwif->present && !hwif->mate && !initializing) || 715 if ((!hwif->present && !hwif->mate && !initializing) ||
697 (!hwif->hw.io_ports[IDE_DATA_OFFSET] && initializing)) 716 (!hwif->io_ports[IDE_DATA_OFFSET] && initializing))
698 goto found; 717 goto found;
699 } 718 }
700 for (index = 0; index < MAX_HWIFS; index++) 719 for (index = 0; index < MAX_HWIFS; index++)
@@ -710,16 +729,18 @@ found:
710 } 729 }
711 if (hwif->present) 730 if (hwif->present)
712 return -1; 731 return -1;
713 memcpy(&hwif->hw, hw, sizeof(*hw)); 732 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports));
714 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
715 hwif->irq = hw->irq; 733 hwif->irq = hw->irq;
716 hwif->noprobe = 0; 734 hwif->noprobe = 0;
735 hwif->fixup = fixup;
717 hwif->chipset = hw->chipset; 736 hwif->chipset = hw->chipset;
718 hwif->gendev.parent = hw->dev; 737 hwif->gendev.parent = hw->dev;
738 hwif->ack_intr = hw->ack_intr;
739
740 if (initializing == 0) {
741 u8 idx[4] = { index, 0xff, 0xff, 0xff };
719 742
720 if (!initializing) { 743 ide_device_add(idx);
721 probe_hwif_init_with_fixup(hwif, fixup);
722 ide_proc_register_port(hwif);
723 } 744 }
724 745
725 if (hwifp) 746 if (hwifp)
@@ -728,13 +749,6 @@ found:
728 return (initializing || hwif->present) ? index : -1; 749 return (initializing || hwif->present) ? index : -1;
729} 750}
730 751
731EXPORT_SYMBOL(ide_register_hw_with_fixup);
732
733int ide_register_hw(hw_regs_t *hw, int initializing, ide_hwif_t **hwifp)
734{
735 return ide_register_hw_with_fixup(hw, initializing, hwifp, NULL);
736}
737
738EXPORT_SYMBOL(ide_register_hw); 752EXPORT_SYMBOL(ide_register_hw);
739 753
740/* 754/*
@@ -1050,7 +1064,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
1050 ide_init_hwif_ports(&hw, (unsigned long) args[0], 1064 ide_init_hwif_ports(&hw, (unsigned long) args[0],
1051 (unsigned long) args[1], NULL); 1065 (unsigned long) args[1], NULL);
1052 hw.irq = args[2]; 1066 hw.irq = args[2];
1053 if (ide_register_hw(&hw, 0, NULL) == -1) 1067 if (ide_register_hw(&hw, NULL, 0, NULL) == -1)
1054 return -EIO; 1068 return -EIO;
1055 return 0; 1069 return 0;
1056 } 1070 }
@@ -1401,6 +1415,9 @@ static int __init ide_setup(char *s)
1401 "reset", "minus6", "ata66", "minus8", "minus9", 1415 "reset", "minus6", "ata66", "minus8", "minus9",
1402 "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb", 1416 "minus10", "four", "qd65xx", "ht6560b", "cmd640_vlb",
1403 "dtc2278", "umc8672", "ali14xx", NULL }; 1417 "dtc2278", "umc8672", "ali14xx", NULL };
1418
1419 hw_regs_t hwregs;
1420
1404 hw = s[3] - '0'; 1421 hw = s[3] - '0';
1405 hwif = &ide_hwifs[hw]; 1422 hwif = &ide_hwifs[hw];
1406 i = match_parm(&s[4], ide_words, vals, 3); 1423 i = match_parm(&s[4], ide_words, vals, 3);
@@ -1510,9 +1527,9 @@ static int __init ide_setup(char *s)
1510 case 2: /* base,ctl */ 1527 case 2: /* base,ctl */
1511 vals[2] = 0; /* default irq = probe for it */ 1528 vals[2] = 0; /* default irq = probe for it */
1512 case 3: /* base,ctl,irq */ 1529 case 3: /* base,ctl,irq */
1513 hwif->hw.irq = vals[2]; 1530 memset(&hwregs, 0, sizeof(hwregs));
1514 ide_init_hwif_ports(&hwif->hw, (unsigned long) vals[0], (unsigned long) vals[1], &hwif->irq); 1531 ide_init_hwif_ports(&hwregs, vals[0], vals[1], &hwif->irq);
1515 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 1532 memcpy(hwif->io_ports, hwregs.io_ports, sizeof(hwif->io_ports));
1516 hwif->irq = vals[2]; 1533 hwif->irq = vals[2];
1517 hwif->noprobe = 0; 1534 hwif->noprobe = 0;
1518 hwif->chipset = ide_forced; 1535 hwif->chipset = ide_forced;
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c
index 2f0ef9b44033..10311ecc674a 100644
--- a/drivers/ide/legacy/ali14xx.c
+++ b/drivers/ide/legacy/ali14xx.c
@@ -102,6 +102,8 @@ static void outReg (u8 data, u8 reg)
102 outb_p(data, dataPort); 102 outb_p(data, dataPort);
103} 103}
104 104
105static DEFINE_SPINLOCK(ali14xx_lock);
106
105/* 107/*
106 * Set PIO mode for the specified drive. 108 * Set PIO mode for the specified drive.
107 * This function computes timing parameters 109 * This function computes timing parameters
@@ -129,14 +131,14 @@ static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
129 131
130 /* stuff timing parameters into controller registers */ 132 /* stuff timing parameters into controller registers */
131 driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit; 133 driveNum = (HWIF(drive)->index << 1) + drive->select.b.unit;
132 spin_lock_irqsave(&ide_lock, flags); 134 spin_lock_irqsave(&ali14xx_lock, flags);
133 outb_p(regOn, basePort); 135 outb_p(regOn, basePort);
134 outReg(param1, regTab[driveNum].reg1); 136 outReg(param1, regTab[driveNum].reg1);
135 outReg(param2, regTab[driveNum].reg2); 137 outReg(param2, regTab[driveNum].reg2);
136 outReg(param3, regTab[driveNum].reg3); 138 outReg(param3, regTab[driveNum].reg3);
137 outReg(param4, regTab[driveNum].reg4); 139 outReg(param4, regTab[driveNum].reg4);
138 outb_p(regOff, basePort); 140 outb_p(regOff, basePort);
139 spin_unlock_irqrestore(&ide_lock, flags); 141 spin_unlock_irqrestore(&ali14xx_lock, flags);
140} 142}
141 143
142/* 144/*
@@ -193,6 +195,7 @@ static int __init initRegisters (void) {
193static int __init ali14xx_probe(void) 195static int __init ali14xx_probe(void)
194{ 196{
195 ide_hwif_t *hwif, *mate; 197 ide_hwif_t *hwif, *mate;
198 static u8 idx[4] = { 0, 1, 0xff, 0xff };
196 199
197 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n", 200 printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n",
198 basePort, regOn); 201 basePort, regOn);
@@ -217,11 +220,7 @@ static int __init ali14xx_probe(void)
217 mate->mate = hwif; 220 mate->mate = hwif;
218 mate->channel = 1; 221 mate->channel = 1;
219 222
220 probe_hwif_init(hwif); 223 ide_device_add(idx);
221 probe_hwif_init(mate);
222
223 ide_proc_register_port(hwif);
224 ide_proc_register_port(mate);
225 224
226 return 0; 225 return 0;
227} 226}
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index 101aee1711c4..4a0be251a05f 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -212,8 +212,8 @@ fail_base2:
212// xsurf_iops, 212// xsurf_iops,
213 IRQ_AMIGA_PORTS); 213 IRQ_AMIGA_PORTS);
214 } 214 }
215 215
216 index = ide_register_hw(&hw, 1, &hwif); 216 index = ide_register_hw(&hw, NULL, 1, &hwif);
217 if (index != -1) { 217 if (index != -1) {
218 hwif->mmio = 1; 218 hwif->mmio = 1;
219 printk("ide%d: ", index); 219 printk("ide%d: ", index);
diff --git a/drivers/ide/legacy/dtc2278.c b/drivers/ide/legacy/dtc2278.c
index f16521254867..24a845d45bd2 100644
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -67,20 +67,24 @@ static void sub22 (char b, char c)
67 } 67 }
68} 68}
69 69
70static DEFINE_SPINLOCK(dtc2278_lock);
71
70static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio) 72static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio)
71{ 73{
72 unsigned long flags; 74 unsigned long flags;
73 75
74 if (pio >= 3) { 76 if (pio >= 3) {
75 spin_lock_irqsave(&ide_lock, flags); 77 spin_lock_irqsave(&dtc2278_lock, flags);
76 /* 78 /*
77 * This enables PIO mode4 (3?) on the first interface 79 * This enables PIO mode4 (3?) on the first interface
78 */ 80 */
79 sub22(1,0xc3); 81 sub22(1,0xc3);
80 sub22(0,0xa0); 82 sub22(0,0xa0);
81 spin_unlock_irqrestore(&ide_lock, flags); 83 spin_unlock_irqrestore(&dtc2278_lock, flags);
82 } else { 84 } else {
83 /* we don't know how to set it back again.. */ 85 /* we don't know how to set it back again.. */
86 /* Actually we do - there is a data sheet available for the
87 Winbond but does anyone actually care */
84 } 88 }
85 89
86 /* 90 /*
@@ -94,6 +98,7 @@ static int __init dtc2278_probe(void)
94{ 98{
95 unsigned long flags; 99 unsigned long flags;
96 ide_hwif_t *hwif, *mate; 100 ide_hwif_t *hwif, *mate;
101 static u8 idx[4] = { 0, 1, 0xff, 0xff };
97 102
98 hwif = &ide_hwifs[0]; 103 hwif = &ide_hwifs[0];
99 mate = &ide_hwifs[1]; 104 mate = &ide_hwifs[1];
@@ -129,16 +134,13 @@ static int __init dtc2278_probe(void)
129 134
130 mate->serialized = 1; 135 mate->serialized = 1;
131 mate->chipset = ide_dtc2278; 136 mate->chipset = ide_dtc2278;
137 mate->pio_mask = ATA_PIO4;
132 mate->drives[0].no_unmask = 1; 138 mate->drives[0].no_unmask = 1;
133 mate->drives[1].no_unmask = 1; 139 mate->drives[1].no_unmask = 1;
134 mate->mate = hwif; 140 mate->mate = hwif;
135 mate->channel = 1; 141 mate->channel = 1;
136 142
137 probe_hwif_init(hwif); 143 ide_device_add(idx);
138 probe_hwif_init(mate);
139
140 ide_proc_register_port(hwif);
141 ide_proc_register_port(mate);
142 144
143 return 0; 145 return 0;
144} 146}
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index f0829b83e970..7d7936f1b900 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -72,7 +72,7 @@ void __init falconide_init(void)
72 0, 0, NULL, 72 0, 0, NULL,
73// falconide_iops, 73// falconide_iops,
74 IRQ_MFP_IDE); 74 IRQ_MFP_IDE);
75 index = ide_register_hw(&hw, 1, NULL); 75 index = ide_register_hw(&hw, NULL, 1, NULL);
76 76
77 if (index != -1) 77 if (index != -1)
78 printk("ide%d: Falcon IDE interface\n", index); 78 printk("ide%d: Falcon IDE interface\n", index);
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index 0830a021bbb6..53331ee1e957 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -165,7 +165,7 @@ found:
165// &gayle_iops, 165// &gayle_iops,
166 IRQ_AMIGA_PORTS); 166 IRQ_AMIGA_PORTS);
167 167
168 index = ide_register_hw(&hw, 1, &hwif); 168 index = ide_register_hw(&hw, NULL, 1, &hwif);
169 if (index != -1) { 169 if (index != -1) {
170 hwif->mmio = 1; 170 hwif->mmio = 1;
171 switch (i) { 171 switch (i) {
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 2e5a9cc5c0f7..a4245d13f11b 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -247,6 +247,8 @@ static u8 ht_pio2timings(ide_drive_t *drive, const u8 pio)
247 } 247 }
248} 248}
249 249
250static DEFINE_SPINLOCK(ht6560b_lock);
251
250/* 252/*
251 * Enable/Disable so called prefetch mode 253 * Enable/Disable so called prefetch mode
252 */ 254 */
@@ -254,9 +256,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
254{ 256{
255 unsigned long flags; 257 unsigned long flags;
256 int t = HT_PREFETCH_MODE << 8; 258 int t = HT_PREFETCH_MODE << 8;
257 259
258 spin_lock_irqsave(&ide_lock, flags); 260 spin_lock_irqsave(&ht6560b_lock, flags);
259 261
260 /* 262 /*
261 * Prefetch mode and unmask irq seems to conflict 263 * Prefetch mode and unmask irq seems to conflict
262 */ 264 */
@@ -268,9 +270,9 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
268 drive->drive_data &= ~t; /* disable prefetch mode */ 270 drive->drive_data &= ~t; /* disable prefetch mode */
269 drive->no_unmask = 0; 271 drive->no_unmask = 0;
270 } 272 }
271 273
272 spin_unlock_irqrestore(&ide_lock, flags); 274 spin_unlock_irqrestore(&ht6560b_lock, flags);
273 275
274#ifdef DEBUG 276#ifdef DEBUG
275 printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis")); 277 printk("ht6560b: drive %s prefetch mode %sabled\n", drive->name, (state ? "en" : "dis"));
276#endif 278#endif
@@ -287,16 +289,14 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio)
287 ht_set_prefetch(drive, pio & 1); 289 ht_set_prefetch(drive, pio & 1);
288 return; 290 return;
289 } 291 }
290 292
291 timing = ht_pio2timings(drive, pio); 293 timing = ht_pio2timings(drive, pio);
292 294
293 spin_lock_irqsave(&ide_lock, flags); 295 spin_lock_irqsave(&ht6560b_lock, flags);
294
295 drive->drive_data &= 0xff00; 296 drive->drive_data &= 0xff00;
296 drive->drive_data |= timing; 297 drive->drive_data |= timing;
297 298 spin_unlock_irqrestore(&ht6560b_lock, flags);
298 spin_unlock_irqrestore(&ide_lock, flags); 299
299
300#ifdef DEBUG 300#ifdef DEBUG
301 printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing); 301 printk("ht6560b: drive %s tuned to pio mode %#x timing=%#x\n", drive->name, pio, timing);
302#endif 302#endif
@@ -311,6 +311,7 @@ MODULE_PARM_DESC(probe, "probe for HT6560B chipset");
311int __init ht6560b_init(void) 311int __init ht6560b_init(void)
312{ 312{
313 ide_hwif_t *hwif, *mate; 313 ide_hwif_t *hwif, *mate;
314 static u8 idx[4] = { 0, 1, 0xff, 0xff };
314 int t; 315 int t;
315 316
316 if (probe_ht6560b == 0) 317 if (probe_ht6560b == 0)
@@ -359,11 +360,7 @@ int __init ht6560b_init(void)
359 mate->drives[0].drive_data = t; 360 mate->drives[0].drive_data = t;
360 mate->drives[1].drive_data = t; 361 mate->drives[1].drive_data = t;
361 362
362 probe_hwif_init(hwif); 363 ide_device_add(idx);
363 probe_hwif_init(mate);
364
365 ide_proc_register_port(hwif);
366 ide_proc_register_port(mate);
367 364
368 return 0; 365 return 0;
369 366
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index e8e360c2619d..03715c058664 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -153,7 +153,7 @@ static int idecs_register(unsigned long io, unsigned long ctl, unsigned long irq
153 hw.irq = irq; 153 hw.irq = irq;
154 hw.chipset = ide_pci; 154 hw.chipset = ide_pci;
155 hw.dev = &handle->dev; 155 hw.dev = &handle->dev;
156 return ide_register_hw_with_fixup(&hw, 0, NULL, ide_undecoded_slave); 156 return ide_register_hw(&hw, &ide_undecoded_slave, 0, NULL);
157} 157}
158 158
159/*====================================================================== 159/*======================================================================
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index b992b2b91fe2..7bb79f53dac8 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -33,39 +33,24 @@ static ide_hwif_t *__devinit plat_ide_locate_hwif(void __iomem *base,
33 int mmio) 33 int mmio)
34{ 34{
35 unsigned long port = (unsigned long)base; 35 unsigned long port = (unsigned long)base;
36 ide_hwif_t *hwif; 36 ide_hwif_t *hwif = ide_find_port(port);
37 int index, i; 37 int i;
38
39 for (index = 0; index < MAX_HWIFS; ++index) {
40 hwif = ide_hwifs + index;
41 if (hwif->io_ports[IDE_DATA_OFFSET] == port)
42 goto found;
43 }
44
45 for (index = 0; index < MAX_HWIFS; ++index) {
46 hwif = ide_hwifs + index;
47 if (hwif->io_ports[IDE_DATA_OFFSET] == 0)
48 goto found;
49 }
50 38
51 return NULL; 39 if (hwif == NULL)
52 40 goto out;
53found:
54 41
55 hwif->hw.io_ports[IDE_DATA_OFFSET] = port; 42 hwif->io_ports[IDE_DATA_OFFSET] = port;
56 43
57 port += (1 << pdata->ioport_shift); 44 port += (1 << pdata->ioport_shift);
58 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; 45 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET;
59 i++, port += (1 << pdata->ioport_shift)) 46 i++, port += (1 << pdata->ioport_shift))
60 hwif->hw.io_ports[i] = port; 47 hwif->io_ports[i] = port;
61 48
62 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; 49 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
63 50
64 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports)); 51 hwif->irq = irq;
65 hwif->hw.irq = hwif->irq = irq;
66 52
67 hwif->hw.dma = NO_DMA; 53 hwif->chipset = ide_generic;
68 hwif->chipset = hwif->hw.chipset = ide_generic;
69 54
70 if (mmio) { 55 if (mmio) {
71 hwif->mmio = 1; 56 hwif->mmio = 1;
@@ -73,8 +58,8 @@ found:
73 } 58 }
74 59
75 hwif_prop.hwif = hwif; 60 hwif_prop.hwif = hwif;
76 hwif_prop.index = index; 61 hwif_prop.index = hwif->index;
77 62out:
78 return hwif; 63 return hwif;
79} 64}
80 65
@@ -83,6 +68,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
83 struct resource *res_base, *res_alt, *res_irq; 68 struct resource *res_base, *res_alt, *res_irq;
84 ide_hwif_t *hwif; 69 ide_hwif_t *hwif;
85 struct pata_platform_info *pdata; 70 struct pata_platform_info *pdata;
71 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
86 int ret = 0; 72 int ret = 0;
87 int mmio = 0; 73 int mmio = 0;
88 74
@@ -130,10 +116,11 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
130 hwif->gendev.parent = &pdev->dev; 116 hwif->gendev.parent = &pdev->dev;
131 hwif->noprobe = 0; 117 hwif->noprobe = 0;
132 118
133 probe_hwif_init(hwif); 119 idx[0] = hwif->index;
120
121 ide_device_add(idx);
134 122
135 platform_set_drvdata(pdev, hwif); 123 platform_set_drvdata(pdev, hwif);
136 ide_proc_register_port(hwif);
137 124
138 return 0; 125 return 0;
139 126
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index b557c45a5a9d..e87cd2f16430 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -93,21 +93,21 @@ void macide_init(void)
93 0, 0, macide_ack_intr, 93 0, 0, macide_ack_intr,
94// quadra_ide_iops, 94// quadra_ide_iops,
95 IRQ_NUBUS_F); 95 IRQ_NUBUS_F);
96 index = ide_register_hw(&hw, 1, &hwif); 96 index = ide_register_hw(&hw, NULL, 1, &hwif);
97 break; 97 break;
98 case MAC_IDE_PB: 98 case MAC_IDE_PB:
99 ide_setup_ports(&hw, IDE_BASE, macide_offsets, 99 ide_setup_ports(&hw, IDE_BASE, macide_offsets,
100 0, 0, macide_ack_intr, 100 0, 0, macide_ack_intr,
101// macide_pb_iops, 101// macide_pb_iops,
102 IRQ_NUBUS_C); 102 IRQ_NUBUS_C);
103 index = ide_register_hw(&hw, 1, &hwif); 103 index = ide_register_hw(&hw, NULL, 1, &hwif);
104 break; 104 break;
105 case MAC_IDE_BABOON: 105 case MAC_IDE_BABOON:
106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets, 106 ide_setup_ports(&hw, BABOON_BASE, macide_offsets,
107 0, 0, NULL, 107 0, 0, NULL,
108// macide_baboon_iops, 108// macide_baboon_iops,
109 IRQ_BABOON_1); 109 IRQ_BABOON_1);
110 index = ide_register_hw(&hw, 1, &hwif); 110 index = ide_register_hw(&hw, NULL, 1, &hwif);
111 if (index == -1) break; 111 if (index == -1) break;
112 if (macintosh_config->ident == MAC_MODEL_PB190) { 112 if (macintosh_config->ident == MAC_MODEL_PB190) {
113 113
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index e628a983ce33..a73db1bd482d 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -89,9 +89,8 @@ void q40_ide_setup_ports ( hw_regs_t *hw,
89 else 89 else
90 hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]); 90 hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]);
91 } 91 }
92 92
93 hw->irq = irq; 93 hw->irq = irq;
94 hw->dma = NO_DMA;
95 hw->ack_intr = ack_intr; 94 hw->ack_intr = ack_intr;
96/* 95/*
97 * hw->iops = iops; 96 * hw->iops = iops;
@@ -102,7 +101,7 @@ void q40_ide_setup_ports ( hw_regs_t *hw,
102 101
103/* 102/*
104 * the static array is needed to have the name reported in /proc/ioports, 103 * the static array is needed to have the name reported in /proc/ioports,
105 * hwif->name unfortunately isn´t available yet 104 * hwif->name unfortunately isn't available yet
106 */ 105 */
107static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ 106static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={
108 "ide0", "ide1" 107 "ide0", "ide1"
@@ -142,7 +141,7 @@ void q40ide_init(void)
142 0, NULL, 141 0, NULL,
143// m68kide_iops, 142// m68kide_iops,
144 q40ide_default_irq(pcide_bases[i])); 143 q40ide_default_irq(pcide_bases[i]));
145 index = ide_register_hw(&hw, 1, &hwif); 144 index = ide_register_hw(&hw, NULL, 1, &hwif);
146 // **FIXME** 145 // **FIXME**
147 if (index != -1) 146 if (index != -1)
148 hwif->mmio = 1; 147 hwif->mmio = 1;
diff --git a/drivers/ide/legacy/qd65xx.c b/drivers/ide/legacy/qd65xx.c
index 0c81d2d0b941..912e73853faa 100644
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -89,26 +89,6 @@
89 89
90static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */ 90static int timings[4]={-1,-1,-1,-1}; /* stores current timing for each timer */
91 91
92static void qd_write_reg (u8 content, unsigned long reg)
93{
94 unsigned long flags;
95
96 spin_lock_irqsave(&ide_lock, flags);
97 outb(content,reg);
98 spin_unlock_irqrestore(&ide_lock, flags);
99}
100
101static u8 __init qd_read_reg (unsigned long reg)
102{
103 unsigned long flags;
104 u8 read;
105
106 spin_lock_irqsave(&ide_lock, flags);
107 read = inb(reg);
108 spin_unlock_irqrestore(&ide_lock, flags);
109 return read;
110}
111
112/* 92/*
113 * qd_select: 93 * qd_select:
114 * 94 *
@@ -121,7 +101,7 @@ static void qd_select (ide_drive_t *drive)
121 (QD_TIMREG(drive) & 0x02); 101 (QD_TIMREG(drive) & 0x02);
122 102
123 if (timings[index] != QD_TIMING(drive)) 103 if (timings[index] != QD_TIMING(drive))
124 qd_write_reg(timings[index] = QD_TIMING(drive), QD_TIMREG(drive)); 104 outb(timings[index] = QD_TIMING(drive), QD_TIMREG(drive));
125} 105}
126 106
127/* 107/*
@@ -284,7 +264,7 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
284 } 264 }
285 265
286 if (!HWIF(drive)->channel && drive->media != ide_disk) { 266 if (!HWIF(drive)->channel && drive->media != ide_disk) {
287 qd_write_reg(0x5f, QD_CONTROL_PORT); 267 outb(0x5f, QD_CONTROL_PORT);
288 printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO " 268 printk(KERN_WARNING "%s: ATAPI: disabled read-ahead FIFO "
289 "and post-write buffer on %s.\n", 269 "and post-write buffer on %s.\n",
290 drive->name, HWIF(drive)->name); 270 drive->name, HWIF(drive)->name);
@@ -301,16 +281,15 @@ static void qd6580_set_pio_mode(ide_drive_t *drive, const u8 pio)
301 281
302static int __init qd_testreg(int port) 282static int __init qd_testreg(int port)
303{ 283{
304 u8 savereg;
305 u8 readreg;
306 unsigned long flags; 284 unsigned long flags;
285 u8 savereg, readreg;
307 286
308 spin_lock_irqsave(&ide_lock, flags); 287 local_irq_save(flags);
309 savereg = inb_p(port); 288 savereg = inb_p(port);
310 outb_p(QD_TESTVAL, port); /* safe value */ 289 outb_p(QD_TESTVAL, port); /* safe value */
311 readreg = inb_p(port); 290 readreg = inb_p(port);
312 outb(savereg, port); 291 outb(savereg, port);
313 spin_unlock_irqrestore(&ide_lock, flags); 292 local_irq_restore(flags);
314 293
315 if (savereg == QD_TESTVAL) { 294 if (savereg == QD_TESTVAL) {
316 printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n"); 295 printk(KERN_ERR "Outch ! the probe for qd65xx isn't reliable !\n");
@@ -364,13 +343,13 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
364 343
365 if (set_pio_mode == (void *)qd6500_set_pio_mode) { 344 if (set_pio_mode == (void *)qd6500_set_pio_mode) {
366 // will do it for both 345 // will do it for both
367 qd_write_reg(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 346 outb(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
368 } else if (set_pio_mode == (void *)qd6580_set_pio_mode) { 347 } else if (set_pio_mode == (void *)qd6580_set_pio_mode) {
369 if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { 348 if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) {
370 qd_write_reg(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 349 outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
371 qd_write_reg(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); 350 outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1]));
372 } else { 351 } else {
373 qd_write_reg(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); 352 outb(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0]));
374 } 353 }
375 } else { 354 } else {
376 printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n"); 355 printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n");
@@ -389,10 +368,11 @@ static void __exit qd_unsetup(ide_hwif_t *hwif)
389static int __init qd_probe(int base) 368static int __init qd_probe(int base)
390{ 369{
391 ide_hwif_t *hwif; 370 ide_hwif_t *hwif;
371 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
392 u8 config; 372 u8 config;
393 u8 unit; 373 u8 unit;
394 374
395 config = qd_read_reg(QD_CONFIG_PORT); 375 config = inb(QD_CONFIG_PORT);
396 376
397 if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) ) 377 if (! ((config & QD_CONFIG_BASEPORT) >> 1 == (base == 0xb0)) )
398 return 1; 378 return 1;
@@ -419,9 +399,9 @@ static int __init qd_probe(int base)
419 399
420 hwif->set_pio_mode = &qd6500_set_pio_mode; 400 hwif->set_pio_mode = &qd6500_set_pio_mode;
421 401
422 probe_hwif_init(hwif); 402 idx[0] = unit;
423 403
424 ide_proc_register_port(hwif); 404 ide_device_add(idx);
425 405
426 return 1; 406 return 1;
427 } 407 }
@@ -436,7 +416,7 @@ static int __init qd_probe(int base)
436 416
437 /* qd6580 found */ 417 /* qd6580 found */
438 418
439 control = qd_read_reg(QD_CONTROL_PORT); 419 control = inb(QD_CONTROL_PORT);
440 420
441 printk(KERN_NOTICE "qd6580 at %#x\n", base); 421 printk(KERN_NOTICE "qd6580 at %#x\n", base);
442 printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n", 422 printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n",
@@ -453,11 +433,11 @@ static int __init qd_probe(int base)
453 433
454 hwif->set_pio_mode = &qd6580_set_pio_mode; 434 hwif->set_pio_mode = &qd6580_set_pio_mode;
455 435
456 probe_hwif_init(hwif); 436 idx[0] = unit;
457 437
458 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 438 ide_device_add(idx);
459 439
460 ide_proc_register_port(hwif); 440 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
461 441
462 return 1; 442 return 1;
463 } else { 443 } else {
@@ -474,19 +454,17 @@ static int __init qd_probe(int base)
474 454
475 hwif->set_pio_mode = &qd6580_set_pio_mode; 455 hwif->set_pio_mode = &qd6580_set_pio_mode;
476 456
477 probe_hwif_init(hwif);
478
479 qd_setup(mate, base, config | (control << 8), 457 qd_setup(mate, base, config | (control << 8),
480 QD6580_DEF_DATA2, QD6580_DEF_DATA2); 458 QD6580_DEF_DATA2, QD6580_DEF_DATA2);
481 459
482 mate->set_pio_mode = &qd6580_set_pio_mode; 460 mate->set_pio_mode = &qd6580_set_pio_mode;
483 461
484 probe_hwif_init(mate); 462 idx[0] = 0;
463 idx[1] = 1;
485 464
486 qd_write_reg(QD_DEF_CONTR,QD_CONTROL_PORT); 465 ide_device_add(idx);
487 466
488 ide_proc_register_port(hwif); 467 outb(QD_DEF_CONTR, QD_CONTROL_PORT);
489 ide_proc_register_port(mate);
490 468
491 return 0; /* no other qd65xx possible */ 469 return 0; /* no other qd65xx possible */
492 } 470 }
diff --git a/drivers/ide/legacy/umc8672.c b/drivers/ide/legacy/umc8672.c
index 1151c92dd531..79577b916874 100644
--- a/drivers/ide/legacy/umc8672.c
+++ b/drivers/ide/legacy/umc8672.c
@@ -124,8 +124,9 @@ static void umc_set_pio_mode(ide_drive_t *drive, const u8 pio)
124 124
125static int __init umc8672_probe(void) 125static int __init umc8672_probe(void)
126{ 126{
127 unsigned long flags;
128 ide_hwif_t *hwif, *mate; 127 ide_hwif_t *hwif, *mate;
128 unsigned long flags;
129 static u8 idx[4] = { 0, 1, 0xff, 0xff };
129 130
130 if (!request_region(0x108, 2, "umc8672")) { 131 if (!request_region(0x108, 2, "umc8672")) {
131 printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n"); 132 printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n");
@@ -158,11 +159,7 @@ static int __init umc8672_probe(void)
158 mate->mate = hwif; 159 mate->mate = hwif;
159 mate->channel = 1; 160 mate->channel = 1;
160 161
161 probe_hwif_init(hwif); 162 ide_device_add(idx);
162 probe_hwif_init(mate);
163
164 ide_proc_register_port(hwif);
165 ide_proc_register_port(mate);
166 163
167 return 0; 164 return 0;
168} 165}
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 47c035a550e3..1de58566e5b6 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -601,8 +601,9 @@ static int au_ide_probe(struct device *dev)
601 _auide_hwif *ahwif = &auide_hwif; 601 _auide_hwif *ahwif = &auide_hwif;
602 ide_hwif_t *hwif; 602 ide_hwif_t *hwif;
603 struct resource *res; 603 struct resource *res;
604 hw_regs_t *hw;
605 int ret = 0; 604 int ret = 0;
605 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
606 hw_regs_t hw;
606 607
607#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) 608#if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA)
608 char *mode = "MWDMA2"; 609 char *mode = "MWDMA2";
@@ -644,12 +645,12 @@ static int au_ide_probe(struct device *dev)
644 /* FIXME: This might possibly break PCMCIA IDE devices */ 645 /* FIXME: This might possibly break PCMCIA IDE devices */
645 646
646 hwif = &ide_hwifs[pdev->id]; 647 hwif = &ide_hwifs[pdev->id];
647 hw = &hwif->hw; 648 hwif->irq = ahwif->irq;
648 hwif->irq = hw->irq = ahwif->irq;
649 hwif->chipset = ide_au1xxx; 649 hwif->chipset = ide_au1xxx;
650 650
651 auide_setup_ports(hw, ahwif); 651 memset(&hw, 0, sizeof(hw));
652 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); 652 auide_setup_ports(&hw, ahwif);
653 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
653 654
654 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ 655 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
655#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA 656#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
@@ -699,9 +700,6 @@ static int au_ide_probe(struct device *dev)
699 hwif->dma_host_on = &auide_dma_host_on; 700 hwif->dma_host_on = &auide_dma_host_on;
700 hwif->dma_lost_irq = &auide_dma_lost_irq; 701 hwif->dma_lost_irq = &auide_dma_lost_irq;
701 hwif->ide_dma_on = &auide_dma_on; 702 hwif->ide_dma_on = &auide_dma_on;
702
703 hwif->atapi_dma = 1;
704
705#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ 703#else /* !CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */
706 hwif->channel = 0; 704 hwif->channel = 0;
707 hwif->hold = 1; 705 hwif->hold = 1;
@@ -709,8 +707,10 @@ static int au_ide_probe(struct device *dev)
709 hwif->config_data = 0; /* no chipset-specific code */ 707 hwif->config_data = 0; /* no chipset-specific code */
710 708
711 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */ 709 hwif->drives[0].autotune = 1; /* 1=autotune, 2=noautotune, 0=default */
710 hwif->drives[1].autotune = 1;
712#endif 711#endif
713 hwif->drives[0].no_io_32bit = 1; 712 hwif->drives[0].no_io_32bit = 1;
713 hwif->drives[1].no_io_32bit = 1;
714 714
715 auide_hwif.hwif = hwif; 715 auide_hwif.hwif = hwif;
716 hwif->hwif_data = &auide_hwif; 716 hwif->hwif_data = &auide_hwif;
@@ -720,9 +720,9 @@ static int au_ide_probe(struct device *dev)
720 dbdma_init_done = 1; 720 dbdma_init_done = 1;
721#endif 721#endif
722 722
723 probe_hwif_init(hwif); 723 idx[0] = hwif->index;
724 724
725 ide_proc_register_port(hwif); 725 ide_device_add(idx);
726 726
727 dev_set_drvdata(dev, hwif); 727 dev_set_drvdata(dev, hwif);
728 728
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index c2e29571b007..521edd41b572 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -71,6 +71,7 @@ static int __devinit swarm_ide_probe(struct device *dev)
71 u8 __iomem *base; 71 u8 __iomem *base;
72 phys_t offset, size; 72 phys_t offset, size;
73 int i; 73 int i;
74 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
74 75
75 if (!SIBYTE_HAVE_IDE) 76 if (!SIBYTE_HAVE_IDE)
76 return -ENODEV; 77 return -ENODEV;
@@ -119,18 +120,15 @@ static int __devinit swarm_ide_probe(struct device *dev)
119 hwif->noprobe = 0; 120 hwif->noprobe = 0;
120 121
121 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) 122 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++)
122 hwif->hw.io_ports[i] = 123 hwif->io_ports[i] =
123 (unsigned long)(base + ((0x1f0 + i) << 5)); 124 (unsigned long)(base + ((0x1f0 + i) << 5));
124 hwif->hw.io_ports[IDE_CONTROL_OFFSET] = 125 hwif->io_ports[IDE_CONTROL_OFFSET] =
125 (unsigned long)(base + (0x3f6 << 5)); 126 (unsigned long)(base + (0x3f6 << 5));
126 hwif->hw.irq = K_INT_GB_IDE; 127 hwif->irq = K_INT_GB_IDE;
127 128
128 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 129 idx[0] = hwif->index;
129 hwif->irq = hwif->hw.irq;
130 130
131 probe_hwif_init(hwif); 131 ide_device_add(idx);
132
133 ide_proc_register_port(hwif);
134 132
135 dev_set_drvdata(dev, hwif); 133 dev_set_drvdata(dev, hwif);
136 134
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 3a4c2c26a77e..19ec421f7b9f 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/aec62xx.c Version 0.25 Aug 1, 2007 2 * linux/drivers/ide/pci/aec62xx.c Version 0.27 Sep 16, 2007
3 * 3 *
4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com>
@@ -141,19 +141,6 @@ static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
141 drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0); 141 drive->hwif->set_dma_mode(drive, pio + XFER_PIO_0);
142} 142}
143 143
144static void aec62xx_dma_lost_irq (ide_drive_t *drive)
145{
146 switch (HWIF(drive)->pci_dev->device) {
147 case PCI_DEVICE_ID_ARTOP_ATP860:
148 case PCI_DEVICE_ID_ARTOP_ATP860R:
149 case PCI_DEVICE_ID_ARTOP_ATP865:
150 case PCI_DEVICE_ID_ARTOP_ATP865R:
151 printk(" AEC62XX time out ");
152 default:
153 break;
154 }
155}
156
157static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 144static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name)
158{ 145{
159 int bus_speed = system_bus_clock(); 146 int bus_speed = system_bus_clock();
@@ -184,34 +171,21 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch
184static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) 171static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
185{ 172{
186 struct pci_dev *dev = hwif->pci_dev; 173 struct pci_dev *dev = hwif->pci_dev;
187 u8 reg54 = 0, mask = hwif->channel ? 0xf0 : 0x0f;
188 unsigned long flags;
189 174
190 hwif->set_pio_mode = &aec_set_pio_mode; 175 hwif->set_pio_mode = &aec_set_pio_mode;
191 176
192 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { 177 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
193 if(hwif->mate)
194 hwif->mate->serialized = hwif->serialized = 1;
195 hwif->set_dma_mode = &aec6210_set_mode; 178 hwif->set_dma_mode = &aec6210_set_mode;
196 } else 179 else
197 hwif->set_dma_mode = &aec6260_set_mode; 180 hwif->set_dma_mode = &aec6260_set_mode;
198 181
199 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
200
201 if (hwif->dma_base == 0) 182 if (hwif->dma_base == 0)
202 return; 183 return;
203 184
204 hwif->ultra_mask = hwif->cds->udma_mask; 185 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
205 hwif->mwdma_mask = 0x07; 186 return;
206
207 hwif->dma_lost_irq = &aec62xx_dma_lost_irq;
208 187
209 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { 188 if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
210 spin_lock_irqsave(&ide_lock, flags);
211 pci_read_config_byte (dev, 0x54, &reg54);
212 pci_write_config_byte(dev, 0x54, (reg54 & ~mask));
213 spin_unlock_irqrestore(&ide_lock, flags);
214 } else if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
215 u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01; 189 u8 ata66 = 0, mask = hwif->channel ? 0x02 : 0x01;
216 190
217 pci_read_config_byte(hwif->pci_dev, 0x49, &ata66); 191 pci_read_config_byte(hwif->pci_dev, 0x49, &ata66);
@@ -220,73 +194,53 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
220 } 194 }
221} 195}
222 196
223static int __devinit init_setup_aec62xx(struct pci_dev *dev, ide_pci_device_t *d) 197static const struct ide_port_info aec62xx_chipsets[] __devinitdata = {
224{
225 return ide_setup_pci_device(dev, d);
226}
227
228static int __devinit init_setup_aec6x80(struct pci_dev *dev, ide_pci_device_t *d)
229{
230 unsigned long dma_base = pci_resource_start(dev, 4);
231
232 if (inb(dma_base + 2) & 0x10) {
233 d->name = (dev->device == PCI_DEVICE_ID_ARTOP_ATP865R) ?
234 "AEC6880R" : "AEC6880";
235 d->udma_mask = 0x7f; /* udma0-6 */
236 }
237
238 return ide_setup_pci_device(dev, d);
239}
240
241static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
242 { /* 0 */ 198 { /* 0 */
243 .name = "AEC6210", 199 .name = "AEC6210",
244 .init_setup = init_setup_aec62xx,
245 .init_chipset = init_chipset_aec62xx, 200 .init_chipset = init_chipset_aec62xx,
246 .init_hwif = init_hwif_aec62xx, 201 .init_hwif = init_hwif_aec62xx,
247 .autodma = AUTODMA,
248 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 202 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
249 .bootable = OFF_BOARD, 203 .host_flags = IDE_HFLAG_SERIALIZE |
204 IDE_HFLAG_NO_ATAPI_DMA |
205 IDE_HFLAG_OFF_BOARD,
250 .pio_mask = ATA_PIO4, 206 .pio_mask = ATA_PIO4,
251 .udma_mask = 0x07, /* udma0-2 */ 207 .mwdma_mask = ATA_MWDMA2,
208 .udma_mask = ATA_UDMA2,
252 },{ /* 1 */ 209 },{ /* 1 */
253 .name = "AEC6260", 210 .name = "AEC6260",
254 .init_setup = init_setup_aec62xx,
255 .init_chipset = init_chipset_aec62xx, 211 .init_chipset = init_chipset_aec62xx,
256 .init_hwif = init_hwif_aec62xx, 212 .init_hwif = init_hwif_aec62xx,
257 .autodma = NOAUTODMA, 213 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_NO_AUTODMA |
258 .bootable = OFF_BOARD, 214 IDE_HFLAG_OFF_BOARD,
259 .pio_mask = ATA_PIO4, 215 .pio_mask = ATA_PIO4,
260 .udma_mask = 0x1f, /* udma0-4 */ 216 .mwdma_mask = ATA_MWDMA2,
217 .udma_mask = ATA_UDMA4,
261 },{ /* 2 */ 218 },{ /* 2 */
262 .name = "AEC6260R", 219 .name = "AEC6260R",
263 .init_setup = init_setup_aec62xx,
264 .init_chipset = init_chipset_aec62xx, 220 .init_chipset = init_chipset_aec62xx,
265 .init_hwif = init_hwif_aec62xx, 221 .init_hwif = init_hwif_aec62xx,
266 .autodma = AUTODMA,
267 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 222 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
268 .bootable = NEVER_BOARD, 223 .host_flags = IDE_HFLAG_NO_ATAPI_DMA,
269 .pio_mask = ATA_PIO4, 224 .pio_mask = ATA_PIO4,
270 .udma_mask = 0x1f, /* udma0-4 */ 225 .mwdma_mask = ATA_MWDMA2,
226 .udma_mask = ATA_UDMA4,
271 },{ /* 3 */ 227 },{ /* 3 */
272 .name = "AEC6280", 228 .name = "AEC6280",
273 .init_setup = init_setup_aec6x80,
274 .init_chipset = init_chipset_aec62xx, 229 .init_chipset = init_chipset_aec62xx,
275 .init_hwif = init_hwif_aec62xx, 230 .init_hwif = init_hwif_aec62xx,
276 .autodma = AUTODMA, 231 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
277 .bootable = OFF_BOARD,
278 .pio_mask = ATA_PIO4, 232 .pio_mask = ATA_PIO4,
279 .udma_mask = 0x3f, /* udma0-5 */ 233 .mwdma_mask = ATA_MWDMA2,
234 .udma_mask = ATA_UDMA5,
280 },{ /* 4 */ 235 },{ /* 4 */
281 .name = "AEC6280R", 236 .name = "AEC6280R",
282 .init_setup = init_setup_aec6x80,
283 .init_chipset = init_chipset_aec62xx, 237 .init_chipset = init_chipset_aec62xx,
284 .init_hwif = init_hwif_aec62xx, 238 .init_hwif = init_hwif_aec62xx,
285 .autodma = AUTODMA,
286 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 239 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
287 .bootable = OFF_BOARD, 240 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
288 .pio_mask = ATA_PIO4, 241 .pio_mask = ATA_PIO4,
289 .udma_mask = 0x3f, /* udma0-5 */ 242 .mwdma_mask = ATA_MWDMA2,
243 .udma_mask = ATA_UDMA5,
290 } 244 }
291}; 245};
292 246
@@ -299,14 +253,26 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
299 * finds a device matching our IDE device tables. 253 * finds a device matching our IDE device tables.
300 * 254 *
301 * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R] 255 * NOTE: since we're going to modify the 'name' field for AEC-6[26]80[R]
302 * chips, pass a local copy of 'struct pci_device_id' down the call chain. 256 * chips, pass a local copy of 'struct ide_port_info' down the call chain.
303 */ 257 */
304 258
305static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 259static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
306{ 260{
307 ide_pci_device_t d = aec62xx_chipsets[id->driver_data]; 261 struct ide_port_info d;
262 u8 idx = id->driver_data;
263
264 d = aec62xx_chipsets[idx];
265
266 if (idx == 3 || idx == 4) {
267 unsigned long dma_base = pci_resource_start(dev, 4);
268
269 if (inb(dma_base + 2) & 0x10) {
270 d.name = (idx == 4) ? "AEC6880R" : "AEC6880";
271 d.udma_mask = ATA_UDMA6;
272 }
273 }
308 274
309 return d.init_setup(dev, &d); 275 return ide_setup_pci_device(dev, &d);
310} 276}
311 277
312static const struct pci_device_id aec62xx_pci_tbl[] = { 278static const struct pci_device_id aec62xx_pci_tbl[] = {
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 31d4e50647d5..a607dd31a64c 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/alim15x3.c Version 0.26 Jul 14 2007 2 * linux/drivers/ide/pci/alim15x3.c Version 0.29 Sep 16 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer 4 * Copyright (C) 1998-2000 Michel Aubry, Maintainer
5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz, Maintainer
@@ -492,6 +492,13 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
492 * clear bit 7 492 * clear bit 7
493 */ 493 */
494 pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F); 494 pci_write_config_byte(dev, 0x4b, tmpbyte & 0x7F);
495 /*
496 * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010
497 */
498 if (m5229_revision >= 0x20 && isa_dev) {
499 pci_read_config_byte(isa_dev, 0x5e, &tmpbyte);
500 chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0;
501 }
495 goto out; 502 goto out;
496 } 503 }
497 504
@@ -537,7 +544,30 @@ static unsigned int __devinit init_chipset_ali15x3 (struct pci_dev *dev, const c
537 pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02); 544 pci_write_config_byte(isa_dev, 0x79, tmpbyte | 0x02);
538 } 545 }
539 } 546 }
547
540out: 548out:
549 /*
550 * CD_ROM DMA on (m5229, 0x53, bit0)
551 * Enable this bit even if we want to use PIO.
552 * PIO FIFO off (m5229, 0x53, bit1)
553 * The hardware will use 0x54h and 0x55h to control PIO FIFO.
554 * (Not on later devices it seems)
555 *
556 * 0x53 changes meaning on later revs - we must no touch
557 * bit 1 on them. Need to check if 0x20 is the right break.
558 */
559 if (m5229_revision >= 0x20) {
560 pci_read_config_byte(dev, 0x53, &tmpbyte);
561
562 if (m5229_revision <= 0x20)
563 tmpbyte = (tmpbyte & (~0x02)) | 0x01;
564 else if (m5229_revision == 0xc7 || m5229_revision == 0xc8)
565 tmpbyte |= 0x03;
566 else
567 tmpbyte |= 0x01;
568
569 pci_write_config_byte(dev, 0x53, tmpbyte);
570 }
541 pci_dev_put(north); 571 pci_dev_put(north);
542 pci_dev_put(isa_dev); 572 pci_dev_put(isa_dev);
543 local_irq_restore(flags); 573 local_irq_restore(flags);
@@ -616,36 +646,8 @@ static u8 __devinit ata66_ali15x3(ide_hwif_t *hwif)
616 if ((tmpbyte & (1 << hwif->channel)) == 0) 646 if ((tmpbyte & (1 << hwif->channel)) == 0)
617 cbl = ATA_CBL_PATA80; 647 cbl = ATA_CBL_PATA80;
618 } 648 }
619 } else {
620 /*
621 * check m1533, 0x5e, bit 1~4 == 1001 => & 00011110 = 00010010
622 */
623 pci_read_config_byte(isa_dev, 0x5e, &tmpbyte);
624 chip_is_1543c_e = ((tmpbyte & 0x1e) == 0x12) ? 1: 0;
625 } 649 }
626 650
627 /*
628 * CD_ROM DMA on (m5229, 0x53, bit0)
629 * Enable this bit even if we want to use PIO
630 * PIO FIFO off (m5229, 0x53, bit1)
631 * The hardware will use 0x54h and 0x55h to control PIO FIFO
632 * (Not on later devices it seems)
633 *
634 * 0x53 changes meaning on later revs - we must no touch
635 * bit 1 on them. Need to check if 0x20 is the right break
636 */
637
638 pci_read_config_byte(dev, 0x53, &tmpbyte);
639
640 if(m5229_revision <= 0x20)
641 tmpbyte = (tmpbyte & (~0x02)) | 0x01;
642 else if (m5229_revision == 0xc7 || m5229_revision == 0xc8)
643 tmpbyte |= 0x03;
644 else
645 tmpbyte |= 0x01;
646
647 pci_write_config_byte(dev, 0x53, tmpbyte);
648
649 local_irq_restore(flags); 651 local_irq_restore(flags);
650 652
651 return cbl; 653 return cbl;
@@ -664,35 +666,8 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
664 hwif->set_dma_mode = &ali_set_dma_mode; 666 hwif->set_dma_mode = &ali_set_dma_mode;
665 hwif->udma_filter = &ali_udma_filter; 667 hwif->udma_filter = &ali_udma_filter;
666 668
667 /* don't use LBA48 DMA on ALi devices before rev 0xC5 */ 669 if (hwif->dma_base == 0)
668 hwif->no_lba48_dma = (m5229_revision <= 0xC4) ? 1 : 0;
669
670 if (!hwif->dma_base) {
671 hwif->drives[0].autotune = 1;
672 hwif->drives[1].autotune = 1;
673 return; 670 return;
674 }
675
676 /*
677 * check in ->init_dma guarantees m5229_revision >= 0x20 here
678 */
679
680 if (m5229_revision > 0x20)
681 hwif->atapi_dma = 1;
682
683 if (m5229_revision <= 0x20)
684 hwif->ultra_mask = 0x00; /* no udma */
685 else if (m5229_revision < 0xC2)
686 hwif->ultra_mask = 0x07; /* udma0-2 */
687 else if (m5229_revision == 0xC2 || m5229_revision == 0xC3)
688 hwif->ultra_mask = 0x1f; /* udma0-4 */
689 else if (m5229_revision == 0xC4)
690 hwif->ultra_mask = 0x3f; /* udma0-5 */
691 else
692 hwif->ultra_mask = 0x7f; /* udma0-6 */
693
694 hwif->mwdma_mask = 0x07;
695 hwif->swdma_mask = 0x07;
696 671
697 hwif->dma_setup = &ali15x3_dma_setup; 672 hwif->dma_setup = &ali15x3_dma_setup;
698 673
@@ -771,14 +746,15 @@ static void __devinit init_dma_ali15x3 (ide_hwif_t *hwif, unsigned long dmabase)
771 ide_setup_dma(hwif, dmabase, 8); 746 ide_setup_dma(hwif, dmabase, 8);
772} 747}
773 748
774static ide_pci_device_t ali15x3_chipset __devinitdata = { 749static const struct ide_port_info ali15x3_chipset __devinitdata = {
775 .name = "ALI15X3", 750 .name = "ALI15X3",
776 .init_chipset = init_chipset_ali15x3, 751 .init_chipset = init_chipset_ali15x3,
777 .init_hwif = init_hwif_ali15x3, 752 .init_hwif = init_hwif_ali15x3,
778 .init_dma = init_dma_ali15x3, 753 .init_dma = init_dma_ali15x3,
779 .autodma = AUTODMA, 754 .host_flags = IDE_HFLAG_BOOTABLE,
780 .bootable = ON_BOARD,
781 .pio_mask = ATA_PIO5, 755 .pio_mask = ATA_PIO5,
756 .swdma_mask = ATA_SWDMA2,
757 .mwdma_mask = ATA_MWDMA2,
782}; 758};
783 759
784/** 760/**
@@ -796,15 +772,34 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev
796 { }, 772 { },
797 }; 773 };
798 774
799 ide_pci_device_t *d = &ali15x3_chipset; 775 struct ide_port_info d = ali15x3_chipset;
776 u8 rev = dev->revision;
800 777
801 if (pci_dev_present(ati_rs100)) 778 if (pci_dev_present(ati_rs100))
802 printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); 779 printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n");
803 780
781 /* don't use LBA48 DMA on ALi devices before rev 0xC5 */
782 if (rev <= 0xC4)
783 d.host_flags |= IDE_HFLAG_NO_LBA48_DMA;
784
785 if (rev >= 0x20) {
786 if (rev == 0x20)
787 d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
788
789 if (rev < 0xC2)
790 d.udma_mask = ATA_UDMA2;
791 else if (rev == 0xC2 || rev == 0xC3)
792 d.udma_mask = ATA_UDMA4;
793 else if (rev == 0xC4)
794 d.udma_mask = ATA_UDMA5;
795 else
796 d.udma_mask = ATA_UDMA6;
797 }
798
804#if defined(CONFIG_SPARC64) 799#if defined(CONFIG_SPARC64)
805 d->init_hwif = init_hwif_common_ali15x3; 800 d.init_hwif = init_hwif_common_ali15x3;
806#endif /* CONFIG_SPARC64 */ 801#endif /* CONFIG_SPARC64 */
807 return ide_setup_pci_device(dev, d); 802 return ide_setup_pci_device(dev, &d);
808} 803}
809 804
810 805
diff --git a/drivers/ide/pci/amd74xx.c b/drivers/ide/pci/amd74xx.c
index 3bf3d931eea1..8d4125ec252c 100644
--- a/drivers/ide/pci/amd74xx.c
+++ b/drivers/ide/pci/amd74xx.c
@@ -77,7 +77,7 @@ static struct amd_ide_chip {
77}; 77};
78 78
79static struct amd_ide_chip *amd_config; 79static struct amd_ide_chip *amd_config;
80static ide_pci_device_t *amd_chipset; 80static const struct ide_port_info *amd_chipset;
81static unsigned int amd_80w; 81static unsigned int amd_80w;
82static unsigned int amd_clock; 82static unsigned int amd_clock;
83 83
@@ -233,7 +233,6 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
233 * Print the boot message. 233 * Print the boot message.
234 */ 234 */
235 235
236 pci_read_config_byte(dev, PCI_REVISION_ID, &t);
237 printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n", 236 printk(KERN_INFO "%s: %s (rev %02x) UDMA%s controller\n",
238 amd_chipset->name, pci_name(dev), dev->revision, 237 amd_chipset->name, pci_name(dev), dev->revision,
239 amd_dma[fls(amd_config->udma_mask) - 1]); 238 amd_dma[fls(amd_config->udma_mask) - 1]);
@@ -243,29 +242,18 @@ static unsigned int __devinit init_chipset_amd74xx(struct pci_dev *dev, const ch
243 242
244static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) 243static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
245{ 244{
246 int i;
247
248 if (hwif->irq == 0) /* 0 is bogus but will do for now */ 245 if (hwif->irq == 0) /* 0 is bogus but will do for now */
249 hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel); 246 hwif->irq = pci_get_legacy_ide_irq(hwif->pci_dev, hwif->channel);
250 247
251 hwif->set_pio_mode = &amd_set_pio_mode; 248 hwif->set_pio_mode = &amd_set_pio_mode;
252 hwif->set_dma_mode = &amd_set_drive; 249 hwif->set_dma_mode = &amd_set_drive;
253 250
254 for (i = 0; i < 2; i++) {
255 hwif->drives[i].io_32bit = 1;
256 hwif->drives[i].unmask = 1;
257 hwif->drives[i].autotune = 1;
258 }
259
260 if (!hwif->dma_base) 251 if (!hwif->dma_base)
261 return; 252 return;
262 253
263 hwif->atapi_dma = 1;
264
265 hwif->ultra_mask = amd_config->udma_mask; 254 hwif->ultra_mask = amd_config->udma_mask;
266 hwif->mwdma_mask = 0x07; 255 if (amd_config->flags & AMD_BAD_SWDMA)
267 if ((amd_config->flags & AMD_BAD_SWDMA) == 0) 256 hwif->swdma_mask = 0x00;
268 hwif->swdma_mask = 0x07;
269 257
270 if (hwif->cbl != ATA_CBL_PATA40_SHORT) { 258 if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
271 if ((amd_80w >> hwif->channel) & 1) 259 if ((amd_80w >> hwif->channel) & 1)
@@ -275,18 +263,24 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
275 } 263 }
276} 264}
277 265
266#define IDE_HFLAGS_AMD \
267 (IDE_HFLAG_PIO_NO_BLACKLIST | \
268 IDE_HFLAG_PIO_NO_DOWNGRADE | \
269 IDE_HFLAG_POST_SET_MODE | \
270 IDE_HFLAG_IO_32BIT | \
271 IDE_HFLAG_UNMASK_IRQS | \
272 IDE_HFLAG_BOOTABLE)
273
278#define DECLARE_AMD_DEV(name_str) \ 274#define DECLARE_AMD_DEV(name_str) \
279 { \ 275 { \
280 .name = name_str, \ 276 .name = name_str, \
281 .init_chipset = init_chipset_amd74xx, \ 277 .init_chipset = init_chipset_amd74xx, \
282 .init_hwif = init_hwif_amd74xx, \ 278 .init_hwif = init_hwif_amd74xx, \
283 .autodma = AUTODMA, \
284 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ 279 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \
285 .bootable = ON_BOARD, \ 280 .host_flags = IDE_HFLAGS_AMD, \
286 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \
287 | IDE_HFLAG_PIO_NO_DOWNGRADE \
288 | IDE_HFLAG_POST_SET_MODE, \
289 .pio_mask = ATA_PIO5, \ 281 .pio_mask = ATA_PIO5, \
282 .swdma_mask = ATA_SWDMA2, \
283 .mwdma_mask = ATA_MWDMA2, \
290 } 284 }
291 285
292#define DECLARE_NV_DEV(name_str) \ 286#define DECLARE_NV_DEV(name_str) \
@@ -294,16 +288,14 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif)
294 .name = name_str, \ 288 .name = name_str, \
295 .init_chipset = init_chipset_amd74xx, \ 289 .init_chipset = init_chipset_amd74xx, \
296 .init_hwif = init_hwif_amd74xx, \ 290 .init_hwif = init_hwif_amd74xx, \
297 .autodma = AUTODMA, \
298 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ 291 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \
299 .bootable = ON_BOARD, \ 292 .host_flags = IDE_HFLAGS_AMD, \
300 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \
301 | IDE_HFLAG_PIO_NO_DOWNGRADE \
302 | IDE_HFLAG_POST_SET_MODE, \
303 .pio_mask = ATA_PIO5, \ 293 .pio_mask = ATA_PIO5, \
294 .swdma_mask = ATA_SWDMA2, \
295 .mwdma_mask = ATA_MWDMA2, \
304 } 296 }
305 297
306static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { 298static const struct ide_port_info amd74xx_chipsets[] __devinitdata = {
307 /* 0 */ DECLARE_AMD_DEV("AMD7401"), 299 /* 0 */ DECLARE_AMD_DEV("AMD7401"),
308 /* 1 */ DECLARE_AMD_DEV("AMD7409"), 300 /* 1 */ DECLARE_AMD_DEV("AMD7409"),
309 /* 2 */ DECLARE_AMD_DEV("AMD7411"), 301 /* 2 */ DECLARE_AMD_DEV("AMD7411"),
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index 446900da1329..ef8e0164ef7a 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -172,21 +172,12 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
172 u8 ch = hwif->channel; 172 u8 ch = hwif->channel;
173 struct pci_dev *pdev = hwif->pci_dev; 173 struct pci_dev *pdev = hwif->pci_dev;
174 174
175 if (!hwif->irq)
176 hwif->irq = ch ? 15 : 14;
177
178 hwif->set_pio_mode = &atiixp_set_pio_mode; 175 hwif->set_pio_mode = &atiixp_set_pio_mode;
179 hwif->set_dma_mode = &atiixp_set_dma_mode; 176 hwif->set_dma_mode = &atiixp_set_dma_mode;
180 hwif->drives[0].autotune = 1;
181 hwif->drives[1].autotune = 1;
182 177
183 if (!hwif->dma_base) 178 if (!hwif->dma_base)
184 return; 179 return;
185 180
186 hwif->atapi_dma = 1;
187 hwif->ultra_mask = 0x3f;
188 hwif->mwdma_mask = 0x07;
189
190 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode); 181 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
191 182
192 if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40) 183 if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
@@ -198,23 +189,24 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
198 hwif->dma_host_off = &atiixp_dma_host_off; 189 hwif->dma_host_off = &atiixp_dma_host_off;
199} 190}
200 191
201 192static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
202static ide_pci_device_t atiixp_pci_info[] __devinitdata = {
203 { /* 0 */ 193 { /* 0 */
204 .name = "ATIIXP", 194 .name = "ATIIXP",
205 .init_hwif = init_hwif_atiixp, 195 .init_hwif = init_hwif_atiixp,
206 .autodma = AUTODMA,
207 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 196 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}},
208 .bootable = ON_BOARD, 197 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
209 .pio_mask = ATA_PIO4, 198 .pio_mask = ATA_PIO4,
199 .mwdma_mask = ATA_MWDMA2,
200 .udma_mask = ATA_UDMA5,
210 },{ /* 1 */ 201 },{ /* 1 */
211 .name = "SB600_PATA", 202 .name = "SB600_PATA",
212 .init_hwif = init_hwif_atiixp, 203 .init_hwif = init_hwif_atiixp,
213 .autodma = AUTODMA,
214 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, 204 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}},
215 .bootable = ON_BOARD, 205 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_LEGACY_IRQS |
216 .host_flags = IDE_HFLAG_SINGLE, 206 IDE_HFLAG_BOOTABLE,
217 .pio_mask = ATA_PIO4, 207 .pio_mask = ATA_PIO4,
208 .mwdma_mask = ATA_MWDMA2,
209 .udma_mask = ATA_UDMA5,
218 }, 210 },
219}; 211};
220 212
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index f369645e4d16..4aa48104e0c1 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -185,6 +185,8 @@ static u8 recovery_counts[4] = {16, 16, 16, 16}; /* Recovery count (encoded) */
185 185
186#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 186#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */
187 187
188static DEFINE_SPINLOCK(cmd640_lock);
189
188/* 190/*
189 * These are initialized to point at the devices we control 191 * These are initialized to point at the devices we control
190 */ 192 */
@@ -258,12 +260,12 @@ static u8 get_cmd640_reg_vlb (u16 reg)
258 260
259static u8 get_cmd640_reg(u16 reg) 261static u8 get_cmd640_reg(u16 reg)
260{ 262{
261 u8 b;
262 unsigned long flags; 263 unsigned long flags;
264 u8 b;
263 265
264 spin_lock_irqsave(&ide_lock, flags); 266 spin_lock_irqsave(&cmd640_lock, flags);
265 b = __get_cmd640_reg(reg); 267 b = __get_cmd640_reg(reg);
266 spin_unlock_irqrestore(&ide_lock, flags); 268 spin_unlock_irqrestore(&cmd640_lock, flags);
267 return b; 269 return b;
268} 270}
269 271
@@ -271,9 +273,9 @@ static void put_cmd640_reg(u16 reg, u8 val)
271{ 273{
272 unsigned long flags; 274 unsigned long flags;
273 275
274 spin_lock_irqsave(&ide_lock, flags); 276 spin_lock_irqsave(&cmd640_lock, flags);
275 __put_cmd640_reg(reg,val); 277 __put_cmd640_reg(reg,val);
276 spin_unlock_irqrestore(&ide_lock, flags); 278 spin_unlock_irqrestore(&cmd640_lock, flags);
277} 279}
278 280
279static int __init match_pci_cmd640_device (void) 281static int __init match_pci_cmd640_device (void)
@@ -351,7 +353,7 @@ static int __init secondary_port_responding (void)
351{ 353{
352 unsigned long flags; 354 unsigned long flags;
353 355
354 spin_lock_irqsave(&ide_lock, flags); 356 spin_lock_irqsave(&cmd640_lock, flags);
355 357
356 outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */ 358 outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */
357 udelay(100); 359 udelay(100);
@@ -359,11 +361,11 @@ static int __init secondary_port_responding (void)
359 outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */ 361 outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */
360 udelay(100); 362 udelay(100);
361 if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) { 363 if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) {
362 spin_unlock_irqrestore(&ide_lock, flags); 364 spin_unlock_irqrestore(&cmd640_lock, flags);
363 return 0; /* nothing responded */ 365 return 0; /* nothing responded */
364 } 366 }
365 } 367 }
366 spin_unlock_irqrestore(&ide_lock, flags); 368 spin_unlock_irqrestore(&cmd640_lock, flags);
367 return 1; /* success */ 369 return 1; /* success */
368} 370}
369 371
@@ -440,11 +442,11 @@ static void __init setup_device_ptrs (void)
440static void set_prefetch_mode (unsigned int index, int mode) 442static void set_prefetch_mode (unsigned int index, int mode)
441{ 443{
442 ide_drive_t *drive = cmd_drives[index]; 444 ide_drive_t *drive = cmd_drives[index];
445 unsigned long flags;
443 int reg = prefetch_regs[index]; 446 int reg = prefetch_regs[index];
444 u8 b; 447 u8 b;
445 unsigned long flags;
446 448
447 spin_lock_irqsave(&ide_lock, flags); 449 spin_lock_irqsave(&cmd640_lock, flags);
448 b = __get_cmd640_reg(reg); 450 b = __get_cmd640_reg(reg);
449 if (mode) { /* want prefetch on? */ 451 if (mode) { /* want prefetch on? */
450#if CMD640_PREFETCH_MASKS 452#if CMD640_PREFETCH_MASKS
@@ -460,7 +462,7 @@ static void set_prefetch_mode (unsigned int index, int mode)
460 b |= prefetch_masks[index]; /* disable prefetch */ 462 b |= prefetch_masks[index]; /* disable prefetch */
461 } 463 }
462 __put_cmd640_reg(reg, b); 464 __put_cmd640_reg(reg, b);
463 spin_unlock_irqrestore(&ide_lock, flags); 465 spin_unlock_irqrestore(&cmd640_lock, flags);
464} 466}
465 467
466/* 468/*
@@ -561,7 +563,7 @@ static void program_drive_counts (unsigned int index)
561 /* 563 /*
562 * Now that everything is ready, program the new timings 564 * Now that everything is ready, program the new timings
563 */ 565 */
564 spin_lock_irqsave(&ide_lock, flags); 566 spin_lock_irqsave(&cmd640_lock, flags);
565 /* 567 /*
566 * Program the address_setup clocks into ARTTIM reg, 568 * Program the address_setup clocks into ARTTIM reg,
567 * and then the active/recovery counts into the DRWTIM reg 569 * and then the active/recovery counts into the DRWTIM reg
@@ -570,7 +572,7 @@ static void program_drive_counts (unsigned int index)
570 setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f; 572 setup_count |= __get_cmd640_reg(arttim_regs[index]) & 0x3f;
571 __put_cmd640_reg(arttim_regs[index], setup_count); 573 __put_cmd640_reg(arttim_regs[index], setup_count);
572 __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count)); 574 __put_cmd640_reg(drwtim_regs[index], pack_nibbles(active_count, recovery_count));
573 spin_unlock_irqrestore(&ide_lock, flags); 575 spin_unlock_irqrestore(&cmd640_lock, flags);
574} 576}
575 577
576/* 578/*
@@ -670,20 +672,20 @@ static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
670 672
671static int pci_conf1(void) 673static int pci_conf1(void)
672{ 674{
673 u32 tmp;
674 unsigned long flags; 675 unsigned long flags;
676 u32 tmp;
675 677
676 spin_lock_irqsave(&ide_lock, flags); 678 spin_lock_irqsave(&cmd640_lock, flags);
677 outb(0x01, 0xCFB); 679 outb(0x01, 0xCFB);
678 tmp = inl(0xCF8); 680 tmp = inl(0xCF8);
679 outl(0x80000000, 0xCF8); 681 outl(0x80000000, 0xCF8);
680 if (inl(0xCF8) == 0x80000000) { 682 if (inl(0xCF8) == 0x80000000) {
681 outl(tmp, 0xCF8); 683 outl(tmp, 0xCF8);
682 spin_unlock_irqrestore(&ide_lock, flags); 684 spin_unlock_irqrestore(&cmd640_lock, flags);
683 return 1; 685 return 1;
684 } 686 }
685 outl(tmp, 0xCF8); 687 outl(tmp, 0xCF8);
686 spin_unlock_irqrestore(&ide_lock, flags); 688 spin_unlock_irqrestore(&cmd640_lock, flags);
687 return 0; 689 return 0;
688} 690}
689 691
@@ -691,15 +693,15 @@ static int pci_conf2(void)
691{ 693{
692 unsigned long flags; 694 unsigned long flags;
693 695
694 spin_lock_irqsave(&ide_lock, flags); 696 spin_lock_irqsave(&cmd640_lock, flags);
695 outb(0x00, 0xCFB); 697 outb(0x00, 0xCFB);
696 outb(0x00, 0xCF8); 698 outb(0x00, 0xCF8);
697 outb(0x00, 0xCFA); 699 outb(0x00, 0xCFA);
698 if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) { 700 if (inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) {
699 spin_unlock_irqrestore(&ide_lock, flags); 701 spin_unlock_irqrestore(&cmd640_lock, flags);
700 return 1; 702 return 1;
701 } 703 }
702 spin_unlock_irqrestore(&ide_lock, flags); 704 spin_unlock_irqrestore(&cmd640_lock, flags);
703 return 0; 705 return 0;
704} 706}
705 707
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index f3d3bde8daba..ea0143ef5fe5 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -439,11 +439,8 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha
439 u8 mrdmode = 0; 439 u8 mrdmode = 0;
440 440
441 if (dev->device == PCI_DEVICE_ID_CMD_646) { 441 if (dev->device == PCI_DEVICE_ID_CMD_646) {
442 u8 rev = 0;
443 442
444 pci_read_config_byte(dev, PCI_REVISION_ID, &rev); 443 switch (dev->revision) {
445
446 switch (rev) {
447 case 0x07: 444 case 0x07:
448 case 0x05: 445 case 0x05:
449 printk("%s: UltraDMA capable\n", name); 446 printk("%s: UltraDMA capable\n", name);
@@ -505,22 +502,13 @@ static u8 __devinit ata66_cmd64x(ide_hwif_t *hwif)
505static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif) 502static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
506{ 503{
507 struct pci_dev *dev = hwif->pci_dev; 504 struct pci_dev *dev = hwif->pci_dev;
508 u8 rev = 0;
509
510 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
511 505
512 hwif->set_pio_mode = &cmd64x_set_pio_mode; 506 hwif->set_pio_mode = &cmd64x_set_pio_mode;
513 hwif->set_dma_mode = &cmd64x_set_dma_mode; 507 hwif->set_dma_mode = &cmd64x_set_dma_mode;
514 508
515 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
516
517 if (!hwif->dma_base) 509 if (!hwif->dma_base)
518 return; 510 return;
519 511
520 hwif->atapi_dma = 1;
521 hwif->mwdma_mask = 0x07;
522 hwif->ultra_mask = hwif->cds->udma_mask;
523
524 /* 512 /*
525 * UltraDMA only supported on PCI646U and PCI646U2, which 513 * UltraDMA only supported on PCI646U and PCI646U2, which
526 * correspond to revisions 0x03, 0x05 and 0x07 respectively. 514 * correspond to revisions 0x03, 0x05 and 0x07 respectively.
@@ -533,7 +521,7 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
533 * 521 *
534 * So we only do UltraDMA on revision 0x05 and 0x07 chipsets. 522 * So we only do UltraDMA on revision 0x05 and 0x07 chipsets.
535 */ 523 */
536 if (dev->device == PCI_DEVICE_ID_CMD_646 && rev < 5) 524 if (dev->device == PCI_DEVICE_ID_CMD_646 && dev->revision < 5)
537 hwif->ultra_mask = 0x00; 525 hwif->ultra_mask = 0x00;
538 526
539 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 527 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
@@ -547,11 +535,10 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
547 hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq; 535 hwif->ide_dma_test_irq = &cmd648_ide_dma_test_irq;
548 break; 536 break;
549 case PCI_DEVICE_ID_CMD_646: 537 case PCI_DEVICE_ID_CMD_646:
550 hwif->chipset = ide_cmd646; 538 if (dev->revision == 0x01) {
551 if (rev == 0x01) {
552 hwif->ide_dma_end = &cmd646_1_ide_dma_end; 539 hwif->ide_dma_end = &cmd646_1_ide_dma_end;
553 break; 540 break;
554 } else if (rev >= 0x03) 541 } else if (dev->revision >= 0x03)
555 goto alt_irq_bits; 542 goto alt_irq_bits;
556 /* fall thru */ 543 /* fall thru */
557 default: 544 default:
@@ -561,80 +548,62 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
561 } 548 }
562} 549}
563 550
564static int __devinit init_setup_cmd64x(struct pci_dev *dev, ide_pci_device_t *d) 551static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
565{
566 return ide_setup_pci_device(dev, d);
567}
568
569static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d)
570{
571 /*
572 * The original PCI0646 didn't have the primary channel enable bit,
573 * it appeared starting with PCI0646U (i.e. revision ID 3).
574 */
575 if (dev->revision < 3)
576 d->enablebits[0].reg = 0;
577
578 return ide_setup_pci_device(dev, d);
579}
580
581static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
582 { /* 0 */ 552 { /* 0 */
583 .name = "CMD643", 553 .name = "CMD643",
584 .init_setup = init_setup_cmd64x,
585 .init_chipset = init_chipset_cmd64x, 554 .init_chipset = init_chipset_cmd64x,
586 .init_hwif = init_hwif_cmd64x, 555 .init_hwif = init_hwif_cmd64x,
587 .autodma = AUTODMA,
588 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 556 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}},
589 .bootable = ON_BOARD, 557 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
590 .host_flags = IDE_HFLAG_ABUSE_PREFETCH,
591 .pio_mask = ATA_PIO5, 558 .pio_mask = ATA_PIO5,
559 .mwdma_mask = ATA_MWDMA2,
592 .udma_mask = 0x00, /* no udma */ 560 .udma_mask = 0x00, /* no udma */
593 },{ /* 1 */ 561 },{ /* 1 */
594 .name = "CMD646", 562 .name = "CMD646",
595 .init_setup = init_setup_cmd646,
596 .init_chipset = init_chipset_cmd64x, 563 .init_chipset = init_chipset_cmd64x,
597 .init_hwif = init_hwif_cmd64x, 564 .init_hwif = init_hwif_cmd64x,
598 .autodma = AUTODMA,
599 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 565 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
600 .bootable = ON_BOARD, 566 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
601 .host_flags = IDE_HFLAG_ABUSE_PREFETCH,
602 .pio_mask = ATA_PIO5, 567 .pio_mask = ATA_PIO5,
603 .udma_mask = 0x07, /* udma0-2 */ 568 .mwdma_mask = ATA_MWDMA2,
569 .udma_mask = ATA_UDMA2,
604 },{ /* 2 */ 570 },{ /* 2 */
605 .name = "CMD648", 571 .name = "CMD648",
606 .init_setup = init_setup_cmd64x,
607 .init_chipset = init_chipset_cmd64x, 572 .init_chipset = init_chipset_cmd64x,
608 .init_hwif = init_hwif_cmd64x, 573 .init_hwif = init_hwif_cmd64x,
609 .autodma = AUTODMA,
610 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 574 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
611 .bootable = ON_BOARD, 575 .chipset = ide_cmd646,
612 .host_flags = IDE_HFLAG_ABUSE_PREFETCH, 576 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
613 .pio_mask = ATA_PIO5, 577 .pio_mask = ATA_PIO5,
614 .udma_mask = 0x1f, /* udma0-4 */ 578 .mwdma_mask = ATA_MWDMA2,
579 .udma_mask = ATA_UDMA4,
615 },{ /* 3 */ 580 },{ /* 3 */
616 .name = "CMD649", 581 .name = "CMD649",
617 .init_setup = init_setup_cmd64x,
618 .init_chipset = init_chipset_cmd64x, 582 .init_chipset = init_chipset_cmd64x,
619 .init_hwif = init_hwif_cmd64x, 583 .init_hwif = init_hwif_cmd64x,
620 .autodma = AUTODMA,
621 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 584 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
622 .bootable = ON_BOARD, 585 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
623 .host_flags = IDE_HFLAG_ABUSE_PREFETCH,
624 .pio_mask = ATA_PIO5, 586 .pio_mask = ATA_PIO5,
625 .udma_mask = 0x3f, /* udma0-5 */ 587 .mwdma_mask = ATA_MWDMA2,
588 .udma_mask = ATA_UDMA5,
626 } 589 }
627}; 590};
628 591
629/*
630 * We may have to modify enablebits for PCI0646, so we'd better pass
631 * a local copy of the ide_pci_device_t structure down the call chain...
632 */
633static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 592static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
634{ 593{
635 ide_pci_device_t d = cmd64x_chipsets[id->driver_data]; 594 struct ide_port_info d;
595 u8 idx = id->driver_data;
596
597 d = cmd64x_chipsets[idx];
598
599 /*
600 * The original PCI0646 didn't have the primary channel enable bit,
601 * it appeared starting with PCI0646U (i.e. revision ID 3).
602 */
603 if (idx == 1 && dev->revision < 3)
604 d.enablebits[0].reg = 0;
636 605
637 return d.init_setup(dev, &d); 606 return ide_setup_pci_device(dev, &d);
638} 607}
639 608
640static const struct pci_device_id cmd64x_pci_tbl[] = { 609static const struct pci_device_id cmd64x_pci_tbl[] = {
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index a8bf4940ca9c..0466462fd21b 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -106,18 +106,6 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
106} 106}
107 107
108/* 108/*
109 * We provide a callback for our nonstandard DMA location
110 */
111
112static void __devinit cs5520_init_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
113{
114 unsigned long bmide = pci_resource_start(dev, 2); /* Not the usual 4 */
115 if(hwif->mate && hwif->mate->dma_base) /* Second channel at primary + 8 */
116 bmide += 8;
117 ide_setup_dma(hwif, bmide, 8);
118}
119
120/*
121 * We wrap the DMA activate to set the vdma flag. This is needed 109 * We wrap the DMA activate to set the vdma flag. This is needed
122 * so that the IDE DMA layer issues PIO not DMA commands over the 110 * so that the IDE DMA layer issues PIO not DMA commands over the
123 * DMA channel 111 * DMA channel
@@ -125,6 +113,7 @@ static void __devinit cs5520_init_setup_dma(struct pci_dev *dev, ide_pci_device_
125 113
126static int cs5520_dma_on(ide_drive_t *drive) 114static int cs5520_dma_on(ide_drive_t *drive)
127{ 115{
116 /* ATAPI is harder so leave it for now */
128 drive->vdma = 1; 117 drive->vdma = 1;
129 return 0; 118 return 0;
130} 119}
@@ -134,33 +123,25 @@ static void __devinit init_hwif_cs5520(ide_hwif_t *hwif)
134 hwif->set_pio_mode = &cs5520_set_pio_mode; 123 hwif->set_pio_mode = &cs5520_set_pio_mode;
135 hwif->set_dma_mode = &cs5520_set_dma_mode; 124 hwif->set_dma_mode = &cs5520_set_dma_mode;
136 125
137 if (hwif->dma_base == 0) { 126 if (hwif->dma_base == 0)
138 hwif->drives[1].autotune = hwif->drives[0].autotune = 1;
139 return; 127 return;
140 }
141 128
142 hwif->ide_dma_on = &cs5520_dma_on; 129 hwif->ide_dma_on = &cs5520_dma_on;
143
144 /* ATAPI is harder so leave it for now */
145 hwif->atapi_dma = 0;
146 hwif->ultra_mask = 0;
147 hwif->swdma_mask = 0;
148 hwif->mwdma_mask = 0;
149} 130}
150 131
151#define DECLARE_CS_DEV(name_str) \ 132#define DECLARE_CS_DEV(name_str) \
152 { \ 133 { \
153 .name = name_str, \ 134 .name = name_str, \
154 .init_setup_dma = cs5520_init_setup_dma, \
155 .init_hwif = init_hwif_cs5520, \ 135 .init_hwif = init_hwif_cs5520, \
156 .autodma = AUTODMA, \
157 .bootable = ON_BOARD, \
158 .host_flags = IDE_HFLAG_ISA_PORTS | \ 136 .host_flags = IDE_HFLAG_ISA_PORTS | \
159 IDE_HFLAG_VDMA, \ 137 IDE_HFLAG_CS5520 | \
138 IDE_HFLAG_VDMA | \
139 IDE_HFLAG_NO_ATAPI_DMA | \
140 IDE_HFLAG_BOOTABLE, \
160 .pio_mask = ATA_PIO4, \ 141 .pio_mask = ATA_PIO4, \
161 } 142 }
162 143
163static ide_pci_device_t cyrix_chipsets[] __devinitdata = { 144static const struct ide_port_info cyrix_chipsets[] __devinitdata = {
164 /* 0 */ DECLARE_CS_DEV("Cyrix 5510"), 145 /* 0 */ DECLARE_CS_DEV("Cyrix 5510"),
165 /* 1 */ DECLARE_CS_DEV("Cyrix 5520") 146 /* 1 */ DECLARE_CS_DEV("Cyrix 5520")
166}; 147};
@@ -173,9 +154,8 @@ static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
173 154
174static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) 155static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id)
175{ 156{
176 ide_hwif_t *hwif = NULL, *mate = NULL; 157 const struct ide_port_info *d = &cyrix_chipsets[id->driver_data];
177 ata_index_t index; 158 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
178 ide_pci_device_t *d = &cyrix_chipsets[id->driver_data];
179 159
180 ide_setup_pci_noise(dev, d); 160 ide_setup_pci_noise(dev, d);
181 161
@@ -191,29 +171,14 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic
191 return -ENODEV; 171 return -ENODEV;
192 } 172 }
193 173
194 index.all = 0xf0f0;
195
196 /* 174 /*
197 * Now the chipset is configured we can let the core 175 * Now the chipset is configured we can let the core
198 * do all the device setup for us 176 * do all the device setup for us
199 */ 177 */
200 178
201 ide_pci_setup_ports(dev, d, 14, &index); 179 ide_pci_setup_ports(dev, d, 14, &idx[0]);
202
203 if ((index.b.low & 0xf0) != 0xf0)
204 hwif = &ide_hwifs[index.b.low];
205 if ((index.b.high & 0xf0) != 0xf0)
206 mate = &ide_hwifs[index.b.high];
207
208 if (hwif)
209 probe_hwif_init(hwif);
210 if (mate)
211 probe_hwif_init(mate);
212 180
213 if (hwif) 181 ide_device_add(idx);
214 ide_proc_register_port(hwif);
215 if (mate)
216 ide_proc_register_port(mate);
217 182
218 return 0; 183 return 0;
219} 184}
diff --git a/drivers/ide/pci/cs5530.c b/drivers/ide/pci/cs5530.c
index 0d23b8aabe9c..599408952bd4 100644
--- a/drivers/ide/pci/cs5530.c
+++ b/drivers/ide/pci/cs5530.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cs5530.c Version 0.76 Aug 3 2007 2 * linux/drivers/ide/pci/cs5530.c Version 0.77 Sep 24 2007
3 * 3 *
4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2000 Mark Lord <mlord@pobox.com>
@@ -146,7 +146,6 @@ static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode)
146static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name) 146static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const char *name)
147{ 147{
148 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; 148 struct pci_dev *master_0 = NULL, *cs5530_0 = NULL;
149 unsigned long flags;
150 149
151 if (pci_resource_start(dev, 4) == 0) 150 if (pci_resource_start(dev, 4) == 0)
152 return -EFAULT; 151 return -EFAULT;
@@ -171,9 +170,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
171 goto out; 170 goto out;
172 } 171 }
173 172
174 spin_lock_irqsave(&ide_lock, flags);
175 /* all CPUs (there should only be one CPU with this chipset) */
176
177 /* 173 /*
178 * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530: 174 * Enable BusMaster and MemoryWriteAndInvalidate for the cs5530:
179 * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530 175 * --> OR 0x14 into 16-bit PCI COMMAND reg of function 0 of the cs5530
@@ -224,8 +220,6 @@ static unsigned int __devinit init_chipset_cs5530 (struct pci_dev *dev, const ch
224 pci_write_config_byte(master_0, 0x42, 0x00); 220 pci_write_config_byte(master_0, 0x42, 0x00);
225 pci_write_config_byte(master_0, 0x43, 0xc1); 221 pci_write_config_byte(master_0, 0x43, 0xc1);
226 222
227 spin_unlock_irqrestore(&ide_lock, flags);
228
229out: 223out:
230 pci_dev_put(master_0); 224 pci_dev_put(master_0);
231 pci_dev_put(cs5530_0); 225 pci_dev_put(cs5530_0);
@@ -245,9 +239,6 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
245 unsigned long basereg; 239 unsigned long basereg;
246 u32 d0_timings; 240 u32 d0_timings;
247 241
248 if (hwif->mate)
249 hwif->serialized = hwif->mate->serialized = 1;
250
251 hwif->set_pio_mode = &cs5530_set_pio_mode; 242 hwif->set_pio_mode = &cs5530_set_pio_mode;
252 hwif->set_dma_mode = &cs5530_set_dma_mode; 243 hwif->set_dma_mode = &cs5530_set_dma_mode;
253 244
@@ -258,27 +249,22 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)
258 if (CS5530_BAD_PIO(inl(basereg + 8))) 249 if (CS5530_BAD_PIO(inl(basereg + 8)))
259 outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 8); 250 outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 8);
260 251
261 hwif->drives[0].autotune = 1;
262 hwif->drives[1].autotune = 1;
263
264 if (hwif->dma_base == 0) 252 if (hwif->dma_base == 0)
265 return; 253 return;
266 254
267 hwif->atapi_dma = 1;
268 hwif->ultra_mask = 0x07;
269 hwif->mwdma_mask = 0x07;
270
271 hwif->udma_filter = cs5530_udma_filter; 255 hwif->udma_filter = cs5530_udma_filter;
272} 256}
273 257
274static ide_pci_device_t cs5530_chipset __devinitdata = { 258static const struct ide_port_info cs5530_chipset __devinitdata = {
275 .name = "CS5530", 259 .name = "CS5530",
276 .init_chipset = init_chipset_cs5530, 260 .init_chipset = init_chipset_cs5530,
277 .init_hwif = init_hwif_cs5530, 261 .init_hwif = init_hwif_cs5530,
278 .autodma = AUTODMA, 262 .host_flags = IDE_HFLAG_SERIALIZE |
279 .bootable = ON_BOARD, 263 IDE_HFLAG_POST_SET_MODE |
264 IDE_HFLAG_BOOTABLE,
280 .pio_mask = ATA_PIO4, 265 .pio_mask = ATA_PIO4,
281 .host_flags = IDE_HFLAG_POST_SET_MODE, 266 .mwdma_mask = ATA_MWDMA2,
267 .udma_mask = ATA_UDMA2,
282}; 268};
283 269
284static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id) 270static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index e4891a16afef..9094916e3780 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -84,7 +84,7 @@ static void cs5535_set_speed(ide_drive_t *drive, const u8 speed)
84 84
85 /* Set the PIO timings */ 85 /* Set the PIO timings */
86 if ((speed & XFER_MODE) == XFER_PIO) { 86 if ((speed & XFER_MODE) == XFER_PIO) {
87 ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1]; 87 ide_drive_t *pair = ide_get_paired_drive(drive);
88 u8 cmd, pioa; 88 u8 cmd, pioa;
89 89
90 cmd = pioa = speed - XFER_PIO_0; 90 cmd = pioa = speed - XFER_PIO_0;
@@ -180,25 +180,20 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
180 hwif->set_pio_mode = &cs5535_set_pio_mode; 180 hwif->set_pio_mode = &cs5535_set_pio_mode;
181 hwif->set_dma_mode = &cs5535_set_dma_mode; 181 hwif->set_dma_mode = &cs5535_set_dma_mode;
182 182
183 hwif->drives[1].autotune = hwif->drives[0].autotune = 1;
184
185 if (hwif->dma_base == 0) 183 if (hwif->dma_base == 0)
186 return; 184 return;
187 185
188 hwif->atapi_dma = 1;
189 hwif->ultra_mask = 0x1F;
190 hwif->mwdma_mask = 0x07;
191
192 hwif->cbl = cs5535_cable_detect(hwif->pci_dev); 186 hwif->cbl = cs5535_cable_detect(hwif->pci_dev);
193} 187}
194 188
195static ide_pci_device_t cs5535_chipset __devinitdata = { 189static const struct ide_port_info cs5535_chipset __devinitdata = {
196 .name = "CS5535", 190 .name = "CS5535",
197 .init_hwif = init_hwif_cs5535, 191 .init_hwif = init_hwif_cs5535,
198 .autodma = AUTODMA, 192 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE |
199 .bootable = ON_BOARD, 193 IDE_HFLAG_BOOTABLE,
200 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE,
201 .pio_mask = ATA_PIO4, 194 .pio_mask = ATA_PIO4,
195 .mwdma_mask = ATA_MWDMA2,
196 .udma_mask = ATA_UDMA4,
202}; 197};
203 198
204static int __devinit cs5535_init_one(struct pci_dev *dev, 199static int __devinit cs5535_init_one(struct pci_dev *dev,
diff --git a/drivers/ide/pci/cy82c693.c b/drivers/ide/pci/cy82c693.c
index c498ecfd7fcb..3ef4fc10fe2c 100644
--- a/drivers/ide/pci/cy82c693.c
+++ b/drivers/ide/pci/cy82c693.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cy82c693.c Version 0.40 Sep. 10, 2002 2 * linux/drivers/ide/pci/cy82c693.c Version 0.41 Aug 27, 2007
3 * 3 *
4 * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer 4 * Copyright (C) 1998-2000 Andreas S. Krebs (akrebs@altavista.net), Maintainer
5 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator 5 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>, Integrator
@@ -428,18 +428,10 @@ static unsigned int __devinit init_chipset_cy82c693(struct pci_dev *dev, const c
428 */ 428 */
429static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) 429static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif)
430{ 430{
431 hwif->chipset = ide_cy82c693;
432 hwif->set_pio_mode = &cy82c693_set_pio_mode; 431 hwif->set_pio_mode = &cy82c693_set_pio_mode;
433 432
434 if (!hwif->dma_base) { 433 if (hwif->dma_base == 0)
435 hwif->drives[0].autotune = 1;
436 hwif->drives[1].autotune = 1;
437 return; 434 return;
438 }
439
440 hwif->atapi_dma = 1;
441 hwif->mwdma_mask = 0x04;
442 hwif->swdma_mask = 0x04;
443 435
444 hwif->ide_dma_on = &cy82c693_ide_dma_on; 436 hwif->ide_dma_on = &cy82c693_ide_dma_on;
445} 437}
@@ -456,15 +448,17 @@ static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
456 } 448 }
457} 449}
458 450
459static ide_pci_device_t cy82c693_chipset __devinitdata = { 451static const struct ide_port_info cy82c693_chipset __devinitdata = {
460 .name = "CY82C693", 452 .name = "CY82C693",
461 .init_chipset = init_chipset_cy82c693, 453 .init_chipset = init_chipset_cy82c693,
462 .init_iops = init_iops_cy82c693, 454 .init_iops = init_iops_cy82c693,
463 .init_hwif = init_hwif_cy82c693, 455 .init_hwif = init_hwif_cy82c693,
464 .autodma = AUTODMA, 456 .chipset = ide_cy82c693,
465 .bootable = ON_BOARD, 457 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA |
466 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_TRUST_BIOS_FOR_DMA, 458 IDE_HFLAG_BOOTABLE,
467 .pio_mask = ATA_PIO4, 459 .pio_mask = ATA_PIO4,
460 .swdma_mask = ATA_SWDMA2_ONLY,
461 .mwdma_mask = ATA_MWDMA2_ONLY,
468}; 462};
469 463
470static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id) 464static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c
index 46f4a888c037..83829081640a 100644
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -80,7 +80,7 @@ delkin_cb_probe (struct pci_dev *dev, const struct pci_device_id *id)
80 hw.irq = dev->irq; 80 hw.irq = dev->irq;
81 hw.chipset = ide_pci; /* this enables IRQ sharing */ 81 hw.chipset = ide_pci; /* this enables IRQ sharing */
82 82
83 rc = ide_register_hw_with_fixup(&hw, 0, &hwif, ide_undecoded_slave); 83 rc = ide_register_hw(&hw, &ide_undecoded_slave, 0, &hwif);
84 if (rc < 0) { 84 if (rc < 0) {
85 printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc); 85 printk(KERN_ERR "delkin_cb: ide_register_hw failed (%d)\n", rc);
86 pci_disable_device(dev); 86 pci_disable_device(dev);
diff --git a/drivers/ide/pci/generic.c b/drivers/ide/pci/generic.c
index cce6311b02df..f44d70852c3c 100644
--- a/drivers/ide/pci/generic.c
+++ b/drivers/ide/pci/generic.c
@@ -54,130 +54,61 @@ __setup("all-generic-ide", ide_generic_all_on);
54module_param_named(all_generic_ide, ide_generic_all, bool, 0444); 54module_param_named(all_generic_ide, ide_generic_all, bool, 0444);
55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers."); 55MODULE_PARM_DESC(all_generic_ide, "IDE generic will claim all unknown PCI IDE storage controllers.");
56 56
57static void __devinit init_hwif_generic (ide_hwif_t *hwif) 57#define IDE_HFLAGS_UMC (IDE_HFLAG_NO_DMA | IDE_HFLAG_FORCE_LEGACY_IRQS)
58{ 58
59 switch(hwif->pci_dev->device) { 59#define DECLARE_GENERIC_PCI_DEV(name_str, extra_flags) \
60 case PCI_DEVICE_ID_UMC_UM8673F: 60 { \
61 case PCI_DEVICE_ID_UMC_UM8886A: 61 .name = name_str, \
62 case PCI_DEVICE_ID_UMC_UM8886BF: 62 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA | \
63 hwif->irq = hwif->channel ? 15 : 14; 63 extra_flags | \
64 break; 64 IDE_HFLAG_BOOTABLE, \
65 default: 65 .swdma_mask = ATA_SWDMA2, \
66 break; 66 .mwdma_mask = ATA_MWDMA2, \
67 .udma_mask = ATA_UDMA6, \
67 } 68 }
68 69
69 if (!(hwif->dma_base)) 70static const struct ide_port_info generic_chipsets[] __devinitdata = {
70 return; 71 /* 0 */ DECLARE_GENERIC_PCI_DEV("Unknown", 0),
71
72 hwif->atapi_dma = 1;
73 hwif->ultra_mask = 0x7f;
74 hwif->mwdma_mask = 0x07;
75 hwif->swdma_mask = 0x07;
76}
77
78#if 0
79 /* Logic to add back later on */
80
81 if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
82 ide_pci_device_t *unknown = unknown_chipset;
83 init_setup_unknown(dev, unknown);
84 return 1;
85 }
86 return 0;
87#endif
88 72
89static ide_pci_device_t generic_chipsets[] __devinitdata = { 73 { /* 1 */
90 { /* 0 */
91 .name = "Unknown",
92 .init_hwif = init_hwif_generic,
93 .autodma = AUTODMA,
94 .bootable = ON_BOARD,
95 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
96 },{ /* 1 */
97 .name = "NS87410", 74 .name = "NS87410",
98 .init_hwif = init_hwif_generic,
99 .autodma = AUTODMA,
100 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, 75 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}},
101 .bootable = ON_BOARD, 76 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
102 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 77 IDE_HFLAG_BOOTABLE,
103 },{ /* 2 */ 78 .swdma_mask = ATA_SWDMA2,
104 .name = "SAMURAI", 79 .mwdma_mask = ATA_MWDMA2,
105 .init_hwif = init_hwif_generic, 80 .udma_mask = ATA_UDMA6,
106 .autodma = AUTODMA, 81 },
107 .bootable = ON_BOARD, 82
108 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 83 /* 2 */ DECLARE_GENERIC_PCI_DEV("SAMURAI", 0),
109 },{ /* 3 */ 84 /* 3 */ DECLARE_GENERIC_PCI_DEV("HT6565", 0),
110 .name = "HT6565", 85 /* 4 */ DECLARE_GENERIC_PCI_DEV("UM8673F", IDE_HFLAGS_UMC),
111 .init_hwif = init_hwif_generic, 86 /* 5 */ DECLARE_GENERIC_PCI_DEV("UM8886A", IDE_HFLAGS_UMC),
112 .autodma = AUTODMA, 87 /* 6 */ DECLARE_GENERIC_PCI_DEV("UM8886BF", IDE_HFLAGS_UMC),
113 .bootable = ON_BOARD, 88 /* 7 */ DECLARE_GENERIC_PCI_DEV("HINT_IDE", 0),
114 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 89 /* 8 */ DECLARE_GENERIC_PCI_DEV("VIA_IDE", IDE_HFLAG_NO_AUTODMA),
115 },{ /* 4 */ 90 /* 9 */ DECLARE_GENERIC_PCI_DEV("OPTI621V", IDE_HFLAG_NO_AUTODMA),
116 .name = "UM8673F", 91
117 .init_hwif = init_hwif_generic, 92 { /* 10 */
118 .autodma = NODMA,
119 .bootable = ON_BOARD,
120 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
121 },{ /* 5 */
122 .name = "UM8886A",
123 .init_hwif = init_hwif_generic,
124 .autodma = NODMA,
125 .bootable = ON_BOARD,
126 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
127 },{ /* 6 */
128 .name = "UM8886BF",
129 .init_hwif = init_hwif_generic,
130 .autodma = NODMA,
131 .bootable = ON_BOARD,
132 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
133 },{ /* 7 */
134 .name = "HINT_IDE",
135 .init_hwif = init_hwif_generic,
136 .autodma = AUTODMA,
137 .bootable = ON_BOARD,
138 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
139 },{ /* 8 */
140 .name = "VIA_IDE",
141 .init_hwif = init_hwif_generic,
142 .autodma = NOAUTODMA,
143 .bootable = ON_BOARD,
144 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
145 },{ /* 9 */
146 .name = "OPTI621V",
147 .init_hwif = init_hwif_generic,
148 .autodma = NOAUTODMA,
149 .bootable = ON_BOARD,
150 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
151 },{ /* 10 */
152 .name = "VIA8237SATA", 93 .name = "VIA8237SATA",
153 .init_hwif = init_hwif_generic, 94 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
154 .autodma = AUTODMA, 95 IDE_HFLAG_OFF_BOARD,
155 .bootable = OFF_BOARD, 96 .swdma_mask = ATA_SWDMA2,
156 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 97 .mwdma_mask = ATA_MWDMA2,
157 },{ /* 11 */ 98 .udma_mask = ATA_UDMA6,
158 .name = "Piccolo0102", 99 },
159 .init_hwif = init_hwif_generic, 100
160 .autodma = NOAUTODMA, 101 /* 11 */ DECLARE_GENERIC_PCI_DEV("Piccolo0102", IDE_HFLAG_NO_AUTODMA),
161 .bootable = ON_BOARD, 102 /* 12 */ DECLARE_GENERIC_PCI_DEV("Piccolo0103", IDE_HFLAG_NO_AUTODMA),
162 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 103 /* 13 */ DECLARE_GENERIC_PCI_DEV("Piccolo0105", IDE_HFLAG_NO_AUTODMA),
163 },{ /* 12 */ 104
164 .name = "Piccolo0103", 105 { /* 14 */
165 .init_hwif = init_hwif_generic,
166 .autodma = NOAUTODMA,
167 .bootable = ON_BOARD,
168 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
169 },{ /* 13 */
170 .name = "Piccolo0105",
171 .init_hwif = init_hwif_generic,
172 .autodma = NOAUTODMA,
173 .bootable = ON_BOARD,
174 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA,
175 },{ /* 14 */
176 .name = "Revolution", 106 .name = "Revolution",
177 .init_hwif = init_hwif_generic, 107 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
178 .autodma = AUTODMA, 108 IDE_HFLAG_OFF_BOARD,
179 .bootable = OFF_BOARD, 109 .swdma_mask = ATA_SWDMA2,
180 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 110 .mwdma_mask = ATA_MWDMA2,
111 .udma_mask = ATA_UDMA6,
181 } 112 }
182}; 113};
183 114
@@ -192,7 +123,7 @@ static ide_pci_device_t generic_chipsets[] __devinitdata = {
192 123
193static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) 124static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id)
194{ 125{
195 ide_pci_device_t *d = &generic_chipsets[id->driver_data]; 126 const struct ide_port_info *d = &generic_chipsets[id->driver_data];
196 int ret = -ENODEV; 127 int ret = -ENODEV;
197 128
198 /* Don't use the generic entry unless instructed to do so */ 129 /* Don't use the generic entry unless instructed to do so */
diff --git a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
index 44ac0e2f7a09..ae6307fae4f9 100644
--- a/drivers/ide/pci/hpt34x.c
+++ b/drivers/ide/pci/hpt34x.c
@@ -125,49 +125,45 @@ static unsigned int __devinit init_chipset_hpt34x(struct pci_dev *dev, const cha
125 125
126static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) 126static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif)
127{ 127{
128 u16 pcicmd = 0;
129
130 hwif->set_pio_mode = &hpt34x_set_pio_mode; 128 hwif->set_pio_mode = &hpt34x_set_pio_mode;
131 hwif->set_dma_mode = &hpt34x_set_mode; 129 hwif->set_dma_mode = &hpt34x_set_mode;
130}
132 131
133 hwif->drives[0].autotune = 1; 132static const struct ide_port_info hpt34x_chipsets[] __devinitdata = {
134 hwif->drives[1].autotune = 1; 133 { /* 0 */
135 134 .name = "HPT343",
136 pci_read_config_word(hwif->pci_dev, PCI_COMMAND, &pcicmd); 135 .init_chipset = init_chipset_hpt34x,
137 136 .init_hwif = init_hwif_hpt34x,
138 if (!hwif->dma_base) 137 .extra = 16,
139 return; 138 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
140 139 IDE_HFLAG_NO_AUTODMA,
140 .pio_mask = ATA_PIO5,
141 },
142 { /* 1 */
143 .name = "HPT345",
144 .init_chipset = init_chipset_hpt34x,
145 .init_hwif = init_hwif_hpt34x,
146 .extra = 16,
147 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
148 IDE_HFLAG_NO_AUTODMA |
149 IDE_HFLAG_OFF_BOARD,
150 .pio_mask = ATA_PIO5,
141#ifdef CONFIG_HPT34X_AUTODMA 151#ifdef CONFIG_HPT34X_AUTODMA
142 if ((pcicmd & PCI_COMMAND_MEMORY) == 0) 152 .swdma_mask = ATA_SWDMA2,
143 return; 153 .mwdma_mask = ATA_MWDMA2,
144 154 .udma_mask = ATA_UDMA2,
145 hwif->ultra_mask = 0x07;
146 hwif->mwdma_mask = 0x07;
147 hwif->swdma_mask = 0x07;
148#endif 155#endif
149} 156 }
150
151static ide_pci_device_t hpt34x_chipset __devinitdata = {
152 .name = "HPT34X",
153 .init_chipset = init_chipset_hpt34x,
154 .init_hwif = init_hwif_hpt34x,
155 .autodma = NOAUTODMA,
156 .bootable = NEVER_BOARD,
157 .extra = 16,
158 .pio_mask = ATA_PIO5,
159}; 157};
160 158
161static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 159static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
162{ 160{
163 ide_pci_device_t *d = &hpt34x_chipset; 161 const struct ide_port_info *d;
164 static char *chipset_names[] = {"HPT343", "HPT345"};
165 u16 pcicmd = 0; 162 u16 pcicmd = 0;
166 163
167 pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 164 pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
168 165
169 d->name = chipset_names[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0]; 166 d = &hpt34x_chipsets[(pcicmd & PCI_COMMAND_MEMORY) ? 1 : 0];
170 d->bootable = (pcicmd & PCI_COMMAND_MEMORY) ? OFF_BOARD : NEVER_BOARD;
171 167
172 return ide_setup_pci_device(dev, d); 168 return ide_setup_pci_device(dev, d);
173} 169}
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index fcb21ddab2cc..612b795241bf 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.14 Oct 1, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.20 Oct 1, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
6 * Portions Copyright (C) 2003 Red Hat Inc 6 * Portions Copyright (C) 2003 Red Hat Inc
7 * Portions Copyright (C) 2007 Bartlomiej Zolnierkiewicz
7 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc. 8 * Portions Copyright (C) 2005-2007 MontaVista Software, Inc.
8 * 9 *
9 * Thanks to HighPoint Technologies for their assistance, and hardware. 10 * Thanks to HighPoint Technologies for their assistance, and hardware.
@@ -393,8 +394,9 @@ enum ata_clock {
393 */ 394 */
394 395
395struct hpt_info { 396struct hpt_info {
397 char *chip_name; /* Chip name */
396 u8 chip_type; /* Chip type */ 398 u8 chip_type; /* Chip type */
397 u8 max_ultra; /* Max. UltraDMA mode allowed */ 399 u8 udma_mask; /* Allowed UltraDMA modes mask. */
398 u8 dpll_clk; /* DPLL clock in MHz */ 400 u8 dpll_clk; /* DPLL clock in MHz */
399 u8 pci_clk; /* PCI clock in MHz */ 401 u8 pci_clk; /* PCI clock in MHz */
400 u32 **settings; /* Chipset settings table */ 402 u32 **settings; /* Chipset settings table */
@@ -432,78 +434,89 @@ static u32 *hpt37x_settings[NUM_ATA_CLOCKS] = {
432}; 434};
433 435
434static struct hpt_info hpt36x __devinitdata = { 436static struct hpt_info hpt36x __devinitdata = {
437 .chip_name = "HPT36x",
435 .chip_type = HPT36x, 438 .chip_type = HPT36x,
436 .max_ultra = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? 4 : 3) : 2, 439 .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2,
437 .dpll_clk = 0, /* no DPLL */ 440 .dpll_clk = 0, /* no DPLL */
438 .settings = hpt36x_settings 441 .settings = hpt36x_settings
439}; 442};
440 443
441static struct hpt_info hpt370 __devinitdata = { 444static struct hpt_info hpt370 __devinitdata = {
445 .chip_name = "HPT370",
442 .chip_type = HPT370, 446 .chip_type = HPT370,
443 .max_ultra = HPT370_ALLOW_ATA100_5 ? 5 : 4, 447 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
444 .dpll_clk = 48, 448 .dpll_clk = 48,
445 .settings = hpt37x_settings 449 .settings = hpt37x_settings
446}; 450};
447 451
448static struct hpt_info hpt370a __devinitdata = { 452static struct hpt_info hpt370a __devinitdata = {
453 .chip_name = "HPT370A",
449 .chip_type = HPT370A, 454 .chip_type = HPT370A,
450 .max_ultra = HPT370_ALLOW_ATA100_5 ? 5 : 4, 455 .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4,
451 .dpll_clk = 48, 456 .dpll_clk = 48,
452 .settings = hpt37x_settings 457 .settings = hpt37x_settings
453}; 458};
454 459
455static struct hpt_info hpt374 __devinitdata = { 460static struct hpt_info hpt374 __devinitdata = {
461 .chip_name = "HPT374",
456 .chip_type = HPT374, 462 .chip_type = HPT374,
457 .max_ultra = 5, 463 .udma_mask = ATA_UDMA5,
458 .dpll_clk = 48, 464 .dpll_clk = 48,
459 .settings = hpt37x_settings 465 .settings = hpt37x_settings
460}; 466};
461 467
462static struct hpt_info hpt372 __devinitdata = { 468static struct hpt_info hpt372 __devinitdata = {
469 .chip_name = "HPT372",
463 .chip_type = HPT372, 470 .chip_type = HPT372,
464 .max_ultra = HPT372_ALLOW_ATA133_6 ? 6 : 5, 471 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
465 .dpll_clk = 55, 472 .dpll_clk = 55,
466 .settings = hpt37x_settings 473 .settings = hpt37x_settings
467}; 474};
468 475
469static struct hpt_info hpt372a __devinitdata = { 476static struct hpt_info hpt372a __devinitdata = {
477 .chip_name = "HPT372A",
470 .chip_type = HPT372A, 478 .chip_type = HPT372A,
471 .max_ultra = HPT372_ALLOW_ATA133_6 ? 6 : 5, 479 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
472 .dpll_clk = 66, 480 .dpll_clk = 66,
473 .settings = hpt37x_settings 481 .settings = hpt37x_settings
474}; 482};
475 483
476static struct hpt_info hpt302 __devinitdata = { 484static struct hpt_info hpt302 __devinitdata = {
485 .chip_name = "HPT302",
477 .chip_type = HPT302, 486 .chip_type = HPT302,
478 .max_ultra = HPT372_ALLOW_ATA133_6 ? 6 : 5, 487 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
479 .dpll_clk = 66, 488 .dpll_clk = 66,
480 .settings = hpt37x_settings 489 .settings = hpt37x_settings
481}; 490};
482 491
483static struct hpt_info hpt371 __devinitdata = { 492static struct hpt_info hpt371 __devinitdata = {
493 .chip_name = "HPT371",
484 .chip_type = HPT371, 494 .chip_type = HPT371,
485 .max_ultra = HPT371_ALLOW_ATA133_6 ? 6 : 5, 495 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
486 .dpll_clk = 66, 496 .dpll_clk = 66,
487 .settings = hpt37x_settings 497 .settings = hpt37x_settings
488}; 498};
489 499
490static struct hpt_info hpt372n __devinitdata = { 500static struct hpt_info hpt372n __devinitdata = {
501 .chip_name = "HPT372N",
491 .chip_type = HPT372N, 502 .chip_type = HPT372N,
492 .max_ultra = HPT372_ALLOW_ATA133_6 ? 6 : 5, 503 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
493 .dpll_clk = 77, 504 .dpll_clk = 77,
494 .settings = hpt37x_settings 505 .settings = hpt37x_settings
495}; 506};
496 507
497static struct hpt_info hpt302n __devinitdata = { 508static struct hpt_info hpt302n __devinitdata = {
509 .chip_name = "HPT302N",
498 .chip_type = HPT302N, 510 .chip_type = HPT302N,
499 .max_ultra = HPT302_ALLOW_ATA133_6 ? 6 : 5, 511 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
500 .dpll_clk = 77, 512 .dpll_clk = 77,
501 .settings = hpt37x_settings 513 .settings = hpt37x_settings
502}; 514};
503 515
504static struct hpt_info hpt371n __devinitdata = { 516static struct hpt_info hpt371n __devinitdata = {
517 .chip_name = "HPT371N",
505 .chip_type = HPT371N, 518 .chip_type = HPT371N,
506 .max_ultra = HPT371_ALLOW_ATA133_6 ? 6 : 5, 519 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
507 .dpll_clk = 77, 520 .dpll_clk = 77,
508 .settings = hpt37x_settings 521 .settings = hpt37x_settings
509}; 522};
@@ -676,12 +689,11 @@ static int hpt3xx_quirkproc(ide_drive_t *drive)
676 689
677static void hpt3xx_intrproc(ide_drive_t *drive) 690static void hpt3xx_intrproc(ide_drive_t *drive)
678{ 691{
679 ide_hwif_t *hwif = HWIF(drive);
680
681 if (drive->quirk_list) 692 if (drive->quirk_list)
682 return; 693 return;
694
683 /* drives in the quirk_list may not like intr setups/cleanups */ 695 /* drives in the quirk_list may not like intr setups/cleanups */
684 hwif->OUTB(drive->ctl | 2, IDE_CONTROL_REG); 696 outb(drive->ctl | 2, IDE_CONTROL_REG);
685} 697}
686 698
687static void hpt3xx_maskproc(ide_drive_t *drive, int mask) 699static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
@@ -709,8 +721,8 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
709 enable_irq (hwif->irq); 721 enable_irq (hwif->irq);
710 } 722 }
711 } else 723 } else
712 hwif->OUTB(mask ? (drive->ctl | 2) : (drive->ctl & ~2), 724 outb(mask ? (drive->ctl | 2) : (drive->ctl & ~2),
713 IDE_CONTROL_REG); 725 IDE_CONTROL_REG);
714} 726}
715 727
716/* 728/*
@@ -750,9 +762,9 @@ static void hpt370_irq_timeout(ide_drive_t *drive)
750 printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); 762 printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff);
751 763
752 /* get DMA command mode */ 764 /* get DMA command mode */
753 dma_cmd = hwif->INB(hwif->dma_command); 765 dma_cmd = inb(hwif->dma_command);
754 /* stop DMA */ 766 /* stop DMA */
755 hwif->OUTB(dma_cmd & ~0x1, hwif->dma_command); 767 outb(dma_cmd & ~0x1, hwif->dma_command);
756 hpt370_clear_engine(drive); 768 hpt370_clear_engine(drive);
757} 769}
758 770
@@ -767,12 +779,12 @@ static void hpt370_ide_dma_start(ide_drive_t *drive)
767static int hpt370_ide_dma_end(ide_drive_t *drive) 779static int hpt370_ide_dma_end(ide_drive_t *drive)
768{ 780{
769 ide_hwif_t *hwif = HWIF(drive); 781 ide_hwif_t *hwif = HWIF(drive);
770 u8 dma_stat = hwif->INB(hwif->dma_status); 782 u8 dma_stat = inb(hwif->dma_status);
771 783
772 if (dma_stat & 0x01) { 784 if (dma_stat & 0x01) {
773 /* wait a little */ 785 /* wait a little */
774 udelay(20); 786 udelay(20);
775 dma_stat = hwif->INB(hwif->dma_status); 787 dma_stat = inb(hwif->dma_status);
776 if (dma_stat & 0x01) 788 if (dma_stat & 0x01)
777 hpt370_irq_timeout(drive); 789 hpt370_irq_timeout(drive);
778 } 790 }
@@ -833,34 +845,32 @@ static int hpt374_ide_dma_end(ide_drive_t *drive)
833 845
834static void hpt3xxn_set_clock(ide_hwif_t *hwif, u8 mode) 846static void hpt3xxn_set_clock(ide_hwif_t *hwif, u8 mode)
835{ 847{
836 u8 scr2 = hwif->INB(hwif->dma_master + 0x7b); 848 u8 scr2 = inb(hwif->dma_master + 0x7b);
837 849
838 if ((scr2 & 0x7f) == mode) 850 if ((scr2 & 0x7f) == mode)
839 return; 851 return;
840 852
841 /* Tristate the bus */ 853 /* Tristate the bus */
842 hwif->OUTB(0x80, hwif->dma_master + 0x73); 854 outb(0x80, hwif->dma_master + 0x73);
843 hwif->OUTB(0x80, hwif->dma_master + 0x77); 855 outb(0x80, hwif->dma_master + 0x77);
844 856
845 /* Switch clock and reset channels */ 857 /* Switch clock and reset channels */
846 hwif->OUTB(mode, hwif->dma_master + 0x7b); 858 outb(mode, hwif->dma_master + 0x7b);
847 hwif->OUTB(0xc0, hwif->dma_master + 0x79); 859 outb(0xc0, hwif->dma_master + 0x79);
848 860
849 /* 861 /*
850 * Reset the state machines. 862 * Reset the state machines.
851 * NOTE: avoid accidentally enabling the disabled channels. 863 * NOTE: avoid accidentally enabling the disabled channels.
852 */ 864 */
853 hwif->OUTB(hwif->INB(hwif->dma_master + 0x70) | 0x32, 865 outb(inb(hwif->dma_master + 0x70) | 0x32, hwif->dma_master + 0x70);
854 hwif->dma_master + 0x70); 866 outb(inb(hwif->dma_master + 0x74) | 0x32, hwif->dma_master + 0x74);
855 hwif->OUTB(hwif->INB(hwif->dma_master + 0x74) | 0x32,
856 hwif->dma_master + 0x74);
857 867
858 /* Complete reset */ 868 /* Complete reset */
859 hwif->OUTB(0x00, hwif->dma_master + 0x79); 869 outb(0x00, hwif->dma_master + 0x79);
860 870
861 /* Reconnect channels to bus */ 871 /* Reconnect channels to bus */
862 hwif->OUTB(0x00, hwif->dma_master + 0x73); 872 outb(0x00, hwif->dma_master + 0x73);
863 hwif->OUTB(0x00, hwif->dma_master + 0x77); 873 outb(0x00, hwif->dma_master + 0x77);
864} 874}
865 875
866/** 876/**
@@ -1139,7 +1149,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha
1139 * Select 66 MHz DPLL clock only if UltraATA/133 mode is 1149 * Select 66 MHz DPLL clock only if UltraATA/133 mode is
1140 * supported/enabled, use 50 MHz DPLL clock otherwise... 1150 * supported/enabled, use 50 MHz DPLL clock otherwise...
1141 */ 1151 */
1142 if (info->max_ultra == 6) { 1152 if (info->udma_mask == ATA_UDMA6) {
1143 dpll_clk = 66; 1153 dpll_clk = 66;
1144 clock = ATA_CLOCK_66MHZ; 1154 clock = ATA_CLOCK_66MHZ;
1145 } else if (dpll_clk) { /* HPT36x chips don't have DPLL */ 1155 } else if (dpll_clk) { /* HPT36x chips don't have DPLL */
@@ -1291,14 +1301,9 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1291 if (new_mcr != old_mcr) 1301 if (new_mcr != old_mcr)
1292 pci_write_config_byte(dev, hwif->select_data + 1, new_mcr); 1302 pci_write_config_byte(dev, hwif->select_data + 1, new_mcr);
1293 1303
1294 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
1295
1296 if (hwif->dma_base == 0) 1304 if (hwif->dma_base == 0)
1297 return; 1305 return;
1298 1306
1299 hwif->ultra_mask = hwif->cds->udma_mask;
1300 hwif->mwdma_mask = 0x07;
1301
1302 /* 1307 /*
1303 * The HPT37x uses the CBLID pins as outputs for MA15/MA16 1308 * The HPT37x uses the CBLID pins as outputs for MA15/MA16
1304 * address lines to access an external EEPROM. To read valid 1309 * address lines to access an external EEPROM. To read valid
@@ -1354,7 +1359,7 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
1354 u8 dma_new = 0, dma_old = 0; 1359 u8 dma_new = 0, dma_old = 0;
1355 unsigned long flags; 1360 unsigned long flags;
1356 1361
1357 dma_old = hwif->INB(dmabase + 2); 1362 dma_old = inb(dmabase + 2);
1358 1363
1359 local_irq_save(flags); 1364 local_irq_save(flags);
1360 1365
@@ -1365,60 +1370,26 @@ static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase)
1365 if (masterdma & 0x30) dma_new |= 0x20; 1370 if (masterdma & 0x30) dma_new |= 0x20;
1366 if ( slavedma & 0x30) dma_new |= 0x40; 1371 if ( slavedma & 0x30) dma_new |= 0x40;
1367 if (dma_new != dma_old) 1372 if (dma_new != dma_old)
1368 hwif->OUTB(dma_new, dmabase + 2); 1373 outb(dma_new, dmabase + 2);
1369 1374
1370 local_irq_restore(flags); 1375 local_irq_restore(flags);
1371 1376
1372 ide_setup_dma(hwif, dmabase, 8); 1377 ide_setup_dma(hwif, dmabase, 8);
1373} 1378}
1374 1379
1375static int __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d) 1380static void __devinit hpt374_init(struct pci_dev *dev, struct pci_dev *dev2)
1376{ 1381{
1377 struct pci_dev *dev2; 1382 if (dev2->irq != dev->irq) {
1378 1383 /* FIXME: we need a core pci_set_interrupt() */
1379 if (PCI_FUNC(dev->devfn) & 1) 1384 dev2->irq = dev->irq;
1380 return -ENODEV; 1385 printk(KERN_INFO "HPT374: PCI config space interrupt fixed\n");
1381
1382 pci_set_drvdata(dev, &hpt374);
1383
1384 if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) {
1385 int ret;
1386
1387 pci_set_drvdata(dev2, &hpt374);
1388
1389 if (dev2->irq != dev->irq) {
1390 /* FIXME: we need a core pci_set_interrupt() */
1391 dev2->irq = dev->irq;
1392 printk(KERN_WARNING "%s: PCI config space interrupt "
1393 "fixed.\n", d->name);
1394 }
1395 ret = ide_setup_pci_devices(dev, dev2, d);
1396 if (ret < 0)
1397 pci_dev_put(dev2);
1398 return ret;
1399 } 1386 }
1400 return ide_setup_pci_device(dev, d);
1401}
1402
1403static int __devinit init_setup_hpt372n(struct pci_dev *dev, ide_pci_device_t *d)
1404{
1405 pci_set_drvdata(dev, &hpt372n);
1406
1407 return ide_setup_pci_device(dev, d);
1408} 1387}
1409 1388
1410static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d) 1389static void __devinit hpt371_init(struct pci_dev *dev)
1411{ 1390{
1412 struct hpt_info *info;
1413 u8 mcr1 = 0; 1391 u8 mcr1 = 0;
1414 1392
1415 if (dev->revision > 1) {
1416 d->name = "HPT371N";
1417
1418 info = &hpt371n;
1419 } else
1420 info = &hpt371;
1421
1422 /* 1393 /*
1423 * HPT371 chips physically have only one channel, the secondary one, 1394 * HPT371 chips physically have only one channel, the secondary one,
1424 * but the primary channel registers do exist! Go figure... 1395 * but the primary channel registers do exist! Go figure...
@@ -1428,194 +1399,102 @@ static int __devinit init_setup_hpt371(struct pci_dev *dev, ide_pci_device_t *d)
1428 pci_read_config_byte(dev, 0x50, &mcr1); 1399 pci_read_config_byte(dev, 0x50, &mcr1);
1429 if (mcr1 & 0x04) 1400 if (mcr1 & 0x04)
1430 pci_write_config_byte(dev, 0x50, mcr1 & ~0x04); 1401 pci_write_config_byte(dev, 0x50, mcr1 & ~0x04);
1431
1432 pci_set_drvdata(dev, info);
1433
1434 return ide_setup_pci_device(dev, d);
1435} 1402}
1436 1403
1437static int __devinit init_setup_hpt372a(struct pci_dev *dev, ide_pci_device_t *d) 1404static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2)
1438{ 1405{
1439 struct hpt_info *info; 1406 u8 mcr1 = 0, pin1 = 0, pin2 = 0;
1440
1441 if (dev->revision > 1) {
1442 d->name = "HPT372N";
1443 1407
1444 info = &hpt372n; 1408 /*
1445 } else 1409 * Now we'll have to force both channels enabled if
1446 info = &hpt372a; 1410 * at least one of them has been enabled by BIOS...
1447 pci_set_drvdata(dev, info); 1411 */
1448 1412 pci_read_config_byte(dev, 0x50, &mcr1);
1449 return ide_setup_pci_device(dev, d); 1413 if (mcr1 & 0x30)
1450} 1414 pci_write_config_byte(dev, 0x50, mcr1 | 0x30);
1451
1452static int __devinit init_setup_hpt302(struct pci_dev *dev, ide_pci_device_t *d)
1453{
1454 struct hpt_info *info;
1455 1415
1456 if (dev->revision > 1) { 1416 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin1);
1457 d->name = "HPT302N"; 1417 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2);
1458 1418
1459 info = &hpt302n; 1419 if (pin1 != pin2 && dev->irq == dev2->irq) {
1460 } else 1420 printk(KERN_INFO "HPT36x: onboard version of chipset, "
1461 info = &hpt302; 1421 "pin1=%d pin2=%d\n", pin1, pin2);
1462 pci_set_drvdata(dev, info); 1422 return 1;
1423 }
1463 1424
1464 return ide_setup_pci_device(dev, d); 1425 return 0;
1465} 1426}
1466 1427
1467static int __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d) 1428static const struct ide_port_info hpt366_chipsets[] __devinitdata = {
1468{ 1429 { /* 0 */
1469 struct pci_dev *dev2; 1430 .name = "HPT36x",
1470 u8 rev = dev->revision; 1431 .init_chipset = init_chipset_hpt366,
1471 static char *chipset_names[] = { "HPT366", "HPT366", "HPT368", 1432 .init_hwif = init_hwif_hpt366,
1472 "HPT370", "HPT370A", "HPT372", 1433 .init_dma = init_dma_hpt366,
1473 "HPT372N" };
1474 static struct hpt_info *info[] = { &hpt36x, &hpt36x, &hpt36x,
1475 &hpt370, &hpt370a, &hpt372,
1476 &hpt372n };
1477
1478 if (PCI_FUNC(dev->devfn) & 1)
1479 return -ENODEV;
1480
1481 switch (rev) {
1482 case 0:
1483 case 1:
1484 case 2:
1485 /* 1434 /*
1486 * HPT36x chips have one channel per function and have 1435 * HPT36x chips have one channel per function and have
1487 * both channel enable bits located differently and visible 1436 * both channel enable bits located differently and visible
1488 * to both functions -- really stupid design decision... :-( 1437 * to both functions -- really stupid design decision... :-(
1489 * Bit 4 is for the primary channel, bit 5 for the secondary. 1438 * Bit 4 is for the primary channel, bit 5 for the secondary.
1490 */ 1439 */
1491 d->host_flags |= IDE_HFLAG_SINGLE; 1440 .enablebits = {{0x50,0x10,0x10}, {0x54,0x04,0x04}},
1492 d->enablebits[0].mask = d->enablebits[0].val = 0x10;
1493
1494 d->udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ?
1495 ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2;
1496 break;
1497 case 3:
1498 case 4:
1499 d->udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4;
1500 break;
1501 default:
1502 rev = 6;
1503 /* fall thru */
1504 case 5:
1505 case 6:
1506 d->udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5;
1507 break;
1508 }
1509
1510 d->name = chipset_names[rev];
1511
1512 pci_set_drvdata(dev, info[rev]);
1513
1514 if (rev > 2)
1515 goto init_single;
1516
1517 if ((dev2 = pci_get_slot(dev->bus, dev->devfn + 1)) != NULL) {
1518 u8 mcr1 = 0, pin1 = 0, pin2 = 0;
1519 int ret;
1520
1521 pci_set_drvdata(dev2, info[rev]);
1522
1523 /*
1524 * Now we'll have to force both channels enabled if
1525 * at least one of them has been enabled by BIOS...
1526 */
1527 pci_read_config_byte(dev, 0x50, &mcr1);
1528 if (mcr1 & 0x30)
1529 pci_write_config_byte(dev, 0x50, mcr1 | 0x30);
1530
1531 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin1);
1532 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin2);
1533 if (pin1 != pin2 && dev->irq == dev2->irq) {
1534 d->bootable = ON_BOARD;
1535 printk("%s: onboard version of chipset, pin1=%d pin2=%d\n",
1536 d->name, pin1, pin2);
1537 }
1538 ret = ide_setup_pci_devices(dev, dev2, d);
1539 if (ret < 0)
1540 pci_dev_put(dev2);
1541 return ret;
1542 }
1543init_single:
1544 return ide_setup_pci_device(dev, d);
1545}
1546
1547static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1548 { /* 0 */
1549 .name = "HPT366",
1550 .init_setup = init_setup_hpt366,
1551 .init_chipset = init_chipset_hpt366,
1552 .init_hwif = init_hwif_hpt366,
1553 .init_dma = init_dma_hpt366,
1554 .autodma = AUTODMA,
1555 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1556 .bootable = OFF_BOARD,
1557 .extra = 240, 1441 .extra = 240,
1442 .host_flags = IDE_HFLAG_SINGLE |
1443 IDE_HFLAG_NO_ATAPI_DMA |
1444 IDE_HFLAG_OFF_BOARD,
1558 .pio_mask = ATA_PIO4, 1445 .pio_mask = ATA_PIO4,
1446 .mwdma_mask = ATA_MWDMA2,
1559 },{ /* 1 */ 1447 },{ /* 1 */
1560 .name = "HPT372A", 1448 .name = "HPT372A",
1561 .init_setup = init_setup_hpt372a,
1562 .init_chipset = init_chipset_hpt366, 1449 .init_chipset = init_chipset_hpt366,
1563 .init_hwif = init_hwif_hpt366, 1450 .init_hwif = init_hwif_hpt366,
1564 .init_dma = init_dma_hpt366, 1451 .init_dma = init_dma_hpt366,
1565 .autodma = AUTODMA,
1566 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1452 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1567 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1568 .bootable = OFF_BOARD,
1569 .extra = 240, 1453 .extra = 240,
1454 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
1570 .pio_mask = ATA_PIO4, 1455 .pio_mask = ATA_PIO4,
1456 .mwdma_mask = ATA_MWDMA2,
1571 },{ /* 2 */ 1457 },{ /* 2 */
1572 .name = "HPT302", 1458 .name = "HPT302",
1573 .init_setup = init_setup_hpt302,
1574 .init_chipset = init_chipset_hpt366, 1459 .init_chipset = init_chipset_hpt366,
1575 .init_hwif = init_hwif_hpt366, 1460 .init_hwif = init_hwif_hpt366,
1576 .init_dma = init_dma_hpt366, 1461 .init_dma = init_dma_hpt366,
1577 .autodma = AUTODMA,
1578 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1462 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1579 .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1580 .bootable = OFF_BOARD,
1581 .extra = 240, 1463 .extra = 240,
1464 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
1582 .pio_mask = ATA_PIO4, 1465 .pio_mask = ATA_PIO4,
1466 .mwdma_mask = ATA_MWDMA2,
1583 },{ /* 3 */ 1467 },{ /* 3 */
1584 .name = "HPT371", 1468 .name = "HPT371",
1585 .init_setup = init_setup_hpt371,
1586 .init_chipset = init_chipset_hpt366, 1469 .init_chipset = init_chipset_hpt366,
1587 .init_hwif = init_hwif_hpt366, 1470 .init_hwif = init_hwif_hpt366,
1588 .init_dma = init_dma_hpt366, 1471 .init_dma = init_dma_hpt366,
1589 .autodma = AUTODMA,
1590 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1472 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1591 .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1592 .bootable = OFF_BOARD,
1593 .extra = 240, 1473 .extra = 240,
1474 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
1594 .pio_mask = ATA_PIO4, 1475 .pio_mask = ATA_PIO4,
1476 .mwdma_mask = ATA_MWDMA2,
1595 },{ /* 4 */ 1477 },{ /* 4 */
1596 .name = "HPT374", 1478 .name = "HPT374",
1597 .init_setup = init_setup_hpt374,
1598 .init_chipset = init_chipset_hpt366, 1479 .init_chipset = init_chipset_hpt366,
1599 .init_hwif = init_hwif_hpt366, 1480 .init_hwif = init_hwif_hpt366,
1600 .init_dma = init_dma_hpt366, 1481 .init_dma = init_dma_hpt366,
1601 .autodma = AUTODMA,
1602 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1482 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1603 .udma_mask = ATA_UDMA5, 1483 .udma_mask = ATA_UDMA5,
1604 .bootable = OFF_BOARD,
1605 .extra = 240, 1484 .extra = 240,
1485 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
1606 .pio_mask = ATA_PIO4, 1486 .pio_mask = ATA_PIO4,
1487 .mwdma_mask = ATA_MWDMA2,
1607 },{ /* 5 */ 1488 },{ /* 5 */
1608 .name = "HPT372N", 1489 .name = "HPT372N",
1609 .init_setup = init_setup_hpt372n,
1610 .init_chipset = init_chipset_hpt366, 1490 .init_chipset = init_chipset_hpt366,
1611 .init_hwif = init_hwif_hpt366, 1491 .init_hwif = init_hwif_hpt366,
1612 .init_dma = init_dma_hpt366, 1492 .init_dma = init_dma_hpt366,
1613 .autodma = AUTODMA,
1614 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1493 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}},
1615 .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5,
1616 .bootable = OFF_BOARD,
1617 .extra = 240, 1494 .extra = 240,
1495 .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD,
1618 .pio_mask = ATA_PIO4, 1496 .pio_mask = ATA_PIO4,
1497 .mwdma_mask = ATA_MWDMA2,
1619 } 1498 }
1620}; 1499};
1621 1500
@@ -1626,16 +1505,77 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
1626 * 1505 *
1627 * Called when the PCI registration layer (or the IDE initialization) 1506 * Called when the PCI registration layer (or the IDE initialization)
1628 * finds a device matching our IDE device tables. 1507 * finds a device matching our IDE device tables.
1629 *
1630 * NOTE: since we'll have to modify some fields of the ide_pci_device_t
1631 * structure depending on the chip's revision, we'd better pass a local
1632 * copy down the call chain...
1633 */ 1508 */
1634static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id) 1509static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1635{ 1510{
1636 ide_pci_device_t d = hpt366_chipsets[id->driver_data]; 1511 struct hpt_info *info = NULL;
1512 struct pci_dev *dev2 = NULL;
1513 struct ide_port_info d;
1514 u8 idx = id->driver_data;
1515 u8 rev = dev->revision;
1516
1517 if ((idx == 0 || idx == 4) && (PCI_FUNC(dev->devfn) & 1))
1518 return -ENODEV;
1519
1520 switch (idx) {
1521 case 0:
1522 if (rev < 3)
1523 info = &hpt36x;
1524 else {
1525 static struct hpt_info *hpt37x_info[] =
1526 { &hpt370, &hpt370a, &hpt372, &hpt372n };
1527
1528 info = hpt37x_info[min_t(u8, rev, 6) - 3];
1529 idx++;
1530 }
1531 break;
1532 case 1:
1533 info = (rev > 1) ? &hpt372n : &hpt372a;
1534 break;
1535 case 2:
1536 info = (rev > 1) ? &hpt302n : &hpt302;
1537 break;
1538 case 3:
1539 hpt371_init(dev);
1540 info = (rev > 1) ? &hpt371n : &hpt371;
1541 break;
1542 case 4:
1543 info = &hpt374;
1544 break;
1545 case 5:
1546 info = &hpt372n;
1547 break;
1548 }
1549
1550 d = hpt366_chipsets[idx];
1551
1552 d.name = info->chip_name;
1553 d.udma_mask = info->udma_mask;
1554
1555 pci_set_drvdata(dev, info);
1556
1557 if (info == &hpt36x || info == &hpt374)
1558 dev2 = pci_get_slot(dev->bus, dev->devfn + 1);
1559
1560 if (dev2) {
1561 int ret;
1562
1563 pci_set_drvdata(dev2, info);
1564
1565 if (info == &hpt374)
1566 hpt374_init(dev, dev2);
1567 else {
1568 if (hpt36x_init(dev, dev2))
1569 d.host_flags |= IDE_HFLAG_BOOTABLE;
1570 }
1571
1572 ret = ide_setup_pci_devices(dev, dev2, &d);
1573 if (ret < 0)
1574 pci_dev_put(dev2);
1575 return ret;
1576 }
1637 1577
1638 return d.init_setup(dev, &d); 1578 return ide_setup_pci_device(dev, &d);
1639} 1579}
1640 1580
1641static const struct pci_device_id hpt366_pci_tbl[] = { 1581static const struct pci_device_id hpt366_pci_tbl[] = {
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index 24a71d03744a..90b52ed37bfc 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -170,17 +170,9 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
170 hwif->set_dma_mode = &it8213_set_dma_mode; 170 hwif->set_dma_mode = &it8213_set_dma_mode;
171 hwif->set_pio_mode = &it8213_set_pio_mode; 171 hwif->set_pio_mode = &it8213_set_pio_mode;
172 172
173 hwif->drives[0].autotune = 1;
174 hwif->drives[1].autotune = 1;
175
176 if (!hwif->dma_base) 173 if (!hwif->dma_base)
177 return; 174 return;
178 175
179 hwif->atapi_dma = 1;
180 hwif->ultra_mask = 0x7f;
181 hwif->mwdma_mask = 0x06;
182 hwif->swdma_mask = 0x04;
183
184 pci_read_config_byte(hwif->pci_dev, 0x42, &reg42h); 176 pci_read_config_byte(hwif->pci_dev, 0x42, &reg42h);
185 177
186 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 178 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
@@ -192,14 +184,16 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)
192 { \ 184 { \
193 .name = name_str, \ 185 .name = name_str, \
194 .init_hwif = init_hwif_it8213, \ 186 .init_hwif = init_hwif_it8213, \
195 .autodma = AUTODMA, \
196 .enablebits = {{0x41,0x80,0x80}}, \ 187 .enablebits = {{0x41,0x80,0x80}}, \
197 .bootable = ON_BOARD, \ 188 .host_flags = IDE_HFLAG_SINGLE | \
198 .host_flags = IDE_HFLAG_SINGLE, \ 189 IDE_HFLAG_BOOTABLE, \
199 .pio_mask = ATA_PIO4, \ 190 .pio_mask = ATA_PIO4, \
191 .swdma_mask = ATA_SWDMA2_ONLY, \
192 .mwdma_mask = ATA_MWDMA12_ONLY, \
193 .udma_mask = ATA_UDMA6, \
200 } 194 }
201 195
202static ide_pci_device_t it8213_chipsets[] __devinitdata = { 196static const struct ide_port_info it8213_chipsets[] __devinitdata = {
203 /* 0 */ DECLARE_ITE_DEV("IT8213"), 197 /* 0 */ DECLARE_ITE_DEV("IT8213"),
204}; 198};
205 199
diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c
index f3391a8698ac..5c9975435319 100644
--- a/drivers/ide/pci/it821x.c
+++ b/drivers/ide/pci/it821x.c
@@ -95,7 +95,7 @@ struct it821x_dev
95 95
96/* 96/*
97 * We allow users to force the card into non raid mode without 97 * We allow users to force the card into non raid mode without
98 * flashing the alternative BIOS. This is also neccessary right now 98 * flashing the alternative BIOS. This is also necessary right now
99 * for embedded platforms that cannot run a PC BIOS but are using this 99 * for embedded platforms that cannot run a PC BIOS but are using this
100 * device. 100 * device.
101 */ 101 */
@@ -544,12 +544,10 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
544 544
545 ide_set_hwifdata(hwif, idev); 545 ide_set_hwifdata(hwif, idev);
546 546
547 hwif->atapi_dma = 1;
548
549 pci_read_config_byte(hwif->pci_dev, 0x50, &conf); 547 pci_read_config_byte(hwif->pci_dev, 0x50, &conf);
550 if(conf & 1) { 548 if (conf & 1) {
551 idev->smart = 1; 549 idev->smart = 1;
552 hwif->atapi_dma = 0; 550 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
553 /* Long I/O's although allowed in LBA48 space cause the 551 /* Long I/O's although allowed in LBA48 space cause the
554 onboard firmware to enter the twighlight zone */ 552 onboard firmware to enter the twighlight zone */
555 hwif->rqsize = 256; 553 hwif->rqsize = 256;
@@ -566,14 +564,14 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
566 564
567 /* 565 /*
568 * Not in the docs but according to the reference driver 566 * Not in the docs but according to the reference driver
569 * this is neccessary. 567 * this is necessary.
570 */ 568 */
571 569
572 pci_read_config_byte(hwif->pci_dev, 0x08, &conf); 570 pci_read_config_byte(hwif->pci_dev, 0x08, &conf);
573 if(conf == 0x10) { 571 if (conf == 0x10) {
574 idev->timing10 = 1; 572 idev->timing10 = 1;
575 hwif->atapi_dma = 0; 573 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
576 if(!idev->smart) 574 if (idev->smart == 0)
577 printk(KERN_WARNING "it821x: Revision 0x10, workarounds activated.\n"); 575 printk(KERN_WARNING "it821x: Revision 0x10, workarounds activated.\n");
578 } 576 }
579 577
@@ -587,14 +585,11 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
587 } else 585 } else
588 hwif->host_flags |= IDE_HFLAG_NO_SET_MODE; 586 hwif->host_flags |= IDE_HFLAG_NO_SET_MODE;
589 587
590 hwif->drives[0].autotune = 1;
591 hwif->drives[1].autotune = 1;
592
593 if (hwif->dma_base == 0) 588 if (hwif->dma_base == 0)
594 return; 589 return;
595 590
596 hwif->ultra_mask = 0x7f; 591 hwif->ultra_mask = ATA_UDMA6;
597 hwif->mwdma_mask = 0x07; 592 hwif->mwdma_mask = ATA_MWDMA2;
598 593
599 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 594 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
600 hwif->cbl = ata66_it821x(hwif); 595 hwif->cbl = ata66_it821x(hwif);
@@ -638,13 +633,12 @@ static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const cha
638 .name = name_str, \ 633 .name = name_str, \
639 .init_chipset = init_chipset_it821x, \ 634 .init_chipset = init_chipset_it821x, \
640 .init_hwif = init_hwif_it821x, \ 635 .init_hwif = init_hwif_it821x, \
641 .autodma = AUTODMA, \
642 .bootable = ON_BOARD, \
643 .fixup = it821x_fixups, \ 636 .fixup = it821x_fixups, \
637 .host_flags = IDE_HFLAG_BOOTABLE, \
644 .pio_mask = ATA_PIO4, \ 638 .pio_mask = ATA_PIO4, \
645 } 639 }
646 640
647static ide_pci_device_t it821x_chipsets[] __devinitdata = { 641static const struct ide_port_info it821x_chipsets[] __devinitdata = {
648 /* 0 */ DECLARE_ITE_DEV("IT8212"), 642 /* 0 */ DECLARE_ITE_DEV("IT8212"),
649}; 643};
650 644
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index bb893ffcc987..bdf64d997708 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -111,27 +111,21 @@ static void __devinit init_hwif_jmicron(ide_hwif_t *hwif)
111 hwif->set_pio_mode = &jmicron_set_pio_mode; 111 hwif->set_pio_mode = &jmicron_set_pio_mode;
112 hwif->set_dma_mode = &jmicron_set_dma_mode; 112 hwif->set_dma_mode = &jmicron_set_dma_mode;
113 113
114 hwif->drives[0].autotune = 1;
115 hwif->drives[1].autotune = 1;
116
117 if (hwif->dma_base == 0) 114 if (hwif->dma_base == 0)
118 return; 115 return;
119 116
120 hwif->atapi_dma = 1;
121 hwif->ultra_mask = 0x7f;
122 hwif->mwdma_mask = 0x07;
123
124 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 117 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
125 hwif->cbl = ata66_jmicron(hwif); 118 hwif->cbl = ata66_jmicron(hwif);
126} 119}
127 120
128static ide_pci_device_t jmicron_chipset __devinitdata = { 121static const struct ide_port_info jmicron_chipset __devinitdata = {
129 .name = "JMB", 122 .name = "JMB",
130 .init_hwif = init_hwif_jmicron, 123 .init_hwif = init_hwif_jmicron,
131 .autodma = AUTODMA, 124 .host_flags = IDE_HFLAG_BOOTABLE,
132 .bootable = ON_BOARD,
133 .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } }, 125 .enablebits = { { 0x40, 0x01, 0x01 }, { 0x40, 0x10, 0x10 } },
134 .pio_mask = ATA_PIO5, 126 .pio_mask = ATA_PIO5,
127 .mwdma_mask = ATA_MWDMA2,
128 .udma_mask = ATA_UDMA6,
135}; 129};
136 130
137/** 131/**
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index a8cd50ab62fb..d4df4642dbb5 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -260,15 +260,15 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
260 hwif->ide_dma_end = &ns87415_ide_dma_end; 260 hwif->ide_dma_end = &ns87415_ide_dma_end;
261} 261}
262 262
263static ide_pci_device_t ns87415_chipset __devinitdata = { 263static const struct ide_port_info ns87415_chipset __devinitdata = {
264 .name = "NS87415", 264 .name = "NS87415",
265#ifdef CONFIG_SUPERIO 265#ifdef CONFIG_SUPERIO
266 .init_iops = init_iops_ns87415, 266 .init_iops = init_iops_ns87415,
267#endif 267#endif
268 .init_hwif = init_hwif_ns87415, 268 .init_hwif = init_hwif_ns87415,
269 .autodma = AUTODMA, 269 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
270 .bootable = ON_BOARD, 270 IDE_HFLAG_NO_ATAPI_DMA |
271 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 271 IDE_HFLAG_BOOTABLE,
272}; 272};
273 273
274static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id) 274static int __devinit ns87415_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 250662ea18ad..8953d9c3926f 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/opti621.c Version 0.7 Sept 10, 2002 2 * linux/drivers/ide/pci/opti621.c Version 0.9 Sep 24, 2007
3 * 3 *
4 * Copyright (C) 1996-1998 Linus Torvalds & authors (see below) 4 * Copyright (C) 1996-1998 Linus Torvalds & authors (see below)
5 */ 5 */
@@ -57,9 +57,6 @@
57 * There is a 25/33MHz switch in configuration 57 * There is a 25/33MHz switch in configuration
58 * register, but driver is written for use at any frequency which get 58 * register, but driver is written for use at any frequency which get
59 * (use idebus=xx to select PCI bus speed). 59 * (use idebus=xx to select PCI bus speed).
60 * Use hda=autotune and hdb=autotune for automatical tune of the PIO modes.
61 * If you get strange results, do not use this and set PIO manually
62 * by hdparm.
63 * 60 *
64 * Version 0.1, Nov 8, 1996 61 * Version 0.1, Nov 8, 1996
65 * by Jaromir Koutek, for 2.1.8. 62 * by Jaromir Koutek, for 2.1.8.
@@ -136,6 +133,8 @@ static int reg_base;
136#define PIO_NOT_EXIST 254 133#define PIO_NOT_EXIST 254
137#define PIO_DONT_KNOW 255 134#define PIO_DONT_KNOW 255
138 135
136static DEFINE_SPINLOCK(opti621_lock);
137
139/* there are stored pio numbers from other calls of opti621_set_pio_mode */ 138/* there are stored pio numbers from other calls of opti621_set_pio_mode */
140static void compute_pios(ide_drive_t *drive, const u8 pio) 139static void compute_pios(ide_drive_t *drive, const u8 pio)
141/* Store values into drive->drive_data 140/* Store values into drive->drive_data
@@ -281,7 +280,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
281 second.recovery_time, drdy); 280 second.recovery_time, drdy);
282#endif 281#endif
283 282
284 spin_lock_irqsave(&ide_lock, flags); 283 spin_lock_irqsave(&opti621_lock, flags);
285 284
286 reg_base = hwif->io_ports[IDE_DATA_OFFSET]; 285 reg_base = hwif->io_ports[IDE_DATA_OFFSET];
287 286
@@ -320,7 +319,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
320 /* and read prefetch for both drives */ 319 /* and read prefetch for both drives */
321 write_reg(misc, MISC_REG); 320 write_reg(misc, MISC_REG);
322 321
323 spin_unlock_irqrestore(&ide_lock, flags); 322 spin_unlock_irqrestore(&opti621_lock, flags);
324} 323}
325 324
326/* 325/*
@@ -332,32 +331,27 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif)
332 hwif->drives[1].drive_data = PIO_DONT_KNOW; 331 hwif->drives[1].drive_data = PIO_DONT_KNOW;
333 332
334 hwif->set_pio_mode = &opti621_set_pio_mode; 333 hwif->set_pio_mode = &opti621_set_pio_mode;
335
336 if (!(hwif->dma_base))
337 return;
338
339 hwif->atapi_dma = 1;
340 hwif->mwdma_mask = 0x07;
341 hwif->swdma_mask = 0x07;
342} 334}
343 335
344static ide_pci_device_t opti621_chipsets[] __devinitdata = { 336static const struct ide_port_info opti621_chipsets[] __devinitdata = {
345 { /* 0 */ 337 { /* 0 */
346 .name = "OPTI621", 338 .name = "OPTI621",
347 .init_hwif = init_hwif_opti621, 339 .init_hwif = init_hwif_opti621,
348 .autodma = AUTODMA,
349 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 340 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
350 .bootable = ON_BOARD, 341 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
342 IDE_HFLAG_BOOTABLE,
351 .pio_mask = ATA_PIO3, 343 .pio_mask = ATA_PIO3,
352 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 344 .swdma_mask = ATA_SWDMA2,
345 .mwdma_mask = ATA_MWDMA2,
353 },{ /* 1 */ 346 },{ /* 1 */
354 .name = "OPTI621X", 347 .name = "OPTI621X",
355 .init_hwif = init_hwif_opti621, 348 .init_hwif = init_hwif_opti621,
356 .autodma = AUTODMA,
357 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 349 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}},
358 .bootable = ON_BOARD, 350 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA |
351 IDE_HFLAG_BOOTABLE,
359 .pio_mask = ATA_PIO3, 352 .pio_mask = ATA_PIO3,
360 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 353 .swdma_mask = ATA_SWDMA2,
354 .mwdma_mask = ATA_MWDMA2,
361 } 355 }
362}; 356};
363 357
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 8704b6f33312..4234efeba606 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -332,16 +332,12 @@ static long __devinit detect_pll_input_clock(unsigned long dma_base)
332static void __devinit apple_kiwi_init(struct pci_dev *pdev) 332static void __devinit apple_kiwi_init(struct pci_dev *pdev)
333{ 333{
334 struct device_node *np = pci_device_to_OF_node(pdev); 334 struct device_node *np = pci_device_to_OF_node(pdev);
335 unsigned int class_rev = 0;
336 u8 conf; 335 u8 conf;
337 336
338 if (np == NULL || !of_device_is_compatible(np, "kiwi-root")) 337 if (np == NULL || !of_device_is_compatible(np, "kiwi-root"))
339 return; 338 return;
340 339
341 pci_read_config_dword(pdev, PCI_CLASS_REVISION, &class_rev); 340 if (pdev->revision >= 0x03) {
342 class_rev &= 0xff;
343
344 if (class_rev >= 0x03) {
345 /* Setup chip magic config stuff (from darwin) */ 341 /* Setup chip magic config stuff (from darwin) */
346 pci_read_config_byte (pdev, 0x40, &conf); 342 pci_read_config_byte (pdev, 0x40, &conf);
347 pci_write_config_byte(pdev, 0x40, (conf | 0x01)); 343 pci_write_config_byte(pdev, 0x40, (conf | 0x01));
@@ -475,32 +471,76 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
475 hwif->quirkproc = &pdcnew_quirkproc; 471 hwif->quirkproc = &pdcnew_quirkproc;
476 hwif->resetproc = &pdcnew_reset; 472 hwif->resetproc = &pdcnew_reset;
477 473
478 hwif->err_stops_fifo = 1;
479
480 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
481
482 if (hwif->dma_base == 0) 474 if (hwif->dma_base == 0)
483 return; 475 return;
484 476
485 hwif->atapi_dma = 1;
486
487 hwif->ultra_mask = hwif->cds->udma_mask;
488 hwif->mwdma_mask = 0x07;
489
490 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 477 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
491 hwif->cbl = pdcnew_cable_detect(hwif); 478 hwif->cbl = pdcnew_cable_detect(hwif);
492} 479}
493 480
494static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d) 481static struct pci_dev * __devinit pdc20270_get_dev2(struct pci_dev *dev)
495{ 482{
496 return ide_setup_pci_device(dev, d); 483 struct pci_dev *dev2;
484
485 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 2,
486 PCI_FUNC(dev->devfn)));
487 if (dev2 &&
488 dev2->vendor == dev->vendor &&
489 dev2->device == dev->device) {
490
491 if (dev2->irq != dev->irq) {
492 dev2->irq = dev->irq;
493 printk(KERN_INFO "PDC20270: PCI config space "
494 "interrupt fixed\n");
495 }
496
497 return dev2;
498 }
499
500 return NULL;
497} 501}
498 502
499static int __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *d) 503#define DECLARE_PDCNEW_DEV(name_str, udma) \
504 { \
505 .name = name_str, \
506 .init_chipset = init_chipset_pdcnew, \
507 .init_hwif = init_hwif_pdc202new, \
508 .host_flags = IDE_HFLAG_POST_SET_MODE | \
509 IDE_HFLAG_ERROR_STOPS_FIFO | \
510 IDE_HFLAG_OFF_BOARD, \
511 .pio_mask = ATA_PIO4, \
512 .mwdma_mask = ATA_MWDMA2, \
513 .udma_mask = udma, \
514 }
515
516static const struct ide_port_info pdcnew_chipsets[] __devinitdata = {
517 /* 0 */ DECLARE_PDCNEW_DEV("PDC20268", ATA_UDMA5),
518 /* 1 */ DECLARE_PDCNEW_DEV("PDC20269", ATA_UDMA6),
519 /* 2 */ DECLARE_PDCNEW_DEV("PDC20270", ATA_UDMA5),
520 /* 3 */ DECLARE_PDCNEW_DEV("PDC20271", ATA_UDMA6),
521 /* 4 */ DECLARE_PDCNEW_DEV("PDC20275", ATA_UDMA6),
522 /* 5 */ DECLARE_PDCNEW_DEV("PDC20276", ATA_UDMA6),
523 /* 6 */ DECLARE_PDCNEW_DEV("PDC20277", ATA_UDMA6),
524};
525
526/**
527 * pdc202new_init_one - called when a pdc202xx is found
528 * @dev: the pdc202new device
529 * @id: the matching pci id
530 *
531 * Called when the PCI registration layer (or the IDE initialization)
532 * finds a device matching our IDE device tables.
533 */
534
535static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id)
500{ 536{
537 const struct ide_port_info *d;
501 struct pci_dev *bridge = dev->bus->self; 538 struct pci_dev *bridge = dev->bus->self;
539 u8 idx = id->driver_data;
540
541 d = &pdcnew_chipsets[idx];
502 542
503 if (bridge != NULL && 543 if (idx == 2 && bridge &&
504 bridge->vendor == PCI_VENDOR_ID_DEC && 544 bridge->vendor == PCI_VENDOR_ID_DEC &&
505 bridge->device == PCI_DEVICE_ID_DEC_21150) { 545 bridge->device == PCI_DEVICE_ID_DEC_21150) {
506 struct pci_dev *dev2; 546 struct pci_dev *dev2;
@@ -508,133 +548,26 @@ static int __devinit init_setup_pdc20270(struct pci_dev *dev, ide_pci_device_t *
508 if (PCI_SLOT(dev->devfn) & 2) 548 if (PCI_SLOT(dev->devfn) & 2)
509 return -ENODEV; 549 return -ENODEV;
510 550
511 dev2 = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn) + 2, 551 dev2 = pdc20270_get_dev2(dev);
512 PCI_FUNC(dev->devfn)));
513 if (dev2 != NULL &&
514 dev2->vendor == dev->vendor &&
515 dev2->device == dev->device) {
516 int ret;
517
518 if (dev2->irq != dev->irq) {
519 dev2->irq = dev->irq;
520 552
521 printk(KERN_WARNING "%s: PCI config space " 553 if (dev2) {
522 "interrupt fixed.\n", d->name); 554 int ret = ide_setup_pci_devices(dev, dev2, d);
523 }
524
525 ret = ide_setup_pci_devices(dev, dev2, d);
526 if (ret < 0) 555 if (ret < 0)
527 pci_dev_put(dev2); 556 pci_dev_put(dev2);
528 return ret; 557 return ret;
529 } 558 }
530 } 559 }
531 return ide_setup_pci_device(dev, d);
532}
533 560
534static int __devinit init_setup_pdc20276(struct pci_dev *dev, ide_pci_device_t *d) 561 if (idx == 5 && bridge &&
535{
536 struct pci_dev *bridge = dev->bus->self;
537
538 if (bridge != NULL &&
539 bridge->vendor == PCI_VENDOR_ID_INTEL && 562 bridge->vendor == PCI_VENDOR_ID_INTEL &&
540 (bridge->device == PCI_DEVICE_ID_INTEL_I960 || 563 (bridge->device == PCI_DEVICE_ID_INTEL_I960 ||
541 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) { 564 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) {
542 565 printk(KERN_INFO "PDC20276: attached to I2O RAID controller, "
543 printk(KERN_INFO "%s: attached to I2O RAID controller, " 566 "skipping\n");
544 "skipping.\n", d->name);
545 return -ENODEV; 567 return -ENODEV;
546 } 568 }
547 return ide_setup_pci_device(dev, d);
548}
549
550static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
551 { /* 0 */
552 .name = "PDC20268",
553 .init_setup = init_setup_pdcnew,
554 .init_chipset = init_chipset_pdcnew,
555 .init_hwif = init_hwif_pdc202new,
556 .autodma = AUTODMA,
557 .bootable = OFF_BOARD,
558 .pio_mask = ATA_PIO4,
559 .udma_mask = 0x3f, /* udma0-5 */
560 .host_flags = IDE_HFLAG_POST_SET_MODE,
561 },{ /* 1 */
562 .name = "PDC20269",
563 .init_setup = init_setup_pdcnew,
564 .init_chipset = init_chipset_pdcnew,
565 .init_hwif = init_hwif_pdc202new,
566 .autodma = AUTODMA,
567 .bootable = OFF_BOARD,
568 .pio_mask = ATA_PIO4,
569 .udma_mask = 0x7f, /* udma0-6*/
570 .host_flags = IDE_HFLAG_POST_SET_MODE,
571 },{ /* 2 */
572 .name = "PDC20270",
573 .init_setup = init_setup_pdc20270,
574 .init_chipset = init_chipset_pdcnew,
575 .init_hwif = init_hwif_pdc202new,
576 .autodma = AUTODMA,
577 .bootable = OFF_BOARD,
578 .pio_mask = ATA_PIO4,
579 .udma_mask = 0x3f, /* udma0-5 */
580 .host_flags = IDE_HFLAG_POST_SET_MODE,
581 },{ /* 3 */
582 .name = "PDC20271",
583 .init_setup = init_setup_pdcnew,
584 .init_chipset = init_chipset_pdcnew,
585 .init_hwif = init_hwif_pdc202new,
586 .autodma = AUTODMA,
587 .bootable = OFF_BOARD,
588 .pio_mask = ATA_PIO4,
589 .udma_mask = 0x7f, /* udma0-6*/
590 .host_flags = IDE_HFLAG_POST_SET_MODE,
591 },{ /* 4 */
592 .name = "PDC20275",
593 .init_setup = init_setup_pdcnew,
594 .init_chipset = init_chipset_pdcnew,
595 .init_hwif = init_hwif_pdc202new,
596 .autodma = AUTODMA,
597 .bootable = OFF_BOARD,
598 .pio_mask = ATA_PIO4,
599 .udma_mask = 0x7f, /* udma0-6*/
600 .host_flags = IDE_HFLAG_POST_SET_MODE,
601 },{ /* 5 */
602 .name = "PDC20276",
603 .init_setup = init_setup_pdc20276,
604 .init_chipset = init_chipset_pdcnew,
605 .init_hwif = init_hwif_pdc202new,
606 .autodma = AUTODMA,
607 .bootable = OFF_BOARD,
608 .pio_mask = ATA_PIO4,
609 .udma_mask = 0x7f, /* udma0-6*/
610 .host_flags = IDE_HFLAG_POST_SET_MODE,
611 },{ /* 6 */
612 .name = "PDC20277",
613 .init_setup = init_setup_pdcnew,
614 .init_chipset = init_chipset_pdcnew,
615 .init_hwif = init_hwif_pdc202new,
616 .autodma = AUTODMA,
617 .bootable = OFF_BOARD,
618 .pio_mask = ATA_PIO4,
619 .udma_mask = 0x7f, /* udma0-6*/
620 .host_flags = IDE_HFLAG_POST_SET_MODE,
621 }
622};
623 569
624/** 570 return ide_setup_pci_device(dev, d);
625 * pdc202new_init_one - called when a pdc202xx is found
626 * @dev: the pdc202new device
627 * @id: the matching pci id
628 *
629 * Called when the PCI registration layer (or the IDE initialization)
630 * finds a device matching our IDE device tables.
631 */
632
633static int __devinit pdc202new_init_one(struct pci_dev *dev, const struct pci_device_id *id)
634{
635 ide_pci_device_t *d = &pdcnew_chipsets[id->driver_data];
636
637 return d->init_setup(dev, d);
638} 571}
639 572
640static const struct pci_device_id pdc202new_pci_tbl[] = { 573static const struct pci_device_id pdc202new_pci_tbl[] = {
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index e1d2337a9f1d..e09742e2ba59 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.51 Jul 27, 2007 2 * linux/drivers/ide/pci/pdc202xx_old.c Version 0.52 Aug 27, 2007
3 * 3 *
4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1998-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. 5 * Copyright (C) 2006-2007 MontaVista Software, Inc.
@@ -97,9 +97,6 @@ static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed)
97 case XFER_MW_DMA_2: TB = 0x60; TC = 0x03; break; 97 case XFER_MW_DMA_2: TB = 0x60; TC = 0x03; break;
98 case XFER_MW_DMA_1: TB = 0x60; TC = 0x04; break; 98 case XFER_MW_DMA_1: TB = 0x60; TC = 0x04; break;
99 case XFER_MW_DMA_0: TB = 0xE0; TC = 0x0F; break; 99 case XFER_MW_DMA_0: TB = 0xE0; TC = 0x0F; break;
100 case XFER_SW_DMA_2: TB = 0x60; TC = 0x05; break;
101 case XFER_SW_DMA_1: TB = 0x80; TC = 0x06; break;
102 case XFER_SW_DMA_0: TB = 0xC0; TC = 0x0B; break;
103 case XFER_PIO_4: TA = 0x01; TB = 0x04; break; 100 case XFER_PIO_4: TA = 0x01; TB = 0x04; break;
104 case XFER_PIO_3: TA = 0x02; TB = 0x06; break; 101 case XFER_PIO_3: TA = 0x02; TB = 0x06; break;
105 case XFER_PIO_2: TA = 0x03; TB = 0x08; break; 102 case XFER_PIO_2: TA = 0x03; TB = 0x08; break;
@@ -305,13 +302,6 @@ static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
305 302
306static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) 303static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
307{ 304{
308 struct pci_dev *dev = hwif->pci_dev;
309
310 /* PDC20265 has problems with large LBA48 requests */
311 if ((dev->device == PCI_DEVICE_ID_PROMISE_20267) ||
312 (dev->device == PCI_DEVICE_ID_PROMISE_20265))
313 hwif->rqsize = 256;
314
315 hwif->set_pio_mode = &pdc202xx_set_pio_mode; 305 hwif->set_pio_mode = &pdc202xx_set_pio_mode;
316 hwif->set_dma_mode = &pdc202xx_set_mode; 306 hwif->set_dma_mode = &pdc202xx_set_mode;
317 307
@@ -320,18 +310,9 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
320 if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246) 310 if (hwif->pci_dev->device != PCI_DEVICE_ID_PROMISE_20246)
321 hwif->resetproc = &pdc202xx_reset; 311 hwif->resetproc = &pdc202xx_reset;
322 312
323 hwif->err_stops_fifo = 1;
324
325 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
326
327 if (hwif->dma_base == 0) 313 if (hwif->dma_base == 0)
328 return; 314 return;
329 315
330 hwif->ultra_mask = hwif->cds->udma_mask;
331 hwif->mwdma_mask = 0x07;
332 hwif->swdma_mask = 0x07;
333 hwif->atapi_dma = 1;
334
335 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq; 316 hwif->dma_lost_irq = &pdc202xx_dma_lost_irq;
336 hwif->dma_timeout = &pdc202xx_dma_timeout; 317 hwif->dma_timeout = &pdc202xx_dma_timeout;
337 318
@@ -377,8 +358,8 @@ static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase)
377 ide_setup_dma(hwif, dmabase, 8); 358 ide_setup_dma(hwif, dmabase, 8);
378} 359}
379 360
380static int __devinit init_setup_pdc202ata4(struct pci_dev *dev, 361static void __devinit pdc202ata4_fixup_irq(struct pci_dev *dev,
381 ide_pci_device_t *d) 362 const char *name)
382{ 363{
383 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) { 364 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) {
384 u8 irq = 0, irq2 = 0; 365 u8 irq = 0, irq2 = 0;
@@ -388,90 +369,45 @@ static int __devinit init_setup_pdc202ata4(struct pci_dev *dev,
388 if (irq != irq2) { 369 if (irq != irq2) {
389 pci_write_config_byte(dev, 370 pci_write_config_byte(dev,
390 (PCI_INTERRUPT_LINE)|0x80, irq); /* 0xbc */ 371 (PCI_INTERRUPT_LINE)|0x80, irq); /* 0xbc */
391 printk(KERN_INFO "%s: pci-config space interrupt " 372 printk(KERN_INFO "%s: PCI config space interrupt "
392 "mirror fixed.\n", d->name); 373 "mirror fixed\n", name);
393 } 374 }
394 } 375 }
395 return ide_setup_pci_device(dev, d);
396} 376}
397 377
398static int __devinit init_setup_pdc20265(struct pci_dev *dev, 378#define DECLARE_PDC2026X_DEV(name_str, udma, extra_flags) \
399 ide_pci_device_t *d) 379 { \
400{ 380 .name = name_str, \
401 if ((dev->bus->self) && 381 .init_chipset = init_chipset_pdc202xx, \
402 (dev->bus->self->vendor == PCI_VENDOR_ID_INTEL) && 382 .init_hwif = init_hwif_pdc202xx, \
403 ((dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960) || 383 .init_dma = init_dma_pdc202xx, \
404 (dev->bus->self->device == PCI_DEVICE_ID_INTEL_I960RM))) { 384 .extra = 48, \
405 printk(KERN_INFO "ide: Skipping Promise PDC20265 " 385 .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO | \
406 "attached to I2O RAID controller.\n"); 386 extra_flags | \
407 return -ENODEV; 387 IDE_HFLAG_OFF_BOARD, \
388 .pio_mask = ATA_PIO4, \
389 .mwdma_mask = ATA_MWDMA2, \
390 .udma_mask = udma, \
408 } 391 }
409 return ide_setup_pci_device(dev, d);
410}
411 392
412static int __devinit init_setup_pdc202xx(struct pci_dev *dev, 393static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = {
413 ide_pci_device_t *d)
414{
415 return ide_setup_pci_device(dev, d);
416}
417
418static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
419 { /* 0 */ 394 { /* 0 */
420 .name = "PDC20246", 395 .name = "PDC20246",
421 .init_setup = init_setup_pdc202ata4,
422 .init_chipset = init_chipset_pdc202xx, 396 .init_chipset = init_chipset_pdc202xx,
423 .init_hwif = init_hwif_pdc202xx, 397 .init_hwif = init_hwif_pdc202xx,
424 .init_dma = init_dma_pdc202xx, 398 .init_dma = init_dma_pdc202xx,
425 .autodma = AUTODMA,
426 .bootable = OFF_BOARD,
427 .extra = 16, 399 .extra = 16,
400 .host_flags = IDE_HFLAG_ERROR_STOPS_FIFO |
401 IDE_HFLAG_OFF_BOARD,
428 .pio_mask = ATA_PIO4, 402 .pio_mask = ATA_PIO4,
429 .udma_mask = 0x07, /* udma0-2 */ 403 .mwdma_mask = ATA_MWDMA2,
430 },{ /* 1 */ 404 .udma_mask = ATA_UDMA2,
431 .name = "PDC20262", 405 },
432 .init_setup = init_setup_pdc202ata4, 406
433 .init_chipset = init_chipset_pdc202xx, 407 /* 1 */ DECLARE_PDC2026X_DEV("PDC20262", ATA_UDMA4, 0),
434 .init_hwif = init_hwif_pdc202xx, 408 /* 2 */ DECLARE_PDC2026X_DEV("PDC20263", ATA_UDMA4, 0),
435 .init_dma = init_dma_pdc202xx, 409 /* 3 */ DECLARE_PDC2026X_DEV("PDC20265", ATA_UDMA5, IDE_HFLAG_RQSIZE_256),
436 .autodma = AUTODMA, 410 /* 4 */ DECLARE_PDC2026X_DEV("PDC20267", ATA_UDMA5, IDE_HFLAG_RQSIZE_256),
437 .bootable = OFF_BOARD,
438 .extra = 48,
439 .pio_mask = ATA_PIO4,
440 .udma_mask = 0x1f, /* udma0-4 */
441 },{ /* 2 */
442 .name = "PDC20263",
443 .init_setup = init_setup_pdc202ata4,
444 .init_chipset = init_chipset_pdc202xx,
445 .init_hwif = init_hwif_pdc202xx,
446 .init_dma = init_dma_pdc202xx,
447 .autodma = AUTODMA,
448 .bootable = OFF_BOARD,
449 .extra = 48,
450 .pio_mask = ATA_PIO4,
451 .udma_mask = 0x1f, /* udma0-4 */
452 },{ /* 3 */
453 .name = "PDC20265",
454 .init_setup = init_setup_pdc20265,
455 .init_chipset = init_chipset_pdc202xx,
456 .init_hwif = init_hwif_pdc202xx,
457 .init_dma = init_dma_pdc202xx,
458 .autodma = AUTODMA,
459 .bootable = OFF_BOARD,
460 .extra = 48,
461 .pio_mask = ATA_PIO4,
462 .udma_mask = 0x3f, /* udma0-5 */
463 },{ /* 4 */
464 .name = "PDC20267",
465 .init_setup = init_setup_pdc202xx,
466 .init_chipset = init_chipset_pdc202xx,
467 .init_hwif = init_hwif_pdc202xx,
468 .init_dma = init_dma_pdc202xx,
469 .autodma = AUTODMA,
470 .bootable = OFF_BOARD,
471 .extra = 48,
472 .pio_mask = ATA_PIO4,
473 .udma_mask = 0x3f, /* udma0-5 */
474 }
475}; 411};
476 412
477/** 413/**
@@ -485,9 +421,28 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
485 421
486static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id) 422static int __devinit pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id)
487{ 423{
488 ide_pci_device_t *d = &pdc202xx_chipsets[id->driver_data]; 424 const struct ide_port_info *d;
425 u8 idx = id->driver_data;
426
427 d = &pdc202xx_chipsets[idx];
428
429 if (idx < 3)
430 pdc202ata4_fixup_irq(dev, d->name);
431
432 if (idx == 3) {
433 struct pci_dev *bridge = dev->bus->self;
489 434
490 return d->init_setup(dev, d); 435 if (bridge &&
436 bridge->vendor == PCI_VENDOR_ID_INTEL &&
437 (bridge->device == PCI_DEVICE_ID_INTEL_I960 ||
438 bridge->device == PCI_DEVICE_ID_INTEL_I960RM)) {
439 printk(KERN_INFO "ide: Skipping Promise PDC20265 "
440 "attached to I2O RAID controller\n");
441 return -ENODEV;
442 }
443 }
444
445 return ide_setup_pci_device(dev, d);
491} 446}
492 447
493static const struct pci_device_id pdc202xx_pci_tbl[] = { 448static const struct pci_device_id pdc202xx_pci_tbl[] = {
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index a8dd0c0add35..9329d4a810e5 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/piix.c Version 0.53 Aug 9, 2007 2 * linux/drivers/ide/pci/piix.c Version 0.54 Sep 5, 2007
3 * 3 *
4 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer 4 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
5 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 5 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
@@ -254,53 +254,20 @@ static void piix_set_dma_mode(ide_drive_t *drive, const u8 speed)
254} 254}
255 255
256/** 256/**
257 * piix_is_ichx - check if ICHx 257 * init_chipset_ich - set up the ICH chipset
258 * @dev: PCI device to check
259 *
260 * returns 1 if ICHx, 0 otherwise.
261 */
262static int piix_is_ichx(struct pci_dev *dev)
263{
264 switch (dev->device) {
265 case PCI_DEVICE_ID_INTEL_82801EB_1:
266 case PCI_DEVICE_ID_INTEL_82801AA_1:
267 case PCI_DEVICE_ID_INTEL_82801AB_1:
268 case PCI_DEVICE_ID_INTEL_82801BA_8:
269 case PCI_DEVICE_ID_INTEL_82801BA_9:
270 case PCI_DEVICE_ID_INTEL_82801CA_10:
271 case PCI_DEVICE_ID_INTEL_82801CA_11:
272 case PCI_DEVICE_ID_INTEL_82801DB_1:
273 case PCI_DEVICE_ID_INTEL_82801DB_10:
274 case PCI_DEVICE_ID_INTEL_82801DB_11:
275 case PCI_DEVICE_ID_INTEL_82801EB_11:
276 case PCI_DEVICE_ID_INTEL_82801E_11:
277 case PCI_DEVICE_ID_INTEL_ESB_2:
278 case PCI_DEVICE_ID_INTEL_ICH6_19:
279 case PCI_DEVICE_ID_INTEL_ICH7_21:
280 case PCI_DEVICE_ID_INTEL_ESB2_18:
281 case PCI_DEVICE_ID_INTEL_ICH8_6:
282 return 1;
283 }
284
285 return 0;
286}
287
288/**
289 * init_chipset_piix - set up the PIIX chipset
290 * @dev: PCI device to set up 258 * @dev: PCI device to set up
291 * @name: Name of the device 259 * @name: Name of the device
292 * 260 *
293 * Initialize the PCI device as required. For the PIIX this turns 261 * Initialize the PCI device as required. For the ICH this turns
294 * out to be nice and simple 262 * out to be nice and simple.
295 */ 263 */
296 264
297static unsigned int __devinit init_chipset_piix (struct pci_dev *dev, const char *name) 265static unsigned int __devinit init_chipset_ich(struct pci_dev *dev, const char *name)
298{ 266{
299 if (piix_is_ichx(dev)) { 267 u32 extra = 0;
300 unsigned int extra = 0; 268
301 pci_read_config_dword(dev, 0x54, &extra); 269 pci_read_config_dword(dev, 0x54, &extra);
302 pci_write_config_dword(dev, 0x54, extra|0x400); 270 pci_write_config_dword(dev, 0x54, extra | 0x400);
303 }
304 271
305 return 0; 272 return 0;
306} 273}
@@ -318,9 +285,9 @@ static void piix_dma_clear_irq(ide_drive_t *drive)
318 u8 dma_stat; 285 u8 dma_stat;
319 286
320 /* clear the INTR & ERROR bits */ 287 /* clear the INTR & ERROR bits */
321 dma_stat = hwif->INB(hwif->dma_status); 288 dma_stat = inb(hwif->dma_status);
322 /* Should we force the bit as well ? */ 289 /* Should we force the bit as well ? */
323 hwif->OUTB(dma_stat, hwif->dma_status); 290 outb(dma_stat, hwif->dma_status);
324} 291}
325 292
326struct ich_laptop { 293struct ich_laptop {
@@ -374,35 +341,12 @@ static u8 __devinit piix_cable_detect(ide_hwif_t *hwif)
374 341
375static void __devinit init_hwif_piix(ide_hwif_t *hwif) 342static void __devinit init_hwif_piix(ide_hwif_t *hwif)
376{ 343{
377#ifndef CONFIG_IA64
378 if (!hwif->irq)
379 hwif->irq = hwif->channel ? 15 : 14;
380#endif /* CONFIG_IA64 */
381
382 if (hwif->pci_dev->device == PCI_DEVICE_ID_INTEL_82371MX) {
383 /* This is a painful system best to let it self tune for now */
384 return;
385 }
386
387 hwif->set_pio_mode = &piix_set_pio_mode; 344 hwif->set_pio_mode = &piix_set_pio_mode;
388 hwif->set_dma_mode = &piix_set_dma_mode; 345 hwif->set_dma_mode = &piix_set_dma_mode;
389 346
390 hwif->drives[0].autotune = 1;
391 hwif->drives[1].autotune = 1;
392
393 if (!hwif->dma_base) 347 if (!hwif->dma_base)
394 return; 348 return;
395 349
396 /* ICHx need to clear the bmdma status for all interrupts */
397 if (piix_is_ichx(hwif->pci_dev))
398 hwif->ide_dma_clear_irq = &piix_dma_clear_irq;
399
400 hwif->atapi_dma = 1;
401
402 hwif->ultra_mask = hwif->cds->udma_mask;
403 hwif->mwdma_mask = 0x06;
404 hwif->swdma_mask = 0x04;
405
406 if (hwif->ultra_mask & 0x78) { 350 if (hwif->ultra_mask & 0x78) {
407 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 351 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
408 hwif->cbl = piix_cable_detect(hwif); 352 hwif->cbl = piix_cable_detect(hwif);
@@ -412,21 +356,49 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
412 hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0; 356 hwif->ultra_mask = hwif->mwdma_mask = hwif->swdma_mask = 0;
413} 357}
414 358
359static void __devinit init_hwif_ich(ide_hwif_t *hwif)
360{
361 init_hwif_piix(hwif);
362
363 /* ICHx need to clear the BMDMA status for all interrupts */
364 if (hwif->dma_base)
365 hwif->ide_dma_clear_irq = &piix_dma_clear_irq;
366}
367
368#ifndef CONFIG_IA64
369 #define IDE_HFLAGS_PIIX (IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE)
370#else
371 #define IDE_HFLAGS_PIIX IDE_HFLAG_BOOTABLE
372#endif
373
415#define DECLARE_PIIX_DEV(name_str, udma) \ 374#define DECLARE_PIIX_DEV(name_str, udma) \
416 { \ 375 { \
417 .name = name_str, \ 376 .name = name_str, \
418 .init_chipset = init_chipset_piix, \
419 .init_hwif = init_hwif_piix, \ 377 .init_hwif = init_hwif_piix, \
420 .autodma = AUTODMA, \
421 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ 378 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
422 .bootable = ON_BOARD, \ 379 .host_flags = IDE_HFLAGS_PIIX, \
423 .pio_mask = ATA_PIO4, \ 380 .pio_mask = ATA_PIO4, \
381 .swdma_mask = ATA_SWDMA2_ONLY, \
382 .mwdma_mask = ATA_MWDMA12_ONLY, \
424 .udma_mask = udma, \ 383 .udma_mask = udma, \
425 } 384 }
426 385
427static ide_pci_device_t piix_pci_info[] __devinitdata = { 386#define DECLARE_ICH_DEV(name_str, udma) \
428 /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */ 387 { \
429 /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */ 388 .name = name_str, \
389 .init_chipset = init_chipset_ich, \
390 .init_hwif = init_hwif_ich, \
391 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
392 .host_flags = IDE_HFLAGS_PIIX, \
393 .pio_mask = ATA_PIO4, \
394 .swdma_mask = ATA_SWDMA2_ONLY, \
395 .mwdma_mask = ATA_MWDMA12_ONLY, \
396 .udma_mask = udma, \
397 }
398
399static const struct ide_port_info piix_pci_info[] __devinitdata = {
400 /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */
401 /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */
430 402
431 /* 2 */ 403 /* 2 */
432 { /* 404 { /*
@@ -435,36 +407,35 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = {
435 * of the bit 14 of the IDETIM register at offset 0x6c 407 * of the bit 14 of the IDETIM register at offset 0x6c
436 */ 408 */
437 .name = "MPIIX", 409 .name = "MPIIX",
438 .init_hwif = init_hwif_piix,
439 .autodma = NODMA,
440 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, 410 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}},
441 .bootable = ON_BOARD, 411 .host_flags = IDE_HFLAG_ISA_PORTS | IDE_HFLAG_NO_DMA |
442 .host_flags = IDE_HFLAG_ISA_PORTS, 412 IDE_HFLAGS_PIIX,
443 .pio_mask = ATA_PIO4, 413 .pio_mask = ATA_PIO4,
414 /* This is a painful system best to let it self tune for now */
444 }, 415 },
445 416
446 /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */ 417 /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */
447 /* 4 */ DECLARE_PIIX_DEV("PIIX4", 0x07), /* udma0-2 */ 418 /* 4 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2),
448 /* 5 */ DECLARE_PIIX_DEV("ICH0", 0x07), /* udma0-2 */ 419 /* 5 */ DECLARE_ICH_DEV("ICH0", ATA_UDMA2),
449 /* 6 */ DECLARE_PIIX_DEV("PIIX4", 0x07), /* udma0-2 */ 420 /* 6 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2),
450 /* 7 */ DECLARE_PIIX_DEV("ICH", 0x1f), /* udma0-4 */ 421 /* 7 */ DECLARE_ICH_DEV("ICH", ATA_UDMA4),
451 /* 8 */ DECLARE_PIIX_DEV("PIIX4", 0x1f), /* udma0-4 */ 422 /* 8 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA4),
452 /* 9 */ DECLARE_PIIX_DEV("PIIX4", 0x07), /* udma0-2 */ 423 /* 9 */ DECLARE_PIIX_DEV("PIIX4", ATA_UDMA2),
453 /* 10 */ DECLARE_PIIX_DEV("ICH2", 0x3f), /* udma0-5 */ 424 /* 10 */ DECLARE_ICH_DEV("ICH2", ATA_UDMA5),
454 /* 11 */ DECLARE_PIIX_DEV("ICH2M", 0x3f), /* udma0-5 */ 425 /* 11 */ DECLARE_ICH_DEV("ICH2M", ATA_UDMA5),
455 /* 12 */ DECLARE_PIIX_DEV("ICH3M", 0x3f), /* udma0-5 */ 426 /* 12 */ DECLARE_ICH_DEV("ICH3M", ATA_UDMA5),
456 /* 13 */ DECLARE_PIIX_DEV("ICH3", 0x3f), /* udma0-5 */ 427 /* 13 */ DECLARE_ICH_DEV("ICH3", ATA_UDMA5),
457 /* 14 */ DECLARE_PIIX_DEV("ICH4", 0x3f), /* udma0-5 */ 428 /* 14 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5),
458 /* 15 */ DECLARE_PIIX_DEV("ICH5", 0x3f), /* udma0-5 */ 429 /* 15 */ DECLARE_ICH_DEV("ICH5", ATA_UDMA5),
459 /* 16 */ DECLARE_PIIX_DEV("C-ICH", 0x3f), /* udma0-5 */ 430 /* 16 */ DECLARE_ICH_DEV("C-ICH", ATA_UDMA5),
460 /* 17 */ DECLARE_PIIX_DEV("ICH4", 0x3f), /* udma0-5 */ 431 /* 17 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5),
461 /* 18 */ DECLARE_PIIX_DEV("ICH5-SATA", 0x3f), /* udma0-5 */ 432 /* 18 */ DECLARE_ICH_DEV("ICH5-SATA", ATA_UDMA5),
462 /* 19 */ DECLARE_PIIX_DEV("ICH5", 0x3f), /* udma0-5 */ 433 /* 19 */ DECLARE_ICH_DEV("ICH5", ATA_UDMA5),
463 /* 20 */ DECLARE_PIIX_DEV("ICH6", 0x3f), /* udma0-5 */ 434 /* 20 */ DECLARE_ICH_DEV("ICH6", ATA_UDMA5),
464 /* 21 */ DECLARE_PIIX_DEV("ICH7", 0x3f), /* udma0-5 */ 435 /* 21 */ DECLARE_ICH_DEV("ICH7", ATA_UDMA5),
465 /* 22 */ DECLARE_PIIX_DEV("ICH4", 0x3f), /* udma0-5 */ 436 /* 22 */ DECLARE_ICH_DEV("ICH4", ATA_UDMA5),
466 /* 23 */ DECLARE_PIIX_DEV("ESB2", 0x3f), /* udma0-5 */ 437 /* 23 */ DECLARE_ICH_DEV("ESB2", ATA_UDMA5),
467 /* 24 */ DECLARE_PIIX_DEV("ICH8M", 0x3f), /* udma0-5 */ 438 /* 24 */ DECLARE_ICH_DEV("ICH8M", ATA_UDMA5),
468}; 439};
469 440
470/** 441/**
@@ -478,9 +449,7 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = {
478 449
479static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id) 450static int __devinit piix_init_one(struct pci_dev *dev, const struct pci_device_id *id)
480{ 451{
481 ide_pci_device_t *d = &piix_pci_info[id->driver_data]; 452 return ide_setup_pci_device(dev, &piix_pci_info[id->driver_data]);
482
483 return ide_setup_pci_device(dev, d);
484} 453}
485 454
486/** 455/**
diff --git a/drivers/ide/pci/rz1000.c b/drivers/ide/pci/rz1000.c
index 3f506e8d44e3..6b10ae260fa2 100644
--- a/drivers/ide/pci/rz1000.c
+++ b/drivers/ide/pci/rz1000.c
@@ -35,13 +35,13 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif)
35 u16 reg; 35 u16 reg;
36 struct pci_dev *dev = hwif->pci_dev; 36 struct pci_dev *dev = hwif->pci_dev;
37 37
38 hwif->chipset = ide_rz1000;
39 if (!pci_read_config_word (dev, 0x40, &reg) && 38 if (!pci_read_config_word (dev, 0x40, &reg) &&
40 !pci_write_config_word(dev, 0x40, reg & 0xdfff)) { 39 !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
41 printk(KERN_INFO "%s: disabled chipset read-ahead " 40 printk(KERN_INFO "%s: disabled chipset read-ahead "
42 "(buggy RZ1000/RZ1001)\n", hwif->name); 41 "(buggy RZ1000/RZ1001)\n", hwif->name);
43 } else { 42 } else {
44 hwif->serialized = 1; 43 if (hwif->mate)
44 hwif->mate->serialized = hwif->serialized = 1;
45 hwif->drives[0].no_unmask = 1; 45 hwif->drives[0].no_unmask = 1;
46 hwif->drives[1].no_unmask = 1; 46 hwif->drives[1].no_unmask = 1;
47 printk(KERN_INFO "%s: serialized, disabled unmasking " 47 printk(KERN_INFO "%s: serialized, disabled unmasking "
@@ -49,11 +49,11 @@ static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif)
49 } 49 }
50} 50}
51 51
52static ide_pci_device_t rz1000_chipset __devinitdata = { 52static const struct ide_port_info rz1000_chipset __devinitdata = {
53 .name = "RZ100x", 53 .name = "RZ100x",
54 .init_hwif = init_hwif_rz1000, 54 .init_hwif = init_hwif_rz1000,
55 .autodma = NODMA, 55 .chipset = ide_rz1000,
56 .bootable = ON_BOARD, 56 .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_BOOTABLE,
57}; 57};
58 58
59static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id) 59static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/sc1200.c b/drivers/ide/pci/sc1200.c
index 54c5c98a2e26..d2c8b5524f28 100644
--- a/drivers/ide/pci/sc1200.c
+++ b/drivers/ide/pci/sc1200.c
@@ -362,33 +362,26 @@ static int sc1200_resume (struct pci_dev *dev)
362 */ 362 */
363static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) 363static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif)
364{ 364{
365 if (hwif->mate)
366 hwif->serialized = hwif->mate->serialized = 1;
367
368 hwif->set_pio_mode = &sc1200_set_pio_mode; 365 hwif->set_pio_mode = &sc1200_set_pio_mode;
369 hwif->set_dma_mode = &sc1200_set_dma_mode; 366 hwif->set_dma_mode = &sc1200_set_dma_mode;
370 367
371 hwif->drives[0].autotune = 1;
372 hwif->drives[1].autotune = 1;
373
374 if (hwif->dma_base == 0) 368 if (hwif->dma_base == 0)
375 return; 369 return;
376 370
377 hwif->udma_filter = sc1200_udma_filter; 371 hwif->udma_filter = sc1200_udma_filter;
378 hwif->ide_dma_end = &sc1200_ide_dma_end; 372 hwif->ide_dma_end = &sc1200_ide_dma_end;
379
380 hwif->atapi_dma = 1;
381 hwif->ultra_mask = 0x07;
382 hwif->mwdma_mask = 0x07;
383} 373}
384 374
385static ide_pci_device_t sc1200_chipset __devinitdata = { 375static const struct ide_port_info sc1200_chipset __devinitdata = {
386 .name = "SC1200", 376 .name = "SC1200",
387 .init_hwif = init_hwif_sc1200, 377 .init_hwif = init_hwif_sc1200,
388 .autodma = AUTODMA, 378 .host_flags = IDE_HFLAG_SERIALIZE |
389 .bootable = ON_BOARD, 379 IDE_HFLAG_POST_SET_MODE |
390 .host_flags = IDE_HFLAG_ABUSE_DMA_MODES | IDE_HFLAG_POST_SET_MODE, 380 IDE_HFLAG_ABUSE_DMA_MODES |
381 IDE_HFLAG_BOOTABLE,
391 .pio_mask = ATA_PIO4, 382 .pio_mask = ATA_PIO4,
383 .mwdma_mask = ATA_MWDMA2,
384 .udma_mask = ATA_UDMA2,
392}; 385};
393 386
394static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) 387static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index bd4c1d3070e4..ebb7132b9b84 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -472,7 +472,7 @@ static u8 scc_udma_filter(ide_drive_t *drive)
472 if ((drive->media != ide_disk) && (mask & 0xE0)) { 472 if ((drive->media != ide_disk) && (mask & 0xE0)) {
473 printk(KERN_INFO "%s: limit %s to UDMA4\n", 473 printk(KERN_INFO "%s: limit %s to UDMA4\n",
474 SCC_PATA_NAME, drive->name); 474 SCC_PATA_NAME, drive->name);
475 mask = 0x1F; 475 mask = ATA_UDMA4;
476 } 476 }
477 477
478 return mask; 478 return mask;
@@ -538,12 +538,13 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name)
538/** 538/**
539 * init_setup_scc - set up an SCC PATA Controller 539 * init_setup_scc - set up an SCC PATA Controller
540 * @dev: PCI device 540 * @dev: PCI device
541 * @d: IDE PCI device 541 * @d: IDE port info
542 * 542 *
543 * Perform the initial set up for this device. 543 * Perform the initial set up for this device.
544 */ 544 */
545 545
546static int __devinit init_setup_scc(struct pci_dev *dev, ide_pci_device_t *d) 546static int __devinit init_setup_scc(struct pci_dev *dev,
547 const struct ide_port_info *d)
547{ 548{
548 unsigned long ctl_base; 549 unsigned long ctl_base;
549 unsigned long dma_base; 550 unsigned long dma_base;
@@ -683,17 +684,10 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
683 hwif->ide_dma_test_irq = scc_dma_test_irq; 684 hwif->ide_dma_test_irq = scc_dma_test_irq;
684 hwif->udma_filter = scc_udma_filter; 685 hwif->udma_filter = scc_udma_filter;
685 686
686 hwif->drives[0].autotune = IDE_TUNE_AUTO; 687 if (in_be32((void __iomem *)(hwif->config_data + 0xff0)) & CCKCTRL_ATACLKOEN)
687 hwif->drives[1].autotune = IDE_TUNE_AUTO; 688 hwif->ultra_mask = ATA_UDMA6; /* 133MHz */
688 689 else
689 if (in_be32((void __iomem *)(hwif->config_data + 0xff0)) & CCKCTRL_ATACLKOEN) { 690 hwif->ultra_mask = ATA_UDMA5; /* 100MHz */
690 hwif->ultra_mask = 0x7f; /* 133MHz */
691 } else {
692 hwif->ultra_mask = 0x3f; /* 100MHz */
693 }
694 hwif->mwdma_mask = 0x00;
695 hwif->swdma_mask = 0x00;
696 hwif->atapi_dma = 1;
697 691
698 /* we support 80c cable only. */ 692 /* we support 80c cable only. */
699 hwif->cbl = ATA_CBL_PATA80; 693 hwif->cbl = ATA_CBL_PATA80;
@@ -702,16 +696,14 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
702#define DECLARE_SCC_DEV(name_str) \ 696#define DECLARE_SCC_DEV(name_str) \
703 { \ 697 { \
704 .name = name_str, \ 698 .name = name_str, \
705 .init_setup = init_setup_scc, \
706 .init_iops = init_iops_scc, \ 699 .init_iops = init_iops_scc, \
707 .init_hwif = init_hwif_scc, \ 700 .init_hwif = init_hwif_scc, \
708 .autodma = AUTODMA, \ 701 .host_flags = IDE_HFLAG_SINGLE | \
709 .bootable = ON_BOARD, \ 702 IDE_HFLAG_BOOTABLE, \
710 .host_flags = IDE_HFLAG_SINGLE, \
711 .pio_mask = ATA_PIO4, \ 703 .pio_mask = ATA_PIO4, \
712 } 704 }
713 705
714static ide_pci_device_t scc_chipsets[] __devinitdata = { 706static const struct ide_port_info scc_chipsets[] __devinitdata = {
715 /* 0 */ DECLARE_SCC_DEV("sccIDE"), 707 /* 0 */ DECLARE_SCC_DEV("sccIDE"),
716}; 708};
717 709
@@ -726,8 +718,7 @@ static ide_pci_device_t scc_chipsets[] __devinitdata = {
726 718
727static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) 719static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id)
728{ 720{
729 ide_pci_device_t *d = &scc_chipsets[id->driver_data]; 721 return init_setup_scc(dev, &scc_chipsets[id->driver_data]);
730 return d->init_setup(dev, d);
731} 722}
732 723
733/** 724/**
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index d3ffc52e22af..a7280311357b 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -158,13 +158,6 @@ static void svwks_set_dma_mode(ide_drive_t *drive, const u8 speed)
158 158
159 u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; 159 u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0;
160 160
161 /* If we are about to put a disk into UDMA mode we screwed up.
162 Our code assumes we never _ever_ do this on an OSB4 */
163
164 if(dev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4 &&
165 drive->media == ide_disk && speed >= XFER_UDMA_0)
166 BUG();
167
168 pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); 161 pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing);
169 pci_read_config_byte(dev, 0x54, &ultra_enable); 162 pci_read_config_byte(dev, 0x54, &ultra_enable);
170 163
@@ -360,23 +353,10 @@ static u8 __devinit ata66_svwks(ide_hwif_t *hwif)
360 353
361static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 354static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
362{ 355{
363 if (!hwif->irq)
364 hwif->irq = hwif->channel ? 15 : 14;
365
366 hwif->set_pio_mode = &svwks_set_pio_mode; 356 hwif->set_pio_mode = &svwks_set_pio_mode;
367 hwif->set_dma_mode = &svwks_set_dma_mode; 357 hwif->set_dma_mode = &svwks_set_dma_mode;
368 hwif->udma_filter = &svwks_udma_filter; 358 hwif->udma_filter = &svwks_udma_filter;
369 359
370 hwif->atapi_dma = 1;
371
372 if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE)
373 hwif->ultra_mask = 0x3f;
374
375 hwif->mwdma_mask = 0x07;
376
377 hwif->drives[0].autotune = 1;
378 hwif->drives[1].autotune = 1;
379
380 if (!hwif->dma_base) 360 if (!hwif->dma_base)
381 return; 361 return;
382 362
@@ -386,72 +366,49 @@ static void __devinit init_hwif_svwks (ide_hwif_t *hwif)
386 } 366 }
387} 367}
388 368
389static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) 369static const struct ide_port_info serverworks_chipsets[] __devinitdata = {
390{
391 return ide_setup_pci_device(dev, d);
392}
393
394static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d)
395{
396 if (!(PCI_FUNC(dev->devfn) & 1)) {
397 d->bootable = NEVER_BOARD;
398 if (dev->resource[0].start == 0x01f1)
399 d->bootable = ON_BOARD;
400 }
401
402 if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ||
403 dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) &&
404 (!(PCI_FUNC(dev->devfn) & 1)))
405 d->host_flags |= IDE_HFLAG_SINGLE;
406 else
407 d->host_flags &= ~IDE_HFLAG_SINGLE;
408
409 return ide_setup_pci_device(dev, d);
410}
411
412static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
413 { /* 0 */ 370 { /* 0 */
414 .name = "SvrWks OSB4", 371 .name = "SvrWks OSB4",
415 .init_setup = init_setup_svwks,
416 .init_chipset = init_chipset_svwks, 372 .init_chipset = init_chipset_svwks,
417 .init_hwif = init_hwif_svwks, 373 .init_hwif = init_hwif_svwks,
418 .autodma = AUTODMA, 374 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
419 .bootable = ON_BOARD,
420 .pio_mask = ATA_PIO4, 375 .pio_mask = ATA_PIO4,
376 .mwdma_mask = ATA_MWDMA2,
377 .udma_mask = 0x00, /* UDMA is problematic on OSB4 */
421 },{ /* 1 */ 378 },{ /* 1 */
422 .name = "SvrWks CSB5", 379 .name = "SvrWks CSB5",
423 .init_setup = init_setup_svwks,
424 .init_chipset = init_chipset_svwks, 380 .init_chipset = init_chipset_svwks,
425 .init_hwif = init_hwif_svwks, 381 .init_hwif = init_hwif_svwks,
426 .autodma = AUTODMA, 382 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
427 .bootable = ON_BOARD,
428 .pio_mask = ATA_PIO4, 383 .pio_mask = ATA_PIO4,
384 .mwdma_mask = ATA_MWDMA2,
385 .udma_mask = ATA_UDMA5,
429 },{ /* 2 */ 386 },{ /* 2 */
430 .name = "SvrWks CSB6", 387 .name = "SvrWks CSB6",
431 .init_setup = init_setup_csb6,
432 .init_chipset = init_chipset_svwks, 388 .init_chipset = init_chipset_svwks,
433 .init_hwif = init_hwif_svwks, 389 .init_hwif = init_hwif_svwks,
434 .autodma = AUTODMA, 390 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
435 .bootable = ON_BOARD,
436 .pio_mask = ATA_PIO4, 391 .pio_mask = ATA_PIO4,
392 .mwdma_mask = ATA_MWDMA2,
393 .udma_mask = ATA_UDMA5,
437 },{ /* 3 */ 394 },{ /* 3 */
438 .name = "SvrWks CSB6", 395 .name = "SvrWks CSB6",
439 .init_setup = init_setup_csb6,
440 .init_chipset = init_chipset_svwks, 396 .init_chipset = init_chipset_svwks,
441 .init_hwif = init_hwif_svwks, 397 .init_hwif = init_hwif_svwks,
442 .autodma = AUTODMA, 398 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE |
443 .bootable = ON_BOARD, 399 IDE_HFLAG_BOOTABLE,
444 .host_flags = IDE_HFLAG_SINGLE,
445 .pio_mask = ATA_PIO4, 400 .pio_mask = ATA_PIO4,
401 .mwdma_mask = ATA_MWDMA2,
402 .udma_mask = ATA_UDMA5,
446 },{ /* 4 */ 403 },{ /* 4 */
447 .name = "SvrWks HT1000", 404 .name = "SvrWks HT1000",
448 .init_setup = init_setup_svwks,
449 .init_chipset = init_chipset_svwks, 405 .init_chipset = init_chipset_svwks,
450 .init_hwif = init_hwif_svwks, 406 .init_hwif = init_hwif_svwks,
451 .autodma = AUTODMA, 407 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_SINGLE |
452 .bootable = ON_BOARD, 408 IDE_HFLAG_BOOTABLE,
453 .host_flags = IDE_HFLAG_SINGLE,
454 .pio_mask = ATA_PIO4, 409 .pio_mask = ATA_PIO4,
410 .mwdma_mask = ATA_MWDMA2,
411 .udma_mask = ATA_UDMA5,
455 } 412 }
456}; 413};
457 414
@@ -466,9 +423,21 @@ static ide_pci_device_t serverworks_chipsets[] __devinitdata = {
466 423
467static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id) 424static int __devinit svwks_init_one(struct pci_dev *dev, const struct pci_device_id *id)
468{ 425{
469 ide_pci_device_t *d = &serverworks_chipsets[id->driver_data]; 426 struct ide_port_info d;
427 u8 idx = id->driver_data;
428
429 d = serverworks_chipsets[idx];
430
431 if (idx == 2 || idx == 3) {
432 if ((PCI_FUNC(dev->devfn) & 1) == 0) {
433 if (pci_resource_start(dev, 0) != 0x01f1)
434 d.host_flags &= ~IDE_HFLAG_BOOTABLE;
435 d.host_flags |= IDE_HFLAG_SINGLE;
436 } else
437 d.host_flags &= ~IDE_HFLAG_SINGLE;
438 }
470 439
471 return d->init_setup(dev, d); 440 return ide_setup_pci_device(dev, &d);
472} 441}
473 442
474static const struct pci_device_id svwks_pci_tbl[] = { 443static const struct pci_device_id svwks_pci_tbl[] = {
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 9a9474f534e5..de820aa58cd0 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -592,8 +592,7 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
592 if (hwif->dma_base == 0) 592 if (hwif->dma_base == 0)
593 return; 593 return;
594 594
595 hwif->atapi_dma = 1; 595 hwif->mwdma_mask = ATA_MWDMA2_ONLY;
596 hwif->mwdma_mask = 0x04;
597 596
598 hwif->dma_setup = &sgiioc4_ide_dma_setup; 597 hwif->dma_setup = &sgiioc4_ide_dma_setup;
599 hwif->dma_start = &sgiioc4_ide_dma_start; 598 hwif->dma_start = &sgiioc4_ide_dma_start;
@@ -615,6 +614,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
615 void __iomem *virt_base; 614 void __iomem *virt_base;
616 ide_hwif_t *hwif; 615 ide_hwif_t *hwif;
617 int h; 616 int h;
617 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
618 618
619 /* 619 /*
620 * Find an empty HWIF; if none available, return -ENOMEM. 620 * Find an empty HWIF; if none available, return -ENOMEM.
@@ -655,10 +655,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
655 } 655 }
656 656
657 if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) { 657 if (hwif->io_ports[IDE_DATA_OFFSET] != cmd_base) {
658 hw_regs_t hw;
659
658 /* Initialize the IO registers */ 660 /* Initialize the IO registers */
659 sgiioc4_init_hwif_ports(&hwif->hw, cmd_base, ctl, irqport); 661 memset(&hw, 0, sizeof(hw));
660 memcpy(hwif->io_ports, hwif->hw.io_ports, 662 sgiioc4_init_hwif_ports(&hw, cmd_base, ctl, irqport);
661 sizeof (hwif->io_ports)); 663 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
662 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 664 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
663 } 665 }
664 666
@@ -680,11 +682,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
680 682
681 ide_init_sgiioc4(hwif); 683 ide_init_sgiioc4(hwif);
682 684
683 if (probe_hwif_init(hwif)) 685 idx[0] = hwif->index;
684 return -EIO;
685 686
686 /* Create /proc/ide entries */ 687 if (ide_device_add(idx))
687 ide_proc_register_port(hwif); 688 return -EIO;
688 689
689 return 0; 690 return 0;
690} 691}
@@ -692,14 +693,12 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
692static unsigned int __devinit 693static unsigned int __devinit
693pci_init_sgiioc4(struct pci_dev *dev) 694pci_init_sgiioc4(struct pci_dev *dev)
694{ 695{
695 unsigned int class_rev;
696 int ret; 696 int ret;
697 697
698 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
699 class_rev &= 0xff;
700 printk(KERN_INFO "%s: IDE controller at PCI slot %s, revision %d\n", 698 printk(KERN_INFO "%s: IDE controller at PCI slot %s, revision %d\n",
701 DRV_NAME, pci_name(dev), class_rev); 699 DRV_NAME, pci_name(dev), dev->revision);
702 if (class_rev < IOC4_SUPPORTED_FIRMWARE_REV) { 700
701 if (dev->revision < IOC4_SUPPORTED_FIRMWARE_REV) {
703 printk(KERN_ERR "Skipping %s IDE controller in slot %s: " 702 printk(KERN_ERR "Skipping %s IDE controller in slot %s: "
704 "firmware is obsolete - please upgrade to " 703 "firmware is obsolete - please upgrade to "
705 "revision46 or higher\n", 704 "revision46 or higher\n",
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 85d0afd00e66..6d99441c605b 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/siimage.c Version 1.16 Jul 13 2007 2 * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007
3 * 3 *
4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com>
@@ -26,7 +26,7 @@
26 * 26 *
27 * If you have strange problems with nVidia chipset systems please 27 * If you have strange problems with nVidia chipset systems please
28 * see the SI support documentation and update your system BIOS 28 * see the SI support documentation and update your system BIOS
29 * if neccessary 29 * if necessary
30 * 30 *
31 * The Dell DRAC4 has some interesting features including effectively hot 31 * The Dell DRAC4 has some interesting features including effectively hot
32 * unplugging/replugging the virtual CD interface when the DRAC is reset. 32 * unplugging/replugging the virtual CD interface when the DRAC is reset.
@@ -57,8 +57,8 @@
57 57
58static int pdev_is_sata(struct pci_dev *pdev) 58static int pdev_is_sata(struct pci_dev *pdev)
59{ 59{
60 switch(pdev->device) 60#ifdef CONFIG_BLK_DEV_IDE_SATA
61 { 61 switch(pdev->device) {
62 case PCI_DEVICE_ID_SII_3112: 62 case PCI_DEVICE_ID_SII_3112:
63 case PCI_DEVICE_ID_SII_1210SA: 63 case PCI_DEVICE_ID_SII_1210SA:
64 return 1; 64 return 1;
@@ -66,9 +66,10 @@ static int pdev_is_sata(struct pci_dev *pdev)
66 return 0; 66 return 0;
67 } 67 }
68 BUG(); 68 BUG();
69#endif
69 return 0; 70 return 0;
70} 71}
71 72
72/** 73/**
73 * is_sata - check if hwif is SATA 74 * is_sata - check if hwif is SATA
74 * @hwif: interface to check 75 * @hwif: interface to check
@@ -136,7 +137,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r)
136 * SI3112 SATA controller life is a bit simpler. 137 * SI3112 SATA controller life is a bit simpler.
137 */ 138 */
138 139
139static u8 sil_udma_filter(ide_drive_t *drive) 140static u8 sil_pata_udma_filter(ide_drive_t *drive)
140{ 141{
141 ide_hwif_t *hwif = drive->hwif; 142 ide_hwif_t *hwif = drive->hwif;
142 unsigned long base = (unsigned long) hwif->hwif_data; 143 unsigned long base = (unsigned long) hwif->hwif_data;
@@ -147,23 +148,23 @@ static u8 sil_udma_filter(ide_drive_t *drive)
147 else 148 else
148 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); 149 pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc);
149 150
150 if (is_sata(hwif)) {
151 mask = strstr(drive->id->model, "Maxtor") ? 0x3f : 0x7f;
152 goto out;
153 }
154
155 if ((scsc & 0x30) == 0x10) /* 133 */ 151 if ((scsc & 0x30) == 0x10) /* 133 */
156 mask = 0x7f; 152 mask = ATA_UDMA6;
157 else if ((scsc & 0x30) == 0x20) /* 2xPCI */ 153 else if ((scsc & 0x30) == 0x20) /* 2xPCI */
158 mask = 0x7f; 154 mask = ATA_UDMA6;
159 else if ((scsc & 0x30) == 0x00) /* 100 */ 155 else if ((scsc & 0x30) == 0x00) /* 100 */
160 mask = 0x3f; 156 mask = ATA_UDMA5;
161 else /* Disabled ? */ 157 else /* Disabled ? */
162 BUG(); 158 BUG();
163out: 159
164 return mask; 160 return mask;
165} 161}
166 162
163static u8 sil_sata_udma_filter(ide_drive_t *drive)
164{
165 return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6;
166}
167
167/** 168/**
168 * sil_set_pio_mode - set host controller for PIO mode 169 * sil_set_pio_mode - set host controller for PIO mode
169 * @drive: drive 170 * @drive: drive
@@ -180,7 +181,7 @@ static void sil_set_pio_mode(ide_drive_t *drive, u8 pio)
180 const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 181 const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 };
181 182
182 ide_hwif_t *hwif = HWIF(drive); 183 ide_hwif_t *hwif = HWIF(drive);
183 ide_drive_t *pair = &hwif->drives[drive->dn ^ 1]; 184 ide_drive_t *pair = ide_get_paired_drive(drive);
184 u32 speedt = 0; 185 u32 speedt = 0;
185 u16 speedp = 0; 186 u16 speedp = 0;
186 unsigned long addr = siimage_seldev(drive, 0x04); 187 unsigned long addr = siimage_seldev(drive, 0x04);
@@ -340,10 +341,11 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
340static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) 341static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
341{ 342{
342 ide_hwif_t *hwif = HWIF(drive); 343 ide_hwif_t *hwif = HWIF(drive);
343 unsigned long base = (unsigned long)hwif->hwif_data;
344 unsigned long addr = siimage_selreg(hwif, 0x1); 344 unsigned long addr = siimage_selreg(hwif, 0x1);
345 345
346 if (SATA_ERROR_REG) { 346 if (SATA_ERROR_REG) {
347 unsigned long base = (unsigned long)hwif->hwif_data;
348
347 u32 ext_stat = readl((void __iomem *)(base + 0x10)); 349 u32 ext_stat = readl((void __iomem *)(base + 0x10));
348 u8 watchdog = 0; 350 u8 watchdog = 0;
349 if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { 351 if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) {
@@ -376,7 +378,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
376} 378}
377 379
378/** 380/**
379 * siimage_busproc - bus isolation ioctl 381 * sil_sata_busproc - bus isolation IOCTL
380 * @drive: drive to isolate/restore 382 * @drive: drive to isolate/restore
381 * @state: bus state to set 383 * @state: bus state to set
382 * 384 *
@@ -384,8 +386,8 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
384 * SATA controller the work required is quite limited, we 386 * SATA controller the work required is quite limited, we
385 * just have to clean up the statistics 387 * just have to clean up the statistics
386 */ 388 */
387 389
388static int siimage_busproc (ide_drive_t * drive, int state) 390static int sil_sata_busproc(ide_drive_t * drive, int state)
389{ 391{
390 ide_hwif_t *hwif = HWIF(drive); 392 ide_hwif_t *hwif = HWIF(drive);
391 u32 stat_config = 0; 393 u32 stat_config = 0;
@@ -417,14 +419,14 @@ static int siimage_busproc (ide_drive_t * drive, int state)
417} 419}
418 420
419/** 421/**
420 * siimage_reset_poll - wait for sata reset 422 * sil_sata_reset_poll - wait for SATA reset
421 * @drive: drive we are resetting 423 * @drive: drive we are resetting
422 * 424 *
423 * Poll the SATA phy and see whether it has come back from the dead 425 * Poll the SATA phy and see whether it has come back from the dead
424 * yet. 426 * yet.
425 */ 427 */
426 428
427static int siimage_reset_poll (ide_drive_t *drive) 429static int sil_sata_reset_poll(ide_drive_t *drive)
428{ 430{
429 if (SATA_STATUS_REG) { 431 if (SATA_STATUS_REG) {
430 ide_hwif_t *hwif = HWIF(drive); 432 ide_hwif_t *hwif = HWIF(drive);
@@ -436,27 +438,22 @@ static int siimage_reset_poll (ide_drive_t *drive)
436 HWGROUP(drive)->polling = 0; 438 HWGROUP(drive)->polling = 0;
437 return ide_started; 439 return ide_started;
438 } 440 }
439 return 0;
440 } else {
441 return 0;
442 } 441 }
442
443 return 0;
443} 444}
444 445
445/** 446/**
446 * siimage_pre_reset - reset hook 447 * sil_sata_pre_reset - reset hook
447 * @drive: IDE device being reset 448 * @drive: IDE device being reset
448 * 449 *
449 * For the SATA devices we need to handle recalibration/geometry 450 * For the SATA devices we need to handle recalibration/geometry
450 * differently 451 * differently
451 */ 452 */
452
453static void siimage_pre_reset (ide_drive_t *drive)
454{
455 if (drive->media != ide_disk)
456 return;
457 453
458 if (is_sata(HWIF(drive))) 454static void sil_sata_pre_reset(ide_drive_t *drive)
459 { 455{
456 if (drive->media == ide_disk) {
460 drive->special.b.set_geometry = 0; 457 drive->special.b.set_geometry = 0;
461 drive->special.b.recalibrate = 0; 458 drive->special.b.recalibrate = 0;
462 } 459 }
@@ -502,7 +499,6 @@ static void siimage_reset (ide_drive_t *drive)
502 drive->failures++; 499 drive->failures++;
503 } 500 }
504 } 501 }
505
506} 502}
507 503
508/** 504/**
@@ -640,13 +636,9 @@ static unsigned int setup_mmio_siimage (struct pci_dev *dev, const char *name)
640 636
641static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name) 637static unsigned int __devinit init_chipset_siimage(struct pci_dev *dev, const char *name)
642{ 638{
643 u32 class_rev = 0; 639 u8 rev = dev->revision, tmpbyte = 0, BA5_EN = 0;
644 u8 tmpbyte = 0;
645 u8 BA5_EN = 0;
646 640
647 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); 641 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, rev ? 1 : 255);
648 class_rev &= 0xff;
649 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (class_rev) ? 1 : 255);
650 642
651 pci_read_config_byte(dev, 0x8A, &BA5_EN); 643 pci_read_config_byte(dev, 0x8A, &BA5_EN);
652 if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) { 644 if ((BA5_EN & 0x01) || (pci_resource_start(dev, 5))) {
@@ -762,16 +754,11 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
762 hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148; 754 hwif->sata_misc[SATA_IEN_OFFSET] = base + 0x148;
763 } 755 }
764 756
765 hw.irq = hwif->pci_dev->irq; 757 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
766
767 memcpy(&hwif->hw, &hw, sizeof(hw));
768 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
769 758
770 hwif->irq = hw.irq; 759 hwif->irq = dev->irq;
771 760
772 base = (unsigned long) addr; 761 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00);
773
774 hwif->dma_base = base + (ch ? 0x08 : 0x00);
775 762
776 hwif->mmio = 1; 763 hwif->mmio = 1;
777} 764}
@@ -825,19 +812,14 @@ static void __devinit siimage_fixup(ide_hwif_t *hwif)
825 812
826static void __devinit init_iops_siimage(ide_hwif_t *hwif) 813static void __devinit init_iops_siimage(ide_hwif_t *hwif)
827{ 814{
828 struct pci_dev *dev = hwif->pci_dev;
829 u32 class_rev = 0;
830
831 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
832 class_rev &= 0xff;
833
834 hwif->hwif_data = NULL; 815 hwif->hwif_data = NULL;
835 816
836 /* Pessimal until we finish probing */ 817 /* Pessimal until we finish probing */
837 hwif->rqsize = 15; 818 hwif->rqsize = 15;
838 819
839 if (pci_get_drvdata(dev) == NULL) 820 if (pci_get_drvdata(hwif->pci_dev) == NULL)
840 return; 821 return;
822
841 init_mmio_iops_siimage(hwif); 823 init_mmio_iops_siimage(hwif);
842} 824}
843 825
@@ -873,34 +855,32 @@ static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
873 855
874static void __devinit init_hwif_siimage(ide_hwif_t *hwif) 856static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
875{ 857{
858 u8 sata = is_sata(hwif);
859
876 hwif->resetproc = &siimage_reset; 860 hwif->resetproc = &siimage_reset;
877 hwif->set_pio_mode = &sil_set_pio_mode; 861 hwif->set_pio_mode = &sil_set_pio_mode;
878 hwif->set_dma_mode = &sil_set_dma_mode; 862 hwif->set_dma_mode = &sil_set_dma_mode;
879 hwif->reset_poll = &siimage_reset_poll;
880 hwif->pre_reset = &siimage_pre_reset;
881 hwif->udma_filter = &sil_udma_filter;
882 863
883 if(is_sata(hwif)) { 864 if (sata) {
884 static int first = 1; 865 static int first = 1;
885 866
886 hwif->busproc = &siimage_busproc; 867 hwif->busproc = &sil_sata_busproc;
868 hwif->reset_poll = &sil_sata_reset_poll;
869 hwif->pre_reset = &sil_sata_pre_reset;
870 hwif->udma_filter = &sil_sata_udma_filter;
887 871
888 if (first) { 872 if (first) {
889 printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); 873 printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
890 first = 0; 874 first = 0;
891 } 875 }
892 } 876 } else
893 877 hwif->udma_filter = &sil_pata_udma_filter;
894 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
895 878
896 if (hwif->dma_base == 0) 879 if (hwif->dma_base == 0)
897 return; 880 return;
898 881
899 hwif->ultra_mask = 0x7f; 882 if (sata)
900 hwif->mwdma_mask = 0x07; 883 hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
901
902 if (!is_sata(hwif))
903 hwif->atapi_dma = 1;
904 884
905 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 885 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
906 hwif->cbl = ata66_siimage(hwif); 886 hwif->cbl = ata66_siimage(hwif);
@@ -919,12 +899,13 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
919 .init_iops = init_iops_siimage, \ 899 .init_iops = init_iops_siimage, \
920 .init_hwif = init_hwif_siimage, \ 900 .init_hwif = init_hwif_siimage, \
921 .fixup = siimage_fixup, \ 901 .fixup = siimage_fixup, \
922 .autodma = AUTODMA, \ 902 .host_flags = IDE_HFLAG_BOOTABLE, \
923 .bootable = ON_BOARD, \
924 .pio_mask = ATA_PIO4, \ 903 .pio_mask = ATA_PIO4, \
904 .mwdma_mask = ATA_MWDMA2, \
905 .udma_mask = ATA_UDMA6, \
925 } 906 }
926 907
927static ide_pci_device_t siimage_chipsets[] __devinitdata = { 908static const struct ide_port_info siimage_chipsets[] __devinitdata = {
928 /* 0 */ DECLARE_SII_DEV("SiI680"), 909 /* 0 */ DECLARE_SII_DEV("SiI680"),
929 /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"), 910 /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"),
930 /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA") 911 /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA")
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 5a54e2e20b3c..6b7bb53acefd 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -264,7 +264,7 @@ static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode)
264 if (mode >= XFER_MW_DMA_0) { 264 if (mode >= XFER_MW_DMA_0) {
265 t1 &= ~0x04; /* disable UDMA */ 265 t1 &= ~0x04; /* disable UDMA */
266 idx = mode - XFER_MW_DMA_0 + 5; 266 idx = mode - XFER_MW_DMA_0 + 5;
267 } 267 } else
268 idx = mode - XFER_PIO_0; 268 idx = mode - XFER_PIO_0;
269 t1 |= ini_time_value[clk][idx] << 12; 269 t1 |= ini_time_value[clk][idx] << 12;
270 t1 |= act_time_value[clk][idx] << 16; 270 t1 |= act_time_value[clk][idx] << 16;
@@ -564,38 +564,30 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
564{ 564{
565 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f }; 565 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
566 566
567 if (!hwif->irq)
568 hwif->irq = hwif->channel ? 15 : 14;
569
570 hwif->set_pio_mode = &sis_set_pio_mode; 567 hwif->set_pio_mode = &sis_set_pio_mode;
571 hwif->set_dma_mode = &sis_set_dma_mode; 568 hwif->set_dma_mode = &sis_set_dma_mode;
572 569
573 if (chipset_family >= ATA_133) 570 if (chipset_family >= ATA_133)
574 hwif->udma_filter = sis5513_ata133_udma_filter; 571 hwif->udma_filter = sis5513_ata133_udma_filter;
575 572
576 hwif->drives[0].autotune = 1;
577 hwif->drives[1].autotune = 1;
578
579 if (hwif->dma_base == 0) 573 if (hwif->dma_base == 0)
580 return; 574 return;
581 575
582 hwif->atapi_dma = 1;
583
584 hwif->ultra_mask = udma_rates[chipset_family]; 576 hwif->ultra_mask = udma_rates[chipset_family];
585 hwif->mwdma_mask = 0x07;
586 577
587 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 578 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
588 hwif->cbl = ata66_sis5513(hwif); 579 hwif->cbl = ata66_sis5513(hwif);
589} 580}
590 581
591static ide_pci_device_t sis5513_chipset __devinitdata = { 582static const struct ide_port_info sis5513_chipset __devinitdata = {
592 .name = "SIS5513", 583 .name = "SIS5513",
593 .init_chipset = init_chipset_sis5513, 584 .init_chipset = init_chipset_sis5513,
594 .init_hwif = init_hwif_sis5513, 585 .init_hwif = init_hwif_sis5513,
595 .autodma = NOAUTODMA,
596 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 586 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
597 .bootable = ON_BOARD, 587 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_NO_AUTODMA |
588 IDE_HFLAG_BOOTABLE,
598 .pio_mask = ATA_PIO4, 589 .pio_mask = ATA_PIO4,
590 .mwdma_mask = ATA_MWDMA2,
599}; 591};
600 592
601static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) 593static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 771efb8884c8..147d783f7529 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -361,19 +361,6 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
361 hwif->selectproc = &sl82c105_selectproc; 361 hwif->selectproc = &sl82c105_selectproc;
362 hwif->resetproc = &sl82c105_resetproc; 362 hwif->resetproc = &sl82c105_resetproc;
363 363
364 /*
365 * We support 32-bit I/O on this interface, and
366 * it doesn't have problems with interrupts.
367 */
368 hwif->drives[0].io_32bit = hwif->drives[1].io_32bit = 1;
369 hwif->drives[0].unmask = hwif->drives[1].unmask = 1;
370
371 /*
372 * We always autotune PIO, this is done before DMA is checked,
373 * so there's no risk of accidentally disabling DMA
374 */
375 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
376
377 if (!hwif->dma_base) 364 if (!hwif->dma_base)
378 return; 365 return;
379 366
@@ -388,8 +375,7 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
388 return; 375 return;
389 } 376 }
390 377
391 hwif->atapi_dma = 1; 378 hwif->mwdma_mask = ATA_MWDMA2;
392 hwif->mwdma_mask = 0x07;
393 379
394 hwif->ide_dma_on = &sl82c105_ide_dma_on; 380 hwif->ide_dma_on = &sl82c105_ide_dma_on;
395 hwif->dma_off_quietly = &sl82c105_dma_off_quietly; 381 hwif->dma_off_quietly = &sl82c105_dma_off_quietly;
@@ -401,13 +387,15 @@ static void __devinit init_hwif_sl82c105(ide_hwif_t *hwif)
401 hwif->serialized = hwif->mate->serialized = 1; 387 hwif->serialized = hwif->mate->serialized = 1;
402} 388}
403 389
404static ide_pci_device_t sl82c105_chipset __devinitdata = { 390static const struct ide_port_info sl82c105_chipset __devinitdata = {
405 .name = "W82C105", 391 .name = "W82C105",
406 .init_chipset = init_chipset_sl82c105, 392 .init_chipset = init_chipset_sl82c105,
407 .init_hwif = init_hwif_sl82c105, 393 .init_hwif = init_hwif_sl82c105,
408 .autodma = NOAUTODMA,
409 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 394 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}},
410 .bootable = ON_BOARD, 395 .host_flags = IDE_HFLAG_IO_32BIT |
396 IDE_HFLAG_UNMASK_IRQS |
397 IDE_HFLAG_NO_AUTODMA |
398 IDE_HFLAG_BOOTABLE,
411 .pio_mask = ATA_PIO5, 399 .pio_mask = ATA_PIO5,
412}; 400};
413 401
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index fa8df6d43832..eb4445b229ed 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/slc90e66.c Version 0.18 Aug 9, 2007 2 * linux/drivers/ide/pci/slc90e66.c Version 0.19 Sep 24, 2007
3 * 3 *
4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com>
@@ -21,6 +21,8 @@
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23 23
24static DEFINE_SPINLOCK(slc90e66_lock);
25
24static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio) 26static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
25{ 27{
26 ide_hwif_t *hwif = HWIF(drive); 28 ide_hwif_t *hwif = HWIF(drive);
@@ -40,7 +42,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
40 { 2, 1 }, 42 { 2, 1 },
41 { 2, 3 }, }; 43 { 2, 3 }, };
42 44
43 spin_lock_irqsave(&ide_lock, flags); 45 spin_lock_irqsave(&slc90e66_lock, flags);
44 pci_read_config_word(dev, master_port, &master_data); 46 pci_read_config_word(dev, master_port, &master_data);
45 47
46 if (pio > 1) 48 if (pio > 1)
@@ -71,7 +73,7 @@ static void slc90e66_set_pio_mode(ide_drive_t *drive, const u8 pio)
71 pci_write_config_word(dev, master_port, master_data); 73 pci_write_config_word(dev, master_port, master_data);
72 if (is_slave) 74 if (is_slave)
73 pci_write_config_byte(dev, slave_port, slave_data); 75 pci_write_config_byte(dev, slave_port, slave_data);
74 spin_unlock_irqrestore(&ide_lock, flags); 76 spin_unlock_irqrestore(&slc90e66_lock, flags);
75} 77}
76 78
77static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) 79static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
@@ -133,37 +135,28 @@ static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
133 u8 reg47 = 0; 135 u8 reg47 = 0;
134 u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ 136 u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */
135 137
136 if (!hwif->irq)
137 hwif->irq = hwif->channel ? 15 : 14;
138
139 hwif->set_pio_mode = &slc90e66_set_pio_mode; 138 hwif->set_pio_mode = &slc90e66_set_pio_mode;
140 hwif->set_dma_mode = &slc90e66_set_dma_mode; 139 hwif->set_dma_mode = &slc90e66_set_dma_mode;
141 140
142 pci_read_config_byte(hwif->pci_dev, 0x47, &reg47); 141 pci_read_config_byte(hwif->pci_dev, 0x47, &reg47);
143 142
144 hwif->drives[0].autotune = 1;
145 hwif->drives[1].autotune = 1;
146
147 if (hwif->dma_base == 0) 143 if (hwif->dma_base == 0)
148 return; 144 return;
149 145
150 hwif->atapi_dma = 1;
151 hwif->ultra_mask = 0x1f;
152 hwif->mwdma_mask = 0x06;
153 hwif->swdma_mask = 0x04;
154
155 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 146 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
156 /* bit[0(1)]: 0:80, 1:40 */ 147 /* bit[0(1)]: 0:80, 1:40 */
157 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 148 hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
158} 149}
159 150
160static ide_pci_device_t slc90e66_chipset __devinitdata = { 151static const struct ide_port_info slc90e66_chipset __devinitdata = {
161 .name = "SLC90E66", 152 .name = "SLC90E66",
162 .init_hwif = init_hwif_slc90e66, 153 .init_hwif = init_hwif_slc90e66,
163 .autodma = AUTODMA,
164 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 154 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}},
165 .bootable = ON_BOARD, 155 .host_flags = IDE_HFLAG_LEGACY_IRQS | IDE_HFLAG_BOOTABLE,
166 .pio_mask = ATA_PIO4, 156 .pio_mask = ATA_PIO4,
157 .swdma_mask = ATA_SWDMA2_ONLY,
158 .mwdma_mask = ATA_MWDMA12_ONLY,
159 .udma_mask = ATA_UDMA4,
167}; 160};
168 161
169static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id) 162static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index de62db576adc..a66ebd14664e 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * drivers/ide/pci/tc86c001.c Version 1.00 Dec 12, 2006 2 * drivers/ide/pci/tc86c001.c Version 1.01 Sep 5, 2007
3 * 3 *
4 * Copyright (C) 2002 Toshiba Corporation 4 * Copyright (C) 2002 Toshiba Corporation
5 * Copyright (C) 2005-2006 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2005-2006 MontaVista Software, Inc. <source@mvista.com>
@@ -17,7 +17,7 @@ static void tc86c001_set_mode(ide_drive_t *drive, const u8 speed)
17{ 17{
18 ide_hwif_t *hwif = HWIF(drive); 18 ide_hwif_t *hwif = HWIF(drive);
19 unsigned long scr_port = hwif->config_data + (drive->dn ? 0x02 : 0x00); 19 unsigned long scr_port = hwif->config_data + (drive->dn ? 0x02 : 0x00);
20 u16 mode, scr = hwif->INW(scr_port); 20 u16 mode, scr = inw(scr_port);
21 21
22 switch (speed) { 22 switch (speed) {
23 case XFER_UDMA_4: mode = 0x00c0; break; 23 case XFER_UDMA_4: mode = 0x00c0; break;
@@ -65,7 +65,7 @@ static int tc86c001_timer_expiry(ide_drive_t *drive)
65 ide_hwif_t *hwif = HWIF(drive); 65 ide_hwif_t *hwif = HWIF(drive);
66 ide_expiry_t *expiry = ide_get_hwifdata(hwif); 66 ide_expiry_t *expiry = ide_get_hwifdata(hwif);
67 ide_hwgroup_t *hwgroup = HWGROUP(drive); 67 ide_hwgroup_t *hwgroup = HWGROUP(drive);
68 u8 dma_stat = hwif->INB(hwif->dma_status); 68 u8 dma_stat = inb(hwif->dma_status);
69 69
70 /* Restore a higher level driver's expiry handler first. */ 70 /* Restore a higher level driver's expiry handler first. */
71 hwgroup->expiry = expiry; 71 hwgroup->expiry = expiry;
@@ -73,7 +73,7 @@ static int tc86c001_timer_expiry(ide_drive_t *drive)
73 if ((dma_stat & 5) == 1) { /* DMA active and no interrupt */ 73 if ((dma_stat & 5) == 1) { /* DMA active and no interrupt */
74 unsigned long sc_base = hwif->config_data; 74 unsigned long sc_base = hwif->config_data;
75 unsigned long twcr_port = sc_base + (drive->dn ? 0x06 : 0x04); 75 unsigned long twcr_port = sc_base + (drive->dn ? 0x06 : 0x04);
76 u8 dma_cmd = hwif->INB(hwif->dma_command); 76 u8 dma_cmd = inb(hwif->dma_command);
77 77
78 printk(KERN_WARNING "%s: DMA interrupt possibly stuck, " 78 printk(KERN_WARNING "%s: DMA interrupt possibly stuck, "
79 "attempting recovery...\n", drive->name); 79 "attempting recovery...\n", drive->name);
@@ -135,7 +135,7 @@ static int tc86c001_busproc(ide_drive_t *drive, int state)
135 u16 scr1; 135 u16 scr1;
136 136
137 /* System Control 1 Register bit 11 (ATA Hard Reset) read */ 137 /* System Control 1 Register bit 11 (ATA Hard Reset) read */
138 scr1 = hwif->INW(sc_base + 0x00); 138 scr1 = inw(sc_base + 0x00);
139 139
140 switch (state) { 140 switch (state) {
141 case BUSSTATE_ON: 141 case BUSSTATE_ON:
@@ -165,7 +165,7 @@ static int tc86c001_busproc(ide_drive_t *drive, int state)
165static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) 165static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
166{ 166{
167 unsigned long sc_base = pci_resource_start(hwif->pci_dev, 5); 167 unsigned long sc_base = pci_resource_start(hwif->pci_dev, 5);
168 u16 scr1 = hwif->INW(sc_base + 0x00);; 168 u16 scr1 = inw(sc_base + 0x00);
169 169
170 /* System Control 1 Register bit 15 (Soft Reset) set */ 170 /* System Control 1 Register bit 15 (Soft Reset) set */
171 outw(scr1 | 0x8000, sc_base + 0x00); 171 outw(scr1 | 0x8000, sc_base + 0x00);
@@ -184,8 +184,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
184 184
185 hwif->busproc = &tc86c001_busproc; 185 hwif->busproc = &tc86c001_busproc;
186 186
187 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
188
189 if (!hwif->dma_base) 187 if (!hwif->dma_base)
190 return; 188 return;
191 189
@@ -198,10 +196,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
198 /* Sector Count Register limit */ 196 /* Sector Count Register limit */
199 hwif->rqsize = 0xffff; 197 hwif->rqsize = 0xffff;
200 198
201 hwif->atapi_dma = 1;
202 hwif->ultra_mask = 0x1f;
203 hwif->mwdma_mask = 0x07;
204
205 hwif->dma_start = &tc86c001_dma_start; 199 hwif->dma_start = &tc86c001_dma_start;
206 200
207 if (hwif->cbl != ATA_CBL_PATA40_SHORT) { 201 if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
@@ -209,7 +203,7 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
209 * System Control 1 Register bit 13 (PDIAGN): 203 * System Control 1 Register bit 13 (PDIAGN):
210 * 0=80-pin cable, 1=40-pin cable 204 * 0=80-pin cable, 1=40-pin cable
211 */ 205 */
212 scr1 = hwif->INW(sc_base + 0x00); 206 scr1 = inw(sc_base + 0x00);
213 hwif->cbl = (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; 207 hwif->cbl = (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
214 } 208 }
215} 209}
@@ -224,14 +218,14 @@ static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,
224 return err; 218 return err;
225} 219}
226 220
227static ide_pci_device_t tc86c001_chipset __devinitdata = { 221static const struct ide_port_info tc86c001_chipset __devinitdata = {
228 .name = "TC86C001", 222 .name = "TC86C001",
229 .init_chipset = init_chipset_tc86c001, 223 .init_chipset = init_chipset_tc86c001,
230 .init_hwif = init_hwif_tc86c001, 224 .init_hwif = init_hwif_tc86c001,
231 .autodma = AUTODMA, 225 .host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_OFF_BOARD,
232 .bootable = OFF_BOARD,
233 .host_flags = IDE_HFLAG_SINGLE,
234 .pio_mask = ATA_PIO4, 226 .pio_mask = ATA_PIO4,
227 .mwdma_mask = ATA_MWDMA2,
228 .udma_mask = ATA_UDMA4,
235}; 229};
236 230
237static int __devinit tc86c001_init_one(struct pci_dev *dev, 231static int __devinit tc86c001_init_one(struct pci_dev *dev,
diff --git a/drivers/ide/pci/triflex.c b/drivers/ide/pci/triflex.c
index 4075c907f05c..a227c41d23a3 100644
--- a/drivers/ide/pci/triflex.c
+++ b/drivers/ide/pci/triflex.c
@@ -100,22 +100,16 @@ static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
100{ 100{
101 hwif->set_pio_mode = &triflex_set_pio_mode; 101 hwif->set_pio_mode = &triflex_set_pio_mode;
102 hwif->set_dma_mode = &triflex_set_mode; 102 hwif->set_dma_mode = &triflex_set_mode;
103
104 if (hwif->dma_base == 0)
105 return;
106
107 hwif->atapi_dma = 1;
108 hwif->mwdma_mask = 0x07;
109 hwif->swdma_mask = 0x07;
110} 103}
111 104
112static ide_pci_device_t triflex_device __devinitdata = { 105static const struct ide_port_info triflex_device __devinitdata = {
113 .name = "TRIFLEX", 106 .name = "TRIFLEX",
114 .init_hwif = init_hwif_triflex, 107 .init_hwif = init_hwif_triflex,
115 .autodma = AUTODMA,
116 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 108 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}},
117 .bootable = ON_BOARD, 109 .host_flags = IDE_HFLAG_BOOTABLE,
118 .pio_mask = ATA_PIO4, 110 .pio_mask = ATA_PIO4,
111 .swdma_mask = ATA_SWDMA2,
112 .mwdma_mask = ATA_MWDMA2,
119}; 113};
120 114
121static int __devinit triflex_init_one(struct pci_dev *dev, 115static int __devinit triflex_init_one(struct pci_dev *dev,
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index e3d943ada7b0..5011ba22e36c 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -250,8 +250,6 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
250 u8 reg = 0; 250 u8 reg = 0;
251 struct pci_dev *dev = hwif->pci_dev; 251 struct pci_dev *dev = hwif->pci_dev;
252 252
253 hwif->no_lba48 = 1;
254 hwif->chipset = ide_trm290;
255 cfgbase = pci_resource_start(dev, 4); 253 cfgbase = pci_resource_start(dev, 4);
256 if ((dev->class & 5) && cfgbase) { 254 if ((dev->class & 5) && cfgbase) {
257 hwif->config_data = cfgbase; 255 hwif->config_data = cfgbase;
@@ -321,14 +319,17 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
321#endif 319#endif
322} 320}
323 321
324static ide_pci_device_t trm290_chipset __devinitdata = { 322static const struct ide_port_info trm290_chipset __devinitdata = {
325 .name = "TRM290", 323 .name = "TRM290",
326 .init_hwif = init_hwif_trm290, 324 .init_hwif = init_hwif_trm290,
327 .autodma = NOAUTODMA, 325 .chipset = ide_trm290,
328 .bootable = ON_BOARD, 326 .host_flags = IDE_HFLAG_NO_ATAPI_DMA |
329#if 0 /* play it safe for now */ 327#if 0 /* play it safe for now */
330 .host_flags = IDE_HFLAG_TRUST_BIOS_FOR_DMA, 328 IDE_HFLAG_TRUST_BIOS_FOR_DMA |
331#endif 329#endif
330 IDE_HFLAG_NO_AUTODMA |
331 IDE_HFLAG_BOOTABLE |
332 IDE_HFLAG_NO_LBA48,
332}; 333};
333 334
334static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id) 335static int __devinit trm290_init_one(struct pci_dev *dev, const struct pci_device_id *id)
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index b25fb65b240e..a0d3c16b68ec 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * Version 3.49 3 * Version 3.50
4 * 4 *
5 * VIA IDE driver for Linux. Supported southbridges: 5 * VIA IDE driver for Linux. Supported southbridges:
6 * 6 *
@@ -422,67 +422,40 @@ static u8 __devinit via82cxxx_cable_detect(ide_hwif_t *hwif)
422 422
423static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) 423static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif)
424{ 424{
425 struct via82cxxx_dev *vdev = pci_get_drvdata(hwif->pci_dev);
426 int i;
427
428 hwif->set_pio_mode = &via_set_pio_mode; 425 hwif->set_pio_mode = &via_set_pio_mode;
429 hwif->set_dma_mode = &via_set_drive; 426 hwif->set_dma_mode = &via_set_drive;
430 427
431#ifdef CONFIG_PPC_CHRP
432 if(machine_is(chrp) && _chrp_type == _CHRP_Pegasos) {
433 hwif->irq = hwif->channel ? 15 : 14;
434 }
435#endif
436
437 for (i = 0; i < 2; i++) {
438 hwif->drives[i].io_32bit = 1;
439 hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1;
440 hwif->drives[i].autotune = 1;
441 }
442
443 if (!hwif->dma_base) 428 if (!hwif->dma_base)
444 return; 429 return;
445 430
446 hwif->atapi_dma = 1;
447
448 hwif->ultra_mask = vdev->via_config->udma_mask;
449 hwif->mwdma_mask = 0x07;
450 hwif->swdma_mask = 0x07;
451
452 if (hwif->cbl != ATA_CBL_PATA40_SHORT) 431 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
453 hwif->cbl = via82cxxx_cable_detect(hwif); 432 hwif->cbl = via82cxxx_cable_detect(hwif);
454} 433}
455 434
456static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { 435static const struct ide_port_info via82cxxx_chipset __devinitdata = {
457 { /* 0 */ 436 .name = "VP_IDE",
458 .name = "VP_IDE", 437 .init_chipset = init_chipset_via82cxxx,
459 .init_chipset = init_chipset_via82cxxx, 438 .init_hwif = init_hwif_via82cxxx,
460 .init_hwif = init_hwif_via82cxxx, 439 .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
461 .autodma = NOAUTODMA, 440 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST |
462 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 441 IDE_HFLAG_PIO_NO_DOWNGRADE |
463 .bootable = ON_BOARD, 442 IDE_HFLAG_POST_SET_MODE |
464 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST 443 IDE_HFLAG_IO_32BIT |
465 | IDE_HFLAG_PIO_NO_DOWNGRADE 444 IDE_HFLAG_BOOTABLE,
466 | IDE_HFLAG_POST_SET_MODE, 445 .pio_mask = ATA_PIO5,
467 .pio_mask = ATA_PIO5, 446 .swdma_mask = ATA_SWDMA2,
468 },{ /* 1 */ 447 .mwdma_mask = ATA_MWDMA2,
469 .name = "VP_IDE",
470 .init_chipset = init_chipset_via82cxxx,
471 .init_hwif = init_hwif_via82cxxx,
472 .autodma = AUTODMA,
473 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}},
474 .bootable = ON_BOARD,
475 .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST
476 | IDE_HFLAG_PIO_NO_DOWNGRADE
477 | IDE_HFLAG_POST_SET_MODE,
478 .pio_mask = ATA_PIO5,
479 }
480}; 448};
481 449
482static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) 450static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
483{ 451{
484 struct pci_dev *isa = NULL; 452 struct pci_dev *isa = NULL;
485 struct via_isa_bridge *via_config; 453 struct via_isa_bridge *via_config;
454 u8 idx = id->driver_data;
455 struct ide_port_info d;
456
457 d = via82cxxx_chipset;
458
486 /* 459 /*
487 * Find the ISA bridge and check we know what it is. 460 * Find the ISA bridge and check we know what it is.
488 */ 461 */
@@ -492,7 +465,23 @@ static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_i
492 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); 465 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n");
493 return -ENODEV; 466 return -ENODEV;
494 } 467 }
495 return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); 468
469 if (idx == 0)
470 d.host_flags |= IDE_HFLAG_NO_AUTODMA;
471 else
472 d.enablebits[1].reg = d.enablebits[0].reg = 0;
473
474 if ((via_config->flags & VIA_NO_UNMASK) == 0)
475 d.host_flags |= IDE_HFLAG_UNMASK_IRQS;
476
477#ifdef CONFIG_PPC_CHRP
478 if (machine_is(chrp) && _chrp_type == _CHRP_Pegasos)
479 d.host_flags |= IDE_HFLAG_FORCE_LEGACY_IRQS;
480#endif
481
482 d.udma_mask = via_config->udma_mask;
483
484 return ide_setup_pci_device(dev, &d);
496} 485}
497 486
498static const struct pci_device_id via_pci_tbl[] = { 487static const struct pci_device_id via_pci_tbl[] = {
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index df2e92034f5d..5f0da35ab5ad 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -316,8 +316,8 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
316 316
317 ide_hwifs[data_port].pio_mask = ATA_PIO4; 317 ide_hwifs[data_port].pio_mask = ATA_PIO4;
318 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 318 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
319 ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
319 320
320 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
321 /* Enable Harddisk Interrupt, 321 /* Enable Harddisk Interrupt,
322 * and make it edge sensitive 322 * and make it edge sensitive
323 */ 323 */
@@ -402,8 +402,8 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
402 402
403 ide_hwifs[data_port].pio_mask = ATA_PIO4; 403 ide_hwifs[data_port].pio_mask = ATA_PIO4;
404 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 404 ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode;
405 ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack;
405 406
406 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack;
407 /* Enable Harddisk Interrupt, 407 /* Enable Harddisk Interrupt,
408 * and make it edge sensitive 408 * and make it edge sensitive
409 */ 409 */
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 1d25a3433008..816b5311dad6 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -1039,6 +1039,8 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1039{ 1039{
1040 struct device_node *np = pmif->node; 1040 struct device_node *np = pmif->node;
1041 const int *bidp; 1041 const int *bidp;
1042 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
1043 hw_regs_t hw;
1042 1044
1043 pmif->cable_80 = 0; 1045 pmif->cable_80 = 0;
1044 pmif->broken_dma = pmif->broken_dma_warn = 0; 1046 pmif->broken_dma = pmif->broken_dma_warn = 0;
@@ -1124,8 +1126,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1124 /* Tell common code _not_ to mess with resources */ 1126 /* Tell common code _not_ to mess with resources */
1125 hwif->mmio = 1; 1127 hwif->mmio = 1;
1126 hwif->hwif_data = pmif; 1128 hwif->hwif_data = pmif;
1127 pmac_ide_init_hwif_ports(&hwif->hw, pmif->regbase, 0, &hwif->irq); 1129 memset(&hw, 0, sizeof(hw));
1128 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 1130 pmac_ide_init_hwif_ports(&hw, pmif->regbase, 0, &hwif->irq);
1131 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
1129 hwif->chipset = ide_pmac; 1132 hwif->chipset = ide_pmac;
1130 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay; 1133 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET] || pmif->mediabay;
1131 hwif->hold = pmif->mediabay; 1134 hwif->hold = pmif->mediabay;
@@ -1163,10 +1166,9 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1163 pmac_ide_setup_dma(pmif, hwif); 1166 pmac_ide_setup_dma(pmif, hwif);
1164#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 1167#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
1165 1168
1166 /* We probe the hwif now */ 1169 idx[0] = hwif->index;
1167 probe_hwif_init(hwif);
1168 1170
1169 ide_proc_register_port(hwif); 1171 ide_device_add(idx);
1170 1172
1171 return 0; 1173 return 0;
1172} 1174}
@@ -1780,7 +1782,6 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif)
1780 hwif->dma_timeout = &ide_dma_timeout; 1782 hwif->dma_timeout = &ide_dma_timeout;
1781 hwif->dma_lost_irq = &pmac_ide_dma_lost_irq; 1783 hwif->dma_lost_irq = &pmac_ide_dma_lost_irq;
1782 1784
1783 hwif->atapi_dma = 1;
1784 switch(pmif->kind) { 1785 switch(pmif->kind) {
1785 case controller_sh_ata6: 1786 case controller_sh_ata6:
1786 hwif->ultra_mask = pmif->cable_80 ? 0x7f : 0x07; 1787 hwif->ultra_mask = pmif->cable_80 ? 0x7f : 0x07;
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 3d101f73f910..02d14bf85ab2 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -147,14 +147,15 @@ static int ide_setup_pci_baseregs (struct pci_dev *dev, const char *name)
147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 147#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
148/** 148/**
149 * ide_get_or_set_dma_base - setup BMIBA 149 * ide_get_or_set_dma_base - setup BMIBA
150 * @hwif: Interface 150 * @d: IDE port info
151 * @hwif: IDE interface
151 * 152 *
152 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space. 153 * Fetch the DMA Bus-Master-I/O-Base-Address (BMIBA) from PCI space.
153 * Where a device has a partner that is already in DMA mode we check 154 * Where a device has a partner that is already in DMA mode we check
154 * and enforce IDE simplex rules. 155 * and enforce IDE simplex rules.
155 */ 156 */
156 157
157static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif) 158static unsigned long ide_get_or_set_dma_base(const struct ide_port_info *d, ide_hwif_t *hwif)
158{ 159{
159 unsigned long dma_base = 0; 160 unsigned long dma_base = 0;
160 struct pci_dev *dev = hwif->pci_dev; 161 struct pci_dev *dev = hwif->pci_dev;
@@ -165,14 +166,15 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
165 if (hwif->mate && hwif->mate->dma_base) { 166 if (hwif->mate && hwif->mate->dma_base) {
166 dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8); 167 dma_base = hwif->mate->dma_base - (hwif->channel ? 0 : 8);
167 } else { 168 } else {
168 dma_base = pci_resource_start(dev, 4); 169 u8 baridx = (d->host_flags & IDE_HFLAG_CS5520) ? 2 : 4;
169 if (!dma_base) { 170
170 printk(KERN_ERR "%s: dma_base is invalid\n", 171 dma_base = pci_resource_start(dev, baridx);
171 hwif->cds->name); 172
172 } 173 if (dma_base == 0)
174 printk(KERN_ERR "%s: DMA base is invalid\n", d->name);
173 } 175 }
174 176
175 if (dma_base) { 177 if ((d->host_flags & IDE_HFLAG_CS5520) == 0 && dma_base) {
176 u8 simplex_stat = 0; 178 u8 simplex_stat = 0;
177 dma_base += hwif->channel ? 8 : 0; 179 dma_base += hwif->channel ? 8 : 0;
178 180
@@ -183,13 +185,13 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
183 case PCI_DEVICE_ID_CMD_643: 185 case PCI_DEVICE_ID_CMD_643:
184 case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE: 186 case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE:
185 case PCI_DEVICE_ID_REVOLUTION: 187 case PCI_DEVICE_ID_REVOLUTION:
186 simplex_stat = hwif->INB(dma_base + 2); 188 simplex_stat = inb(dma_base + 2);
187 hwif->OUTB((simplex_stat&0x60),(dma_base + 2)); 189 outb(simplex_stat & 0x60, dma_base + 2);
188 simplex_stat = hwif->INB(dma_base + 2); 190 simplex_stat = inb(dma_base + 2);
189 if (simplex_stat & 0x80) { 191 if (simplex_stat & 0x80) {
190 printk(KERN_INFO "%s: simplex device: " 192 printk(KERN_INFO "%s: simplex device: "
191 "DMA forced\n", 193 "DMA forced\n",
192 hwif->cds->name); 194 d->name);
193 } 195 }
194 break; 196 break;
195 default: 197 default:
@@ -212,8 +214,8 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
212 */ 214 */
213 if (hwif->mate && hwif->mate->dma_base) { 215 if (hwif->mate && hwif->mate->dma_base) {
214 printk(KERN_INFO "%s: simplex device: " 216 printk(KERN_INFO "%s: simplex device: "
215 "DMA disabled\n", 217 "DMA disabled\n",
216 hwif->cds->name); 218 d->name);
217 dma_base = 0; 219 dma_base = 0;
218 } 220 }
219 } 221 }
@@ -223,10 +225,11 @@ static unsigned long ide_get_or_set_dma_base (ide_hwif_t *hwif)
223} 225}
224#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 226#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
225 227
226void ide_setup_pci_noise (struct pci_dev *dev, ide_pci_device_t *d) 228void ide_setup_pci_noise(struct pci_dev *dev, const struct ide_port_info *d)
227{ 229{
228 printk(KERN_INFO "%s: IDE controller at PCI slot %s\n", 230 printk(KERN_INFO "%s: IDE controller (0x%04x:0x%04x rev 0x%02x) at "
229 d->name, pci_name(dev)); 231 " PCI slot %s\n", d->name, dev->vendor, dev->device,
232 dev->revision, pci_name(dev));
230} 233}
231 234
232EXPORT_SYMBOL_GPL(ide_setup_pci_noise); 235EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
@@ -235,15 +238,15 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise);
235/** 238/**
236 * ide_pci_enable - do PCI enables 239 * ide_pci_enable - do PCI enables
237 * @dev: PCI device 240 * @dev: PCI device
238 * @d: IDE pci device data 241 * @d: IDE port info
239 * 242 *
240 * Enable the IDE PCI device. We attempt to enable the device in full 243 * Enable the IDE PCI device. We attempt to enable the device in full
241 * but if that fails then we only need BAR4 so we will enable that. 244 * but if that fails then we only need BAR4 so we will enable that.
242 * 245 *
243 * Returns zero on success or an error code 246 * Returns zero on success or an error code
244 */ 247 */
245 248
246static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d) 249static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d)
247{ 250{
248 int ret; 251 int ret;
249 252
@@ -258,9 +261,9 @@ static int ide_pci_enable(struct pci_dev *dev, ide_pci_device_t *d)
258 } 261 }
259 262
260 /* 263 /*
261 * assume all devices can do 32-bit dma for now. we can add a 264 * assume all devices can do 32-bit DMA for now, we can add
262 * dma mask field to the ide_pci_device_t if we need it (or let 265 * a DMA mask field to the struct ide_port_info if we need it
263 * lower level driver set the dma mask) 266 * (or let lower level driver set the DMA mask)
264 */ 267 */
265 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK); 268 ret = pci_set_dma_mask(dev, DMA_32BIT_MASK);
266 if (ret < 0) { 269 if (ret < 0) {
@@ -282,13 +285,13 @@ out:
282/** 285/**
283 * ide_pci_configure - configure an unconfigured device 286 * ide_pci_configure - configure an unconfigured device
284 * @dev: PCI device 287 * @dev: PCI device
285 * @d: IDE pci device data 288 * @d: IDE port info
286 * 289 *
287 * Enable and configure the PCI device we have been passed. 290 * Enable and configure the PCI device we have been passed.
288 * Returns zero on success or an error code. 291 * Returns zero on success or an error code.
289 */ 292 */
290 293
291static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d) 294static int ide_pci_configure(struct pci_dev *dev, const struct ide_port_info *d)
292{ 295{
293 u16 pcicmd = 0; 296 u16 pcicmd = 0;
294 /* 297 /*
@@ -316,15 +319,15 @@ static int ide_pci_configure(struct pci_dev *dev, ide_pci_device_t *d)
316 319
317/** 320/**
318 * ide_pci_check_iomem - check a register is I/O 321 * ide_pci_check_iomem - check a register is I/O
319 * @dev: pci device 322 * @dev: PCI device
320 * @d: ide_pci_device 323 * @d: IDE port info
321 * @bar: bar number 324 * @bar: BAR number
322 * 325 *
323 * Checks if a BAR is configured and points to MMIO space. If so 326 * Checks if a BAR is configured and points to MMIO space. If so
324 * print an error and return an error code. Otherwise return 0 327 * print an error and return an error code. Otherwise return 0
325 */ 328 */
326 329
327static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar) 330static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar)
328{ 331{
329 ulong flags = pci_resource_flags(dev, bar); 332 ulong flags = pci_resource_flags(dev, bar);
330 333
@@ -346,7 +349,7 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar
346/** 349/**
347 * ide_hwif_configure - configure an IDE interface 350 * ide_hwif_configure - configure an IDE interface
348 * @dev: PCI device holding interface 351 * @dev: PCI device holding interface
349 * @d: IDE pci data 352 * @d: IDE port info
350 * @mate: Paired interface if any 353 * @mate: Paired interface if any
351 * 354 *
352 * Perform the initial set up for the hardware interface structure. This 355 * Perform the initial set up for the hardware interface structure. This
@@ -355,11 +358,12 @@ static int ide_pci_check_iomem(struct pci_dev *dev, ide_pci_device_t *d, int bar
355 * 358 *
356 * Returns the new hardware interface structure, or NULL on a failure 359 * Returns the new hardware interface structure, or NULL on a failure
357 */ 360 */
358 361
359static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *mate, int port, int irq) 362static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq)
360{ 363{
361 unsigned long ctl = 0, base = 0; 364 unsigned long ctl = 0, base = 0;
362 ide_hwif_t *hwif; 365 ide_hwif_t *hwif;
366 u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0;
363 367
364 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { 368 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) {
365 /* Possibly we should fail if these checks report true */ 369 /* Possibly we should fail if these checks report true */
@@ -380,23 +384,24 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
380 ctl = port ? 0x374 : 0x3f4; 384 ctl = port ? 0x374 : 0x3f4;
381 base = port ? 0x170 : 0x1f0; 385 base = port ? 0x170 : 0x1f0;
382 } 386 }
383 if ((hwif = ide_match_hwif(base, d->bootable, d->name)) == NULL) 387 if ((hwif = ide_match_hwif(base, bootable, d->name)) == NULL)
384 return NULL; /* no room in ide_hwifs[] */ 388 return NULL; /* no room in ide_hwifs[] */
385 if (hwif->io_ports[IDE_DATA_OFFSET] != base || 389 if (hwif->io_ports[IDE_DATA_OFFSET] != base ||
386 hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { 390 hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) {
387 memset(&hwif->hw, 0, sizeof(hwif->hw)); 391 hw_regs_t hw;
388#ifndef IDE_ARCH_OBSOLETE_INIT 392
389 ide_std_init_ports(&hwif->hw, base, (ctl | 2)); 393 memset(&hw, 0, sizeof(hw));
390 hwif->hw.io_ports[IDE_IRQ_OFFSET] = 0; 394#ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT
395 ide_std_init_ports(&hw, base, ctl | 2);
391#else 396#else
392 ide_init_hwif_ports(&hwif->hw, base, (ctl | 2), NULL); 397 ide_init_hwif_ports(&hw, base, ctl | 2, NULL);
393#endif 398#endif
394 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); 399 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
395 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET]; 400 hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
396 } 401 }
397 hwif->chipset = ide_pci; 402 hwif->chipset = d->chipset ? d->chipset : ide_pci;
398 hwif->pci_dev = dev; 403 hwif->pci_dev = dev;
399 hwif->cds = (struct ide_pci_device_s *) d; 404 hwif->cds = d;
400 hwif->channel = port; 405 hwif->channel = port;
401 406
402 if (!hwif->irq) 407 if (!hwif->irq)
@@ -411,28 +416,25 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
411/** 416/**
412 * ide_hwif_setup_dma - configure DMA interface 417 * ide_hwif_setup_dma - configure DMA interface
413 * @dev: PCI device 418 * @dev: PCI device
414 * @d: IDE pci data 419 * @d: IDE port info
415 * @hwif: Hardware interface we are configuring 420 * @hwif: IDE interface
416 * 421 *
417 * Set up the DMA base for the interface. Enable the master bits as 422 * Set up the DMA base for the interface. Enable the master bits as
418 * necessary and attempt to bring the device DMA into a ready to use 423 * necessary and attempt to bring the device DMA into a ready to use
419 * state 424 * state
420 */ 425 */
421 426
422#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 427static void ide_hwif_setup_dma(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *hwif)
423static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
424{
425}
426#else
427static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwif_t *hwif)
428{ 428{
429#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
429 u16 pcicmd; 430 u16 pcicmd;
431
430 pci_read_config_word(dev, PCI_COMMAND, &pcicmd); 432 pci_read_config_word(dev, PCI_COMMAND, &pcicmd);
431 433
432 if ((d->autodma == AUTODMA) || 434 if ((d->host_flags & IDE_HFLAG_NO_AUTODMA) == 0 ||
433 ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE && 435 ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE &&
434 (dev->class & 0x80))) { 436 (dev->class & 0x80))) {
435 unsigned long dma_base = ide_get_or_set_dma_base(hwif); 437 unsigned long dma_base = ide_get_or_set_dma_base(d, hwif);
436 if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) { 438 if (dma_base && !(pcicmd & PCI_COMMAND_MASTER)) {
437 /* 439 /*
438 * Set up BM-DMA capability 440 * Set up BM-DMA capability
@@ -456,13 +458,13 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
456 "(BIOS)\n", hwif->name, d->name); 458 "(BIOS)\n", hwif->name, d->name);
457 } 459 }
458 } 460 }
459}
460#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ 461#endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/
462}
461 463
462/** 464/**
463 * ide_setup_pci_controller - set up IDE PCI 465 * ide_setup_pci_controller - set up IDE PCI
464 * @dev: PCI device 466 * @dev: PCI device
465 * @d: IDE PCI data 467 * @d: IDE port info
466 * @noisy: verbose flag 468 * @noisy: verbose flag
467 * @config: returned as 1 if we configured the hardware 469 * @config: returned as 1 if we configured the hardware
468 * 470 *
@@ -470,11 +472,10 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi
470 * up the PCI side of the device, checks that the device is enabled 472 * up the PCI side of the device, checks that the device is enabled
471 * and enables it if need be 473 * and enables it if need be
472 */ 474 */
473 475
474static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, int noisy, int *config) 476static int ide_setup_pci_controller(struct pci_dev *dev, const struct ide_port_info *d, int noisy, int *config)
475{ 477{
476 int ret; 478 int ret;
477 u32 class_rev;
478 u16 pcicmd; 479 u16 pcicmd;
479 480
480 if (noisy) 481 if (noisy)
@@ -497,10 +498,6 @@ static int ide_setup_pci_controller(struct pci_dev *dev, ide_pci_device_t *d, in
497 printk(KERN_INFO "%s: device enabled (Linux)\n", d->name); 498 printk(KERN_INFO "%s: device enabled (Linux)\n", d->name);
498 } 499 }
499 500
500 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
501 class_rev &= 0xff;
502 if (noisy)
503 printk(KERN_INFO "%s: chipset revision %d\n", d->name, class_rev);
504out: 501out:
505 return ret; 502 return ret;
506} 503}
@@ -508,9 +505,9 @@ out:
508/** 505/**
509 * ide_pci_setup_ports - configure ports/devices on PCI IDE 506 * ide_pci_setup_ports - configure ports/devices on PCI IDE
510 * @dev: PCI device 507 * @dev: PCI device
511 * @d: IDE pci device info 508 * @d: IDE port info
512 * @pciirq: IRQ line 509 * @pciirq: IRQ line
513 * @index: ata index to update 510 * @idx: ATA index table to update
514 * 511 *
515 * Scan the interfaces attached to this device and do any 512 * Scan the interfaces attached to this device and do any
516 * necessary per port setup. Attach the devices and ask the 513 * necessary per port setup. Attach the devices and ask the
@@ -520,26 +517,25 @@ out:
520 * but is also used directly as a helper function by some controllers 517 * but is also used directly as a helper function by some controllers
521 * where the chipset setup is not the default PCI IDE one. 518 * where the chipset setup is not the default PCI IDE one.
522 */ 519 */
523 520
524void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) 521void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int pciirq, u8 *idx)
525{ 522{
526 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; 523 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
527 int at_least_one_hwif_enabled = 0;
528 ide_hwif_t *hwif, *mate = NULL; 524 ide_hwif_t *hwif, *mate = NULL;
529 u8 tmp; 525 u8 tmp;
530 526
531 index->all = 0xf0f0;
532
533 /* 527 /*
534 * Set up the IDE ports 528 * Set up the IDE ports
535 */ 529 */
536 530
537 for (port = 0; port < channels; ++port) { 531 for (port = 0; port < channels; ++port) {
538 ide_pci_enablebit_t *e = &(d->enablebits[port]); 532 const ide_pci_enablebit_t *e = &(d->enablebits[port]);
539 533
540 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 534 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
541 (tmp & e->mask) != e->val)) 535 (tmp & e->mask) != e->val)) {
536 printk(KERN_INFO "%s: IDE port disabled\n", d->name);
542 continue; /* port not enabled */ 537 continue; /* port not enabled */
538 }
543 539
544 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 540 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL)
545 continue; 541 continue;
@@ -547,27 +543,49 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
547 /* setup proper ancestral information */ 543 /* setup proper ancestral information */
548 hwif->gendev.parent = &dev->dev; 544 hwif->gendev.parent = &dev->dev;
549 545
550 if (hwif->channel) { 546 *(idx + port) = hwif->index;
551 index->b.high = hwif->index;
552 } else {
553 index->b.low = hwif->index;
554 }
555 547
556 548
557 if (d->init_iops) 549 if (d->init_iops)
558 d->init_iops(hwif); 550 d->init_iops(hwif);
559 551
560 if (d->autodma == NODMA) 552 if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
561 goto bypass_legacy_dma;
562
563 if(d->init_setup_dma)
564 d->init_setup_dma(dev, d, hwif);
565 else
566 ide_hwif_setup_dma(dev, d, hwif); 553 ide_hwif_setup_dma(dev, d, hwif);
567bypass_legacy_dma: 554
555 if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
556 (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
557 hwif->irq = port ? 15 : 14;
558
559 hwif->fixup = d->fixup;
560
568 hwif->host_flags = d->host_flags; 561 hwif->host_flags = d->host_flags;
569 hwif->pio_mask = d->pio_mask; 562 hwif->pio_mask = d->pio_mask;
570 563
564 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
565 hwif->mate->serialized = hwif->serialized = 1;
566
567 if (d->host_flags & IDE_HFLAG_IO_32BIT) {
568 hwif->drives[0].io_32bit = 1;
569 hwif->drives[1].io_32bit = 1;
570 }
571
572 if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
573 hwif->drives[0].unmask = 1;
574 hwif->drives[1].unmask = 1;
575 }
576
577 if (hwif->dma_base) {
578 hwif->swdma_mask = d->swdma_mask;
579 hwif->mwdma_mask = d->mwdma_mask;
580 hwif->ultra_mask = d->udma_mask;
581 }
582
583 hwif->drives[0].autotune = 1;
584 hwif->drives[1].autotune = 1;
585
586 if (d->host_flags & IDE_HFLAG_RQSIZE_256)
587 hwif->rqsize = 256;
588
571 if (d->init_hwif) 589 if (d->init_hwif)
572 /* Call chipset-specific routine 590 /* Call chipset-specific routine
573 * for each enabled hwif 591 * for each enabled hwif
@@ -575,10 +593,7 @@ bypass_legacy_dma:
575 d->init_hwif(hwif); 593 d->init_hwif(hwif);
576 594
577 mate = hwif; 595 mate = hwif;
578 at_least_one_hwif_enabled = 1;
579 } 596 }
580 if (!at_least_one_hwif_enabled)
581 printk(KERN_INFO "%s: neither IDE port enabled (BIOS)\n", d->name);
582} 597}
583 598
584EXPORT_SYMBOL_GPL(ide_pci_setup_ports); 599EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
@@ -590,13 +605,13 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
590 * 605 *
591 * One thing that is not standardized is the location of the 606 * One thing that is not standardized is the location of the
592 * primary/secondary interface "enable/disable" bits. For chipsets that 607 * primary/secondary interface "enable/disable" bits. For chipsets that
593 * we "know" about, this information is in the ide_pci_device_t struct; 608 * we "know" about, this information is in the struct ide_port_info;
594 * for all other chipsets, we just assume both interfaces are enabled. 609 * for all other chipsets, we just assume both interfaces are enabled.
595 */ 610 */
596static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d, 611static int do_ide_setup_pci_device(struct pci_dev *dev,
597 ata_index_t *index, u8 noisy) 612 const struct ide_port_info *d,
613 u8 *idx, u8 noisy)
598{ 614{
599 static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } };
600 int tried_config = 0; 615 int tried_config = 0;
601 int pciirq, ret; 616 int pciirq, ret;
602 617
@@ -646,51 +661,35 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
646 661
647 /* FIXME: silent failure can happen */ 662 /* FIXME: silent failure can happen */
648 663
649 *index = ata_index; 664 ide_pci_setup_ports(dev, d, pciirq, idx);
650 ide_pci_setup_ports(dev, d, pciirq, index);
651out: 665out:
652 return ret; 666 return ret;
653} 667}
654 668
655int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) 669int ide_setup_pci_device(struct pci_dev *dev, const struct ide_port_info *d)
656{ 670{
657 ide_hwif_t *hwif = NULL, *mate = NULL; 671 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
658 ata_index_t index_list;
659 int ret; 672 int ret;
660 673
661 ret = do_ide_setup_pci_device(dev, d, &index_list, 1); 674 ret = do_ide_setup_pci_device(dev, d, &idx[0], 1);
662 if (ret < 0)
663 goto out;
664
665 if ((index_list.b.low & 0xf0) != 0xf0)
666 hwif = &ide_hwifs[index_list.b.low];
667 if ((index_list.b.high & 0xf0) != 0xf0)
668 mate = &ide_hwifs[index_list.b.high];
669 675
670 if (hwif) 676 if (ret >= 0)
671 probe_hwif_init_with_fixup(hwif, d->fixup); 677 ide_device_add(idx);
672 if (mate)
673 probe_hwif_init_with_fixup(mate, d->fixup);
674 678
675 if (hwif)
676 ide_proc_register_port(hwif);
677 if (mate)
678 ide_proc_register_port(mate);
679out:
680 return ret; 679 return ret;
681} 680}
682 681
683EXPORT_SYMBOL_GPL(ide_setup_pci_device); 682EXPORT_SYMBOL_GPL(ide_setup_pci_device);
684 683
685int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, 684int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
686 ide_pci_device_t *d) 685 const struct ide_port_info *d)
687{ 686{
688 struct pci_dev *pdev[] = { dev1, dev2 }; 687 struct pci_dev *pdev[] = { dev1, dev2 };
689 ata_index_t index_list[2];
690 int ret, i; 688 int ret, i;
689 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
691 690
692 for (i = 0; i < 2; i++) { 691 for (i = 0; i < 2; i++) {
693 ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i); 692 ret = do_ide_setup_pci_device(pdev[i], d, &idx[i*2], !i);
694 /* 693 /*
695 * FIXME: Mom, mom, they stole me the helper function to undo 694 * FIXME: Mom, mom, they stole me the helper function to undo
696 * do_ide_setup_pci_device() on the first device! 695 * do_ide_setup_pci_device() on the first device!
@@ -699,25 +698,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
699 goto out; 698 goto out;
700 } 699 }
701 700
702 for (i = 0; i < 2; i++) { 701 ide_device_add(idx);
703 u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
704 int j;
705
706 for (j = 0; j < 2; j++) {
707 if ((idx[j] & 0xf0) != 0xf0)
708 probe_hwif_init(ide_hwifs + idx[j]);
709 }
710 }
711
712 for (i = 0; i < 2; i++) {
713 u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
714 int j;
715
716 for (j = 0; j < 2; j++) {
717 if ((idx[j] & 0xf0) != 0xf0)
718 ide_proc_register_port(ide_hwifs + idx[j]);
719 }
720 }
721out: 702out:
722 return ret; 703 return ret;
723} 704}
@@ -742,9 +723,6 @@ static LIST_HEAD(ide_pci_drivers);
742 * hands the controllers off to the core PCI code to do the rest of 723 * hands the controllers off to the core PCI code to do the rest of
743 * the work. 724 * the work.
744 * 725 *
745 * The driver_data of the driver table must point to an ide_pci_device_t
746 * describing the interface.
747 *
748 * Returns are the same as for pci_register_driver 726 * Returns are the same as for pci_register_driver
749 */ 727 */
750 728
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 93644f82592c..d08fb30768bc 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2797,11 +2797,12 @@ static void cma_remove_one(struct ib_device *device)
2797 2797
2798static int cma_init(void) 2798static int cma_init(void)
2799{ 2799{
2800 int ret, low, high; 2800 int ret, low, high, remaining;
2801 2801
2802 get_random_bytes(&next_port, sizeof next_port); 2802 get_random_bytes(&next_port, sizeof next_port);
2803 inet_get_local_port_range(&low, &high); 2803 inet_get_local_port_range(&low, &high);
2804 next_port = ((unsigned int) next_port % (high - low)) + low; 2804 remaining = (high - low) + 1;
2805 next_port = ((unsigned int) next_port % remaining) + low;
2805 2806
2806 cma_wq = create_singlethread_workqueue("rdma_cm"); 2807 cma_wq = create_singlethread_workqueue("rdma_cm");
2807 if (!cma_wq) 2808 if (!cma_wq)
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index a3409fdb307c..7a7dab890f6d 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -579,12 +579,12 @@ static ssize_t ehca_show_##name(struct device *dev, \
579 \ 579 \
580 rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); \ 580 rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); \
581 if (!rblock) { \ 581 if (!rblock) { \
582 dev_err(dev, "Can't allocate rblock memory."); \ 582 dev_err(dev, "Can't allocate rblock memory.\n"); \
583 return 0; \ 583 return 0; \
584 } \ 584 } \
585 \ 585 \
586 if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { \ 586 if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { \
587 dev_err(dev, "Can't query device properties"); \ 587 dev_err(dev, "Can't query device properties\n"); \
588 ehca_free_fw_ctrlblock(rblock); \ 588 ehca_free_fw_ctrlblock(rblock); \
589 return 0; \ 589 return 0; \
590 } \ 590 } \
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 1d62c8b88e12..e5b4e9bfbdc5 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -495,7 +495,7 @@ static unsigned int evdev_poll(struct file *file, poll_table *wait)
495#ifdef CONFIG_COMPAT 495#ifdef CONFIG_COMPAT
496 496
497#define BITS_PER_LONG_COMPAT (sizeof(compat_long_t) * 8) 497#define BITS_PER_LONG_COMPAT (sizeof(compat_long_t) * 8)
498#define NBITS_COMPAT(x) ((((x) - 1) / BITS_PER_LONG_COMPAT) + 1) 498#define BITS_TO_LONGS_COMPAT(x) ((((x) - 1) / BITS_PER_LONG_COMPAT) + 1)
499 499
500#ifdef __BIG_ENDIAN 500#ifdef __BIG_ENDIAN
501static int bits_to_user(unsigned long *bits, unsigned int maxbit, 501static int bits_to_user(unsigned long *bits, unsigned int maxbit,
@@ -504,7 +504,7 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit,
504 int len, i; 504 int len, i;
505 505
506 if (compat) { 506 if (compat) {
507 len = NBITS_COMPAT(maxbit) * sizeof(compat_long_t); 507 len = BITS_TO_LONGS_COMPAT(maxbit) * sizeof(compat_long_t);
508 if (len > maxlen) 508 if (len > maxlen)
509 len = maxlen; 509 len = maxlen;
510 510
@@ -515,7 +515,7 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit,
515 sizeof(compat_long_t))) 515 sizeof(compat_long_t)))
516 return -EFAULT; 516 return -EFAULT;
517 } else { 517 } else {
518 len = NBITS(maxbit) * sizeof(long); 518 len = BITS_TO_LONGS(maxbit) * sizeof(long);
519 if (len > maxlen) 519 if (len > maxlen)
520 len = maxlen; 520 len = maxlen;
521 521
@@ -530,8 +530,8 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit,
530 unsigned int maxlen, void __user *p, int compat) 530 unsigned int maxlen, void __user *p, int compat)
531{ 531{
532 int len = compat ? 532 int len = compat ?
533 NBITS_COMPAT(maxbit) * sizeof(compat_long_t) : 533 BITS_TO_LONGS_COMPAT(maxbit) * sizeof(compat_long_t) :
534 NBITS(maxbit) * sizeof(long); 534 BITS_TO_LONGS(maxbit) * sizeof(long);
535 535
536 if (len > maxlen) 536 if (len > maxlen)
537 len = maxlen; 537 len = maxlen;
@@ -545,7 +545,7 @@ static int bits_to_user(unsigned long *bits, unsigned int maxbit,
545static int bits_to_user(unsigned long *bits, unsigned int maxbit, 545static int bits_to_user(unsigned long *bits, unsigned int maxbit,
546 unsigned int maxlen, void __user *p, int compat) 546 unsigned int maxlen, void __user *p, int compat)
547{ 547{
548 int len = NBITS(maxbit) * sizeof(long); 548 int len = BITS_TO_LONGS(maxbit) * sizeof(long);
549 549
550 if (len > maxlen) 550 if (len > maxlen)
551 len = maxlen; 551 len = maxlen;
diff --git a/drivers/input/fixp-arith.h b/drivers/input/fixp-arith.h
index ed3d2da0c485..3089d7382325 100644
--- a/drivers/input/fixp-arith.h
+++ b/drivers/input/fixp-arith.h
@@ -24,7 +24,7 @@
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * 25 *
26 * Should you need to contact me, the author, you can do so by 26 * Should you need to contact me, the author, you can do so by
27 * e-mail - mail your message to <deneux@ifrance.com> 27 * e-mail - mail your message to <johann.deneux@gmail.com>
28 */ 28 */
29 29
30#include <linux/types.h> 30#include <linux/types.h>
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 20896d5e5f0e..bfc6061f1554 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -136,7 +136,8 @@ static int gameport_measure_speed(struct gameport *gameport)
136 } 136 }
137 137
138 gameport_close(gameport); 138 gameport_close(gameport);
139 return (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx); 139 return (cpu_data(raw_smp_processor_id()).loops_per_jiffy *
140 (unsigned long)HZ / (1000 / 50)) / (tx < 1 ? 1 : tx);
140 141
141#else 142#else
142 143
@@ -448,9 +449,8 @@ static int gameport_thread(void *nothing)
448 set_freezable(); 449 set_freezable();
449 do { 450 do {
450 gameport_handle_event(); 451 gameport_handle_event();
451 wait_event_interruptible(gameport_wait, 452 wait_event_freezable(gameport_wait,
452 kthread_should_stop() || !list_empty(&gameport_event_list)); 453 kthread_should_stop() || !list_empty(&gameport_event_list));
453 try_to_freeze();
454 } while (!kthread_should_stop()); 454 } while (!kthread_should_stop());
455 455
456 printk(KERN_DEBUG "gameport: kgameportd exiting\n"); 456 printk(KERN_DEBUG "gameport: kgameportd exiting\n");
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 2f2b020cd629..307c7b5c2b33 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -584,10 +584,10 @@ static int input_default_setkeycode(struct input_dev *dev,
584 584
585 585
586#define MATCH_BIT(bit, max) \ 586#define MATCH_BIT(bit, max) \
587 for (i = 0; i < NBITS(max); i++) \ 587 for (i = 0; i < BITS_TO_LONGS(max); i++) \
588 if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \ 588 if ((id->bit[i] & dev->bit[i]) != id->bit[i]) \
589 break; \ 589 break; \
590 if (i != NBITS(max)) \ 590 if (i != BITS_TO_LONGS(max)) \
591 continue; 591 continue;
592 592
593static const struct input_device_id *input_match_device(const struct input_device_id *id, 593static const struct input_device_id *input_match_device(const struct input_device_id *id,
@@ -698,7 +698,7 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
698{ 698{
699 int i; 699 int i;
700 700
701 for (i = NBITS(max) - 1; i > 0; i--) 701 for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
702 if (bitmap[i]) 702 if (bitmap[i])
703 break; 703 break;
704 704
@@ -892,7 +892,7 @@ static int input_print_modalias_bits(char *buf, int size,
892 892
893 len += snprintf(buf, max(size, 0), "%c", name); 893 len += snprintf(buf, max(size, 0), "%c", name);
894 for (i = min_bit; i < max_bit; i++) 894 for (i = min_bit; i < max_bit; i++)
895 if (bm[LONG(i)] & BIT(i)) 895 if (bm[BIT_WORD(i)] & BIT_MASK(i))
896 len += snprintf(buf + len, max(size - len, 0), "%X,", i); 896 len += snprintf(buf + len, max(size - len, 0), "%X,", i);
897 return len; 897 return len;
898} 898}
@@ -991,7 +991,7 @@ static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap,
991 int i; 991 int i;
992 int len = 0; 992 int len = 0;
993 993
994 for (i = NBITS(max) - 1; i > 0; i--) 994 for (i = BITS_TO_LONGS(max) - 1; i > 0; i--)
995 if (bitmap[i]) 995 if (bitmap[i])
996 break; 996 break;
997 997
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index 2b201f9aa024..22b2789ef58a 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -844,8 +844,8 @@ static const struct input_device_id joydev_blacklist[] = {
844 { 844 {
845 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 845 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
846 INPUT_DEVICE_ID_MATCH_KEYBIT, 846 INPUT_DEVICE_ID_MATCH_KEYBIT,
847 .evbit = { BIT(EV_KEY) }, 847 .evbit = { BIT_MASK(EV_KEY) },
848 .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, 848 .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
849 }, /* Avoid itouchpads, touchscreens and tablets */ 849 }, /* Avoid itouchpads, touchscreens and tablets */
850 { } /* Terminating entry */ 850 { } /* Terminating entry */
851}; 851};
@@ -854,20 +854,20 @@ static const struct input_device_id joydev_ids[] = {
854 { 854 {
855 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 855 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
856 INPUT_DEVICE_ID_MATCH_ABSBIT, 856 INPUT_DEVICE_ID_MATCH_ABSBIT,
857 .evbit = { BIT(EV_ABS) }, 857 .evbit = { BIT_MASK(EV_ABS) },
858 .absbit = { BIT(ABS_X) }, 858 .absbit = { BIT_MASK(ABS_X) },
859 }, 859 },
860 { 860 {
861 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 861 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
862 INPUT_DEVICE_ID_MATCH_ABSBIT, 862 INPUT_DEVICE_ID_MATCH_ABSBIT,
863 .evbit = { BIT(EV_ABS) }, 863 .evbit = { BIT_MASK(EV_ABS) },
864 .absbit = { BIT(ABS_WHEEL) }, 864 .absbit = { BIT_MASK(ABS_WHEEL) },
865 }, 865 },
866 { 866 {
867 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 867 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
868 INPUT_DEVICE_ID_MATCH_ABSBIT, 868 INPUT_DEVICE_ID_MATCH_ABSBIT,
869 .evbit = { BIT(EV_ABS) }, 869 .evbit = { BIT_MASK(EV_ABS) },
870 .absbit = { BIT(ABS_THROTTLE) }, 870 .absbit = { BIT_MASK(ABS_THROTTLE) },
871 }, 871 },
872 { } /* Terminating entry */ 872 { } /* Terminating entry */
873}; 873};
diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c
index ff701ab10d74..52ba16f487c7 100644
--- a/drivers/input/joystick/a3d.c
+++ b/drivers/input/joystick/a3d.c
@@ -326,14 +326,19 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
326 326
327 a3d->length = 33; 327 a3d->length = 33;
328 328
329 input_dev->evbit[0] |= BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL); 329 input_dev->evbit[0] |= BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY) |
330 input_dev->relbit[0] |= BIT(REL_X) | BIT(REL_Y); 330 BIT_MASK(EV_REL);
331 input_dev->absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_RUDDER) 331 input_dev->relbit[0] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y);
332 | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y) | BIT(ABS_HAT1X) | BIT(ABS_HAT1Y); 332 input_dev->absbit[0] |= BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) |
333 input_dev->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE) 333 BIT_MASK(ABS_THROTTLE) | BIT_MASK(ABS_RUDDER) |
334 | BIT(BTN_SIDE) | BIT(BTN_EXTRA); 334 BIT_MASK(ABS_HAT0X) | BIT_MASK(ABS_HAT0Y) |
335 input_dev->keybit[LONG(BTN_JOYSTICK)] |= BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) 335 BIT_MASK(ABS_HAT1X) | BIT_MASK(ABS_HAT1Y);
336 | BIT(BTN_PINKIE); 336 input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_RIGHT) |
337 BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) |
338 BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA);
339 input_dev->keybit[BIT_WORD(BTN_JOYSTICK)] |=
340 BIT_MASK(BTN_TRIGGER) | BIT_MASK(BTN_THUMB) |
341 BIT_MASK(BTN_TOP) | BIT_MASK(BTN_PINKIE);
337 342
338 a3d_read(a3d, data); 343 a3d_read(a3d, data);
339 344
@@ -348,9 +353,10 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
348 } else { 353 } else {
349 a3d->length = 29; 354 a3d->length = 29;
350 355
351 input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_REL); 356 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
352 input_dev->relbit[0] |= BIT(REL_X) | BIT(REL_Y); 357 input_dev->relbit[0] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y);
353 input_dev->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE); 358 input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_RIGHT) |
359 BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE);
354 360
355 a3d_read(a3d, data); 361 a3d_read(a3d, data);
356 362
diff --git a/drivers/input/joystick/adi.c b/drivers/input/joystick/adi.c
index 28140c4a110d..d1ca8a14950f 100644
--- a/drivers/input/joystick/adi.c
+++ b/drivers/input/joystick/adi.c
@@ -431,7 +431,7 @@ static int adi_init_input(struct adi *adi, struct adi_port *port, int half)
431 input_dev->open = adi_open; 431 input_dev->open = adi_open;
432 input_dev->close = adi_close; 432 input_dev->close = adi_close;
433 433
434 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 434 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
435 435
436 for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++) 436 for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad != -1)) * 2; i++)
437 set_bit(adi->abs[i], input_dev->absbit); 437 set_bit(adi->abs[i], input_dev->absbit);
diff --git a/drivers/input/joystick/amijoy.c b/drivers/input/joystick/amijoy.c
index b0f5541ec3e6..5cf9f3610e67 100644
--- a/drivers/input/joystick/amijoy.c
+++ b/drivers/input/joystick/amijoy.c
@@ -137,9 +137,10 @@ static int __init amijoy_init(void)
137 amijoy_dev[i]->open = amijoy_open; 137 amijoy_dev[i]->open = amijoy_open;
138 amijoy_dev[i]->close = amijoy_close; 138 amijoy_dev[i]->close = amijoy_close;
139 139
140 amijoy_dev[i]->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 140 amijoy_dev[i]->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
141 amijoy_dev[i]->absbit[0] = BIT(ABS_X) | BIT(ABS_Y); 141 amijoy_dev[i]->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y);
142 amijoy_dev[i]->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 142 amijoy_dev[i]->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
143 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
143 for (j = 0; j < 2; j++) { 144 for (j = 0; j < 2; j++) {
144 amijoy_dev[i]->absmin[ABS_X + j] = -1; 145 amijoy_dev[i]->absmin[ABS_X + j] = -1;
145 amijoy_dev[i]->absmax[ABS_X + j] = 1; 146 amijoy_dev[i]->absmax[ABS_X + j] = 1;
diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c
index bdd157c1ebf8..15739880afc6 100644
--- a/drivers/input/joystick/analog.c
+++ b/drivers/input/joystick/analog.c
@@ -456,7 +456,7 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
456 input_dev->open = analog_open; 456 input_dev->open = analog_open;
457 input_dev->close = analog_close; 457 input_dev->close = analog_close;
458 458
459 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 459 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
460 460
461 for (i = j = 0; i < 4; i++) 461 for (i = j = 0; i < 4; i++)
462 if (analog->mask & (1 << i)) { 462 if (analog->mask & (1 << i)) {
diff --git a/drivers/input/joystick/cobra.c b/drivers/input/joystick/cobra.c
index d3352a849b85..55646a6d89f5 100644
--- a/drivers/input/joystick/cobra.c
+++ b/drivers/input/joystick/cobra.c
@@ -218,7 +218,7 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
218 input_dev->open = cobra_open; 218 input_dev->open = cobra_open;
219 input_dev->close = cobra_close; 219 input_dev->close = cobra_close;
220 220
221 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 221 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
222 input_set_abs_params(input_dev, ABS_X, -1, 1, 0, 0); 222 input_set_abs_params(input_dev, ABS_X, -1, 1, 0, 0);
223 input_set_abs_params(input_dev, ABS_Y, -1, 1, 0, 0); 223 input_set_abs_params(input_dev, ABS_Y, -1, 1, 0, 0);
224 for (j = 0; cobra_btn[j]; j++) 224 for (j = 0; cobra_btn[j]; j++)
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c
index b069ee18e353..a6ca9d5e252f 100644
--- a/drivers/input/joystick/db9.c
+++ b/drivers/input/joystick/db9.c
@@ -4,7 +4,7 @@
4 * Copyright (c) 1999-2001 Vojtech Pavlik 4 * Copyright (c) 1999-2001 Vojtech Pavlik
5 * 5 *
6 * Based on the work of: 6 * Based on the work of:
7 * Andree Borrmann Mats Sjövall 7 * Andree Borrmann Mats Sjövall
8 */ 8 */
9 9
10/* 10/*
@@ -631,7 +631,7 @@ static struct db9 __init *db9_probe(int parport, int mode)
631 input_dev->open = db9_open; 631 input_dev->open = db9_open;
632 input_dev->close = db9_close; 632 input_dev->close = db9_close;
633 633
634 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 634 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
635 for (j = 0; j < db9_mode->n_buttons; j++) 635 for (j = 0; j < db9_mode->n_buttons; j++)
636 set_bit(db9_mode->buttons[j], input_dev->keybit); 636 set_bit(db9_mode->buttons[j], input_dev->keybit);
637 for (j = 0; j < db9_mode->n_axis; j++) { 637 for (j = 0; j < db9_mode->n_axis; j++) {
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c
index 1a452e0e5f25..df2a9d02ca6c 100644
--- a/drivers/input/joystick/gamecon.c
+++ b/drivers/input/joystick/gamecon.c
@@ -653,12 +653,12 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
653 input_dev->close = gc_close; 653 input_dev->close = gc_close;
654 654
655 if (pad_type != GC_SNESMOUSE) { 655 if (pad_type != GC_SNESMOUSE) {
656 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 656 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
657 657
658 for (i = 0; i < 2; i++) 658 for (i = 0; i < 2; i++)
659 input_set_abs_params(input_dev, ABS_X + i, -1, 1, 0, 0); 659 input_set_abs_params(input_dev, ABS_X + i, -1, 1, 0, 0);
660 } else 660 } else
661 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 661 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
662 662
663 gc->pads[0] |= gc_status_bit[idx]; 663 gc->pads[0] |= gc_status_bit[idx];
664 gc->pads[pad_type] |= gc_status_bit[idx]; 664 gc->pads[pad_type] |= gc_status_bit[idx];
diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c
index d514aebf7554..1f6302c0eb3f 100644
--- a/drivers/input/joystick/gf2k.c
+++ b/drivers/input/joystick/gf2k.c
@@ -315,7 +315,7 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
315 input_dev->open = gf2k_open; 315 input_dev->open = gf2k_open;
316 input_dev->close = gf2k_close; 316 input_dev->close = gf2k_close;
317 317
318 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 318 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
319 319
320 for (i = 0; i < gf2k_axes[gf2k->id]; i++) 320 for (i = 0; i < gf2k_axes[gf2k->id]; i++)
321 set_bit(gf2k_abs[i], input_dev->absbit); 321 set_bit(gf2k_abs[i], input_dev->absbit);
diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c
index 73eb5ab6f140..fd3853ab1aad 100644
--- a/drivers/input/joystick/grip.c
+++ b/drivers/input/joystick/grip.c
@@ -370,7 +370,7 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
370 input_dev->open = grip_open; 370 input_dev->open = grip_open;
371 input_dev->close = grip_close; 371 input_dev->close = grip_close;
372 372
373 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 373 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
374 374
375 for (j = 0; (t = grip_abs[grip->mode[i]][j]) >= 0; j++) { 375 for (j = 0; (t = grip_abs[grip->mode[i]][j]) >= 0; j++) {
376 376
diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c
index 4ed3a3eadf19..c57e21d68c00 100644
--- a/drivers/input/joystick/grip_mp.c
+++ b/drivers/input/joystick/grip_mp.c
@@ -606,7 +606,7 @@ static int register_slot(int slot, struct grip_mp *grip)
606 input_dev->open = grip_open; 606 input_dev->open = grip_open;
607 input_dev->close = grip_close; 607 input_dev->close = grip_close;
608 608
609 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 609 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
610 610
611 for (j = 0; (t = grip_abs[port->mode][j]) >= 0; j++) 611 for (j = 0; (t = grip_abs[port->mode][j]) >= 0; j++)
612 input_set_abs_params(input_dev, t, -1, 1, 0, 0); 612 input_set_abs_params(input_dev, t, -1, 1, 0, 0);
diff --git a/drivers/input/joystick/guillemot.c b/drivers/input/joystick/guillemot.c
index d4e8073caf27..aa6bfb3fb8cd 100644
--- a/drivers/input/joystick/guillemot.c
+++ b/drivers/input/joystick/guillemot.c
@@ -238,7 +238,7 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver *
238 input_dev->open = guillemot_open; 238 input_dev->open = guillemot_open;
239 input_dev->close = guillemot_close; 239 input_dev->close = guillemot_close;
240 240
241 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 241 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
242 242
243 for (i = 0; (t = guillemot->type->abs[i]) >= 0; i++) 243 for (i = 0; (t = guillemot->type->abs[i]) >= 0; i++)
244 input_set_abs_params(input_dev, t, 0, 255, 0, 0); 244 input_set_abs_params(input_dev, t, 0, 255, 0, 0);
diff --git a/drivers/input/joystick/iforce/Makefile b/drivers/input/joystick/iforce/Makefile
index 17ae42bf9ffd..74daff49ab6e 100644
--- a/drivers/input/joystick/iforce/Makefile
+++ b/drivers/input/joystick/iforce/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the I-Force driver 2# Makefile for the I-Force driver
3# 3#
4# By Johann Deneux <deneux@ifrance.com> 4# By Johann Deneux <johann.deneux@gmail.com>
5# 5#
6 6
7# Goal definition 7# Goal definition
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index 682244b1c042..6f826b37d9aa 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -389,7 +389,8 @@ int iforce_init_device(struct iforce *iforce)
389 * Set input device bitfields and ranges. 389 * Set input device bitfields and ranges.
390 */ 390 */
391 391
392 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_FF_STATUS); 392 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
393 BIT_MASK(EV_FF_STATUS);
393 394
394 for (i = 0; iforce->type->btn[i] >= 0; i++) 395 for (i = 0; iforce->type->btn[i] >= 0; i++)
395 set_bit(iforce->type->btn[i], input_dev->keybit); 396 set_bit(iforce->type->btn[i], input_dev->keybit);
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
index 40a853ac21c7..a964a7cfd210 100644
--- a/drivers/input/joystick/iforce/iforce.h
+++ b/drivers/input/joystick/iforce/iforce.h
@@ -62,13 +62,13 @@
62#define FF_CORE_IS_PLAYED 3 /* Effect is currently being played */ 62#define FF_CORE_IS_PLAYED 3 /* Effect is currently being played */
63#define FF_CORE_SHOULD_PLAY 4 /* User wants the effect to be played */ 63#define FF_CORE_SHOULD_PLAY 4 /* User wants the effect to be played */
64#define FF_CORE_UPDATE 5 /* Effect is being updated */ 64#define FF_CORE_UPDATE 5 /* Effect is being updated */
65#define FF_MODCORE_MAX 5 65#define FF_MODCORE_CNT 6
66 66
67struct iforce_core_effect { 67struct iforce_core_effect {
68 /* Information about where modifiers are stored in the device's memory */ 68 /* Information about where modifiers are stored in the device's memory */
69 struct resource mod1_chunk; 69 struct resource mod1_chunk;
70 struct resource mod2_chunk; 70 struct resource mod2_chunk;
71 unsigned long flags[NBITS(FF_MODCORE_MAX)]; 71 unsigned long flags[BITS_TO_LONGS(FF_MODCORE_CNT)];
72}; 72};
73 73
74#define FF_CMD_EFFECT 0x010e 74#define FF_CMD_EFFECT 0x010e
diff --git a/drivers/input/joystick/interact.c b/drivers/input/joystick/interact.c
index 1aec1e9d7c59..bc8ea95dfd0e 100644
--- a/drivers/input/joystick/interact.c
+++ b/drivers/input/joystick/interact.c
@@ -269,7 +269,7 @@ static int interact_connect(struct gameport *gameport, struct gameport_driver *d
269 input_dev->open = interact_open; 269 input_dev->open = interact_open;
270 input_dev->close = interact_close; 270 input_dev->close = interact_close;
271 271
272 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 272 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
273 273
274 for (i = 0; (t = interact_type[interact->type].abs[i]) >= 0; i++) { 274 for (i = 0; (t = interact_type[interact->type].abs[i]) >= 0; i++) {
275 set_bit(t, input_dev->absbit); 275 set_bit(t, input_dev->absbit);
diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
index b35604ee43ae..54e676948ebb 100644
--- a/drivers/input/joystick/magellan.c
+++ b/drivers/input/joystick/magellan.c
@@ -170,7 +170,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
170 input_dev->id.version = 0x0100; 170 input_dev->id.version = 0x0100;
171 input_dev->dev.parent = &serio->dev; 171 input_dev->dev.parent = &serio->dev;
172 172
173 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 173 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
174 174
175 for (i = 0; i < 9; i++) 175 for (i = 0; i < 9; i++)
176 set_bit(magellan_buttons[i], input_dev->keybit); 176 set_bit(magellan_buttons[i], input_dev->keybit);
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
index 2adf73f63c94..7b4865fdee54 100644
--- a/drivers/input/joystick/sidewinder.c
+++ b/drivers/input/joystick/sidewinder.c
@@ -758,7 +758,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
758 input_dev->open = sw_open; 758 input_dev->open = sw_open;
759 input_dev->close = sw_close; 759 input_dev->close = sw_close;
760 760
761 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 761 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
762 762
763 for (j = 0; (bits = sw_bit[sw->type][j]); j++) { 763 for (j = 0; (bits = sw_bit[sw->type][j]); j++) {
764 code = sw_abs[sw->type][j]; 764 code = sw_abs[sw->type][j];
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
index abb7c4cf54ad..d4087fd49656 100644
--- a/drivers/input/joystick/spaceball.c
+++ b/drivers/input/joystick/spaceball.c
@@ -228,18 +228,23 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
228 input_dev->id.version = 0x0100; 228 input_dev->id.version = 0x0100;
229 input_dev->dev.parent = &serio->dev; 229 input_dev->dev.parent = &serio->dev;
230 230
231 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 231 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
232 232
233 switch (id) { 233 switch (id) {
234 case SPACEBALL_4000FLX: 234 case SPACEBALL_4000FLX:
235 case SPACEBALL_4000FLX_L: 235 case SPACEBALL_4000FLX_L:
236 input_dev->keybit[LONG(BTN_0)] |= BIT(BTN_9); 236 input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_9);
237 input_dev->keybit[LONG(BTN_A)] |= BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_MODE); 237 input_dev->keybit[BIT_WORD(BTN_A)] |= BIT_MASK(BTN_A) |
238 BIT_MASK(BTN_B) | BIT_MASK(BTN_C) |
239 BIT_MASK(BTN_MODE);
238 default: 240 default:
239 input_dev->keybit[LONG(BTN_0)] |= BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) 241 input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_2) |
240 | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7) | BIT(BTN_8); 242 BIT_MASK(BTN_3) | BIT_MASK(BTN_4) |
243 BIT_MASK(BTN_5) | BIT_MASK(BTN_6) |
244 BIT_MASK(BTN_7) | BIT_MASK(BTN_8);
241 case SPACEBALL_3003C: 245 case SPACEBALL_3003C:
242 input_dev->keybit[LONG(BTN_0)] |= BIT(BTN_1) | BIT(BTN_8); 246 input_dev->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_1) |
247 BIT_MASK(BTN_8);
243 } 248 }
244 249
245 for (i = 0; i < 3; i++) { 250 for (i = 0; i < 3; i++) {
diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c
index c4937f1e837c..f7ce4004f4ba 100644
--- a/drivers/input/joystick/spaceorb.c
+++ b/drivers/input/joystick/spaceorb.c
@@ -185,7 +185,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
185 input_dev->id.version = 0x0100; 185 input_dev->id.version = 0x0100;
186 input_dev->dev.parent = &serio->dev; 186 input_dev->dev.parent = &serio->dev;
187 187
188 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 188 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
189 189
190 for (i = 0; i < 6; i++) 190 for (i = 0; i < 6; i++)
191 set_bit(spaceorb_buttons[i], input_dev->keybit); 191 set_bit(spaceorb_buttons[i], input_dev->keybit);
diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c
index 8581ee991d4e..baa10b2f7ba1 100644
--- a/drivers/input/joystick/stinger.c
+++ b/drivers/input/joystick/stinger.c
@@ -156,10 +156,11 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
156 input_dev->id.version = 0x0100; 156 input_dev->id.version = 0x0100;
157 input_dev->dev.parent = &serio->dev; 157 input_dev->dev.parent = &serio->dev;
158 158
159 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 159 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
160 input_dev->keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) | 160 input_dev->keybit[BIT_WORD(BTN_A)] = BIT_MASK(BTN_A) | BIT_MASK(BTN_B) |
161 BIT(BTN_Y) | BIT(BTN_Z) | BIT(BTN_TL) | BIT(BTN_TR) | 161 BIT_MASK(BTN_C) | BIT_MASK(BTN_X) | BIT_MASK(BTN_Y) |
162 BIT(BTN_START) | BIT(BTN_SELECT); 162 BIT_MASK(BTN_Z) | BIT_MASK(BTN_TL) | BIT_MASK(BTN_TR) |
163 BIT_MASK(BTN_START) | BIT_MASK(BTN_SELECT);
163 input_set_abs_params(input_dev, ABS_X, -64, 64, 0, 4); 164 input_set_abs_params(input_dev, ABS_X, -64, 64, 0, 4);
164 input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 4); 165 input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 4);
165 166
diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c
index 3b36ee04f726..0feeb8acb532 100644
--- a/drivers/input/joystick/tmdc.c
+++ b/drivers/input/joystick/tmdc.c
@@ -333,7 +333,7 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data)
333 input_dev->open = tmdc_open; 333 input_dev->open = tmdc_open;
334 input_dev->close = tmdc_close; 334 input_dev->close = tmdc_close;
335 335
336 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 336 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
337 337
338 for (i = 0; i < port->absc && i < TMDC_ABS; i++) 338 for (i = 0; i < port->absc && i < TMDC_ABS; i++)
339 if (port->abs[i] >= 0) 339 if (port->abs[i] >= 0)
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c
index 8381c6f14373..bbebd4e2ad7f 100644
--- a/drivers/input/joystick/turbografx.c
+++ b/drivers/input/joystick/turbografx.c
@@ -229,7 +229,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
229 input_dev->open = tgfx_open; 229 input_dev->open = tgfx_open;
230 input_dev->close = tgfx_close; 230 input_dev->close = tgfx_close;
231 231
232 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 232 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
233 input_set_abs_params(input_dev, ABS_X, -1, 1, 0, 0); 233 input_set_abs_params(input_dev, ABS_X, -1, 1, 0, 0);
234 input_set_abs_params(input_dev, ABS_Y, -1, 1, 0, 0); 234 input_set_abs_params(input_dev, ABS_Y, -1, 1, 0, 0);
235 235
diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c
index c91504ec38eb..1085c841fec4 100644
--- a/drivers/input/joystick/twidjoy.c
+++ b/drivers/input/joystick/twidjoy.c
@@ -207,7 +207,7 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
207 input_dev->id.version = 0x0100; 207 input_dev->id.version = 0x0100;
208 input_dev->dev.parent = &serio->dev; 208 input_dev->dev.parent = &serio->dev;
209 209
210 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 210 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
211 input_set_abs_params(input_dev, ABS_X, -50, 50, 4, 4); 211 input_set_abs_params(input_dev, ABS_X, -50, 50, 4, 4);
212 input_set_abs_params(input_dev, ABS_Y, -50, 50, 4, 4); 212 input_set_abs_params(input_dev, ABS_Y, -50, 50, 4, 4);
213 213
diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
index 4e85f72eefd7..e928b6e3724a 100644
--- a/drivers/input/joystick/warrior.c
+++ b/drivers/input/joystick/warrior.c
@@ -162,9 +162,11 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
162 input_dev->id.version = 0x0100; 162 input_dev->id.version = 0x0100;
163 input_dev->dev.parent = &serio->dev; 163 input_dev->dev.parent = &serio->dev;
164 164
165 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); 165 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL) |
166 input_dev->keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2); 166 BIT_MASK(EV_ABS);
167 input_dev->relbit[0] = BIT(REL_DIAL); 167 input_dev->keybit[BIT_WORD(BTN_TRIGGER)] = BIT_MASK(BTN_TRIGGER) |
168 BIT_MASK(BTN_THUMB) | BIT_MASK(BTN_TOP) | BIT_MASK(BTN_TOP2);
169 input_dev->relbit[0] = BIT_MASK(REL_DIAL);
168 input_set_abs_params(input_dev, ABS_X, -64, 64, 0, 8); 170 input_set_abs_params(input_dev, ABS_X, -64, 64, 0, 8);
169 input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 8); 171 input_set_abs_params(input_dev, ABS_Y, -64, 64, 0, 8);
170 input_set_abs_params(input_dev, ABS_THROTTLE, -112, 112, 0, 0); 172 input_set_abs_params(input_dev, ABS_THROTTLE, -112, 112, 0, 0);
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 623629a69b03..6dd375825a14 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -658,7 +658,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
658 input_dev->open = xpad_open; 658 input_dev->open = xpad_open;
659 input_dev->close = xpad_close; 659 input_dev->close = xpad_close;
660 660
661 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 661 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
662 662
663 /* set up buttons */ 663 /* set up buttons */
664 for (i = 0; xpad_btn[i] >= 0; i++) 664 for (i = 0; xpad_btn[i] >= 0; i++)
diff --git a/drivers/input/keyboard/aaed2000_kbd.c b/drivers/input/keyboard/aaed2000_kbd.c
index 63d6ead6b877..72abc196ce66 100644
--- a/drivers/input/keyboard/aaed2000_kbd.c
+++ b/drivers/input/keyboard/aaed2000_kbd.c
@@ -125,7 +125,7 @@ static int __devinit aaedkbd_probe(struct platform_device *pdev)
125 input_dev->id.version = 0x0100; 125 input_dev->id.version = 0x0100;
126 input_dev->dev.parent = &pdev->dev; 126 input_dev->dev.parent = &pdev->dev;
127 127
128 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 128 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
129 input_dev->keycode = aaedkbd->keycode; 129 input_dev->keycode = aaedkbd->keycode;
130 input_dev->keycodesize = sizeof(unsigned char); 130 input_dev->keycodesize = sizeof(unsigned char);
131 input_dev->keycodemax = ARRAY_SIZE(aaedkbd_keycode); 131 input_dev->keycodemax = ARRAY_SIZE(aaedkbd_keycode);
diff --git a/drivers/input/keyboard/amikbd.c b/drivers/input/keyboard/amikbd.c
index c67e84ec2d6a..81bf7562aca0 100644
--- a/drivers/input/keyboard/amikbd.c
+++ b/drivers/input/keyboard/amikbd.c
@@ -209,7 +209,7 @@ static int __init amikbd_init(void)
209 amikbd_dev->id.product = 0x0001; 209 amikbd_dev->id.product = 0x0001;
210 amikbd_dev->id.version = 0x0100; 210 amikbd_dev->id.version = 0x0100;
211 211
212 amikbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 212 amikbd_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
213 213
214 for (i = 0; i < 0x78; i++) 214 for (i = 0; i < 0x78; i++)
215 set_bit(i, amikbd_dev->keybit); 215 set_bit(i, amikbd_dev->keybit);
diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c
index a1800151b6ce..4e92100c56a8 100644
--- a/drivers/input/keyboard/atakbd.c
+++ b/drivers/input/keyboard/atakbd.c
@@ -237,7 +237,7 @@ static int __init atakbd_init(void)
237 atakbd_dev->id.product = 0x0001; 237 atakbd_dev->id.product = 0x0001;
238 atakbd_dev->id.version = 0x0100; 238 atakbd_dev->id.version = 0x0100;
239 239
240 atakbd_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 240 atakbd_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
241 atakbd_dev->keycode = atakbd_keycode; 241 atakbd_dev->keycode = atakbd_keycode;
242 atakbd_dev->keycodesize = sizeof(unsigned char); 242 atakbd_dev->keycodesize = sizeof(unsigned char);
243 atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode); 243 atakbd_dev->keycodemax = ARRAY_SIZE(atakbd_keycode);
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 41fc3d03b6eb..b39c5b31e620 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -900,27 +900,32 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd)
900 900
901 input_set_drvdata(input_dev, atkbd); 901 input_set_drvdata(input_dev, atkbd);
902 902
903 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); 903 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
904 BIT_MASK(EV_MSC);
904 905
905 if (atkbd->write) { 906 if (atkbd->write) {
906 input_dev->evbit[0] |= BIT(EV_LED); 907 input_dev->evbit[0] |= BIT_MASK(EV_LED);
907 input_dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); 908 input_dev->ledbit[0] = BIT_MASK(LED_NUML) |
909 BIT_MASK(LED_CAPSL) | BIT_MASK(LED_SCROLLL);
908 } 910 }
909 911
910 if (atkbd->extra) 912 if (atkbd->extra)
911 input_dev->ledbit[0] |= BIT(LED_COMPOSE) | BIT(LED_SUSPEND) | 913 input_dev->ledbit[0] |= BIT_MASK(LED_COMPOSE) |
912 BIT(LED_SLEEP) | BIT(LED_MUTE) | BIT(LED_MISC); 914 BIT_MASK(LED_SUSPEND) | BIT_MASK(LED_SLEEP) |
915 BIT_MASK(LED_MUTE) | BIT_MASK(LED_MISC);
913 916
914 if (!atkbd->softrepeat) { 917 if (!atkbd->softrepeat) {
915 input_dev->rep[REP_DELAY] = 250; 918 input_dev->rep[REP_DELAY] = 250;
916 input_dev->rep[REP_PERIOD] = 33; 919 input_dev->rep[REP_PERIOD] = 33;
917 } 920 }
918 921
919 input_dev->mscbit[0] = atkbd->softraw ? BIT(MSC_SCAN) : BIT(MSC_RAW) | BIT(MSC_SCAN); 922 input_dev->mscbit[0] = atkbd->softraw ? BIT_MASK(MSC_SCAN) :
923 BIT_MASK(MSC_RAW) | BIT_MASK(MSC_SCAN);
920 924
921 if (atkbd->scroll) { 925 if (atkbd->scroll) {
922 input_dev->evbit[0] |= BIT(EV_REL); 926 input_dev->evbit[0] |= BIT_MASK(EV_REL);
923 input_dev->relbit[0] = BIT(REL_WHEEL) | BIT(REL_HWHEEL); 927 input_dev->relbit[0] = BIT_MASK(REL_WHEEL) |
928 BIT_MASK(REL_HWHEEL);
924 set_bit(BTN_MIDDLE, input_dev->keybit); 929 set_bit(BTN_MIDDLE, input_dev->keybit);
925 } 930 }
926 931
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c
index 6578bfff644b..790fed368aae 100644
--- a/drivers/input/keyboard/corgikbd.c
+++ b/drivers/input/keyboard/corgikbd.c
@@ -325,7 +325,8 @@ static int __init corgikbd_probe(struct platform_device *pdev)
325 input_dev->id.version = 0x0100; 325 input_dev->id.version = 0x0100;
326 input_dev->dev.parent = &pdev->dev; 326 input_dev->dev.parent = &pdev->dev;
327 327
328 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); 328 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
329 BIT_MASK(EV_PWR) | BIT_MASK(EV_SW);
329 input_dev->keycode = corgikbd->keycode; 330 input_dev->keycode = corgikbd->keycode;
330 input_dev->keycodesize = sizeof(unsigned char); 331 input_dev->keycodesize = sizeof(unsigned char);
331 input_dev->keycodemax = ARRAY_SIZE(corgikbd_keycode); 332 input_dev->keycodemax = ARRAY_SIZE(corgikbd_keycode);
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index e2a3293bc67e..3eddf52a0bba 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -62,7 +62,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
62 62
63 platform_set_drvdata(pdev, input); 63 platform_set_drvdata(pdev, input);
64 64
65 input->evbit[0] = BIT(EV_KEY); 65 input->evbit[0] = BIT_MASK(EV_KEY);
66 66
67 input->name = pdev->name; 67 input->name = pdev->name;
68 input->phys = "gpio-keys/input0"; 68 input->phys = "gpio-keys/input0";
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index cdd254f2e6c7..adbf29f0169d 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -323,8 +323,9 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
323 goto bail2; 323 goto bail2;
324 } 324 }
325 325
326 kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 326 kbd->dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
327 kbd->dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); 327 kbd->dev->ledbit[0] = BIT_MASK(LED_NUML) | BIT_MASK(LED_CAPSL) |
328 BIT_MASK(LED_SCROLLL);
328 kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; 329 kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE;
329 kbd->dev->keycodesize = sizeof(hil_kbd_set1[0]); 330 kbd->dev->keycodesize = sizeof(hil_kbd_set1[0]);
330 kbd->dev->keycode = hil_kbd_set1; 331 kbd->dev->keycode = hil_kbd_set1;
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c
index 499b6974457f..50d80ecf0b80 100644
--- a/drivers/input/keyboard/hilkbd.c
+++ b/drivers/input/keyboard/hilkbd.c
@@ -266,8 +266,9 @@ hil_keyb_init(void)
266 if (hphilkeyb_keycode[i] != KEY_RESERVED) 266 if (hphilkeyb_keycode[i] != KEY_RESERVED)
267 set_bit(hphilkeyb_keycode[i], hil_dev.dev->keybit); 267 set_bit(hphilkeyb_keycode[i], hil_dev.dev->keybit);
268 268
269 hil_dev.dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 269 hil_dev.dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
270 hil_dev.dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); 270 hil_dev.dev->ledbit[0] = BIT_MASK(LED_NUML) | BIT_MASK(LED_CAPSL) |
271 BIT_MASK(LED_SCROLLL);
271 hil_dev.dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; 272 hil_dev.dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE;
272 hil_dev.dev->keycodesize= sizeof(hphilkeyb_keycode[0]); 273 hil_dev.dev->keycodesize= sizeof(hphilkeyb_keycode[0]);
273 hil_dev.dev->keycode = hphilkeyb_keycode; 274 hil_dev.dev->keycode = hphilkeyb_keycode;
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c
index 7a41b271f222..5a0ca18d6755 100644
--- a/drivers/input/keyboard/locomokbd.c
+++ b/drivers/input/keyboard/locomokbd.c
@@ -233,7 +233,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
233 input_dev->id.version = 0x0100; 233 input_dev->id.version = 0x0100;
234 input_dev->dev.parent = &dev->dev; 234 input_dev->dev.parent = &dev->dev;
235 235
236 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 236 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
237 input_dev->keycode = locomokbd->keycode; 237 input_dev->keycode = locomokbd->keycode;
238 input_dev->keycodesize = sizeof(unsigned char); 238 input_dev->keycodesize = sizeof(unsigned char);
239 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode); 239 input_dev->keycodemax = ARRAY_SIZE(locomokbd_keycode);
diff --git a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c
index b97a41e3ee56..48d1cab0aa1c 100644
--- a/drivers/input/keyboard/newtonkbd.c
+++ b/drivers/input/keyboard/newtonkbd.c
@@ -106,7 +106,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
106 input_dev->id.version = 0x0100; 106 input_dev->id.version = 0x0100;
107 input_dev->dev.parent = &serio->dev; 107 input_dev->dev.parent = &serio->dev;
108 108
109 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 109 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
110 input_dev->keycode = nkbd->keycode; 110 input_dev->keycode = nkbd->keycode;
111 input_dev->keycodesize = sizeof(unsigned char); 111 input_dev->keycodesize = sizeof(unsigned char);
112 input_dev->keycodemax = ARRAY_SIZE(nkbd_keycode); 112 input_dev->keycodemax = ARRAY_SIZE(nkbd_keycode);
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 76f1969552c5..babc913d5492 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -4,7 +4,7 @@
4 * OMAP Keypad Driver 4 * OMAP Keypad Driver
5 * 5 *
6 * Copyright (C) 2003 Nokia Corporation 6 * Copyright (C) 2003 Nokia Corporation
7 * Written by Timo Teräs <ext-timo.teras@nokia.com> 7 * Written by Timo Teräs <ext-timo.teras@nokia.com>
8 * 8 *
9 * Added support for H2 & H3 Keypad 9 * Added support for H2 & H3 Keypad
10 * Copyright (C) 2004 Texas Instruments 10 * Copyright (C) 2004 Texas Instruments
@@ -481,6 +481,6 @@ static void __exit omap_kp_exit(void)
481module_init(omap_kp_init); 481module_init(omap_kp_init);
482module_exit(omap_kp_exit); 482module_exit(omap_kp_exit);
483 483
484MODULE_AUTHOR("Timo Teräs"); 484MODULE_AUTHOR("Timo Teräs");
485MODULE_DESCRIPTION("OMAP Keypad Driver"); 485MODULE_DESCRIPTION("OMAP Keypad Driver");
486MODULE_LICENSE("GPL"); 486MODULE_LICENSE("GPL");
diff --git a/drivers/input/keyboard/pxa27x_keyboard.c b/drivers/input/keyboard/pxa27x_keyboard.c
index b7061aa38816..bdd64ee4c5c8 100644
--- a/drivers/input/keyboard/pxa27x_keyboard.c
+++ b/drivers/input/keyboard/pxa27x_keyboard.c
@@ -183,8 +183,9 @@ static int __devinit pxakbd_probe(struct platform_device *pdev)
183 input_dev->close = pxakbd_close; 183 input_dev->close = pxakbd_close;
184 input_dev->dev.parent = &pdev->dev; 184 input_dev->dev.parent = &pdev->dev;
185 185
186 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL); 186 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
187 input_dev->relbit[LONG(REL_WHEEL)] = BIT(REL_WHEEL); 187 BIT_MASK(EV_REL);
188 input_dev->relbit[BIT_WORD(REL_WHEEL)] = BIT_MASK(REL_WHEEL);
188 for (row = 0; row < pdata->nr_rows; row++) { 189 for (row = 0; row < pdata->nr_rows; row++) {
189 for (col = 0; col < pdata->nr_cols; col++) { 190 for (col = 0; col < pdata->nr_cols; col++) {
190 int code = pdata->keycodes[row][col]; 191 int code = pdata->keycodes[row][col];
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c
index 41b80385476c..410d78a774d0 100644
--- a/drivers/input/keyboard/spitzkbd.c
+++ b/drivers/input/keyboard/spitzkbd.c
@@ -381,7 +381,8 @@ static int __init spitzkbd_probe(struct platform_device *dev)
381 input_dev->id.product = 0x0001; 381 input_dev->id.product = 0x0001;
382 input_dev->id.version = 0x0100; 382 input_dev->id.version = 0x0100;
383 383
384 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); 384 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
385 BIT_MASK(EV_PWR) | BIT_MASK(EV_SW);
385 input_dev->keycode = spitzkbd->keycode; 386 input_dev->keycode = spitzkbd->keycode;
386 input_dev->keycodesize = sizeof(unsigned char); 387 input_dev->keycodesize = sizeof(unsigned char);
387 input_dev->keycodemax = ARRAY_SIZE(spitzkbd_keycode); 388 input_dev->keycodemax = ARRAY_SIZE(spitzkbd_keycode);
diff --git a/drivers/input/keyboard/stowaway.c b/drivers/input/keyboard/stowaway.c
index b44b0684d543..7437219370b1 100644
--- a/drivers/input/keyboard/stowaway.c
+++ b/drivers/input/keyboard/stowaway.c
@@ -110,7 +110,7 @@ static int skbd_connect(struct serio *serio, struct serio_driver *drv)
110 input_dev->id.version = 0x0100; 110 input_dev->id.version = 0x0100;
111 input_dev->dev.parent = &serio->dev; 111 input_dev->dev.parent = &serio->dev;
112 112
113 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 113 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
114 input_dev->keycode = skbd->keycode; 114 input_dev->keycode = skbd->keycode;
115 input_dev->keycodesize = sizeof(unsigned char); 115 input_dev->keycodesize = sizeof(unsigned char);
116 input_dev->keycodemax = ARRAY_SIZE(skbd_keycode); 116 input_dev->keycodemax = ARRAY_SIZE(skbd_keycode);
diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
index 1d4e39624cfe..be0f5d19d023 100644
--- a/drivers/input/keyboard/sunkbd.c
+++ b/drivers/input/keyboard/sunkbd.c
@@ -277,9 +277,11 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
277 277
278 input_dev->event = sunkbd_event; 278 input_dev->event = sunkbd_event;
279 279
280 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP); 280 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_LED) |
281 input_dev->ledbit[0] = BIT(LED_CAPSL) | BIT(LED_COMPOSE) | BIT(LED_SCROLLL) | BIT(LED_NUML); 281 BIT_MASK(EV_SND) | BIT_MASK(EV_REP);
282 input_dev->sndbit[0] = BIT(SND_CLICK) | BIT(SND_BELL); 282 input_dev->ledbit[0] = BIT_MASK(LED_CAPSL) | BIT_MASK(LED_COMPOSE) |
283 BIT_MASK(LED_SCROLLL) | BIT_MASK(LED_NUML);
284 input_dev->sndbit[0] = BIT_MASK(SND_CLICK) | BIT_MASK(SND_BELL);
283 285
284 input_dev->keycode = sunkbd->keycode; 286 input_dev->keycode = sunkbd->keycode;
285 input_dev->keycodesize = sizeof(unsigned char); 287 input_dev->keycodesize = sizeof(unsigned char);
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
index f3a56eb58ed1..152a2c070508 100644
--- a/drivers/input/keyboard/xtkbd.c
+++ b/drivers/input/keyboard/xtkbd.c
@@ -110,7 +110,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv)
110 input_dev->id.version = 0x0100; 110 input_dev->id.version = 0x0100;
111 input_dev->dev.parent = &serio->dev; 111 input_dev->dev.parent = &serio->dev;
112 112
113 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 113 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
114 input_dev->keycode = xtkbd->keycode; 114 input_dev->keycode = xtkbd->keycode;
115 input_dev->keycodesize = sizeof(unsigned char); 115 input_dev->keycodesize = sizeof(unsigned char);
116 input_dev->keycodemax = ARRAY_SIZE(xtkbd_keycode); 116 input_dev->keycodemax = ARRAY_SIZE(xtkbd_keycode);
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7acc6351bb44..8f5c7b90187d 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -70,9 +70,9 @@ config INPUT_WISTRON_BTNS
70 select LEDS_CLASS 70 select LEDS_CLASS
71 select CHECK_SIGNATURE 71 select CHECK_SIGNATURE
72 help 72 help
73 Say Y here for support of Winstron laptop button interface, used on 73 Say Y here for support of Wistron laptop button interfaces, used on
74 laptops of various brands, including Acer and Fujitsu-Siemens. If 74 laptops of various brands, including Acer and Fujitsu-Siemens. If
75 available, mail and wifi leds will be controlable via /sys/class/leds. 75 available, mail and wifi LEDs will be controllable via /sys/class/leds.
76 76
77 To compile this driver as a module, choose M here: the module will 77 To compile this driver as a module, choose M here: the module will
78 be called wistron_btns. 78 be called wistron_btns.
diff --git a/drivers/input/misc/ati_remote.c b/drivers/input/misc/ati_remote.c
index 471aab206443..3a7937481ad8 100644
--- a/drivers/input/misc/ati_remote.c
+++ b/drivers/input/misc/ati_remote.c
@@ -662,10 +662,10 @@ static void ati_remote_input_init(struct ati_remote *ati_remote)
662 struct input_dev *idev = ati_remote->idev; 662 struct input_dev *idev = ati_remote->idev;
663 int i; 663 int i;
664 664
665 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 665 idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
666 idev->keybit[LONG(BTN_MOUSE)] = ( BIT(BTN_LEFT) | BIT(BTN_RIGHT) | 666 idev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
667 BIT(BTN_SIDE) | BIT(BTN_EXTRA) ); 667 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA);
668 idev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 668 idev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
669 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) 669 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++)
670 if (ati_remote_tbl[i].type == EV_KEY) 670 if (ati_remote_tbl[i].type == EV_KEY)
671 set_bit(ati_remote_tbl[i].code, idev->keybit); 671 set_bit(ati_remote_tbl[i].code, idev->keybit);
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 1031543e5c3f..f2709b82485c 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -346,9 +346,10 @@ static int ati_remote2_input_init(struct ati_remote2 *ar2)
346 ar2->idev = idev; 346 ar2->idev = idev;
347 input_set_drvdata(idev, ar2); 347 input_set_drvdata(idev, ar2);
348 348
349 idev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL); 349 idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | BIT_MASK(EV_REL);
350 idev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); 350 idev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
351 idev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 351 BIT_MASK(BTN_RIGHT);
352 idev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
352 for (i = 0; ati_remote2_key_table[i].key_code != KEY_RESERVED; i++) 353 for (i = 0; ati_remote2_key_table[i].key_code != KEY_RESERVED; i++)
353 set_bit(ati_remote2_key_table[i].key_code, idev->keybit); 354 set_bit(ati_remote2_key_table[i].key_code, idev->keybit);
354 355
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c
index e43e92fd9e23..4e3ad657ed80 100644
--- a/drivers/input/misc/atlas_btns.c
+++ b/drivers/input/misc/atlas_btns.c
@@ -81,7 +81,7 @@ static int atlas_acpi_button_add(struct acpi_device *device)
81 input_dev->name = "Atlas ACPI button driver"; 81 input_dev->name = "Atlas ACPI button driver";
82 input_dev->phys = "ASIM0000/atlas/input0"; 82 input_dev->phys = "ASIM0000/atlas/input0";
83 input_dev->id.bustype = BUS_HOST; 83 input_dev->id.bustype = BUS_HOST;
84 input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY); 84 input_dev->evbit[BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY);
85 85
86 set_bit(KEY_F1, input_dev->keybit); 86 set_bit(KEY_F1, input_dev->keybit);
87 set_bit(KEY_F2, input_dev->keybit); 87 set_bit(KEY_F2, input_dev->keybit);
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c
index 064b07936019..1aef97ed5e84 100644
--- a/drivers/input/misc/cobalt_btns.c
+++ b/drivers/input/misc/cobalt_btns.c
@@ -104,7 +104,7 @@ static int __devinit cobalt_buttons_probe(struct platform_device *pdev)
104 input->id.bustype = BUS_HOST; 104 input->id.bustype = BUS_HOST;
105 input->cdev.dev = &pdev->dev; 105 input->cdev.dev = &pdev->dev;
106 106
107 input->evbit[0] = BIT(EV_KEY); 107 input->evbit[0] = BIT_MASK(EV_KEY);
108 for (i = 0; i < ARRAY_SIZE(buttons_map); i++) { 108 for (i = 0; i < ARRAY_SIZE(buttons_map); i++) {
109 set_bit(buttons_map[i].keycode, input->keybit); 109 set_bit(buttons_map[i].keycode, input->keybit);
110 buttons_map[i].count = 0; 110 buttons_map[i].count = 0;
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index e759944041ab..d2ade7443b7d 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -109,8 +109,8 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
109 input_dev->id.version = 0x0100; 109 input_dev->id.version = 0x0100;
110 input_dev->dev.parent = &dev->dev; 110 input_dev->dev.parent = &dev->dev;
111 111
112 input_dev->evbit[0] = BIT(EV_SND); 112 input_dev->evbit[0] = BIT_MASK(EV_SND);
113 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 113 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
114 input_dev->event = ixp4xx_spkr_event; 114 input_dev->event = ixp4xx_spkr_event;
115 115
116 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, 116 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index 1bffc9fa98c2..fd74347047dd 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -497,7 +497,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic
497 usb_to_input_id(udev, &input_dev->id); 497 usb_to_input_id(udev, &input_dev->id);
498 input_dev->dev.parent = &interface->dev; 498 input_dev->dev.parent = &interface->dev;
499 499
500 input_dev->evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */ 500 input_dev->evbit[0] = BIT_MASK(EV_KEY); /* We will only report KEY events. */
501 for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++) 501 for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++)
502 if (keyspan_key_table[i] != KEY_RESERVED) 502 if (keyspan_key_table[i] != KEY_RESERVED)
503 set_bit(keyspan_key_table[i], input_dev->keybit); 503 set_bit(keyspan_key_table[i], input_dev->keybit);
diff --git a/drivers/input/misc/m68kspkr.c b/drivers/input/misc/m68kspkr.c
index e9f26e766b4d..0c64d9bb718e 100644
--- a/drivers/input/misc/m68kspkr.c
+++ b/drivers/input/misc/m68kspkr.c
@@ -65,8 +65,8 @@ static int __devinit m68kspkr_probe(struct platform_device *dev)
65 input_dev->id.version = 0x0100; 65 input_dev->id.version = 0x0100;
66 input_dev->dev.parent = &dev->dev; 66 input_dev->dev.parent = &dev->dev;
67 67
68 input_dev->evbit[0] = BIT(EV_SND); 68 input_dev->evbit[0] = BIT_MASK(EV_SND);
69 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 69 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
70 input_dev->event = m68kspkr_event; 70 input_dev->event = m68kspkr_event;
71 71
72 err = input_register_device(input_dev); 72 err = input_register_device(input_dev);
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index c19f77fbaf2a..4941a9e61e90 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -86,8 +86,8 @@ static int __devinit pcspkr_probe(struct platform_device *dev)
86 pcspkr_dev->id.version = 0x0100; 86 pcspkr_dev->id.version = 0x0100;
87 pcspkr_dev->dev.parent = &dev->dev; 87 pcspkr_dev->dev.parent = &dev->dev;
88 88
89 pcspkr_dev->evbit[0] = BIT(EV_SND); 89 pcspkr_dev->evbit[0] = BIT_MASK(EV_SND);
90 pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 90 pcspkr_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
91 pcspkr_dev->event = pcspkr_event; 91 pcspkr_dev->event = pcspkr_event;
92 92
93 err = input_register_device(pcspkr_dev); 93 err = input_register_device(pcspkr_dev);
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 448a470d28f2..7a7b8c7b9633 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -363,10 +363,11 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
363 363
364 input_dev->event = powermate_input_event; 364 input_dev->event = powermate_input_event;
365 365
366 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_MSC); 366 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL) |
367 input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); 367 BIT_MASK(EV_MSC);
368 input_dev->relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); 368 input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
369 input_dev->mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); 369 input_dev->relbit[BIT_WORD(REL_DIAL)] = BIT_MASK(REL_DIAL);
370 input_dev->mscbit[BIT_WORD(MSC_PULSELED)] = BIT_MASK(MSC_PULSELED);
370 371
371 /* get a handle to the interrupt data pipe */ 372 /* get a handle to the interrupt data pipe */
372 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); 373 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index e36ec1d92be8..a3637d870880 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -115,8 +115,8 @@ static int __devinit sparcspkr_probe(struct device *dev)
115 input_dev->id.version = 0x0100; 115 input_dev->id.version = 0x0100;
116 input_dev->dev.parent = dev; 116 input_dev->dev.parent = dev;
117 117
118 input_dev->evbit[0] = BIT(EV_SND); 118 input_dev->evbit[0] = BIT_MASK(EV_SND);
119 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 119 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
120 120
121 input_dev->event = state->event; 121 input_dev->event = state->event;
122 122
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index ab15880fd566..46279ef2b649 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -945,7 +945,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
945 /* input_dev->event = input_ev; TODO */ 945 /* input_dev->event = input_ev; TODO */
946 946
947 /* register available key events */ 947 /* register available key events */
948 input_dev->evbit[0] = BIT(EV_KEY); 948 input_dev->evbit[0] = BIT_MASK(EV_KEY);
949 for (i = 0; i < 256; i++) { 949 for (i = 0; i < 256; i++) {
950 int k = map_p1k_to_key(i); 950 int k = map_p1k_to_key(i);
951 if (k >= 0) { 951 if (k >= 0) {
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 64d70a9b714c..2b5ed119c9a9 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -455,24 +455,25 @@ int alps_init(struct psmouse *psmouse)
455 if (alps_hw_init(psmouse, &version)) 455 if (alps_hw_init(psmouse, &version))
456 goto init_fail; 456 goto init_fail;
457 457
458 dev1->evbit[LONG(EV_KEY)] |= BIT(EV_KEY); 458 dev1->evbit[BIT_WORD(EV_KEY)] |= BIT_MASK(EV_KEY);
459 dev1->keybit[LONG(BTN_TOUCH)] |= BIT(BTN_TOUCH); 459 dev1->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH);
460 dev1->keybit[LONG(BTN_TOOL_FINGER)] |= BIT(BTN_TOOL_FINGER); 460 dev1->keybit[BIT_WORD(BTN_TOOL_FINGER)] |= BIT_MASK(BTN_TOOL_FINGER);
461 dev1->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 461 dev1->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) |
462 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
462 463
463 dev1->evbit[LONG(EV_ABS)] |= BIT(EV_ABS); 464 dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS);
464 input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); 465 input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0);
465 input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); 466 input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0);
466 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); 467 input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0);
467 468
468 if (priv->i->flags & ALPS_WHEEL) { 469 if (priv->i->flags & ALPS_WHEEL) {
469 dev1->evbit[LONG(EV_REL)] |= BIT(EV_REL); 470 dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL);
470 dev1->relbit[LONG(REL_WHEEL)] |= BIT(REL_WHEEL); 471 dev1->relbit[BIT_WORD(REL_WHEEL)] |= BIT_MASK(REL_WHEEL);
471 } 472 }
472 473
473 if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { 474 if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) {
474 dev1->keybit[LONG(BTN_FORWARD)] |= BIT(BTN_FORWARD); 475 dev1->keybit[BIT_WORD(BTN_FORWARD)] |= BIT_MASK(BTN_FORWARD);
475 dev1->keybit[LONG(BTN_BACK)] |= BIT(BTN_BACK); 476 dev1->keybit[BIT_WORD(BTN_BACK)] |= BIT_MASK(BTN_BACK);
476 } 477 }
477 478
478 snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); 479 snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys);
@@ -483,9 +484,10 @@ int alps_init(struct psmouse *psmouse)
483 dev2->id.product = PSMOUSE_ALPS; 484 dev2->id.product = PSMOUSE_ALPS;
484 dev2->id.version = 0x0000; 485 dev2->id.version = 0x0000;
485 486
486 dev2->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 487 dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
487 dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y); 488 dev2->relbit[BIT_WORD(REL_X)] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y);
488 dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 489 dev2->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) |
490 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
489 491
490 if (input_register_device(priv->dev2)) 492 if (input_register_device(priv->dev2))
491 goto init_fail; 493 goto init_fail;
diff --git a/drivers/input/mouse/amimouse.c b/drivers/input/mouse/amimouse.c
index 239a0e16d91a..a185ac78a42c 100644
--- a/drivers/input/mouse/amimouse.c
+++ b/drivers/input/mouse/amimouse.c
@@ -111,9 +111,10 @@ static int __init amimouse_init(void)
111 amimouse_dev->id.product = 0x0002; 111 amimouse_dev->id.product = 0x0002;
112 amimouse_dev->id.version = 0x0100; 112 amimouse_dev->id.version = 0x0100;
113 113
114 amimouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 114 amimouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
115 amimouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 115 amimouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
116 amimouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 116 amimouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
117 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
117 amimouse_dev->open = amimouse_open; 118 amimouse_dev->open = amimouse_open;
118 amimouse_dev->close = amimouse_close; 119 amimouse_dev->close = amimouse_close;
119 120
diff --git a/drivers/input/mouse/atarimouse.c b/drivers/input/mouse/atarimouse.c
index c8c7244b48a1..98a3561d4b05 100644
--- a/drivers/input/mouse/atarimouse.c
+++ b/drivers/input/mouse/atarimouse.c
@@ -137,9 +137,10 @@ static int __init atamouse_init(void)
137 atamouse_dev->id.product = 0x0002; 137 atamouse_dev->id.product = 0x0002;
138 atamouse_dev->id.version = 0x0100; 138 atamouse_dev->id.version = 0x0100;
139 139
140 atamouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 140 atamouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
141 atamouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 141 atamouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
142 atamouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 142 atamouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
143 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
143 atamouse_dev->open = atamouse_open; 144 atamouse_dev->open = atamouse_open;
144 atamouse_dev->close = atamouse_close; 145 atamouse_dev->close = atamouse_close;
145 146
diff --git a/drivers/input/mouse/hil_ptr.c b/drivers/input/mouse/hil_ptr.c
index 449bf4dcbbcc..27f88fbb7136 100644
--- a/drivers/input/mouse/hil_ptr.c
+++ b/drivers/input/mouse/hil_ptr.c
@@ -298,12 +298,12 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
298 idd = ptr->idd + 1; 298 idd = ptr->idd + 1;
299 txt = "unknown"; 299 txt = "unknown";
300 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) { 300 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {
301 ptr->dev->evbit[0] = BIT(EV_REL); 301 ptr->dev->evbit[0] = BIT_MASK(EV_REL);
302 txt = "relative"; 302 txt = "relative";
303 } 303 }
304 304
305 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_ABS) { 305 if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_ABS) {
306 ptr->dev->evbit[0] = BIT(EV_ABS); 306 ptr->dev->evbit[0] = BIT_MASK(EV_ABS);
307 txt = "absolute"; 307 txt = "absolute";
308 } 308 }
309 if (!ptr->dev->evbit[0]) 309 if (!ptr->dev->evbit[0])
@@ -311,7 +311,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
311 311
312 ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd); 312 ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd);
313 if (ptr->nbtn) 313 if (ptr->nbtn)
314 ptr->dev->evbit[0] |= BIT(EV_KEY); 314 ptr->dev->evbit[0] |= BIT_MASK(EV_KEY);
315 315
316 naxsets = HIL_IDD_NUM_AXSETS(*idd); 316 naxsets = HIL_IDD_NUM_AXSETS(*idd);
317 ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd); 317 ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd);
diff --git a/drivers/input/mouse/inport.c b/drivers/input/mouse/inport.c
index 79b624fe8994..655a39217432 100644
--- a/drivers/input/mouse/inport.c
+++ b/drivers/input/mouse/inport.c
@@ -163,9 +163,10 @@ static int __init inport_init(void)
163 inport_dev->id.product = 0x0001; 163 inport_dev->id.product = 0x0001;
164 inport_dev->id.version = 0x0100; 164 inport_dev->id.version = 0x0100;
165 165
166 inport_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 166 inport_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
167 inport_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 167 inport_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
168 inport_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 168 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
169 inport_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
169 170
170 inport_dev->open = inport_open; 171 inport_dev->open = inport_open;
171 inport_dev->close = inport_close; 172 inport_dev->close = inport_close;
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index d7de4c53b3d8..9ec57d80186e 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -270,9 +270,10 @@ static int lifebook_create_relative_device(struct psmouse *psmouse)
270 dev2->id.version = 0x0000; 270 dev2->id.version = 0x0000;
271 dev2->dev.parent = &psmouse->ps2dev.serio->dev; 271 dev2->dev.parent = &psmouse->ps2dev.serio->dev;
272 272
273 dev2->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 273 dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
274 dev2->relbit[LONG(REL_X)] = BIT(REL_X) | BIT(REL_Y); 274 dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
275 dev2->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); 275 dev2->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
276 BIT_MASK(BTN_RIGHT);
276 277
277 error = input_register_device(priv->dev2); 278 error = input_register_device(priv->dev2);
278 if (error) 279 if (error)
@@ -295,9 +296,9 @@ int lifebook_init(struct psmouse *psmouse)
295 if (lifebook_absolute_mode(psmouse)) 296 if (lifebook_absolute_mode(psmouse))
296 return -1; 297 return -1;
297 298
298 dev1->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); 299 dev1->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
299 dev1->relbit[0] = 0; 300 dev1->relbit[0] = 0;
300 dev1->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 301 dev1->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
301 input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0); 302 input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0);
302 input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0); 303 input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0);
303 304
diff --git a/drivers/input/mouse/logibm.c b/drivers/input/mouse/logibm.c
index 26c3b2e2ca94..b23a4f3ea5cd 100644
--- a/drivers/input/mouse/logibm.c
+++ b/drivers/input/mouse/logibm.c
@@ -156,9 +156,10 @@ static int __init logibm_init(void)
156 logibm_dev->id.product = 0x0001; 156 logibm_dev->id.product = 0x0001;
157 logibm_dev->id.version = 0x0100; 157 logibm_dev->id.version = 0x0100;
158 158
159 logibm_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 159 logibm_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
160 logibm_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 160 logibm_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
161 logibm_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 161 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
162 logibm_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
162 163
163 logibm_dev->open = logibm_open; 164 logibm_dev->open = logibm_open;
164 logibm_dev->close = logibm_close; 165 logibm_dev->close = logibm_close;
diff --git a/drivers/input/mouse/pc110pad.c b/drivers/input/mouse/pc110pad.c
index 05d992e514f0..8991ab0b4fe3 100644
--- a/drivers/input/mouse/pc110pad.c
+++ b/drivers/input/mouse/pc110pad.c
@@ -144,9 +144,9 @@ static int __init pc110pad_init(void)
144 pc110pad_dev->id.product = 0x0001; 144 pc110pad_dev->id.product = 0x0001;
145 pc110pad_dev->id.version = 0x0100; 145 pc110pad_dev->id.version = 0x0100;
146 146
147 pc110pad_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 147 pc110pad_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
148 pc110pad_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y); 148 pc110pad_dev->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y);
149 pc110pad_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 149 pc110pad_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
150 150
151 pc110pad_dev->absmax[ABS_X] = 0x1ff; 151 pc110pad_dev->absmax[ABS_X] = 0x1ff;
152 pc110pad_dev->absmax[ABS_Y] = 0x0ff; 152 pc110pad_dev->absmax[ABS_Y] = 0x0ff;
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 073525756532..21a9c0b69a1f 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -906,7 +906,7 @@ static void psmouse_activate(struct psmouse *psmouse)
906 906
907/* 907/*
908 * psmouse_deactivate() puts the mouse into poll mode so that we don't get motion 908 * psmouse_deactivate() puts the mouse into poll mode so that we don't get motion
909 * reports from it unless we explicitely request it. 909 * reports from it unless we explicitly request it.
910 */ 910 */
911 911
912static void psmouse_deactivate(struct psmouse *psmouse) 912static void psmouse_deactivate(struct psmouse *psmouse)
@@ -1115,9 +1115,10 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse
1115 1115
1116 input_dev->dev.parent = &psmouse->ps2dev.serio->dev; 1116 input_dev->dev.parent = &psmouse->ps2dev.serio->dev;
1117 1117
1118 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 1118 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
1119 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 1119 input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
1120 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 1120 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
1121 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
1121 1122
1122 psmouse->set_rate = psmouse_set_rate; 1123 psmouse->set_rate = psmouse_set_rate;
1123 psmouse->set_resolution = psmouse_set_resolution; 1124 psmouse->set_resolution = psmouse_set_resolution;
diff --git a/drivers/input/mouse/rpcmouse.c b/drivers/input/mouse/rpcmouse.c
index 355efd0423e7..18a48636ba4a 100644
--- a/drivers/input/mouse/rpcmouse.c
+++ b/drivers/input/mouse/rpcmouse.c
@@ -78,9 +78,10 @@ static int __init rpcmouse_init(void)
78 rpcmouse_dev->id.product = 0x0001; 78 rpcmouse_dev->id.product = 0x0001;
79 rpcmouse_dev->id.version = 0x0100; 79 rpcmouse_dev->id.version = 0x0100;
80 80
81 rpcmouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 81 rpcmouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
82 rpcmouse_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 82 rpcmouse_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
83 rpcmouse_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 83 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
84 rpcmouse_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
84 85
85 rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX); 86 rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX);
86 rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY); 87 rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY);
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index 77b8ee2b9651..ed917bfd086a 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -268,9 +268,10 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
268 input_dev->id.version = 0x0100; 268 input_dev->id.version = 0x0100;
269 input_dev->dev.parent = &serio->dev; 269 input_dev->dev.parent = &serio->dev;
270 270
271 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 271 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
272 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT); 272 input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
273 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 273 BIT_MASK(BTN_RIGHT);
274 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
274 275
275 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit); 276 if (c & 0x01) set_bit(BTN_MIDDLE, input_dev->keybit);
276 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit); 277 if (c & 0x02) set_bit(BTN_SIDE, input_dev->keybit);
diff --git a/drivers/input/mouse/touchkit_ps2.c b/drivers/input/mouse/touchkit_ps2.c
index 7b977fd23571..3fadb2accac0 100644
--- a/drivers/input/mouse/touchkit_ps2.c
+++ b/drivers/input/mouse/touchkit_ps2.c
@@ -85,7 +85,7 @@ int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties)
85 return -ENODEV; 85 return -ENODEV;
86 86
87 if (set_properties) { 87 if (set_properties) {
88 dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 88 dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
89 set_bit(BTN_TOUCH, dev->keybit); 89 set_bit(BTN_TOUCH, dev->keybit);
90 input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); 90 input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0);
91 input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); 91 input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0);
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
index 4a321576f345..404eedd5ffa2 100644
--- a/drivers/input/mouse/vsxxxaa.c
+++ b/drivers/input/mouse/vsxxxaa.c
@@ -330,7 +330,7 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse)
330 330
331 /* 331 /*
332 * Check for Power-On-Reset packets. These are sent out 332 * Check for Power-On-Reset packets. These are sent out
333 * after plugging the mouse in, or when explicitely 333 * after plugging the mouse in, or when explicitly
334 * requested by sending 'T'. 334 * requested by sending 'T'.
335 * 335 *
336 * [0]: 1 0 1 0 R3 R2 R1 R0 336 * [0]: 1 0 1 0 R3 R2 R1 R0
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 79146d6ed2ab..78c3ea75da2a 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -998,34 +998,36 @@ static const struct input_device_id mousedev_ids[] = {
998 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 998 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
999 INPUT_DEVICE_ID_MATCH_KEYBIT | 999 INPUT_DEVICE_ID_MATCH_KEYBIT |
1000 INPUT_DEVICE_ID_MATCH_RELBIT, 1000 INPUT_DEVICE_ID_MATCH_RELBIT,
1001 .evbit = { BIT(EV_KEY) | BIT(EV_REL) }, 1001 .evbit = { BIT_MASK(EV_KEY) | BIT_MASK(EV_REL) },
1002 .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) }, 1002 .keybit = { [BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) },
1003 .relbit = { BIT(REL_X) | BIT(REL_Y) }, 1003 .relbit = { BIT_MASK(REL_X) | BIT_MASK(REL_Y) },
1004 }, /* A mouse like device, at least one button, 1004 }, /* A mouse like device, at least one button,
1005 two relative axes */ 1005 two relative axes */
1006 { 1006 {
1007 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 1007 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
1008 INPUT_DEVICE_ID_MATCH_RELBIT, 1008 INPUT_DEVICE_ID_MATCH_RELBIT,
1009 .evbit = { BIT(EV_KEY) | BIT(EV_REL) }, 1009 .evbit = { BIT_MASK(EV_KEY) | BIT_MASK(EV_REL) },
1010 .relbit = { BIT(REL_WHEEL) }, 1010 .relbit = { BIT_MASK(REL_WHEEL) },
1011 }, /* A separate scrollwheel */ 1011 }, /* A separate scrollwheel */
1012 { 1012 {
1013 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 1013 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
1014 INPUT_DEVICE_ID_MATCH_KEYBIT | 1014 INPUT_DEVICE_ID_MATCH_KEYBIT |
1015 INPUT_DEVICE_ID_MATCH_ABSBIT, 1015 INPUT_DEVICE_ID_MATCH_ABSBIT,
1016 .evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, 1016 .evbit = { BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) },
1017 .keybit = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) }, 1017 .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
1018 .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, 1018 .absbit = { BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) },
1019 }, /* A tablet like device, at least touch detection, 1019 }, /* A tablet like device, at least touch detection,
1020 two absolute axes */ 1020 two absolute axes */
1021 { 1021 {
1022 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 1022 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
1023 INPUT_DEVICE_ID_MATCH_KEYBIT | 1023 INPUT_DEVICE_ID_MATCH_KEYBIT |
1024 INPUT_DEVICE_ID_MATCH_ABSBIT, 1024 INPUT_DEVICE_ID_MATCH_ABSBIT,
1025 .evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, 1025 .evbit = { BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) },
1026 .keybit = { [LONG(BTN_TOOL_FINGER)] = BIT(BTN_TOOL_FINGER) }, 1026 .keybit = { [BIT_WORD(BTN_TOOL_FINGER)] =
1027 .absbit = { BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | 1027 BIT_MASK(BTN_TOOL_FINGER) },
1028 BIT(ABS_TOOL_WIDTH) }, 1028 .absbit = { BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) |
1029 BIT_MASK(ABS_PRESSURE) |
1030 BIT_MASK(ABS_TOOL_WIDTH) },
1029 }, /* A touchpad */ 1031 }, /* A touchpad */
1030 1032
1031 { }, /* Terminating entry */ 1033 { }, /* Terminating entry */
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index b3bc15acd3f5..7f5293828fbf 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -387,9 +387,8 @@ static int serio_thread(void *nothing)
387 set_freezable(); 387 set_freezable();
388 do { 388 do {
389 serio_handle_event(); 389 serio_handle_event();
390 wait_event_interruptible(serio_wait, 390 wait_event_freezable(serio_wait,
391 kthread_should_stop() || !list_empty(&serio_event_list)); 391 kthread_should_stop() || !list_empty(&serio_event_list));
392 try_to_freeze();
393 } while (!kthread_should_stop()); 392 } while (!kthread_should_stop());
394 393
395 printk(KERN_DEBUG "serio: kseriod exiting\n"); 394 printk(KERN_DEBUG "serio: kseriod exiting\n");
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index dd2310458c46..b973d0ef6d16 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -192,10 +192,14 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_
192 input_dev->open = usb_acecad_open; 192 input_dev->open = usb_acecad_open;
193 input_dev->close = usb_acecad_close; 193 input_dev->close = usb_acecad_close;
194 194
195 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 195 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
196 input_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE); 196 input_dev->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) |
197 input_dev->keybit[LONG(BTN_LEFT)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 197 BIT_MASK(ABS_PRESSURE);
198 input_dev->keybit[LONG(BTN_DIGI)] = BIT(BTN_TOOL_PEN) |BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2); 198 input_dev->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) |
199 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
200 input_dev->keybit[BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_TOOL_PEN) |
201 BIT_MASK(BTN_TOUCH) | BIT_MASK(BTN_STYLUS) |
202 BIT_MASK(BTN_STYLUS2);
199 203
200 switch (id->driver_info) { 204 switch (id->driver_info) {
201 case 0: 205 case 0:
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index b2ca10f2fe0e..d2c6da264722 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
@@ -573,10 +573,12 @@ static void gtco_setup_caps(struct input_dev *inputdev)
573 struct gtco *device = input_get_drvdata(inputdev); 573 struct gtco *device = input_get_drvdata(inputdev);
574 574
575 /* Which events */ 575 /* Which events */
576 inputdev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC); 576 inputdev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
577 BIT_MASK(EV_MSC);
577 578
578 /* Misc event menu block */ 579 /* Misc event menu block */
579 inputdev->mscbit[0] = BIT(MSC_SCAN)|BIT(MSC_SERIAL)|BIT(MSC_RAW) ; 580 inputdev->mscbit[0] = BIT_MASK(MSC_SCAN) | BIT_MASK(MSC_SERIAL) |
581 BIT_MASK(MSC_RAW);
580 582
581 /* Absolute values based on HID report info */ 583 /* Absolute values based on HID report info */
582 input_set_abs_params(inputdev, ABS_X, device->min_X, device->max_X, 584 input_set_abs_params(inputdev, ABS_X, device->min_X, device->max_X,
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 91e6d00d4a43..1182fc133167 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -153,10 +153,13 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
153 input_dev->open = kbtab_open; 153 input_dev->open = kbtab_open;
154 input_dev->close = kbtab_close; 154 input_dev->close = kbtab_close;
155 155
156 input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC); 156 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
157 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 157 BIT_MASK(EV_MSC);
158 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH); 158 input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) |
159 input_dev->mscbit[0] |= BIT(MSC_SERIAL); 159 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
160 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) |
161 BIT_MASK(BTN_TOUCH);
162 input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL);
160 input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0); 163 input_set_abs_params(input_dev, ABS_X, 0, 0x2000, 4, 0);
161 input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0); 164 input_set_abs_params(input_dev, ABS_Y, 0, 0x1750, 4, 0);
162 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0); 165 input_set_abs_params(input_dev, ABS_PRESSURE, 0, 0xff, 0, 0);
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 064e123c9b76..d64b1ea136b3 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -140,48 +140,58 @@ static void wacom_close(struct input_dev *dev)
140 140
141void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 141void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
142{ 142{
143 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_1) | BIT(BTN_5); 143 input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_1) |
144 BIT_MASK(BTN_5);
144 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); 145 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
145} 146}
146 147
147void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 148void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
148{ 149{
149 input_dev->evbit[0] |= BIT(EV_MSC); 150 input_dev->evbit[0] |= BIT_MASK(EV_MSC);
150 input_dev->mscbit[0] |= BIT(MSC_SERIAL); 151 input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL);
151 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); 152 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER);
152 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_4); 153 input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) |
154 BIT_MASK(BTN_4);
153} 155}
154 156
155void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 157void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
156{ 158{
157 input_dev->evbit[0] |= BIT(EV_REL); 159 input_dev->evbit[0] |= BIT_MASK(EV_REL);
158 input_dev->relbit[0] |= BIT(REL_WHEEL); 160 input_dev->relbit[0] |= BIT_MASK(REL_WHEEL);
159 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 161 input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) |
160 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); 162 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
163 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) |
164 BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_STYLUS2);
161 input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); 165 input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0);
162} 166}
163 167
164void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 168void input_dev_i3s(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
165{ 169{
166 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); 170 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER);
167 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3); 171 input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) |
172 BIT_MASK(BTN_1) | BIT_MASK(BTN_2) | BIT_MASK(BTN_3);
168 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); 173 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0);
169} 174}
170 175
171void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 176void input_dev_i3(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
172{ 177{
173 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); 178 input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_4) |
179 BIT_MASK(BTN_5) | BIT_MASK(BTN_6) | BIT_MASK(BTN_7);
174 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); 180 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0);
175} 181}
176 182
177void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 183void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
178{ 184{
179 input_dev->evbit[0] |= BIT(EV_MSC) | BIT(EV_REL); 185 input_dev->evbit[0] |= BIT_MASK(EV_MSC) | BIT_MASK(EV_REL);
180 input_dev->mscbit[0] |= BIT(MSC_SERIAL); 186 input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL);
181 input_dev->relbit[0] |= BIT(REL_WHEEL); 187 input_dev->relbit[0] |= BIT_MASK(REL_WHEEL);
182 input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA); 188 input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) |
183 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH) 189 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE) |
184 | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2); 190 BIT_MASK(BTN_SIDE) | BIT_MASK(BTN_EXTRA);
191 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER) |
192 BIT_MASK(BTN_TOOL_MOUSE) | BIT_MASK(BTN_TOOL_BRUSH) |
193 BIT_MASK(BTN_TOOL_PENCIL) | BIT_MASK(BTN_TOOL_AIRBRUSH) |
194 BIT_MASK(BTN_TOOL_LENS) | BIT_MASK(BTN_STYLUS2);
185 input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0); 195 input_set_abs_params(input_dev, ABS_DISTANCE, 0, wacom_wac->features->distance_max, 0, 0);
186 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); 196 input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
187 input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); 197 input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0);
@@ -192,12 +202,13 @@ void input_dev_i(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
192 202
193void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 203void input_dev_pl(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
194{ 204{
195 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); 205 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_STYLUS2) |
206 BIT_MASK(BTN_TOOL_RUBBER);
196} 207}
197 208
198void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac) 209void input_dev_pt(struct input_dev *input_dev, struct wacom_wac *wacom_wac)
199{ 210{
200 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER); 211 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_RUBBER);
201} 212}
202 213
203static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) 214static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
@@ -243,12 +254,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
243 input_dev->open = wacom_open; 254 input_dev->open = wacom_open;
244 input_dev->close = wacom_close; 255 input_dev->close = wacom_close;
245 256
246 input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS); 257 input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
247 input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS); 258 input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_PEN) |
259 BIT_MASK(BTN_TOUCH) | BIT_MASK(BTN_STYLUS);
248 input_set_abs_params(input_dev, ABS_X, 0, wacom_wac->features->x_max, 4, 0); 260 input_set_abs_params(input_dev, ABS_X, 0, wacom_wac->features->x_max, 4, 0);
249 input_set_abs_params(input_dev, ABS_Y, 0, wacom_wac->features->y_max, 4, 0); 261 input_set_abs_params(input_dev, ABS_Y, 0, wacom_wac->features->y_max, 4, 0);
250 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom_wac->features->pressure_max, 0, 0); 262 input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom_wac->features->pressure_max, 0, 0);
251 input_dev->absbit[LONG(ABS_MISC)] |= BIT(ABS_MISC); 263 input_dev->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC);
252 264
253 wacom_init_input_dev(input_dev, wacom_wac); 265 wacom_init_input_dev(input_dev, wacom_wac);
254 266
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 51ae4fb7d123..f59aecf5ec15 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -917,8 +917,8 @@ static int __devinit ads7846_probe(struct spi_device *spi)
917 input_dev->phys = ts->phys; 917 input_dev->phys = ts->phys;
918 input_dev->dev.parent = &spi->dev; 918 input_dev->dev.parent = &spi->dev;
919 919
920 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 920 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
921 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 921 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
922 input_set_abs_params(input_dev, ABS_X, 922 input_set_abs_params(input_dev, ABS_X,
923 pdata->x_min ? : 0, 923 pdata->x_min ? : 0,
924 pdata->x_max ? : MAX_12BIT, 924 pdata->x_max ? : MAX_12BIT,
diff --git a/drivers/input/touchscreen/corgi_ts.c b/drivers/input/touchscreen/corgi_ts.c
index e6a31d118786..b1b2e07bf080 100644
--- a/drivers/input/touchscreen/corgi_ts.c
+++ b/drivers/input/touchscreen/corgi_ts.c
@@ -302,8 +302,8 @@ static int __init corgits_probe(struct platform_device *pdev)
302 input_dev->id.version = 0x0100; 302 input_dev->id.version = 0x0100;
303 input_dev->dev.parent = &pdev->dev; 303 input_dev->dev.parent = &pdev->dev;
304 304
305 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 305 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
306 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 306 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
307 input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0); 307 input_set_abs_params(input_dev, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0);
308 input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0); 308 input_set_abs_params(input_dev, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0);
309 input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); 309 input_set_abs_params(input_dev, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0);
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
index 557d781719f1..d20689cdbd5d 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -320,8 +320,8 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
320 input_dev->id.version = 0x0100; 320 input_dev->id.version = 0x0100;
321 input_dev->dev.parent = &serio->dev; 321 input_dev->dev.parent = &serio->dev;
322 322
323 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 323 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
324 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 324 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
325 325
326 serio_set_drvdata(serio, elo); 326 serio_set_drvdata(serio, elo);
327 err = serio_open(serio, drv); 327 err = serio_open(serio, drv);
diff --git a/drivers/input/touchscreen/fujitsu_ts.c b/drivers/input/touchscreen/fujitsu_ts.c
index daf7a4afc935..80b21800355f 100644
--- a/drivers/input/touchscreen/fujitsu_ts.c
+++ b/drivers/input/touchscreen/fujitsu_ts.c
@@ -122,8 +122,8 @@ static int fujitsu_connect(struct serio *serio, struct serio_driver *drv)
122 input_dev->id.vendor = SERIO_FUJITSU; 122 input_dev->id.vendor = SERIO_FUJITSU;
123 input_dev->id.product = 0; 123 input_dev->id.product = 0;
124 input_dev->id.version = 0x0100; 124 input_dev->id.version = 0x0100;
125 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 125 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
126 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 126 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
127 127
128 input_set_abs_params(input_dev, ABS_X, 0, 4096, 0, 0); 128 input_set_abs_params(input_dev, ABS_X, 0, 4096, 0, 0);
129 input_set_abs_params(input_dev, ABS_Y, 0, 4096, 0, 0); 129 input_set_abs_params(input_dev, ABS_Y, 0, 4096, 0, 0);
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index 39d602600d7c..a48a15868c4a 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -137,8 +137,8 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
137 input_dev->id.product = 0x0051; 137 input_dev->id.product = 0x0051;
138 input_dev->id.version = 0x0100; 138 input_dev->id.version = 0x0100;
139 input_dev->dev.parent = &serio->dev; 139 input_dev->dev.parent = &serio->dev;
140 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 140 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
141 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 141 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
142 input_set_abs_params(input_dev, ABS_X, 24, 1000, 0, 0); 142 input_set_abs_params(input_dev, ABS_X, 24, 1000, 0, 0);
143 input_set_abs_params(input_dev, ABS_Y, 24, 1000, 0, 0); 143 input_set_abs_params(input_dev, ABS_Y, 24, 1000, 0, 0);
144 144
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
index 09ed7803cb8f..2ae6c6016a86 100644
--- a/drivers/input/touchscreen/h3600_ts_input.c
+++ b/drivers/input/touchscreen/h3600_ts_input.c
@@ -373,8 +373,9 @@ static int h3600ts_connect(struct serio *serio, struct serio_driver *drv)
373 373
374 input_dev->event = h3600ts_event; 374 input_dev->event = h3600ts_event;
375 375
376 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_LED) | BIT(EV_PWR); 376 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) |
377 input_dev->ledbit[0] = BIT(LED_SLEEP); 377 BIT_MASK(EV_LED) | BIT_MASK(EV_PWR);
378 input_dev->ledbit[0] = BIT_MASK(LED_SLEEP);
378 input_set_abs_params(input_dev, ABS_X, 60, 985, 0, 0); 379 input_set_abs_params(input_dev, ABS_X, 60, 985, 0, 0);
379 input_set_abs_params(input_dev, ABS_Y, 35, 1024, 0, 0); 380 input_set_abs_params(input_dev, ABS_Y, 35, 1024, 0, 0);
380 381
diff --git a/drivers/input/touchscreen/hp680_ts_input.c b/drivers/input/touchscreen/hp680_ts_input.c
index 1a15475aedfc..c38d4e0f95c6 100644
--- a/drivers/input/touchscreen/hp680_ts_input.c
+++ b/drivers/input/touchscreen/hp680_ts_input.c
@@ -81,8 +81,8 @@ static int __init hp680_ts_init(void)
81 if (!hp680_ts_dev) 81 if (!hp680_ts_dev)
82 return -ENOMEM; 82 return -ENOMEM;
83 83
84 hp680_ts_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); 84 hp680_ts_dev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY);
85 hp680_ts_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 85 hp680_ts_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
86 86
87 input_set_abs_params(hp680_ts_dev, ABS_X, 87 input_set_abs_params(hp680_ts_dev, ABS_X,
88 HP680_TS_ABS_X_MIN, HP680_TS_ABS_X_MAX, 0, 0); 88 HP680_TS_ABS_X_MIN, HP680_TS_ABS_X_MAX, 0, 0);
diff --git a/drivers/input/touchscreen/mk712.c b/drivers/input/touchscreen/mk712.c
index 44140feeffc5..80a658868706 100644
--- a/drivers/input/touchscreen/mk712.c
+++ b/drivers/input/touchscreen/mk712.c
@@ -186,8 +186,8 @@ static int __init mk712_init(void)
186 mk712_dev->open = mk712_open; 186 mk712_dev->open = mk712_open;
187 mk712_dev->close = mk712_close; 187 mk712_dev->close = mk712_close;
188 188
189 mk712_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 189 mk712_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
190 mk712_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 190 mk712_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
191 input_set_abs_params(mk712_dev, ABS_X, 0, 0xfff, 88, 0); 191 input_set_abs_params(mk712_dev, ABS_X, 0, 0xfff, 88, 0);
192 input_set_abs_params(mk712_dev, ABS_Y, 0, 0xfff, 88, 0); 192 input_set_abs_params(mk712_dev, ABS_Y, 0, 0xfff, 88, 0);
193 193
diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
index 4ec3b1f940c8..9077228418b7 100644
--- a/drivers/input/touchscreen/mtouch.c
+++ b/drivers/input/touchscreen/mtouch.c
@@ -151,8 +151,8 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv)
151 input_dev->id.product = 0; 151 input_dev->id.product = 0;
152 input_dev->id.version = 0x0100; 152 input_dev->id.version = 0x0100;
153 input_dev->dev.parent = &serio->dev; 153 input_dev->dev.parent = &serio->dev;
154 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 154 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
155 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 155 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
156 input_set_abs_params(mtouch->dev, ABS_X, MTOUCH_MIN_XC, MTOUCH_MAX_XC, 0, 0); 156 input_set_abs_params(mtouch->dev, ABS_X, MTOUCH_MIN_XC, MTOUCH_MAX_XC, 0, 0);
157 input_set_abs_params(mtouch->dev, ABS_Y, MTOUCH_MIN_YC, MTOUCH_MAX_YC, 0, 0); 157 input_set_abs_params(mtouch->dev, ABS_Y, MTOUCH_MIN_YC, MTOUCH_MAX_YC, 0, 0);
158 158
diff --git a/drivers/input/touchscreen/penmount.c b/drivers/input/touchscreen/penmount.c
index f2c0d3c7149c..c7f9cebebbb6 100644
--- a/drivers/input/touchscreen/penmount.c
+++ b/drivers/input/touchscreen/penmount.c
@@ -113,8 +113,8 @@ static int pm_connect(struct serio *serio, struct serio_driver *drv)
113 input_dev->id.version = 0x0100; 113 input_dev->id.version = 0x0100;
114 input_dev->dev.parent = &serio->dev; 114 input_dev->dev.parent = &serio->dev;
115 115
116 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 116 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
117 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 117 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
118 input_set_abs_params(pm->dev, ABS_X, 0, 0x3ff, 0, 0); 118 input_set_abs_params(pm->dev, ABS_X, 0, 0x3ff, 0, 0);
119 input_set_abs_params(pm->dev, ABS_Y, 0, 0x3ff, 0, 0); 119 input_set_abs_params(pm->dev, ABS_Y, 0, 0x3ff, 0, 0);
120 120
diff --git a/drivers/input/touchscreen/touchright.c b/drivers/input/touchscreen/touchright.c
index 3def7bb1df44..3a5c142c2a78 100644
--- a/drivers/input/touchscreen/touchright.c
+++ b/drivers/input/touchscreen/touchright.c
@@ -125,8 +125,8 @@ static int tr_connect(struct serio *serio, struct serio_driver *drv)
125 input_dev->id.product = 0; 125 input_dev->id.product = 0;
126 input_dev->id.version = 0x0100; 126 input_dev->id.version = 0x0100;
127 input_dev->dev.parent = &serio->dev; 127 input_dev->dev.parent = &serio->dev;
128 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 128 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
129 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 129 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
130 input_set_abs_params(tr->dev, ABS_X, TR_MIN_XC, TR_MAX_XC, 0, 0); 130 input_set_abs_params(tr->dev, ABS_X, TR_MIN_XC, TR_MAX_XC, 0, 0);
131 input_set_abs_params(tr->dev, ABS_Y, TR_MIN_YC, TR_MAX_YC, 0, 0); 131 input_set_abs_params(tr->dev, ABS_Y, TR_MIN_YC, TR_MAX_YC, 0, 0);
132 132
diff --git a/drivers/input/touchscreen/touchwin.c b/drivers/input/touchscreen/touchwin.c
index ac4bdcf18666..763a656a59f8 100644
--- a/drivers/input/touchscreen/touchwin.c
+++ b/drivers/input/touchscreen/touchwin.c
@@ -132,8 +132,8 @@ static int tw_connect(struct serio *serio, struct serio_driver *drv)
132 input_dev->id.product = 0; 132 input_dev->id.product = 0;
133 input_dev->id.version = 0x0100; 133 input_dev->id.version = 0x0100;
134 input_dev->dev.parent = &serio->dev; 134 input_dev->dev.parent = &serio->dev;
135 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 135 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
136 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 136 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
137 input_set_abs_params(tw->dev, ABS_X, TW_MIN_XC, TW_MAX_XC, 0, 0); 137 input_set_abs_params(tw->dev, ABS_X, TW_MIN_XC, TW_MAX_XC, 0, 0);
138 input_set_abs_params(tw->dev, ABS_Y, TW_MIN_YC, TW_MAX_YC, 0, 0); 138 input_set_abs_params(tw->dev, ABS_Y, TW_MIN_YC, TW_MAX_YC, 0, 0);
139 139
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c
index 86aed64ec0fb..7549939b9535 100644
--- a/drivers/input/touchscreen/ucb1400_ts.c
+++ b/drivers/input/touchscreen/ucb1400_ts.c
@@ -333,10 +333,9 @@ static int ucb1400_ts_thread(void *_ucb)
333 timeout = msecs_to_jiffies(10); 333 timeout = msecs_to_jiffies(10);
334 } 334 }
335 335
336 wait_event_interruptible_timeout(ucb->ts_wait, 336 wait_event_freezable_timeout(ucb->ts_wait,
337 ucb->irq_pending || ucb->ts_restart || kthread_should_stop(), 337 ucb->irq_pending || ucb->ts_restart || kthread_should_stop(),
338 timeout); 338 timeout);
339 try_to_freeze();
340 } 339 }
341 340
342 /* Send the "pen off" if we are stopping with the pen still active */ 341 /* Send the "pen off" if we are stopping with the pen still active */
@@ -518,7 +517,7 @@ static int ucb1400_ts_probe(struct device *dev)
518 idev->id.product = id; 517 idev->id.product = id;
519 idev->open = ucb1400_ts_open; 518 idev->open = ucb1400_ts_open;
520 idev->close = ucb1400_ts_close; 519 idev->close = ucb1400_ts_close;
521 idev->evbit[0] = BIT(EV_ABS); 520 idev->evbit[0] = BIT_MASK(EV_ABS);
522 521
523 ucb1400_adc_enable(ucb); 522 ucb1400_adc_enable(ucb);
524 x_res = ucb1400_ts_read_xres(ucb); 523 x_res = ucb1400_ts_read_xres(ucb);
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 9fb3d5c30999..5f34b78d5ddb 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -868,8 +868,8 @@ static int usbtouch_probe(struct usb_interface *intf,
868 input_dev->open = usbtouch_open; 868 input_dev->open = usbtouch_open;
869 input_dev->close = usbtouch_close; 869 input_dev->close = usbtouch_close;
870 870
871 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 871 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
872 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 872 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
873 input_set_abs_params(input_dev, ABS_X, type->min_xc, type->max_xc, 0, 0); 873 input_set_abs_params(input_dev, ABS_X, type->min_xc, type->max_xc, 0, 0);
874 input_set_abs_params(input_dev, ABS_Y, type->min_yc, type->max_yc, 0, 0); 874 input_set_abs_params(input_dev, ABS_Y, type->min_yc, type->max_yc, 0, 0);
875 if (type->max_press) 875 if (type->max_press)
diff --git a/drivers/isdn/act2000/act2000_isa.c b/drivers/isdn/act2000/act2000_isa.c
index 09ea50dd3459..819ea85576a3 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -126,7 +126,7 @@ act2000_isa_enable_irq(act2000_card * card)
126 126
127/* 127/*
128 * Install interrupt handler, enable irq on card. 128 * Install interrupt handler, enable irq on card.
129 * If irq is -1, choose next free irq, else irq is given explicitely. 129 * If irq is -1, choose next free irq, else irq is given explicitly.
130 */ 130 */
131int 131int
132act2000_isa_config_irq(act2000_card * card, short irq) 132act2000_isa_config_irq(act2000_card * card, short irq)
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c
index 6df336bdd571..acd417197d03 100644
--- a/drivers/isdn/gigaset/common.c
+++ b/drivers/isdn/gigaset/common.c
@@ -534,7 +534,8 @@ int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
534 n = RBUFSIZE - tail; 534 n = RBUFSIZE - tail;
535 if (!n) { 535 if (!n) {
536 dev_err(inbuf->cs->dev, 536 dev_err(inbuf->cs->dev,
537 "buffer overflow (%u bytes lost)", bytesleft); 537 "buffer overflow (%u bytes lost)\n",
538 bytesleft);
538 break; 539 break;
539 } 540 }
540 if (n > bytesleft) 541 if (n > bytesleft)
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
index 7a69a18d07e2..4484a6417235 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -321,12 +321,15 @@ void b1_reset_ctr(struct capi_ctr *ctrl)
321 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); 321 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
322 avmcard *card = cinfo->card; 322 avmcard *card = cinfo->card;
323 unsigned int port = card->port; 323 unsigned int port = card->port;
324 unsigned long flags;
324 325
325 b1_reset(port); 326 b1_reset(port);
326 b1_reset(port); 327 b1_reset(port);
327 328
328 memset(cinfo->version, 0, sizeof(cinfo->version)); 329 memset(cinfo->version, 0, sizeof(cinfo->version));
330 spin_lock_irqsave(&card->lock, flags);
329 capilib_release(&cinfo->ncci_head); 331 capilib_release(&cinfo->ncci_head);
332 spin_unlock_irqrestore(&card->lock, flags);
330 capi_ctr_reseted(ctrl); 333 capi_ctr_reseted(ctrl);
331} 334}
332 335
@@ -361,9 +364,8 @@ void b1_release_appl(struct capi_ctr *ctrl, u16 appl)
361 unsigned int port = card->port; 364 unsigned int port = card->port;
362 unsigned long flags; 365 unsigned long flags;
363 366
364 capilib_release_appl(&cinfo->ncci_head, appl);
365
366 spin_lock_irqsave(&card->lock, flags); 367 spin_lock_irqsave(&card->lock, flags);
368 capilib_release_appl(&cinfo->ncci_head, appl);
367 b1_put_byte(port, SEND_RELEASE); 369 b1_put_byte(port, SEND_RELEASE);
368 b1_put_word(port, appl); 370 b1_put_word(port, appl);
369 spin_unlock_irqrestore(&card->lock, flags); 371 spin_unlock_irqrestore(&card->lock, flags);
@@ -380,27 +382,27 @@ u16 b1_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
380 u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data); 382 u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
381 u16 dlen, retval; 383 u16 dlen, retval;
382 384
385 spin_lock_irqsave(&card->lock, flags);
383 if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) { 386 if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) {
384 retval = capilib_data_b3_req(&cinfo->ncci_head, 387 retval = capilib_data_b3_req(&cinfo->ncci_head,
385 CAPIMSG_APPID(skb->data), 388 CAPIMSG_APPID(skb->data),
386 CAPIMSG_NCCI(skb->data), 389 CAPIMSG_NCCI(skb->data),
387 CAPIMSG_MSGID(skb->data)); 390 CAPIMSG_MSGID(skb->data));
388 if (retval != CAPI_NOERROR) 391 if (retval != CAPI_NOERROR) {
392 spin_unlock_irqrestore(&card->lock, flags);
389 return retval; 393 return retval;
394 }
390 395
391 dlen = CAPIMSG_DATALEN(skb->data); 396 dlen = CAPIMSG_DATALEN(skb->data);
392 397
393 spin_lock_irqsave(&card->lock, flags);
394 b1_put_byte(port, SEND_DATA_B3_REQ); 398 b1_put_byte(port, SEND_DATA_B3_REQ);
395 b1_put_slice(port, skb->data, len); 399 b1_put_slice(port, skb->data, len);
396 b1_put_slice(port, skb->data + len, dlen); 400 b1_put_slice(port, skb->data + len, dlen);
397 spin_unlock_irqrestore(&card->lock, flags);
398 } else { 401 } else {
399 spin_lock_irqsave(&card->lock, flags);
400 b1_put_byte(port, SEND_MESSAGE); 402 b1_put_byte(port, SEND_MESSAGE);
401 b1_put_slice(port, skb->data, len); 403 b1_put_slice(port, skb->data, len);
402 spin_unlock_irqrestore(&card->lock, flags);
403 } 404 }
405 spin_unlock_irqrestore(&card->lock, flags);
404 406
405 dev_kfree_skb_any(skb); 407 dev_kfree_skb_any(skb);
406 return CAPI_NOERROR; 408 return CAPI_NOERROR;
@@ -534,17 +536,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
534 536
535 ApplId = (unsigned) b1_get_word(card->port); 537 ApplId = (unsigned) b1_get_word(card->port);
536 MsgLen = b1_get_slice(card->port, card->msgbuf); 538 MsgLen = b1_get_slice(card->port, card->msgbuf);
537 spin_unlock_irqrestore(&card->lock, flags);
538 if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { 539 if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
539 printk(KERN_ERR "%s: incoming packet dropped\n", 540 printk(KERN_ERR "%s: incoming packet dropped\n",
540 card->name); 541 card->name);
542 spin_unlock_irqrestore(&card->lock, flags);
541 } else { 543 } else {
542 memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); 544 memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
543 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) 545 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF)
544 capilib_data_b3_conf(&cinfo->ncci_head, ApplId, 546 capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
545 CAPIMSG_NCCI(skb->data), 547 CAPIMSG_NCCI(skb->data),
546 CAPIMSG_MSGID(skb->data)); 548 CAPIMSG_MSGID(skb->data));
547 549 spin_unlock_irqrestore(&card->lock, flags);
548 capi_ctr_handle_message(ctrl, ApplId, skb); 550 capi_ctr_handle_message(ctrl, ApplId, skb);
549 } 551 }
550 break; 552 break;
@@ -554,21 +556,17 @@ irqreturn_t b1_interrupt(int interrupt, void *devptr)
554 ApplId = b1_get_word(card->port); 556 ApplId = b1_get_word(card->port);
555 NCCI = b1_get_word(card->port); 557 NCCI = b1_get_word(card->port);
556 WindowSize = b1_get_word(card->port); 558 WindowSize = b1_get_word(card->port);
557 spin_unlock_irqrestore(&card->lock, flags);
558
559 capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); 559 capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
560 560 spin_unlock_irqrestore(&card->lock, flags);
561 break; 561 break;
562 562
563 case RECEIVE_FREE_NCCI: 563 case RECEIVE_FREE_NCCI:
564 564
565 ApplId = b1_get_word(card->port); 565 ApplId = b1_get_word(card->port);
566 NCCI = b1_get_word(card->port); 566 NCCI = b1_get_word(card->port);
567 spin_unlock_irqrestore(&card->lock, flags);
568
569 if (NCCI != 0xffffffff) 567 if (NCCI != 0xffffffff)
570 capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); 568 capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
571 569 spin_unlock_irqrestore(&card->lock, flags);
572 break; 570 break;
573 571
574 case RECEIVE_START: 572 case RECEIVE_START:
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c
index 428872b653e9..669f6f67449c 100644
--- a/drivers/isdn/hardware/avm/b1dma.c
+++ b/drivers/isdn/hardware/avm/b1dma.c
@@ -486,11 +486,13 @@ static void b1dma_handle_rx(avmcard *card)
486 card->name); 486 card->name);
487 } else { 487 } else {
488 memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen); 488 memcpy(skb_put(skb, MsgLen), card->msgbuf, MsgLen);
489 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) 489 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_CONF) {
490 spin_lock(&card->lock);
490 capilib_data_b3_conf(&cinfo->ncci_head, ApplId, 491 capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
491 CAPIMSG_NCCI(skb->data), 492 CAPIMSG_NCCI(skb->data),
492 CAPIMSG_MSGID(skb->data)); 493 CAPIMSG_MSGID(skb->data));
493 494 spin_unlock(&card->lock);
495 }
494 capi_ctr_handle_message(ctrl, ApplId, skb); 496 capi_ctr_handle_message(ctrl, ApplId, skb);
495 } 497 }
496 break; 498 break;
@@ -500,9 +502,9 @@ static void b1dma_handle_rx(avmcard *card)
500 ApplId = _get_word(&p); 502 ApplId = _get_word(&p);
501 NCCI = _get_word(&p); 503 NCCI = _get_word(&p);
502 WindowSize = _get_word(&p); 504 WindowSize = _get_word(&p);
503 505 spin_lock(&card->lock);
504 capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); 506 capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
505 507 spin_unlock(&card->lock);
506 break; 508 break;
507 509
508 case RECEIVE_FREE_NCCI: 510 case RECEIVE_FREE_NCCI:
@@ -510,9 +512,11 @@ static void b1dma_handle_rx(avmcard *card)
510 ApplId = _get_word(&p); 512 ApplId = _get_word(&p);
511 NCCI = _get_word(&p); 513 NCCI = _get_word(&p);
512 514
513 if (NCCI != 0xffffffff) 515 if (NCCI != 0xffffffff) {
516 spin_lock(&card->lock);
514 capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); 517 capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
515 518 spin_unlock(&card->lock);
519 }
516 break; 520 break;
517 521
518 case RECEIVE_START: 522 case RECEIVE_START:
@@ -751,10 +755,10 @@ void b1dma_reset_ctr(struct capi_ctr *ctrl)
751 755
752 spin_lock_irqsave(&card->lock, flags); 756 spin_lock_irqsave(&card->lock, flags);
753 b1dma_reset(card); 757 b1dma_reset(card);
754 spin_unlock_irqrestore(&card->lock, flags);
755 758
756 memset(cinfo->version, 0, sizeof(cinfo->version)); 759 memset(cinfo->version, 0, sizeof(cinfo->version));
757 capilib_release(&cinfo->ncci_head); 760 capilib_release(&cinfo->ncci_head);
761 spin_unlock_irqrestore(&card->lock, flags);
758 capi_ctr_reseted(ctrl); 762 capi_ctr_reseted(ctrl);
759} 763}
760 764
@@ -803,8 +807,11 @@ void b1dma_release_appl(struct capi_ctr *ctrl, u16 appl)
803 avmcard *card = cinfo->card; 807 avmcard *card = cinfo->card;
804 struct sk_buff *skb; 808 struct sk_buff *skb;
805 void *p; 809 void *p;
810 unsigned long flags;
806 811
812 spin_lock_irqsave(&card->lock, flags);
807 capilib_release_appl(&cinfo->ncci_head, appl); 813 capilib_release_appl(&cinfo->ncci_head, appl);
814 spin_unlock_irqrestore(&card->lock, flags);
808 815
809 skb = alloc_skb(7, GFP_ATOMIC); 816 skb = alloc_skb(7, GFP_ATOMIC);
810 if (!skb) { 817 if (!skb) {
@@ -832,10 +839,13 @@ u16 b1dma_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
832 u16 retval = CAPI_NOERROR; 839 u16 retval = CAPI_NOERROR;
833 840
834 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { 841 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
842 unsigned long flags;
843 spin_lock_irqsave(&card->lock, flags);
835 retval = capilib_data_b3_req(&cinfo->ncci_head, 844 retval = capilib_data_b3_req(&cinfo->ncci_head,
836 CAPIMSG_APPID(skb->data), 845 CAPIMSG_APPID(skb->data),
837 CAPIMSG_NCCI(skb->data), 846 CAPIMSG_NCCI(skb->data),
838 CAPIMSG_MSGID(skb->data)); 847 CAPIMSG_MSGID(skb->data));
848 spin_unlock_irqrestore(&card->lock, flags);
839 } 849 }
840 if (retval == CAPI_NOERROR) 850 if (retval == CAPI_NOERROR)
841 b1dma_queue_tx(card, skb); 851 b1dma_queue_tx(card, skb);
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c
index d58f927e766a..4bbbbe688077 100644
--- a/drivers/isdn/hardware/avm/c4.c
+++ b/drivers/isdn/hardware/avm/c4.c
@@ -678,7 +678,9 @@ static irqreturn_t c4_handle_interrupt(avmcard *card)
678 for (i=0; i < card->nr_controllers; i++) { 678 for (i=0; i < card->nr_controllers; i++) {
679 avmctrl_info *cinfo = &card->ctrlinfo[i]; 679 avmctrl_info *cinfo = &card->ctrlinfo[i];
680 memset(cinfo->version, 0, sizeof(cinfo->version)); 680 memset(cinfo->version, 0, sizeof(cinfo->version));
681 spin_lock_irqsave(&card->lock, flags);
681 capilib_release(&cinfo->ncci_head); 682 capilib_release(&cinfo->ncci_head);
683 spin_unlock_irqrestore(&card->lock, flags);
682 capi_ctr_reseted(&cinfo->capi_ctrl); 684 capi_ctr_reseted(&cinfo->capi_ctrl);
683 } 685 }
684 card->nlogcontr = 0; 686 card->nlogcontr = 0;
@@ -727,6 +729,7 @@ static void c4_send_init(avmcard *card)
727{ 729{
728 struct sk_buff *skb; 730 struct sk_buff *skb;
729 void *p; 731 void *p;
732 unsigned long flags;
730 733
731 skb = alloc_skb(15, GFP_ATOMIC); 734 skb = alloc_skb(15, GFP_ATOMIC);
732 if (!skb) { 735 if (!skb) {
@@ -744,12 +747,15 @@ static void c4_send_init(avmcard *card)
744 skb_put(skb, (u8 *)p - (u8 *)skb->data); 747 skb_put(skb, (u8 *)p - (u8 *)skb->data);
745 748
746 skb_queue_tail(&card->dma->send_queue, skb); 749 skb_queue_tail(&card->dma->send_queue, skb);
750 spin_lock_irqsave(&card->lock, flags);
747 c4_dispatch_tx(card); 751 c4_dispatch_tx(card);
752 spin_unlock_irqrestore(&card->lock, flags);
748} 753}
749 754
750static int queue_sendconfigword(avmcard *card, u32 val) 755static int queue_sendconfigword(avmcard *card, u32 val)
751{ 756{
752 struct sk_buff *skb; 757 struct sk_buff *skb;
758 unsigned long flags;
753 void *p; 759 void *p;
754 760
755 skb = alloc_skb(3+4, GFP_ATOMIC); 761 skb = alloc_skb(3+4, GFP_ATOMIC);
@@ -766,7 +772,9 @@ static int queue_sendconfigword(avmcard *card, u32 val)
766 skb_put(skb, (u8 *)p - (u8 *)skb->data); 772 skb_put(skb, (u8 *)p - (u8 *)skb->data);
767 773
768 skb_queue_tail(&card->dma->send_queue, skb); 774 skb_queue_tail(&card->dma->send_queue, skb);
775 spin_lock_irqsave(&card->lock, flags);
769 c4_dispatch_tx(card); 776 c4_dispatch_tx(card);
777 spin_unlock_irqrestore(&card->lock, flags);
770 return 0; 778 return 0;
771} 779}
772 780
@@ -986,7 +994,9 @@ static void c4_release_appl(struct capi_ctr *ctrl, u16 appl)
986 struct sk_buff *skb; 994 struct sk_buff *skb;
987 void *p; 995 void *p;
988 996
997 spin_lock_irqsave(&card->lock, flags);
989 capilib_release_appl(&cinfo->ncci_head, appl); 998 capilib_release_appl(&cinfo->ncci_head, appl);
999 spin_unlock_irqrestore(&card->lock, flags);
990 1000
991 if (ctrl->cnr == card->cardnr) { 1001 if (ctrl->cnr == card->cardnr) {
992 skb = alloc_skb(7, GFP_ATOMIC); 1002 skb = alloc_skb(7, GFP_ATOMIC);
@@ -1019,7 +1029,8 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
1019 u16 retval = CAPI_NOERROR; 1029 u16 retval = CAPI_NOERROR;
1020 unsigned long flags; 1030 unsigned long flags;
1021 1031
1022 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) { 1032 spin_lock_irqsave(&card->lock, flags);
1033 if (CAPIMSG_CMD(skb->data) == CAPI_DATA_B3_REQ) {
1023 retval = capilib_data_b3_req(&cinfo->ncci_head, 1034 retval = capilib_data_b3_req(&cinfo->ncci_head,
1024 CAPIMSG_APPID(skb->data), 1035 CAPIMSG_APPID(skb->data),
1025 CAPIMSG_NCCI(skb->data), 1036 CAPIMSG_NCCI(skb->data),
@@ -1027,10 +1038,9 @@ static u16 c4_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
1027 } 1038 }
1028 if (retval == CAPI_NOERROR) { 1039 if (retval == CAPI_NOERROR) {
1029 skb_queue_tail(&card->dma->send_queue, skb); 1040 skb_queue_tail(&card->dma->send_queue, skb);
1030 spin_lock_irqsave(&card->lock, flags);
1031 c4_dispatch_tx(card); 1041 c4_dispatch_tx(card);
1032 spin_unlock_irqrestore(&card->lock, flags);
1033 } 1042 }
1043 spin_unlock_irqrestore(&card->lock, flags);
1034 return retval; 1044 return retval;
1035} 1045}
1036 1046
diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c
index c925020fe9b7..6130724e46e7 100644
--- a/drivers/isdn/hardware/avm/t1isa.c
+++ b/drivers/isdn/hardware/avm/t1isa.c
@@ -180,8 +180,8 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
180 180
181 ApplId = (unsigned) b1_get_word(card->port); 181 ApplId = (unsigned) b1_get_word(card->port);
182 MsgLen = t1_get_slice(card->port, card->msgbuf); 182 MsgLen = t1_get_slice(card->port, card->msgbuf);
183 spin_unlock_irqrestore(&card->lock, flags);
184 if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) { 183 if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
184 spin_unlock_irqrestore(&card->lock, flags);
185 printk(KERN_ERR "%s: incoming packet dropped\n", 185 printk(KERN_ERR "%s: incoming packet dropped\n",
186 card->name); 186 card->name);
187 } else { 187 } else {
@@ -190,7 +190,7 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
190 capilib_data_b3_conf(&cinfo->ncci_head, ApplId, 190 capilib_data_b3_conf(&cinfo->ncci_head, ApplId,
191 CAPIMSG_NCCI(skb->data), 191 CAPIMSG_NCCI(skb->data),
192 CAPIMSG_MSGID(skb->data)); 192 CAPIMSG_MSGID(skb->data));
193 193 spin_unlock_irqrestore(&card->lock, flags);
194 capi_ctr_handle_message(ctrl, ApplId, skb); 194 capi_ctr_handle_message(ctrl, ApplId, skb);
195 } 195 }
196 break; 196 break;
@@ -200,21 +200,17 @@ static irqreturn_t t1isa_interrupt(int interrupt, void *devptr)
200 ApplId = b1_get_word(card->port); 200 ApplId = b1_get_word(card->port);
201 NCCI = b1_get_word(card->port); 201 NCCI = b1_get_word(card->port);
202 WindowSize = b1_get_word(card->port); 202 WindowSize = b1_get_word(card->port);
203 spin_unlock_irqrestore(&card->lock, flags);
204
205 capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize); 203 capilib_new_ncci(&cinfo->ncci_head, ApplId, NCCI, WindowSize);
206 204 spin_unlock_irqrestore(&card->lock, flags);
207 break; 205 break;
208 206
209 case RECEIVE_FREE_NCCI: 207 case RECEIVE_FREE_NCCI:
210 208
211 ApplId = b1_get_word(card->port); 209 ApplId = b1_get_word(card->port);
212 NCCI = b1_get_word(card->port); 210 NCCI = b1_get_word(card->port);
213 spin_unlock_irqrestore(&card->lock, flags);
214
215 if (NCCI != 0xffffffff) 211 if (NCCI != 0xffffffff)
216 capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI); 212 capilib_free_ncci(&cinfo->ncci_head, ApplId, NCCI);
217 213 spin_unlock_irqrestore(&card->lock, flags);
218 break; 214 break;
219 215
220 case RECEIVE_START: 216 case RECEIVE_START:
@@ -333,13 +329,16 @@ static void t1isa_reset_ctr(struct capi_ctr *ctrl)
333 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata); 329 avmctrl_info *cinfo = (avmctrl_info *)(ctrl->driverdata);
334 avmcard *card = cinfo->card; 330 avmcard *card = cinfo->card;
335 unsigned int port = card->port; 331 unsigned int port = card->port;
332 unsigned long flags;
336 333
337 t1_disable_irq(port); 334 t1_disable_irq(port);
338 b1_reset(port); 335 b1_reset(port);
339 b1_reset(port); 336 b1_reset(port);
340 337
341 memset(cinfo->version, 0, sizeof(cinfo->version)); 338 memset(cinfo->version, 0, sizeof(cinfo->version));
339 spin_lock_irqsave(&card->lock, flags);
342 capilib_release(&cinfo->ncci_head); 340 capilib_release(&cinfo->ncci_head);
341 spin_unlock_irqrestore(&card->lock, flags);
343 capi_ctr_reseted(ctrl); 342 capi_ctr_reseted(ctrl);
344} 343}
345 344
@@ -466,29 +465,26 @@ static u16 t1isa_send_message(struct capi_ctr *ctrl, struct sk_buff *skb)
466 u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data); 465 u8 subcmd = CAPIMSG_SUBCOMMAND(skb->data);
467 u16 dlen, retval; 466 u16 dlen, retval;
468 467
468 spin_lock_irqsave(&card->lock, flags);
469 if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) { 469 if (CAPICMD(cmd, subcmd) == CAPI_DATA_B3_REQ) {
470 retval = capilib_data_b3_req(&cinfo->ncci_head, 470 retval = capilib_data_b3_req(&cinfo->ncci_head,
471 CAPIMSG_APPID(skb->data), 471 CAPIMSG_APPID(skb->data),
472 CAPIMSG_NCCI(skb->data), 472 CAPIMSG_NCCI(skb->data),
473 CAPIMSG_MSGID(skb->data)); 473 CAPIMSG_MSGID(skb->data));
474 if (retval != CAPI_NOERROR) 474 if (retval != CAPI_NOERROR) {
475 spin_unlock_irqrestore(&card->lock, flags);
475 return retval; 476 return retval;
476 477 }
477 dlen = CAPIMSG_DATALEN(skb->data); 478 dlen = CAPIMSG_DATALEN(skb->data);
478 479
479 spin_lock_irqsave(&card->lock, flags);
480 b1_put_byte(port, SEND_DATA_B3_REQ); 480 b1_put_byte(port, SEND_DATA_B3_REQ);
481 t1_put_slice(port, skb->data, len); 481 t1_put_slice(port, skb->data, len);
482 t1_put_slice(port, skb->data + len, dlen); 482 t1_put_slice(port, skb->data + len, dlen);
483 spin_unlock_irqrestore(&card->lock, flags);
484 } else { 483 } else {
485
486 spin_lock_irqsave(&card->lock, flags);
487 b1_put_byte(port, SEND_MESSAGE); 484 b1_put_byte(port, SEND_MESSAGE);
488 t1_put_slice(port, skb->data, len); 485 t1_put_slice(port, skb->data, len);
489 spin_unlock_irqrestore(&card->lock, flags);
490 } 486 }
491 487 spin_unlock_irqrestore(&card->lock, flags);
492 dev_kfree_skb_any(skb); 488 dev_kfree_skb_any(skb);
493 return CAPI_NOERROR; 489 return CAPI_NOERROR;
494} 490}
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
index 82edc1c1db7a..4d425c644d41 100644
--- a/drivers/isdn/hardware/eicon/capifunc.c
+++ b/drivers/isdn/hardware/eicon/capifunc.c
@@ -321,7 +321,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
321 DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i, 321 DBG_BLK((((char *)(long)GET_DWORD(&msg.info.data_b3_ind.Data)) + i,
322 ((dlength - i) < 256) ? (dlength - i) : 256)) 322 ((dlength - i) < 256) ? (dlength - i) : 256))
323 if (!(myDriverDebugHandle.dbgMask & DL_PRV0)) 323 if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
324 break; /* not more if not explicitely requested */ 324 break; /* not more if not explicitly requested */
325 } 325 }
326 } 326 }
327 break; 327 break;
@@ -965,7 +965,7 @@ static u16 diva_send_message(struct capi_ctr *ctrl,
965 ((GET_WORD(&msg->info.data_b3_req.Data_Length) - j) < 965 ((GET_WORD(&msg->info.data_b3_req.Data_Length) - j) <
966 256) ? (GET_WORD(&msg->info.data_b3_req.Data_Length) - j) : 256)) 966 256) ? (GET_WORD(&msg->info.data_b3_req.Data_Length) - j) : 256))
967 if (!(myDriverDebugHandle.dbgMask & DL_PRV0)) 967 if (!(myDriverDebugHandle.dbgMask & DL_PRV0))
968 break; /* not more if not explicitely requested */ 968 break; /* not more if not explicitly requested */
969 } 969 }
970 } 970 }
971#endif 971#endif
diff --git a/drivers/isdn/hisax/amd7930_fn.c b/drivers/isdn/hisax/amd7930_fn.c
index 3b19caeba258..c0d7036404a5 100644
--- a/drivers/isdn/hisax/amd7930_fn.c
+++ b/drivers/isdn/hisax/amd7930_fn.c
@@ -767,7 +767,7 @@ Amd7930_init(struct IsdnCardState *cs)
767 /* read */ 767 /* read */
768 if (*ptr++ >= 0x100) { 768 if (*ptr++ >= 0x100) {
769 if (cmd < 8) 769 if (cmd < 8)
770 /* setzt Register zurück */ 770 /* reset register */
771 rByteAMD(cs, cmd); 771 rByteAMD(cs, cmd);
772 else { 772 else {
773 wByteAMD(cs, 0x00, cmd); 773 wByteAMD(cs, 0x00, cmd);
diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c
index b73027ff50e8..39f421ed8de8 100644
--- a/drivers/isdn/hisax/enternow_pci.c
+++ b/drivers/isdn/hisax/enternow_pci.c
@@ -75,16 +75,16 @@
75static const char *enternow_pci_rev = "$Revision: 1.1.4.5 $"; 75static const char *enternow_pci_rev = "$Revision: 1.1.4.5 $";
76 76
77 77
78/* für PowerISDN PCI */ 78/* for PowerISDN PCI */
79#define TJ_AMD_IRQ 0x20 79#define TJ_AMD_IRQ 0x20
80#define TJ_LED1 0x40 80#define TJ_LED1 0x40
81#define TJ_LED2 0x80 81#define TJ_LED2 0x80
82 82
83 83
84/* Das Fenster zum AMD... 84/* The window to [the] AMD [chip]...
85 * Ab Adresse hw.njet.base + TJ_AMD_PORT werden vom AMD jeweils 8 Bit in 85 * From address hw.njet.base + TJ_AMD_PORT onwards, the AMD
86 * den TigerJet i/o-Raum gemappt 86 * maps [consecutive/multiple] 8 bits into the TigerJet I/O space
87 * -> 0x01 des AMD bei hw.njet.base + 0C4 */ 87 * -> 0x01 of the AMD at hw.njet.base + 0C4 */
88#define TJ_AMD_PORT 0xC0 88#define TJ_AMD_PORT 0xC0
89 89
90 90
@@ -96,11 +96,11 @@ static const char *enternow_pci_rev = "$Revision: 1.1.4.5 $";
96static unsigned char 96static unsigned char
97ReadByteAmd7930(struct IsdnCardState *cs, unsigned char offset) 97ReadByteAmd7930(struct IsdnCardState *cs, unsigned char offset)
98{ 98{
99 /* direktes Register */ 99 /* direct register */
100 if(offset < 8) 100 if(offset < 8)
101 return (inb(cs->hw.njet.isac + 4*offset)); 101 return (inb(cs->hw.njet.isac + 4*offset));
102 102
103 /* indirektes Register */ 103 /* indirect register */
104 else { 104 else {
105 outb(offset, cs->hw.njet.isac + 4*AMD_CR); 105 outb(offset, cs->hw.njet.isac + 4*AMD_CR);
106 return(inb(cs->hw.njet.isac + 4*AMD_DR)); 106 return(inb(cs->hw.njet.isac + 4*AMD_DR));
@@ -111,11 +111,11 @@ ReadByteAmd7930(struct IsdnCardState *cs, unsigned char offset)
111static void 111static void
112WriteByteAmd7930(struct IsdnCardState *cs, unsigned char offset, unsigned char value) 112WriteByteAmd7930(struct IsdnCardState *cs, unsigned char offset, unsigned char value)
113{ 113{
114 /* direktes Register */ 114 /* direct register */
115 if(offset < 8) 115 if(offset < 8)
116 outb(value, cs->hw.njet.isac + 4*offset); 116 outb(value, cs->hw.njet.isac + 4*offset);
117 117
118 /* indirektes Register */ 118 /* indirect register */
119 else { 119 else {
120 outb(offset, cs->hw.njet.isac + 4*AMD_CR); 120 outb(offset, cs->hw.njet.isac + 4*AMD_CR);
121 outb(value, cs->hw.njet.isac + 4*AMD_DR); 121 outb(value, cs->hw.njet.isac + 4*AMD_DR);
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index 077080aca799..fba8b624ffcf 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -1,6 +1,6 @@
1/* $Id: hfc_pci.c,v 1.48.2.4 2004/02/11 13:21:33 keil Exp $ 1/* $Id: hfc_pci.c,v 1.48.2.4 2004/02/11 13:21:33 keil Exp $
2 * 2 *
3 * low level driver for CCD´s hfc-pci based cards 3 * low level driver for CCD's hfc-pci based cards
4 * 4 *
5 * Author Werner Cornelius 5 * Author Werner Cornelius
6 * based on existing driver for CCD hfc ISA cards 6 * based on existing driver for CCD hfc ISA cards
diff --git a/drivers/isdn/hisax/isdnhdlc.c b/drivers/isdn/hisax/isdnhdlc.c
index 268dced6c34a..c69a77a80062 100644
--- a/drivers/isdn/hisax/isdnhdlc.c
+++ b/drivers/isdn/hisax/isdnhdlc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * isdnhdlc.c -- General purpose ISDN HDLC decoder. 2 * isdnhdlc.c -- General purpose ISDN HDLC decoder.
3 * 3 *
4 *Copyright (C) 2002 Wolfgang Mües <wolfgang@iksw-muees.de> 4 *Copyright (C) 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
5 * 2001 Frode Isaksen <fisaksen@bewan.com> 5 * 2001 Frode Isaksen <fisaksen@bewan.com>
6 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de> 6 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
7 * 7 *
@@ -27,7 +27,7 @@
27 27
28/*-------------------------------------------------------------------*/ 28/*-------------------------------------------------------------------*/
29 29
30MODULE_AUTHOR("Wolfgang Mües <wolfgang@iksw-muees.de>, " 30MODULE_AUTHOR("Wolfgang Mües <wolfgang@iksw-muees.de>, "
31 "Frode Isaksen <fisaksen@bewan.com>, " 31 "Frode Isaksen <fisaksen@bewan.com>, "
32 "Kai Germaschewski <kai.germaschewski@gmx.de>"); 32 "Kai Germaschewski <kai.germaschewski@gmx.de>");
33MODULE_DESCRIPTION("General purpose ISDN HDLC decoder"); 33MODULE_DESCRIPTION("General purpose ISDN HDLC decoder");
diff --git a/drivers/isdn/hisax/isdnhdlc.h b/drivers/isdn/hisax/isdnhdlc.h
index 45167d2f8fb0..cf0a95a24015 100644
--- a/drivers/isdn/hisax/isdnhdlc.h
+++ b/drivers/isdn/hisax/isdnhdlc.h
@@ -5,7 +5,7 @@
5 * Neccessary because some ISDN devices don't have HDLC 5 * Neccessary because some ISDN devices don't have HDLC
6 * controllers. Also included: a bit reversal table. 6 * controllers. Also included: a bit reversal table.
7 * 7 *
8 *Copyright (C) 2002 Wolfgang Mües <wolfgang@iksw-muees.de> 8 *Copyright (C) 2002 Wolfgang Mües <wolfgang@iksw-muees.de>
9 * 2001 Frode Isaksen <fisaksen@bewan.com> 9 * 2001 Frode Isaksen <fisaksen@bewan.com>
10 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de> 10 * 2001 Kai Germaschewski <kai.germaschewski@gmx.de>
11 * 11 *
diff --git a/drivers/isdn/hisax/jade.c b/drivers/isdn/hisax/jade.c
index 43d61d1bc5b6..70840a710acf 100644
--- a/drivers/isdn/hisax/jade.c
+++ b/drivers/isdn/hisax/jade.c
@@ -304,7 +304,7 @@ initjade(struct IsdnCardState *cs)
304 cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0x00); 304 cs->BC_Write_Reg(cs, 1, jade_HDLC_IMR, 0x00);
305 /* Setup host access to hdlc controller */ 305 /* Setup host access to hdlc controller */
306 jade_write_indirect(cs, jade_HDLCCNTRACCESS, (jadeINDIRECT_HAH1|jadeINDIRECT_HAH2)); 306 jade_write_indirect(cs, jade_HDLCCNTRACCESS, (jadeINDIRECT_HAH1|jadeINDIRECT_HAH2));
307 /* Unmask HDLC int (don´t forget DSP int later on)*/ 307 /* Unmask HDLC int (don't forget DSP int later on)*/
308 cs->BC_Write_Reg(cs, -1,jade_INT, (jadeINT_HDLC1|jadeINT_HDLC2)); 308 cs->BC_Write_Reg(cs, -1,jade_INT, (jadeINT_HDLC1|jadeINT_HDLC2));
309 309
310 /* once again TRANSPARENT */ 310 /* once again TRANSPARENT */
diff --git a/drivers/isdn/pcbit/capi.c b/drivers/isdn/pcbit/capi.c
index 7b55e151f1b0..ac5a91ccde81 100644
--- a/drivers/isdn/pcbit/capi.c
+++ b/drivers/isdn/pcbit/capi.c
@@ -15,9 +15,9 @@
15 15
16/* 16/*
17 * Documentation: 17 * Documentation:
18 * - "Common ISDN API - Perfil Português - Versão 2.1", 18 * - "Common ISDN API - Perfil Português - Versão 2.1",
19 * Telecom Portugal, Fev 1992. 19 * Telecom Portugal, Fev 1992.
20 * - "Common ISDN API - Especificação de protocolos para 20 * - "Common ISDN API - Especificação de protocolos para
21 * acesso aos canais B", Inesc, Jan 1994. 21 * acesso aos canais B", Inesc, Jan 1994.
22 */ 22 */
23 23
diff --git a/drivers/isdn/sc/debug.h b/drivers/isdn/sc/debug.h
deleted file mode 100644
index e9db96ede4b2..000000000000
--- a/drivers/isdn/sc/debug.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/* $Id: debug.h,v 1.2.8.1 2001/09/23 22:24:59 kai Exp $
2 *
3 * Copyright (C) 1996 SpellCaster Telecommunications Inc.
4 *
5 * This software may be used and distributed according to the terms
6 * of the GNU General Public License, incorporated herein by reference.
7 *
8 * For more information, please contact gpl-info@spellcast.com or write:
9 *
10 * SpellCaster Telecommunications Inc.
11 * 5621 Finch Avenue East, Unit #3
12 * Scarborough, Ontario Canada
13 * M1B 2T9
14 * +1 (416) 297-8565
15 * +1 (416) 297-6433 Facsimile
16 */
17
18#define REQUEST_IRQ(a,b,c,d,e) request_irq(a,b,c,d,e)
19#define FREE_IRQ(a,b) free_irq(a,b)
diff --git a/drivers/isdn/sc/includes.h b/drivers/isdn/sc/includes.h
index 5286e0c810a9..4766e5b77378 100644
--- a/drivers/isdn/sc/includes.h
+++ b/drivers/isdn/sc/includes.h
@@ -14,4 +14,3 @@
14#include <linux/timer.h> 14#include <linux/timer.h>
15#include <linux/wait.h> 15#include <linux/wait.h>
16#include <linux/isdnif.h> 16#include <linux/isdnif.h>
17#include "debug.h"
diff --git a/drivers/isdn/sc/init.c b/drivers/isdn/sc/init.c
index 0bf76344a0d5..d09c854cfac7 100644
--- a/drivers/isdn/sc/init.c
+++ b/drivers/isdn/sc/init.c
@@ -404,7 +404,7 @@ static void __exit sc_exit(void)
404 /* 404 /*
405 * Release the IRQ 405 * Release the IRQ
406 */ 406 */
407 FREE_IRQ(sc_adapter[i]->interrupt, NULL); 407 free_irq(sc_adapter[i]->interrupt, NULL);
408 408
409 /* 409 /*
410 * Reset for a clean start 410 * Reset for a clean start
diff --git a/drivers/leds/leds-s3c24xx.c b/drivers/leds/leds-s3c24xx.c
index 50914439d861..0fd640751294 100644
--- a/drivers/leds/leds-s3c24xx.c
+++ b/drivers/leds/leds-s3c24xx.c
@@ -43,7 +43,7 @@ static void s3c24xx_led_set(struct led_classdev *led_cdev,
43 struct s3c24xx_gpio_led *led = to_gpio(led_cdev); 43 struct s3c24xx_gpio_led *led = to_gpio(led_cdev);
44 struct s3c24xx_led_platdata *pd = led->pdata; 44 struct s3c24xx_led_platdata *pd = led->pdata;
45 45
46 /* there will be a sort delay between setting the output and 46 /* there will be a short delay between setting the output and
47 * going from output to input when using tristate. */ 47 * going from output to input when using tristate. */
48 48
49 s3c2410_gpio_setpin(pd->gpio, (value ? 1 : 0) ^ 49 s3c2410_gpio_setpin(pd->gpio, (value ? 1 : 0) ^
diff --git a/drivers/macintosh/adbhid.c b/drivers/macintosh/adbhid.c
index 2766e4fc4ea8..883da72b5368 100644
--- a/drivers/macintosh/adbhid.c
+++ b/drivers/macintosh/adbhid.c
@@ -791,8 +791,10 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
791 if (hid->keycode[i]) 791 if (hid->keycode[i])
792 set_bit(hid->keycode[i], input_dev->keybit); 792 set_bit(hid->keycode[i], input_dev->keybit);
793 793
794 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP); 794 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_LED) |
795 input_dev->ledbit[0] = BIT(LED_SCROLLL) | BIT(LED_CAPSL) | BIT(LED_NUML); 795 BIT_MASK(EV_REP);
796 input_dev->ledbit[0] = BIT_MASK(LED_SCROLLL) |
797 BIT_MASK(LED_CAPSL) | BIT_MASK(LED_NUML);
796 input_dev->event = adbhid_kbd_event; 798 input_dev->event = adbhid_kbd_event;
797 input_dev->keycodemax = KEY_FN; 799 input_dev->keycodemax = KEY_FN;
798 input_dev->keycodesize = sizeof(hid->keycode[0]); 800 input_dev->keycodesize = sizeof(hid->keycode[0]);
@@ -801,16 +803,18 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
801 case ADB_MOUSE: 803 case ADB_MOUSE:
802 sprintf(hid->name, "ADB mouse"); 804 sprintf(hid->name, "ADB mouse");
803 805
804 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 806 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
805 input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 807 input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
806 input_dev->relbit[0] = BIT(REL_X) | BIT(REL_Y); 808 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
809 input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
807 break; 810 break;
808 811
809 case ADB_MISC: 812 case ADB_MISC:
810 switch (original_handler_id) { 813 switch (original_handler_id) {
811 case 0x02: /* Adjustable keyboard button device */ 814 case 0x02: /* Adjustable keyboard button device */
812 sprintf(hid->name, "ADB adjustable keyboard buttons"); 815 sprintf(hid->name, "ADB adjustable keyboard buttons");
813 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 816 input_dev->evbit[0] = BIT_MASK(EV_KEY) |
817 BIT_MASK(EV_REP);
814 set_bit(KEY_SOUND, input_dev->keybit); 818 set_bit(KEY_SOUND, input_dev->keybit);
815 set_bit(KEY_MUTE, input_dev->keybit); 819 set_bit(KEY_MUTE, input_dev->keybit);
816 set_bit(KEY_VOLUMEUP, input_dev->keybit); 820 set_bit(KEY_VOLUMEUP, input_dev->keybit);
@@ -818,7 +822,8 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
818 break; 822 break;
819 case 0x1f: /* Powerbook button device */ 823 case 0x1f: /* Powerbook button device */
820 sprintf(hid->name, "ADB Powerbook buttons"); 824 sprintf(hid->name, "ADB Powerbook buttons");
821 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 825 input_dev->evbit[0] = BIT_MASK(EV_KEY) |
826 BIT_MASK(EV_REP);
822 set_bit(KEY_MUTE, input_dev->keybit); 827 set_bit(KEY_MUTE, input_dev->keybit);
823 set_bit(KEY_VOLUMEUP, input_dev->keybit); 828 set_bit(KEY_VOLUMEUP, input_dev->keybit);
824 set_bit(KEY_VOLUMEDOWN, input_dev->keybit); 829 set_bit(KEY_VOLUMEDOWN, input_dev->keybit);
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 33dee3a773ed..89302309da92 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -117,9 +117,10 @@ static int emumousebtn_input_register(void)
117 emumousebtn->id.product = 0x0001; 117 emumousebtn->id.product = 0x0001;
118 emumousebtn->id.version = 0x0100; 118 emumousebtn->id.version = 0x0100;
119 119
120 emumousebtn->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 120 emumousebtn->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
121 emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); 121 emumousebtn->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
122 emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y); 122 BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT);
123 emumousebtn->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
123 124
124 ret = input_register_device(emumousebtn); 125 ret = input_register_device(emumousebtn);
125 if (ret) 126 if (ret)
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index c803d2bba65d..48d647abea46 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -563,7 +563,7 @@ static void media_bay_step(int i)
563 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL); 563 ide_init_hwif_ports(&hw, (unsigned long) bay->cd_base, (unsigned long) 0, NULL);
564 hw.irq = bay->cd_irq; 564 hw.irq = bay->cd_irq;
565 hw.chipset = ide_pmac; 565 hw.chipset = ide_pmac;
566 bay->cd_index = ide_register_hw(&hw, 0, NULL); 566 bay->cd_index = ide_register_hw(&hw, NULL, 0, NULL);
567 pmu_resume(); 567 pmu_resume();
568 } 568 }
569 if (bay->cd_index == -1) { 569 if (bay->cd_index == -1) {
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index f7c509b7a8ea..dc741d3a4531 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1521,7 +1521,7 @@ pmu_sr_intr(void)
1521 req = current_req; 1521 req = current_req;
1522 /* 1522 /*
1523 * For PMU sleep and freq change requests, we lock the 1523 * For PMU sleep and freq change requests, we lock the
1524 * PMU until it's explicitely unlocked. This avoids any 1524 * PMU until it's explicitly unlocked. This avoids any
1525 * spurrious event polling getting in 1525 * spurrious event polling getting in
1526 */ 1526 */
1527 current_req = req->next; 1527 current_req = req->next;
diff --git a/drivers/md/Kconfig b/drivers/md/Kconfig
index 34a8c60a254a..9b6fbf044fd8 100644
--- a/drivers/md/Kconfig
+++ b/drivers/md/Kconfig
@@ -267,6 +267,12 @@ config DM_MULTIPATH_RDAC
267 ---help--- 267 ---help---
268 Multipath support for LSI/Engenio RDAC. 268 Multipath support for LSI/Engenio RDAC.
269 269
270config DM_MULTIPATH_HP
271 tristate "HP MSA multipath support (EXPERIMENTAL)"
272 depends on DM_MULTIPATH && BLK_DEV_DM && EXPERIMENTAL
273 ---help---
274 Multipath support for HP MSA (Active/Passive) series hardware.
275
270config DM_DELAY 276config DM_DELAY
271 tristate "I/O delaying target (EXPERIMENTAL)" 277 tristate "I/O delaying target (EXPERIMENTAL)"
272 depends on BLK_DEV_DM && EXPERIMENTAL 278 depends on BLK_DEV_DM && EXPERIMENTAL
@@ -276,4 +282,10 @@ config DM_DELAY
276 282
277 If unsure, say N. 283 If unsure, say N.
278 284
285config DM_UEVENT
286 bool "DM uevents (EXPERIMENTAL)"
287 depends on BLK_DEV_DM && EXPERIMENTAL
288 ---help---
289 Generate udev events for DM events.
290
279endif # MD 291endif # MD
diff --git a/drivers/md/Makefile b/drivers/md/Makefile
index c49366cdc05d..d9aa7edb8780 100644
--- a/drivers/md/Makefile
+++ b/drivers/md/Makefile
@@ -8,6 +8,7 @@ dm-multipath-objs := dm-hw-handler.o dm-path-selector.o dm-mpath.o
8dm-snapshot-objs := dm-snap.o dm-exception-store.o 8dm-snapshot-objs := dm-snap.o dm-exception-store.o
9dm-mirror-objs := dm-log.o dm-raid1.o 9dm-mirror-objs := dm-log.o dm-raid1.o
10dm-rdac-objs := dm-mpath-rdac.o 10dm-rdac-objs := dm-mpath-rdac.o
11dm-hp-sw-objs := dm-mpath-hp-sw.o
11md-mod-objs := md.o bitmap.o 12md-mod-objs := md.o bitmap.o
12raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \ 13raid456-objs := raid5.o raid6algos.o raid6recov.o raid6tables.o \
13 raid6int1.o raid6int2.o raid6int4.o \ 14 raid6int1.o raid6int2.o raid6int4.o \
@@ -35,6 +36,7 @@ obj-$(CONFIG_DM_CRYPT) += dm-crypt.o
35obj-$(CONFIG_DM_DELAY) += dm-delay.o 36obj-$(CONFIG_DM_DELAY) += dm-delay.o
36obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o 37obj-$(CONFIG_DM_MULTIPATH) += dm-multipath.o dm-round-robin.o
37obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o 38obj-$(CONFIG_DM_MULTIPATH_EMC) += dm-emc.o
39obj-$(CONFIG_DM_MULTIPATH_HP) += dm-hp-sw.o
38obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rdac.o 40obj-$(CONFIG_DM_MULTIPATH_RDAC) += dm-rdac.o
39obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o 41obj-$(CONFIG_DM_SNAPSHOT) += dm-snapshot.o
40obj-$(CONFIG_DM_MIRROR) += dm-mirror.o 42obj-$(CONFIG_DM_MIRROR) += dm-mirror.o
@@ -48,6 +50,10 @@ ifeq ($(CONFIG_ALTIVEC),y)
48altivec_flags := -maltivec -mabi=altivec 50altivec_flags := -maltivec -mabi=altivec
49endif 51endif
50 52
53ifeq ($(CONFIG_DM_UEVENT),y)
54dm-mod-objs += dm-uevent.o
55endif
56
51targets += raid6int1.c 57targets += raid6int1.c
52$(obj)/raid6int1.c: UNROLL := 1 58$(obj)/raid6int1.c: UNROLL := 1
53$(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE 59$(obj)/raid6int1.c: $(src)/raid6int.uc $(src)/unroll.pl FORCE
diff --git a/drivers/md/dm-bio-list.h b/drivers/md/dm-bio-list.h
index 3f7b827649e3..d4509be0fe67 100644
--- a/drivers/md/dm-bio-list.h
+++ b/drivers/md/dm-bio-list.h
@@ -21,11 +21,6 @@ static inline int bio_list_empty(const struct bio_list *bl)
21 return bl->head == NULL; 21 return bl->head == NULL;
22} 22}
23 23
24#define BIO_LIST_INIT { .head = NULL, .tail = NULL }
25
26#define BIO_LIST(bl) \
27 struct bio_list bl = BIO_LIST_INIT
28
29static inline void bio_list_init(struct bio_list *bl) 24static inline void bio_list_init(struct bio_list *bl)
30{ 25{
31 bl->head = bl->tail = NULL; 26 bl->head = bl->tail = NULL;
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 64fee90bb68b..0eb5416798bd 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -36,7 +36,6 @@ struct dm_crypt_io {
36 struct work_struct work; 36 struct work_struct work;
37 atomic_t pending; 37 atomic_t pending;
38 int error; 38 int error;
39 int post_process;
40}; 39};
41 40
42/* 41/*
@@ -57,7 +56,7 @@ struct crypt_config;
57 56
58struct crypt_iv_operations { 57struct crypt_iv_operations {
59 int (*ctr)(struct crypt_config *cc, struct dm_target *ti, 58 int (*ctr)(struct crypt_config *cc, struct dm_target *ti,
60 const char *opts); 59 const char *opts);
61 void (*dtr)(struct crypt_config *cc); 60 void (*dtr)(struct crypt_config *cc);
62 const char *(*status)(struct crypt_config *cc); 61 const char *(*status)(struct crypt_config *cc);
63 int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector); 62 int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector);
@@ -80,6 +79,8 @@ struct crypt_config {
80 mempool_t *page_pool; 79 mempool_t *page_pool;
81 struct bio_set *bs; 80 struct bio_set *bs;
82 81
82 struct workqueue_struct *io_queue;
83 struct workqueue_struct *crypt_queue;
83 /* 84 /*
84 * crypto related data 85 * crypto related data
85 */ 86 */
@@ -112,7 +113,7 @@ static void clone_init(struct dm_crypt_io *, struct bio *);
112 * Different IV generation algorithms: 113 * Different IV generation algorithms:
113 * 114 *
114 * plain: the initial vector is the 32-bit little-endian version of the sector 115 * plain: the initial vector is the 32-bit little-endian version of the sector
115 * number, padded with zeros if neccessary. 116 * number, padded with zeros if necessary.
116 * 117 *
117 * essiv: "encrypted sector|salt initial vector", the sector number is 118 * essiv: "encrypted sector|salt initial vector", the sector number is
118 * encrypted with the bulk cipher using a salt as key. The salt 119 * encrypted with the bulk cipher using a salt as key. The salt
@@ -137,7 +138,7 @@ static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
137} 138}
138 139
139static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, 140static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
140 const char *opts) 141 const char *opts)
141{ 142{
142 struct crypto_cipher *essiv_tfm; 143 struct crypto_cipher *essiv_tfm;
143 struct crypto_hash *hash_tfm; 144 struct crypto_hash *hash_tfm;
@@ -175,6 +176,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
175 176
176 if (err) { 177 if (err) {
177 ti->error = "Error calculating hash in ESSIV"; 178 ti->error = "Error calculating hash in ESSIV";
179 kfree(salt);
178 return err; 180 return err;
179 } 181 }
180 182
@@ -188,7 +190,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
188 if (crypto_cipher_blocksize(essiv_tfm) != 190 if (crypto_cipher_blocksize(essiv_tfm) !=
189 crypto_blkcipher_ivsize(cc->tfm)) { 191 crypto_blkcipher_ivsize(cc->tfm)) {
190 ti->error = "Block size of ESSIV cipher does " 192 ti->error = "Block size of ESSIV cipher does "
191 "not match IV size of block cipher"; 193 "not match IV size of block cipher";
192 crypto_free_cipher(essiv_tfm); 194 crypto_free_cipher(essiv_tfm);
193 kfree(salt); 195 kfree(salt);
194 return -EINVAL; 196 return -EINVAL;
@@ -319,10 +321,10 @@ crypt_convert_scatterlist(struct crypt_config *cc, struct scatterlist *out,
319 return r; 321 return r;
320} 322}
321 323
322static void 324static void crypt_convert_init(struct crypt_config *cc,
323crypt_convert_init(struct crypt_config *cc, struct convert_context *ctx, 325 struct convert_context *ctx,
324 struct bio *bio_out, struct bio *bio_in, 326 struct bio *bio_out, struct bio *bio_in,
325 sector_t sector, int write) 327 sector_t sector, int write)
326{ 328{
327 ctx->bio_in = bio_in; 329 ctx->bio_in = bio_in;
328 ctx->bio_out = bio_out; 330 ctx->bio_out = bio_out;
@@ -338,7 +340,7 @@ crypt_convert_init(struct crypt_config *cc, struct convert_context *ctx,
338 * Encrypt / decrypt data from one bio to another one (can be the same one) 340 * Encrypt / decrypt data from one bio to another one (can be the same one)
339 */ 341 */
340static int crypt_convert(struct crypt_config *cc, 342static int crypt_convert(struct crypt_config *cc,
341 struct convert_context *ctx) 343 struct convert_context *ctx)
342{ 344{
343 int r = 0; 345 int r = 0;
344 346
@@ -370,7 +372,7 @@ static int crypt_convert(struct crypt_config *cc,
370 } 372 }
371 373
372 r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length, 374 r = crypt_convert_scatterlist(cc, &sg_out, &sg_in, sg_in.length,
373 ctx->write, ctx->sector); 375 ctx->write, ctx->sector);
374 if (r < 0) 376 if (r < 0)
375 break; 377 break;
376 378
@@ -380,13 +382,13 @@ static int crypt_convert(struct crypt_config *cc,
380 return r; 382 return r;
381} 383}
382 384
383 static void dm_crypt_bio_destructor(struct bio *bio) 385static void dm_crypt_bio_destructor(struct bio *bio)
384 { 386{
385 struct dm_crypt_io *io = bio->bi_private; 387 struct dm_crypt_io *io = bio->bi_private;
386 struct crypt_config *cc = io->target->private; 388 struct crypt_config *cc = io->target->private;
387 389
388 bio_free(bio, cc->bs); 390 bio_free(bio, cc->bs);
389 } 391}
390 392
391/* 393/*
392 * Generate a new unfragmented bio with the given size 394 * Generate a new unfragmented bio with the given size
@@ -458,7 +460,7 @@ static void crypt_free_buffer_pages(struct crypt_config *cc, struct bio *clone)
458 * One of the bios was finished. Check for completion of 460 * One of the bios was finished. Check for completion of
459 * the whole request and correctly clean up the buffer. 461 * the whole request and correctly clean up the buffer.
460 */ 462 */
461static void dec_pending(struct dm_crypt_io *io, int error) 463static void crypt_dec_pending(struct dm_crypt_io *io, int error)
462{ 464{
463 struct crypt_config *cc = (struct crypt_config *) io->target->private; 465 struct crypt_config *cc = (struct crypt_config *) io->target->private;
464 466
@@ -474,18 +476,36 @@ static void dec_pending(struct dm_crypt_io *io, int error)
474} 476}
475 477
476/* 478/*
477 * kcryptd: 479 * kcryptd/kcryptd_io:
478 * 480 *
479 * Needed because it would be very unwise to do decryption in an 481 * Needed because it would be very unwise to do decryption in an
480 * interrupt context. 482 * interrupt context.
483 *
484 * kcryptd performs the actual encryption or decryption.
485 *
486 * kcryptd_io performs the IO submission.
487 *
488 * They must be separated as otherwise the final stages could be
489 * starved by new requests which can block in the first stages due
490 * to memory allocation.
481 */ 491 */
482static struct workqueue_struct *_kcryptd_workqueue;
483static void kcryptd_do_work(struct work_struct *work); 492static void kcryptd_do_work(struct work_struct *work);
493static void kcryptd_do_crypt(struct work_struct *work);
484 494
485static void kcryptd_queue_io(struct dm_crypt_io *io) 495static void kcryptd_queue_io(struct dm_crypt_io *io)
486{ 496{
497 struct crypt_config *cc = io->target->private;
498
487 INIT_WORK(&io->work, kcryptd_do_work); 499 INIT_WORK(&io->work, kcryptd_do_work);
488 queue_work(_kcryptd_workqueue, &io->work); 500 queue_work(cc->io_queue, &io->work);
501}
502
503static void kcryptd_queue_crypt(struct dm_crypt_io *io)
504{
505 struct crypt_config *cc = io->target->private;
506
507 INIT_WORK(&io->work, kcryptd_do_crypt);
508 queue_work(cc->crypt_queue, &io->work);
489} 509}
490 510
491static void crypt_endio(struct bio *clone, int error) 511static void crypt_endio(struct bio *clone, int error)
@@ -508,13 +528,12 @@ static void crypt_endio(struct bio *clone, int error)
508 } 528 }
509 529
510 bio_put(clone); 530 bio_put(clone);
511 io->post_process = 1; 531 kcryptd_queue_crypt(io);
512 kcryptd_queue_io(io);
513 return; 532 return;
514 533
515out: 534out:
516 bio_put(clone); 535 bio_put(clone);
517 dec_pending(io, error); 536 crypt_dec_pending(io, error);
518} 537}
519 538
520static void clone_init(struct dm_crypt_io *io, struct bio *clone) 539static void clone_init(struct dm_crypt_io *io, struct bio *clone)
@@ -544,7 +563,7 @@ static void process_read(struct dm_crypt_io *io)
544 */ 563 */
545 clone = bio_alloc_bioset(GFP_NOIO, bio_segments(base_bio), cc->bs); 564 clone = bio_alloc_bioset(GFP_NOIO, bio_segments(base_bio), cc->bs);
546 if (unlikely(!clone)) { 565 if (unlikely(!clone)) {
547 dec_pending(io, -ENOMEM); 566 crypt_dec_pending(io, -ENOMEM);
548 return; 567 return;
549 } 568 }
550 569
@@ -579,7 +598,7 @@ static void process_write(struct dm_crypt_io *io)
579 while (remaining) { 598 while (remaining) {
580 clone = crypt_alloc_buffer(io, remaining); 599 clone = crypt_alloc_buffer(io, remaining);
581 if (unlikely(!clone)) { 600 if (unlikely(!clone)) {
582 dec_pending(io, -ENOMEM); 601 crypt_dec_pending(io, -ENOMEM);
583 return; 602 return;
584 } 603 }
585 604
@@ -589,7 +608,7 @@ static void process_write(struct dm_crypt_io *io)
589 if (unlikely(crypt_convert(cc, &ctx) < 0)) { 608 if (unlikely(crypt_convert(cc, &ctx) < 0)) {
590 crypt_free_buffer_pages(cc, clone); 609 crypt_free_buffer_pages(cc, clone);
591 bio_put(clone); 610 bio_put(clone);
592 dec_pending(io, -EIO); 611 crypt_dec_pending(io, -EIO);
593 return; 612 return;
594 } 613 }
595 614
@@ -624,17 +643,23 @@ static void process_read_endio(struct dm_crypt_io *io)
624 crypt_convert_init(cc, &ctx, io->base_bio, io->base_bio, 643 crypt_convert_init(cc, &ctx, io->base_bio, io->base_bio,
625 io->base_bio->bi_sector - io->target->begin, 0); 644 io->base_bio->bi_sector - io->target->begin, 0);
626 645
627 dec_pending(io, crypt_convert(cc, &ctx)); 646 crypt_dec_pending(io, crypt_convert(cc, &ctx));
628} 647}
629 648
630static void kcryptd_do_work(struct work_struct *work) 649static void kcryptd_do_work(struct work_struct *work)
631{ 650{
632 struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work); 651 struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work);
633 652
634 if (io->post_process) 653 if (bio_data_dir(io->base_bio) == READ)
635 process_read_endio(io);
636 else if (bio_data_dir(io->base_bio) == READ)
637 process_read(io); 654 process_read(io);
655}
656
657static void kcryptd_do_crypt(struct work_struct *work)
658{
659 struct dm_crypt_io *io = container_of(work, struct dm_crypt_io, work);
660
661 if (bio_data_dir(io->base_bio) == READ)
662 process_read_endio(io);
638 else 663 else
639 process_write(io); 664 process_write(io);
640} 665}
@@ -690,7 +715,7 @@ static int crypt_set_key(struct crypt_config *cc, char *key)
690 cc->key_size = key_size; /* initial settings */ 715 cc->key_size = key_size; /* initial settings */
691 716
692 if ((!key_size && strcmp(key, "-")) || 717 if ((!key_size && strcmp(key, "-")) ||
693 (key_size && crypt_decode_key(cc->key, key, key_size) < 0)) 718 (key_size && crypt_decode_key(cc->key, key, key_size) < 0))
694 return -EINVAL; 719 return -EINVAL;
695 720
696 set_bit(DM_CRYPT_KEY_VALID, &cc->flags); 721 set_bit(DM_CRYPT_KEY_VALID, &cc->flags);
@@ -746,7 +771,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
746 771
747 if (crypt_set_key(cc, argv[1])) { 772 if (crypt_set_key(cc, argv[1])) {
748 ti->error = "Error decoding key"; 773 ti->error = "Error decoding key";
749 goto bad1; 774 goto bad_cipher;
750 } 775 }
751 776
752 /* Compatiblity mode for old dm-crypt cipher strings */ 777 /* Compatiblity mode for old dm-crypt cipher strings */
@@ -757,19 +782,19 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
757 782
758 if (strcmp(chainmode, "ecb") && !ivmode) { 783 if (strcmp(chainmode, "ecb") && !ivmode) {
759 ti->error = "This chaining mode requires an IV mechanism"; 784 ti->error = "This chaining mode requires an IV mechanism";
760 goto bad1; 785 goto bad_cipher;
761 } 786 }
762 787
763 if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)", chainmode, 788 if (snprintf(cc->cipher, CRYPTO_MAX_ALG_NAME, "%s(%s)",
764 cipher) >= CRYPTO_MAX_ALG_NAME) { 789 chainmode, cipher) >= CRYPTO_MAX_ALG_NAME) {
765 ti->error = "Chain mode + cipher name is too long"; 790 ti->error = "Chain mode + cipher name is too long";
766 goto bad1; 791 goto bad_cipher;
767 } 792 }
768 793
769 tfm = crypto_alloc_blkcipher(cc->cipher, 0, CRYPTO_ALG_ASYNC); 794 tfm = crypto_alloc_blkcipher(cc->cipher, 0, CRYPTO_ALG_ASYNC);
770 if (IS_ERR(tfm)) { 795 if (IS_ERR(tfm)) {
771 ti->error = "Error allocating crypto tfm"; 796 ti->error = "Error allocating crypto tfm";
772 goto bad1; 797 goto bad_cipher;
773 } 798 }
774 799
775 strcpy(cc->cipher, cipher); 800 strcpy(cc->cipher, cipher);
@@ -793,18 +818,18 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
793 cc->iv_gen_ops = &crypt_iv_null_ops; 818 cc->iv_gen_ops = &crypt_iv_null_ops;
794 else { 819 else {
795 ti->error = "Invalid IV mode"; 820 ti->error = "Invalid IV mode";
796 goto bad2; 821 goto bad_ivmode;
797 } 822 }
798 823
799 if (cc->iv_gen_ops && cc->iv_gen_ops->ctr && 824 if (cc->iv_gen_ops && cc->iv_gen_ops->ctr &&
800 cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0) 825 cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0)
801 goto bad2; 826 goto bad_ivmode;
802 827
803 cc->iv_size = crypto_blkcipher_ivsize(tfm); 828 cc->iv_size = crypto_blkcipher_ivsize(tfm);
804 if (cc->iv_size) 829 if (cc->iv_size)
805 /* at least a 64 bit sector number should fit in our buffer */ 830 /* at least a 64 bit sector number should fit in our buffer */
806 cc->iv_size = max(cc->iv_size, 831 cc->iv_size = max(cc->iv_size,
807 (unsigned int)(sizeof(u64) / sizeof(u8))); 832 (unsigned int)(sizeof(u64) / sizeof(u8)));
808 else { 833 else {
809 if (cc->iv_gen_ops) { 834 if (cc->iv_gen_ops) {
810 DMWARN("Selected cipher does not support IVs"); 835 DMWARN("Selected cipher does not support IVs");
@@ -817,13 +842,13 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
817 cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool); 842 cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool);
818 if (!cc->io_pool) { 843 if (!cc->io_pool) {
819 ti->error = "Cannot allocate crypt io mempool"; 844 ti->error = "Cannot allocate crypt io mempool";
820 goto bad3; 845 goto bad_slab_pool;
821 } 846 }
822 847
823 cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); 848 cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0);
824 if (!cc->page_pool) { 849 if (!cc->page_pool) {
825 ti->error = "Cannot allocate page mempool"; 850 ti->error = "Cannot allocate page mempool";
826 goto bad4; 851 goto bad_page_pool;
827 } 852 }
828 853
829 cc->bs = bioset_create(MIN_IOS, MIN_IOS); 854 cc->bs = bioset_create(MIN_IOS, MIN_IOS);
@@ -834,25 +859,25 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
834 859
835 if (crypto_blkcipher_setkey(tfm, cc->key, key_size) < 0) { 860 if (crypto_blkcipher_setkey(tfm, cc->key, key_size) < 0) {
836 ti->error = "Error setting key"; 861 ti->error = "Error setting key";
837 goto bad5; 862 goto bad_device;
838 } 863 }
839 864
840 if (sscanf(argv[2], "%llu", &tmpll) != 1) { 865 if (sscanf(argv[2], "%llu", &tmpll) != 1) {
841 ti->error = "Invalid iv_offset sector"; 866 ti->error = "Invalid iv_offset sector";
842 goto bad5; 867 goto bad_device;
843 } 868 }
844 cc->iv_offset = tmpll; 869 cc->iv_offset = tmpll;
845 870
846 if (sscanf(argv[4], "%llu", &tmpll) != 1) { 871 if (sscanf(argv[4], "%llu", &tmpll) != 1) {
847 ti->error = "Invalid device sector"; 872 ti->error = "Invalid device sector";
848 goto bad5; 873 goto bad_device;
849 } 874 }
850 cc->start = tmpll; 875 cc->start = tmpll;
851 876
852 if (dm_get_device(ti, argv[3], cc->start, ti->len, 877 if (dm_get_device(ti, argv[3], cc->start, ti->len,
853 dm_table_get_mode(ti->table), &cc->dev)) { 878 dm_table_get_mode(ti->table), &cc->dev)) {
854 ti->error = "Device lookup failed"; 879 ti->error = "Device lookup failed";
855 goto bad5; 880 goto bad_device;
856 } 881 }
857 882
858 if (ivmode && cc->iv_gen_ops) { 883 if (ivmode && cc->iv_gen_ops) {
@@ -861,27 +886,45 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
861 cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL); 886 cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL);
862 if (!cc->iv_mode) { 887 if (!cc->iv_mode) {
863 ti->error = "Error kmallocing iv_mode string"; 888 ti->error = "Error kmallocing iv_mode string";
864 goto bad5; 889 goto bad_ivmode_string;
865 } 890 }
866 strcpy(cc->iv_mode, ivmode); 891 strcpy(cc->iv_mode, ivmode);
867 } else 892 } else
868 cc->iv_mode = NULL; 893 cc->iv_mode = NULL;
869 894
895 cc->io_queue = create_singlethread_workqueue("kcryptd_io");
896 if (!cc->io_queue) {
897 ti->error = "Couldn't create kcryptd io queue";
898 goto bad_io_queue;
899 }
900
901 cc->crypt_queue = create_singlethread_workqueue("kcryptd");
902 if (!cc->crypt_queue) {
903 ti->error = "Couldn't create kcryptd queue";
904 goto bad_crypt_queue;
905 }
906
870 ti->private = cc; 907 ti->private = cc;
871 return 0; 908 return 0;
872 909
873bad5: 910bad_crypt_queue:
911 destroy_workqueue(cc->io_queue);
912bad_io_queue:
913 kfree(cc->iv_mode);
914bad_ivmode_string:
915 dm_put_device(ti, cc->dev);
916bad_device:
874 bioset_free(cc->bs); 917 bioset_free(cc->bs);
875bad_bs: 918bad_bs:
876 mempool_destroy(cc->page_pool); 919 mempool_destroy(cc->page_pool);
877bad4: 920bad_page_pool:
878 mempool_destroy(cc->io_pool); 921 mempool_destroy(cc->io_pool);
879bad3: 922bad_slab_pool:
880 if (cc->iv_gen_ops && cc->iv_gen_ops->dtr) 923 if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)
881 cc->iv_gen_ops->dtr(cc); 924 cc->iv_gen_ops->dtr(cc);
882bad2: 925bad_ivmode:
883 crypto_free_blkcipher(tfm); 926 crypto_free_blkcipher(tfm);
884bad1: 927bad_cipher:
885 /* Must zero key material before freeing */ 928 /* Must zero key material before freeing */
886 memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); 929 memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
887 kfree(cc); 930 kfree(cc);
@@ -892,7 +935,8 @@ static void crypt_dtr(struct dm_target *ti)
892{ 935{
893 struct crypt_config *cc = (struct crypt_config *) ti->private; 936 struct crypt_config *cc = (struct crypt_config *) ti->private;
894 937
895 flush_workqueue(_kcryptd_workqueue); 938 destroy_workqueue(cc->io_queue);
939 destroy_workqueue(cc->crypt_queue);
896 940
897 bioset_free(cc->bs); 941 bioset_free(cc->bs);
898 mempool_destroy(cc->page_pool); 942 mempool_destroy(cc->page_pool);
@@ -918,9 +962,13 @@ static int crypt_map(struct dm_target *ti, struct bio *bio,
918 io = mempool_alloc(cc->io_pool, GFP_NOIO); 962 io = mempool_alloc(cc->io_pool, GFP_NOIO);
919 io->target = ti; 963 io->target = ti;
920 io->base_bio = bio; 964 io->base_bio = bio;
921 io->error = io->post_process = 0; 965 io->error = 0;
922 atomic_set(&io->pending, 0); 966 atomic_set(&io->pending, 0);
923 kcryptd_queue_io(io); 967
968 if (bio_data_dir(io->base_bio) == READ)
969 kcryptd_queue_io(io);
970 else
971 kcryptd_queue_crypt(io);
924 972
925 return DM_MAPIO_SUBMITTED; 973 return DM_MAPIO_SUBMITTED;
926} 974}
@@ -1037,25 +1085,12 @@ static int __init dm_crypt_init(void)
1037 if (!_crypt_io_pool) 1085 if (!_crypt_io_pool)
1038 return -ENOMEM; 1086 return -ENOMEM;
1039 1087
1040 _kcryptd_workqueue = create_workqueue("kcryptd");
1041 if (!_kcryptd_workqueue) {
1042 r = -ENOMEM;
1043 DMERR("couldn't create kcryptd");
1044 goto bad1;
1045 }
1046
1047 r = dm_register_target(&crypt_target); 1088 r = dm_register_target(&crypt_target);
1048 if (r < 0) { 1089 if (r < 0) {
1049 DMERR("register failed %d", r); 1090 DMERR("register failed %d", r);
1050 goto bad2; 1091 kmem_cache_destroy(_crypt_io_pool);
1051 } 1092 }
1052 1093
1053 return 0;
1054
1055bad2:
1056 destroy_workqueue(_kcryptd_workqueue);
1057bad1:
1058 kmem_cache_destroy(_crypt_io_pool);
1059 return r; 1094 return r;
1060} 1095}
1061 1096
@@ -1066,7 +1101,6 @@ static void __exit dm_crypt_exit(void)
1066 if (r < 0) 1101 if (r < 0)
1067 DMERR("unregister failed %d", r); 1102 DMERR("unregister failed %d", r);
1068 1103
1069 destroy_workqueue(_kcryptd_workqueue);
1070 kmem_cache_destroy(_crypt_io_pool); 1104 kmem_cache_destroy(_crypt_io_pool);
1071} 1105}
1072 1106
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c
index 6928c136d3c5..bdd37f881c42 100644
--- a/drivers/md/dm-delay.c
+++ b/drivers/md/dm-delay.c
@@ -83,7 +83,7 @@ static struct bio *flush_delayed_bios(struct delay_c *dc, int flush_all)
83 struct dm_delay_info *delayed, *next; 83 struct dm_delay_info *delayed, *next;
84 unsigned long next_expires = 0; 84 unsigned long next_expires = 0;
85 int start_timer = 0; 85 int start_timer = 0;
86 BIO_LIST(flush_bios); 86 struct bio_list flush_bios = { };
87 87
88 mutex_lock(&delayed_bios_lock); 88 mutex_lock(&delayed_bios_lock);
89 list_for_each_entry_safe(delayed, next, &dc->delayed_bios, list) { 89 list_for_each_entry_safe(delayed, next, &dc->delayed_bios, list) {
@@ -163,34 +163,32 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)
163 goto bad; 163 goto bad;
164 } 164 }
165 165
166 if (argc == 3) { 166 dc->dev_write = NULL;
167 dc->dev_write = NULL; 167 if (argc == 3)
168 goto out; 168 goto out;
169 }
170 169
171 if (sscanf(argv[4], "%llu", &tmpll) != 1) { 170 if (sscanf(argv[4], "%llu", &tmpll) != 1) {
172 ti->error = "Invalid write device sector"; 171 ti->error = "Invalid write device sector";
173 goto bad; 172 goto bad_dev_read;
174 } 173 }
175 dc->start_write = tmpll; 174 dc->start_write = tmpll;
176 175
177 if (sscanf(argv[5], "%u", &dc->write_delay) != 1) { 176 if (sscanf(argv[5], "%u", &dc->write_delay) != 1) {
178 ti->error = "Invalid write delay"; 177 ti->error = "Invalid write delay";
179 goto bad; 178 goto bad_dev_read;
180 } 179 }
181 180
182 if (dm_get_device(ti, argv[3], dc->start_write, ti->len, 181 if (dm_get_device(ti, argv[3], dc->start_write, ti->len,
183 dm_table_get_mode(ti->table), &dc->dev_write)) { 182 dm_table_get_mode(ti->table), &dc->dev_write)) {
184 ti->error = "Write device lookup failed"; 183 ti->error = "Write device lookup failed";
185 dm_put_device(ti, dc->dev_read); 184 goto bad_dev_read;
186 goto bad;
187 } 185 }
188 186
189out: 187out:
190 dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache); 188 dc->delayed_pool = mempool_create_slab_pool(128, delayed_cache);
191 if (!dc->delayed_pool) { 189 if (!dc->delayed_pool) {
192 DMERR("Couldn't create delayed bio pool."); 190 DMERR("Couldn't create delayed bio pool.");
193 goto bad; 191 goto bad_dev_write;
194 } 192 }
195 193
196 setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc); 194 setup_timer(&dc->delay_timer, handle_delayed_timer, (unsigned long)dc);
@@ -203,6 +201,11 @@ out:
203 ti->private = dc; 201 ti->private = dc;
204 return 0; 202 return 0;
205 203
204bad_dev_write:
205 if (dc->dev_write)
206 dm_put_device(ti, dc->dev_write);
207bad_dev_read:
208 dm_put_device(ti, dc->dev_read);
206bad: 209bad:
207 kfree(dc); 210 kfree(dc);
208 return -EINVAL; 211 return -EINVAL;
@@ -305,7 +308,7 @@ static int delay_status(struct dm_target *ti, status_type_t type,
305 (unsigned long long) dc->start_read, 308 (unsigned long long) dc->start_read,
306 dc->read_delay); 309 dc->read_delay);
307 if (dc->dev_write) 310 if (dc->dev_write)
308 DMEMIT("%s %llu %u", dc->dev_write->name, 311 DMEMIT(" %s %llu %u", dc->dev_write->name,
309 (unsigned long long) dc->start_write, 312 (unsigned long long) dc->start_write,
310 dc->write_delay); 313 dc->write_delay);
311 break; 314 break;
diff --git a/drivers/md/dm-emc.c b/drivers/md/dm-emc.c
index 342517261ece..6b91b9ab1d41 100644
--- a/drivers/md/dm-emc.c
+++ b/drivers/md/dm-emc.c
@@ -81,7 +81,7 @@ static struct bio *get_failover_bio(struct dm_path *path, unsigned data_size)
81 } 81 }
82 82
83 if (bio_add_page(bio, page, data_size, 0) != data_size) { 83 if (bio_add_page(bio, page, data_size, 0) != data_size) {
84 DMERR("get_failover_bio: alloc_page() failed."); 84 DMERR("get_failover_bio: bio_add_page() failed.");
85 __free_page(page); 85 __free_page(page);
86 bio_put(bio); 86 bio_put(bio);
87 return NULL; 87 return NULL;
@@ -211,12 +211,10 @@ fail_path:
211 211
212static struct emc_handler *alloc_emc_handler(void) 212static struct emc_handler *alloc_emc_handler(void)
213{ 213{
214 struct emc_handler *h = kmalloc(sizeof(*h), GFP_KERNEL); 214 struct emc_handler *h = kzalloc(sizeof(*h), GFP_KERNEL);
215 215
216 if (h) { 216 if (h)
217 memset(h, 0, sizeof(*h));
218 spin_lock_init(&h->lock); 217 spin_lock_init(&h->lock);
219 }
220 218
221 return h; 219 return h;
222} 220}
diff --git a/drivers/md/dm-hw-handler.c b/drivers/md/dm-hw-handler.c
index baafaaba4d4b..2ee84d8aa0bf 100644
--- a/drivers/md/dm-hw-handler.c
+++ b/drivers/md/dm-hw-handler.c
@@ -91,12 +91,10 @@ void dm_put_hw_handler(struct hw_handler_type *hwht)
91 91
92static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht) 92static struct hwh_internal *_alloc_hw_handler(struct hw_handler_type *hwht)
93{ 93{
94 struct hwh_internal *hwhi = kmalloc(sizeof(*hwhi), GFP_KERNEL); 94 struct hwh_internal *hwhi = kzalloc(sizeof(*hwhi), GFP_KERNEL);
95 95
96 if (hwhi) { 96 if (hwhi)
97 memset(hwhi, 0, sizeof(*hwhi));
98 hwhi->hwht = *hwht; 97 hwhi->hwht = *hwht;
99 }
100 98
101 return hwhi; 99 return hwhi;
102} 100}
diff --git a/drivers/md/dm-hw-handler.h b/drivers/md/dm-hw-handler.h
index e0832e6fcf36..46809dcb121a 100644
--- a/drivers/md/dm-hw-handler.h
+++ b/drivers/md/dm-hw-handler.h
@@ -58,5 +58,6 @@ unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio);
58#define MP_FAIL_PATH 1 58#define MP_FAIL_PATH 1
59#define MP_BYPASS_PG 2 59#define MP_BYPASS_PG 2
60#define MP_ERROR_IO 4 /* Don't retry this I/O */ 60#define MP_ERROR_IO 4 /* Don't retry this I/O */
61#define MP_RETRY 8
61 62
62#endif 63#endif
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index b441d82c338a..138200bf5e0b 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -700,7 +700,7 @@ static int dev_rename(struct dm_ioctl *param, size_t param_size)
700 int r; 700 int r;
701 char *new_name = (char *) param + param->data_start; 701 char *new_name = (char *) param + param->data_start;
702 702
703 if (new_name < (char *) (param + 1) || 703 if (new_name < (char *) param->data ||
704 invalid_str(new_name, (void *) param + param_size)) { 704 invalid_str(new_name, (void *) param + param_size)) {
705 DMWARN("Invalid new logical volume name supplied."); 705 DMWARN("Invalid new logical volume name supplied.");
706 return -EINVAL; 706 return -EINVAL;
@@ -726,7 +726,7 @@ static int dev_set_geometry(struct dm_ioctl *param, size_t param_size)
726 if (!md) 726 if (!md)
727 return -ENXIO; 727 return -ENXIO;
728 728
729 if (geostr < (char *) (param + 1) || 729 if (geostr < (char *) param->data ||
730 invalid_str(geostr, (void *) param + param_size)) { 730 invalid_str(geostr, (void *) param + param_size)) {
731 DMWARN("Invalid geometry supplied."); 731 DMWARN("Invalid geometry supplied.");
732 goto out; 732 goto out;
@@ -1233,7 +1233,7 @@ static int target_message(struct dm_ioctl *param, size_t param_size)
1233 if (r) 1233 if (r)
1234 goto out; 1234 goto out;
1235 1235
1236 if (tmsg < (struct dm_target_msg *) (param + 1) || 1236 if (tmsg < (struct dm_target_msg *) param->data ||
1237 invalid_str(tmsg->message, (void *) param + param_size)) { 1237 invalid_str(tmsg->message, (void *) param + param_size)) {
1238 DMWARN("Invalid target message parameters."); 1238 DMWARN("Invalid target message parameters.");
1239 r = -EINVAL; 1239 r = -EINVAL;
@@ -1358,7 +1358,7 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param)
1358 if (tmp.data_size < sizeof(tmp)) 1358 if (tmp.data_size < sizeof(tmp))
1359 return -EINVAL; 1359 return -EINVAL;
1360 1360
1361 dmi = (struct dm_ioctl *) vmalloc(tmp.data_size); 1361 dmi = vmalloc(tmp.data_size);
1362 if (!dmi) 1362 if (!dmi)
1363 return -ENOMEM; 1363 return -ENOMEM;
1364 1364
@@ -1515,3 +1515,35 @@ void dm_interface_exit(void)
1515 1515
1516 dm_hash_exit(); 1516 dm_hash_exit();
1517} 1517}
1518
1519/**
1520 * dm_copy_name_and_uuid - Copy mapped device name & uuid into supplied buffers
1521 * @md: Pointer to mapped_device
1522 * @name: Buffer (size DM_NAME_LEN) for name
1523 * @uuid: Buffer (size DM_UUID_LEN) for uuid or empty string if uuid not defined
1524 */
1525int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
1526{
1527 int r = 0;
1528 struct hash_cell *hc;
1529
1530 if (!md)
1531 return -ENXIO;
1532
1533 dm_get(md);
1534 down_read(&_hash_lock);
1535 hc = dm_get_mdptr(md);
1536 if (!hc || hc->md != md) {
1537 r = -ENXIO;
1538 goto out;
1539 }
1540
1541 strcpy(name, hc->name);
1542 strcpy(uuid, hc->uuid ? : "");
1543
1544out:
1545 up_read(&_hash_lock);
1546 dm_put(md);
1547
1548 return r;
1549}
diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
index a66428d860fe..072ee4353eab 100644
--- a/drivers/md/dm-log.c
+++ b/drivers/md/dm-log.c
@@ -696,7 +696,7 @@ static struct dirty_log_type _disk_type = {
696 .module = THIS_MODULE, 696 .module = THIS_MODULE,
697 .ctr = disk_ctr, 697 .ctr = disk_ctr,
698 .dtr = disk_dtr, 698 .dtr = disk_dtr,
699 .suspend = disk_flush, 699 .postsuspend = disk_flush,
700 .resume = disk_resume, 700 .resume = disk_resume,
701 .get_region_size = core_get_region_size, 701 .get_region_size = core_get_region_size,
702 .is_clean = core_is_clean, 702 .is_clean = core_is_clean,
diff --git a/drivers/md/dm-log.h b/drivers/md/dm-log.h
index 86a301c8daf1..3fae87eb5963 100644
--- a/drivers/md/dm-log.h
+++ b/drivers/md/dm-log.h
@@ -32,7 +32,8 @@ struct dirty_log_type {
32 * There are times when we don't want the log to touch 32 * There are times when we don't want the log to touch
33 * the disk. 33 * the disk.
34 */ 34 */
35 int (*suspend)(struct dirty_log *log); 35 int (*presuspend)(struct dirty_log *log);
36 int (*postsuspend)(struct dirty_log *log);
36 int (*resume)(struct dirty_log *log); 37 int (*resume)(struct dirty_log *log);
37 38
38 /* 39 /*
diff --git a/drivers/md/dm-mpath-hp-sw.c b/drivers/md/dm-mpath-hp-sw.c
new file mode 100644
index 000000000000..204bf42c9449
--- /dev/null
+++ b/drivers/md/dm-mpath-hp-sw.c
@@ -0,0 +1,248 @@
1/*
2 * Copyright (C) 2005 Mike Christie, All rights reserved.
3 * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
4 * Authors: Mike Christie
5 * Dave Wysochanski
6 *
7 * This file is released under the GPL.
8 *
9 * This module implements the specific path activation code for
10 * HP StorageWorks and FSC FibreCat Asymmetric (Active/Passive)
11 * storage arrays.
12 * These storage arrays have controller-based failover, not
13 * LUN-based failover. However, LUN-based failover is the design
14 * of dm-multipath. Thus, this module is written for LUN-based failover.
15 */
16#include <linux/blkdev.h>
17#include <linux/list.h>
18#include <linux/types.h>
19#include <scsi/scsi.h>
20#include <scsi/scsi_cmnd.h>
21#include <scsi/scsi_dbg.h>
22
23#include "dm.h"
24#include "dm-hw-handler.h"
25
26#define DM_MSG_PREFIX "multipath hp-sw"
27#define DM_HP_HWH_NAME "hp-sw"
28#define DM_HP_HWH_VER "1.0.0"
29
30struct hp_sw_context {
31 unsigned char sense[SCSI_SENSE_BUFFERSIZE];
32};
33
34/*
35 * hp_sw_error_is_retryable - Is an HP-specific check condition retryable?
36 * @req: path activation request
37 *
38 * Examine error codes of request and determine whether the error is retryable.
39 * Some error codes are already retried by scsi-ml (see
40 * scsi_decide_disposition), but some HP specific codes are not.
41 * The intent of this routine is to supply the logic for the HP specific
42 * check conditions.
43 *
44 * Returns:
45 * 1 - command completed with retryable error
46 * 0 - command completed with non-retryable error
47 *
48 * Possible optimizations
49 * 1. More hardware-specific error codes
50 */
51static int hp_sw_error_is_retryable(struct request *req)
52{
53 /*
54 * NOT_READY is known to be retryable
55 * For now we just dump out the sense data and call it retryable
56 */
57 if (status_byte(req->errors) == CHECK_CONDITION)
58 __scsi_print_sense(DM_HP_HWH_NAME, req->sense, req->sense_len);
59
60 /*
61 * At this point we don't have complete information about all the error
62 * codes from this hardware, so we are just conservative and retry
63 * when in doubt.
64 */
65 return 1;
66}
67
68/*
69 * hp_sw_end_io - Completion handler for HP path activation.
70 * @req: path activation request
71 * @error: scsi-ml error
72 *
73 * Check sense data, free request structure, and notify dm that
74 * pg initialization has completed.
75 *
76 * Context: scsi-ml softirq
77 *
78 */
79static void hp_sw_end_io(struct request *req, int error)
80{
81 struct dm_path *path = req->end_io_data;
82 unsigned err_flags = 0;
83
84 if (!error) {
85 DMDEBUG("%s path activation command - success",
86 path->dev->name);
87 goto out;
88 }
89
90 if (hp_sw_error_is_retryable(req)) {
91 DMDEBUG("%s path activation command - retry",
92 path->dev->name);
93 err_flags = MP_RETRY;
94 goto out;
95 }
96
97 DMWARN("%s path activation fail - error=0x%x",
98 path->dev->name, error);
99 err_flags = MP_FAIL_PATH;
100
101out:
102 req->end_io_data = NULL;
103 __blk_put_request(req->q, req);
104 dm_pg_init_complete(path, err_flags);
105}
106
107/*
108 * hp_sw_get_request - Allocate an HP specific path activation request
109 * @path: path on which request will be sent (needed for request queue)
110 *
111 * The START command is used for path activation request.
112 * These arrays are controller-based failover, not LUN based.
113 * One START command issued to a single path will fail over all
114 * LUNs for the same controller.
115 *
116 * Possible optimizations
117 * 1. Make timeout configurable
118 * 2. Preallocate request
119 */
120static struct request *hp_sw_get_request(struct dm_path *path)
121{
122 struct request *req;
123 struct block_device *bdev = path->dev->bdev;
124 struct request_queue *q = bdev_get_queue(bdev);
125 struct hp_sw_context *h = path->hwhcontext;
126
127 req = blk_get_request(q, WRITE, GFP_NOIO);
128 if (!req)
129 goto out;
130
131 req->timeout = 60 * HZ;
132
133 req->errors = 0;
134 req->cmd_type = REQ_TYPE_BLOCK_PC;
135 req->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE;
136 req->end_io_data = path;
137 req->sense = h->sense;
138 memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE);
139
140 memset(&req->cmd, 0, BLK_MAX_CDB);
141 req->cmd[0] = START_STOP;
142 req->cmd[4] = 1;
143 req->cmd_len = COMMAND_SIZE(req->cmd[0]);
144
145out:
146 return req;
147}
148
149/*
150 * hp_sw_pg_init - HP path activation implementation.
151 * @hwh: hardware handler specific data
152 * @bypassed: unused; is the path group bypassed? (see dm-mpath.c)
153 * @path: path to send initialization command
154 *
155 * Send an HP-specific path activation command on 'path'.
156 * Do not try to optimize in any way, just send the activation command.
157 * More than one path activation command may be sent to the same controller.
158 * This seems to work fine for basic failover support.
159 *
160 * Possible optimizations
161 * 1. Detect an in-progress activation request and avoid submitting another one
162 * 2. Model the controller and only send a single activation request at a time
163 * 3. Determine the state of a path before sending an activation request
164 *
165 * Context: kmpathd (see process_queued_ios() in dm-mpath.c)
166 */
167static void hp_sw_pg_init(struct hw_handler *hwh, unsigned bypassed,
168 struct dm_path *path)
169{
170 struct request *req;
171 struct hp_sw_context *h;
172
173 path->hwhcontext = hwh->context;
174 h = hwh->context;
175
176 req = hp_sw_get_request(path);
177 if (!req) {
178 DMERR("%s path activation command - allocation fail",
179 path->dev->name);
180 goto retry;
181 }
182
183 DMDEBUG("%s path activation command - sent", path->dev->name);
184
185 blk_execute_rq_nowait(req->q, NULL, req, 1, hp_sw_end_io);
186 return;
187
188retry:
189 dm_pg_init_complete(path, MP_RETRY);
190}
191
192static int hp_sw_create(struct hw_handler *hwh, unsigned argc, char **argv)
193{
194 struct hp_sw_context *h;
195
196 h = kmalloc(sizeof(*h), GFP_KERNEL);
197 if (!h)
198 return -ENOMEM;
199
200 hwh->context = h;
201
202 return 0;
203}
204
205static void hp_sw_destroy(struct hw_handler *hwh)
206{
207 struct hp_sw_context *h = hwh->context;
208
209 kfree(h);
210}
211
212static struct hw_handler_type hp_sw_hwh = {
213 .name = DM_HP_HWH_NAME,
214 .module = THIS_MODULE,
215 .create = hp_sw_create,
216 .destroy = hp_sw_destroy,
217 .pg_init = hp_sw_pg_init,
218};
219
220static int __init hp_sw_init(void)
221{
222 int r;
223
224 r = dm_register_hw_handler(&hp_sw_hwh);
225 if (r < 0)
226 DMERR("register failed %d", r);
227 else
228 DMINFO("version " DM_HP_HWH_VER " loaded");
229
230 return r;
231}
232
233static void __exit hp_sw_exit(void)
234{
235 int r;
236
237 r = dm_unregister_hw_handler(&hp_sw_hwh);
238 if (r < 0)
239 DMERR("unregister failed %d", r);
240}
241
242module_init(hp_sw_init);
243module_exit(hp_sw_exit);
244
245MODULE_DESCRIPTION("DM Multipath HP StorageWorks / FSC FibreCat (A/P) support");
246MODULE_AUTHOR("Mike Christie, Dave Wysochanski <dm-devel@redhat.com>");
247MODULE_LICENSE("GPL");
248MODULE_VERSION(DM_HP_HWH_VER);
diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c
index 16b161345775..e04eb5c697fb 100644
--- a/drivers/md/dm-mpath-rdac.c
+++ b/drivers/md/dm-mpath-rdac.c
@@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = {
664 664
665static int __init rdac_init(void) 665static int __init rdac_init(void)
666{ 666{
667 int r = dm_register_hw_handler(&rdac_handler); 667 int r;
668
669 if (r < 0) {
670 DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
671 return r;
672 }
673 668
674 rdac_wkqd = create_singlethread_workqueue("rdac_wkqd"); 669 rdac_wkqd = create_singlethread_workqueue("rdac_wkqd");
675 if (!rdac_wkqd) { 670 if (!rdac_wkqd) {
676 DMERR("Failed to create workqueue rdac_wkqd."); 671 DMERR("Failed to create workqueue rdac_wkqd.");
677 dm_unregister_hw_handler(&rdac_handler);
678 return -ENOMEM; 672 return -ENOMEM;
679 } 673 }
680 674
675 r = dm_register_hw_handler(&rdac_handler);
676 if (r < 0) {
677 DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
678 destroy_workqueue(rdac_wkqd);
679 return r;
680 }
681
681 DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER); 682 DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER);
682 return 0; 683 return 0;
683} 684}
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 31056abca89d..24b2b1e32fae 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -10,6 +10,7 @@
10#include "dm-hw-handler.h" 10#include "dm-hw-handler.h"
11#include "dm-bio-list.h" 11#include "dm-bio-list.h"
12#include "dm-bio-record.h" 12#include "dm-bio-record.h"
13#include "dm-uevent.h"
13 14
14#include <linux/ctype.h> 15#include <linux/ctype.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -75,6 +76,8 @@ struct multipath {
75 unsigned queue_io; /* Must we queue all I/O? */ 76 unsigned queue_io; /* Must we queue all I/O? */
76 unsigned queue_if_no_path; /* Queue I/O if last path fails? */ 77 unsigned queue_if_no_path; /* Queue I/O if last path fails? */
77 unsigned saved_queue_if_no_path;/* Saved state during suspension */ 78 unsigned saved_queue_if_no_path;/* Saved state during suspension */
79 unsigned pg_init_retries; /* Number of times to retry pg_init */
80 unsigned pg_init_count; /* Number of times pg_init called */
78 81
79 struct work_struct process_queued_ios; 82 struct work_struct process_queued_ios;
80 struct bio_list queued_ios; 83 struct bio_list queued_ios;
@@ -225,6 +228,8 @@ static void __switch_pg(struct multipath *m, struct pgpath *pgpath)
225 m->pg_init_required = 0; 228 m->pg_init_required = 0;
226 m->queue_io = 0; 229 m->queue_io = 0;
227 } 230 }
231
232 m->pg_init_count = 0;
228} 233}
229 234
230static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg) 235static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg)
@@ -424,6 +429,7 @@ static void process_queued_ios(struct work_struct *work)
424 must_queue = 0; 429 must_queue = 0;
425 430
426 if (m->pg_init_required && !m->pg_init_in_progress) { 431 if (m->pg_init_required && !m->pg_init_in_progress) {
432 m->pg_init_count++;
427 m->pg_init_required = 0; 433 m->pg_init_required = 0;
428 m->pg_init_in_progress = 1; 434 m->pg_init_in_progress = 1;
429 init_required = 1; 435 init_required = 1;
@@ -689,9 +695,11 @@ static int parse_features(struct arg_set *as, struct multipath *m)
689 int r; 695 int r;
690 unsigned argc; 696 unsigned argc;
691 struct dm_target *ti = m->ti; 697 struct dm_target *ti = m->ti;
698 const char *param_name;
692 699
693 static struct param _params[] = { 700 static struct param _params[] = {
694 {0, 1, "invalid number of feature args"}, 701 {0, 3, "invalid number of feature args"},
702 {1, 50, "pg_init_retries must be between 1 and 50"},
695 }; 703 };
696 704
697 r = read_param(_params, shift(as), &argc, &ti->error); 705 r = read_param(_params, shift(as), &argc, &ti->error);
@@ -701,12 +709,28 @@ static int parse_features(struct arg_set *as, struct multipath *m)
701 if (!argc) 709 if (!argc)
702 return 0; 710 return 0;
703 711
704 if (!strnicmp(shift(as), MESG_STR("queue_if_no_path"))) 712 do {
705 return queue_if_no_path(m, 1, 0); 713 param_name = shift(as);
706 else { 714 argc--;
715
716 if (!strnicmp(param_name, MESG_STR("queue_if_no_path"))) {
717 r = queue_if_no_path(m, 1, 0);
718 continue;
719 }
720
721 if (!strnicmp(param_name, MESG_STR("pg_init_retries")) &&
722 (argc >= 1)) {
723 r = read_param(_params + 1, shift(as),
724 &m->pg_init_retries, &ti->error);
725 argc--;
726 continue;
727 }
728
707 ti->error = "Unrecognised multipath feature request"; 729 ti->error = "Unrecognised multipath feature request";
708 return -EINVAL; 730 r = -EINVAL;
709 } 731 } while (argc && !r);
732
733 return r;
710} 734}
711 735
712static int multipath_ctr(struct dm_target *ti, unsigned int argc, 736static int multipath_ctr(struct dm_target *ti, unsigned int argc,
@@ -834,6 +858,9 @@ static int fail_path(struct pgpath *pgpath)
834 if (pgpath == m->current_pgpath) 858 if (pgpath == m->current_pgpath)
835 m->current_pgpath = NULL; 859 m->current_pgpath = NULL;
836 860
861 dm_path_uevent(DM_UEVENT_PATH_FAILED, m->ti,
862 pgpath->path.dev->name, m->nr_valid_paths);
863
837 queue_work(kmultipathd, &m->trigger_event); 864 queue_work(kmultipathd, &m->trigger_event);
838 865
839out: 866out:
@@ -873,6 +900,9 @@ static int reinstate_path(struct pgpath *pgpath)
873 if (!m->nr_valid_paths++ && m->queue_size) 900 if (!m->nr_valid_paths++ && m->queue_size)
874 queue_work(kmultipathd, &m->process_queued_ios); 901 queue_work(kmultipathd, &m->process_queued_ios);
875 902
903 dm_path_uevent(DM_UEVENT_PATH_REINSTATED, m->ti,
904 pgpath->path.dev->name, m->nr_valid_paths);
905
876 queue_work(kmultipathd, &m->trigger_event); 906 queue_work(kmultipathd, &m->trigger_event);
877 907
878out: 908out:
@@ -976,6 +1006,26 @@ static int bypass_pg_num(struct multipath *m, const char *pgstr, int bypassed)
976} 1006}
977 1007
978/* 1008/*
1009 * Should we retry pg_init immediately?
1010 */
1011static int pg_init_limit_reached(struct multipath *m, struct pgpath *pgpath)
1012{
1013 unsigned long flags;
1014 int limit_reached = 0;
1015
1016 spin_lock_irqsave(&m->lock, flags);
1017
1018 if (m->pg_init_count <= m->pg_init_retries)
1019 m->pg_init_required = 1;
1020 else
1021 limit_reached = 1;
1022
1023 spin_unlock_irqrestore(&m->lock, flags);
1024
1025 return limit_reached;
1026}
1027
1028/*
979 * pg_init must call this when it has completed its initialisation 1029 * pg_init must call this when it has completed its initialisation
980 */ 1030 */
981void dm_pg_init_complete(struct dm_path *path, unsigned err_flags) 1031void dm_pg_init_complete(struct dm_path *path, unsigned err_flags)
@@ -985,8 +1035,14 @@ void dm_pg_init_complete(struct dm_path *path, unsigned err_flags)
985 struct multipath *m = pg->m; 1035 struct multipath *m = pg->m;
986 unsigned long flags; 1036 unsigned long flags;
987 1037
988 /* We insist on failing the path if the PG is already bypassed. */ 1038 /*
989 if (err_flags && pg->bypassed) 1039 * If requested, retry pg_init until maximum number of retries exceeded.
1040 * If retry not requested and PG already bypassed, always fail the path.
1041 */
1042 if (err_flags & MP_RETRY) {
1043 if (pg_init_limit_reached(m, pgpath))
1044 err_flags |= MP_FAIL_PATH;
1045 } else if (err_flags && pg->bypassed)
990 err_flags |= MP_FAIL_PATH; 1046 err_flags |= MP_FAIL_PATH;
991 1047
992 if (err_flags & MP_FAIL_PATH) 1048 if (err_flags & MP_FAIL_PATH)
@@ -996,7 +1052,7 @@ void dm_pg_init_complete(struct dm_path *path, unsigned err_flags)
996 bypass_pg(m, pg, 1); 1052 bypass_pg(m, pg, 1);
997 1053
998 spin_lock_irqsave(&m->lock, flags); 1054 spin_lock_irqsave(&m->lock, flags);
999 if (err_flags) { 1055 if (err_flags & ~MP_RETRY) {
1000 m->current_pgpath = NULL; 1056 m->current_pgpath = NULL;
1001 m->current_pg = NULL; 1057 m->current_pg = NULL;
1002 } else if (!m->pg_init_required) 1058 } else if (!m->pg_init_required)
@@ -1148,11 +1204,15 @@ static int multipath_status(struct dm_target *ti, status_type_t type,
1148 1204
1149 /* Features */ 1205 /* Features */
1150 if (type == STATUSTYPE_INFO) 1206 if (type == STATUSTYPE_INFO)
1151 DMEMIT("1 %u ", m->queue_size); 1207 DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count);
1152 else if (m->queue_if_no_path) 1208 else {
1153 DMEMIT("1 queue_if_no_path "); 1209 DMEMIT("%u ", m->queue_if_no_path +
1154 else 1210 (m->pg_init_retries > 0) * 2);
1155 DMEMIT("0 "); 1211 if (m->queue_if_no_path)
1212 DMEMIT("queue_if_no_path ");
1213 if (m->pg_init_retries)
1214 DMEMIT("pg_init_retries %u ", m->pg_init_retries);
1215 }
1156 1216
1157 if (hwh->type && hwh->type->status) 1217 if (hwh->type && hwh->type->status)
1158 sz += hwh->type->status(hwh, type, result + sz, maxlen - sz); 1218 sz += hwh->type->status(hwh, type, result + sz, maxlen - sz);
diff --git a/drivers/md/dm-path-selector.c b/drivers/md/dm-path-selector.c
index f10a0c89b3f4..ca1bb636a3e4 100644
--- a/drivers/md/dm-path-selector.c
+++ b/drivers/md/dm-path-selector.c
@@ -94,12 +94,10 @@ out:
94 94
95static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst) 95static struct ps_internal *_alloc_path_selector(struct path_selector_type *pst)
96{ 96{
97 struct ps_internal *psi = kmalloc(sizeof(*psi), GFP_KERNEL); 97 struct ps_internal *psi = kzalloc(sizeof(*psi), GFP_KERNEL);
98 98
99 if (psi) { 99 if (psi)
100 memset(psi, 0, sizeof(*psi));
101 psi->pst = *pst; 100 psi->pst = *pst;
102 }
103 101
104 return psi; 102 return psi;
105} 103}
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index d09ff15490a5..31123d4a6b9c 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -19,6 +19,7 @@
19#include <linux/time.h> 19#include <linux/time.h>
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21#include <linux/workqueue.h> 21#include <linux/workqueue.h>
22#include <linux/log2.h>
22 23
23#define DM_MSG_PREFIX "raid1" 24#define DM_MSG_PREFIX "raid1"
24#define DM_IO_PAGES 64 25#define DM_IO_PAGES 64
@@ -113,6 +114,7 @@ struct region {
113 * Mirror set structures. 114 * Mirror set structures.
114 *---------------------------------------------------------------*/ 115 *---------------------------------------------------------------*/
115struct mirror { 116struct mirror {
117 struct mirror_set *ms;
116 atomic_t error_count; 118 atomic_t error_count;
117 struct dm_dev *dev; 119 struct dm_dev *dev;
118 sector_t offset; 120 sector_t offset;
@@ -974,6 +976,7 @@ static struct mirror_set *alloc_context(unsigned int nr_mirrors,
974 976
975 if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) { 977 if (rh_init(&ms->rh, ms, dl, region_size, ms->nr_regions)) {
976 ti->error = "Error creating dirty region hash"; 978 ti->error = "Error creating dirty region hash";
979 dm_io_client_destroy(ms->io_client);
977 kfree(ms); 980 kfree(ms);
978 return NULL; 981 return NULL;
979 } 982 }
@@ -994,7 +997,7 @@ static void free_context(struct mirror_set *ms, struct dm_target *ti,
994 997
995static inline int _check_region_size(struct dm_target *ti, uint32_t size) 998static inline int _check_region_size(struct dm_target *ti, uint32_t size)
996{ 999{
997 return !(size % (PAGE_SIZE >> 9) || (size & (size - 1)) || 1000 return !(size % (PAGE_SIZE >> 9) || !is_power_of_2(size) ||
998 size > ti->len); 1001 size > ti->len);
999} 1002}
1000 1003
@@ -1015,6 +1018,7 @@ static int get_mirror(struct mirror_set *ms, struct dm_target *ti,
1015 return -ENXIO; 1018 return -ENXIO;
1016 } 1019 }
1017 1020
1021 ms->mirror[mirror].ms = ms;
1018 ms->mirror[mirror].offset = offset; 1022 ms->mirror[mirror].offset = offset;
1019 1023
1020 return 0; 1024 return 0;
@@ -1163,16 +1167,14 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1163 ms->kmirrord_wq = create_singlethread_workqueue("kmirrord"); 1167 ms->kmirrord_wq = create_singlethread_workqueue("kmirrord");
1164 if (!ms->kmirrord_wq) { 1168 if (!ms->kmirrord_wq) {
1165 DMERR("couldn't start kmirrord"); 1169 DMERR("couldn't start kmirrord");
1166 free_context(ms, ti, m); 1170 r = -ENOMEM;
1167 return -ENOMEM; 1171 goto err_free_context;
1168 } 1172 }
1169 INIT_WORK(&ms->kmirrord_work, do_mirror); 1173 INIT_WORK(&ms->kmirrord_work, do_mirror);
1170 1174
1171 r = parse_features(ms, argc, argv, &args_used); 1175 r = parse_features(ms, argc, argv, &args_used);
1172 if (r) { 1176 if (r)
1173 free_context(ms, ti, ms->nr_mirrors); 1177 goto err_destroy_wq;
1174 return r;
1175 }
1176 1178
1177 argv += args_used; 1179 argv += args_used;
1178 argc -= args_used; 1180 argc -= args_used;
@@ -1188,19 +1190,22 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv)
1188 1190
1189 if (argc) { 1191 if (argc) {
1190 ti->error = "Too many mirror arguments"; 1192 ti->error = "Too many mirror arguments";
1191 free_context(ms, ti, ms->nr_mirrors); 1193 r = -EINVAL;
1192 return -EINVAL; 1194 goto err_destroy_wq;
1193 } 1195 }
1194 1196
1195 r = kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client); 1197 r = kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client);
1196 if (r) { 1198 if (r)
1197 destroy_workqueue(ms->kmirrord_wq); 1199 goto err_destroy_wq;
1198 free_context(ms, ti, ms->nr_mirrors);
1199 return r;
1200 }
1201 1200
1202 wake(ms); 1201 wake(ms);
1203 return 0; 1202 return 0;
1203
1204err_destroy_wq:
1205 destroy_workqueue(ms->kmirrord_wq);
1206err_free_context:
1207 free_context(ms, ti, ms->nr_mirrors);
1208 return r;
1204} 1209}
1205 1210
1206static void mirror_dtr(struct dm_target *ti) 1211static void mirror_dtr(struct dm_target *ti)
@@ -1302,7 +1307,7 @@ static void mirror_postsuspend(struct dm_target *ti)
1302 wait_event(_kmirrord_recovery_stopped, 1307 wait_event(_kmirrord_recovery_stopped,
1303 !atomic_read(&ms->rh.recovery_in_flight)); 1308 !atomic_read(&ms->rh.recovery_in_flight));
1304 1309
1305 if (log->type->suspend && log->type->suspend(log)) 1310 if (log->type->postsuspend && log->type->postsuspend(log))
1306 /* FIXME: need better error handling */ 1311 /* FIXME: need better error handling */
1307 DMWARN("log suspend failed"); 1312 DMWARN("log suspend failed");
1308} 1313}
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 98a633f3d6b0..cee16fadd9ee 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
20#include <linux/log2.h>
20 21
21#include "dm-snap.h" 22#include "dm-snap.h"
22#include "dm-bio-list.h" 23#include "dm-bio-list.h"
@@ -415,7 +416,7 @@ static int set_chunk_size(struct dm_snapshot *s, const char *chunk_size_arg,
415 chunk_size = round_up(chunk_size, PAGE_SIZE >> 9); 416 chunk_size = round_up(chunk_size, PAGE_SIZE >> 9);
416 417
417 /* Check chunk_size is a power of 2 */ 418 /* Check chunk_size is a power of 2 */
418 if (chunk_size & (chunk_size - 1)) { 419 if (!is_power_of_2(chunk_size)) {
419 *error = "Chunk size is not a power of 2"; 420 *error = "Chunk size is not a power of 2";
420 return -EINVAL; 421 return -EINVAL;
421 } 422 }
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index 51f5e0760012..969944a8aba2 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -11,6 +11,7 @@
11#include <linux/blkdev.h> 11#include <linux/blkdev.h>
12#include <linux/bio.h> 12#include <linux/bio.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/log2.h>
14 15
15#define DM_MSG_PREFIX "striped" 16#define DM_MSG_PREFIX "striped"
16 17
@@ -99,7 +100,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
99 /* 100 /*
100 * chunk_size is a power of two 101 * chunk_size is a power of two
101 */ 102 */
102 if (!chunk_size || (chunk_size & (chunk_size - 1)) || 103 if (!is_power_of_2(chunk_size) ||
103 (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) { 104 (chunk_size < (PAGE_SIZE >> SECTOR_SHIFT))) {
104 ti->error = "Invalid chunk size"; 105 ti->error = "Invalid chunk size";
105 return -EINVAL; 106 return -EINVAL;
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index fbe477bb2c68..8939e6105088 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -213,12 +213,11 @@ static int alloc_targets(struct dm_table *t, unsigned int num)
213int dm_table_create(struct dm_table **result, int mode, 213int dm_table_create(struct dm_table **result, int mode,
214 unsigned num_targets, struct mapped_device *md) 214 unsigned num_targets, struct mapped_device *md)
215{ 215{
216 struct dm_table *t = kmalloc(sizeof(*t), GFP_KERNEL); 216 struct dm_table *t = kzalloc(sizeof(*t), GFP_KERNEL);
217 217
218 if (!t) 218 if (!t)
219 return -ENOMEM; 219 return -ENOMEM;
220 220
221 memset(t, 0, sizeof(*t));
222 INIT_LIST_HEAD(&t->devices); 221 INIT_LIST_HEAD(&t->devices);
223 atomic_set(&t->holders, 1); 222 atomic_set(&t->holders, 1);
224 223
diff --git a/drivers/md/dm-target.c b/drivers/md/dm-target.c
index 477a041a41cf..835cf95b857f 100644
--- a/drivers/md/dm-target.c
+++ b/drivers/md/dm-target.c
@@ -88,12 +88,10 @@ void dm_put_target_type(struct target_type *t)
88 88
89static struct tt_internal *alloc_target(struct target_type *t) 89static struct tt_internal *alloc_target(struct target_type *t)
90{ 90{
91 struct tt_internal *ti = kmalloc(sizeof(*ti), GFP_KERNEL); 91 struct tt_internal *ti = kzalloc(sizeof(*ti), GFP_KERNEL);
92 92
93 if (ti) { 93 if (ti)
94 memset(ti, 0, sizeof(*ti));
95 ti->tt = *t; 94 ti->tt = *t;
96 }
97 95
98 return ti; 96 return ti;
99} 97}
diff --git a/drivers/md/dm-uevent.c b/drivers/md/dm-uevent.c
new file mode 100644
index 000000000000..50377e5dc2a3
--- /dev/null
+++ b/drivers/md/dm-uevent.c
@@ -0,0 +1,222 @@
1/*
2 * Device Mapper Uevent Support (dm-uevent)
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2007
19 * Author: Mike Anderson <andmike@linux.vnet.ibm.com>
20 */
21#include <linux/list.h>
22#include <linux/slab.h>
23#include <linux/kobject.h>
24#include <linux/dm-ioctl.h>
25
26#include "dm.h"
27#include "dm-uevent.h"
28
29#define DM_MSG_PREFIX "uevent"
30
31static const struct {
32 enum dm_uevent_type type;
33 enum kobject_action action;
34 char *name;
35} _dm_uevent_type_names[] = {
36 {DM_UEVENT_PATH_FAILED, KOBJ_CHANGE, "PATH_FAILED"},
37 {DM_UEVENT_PATH_REINSTATED, KOBJ_CHANGE, "PATH_REINSTATED"},
38};
39
40static struct kmem_cache *_dm_event_cache;
41
42struct dm_uevent {
43 struct mapped_device *md;
44 enum kobject_action action;
45 struct kobj_uevent_env ku_env;
46 struct list_head elist;
47 char name[DM_NAME_LEN];
48 char uuid[DM_UUID_LEN];
49};
50
51static void dm_uevent_free(struct dm_uevent *event)
52{
53 kmem_cache_free(_dm_event_cache, event);
54}
55
56static struct dm_uevent *dm_uevent_alloc(struct mapped_device *md)
57{
58 struct dm_uevent *event;
59
60 event = kmem_cache_zalloc(_dm_event_cache, GFP_ATOMIC);
61 if (!event)
62 return NULL;
63
64 INIT_LIST_HEAD(&event->elist);
65 event->md = md;
66
67 return event;
68}
69
70static struct dm_uevent *dm_build_path_uevent(struct mapped_device *md,
71 struct dm_target *ti,
72 enum kobject_action action,
73 const char *dm_action,
74 const char *path,
75 unsigned nr_valid_paths)
76{
77 struct dm_uevent *event;
78
79 event = dm_uevent_alloc(md);
80 if (!event) {
81 DMERR("%s: dm_uevent_alloc() failed", __FUNCTION__);
82 goto err_nomem;
83 }
84
85 event->action = action;
86
87 if (add_uevent_var(&event->ku_env, "DM_TARGET=%s", ti->type->name)) {
88 DMERR("%s: add_uevent_var() for DM_TARGET failed",
89 __FUNCTION__);
90 goto err_add;
91 }
92
93 if (add_uevent_var(&event->ku_env, "DM_ACTION=%s", dm_action)) {
94 DMERR("%s: add_uevent_var() for DM_ACTION failed",
95 __FUNCTION__);
96 goto err_add;
97 }
98
99 if (add_uevent_var(&event->ku_env, "DM_SEQNUM=%u",
100 dm_next_uevent_seq(md))) {
101 DMERR("%s: add_uevent_var() for DM_SEQNUM failed",
102 __FUNCTION__);
103 goto err_add;
104 }
105
106 if (add_uevent_var(&event->ku_env, "DM_PATH=%s", path)) {
107 DMERR("%s: add_uevent_var() for DM_PATH failed", __FUNCTION__);
108 goto err_add;
109 }
110
111 if (add_uevent_var(&event->ku_env, "DM_NR_VALID_PATHS=%d",
112 nr_valid_paths)) {
113 DMERR("%s: add_uevent_var() for DM_NR_VALID_PATHS failed",
114 __FUNCTION__);
115 goto err_add;
116 }
117
118 return event;
119
120err_add:
121 dm_uevent_free(event);
122err_nomem:
123 return ERR_PTR(-ENOMEM);
124}
125
126/**
127 * dm_send_uevents - send uevents for given list
128 *
129 * @events: list of events to send
130 * @kobj: kobject generating event
131 *
132 */
133void dm_send_uevents(struct list_head *events, struct kobject *kobj)
134{
135 int r;
136 struct dm_uevent *event, *next;
137
138 list_for_each_entry_safe(event, next, events, elist) {
139 list_del_init(&event->elist);
140
141 /*
142 * Need to call dm_copy_name_and_uuid from here for now.
143 * Context of previous var adds and locking used for
144 * hash_cell not compatable.
145 */
146 if (dm_copy_name_and_uuid(event->md, event->name,
147 event->uuid)) {
148 DMERR("%s: dm_copy_name_and_uuid() failed",
149 __FUNCTION__);
150 goto uevent_free;
151 }
152
153 if (add_uevent_var(&event->ku_env, "DM_NAME=%s", event->name)) {
154 DMERR("%s: add_uevent_var() for DM_NAME failed",
155 __FUNCTION__);
156 goto uevent_free;
157 }
158
159 if (add_uevent_var(&event->ku_env, "DM_UUID=%s", event->uuid)) {
160 DMERR("%s: add_uevent_var() for DM_UUID failed",
161 __FUNCTION__);
162 goto uevent_free;
163 }
164
165 r = kobject_uevent_env(kobj, event->action, event->ku_env.envp);
166 if (r)
167 DMERR("%s: kobject_uevent_env failed", __FUNCTION__);
168uevent_free:
169 dm_uevent_free(event);
170 }
171}
172EXPORT_SYMBOL_GPL(dm_send_uevents);
173
174/**
175 * dm_path_uevent - called to create a new path event and queue it
176 *
177 * @event_type: path event type enum
178 * @ti: pointer to a dm_target
179 * @path: string containing pathname
180 * @nr_valid_paths: number of valid paths remaining
181 *
182 */
183void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti,
184 const char *path, unsigned nr_valid_paths)
185{
186 struct mapped_device *md = dm_table_get_md(ti->table);
187 struct dm_uevent *event;
188
189 if (event_type >= ARRAY_SIZE(_dm_uevent_type_names)) {
190 DMERR("%s: Invalid event_type %d", __FUNCTION__, event_type);
191 goto out;
192 }
193
194 event = dm_build_path_uevent(md, ti,
195 _dm_uevent_type_names[event_type].action,
196 _dm_uevent_type_names[event_type].name,
197 path, nr_valid_paths);
198 if (IS_ERR(event))
199 goto out;
200
201 dm_uevent_add(md, &event->elist);
202
203out:
204 dm_put(md);
205}
206EXPORT_SYMBOL_GPL(dm_path_uevent);
207
208int dm_uevent_init(void)
209{
210 _dm_event_cache = KMEM_CACHE(dm_uevent, 0);
211 if (!_dm_event_cache)
212 return -ENOMEM;
213
214 DMINFO("version 1.0.3");
215
216 return 0;
217}
218
219void dm_uevent_exit(void)
220{
221 kmem_cache_destroy(_dm_event_cache);
222}
diff --git a/drivers/md/dm-uevent.h b/drivers/md/dm-uevent.h
new file mode 100644
index 000000000000..2eccc8bd671a
--- /dev/null
+++ b/drivers/md/dm-uevent.h
@@ -0,0 +1,59 @@
1/*
2 * Device Mapper Uevent Support
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2007
19 * Author: Mike Anderson <andmike@linux.vnet.ibm.com>
20 */
21#ifndef DM_UEVENT_H
22#define DM_UEVENT_H
23
24enum dm_uevent_type {
25 DM_UEVENT_PATH_FAILED,
26 DM_UEVENT_PATH_REINSTATED,
27};
28
29#ifdef CONFIG_DM_UEVENT
30
31extern int dm_uevent_init(void);
32extern void dm_uevent_exit(void);
33extern void dm_send_uevents(struct list_head *events, struct kobject *kobj);
34extern void dm_path_uevent(enum dm_uevent_type event_type,
35 struct dm_target *ti, const char *path,
36 unsigned nr_valid_paths);
37
38#else
39
40static inline int dm_uevent_init(void)
41{
42 return 0;
43}
44static inline void dm_uevent_exit(void)
45{
46}
47static inline void dm_send_uevents(struct list_head *events,
48 struct kobject *kobj)
49{
50}
51static inline void dm_path_uevent(enum dm_uevent_type event_type,
52 struct dm_target *ti, const char *path,
53 unsigned nr_valid_paths)
54{
55}
56
57#endif /* CONFIG_DM_UEVENT */
58
59#endif /* DM_UEVENT_H */
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index d837d37f6209..07cbbb8eb3e0 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -7,6 +7,7 @@
7 7
8#include "dm.h" 8#include "dm.h"
9#include "dm-bio-list.h" 9#include "dm-bio-list.h"
10#include "dm-uevent.h"
10 11
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/module.h> 13#include <linux/module.h>
@@ -112,6 +113,9 @@ struct mapped_device {
112 */ 113 */
113 atomic_t event_nr; 114 atomic_t event_nr;
114 wait_queue_head_t eventq; 115 wait_queue_head_t eventq;
116 atomic_t uevent_seq;
117 struct list_head uevent_list;
118 spinlock_t uevent_lock; /* Protect access to uevent_list */
115 119
116 /* 120 /*
117 * freeze/thaw support require holding onto a super block 121 * freeze/thaw support require holding onto a super block
@@ -143,11 +147,19 @@ static int __init local_init(void)
143 return -ENOMEM; 147 return -ENOMEM;
144 } 148 }
145 149
150 r = dm_uevent_init();
151 if (r) {
152 kmem_cache_destroy(_tio_cache);
153 kmem_cache_destroy(_io_cache);
154 return r;
155 }
156
146 _major = major; 157 _major = major;
147 r = register_blkdev(_major, _name); 158 r = register_blkdev(_major, _name);
148 if (r < 0) { 159 if (r < 0) {
149 kmem_cache_destroy(_tio_cache); 160 kmem_cache_destroy(_tio_cache);
150 kmem_cache_destroy(_io_cache); 161 kmem_cache_destroy(_io_cache);
162 dm_uevent_exit();
151 return r; 163 return r;
152 } 164 }
153 165
@@ -162,6 +174,7 @@ static void local_exit(void)
162 kmem_cache_destroy(_tio_cache); 174 kmem_cache_destroy(_tio_cache);
163 kmem_cache_destroy(_io_cache); 175 kmem_cache_destroy(_io_cache);
164 unregister_blkdev(_major, _name); 176 unregister_blkdev(_major, _name);
177 dm_uevent_exit();
165 178
166 _major = 0; 179 _major = 0;
167 180
@@ -751,15 +764,13 @@ static void __clone_and_map(struct clone_info *ci)
751/* 764/*
752 * Split the bio into several clones. 765 * Split the bio into several clones.
753 */ 766 */
754static void __split_bio(struct mapped_device *md, struct bio *bio) 767static int __split_bio(struct mapped_device *md, struct bio *bio)
755{ 768{
756 struct clone_info ci; 769 struct clone_info ci;
757 770
758 ci.map = dm_get_table(md); 771 ci.map = dm_get_table(md);
759 if (!ci.map) { 772 if (unlikely(!ci.map))
760 bio_io_error(bio); 773 return -EIO;
761 return;
762 }
763 774
764 ci.md = md; 775 ci.md = md;
765 ci.bio = bio; 776 ci.bio = bio;
@@ -779,6 +790,8 @@ static void __split_bio(struct mapped_device *md, struct bio *bio)
779 /* drop the extra reference count */ 790 /* drop the extra reference count */
780 dec_pending(ci.io, 0); 791 dec_pending(ci.io, 0);
781 dm_table_put(ci.map); 792 dm_table_put(ci.map);
793
794 return 0;
782} 795}
783/*----------------------------------------------------------------- 796/*-----------------------------------------------------------------
784 * CRUD END 797 * CRUD END
@@ -790,7 +803,7 @@ static void __split_bio(struct mapped_device *md, struct bio *bio)
790 */ 803 */
791static int dm_request(struct request_queue *q, struct bio *bio) 804static int dm_request(struct request_queue *q, struct bio *bio)
792{ 805{
793 int r; 806 int r = -EIO;
794 int rw = bio_data_dir(bio); 807 int rw = bio_data_dir(bio);
795 struct mapped_device *md = q->queuedata; 808 struct mapped_device *md = q->queuedata;
796 809
@@ -815,18 +828,11 @@ static int dm_request(struct request_queue *q, struct bio *bio)
815 while (test_bit(DMF_BLOCK_IO, &md->flags)) { 828 while (test_bit(DMF_BLOCK_IO, &md->flags)) {
816 up_read(&md->io_lock); 829 up_read(&md->io_lock);
817 830
818 if (bio_rw(bio) == READA) { 831 if (bio_rw(bio) != READA)
819 bio_io_error(bio); 832 r = queue_io(md, bio);
820 return 0;
821 }
822
823 r = queue_io(md, bio);
824 if (r < 0) {
825 bio_io_error(bio);
826 return 0;
827 833
828 } else if (r == 0) 834 if (r <= 0)
829 return 0; /* deferred successfully */ 835 goto out_req;
830 836
831 /* 837 /*
832 * We're in a while loop, because someone could suspend 838 * We're in a while loop, because someone could suspend
@@ -835,8 +841,13 @@ static int dm_request(struct request_queue *q, struct bio *bio)
835 down_read(&md->io_lock); 841 down_read(&md->io_lock);
836 } 842 }
837 843
838 __split_bio(md, bio); 844 r = __split_bio(md, bio);
839 up_read(&md->io_lock); 845 up_read(&md->io_lock);
846
847out_req:
848 if (r < 0)
849 bio_io_error(bio);
850
840 return 0; 851 return 0;
841} 852}
842 853
@@ -977,6 +988,9 @@ static struct mapped_device *alloc_dev(int minor)
977 atomic_set(&md->holders, 1); 988 atomic_set(&md->holders, 1);
978 atomic_set(&md->open_count, 0); 989 atomic_set(&md->open_count, 0);
979 atomic_set(&md->event_nr, 0); 990 atomic_set(&md->event_nr, 0);
991 atomic_set(&md->uevent_seq, 0);
992 INIT_LIST_HEAD(&md->uevent_list);
993 spin_lock_init(&md->uevent_lock);
980 994
981 md->queue = blk_alloc_queue(GFP_KERNEL); 995 md->queue = blk_alloc_queue(GFP_KERNEL);
982 if (!md->queue) 996 if (!md->queue)
@@ -1044,12 +1058,14 @@ static struct mapped_device *alloc_dev(int minor)
1044 return NULL; 1058 return NULL;
1045} 1059}
1046 1060
1061static void unlock_fs(struct mapped_device *md);
1062
1047static void free_dev(struct mapped_device *md) 1063static void free_dev(struct mapped_device *md)
1048{ 1064{
1049 int minor = md->disk->first_minor; 1065 int minor = md->disk->first_minor;
1050 1066
1051 if (md->suspended_bdev) { 1067 if (md->suspended_bdev) {
1052 thaw_bdev(md->suspended_bdev, NULL); 1068 unlock_fs(md);
1053 bdput(md->suspended_bdev); 1069 bdput(md->suspended_bdev);
1054 } 1070 }
1055 mempool_destroy(md->tio_pool); 1071 mempool_destroy(md->tio_pool);
@@ -1073,8 +1089,16 @@ static void free_dev(struct mapped_device *md)
1073 */ 1089 */
1074static void event_callback(void *context) 1090static void event_callback(void *context)
1075{ 1091{
1092 unsigned long flags;
1093 LIST_HEAD(uevents);
1076 struct mapped_device *md = (struct mapped_device *) context; 1094 struct mapped_device *md = (struct mapped_device *) context;
1077 1095
1096 spin_lock_irqsave(&md->uevent_lock, flags);
1097 list_splice_init(&md->uevent_list, &uevents);
1098 spin_unlock_irqrestore(&md->uevent_lock, flags);
1099
1100 dm_send_uevents(&uevents, &md->disk->kobj);
1101
1078 atomic_inc(&md->event_nr); 1102 atomic_inc(&md->event_nr);
1079 wake_up(&md->eventq); 1103 wake_up(&md->eventq);
1080} 1104}
@@ -1233,7 +1257,8 @@ static void __flush_deferred_io(struct mapped_device *md, struct bio *c)
1233 while (c) { 1257 while (c) {
1234 n = c->bi_next; 1258 n = c->bi_next;
1235 c->bi_next = NULL; 1259 c->bi_next = NULL;
1236 __split_bio(md, c); 1260 if (__split_bio(md, c))
1261 bio_io_error(c);
1237 c = n; 1262 c = n;
1238 } 1263 }
1239} 1264}
@@ -1491,6 +1516,11 @@ out:
1491/*----------------------------------------------------------------- 1516/*-----------------------------------------------------------------
1492 * Event notification. 1517 * Event notification.
1493 *---------------------------------------------------------------*/ 1518 *---------------------------------------------------------------*/
1519uint32_t dm_next_uevent_seq(struct mapped_device *md)
1520{
1521 return atomic_add_return(1, &md->uevent_seq);
1522}
1523
1494uint32_t dm_get_event_nr(struct mapped_device *md) 1524uint32_t dm_get_event_nr(struct mapped_device *md)
1495{ 1525{
1496 return atomic_read(&md->event_nr); 1526 return atomic_read(&md->event_nr);
@@ -1502,6 +1532,15 @@ int dm_wait_event(struct mapped_device *md, int event_nr)
1502 (event_nr != atomic_read(&md->event_nr))); 1532 (event_nr != atomic_read(&md->event_nr)));
1503} 1533}
1504 1534
1535void dm_uevent_add(struct mapped_device *md, struct list_head *elist)
1536{
1537 unsigned long flags;
1538
1539 spin_lock_irqsave(&md->uevent_lock, flags);
1540 list_add(elist, &md->uevent_list);
1541 spin_unlock_irqrestore(&md->uevent_lock, flags);
1542}
1543
1505/* 1544/*
1506 * The gendisk is only valid as long as you have a reference 1545 * The gendisk is only valid as long as you have a reference
1507 * count on 'md'. 1546 * count on 'md'.
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c
index 7e052378c47e..f3831f31223e 100644
--- a/drivers/md/kcopyd.c
+++ b/drivers/md/kcopyd.c
@@ -198,7 +198,7 @@ struct kcopyd_job {
198 * These fields are only used if the job has been split 198 * These fields are only used if the job has been split
199 * into more manageable parts. 199 * into more manageable parts.
200 */ 200 */
201 struct semaphore lock; 201 struct mutex lock;
202 atomic_t sub_jobs; 202 atomic_t sub_jobs;
203 sector_t progress; 203 sector_t progress;
204}; 204};
@@ -456,7 +456,7 @@ static void segment_complete(int read_err,
456 sector_t count = 0; 456 sector_t count = 0;
457 struct kcopyd_job *job = (struct kcopyd_job *) context; 457 struct kcopyd_job *job = (struct kcopyd_job *) context;
458 458
459 down(&job->lock); 459 mutex_lock(&job->lock);
460 460
461 /* update the error */ 461 /* update the error */
462 if (read_err) 462 if (read_err)
@@ -480,7 +480,7 @@ static void segment_complete(int read_err,
480 job->progress += count; 480 job->progress += count;
481 } 481 }
482 } 482 }
483 up(&job->lock); 483 mutex_unlock(&job->lock);
484 484
485 if (count) { 485 if (count) {
486 int i; 486 int i;
@@ -562,7 +562,7 @@ int kcopyd_copy(struct kcopyd_client *kc, struct io_region *from,
562 dispatch_job(job); 562 dispatch_job(job);
563 563
564 else { 564 else {
565 init_MUTEX(&job->lock); 565 mutex_init(&job->lock);
566 job->progress = 0; 566 job->progress = 0;
567 split_job(job); 567 split_job(job);
568 } 568 }
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c059ae6f37e5..808cd9549456 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4717,7 +4717,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
4717 4717
4718void md_unregister_thread(mdk_thread_t *thread) 4718void md_unregister_thread(mdk_thread_t *thread)
4719{ 4719{
4720 dprintk("interrupting MD-thread pid %d\n", thread->tsk->pid); 4720 dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
4721 4721
4722 kthread_stop(thread->tsk); 4722 kthread_stop(thread->tsk);
4723 kfree(thread); 4723 kfree(thread);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 16775a0df7f6..85478d6a9c1a 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -9,7 +9,7 @@
9 * 9 *
10 * Better read-balancing code written by Mika Kuoppala <miku@iki.fi>, 2000 10 * Better read-balancing code written by Mika Kuoppala <miku@iki.fi>, 2000
11 * 11 *
12 * Fixes to reconstruction by Jakob Østergaard" <jakob@ostenfeld.dk> 12 * Fixes to reconstruction by Jakob Østergaard" <jakob@ostenfeld.dk>
13 * Various fixes by Neil Brown <neilb@cse.unsw.edu.au> 13 * Various fixes by Neil Brown <neilb@cse.unsw.edu.au>
14 * 14 *
15 * Changes by Peter T. Breuer <ptb@it.uc3m.es> 31/1/2003 to support 15 * Changes by Peter T. Breuer <ptb@it.uc3m.es> 31/1/2003 to support
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c
index d2905720eb74..9c905399a233 100644
--- a/drivers/media/common/saa7146_hlp.c
+++ b/drivers/media/common/saa7146_hlp.c
@@ -312,7 +312,7 @@ static int sort_and_eliminate(u32* values, int* count)
312 return -EINVAL; 312 return -EINVAL;
313 } 313 }
314 314
315 /* bubble sort the first ´count´ items of the array ´values´ */ 315 /* bubble sort the first @count items of the array @values */
316 for( top = *count; top > 0; top--) { 316 for( top = *count; top > 0; top--) {
317 for( low = 0, high = 1; high < top; low++, high++) { 317 for( low = 0, high = 1; high < top; low++, high++) {
318 if( values[low] > values[high] ) { 318 if( values[low] > values[high] ) {
diff --git a/drivers/media/dvb/bt8xx/bt878.c b/drivers/media/dvb/bt8xx/bt878.c
index eca602d9b3de..85e36a1d6d78 100644
--- a/drivers/media/dvb/bt8xx/bt878.c
+++ b/drivers/media/dvb/bt8xx/bt878.c
@@ -280,7 +280,7 @@ static irqreturn_t bt878_irq(int irq, void *dev_id)
280 if (!(astat = (stat & mask))) 280 if (!(astat = (stat & mask)))
281 return IRQ_NONE; /* this interrupt is not for me */ 281 return IRQ_NONE; /* this interrupt is not for me */
282/* dprintk("bt878(%d) debug: irq count %d, stat 0x%8.8x, mask 0x%8.8x\n",bt->nr,count,stat,mask); */ 282/* dprintk("bt878(%d) debug: irq count %d, stat 0x%8.8x, mask 0x%8.8x\n",bt->nr,count,stat,mask); */
283 btwrite(astat, BT878_AINT_STAT); /* try to clear interupt condition */ 283 btwrite(astat, BT878_AINT_STAT); /* try to clear interrupt condition */
284 284
285 285
286 if (astat & (BT878_ASCERR | BT878_AOCERR)) { 286 if (astat & (BT878_ASCERR | BT878_AOCERR)) {
diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c
index 5a12b5679556..a05e5c182288 100644
--- a/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * TerraTec Cinergy T²/qanu USB2 DVB-T adapter. 2 * TerraTec Cinergy T²/qanu USB2 DVB-T adapter.
3 * 3 *
4 * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and 4 * Copyright (C) 2004 Daniel Mack <daniel@qanu.de> and
5 * Holger Waechtler <holger@qanu.de> 5 * Holger Waechtler <holger@qanu.de>
@@ -820,7 +820,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2)
820 820
821 input_dev->name = DRIVER_NAME " remote control"; 821 input_dev->name = DRIVER_NAME " remote control";
822 input_dev->phys = cinergyt2->phys; 822 input_dev->phys = cinergyt2->phys;
823 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); 823 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
824 for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3) 824 for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3)
825 set_bit(rc_keys[i + 2], input_dev->keybit); 825 set_bit(rc_keys[i + 2], input_dev->keybit);
826 input_dev->keycodesize = 0; 826 input_dev->keycodesize = 0;
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index b203640ef1c5..445f02665577 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -527,7 +527,8 @@ static int dvb_frontend_thread(void *data)
527 up(&fepriv->sem); /* is locked when we enter the thread... */ 527 up(&fepriv->sem); /* is locked when we enter the thread... */
528restart: 528restart:
529 timeout = wait_event_interruptible_timeout(fepriv->wait_queue, 529 timeout = wait_event_interruptible_timeout(fepriv->wait_queue,
530 dvb_frontend_should_wakeup(fe) || kthread_should_stop(), 530 dvb_frontend_should_wakeup(fe) || kthread_should_stop()
531 || freezing(current),
531 fepriv->delay); 532 fepriv->delay);
532 533
533 if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { 534 if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index 7b9f35bfb4f0..c0c2c22ddd83 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -106,7 +106,7 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
106 if (!input_dev) 106 if (!input_dev)
107 return -ENOMEM; 107 return -ENOMEM;
108 108
109 input_dev->evbit[0] = BIT(EV_KEY); 109 input_dev->evbit[0] = BIT_MASK(EV_KEY);
110 input_dev->name = "IR-receiver inside an USB DVB receiver"; 110 input_dev->name = "IR-receiver inside an USB DVB receiver";
111 input_dev->phys = d->rc_phys; 111 input_dev->phys = d->rc_phys;
112 usb_to_input_id(d->udev, &input_dev->id); 112 usb_to_input_id(d->udev, &input_dev->id);
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c
index 5d19c402dad1..a283e1de83fa 100644
--- a/drivers/media/dvb/ttpci/av7110_ir.c
+++ b/drivers/media/dvb/ttpci/av7110_ir.c
@@ -27,7 +27,7 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/proc_fs.h> 28#include <linux/proc_fs.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <asm/bitops.h> 30#include <linux/bitops.h>
31 31
32#include "av7110.h" 32#include "av7110.h"
33#include "av7110_hw.h" 33#include "av7110_hw.h"
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 288e79f2cb0f..7902ae1d9a18 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -128,7 +128,7 @@ struct ttusb {
128 struct dvb_frontend* fe; 128 struct dvb_frontend* fe;
129}; 129};
130 130
131/* ugly workaround ... don't know why it's neccessary to read */ 131/* ugly workaround ... don't know why it's necessary to read */
132/* all result codes. */ 132/* all result codes. */
133 133
134#define DEBUG 0 134#define DEBUG 0
diff --git a/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
index 5e691fd79904..1ec981d98b91 100644
--- a/drivers/media/dvb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/dvb/ttusb-dec/ttusb_dec.c
@@ -1198,7 +1198,7 @@ static int ttusb_init_rc( struct ttusb_dec *dec)
1198 1198
1199 input_dev->name = "ttusb_dec remote control"; 1199 input_dev->name = "ttusb_dec remote control";
1200 input_dev->phys = dec->rc_phys; 1200 input_dev->phys = dec->rc_phys;
1201 input_dev->evbit[0] = BIT(EV_KEY); 1201 input_dev->evbit[0] = BIT_MASK(EV_KEY);
1202 input_dev->keycodesize = sizeof(u16); 1202 input_dev->keycodesize = sizeof(u16);
1203 input_dev->keycodemax = 0x1a; 1203 input_dev->keycodemax = 0x1a;
1204 input_dev->keycode = rc_keys; 1204 input_dev->keycode = rc_keys;
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index dd6a7d68b07f..3abd9fa54d2c 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -1259,7 +1259,7 @@ struct tvcard bttv_tvcards[] = {
1259 .has_radio = 1, 1259 .has_radio = 1,
1260 }, 1260 },
1261 [BTTV_BOARD_LIFETEC_9415] = { 1261 [BTTV_BOARD_LIFETEC_9415] = {
1262 /* Tim Röstermundt <rosterm@uni-muenster.de> 1262 /* Tim Röstermundt <rosterm@uni-muenster.de>
1263 in de.comp.os.unix.linux.hardware: 1263 in de.comp.os.unix.linux.hardware:
1264 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 1264 options bttv card=0 pll=1 radio=1 gpiomask=0x18e0
1265 gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff 1265 gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff
@@ -2824,7 +2824,7 @@ struct tvcard bttv_tvcards[] = {
2824 }, 2824 },
2825 /* ---- card 0x8b ---------------------------------- */ 2825 /* ---- card 0x8b ---------------------------------- */
2826 [BTTV_BOARD_PV_M4900] = { 2826 [BTTV_BOARD_PV_M4900] = {
2827 /* Sérgio Fortier <sergiofortier@yahoo.com.br> */ 2827 /* Sérgio Fortier <sergiofortier@yahoo.com.br> */
2828 .name = "Prolink PixelView PlayTV MPEG2 PV-M4900", 2828 .name = "Prolink PixelView PlayTV MPEG2 PV-M4900",
2829 .video_inputs = 3, 2829 .video_inputs = 3,
2830 .audio_inputs = 1, 2830 .audio_inputs = 1,
@@ -4709,18 +4709,18 @@ adtvk503_audio(struct bttv *btv, struct video_audio *v, int set)
4709 * 4709 *
4710 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin. 4710 * The board hardwire Y0 (xpoint) to MUX1 and MUXOUT to Yin.
4711 * GPIO pins are wired as: 4711 * GPIO pins are wired as:
4712 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroler) 4712 * GPIO[0:3] - AX[0:3] (xpoint) - P1[0:3] (microcontroller)
4713 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroler) 4713 * GPIO[4:6] - AY[0:2] (xpoint) - P1[4:6] (microcontroller)
4714 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroler) 4714 * GPIO[7] - DATA (xpoint) - P1[7] (microcontroller)
4715 * GPIO[8] - - P3[5] (microcontroler) 4715 * GPIO[8] - - P3[5] (microcontroller)
4716 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroler) 4716 * GPIO[9] - RESET (xpoint) - P3[6] (microcontroller)
4717 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroler) 4717 * GPIO[10] - STROBE (xpoint) - P3[7] (microcontroller)
4718 * GPINTR - - P3[4] (microcontroler) 4718 * GPINTR - - P3[4] (microcontroller)
4719 * 4719 *
4720 * The microcontroler is a 80C32 like. It should be possible to change xpoint 4720 * The microcontroller is a 80C32 like. It should be possible to change xpoint
4721 * configuration either directly (as we are doing) or using the microcontroler 4721 * configuration either directly (as we are doing) or using the microcontroller
4722 * which is also wired to I2C interface. I have no further info on the 4722 * which is also wired to I2C interface. I have no further info on the
4723 * microcontroler features, one would need to disassembly the firmware. 4723 * microcontroller features, one would need to disassembly the firmware.
4724 * note: the vendor refused to give any information on this product, all 4724 * note: the vendor refused to give any information on this product, all
4725 * that stuff was found using a multimeter! :) 4725 * that stuff was found using a multimeter! :)
4726 */ 4726 */
@@ -4788,7 +4788,7 @@ static void tibetCS16_init(struct bttv *btv)
4788 * The analog switch is controlled by the "master", but the detection order 4788 * The analog switch is controlled by the "master", but the detection order
4789 * of the four BT878A chips is in an order which I just don't understand. 4789 * of the four BT878A chips is in an order which I just don't understand.
4790 * The "master" is actually the second controller to be detected. The 4790 * The "master" is actually the second controller to be detected. The
4791 * logic on the board uses logical numbers for the 4 controlers, but 4791 * logic on the board uses logical numbers for the 4 controllers, but
4792 * those numbers are different from the detection sequence. When working 4792 * those numbers are different from the detection sequence. When working
4793 * with the analog switch, we need to "map" from the detection sequence 4793 * with the analog switch, we need to "map" from the detection sequence
4794 * over to the board's logical controller number. This mapping sequence 4794 * over to the board's logical controller number. This mapping sequence
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index b8d5327c438d..e467682aabd7 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -907,7 +907,7 @@ static int em28xx_set_fmt(struct em28xx *dev, unsigned int cmd, struct v4l2_form
907 907
908 /* stop io in case it is already in progress */ 908 /* stop io in case it is already in progress */
909 if (dev->stream == STREAM_ON) { 909 if (dev->stream == STREAM_ON) {
910 em28xx_videodbg("VIDIOC_SET_FMT: interupting stream\n"); 910 em28xx_videodbg("VIDIOC_SET_FMT: interrupting stream\n");
911 if ((ret = em28xx_stream_interrupt(dev))) 911 if ((ret = em28xx_stream_interrupt(dev)))
912 return ret; 912 return ret;
913 } 913 }
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index 7533fc203319..69283926a8dc 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net> 4 * Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net>
5 * 5 *
6 * Copyright (C) 2001-2002 Alcôve <www.alcove.com> 6 * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
7 * 7 *
8 * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com> 8 * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com>
9 * 9 *
diff --git a/drivers/media/video/meye.h b/drivers/media/video/meye.h
index 323d0074120d..d535748df445 100644
--- a/drivers/media/video/meye.h
+++ b/drivers/media/video/meye.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net> 4 * Copyright (C) 2001-2004 Stelian Pop <stelian@popies.net>
5 * 5 *
6 * Copyright (C) 2001-2002 Alcôve <www.alcove.com> 6 * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
7 * 7 *
8 * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com> 8 * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com>
9 * 9 *
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index e20aa3612a7c..ad0232935df6 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -196,10 +196,10 @@ static int i2c_senddata(struct saa5246a_device *t, ...)
196 return i2c_sendbuf(t, buf[0], ct-1, buf+1); 196 return i2c_sendbuf(t, buf[0], ct-1, buf+1);
197} 197}
198 198
199/* Get count number of bytes from I²C-device at address adr, store them in buf. 199/* Get count number of bytes from I²C-device at address adr, store them in buf.
200 * Start & stop handshaking is done by this routine, ack will be sent after the 200 * Start & stop handshaking is done by this routine, ack will be sent after the
201 * last byte to inhibit further sending of data. If uaccess is 'true', data is 201 * last byte to inhibit further sending of data. If uaccess is 'true', data is
202 * written to user-space with put_user. Returns -1 if I²C-device didn't send 202 * written to user-space with put_user. Returns -1 if I²C-device didn't send
203 * acknowledge, 0 otherwise 203 * acknowledge, 0 otherwise
204 */ 204 */
205static int i2c_getdata(struct saa5246a_device *t, int count, u8 *buf) 205static int i2c_getdata(struct saa5246a_device *t, int count, u8 *buf)
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 17f1e2e9a66b..94bb59a32b17 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -291,10 +291,10 @@ static int i2c_senddata(struct saa5249_device *t, ...)
291 return i2c_sendbuf(t, buf[0], ct-1, buf+1); 291 return i2c_sendbuf(t, buf[0], ct-1, buf+1);
292} 292}
293 293
294/* Get count number of bytes from I²C-device at address adr, store them in buf. Start & stop 294/* Get count number of bytes from I²C-device at address adr, store them in buf. Start & stop
295 * handshaking is done by this routine, ack will be sent after the last byte to inhibit further 295 * handshaking is done by this routine, ack will be sent after the last byte to inhibit further
296 * sending of data. If uaccess is 'true', data is written to user-space with put_user. 296 * sending of data. If uaccess is 'true', data is written to user-space with put_user.
297 * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise 297 * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise
298 */ 298 */
299 299
300static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) 300static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf)
diff --git a/drivers/media/video/usbvideo/konicawc.c b/drivers/media/video/usbvideo/konicawc.c
index 491505d6fdee..3e93f8058770 100644
--- a/drivers/media/video/usbvideo/konicawc.c
+++ b/drivers/media/video/usbvideo/konicawc.c
@@ -238,8 +238,8 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev
238 usb_to_input_id(dev, &input_dev->id); 238 usb_to_input_id(dev, &input_dev->id);
239 input_dev->dev.parent = &dev->dev; 239 input_dev->dev.parent = &dev->dev;
240 240
241 input_dev->evbit[0] = BIT(EV_KEY); 241 input_dev->evbit[0] = BIT_MASK(EV_KEY);
242 input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); 242 input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
243 243
244 input_dev->private = cam; 244 input_dev->private = cam;
245 245
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c
index dd1a6d6bbc9e..d847273eeba0 100644
--- a/drivers/media/video/usbvideo/quickcam_messenger.c
+++ b/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -102,8 +102,8 @@ static void qcm_register_input(struct qcm *cam, struct usb_device *dev)
102 usb_to_input_id(dev, &input_dev->id); 102 usb_to_input_id(dev, &input_dev->id);
103 input_dev->dev.parent = &dev->dev; 103 input_dev->dev.parent = &dev->dev;
104 104
105 input_dev->evbit[0] = BIT(EV_KEY); 105 input_dev->evbit[0] = BIT_MASK(EV_KEY);
106 input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); 106 input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0);
107 107
108 input_dev->private = cam; 108 input_dev->private = cam;
109 109
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index ff555129c82f..db3c9e3deb26 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -955,7 +955,7 @@ read_frame(struct vicam_camera *cam, int framenum)
955 request[7] = realShutter >> 8; 955 request[7] = realShutter >> 8;
956 } 956 }
957 957
958 // Per John Markus Bjørndalen, byte at index 8 causes problems if it isn't 0 958 // Per John Markus Bjørndalen, byte at index 8 causes problems if it isn't 0
959 request[8] = 0; 959 request[8] = 0;
960 // bytes 9-15 do not seem to affect exposure or image quality 960 // bytes 9-15 do not seem to affect exposure or image quality
961 961
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index 9eac65f34bff..dcf22a3b672a 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -144,7 +144,7 @@ const static unsigned int palette2pixelformat[] = {
144 [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P, 144 [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P,
145}; 145};
146 146
147static unsigned int __attribute_pure__ 147static unsigned int __pure
148palette_to_pixelformat(unsigned int palette) 148palette_to_pixelformat(unsigned int palette)
149{ 149{
150 if (palette < ARRAY_SIZE(palette2pixelformat)) 150 if (palette < ARRAY_SIZE(palette2pixelformat))
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index c3440b280d20..321249240d05 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -37,7 +37,7 @@
37 * Video4linux 1/2 integration by Justin Schoeman 37 * Video4linux 1/2 integration by Justin Schoeman
38 * <justin@suntiger.ee.up.ac.za> 38 * <justin@suntiger.ee.up.ac.za>
39 * 2.4 PROCFS support ported from 2.4 kernels by 39 * 2.4 PROCFS support ported from 2.4 kernels by
40 * Iñaki García Etxebarria <garetxe@euskalnet.net> 40 * Iñaki García Etxebarria <garetxe@euskalnet.net>
41 * Makefile fix by "W. Michael Petullo" <mike@flyn.org> 41 * Makefile fix by "W. Michael Petullo" <mike@flyn.org>
42 * 2.4 devfs support ported from 2.4 kernels by 42 * 2.4 devfs support ported from 2.4 kernels by
43 * Dan Merillat <dan@merillat.org> 43 * Dan Merillat <dan@merillat.org>
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index 1c14fa2bd411..419e5af78533 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -1285,7 +1285,7 @@ zoran_open (struct inode *inode,
1285 } 1285 }
1286 1286
1287 dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n", 1287 dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n",
1288 ZR_DEVNAME(zr), current->comm, current->pid, zr->user); 1288 ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
1289 1289
1290 /* now, create the open()-specific file_ops struct */ 1290 /* now, create the open()-specific file_ops struct */
1291 fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL); 1291 fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);
@@ -1358,7 +1358,7 @@ zoran_close (struct inode *inode,
1358 struct zoran *zr = fh->zr; 1358 struct zoran *zr = fh->zr;
1359 1359
1360 dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n", 1360 dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n",
1361 ZR_DEVNAME(zr), current->comm, current->pid, zr->user); 1361 ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
1362 1362
1363 /* kernel locks (fs/device.c), so don't do that ourselves 1363 /* kernel locks (fs/device.c), so don't do that ourselves
1364 * (prevents deadlocks) */ 1364 * (prevents deadlocks) */
diff --git a/drivers/message/i2o/README b/drivers/message/i2o/README
index a81f851f7b5d..911fc3021e3b 100644
--- a/drivers/message/i2o/README
+++ b/drivers/message/i2o/README
@@ -30,13 +30,13 @@ Juha Sievanen, University of Helsinki Finland
30 Bug fixes 30 Bug fixes
31 Core code extensions 31 Core code extensions
32 32
33Auvo Häkkinen, University of Helsinki Finland 33Auvo Häkkinen, University of Helsinki Finland
34 LAN OSM code 34 LAN OSM code
35 /Proc interface to LAN class 35 /Proc interface to LAN class
36 Bug fixes 36 Bug fixes
37 Core code extensions 37 Core code extensions
38 38
39Taneli Vähäkangas, University of Helsinki Finland 39Taneli Vähäkangas, University of Helsinki Finland
40 Fixes to i2o_config 40 Fixes to i2o_config
41 41
42CREDITS 42CREDITS
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index ce8f1a34ed21..6cbcc21de518 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -15,8 +15,8 @@
15 * 15 *
16 * Fixes/additions: 16 * Fixes/additions:
17 * Philipp Rumpf 17 * Philipp Rumpf
18 * Juha Sievänen <Juha.Sievanen@cs.Helsinki.FI> 18 * Juha Sievänen <Juha.Sievanen@cs.Helsinki.FI>
19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI> 19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI>
20 * Deepak Saxena <deepak@plexity.net> 20 * Deepak Saxena <deepak@plexity.net>
21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com> 21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com>
22 * Alan Cox <alan@redhat.com>: 22 * Alan Cox <alan@redhat.com>:
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 84e046e94f5f..c0fb77dc19bb 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -10,12 +10,12 @@
10 * Added basic ioctl() support 10 * Added basic ioctl() support
11 * Deepak Saxena (06/07/1999): 11 * Deepak Saxena (06/07/1999):
12 * Added software download ioctl (still testing) 12 * Added software download ioctl (still testing)
13 * Auvo Häkkinen (09/10/1999): 13 * Auvo Häkkinen (09/10/1999):
14 * Changes to i2o_cfg_reply(), ioctl_parms() 14 * Changes to i2o_cfg_reply(), ioctl_parms()
15 * Added ioct_validate() 15 * Added ioct_validate()
16 * Taneli Vähäkangas (09/30/1999): 16 * Taneli Vähäkangas (09/30/1999):
17 * Fixed ioctl_swdl() 17 * Fixed ioctl_swdl()
18 * Taneli Vähäkangas (10/04/1999): 18 * Taneli Vähäkangas (10/04/1999):
19 * Changed ioctl_swdl(), implemented ioctl_swul() and ioctl_swdel() 19 * Changed ioctl_swdl(), implemented ioctl_swul() and ioctl_swdel()
20 * Deepak Saxena (11/18/1999): 20 * Deepak Saxena (11/18/1999):
21 * Added event managmenet support 21 * Added event managmenet support
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 06892ac2286e..6fdd072201f9 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -19,8 +19,8 @@
19 * 19 *
20 * 20 *
21 * Fixes/additions: 21 * Fixes/additions:
22 * Juha Sievänen (Juha.Sievanen@cs.Helsinki.FI), 22 * Juha Sievänen (Juha.Sievanen@cs.Helsinki.FI),
23 * Auvo Häkkinen (Auvo.Hakkinen@cs.Helsinki.FI) 23 * Auvo Häkkinen (Auvo.Hakkinen@cs.Helsinki.FI)
24 * University of Helsinki, Department of Computer Science 24 * University of Helsinki, Department of Computer Science
25 * LAN entries 25 * LAN entries
26 * Markus Lidel <Markus.Lidel@shadowconnect.com> 26 * Markus Lidel <Markus.Lidel@shadowconnect.com>
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index a1ec16a075c6..7814a06ae970 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -15,8 +15,8 @@
15 * 15 *
16 * Fixes/additions: 16 * Fixes/additions:
17 * Philipp Rumpf 17 * Philipp Rumpf
18 * Juha Sievänen <Juha.Sievanen@cs.Helsinki.FI> 18 * Juha Sievänen <Juha.Sievanen@cs.Helsinki.FI>
19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI> 19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI>
20 * Deepak Saxena <deepak@plexity.net> 20 * Deepak Saxena <deepak@plexity.net>
21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com> 21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com>
22 * Alan Cox <alan@redhat.com>: 22 * Alan Cox <alan@redhat.com>:
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 3661e6e065d2..685a89547a51 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -15,8 +15,8 @@
15 * 15 *
16 * Fixes/additions: 16 * Fixes/additions:
17 * Philipp Rumpf 17 * Philipp Rumpf
18 * Juha Sievänen <Juha.Sievanen@cs.Helsinki.FI> 18 * Juha Sievänen <Juha.Sievanen@cs.Helsinki.FI>
19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI> 19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI>
20 * Deepak Saxena <deepak@plexity.net> 20 * Deepak Saxena <deepak@plexity.net>
21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com> 21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com>
22 * Alan Cox <alan@redhat.com>: 22 * Alan Cox <alan@redhat.com>:
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index a20a51efe118..25716193a534 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -10,8 +10,8 @@ config MFD_SM501
10 ---help--- 10 ---help---
11 This is the core driver for the Silicon Motion SM501 multimedia 11 This is the core driver for the Silicon Motion SM501 multimedia
12 companion chip. This device is a multifunction device which may 12 companion chip. This device is a multifunction device which may
13 provide numerous interfaces including USB host controller USB gadget, 13 provide numerous interfaces including USB host controller, USB gadget,
14 Asyncronous Serial ports, Audio functions and a dual display video 14 asynchronous serial ports, audio functions, and a dual display video
15 interface. The device may be connected by PCI or local bus with 15 interface. The device may be connected by PCI or local bus with
16 varying functions enabled. 16 varying functions enabled.
17 17
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 346c44eff95e..b5e67c0ff433 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -111,6 +111,21 @@ config ASUS_LAPTOP
111 111
112 If you have an ACPI-compatible ASUS laptop, say Y or M here. 112 If you have an ACPI-compatible ASUS laptop, say Y or M here.
113 113
114config FUJITSU_LAPTOP
115 tristate "Fujitsu Laptop Extras"
116 depends on X86
117 depends on ACPI
118 depends on BACKLIGHT_CLASS_DEVICE
119 ---help---
120 This is a driver for laptops built by Fujitsu:
121
122 * P2xxx/P5xxx/S6xxx/S7xxx series Lifebooks
123 * Possibly other Fujitsu laptop models
124
125 It adds support for LCD brightness control.
126
127 If you have a Fujitsu laptop, say Y or M here.
128
114config MSI_LAPTOP 129config MSI_LAPTOP
115 tristate "MSI Laptop Extras" 130 tristate "MSI Laptop Extras"
116 depends on X86 131 depends on X86
@@ -134,6 +149,7 @@ config SONY_LAPTOP
134 tristate "Sony Laptop Extras" 149 tristate "Sony Laptop Extras"
135 depends on X86 && ACPI 150 depends on X86 && ACPI
136 select BACKLIGHT_CLASS_DEVICE 151 select BACKLIGHT_CLASS_DEVICE
152 depends on INPUT
137 ---help--- 153 ---help---
138 This mini-driver drives the SNC and SPIC devices present in the ACPI 154 This mini-driver drives the SNC and SPIC devices present in the ACPI
139 BIOS of the Sony Vaio laptops. 155 BIOS of the Sony Vaio laptops.
@@ -156,6 +172,7 @@ config THINKPAD_ACPI
156 select BACKLIGHT_CLASS_DEVICE 172 select BACKLIGHT_CLASS_DEVICE
157 select HWMON 173 select HWMON
158 select NVRAM 174 select NVRAM
175 depends on INPUT
159 ---help--- 176 ---help---
160 This is a driver for the IBM and Lenovo ThinkPad laptops. It adds 177 This is a driver for the IBM and Lenovo ThinkPad laptops. It adds
161 support for Fn-Fx key combinations, Bluetooth control, video 178 support for Fn-Fx key combinations, Bluetooth control, video
@@ -163,7 +180,7 @@ config THINKPAD_ACPI
163 For more information about this driver see 180 For more information about this driver see
164 <file:Documentation/thinkpad-acpi.txt> and <http://ibm-acpi.sf.net/> . 181 <file:Documentation/thinkpad-acpi.txt> and <http://ibm-acpi.sf.net/> .
165 182
166 This driver was formely known as ibm-acpi. 183 This driver was formerly known as ibm-acpi.
167 184
168 If you have an IBM or Lenovo ThinkPad laptop, say Y or M here. 185 If you have an IBM or Lenovo ThinkPad laptop, say Y or M here.
169 186
@@ -197,7 +214,7 @@ config THINKPAD_ACPI_BAY
197 default y 214 default y
198 ---help--- 215 ---help---
199 Allows the thinkpad_acpi driver to handle removable bays. It will 216 Allows the thinkpad_acpi driver to handle removable bays. It will
200 eletrically disable the device in the bay, and also generate 217 electrically disable the device in the bay, and also generate
201 notifications when the bay lever is ejected or inserted. 218 notifications when the bay lever is ejected or inserted.
202 219
203 If you are not sure, say Y here. 220 If you are not sure, say Y here.
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index a24c61475c2f..87f2685d728f 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -15,4 +15,5 @@ obj-$(CONFIG_PHANTOM) += phantom.o
15obj-$(CONFIG_SGI_IOC4) += ioc4.o 15obj-$(CONFIG_SGI_IOC4) += ioc4.o
16obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o 16obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o
17obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o 17obj-$(CONFIG_THINKPAD_ACPI) += thinkpad_acpi.o
18obj-$(CONFIG_FUJITSU_LAPTOP) += fujitsu-laptop.o
18obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o 19obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
diff --git a/drivers/misc/fujitsu-laptop.c b/drivers/misc/fujitsu-laptop.c
new file mode 100644
index 000000000000..d366a6cc1fd9
--- /dev/null
+++ b/drivers/misc/fujitsu-laptop.c
@@ -0,0 +1,358 @@
1/*-*-linux-c-*-*/
2
3/*
4 Copyright (C) 2007 Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
5 Based on earlier work:
6 Copyright (C) 2003 Shane Spencer <shane@bogomip.com>
7 Adrian Yee <brewt-fujitsu@brewt.org>
8
9 Templated from msi-laptop.c which is copyright by its respective authors.
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 02110-1301, USA.
25 */
26
27/*
28 * fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
29 * features made available on a range of Fujitsu laptops including the
30 * P2xxx/P5xxx/S6xxx/S7xxx series.
31 *
32 * This driver exports a few files in /sys/devices/platform/fujitsu-laptop/;
33 * others may be added at a later date.
34 *
35 * lcd_level - Screen brightness: contains a single integer in the
36 * range 0..7. (rw)
37 *
38 * In addition to these platform device attributes the driver
39 * registers itself in the Linux backlight control subsystem and is
40 * available to userspace under /sys/class/backlight/fujitsu-laptop/.
41 *
42 * This driver has been tested on a Fujitsu Lifebook S7020. It should
43 * work on most P-series and S-series Lifebooks, but YMMV.
44 */
45
46#include <linux/module.h>
47#include <linux/kernel.h>
48#include <linux/init.h>
49#include <linux/acpi.h>
50#include <linux/dmi.h>
51#include <linux/backlight.h>
52#include <linux/platform_device.h>
53#include <linux/autoconf.h>
54
55#define FUJITSU_DRIVER_VERSION "0.3"
56
57#define FUJITSU_LCD_N_LEVELS 8
58
59#define ACPI_FUJITSU_CLASS "fujitsu"
60#define ACPI_FUJITSU_HID "FUJ02B1"
61#define ACPI_FUJITSU_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI extras driver"
62#define ACPI_FUJITSU_DEVICE_NAME "Fujitsu FUJ02B1"
63
64struct fujitsu_t {
65 acpi_handle acpi_handle;
66 struct backlight_device *bl_device;
67 struct platform_device *pf_device;
68
69 unsigned long fuj02b1_state;
70 unsigned int brightness_changed;
71 unsigned int brightness_level;
72};
73
74static struct fujitsu_t *fujitsu;
75
76/* Hardware access */
77
78static int set_lcd_level(int level)
79{
80 acpi_status status = AE_OK;
81 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
82 struct acpi_object_list arg_list = { 1, &arg0 };
83 acpi_handle handle = NULL;
84
85 if (level < 0 || level >= FUJITSU_LCD_N_LEVELS)
86 return -EINVAL;
87
88 if (!fujitsu)
89 return -EINVAL;
90
91 status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle);
92 if (ACPI_FAILURE(status)) {
93 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SBLL not present\n"));
94 return -ENODEV;
95 }
96
97 arg0.integer.value = level;
98
99 status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
100 if (ACPI_FAILURE(status))
101 return -ENODEV;
102
103 return 0;
104}
105
106static int get_lcd_level(void)
107{
108 unsigned long state = 0;
109 acpi_status status = AE_OK;
110
111 // Get the Brightness
112 status =
113 acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);
114 if (status < 0)
115 return status;
116
117 fujitsu->fuj02b1_state = state;
118 fujitsu->brightness_level = state & 0x0fffffff;
119
120 if (state & 0x80000000)
121 fujitsu->brightness_changed = 1;
122 else
123 fujitsu->brightness_changed = 0;
124
125 if (status < 0)
126 return status;
127
128 return fujitsu->brightness_level;
129}
130
131/* Backlight device stuff */
132
133static int bl_get_brightness(struct backlight_device *b)
134{
135 return get_lcd_level();
136}
137
138static int bl_update_status(struct backlight_device *b)
139{
140 return set_lcd_level(b->props.brightness);
141}
142
143static struct backlight_ops fujitsubl_ops = {
144 .get_brightness = bl_get_brightness,
145 .update_status = bl_update_status,
146};
147
148/* Platform device */
149
150static ssize_t show_lcd_level(struct device *dev,
151 struct device_attribute *attr, char *buf)
152{
153
154 int ret;
155
156 ret = get_lcd_level();
157 if (ret < 0)
158 return ret;
159
160 return sprintf(buf, "%i\n", ret);
161}
162
163static ssize_t store_lcd_level(struct device *dev,
164 struct device_attribute *attr, const char *buf,
165 size_t count)
166{
167
168 int level, ret;
169
170 if (sscanf(buf, "%i", &level) != 1
171 || (level < 0 || level >= FUJITSU_LCD_N_LEVELS))
172 return -EINVAL;
173
174 ret = set_lcd_level(level);
175 if (ret < 0)
176 return ret;
177
178 return count;
179}
180
181static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
182
183static struct attribute *fujitsupf_attributes[] = {
184 &dev_attr_lcd_level.attr,
185 NULL
186};
187
188static struct attribute_group fujitsupf_attribute_group = {
189 .attrs = fujitsupf_attributes
190};
191
192static struct platform_driver fujitsupf_driver = {
193 .driver = {
194 .name = "fujitsu-laptop",
195 .owner = THIS_MODULE,
196 }
197};
198
199/* ACPI device */
200
201int acpi_fujitsu_add(struct acpi_device *device)
202{
203 int result = 0;
204 int state = 0;
205
206 ACPI_FUNCTION_TRACE("acpi_fujitsu_add");
207
208 if (!device)
209 return -EINVAL;
210
211 fujitsu->acpi_handle = device->handle;
212 sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_DEVICE_NAME);
213 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
214 acpi_driver_data(device) = fujitsu;
215
216 result = acpi_bus_get_power(fujitsu->acpi_handle, &state);
217 if (result) {
218 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
219 "Error reading power state\n"));
220 goto end;
221 }
222
223 printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
224 acpi_device_name(device), acpi_device_bid(device),
225 !device->power.state ? "on" : "off");
226
227 end:
228
229 return result;
230}
231
232int acpi_fujitsu_remove(struct acpi_device *device, int type)
233{
234 ACPI_FUNCTION_TRACE("acpi_fujitsu_remove");
235
236 if (!device || !acpi_driver_data(device))
237 return -EINVAL;
238 fujitsu->acpi_handle = 0;
239
240 return 0;
241}
242
243static const struct acpi_device_id fujitsu_device_ids[] = {
244 {ACPI_FUJITSU_HID, 0},
245 {"", 0},
246};
247
248static struct acpi_driver acpi_fujitsu_driver = {
249 .name = ACPI_FUJITSU_DRIVER_NAME,
250 .class = ACPI_FUJITSU_CLASS,
251 .ids = fujitsu_device_ids,
252 .ops = {
253 .add = acpi_fujitsu_add,
254 .remove = acpi_fujitsu_remove,
255 },
256};
257
258/* Initialization */
259
260static int __init fujitsu_init(void)
261{
262 int ret, result;
263
264 if (acpi_disabled)
265 return -ENODEV;
266
267 fujitsu = kmalloc(sizeof(struct fujitsu_t), GFP_KERNEL);
268 if (!fujitsu)
269 return -ENOMEM;
270 memset(fujitsu, 0, sizeof(struct fujitsu_t));
271
272 result = acpi_bus_register_driver(&acpi_fujitsu_driver);
273 if (result < 0) {
274 ret = -ENODEV;
275 goto fail_acpi;
276 }
277
278 /* Register backlight stuff */
279
280 fujitsu->bl_device =
281 backlight_device_register("fujitsu-laptop", NULL, NULL,
282 &fujitsubl_ops);
283 if (IS_ERR(fujitsu->bl_device))
284 return PTR_ERR(fujitsu->bl_device);
285
286 fujitsu->bl_device->props.max_brightness = FUJITSU_LCD_N_LEVELS - 1;
287 ret = platform_driver_register(&fujitsupf_driver);
288 if (ret)
289 goto fail_backlight;
290
291 /* Register platform stuff */
292
293 fujitsu->pf_device = platform_device_alloc("fujitsu-laptop", -1);
294 if (!fujitsu->pf_device) {
295 ret = -ENOMEM;
296 goto fail_platform_driver;
297 }
298
299 ret = platform_device_add(fujitsu->pf_device);
300 if (ret)
301 goto fail_platform_device1;
302
303 ret =
304 sysfs_create_group(&fujitsu->pf_device->dev.kobj,
305 &fujitsupf_attribute_group);
306 if (ret)
307 goto fail_platform_device2;
308
309 printk(KERN_INFO "fujitsu-laptop: driver " FUJITSU_DRIVER_VERSION
310 " successfully loaded.\n");
311
312 return 0;
313
314 fail_platform_device2:
315
316 platform_device_del(fujitsu->pf_device);
317
318 fail_platform_device1:
319
320 platform_device_put(fujitsu->pf_device);
321
322 fail_platform_driver:
323
324 platform_driver_unregister(&fujitsupf_driver);
325
326 fail_backlight:
327
328 backlight_device_unregister(fujitsu->bl_device);
329
330 fail_acpi:
331
332 kfree(fujitsu);
333
334 return ret;
335}
336
337static void __exit fujitsu_cleanup(void)
338{
339 sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
340 &fujitsupf_attribute_group);
341 platform_device_unregister(fujitsu->pf_device);
342 platform_driver_unregister(&fujitsupf_driver);
343 backlight_device_unregister(fujitsu->bl_device);
344
345 acpi_bus_unregister_driver(&acpi_fujitsu_driver);
346
347 kfree(fujitsu);
348
349 printk(KERN_INFO "fujitsu-laptop: driver unloaded.\n");
350}
351
352module_init(fujitsu_init);
353module_exit(fujitsu_cleanup);
354
355MODULE_AUTHOR("Jonathan Woithe");
356MODULE_DESCRIPTION("Fujitsu laptop extras support");
357MODULE_VERSION(FUJITSU_DRIVER_VERSION);
358MODULE_LICENSE("GPL");
diff --git a/drivers/misc/ibmasm/remote.c b/drivers/misc/ibmasm/remote.c
index 0550ce075fc4..477bb43c899c 100644
--- a/drivers/misc/ibmasm/remote.c
+++ b/drivers/misc/ibmasm/remote.c
@@ -17,7 +17,7 @@
17 * 17 *
18 * Copyright (C) IBM Corporation, 2004 18 * Copyright (C) IBM Corporation, 2004
19 * 19 *
20 * Authors: Max Asböck <amax@us.ibm.com> 20 * Authors: Max Asböck <amax@us.ibm.com>
21 * Vernon Mauery <vernux@us.ibm.com> 21 * Vernon Mauery <vernux@us.ibm.com>
22 * 22 *
23 */ 23 */
@@ -226,9 +226,9 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp)
226 mouse_dev->id.product = pdev->device; 226 mouse_dev->id.product = pdev->device;
227 mouse_dev->id.version = 1; 227 mouse_dev->id.version = 1;
228 mouse_dev->dev.parent = sp->dev; 228 mouse_dev->dev.parent = sp->dev;
229 mouse_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 229 mouse_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
230 mouse_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | 230 mouse_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
231 BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 231 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
232 set_bit(BTN_TOUCH, mouse_dev->keybit); 232 set_bit(BTN_TOUCH, mouse_dev->keybit);
233 mouse_dev->name = "ibmasm RSA I remote mouse"; 233 mouse_dev->name = "ibmasm RSA I remote mouse";
234 input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 0, 0); 234 input_set_abs_params(mouse_dev, ABS_X, 0, MOUSE_X_MAX, 0, 0);
@@ -239,7 +239,7 @@ int ibmasm_init_remote_input_dev(struct service_processor *sp)
239 keybd_dev->id.product = pdev->device; 239 keybd_dev->id.product = pdev->device;
240 keybd_dev->id.version = 2; 240 keybd_dev->id.version = 2;
241 keybd_dev->dev.parent = sp->dev; 241 keybd_dev->dev.parent = sp->dev;
242 keybd_dev->evbit[0] = BIT(EV_KEY); 242 keybd_dev->evbit[0] = BIT_MASK(EV_KEY);
243 keybd_dev->name = "ibmasm RSA I remote keyboard"; 243 keybd_dev->name = "ibmasm RSA I remote keyboard";
244 244
245 for (i = 0; i < XLATE_SIZE; i++) { 245 for (i = 0; i < XLATE_SIZE; i++) {
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index 5108b7c576df..cd221fd0fb94 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -9,6 +9,7 @@
9 * You need an userspace library to cooperate with this driver. It (and other 9 * You need an userspace library to cooperate with this driver. It (and other
10 * info) may be obtained here: 10 * info) may be obtained here:
11 * http://www.fi.muni.cz/~xslaby/phantom.html 11 * http://www.fi.muni.cz/~xslaby/phantom.html
12 * or alternatively, you might use OpenHaptics provided by Sensable.
12 */ 13 */
13 14
14#include <linux/kernel.h> 15#include <linux/kernel.h>
@@ -24,13 +25,14 @@
24#include <asm/atomic.h> 25#include <asm/atomic.h>
25#include <asm/io.h> 26#include <asm/io.h>
26 27
27#define PHANTOM_VERSION "n0.9.5" 28#define PHANTOM_VERSION "n0.9.7"
28 29
29#define PHANTOM_MAX_MINORS 8 30#define PHANTOM_MAX_MINORS 8
30 31
31#define PHN_IRQCTL 0x4c /* irq control in caddr space */ 32#define PHN_IRQCTL 0x4c /* irq control in caddr space */
32 33
33#define PHB_RUNNING 1 34#define PHB_RUNNING 1
35#define PHB_NOT_OH 2
34 36
35static struct class *phantom_class; 37static struct class *phantom_class;
36static int phantom_major; 38static int phantom_major;
@@ -47,7 +49,11 @@ struct phantom_device {
47 struct cdev cdev; 49 struct cdev cdev;
48 50
49 struct mutex open_lock; 51 struct mutex open_lock;
50 spinlock_t ioctl_lock; 52 spinlock_t regs_lock;
53
54 /* used in NOT_OH mode */
55 struct phm_regs oregs;
56 u32 ctl_reg;
51}; 57};
52 58
53static unsigned char phantom_devices[PHANTOM_MAX_MINORS]; 59static unsigned char phantom_devices[PHANTOM_MAX_MINORS];
@@ -82,6 +88,7 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
82 struct phm_regs rs; 88 struct phm_regs rs;
83 struct phm_reg r; 89 struct phm_reg r;
84 void __user *argp = (void __user *)arg; 90 void __user *argp = (void __user *)arg;
91 unsigned long flags;
85 unsigned int i; 92 unsigned int i;
86 93
87 if (_IOC_TYPE(cmd) != PH_IOC_MAGIC || 94 if (_IOC_TYPE(cmd) != PH_IOC_MAGIC ||
@@ -96,32 +103,45 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
96 if (r.reg > 7) 103 if (r.reg > 7)
97 return -EINVAL; 104 return -EINVAL;
98 105
99 spin_lock(&dev->ioctl_lock); 106 spin_lock_irqsave(&dev->regs_lock, flags);
100 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) && 107 if (r.reg == PHN_CONTROL && (r.value & PHN_CTL_IRQ) &&
101 phantom_status(dev, dev->status | PHB_RUNNING)){ 108 phantom_status(dev, dev->status | PHB_RUNNING)){
102 spin_unlock(&dev->ioctl_lock); 109 spin_unlock_irqrestore(&dev->regs_lock, flags);
103 return -ENODEV; 110 return -ENODEV;
104 } 111 }
105 112
106 pr_debug("phantom: writing %x to %u\n", r.value, r.reg); 113 pr_debug("phantom: writing %x to %u\n", r.value, r.reg);
114
115 /* preserve amp bit (don't allow to change it when in NOT_OH) */
116 if (r.reg == PHN_CONTROL && (dev->status & PHB_NOT_OH)) {
117 r.value &= ~PHN_CTL_AMP;
118 r.value |= dev->ctl_reg & PHN_CTL_AMP;
119 dev->ctl_reg = r.value;
120 }
121
107 iowrite32(r.value, dev->iaddr + r.reg); 122 iowrite32(r.value, dev->iaddr + r.reg);
108 ioread32(dev->iaddr); /* PCI posting */ 123 ioread32(dev->iaddr); /* PCI posting */
109 124
110 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ)) 125 if (r.reg == PHN_CONTROL && !(r.value & PHN_CTL_IRQ))
111 phantom_status(dev, dev->status & ~PHB_RUNNING); 126 phantom_status(dev, dev->status & ~PHB_RUNNING);
112 spin_unlock(&dev->ioctl_lock); 127 spin_unlock_irqrestore(&dev->regs_lock, flags);
113 break; 128 break;
114 case PHN_SET_REGS: 129 case PHN_SET_REGS:
115 if (copy_from_user(&rs, argp, sizeof(rs))) 130 if (copy_from_user(&rs, argp, sizeof(rs)))
116 return -EFAULT; 131 return -EFAULT;
117 132
118 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask); 133 pr_debug("phantom: SRS %u regs %x\n", rs.count, rs.mask);
119 spin_lock(&dev->ioctl_lock); 134 spin_lock_irqsave(&dev->regs_lock, flags);
120 for (i = 0; i < min(rs.count, 8U); i++) 135 if (dev->status & PHB_NOT_OH)
121 if ((1 << i) & rs.mask) 136 memcpy(&dev->oregs, &rs, sizeof(rs));
122 iowrite32(rs.values[i], dev->oaddr + i); 137 else {
123 ioread32(dev->iaddr); /* PCI posting */ 138 u32 m = min(rs.count, 8U);
124 spin_unlock(&dev->ioctl_lock); 139 for (i = 0; i < m; i++)
140 if (rs.mask & BIT(i))
141 iowrite32(rs.values[i], dev->oaddr + i);
142 ioread32(dev->iaddr); /* PCI posting */
143 }
144 spin_unlock_irqrestore(&dev->regs_lock, flags);
125 break; 145 break;
126 case PHN_GET_REG: 146 case PHN_GET_REG:
127 if (copy_from_user(&r, argp, sizeof(r))) 147 if (copy_from_user(&r, argp, sizeof(r)))
@@ -135,20 +155,35 @@ static long phantom_ioctl(struct file *file, unsigned int cmd,
135 if (copy_to_user(argp, &r, sizeof(r))) 155 if (copy_to_user(argp, &r, sizeof(r)))
136 return -EFAULT; 156 return -EFAULT;
137 break; 157 break;
138 case PHN_GET_REGS: 158 case PHN_GET_REGS: {
159 u32 m;
160
139 if (copy_from_user(&rs, argp, sizeof(rs))) 161 if (copy_from_user(&rs, argp, sizeof(rs)))
140 return -EFAULT; 162 return -EFAULT;
141 163
164 m = min(rs.count, 8U);
165
142 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask); 166 pr_debug("phantom: GRS %u regs %x\n", rs.count, rs.mask);
143 spin_lock(&dev->ioctl_lock); 167 spin_lock_irqsave(&dev->regs_lock, flags);
144 for (i = 0; i < min(rs.count, 8U); i++) 168 for (i = 0; i < m; i++)
145 if ((1 << i) & rs.mask) 169 if (rs.mask & BIT(i))
146 rs.values[i] = ioread32(dev->iaddr + i); 170 rs.values[i] = ioread32(dev->iaddr + i);
147 spin_unlock(&dev->ioctl_lock); 171 spin_unlock_irqrestore(&dev->regs_lock, flags);
148 172
149 if (copy_to_user(argp, &rs, sizeof(rs))) 173 if (copy_to_user(argp, &rs, sizeof(rs)))
150 return -EFAULT; 174 return -EFAULT;
151 break; 175 break;
176 } case PHN_NOT_OH:
177 spin_lock_irqsave(&dev->regs_lock, flags);
178 if (dev->status & PHB_RUNNING) {
179 printk(KERN_ERR "phantom: you need to set NOT_OH "
180 "before you start the device!\n");
181 spin_unlock_irqrestore(&dev->regs_lock, flags);
182 return -EINVAL;
183 }
184 dev->status |= PHB_NOT_OH;
185 spin_unlock_irqrestore(&dev->regs_lock, flags);
186 break;
152 default: 187 default:
153 return -ENOTTY; 188 return -ENOTTY;
154 } 189 }
@@ -171,8 +206,11 @@ static int phantom_open(struct inode *inode, struct file *file)
171 return -EINVAL; 206 return -EINVAL;
172 } 207 }
173 208
209 WARN_ON(dev->status & PHB_NOT_OH);
210
174 file->private_data = dev; 211 file->private_data = dev;
175 212
213 atomic_set(&dev->counter, 0);
176 dev->opened++; 214 dev->opened++;
177 mutex_unlock(&dev->open_lock); 215 mutex_unlock(&dev->open_lock);
178 216
@@ -187,6 +225,7 @@ static int phantom_release(struct inode *inode, struct file *file)
187 225
188 dev->opened = 0; 226 dev->opened = 0;
189 phantom_status(dev, dev->status & ~PHB_RUNNING); 227 phantom_status(dev, dev->status & ~PHB_RUNNING);
228 dev->status &= ~PHB_NOT_OH;
190 229
191 mutex_unlock(&dev->open_lock); 230 mutex_unlock(&dev->open_lock);
192 231
@@ -220,12 +259,32 @@ static struct file_operations phantom_file_ops = {
220static irqreturn_t phantom_isr(int irq, void *data) 259static irqreturn_t phantom_isr(int irq, void *data)
221{ 260{
222 struct phantom_device *dev = data; 261 struct phantom_device *dev = data;
262 unsigned int i;
263 u32 ctl;
223 264
224 if (!(ioread32(dev->iaddr + PHN_CONTROL) & PHN_CTL_IRQ)) 265 spin_lock(&dev->regs_lock);
266 ctl = ioread32(dev->iaddr + PHN_CONTROL);
267 if (!(ctl & PHN_CTL_IRQ)) {
268 spin_unlock(&dev->regs_lock);
225 return IRQ_NONE; 269 return IRQ_NONE;
270 }
226 271
227 iowrite32(0, dev->iaddr); 272 iowrite32(0, dev->iaddr);
228 iowrite32(0xc0, dev->iaddr); 273 iowrite32(0xc0, dev->iaddr);
274
275 if (dev->status & PHB_NOT_OH) {
276 struct phm_regs *r = &dev->oregs;
277 u32 m = min(r->count, 8U);
278
279 for (i = 0; i < m; i++)
280 if (r->mask & BIT(i))
281 iowrite32(r->values[i], dev->oaddr + i);
282
283 dev->ctl_reg ^= PHN_CTL_AMP;
284 iowrite32(dev->ctl_reg, dev->iaddr + PHN_CONTROL);
285 }
286 spin_unlock(&dev->regs_lock);
287
229 ioread32(dev->iaddr); /* PCI posting */ 288 ioread32(dev->iaddr); /* PCI posting */
230 289
231 atomic_inc(&dev->counter); 290 atomic_inc(&dev->counter);
@@ -297,7 +356,7 @@ static int __devinit phantom_probe(struct pci_dev *pdev,
297 } 356 }
298 357
299 mutex_init(&pht->open_lock); 358 mutex_init(&pht->open_lock);
300 spin_lock_init(&pht->ioctl_lock); 359 spin_lock_init(&pht->regs_lock);
301 init_waitqueue_head(&pht->wait); 360 init_waitqueue_head(&pht->wait);
302 cdev_init(&pht->cdev, &phantom_file_ops); 361 cdev_init(&pht->cdev, &phantom_file_ops);
303 pht->cdev.owner = THIS_MODULE; 362 pht->cdev.owner = THIS_MODULE;
@@ -378,6 +437,8 @@ static int phantom_suspend(struct pci_dev *pdev, pm_message_t state)
378 iowrite32(0, dev->caddr + PHN_IRQCTL); 437 iowrite32(0, dev->caddr + PHN_IRQCTL);
379 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */ 438 ioread32(dev->caddr + PHN_IRQCTL); /* PCI posting */
380 439
440 synchronize_irq(pdev->irq);
441
381 return 0; 442 return 0;
382} 443}
383 444
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index e73a71f04bb4..bb13858f60a1 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -14,7 +14,7 @@
14 * 14 *
15 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org> 15 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
16 * 16 *
17 * Copyright (C) 2001-2002 Alcôve <www.alcove.com> 17 * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
18 * 18 *
19 * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au> 19 * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
20 * 20 *
@@ -277,7 +277,7 @@ static void do_sony_laptop_release_key(struct work_struct *work)
277static DECLARE_WORK(sony_laptop_release_key_work, 277static DECLARE_WORK(sony_laptop_release_key_work,
278 do_sony_laptop_release_key); 278 do_sony_laptop_release_key);
279 279
280/* forward event to the input subsytem */ 280/* forward event to the input subsystem */
281static void sony_laptop_report_input_event(u8 event) 281static void sony_laptop_report_input_event(u8 event)
282{ 282{
283 struct input_dev *jog_dev = sony_laptop_input.jog_dev; 283 struct input_dev *jog_dev = sony_laptop_input.jog_dev;
@@ -411,9 +411,9 @@ static int sony_laptop_setup_input(void)
411 jog_dev->id.bustype = BUS_ISA; 411 jog_dev->id.bustype = BUS_ISA;
412 jog_dev->id.vendor = PCI_VENDOR_ID_SONY; 412 jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
413 413
414 jog_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 414 jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
415 jog_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_MIDDLE); 415 jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE);
416 jog_dev->relbit[0] = BIT(REL_WHEEL); 416 jog_dev->relbit[0] = BIT_MASK(REL_WHEEL);
417 417
418 error = input_register_device(jog_dev); 418 error = input_register_device(jog_dev);
419 if (error) 419 if (error)
@@ -1173,7 +1173,8 @@ static struct acpi_driver sony_nc_driver = {
1173#define SONYPI_TYPE3_OFFSET 0x12 1173#define SONYPI_TYPE3_OFFSET 0x12
1174 1174
1175struct sony_pic_ioport { 1175struct sony_pic_ioport {
1176 struct acpi_resource_io io; 1176 struct acpi_resource_io io1;
1177 struct acpi_resource_io io2;
1177 struct list_head list; 1178 struct list_head list;
1178}; 1179};
1179 1180
@@ -1443,11 +1444,11 @@ static u8 sony_pic_call1(u8 dev)
1443{ 1444{
1444 u8 v1, v2; 1445 u8 v1, v2;
1445 1446
1446 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, 1447 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2,
1447 ITERATIONS_LONG); 1448 ITERATIONS_LONG);
1448 outb(dev, spic_dev.cur_ioport->io.minimum + 4); 1449 outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
1449 v1 = inb_p(spic_dev.cur_ioport->io.minimum + 4); 1450 v1 = inb_p(spic_dev.cur_ioport->io1.minimum + 4);
1450 v2 = inb_p(spic_dev.cur_ioport->io.minimum); 1451 v2 = inb_p(spic_dev.cur_ioport->io1.minimum);
1451 dprintk("sony_pic_call1: 0x%.4x\n", (v2 << 8) | v1); 1452 dprintk("sony_pic_call1: 0x%.4x\n", (v2 << 8) | v1);
1452 return v2; 1453 return v2;
1453} 1454}
@@ -1456,13 +1457,13 @@ static u8 sony_pic_call2(u8 dev, u8 fn)
1456{ 1457{
1457 u8 v1; 1458 u8 v1;
1458 1459
1459 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, 1460 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2,
1460 ITERATIONS_LONG); 1461 ITERATIONS_LONG);
1461 outb(dev, spic_dev.cur_ioport->io.minimum + 4); 1462 outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
1462 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, 1463 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2,
1463 ITERATIONS_LONG); 1464 ITERATIONS_LONG);
1464 outb(fn, spic_dev.cur_ioport->io.minimum); 1465 outb(fn, spic_dev.cur_ioport->io1.minimum);
1465 v1 = inb_p(spic_dev.cur_ioport->io.minimum); 1466 v1 = inb_p(spic_dev.cur_ioport->io1.minimum);
1466 dprintk("sony_pic_call2: 0x%.4x\n", v1); 1467 dprintk("sony_pic_call2: 0x%.4x\n", v1);
1467 return v1; 1468 return v1;
1468} 1469}
@@ -1471,13 +1472,13 @@ static u8 sony_pic_call3(u8 dev, u8 fn, u8 v)
1471{ 1472{
1472 u8 v1; 1473 u8 v1;
1473 1474
1474 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, ITERATIONS_LONG); 1475 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
1475 outb(dev, spic_dev.cur_ioport->io.minimum + 4); 1476 outb(dev, spic_dev.cur_ioport->io1.minimum + 4);
1476 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, ITERATIONS_LONG); 1477 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
1477 outb(fn, spic_dev.cur_ioport->io.minimum); 1478 outb(fn, spic_dev.cur_ioport->io1.minimum);
1478 wait_on_command(inb_p(spic_dev.cur_ioport->io.minimum + 4) & 2, ITERATIONS_LONG); 1479 wait_on_command(inb_p(spic_dev.cur_ioport->io1.minimum + 4) & 2, ITERATIONS_LONG);
1479 outb(v, spic_dev.cur_ioport->io.minimum); 1480 outb(v, spic_dev.cur_ioport->io1.minimum);
1480 v1 = inb_p(spic_dev.cur_ioport->io.minimum); 1481 v1 = inb_p(spic_dev.cur_ioport->io1.minimum);
1481 dprintk("sony_pic_call3: 0x%.4x\n", v1); 1482 dprintk("sony_pic_call3: 0x%.4x\n", v1);
1482 return v1; 1483 return v1;
1483} 1484}
@@ -2074,7 +2075,18 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2074 2075
2075 switch (resource->type) { 2076 switch (resource->type) {
2076 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 2077 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
2078 {
2079 /* start IO enumeration */
2080 struct sony_pic_ioport *ioport = kzalloc(sizeof(*ioport), GFP_KERNEL);
2081 if (!ioport)
2082 return AE_ERROR;
2083
2084 list_add(&ioport->list, &dev->ioports);
2085 return AE_OK;
2086 }
2087
2077 case ACPI_RESOURCE_TYPE_END_DEPENDENT: 2088 case ACPI_RESOURCE_TYPE_END_DEPENDENT:
2089 /* end IO enumeration */
2078 return AE_OK; 2090 return AE_OK;
2079 2091
2080 case ACPI_RESOURCE_TYPE_IRQ: 2092 case ACPI_RESOURCE_TYPE_IRQ:
@@ -2101,7 +2113,7 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2101 if (!interrupt) 2113 if (!interrupt)
2102 return AE_ERROR; 2114 return AE_ERROR;
2103 2115
2104 list_add_tail(&interrupt->list, &dev->interrupts); 2116 list_add(&interrupt->list, &dev->interrupts);
2105 interrupt->irq.triggering = p->triggering; 2117 interrupt->irq.triggering = p->triggering;
2106 interrupt->irq.polarity = p->polarity; 2118 interrupt->irq.polarity = p->polarity;
2107 interrupt->irq.sharable = p->sharable; 2119 interrupt->irq.sharable = p->sharable;
@@ -2113,18 +2125,27 @@ sony_pic_read_possible_resource(struct acpi_resource *resource, void *context)
2113 case ACPI_RESOURCE_TYPE_IO: 2125 case ACPI_RESOURCE_TYPE_IO:
2114 { 2126 {
2115 struct acpi_resource_io *io = &resource->data.io; 2127 struct acpi_resource_io *io = &resource->data.io;
2116 struct sony_pic_ioport *ioport = NULL; 2128 struct sony_pic_ioport *ioport =
2129 list_first_entry(&dev->ioports, struct sony_pic_ioport, list);
2117 if (!io) { 2130 if (!io) {
2118 dprintk("Blank IO resource\n"); 2131 dprintk("Blank IO resource\n");
2119 return AE_OK; 2132 return AE_OK;
2120 } 2133 }
2121 2134
2122 ioport = kzalloc(sizeof(*ioport), GFP_KERNEL); 2135 if (!ioport->io1.minimum) {
2123 if (!ioport) 2136 memcpy(&ioport->io1, io, sizeof(*io));
2137 dprintk("IO1 at 0x%.4x (0x%.2x)\n", ioport->io1.minimum,
2138 ioport->io1.address_length);
2139 }
2140 else if (!ioport->io2.minimum) {
2141 memcpy(&ioport->io2, io, sizeof(*io));
2142 dprintk("IO2 at 0x%.4x (0x%.2x)\n", ioport->io2.minimum,
2143 ioport->io2.address_length);
2144 }
2145 else {
2146 printk(KERN_ERR DRV_PFX "Unknown SPIC Type, more than 2 IO Ports\n");
2124 return AE_ERROR; 2147 return AE_ERROR;
2125 2148 }
2126 list_add_tail(&ioport->list, &dev->ioports);
2127 memcpy(&ioport->io, io, sizeof(*io));
2128 return AE_OK; 2149 return AE_OK;
2129 } 2150 }
2130 default: 2151 default:
@@ -2199,10 +2220,22 @@ static int sony_pic_enable(struct acpi_device *device,
2199{ 2220{
2200 acpi_status status; 2221 acpi_status status;
2201 int result = 0; 2222 int result = 0;
2223 /* Type 1 resource layout is:
2224 * IO
2225 * IO
2226 * IRQNoFlags
2227 * End
2228 *
2229 * Type 2 and 3 resource layout is:
2230 * IO
2231 * IRQNoFlags
2232 * End
2233 */
2202 struct { 2234 struct {
2203 struct acpi_resource io_res; 2235 struct acpi_resource res1;
2204 struct acpi_resource irq_res; 2236 struct acpi_resource res2;
2205 struct acpi_resource end; 2237 struct acpi_resource res3;
2238 struct acpi_resource res4;
2206 } *resource; 2239 } *resource;
2207 struct acpi_buffer buffer = { 0, NULL }; 2240 struct acpi_buffer buffer = { 0, NULL };
2208 2241
@@ -2217,21 +2250,49 @@ static int sony_pic_enable(struct acpi_device *device,
2217 buffer.length = sizeof(*resource) + 1; 2250 buffer.length = sizeof(*resource) + 1;
2218 buffer.pointer = resource; 2251 buffer.pointer = resource;
2219 2252
2220 /* setup io resource */ 2253 /* setup Type 1 resources */
2221 resource->io_res.type = ACPI_RESOURCE_TYPE_IO; 2254 if (spic_dev.model == SONYPI_DEVICE_TYPE1) {
2222 resource->io_res.length = sizeof(struct acpi_resource);
2223 memcpy(&resource->io_res.data.io, &ioport->io,
2224 sizeof(struct acpi_resource_io));
2225 2255
2226 /* setup irq resource */ 2256 /* setup io resources */
2227 resource->irq_res.type = ACPI_RESOURCE_TYPE_IRQ; 2257 resource->res1.type = ACPI_RESOURCE_TYPE_IO;
2228 resource->irq_res.length = sizeof(struct acpi_resource); 2258 resource->res1.length = sizeof(struct acpi_resource);
2229 memcpy(&resource->irq_res.data.irq, &irq->irq, 2259 memcpy(&resource->res1.data.io, &ioport->io1,
2230 sizeof(struct acpi_resource_irq)); 2260 sizeof(struct acpi_resource_io));
2231 /* we requested a shared irq */
2232 resource->irq_res.data.irq.sharable = ACPI_SHARED;
2233 2261
2234 resource->end.type = ACPI_RESOURCE_TYPE_END_TAG; 2262 resource->res2.type = ACPI_RESOURCE_TYPE_IO;
2263 resource->res2.length = sizeof(struct acpi_resource);
2264 memcpy(&resource->res2.data.io, &ioport->io2,
2265 sizeof(struct acpi_resource_io));
2266
2267 /* setup irq resource */
2268 resource->res3.type = ACPI_RESOURCE_TYPE_IRQ;
2269 resource->res3.length = sizeof(struct acpi_resource);
2270 memcpy(&resource->res3.data.irq, &irq->irq,
2271 sizeof(struct acpi_resource_irq));
2272 /* we requested a shared irq */
2273 resource->res3.data.irq.sharable = ACPI_SHARED;
2274
2275 resource->res4.type = ACPI_RESOURCE_TYPE_END_TAG;
2276
2277 }
2278 /* setup Type 2/3 resources */
2279 else {
2280 /* setup io resource */
2281 resource->res1.type = ACPI_RESOURCE_TYPE_IO;
2282 resource->res1.length = sizeof(struct acpi_resource);
2283 memcpy(&resource->res1.data.io, &ioport->io1,
2284 sizeof(struct acpi_resource_io));
2285
2286 /* setup irq resource */
2287 resource->res2.type = ACPI_RESOURCE_TYPE_IRQ;
2288 resource->res2.length = sizeof(struct acpi_resource);
2289 memcpy(&resource->res2.data.irq, &irq->irq,
2290 sizeof(struct acpi_resource_irq));
2291 /* we requested a shared irq */
2292 resource->res2.data.irq.sharable = ACPI_SHARED;
2293
2294 resource->res3.type = ACPI_RESOURCE_TYPE_END_TAG;
2295 }
2235 2296
2236 /* Attempt to set the resource */ 2297 /* Attempt to set the resource */
2237 dprintk("Evaluating _SRS\n"); 2298 dprintk("Evaluating _SRS\n");
@@ -2239,7 +2300,7 @@ static int sony_pic_enable(struct acpi_device *device,
2239 2300
2240 /* check for total failure */ 2301 /* check for total failure */
2241 if (ACPI_FAILURE(status)) { 2302 if (ACPI_FAILURE(status)) {
2242 printk(KERN_ERR DRV_PFX "Error evaluating _SRS"); 2303 printk(KERN_ERR DRV_PFX "Error evaluating _SRS\n");
2243 result = -ENODEV; 2304 result = -ENODEV;
2244 goto end; 2305 goto end;
2245 } 2306 }
@@ -2268,11 +2329,14 @@ static irqreturn_t sony_pic_irq(int irq, void *dev_id)
2268 2329
2269 struct sony_pic_dev *dev = (struct sony_pic_dev *) dev_id; 2330 struct sony_pic_dev *dev = (struct sony_pic_dev *) dev_id;
2270 2331
2271 ev = inb_p(dev->cur_ioport->io.minimum); 2332 ev = inb_p(dev->cur_ioport->io1.minimum);
2272 data_mask = inb_p(dev->cur_ioport->io.minimum + dev->evport_offset); 2333 if (dev->cur_ioport->io2.minimum)
2334 data_mask = inb_p(dev->cur_ioport->io2.minimum);
2335 else
2336 data_mask = inb_p(dev->cur_ioport->io1.minimum + dev->evport_offset);
2273 2337
2274 dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n", 2338 dprintk("event ([%.2x] [%.2x]) at port 0x%.4x(+0x%.2x)\n",
2275 ev, data_mask, dev->cur_ioport->io.minimum, dev->evport_offset); 2339 ev, data_mask, dev->cur_ioport->io1.minimum, dev->evport_offset);
2276 2340
2277 if (ev == 0x00 || ev == 0xff) 2341 if (ev == 0x00 || ev == 0xff)
2278 return IRQ_HANDLED; 2342 return IRQ_HANDLED;
@@ -2323,8 +2387,11 @@ static int sony_pic_remove(struct acpi_device *device, int type)
2323 } 2387 }
2324 2388
2325 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev); 2389 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev);
2326 release_region(spic_dev.cur_ioport->io.minimum, 2390 release_region(spic_dev.cur_ioport->io1.minimum,
2327 spic_dev.cur_ioport->io.address_length); 2391 spic_dev.cur_ioport->io1.address_length);
2392 if (spic_dev.cur_ioport->io2.minimum)
2393 release_region(spic_dev.cur_ioport->io2.minimum,
2394 spic_dev.cur_ioport->io2.address_length);
2328 2395
2329 sonypi_compat_exit(); 2396 sonypi_compat_exit();
2330 2397
@@ -2397,14 +2464,36 @@ static int sony_pic_add(struct acpi_device *device)
2397 goto err_remove_input; 2464 goto err_remove_input;
2398 2465
2399 /* request io port */ 2466 /* request io port */
2400 list_for_each_entry(io, &spic_dev.ioports, list) { 2467 list_for_each_entry_reverse(io, &spic_dev.ioports, list) {
2401 if (request_region(io->io.minimum, io->io.address_length, 2468 if (request_region(io->io1.minimum, io->io1.address_length,
2402 "Sony Programable I/O Device")) { 2469 "Sony Programable I/O Device")) {
2403 dprintk("I/O port: 0x%.4x (0x%.4x) + 0x%.2x\n", 2470 dprintk("I/O port1: 0x%.4x (0x%.4x) + 0x%.2x\n",
2404 io->io.minimum, io->io.maximum, 2471 io->io1.minimum, io->io1.maximum,
2405 io->io.address_length); 2472 io->io1.address_length);
2406 spic_dev.cur_ioport = io; 2473 /* Type 1 have 2 ioports */
2407 break; 2474 if (io->io2.minimum) {
2475 if (request_region(io->io2.minimum,
2476 io->io2.address_length,
2477 "Sony Programable I/O Device")) {
2478 dprintk("I/O port2: 0x%.4x (0x%.4x) + 0x%.2x\n",
2479 io->io2.minimum, io->io2.maximum,
2480 io->io2.address_length);
2481 spic_dev.cur_ioport = io;
2482 break;
2483 }
2484 else {
2485 dprintk("Unable to get I/O port2: "
2486 "0x%.4x (0x%.4x) + 0x%.2x\n",
2487 io->io2.minimum, io->io2.maximum,
2488 io->io2.address_length);
2489 release_region(io->io1.minimum,
2490 io->io1.address_length);
2491 }
2492 }
2493 else {
2494 spic_dev.cur_ioport = io;
2495 break;
2496 }
2408 } 2497 }
2409 } 2498 }
2410 if (!spic_dev.cur_ioport) { 2499 if (!spic_dev.cur_ioport) {
@@ -2414,7 +2503,7 @@ static int sony_pic_add(struct acpi_device *device)
2414 } 2503 }
2415 2504
2416 /* request IRQ */ 2505 /* request IRQ */
2417 list_for_each_entry(irq, &spic_dev.interrupts, list) { 2506 list_for_each_entry_reverse(irq, &spic_dev.interrupts, list) {
2418 if (!request_irq(irq->irq.interrupts[0], sony_pic_irq, 2507 if (!request_irq(irq->irq.interrupts[0], sony_pic_irq,
2419 IRQF_SHARED, "sony-laptop", &spic_dev)) { 2508 IRQF_SHARED, "sony-laptop", &spic_dev)) {
2420 dprintk("IRQ: %d - triggering: %d - " 2509 dprintk("IRQ: %d - triggering: %d - "
@@ -2462,8 +2551,11 @@ err_free_irq:
2462 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev); 2551 free_irq(spic_dev.cur_irq->irq.interrupts[0], &spic_dev);
2463 2552
2464err_release_region: 2553err_release_region:
2465 release_region(spic_dev.cur_ioport->io.minimum, 2554 release_region(spic_dev.cur_ioport->io1.minimum,
2466 spic_dev.cur_ioport->io.address_length); 2555 spic_dev.cur_ioport->io1.address_length);
2556 if (spic_dev.cur_ioport->io2.minimum)
2557 release_region(spic_dev.cur_ioport->io2.minimum,
2558 spic_dev.cur_ioport->io2.address_length);
2467 2559
2468err_remove_compat: 2560err_remove_compat:
2469 sonypi_compat_exit(); 2561 sonypi_compat_exit();
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 81e068fa7ac5..e953276664a0 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24#define IBM_VERSION "0.16" 24#define IBM_VERSION "0.16"
25#define TPACPI_SYSFS_VERSION 0x010000 25#define TPACPI_SYSFS_VERSION 0x020000
26 26
27/* 27/*
28 * Changelog: 28 * Changelog:
@@ -117,6 +117,12 @@ IBM_BIOS_MODULE_ALIAS("K[U,X-Z]");
117 117
118#define __unused __attribute__ ((unused)) 118#define __unused __attribute__ ((unused))
119 119
120static enum {
121 TPACPI_LIFE_INIT = 0,
122 TPACPI_LIFE_RUNNING,
123 TPACPI_LIFE_EXITING,
124} tpacpi_lifecycle;
125
120/**************************************************************************** 126/****************************************************************************
121 **************************************************************************** 127 ****************************************************************************
122 * 128 *
@@ -342,6 +348,9 @@ static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
342{ 348{
343 struct ibm_struct *ibm = data; 349 struct ibm_struct *ibm = data;
344 350
351 if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING)
352 return;
353
345 if (!ibm || !ibm->acpi || !ibm->acpi->notify) 354 if (!ibm || !ibm->acpi || !ibm->acpi->notify)
346 return; 355 return;
347 356
@@ -517,8 +526,10 @@ static char *next_cmd(char **cmds)
517 ****************************************************************************/ 526 ****************************************************************************/
518 527
519static struct platform_device *tpacpi_pdev; 528static struct platform_device *tpacpi_pdev;
529static struct platform_device *tpacpi_sensors_pdev;
520static struct device *tpacpi_hwmon; 530static struct device *tpacpi_hwmon;
521static struct input_dev *tpacpi_inputdev; 531static struct input_dev *tpacpi_inputdev;
532static struct mutex tpacpi_inputdev_send_mutex;
522 533
523 534
524static int tpacpi_resume_handler(struct platform_device *pdev) 535static int tpacpi_resume_handler(struct platform_device *pdev)
@@ -543,6 +554,12 @@ static struct platform_driver tpacpi_pdriver = {
543 .resume = tpacpi_resume_handler, 554 .resume = tpacpi_resume_handler,
544}; 555};
545 556
557static struct platform_driver tpacpi_hwmon_pdriver = {
558 .driver = {
559 .name = IBM_HWMON_DRVR_NAME,
560 .owner = THIS_MODULE,
561 },
562};
546 563
547/************************************************************************* 564/*************************************************************************
548 * thinkpad-acpi driver attributes 565 * thinkpad-acpi driver attributes
@@ -692,6 +709,8 @@ static int parse_strtoul(const char *buf,
692{ 709{
693 char *endp; 710 char *endp;
694 711
712 while (*buf && isspace(*buf))
713 buf++;
695 *value = simple_strtoul(buf, &endp, 0); 714 *value = simple_strtoul(buf, &endp, 0);
696 while (*endp && isspace(*endp)) 715 while (*endp && isspace(*endp))
697 endp++; 716 endp++;
@@ -989,6 +1008,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
989 1008
990 int res, i; 1009 int res, i;
991 int status; 1010 int status;
1011 int hkeyv;
992 1012
993 vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n"); 1013 vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n");
994 1014
@@ -1014,18 +1034,35 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
1014 return res; 1034 return res;
1015 1035
1016 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, 1036 /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p,
1017 A30, R30, R31, T20-22, X20-21, X22-24 */ 1037 A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking
1018 tp_features.hotkey_mask = 1038 for HKEY interface version 0x100 */
1019 acpi_evalf(hkey_handle, NULL, "DHKN", "qv"); 1039 if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) {
1040 if ((hkeyv >> 8) != 1) {
1041 printk(IBM_ERR "unknown version of the "
1042 "HKEY interface: 0x%x\n", hkeyv);
1043 printk(IBM_ERR "please report this to %s\n",
1044 IBM_MAIL);
1045 } else {
1046 /*
1047 * MHKV 0x100 in A31, R40, R40e,
1048 * T4x, X31, and later
1049 * */
1050 tp_features.hotkey_mask = 1;
1051 }
1052 }
1020 1053
1021 vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", 1054 vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n",
1022 str_supported(tp_features.hotkey_mask)); 1055 str_supported(tp_features.hotkey_mask));
1023 1056
1024 if (tp_features.hotkey_mask) { 1057 if (tp_features.hotkey_mask) {
1025 /* MHKA available in A31, R40, R40e, T4x, X31, and later */
1026 if (!acpi_evalf(hkey_handle, &hotkey_all_mask, 1058 if (!acpi_evalf(hkey_handle, &hotkey_all_mask,
1027 "MHKA", "qd")) 1059 "MHKA", "qd")) {
1060 printk(IBM_ERR
1061 "missing MHKA handler, "
1062 "please report this to %s\n",
1063 IBM_MAIL);
1028 hotkey_all_mask = 0x080cU; /* FN+F12, FN+F4, FN+F3 */ 1064 hotkey_all_mask = 0x080cU; /* FN+F12, FN+F4, FN+F3 */
1065 }
1029 } 1066 }
1030 1067
1031 res = hotkey_get(&hotkey_orig_status, &hotkey_orig_mask); 1068 res = hotkey_get(&hotkey_orig_status, &hotkey_orig_mask);
@@ -1131,6 +1168,8 @@ static void tpacpi_input_send_key(unsigned int scancode,
1131 unsigned int keycode) 1168 unsigned int keycode)
1132{ 1169{
1133 if (keycode != KEY_RESERVED) { 1170 if (keycode != KEY_RESERVED) {
1171 mutex_lock(&tpacpi_inputdev_send_mutex);
1172
1134 input_report_key(tpacpi_inputdev, keycode, 1); 1173 input_report_key(tpacpi_inputdev, keycode, 1);
1135 if (keycode == KEY_UNKNOWN) 1174 if (keycode == KEY_UNKNOWN)
1136 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, 1175 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
@@ -1142,6 +1181,8 @@ static void tpacpi_input_send_key(unsigned int scancode,
1142 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, 1181 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
1143 scancode); 1182 scancode);
1144 input_sync(tpacpi_inputdev); 1183 input_sync(tpacpi_inputdev);
1184
1185 mutex_unlock(&tpacpi_inputdev_send_mutex);
1145 } 1186 }
1146} 1187}
1147 1188
@@ -1149,18 +1190,47 @@ static void tpacpi_input_send_radiosw(void)
1149{ 1190{
1150 int wlsw; 1191 int wlsw;
1151 1192
1152 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) 1193 mutex_lock(&tpacpi_inputdev_send_mutex);
1194
1195 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1153 input_report_switch(tpacpi_inputdev, 1196 input_report_switch(tpacpi_inputdev,
1154 SW_RADIO, !!wlsw); 1197 SW_RADIO, !!wlsw);
1198 input_sync(tpacpi_inputdev);
1199 }
1200
1201 mutex_unlock(&tpacpi_inputdev_send_mutex);
1155} 1202}
1156 1203
1157static void hotkey_notify(struct ibm_struct *ibm, u32 event) 1204static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1158{ 1205{
1159 u32 hkey; 1206 u32 hkey;
1160 unsigned int keycode, scancode; 1207 unsigned int keycode, scancode;
1161 int send_acpi_ev = 0; 1208 int send_acpi_ev;
1209 int ignore_acpi_ev;
1210
1211 if (event != 0x80) {
1212 printk(IBM_ERR "unknown HKEY notification event %d\n", event);
1213 /* forward it to userspace, maybe it knows how to handle it */
1214 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
1215 ibm->acpi->device->dev.bus_id,
1216 event, 0);
1217 return;
1218 }
1219
1220 while (1) {
1221 if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
1222 printk(IBM_ERR "failed to retrieve HKEY event\n");
1223 return;
1224 }
1225
1226 if (hkey == 0) {
1227 /* queue empty */
1228 return;
1229 }
1230
1231 send_acpi_ev = 0;
1232 ignore_acpi_ev = 0;
1162 1233
1163 if (event == 0x80 && acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
1164 switch (hkey >> 12) { 1234 switch (hkey >> 12) {
1165 case 1: 1235 case 1:
1166 /* 0x1000-0x1FFF: key presses */ 1236 /* 0x1000-0x1FFF: key presses */
@@ -1182,9 +1252,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1182 * eat up known LID events */ 1252 * eat up known LID events */
1183 if (hkey != 0x5001 && hkey != 0x5002) { 1253 if (hkey != 0x5001 && hkey != 0x5002) {
1184 printk(IBM_ERR 1254 printk(IBM_ERR
1185 "unknown LID-related hotkey event: 0x%04x\n", 1255 "unknown LID-related HKEY event: 0x%04x\n",
1186 hkey); 1256 hkey);
1187 send_acpi_ev = 1; 1257 send_acpi_ev = 1;
1258 } else {
1259 ignore_acpi_ev = 1;
1188 } 1260 }
1189 break; 1261 break;
1190 case 7: 1262 case 7:
@@ -1202,21 +1274,18 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1202 printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey); 1274 printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey);
1203 send_acpi_ev = 1; 1275 send_acpi_ev = 1;
1204 } 1276 }
1205 } else {
1206 printk(IBM_ERR "unknown hotkey notification event %d\n", event);
1207 hkey = 0;
1208 send_acpi_ev = 1;
1209 }
1210 1277
1211 /* Legacy events */ 1278 /* Legacy events */
1212 if (send_acpi_ev || hotkey_report_mode < 2) 1279 if (!ignore_acpi_ev && (send_acpi_ev || hotkey_report_mode < 2)) {
1213 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey); 1280 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
1281 }
1214 1282
1215 /* netlink events */ 1283 /* netlink events */
1216 if (send_acpi_ev) { 1284 if (!ignore_acpi_ev && send_acpi_ev) {
1217 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 1285 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
1218 ibm->acpi->device->dev.bus_id, 1286 ibm->acpi->device->dev.bus_id,
1219 event, hkey); 1287 event, hkey);
1288 }
1220 } 1289 }
1221} 1290}
1222 1291
@@ -2812,7 +2881,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
2812 2881
2813 switch(thermal_read_mode) { 2882 switch(thermal_read_mode) {
2814 case TPACPI_THERMAL_TPEC_16: 2883 case TPACPI_THERMAL_TPEC_16:
2815 res = sysfs_create_group(&tpacpi_pdev->dev.kobj, 2884 res = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
2816 &thermal_temp_input16_group); 2885 &thermal_temp_input16_group);
2817 if (res) 2886 if (res)
2818 return res; 2887 return res;
@@ -2820,7 +2889,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
2820 case TPACPI_THERMAL_TPEC_8: 2889 case TPACPI_THERMAL_TPEC_8:
2821 case TPACPI_THERMAL_ACPI_TMP07: 2890 case TPACPI_THERMAL_ACPI_TMP07:
2822 case TPACPI_THERMAL_ACPI_UPDT: 2891 case TPACPI_THERMAL_ACPI_UPDT:
2823 res = sysfs_create_group(&tpacpi_pdev->dev.kobj, 2892 res = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
2824 &thermal_temp_input8_group); 2893 &thermal_temp_input8_group);
2825 if (res) 2894 if (res)
2826 return res; 2895 return res;
@@ -2837,13 +2906,13 @@ static void thermal_exit(void)
2837{ 2906{
2838 switch(thermal_read_mode) { 2907 switch(thermal_read_mode) {
2839 case TPACPI_THERMAL_TPEC_16: 2908 case TPACPI_THERMAL_TPEC_16:
2840 sysfs_remove_group(&tpacpi_pdev->dev.kobj, 2909 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj,
2841 &thermal_temp_input16_group); 2910 &thermal_temp_input16_group);
2842 break; 2911 break;
2843 case TPACPI_THERMAL_TPEC_8: 2912 case TPACPI_THERMAL_TPEC_8:
2844 case TPACPI_THERMAL_ACPI_TMP07: 2913 case TPACPI_THERMAL_ACPI_TMP07:
2845 case TPACPI_THERMAL_ACPI_UPDT: 2914 case TPACPI_THERMAL_ACPI_UPDT:
2846 sysfs_remove_group(&tpacpi_pdev->dev.kobj, 2915 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj,
2847 &thermal_temp_input16_group); 2916 &thermal_temp_input16_group);
2848 break; 2917 break;
2849 case TPACPI_THERMAL_NONE: 2918 case TPACPI_THERMAL_NONE:
@@ -3626,7 +3695,7 @@ static struct device_attribute dev_attr_fan_fan1_input =
3626 __ATTR(fan1_input, S_IRUGO, 3695 __ATTR(fan1_input, S_IRUGO,
3627 fan_fan1_input_show, NULL); 3696 fan_fan1_input_show, NULL);
3628 3697
3629/* sysfs fan fan_watchdog (driver) ------------------------------------- */ 3698/* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */
3630static ssize_t fan_fan_watchdog_show(struct device_driver *drv, 3699static ssize_t fan_fan_watchdog_show(struct device_driver *drv,
3631 char *buf) 3700 char *buf)
3632{ 3701{
@@ -3768,10 +3837,10 @@ static int __init fan_init(struct ibm_init_struct *iibm)
3768 3837
3769 if (fan_status_access_mode != TPACPI_FAN_NONE || 3838 if (fan_status_access_mode != TPACPI_FAN_NONE ||
3770 fan_control_access_mode != TPACPI_FAN_WR_NONE) { 3839 fan_control_access_mode != TPACPI_FAN_WR_NONE) {
3771 rc = sysfs_create_group(&tpacpi_pdev->dev.kobj, 3840 rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
3772 &fan_attr_group); 3841 &fan_attr_group);
3773 if (!(rc < 0)) 3842 if (!(rc < 0))
3774 rc = driver_create_file(&tpacpi_pdriver.driver, 3843 rc = driver_create_file(&tpacpi_hwmon_pdriver.driver,
3775 &driver_attr_fan_watchdog); 3844 &driver_attr_fan_watchdog);
3776 if (rc < 0) 3845 if (rc < 0)
3777 return rc; 3846 return rc;
@@ -3854,8 +3923,8 @@ static void fan_exit(void)
3854 vdbg_printk(TPACPI_DBG_EXIT, "cancelling any pending fan watchdog tasks\n"); 3923 vdbg_printk(TPACPI_DBG_EXIT, "cancelling any pending fan watchdog tasks\n");
3855 3924
3856 /* FIXME: can we really do this unconditionally? */ 3925 /* FIXME: can we really do this unconditionally? */
3857 sysfs_remove_group(&tpacpi_pdev->dev.kobj, &fan_attr_group); 3926 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, &fan_attr_group);
3858 driver_remove_file(&tpacpi_pdriver.driver, &driver_attr_fan_watchdog); 3927 driver_remove_file(&tpacpi_hwmon_pdriver.driver, &driver_attr_fan_watchdog);
3859 3928
3860 cancel_delayed_work(&fan_watchdog_task); 3929 cancel_delayed_work(&fan_watchdog_task);
3861 flush_scheduled_work(); 3930 flush_scheduled_work();
@@ -3888,6 +3957,9 @@ static void fan_watchdog_fire(struct work_struct *ignored)
3888{ 3957{
3889 int rc; 3958 int rc;
3890 3959
3960 if (tpacpi_lifecycle != TPACPI_LIFE_RUNNING)
3961 return;
3962
3891 printk(IBM_NOTICE "fan watchdog: enabling fan\n"); 3963 printk(IBM_NOTICE "fan watchdog: enabling fan\n");
3892 rc = fan_set_enable(); 3964 rc = fan_set_enable();
3893 if (rc < 0) { 3965 if (rc < 0) {
@@ -3908,7 +3980,8 @@ static void fan_watchdog_reset(void)
3908 if (fan_watchdog_active) 3980 if (fan_watchdog_active)
3909 cancel_delayed_work(&fan_watchdog_task); 3981 cancel_delayed_work(&fan_watchdog_task);
3910 3982
3911 if (fan_watchdog_maxinterval > 0) { 3983 if (fan_watchdog_maxinterval > 0 &&
3984 tpacpi_lifecycle != TPACPI_LIFE_EXITING) {
3912 fan_watchdog_active = 1; 3985 fan_watchdog_active = 1;
3913 if (!schedule_delayed_work(&fan_watchdog_task, 3986 if (!schedule_delayed_work(&fan_watchdog_task,
3914 msecs_to_jiffies(fan_watchdog_maxinterval 3987 msecs_to_jiffies(fan_watchdog_maxinterval
@@ -4302,6 +4375,19 @@ static struct ibm_struct fan_driver_data = {
4302 **************************************************************************** 4375 ****************************************************************************
4303 ****************************************************************************/ 4376 ****************************************************************************/
4304 4377
4378/* sysfs name ---------------------------------------------------------- */
4379static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev,
4380 struct device_attribute *attr,
4381 char *buf)
4382{
4383 return snprintf(buf, PAGE_SIZE, "%s\n", IBM_NAME);
4384}
4385
4386static struct device_attribute dev_attr_thinkpad_acpi_pdev_name =
4387 __ATTR(name, S_IRUGO, thinkpad_acpi_pdev_name_show, NULL);
4388
4389/* --------------------------------------------------------------------- */
4390
4305/* /proc support */ 4391/* /proc support */
4306static struct proc_dir_entry *proc_dir; 4392static struct proc_dir_entry *proc_dir;
4307 4393
@@ -4674,6 +4760,8 @@ static int __init thinkpad_acpi_module_init(void)
4674{ 4760{
4675 int ret, i; 4761 int ret, i;
4676 4762
4763 tpacpi_lifecycle = TPACPI_LIFE_INIT;
4764
4677 /* Parameter checking */ 4765 /* Parameter checking */
4678 if (hotkey_report_mode > 2) 4766 if (hotkey_report_mode > 2)
4679 return -EINVAL; 4767 return -EINVAL;
@@ -4702,19 +4790,31 @@ static int __init thinkpad_acpi_module_init(void)
4702 4790
4703 ret = platform_driver_register(&tpacpi_pdriver); 4791 ret = platform_driver_register(&tpacpi_pdriver);
4704 if (ret) { 4792 if (ret) {
4705 printk(IBM_ERR "unable to register platform driver\n"); 4793 printk(IBM_ERR "unable to register main platform driver\n");
4706 thinkpad_acpi_module_exit(); 4794 thinkpad_acpi_module_exit();
4707 return ret; 4795 return ret;
4708 } 4796 }
4709 tp_features.platform_drv_registered = 1; 4797 tp_features.platform_drv_registered = 1;
4710 4798
4799 ret = platform_driver_register(&tpacpi_hwmon_pdriver);
4800 if (ret) {
4801 printk(IBM_ERR "unable to register hwmon platform driver\n");
4802 thinkpad_acpi_module_exit();
4803 return ret;
4804 }
4805 tp_features.sensors_pdrv_registered = 1;
4806
4711 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver); 4807 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
4808 if (!ret) {
4809 tp_features.platform_drv_attrs_registered = 1;
4810 ret = tpacpi_create_driver_attributes(&tpacpi_hwmon_pdriver.driver);
4811 }
4712 if (ret) { 4812 if (ret) {
4713 printk(IBM_ERR "unable to create sysfs driver attributes\n"); 4813 printk(IBM_ERR "unable to create sysfs driver attributes\n");
4714 thinkpad_acpi_module_exit(); 4814 thinkpad_acpi_module_exit();
4715 return ret; 4815 return ret;
4716 } 4816 }
4717 tp_features.platform_drv_attrs_registered = 1; 4817 tp_features.sensors_pdrv_attrs_registered = 1;
4718 4818
4719 4819
4720 /* Device initialization */ 4820 /* Device initialization */
@@ -4727,7 +4827,26 @@ static int __init thinkpad_acpi_module_init(void)
4727 thinkpad_acpi_module_exit(); 4827 thinkpad_acpi_module_exit();
4728 return ret; 4828 return ret;
4729 } 4829 }
4730 tpacpi_hwmon = hwmon_device_register(&tpacpi_pdev->dev); 4830 tpacpi_sensors_pdev = platform_device_register_simple(
4831 IBM_HWMON_DRVR_NAME,
4832 -1, NULL, 0);
4833 if (IS_ERR(tpacpi_sensors_pdev)) {
4834 ret = PTR_ERR(tpacpi_sensors_pdev);
4835 tpacpi_sensors_pdev = NULL;
4836 printk(IBM_ERR "unable to register hwmon platform device\n");
4837 thinkpad_acpi_module_exit();
4838 return ret;
4839 }
4840 ret = device_create_file(&tpacpi_sensors_pdev->dev,
4841 &dev_attr_thinkpad_acpi_pdev_name);
4842 if (ret) {
4843 printk(IBM_ERR
4844 "unable to create sysfs hwmon device attributes\n");
4845 thinkpad_acpi_module_exit();
4846 return ret;
4847 }
4848 tp_features.sensors_pdev_attrs_registered = 1;
4849 tpacpi_hwmon = hwmon_device_register(&tpacpi_sensors_pdev->dev);
4731 if (IS_ERR(tpacpi_hwmon)) { 4850 if (IS_ERR(tpacpi_hwmon)) {
4732 ret = PTR_ERR(tpacpi_hwmon); 4851 ret = PTR_ERR(tpacpi_hwmon);
4733 tpacpi_hwmon = NULL; 4852 tpacpi_hwmon = NULL;
@@ -4735,6 +4854,7 @@ static int __init thinkpad_acpi_module_init(void)
4735 thinkpad_acpi_module_exit(); 4854 thinkpad_acpi_module_exit();
4736 return ret; 4855 return ret;
4737 } 4856 }
4857 mutex_init(&tpacpi_inputdev_send_mutex);
4738 tpacpi_inputdev = input_allocate_device(); 4858 tpacpi_inputdev = input_allocate_device();
4739 if (!tpacpi_inputdev) { 4859 if (!tpacpi_inputdev) {
4740 printk(IBM_ERR "unable to allocate input device\n"); 4860 printk(IBM_ERR "unable to allocate input device\n");
@@ -4769,6 +4889,7 @@ static int __init thinkpad_acpi_module_init(void)
4769 tp_features.input_device_registered = 1; 4889 tp_features.input_device_registered = 1;
4770 } 4890 }
4771 4891
4892 tpacpi_lifecycle = TPACPI_LIFE_RUNNING;
4772 return 0; 4893 return 0;
4773} 4894}
4774 4895
@@ -4776,6 +4897,8 @@ static void thinkpad_acpi_module_exit(void)
4776{ 4897{
4777 struct ibm_struct *ibm, *itmp; 4898 struct ibm_struct *ibm, *itmp;
4778 4899
4900 tpacpi_lifecycle = TPACPI_LIFE_EXITING;
4901
4779 list_for_each_entry_safe_reverse(ibm, itmp, 4902 list_for_each_entry_safe_reverse(ibm, itmp,
4780 &tpacpi_all_drivers, 4903 &tpacpi_all_drivers,
4781 all_drivers) { 4904 all_drivers) {
@@ -4794,12 +4917,22 @@ static void thinkpad_acpi_module_exit(void)
4794 if (tpacpi_hwmon) 4917 if (tpacpi_hwmon)
4795 hwmon_device_unregister(tpacpi_hwmon); 4918 hwmon_device_unregister(tpacpi_hwmon);
4796 4919
4920 if (tp_features.sensors_pdev_attrs_registered)
4921 device_remove_file(&tpacpi_sensors_pdev->dev,
4922 &dev_attr_thinkpad_acpi_pdev_name);
4923 if (tpacpi_sensors_pdev)
4924 platform_device_unregister(tpacpi_sensors_pdev);
4797 if (tpacpi_pdev) 4925 if (tpacpi_pdev)
4798 platform_device_unregister(tpacpi_pdev); 4926 platform_device_unregister(tpacpi_pdev);
4799 4927
4928 if (tp_features.sensors_pdrv_attrs_registered)
4929 tpacpi_remove_driver_attributes(&tpacpi_hwmon_pdriver.driver);
4800 if (tp_features.platform_drv_attrs_registered) 4930 if (tp_features.platform_drv_attrs_registered)
4801 tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver); 4931 tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver);
4802 4932
4933 if (tp_features.sensors_pdrv_registered)
4934 platform_driver_unregister(&tpacpi_hwmon_pdriver);
4935
4803 if (tp_features.platform_drv_registered) 4936 if (tp_features.platform_drv_registered)
4804 platform_driver_unregister(&tpacpi_pdriver); 4937 platform_driver_unregister(&tpacpi_pdriver);
4805 4938
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h
index acd5835ec889..3abcc8120634 100644
--- a/drivers/misc/thinkpad_acpi.h
+++ b/drivers/misc/thinkpad_acpi.h
@@ -58,13 +58,14 @@
58 58
59#define IBM_NAME "thinkpad" 59#define IBM_NAME "thinkpad"
60#define IBM_DESC "ThinkPad ACPI Extras" 60#define IBM_DESC "ThinkPad ACPI Extras"
61#define IBM_FILE "thinkpad_acpi" 61#define IBM_FILE IBM_NAME "_acpi"
62#define IBM_URL "http://ibm-acpi.sf.net/" 62#define IBM_URL "http://ibm-acpi.sf.net/"
63#define IBM_MAIL "ibm-acpi-devel@lists.sourceforge.net" 63#define IBM_MAIL "ibm-acpi-devel@lists.sourceforge.net"
64 64
65#define IBM_PROC_DIR "ibm" 65#define IBM_PROC_DIR "ibm"
66#define IBM_ACPI_EVENT_PREFIX "ibm" 66#define IBM_ACPI_EVENT_PREFIX "ibm"
67#define IBM_DRVR_NAME IBM_FILE 67#define IBM_DRVR_NAME IBM_FILE
68#define IBM_HWMON_DRVR_NAME IBM_NAME "_hwmon"
68 69
69#define IBM_LOG IBM_FILE ": " 70#define IBM_LOG IBM_FILE ": "
70#define IBM_ERR KERN_ERR IBM_LOG 71#define IBM_ERR KERN_ERR IBM_LOG
@@ -171,6 +172,7 @@ static int parse_strtoul(const char *buf, unsigned long max,
171 172
172/* Device model */ 173/* Device model */
173static struct platform_device *tpacpi_pdev; 174static struct platform_device *tpacpi_pdev;
175static struct platform_device *tpacpi_sensors_pdev;
174static struct device *tpacpi_hwmon; 176static struct device *tpacpi_hwmon;
175static struct platform_driver tpacpi_pdriver; 177static struct platform_driver tpacpi_pdriver;
176static struct input_dev *tpacpi_inputdev; 178static struct input_dev *tpacpi_inputdev;
@@ -233,22 +235,25 @@ struct ibm_init_struct {
233 235
234static struct { 236static struct {
235#ifdef CONFIG_THINKPAD_ACPI_BAY 237#ifdef CONFIG_THINKPAD_ACPI_BAY
236 u16 bay_status:1; 238 u32 bay_status:1;
237 u16 bay_eject:1; 239 u32 bay_eject:1;
238 u16 bay_status2:1; 240 u32 bay_status2:1;
239 u16 bay_eject2:1; 241 u32 bay_eject2:1;
240#endif 242#endif
241 u16 bluetooth:1; 243 u32 bluetooth:1;
242 u16 hotkey:1; 244 u32 hotkey:1;
243 u16 hotkey_mask:1; 245 u32 hotkey_mask:1;
244 u16 hotkey_wlsw:1; 246 u32 hotkey_wlsw:1;
245 u16 light:1; 247 u32 light:1;
246 u16 light_status:1; 248 u32 light_status:1;
247 u16 wan:1; 249 u32 wan:1;
248 u16 fan_ctrl_status_undef:1; 250 u32 fan_ctrl_status_undef:1;
249 u16 input_device_registered:1; 251 u32 input_device_registered:1;
250 u16 platform_drv_registered:1; 252 u32 platform_drv_registered:1;
251 u16 platform_drv_attrs_registered:1; 253 u32 platform_drv_attrs_registered:1;
254 u32 sensors_pdrv_registered:1;
255 u32 sensors_pdrv_attrs_registered:1;
256 u32 sensors_pdev_attrs_registered:1;
252} tp_features; 257} tp_features;
253 258
254struct thinkpad_id_data { 259struct thinkpad_id_data {
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 2a2a125b0c76..a592fc04cf78 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -54,7 +54,7 @@ config MTD_PHYSMAP_BANKWIDTH
54 help 54 help
55 This is the total width of the data bus of the flash devices 55 This is the total width of the data bus of the flash devices
56 in octets. For example, if you have a data bus width of 32 56 in octets. For example, if you have a data bus width of 32
57 bits, you would set the bus width octect value to 4. This is 57 bits, you would set the bus width octet value to 4. This is
58 used internally by the CFI drivers. 58 used internally by the CFI drivers.
59 Ignore this option if you use run-time physmap configuration 59 Ignore this option if you use run-time physmap configuration
60 (i.e., run-time calling physmap_configure()). 60 (i.e., run-time calling physmap_configure()).
@@ -73,12 +73,12 @@ config MTD_PMC_MSP_EVM
73 depends on PMC_MSP && MTD_CFI 73 depends on PMC_MSP && MTD_CFI
74 select MTD_PARTITIONS 74 select MTD_PARTITIONS
75 help 75 help
76 This provides a 'mapping' driver which support the way 76 This provides a 'mapping' driver which supports the way
77 in which user-programmable flash chips are connected on the 77 in which user-programmable flash chips are connected on the
78 PMC-Sierra MSP eval/demo boards 78 PMC-Sierra MSP eval/demo boards.
79 79
80choice 80choice
81 prompt "Maximum mappable memory avialable for flash IO" 81 prompt "Maximum mappable memory available for flash IO"
82 depends on MTD_PMC_MSP_EVM 82 depends on MTD_PMC_MSP_EVM
83 default MSP_FLASH_MAP_LIMIT_32M 83 default MSP_FLASH_MAP_LIMIT_32M
84 84
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index b79a9cf2d162..21b921dd6aab 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -696,7 +696,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev,
696 696
697 info->clk = clk_get(&pdev->dev, "nand"); 697 info->clk = clk_get(&pdev->dev, "nand");
698 if (IS_ERR(info->clk)) { 698 if (IS_ERR(info->clk)) {
699 dev_err(&pdev->dev, "failed to get clock"); 699 dev_err(&pdev->dev, "failed to get clock\n");
700 err = -ENOENT; 700 err = -ENOENT;
701 goto exit_error; 701 goto exit_error;
702 } 702 }
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index a4f1bf33164a..6330c8cc72b5 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1309,7 +1309,7 @@ static int ubi_thread(void *u)
1309 struct ubi_device *ubi = u; 1309 struct ubi_device *ubi = u;
1310 1310
1311 ubi_msg("background thread \"%s\" started, PID %d", 1311 ubi_msg("background thread \"%s\" started, PID %d",
1312 ubi->bgt_name, current->pid); 1312 ubi->bgt_name, task_pid_nr(current));
1313 1313
1314 set_freezable(); 1314 set_freezable();
1315 for (;;) { 1315 for (;;) {
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 862f47223fdc..6f8e7d4cf74d 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1491,7 +1491,7 @@ vortex_up(struct net_device *dev)
1491 struct vortex_private *vp = netdev_priv(dev); 1491 struct vortex_private *vp = netdev_priv(dev);
1492 void __iomem *ioaddr = vp->ioaddr; 1492 void __iomem *ioaddr = vp->ioaddr;
1493 unsigned int config; 1493 unsigned int config;
1494 int i, mii_reg1, mii_reg5, err; 1494 int i, mii_reg1, mii_reg5, err = 0;
1495 1495
1496 if (VORTEX_PCI(vp)) { 1496 if (VORTEX_PCI(vp)) {
1497 pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */ 1497 pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 973b684c11e3..eef6fecfff2a 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -73,7 +73,7 @@
73 73
74 Jean-Jacques Michel - bug fix 74 Jean-Jacques Michel - bug fix
75 75
76 Tobias Ringström - Rx interrupt status checking suggestion 76 Tobias Ringström - Rx interrupt status checking suggestion
77 77
78 Andrew Morton - Clear blocked signals, avoid 78 Andrew Morton - Clear blocked signals, avoid
79 buffer overrun setting current->comm. 79 buffer overrun setting current->comm.
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 83d52c8acab0..ce34b539bf38 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -855,7 +855,7 @@ config BFIN_MAC_USE_L1
855 depends on BFIN_MAC && BF537 855 depends on BFIN_MAC && BF537
856 default y 856 default y
857 help 857 help
858 To get maximum network performace, you should use L1 memory as rx/tx buffers. 858 To get maximum network performance, you should use L1 memory as rx/tx buffers.
859 Say N here if you want to reserve L1 memory for other uses. 859 Say N here if you want to reserve L1 memory for other uses.
860 860
861config BFIN_TX_DESC_NUM 861config BFIN_TX_DESC_NUM
@@ -1293,9 +1293,6 @@ config PCNET32_NAPI
1293 deployed on potentially unfriendly networks (e.g. in a firewall), 1293 deployed on potentially unfriendly networks (e.g. in a firewall),
1294 then say Y here. 1294 then say Y here.
1295 1295
1296 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
1297 information.
1298
1299 If in doubt, say N. 1296 If in doubt, say N.
1300 1297
1301config AMD8111_ETH 1298config AMD8111_ETH
@@ -1313,7 +1310,7 @@ config AMD8111_ETH
1313 will be called amd8111e. 1310 will be called amd8111e.
1314 1311
1315config AMD8111E_NAPI 1312config AMD8111E_NAPI
1316 bool "Enable NAPI support" 1313 bool "Use RX polling (NAPI)"
1317 depends on AMD8111_ETH 1314 depends on AMD8111_ETH
1318 help 1315 help
1319 NAPI is a new driver API designed to reduce CPU and interrupt load 1316 NAPI is a new driver API designed to reduce CPU and interrupt load
@@ -1324,9 +1321,6 @@ config AMD8111E_NAPI
1324 deployed on potentially unfriendly networks (e.g. in a firewall), 1321 deployed on potentially unfriendly networks (e.g. in a firewall),
1325 then say Y here. 1322 then say Y here.
1326 1323
1327 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
1328 information.
1329
1330 If in doubt, say N. 1324 If in doubt, say N.
1331 1325
1332config ADAPTEC_STARFIRE 1326config ADAPTEC_STARFIRE
@@ -1355,9 +1349,6 @@ config ADAPTEC_STARFIRE_NAPI
1355 deployed on potentially unfriendly networks (e.g. in a firewall), 1349 deployed on potentially unfriendly networks (e.g. in a firewall),
1356 then say Y here. 1350 then say Y here.
1357 1351
1358 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
1359 information.
1360
1361 If in doubt, say N. 1352 If in doubt, say N.
1362 1353
1363config AC3200 1354config AC3200
@@ -1431,7 +1422,7 @@ config FORCEDETH
1431 called forcedeth. 1422 called forcedeth.
1432 1423
1433config FORCEDETH_NAPI 1424config FORCEDETH_NAPI
1434 bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)" 1425 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
1435 depends on FORCEDETH && EXPERIMENTAL 1426 depends on FORCEDETH && EXPERIMENTAL
1436 help 1427 help
1437 NAPI is a new driver API designed to reduce CPU and interrupt load 1428 NAPI is a new driver API designed to reduce CPU and interrupt load
@@ -1442,9 +1433,6 @@ config FORCEDETH_NAPI
1442 deployed on potentially unfriendly networks (e.g. in a firewall), 1433 deployed on potentially unfriendly networks (e.g. in a firewall),
1443 then say Y here. 1434 then say Y here.
1444 1435
1445 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
1446 information.
1447
1448 If in doubt, say N. 1436 If in doubt, say N.
1449 1437
1450config CS89x0 1438config CS89x0
@@ -1756,9 +1744,6 @@ config VIA_RHINE_NAPI
1756 deployed on potentially unfriendly networks (e.g. in a firewall), 1744 deployed on potentially unfriendly networks (e.g. in a firewall),
1757 then say Y here. 1745 then say Y here.
1758 1746
1759 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
1760 information.
1761
1762config LAN_SAA9730 1747config LAN_SAA9730
1763 bool "Philips SAA9730 Ethernet support" 1748 bool "Philips SAA9730 Ethernet support"
1764 depends on NET_PCI && PCI && MIPS_ATLAS 1749 depends on NET_PCI && PCI && MIPS_ATLAS
@@ -2003,9 +1988,6 @@ config E1000_NAPI
2003 deployed on potentially unfriendly networks (e.g. in a firewall), 1988 deployed on potentially unfriendly networks (e.g. in a firewall),
2004 then say Y here. 1989 then say Y here.
2005 1990
2006 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
2007 information.
2008
2009 If in doubt, say N. 1991 If in doubt, say N.
2010 1992
2011config E1000_DISABLE_PACKET_SPLIT 1993config E1000_DISABLE_PACKET_SPLIT
@@ -2099,7 +2081,7 @@ config R8169
2099 will be called r8169. This is recommended. 2081 will be called r8169. This is recommended.
2100 2082
2101config R8169_NAPI 2083config R8169_NAPI
2102 bool "Use Rx and Tx Polling (NAPI) (EXPERIMENTAL)" 2084 bool "Use Rx Polling (NAPI) (EXPERIMENTAL)"
2103 depends on R8169 && EXPERIMENTAL 2085 depends on R8169 && EXPERIMENTAL
2104 help 2086 help
2105 NAPI is a new driver API designed to reduce CPU and interrupt load 2087 NAPI is a new driver API designed to reduce CPU and interrupt load
@@ -2110,9 +2092,6 @@ config R8169_NAPI
2110 deployed on potentially unfriendly networks (e.g. in a firewall), 2092 deployed on potentially unfriendly networks (e.g. in a firewall),
2111 then say Y here. 2093 then say Y here.
2112 2094
2113 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
2114 information.
2115
2116 If in doubt, say N. 2095 If in doubt, say N.
2117 2096
2118config R8169_VLAN 2097config R8169_VLAN
@@ -2364,7 +2343,7 @@ config GIANFAR
2364 and MPC86xx family of chips, and the FEC on the 8540. 2343 and MPC86xx family of chips, and the FEC on the 8540.
2365 2344
2366config GFAR_NAPI 2345config GFAR_NAPI
2367 bool "NAPI Support" 2346 bool "Use Rx Polling (NAPI)"
2368 depends on GIANFAR 2347 depends on GIANFAR
2369 2348
2370config UCC_GETH 2349config UCC_GETH
@@ -2376,7 +2355,7 @@ config UCC_GETH
2376 which is available on some Freescale SOCs. 2355 which is available on some Freescale SOCs.
2377 2356
2378config UGETH_NAPI 2357config UGETH_NAPI
2379 bool "NAPI Support" 2358 bool "Use Rx Polling (NAPI)"
2380 depends on UCC_GETH 2359 depends on UCC_GETH
2381 2360
2382config UGETH_MAGIC_PACKET 2361config UGETH_MAGIC_PACKET
@@ -2494,7 +2473,7 @@ config CHELSIO_T3
2494 2473
2495config EHEA 2474config EHEA
2496 tristate "eHEA Ethernet support" 2475 tristate "eHEA Ethernet support"
2497 depends on IBMEBUS 2476 depends on IBMEBUS && INET
2498 select INET_LRO 2477 select INET_LRO
2499 ---help--- 2478 ---help---
2500 This driver supports the IBM pSeries eHEA ethernet adapter. 2479 This driver supports the IBM pSeries eHEA ethernet adapter.
@@ -2559,9 +2538,6 @@ config IXGB_NAPI
2559 deployed on potentially unfriendly networks (e.g. in a firewall), 2538 deployed on potentially unfriendly networks (e.g. in a firewall),
2560 then say Y here. 2539 then say Y here.
2561 2540
2562 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
2563 information.
2564
2565 If in doubt, say N. 2541 If in doubt, say N.
2566 2542
2567config S2IO 2543config S2IO
@@ -2584,14 +2560,11 @@ config S2IO_NAPI
2584 deployed on potentially unfriendly networks (e.g. in a firewall), 2560 deployed on potentially unfriendly networks (e.g. in a firewall),
2585 then say Y here. 2561 then say Y here.
2586 2562
2587 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
2588 information.
2589
2590 If in doubt, say N. 2563 If in doubt, say N.
2591 2564
2592config MYRI10GE 2565config MYRI10GE
2593 tristate "Myricom Myri-10G Ethernet support" 2566 tristate "Myricom Myri-10G Ethernet support"
2594 depends on PCI 2567 depends on PCI && INET
2595 select FW_LOADER 2568 select FW_LOADER
2596 select CRC32 2569 select CRC32
2597 select INET_LRO 2570 select INET_LRO
diff --git a/drivers/net/amd8111e.c b/drivers/net/amd8111e.c
index 1cc74ec88a58..eebf5bb2b03a 100644
--- a/drivers/net/amd8111e.c
+++ b/drivers/net/amd8111e.c
@@ -1111,7 +1111,7 @@ static struct net_device_stats *amd8111e_get_stats(struct net_device * dev)
1111 1111
1112 return new_stats; 1112 return new_stats;
1113} 1113}
1114/* This function recalculate the interupt coalescing mode on every interrupt 1114/* This function recalculate the interrupt coalescing mode on every interrupt
1115according to the datarate and the packet rate. 1115according to the datarate and the packet rate.
1116*/ 1116*/
1117static int amd8111e_calc_coalesce(struct net_device *dev) 1117static int amd8111e_calc_coalesce(struct net_device *dev)
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c
index 3fa3bccd1adb..10f3a196be32 100644
--- a/drivers/net/ariadne.c
+++ b/drivers/net/ariadne.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Amiga Linux/m68k Ariadne Ethernet Driver 2 * Amiga Linux/m68k Ariadne Ethernet Driver
3 * 3 *
4 * © Copyright 1995-2003 by Geert Uytterhoeven (geert@linux-m68k.org) 4 * © Copyright 1995-2003 by Geert Uytterhoeven (geert@linux-m68k.org)
5 * Peter De Schrijver (p2@mind.be) 5 * Peter De Schrijver (p2@mind.be)
6 * 6 *
7 * --------------------------------------------------------------------------- 7 * ---------------------------------------------------------------------------
diff --git a/drivers/net/ariadne.h b/drivers/net/ariadne.h
index f7913d5a39f1..bb613f292e04 100644
--- a/drivers/net/ariadne.h
+++ b/drivers/net/ariadne.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Amiga Linux/m68k Ariadne Ethernet Driver 2 * Amiga Linux/m68k Ariadne Ethernet Driver
3 * 3 *
4 * © Copyright 1995 by Geert Uytterhoeven (geert@linux-m68k.org) 4 * © Copyright 1995 by Geert Uytterhoeven (geert@linux-m68k.org)
5 * Peter De Schrijver 5 * Peter De Schrijver
6 * (Peter.DeSchrijver@linux.cc.kuleuven.ac.be) 6 * (Peter.DeSchrijver@linux.cc.kuleuven.ac.be)
7 * 7 *
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 185f98e3964c..504b7ce2747d 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -542,7 +542,7 @@ static struct {
542static int num_ifs; 542static int num_ifs;
543 543
544/* 544/*
545 * Setup the base address and interupt of the Au1xxx ethernet macs 545 * Setup the base address and interrupt of the Au1xxx ethernet macs
546 * based on cpu type and whether the interface is enabled in sys_pinfunc 546 * based on cpu type and whether the interface is enabled in sys_pinfunc
547 * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0. 547 * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0.
548 */ 548 */
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 9fe0517cf893..7495a9ee8f4b 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -900,7 +900,7 @@ static int ax_probe(struct platform_device *pdev)
900 900
901 ax->map2 = ioremap(res->start, size); 901 ax->map2 = ioremap(res->start, size);
902 if (ax->map2 == NULL) { 902 if (ax->map2 == NULL) {
903 dev_err(&pdev->dev, "cannot map reset register"); 903 dev_err(&pdev->dev, "cannot map reset register\n");
904 ret = -ENXIO; 904 ret = -ENXIO;
905 goto exit_mem2; 905 goto exit_mem2;
906 } 906 }
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 78ed633ceb82..da767d3d5af5 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -26,7 +26,7 @@
26#include <linux/etherdevice.h> 26#include <linux/etherdevice.h>
27#include <linux/skbuff.h> 27#include <linux/skbuff.h>
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <asm/bitops.h> 29#include <linux/bitops.h>
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
@@ -56,8 +56,8 @@
56 56
57#define DRV_MODULE_NAME "bnx2" 57#define DRV_MODULE_NAME "bnx2"
58#define PFX DRV_MODULE_NAME ": " 58#define PFX DRV_MODULE_NAME ": "
59#define DRV_MODULE_VERSION "1.6.7" 59#define DRV_MODULE_VERSION "1.6.8"
60#define DRV_MODULE_RELDATE "October 10, 2007" 60#define DRV_MODULE_RELDATE "October 17, 2007"
61 61
62#define RUN_AT(x) (jiffies + (x)) 62#define RUN_AT(x) (jiffies + (x))
63 63
@@ -3079,14 +3079,18 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
3079 autoneg = bp->autoneg; 3079 autoneg = bp->autoneg;
3080 advertising = bp->advertising; 3080 advertising = bp->advertising;
3081 3081
3082 bp->autoneg = AUTONEG_SPEED; 3082 if (bp->phy_port == PORT_TP) {
3083 bp->advertising = ADVERTISED_10baseT_Half | 3083 bp->autoneg = AUTONEG_SPEED;
3084 ADVERTISED_10baseT_Full | 3084 bp->advertising = ADVERTISED_10baseT_Half |
3085 ADVERTISED_100baseT_Half | 3085 ADVERTISED_10baseT_Full |
3086 ADVERTISED_100baseT_Full | 3086 ADVERTISED_100baseT_Half |
3087 ADVERTISED_Autoneg; 3087 ADVERTISED_100baseT_Full |
3088 ADVERTISED_Autoneg;
3089 }
3088 3090
3089 bnx2_setup_copper_phy(bp); 3091 spin_lock_bh(&bp->phy_lock);
3092 bnx2_setup_phy(bp, bp->phy_port);
3093 spin_unlock_bh(&bp->phy_lock);
3090 3094
3091 bp->autoneg = autoneg; 3095 bp->autoneg = autoneg;
3092 bp->advertising = advertising; 3096 bp->advertising = advertising;
@@ -3097,10 +3101,16 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state)
3097 3101
3098 /* Enable port mode. */ 3102 /* Enable port mode. */
3099 val &= ~BNX2_EMAC_MODE_PORT; 3103 val &= ~BNX2_EMAC_MODE_PORT;
3100 val |= BNX2_EMAC_MODE_PORT_MII | 3104 val |= BNX2_EMAC_MODE_MPKT_RCVD |
3101 BNX2_EMAC_MODE_MPKT_RCVD |
3102 BNX2_EMAC_MODE_ACPI_RCVD | 3105 BNX2_EMAC_MODE_ACPI_RCVD |
3103 BNX2_EMAC_MODE_MPKT; 3106 BNX2_EMAC_MODE_MPKT;
3107 if (bp->phy_port == PORT_TP)
3108 val |= BNX2_EMAC_MODE_PORT_MII;
3109 else {
3110 val |= BNX2_EMAC_MODE_PORT_GMII;
3111 if (bp->line_speed == SPEED_2500)
3112 val |= BNX2_EMAC_MODE_25G_MODE;
3113 }
3104 3114
3105 REG_WR(bp, BNX2_EMAC_MODE, val); 3115 REG_WR(bp, BNX2_EMAC_MODE, val);
3106 3116
@@ -6428,7 +6438,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6428 /* enable device (incl. PCI PM wakeup), and bus-mastering */ 6438 /* enable device (incl. PCI PM wakeup), and bus-mastering */
6429 rc = pci_enable_device(pdev); 6439 rc = pci_enable_device(pdev);
6430 if (rc) { 6440 if (rc) {
6431 dev_err(&pdev->dev, "Cannot enable PCI device, aborting."); 6441 dev_err(&pdev->dev, "Cannot enable PCI device, aborting.\n");
6432 goto err_out; 6442 goto err_out;
6433 } 6443 }
6434 6444
diff --git a/drivers/net/bnx2_fw2.h b/drivers/net/bnx2_fw2.h
index 5bd52bead9bf..4b129b7cbfad 100644
--- a/drivers/net/bnx2_fw2.h
+++ b/drivers/net/bnx2_fw2.h
@@ -15,3248 +15,3270 @@
15 */ 15 */
16 16
17static u8 bnx2_COM_b09FwText[] = { 17static u8 bnx2_COM_b09FwText[] = {
18/* 0x1f, 0x8b, 0x08, 0x00, 0x0e, 0x34, 0xe7, 0x45, 0x00, 0x03, */ 18 0xdc, 0x5b, 0x6b, 0x6c, 0x1c, 0xd7, 0x75, 0x3e, 0x33, 0x3b, 0x4b, 0xae,
19 0xdc, 0x5b, 19 0xc8, 0x15, 0x35, 0x22, 0x57, 0xd4, 0x9a, 0xa2, 0xed, 0x5d, 0x72, 0x28,
20 0x6d, 0x70, 0x5c, 0xd5, 0x79, 0x7e, 0xef, 0xd9, 0xbb, 0xf2, 0x5a, 0x92, 20 0xb2, 0x96, 0xea, 0xae, 0x29, 0xa6, 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0xc5, 0xe4,
58 0x5e, 0x42, 0x5e, 0x8f, 0xa5, 0xe4, 0x85, 0xbe, 0xd7, 0xc1, 0x43, 0x47, 58 0xb9, 0x72, 0xbd, 0x84, 0x1e, 0x0f, 0x81, 0x37, 0x5f, 0x90, 0x7c, 0x2c,
59 0x4e, 0xfb, 0x62, 0x8d, 0xf4, 0xa5, 0xc0, 0xbb, 0xa4, 0x3c, 0xe3, 0xb7, 59 0x22, 0x1b, 0x27, 0x0d, 0x69, 0xeb, 0x8e, 0x48, 0xc6, 0xe6, 0xda, 0x38,
60 0x49, 0xec, 0xb1, 0x18, 0x78, 0xf3, 0xcb, 0x52, 0x4a, 0x26, 0x64, 0xd3, 60 0xed, 0x89, 0x98, 0x84, 0x26, 0x33, 0x4d, 0xa6, 0x74, 0xd8, 0x39, 0x29,
61 0xac, 0x25, 0x5b, 0x07, 0x12, 0x92, 0x77, 0xb8, 0x36, 0x4e, 0x7b, 0x26, 61 0x82, 0x77, 0x57, 0x28, 0x97, 0x68, 0x4b, 0x48, 0x6e, 0xfc, 0x36, 0x19,
62 0x29, 0xb1, 0xd9, 0xfc, 0x66, 0x25, 0xdb, 0x9c, 0xa2, 0x54, 0xc0, 0xbb, 62 0xb4, 0x49, 0xd7, 0xdc, 0xcd, 0xde, 0x5a, 0x11, 0x23, 0x7b, 0x72, 0x40,
63 0x57, 0x29, 0x97, 0x68, 0x4b, 0x4b, 0x71, 0xfa, 0x5a, 0x19, 0x73, 0x48, 63 0xc6, 0xdc, 0xa8, 0x91, 0x3b, 0xf9, 0x59, 0xc9, 0xa6, 0x24, 0x86, 0x71,
64 0xd7, 0x1f, 0x5c, 0x15, 0xac, 0x95, 0xb0, 0x0a, 0xc7, 0x46, 0x65, 0xca, 64 0xf1, 0x3c, 0x5a, 0x66, 0x4a, 0x03, 0x32, 0xea, 0x8a, 0x91, 0x75, 0xc9,
65 0x6b, 0xb7, 0x8a, 0xc7, 0x6e, 0x96, 0x42, 0x56, 0x92, 0x18, 0x97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0x63,
95 0x5a, 0x56, 0xec, 0x1c, 0x79, 0x68, 0x4b, 0x51, 0xef, 0xd9, 0x96, 0x09, 95 0xb3, 0xfb, 0x7f, 0x2a, 0x19, 0x1b, 0xfb, 0xe8, 0xde, 0xa6, 0x78, 0x6f,
96 0xff, 0x91, 0xab, 0x03, 0xd9, 0x15, 0x19, 0x01, 0x8f, 0xd5, 0xc0, 0x4f, 96 0x76, 0x53, 0x66, 0x13, 0x90, 0x7b, 0xcb, 0xc8, 0xb9, 0x67, 0x80, 0x1b,
97 0xea, 0x79, 0x07, 0xfb, 0x18, 0xd8, 0xa1, 0x79, 0xaf, 0x06, 0x28, 0xb3, 97 0xf5, 0x46, 0xf6, 0x78, 0x51, 0x0a, 0xc7, 0x2b, 0x52, 0x48, 0x85, 0xe5,
98 0x69, 0xc8, 0xbd, 0x6d, 0x15, 0xbd, 0x93, 0xc0, 0x8d, 0x36, 0xab, 0x70, 98 0x11, 0xbb, 0x22, 0x7d, 0xa9, 0x1a, 0x39, 0x64, 0x83, 0xf7, 0xdb, 0x7f,
99 0xa4, 0x22, 0xe5, 0x23, 0x75, 0x29, 0x67, 0xe3, 0xf2, 0x90, 0x53, 0x97, 99 0xdf, 0xf0, 0x31, 0xfb, 0x89, 0xf2, 0x61, 0xbc, 0xb3, 0x4e, 0xe4, 0x84,
100 0xe1, 0x6c, 0x8b, 0xec, 0x77, 0xc0, 0xfb, 0x9d, 0xbf, 0x6d, 0x85, 0x98, 100 0x7a, 0xf7, 0xea, 0x8b, 0xe5, 0xb0, 0x64, 0x62, 0xc5, 0xb8, 0x25, 0x2d,
101 0xfd, 0xb8, 0xff, 0x3b, 0x78, 0x67, 0x9d, 0xc8, 0x51, 0xfd, 0x1e, 0xd4, 101 0xa6, 0xb7, 0xee, 0xb0, 0xdf, 0x06, 0x7e, 0x4c, 0x01, 0x27, 0x93, 0x4a,
102 0x57, 0xfc, 0xb8, 0xe4, 0x93, 0x95, 0x94, 0x2d, 0x5b, 0x54, 0xb0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, 0xfb, 0x86, 0xb3, 0x5d, 0x32, 0xe1, 0x58, 117 0xb0, 0x41, 0x12, 0x26, 0x31, 0x5f, 0xed, 0xcb, 0x30, 0x3d, 0xfa, 0x6d,
118 0xd9, 0xf1, 0xfe, 0x75, 0xd4, 0x8b, 0xbc, 0x72, 0xdb, 0x80, 0x0d, 0x92, 118 0x96, 0xfb, 0x4d, 0xa7, 0xb1, 0xaa, 0x9e, 0xba, 0x1d, 0xc2, 0x3b, 0x65,
119 0x56, 0xc4, 0x7c, 0xbd, 0x2f, 0x4b, 0x05, 0xf4, 0x3b, 0x2c, 0x8f, 0x28, 119 0x78, 0xb7, 0x3e, 0x63, 0x0b, 0x65, 0xe2, 0xf0, 0xad, 0xba, 0xec, 0xb7,
120 0xb7, 0xb3, 0xa9, 0x9e, 0xba, 0x1d, 0xc3, 0x3b, 0x65, 0x78, 0x97, 0x39, 120 0xe3, 0xc0, 0x96, 0x94, 0x7f, 0xb6, 0x65, 0x69, 0xd9, 0xc7, 0x89, 0x20,
121 0x63, 0x1b, 0x65, 0xe2, 0xf0, 0x35, 0xa6, 0x1c, 0xb6, 0x6f, 0xb6, 0x57, 121 0x86, 0x73, 0xaf, 0xc0, 0x27, 0x87, 0x72, 0x17, 0x06, 0xad, 0x29, 0xe8,
122 0x96, 0xcf, 0x76, 0xaf, 0x2c, 0x87, 0x38, 0x11, 0xc5, 0x70, 0xee, 0x15, 122 0x5c, 0xad, 0xa6, 0x61, 0xb3, 0xa6, 0x01, 0xb4, 0x76, 0x42, 0xb2, 0x94,
123 0xf8, 0xe4, 0x52, 0xee, 0xe2, 0xa0, 0x35, 0x0b, 0x9d, 0x5b, 0x67, 0x68, 123 0x2e, 0x29, 0xd1, 0xaa, 0x2a, 0x93, 0xf7, 0xfe, 0xfb, 0x7a, 0xd5, 0xee,
124 0xb8, 0xc2, 0xd0, 0x00, 0x5a, 0xfb, 0x20, 0x59, 0x5a, 0x97, 0xb4, 0x68, 124 0xe9, 0x9c, 0xff, 0xf4, 0xf1, 0xfd, 0xcd, 0x80, 0xbd, 0x68, 0x85, 0xce,
125 0x35, 0x95, 0xc9, 0xfb, 0xf0, 0x7d, 0x83, 0x6e, 0x0f, 0x74, 0x2e, 0x7c, 125 0xc6, 0xc0, 0x2b, 0x1f, 0xeb, 0x89, 0xc1, 0x71, 0xd8, 0x07, 0xc8, 0xaa,
126 0x86, 0xf8, 0xfe, 0x66, 0xc4, 0x5e, 0xf4, 0x40, 0x67, 0x93, 0xe0, 0x55, 126 0xc2, 0xf6, 0x28, 0xf0, 0xd0, 0xd2, 0xd8, 0x1c, 0xd1, 0xd8, 0x1c, 0x05,
127 0x88, 0xf5, 0xc4, 0xe0, 0x14, 0xec, 0x03, 0x64, 0x55, 0x63, 0x7b, 0x3b, 127 0x2e, 0xb3, 0x6c, 0xeb, 0x72, 0x4c, 0x97, 0xe3, 0x28, 0xc3, 0x8e, 0x4f,
128 0xf0, 0xd0, 0x36, 0xd8, 0x9c, 0x30, 0xd8, 0xdc, 0x0e, 0x5c, 0x66, 0xd9, 128 0x12, 0xbb, 0x1b, 0x8a, 0x43, 0x27, 0x14, 0xde, 0xd3, 0x56, 0x00, 0x85,
129 0x31, 0xe5, 0xa4, 0x29, 0xa7, 0x50, 0x86, 0x1d, 0x9f, 0x25, 0x2e, 0x5f, 129 0x89, 0xd7, 0xc4, 0xed, 0x56, 0x99, 0x2e, 0x61, 0xbd, 0x05, 0x6c, 0xe4,
130 0x77, 0x70, 0xef, 0x51, 0x8d, 0xf7, 0xb4, 0x15, 0x40, 0x61, 0xe2, 0x35, 130 0xde, 0x83, 0xf4, 0x90, 0x96, 0x75, 0x62, 0xc2, 0x76, 0x65, 0x62, 0xa4,
131 0x71, 0xbb, 0x47, 0xe6, 0x6b, 0x58, 0xaf, 0x81, 0x8d, 0xdc, 0x7b, 0x94, 131 0xf7, 0x61, 0xec, 0x9d, 0xf8, 0x43, 0xba, 0x6f, 0x06, 0xad, 0xdc, 0xc7,
132 0x1e, 0xd2, 0xb2, 0x5e, 0x14, 0x6c, 0x57, 0x3e, 0x49, 0x7a, 0x1f, 0xc4, 132 0x27, 0x49, 0x2b, 0xd7, 0xab, 0xa6, 0xf7, 0xc3, 0xe2, 0x20, 0x69, 0x3f,
133 0xde, 0x89, 0x3f, 0xa4, 0xfb, 0x2a, 0xd0, 0xca, 0x7d, 0xfc, 0x3c, 0x69, 133 0x83, 0x3d, 0x67, 0x80, 0x79, 0x62, 0x0c, 0x74, 0x0e, 0x60, 0xcf, 0xfd,
134 0xe5, 0x7a, 0xcd, 0xf4, 0x7e, 0x58, 0x1c, 0x24, 0xed, 0x27, 0xb1, 0xe7, 134 0xc0, 0xc3, 0xbb, 0x80, 0x87, 0x7b, 0x80, 0x87, 0x7d, 0xc0, 0xc3, 0x34,
135 0x3c, 0x30, 0x4f, 0xac, 0xd1, 0xbe, 0x51, 0xec, 0x79, 0x04, 0x78, 0x78, 135 0xb0, 0xb0, 0x17, 0x58, 0xd8, 0x03, 0x2c, 0x4c, 0x81, 0x37, 0x31, 0x99,
136 0x3b, 0xf0, 0x70, 0x37, 0xf0, 0x70, 0x18, 0x78, 0x98, 0x03, 0x16, 0x0e, 136 0x02, 0x36, 0x4e, 0x01, 0x23, 0xa7, 0x30, 0xc7, 0xf0, 0xa4, 0x18, 0x0f,
137 0x01, 0x0b, 0x07, 0x81, 0x85, 0x59, 0xf0, 0x26, 0x29, 0x73, 0xc0, 0xc6, 137 0x60, 0x0f, 0xdf, 0x9c, 0x48, 0x9e, 0x82, 0x2c, 0xc5, 0x8b, 0x26, 0xe4,
138 0x39, 0x60, 0xe4, 0x1c, 0xe6, 0x18, 0x9f, 0x15, 0xeb, 0x4b, 0xd8, 0xc3, 138 0x3f, 0xd5, 0x0b, 0xd9, 0xee, 0x92, 0x99, 0xb2, 0x25, 0x05, 0xd8, 0xd4,
139 0x63, 0x33, 0x99, 0x93, 0x90, 0xa5, 0x54, 0x45, 0x41, 0xfe, 0xb3, 0x43, 139 0xb6, 0xad, 0xed, 0xd0, 0x35, 0xc8, 0x7b, 0x5c, 0xf4, 0xdf, 0x7a, 0xfd,
140 0x90, 0xed, 0x7e, 0xa9, 0xfa, 0xb6, 0x94, 0x69, 0x53, 0xb7, 0xf7, 0x42, 140 0xfc, 0xb1, 0x88, 0xf3, 0x4f, 0x94, 0xc5, 0x84, 0xc8, 0x79, 0xc9, 0xbb,
141 0xd7, 0x20, 0xef, 0x29, 0x31, 0x7f, 0x1b, 0xcc, 0xf3, 0x1f, 0x45, 0xdc, 141 0xed, 0x76, 0x9b, 0xd9, 0x85, 0x7e, 0x2c, 0xa7, 0xcc, 0x03, 0xc7, 0xef,
142 0xbf, 0xa3, 0x2c, 0xa6, 0x45, 0xce, 0x48, 0xc9, 0xeb, 0x75, 0x0a, 0xaa, 142 0x30, 0x87, 0x8e, 0x2b, 0x7f, 0x05, 0x78, 0x55, 0x91, 0xd1, 0x14, 0x75,
143 0x1f, 0xfd, 0x58, 0xce, 0xaa, 0xfb, 0x8f, 0x5c, 0xaf, 0xf6, 0x1e, 0x21, 143 0xab, 0x22, 0xa7, 0x53, 0xc9, 0xde, 0xa2, 0xd4, 0xcb, 0x58, 0x6c, 0x5c,
144 0x5f, 0xa6, 0x81, 0x57, 0x75, 0x99, 0xcc, 0x52, 0xb7, 0xea, 0x72, 0x22, 144 0xd9, 0x5a, 0x2b, 0x7d, 0x4c, 0xd9, 0xab, 0x82, 0x83, 0x67, 0xa9, 0xdb,
145 0x9b, 0x19, 0xaa, 0x48, 0x9b, 0x4c, 0x25, 0xa7, 0xb5, 0xad, 0xb5, 0x73, 145 0xcc, 0x1f, 0xe7, 0xfe, 0xdb, 0xf1, 0x0b, 0x83, 0x16, 0xce, 0x6f, 0x49,
146 0x87, 0xb5, 0xbd, 0x2a, 0xbb, 0x78, 0xd6, 0x06, 0x54, 0xe9, 0x08, 0xf7, 146 0x5f, 0x8f, 0x6d, 0x3e, 0xd4, 0x59, 0x84, 0x42, 0x24, 0xed, 0x79, 0xac,
147 0xd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fe, 0x33, 0x87, 154 0x71, 0xcf, 0xc9, 0x10, 0xce, 0xf0, 0xe9, 0xf2, 0xac, 0x1c, 0x70, 0x1d,
155 0xf2, 0xc2, 0xfd, 0xc7, 0xf5, 0xbe, 0xd2, 0xea, 0xb4, 0xec, 0xf7, 0xde, 155 0x39, 0x0d, 0xbc, 0xcf, 0x1d, 0x07, 0xee, 0x39, 0xeb, 0x81, 0x51, 0xc9,
156 0x30, 0x7a, 0x14, 0x94, 0xef, 0xc7, 0x99, 0x9e, 0xf0, 0x17, 0xb0, 0x7f, 156 0x73, 0xb4, 0xa1, 0x26, 0xfc, 0xbc, 0x69, 0xf0, 0xf7, 0x89, 0x09, 0xf2,
157 0x57, 0xe6, 0x81, 0xff, 0xc5, 0x23, 0xc0, 0x41, 0xb7, 0x03, 0x98, 0x95, 157 0xd7, 0x94, 0x47, 0x7f, 0xd1, 0x80, 0x3e, 0x26, 0xc0, 0xcf, 0x56, 0x39,
158 0x59, 0xa0, 0x4d, 0x8d, 0xc1, 0xef, 0xab, 0x6a, 0x5e, 0xf7, 0xc8, 0x91, 158 0xec, 0x26, 0x67, 0x33, 0x26, 0x70, 0x31, 0x65, 0x87, 0xa4, 0x2e, 0x8e,
159 0x19, 0x25, 0xdf, 0xbe, 0x31, 0x8d, 0x32, 0xb0, 0x31, 0x9b, 0x39, 0x3d, 159 0x7e, 0x5e, 0x9f, 0x5c, 0x2a, 0x84, 0xb3, 0x2e, 0xa2, 0xef, 0xdb, 0xa0,
160 0xa6, 0x7a, 0xe4, 0x86, 0xce, 0x14, 0xc6, 0xe5, 0x54, 0xc9, 0xdb, 0x18, 160 0x93, 0x63, 0x63, 0xf8, 0x65, 0xd0, 0x0f, 0xf2, 0x6b, 0x27, 0x67, 0xa7,
161 0x03, 0x2f, 0x8f, 0xa7, 0x15, 0xfb, 0x2a, 0x29, 0x66, 0x63, 0x38, 0xff, 161 0x4c, 0xf6, 0x4f, 0xe0, 0xcc, 0x80, 0x2b, 0x93, 0x00, 0x1e, 0x9b, 0xef,
162 0x0a, 0xfa, 0xbf, 0x8f, 0xf5, 0x7a, 0x64, 0x16, 0xbe, 0xd6, 0xec, 0x4c, 162 0x69, 0x33, 0x4f, 0x1a, 0x5c, 0xca, 0x59, 0x02, 0x34, 0x11, 0xd3, 0xda,
163 0x1e, 0xe3, 0x88, 0x5d, 0x99, 0xe3, 0x4b, 0x0a, 0x18, 0x33, 0x0b, 0xf9, 163 0xcf, 0x7d, 0x47, 0xb8, 0xce, 0x46, 0xf4, 0x7f, 0x07, 0x7e, 0xae, 0x2d,
164 0x1e, 0x85, 0x2f, 0x33, 0x03, 0xd1, 0x69, 0x4d, 0xe3, 0x4c, 0x7b, 0x9d, 164 0x33, 0x38, 0x97, 0x9f, 0x82, 0x57, 0x99, 0xb8, 0x57, 0x1e, 0x9e, 0x4c,
165 0x71, 0xe0, 0x41, 0xbe, 0x87, 0xef, 0x9c, 0xd3, 0x95, 0x13, 0x1e, 0xe5, 165 0x9e, 0x9b, 0x37, 0xf9, 0xee, 0x14, 0xf3, 0xe6, 0x6d, 0x22, 0x8d, 0xe4,
166 0x30, 0x2d, 0x4f, 0xf9, 0x1c, 0xd7, 0xbb, 0xf0, 0x1c, 0x7c, 0x9f, 0xdf, 166 0x57, 0x0a, 0xbc, 0x72, 0x6c, 0xd3, 0xdc, 0xaa, 0x7d, 0x3b, 0xea, 0x89,
167 0xf5, 0xae, 0x44, 0xff, 0x77, 0xe1, 0x07, 0x3b, 0x52, 0xc5, 0xb9, 0x95, 167 0x03, 0x9a, 0xe0, 0x67, 0x74, 0x07, 0xf5, 0x84, 0xf6, 0xce, 0xd7, 0x93,
168 0xc1, 0xcb, 0x7c, 0x2a, 0x28, 0x8f, 0xcf, 0x66, 0x16, 0xde, 0x50, 0x7c, 168 0x64, 0x7c, 0xca, 0x84, 0xff, 0xd1, 0x6d, 0xc9, 0x31, 0x55, 0x06, 0x8f,
169 0x77, 0x2b, 0xf3, 0xea, 0x5a, 0x91, 0x4e, 0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0x39, 0xc3, 0x4e, 0xa4, 0x36, 0x6a, 0x3f, 0xe6,
177 0x91, 0x96, 0xbb, 0x40, 0x5f, 0xa6, 0x02, 0x62, 0x0e, 0xab, 0x1c, 0xce, 177 0x49, 0x9c, 0xdb, 0x79, 0x9c, 0x6b, 0x49, 0x86, 0x4e, 0x5e, 0xa2, 0xcc,
178 0x7d, 0x50, 0x2a, 0xf4, 0xf7, 0xce, 0xc6, 0x9e, 0x92, 0xb1, 0x2a, 0xed, 178 0x76, 0xcd, 0x48, 0xb2, 0x6b, 0x4c, 0xb6, 0xd9, 0xd3, 0xd0, 0xb7, 0xcc,
179 0x11, 0x7e, 0x9e, 0xeb, 0x30, 0xbe, 0xc8, 0x6b, 0x5b, 0xd1, 0x0d, 0x39, 179 0x40, 0x65, 0x97, 0x99, 0xe6, 0x98, 0x23, 0x18, 0x83, 0xe7, 0xcc, 0x25,
180 0x80, 0x1d, 0xc9, 0x6e, 0x32, 0x7e, 0xce, 0x13, 0x38, 0xcf, 0x33, 0x38, 180 0x39, 0x54, 0x66, 0xdd, 0xef, 0x80, 0x9f, 0xb0, 0x3b, 0x3d, 0x4f, 0x6a,
181 0xf7, 0x9a, 0xec, 0x3d, 0xf6, 0x0a, 0x65, 0xba, 0xbf, 0x2a, 0x99, 0xfe, 181 0x39, 0xc7, 0x7c, 0x96, 0x3f, 0xdf, 0x25, 0x3d, 0x1f, 0xfb, 0xb1, 0x0f,
182 0x29, 0xd9, 0xe1, 0xcc, 0x43, 0x1f, 0xf3, 0xa3, 0xf5, 0x5b, 0x54, 0x8e, 182 0xc7, 0x2c, 0xce, 0xbb, 0x9b, 0xb6, 0x06, 0x78, 0xd3, 0x61, 0x56, 0x76,
183 0x63, 0x0e, 0x62, 0x0c, 0x9e, 0xd5, 0x57, 0xe4, 0x21, 0x9f, 0x75, 0x0f, 183 0x85, 0xd1, 0x7e, 0xba, 0x87, 0xef, 0x98, 0x07, 0xb6, 0xc6, 0x76, 0xce,
184 0x81, 0x9f,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 191 0x91, 0xde, 0xc4, 0x85, 0xd0, 0x7e, 0x96, 0xbb, 0xa6, 0x4c, 0xf0, 0x1e,
192 0xa4, 0x03, 0xb2, 0x0f, 0xb9, 0x87, 0xdc, 0x96, 0x34, 0x0f, 0xfe, 0xbd, 192 0xe7, 0x93, 0xdd, 0xde, 0xae, 0x71, 0xe9, 0x99, 0x10, 0x65, 0x94, 0xf2,
193 0x33, 0xf0, 0x8b, 0x33, 0x95, 0x3c, 0xe3, 0xb9, 0x4e, 0xe2, 0x26, 0x30, 193 0x9c, 0x77, 0xb7, 0xd9, 0xf7, 0x08, 0x65, 0x34, 0x86, 0xf3, 0x26, 0x2e,
194 0xcc, 0x87, 0x70, 0x60, 0xee, 0x25, 0xb5, 0x9e, 0xf4, 0xa6, 0x97, 0x62, 194 0xf0, 0x69, 0xc1, 0x26, 0xc6, 0x71, 0xc6, 0x5b, 0x34, 0xed, 0x7c, 0xb7,
195 0x7d, 0x2c, 0xf7, 0x2f, 0x41, 0x86, 0xab, 0x38, 0x9f, 0xc2, 0xce, 0x5e, 195 0x64, 0xca, 0xc6, 0x1a, 0xee, 0x7f, 0x6f, 0xf0, 0xea, 0xf8, 0xde, 0xc2,
196 0x83, 0x5b, 0xcf, 0xc6, 0x28, 0xaf, 0x55, 0x60, 0x4c, 0xc9, 0xdb, 0xe1, 196 0x33, 0x39, 0xb6, 0x94, 0x56, 0x9e, 0x67, 0xf5, 0x19, 0x9e, 0x06, 0xed,
197 0xdc, 0x4d, 0xbe, 0x39, 0x8e, 0x3c, 0xe7, 0x45, 0xb1, 0x03, 0xb6, 0xcf, 197 0xac, 0xc7, 0x73, 0xe6, 0x14, 0xf4, 0x0f, 0x58, 0xd1, 0xd3, 0x11, 0xbf,
198 0xa5, 0x1c, 0x26, 0x21, 0x07, 0x36, 0x6c, 0x68, 0x0a, 0x67, 0xfe, 0x6f, 198 0x88, 0xfe, 0x39, 0x60, 0x7c, 0xd1, 0x62, 0xdb, 0x55, 0x63, 0x71, 0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 0x65, 0xdd, 0xad, 0x9b, 228 0x8d, 0xb2, 0x89, 0x73, 0xb8, 0x60, 0x40, 0xe7, 0x6c, 0x33, 0xfd, 0x8a,
229 0x57, 0x96, 0xe9, 0x03, 0x26, 0x11, 0xc3, 0x84, 0xfd, 0x77, 0x7e, 0x22, 229 0x91, 0x83, 0x4c, 0x65, 0xcb, 0xfe, 0x7c, 0xd4, 0xe5, 0xea, 0xdc, 0x80,
230 0x68, 0x27, 0x7f, 0x9b, 0x65, 0x49, 0x2b, 0x23, 0xca, 0x0a, 0xe7, 0xb0, 230 0x9f, 0x13, 0xa0, 0x8f, 0x15, 0x85, 0xdc, 0x00, 0x8b, 0x63, 0xc9, 0xa3,
231 0x64, 0x41, 0x9f, 0x1c, 0x95, 0x7b, 0xc9, 0x2a, 0x42, 0xa6, 0x0a, 0x7e, 231 0x45, 0x59, 0xd4, 0xe1, 0x36, 0xf3, 0x5a, 0x3a, 0x3c, 0xa9, 0x71, 0xeb,
232 0x38, 0x1f, 0x75, 0xb6, 0x39, 0x4f, 0x10, 0xe6, 0x07, 0xe8, 0x6f, 0xb5, 232 0x32, 0xe8, 0xac, 0x48, 0x7f, 0xaa, 0x96, 0x76, 0x47, 0xe3, 0x19, 0xb1,
233 0x43, 0x6e, 0xee, 0xa2, 0x4d, 0x3a, 0x54, 0x91, 0x65, 0xfd, 0xdc, 0xaa, 233 0xa8, 0x52, 0x09, 0x6d, 0xad, 0xc8, 0xc1, 0xd4, 0x3b, 0x15, 0x51, 0x38,
234 0xce, 0xa7, 0x9f, 0xf7, 0x19, 0x8c, 0x3a, 0x07, 0x3a, 0xeb, 0x32, 0x92, 234 0xf8, 0x4d, 0xcd, 0x57, 0xe2, 0xa1, 0x0d, 0xb9, 0x8d, 0x29, 0x3f, 0x2e,
235 0x5d, 0x47, 0x1b, 0x63, 0xb0, 0x8b, 0xb8, 0x53, 0xaf, 0xc7, 0xb6, 0xd7, 235 0x94, 0x3e, 0x45, 0x9f, 0xe4, 0x88, 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xaf, 0xba, 0xb8, 0x6e, 0xef, 0x69, 0xe8, 0x76, 0x28, 0x7b, 243 0x9e, 0x9a, 0x82, 0x6c, 0x0f, 0xa9, 0x38, 0x80, 0x31, 0x40, 0x45, 0x76,
244 0x6b, 0xe5, 0x03, 0x5e, 0xd5, 0x67, 0xf1, 0xac, 0x9f, 0x39, 0x5c, 0x81, 244 0xa7, 0x86, 0x62, 0xe4, 0x43, 0xc6, 0xbc, 0x1a, 0xa6, 0x1f, 0x31, 0xe7,
245 0x2e, 0x2d, 0xea, 0xd8, 0x37, 0x3c, 0x17, 0xfa, 0x38, 0x99, 0xe3, 0x73, 245 0x92, 0x67, 0x29, 0xb4, 0xa7, 0xc0, 0xdb, 0x7f, 0x95, 0x5c, 0x8c, 0x75,
246 0x90, 0xed, 0xbd, 0x3a, 0x26, 0x60, 0x3c, 0x50, 0x97, 0x5d, 0xd9, 0x4f, 246 0xff, 0x55, 0x99, 0x86, 0xff, 0xa3, 0x7c, 0x22, 0xe5, 0x03, 0xd0, 0xa7,
247 0x25, 0xc9, 0x87, 0xbc, 0xfa, 0x71, 0x9c, 0x3e, 0xc3, 0xa2, 0x47, 0x9e, 247 0x83, 0xad, 0x2f, 0x93, 0xa7, 0x17, 0xc0, 0x67, 0xdf, 0x2f, 0xb8, 0x4c,
248 0x65, 0xd1, 0x9e, 0x05, 0x26, 0xfc, 0xab, 0x14, 0x93, 0xac, 0x7b, 0xab, 248 0xbf, 0x54, 0x96, 0xfa, 0xcf, 0x22, 0x8f, 0x94, 0xfe, 0x19, 0x76, 0xc8,
249 0x3e, 0x0f, 0xbf, 0x4a, 0xfb, 0x47, 0xda, 0xde, 0xd3, 0xbf, 0x83, 0x5d, 249 0xc4, 0x7c, 0xb4, 0x77, 0xb4, 0x29, 0xac, 0xdf, 0x11, 0xa6, 0xff, 0xe6,
250 0xf7, 0xc9, 0xd3, 0x25, 0xf0, 0x39, 0xf4, 0x01, 0x7e, 0x40, 0x1f, 0x55, 250 0xd9, 0xff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, 0xce, 0x70, 0xc7, 0x49, 0x26, 0x9c, 0x14, 0x70, 0x78, 0x3e, 0xd9, 302 0xe4, 0xb0, 0xde, 0xc6, 0xb9, 0x0e, 0xc8, 0x34, 0xfc, 0x8b, 0x99, 0x5e,
303 0xae, 0xf3, 0xc5, 0x9f, 0x70, 0x59, 0xef, 0xe0, 0x4c, 0x47, 0x65, 0x1e, 303 0xd0, 0xb8, 0xbd, 0x19, 0xfd, 0xa9, 0x7b, 0xe4, 0xf9, 0x80, 0x0c, 0xc6,
304 0xfe, 0x43, 0x75, 0x08, 0x34, 0xee, 0xec, 0x42, 0x7f, 0xea, 0x1d, 0x79, 304 0xc8, 0xd3, 0x18, 0xfa, 0xef, 0x45, 0x9f, 0x46, 0x3c, 0xff, 0x28, 0x34,
305 0x3e, 0x0a, 0xdb, 0x4b, 0x9e, 0x26, 0xd1, 0x7f, 0x0f, 0xfa, 0x74, 0xe2, 305 0x6d, 0x33, 0x9e, 0xfe, 0x3c, 0xca, 0x9c, 0x23, 0x68, 0x5b, 0x77, 0x85,
306 0x79, 0x5f, 0x6c, 0xde, 0x61, 0xec, 0xfc, 0x79, 0x94, 0x39, 0x47, 0xd4, 306 0x45, 0xcd, 0xc9, 0x31, 0xcd, 0x0a, 0x03, 0x16, 0xd7, 0xe2, 0x3a, 0x6c,
307 0x76, 0x7e, 0x2e, 0x2e, 0x7a, 0x4e, 0x8e, 0xe9, 0xd2, 0xfa, 0xbf, 0xbc, 307 0x7b, 0xaf, 0x72, 0x47, 0x77, 0x6f, 0x60, 0xbd, 0x86, 0xc0, 0x7a, 0xbd,
308 0x16, 0xd7, 0x61, 0xdb, 0xcf, 0xea, 0xd7, 0x0f, 0x0c, 0x45, 0xd6, 0xeb, 308 0x81, 0xf5, 0x48, 0x67, 0x63, 0x80, 0xce, 0x46, 0x8c, 0xff, 0x5d, 0xac,
309 0x88, 0xac, 0x37, 0x14, 0x59, 0x8f, 0x74, 0x76, 0x46, 0xe8, 0xec, 0xc4, 309 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 0xad, 0x33, 0xb2,
317 0xb1, 0x25, 0x57, 0xbb, 0xca, 0xea, 0x1d, 0xe0, 0xd9, 0x6f, 0x34, 0x58, 317 0xc7, 0x99, 0x4b, 0xa8, 0xd7, 0xb1, 0x22, 0xe2, 0x13, 0x65, 0x87, 0x7c,
318 0xda, 0x6a, 0x15, 0x8e, 0x30, 0x5f, 0xd0, 0x66, 0x62, 0x3e, 0xc4, 0x1e, 318 0x3b, 0x41, 0x3b, 0x44, 0xdf, 0x86, 0x36, 0xf6, 0x9c, 0x7e, 0xc7, 0x13,
319 0xda, 0xc6, 0xd8, 0xa6, 0x9d, 0x36, 0x86, 0x7e, 0x0b, 0xed, 0xe7, 0x69, 319 0x72, 0xfc, 0xd0, 0x4c, 0xa3, 0x5c, 0x54, 0x7c, 0xb5, 0x65, 0x7e, 0x81,
320 0xf3, 0x8e, 0x27, 0x64, 0xf8, 0x81, 0x6a, 0xa7, 0xbc, 0xa8, 0x79, 0xea, 320 0xaf, 0x61, 0xfd, 0xbd, 0xe6, 0x31, 0xfd, 0x2d, 0x64, 0x3f, 0x7c, 0x27,
321 0xc8, 0xd9, 0x06, 0x4f, 0xe3, 0xe6, 0xbb, 0xcc, 0x01, 0xf3, 0xcd, 0xa3, 321 0xbc, 0x97, 0x32, 0xa0, 0x23, 0x21, 0xed, 0xdd, 0xcc, 0x61, 0x14, 0xf1,
322 0x0f, 0x7e, 0x11, 0xde, 0x6b, 0x79, 0xd0, 0x90, 0x96, 0xde, 0x01, 0xc6, 322 0x74, 0xf0, 0x34, 0xf0, 0x84, 0xcd, 0x42, 0x0c, 0xd2, 0xde, 0xcd, 0x58,
323 0x6e, 0x15, 0x3c, 0x99, 0xa7, 0xb0, 0xf0, 0x0c, 0xf2, 0x17, 0xbd, 0x03, 323 0x50, 0x40, 0xdb, 0x15, 0x15, 0x07, 0xce, 0x94, 0x6d, 0xe3, 0x4e, 0xd7,
324 0xb0, 0x4b, 0xc0, 0xa1, 0xde, 0x81, 0x73, 0x3a, 0x9e, 0xab, 0xfa, 0x8e, 324 0xcb, 0x1d, 0xcd, 0x3b, 0xab, 0xe5, 0x8e, 0x1e, 0xa8, 0xc5, 0x79, 0x9c,
325 0x75, 0x9b, 0x17, 0xe4, 0x88, 0xce, 0xba, 0x17, 0xca, 0x11, 0xdd, 0xb3, 325 0xf2, 0x73, 0x47, 0xf3, 0xa2, 0x72, 0x47, 0xa7, 0xae, 0x93, 0x3b, 0xca,
326 0x8e, 0x79, 0x8d, 0x30, 0x47, 0x74, 0x56, 0x74, 0x8e, 0xe8, 0xf8, 0x45, 326 0xac, 0x3d, 0x77, 0xc4, 0xf9, 0x2d, 0xb9, 0xbb, 0xc7, 0x36, 0xbf, 0xa8,
327 0x72, 0x44, 0xf9, 0x4b, 0xcf, 0x11, 0x71, 0x7e, 0x5b, 0xee, 0x1c, 0x74, 327 0x73, 0x47, 0x6f, 0x88, 0x97, 0x3b, 0xba, 0x28, 0x2b, 0xe7, 0x8e, 0x8e,
328 0xd4, 0xaf, 0x9a, 0x1c, 0xd1, 0x1b, 0x12, 0xe4, 0x88, 0x5e, 0x94, 0xb5, 328 0x56, 0xe5, 0x8e, 0x9a, 0x54, 0xee, 0x88, 0xf3, 0x78, 0xb9, 0x23, 0x96,
329 0x73, 0x44, 0x87, 0x9a, 0x72, 0x44, 0x9b, 0x75, 0x8e, 0x88, 0xf3, 0x04, 329 0xf3, 0xdd, 0xbf, 0xac, 0x72, 0xe9, 0xf9, 0x6e, 0x60, 0xb0, 0xeb, 0x63,
330 0x39, 0x22, 0x96, 0x4b, 0x03, 0x43, 0x91, 0x5c, 0x07, 0xf0, 0xd7, 0xbb, 330 0x9c, 0x6d, 0x0c, 0xa8, 0xf8, 0xf2, 0x4a, 0xb8, 0xd9, 0xf1, 0x31, 0x8e,
331 0x01, 0x7c, 0x73, 0xac, 0x51, 0x2f, 0xc4, 0x34, 0x62, 0xff, 0x15, 0x0d, 331 0xb6, 0x60, 0xf3, 0x82, 0x3d, 0xf3, 0x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, 0x59, 0xb9, 0x70, 0x0e, 0xe5, 0x81, 0x35, 0x72, 0x28, 339 0xc1, 0xcc, 0x03, 0xb3, 0x32, 0x16, 0xf3, 0x5b, 0x2b, 0xe7, 0x60, 0x1e,
340 0x2f, 0xcb, 0x72, 0x0e, 0xe5, 0x65, 0x09, 0x73, 0x28, 0x31, 0x59, 0xda, 340 0x5a, 0x21, 0x07, 0xf3, 0x5d, 0x59, 0xcc, 0xc1, 0x7c, 0x57, 0xfc, 0x1c,
341 0x1c, 0x48, 0xe3, 0x03, 0xfe, 0x12, 0x7e, 0x67, 0xf0, 0x0b, 0x72, 0x2a, 341 0x0c, 0xe7, 0x08, 0x69, 0x9f, 0x56, 0x30, 0xee, 0x02, 0x7e, 0xe7, 0xf1,
342 0x67, 0x1b, 0xf4, 0xaf, 0x95, 0x53, 0x79, 0x7d, 0xdd, 0x07, 0xc9, 0xa9, 342 0xf3, 0xf2, 0x32, 0xf3, 0x0b, 0x7b, 0x58, 0x29, 0x2f, 0xf3, 0x6f, 0xb5,
343 0x04, 0x36, 0x20, 0xcc, 0xa9, 0xe0, 0xe7, 0xc0, 0xe6, 0xa8, 0x68, 0x4e, 343 0x1f, 0x24, 0x2f, 0xe3, 0xd9, 0x04, 0x3f, 0x2f, 0x83, 0x9f, 0x0d, 0x1b,
344 0xe5, 0x27, 0xd4, 0x07, 0xd4, 0xb1, 0xcc, 0x7a, 0xe8, 0x05, 0xec, 0x52, 344 0x64, 0x06, 0xf3, 0x32, 0xef, 0x53, 0x37, 0x50, 0xc7, 0x32, 0xeb, 0xa1,
345 0x5e, 0xe7, 0x38, 0x3e, 0x67, 0x78, 0x38, 0x87, 0x3d, 0xa7, 0x71, 0x16, 345 0x23, 0xb0, 0x53, 0x19, 0xd8, 0x99, 0x69, 0xf7, 0xd7, 0xd5, 0x79, 0xcc,
346 0xe4, 0x63, 0xaf, 0xf6, 0x2d, 0xf3, 0x76, 0xca, 0x2a, 0xf4, 0xc1, 0x9a, 346 0xb8, 0x53, 0xd8, 0x77, 0x02, 0xe7, 0x41, 0x5e, 0xb6, 0x2b, 0x5f, 0x34,
347 0x4d, 0xf3, 0xbb, 0xb8, 0x6d, 0xed, 0xf5, 0x29, 0xe3, 0x09, 0xab, 0x8c, 347 0x63, 0xc5, 0x8d, 0x6c, 0x27, 0xac, 0xda, 0x38, 0xbf, 0x9d, 0x5b, 0xc6,
348 0xbd, 0x0c, 0x4f, 0xcf, 0xc9, 0x5e, 0x3f, 0xf4, 0xa9, 0x06, 0x1a, 0x73, 348 0x50, 0x99, 0xf2, 0x1e, 0x31, 0x0a, 0xd8, 0x4b, 0xdf, 0xf8, 0x94, 0x0c,
349 0x50, 0x37, 0xe7, 0x81, 0xb3, 0xc0, 0x89, 0x4b, 0xb0, 0x51, 0xa7, 0x40, 349 0x95, 0x7d, 0x3f, 0xab, 0x5b, 0x9f, 0xc5, 0x94, 0xd2, 0xd3, 0x69, 0xf0,
350 0x73, 0x74, 0x1f, 0x88, 0x89, 0x07, 0x51, 0xa7, 0xcf, 0x9c, 0xbe, 0x65, 350 0x00, 0x98, 0xb1, 0x06, 0x9b, 0x75, 0x16, 0x34, 0x07, 0xf7, 0x81, 0x18,
351 0x48, 0x4b, 0x9a, 0x7a, 0x7e, 0x09, 0xf3, 0xb1, 0xee, 0x94, 0x8e, 0xc7, 351 0xba, 0x07, 0x75, 0xea, 0xdc, 0xe9, 0x6f, 0xfa, 0xb4, 0x24, 0xa8, 0xf3,
352 0xca, 0x83, 0xdc, 0x2b, 0x6d, 0xdd, 0x22, 0xe8, 0x43, 0x5d, 0x95, 0x31, 352 0x6b, 0x98, 0x8f, 0x75, 0x67, 0x55, 0xfc, 0x56, 0xe8, 0xe1, 0x5e, 0x69,
353 0x20, 0xed, 0x5e, 0x18, 0xa3, 0xb5, 0xeb, 0x18, 0xad, 0x4b, 0xf3, 0x83, 353 0xfb, 0xe6, 0x40, 0x1f, 0xea, 0x66, 0x18, 0x33, 0xd2, 0x0e, 0xfa, 0x31,
354 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cc, 0xfb, 0x12, 0x45, 0x1d, 0xcf, 0x70, 0xbc, 0x96, 376 0xa4, 0xe5, 0x3e, 0x83, 0x77, 0xea, 0xd1, 0xeb, 0xf0, 0x47, 0x78, 0x47,
377 0x49, 0xc4, 0x20, 0x76, 0x24, 0x97, 0x9e, 0x30, 0xb1, 0x1b, 0x75, 0xac, 377 0xe1, 0x27, 0x2a, 0x5f, 0x37, 0xed, 0xd2, 0xf7, 0x60, 0xcc, 0xb4, 0x53,
378 0x1d, 0x67, 0xe8, 0x9b, 0x58, 0x85, 0xf1, 0xeb, 0xca, 0x7b, 0x12, 0x6b, 378 0xf7, 0xdb, 0xa2, 0xbe, 0xb1, 0x66, 0x53, 0x3b, 0xf4, 0xf7, 0x36, 0xda,
379 0xcb, 0xc0, 0x96, 0x0f, 0x20, 0x03, 0xcd, 0xe7, 0x97, 0x80, 0xee, 0x87, 379 0xc4, 0x24, 0x31, 0x75, 0xc9, 0x79, 0xf3, 0x8e, 0x47, 0x4e, 0xc5, 0x5c,
380 0xe7, 0x17, 0xfa, 0x31, 0x73, 0x66, 0xdf, 0xdd, 0xc1, 0x19, 0xfe, 0xbf, 380 0x1c, 0xaf, 0x7c, 0x7f, 0xc4, 0x49, 0x56, 0xe0, 0xfb, 0x40, 0x44, 0xc7,
381 0xd8, 0xa7, 0x15, 0xd9, 0x67, 0x88, 0x47, 0x0f, 0x98, 0x7d, 0xde, 0xd4, 381 0x97, 0xd4, 0xf9, 0xa8, 0x8a, 0x7d, 0xbd, 0x78, 0x8a, 0xf1, 0xf7, 0xd2,
382 0x84, 0x47, 0x23, 0x4d, 0x3a, 0xfb, 0x71, 0xe2, 0xd1, 0x9f, 0xac, 0xff, 382 0xbb, 0x1d, 0x2b, 0xcb, 0x40, 0xcb, 0x07, 0x90, 0x81, 0xea, 0xf3, 0x8b,
383 0xf8, 0xf1, 0x88, 0xfb, 0xea, 0x5e, 0x13, 0x87, 0x82, 0x7d, 0x3c, 0x22, 383 0x00, 0x8b, 0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, 0x53, 0xff, 0x59, 0xf4, 420 0x14, 0x73, 0xd3, 0xd2, 0x32, 0xc7, 0x27, 0xea, 0x3d, 0x59, 0x39, 0x06,
421 0x7f, 0xad, 0xa9, 0x3f, 0xea, 0x8e, 0xb5, 0x98, 0xef, 0x62, 0xc4, 0xd8, 421 0xfb, 0xdc, 0x07, 0x59, 0xac, 0x91, 0x9c, 0x9a, 0xef, 0x98, 0xe4, 0x9f,
422 0x7d, 0x26, 0x16, 0xc7, 0xb3, 0xd6, 0xfc, 0xad, 0x85, 0x72, 0xd7, 0x83, 422 0xfd, 0xcf, 0xc6, 0xa5, 0xfd, 0x51, 0x77, 0xd2, 0xef, 0xff, 0x78, 0x55,
423 0x33, 0x08, 0xef, 0xb4, 0x51, 0x5f, 0xf3, 0xd0, 0xd7, 0x65, 0x5f, 0x26, 423 0xff, 0xc7, 0xd1, 0xff, 0x67, 0x55, 0xfd, 0x1f, 0x0f, 0xf4, 0x3f, 0xa1,
424 0x90, 0xc7, 0xa8, 0x2c, 0x12, 0x1f, 0x2a, 0x12, 0x73, 0x7d, 0xfa, 0x47, 424 0xfb, 0xd7, 0xa2, 0xbf, 0xd2, 0x83, 0x26, 0xdf, 0x2f, 0x36, 0x1d, 0xc4,
425 0x56, 0xb9, 0x1a, 0xda, 0x24, 0xde, 0x5b, 0xe2, 0x7d, 0xd7, 0xc0, 0xf6, 425 0xb3, 0xcf, 0xfa, 0x63, 0x4e, 0x04, 0xc6, 0x4c, 0x56, 0xad, 0x31, 0x89,
426 0xc6, 0xdd, 0x45, 0x13, 0x83, 0x5d, 0xd1, 0x06, 0xda, 0x81, 0x97, 0x21, 426 0x7e, 0xf1, 0xa6, 0xa5, 0x6b, 0xa0, 0xee, 0x64, 0x8d, 0xfe, 0xbe, 0x47,
427 0x66, 0xca, 0xe1, 0x40, 0x6f, 0x28, 0xbf, 0x9c, 0xdf, 0xe8, 0x0f, 0x65, 427 0x9f, 0xe5, 0xa0, 0xce, 0x17, 0xe0, 0x59,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xb1, 442 0x2e, 0xc6, 0xac, 0xf0, 0x67, 0xbb, 0xfc, 0xd8, 0x88, 0x7e, 0xb3, 0x6d,
443 0x8c, 0x4d, 0xfb, 0xdb, 0x89, 0xa1, 0x05, 0xff, 0x82, 0xe3, 0x31, 0x8e, 443 0x14, 0xdc, 0x3d, 0xe6, 0x90, 0x6a, 0x63, 0x8e, 0xf7, 0x36, 0xf9, 0x9c,
444 0xe3, 0xd9, 0x47, 0xc7, 0xa1, 0xe8, 0xb7, 0x68, 0xc6, 0x07, 0x71, 0x68, 444 0xba, 0x27, 0x70, 0x5e, 0xe7, 0xd2, 0xa6, 0x54, 0x4c, 0xc0, 0xef, 0x1c,
445 0xc1, 0xff, 0x71, 0x5b, 0x80, 0x83, 0x17, 0x8a, 0x59, 0x3e, 0xdf, 0xce, 445 0x85, 0xd4, 0x46, 0xed, 0x03, 0x5e, 0x0f, 0x67, 0x97, 0xc6, 0xcf, 0xa6,
446 0xbc, 0xde, 0xa2, 0x77, 0x31, 0x5a, 0x57, 0xc7, 0xbd, 0xb1, 0x55, 0x71, 446 0x79, 0x04, 0x63, 0x19, 0x3f, 0x7f, 0x21, 0x4a, 0x4c, 0xcd, 0x96, 0x57,
447 0xaf, 0x6d, 0xe2, 0xda, 0x5f, 0xd2, 0x71, 0x6f, 0xc0, 0x63, 0xee, 0x25, 447 0x1d, 0x8f, 0x71, 0x1c, 0xcf, 0x3e, 0x2a, 0x56, 0x46, 0xbf, 0x39, 0x3d,
448 0x1a, 0x47, 0xb9, 0xc0, 0x42, 0x7e, 0x53, 0x21, 0x3e, 0xd0, 0x47, 0x81, 448 0xde, 0x8b, 0x95, 0xb3, 0xe5, 0xad, 0x51, 0x0f, 0x17, 0x57, 0x8b, 0x63,
449 0x9f, 0x35, 0xfd, 0x8b, 0xe0, 0x73, 0x72, 0x0d, 0xb9, 0xf9, 0xb8, 0xed, 449 0x8e, 0x44, 0x99, 0x8b, 0x9c, 0x73, 0xaf, 0x47, 0xeb, 0xf2,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0x29, 0x77,
472 0xb3, 0x8e, 0x69, 0xe7, 0xff, 0xef, 0x48, 0x02, 0xf3, 0x78, 0x0f, 0xb8, 472 0x69, 0x33, 0x5f, 0xe6, 0x7b, 0x17, 0xcf, 0xc7, 0xe8, 0xef, 0x5c, 0x7a,
473 0x43, 0x62, 0xb3, 0xc1, 0x37, 0xcb, 0xe0, 0xff, 0xb8, 0xa4, 0xd0, 0x87, 473 0xb7, 0x62, 0xf1, 0x6e, 0x72, 0x64, 0xe1, 0x6e, 0xf2, 0x18, 0x64, 0xc6,
474 0x77, 0x3c, 0xe3, 0xb2, 0x5f, 0xe7, 0x2c, 0x42, 0x59, 0xfe, 0x35, 0xf0, 474 0x9c, 0x88, 0xc8, 0x74, 0xc0, 0xb6, 0x8e, 0xba, 0xf0, 0x9b, 0x26, 0x6d,
475 0x78, 0x73, 0x7e, 0xb9, 0x9c, 0x5c, 0xc3, 0xee, 0x27, 0xa5, 0x3c, 0x43, 475 0xdd, 0xce, 0xff, 0xa7, 0x82, 0xb8, 0xb0, 0xc4, 0xfb, 0xcc, 0x0d, 0x12,
476 0x79, 0xbe, 0xc1, 0xfc, 0xff, 0x82, 0xd3, 0x52, 0xf6, 0x4f, 0x99, 0xf8, 476 0x9a, 0x54, 0x98, 0x1a, 0xf3, 0xfe, 0xaf, 0x4e, 0x1c, 0x7d, 0x78, 0x77,
477 0x42, 0x7f, 0xdb, 0x01, 0x2f, 0xb7, 0x18, 0x1b, 0x8c, 0x67, 0x75, 0x0b, 477 0x35, 0x2c, 0x87, 0x62, 0x94, 0x65, 0x5f, 0x8e, 0xbf, 0x05, 0xfe, 0x36,
478 0x6d, 0x1e, 0xd6, 0x38, 0x2e, 0xc3, 0xd3, 0x3b, 0x52, 0x7b, 0x81, 0x77, 478 0x65, 0x16, 0xcb, 0x31, 0x2d, 0xd7, 0x94, 0x69, 0x5f, 0xfe, 0x62, 0x32,
479 0x63, 0x7a, 0xcd, 0xcb, 0xe1, 0xb9, 0x75, 0x9e, 0xef, 0x8d, 0x97, 0xca, 479 0x32, 0x41, 0x59, 0xde, 0xa1, 0xff, 0x9f, 0xc4, 0x39, 0x29, 0x94, 0xcf,
480 0xf7, 0xd0, 0x3f, 0xae, 0x62, 0x7f, 0x5b, 0x20, 0x1f, 0x5f, 0x95, 0xe2, 480 0xea, 0x78, 0x43, 0x7d, 0x8b, 0x02, 0x1f, 0x5b, 0xb4, 0x0d, 0xc6, 0x73,
481 0xb1, 0x6b, 0x65, 0xf8, 0x68, 0x06, 0xf4, 0xbc, 0x5f, 0x2f, 0x67, 0xe1, 481 0xa6, 0x85, 0x36, 0x8f, 0xdf, 0x1e, 0xa5, 0x6f, 0x7c, 0x5b, 0x7c, 0x08,
482 0x4b, 0x3f, 0xcd, 0x7b, 0x63, 0xc0, 0x50, 0xf0, 0xed, 0xf9, 0x55, 0xdf, 482 0x78, 0x37, 0xa8, 0x72, 0x27, 0x37, 0xc2, 0x6f, 0xe3, 0x1a, 0xdf, 0x48,
483 0xb1, 0xa3, 0x77, 0xcd, 0xfa, 0x1b, 0x77, 0x87, 0x9e, 0xf5, 0x25, 0xd1, 483 0xd7, 0xca, 0x73, 0xdf, 0x5f, 0xbe, 0x8c, 0xfd, 0xb5, 0x40, 0x36, 0xbe,
484 0x49, 0x9a, 0x67, 0x96, 0xef, 0x8f, 0x2f, 0xfa, 0xbb, 0xb4, 0x6d, 0x7b, 484 0x2a, 0xb9, 0x93, 0xb7, 0x49, 0xdf, 0x89, 0x24, 0xe8, 0x79, 0xbf, 0x52,
485 0xc6, 0x5f, 0x91, 0xfb, 0xd1, 0x67, 0x38, 0x5e, 0xfb, 0x1e, 0xec, 0xdb, 485 0x48, 0xc1, 0xb7, 0x7e, 0x96, 0x77, 0xe1, 0x80, 0xa1, 0x2e, 0x30, 0x14,
486 0x39, 0x8b, 0xf6, 0x6d, 0xca, 0x93, 0xab, 0x63, 0xc2, 0xf3, 0x10, 0x0b, 486 0xbc, 0x7b, 0x61, 0x99, 0xbf, 0x11, 0xbc, 0x43, 0x97, 0x5a, 0xb8, 0x13,
487 0x3c, 0xd0, 0x77, 0x38, 0x82, 0xef, 0xfb, 0x3d, 0xfa, 0x5c, 0x03, 0xac, 487 0xf5, 0x7c, 0x59, 0x22, 0x8d, 0xa4, 0x7b, 0x62, 0xf1, 0x2e, 0xfc, 0x5c,
488 0x58, 0x88, 0xdc, 0xc1, 0x58, 0x3e, 0xdb, 0xe0, 0x6e, 0x46, 0x70, 0x16, 488 0x39, 0xa7, 0xec, 0xdb, 0x73, 0xe5, 0x25, 0x39, 0x21, 0x75, 0x8e, 0xc3,
489 0xc1, 0xfd, 0x11, 0xed, 0x6f, 0x1e, 0xdc, 0xe3, 0x06, 0xf7, 0x47, 0x7a, 489 0xa5, 0x97, 0x61, 0xe3, 0x2e, 0x1b, 0xb4, 0x71, 0x63, 0xae, 0xdc, 0x12,
490 0x67, 0x59, 0xd7, 0xd5, 0x64, 0xfb, 0x12, 0x90, 0x01, 0xde, 0x3b, 0xe2, 490 0x12, 0x9e, 0x89, 0x18, 0xe0, 0x83, 0xba, 0x9b, 0xe2, 0xdd, 0x4d, 0x68,
491 0xbd, 0x71, 0xd2, 0xac, 0x73, 0x1d, 0xff, 0x47, 0xdd, 0xd5, 0xc7, 0xb6, 491 0x55, 0x67, 0xfb, 0x7f, 0xd4, 0x5d, 0x7d, 0x6c, 0x5b, 0xd7, 0x75, 0x3f,
492 0x75, 0x5d, 0xf7, 0xc3, 0x47, 0xea, 0xc3, 0xb4, 0x2c, 0x53, 0x32, 0x25, 492 0x7c, 0xa4, 0x3e, 0x4c, 0xcb, 0xd2, 0x93, 0x4c, 0xc9, 0xb4, 0x2d, 0xcb,
493 0xd3, 0x96, 0x2c, 0xbf, 0x27, 0x3d, 0x59, 0x72, 0xac, 0x14, 0xac, 0xab, 493 0x8f, 0xd2, 0x93, 0xa5, 0xc4, 0x4a, 0xc1, 0x79, 0xda, 0xaa, 0x01, 0x5a,
494 0xad, 0x02, 0x46, 0xa4, 0x0c, 0x49, 0x7f, 0xb4, 0x08, 0x06, 0xfa, 0xa3, 494 0xc7, 0x52, 0xf4, 0xc7, 0x82, 0x60, 0xa5, 0x65, 0x25, 0xf3, 0xd2, 0x2c,
495 0x99, 0x8b, 0x66, 0xab, 0x4b, 0xd9, 0x4e, 0x0a, 0xf4, 0x0f, 0xb7, 0xc5, 495 0x51, 0x29, 0xdb, 0xc9, 0xfe, 0x18, 0xe0, 0x25, 0xd9, 0x9a, 0xfd, 0x51,
496 0x80, 0x6c, 0x58, 0x60, 0x86, 0xb4, 0x12, 0x63, 0x56, 0x4c, 0xd6, 0x66, 496 0xe4, 0x95, 0x94, 0x12, 0x63, 0x56, 0x4d, 0xc6, 0xe6, 0x84, 0x02, 0x0b,
497 0x85, 0x0c, 0xd8, 0x30, 0x4e, 0x54, 0x9c, 0x14, 0x50, 0xc6, 0x04, 0x69, 497 0x36, 0x56, 0x92, 0x9d, 0x14, 0x50, 0xc0, 0x24, 0x6d, 0x87, 0x2c, 0x6d,
498 0x83, 0xa2, 0x58, 0x61, 0x45, 0x76, 0x36, 0x6c, 0x7f, 0x65, 0x43, 0xd0, 498 0x11, 0x55, 0x76, 0xda, 0x7f, 0x8d, 0x2d, 0xc0, 0xb2, 0x2e, 0x69, 0x14,
499 0x05, 0x9b, 0xb3, 0x38, 0x76, 0xb0, 0x06, 0x45, 0xd6, 0x7d, 0x62, 0x18, 499 0x3b, 0xc8, 0x02, 0x2c, 0x58, 0xbb, 0x6e, 0x28, 0xf6, 0x4f, 0xc7, 0x9d,
500 0xd0, 0x0d, 0xdc, 0xf9, 0xdd, 0x0f, 0xf2, 0xf1, 0xf1, 0x51, 0x1f, 0x89, 500 0xdf, 0xfd, 0x20, 0x1f, 0xc9, 0x47, 0x7d, 0x24, 0x6e, 0x81, 0x09, 0x10,
501 0x33, 0x60, 0x02, 0x04, 0xbe, 0xf7, 0x78, 0xdf, 0x7b, 0xf7, 0x9e, 0x7b, 501 0xc8, 0xf7, 0xde, 0x7d, 0xef, 0xdd, 0x7b, 0xee, 0xf9, 0xf8, 0x9d, 0x73,
502 0xce, 0xb9, 0xbf, 0x73, 0xee, 0x39, 0x87, 0x9e, 0x7b, 0xdb, 0x9b, 0xf3, 502 0xcf, 0xb9, 0x94, 0xba, 0xe2, 0x35, 0x57, 0x6e, 0x49, 0x65, 0x7e, 0x65,
503 0xb9, 0xca, 0x77, 0x8e, 0x8a, 0x77, 0x0e, 0x28, 0x9d, 0xa5, 0xe3, 0xc5, 503 0xce, 0x89, 0x9c, 0x0f, 0x95, 0x43, 0x0b, 0x9a, 0x3a, 0x27, 0x6d, 0x99,
504 0x63, 0xc6, 0x6c, 0x61, 0x22, 0xe2, 0x67, 0xfe, 0x9e, 0xad, 0xc2, 0xbe, 504 0x17, 0x33, 0xb0, 0x80, 0x73, 0x3d, 0x35, 0xf6, 0xaf, 0x95, 0xf9, 0xc0,
505 0x6e, 0x87, 0xe1, 0xd6, 0xa2, 0x67, 0xbc, 0x85, 0x9e, 0xcd, 0x32, 0xc1, 505 0x14, 0x31, 0x85, 0x69, 0x13, 0x7d, 0xde, 0x2b, 0xf4, 0x81, 0xf7, 0xba,
506 0xf6, 0x78, 0x5d, 0x77, 0x4b, 0xda, 0xc9, 0xeb, 0x88, 0x85, 0xd7, 0x31, 506 0x7c, 0x40, 0xe9, 0xbc, 0x56, 0xa5, 0xa3, 0x36, 0xc2, 0x6f, 0xf2, 0x9d,
507 0x0e, 0x92, 0x76, 0x75, 0x19, 0xba, 0xe2, 0x8c, 0x6f, 0x68, 0xd0, 0xee, 507 0xfd, 0xe2, 0x9d, 0xdd, 0x4a, 0x67, 0xe9, 0xdc, 0xf7, 0x71, 0x63, 0xba,
508 0x74, 0x9d, 0x76, 0x3b, 0xff, 0x1f, 0xd1, 0xee, 0x1d, 0x81, 0x7f, 0x5f, 508 0x08, 0x5f, 0x9b, 0xe9, 0x52, 0x87, 0xdf, 0xac, 0x4d, 0xe8, 0xf8, 0xb9,
509 0xad, 0x22, 0x6e, 0x4d, 0x63, 0x00, 0x9d, 0x3b, 0x04, 0x3a, 0x42, 0x9f, 509 0x3a, 0x3a, 0x56, 0xcb, 0x03, 0xfb, 0xe6, 0x65, 0x9d, 0x2d, 0x69, 0x26,
510 0x5a, 0xe5, 0x15, 0x82, 0x4e, 0x45, 0x5c, 0x71, 0xad, 0xf6, 0x5a, 0xb4, 510 0xcf, 0x23, 0x9f, 0x5f, 0xe7, 0x65, 0x48, 0x9a, 0x95, 0xe5, 0xe7, 0x92,
511 0xee, 0xa7, 0x64, 0xbb, 0x04, 0xf6, 0x09, 0xfc, 0x79, 0xed, 0xd7, 0xc8, 511 0x3b, 0x27, 0xa3, 0x42, 0xb3, 0xe9, 0x32, 0xcd, 0xf6, 0xfc, 0x3f, 0xa0,
512 0x63, 0x1f, 0x6b, 0x8d, 0x04, 0x56, 0x72, 0xdb, 0x27, 0x0c, 0x08, 0x1d, 512 0xd9, 0x4d, 0x81, 0x79, 0x5f, 0x29, 0x22, 0xff, 0x6e, 0x58, 0xe4, 0x2e,
513 0xf6, 0xc9, 0xb1, 0x4d, 0xda, 0x27, 0xe7, 0xa5, 0x7d, 0x92, 0xdd, 0xb8, 513 0xac, 0xd2, 0x88, 0xb2, 0xff, 0xee, 0x1a, 0x28, 0xd0, 0x12, 0xba, 0x34,
514 0x7d, 0xb2, 0xbb, 0x25, 0xae, 0xab, 0x31, 0x9e, 0xcd, 0xdb, 0x27, 0xc6, 514 0x52, 0x58, 0xa7, 0x98, 0x8c, 0x43, 0x98, 0xa5, 0xd2, 0x77, 0xa2, 0x90,
515 0x9a, 0xf6, 0xc9, 0x90, 0xc3, 0x17, 0x83, 0xfe, 0xfe, 0x06, 0x65, 0x8f, 515 0x3f, 0xf8, 0x24, 0xf0, 0x51, 0x10, 0xdf, 0x3b, 0xc9, 0x63, 0xfb, 0x97,
516 0x43, 0xc7, 0x69, 0x3a, 0x83, 0xc6, 0xc7, 0x5d, 0x7e, 0xe1, 0x4f, 0x93, 516 0x60, 0xd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0xf5,
524 0x23, 0x14, 0xf6, 0x6f, 0xe7, 0x87, 0x68, 0x5d, 0xf3, 0x36, 0x67, 0x2b, 524 0xd2, 0x7a, 0x7f, 0x5d, 0x2c, 0xbc, 0x32, 0x1e, 0x0a, 0x75, 0x6f, 0x0b,
525 0x68, 0x19, 0xdf, 0xcb, 0xf3, 0x12, 0x69, 0xb2, 0xb5, 0xa0, 0x3f, 0xcf, 525 0xcb, 0xd7, 0xd2, 0x7a, 0x7f, 0xc3, 0x78, 0x6a, 0xe3, 0x5c, 0xcc, 0xea,
526 0x33, 0x2e, 0x18, 0xad, 0x63, 0x82, 0xe6, 0xb9, 0xb9, 0x28, 0x6c, 0x3a, 526 0x78, 0x6a, 0xbf, 0xc1, 0x32, 0x92, 0x65, 0x79, 0x69, 0xa8, 0xe3, 0xff,
527 0xad, 0x3b, 0x57, 0x64, 0xec, 0xa9, 0xb8, 0x0e, 0x9c, 0xa6, 0x75, 0xa7, 527 0xce, 0x15, 0x6f, 0x75, 0xeb, 0x79, 0xc8, 0x1a, 0xf9, 0x4e, 0x0e, 0xe9,
528 0x1b, 0x07, 0xef, 0xf5, 0xe0, 0x0b, 0xcf, 0xdc, 0x4f, 0x3d, 0x77, 0x26, 528 0x77, 0x42, 0xae, 0x22, 0x8e, 0x43, 0xf0, 0x9f, 0xf0, 0x5e, 0xe4, 0x62,
529 0x62, 0xce, 0x53, 0x9e, 0x73, 0x57, 0xcf, 0xe1, 0xca, 0x36, 0xda, 0xca, 529 0xd5, 0xe1, 0x2e, 0x7e, 0x2f, 0xcb, 0xff, 0x0b, 0xcf, 0x0b, 0x9b, 0x25,
530 0xfb, 0x53, 0x62, 0x5c, 0xdf, 0xfc, 0x62, 0x02, 0xb9, 0x6a, 0xf5, 0xfc, 530 0x63, 0x12, 0x68, 0x1f, 0xf2, 0x9d, 0x11, 0x6d, 0x65, 0x8e, 0x96, 0x8a,
531 0x21, 0x77, 0xce, 0x14, 0xd6, 0x01, 0x2d, 0x87, 0x3a,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, 0x49, 0x38, 0xf5, 0x8d, 612 0x52, 0xee, 0x49, 0xc4, 0xdf, 0x97, 0xf4, 0xb3, 0x71, 0x1e, 0xbc, 0xdb,
613 0x1c, 0x6f, 0x00, 0x6b, 0x51, 0x15, 0xfb, 0xa6, 0xd8, 0xaf, 0x68, 0x87, 613 0xac, 0xda, 0x5d, 0x74, 0xb5, 0x43, 0x9b, 0x8b, 0xaa, 0x2d, 0x9e, 0xa9,
614 0x9d, 0x77, 0x21, 0x36, 0x7f, 0x13, 0x18, 0x74, 0x23, 0xf2, 0x67, 0x7a, 614 0xb1, 0x86, 0xae, 0xd3, 0x82, 0x1c, 0xae, 0xaa, 0xfa, 0x44, 0xf9, 0xbc,
615 0xc8, 0x9f, 0xf3, 0xfd, 0xc8, 0x83, 0x43, 0x3e, 0x5c, 0x76, 0xd2, 0xa0, 615 0x99, 0xe2, 0x45, 0x6e, 0xd3, 0xa5, 0xae, 0x5f, 0x64, 0xfc, 0x5b, 0x14,
616 0x1a, 0xdb, 0x0a, 0x06, 0x95, 0x43, 0x3e, 0x3a, 0x67, 0x5b, 0xd1, 0x8a, 616 0x32, 0x22, 0xfb, 0xd2, 0x54, 0xee, 0x8b, 0xc4, 0xed, 0xb8, 0xa7, 0x5d,
617 0xc0, 0x9a, 0x8f, 0xc0, 0x7f, 0x35, 0xb9, 0x42, 0x07, 0x44, 0xce, 0x38, 617 0xe5, 0x62, 0xbe, 0x25, 0xd7, 0x05, 0x54, 0x1f, 0xe4, 0x75, 0xfe, 0x5c,
618 0x6a, 0x1f, 0x94, 0x79, 0x0d, 0x3e, 0xcd, 0x3c, 0x78, 0x96, 0xed, 0x8f, 618 0xaa, 0xf6, 0x29, 0xdf, 0x28, 0xea, 0x75, 0x88, 0x8f, 0x7d, 0x33, 0xd9,
619 0xec, 0x49, 0xec, 0xb7, 0xe8, 0x79, 0x41, 0x0e, 0x3c, 0x3e, 0x4d, 0x9e, 619 0x77, 0x7c, 0x32, 0xe7, 0xd8, 0x14, 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0x32, 0x32, 0xff, 0x36, 0xe3, 0xc0, 0x0f, 0x12, 649 0xb8, 0x4f, 0xee, 0x6f, 0x17, 0xa0, 0xe5, 0x72, 0xad, 0xb2, 0x5f, 0xd5,
650 0xaf, 0xbf, 0xe5, 0x88, 0xdf, 0x96, 0xb9, 0xb5, 0x8b, 0x75, 0xcc, 0x2a, 650 0xf0, 0x3d, 0x1b, 0xba, 0xb3, 0x75, 0xca, 0x38, 0xff, 0x3d, 0x11, 0xcb,
651 0x73, 0x6b, 0x65, 0xbc, 0xb7, 0xb3, 0x0e, 0x8c, 0xdc, 0xfb, 0x91, 0xef, 651 0x93, 0xeb, 0x48, 0xab, 0xaa, 0xde, 0x3a, 0x62, 0x21, 0x47, 0x60, 0x71,
652 0xd9, 0xe6, 0xda, 0xfb, 0x91, 0x39, 0xb5, 0xa6, 0xd1, 0xce, 0x86, 0xc3, 652 0x05, 0x71, 0xd8, 0x46, 0xb5, 0xc9, 0x52, 0x17, 0xa5, 0xca, 0x7b, 0xc2,
653 0x1a, 0x81, 0x7a, 0x08, 0x71, 0xe6, 0xdd, 0xad, 0x6d, 0xea, 0x21, 0xc4, 653 0x14, 0x44, 0x1d, 0x86, 0x8c, 0x8f, 0xc9, 0x1a, 0xe2, 0xc5, 0x95, 0x1b,
654 0xdb, 0xd4, 0x43, 0x70, 0xea, 0x7e, 0x27, 0xc6, 0x02, 0x26, 0xc6, 0xda, 654 0xa2, 0x6e, 0x37, 0xae, 0x6a, 0x91, 0x53, 0xd4, 0x26, 0x70, 0xed, 0x27,
655 0x08, 0x2c, 0x8c, 0x7a, 0x06, 0x51, 0x3a, 0x5f, 0xc7, 0x9e, 0x0f, 0x52, 655 0xaf, 0x21, 0xfe, 0x71, 0x68, 0xfb, 0x35, 0xc4, 0xee, 0x7b, 0xb6, 0x57,
656 0x5a, 0x61, 0xcf, 0xf3, 0x15, 0xad, 0x8f, 0x46, 0x5d, 0xfa, 0xc8, 0x0b, 656 0x43, 0x6c, 0xf2, 0xd8, 0x8d, 0x05, 0x59, 0x43, 0x5c, 0xbd, 0x46, 0x23,
657 0x8b, 0x5a, 0x2a, 0xce, 0x47, 0xcb, 0x6b, 0xd6, 0x21, 0xaf, 0x59, 0x0f, 657 0x6b, 0x88, 0x53, 0x2e, 0xac, 0x20, 0xf1, 0xf9, 0x4d, 0x57, 0x7e, 0xb7,
658 0x79, 0xc5, 0x3d, 0xd9, 0x36, 0xfd, 0xfe, 0xa5, 0xba, 0x07, 0xff, 0x4f, 658 0xac, 0x0f, 0x5e, 0x2c, 0xe3, 0x53, 0x59, 0x1f, 0x2c, 0xf3, 0xc1, 0xdd,
659 0x46, 0x50, 0xb3, 0x85, 0x68, 0xf7, 0x80, 0xc2, 0x7f, 0x0e, 0x79, 0x3d, 659 0x7b, 0xdf, 0xc8, 0xb5, 0x20, 0xf9, 0x9e, 0x5d, 0x35, 0x6b, 0x41, 0xb2,
660 0xcb, 0xf2, 0xaa, 0xaf, 0xa3, 0xbf, 0xed, 0x6c, 0x00, 0x8d, 0x19, 0x87, 660 0x2e, 0xd8, 0x32, 0xbc, 0xf8, 0x4e, 0xdb, 0x25, 0xec, 0xf7, 0x10, 0x63,
661 0x7c, 0x87, 0xaf, 0xbd, 0x21, 0xe2, 0xa4, 0x9a, 0xed, 0x45, 0x8d, 0x27, 661 0xde, 0xdd, 0xd9, 0x60, 0xbf, 0x87, 0x58, 0x83, 0xfd, 0x1e, 0xdc, 0xba,
662 0xf6, 0x09, 0x59, 0xba, 0xe3, 0x47, 0xdc, 0x8a, 0xbe, 0x16, 0x52, 0x7e, 662 0xdf, 0x8d, 0xa7, 0x80, 0x7f, 0x61, 0x17, 0x81, 0x7b, 0xb1, 0x5f, 0x43,
663 0x32, 0x4d, 0x8b, 0xce, 0x26, 0xcc, 0xd1, 0xc0, 0x1b, 0x22, 0xc6, 0xd7, 663 0x94, 0xce, 0x97, 0x71, 0xe6, 0x3d, 0x94, 0x54, 0x38, 0xf3, 0xfc, 0x92,
664 0xd1, 0x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, 0xbf, 671 0x35, 0x38, 0xa3, 0x5d, 0xe1, 0x08, 0x91, 0xff, 0xeb, 0xea, 0xdb, 0x7f,
672 0xfd, 0x0d, 0xa6, 0xdd, 0xd7, 0x44, 0x8c, 0xe5, 0x62, 0xf1, 0x82, 0xfc, 672 0x72, 0xdf, 0xf4, 0x79, 0x6d, 0x33, 0xdf, 0xae, 0x8a, 0x69, 0x54, 0xe7,
673 0x2c, 0x3f, 0xa5, 0xde, 0xc1, 0xef, 0xab, 0xfe, 0x98, 0xe2, 0xfd, 0xa6, 673 0x4d, 0x22, 0x7e, 0xb4, 0x2b, 0x69, 0xd8, 0x09, 0x91, 0x7f, 0xda, 0x69,
674 0xc3, 0x96, 0x73, 0xfe, 0x79, 0xe3, 0x95, 0x63, 0x9b, 0xc2, 0x2b, 0xd9, 674 0x23, 0x56, 0x16, 0x67, 0xd9, 0xef, 0x4c, 0x22, 0xd7, 0xb9, 0xf3, 0x92,
675 0x74, 0x03, 0xaf, 0x38, 0x9f, 0xad, 0xb1, 0xcb, 0xe4, 0xa0, 0xac, 0xf7, 675 0x45, 0xa7, 0xb2, 0x57, 0x0f, 0x48, 0x5e, 0x79, 0x5a, 0xec, 0xd3, 0x89,
676 0x00, 0x1a, 0x6c, 0x05, 0x16, 0x4b, 0x83, 0x96, 0x46, 0xcc, 0x8a, 0x24, 676 0x7d, 0x1d, 0x27, 0xd8, 0x3e, 0xc7, 0x19, 0x60, 0xce, 0x15, 0x5b, 0x68,
677 0xfc, 0x33, 0x94, 0xaf, 0x5e, 0xa7, 0x4c, 0x11, 0x98, 0x99, 0x3f, 0xcb, 677 0x91, 0x91, 0xbc, 0xdf, 0x2e, 0x88, 0x58, 0x1f, 0xeb, 0xa4, 0x1c, 0xf6,
678 0xe7, 0x76, 0x4a, 0x1f, 0x8d, 0xbe, 0x07, 0x7a, 0x65, 0x07, 0xb7, 0xff, 678 0x6b, 0x35, 0x16, 0x9a, 0xf9, 0xb9, 0x3d, 0xb4, 0x9c, 0x07, 0xcf, 0x35,
679 0xeb, 0x41, 0x19, 0x97, 0xed, 0xbc, 0xde, 0xcb, 0xd7, 0xbf, 0x10, 0x69, 679 0xa9, 0xfd, 0x53, 0xd0, 0xd6, 0x47, 0x5d, 0xf6, 0xdf, 0x32, 0xed, 0x1e,
680 0xbe, 0xbe, 0x85, 0xaf, 0xf7, 0xa7, 0x31, 0x87, 0xc6, 0x15, 0xf8, 0x25, 680 0x11, 0x79, 0x97, 0x8b, 0xb9, 0xa7, 0xe5, 0x67, 0xe1, 0x55, 0xf5, 0x0e,
681 0x27, 0x29, 0xc7, 0xf3, 0x93, 0xaf, 0xf2, 0xda, 0x7a, 0x95, 0xf5, 0x55, 681 0x7e, 0x5f, 0xf1, 0x75, 0x8a, 0x75, 0xb9, 0xf3, 0x00, 0xdd, 0x7f, 0xde,
682 0x45, 0xb7, 0x1b, 0x40, 0xce, 0x8e, 0x98, 0x13, 0x83, 0xdb, 0x5c, 0x2c, 682 0x78, 0xe5, 0xe4, 0xb6, 0xf0, 0x8a, 0x93, 0xac, 0xe0, 0x15, 0xf7, 0xb3,
683 0x4c, 0x71, 0xbb, 0x21, 0xf2, 0x5f, 0x35, 0x29, 0x5f, 0xd1, 0xbc, 0xaa, 683 0x35, 0x76, 0xf9, 0xe3, 0x1e, 0xb9, 0x9f, 0x05, 0x68, 0xb0, 0x13, 0x58,
684 0xe3, 0xed, 0xdf, 0x18, 0x90, 0x31, 0x55, 0xef, 0xec, 0x94, 0xf4, 0x9b, 684 0x2c, 0x09, 0x5a, 0x1a, 0xe3, 0x91, 0x70, 0xdc, 0x3f, 0x46, 0x99, 0xe2,
685 0x14, 0x3e, 0x4f, 0xc4, 0x73, 0x3c, 0x23, 0xf8, 0xd0, 0x9a, 0x31, 0xeb, 685 0x35, 0x4a, 0xe5, 0x60, 0xe7, 0xf9, 0xb3, 0xf0, 0x37, 0x7b, 0x64, 0x9c,
686 0xef, 0xdf, 0x06, 0xbe, 0x42, 0xdd, 0x54, 0x1e,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31, 0xab, 0xfc, 0x7e, 0xec, 0x31, 0x26,
694 0x3f, 0xc3, 0x6d, 0x91, 0xab, 0x90, 0xe3, 0xcf, 0x1e, 0x15, 0xd7, 0xd3, 694 0xf6, 0x7c, 0xe5, 0x31, 0xb0, 0x5e, 0x1c, 0xb7, 0xcd, 0x74, 0x39, 0x6f,
695 0xca, 0x2b, 0x32, 0x4e, 0x42, 0xaf, 0x5b, 0xb8, 0x77, 0x80, 0x9f, 0x21, 695 0x6d, 0x6d, 0x9f, 0xbc, 0x7f, 0x67, 0x8f, 0xdc, 0x7f, 0xb5, 0x53, 0xed,
696 0xd7, 0xae, 0xf6, 0xef, 0xa1, 0x96, 0x38, 0x98, 0x56, 0x1e, 0x5b, 0xcb, 696 0x15, 0xa8, 0x6d, 0xce, 0x17, 0x90, 0xa7, 0x2d, 0x68, 0xe3, 0x5f, 0x80,
697 0x0f, 0x2b, 0xf6, 0x13, 0x3d, 0xf8, 0x6c, 0xad, 0x7a, 0x06, 0xef, 0x08, 697 0xbe, 0x34, 0xf8, 0x3b, 0x8f, 0x27, 0x89, 0x3e, 0xf6, 0xf6, 0xe8, 0x3d,
698 0x3f, 0x5a, 0xb2, 0x45, 0x5e, 0x21, 0xc7, 0x01, 0xfa, 0xce, 0x7c, 0x96, 698 0x17, 0xe5, 0xb8, 0x4e, 0x70, 0x7f, 0x13, 0x3c, 0x2e, 0x7d, 0x3e, 0xc6,
699 0xb6, 0xf0, 0x5c, 0x7d, 0xc3, 0xf8, 0x35, 0xec, 0xb7, 0x93, 0x8c, 0x79, 699 0xc7, 0x5e, 0xf3, 0x8b, 0x67, 0x05, 0xf9, 0x39, 0x2c, 0x03, 0x53, 0xc1,
700 0x62, 0x1a, 0x17, 0xec, 0xc9, 0xb3, 0x06, 0xd3, 0xb9, 0x90, 0xad, 0x05, 700 0x64, 0x6a, 0x58, 0xce, 0x73, 0x25, 0xae, 0x1b, 0x2e, 0xc7, 0x75, 0xe7,
701 0xec, 0x1e, 0xea, 0x64, 0x59, 0xfd, 0x22, 0x8d, 0xb1, 0xfd, 0x07, 0x99, 701 0xb2, 0xc7, 0x7b, 0x10, 0xcf, 0x30, 0x2e, 0xf1, 0x7c, 0x87, 0x9e, 0xe1,
702 0xb5, 0x23, 0x29, 0x82, 0xbc, 0x59, 0xa1, 0xc3, 0xcc, 0x13, 0xc9, 0x2a, 702 0xb6, 0xa8, 0x63, 0x48, 0xf3, 0x67, 0x9b, 0xca, 0xef, 0xa9, 0xe7, 0x15,
703 0xf8, 0xd9, 0xa0, 0x27, 0x4a, 0x44, 0x8f, 0x97, 0xc6, 0x42, 0xdf, 0x27, 703 0x99, 0x2f, 0xa1, 0xed, 0x16, 0xee, 0xbd, 0x97, 0x9f, 0x21, 0x6d, 0x57,
704 0xdb, 0x6c, 0x7c, 0x6f, 0x85, 0x12, 0xdc, 0x8f, 0x54, 0xf5, 0x77, 0xe8, 704 0xe3, 0xf7, 0x50, 0x5d, 0x4e, 0x4c, 0x3d, 0x8f, 0x6d, 0x14, 0x8b, 0x15,
705 0x43, 0x51, 0xe7, 0x04, 0x74, 0xd4, 0xf3, 0xfe, 0xdb, 0x74, 0x3a, 0x8d, 705 0xeb, 0x8a, 0x1e, 0x7c, 0xb6, 0x51, 0xac, 0x44, 0xe4, 0x39, 0xfb, 0x26,
706 0x7e, 0x6f, 0x5c, 0x3e, 0x4f, 0x6c, 0x4a, 0x3e, 0x83, 0x1e, 0xf2, 0xf9, 706 0xea, 0xe4, 0x15, 0x72, 0x1c, 0xa0, 0x27, 0xe6, 0x1d, 0xda, 0xc1, 0x73,
707 0xea, 0xa0, 0xe4, 0x9b, 0x1a, 0xf3, 0x68, 0x90, 0x66, 0x8b, 0x88, 0x01, 707 0xf5, 0x27, 0x06, 0xea, 0x86, 0x4b, 0x24, 0x73, 0x9f, 0x98, 0xc6, 0x59,
708 0x7b, 0x18, 0x75, 0xa7, 0x8a, 0x19, 0xd6, 0x4b, 0x99, 0x86, 0x5e, 0xba, 708 0x7b, 0xf8, 0xac, 0xc1, 0x74, 0xce, 0x3a, 0xa5, 0x80, 0xdd, 0x46, 0xcd,
709 0x94, 0xf0, 0xc7, 0x21, 0xe3, 0xa8, 0xcb, 0xa6, 0xe2, 0x7e, 0x30, 0x8e, 709 0x2c, 0xab, 0xbf, 0x4f, 0x03, 0xec, 0xeb, 0x41, 0x66, 0xed, 0x70, 0x82,
710 0xdd, 0x34, 0xb6, 0xb0, 0x95, 0xef, 0xa5, 0x95, 0xc4, 0x74, 0x5c, 0xe5, 710 0x20, 0x6f, 0x11, 0xf3, 0x18, 0xf3, 0xc4, 0x44, 0x11, 0xfc, 0x6c, 0xd0,
711 0xfa, 0x5b, 0x66, 0x92, 0xf5, 0xe3, 0x1c, 0xcb, 0x72, 0xae, 0xf8, 0x00, 711 0x63, 0x79, 0xa2, 0x47, 0xf3, 0x03, 0xe6, 0x37, 0xc9, 0xb6, 0x2a, 0xd7,
712 0x2d, 0x86, 0x87, 0x69, 0x74, 0x41, 0xd7, 0x37, 0xc1, 0x58, 0xff, 0x6d, 712 0x23, 0x66, 0x9c, 0xfb, 0x91, 0x28, 0xfe, 0x25, 0x7d, 0x24, 0xf6, 0x71,
713 0x48, 0xea, 0x24, 0x3d, 0xee, 0x5f, 0x11, 0xbe, 0x0b, 0xf3, 0xfa, 0xa7, 713 0x01, 0x1d, 0xf5, 0xbc, 0xff, 0x39, 0x4d, 0x27, 0xd1, 0xef, 0xad, 0xcb,
714 0x35, 0xee, 0xad, 0xeb, 0xe8, 0xa5, 0xbf, 0x52, 0x32, 0x5b, 0xbb, 0x91, 714 0xe7, 0xa9, 0x6d, 0xc9, 0x67, 0xd0, 0x43, 0x3e, 0x3f, 0x54, 0x7c, 0x53,
715 0x88, 0x52, 0x36, 0x31, 0xfd, 0x97, 0x82, 0xff, 0x47, 0xaf, 0xc3, 0x0f, 715 0x62, 0x1e, 0x0d, 0xd2, 0x4c, 0x0e, 0xb9, 0x60, 0x9f, 0x47, 0x0d, 0x66,
716 0x07, 0x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0x75, 0xd3, 0x99, 0x12, 0x63, 0x90, 0x92, 738 0xb5, 0xd0, 0x9b, 0xb9, 0x5e, 0xba, 0x3e, 0xdf, 0x41, 0xb3, 0x8c, 0x99,
739 0x9f, 0x6d, 0x18, 0xb4, 0x0d, 0xec, 0xd5, 0xf5, 0x5f, 0x2f, 0x72, 0xdf, 739 0x67, 0xed, 0x80, 0x95, 0x66, 0xff, 0xe2, 0x6a, 0x54, 0xe4, 0x10, 0xb1,
740 0x73, 0x25, 0x89, 0x41, 0x72, 0x4b, 0xbd, 0x94, 0x2f, 0xf5, 0xa8, 0xf3, 740 0xdc, 0xa1, 0x3d, 0xf0, 0x5f, 0x7c, 0x2f, 0xf3, 0x1c, 0x63, 0xef, 0x56,
741 0x07, 0x44, 0x8c, 0xbb, 0xac, 0x63, 0x84, 0xef, 0xd6, 0xd2, 0x6f, 0x6f, 741 0xfa, 0x80, 0xdf, 0x99, 0xce, 0xea, 0x9c, 0x07, 0xc4, 0xe3, 0x07, 0xcb,
742 0x31, 0x4f, 0x61, 0x4d, 0x95, 0x76, 0x29, 0x74, 0xcd, 0x8d, 0x96, 0xba, 742 0xf8, 0x75, 0x73, 0x1e, 0x31, 0x37, 0xe1, 0x91, 0x71, 0xa1, 0xeb, 0x33,
743 0xc4, 0xe0, 0xb9, 0x19, 0xfa, 0x2e, 0xaf, 0xb7, 0xa3, 0x57, 0xe1, 0x3f, 743 0xf3, 0x7c, 0x7d, 0x1e, 0x71, 0x73, 0x4b, 0xc4, 0x24, 0xbe, 0x14, 0x40,
744 0xfe, 0x2a, 0xf8, 0xa6, 0x0c, 0x1e, 0x1b, 0xbd, 0x8a, 0xba, 0x48, 0x7e, 744 0x7b, 0x9c, 0xb3, 0x65, 0xce, 0xa4, 0x18, 0x5b, 0x98, 0x8f, 0x41, 0xdb,
745 0x91, 0xe7, 0x94, 0x0c, 0x4f, 0x8a, 0xdc, 0x10, 0x29, 0xa3, 0x27, 0x45, 745 0xb0, 0xa2, 0x43, 0x2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
753 0xf1, 0x34, 0x70, 0xd1, 0xdc, 0x4e, 0xa9, 0xe3, 0xd0, 0xaf, 0x6c, 0x14, 753 0x89, 0xba, 0xec, 0xef, 0x08, 0xdd, 0x14, 0x71, 0x2c, 0x03, 0x78, 0x24,
754 0xd0, 0xed, 0xe4, 0x72, 0x0f, 0xad, 0x88, 0x9a, 0x5c, 0xc0, 0x18, 0xb8, 754 0x12, 0x26, 0x92, 0x39, 0x59, 0xa7, 0xec, 0xce, 0x9b, 0xdd, 0xe3, 0x43,
755 0x1f, 0xcf, 0xc9, 0x86, 0x3a, 0x08, 0x35, 0xd7, 0x21, 0xe3, 0x07, 0x22, 755 0x14, 0xeb, 0x01, 0xdf, 0x4b, 0x99, 0x95, 0x7b, 0x22, 0x90, 0xd0, 0xf7,
756 0xd7, 0x79, 0x3e, 0x53, 0xcb, 0xff, 0x55, 0x3b, 0x2d, 0x6a, 0xdc, 0xa0, 756 0xe6, 0x21, 0x5d, 0x63, 0xa0, 0x8f, 0xb5, 0xad, 0xd0, 0xc7, 0x6d, 0x35,
757 0x2d, 0x63, 0x48, 0x81, 0xf9, 0x19, 0xbf, 0x34, 0xd9, 0x55, 0x33, 0xe8, 757 0xd7, 0xcd, 0x9a, 0xeb, 0x1a, 0x7f, 0x63, 0xad, 0x8c, 0xed, 0x3c, 0xc9,
758 0x67, 0x16, 0x7b, 0x2b, 0x86, 0xfd, 0x22, 0xcb, 0x98, 0xdc, 0x2b, 0x4f, 758 0x3d, 0x98, 0x52, 0x0b, 0x92, 0xff, 0xcc, 0x43, 0x83, 0xe6, 0xfd, 0x0a,
759 0xb9, 0xf6, 0xca, 0x4f, 0x8a, 0xbd, 0x72, 0xec, 0x93, 0x83, 0xae, 0xa0, 759 0x83, 0xa7, 0x56, 0x06, 0xc2, 0x9d, 0x46, 0x9b, 0x3f, 0x35, 0xf2, 0xaf,
760 0xa5, 0x57, 0x4c, 0x0b, 0xe6, 0x31, 0xca, 0xf3, 0x68, 0xd2, 0xc5, 0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9, 0xf6, 0x44, 0x14, 0xed, 0xfc, 0x35, 0xed, 0x62, 0x24, 0xda,
783 0xc3, 0xa3, 0x8d, 0xb8, 0x48, 0xc7, 0xfe, 0x7a, 0xc0, 0xb1, 0xbf, 0x1e, 783 0x2e, 0xa3, 0x7d, 0xe9, 0x97, 0xf1, 0xa8, 0x1e, 0xa7, 0xfb, 0x5e, 0x8c,
784 0x72, 0xc4, 0x45, 0x86, 0x05, 0x3e, 0x6b, 0x60, 0xaa, 0xb0, 0xc2, 0x54, 784 0x07, 0xf2, 0xc5, 0x9f, 0x4b, 0xef, 0xd0, 0xf5, 0x1c, 0xfc, 0x71, 0x43,
785 0xc0, 0x5e, 0x52, 0xb7, 0x2d, 0xd6, 0x75, 0xdb, 0x8e, 0x75, 0x74, 0x9b, 785 0xd5, 0x5f, 0x59, 0xe4, 0x2c, 0x31, 0x06, 0xbc, 0x72, 0xd0, 0xb7, 0x96,
786 0x97, 0xad, 0xba, 0xa2, 0xf4, 0x88, 0x15, 0xc5, 0x1a, 0x73, 0x83, 0xf5, 786 0xfb, 0x41, 0x29, 0x55, 0x95, 0xdb, 0x52, 0x1d, 0x73, 0x97, 0x3e, 0x58,
787 0xc5, 0xeb, 0xd5, 0x69, 0xd6, 0x23, 0x51, 0xd6, 0x23, 0x53, 0xac, 0x47, 787 0x2f, 0xd9, 0x97, 0x60, 0x43, 0x61, 0x3f, 0x9d, 0x92, 0xdf, 0x06, 0xde,
788 0x26, 0x59, 0x8f, 0xd8, 0x4c, 0x03, 0x93, 0xc7, 0xfe, 0x11, 0xeb, 0x69, 788 0x83, 0x6f, 0xf4, 0x34, 0xeb, 0x2f, 0x99, 0x9f, 0xc4, 0xba, 0x94, 0x75,
789 0xac, 0x1f, 0x33, 0xf4, 0x4c, 0x15, 0x3a, 0x79, 0x8a, 0x31, 0xd0, 0x47, 789 0x98, 0x94, 0x9f, 0x44, 0xd5, 0x4f, 0x3c, 0x48, 0x1e, 0xee, 0xaf, 0xe4,
790 0xb4, 0x3a, 0xdf, 0xcb, 0xfc, 0x2b, 0x71, 0x4f, 0xb3, 0x5d, 0x83, 0xda, 790 0x49, 0xba, 0xd6, 0xd8, 0x03, 0xae, 0x35, 0x76, 0xd3, 0x95, 0x27, 0x19,
791 0x2b, 0xf0, 0x17, 0xff, 0x39, 0xf4, 0xce, 0x2b, 0x59, 0x1a, 0xf1, 0xdd, 791 0x12, 0xf8, 0xac, 0x82, 0xa9, 0x42, 0x0a, 0x53, 0x01, 0x7b, 0x49, 0xdd,
792 0x2c, 0x82, 0xce, 0xab, 0xa8, 0x55, 0xf1, 0x12, 0x64, 0x1b, 0x35, 0x82, 792 0xb6, 0x58, 0xd6, 0x6d, 0xbb, 0x37, 0xd1, 0x6d, 0x5e, 0xbe, 0xea, 0xaa,
793 0x7f, 0x30, 0x31, 0xc3, 0x7d, 0x1f, 0xf1, 0xe5, 0x79, 0x5e, 0xbe, 0x1d, 793 0xd2, 0x23, 0x91, 0x28, 0x6c, 0x0c, 0xf6, 0x59, 0xfa, 0xfb, 0xe2, 0x28,
794 0xcd, 0x86, 0xfa, 0x59, 0x06, 0x8e, 0x2b, 0x19, 0x38, 0xde, 0x90, 0x81, 794 0xeb, 0x91, 0x28, 0xeb, 0x91, 0x11, 0xd6, 0x23, 0xc3, 0xac, 0x47, 0x6c,
795 0x6c, 0x8e, 0x47, 0xd2, 0xb7, 0xb0, 0x9d, 0xc6, 0x0f, 0x26, 0x76, 0xf5, 795 0xa6, 0x81, 0xc5, 0x63, 0xff, 0x98, 0xf5, 0x34, 0xec, 0xc7, 0x18, 0x3d,
796 0xb1, 0xfc, 0x22, 0x66, 0xa2, 0x51, 0xbf, 0xc7, 0x4f, 0xa7, 0xc3, 0x41, 796 0x53, 0x84, 0x4e, 0x1e, 0x61, 0x0c, 0xf4, 0x31, 0xad, 0xcd, 0xb7, 0x33,
797 0x55, 0xf7, 0xc7, 0x14, 0x39, 0xef, 0xf9, 0xe2, 0xbb, 0x8c, 0x4b, 0x58, 797 0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xd4, 0xc4, 0xf1,
805 0xcf, 0x63, 0xee, 0x85, 0xfe, 0xf8, 0x07, 0x5e, 0xa3, 0xf1, 0x5e, 0xf0, 805 0x45, 0xc4, 0x45, 0xd9, 0x6f, 0x68, 0x15, 0x71, 0xa5, 0x45, 0xd1, 0x16,
806 0x23, 0x1f, 0x97, 0x67, 0xe8, 0x52, 0x41, 0xf7, 0xe1, 0x3d, 0x32, 0xbe, 806 0xc7, 0x91, 0x61, 0xd6, 0x71, 0xd1, 0x55, 0x23, 0x32, 0x16, 0x33, 0x2e,
807 0x8b, 0x7e, 0xf8, 0x68, 0x87, 0xfd, 0x9e, 0xc8, 0x05, 0x31, 0xfe, 0xc4, 807 0xf7, 0x62, 0x5f, 0xfa, 0x6f, 0x17, 0x1f, 0xeb, 0x95, 0xf5, 0xb9, 0x4f,
808 0xdd, 0xa7, 0xa3, 0xaa, 0x4f, 0xa8, 0x75, 0xd9, 0x85, 0xda, 0x3e, 0x84, 808 0xed, 0x95, 0xfa, 0x84, 0x79, 0x34, 0x14, 0x13, 0xbe, 0x5b, 0xd3, 0x25,
809 0x9a, 0x48, 0x8b, 0xa2, 0x16, 0x65, 0xa7, 0xb0, 0x59, 0x17, 0x85, 0xed, 809 0x69, 0x3f, 0x17, 0x79, 0xbe, 0x97, 0xa2, 0xc3, 0x3c, 0xdf, 0x6d, 0xca,
810 0xb1, 0x7f, 0x57, 0xa3, 0x3e, 0xe6, 0x7e, 0xd7, 0xb5, 0x3b, 0xbc, 0x6e, 810 0x76, 0x3a, 0x7c, 0x5d, 0xd8, 0x65, 0xb6, 0xa1, 0xbd, 0xd8, 0xd3, 0xdf,
811 0x1d, 0x12, 0x18, 0x6d, 0x14, 0xf5, 0xda, 0x45, 0x5e, 0xea, 0x8c, 0xf8, 811 0x8c, 0x47, 0x9f, 0xe2, 0x77, 0x62, 0x1f, 0xa1, 0x2f, 0xe3, 0x79, 0xcc,
812 0xce, 0x58, 0xc0, 0x77, 0x0f, 0xa9, 0xef, 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06, 0x63, 0xb2, 0x40, 0x28, 0x43, 834 0x7f, 0x67, 0x39, 0xcc, 0xb2, 0x1c, 0x66, 0x59, 0x0e, 0xb3, 0x2c, 0x87,
835 0xd0, 0xa7, 0x02, 0xa7, 0xf1, 0xbc, 0xaf, 0xb0, 0xde, 0x87, 0x0f, 0x0f, 835 0xec, 0xab, 0x7e, 0x2b, 0xcb, 0x72, 0xc8, 0xb6, 0xe4, 0x15, 0xb6, 0x25,
836 0xeb, 0xc5, 0x19, 0x1f, 0xaf, 0x17, 0x91, 0x9b, 0xac, 0x4f, 0xcf, 0x97, 836 0x52, 0x76, 0x63, 0x2a, 0xbe, 0xa9, 0x65, 0x17, 0xeb, 0x7f, 0x6e, 0x1f,
837 0x6c, 0x96, 0xfb, 0x7e, 0xfa, 0x56, 0x09, 0xeb, 0x34, 0x68, 0xc4, 0xe7, 837 0x47, 0xcb, 0x2a, 0xec, 0x37, 0xf9, 0x8e, 0x0f, 0x55, 0xcb, 0xec, 0x0d,
838 0x65, 0x12, 0xbe, 0x31, 0x23, 0x86, 0xb1, 0x8f, 0x67, 0x0d, 0xc1, 0x27, 838 0x96, 0xd9, 0xa6, 0xf1, 0x1e, 0xba, 0x95, 0xc7, 0x9c, 0x45, 0xac, 0x39,
839 0x7f, 0x0a, 0x3a, 0x30, 0xed, 0x5f, 0xdc, 0x85, 0xda, 0xf3, 0x71, 0xa3, 839 0xd6, 0xd5, 0x09, 0x3f, 0xb0, 0x56, 0x80, 0xe5, 0x09, 0x58, 0x33, 0xc2,
840 0x53, 0xf9, 0x1a, 0x71, 0x8c, 0xf6, 0x68, 0x0b, 0xba, 0xe1, 0xbc, 0xdd, 840 0x74, 0xef, 0xa1, 0xdb, 0xac, 0xaf, 0x6f, 0xe5, 0x21, 0xc3, 0x07, 0xd4,
841 0xbe, 0x24, 0x7e, 0xb3, 0x21, 0x0a, 0xff, 0x9b, 0x4b, 0x7f, 0x5d, 0xe2, 841 0x71, 0x84, 0x65, 0x18, 0xf6, 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, 0x43, 0xe6, 0xdc, 0xdc, 0xa8, 0x6a, 871 0x3a, 0xdf, 0xa5, 0xf8, 0xc9, 0x1d, 0x47, 0x75, 0xf7, 0x35, 0x32, 0xbc,
872 0xec, 0x74, 0x94, 0xe7, 0xcc, 0x8e, 0x1a, 0x46, 0x4a, 0xf8, 0x1a, 0xba, 872 0xce, 0xfa, 0xf7, 0xb6, 0xc0, 0x31, 0x7d, 0x8c, 0x63, 0x70, 0x9e, 0x32,
873 0xed, 0x1e, 0xea, 0xe2, 0x75, 0xf4, 0x2c, 0xa1, 0x96, 0x9a, 0x65, 0x62, 873 0xd0, 0xd3, 0xe9, 0x10, 0xf6, 0xe1, 0x1d, 0xe3, 0x71, 0xb3, 0x3f, 0x36,
874 0x0f, 0xe0, 0x12, 0xf3, 0x64, 0x3e, 0x6a, 0x45, 0x1e, 0x17, 0x76, 0x29, 874 0xca, 0x9f, 0x22, 0xbe, 0x26, 0xe2, 0xbe, 0xea, 0xfe, 0xaf, 0xd3, 0xed,
875 0xd6, 0x17, 0x03, 0x74, 0x62, 0x5a, 0xa3, 0x0f, 0x7c, 0xbc, 0x84, 0x3a, 875 0x79, 0xe8, 0x72, 0xe0, 0x58, 0xb9, 0x57, 0xef, 0xed, 0x15, 0x19, 0xdf,
876 0x9a, 0x51, 0x1e, 0x3f, 0xfc, 0xc7, 0x63, 0xe6, 0x9b, 0xbc, 0x2e, 0x5d, 876 0x4d, 0x78, 0xc6, 0x77, 0x11, 0xdb, 0x1d, 0x05, 0xce, 0x37, 0x11, 0x07,
877 0x12, 0x7e, 0x99, 0x0b, 0x94, 0x63, 0x39, 0x3d, 0x22, 0xe4, 0xd4, 0x18, 877 0x9e, 0x50, 0xbf, 0x5f, 0x92, 0x2e, 0xe2, 0x59, 0x5e, 0x7a, 0x69, 0xcc,
878 0x61, 0x29, 0x62, 0xb9, 0x42, 0x6c, 0xc2, 0xb8, 0xa8, 0xdb, 0x23, 0x6d, 878 0x95, 0x1f, 0x87, 0xbc, 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7, 0x58, 0x89, 0x79, 0xaf, 0x88, 0x3d, 0x7f, 0x3e, 0x2e, 0xe3, 886 0x44, 0x0c, 0x50, 0xf9, 0x3a, 0x3c, 0xca, 0x15, 0xb5, 0x57, 0x42, 0x12,
887 0x77, 0x54, 0x7e, 0x5d, 0xf9, 0xcb, 0x87, 0x29, 0xb9, 0x40, 0xd9, 0x4c, 887 0xba, 0x63, 0xeb, 0x31, 0x89, 0xe4, 0xa7, 0x8e, 0xc5, 0xb8, 0x31, 0x59,
888 0xf4, 0x4b, 0xa2, 0xd6, 0x75, 0x26, 0x3a, 0xa1, 0x7c, 0x3b, 0x11, 0xbe, 888 0xa3, 0xda, 0x51, 0xf8, 0x69, 0x2a, 0x9e, 0x88, 0xfc, 0xf8, 0xf2, 0x6f,
889 0x0e, 0x7f, 0x99, 0x49, 0x5f, 0x2e, 0x58, 0xd9, 0x0c, 0x49, 0x9f, 0x05, 889 0xe9, 0xb8, 0xe3, 0x06, 0xe7, 0x44, 0x6e, 0xe8, 0xcb, 0x45, 0x69, 0x83,
890 0x71, 0x1f, 0x0c, 0x5e, 0x7b, 0x77, 0xb0, 0x0e, 0x39, 0x21, 0xfc, 0x16, 890 0xd3, 0xec, 0xd3, 0x67, 0x8e, 0xb8, 0x31, 0x49, 0x24, 0x37, 0x21, 0x62,
891 0x8c, 0x54, 0xe6, 0xd1, 0x1e, 0x3e, 0x87, 0x7e, 0x82, 0x9d, 0x96, 0x29, 891 0x39, 0xfb, 0x28, 0xbe, 0x30, 0x42, 0x0f, 0x64, 0xa1, 0xc3, 0x68, 0x3d,
892 0x3e, 0xa5, 0xda, 0xd6, 0x28, 0xc4, 0xbc, 0x10, 0xfa, 0x55, 0x3b, 0x1b, 892 0x6e, 0xe3, 0x57, 0x72, 0x20, 0xe3, 0x23, 0x94, 0x28, 0x82, 0x46, 0x3e,
893 0x35, 0x1a, 0xf7, 0xc3, 0xe7, 0x71, 0x42, 0xe0, 0xc8, 0x11, 0xb6, 0x79, 893 0xc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2, 0x5d,
901 0xc9, 0x0f, 0x7f, 0x9c, 0xad, 0x63, 0x29, 0xba, 0x45, 0xdc, 0xbb, 0xdc, 901 0x69, 0x46, 0xc4, 0x2f, 0xf8, 0xb8, 0xf0, 0xc8, 0x7e, 0xa9, 0xdb, 0xe4,
902 0x8f, 0xc4, 0xfa, 0x0c, 0x9d, 0x78, 0x87, 0xed, 0x86, 0x09, 0x15, 0x87, 902 0x79, 0x19, 0xd7, 0xe0, 0x67, 0x16, 0xb8, 0x1f, 0x55, 0xf9, 0xf4, 0xbd,
903 0xd3, 0x21, 0x6a, 0x53, 0xc9, 0xbd, 0x54, 0xad, 0x53, 0x34, 0xef, 0xe9, 903 0x14, 0xdb, 0x46, 0x9c, 0x69, 0xea, 0x8e, 0xc6, 0x99, 0x98, 0xd6, 0xc5,
904 0xbd, 0x0e, 0xe7, 0x6f, 0x73, 0x41, 0x76, 0x9d, 0x98, 0x02, 0xfe, 0x29, 904 0xcd, 0x6a, 0x1a, 0xb4, 0xff, 0xf7, 0x91, 0xb6, 0xe1, 0x4c, 0x2b, 0x53,
905 0x31, 0x47, 0x97, 0x88, 0xe4, 0x1c, 0x37, 0xf6, 0x31, 0xba, 0x78, 0x9e, 905 0xfc, 0x16, 0x08, 0x30, 0x78, 0xa6, 0xf8, 0x3c, 0x7e, 0x03, 0xc7, 0x97,
906 0x60, 0x0f, 0xc2, 0xef, 0xf7, 0x35, 0xfe, 0xc4, 0x7e, 0xc4, 0xd5, 0x21, 906 0x14, 0xd8, 0x38, 0xcc, 0xd8, 0x06, 0x18, 0x67, 0x40, 0xac, 0x8b, 0xc5,
907 0xe0, 0xa8, 0x3e, 0x9b, 0x79, 0x66, 0x1a, 0xe7, 0x83, 0x6c, 0x9f, 0x69, 907 0x1e, 0x0a, 0xfb, 0x32, 0x2b, 0x3d, 0xe4, 0x47, 0x3c, 0xce, 0xd6, 0xb9,
908 0xdc, 0x2b, 0x7d, 0x51, 0x6c, 0xb3, 0xa9, 0xf9, 0x82, 0x1f, 0x6a, 0x54, 908 0x1c, 0xad, 0x22, 0xef, 0x5d, 0xae, 0x47, 0xc2, 0x3e, 0x43, 0x27, 0xae,
909 0xd5, 0x29, 0xb0, 0xc8, 0xec, 0x07, 0x9d, 0x3e, 0x2d, 0x79, 0x5c, 0x6f, 909 0xb3, 0xdf, 0xf0, 0x90, 0xca, 0xb9, 0x41, 0xcd, 0xa6, 0xce, 0xb9, 0xd1,
910 0xef, 0x62, 0x23, 0xb1, 0x4e, 0xf8, 0xdd, 0x30, 0xd4, 0xeb, 0xdc, 0x0b, 910 0x3a, 0x45, 0xf3, 0x9e, 0x5e, 0xeb, 0x70, 0xff, 0xde, 0x18, 0x64, 0xd7,
911 0xda, 0xf3, 0x1c, 0x39, 0xf7, 0x36, 0x1e, 0xdf, 0xa5, 0x7f, 0xb3, 0xe8, 911 0x8d, 0x29, 0x10, 0x9f, 0x12, 0x73, 0x74, 0x81, 0x48, 0xce, 0x71, 0x65,
912 0xfe, 0xcc, 0xdb, 0x16, 0x8f, 0x79, 0xfb, 0xf9, 0x90, 0xdc, 0x3b, 0x7b, 912 0x1d, 0xa3, 0x85, 0xe7, 0x09, 0xfe, 0x20, 0xe2, 0x7e, 0x8f, 0xf0, 0x27,
913 0x58, 0xb5, 0xf1, 0x8a, 0x6f, 0x5d, 0xfe, 0x0e, 0xfc, 0x50, 0x8d, 0xfc, 913 0xd6, 0x23, 0x7e, 0xb4, 0x1f, 0x38, 0xaa, 0xd3, 0x66, 0x9e, 0x19, 0xc5,
914 0x8b, 0x77, 0x84, 0x5e, 0x69, 0xf5, 0x85, 0x47, 0x58, 0x9f, 0x4a, 0x39, 914 0x71, 0x0f, 0xfb, 0x67, 0x1a, 0xf7, 0xca, 0x58, 0x14, 0xfb, 0x6c, 0x6a,
915 0x3e, 0xe1, 0x21, 0xc7, 0xfd, 0x31, 0xe0, 0x96, 0x8f, 0x2f, 0xc7, 0xc7, 915 0xbe, 0x10, 0x87, 0xea, 0x97, 0x39, 0x4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0x69, 0x9e, 0x63, 0xe9, 0x47, 0xce, 0x2c, 0x45, 0xd4, 923 0x6c, 0xbd, 0x1c, 0xbf, 0x81, 0xbe, 0x14, 0x37, 0xca, 0x81, 0x44, 0x4d,
924 0xbc, 0x71, 0x5b, 0x3c, 0xcf, 0x33, 0x5f, 0x10, 0xf3, 0x65, 0x3d, 0xbf, 924 0xbb, 0x3b, 0x56, 0x02, 0x9a, 0xe9, 0x78, 0x09, 0xd6, 0x0d, 0xc1, 0x97,
925 0x52, 0x8f, 0x4f, 0xc6, 0xda, 0x50, 0xa3, 0xff, 0xe0, 0x75, 0xcf, 0x7f, 925 0x58, 0x7b, 0x99, 0x32, 0x12, 0xf3, 0xb5, 0x6b, 0xa9, 0x5b, 0xb9, 0x17,
926 0x30, 0x24, 0x6a, 0x37, 0xdc, 0xa8, 0x1e, 0x64, 0xbc, 0x89, 0x39, 0x85, 926 0xeb, 0x34, 0xb5, 0xf7, 0x02, 0xbb, 0x43, 0x36, 0x22, 0x61, 0x19, 0x0b,
927 0x0f, 0x52, 0xfb, 0x88, 0x1f, 0xda, 0x4b, 0xbd, 0x07, 0x18, 0x05, 0x18, 927 0xd0, 0xf4, 0xeb, 0xf5, 0x1d, 0xcb, 0x47, 0x9c, 0x02, 0x21, 0xd6, 0x1d,
928 0x64, 0x33, 0xbe, 0x34, 0x0e, 0x22, 0xce, 0xdc, 0xe4, 0x7b, 0x50, 0x73, 928 0xa2, 0x73, 0x58, 0x9f, 0x56, 0xb1, 0xe4, 0x93, 0x59, 0x49, 0x07, 0xf3,
929 0x6a, 0xdc, 0x4c, 0x51, 0x0f, 0xfc, 0x10, 0xa8, 0x25, 0x6d, 0xe6, 0x9a, 929 0x88, 0xe0, 0x0f, 0xe0, 0xdb, 0x70, 0xd2, 0x9f, 0xe4, 0x39, 0x96, 0x71,
930 0x64, 0xec, 0x94, 0x90, 0xb1, 0xd4, 0xf2, 0x29, 0x25, 0x63, 0xa7, 0x94, 930 0xe4, 0xd4, 0x72, 0x58, 0xcd, 0x1b, 0xb7, 0xc5, 0xf3, 0xaa, 0xf6, 0x92,
931 0x1f, 0xfe, 0x94, 0x92, 0xb1, 0x53, 0x4a, 0xc6, 0x4e, 0x29, 0x19, 0x3b, 931 0xd7, 0x71, 0x07, 0xcc, 0x57, 0xe4, 0xeb, 0x95, 0xdc, 0x64, 0xd8, 0x86,
932 0xc5, 0x7c, 0x3e, 0xc6, 0xf8, 0x16, 0x58, 0x44, 0xfb, 0x41, 0x7b, 0x29, 932 0x12, 0xfd, 0x37, 0xdb, 0x3d, 0xff, 0x11, 0x53, 0xec, 0xe3, 0xf0, 0x46,
933 0x53, 0xc2, 0x75, 0xac, 0xcf, 0x6e, 0x39, 0x7b, 0x69, 0x44, 0xca, 0x19, 933 0xf1, 0x08, 0xe3, 0x4d, 0xcc, 0x29, 0x62, 0x90, 0x3a, 0x46, 0xfc, 0xc4,
934 0x63, 0x13, 0x19, 0xaf, 0xc7, 0xef, 0xc2, 0x1c, 0xfc, 0x1e, 0xd3, 0xef, 934 0x41, 0x6a, 0x3f, 0xcc, 0x28, 0xc0, 0x20, 0x9b, 0xf1, 0xa5, 0x71, 0x04,
935 0x23, 0x3a, 0x33, 0x8f, 0xbe, 0xfa, 0x28, 0x29, 0x6a, 0xc9, 0x76, 0x50, 935 0xb9, 0xe6, 0x16, 0xdf, 0x83, 0xfd, 0xa8, 0x06, 0xad, 0x04, 0xb5, 0x21,
936 0xc2, 0x89, 0x85, 0x43, 0xc8, 0x0f, 0x93, 0xb6, 0x5f, 0xb6, 0x6d, 0xae, 936 0x0e, 0x81, 0xfd, 0xb0, 0xad, 0x74, 0x95, 0x8c, 0x9d, 0x16, 0x32, 0x96,
937 0x98, 0xe6, 0x93, 0x98, 0x9a, 0x2f, 0xb7, 0x5d, 0xd4, 0x45, 0xe9, 0x22, 937 0x58, 0x39, 0xad, 0x64, 0xec, 0xb4, 0x8a, 0xc3, 0x9f, 0x56, 0x32, 0x76,
938 0xe8, 0x8a, 0x98, 0x4a, 0x93, 0xe7, 0x46, 0xd0, 0x49, 0x86, 0x44, 0xb9, 938 0x5a, 0xc9, 0xd8, 0x69, 0x25, 0x63, 0xa7, 0x99, 0xcf, 0x07, 0x18, 0xdf,
939 0x68, 0x70, 0x4c, 0xd1, 0xe0, 0xdb, 0x62, 0x8c, 0x88, 0x49, 0x84, 0x2f, 939 0x02, 0x8b, 0xe8, 0x38, 0x68, 0x3b, 0xa5, 0xf2, 0x38, 0x0f, 0xfb, 0x5c,
940 0xb3, 0x3d, 0x1d, 0x72, 0x85, 0x31, 0x7e, 0x0e, 0xcb, 0xc2, 0xc1, 0x08, 940 0x2b, 0x67, 0xef, 0xf6, 0x49, 0x39, 0x63, 0x6c, 0x22, 0xeb, 0xc9, 0xf8,
941 0xeb, 0xa4, 0x8d, 0xd3, 0xa1, 0x31, 0xf6, 0x76, 0xba, 0x67, 0xa3, 0x79, 941 0x5d, 0x98, 0x83, 0x57, 0x98, 0xe6, 0x1f, 0xd3, 0x99, 0x79, 0xf4, 0xd5,
942 0x39, 0x77, 0x1c, 0x6b, 0x49, 0x44, 0xad, 0x23, 0x12, 0x17, 0x6f, 0xb1, 942 0x47, 0x13, 0x62, 0x1f, 0xdc, 0x26, 0x8a, 0xbb, 0xb1, 0xb0, 0xc9, 0x63,
943 0x6b, 0x74, 0x34, 0xba, 0x97, 0x8f, 0xad, 0x74, 0x96, 0x0e, 0x90, 0xd1, 943 0xcd, 0x4a, 0xdf, 0xcf, 0x31, 0x6c, 0xc1, 0x27, 0xde, 0x7a, 0x15, 0x7c,
944 0x57, 0xa3, 0xbf, 0x60, 0x39, 0xe8, 0x66, 0x39, 0x38, 0xaa, 0xec, 0x92, 944 0x32, 0xae, 0xe6, 0xab, 0xd6, 0x2f, 0x6a, 0xa1, 0x64, 0x0e, 0x74, 0x45,
945 0xa3, 0x75, 0xbb, 0x64, 0xcf, 0x1e, 0xc4, 0x65, 0x64, 0xc4, 0xbe, 0xd7, 945 0xfe, 0xa4, 0xc5, 0x73, 0x23, 0xe8, 0xe4, 0x98, 0x1e, 0x34, 0x38, 0xa9,
946 0x56, 0x55, 0x43, 0x00, 0xbe, 0x6f, 0x9c, 0x77, 0x51, 0x7c, 0x18, 0xe7, 946 0x68, 0xf0, 0xb8, 0x18, 0x23, 0xf2, 0x0f, 0x11, 0xcb, 0x6c, 0x4c, 0x87,
947 0xf8, 0x2d, 0x22, 0x6b, 0x32, 0xee, 0x1b, 0xdf, 0x23, 0xb0, 0xbb, 0xcf, 947 0x74, 0x76, 0x80, 0x9f, 0xc3, 0xb2, 0x70, 0x24, 0xcc, 0x3a, 0x69, 0xeb,
948 0xc2, 0x3d, 0x47, 0xa5, 0xde, 0xf3, 0x91, 0x7f, 0xfc, 0x36, 0xe3, 0x89, 948 0x74, 0xa8, 0x8c, 0xbd, 0x91, 0xee, 0xd9, 0x6a, 0x5d, 0xce, 0xba, 0xcb,
949 0x1a, 0x3d, 0xc1, 0xef, 0xcc, 0x17, 0xf7, 0xf1, 0xb3, 0x75, 0x4d, 0x09, 949 0x96, 0x84, 0x95, 0x1d, 0x91, 0xb8, 0x78, 0x87, 0x5d, 0xa2, 0x13, 0xd1,
950 0x3b, 0x6e, 0xf8, 0xb6, 0x92, 0xbf, 0xaf, 0xdd, 0xbb, 0x2d, 0xc1, 0x8f, 950 0x83, 0xfc, 0x3d, 0x92, 0x74, 0xe8, 0x30, 0x19, 0x9d, 0x25, 0xfa, 0x11,
951 0x8c, 0xa7, 0x8d, 0xd9, 0xe8, 0x7b, 0xb5, 0xd3, 0x27, 0xe1, 0x63, 0x87, 951 0xcb, 0x41, 0x2b, 0xcb, 0xc1, 0x09, 0xe5, 0x97, 0x9c, 0x28, 0xfb, 0x25,
952 0x9c, 0x58, 0x21, 0xd3, 0xe7, 0x25, 0x1f, 0x12, 0x2b, 0x35, 0xe2, 0x63, 952 0x93, 0x07, 0x90, 0x97, 0x91, 0x12, 0xeb, 0x5e, 0x3b, 0xcb, 0xbf, 0xc3,
953 0x21, 0x2f, 0x35, 0xfa, 0x77, 0x1e, 0x5b, 0x88, 0xb0, 0x77, 0x22, 0x9f, 953 0x02, 0x3d, 0xb6, 0x88, 0xfd, 0x28, 0x7a, 0x71, 0x6c, 0xd2, 0x55, 0xf6,
954 0x9f, 0xa6, 0x19, 0x91, 0x83, 0x8d, 0x38, 0xe9, 0x33, 0xf3, 0xfa, 0x5d, 954 0xab, 0x63, 0xbe, 0x07, 0x0f, 0x08, 0xec, 0xee, 0x7b, 0x00, 0xf7, 0x9c,
955 0xb6, 0xe2, 0x8d, 0xcf, 0x20, 0xce, 0xad, 0xb8, 0x48, 0x6b, 0xaf, 0x39, 955 0x90, 0x7a, 0xcf, 0x47, 0xfe, 0xc1, 0x77, 0x18, 0x4f, 0x94, 0xe8, 0x31,
956 0xf0, 0xd7, 0x8d, 0x2d, 0xac, 0xf6, 0x85, 0x45, 0x4e, 0xf8, 0x76, 0xc6, 956 0x7e, 0x67, 0x26, 0x77, 0x88, 0x9f, 0xad, 0xf7, 0x96, 0xb0, 0x63, 0x86,
957 0x48, 0x3a, 0x1e, 0x7a, 0x9c, 0x9f, 0x0f, 0x3f, 0x5e, 0x80, 0x92, 0x57, 957 0x6f, 0x27, 0xf9, 0x3b, 0x1b, 0xbd, 0x3b, 0x22, 0xf8, 0x91, 0xf1, 0xb4,
958 0xd0, 0xae, 0x93, 0x46, 0x17, 0x6a, 0x5f, 0xe0, 0xef, 0xc5, 0xfe, 0x65, 958 0x31, 0x13, 0x7d, 0xaf, 0x34, 0x3d, 0x85, 0x18, 0x3b, 0xe4, 0x24, 0x62,
959 0x86, 0xba, 0xd5, 0xde, 0x44, 0x8f, 0xda, 0xcf, 0x8a, 0xb0, 0xec, 0x35, 959 0x5a, 0x3e, 0x2f, 0xf9, 0x90, 0x58, 0xa9, 0x92, 0x0b, 0x2b, 0xf3, 0xc2,
960 0x72, 0x9d, 0x47, 0xeb, 0x3e, 0x3d, 0xc8, 0x84, 0xdb, 0xa7, 0xf7, 0xf4, 960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0xaf, 0x0f, 0x6d, 0xb7, 0x8e, 975 0x44, 0xbc, 0xcc, 0x3c, 0xce, 0xcf, 0x9f, 0x60, 0x3c, 0x11, 0xa3, 0x66,
976 0x09, 0x92, 0xff, 0x7b, 0x61, 0xea, 0x7c, 0x0e, 0xbe, 0x97, 0x1a, 0x15, 976 0x5a, 0x5a, 0x6e, 0x66, 0xbf, 0xa0, 0x99, 0xf1, 0xc4, 0x80, 0xd9, 0xef,
977 0xa3, 0xd6, 0xa5, 0x3b, 0x24, 0xfd, 0xcf, 0x2f, 0x88, 0xb8, 0x5a, 0xbe, 977 0x13, 0xef, 0x12, 0x75, 0x35, 0x9f, 0x0f, 0x1c, 0x66, 0xbe, 0xc2, 0xbb,
978 0x9f, 0x9f, 0x39, 0x87, 0x76, 0x2f, 0x98, 0x74, 0xd3, 0x96, 0xf4, 0x7e, 978 0xfe, 0x5d, 0xbd, 0xab, 0xf6, 0x1d, 0xff, 0x51, 0xc2, 0xf1, 0x71, 0x3f,
979 0x23, 0x10, 0x26, 0xff, 0xcb, 0x88, 0x7d, 0x02, 0x56, 0x33, 0x2f, 0xd8, 979 0x39, 0x37, 0xf0, 0x1b, 0x5c, 0xf3, 0x63, 0x8c, 0x9d, 0x43, 0x94, 0x99,
980 0xfb, 0x58, 0xbf, 0x3f, 0x87, 0xfb, 0xf8, 0xf3, 0x65, 0x9c, 0x07, 0x79, 980 0x6f, 0xe2, 0x31, 0x8c, 0xb3, 0x1f, 0x11, 0xe5, 0xe3, 0xfb, 0xc8, 0x29,
981 0x9c, 0x58, 0xaf, 0x11, 0xef, 0x02, 0xbd, 0x78, 0x20, 0x12, 0x12, 0xfc, 981 0x4e, 0xd1, 0x5f, 0x15, 0xdd, 0x31, 0xe1, 0xfb, 0xb8, 0xcf, 0xb2, 0xb6,
982 0xf7, 0x08, 0xf3, 0x54, 0x87, 0xf0, 0x35, 0xf6, 0xa3, 0xad, 0x3d, 0xc4, 982 0xbf, 0x85, 0xfb, 0xf5, 0x91,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 0xef, 0xc1, 0xe6, 0x8e, 0xf9, 1019 0x1e, 0xb7, 0x94, 0xbd, 0x19, 0x9b, 0xdb, 0x15, 0xff, 0x6f, 0x40, 0x75,
1020 0x19, 0x20, 0xf7, 0x14, 0xd9, 0x80, 0xfb, 0x16, 0x90, 0xf2, 0x4a, 0x06, 1020 0xeb, 0x41, 0x73, 0x7f, 0x40, 0xf1, 0x25, 0xa0, 0x79, 0x67, 0x19, 0x86,
1021 0xad, 0xbc, 0x02, 0xa6, 0x09, 0x75, 0x88, 0xfe, 0xa6, 0xf5, 0x9f, 0xe5, 1021 0x43, 0x3d, 0xa0, 0x3c, 0x0a, 0x1a, 0x0f, 0x41, 0xcc, 0xf5, 0x1e, 0x5a,
1022 0x60, 0xe3, 0x80, 0x4d, 0x40, 0x73, 0x9b, 0xa7, 0x90, 0x32, 0xf7, 0x0c, 1022 0x03, 0x12, 0x07, 0x8d, 0x89, 0x20, 0xe6, 0x7a, 0x0f, 0x41, 0xe7, 0x7a,
1023 0xac, 0x6f, 0xb1, 0xae, 0x6d, 0xb4, 0x01, 0xef, 0xb1, 0x5e, 0x34, 0x85, 1023 0x0f, 0xad, 0xb1, 0x01, 0x97, 0xdb, 0xcd, 0x53, 0x80, 0xe1, 0x3e, 0x85,
1024 0x85, 0x61, 0x49, 0x0f, 0x03, 0xb0, 0x7e, 0x00, 0xa5, 0x75, 0x50, 0x1d, 1024 0x19, 0xba, 0xce, 0x51, 0x0d, 0x7a, 0x77, 0x52, 0x0c, 0x78, 0x4c, 0x5b,
1025 0x01, 0x4f, 0xef, 0x02, 0x4d, 0x40, 0xf7, 0x39, 0x01, 0xdb, 0xa2, 0xce, 1025 0x50, 0x05, 0x7f, 0x18, 0xba, 0x62, 0x84, 0xa1, 0x0d, 0xb8, 0x9d, 0xe5,
1026 0xfd, 0xca, 0xe0, 0xb5, 0xb2, 0x0d, 0xd0, 0x73, 0xab, 0x16, 0xf5, 0x88, 1026 0x02, 0x34, 0xd3, 0x79, 0x4a, 0x0c, 0x30, 0x3c, 0x23, 0x80, 0x79, 0x4f,
1027 0xc9, 0x83, 0xf2, 0x99, 0x93, 0x0a, 0x03, 0x19, 0x79, 0x81, 0x0d, 0x9a, 1027 0x18, 0x9a, 0xf7, 0x60, 0x73, 0xc7, 0xfc, 0x0c, 0x90, 0x7b, 0x98, 0x6c,
1028 0x17, 0xc0, 0xe1, 0x04, 0x4c, 0xeb, 0xc0, 0x32, 0x6a, 0x8d, 0x2e, 0xd0, 1028 0xc0, 0x7d, 0x0b, 0x48, 0x79, 0x25, 0x83, 0x56, 0x5e, 0x01, 0xd3, 0x84,
1029 0x3c, 0x1e, 0x16, 0x97, 0x7e, 0x90, 0x18, 0x03, 0x54, 0x8c, 0x05, 0xc8, 1029 0x3a, 0x44, 0x7f, 0xd3, 0x7a, 0x0d, 0x79, 0xd8, 0x38, 0x60, 0x13, 0xd0,
1030 0x97, 0x01, 0xb6, 0x29, 0x41, 0x7e, 0x05, 0xe5, 0x05, 0x90, 0xd9, 0x20, 1030 0xdc, 0xe6, 0x29, 0xa4, 0xcc, 0x3d, 0x03, 0xeb, 0x5b, 0xac, 0x6b, 0x1b,
1031 0xbf, 0x83, 0xca, 0x4e, 0x50, 0x5e, 0x04, 0xb2, 0x97, 0x08, 0x41, 0xfd, 1031 0x6d, 0xc0, 0x7b, 0xac, 0x17, 0x4d, 0x61, 0x61, 0x58, 0xd2, 0xc3, 0x00,
1032 0x0c, 0xa4, 0x81, 0xec, 0xe6, 0x29, 0x22, 0x60, 0x7e, 0x52, 0x80, 0x10, 1032 0xac, 0x1f, 0x40, 0x69, 0x1d, 0x54, 0x47, 0xc0, 0xd3, 0xbb, 0x40, 0x13,
1033 0x43, 0x03, 0x3c, 0x1f, 0x10, 0x1b, 0xc6, 0x30, 0xf5, 0x31, 0x64, 0xe4, 1033 0xd0, 0x7d, 0x4e, 0xc0, 0xb6, 0xa8, 0x73, 0xbf, 0x32, 0x78, 0xad, 0x6c,
1034 0x1b, 0x88, 0x19, 0x88, 0x7c, 0xc3, 0xce, 0x70, 0x40, 0x00, 0x16, 0x56, 1034 0x03, 0xf4, 0xfc, 0xaa, 0x45, 0x3d, 0xde, 0xf2, 0xa0, 0x7c, 0xe6, 0xa4,
1035 0xff, 0xff, 0x1f, 0x53, 0x61, 0x01, 0xa6, 0x53, 0xd0, 0x3a, 0xd6, 0xdf, 1035 0xc2, 0x40, 0x46, 0x5e, 0x60, 0x83, 0xe6, 0x05, 0x70, 0x38, 0x01, 0xd3,
1036 0xff, 0x0f, 0x88, 0xb0, 0x30, 0xb4, 0xc0, 0xd7, 0x23, 0xe6, 0xc8, 0x83, 1036 0x3a, 0xb0, 0x8c, 0x5a, 0x93, 0x04, 0x34, 0x8f, 0x87, 0xc5, 0xa5, 0x1f,
1037 0xca, 0xd0, 0x05, 0x40, 0x56, 0x1b, 0xbc, 0x4d, 0xc0, 0x02, 0xbe, 0xef, 1037 0x24, 0xc6, 0x00, 0x15, 0x63, 0x01, 0xf2, 0x65, 0x80, 0x6d, 0x4a, 0x90,
1038 0x79, 0x01, 0xc3, 0x2f, 0x60, 0x99, 0xf5, 0xff, 0xff, 0x52, 0xb8, 0x5a, 1038 0x5f, 0x41, 0x79, 0x01, 0x64, 0x36, 0xc8, 0xef, 0xa0, 0xb2, 0x13, 0x94,
1039 0x10, 0x00, 0x00, 0x19, 0x3f, 0x16, 0x21, 0xc4, 0x7d, 0x00, 0x00, 0x00 }; 1039 0x17, 0x81, 0xec, 0x25, 0x42, 0x50, 0x3f, 0x03, 0x69, 0x20, 0xbb, 0x79,
1040 0x8a, 0x08, 0x98, 0x9f, 0x14, 0x20, 0xc4, 0xd0, 0x00, 0xcf, 0x07, 0xc4,
1041 0x86, 0x31, 0x4c, 0x7d, 0x0c, 0x19, 0xf9, 0x06, 0x62, 0x06, 0x22, 0xdf,
1042 0xb0, 0x33, 0x1c, 0x10, 0x80, 0x85, 0xd5, 0xff, 0xff, 0xc7, 0x54, 0x58,
1043 0x80, 0xe9, 0x14, 0xb4, 0x8e, 0xf5, 0xf7, 0xff, 0x03, 0x22, 0x2c, 0x0c,
1044 0x2d, 0xf0, 0xf5, 0x88, 0x0b, 0xe5, 0x41, 0x65, 0xe8, 0x02, 0x20, 0xab,
1045 0x0d, 0xde, 0x26, 0x60, 0x01, 0xdf, 0x61, 0xbd, 0x80, 0xe1, 0x17, 0xb0,
1046 0xcc, 0xfa, 0xff, 0x7f, 0x29, 0x5c, 0x2d, 0x08, 0x00, 0x00, 0xff, 0x88,
1047 0x78, 0xb5, 0x98, 0x7e, 0x00, 0x00, 0x00 };
1040 1048
1041static const u32 bnx2_COM_b09FwData[(0x0/4) + 1] = { 0x0 }; 1049static const u32 bnx2_COM_b09FwData[(0x0/4) + 1] = { 0x0 };
1042static const u32 bnx2_COM_b09FwRodata[(0x88/4) + 1] = { 1050static const u32 bnx2_COM_b09FwRodata[(0x88/4) + 1] = {
1043 0x08001b68, 0x08001ba4, 0x08001ba4, 0x08001ba4, 0x08001ba4, 0x08001ba4, 1051 0x08001b7c, 0x08001bb8, 0x08001bb8, 0x08001bb8, 0x08001bb8, 0x08001bb8,
1044 0x08001ab4, 0x08001ba4, 0x08001b28, 0x08001ba4, 0x08001a3c, 0x08001ba4, 1052 0x08001ac8, 0x08001bb8, 0x08001b3c, 0x08001bb8, 0x08001a50, 0x08001bb8,
1045 0x08001ba4, 0x08001ba4, 0x08001a48, 0x00000000, 0x08002abc, 0x08002b0c, 1053 0x08001bb8, 0x08001bb8, 0x08001a5c, 0x00000000, 0x08002b74, 0x08002bc4,
1046 0x08002b3c, 0x08002b6c, 0x08002b9c, 0x00000000, 0x0800604c, 0x0800604c, 1054 0x08002bf4, 0x08002c24, 0x08002c58, 0x00000000, 0x08006120, 0x08006120,
1047 0x0800604c, 0x0800604c, 0x0800604c, 0x08006078, 0x08006078, 0x080060b8, 1055 0x08006120, 0x08006120, 0x08006120, 0x0800614c, 0x0800614c, 0x0800618c,
1048 0x080060c4, 0x080060c4, 0x0800604c, 0x00000000, 0x00000000 }; 1056 0x08006198, 0x08006198, 0x08006120, 0x00000000, 0x00000000 };
1049 1057
1050static struct fw_info bnx2_com_fw_09 = { 1058static struct fw_info bnx2_com_fw_09 = {
1059 /* Firmware version: 3.7.1 */
1051 .ver_major = 0x3, 1060 .ver_major = 0x3,
1052 .ver_minor = 0x4, 1061 .ver_minor = 0x7,
1053 .ver_fix = 0x3, 1062 .ver_fix = 0x1,
1054 1063
1055 .start_addr = 0x080000b4, 1064 .start_addr = 0x080000b4,
1056 1065
1057 .text_addr = 0x08000000, 1066 .text_addr = 0x08000000,
1058 .text_len = 0x7dc0, 1067 .text_len = 0x7e94,
1059 .text_index = 0x0, 1068 .text_index = 0x0,
1060 .gz_text = bnx2_COM_b09FwText, 1069 .gz_text = bnx2_COM_b09FwText,
1061 .gz_text_len = sizeof(bnx2_COM_b09FwText), 1070 .gz_text_len = sizeof(bnx2_COM_b09FwText),
1062 1071
1063 .data_addr = 0x08007e60, 1072 .data_addr = 0x08007f40,
1064 .data_len = 0x0, 1073 .data_len = 0x0,
1065 .data_index = 0x0, 1074 .data_index = 0x0,
1066 .data = bnx2_COM_b09FwData, 1075 .data = bnx2_COM_b09FwData,
1067 1076
1068 .sbss_addr = 0x08007e60, 1077 .sbss_addr = 0x08007f40,
1069 .sbss_len = 0x60, 1078 .sbss_len = 0x60,
1070 .sbss_index = 0x0, 1079 .sbss_index = 0x0,
1071 1080
1072 .bss_addr = 0x08007ec0, 1081 .bss_addr = 0x08007fa0,
1073 .bss_len = 0x88, 1082 .bss_len = 0x88,
1074 .bss_index = 0x0, 1083 .bss_index = 0x0,
1075 1084
1076 .rodata_addr = 0x08007dc0, 1085 .rodata_addr = 0x08007e98,
1077 .rodata_len = 0x88, 1086 .rodata_len = 0x88,
1078 .rodata_index = 0x0, 1087 .rodata_index = 0x0,
1079 .rodata = bnx2_COM_b09FwRodata, 1088 .rodata = bnx2_COM_b09FwRodata,
1080}; 1089};
1081 1090
1082static u8 bnx2_CP_b09FwText[] = { 1091static u8 bnx2_CP_b09FwText[] = {
1083/* 0x1f, 0x8b, 0x08, 0x00, 0x0f, 0x34, 0xe7, 0x45, 0x00, 0x03, */ 1092 0xbd, 0x7d, 0x0d, 0x74, 0x5c, 0xd7, 0x5d, 0xe7, 0xff, 0xdd, 0x79, 0x92,
1084 0xbd, 0x7d, 1093 0xc6, 0xb2, 0x6c, 0x3f, 0xcb, 0x13, 0x79, 0x62, 0xab, 0xf6, 0x8c, 0xf4,
1085 0x0d, 0x74, 0x5c, 0x57, 0x7d, 0xe7, 0xff, 0xdd, 0x19, 0x49, 0x63, 0x59, 1094 0x64, 0xab, 0x91, 0x08, 0x2f, 0xae, 0x28, 0x82, 0x9d, 0x84, 0xe9, 0x48,
1086 0x96, 0x9f, 0xe5, 0x89, 0x32, 0x51, 0x84, 0x3d, 0x23, 0x3d, 0xd9, 0x22, 1095 0xb2, 0x9d, 0x34, 0xed, 0xca, 0x8d, 0x5b, 0xb2, 0x9c, 0x02, 0x62, 0x24,
1087 0x12, 0xe1, 0xc5, 0x11, 0xac, 0xda, 0x2a, 0xe9, 0x30, 0x92, 0x3f, 0x12, 1096 0x27, 0xe9, 0x77, 0xd2, 0x04, 0xb6, 0xec, 0xc9, 0x6e, 0x26, 0x23, 0xf9,
1088 0x02, 0xab, 0x10, 0x43, 0xb3, 0x1c, 0x4a, 0xc5, 0x48, 0x4e, 0x02, 0x04, 1097 0x83, 0x74, 0xec, 0x51, 0x12, 0x25, 0xce, 0xa1, 0x3d, 0xbb, 0xaa, 0xa4,
1089 0xea, 0x40, 0xe8, 0x86, 0xdd, 0xec, 0x66, 0x32, 0x92, 0x3f, 0x9a, 0x8e, 1098 0xd8, 0x06, 0x06, 0x8f, 0x93, 0xb8, 0xa5, 0xec, 0xa6, 0x54, 0x28, 0xae,
1090 0x3d, 0x93, 0x44, 0x89, 0xbd, 0xdd, 0x9c, 0xad, 0x90, 0x14, 0x3b, 0x74, 1099 0x09, 0xa1, 0x07, 0x52, 0x48, 0xd9, 0x40, 0x53, 0x2a, 0xdc, 0xb4, 0xcd,
1091 0x07, 0x4f, 0xe2, 0x98, 0x96, 0x73, 0x0a, 0x8d, 0x50, 0x8c, 0x9b, 0xe6, 1100 0x9e, 0x53, 0xb6, 0x01, 0xca, 0x12, 0x68, 0xe8, 0xdb, 0xdf, 0xef, 0xde,
1092 0xb0, 0xdd, 0xd0, 0xa6, 0x34, 0xdb, 0x86, 0x22, 0x8c, 0x81, 0xf4, 0x2c, 1101 0xfb, 0x34, 0xa3, 0x0f, 0xe7, 0xa3, 0xec, 0xe2, 0x73, 0x9e, 0xdf, 0xbc,
1093 0xdd, 0x86, 0x42, 0x77, 0xd3, 0x36, 0xe5, 0xed, 0xef, 0x77, 0xef, 0x7d, 1102 0xfb, 0xee, 0xc7, 0xff, 0xfe, 0xef, 0xff, 0xfb, 0xfe, 0xef, 0xd3, 0x76,
1094 0x9a, 0x91, 0x34, 0xce, 0x07, 0xdd, 0xad, 0xcf, 0x79, 0x7e, 0xf3, 0xee, 1103 0x91, 0x66, 0xb1, 0xff, 0x36, 0xe0, 0x7a, 0x5b, 0xea, 0xf6, 0xd1, 0x6b,
1095 0xbb, 0x1f, 0xff, 0xfb, 0xbf, 0xff, 0xef, 0xfb, 0xbf, 0x4f, 0x97, 0x8b, 1104 0xae, 0xfe, 0xc9, 0xab, 0xf9, 0xec, 0x3a, 0x4d, 0x31, 0x79, 0x13, 0xff,
1096 0x34, 0x8b, 0xfd, 0xb7, 0x01, 0xd7, 0xd5, 0xc9, 0xfd, 0xe3, 0x57, 0x5f, 1105 0x52, 0x6f, 0xa0, 0x0e, 0x3a, 0xf4, 0xa2, 0xb1, 0x78, 0x49, 0x5c, 0x65,
1097 0x39, 0x70, 0x25, 0x9f, 0xa3, 0x91, 0x68, 0x44, 0xde, 0xc4, 0xbf, 0xe4, 1106 0xdc, 0x3b, 0x72, 0xbe, 0xc4, 0x63, 0x99, 0x91, 0x5f, 0x1e, 0xf5, 0x45,
1098 0x1b, 0xa8, 0x83, 0x0e, 0xdd, 0x70, 0x2c, 0x5e, 0x12, 0x53, 0x43, 0xde, 1107 0xb2, 0x95, 0x9e, 0xd4, 0x80, 0xfc, 0x4b, 0x58, 0x48, 0xb8, 0xc2, 0xf2,
1099 0xfe, 0x8c, 0x27, 0xb1, 0xc8, 0x50, 0xee, 0xce, 0x71, 0x4f, 0x24, 0x5d, 1108 0xb7, 0x64, 0x5e, 0xfd, 0x6f, 0x5f, 0xf8, 0xc9, 0xf4, 0xcb, 0xd3, 0x31,
1100 0xee, 0x4b, 0x0e, 0xcb, 0x3f, 0x05, 0xb9, 0x78, 0x54, 0x58, 0xfe, 0x96, 1109 0x89, 0x7b, 0x99, 0x0f, 0x8b, 0xb7, 0x4b, 0xe2, 0xed, 0x19, 0xb9, 0xe3,
1101 0xa1, 0x57, 0x7f, 0xeb, 0x2b, 0xff, 0x2a, 0xf5, 0xf2, 0x4c, 0x44, 0x62, 1110 0xd3, 0xbb, 0xff, 0x46, 0x64, 0x63, 0xd4, 0xd7, 0x4b, 0xe1, 0x17, 0x76,
1102 0xee, 0xd0, 0xed, 0xe2, 0x6e, 0x93, 0x58, 0xe7, 0x50, 0x72, 0xff, 0x23, 1111 0x4b, 0x61, 0x5b, 0x26, 0x39, 0xd2, 0x90, 0x49, 0xc8, 0x17, 0xab, 0x9e,
1103 0xdb, 0x97, 0x44, 0x5a, 0xc3, 0xbe, 0x5e, 0x0a, 0xbe, 0xb2, 0x5d, 0x72, 1112 0x9c, 0xab, 0xca, 0xf0, 0xa9, 0xd2, 0xcb, 0xa1, 0x9b, 0x09, 0x63, 0x13,
1104 0x1d, 0x43, 0x89, 0xb1, 0x86, 0x21, 0x57, 0x9e, 0xaa, 0xc8, 0xe8, 0x89, 1113 0x7d, 0x8e, 0xc4, 0x32, 0x72, 0x61, 0xb4, 0xef, 0x9e, 0x50, 0xf9, 0x32,
1105 0xc2, 0xcb, 0x41, 0x74, 0x28, 0x88, 0x4c, 0x0d, 0x38, 0x12, 0x19, 0x92, 1114 0xe2, 0x65, 0xfc, 0x60, 0x41, 0x5a, 0xfa, 0x2f, 0xf6, 0xa1, 0x4e, 0xe5,
1106 0xb3, 0xe3, 0x03, 0xf7, 0x04, 0xca, 0xf3, 0xfc, 0x45, 0x69, 0x19, 0x3c, 1115 0xe0, 0xb5, 0x8d, 0x27, 0xe2, 0xa2, 0x32, 0x5d, 0xcf, 0xe7, 0x62, 0xd7,
1107 0x37, 0x80, 0xf7, 0x65, 0x41, 0xdd, 0xbd, 0xd7, 0x9c, 0x28, 0xc4, 0x44, 1116 0x88, 0xf2, 0xfd, 0xe0, 0x82, 0x74, 0x05, 0x4f, 0x09, 0xca, 0xcf, 0xc6,
1108 0x0d, 0xf5, 0xbc, 0x90, 0x89, 0x5c, 0x25, 0x7c, 0x7f, 0x56, 0x7a, 0xfc, 1117 0x25, 0x57, 0x95, 0x16, 0x94, 0xe1, 0xde, 0x8c, 0x3a, 0x69, 0x2f, 0x17,
1109 0xa7, 0x05, 0xe5, 0xe5, 0x98, 0x64, 0x2a, 0xd2, 0x82, 0x32, 0xdc, 0x9b, 1118 0x4b, 0x48, 0xb1, 0xfa, 0x63, 0xcd, 0x66, 0xec, 0xaf, 0xaf, 0x33, 0xf7,
1110 0x51, 0x27, 0xe5, 0x66, 0x22, 0xae, 0xe4, 0x2b, 0x3f, 0x5e, 0x67, 0xc6, 1119 0xdd, 0xf6, 0xbe, 0xee, 0x67, 0xdd, 0x4c, 0x3c, 0xae, 0x4e, 0xc8, 0xcb,
1111 0x9d, 0xb3, 0xf7, 0xbf, 0x8e, 0x99, 0x3b, 0xc6, 0x2d, 0xc6, 0x64, 0x29, 1120 0x13, 0x7d, 0x2f, 0x87, 0x31, 0xdf, 0xf7, 0x06, 0xa4, 0x41, 0x06, 0x13,
1112 0x92, 0x10, 0xc0, 0x82, 0x79, 0x25, 0x64, 0xb2, 0x98, 0x94, 0x4c, 0x81, 1121 0x80, 0xa9, 0xec, 0xa0, 0xef, 0x14, 0xda, 0xfe, 0x12, 0x70, 0x0e, 0xf8,
1113 0xb0, 0x45, 0x25, 0xeb, 0x12, 0xae, 0x04, 0xda, 0xb7, 0x39, 0xf5, 0xeb, 1122 0xca, 0x29, 0x29, 0x10, 0xce, 0x72, 0x5c, 0x16, 0x63, 0x49, 0x01, 0xfc,
1114 0xb3, 0xee, 0x0b, 0xa8, 0x9b, 0x44, 0xbd, 0x4e, 0x79, 0x12, 0x75, 0x4f, 1123 0xc0, 0x45, 0xbb, 0x8c, 0xa3, 0x3c, 0x57, 0xe2, 0x7c, 0x5c, 0xc9, 0x7b,
1115 0x57, 0xe2, 0xf2, 0x44, 0xe5, 0x57, 0x25, 0x8d, 0xb6, 0x8f, 0x57, 0x30, 1124 0x1e, 0xe6, 0xd2, 0x8e, 0x36, 0x3b, 0x1d, 0xd3, 0x3f, 0x9e, 0x97, 0xd5,
1116 0x76, 0xb1, 0x51, 0x86, 0xa7, 0x9b, 0x25, 0x33, 0xdd, 0x9d, 0xc8, 0x4a, 1125 0x67, 0xdd, 0xe7, 0x51, 0x37, 0xa5, 0xeb, 0x3d, 0x51, 0x4d, 0xca, 0xe3,
1117 0x10, 0x7c, 0xda, 0xff, 0xa8, 0x8c, 0xb5, 0xa1, 0x7e, 0x91, 0xef, 0x12, 1126 0xd5, 0x84, 0x3c, 0x56, 0xfd, 0x98, 0x64, 0x3d, 0xe2, 0x00, 0xb0, 0x96,
1118 0x2b, 0xde, 0x65, 0xfd, 0x3e, 0x37, 0xab, 0x1c, 0x49, 0xef, 0x4d, 0x25, 1127 0x1b, 0x65, 0x60, 0xaa, 0x59, 0x72, 0x53, 0x9d, 0xc9, 0xbc, 0x84, 0xe1,
1119 0xc6, 0x14, 0x9f, 0x1b, 0x24, 0xd3, 0x8f, 0xe7, 0xd1, 0xa8, 0x44, 0xbc, 1128 0x9d, 0xc1, 0x07, 0x64, 0xa4, 0x15, 0xf5, 0xcb, 0x7c, 0x97, 0x5c, 0xf6,
1120 0x20, 0xb8, 0xc3,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x0c, 0xf8, 0x13, 0xd9, 0xf4, 0x66, 0xb9,
1135 0xf4, 0x53, 0x89, 0x1c, 0xd6, 0xec, 0x42, 0x21, 0x2e, 0xdf, 0x2b, 0xa4, 1144 0xc9, 0xae, 0xcb, 0x37, 0x31, 0x66, 0xa7, 0x77, 0x87, 0xea, 0xf4, 0x02,
1136 0x40, 0xc5, 0xa9, 0xde, 0x39, 0xe9, 0xf3, 0xe7, 0x00, 0x6f, 0x1e, 0xd7, 1145 0x95, 0xf6, 0x66, 0xe4, 0xf7, 0xf1, 0x1c, 0x86, 0x07, 0x82, 0x74, 0xb2,
1137 0x41, 0xbe, 0x2b, 0xe3, 0x5d, 0x99, 0x6d, 0x83, 0xe0, 0x26, 0xff, 0x37, 1146 0x80, 0x35, 0x7b, 0xb1, 0x94, 0x90, 0x6f, 0x95, 0xd2, 0xa0, 0xfc, 0x74,
1138 0x83, 0xb1, 0x76, 0xc3, 0x17, 0x4f, 0x15, 0xb1, 0x9e, 0x80, 0xf9, 0x74, 1147 0xf7, 0xac, 0xf4, 0x04, 0xb3, 0x80, 0xb7, 0x88, 0xeb, 0x08, 0xdf, 0x55,
1139 0x11, 0xeb, 0x89, 0xb5, 0x7a, 0x5c, 0xaf, 0x7b, 0x2f, 0xd6, 0x9d, 0xb4, 1148 0xf0, 0xae, 0xc2, 0xb6, 0x61, 0x78, 0x53, 0xf0, 0xeb, 0xe1, 0x48, 0x9b,
1140 0x41, 0xba, 0xd8, 0x61, 0x69, 0xf9, 0x03, 0xf6, 0x2e, 0x92, 0x29, 0x3a, 1149 0xe1, 0xa5, 0x2f, 0x96, 0xb1, 0x9e, 0x80, 0xf9, 0x71, 0xac, 0xd3, 0x63,
1141 0x92, 0xf1, 0xff, 0x31, 0x48, 0x6b, 0x7e, 0x11, 0x67, 0xb8, 0x48, 0x5a, 1150 0xe5, 0x88, 0x4e, 0xba, 0xb1, 0xee, 0xa4, 0x0d, 0xd2, 0xc5, 0x1e, 0x4b,
1142 0x6c, 0x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 0x6f,
1164 0xe4, 0x03, 0x65, 0x07, 0x79, 0xd9, 0x53, 0x5c, 0xab, 0x4c, 0xa1, 0x17, 1173 0xc1, 0x6f, 0x96, 0x89, 0x2d, 0x73, 0xf5, 0xf3, 0x40, 0x85, 0x30, 0x47,
1165 0xeb, 0xd1, 0x28, 0xd9, 0xfe, 0xe3, 0x84, 0x15, 0x72, 0xe7, 0xa5, 0x4f, 1174 0x74, 0x0f, 0x3e, 0x98, 0x82, 0xfc, 0x01, 0xdd, 0x0f, 0x90, 0x5f, 0xe6,
1166 0x66, 0xbc, 0x5c, 0x22, 0xa2, 0xf1, 0x04, 0xca, 0x82, 0x3c, 0x4c, 0xeb, 1175 0x38, 0x17, 0xc2, 0xb5, 0x4d, 0xff, 0x1e, 0x9f, 0xda, 0xa1, 0x9f, 0xf3,
1167 0x99, 0x75, 0x49, 0xbe, 0xbf, 0x64, 0xeb, 0xc8, 0xaf, 0xb2, 0x4e, 0x74, 1176 0xc3, 0xdb, 0xa4, 0x30, 0x17, 0xcd, 0x99, 0xb2, 0x87, 0xf2, 0x26, 0x7d,
1168 0x4d, 0x9d, 0x7f, 0xa7, 0x0c, 0x5f, 0xf6, 0x62, 0xdd, 0x3a, 0x14, 0xf1, 1177 0x0c, 0x74, 0x05, 0xf9, 0x13, 0x86, 0x0f, 0x06, 0x94, 0x41, 0x61, 0xf8,
1169 0xd8, 0xb5, 0x8d, 0xcf, 0x12, 0x6b, 0x18, 0xfa, 0x3d, 0xbc, 0x7b, 0xee, 1178 0x78, 0x40, 0x99, 0x74, 0x1e, 0xb2, 0x86, 0x72, 0x88, 0x72, 0x61, 0x50,
1170 0x53, 0x8f, 0x7a, 0xf5, 0xde, 0xfd, 0x28, 0xba, 0xf6, 0xdd, 0x94, 0x44, 1179 0x71, 0xdd, 0x73, 0xa5, 0x00, 0xeb, 0xd3, 0x28, 0xf9, 0xde, 0x47, 0x08,
1171 0xbd, 0x54, 0xef, 0x8d, 0xea, 0x4f, 0x1a, 0xa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, 0x58, 0x1e, 0x40, 0x1f,
1186 0x0e, 0x52, 0x16, 0x0e, 0x8d, 0x7e, 0x2a, 0xe3, 0x2d, 0x0c, 0x36, 0x82, 1195 0xfd, 0xb4, 0x32, 0x32, 0x86, 0xf2, 0x4c, 0xe3, 0x0d, 0x74, 0x9e, 0x04,
1187 0x66, 0xcf, 0xa3, 0xcd, 0x6e, 0xb4, 0xdc, 0x57, 0x8e, 0xca, 0x48, 0x79, 1196 0xdd, 0x51, 0x26, 0x83, 0xcf, 0x7c, 0xf2, 0xfe, 0x06, 0x19, 0x49, 0xf4,
1188 0x00, 0xbc, 0xe0, 0xc8, 0x39, 0x6f, 0xa3, 0x9c, 0xf3, 0x51, 0xb7, 0x12, 1197 0x78, 0x6f, 0x53, 0x2d, 0xa0, 0xb1, 0xb4, 0x97, 0x52, 0xe4, 0x3f, 0x29,
1189 0x91, 0xc5, 0xb8, 0x23, 0x8b, 0x78, 0xce, 0xf8, 0x78, 0x57, 0x09, 0x79, 1198 0x80, 0xb7, 0x0b, 0x03, 0xa2, 0x12, 0x4a, 0x42, 0x19, 0x0c, 0x54, 0xab,
1190 0x6b, 0x40, 0x0e, 0x14, 0x7d, 0x39, 0x5c, 0xbc, 0x41, 0x85, 0x7a, 0x6d, 1199 0x92, 0x7b, 0xc0, 0x5f, 0x59, 0xe8, 0xbf, 0x03, 0xe1, 0x80, 0xe6, 0x2d,
1191 0xa7, 0xbf, 0x5e, 0x1e, 0x73, 0x4d, 0xdf, 0xbb, 0xbd, 0x05, 0x68, 0xd4, 1200 0x53, 0xf7, 0xf2, 0xf2, 0xb9, 0x5f, 0x8e, 0x50, 0xae, 0x66, 0x82, 0x3b,
1192 0xa8, 0x9c, 0xf7, 0x52, 0x89, 0x45, 0xcd, 0x13, 0xff, 0x27, 0x18, 0x41, 1201 0x73, 0xfe, 0x7c, 0x7f, 0x23, 0x68, 0xf6, 0x12, 0xda, 0xec, 0x43, 0xcb,
1193 0x3f, 0xb3, 0x5e, 0xca, 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fd, 0x7e, 0x0d, 0x6b, 0xea, 0xe2,
1208 0x77, 0xed, 0x52, 0xde, 0x95, 0x92, 0x9d, 0xef, 0x94, 0x03, 0x85, 0x77, 1217 0xfa, 0x93, 0xf5, 0xb2, 0x31, 0x80, 0x1d, 0xc0, 0x72, 0x74, 0xda, 0x46,
1209 0x58, 0xd9, 0x82, 0x4b, 0xbe, 0xe4, 0x98, 0x79, 0x26, 0xf4, 0xba, 0xe7, 1218 0xfb, 0xec, 0x19, 0xe0, 0x61, 0x9c, 0x6b, 0x9e, 0xcc, 0xc5, 0x9c, 0x61,
1210 0x8b, 0x39, 0x67, 0x94, 0xf0, 0xe3, 0xf7, 0x70, 0xa1, 0xcf, 0xdd, 0x24, 1219 0xda, 0x3e, 0xc3, 0x90, 0x8f, 0xf9, 0x0a, 0xfb, 0x26, 0xbc, 0x49, 0xfb,
1211 0xa4, 0x81, 0x29, 0x67, 0xb8, 0xe2, 0xa4, 0x23, 0x43, 0x3d, 0x89, 0x49, 1220 0x1b, 0x36, 0x5b, 0xa9, 0xdd, 0xfe, 0x6e, 0xc1, 0xef, 0x94, 0xfd, 0x0d,
1212 0x39, 0x8c, 0xdf, 0xe2, 0x46, 0x86, 0xbe, 0x84, 0xbb, 0xc1, 0xc1, 0x57, 1221 0x99, 0x5a, 0xf2, 0xed, 0xef, 0x04, 0x7e, 0x77, 0xdb, 0xdf, 0x49, 0xfc,
1213 0xb6, 0x43, 0xb6, 0x16, 0x29, 0x2f, 0x3d, 0xcc, 0x3d, 0x29, 0x67, 0x56, 1222 0xee, 0xd5, 0xbf, 0x27, 0xca, 0x7b, 0xf7, 0x2a, 0xff, 0x6a, 0xc9, 0xcf,
1214 0xd8, 0x58, 0xc4, 0x85, 0x92, 0xec, 0x74, 0xea, 0x78, 0x4e, 0x52, 0xb9, 1223 0xb5, 0xcb, 0xe1, 0xd2, 0x7b, 0xad, 0x6c, 0xc1, 0x25, 0x9f, 0x77, 0xcc,
1215 0x19, 0x30, 0xc4, 0x8d, 0x7e, 0x54, 0xde, 0xe7, 0x83, 0x76, 0xaf, 0x74, 1224 0x3c, 0x01, 0x77, 0x99, 0x6d, 0x0a, 0xce, 0xb0, 0xb6, 0xdd, 0xda, 0x61,
1216 0x64, 0xd7, 0x95, 0x51, 0xd8, 0x44, 0xde, 0xcc, 0x2e, 0xc8, 0x58, 0xc8, 1225 0xeb, 0xf4, 0x78, 0x9b, 0x85, 0x34, 0x30, 0xe1, 0x0c, 0x54, 0x9d, 0x6c,
1217 0xbe, 0x08, 0xe9, 0x41, 0x9d, 0x92, 0xb1, 0xe8, 0x10, 0xb0, 0x7d, 0xaa, 1226 0x2c, 0xd3, 0x95, 0x1c, 0x97, 0x63, 0xf8, 0x2d, 0x5e, 0x2c, 0xf3, 0x79,
1218 0x7f, 0x64, 0xb2, 0x90, 0xbd, 0x5d, 0x0d, 0xed, 0xff, 0x6c, 0x66, 0xe0, 1227 0xdc, 0x0d, 0x0e, 0xbe, 0x00, 0x7d, 0x33, 0x5e, 0xa6, 0xbc, 0xf4, 0x31,
1219 0xad, 0x92, 0xdd, 0xab, 0x80, 0xa3, 0xf6, 0x31, 0xc8, 0x4c, 0xcc, 0x2b, 1228 0xf7, 0x94, 0x9c, 0x5f, 0x66, 0xaf, 0x11, 0x17, 0x4a, 0xf2, 0x53, 0xe9,
1220 0x08, 0x40, 0xcf, 0x90, 0xe7, 0x37, 0xdd, 0x14, 0x19, 0x6a, 0x90, 0xe1, 1229 0x47, 0x0a, 0x92, 0x2e, 0x4c, 0x83, 0x21, 0x0e, 0x04, 0xae, 0xbc, 0x27,
1221 0xbd, 0xed, 0x68, 0xc3, 0x77, 0xc4, 0xd7, 0x79, 0xe0, 0x33, 0x95, 0x1c, 1230 0x00, 0xed, 0x5e, 0xed, 0xc8, 0xde, 0xab, 0x5d, 0xd8, 0x57, 0xfe, 0xf4,
1222 0x11, 0xb9, 0x7b, 0x6a, 0x60, 0xc9, 0x99, 0x2c, 0x7d, 0x10, 0x3c, 0x79, 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x63, 0xc7, 0x50, 0xff, 0x8e,
1230 0x11, 0xe5, 0x7c, 0x26, 0xce, 0x88, 0x17, 0xda, 0x22, 0x0d, 0xda, 0x76, 1239 0x1d, 0xa3, 0xfd, 0xae, 0xd5, 0x2d, 0x3b, 0x76, 0x4c, 0xf4, 0x67, 0x31,
1231 0xcc, 0x16, 0x48, 0x33, 0x51, 0x99, 0x28, 0xb4, 0xa1, 0x0d, 0xe8, 0xe2, 1240 0xff, 0x1e, 0x6f, 0x50, 0x7c, 0x6f, 0x2f, 0x95, 0x7c, 0xc2, 0xac, 0xfd,
1232 0x94, 0xbd, 0x8e, 0x02, 0xb6, 0xbd, 0xe8, 0xeb, 0xe8, 0x21, 0xb4, 0xa3, 1241 0x4c, 0xd0, 0x8d, 0xf7, 0x6c, 0xdf, 0xab, 0xdf, 0x0f, 0x48, 0x4f, 0xb2,
1233 0xcc, 0x48, 0xf5, 0x8a, 0xfa, 0x04, 0xea, 0xf4, 0xb9, 0x9b, 0x85, 0x36, 1242 0x55, 0x38, 0x7e, 0x87, 0xd5, 0x49, 0x6c, 0x07, 0x7a, 0xe9, 0xa5, 0x1d,
1234 0xc7, 0x71, 0xc9, 0x16, 0xc9, 0xdf, 0x3d, 0x80, 0x27, 0x26, 0xc9, 0x76, 1243 0xa8, 0x50, 0x2f, 0x05, 0x7c, 0xd0, 0x26, 0xde, 0x06, 0x1b, 0x82, 0xed,
1235 0x3c, 0x57, 0x0e, 0xc0, 0x0e, 0x69, 0xb0, 0x3a, 0x33, 0x94, 0x17, 0xfc, 1244 0x94, 0x5d, 0xf7, 0x92, 0x6a, 0xf0, 0x63, 0xba, 0x5f, 0x75, 0x36, 0x13,
1236 0x77, 0x87, 0x12, 0xef, 0x80, 0x8c, 0xcd, 0x5d, 0x8e, 0x7a, 0x0e, 0xf0, 1245 0x33, 0x6b, 0xde, 0x63, 0xed, 0xeb, 0x4d, 0x28, 0xe7, 0x33, 0x71, 0x49,
1237 0x42, 0x3b, 0x05, 0x36, 0xcb, 0x5c, 0x5a, 0x32, 0xdb, 0xee, 0xc5, 0xdd, 1246 0x7c, 0xd1, 0xde, 0x69, 0xd0, 0xf6, 0x69, 0xbe, 0x44, 0x5a, 0x72, 0x65,
1238 0xc5, 0x73, 0x1e, 0xf7, 0xb7, 0xe0, 0x3e, 0x89, 0x7b, 0x08, 0x27, 0xf0, 1247 0xac, 0xd4, 0x8f, 0x36, 0xa0, 0x97, 0xb3, 0xf6, 0x3a, 0x81, 0xf1, 0x0e,
1239 0xea, 0x47, 0xac, 0xce, 0xba, 0x06, 0x63, 0xff, 0x6b, 0xc9, 0x94, 0x12, 1248 0xa2, 0xaf, 0x13, 0x47, 0xd1, 0x8e, 0xb2, 0x24, 0xdd, 0x2d, 0xea, 0x41,
1240 0xb4, 0x39, 0x36, 0x66, 0xbc, 0xb4, 0xab, 0x44, 0x6d, 0x56, 0x32, 0x85, 1249 0xd4, 0xe9, 0xf1, 0xb6, 0x08, 0xed, 0x9a, 0x47, 0x24, 0x5f, 0x26, 0xdf,
1241 0xfa, 0xf0, 0x09, 0xbc, 0x83, 0x32, 0x7e, 0x12, 0xbf, 0x1f, 0xa4, 0x4d, 1250 0xd3, 0x36, 0x88, 0x4b, 0xaa, 0x0d, 0xcf, 0xd5, 0xc3, 0xb0, 0x75, 0x1a,
1242 0x3c, 0x25, 0xe3, 0x73, 0x1c, 0xa7, 0x00, 0x98, 0x4a, 0x92, 0x3d, 0xf9, 1251 0x22, 0x7b, 0x43, 0x6a, 0x76, 0xd1, 0xaf, 0x2a, 0xf1, 0x0f, 0xcb, 0xc8,
1243 0x00, 0xae, 0x69, 0x5c, 0x0f, 0xe3, 0xe2, 0xdc, 0xd8, 0xff, 0xe2, 0x26, 1252 0xec, 0x76, 0xd4, 0x33, 0xf6, 0xbc, 0xf2, 0x61, 0x17, 0xcd, 0x66, 0x25,
1244 0x05, 0x5c, 0xf3, 0x39, 0x4b, 0x3a, 0xae, 0xe0, 0x37, 0x69, 0xb8, 0x42, 1253 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, 0x25, 0xa9, 1275 0x00, 0x73, 0x83, 0x14, 0x12, 0x31, 0xbd, 0xf6, 0xae, 0xff, 0x5b, 0xae,
1267 0x87, 0xd1, 0x2e, 0x99, 0xed, 0x6f, 0x27, 0x8f, 0xb9, 0xca, 0x03, 0x2e, 1276 0xa1, 0x55, 0xe2, 0x64, 0x99, 0xbf, 0x56, 0x07, 0x53, 0xe4, 0xa3, 0x12,
1268 0x3d, 0xed, 0x1b, 0xe5, 0xd4, 0xc0, 0xc6, 0x55, 0xf5, 0xf5, 0xdd, 0xb1, 1277 0x2e, 0xd2, 0xee, 0xa7, 0x35, 0x5c, 0xb7, 0x40, 0x0e, 0x16, 0x44, 0xb5,
1269 0xcf, 0x51, 0x7b, 0x77, 0xed, 0x3d, 0x69, 0xef, 0xb9, 0xe8, 0x00, 0xef, 1278 0x35, 0xca, 0x95, 0xa0, 0x05, 0x95, 0x80, 0x46, 0x0b, 0x9f, 0x82, 0x3d,
1270 0x8e, 0x44, 0x87, 0x78, 0xc7, 0x1a, 0x0e, 0xb1, 0x0f, 0xcd, 0x57, 0x56, 1279 0x95, 0x9f, 0xa5, 0x9d, 0xde, 0x41, 0xdf, 0x28, 0x9e, 0xef, 0xdd, 0x48,
1271 0xce, 0xf4, 0xb8, 0x79, 0x21, 0x5f, 0xfd, 0xa9, 0xdc, 0x32, 0x67, 0xe4, 1280 0x3a, 0x52, 0x86, 0x6f, 0x1c, 0x95, 0xef, 0xd5, 0x74, 0xea, 0x28, 0x3f,
1272 0xef, 0x2e, 0xc8, 0x20, 0xf8, 0x6f, 0xee, 0xa2, 0x00, 0xfe, 0xbd, 0x65, 1281 0xa1, 0x6d, 0x71, 0xd7, 0xdf, 0xea, 0x5a, 0x9f, 0xde, 0x55, 0xfe, 0x96,
1273 0xb9, 0xa5, 0x42, 0xbc, 0xfd, 0x06, 0xf0, 0xb7, 0x35, 0x4a, 0xde, 0x74, 1282 0x95, 0x65, 0x29, 0xea, 0x67, 0xb4, 0x4b, 0xe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xe4, 0x61,
1303 0x1f, 0x9d, 0xc6, 0x07, 0x99, 0xce, 0x28, 0x23, 0x4f, 0xf7, 0xe8, 0xb5, 1312 0xaf, 0x8c, 0x68, 0x98, 0xb6, 0x03, 0x3e, 0xf8, 0xd3, 0x7d, 0xb8, 0xcf,
1304 0x98, 0x28, 0xa8, 0x38, 0x20, 0x47, 0x19, 0xae, 0x63, 0x7b, 0x71, 0xcf, 1313 0x36, 0xca, 0x62, 0x82, 0xf6, 0xe5, 0x93, 0xba, 0x7e, 0xbe, 0x7c, 0xbd,
1305 0xaa, 0x09, 0x5c, 0xd9, 0x63, 0x1f, 0xc0, 0x6f, 0xae, 0xcd, 0x04, 0xea, 1314 0xc6, 0xed, 0xf4, 0x2a, 0xfe, 0xa1, 0x4f, 0x18, 0xc9, 0x03, 0x23, 0x8d,
1306 0xe1, 0x2a, 0x8e, 0xe2, 0x8e, 0x0b, 0xb6, 0x99, 0x91, 0x23, 0x5c, 0xd3, 1315 0x67, 0x4a, 0x94, 0x05, 0xd0, 0x4d, 0xa5, 0x09, 0xdc, 0x1b, 0xb5, 0x4c,
1307 0x84, 0x5d, 0xd3, 0x2f, 0x03, 0x0f, 0x9c, 0x9f, 0xd2, 0xf1, 0x07, 0xe5, 1316 0x28, 0x4a, 0x24, 0x0f, 0xd8, 0x8e, 0x32, 0xa1, 0x5e, 0xee, 0x50, 0xd6,
1308 0xed, 0x00, 0xde, 0x2b, 0xd6, 0xdf, 0x6d, 0x15, 0xc3, 0x83, 0xb8, 0x7a, 1317 0x50, 0xf6, 0x50, 0x96, 0x98, 0xf5, 0x18, 0x7d, 0x90, 0x32, 0xfc, 0x3a,
1309 0xc9, 0xcf, 0x2d, 0x66, 0xbd, 0x34, 0xed, 0x7e, 0x37, 0x6a, 0x78, 0x31, 1318 0xe8, 0x4d, 0xda, 0x25, 0xbe, 0xf1, 0x4d, 0xa6, 0x72, 0xca, 0xc8, 0xd3,
1310 0x8e, 0xb2, 0x08, 0xca, 0xda, 0x45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, 0xab, 0x7d,
1354 0xc7, 0x6f, 0xc6, 0x59, 0x95, 0x85, 0x59, 0xdb, 0xb1, 0xb0, 0xeb, 0x56, 1363 0x5e, 0xfa, 0xf0, 0x8d, 0x3e, 0xe5, 0x27, 0x6d, 0x25, 0x94, 0xcf, 0xf4,
1355 0xdb, 0xb2, 0x9c, 0x03, 0xed, 0xd9, 0x46, 0x63, 0x0b, 0x16, 0x69, 0x7f, 1364 0x78, 0xad, 0xf0, 0x0d, 0xbe, 0xb8, 0xca, 0xee, 0x4a, 0x59, 0xb9, 0x49,
1356 0x52, 0x76, 0xd1, 0xfe, 0x8c, 0x35, 0x4a, 0x33, 0xe7, 0x33, 0x68, 0xcb, 1365 0xff, 0x38, 0x1a, 0xa3, 0x60, 0xe5, 0x64, 0x01, 0xfd, 0x4f, 0x38, 0x43,
1357 0x68, 0xa7, 0xae, 0x9e, 0xdf, 0x6a, 0xff, 0x91, 0x70, 0x12, 0x6e, 0x43, 1366 0xd5, 0xb5, 0xe4, 0x65, 0x24, 0x27, 0x39, 0x9f, 0x7b, 0xe5, 0x8e, 0x07,
1358 0x5b, 0x49, 0x45, 0xd8, 0x02, 0x19, 0xf5, 0xaf, 0xd5, 0x6b, 0xa0, 0x68, 1367 0xc9, 0xa3, 0x25, 0x6d, 0x5f, 0x5f, 0xb3, 0xe7, 0x30, 0xf0, 0x47, 0xf8,
1359 0xbb, 0xee, 0xf8, 0x76, 0x83, 0x89, 0x31, 0x27, 0xd1, 0x3f, 0xc7, 0x24, 1368 0x17, 0x36, 0xc3, 0x64, 0x80, 0xce, 0xcd, 0xca, 0xa8, 0x5d, 0xb7, 0xd1,
1360 0xff, 0xf1, 0x4e, 0x3b, 0xbf, 0x9e, 0x2c, 0xab, 0xd5, 0x3d, 0x97, 0x2d, 1369 0xa5, 0xf5, 0xe7, 0x35, 0x0c, 0xdd, 0xc8, 0x58, 0xae, 0xb2, 0x30, 0x6b,
1361 0xe3, 0x6f, 0xe7, 0x8a, 0x35, 0x0a, 0xf1, 0x17, 0xd2, 0x45, 0x2d, 0x0e, 1370 0x3b, 0x16, 0x76, 0xdd, 0x4a, 0x5b, 0x96, 0x73, 0xa0, 0x3d, 0xdb, 0x68,
1362 0x49, 0x13, 0xa4, 0x85, 0x90, 0x16, 0xb7, 0x5a, 0x7d, 0x13, 0xd2, 0xde, 1371 0x6c, 0xc1, 0x32, 0xed, 0x4f, 0xca, 0x2e, 0xda, 0x9f, 0x57, 0x37, 0x4a,
1363 0xa5, 0xa0, 0xbd, 0xfb, 0x80, 0x27, 0xca, 0x70, 0xc6, 0xed, 0x36, 0xe3, 1372 0x33, 0xe7, 0x93, 0xb5, 0x65, 0xb4, 0x53, 0x57, 0xce, 0x6f, 0xa5, 0x5f,
1364 0xf9, 0x08, 0x9e, 0x43, 0x3e, 0xb9, 0x98, 0x0c, 0xa7, 0xfc, 0x66, 0x9b, 1373 0x49, 0x38, 0x09, 0xb7, 0xa1, 0xad, 0x94, 0x22, 0x6c, 0xa1, 0x0c, 0x07,
1365 0x8c, 0x95, 0xfb, 0xa1, 0x9f, 0xcb, 0x36, 0x9c, 0x37, 0xe5, 0xff, 0x57, 1374 0xd7, 0xe9, 0x35, 0x50, 0xb4, 0x5d, 0xf7, 0x34, 0x34, 0x9a, 0x38, 0xf6,
1366 0xe9, 0x77, 0x35, 0x1a, 0x3b, 0xfd, 0x43, 0x8d, 0x94, 0xaf, 0x9b, 0xe4, 1375 0x5e, 0xf4, 0xcf, 0x31, 0xc9, 0x7f, 0xbc, 0xd3, 0xce, 0x5f, 0x4b, 0x96,
1367 0x60, 0x4d, 0xd9, 0xc5, 0xe4, 0x77, 0xed, 0x9c, 0x2f, 0xff, 0x7f, 0x30, 1376 0xd5, 0xeb, 0x9e, 0x2b, 0x97, 0xf0, 0x37, 0xb4, 0x6c, 0x8d, 0x22, 0xfc,
1368 0xe7, 0xc4, 0xaa, 0x39, 0xbb, 0x76, 0xce, 0x15, 0xbc, 0x6f, 0xc3, 0xfb, 1377 0x45, 0x74, 0x51, 0x8f, 0x43, 0xd2, 0x04, 0x69, 0x21, 0xa2, 0xc5, 0x9d,
1369 0x16, 0xea, 0x82, 0x64, 0x55, 0xde, 0x58, 0x5c, 0xe8, 0x79, 0xd5, 0xca, 1378 0x56, 0xdf, 0x44, 0xb4, 0xb7, 0x15, 0xb4, 0x77, 0x1f, 0xf0, 0x44, 0x19,
1370 0x89, 0x50, 0x46, 0x70, 0x5e, 0x1f, 0xb1, 0x73, 0x78, 0xa0, 0x66, 0x5e, 1379 0xce, 0x78, 0xde, 0x16, 0x3c, 0x1f, 0xc7, 0x73, 0xc4, 0x27, 0x91, 0x0c,
1371 0x1f, 0x79, 0x13, 0xf3, 0xea, 0x5c, 0x31, 0xaf, 0x5d, 0x17, 0x9d, 0x57, 1380 0xa7, 0x4d, 0xb4, 0x52, 0x8e, 0x53, 0x86, 0xc7, 0x61, 0xf7, 0x50, 0xd6,
1372 0x3d, 0x1e, 0x27, 0x2f, 0x87, 0xf3, 0x8b, 0xc9, 0x8d, 0x05, 0xce, 0x71, 1381 0x6f, 0xb7, 0xfc, 0x94, 0xb3, 0xbc, 0x44, 0x5d, 0xf0, 0xfb, 0xe8, 0xe7,
1373 0x27, 0xe6, 0x48, 0x18, 0xc2, 0x39, 0x0e, 0xd9, 0x39, 0x8a, 0xea, 0xda, 1382 0x86, 0x46, 0x63, 0xa7, 0x17, 0x1b, 0x29, 0x5f, 0x37, 0xcb, 0x91, 0xba,
1374 0xf1, 0x73, 0xf8, 0x5d, 0x3b, 0x3f, 0xea, 0xfe, 0x1f, 0x83, 0xa6, 0x9b, 1383 0xb2, 0xcb, 0xc9, 0xef, 0xfa, 0x39, 0x6f, 0xff, 0x7f, 0x30, 0xe7, 0xe4,
1375 0x24, 0xd3, 0xdf, 0x64, 0xe5, 0xff, 0x97, 0xe5, 0xd6, 0x22, 0xd7, 0x3a, 1384 0x8a, 0x39, 0x7b, 0x76, 0xce, 0x55, 0xbc, 0x6f, 0xc5, 0xfb, 0x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03, 0xea, 0x36, 0xd8, 0x3a, 0xb7, 0x9d, 1392 0x7e, 0x75, 0xa8, 0xfc, 0x72, 0x23, 0xf7, 0x11, 0xf6, 0x06, 0x56, 0x8f,
1384 0xbc, 0x41, 0xed, 0x83, 0x6d, 0xb3, 0x0f, 0x76, 0xce, 0xbe, 0x0a, 0x6d, 1393 0x41, 0x5f, 0xec, 0x83, 0xcd, 0x37, 0x54, 0x52, 0x7d, 0x31, 0x09, 0xc3,
1385 0xcf, 0x9b, 0x41, 0x7b, 0x9d, 0x35, 0xb4, 0x46, 0x1b, 0x87, 0xf3, 0x23, 1394 0xdb, 0x82, 0x66, 0x8c, 0xbd, 0x49, 0xfb, 0xaa, 0xab, 0x63, 0xf8, 0xcf,
1386 0xee, 0x8f, 0x71, 0x0d, 0xfc, 0xa4, 0x7a, 0x45, 0xaf, 0x4b, 0xdb, 0x8a, 1395 0x36, 0x8a, 0x4f, 0x7b, 0x83, 0xfa, 0x1c, 0xfa, 0xee, 0x24, 0x6d, 0xb0,
1387 0xb2, 0xd7, 0x92, 0x55, 0xa1, 0x7e, 0xda, 0x60, 0xe3, 0x46, 0x94, 0xb7, 1396 0x1c, 0xec, 0xe4, 0x6c, 0x32, 0xa6, 0x6d, 0x31, 0xea, 0xc4, 0x74, 0x32,
1388 0xaf, 0x45, 0x5b, 0xa4, 0x11, 0x17, 0x78, 0x26, 0xfe, 0x48, 0x5b, 0xb5, 1397 0x2b, 0x15, 0xc9, 0x9f, 0xcc, 0x26, 0xe1, 0xd8, 0x62, 0x0c, 0xd8, 0x6a,
1389 0xf3, 0xdf, 0xd4, 0x24, 0x5e, 0x67, 0x93, 0x34, 0xdf, 0x0b, 0xf9, 0x5a, 1398 0xb0, 0x21, 0x6f, 0x85, 0xac, 0xb9, 0xb5, 0x7a, 0x50, 0xdd, 0x02, 0x7b,
1390 0x4b, 0x53, 0xbc, 0xbb, 0x56, 0xd7, 0x90, 0xb6, 0x28, 0x83, 0x43, 0x7a, 1399 0xe7, 0x96, 0xd3, 0xef, 0x53, 0xb7, 0xc1, 0xd6, 0xb9, 0xed, 0xf4, 0x8d,
1391 0xd8, 0xfa, 0x1a, 0xf2, 0xf7, 0xa2, 0xf4, 0x74, 0x4f, 0x64, 0x28, 0x08, 1400 0xea, 0x10, 0x6c, 0x9b, 0x43, 0xb0, 0x73, 0x0e, 0x55, 0x69, 0x7b, 0xde,
1392 0xc6, 0x07, 0x64, 0x23, 0xe3, 0x01, 0x99, 0x4a, 0x35, 0x26, 0xa0, 0xbc, 1401 0x0c, 0xba, 0x6b, 0x87, 0x1e, 0xe2, 0x5c, 0xb8, 0x26, 0xb4, 0x71, 0x38,
1393 0xda, 0x98, 0x00, 0xfd, 0xac, 0x47, 0x80, 0xdf, 0x19, 0x5c, 0x22, 0x63, 1402 0x3f, 0xe2, 0xfe, 0x0b, 0x5c, 0x83, 0x20, 0xa5, 0x76, 0x34, 0x71, 0x5d,
1394 0x8c, 0x3b, 0x54, 0x42, 0xbb, 0xfc, 0x1b, 0xd6, 0x2e, 0x0f, 0xe1, 0x48, 1403 0x5a, 0x97, 0x95, 0xbd, 0x96, 0xac, 0x8a, 0xf4, 0xd3, 0x06, 0x1b, 0x4f,
1395 0x02, 0x0e, 0x23, 0x9f, 0xd7, 0xea, 0xb9, 0x95, 0xfa, 0x3b, 0xb7, 0x6c, 1404 0x32, 0x7e, 0xe5, 0xe5, 0x69, 0x8b, 0x34, 0xe2, 0x01, 0xcf, 0xc4, 0x1f,
1396 0xd3, 0x26, 0xe5, 0xc6, 0x22, 0xe7, 0x4d, 0x19, 0x4c, 0xdc, 0xd4, 0xca, 1405 0x69, 0xab, 0x7e, 0xfe, 0x57, 0x36, 0x89, 0x9f, 0xc3, 0xf8, 0xf7, 0x42,
1397 0xe0, 0x84, 0xb5, 0xa3, 0x50, 0x47, 0xcb, 0xcf, 0xb5, 0xb2, 0x93, 0x72, 1406 0xbe, 0xd6, 0xd3, 0x14, 0xef, 0x5e, 0x1d, 0x7f, 0x50, 0x06, 0x47, 0xf4,
1398 0x8f, 0xf1, 0xf9, 0x07, 0x7c, 0xd2, 0xfa, 0x7b, 0x24, 0xbd, 0x1c, 0x9f, 1407 0xb0, 0xf3, 0x35, 0xe4, 0xef, 0x65, 0xe9, 0xe9, 0x9e, 0x58, 0x26, 0x0c,
1399 0x17, 0xd0, 0x9b, 0xf8, 0x91, 0x21, 0xbd, 0xdf, 0xe6, 0xce, 0xca, 0x6e, 1408 0x47, 0xfb, 0x64, 0x13, 0xe3, 0x01, 0xb9, 0x6a, 0x2d, 0x26, 0xa0, 0xfc,
1400 0x19, 0x8e, 0x33, 0xd6, 0xc9, 0x78, 0x9e, 0x97, 0x9b, 0x05, 0x0f, 0x4c, 1409 0xfa, 0x98, 0x00, 0xfd, 0xac, 0x4f, 0x03, 0xbf, 0xd3, 0xb8, 0x44, 0x46,
1401 0x16, 0x15, 0x2c, 0xf8, 0x46, 0x19, 0x73, 0x03, 0xd9, 0xe5, 0x3b, 0x3a, 1410 0x18, 0x77, 0xa8, 0x46, 0x76, 0xf9, 0x57, 0xac, 0x5d, 0x1e, 0xc1, 0x91,
1402 0x76, 0x6c, 0x74, 0xed, 0x4c, 0x93, 0xb1, 0x5d, 0x1d, 0x1d, 0xff, 0x5d, 1411 0x02, 0x1c, 0x46, 0x3e, 0xaf, 0xd6, 0x73, 0xcb, 0xf5, 0x77, 0x61, 0xc9,
1403 0x04, 0xf5, 0x2d, 0x6a, 0xfb, 0x56, 0x69, 0xfd, 0xbb, 0xa0, 0xeb, 0x7c, 1412 0xa6, 0x4d, 0xc9, 0x81, 0xb2, 0xb6, 0x13, 0x21, 0x83, 0x89, 0x9b, 0x7a,
1404 0xae, 0x29, 0x8c, 0x63, 0x2e, 0xba, 0x11, 0x5b, 0xaf, 0xb6, 0xfc, 0x8b, 1413 0x19, 0x9c, 0xb4, 0x76, 0x14, 0xea, 0x68, 0xf9, 0xb9, 0x5a, 0x76, 0x52,
1405 0x36, 0x3e, 0x9d, 0x84, 0xec, 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x8b, 0xec, 0x2f, 1443 0x51, 0x9d, 0xd7, 0xa2, 0xcf, 0x66, 0xbb, 0x9f, 0x91, 0xd4, 0x7b, 0xff,
1435 0x44, 0xe5, 0xe3, 0x68, 0xff, 0xb1, 0x82, 0x0b, 0x7f, 0xfc, 0x4c, 0x8c, 1444 0xd9, 0x84, 0xa1, 0xd5, 0x5b, 0xf4, 0xdc, 0x39, 0xef, 0x0b, 0x6f, 0x80,
1436 0x76, 0xe1, 0xbe, 0x02, 0xf7, 0x27, 0x59, 0x37, 0xbe, 0x6a, 0x7f, 0x36, 1445 0x56, 0xcd, 0xda, 0x5c, 0xac, 0xf9, 0xdb, 0x8c, 0x45, 0xa5, 0x4c, 0x6c,
1437 0x22, 0x5d, 0x3d, 0x79, 0x78, 0x2a, 0x12, 0xdd, 0x03, 0x38, 0x9a, 0x86, 1446 0x9b, 0x71, 0xd2, 0xcb, 0xd9, 0x8e, 0x2f, 0xd5, 0xf9, 0x15, 0x1b, 0xa4,
1438 0x86, 0xe4, 0x07, 0x03, 0x1b, 0x51, 0xf6, 0xb2, 0x1d, 0x6f, 0xd4, 0x31, 1447 0xc0, 0xbc, 0x87, 0xea, 0x46, 0xc6, 0xa2, 0x47, 0xdc, 0x4c, 0x9f, 0x64,
1439 0xf1, 0xde, 0x41, 0x79, 0x77, 0x65, 0x48, 0xae, 0xaf, 0x98, 0x3d, 0xd5, 1448 0x2b, 0xed, 0xa9, 0x62, 0x89, 0x7e, 0xd1, 0xab, 0x36, 0x37, 0x02, 0xcf,
1440 0xea, 0x9e, 0x69, 0xca, 0x5d, 0x80, 0xfe, 0x49, 0xbb, 0x41, 0x70, 0xce, 1449 0x95, 0x16, 0x79, 0xb4, 0x44, 0xda, 0x3a, 0x62, 0x70, 0xb1, 0x26, 0xad,
1441 0xc3, 0xaa, 0x1f, 0x89, 0x4a, 0xac, 0x27, 0x95, 0x58, 0x10, 0xf3, 0x7c, 1450 0x73, 0xad, 0xd9, 0x4f, 0xbd, 0x0e, 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0x71, 0x73, 0xbd, 0xd0, 0x15, 0x28, 0x6b, 0xa5, 0xbf, 1487 0x67, 0xc5, 0x03, 0x9e, 0x39, 0xef, 0x44, 0x6a, 0xcc, 0xce, 0x39, 0x5f,
1479 0x9d, 0xcc, 0x44, 0x52, 0xc9, 0x49, 0x61, 0x3e, 0x14, 0x73, 0x15, 0x98, 1488 0x21, 0x7e, 0x5f, 0x6b, 0xbf, 0xf3, 0xf9, 0x65, 0xfe, 0x17, 0x61, 0xaa,
1480 0x23, 0x44, 0xd9, 0x10, 0x85, 0xcc, 0xe3, 0x1a, 0x9a, 0xf1, 0x26, 0xcb, 1489 0xc1, 0x42, 0xd8, 0x52, 0x16, 0x37, 0x61, 0xf8, 0xf7, 0x01, 0xc7, 0xdc,
1481 0xd5, 0xba, 0x07, 0x84, 0x7b, 0x86, 0xa9, 0xc4, 0x3e, 0x6d, 0x9f, 0x88, 1490 0x0f, 0x1f, 0x46, 0x26, 0x30, 0x6e, 0x61, 0x8b, 0x22, 0x1e, 0xe2, 0xa9,
1482 0x8c, 0x17, 0x58, 0x77, 0x3b, 0xac, 0x13, 0xaf, 0xa6, 0xbe, 0xce, 0xe1, 1491 0x3b, 0x30, 0xf6, 0xc7, 0x31, 0xf6, 0xed, 0x15, 0x8e, 0x07, 0xd9, 0x83,
1483 0x02, 0x9f, 0x87, 0x71, 0xac, 0x58, 0x2c, 0x53, 0x90, 0x97, 0x23, 0x03, 1492 0xb9, 0x4f, 0x54, 0x23, 0x78, 0xd7, 0x1a, 0x3b, 0x5a, 0xf3, 0x6e, 0x6b,
1484 0xf2, 0x32, 0xed, 0xce, 0x61, 0xd0, 0xb6, 0xeb, 0xf1, 0xbd, 0x29, 0xcf, 1493 0x33, 0x46, 0xcf, 0x1a, 0x91, 0x6d, 0x0a, 0xbe, 0x63, 0xae, 0xba, 0xb0,
1485 0xf8, 0xb2, 0x94, 0x19, 0xec, 0xa3, 0x9d, 0x9d, 0x53, 0x9a, 0x27, 0x44, 1494 0xd9, 0x95, 0x9f, 0x81, 0x1c, 0x0f, 0xe5, 0x51, 0xc8, 0xc7, 0x05, 0x4d,
1486 0xa1, 0x6d, 0x2c, 0x5b, 0x96, 0x91, 0x6c, 0xc1, 0xc6, 0x7a, 0x46, 0x39, 1495 0x37, 0xb9, 0xed, 0xfc, 0x3f, 0x26, 0x4f, 0xad, 0x63, 0xbc, 0x7a, 0xc0,
1487 0xe7, 0x0d, 0x35, 0x73, 0x6f, 0x95, 0x28, 0x60, 0x1a, 0x89, 0x24, 0x9d, 1496 0xa7, 0x2d, 0xbc, 0x18, 0x2e, 0xf8, 0x94, 0xf7, 0x1b, 0x64, 0xda, 0x2b,
1488 0x06, 0xef, 0x23, 0x2d, 0x46, 0xe7, 0x43, 0xee, 0xb7, 0xdd, 0xdf, 0xce, 1497 0x74, 0x43, 0xf7, 0xa0, 0x6c, 0x23, 0xfd, 0xf7, 0x54, 0x2e, 0x96, 0x4e,
1489 0x3d, 0x53, 0x05, 0x1f, 0x5a, 0xb5, 0xdf, 0x7e, 0x8d, 0x1a, 0xfa, 0xf3, 1498 0x8d, 0x0b, 0x73, 0xbe, 0x98, 0x13, 0xc1, 0xbc, 0x26, 0xca, 0x06, 0x17,
1490 0x04, 0xf4, 0xa0, 0x95, 0x95, 0xb1, 0x91, 0xae, 0x65, 0xfa, 0xe6, 0xf8, 1499 0x32, 0x94, 0x6b, 0x68, 0xc6, 0x1b, 0xaf, 0xd4, 0xea, 0x1e, 0x16, 0xee,
1491 0xd2, 0x1e, 0xf1, 0x92, 0x23, 0xc3, 0x65, 0x51, 0x91, 0x21, 0x37, 0x36, 1500 0x4d, 0xa6, 0x93, 0x87, 0xb4, 0xbd, 0x23, 0x32, 0x5a, 0x62, 0xdd, 0xdd,
1492 0x5c, 0x5e, 0x49, 0xf3, 0x4f, 0x55, 0xfe, 0xbd, 0xb5, 0x05, 0x6b, 0x63, 1501 0xb0, 0x76, 0xfc, 0xba, 0xfa, 0x3a, 0x57, 0x0d, 0x7c, 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6, 0x7d, 0x50, 0xfa, 0x27, 0x8c, 0xba, 0x7a, 0xcc, 0xc1,
1515 0x84, 0x5c, 0xda, 0xed, 0xc1, 0xbd, 0x76, 0xbe, 0xdf, 0xc2, 0x7c, 0x7f, 1524 0x93, 0x22, 0xf7, 0x3b, 0x13, 0x9b, 0x70, 0x57, 0x1d, 0xc4, 0x49, 0xde,
1516 0xad, 0x59, 0x9a, 0x59, 0x5e, 0x5b, 0xb7, 0x51, 0xf6, 0xb8, 0xdb, 0xdd, 1525 0x67, 0xfc, 0x78, 0x93, 0x2d, 0x8f, 0xb1, 0x3c, 0xed, 0x42, 0x96, 0x98,
1517 0xd8, 0x8a, 0xba, 0xe7, 0x51, 0x97, 0x65, 0x9e, 0xcb, 0x1c, 0x9d, 0xd9, 1526 0xf2, 0x98, 0x2d, 0x07, 0x4c, 0x41, 0x31, 0x05, 0x6e, 0xb3, 0xe5, 0x7c,
1518 0x32, 0xe9, 0xcc, 0xc0, 0xda, 0xd5, 0x13, 0x04, 0xd7, 0xf9, 0x1c, 0x37, 1527 0x56, 0xba, 0xdc, 0x3c, 0x1b, 0x1e, 0x1a, 0x11, 0xc6, 0x89, 0x72, 0xd7,
1519 0x08, 0xae, 0xf7, 0xfb, 0xdc, 0x67, 0xe5, 0xf9, 0xc0, 0xd8, 0x54, 0x21, 1528 0x37, 0xc8, 0x4e, 0xac, 0x0f, 0x7d, 0x50, 0x47, 0x9a, 0x01, 0xc7, 0xc5,
1520 0xed, 0x3c, 0x67, 0xe5, 0x75, 0x10, 0xbc, 0xec, 0xf7, 0xca, 0xef, 0x54, 1529 0xe0, 0xc7, 0x61, 0xab, 0x87, 0xf2, 0x9d, 0xc0, 0xd0, 0xff, 0x8c, 0x74,
1521 0x52, 0x8f, 0xd3, 0xe7, 0x3e, 0x83, 0xe7, 0x33, 0xbe, 0xc9, 0x2b, 0xfa, 1530 0x65, 0x95, 0xc3, 0x5c, 0x83, 0x50, 0x86, 0x82, 0x5d, 0xc9, 0xbd, 0xf8,
1522 0x13, 0xb4, 0x8b, 0xab, 0x7e, 0xd0, 0xb0, 0x27, 0x5f, 0xd4, 0x3e, 0x3a, 1531 0x3d, 0xda, 0x9b, 0x92, 0x99, 0x7e, 0xd0, 0x63, 0x2f, 0x79, 0x63, 0x27,
1523 0xf1, 0x67, 0x62, 0xfc, 0x55, 0x18, 0x30, 0x61, 0x2f, 0xb3, 0xc9, 0x65, 1532 0x6c, 0x28, 0xfc, 0xee, 0x6a, 0x91, 0x45, 0xaf, 0xe0, 0xad, 0x83, 0xff,
1524 0x7e, 0xa0, 0xa6, 0xdf, 0xda, 0x77, 0x0a, 0xef, 0x58, 0x16, 0x04, 0x97, 1533 0x37, 0x88, 0x59, 0xcd, 0x96, 0x7c, 0xef, 0x36, 0x08, 0xb9, 0xac, 0xd7,
1525 0x0c, 0xfc, 0x31, 0xe6, 0x94, 0x2a, 0x71, 0xef, 0xee, 0x03, 0x9a, 0xff, 1534 0x85, 0x7b, 0xfd, 0x7c, 0xbf, 0x8e, 0xf9, 0x9e, 0x6b, 0x96, 0x66, 0x96,
1526 0x04, 0x7e, 0x3d, 0xe9, 0x24, 0xea, 0x2a, 0xe5, 0x1d, 0xee, 0x52, 0xa9, 1535 0xd7, 0xd7, 0x6d, 0x94, 0xfd, 0xde, 0x6e, 0x2f, 0xbe, 0xac, 0xee, 0x25,
1527 0x9c, 0xc8, 0x5b, 0xb0, 0xfe, 0x5c, 0x63, 0x30, 0x48, 0x1b, 0x60, 0xdf, 1536 0xd4, 0x65, 0x99, 0xef, 0x31, 0x17, 0x68, 0xa6, 0x42, 0x3a, 0x33, 0xb0,
1528 0xb6, 0xbd, 0xd9, 0xc4, 0x92, 0xe8, 0x4b, 0xa7, 0x37, 0xc1, 0xd7, 0xd5, 1537 0x76, 0x74, 0x85, 0xe1, 0xf5, 0x01, 0xc7, 0x0d, 0xc3, 0x1b, 0x82, 0x1e,
1529 0xf6, 0x4c, 0x14, 0x7c, 0x3d, 0xd1, 0x16, 0x04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f, 0xe4, 0x1c, 0xe5, 0x6a, 0xfc, 0xda,
1566 0x4b, 0xff, 0x24, 0x66, 0xf3, 0x98, 0x15, 0x9e, 0x37, 0x58, 0xfe, 0x72, 1575 0x6c, 0x45, 0x9c, 0xa2, 0x2f, 0xed, 0x4a, 0xfb, 0x43, 0xd4, 0x37, 0x8d,
1567 0x25, 0xaf, 0xfd, 0xb7, 0x2f, 0xad, 0x37, 0x7c, 0x1a, 0xb5, 0xf9, 0x6b, 1576 0xde, 0x68, 0x9f, 0x27, 0xa3, 0x5a, 0xd7, 0xb8, 0xd7, 0x76, 0x56, 0xe6,
1568 0xfc, 0xdd, 0xb1, 0xde, 0xee, 0xef, 0xe7, 0xd2, 0xf2, 0xfb, 0xeb, 0x69, 1577 0x61, 0xbd, 0x8a, 0x93, 0xf3, 0x09, 0xfb, 0x5a, 0x76, 0xd5, 0x3d, 0x90,
1569 0x97, 0x34, 0x78, 0x43, 0xab, 0xca, 0x62, 0x28, 0xbb, 0x7d, 0xbd, 0x95, 1578 0xff, 0x0b, 0x69, 0xd7, 0xda, 0x12, 0x93, 0x01, 0xfd, 0xa0, 0x84, 0xce,
1570 0x0b, 0x28, 0xbb, 0x07, 0x7e, 0x1a, 0xf3, 0x34, 0xf8, 0x8e, 0x32, 0xb8, 1579 0x15, 0xa8, 0xc1, 0xf4, 0x12, 0x60, 0x82, 0x3c, 0x3e, 0xd9, 0xe3, 0x0d,
1571 0x16, 0x27, 0x7d, 0x60, 0x45, 0xf2, 0x3c, 0xe5, 0x22, 0x6d, 0x4a, 0xcc, 1580 0xcb, 0x56, 0xed, 0xeb, 0x59, 0x5c, 0x63, 0x6e, 0xf1, 0xba, 0xb9, 0x41,
1572 0x51, 0x7d, 0x27, 0x8c, 0xa3, 0xe3, 0x77, 0x3d, 0xdb, 0x9f, 0xf8, 0x26, 1581 0xff, 0xa9, 0x68, 0x6e, 0x90, 0x89, 0xa8, 0x37, 0x29, 0x7f, 0x64, 0x71,
1573 0xae, 0xe5,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34, 0xf8, 0xfd, 0x3e, 0xa3, 0x43, 0x94, 0x5f, 0x8e, 0xab,
1588 0x3b, 0xae, 0xf7, 0x89, 0x94, 0x22, 0x2c, 0xad, 0xab, 0x70, 0x1b, 0xd2, 1597 0xae, 0xd6, 0x7e, 0x6b, 0x5c, 0xe7, 0x37, 0x2d, 0xd5, 0x1d, 0xb3, 0x63,
1589 0x9d, 0xa1, 0xb9, 0xa7, 0x34, 0xcd, 0xb5, 0x58, 0x9a, 0x43, 0x5d, 0x97, 1598 0x93, 0x6e, 0xcd, 0x7e, 0x42, 0x6d, 0x7c, 0x71, 0xd4, 0x2e, 0x01, 0x95,
1590 0xfb, 0xde, 0xa3, 0x2d, 0x55, 0x9a, 0xdb, 0x60, 0x69, 0xee, 0x99, 0xf5, 1599 0x35, 0xca, 0x44, 0x1f, 0x69, 0x94, 0x73, 0xd7, 0x36, 0xd4, 0xb5, 0xb4,
1591 0x66, 0x4f, 0xfc, 0xfd, 0x2d, 0x66, 0x4f, 0xea, 0x2f, 0x57, 0x3d, 0x6f, 1600 0x23, 0x0c, 0x7d, 0xd2, 0x76, 0x72, 0xaf, 0xcd, 0x97, 0x1a, 0x8d, 0xcf,
1592 0xa2, 0xcd, 0x08, 0x5f, 0x2c, 0x7c, 0xae, 0x85, 0xf5, 0x0c, 0x60, 0xad, 1601 0x92, 0x90, 0x2d, 0x0d, 0x3a, 0x2f, 0x01, 0x65, 0x95, 0x48, 0x97, 0xb9,
1593 0x95, 0x35, 0x4d, 0x36, 0xee, 0xc6, 0xfd, 0x73, 0xfa, 0x7d, 0x51, 0x79, 1602 0x32, 0xd3, 0xfb, 0x7f, 0xc2, 0xec, 0x41, 0xd6, 0x5d, 0x33, 0x0f, 0x20,
1594 0x14, 0x76, 0x50, 0xbe, 0xfc, 0x8f, 0xc1, 0x02, 0x7c, 0xbf, 0xa9, 0x65, 1603 0x39, 0x2d, 0x1a, 0x4f, 0x5f, 0xab, 0xe1, 0xc9, 0xce, 0x2d, 0xb1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 0x36, 0x2f, 0x37, 0x53, 0x30, 0xb4, 0x39, 0x41, 0xda, 0x84, 0x3f, 0xb5, 1633 0x3a, 0xb8, 0xa6, 0x7b, 0xef, 0xc6, 0x58, 0xf3, 0xa0, 0x99, 0x3e, 0xf9,
1625 0xd8, 0xff, 0xb7, 0x01, 0xed, 0xfb, 0xa4, 0x22, 0xed, 0xff, 0x4d, 0x30, 1634 0x9d, 0x6a, 0xfa, 0xf3, 0xa2, 0xcf, 0x16, 0xf5, 0xc2, 0x86, 0x9b, 0xbf,
1626 0x17, 0x65, 0x5f, 0x84, 0x7b, 0xff, 0xa7, 0x33, 0x1a, 0x57, 0x77, 0xca, 1635 0xf3, 0xbd, 0x7e, 0x00, 0x5b, 0x2f, 0x94, 0x87, 0x83, 0x7e, 0xd0, 0x50,
1627 0x81, 0x22, 0x6d, 0xe1, 0x98, 0xce, 0xe7, 0x18, 0xf7, 0x69, 0xa7, 0xc5, 1636 0x37, 0xec, 0x3d, 0x5f, 0xfb, 0xa5, 0x8f, 0x6b, 0xda, 0x22, 0x8d, 0x31,
1628 0x80, 0xc7, 0x0f, 0x01, 0x7f, 0x2d, 0xb0, 0xb9, 0x47, 0x50, 0x27, 0x22, 1637 0xdf, 0x86, 0x76, 0x81, 0x13, 0xcf, 0xf5, 0xfe, 0xb1, 0x89, 0xd3, 0x04,
1629 0x63, 0x60, 0xf1, 0xd9, 0x02, 0xf9, 0x93, 0xf7, 0x28, 0xea, 0xbb, 0x32, 1638 0x9d, 0xde, 0x97, 0xc0, 0xb7, 0x43, 0xfe, 0x0e, 0xf8, 0x28, 0xa4, 0x21,
1630 0x5f, 0xb8, 0x59, 0xe7, 0xdb, 0x9d, 0x46, 0xdb, 0x27, 0x71, 0xcd, 0x16, 1639 0xc6, 0xd3, 0xb6, 0xdb, 0x7c, 0xc7, 0x36, 0x99, 0x76, 0x19, 0x77, 0x4c,
1631 0x26, 0xd0, 0x66, 0xaf, 0xae, 0x3f, 0x5b, 0x62, 0x8e, 0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xca, 0x5f, 0x6c, 0x08, 0x63, 0xd5, 0x97, 1662 0x85, 0xd7, 0x85, 0xb7, 0xc7, 0xf3, 0xd5, 0x5a, 0xf0, 0xde, 0x6c, 0x63,
1654 0x62, 0x1e, 0x07, 0x8b, 0x77, 0xc9, 0xa1, 0xa2, 0xa3, 0xe3, 0x8e, 0x0b, 1663 0x89, 0x8c, 0x0f, 0xae, 0x03, 0xde, 0x5a, 0x50, 0x9e, 0x97, 0x89, 0x93,
1655 0x8a, 0x32, 0xc1, 0x05, 0x4f, 0x82, 0xf7, 0x8a, 0xe0, 0xcd, 0x22, 0x78, 1664 0xb7, 0x6e, 0xe1, 0xde, 0x78, 0x83, 0xef, 0xd8, 0x1c, 0x56, 0x9e, 0x39,
1656 0xb1, 0x08, 0xbe, 0x84, 0xfd, 0x7f, 0x06, 0xf6, 0xff, 0x93, 0x58, 0x9b, 1665 0x9a, 0x40, 0x1d, 0xbe, 0x1f, 0x41, 0x9b, 0x74, 0x21, 0x17, 0xdb, 0x02,
1657 0xd3, 0x2b, 0x78, 0x39, 0xad, 0x79, 0x39, 0x5f, 0xa4, 0xaf, 0xd6, 0x7f, 1666 0x9f, 0x88, 0xe3, 0x86, 0xb1, 0x8e, 0x3d, 0xcd, 0x3a, 0x27, 0x55, 0xce,
1658 0x11, 0x7e, 0x8d, 0xca, 0x70, 0x21, 0x05, 0x55, 0xe2, 0x44, 0xb3, 0xfd, 1667 0x52, 0x9f, 0x47, 0x6d, 0x27, 0x74, 0xce, 0x07, 0xfc, 0xf6, 0xc2, 0x60,
1659 0x9f, 0x24, 0xbf, 0xca, 0x83, 0xfe, 0x0d, 0x68, 0x73, 0x18, 0x34, 0x9e, 1668 0x8c, 0xf2, 0xab, 0x5b, 0x06, 0xa8, 0x4f, 0xce, 0x8e, 0x68, 0xda, 0xef,
1660 0xa2, 0x1d, 0x48, 0xfb, 0x27, 0x07, 0xde, 0x3c, 0x4c, 0x5f, 0x4d, 0x5d, 1669 0xdc, 0xc5, 0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1691 0x69, 0x07, 0xd7, 0x4a, 0x38, 0x48, 0x2f, 0xec, 0x87, 0xf4, 0x02, 0x58,
1683 0xe7, 0x0f, 0xdb, 0x7e, 0x30, 0x9c, 0xff, 0xe9, 0x8a, 0xc9, 0x7f, 0x3e, 1692 0xaa, 0x9f, 0x59, 0xa2, 0x97, 0x04, 0xfa, 0x39, 0x5a, 0x36, 0x39, 0x22,
1684 0xbd, 0x46, 0xcf, 0x4d, 0x59, 0xde, 0xf0, 0xb4, 0x5f, 0xcc, 0x98, 0xf6, 1693 0xf0, 0xbb, 0xac, 0x0e, 0xf1, 0xb0, 0xe6, 0xc6, 0x47, 0x5c, 0x9b, 0x46,
1685 0x19, 0xe8, 0xb6, 0x69, 0x3f, 0x69, 0xcf, 0x43, 0x19, 0x7b, 0xe9, 0x1b, 1694 0x02, 0x4b, 0x23, 0xb5, 0x7c, 0xfa, 0x15, 0xb4, 0x01, 0xdc, 0x33, 0x37,
1686 0x3e, 0x79, 0xe7, 0xe3, 0x3a, 0x0f, 0xe5, 0x71, 0xda, 0x4d, 0xc5, 0x36, 1695 0x76, 0xb7, 0xa6, 0x8d, 0xfb, 0x83, 0x12, 0xea, 0x0e, 0x83, 0x36, 0x22,
1687 0x19, 0x99, 0xae, 0x85, 0x9b, 0xf0, 0xe6, 0xb4, 0x1c, 0xcd, 0x62, 0x7e, 1696 0x1c, 0xbc, 0xc7, 0xe2, 0x60, 0xe5, 0x5a, 0xde, 0x66, 0x71, 0x30, 0x6c,
1688 0xe3, 0x7e, 0x2f, 0xe4, 0x9b, 0xa6, 0x25, 0x94, 0xa7, 0x72, 0xc3, 0x91, 1697 0x71, 0xa0, 0xf9, 0xa5, 0xc0, 0x35, 0x53, 0x1a, 0x07, 0x4d, 0x1a, 0x07,
1689 0x26, 0x51, 0x0f, 0x7c, 0x08, 0x73, 0x8e, 0xca, 0x66, 0xaf, 0xdb, 0xdd, 1698 0xa2, 0xa2, 0xb6, 0xb7, 0xad, 0x81, 0x03, 0xd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, 0x34, 0x17, 0x5c, 0xe2, 0x91, 0x4e, 0x3c, 0xf7, 0x33, 1757 0xc3, 0xff, 0x31, 0x19, 0x38, 0x08, 0x5a, 0x7a, 0x78, 0x1e, 0x17, 0xe9,
1749 0x6b, 0x75, 0x46, 0x69, 0x18, 0xbe, 0x7b, 0xe6, 0xe8, 0xaf, 0x40, 0x67, 1758 0xea, 0x19, 0x94, 0x3f, 0xbf, 0x62, 0xdc, 0xe7, 0xde, 0xc4, 0xb8, 0xaf,
1750 0x34, 0x00, 0x6e, 0xd2, 0x5b, 0x87, 0xdc, 0x58, 0x52, 0x53, 0x9b, 0x25, 1759 0xda, 0x71, 0x45, 0xd5, 0xc6, 0x7d, 0x11, 0x7d, 0xbf, 0x64, 0xc7, 0x7d,
1751 0x21, 0x37, 0x15, 0x1a, 0x61, 0xf7, 0x30, 0xaf, 0xaa, 0x59, 0xba, 0x77, 1760 0xb1, 0x6e, 0x5c, 0xd0, 0xca, 0xc3, 0x8b, 0xb8, 0x48, 0x17, 0x2f, 0xa0,
1752 0xc4, 0x4c, 0xde, 0xb7, 0x1b, 0xc7, 0x6f, 0xd7, 0xe4, 0xa1, 0xc7, 0x13, 1761 0x3c, 0x92, 0x09, 0x1f, 0xf4, 0xa4, 0xb9, 0x01, 0xbc, 0x1b, 0x87, 0x7e,
1753 0x78, 0xff, 0x7b, 0x2e, 0xe5, 0x60, 0xdc, 0xbb, 0x56, 0xe7, 0xf4, 0x74, 1762 0x6c, 0x58, 0xd2, 0x8d, 0xd9, 0x3a, 0xfd, 0xf0, 0x46, 0xf4, 0xe3, 0x78,
1754 0xed, 0xa0, 0xdd, 0x72, 0xbd, 0xd6, 0xe1, 0xd1, 0x35, 0x76, 0x92, 0xea, 1763 0x99, 0x36, 0xe2, 0x7c, 0x9d, 0x5c, 0xa0, 0x6f, 0x14, 0xca, 0x49, 0xed,
1755 0x70, 0xa5, 0x6a, 0xa3, 0x8d, 0x17, 0x52, 0x49, 0xc2, 0xf5, 0x90, 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, 0xe5, 0x60, 0xc2, 0xbf, 0x4e, 0xe7, 0x08,
1763 0x5e, 0x1c, 0xf7, 0x9d, 0xeb, 0x51, 0x07, 0x72, 0x7d, 0x07, 0xcb, 0x92, 1772 0x75, 0xec, 0xa1, 0xdd, 0x72, 0x83, 0xd6, 0xe1, 0xee, 0x2a, 0x3b, 0x49,
1764 0xb8, 0x8b, 0x72, 0xdf, 0x19, 0x95, 0x73, 0x03, 0x7c, 0x66, 0xee, 0xbf, 1773 0x6d, 0xf3, 0xa4, 0x66, 0xa3, 0x8d, 0x96, 0xd2, 0x29, 0xc2, 0xf5, 0x90,
1765 0x44, 0xd9, 0xdf, 0xb9, 0x81, 0x4e, 0x79, 0x7c, 0x1e, 0x34, 0x01, 0xb9, 1774 0x70, 0xff, 0xeb, 0x1e, 0x29, 0x06, 0x1b, 0xe1, 0x17, 0x30, 0x76, 0x9e,
1766 0x3f, 0x72, 0x82, 0x30, 0x89, 0xec, 0x9a, 0x65, 0x2c, 0xbd, 0xdb, 0x65, 1775 0xee, 0xa6, 0x6d, 0x34, 0x33, 0xe5, 0xd9, 0x3c, 0xeb, 0x4d, 0xf2, 0xac,
1767 0xdc, 0x94, 0xfb, 0x34, 0xb7, 0x0c, 0x70, 0x2c, 0xe8, 0x25, 0xe8, 0xb8, 1776 0x1e, 0xa7, 0x51, 0xc3, 0x68, 0xce, 0x5e, 0x70, 0x1f, 0x21, 0xae, 0xcf,
1768 0xae, 0x1d, 0x46, 0x16, 0xa4, 0x67, 0x1b, 0x50, 0xce, 0x7e, 0xe1, 0x3f, 1777 0xfb, 0xcc, 0x54, 0x5a, 0xb4, 0xde, 0x99, 0xa9, 0x30, 0xaf, 0x1f, 0xfe,
1769 0xee, 0x65, 0x3f, 0x61, 0x5b, 0x85, 0x39, 0x35, 0x6a, 0x7a, 0x59, 0x5a, 1778 0x54, 0x85, 0x79, 0xfc, 0x81, 0x78, 0x6f, 0x87, 0x9f, 0x5b, 0xd9, 0x21,
1770 0xa5, 0x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d, 0xa6, 0x3a, 0x1b, 1786 0xb8, 0x8e, 0x3d, 0x46, 0x16, 0x64, 0x67, 0x1a, 0x50, 0xce, 0x7e, 0xe1,
1778 0x44, 0x92, 0xe3, 0x5e, 0x87, 0x4c, 0xce, 0x33, 0x96, 0xb0, 0x05, 0x36, 1787 0x3f, 0x1e, 0x64, 0x3f, 0x51, 0x5b, 0x85, 0x39, 0x35, 0x6a, 0x7a, 0x59,
1779 0xd8, 0x56, 0x5c, 0x9d, 0x78, 0x66, 0x3b, 0xf0, 0x54, 0x59, 0xa1, 0x6d, 1788 0x5c, 0xa1, 0x3f, 0xce, 0xff, 0x48, 0xf6, 0x37, 0xfb, 0xe8, 0xd6, 0x7b,
1780 0xd3, 0x1a, 0x3b, 0xeb, 0x71, 0x8c, 0xcd, 0x1c, 0xe1, 0x27, 0x80, 0x87, 1789 0x21, 0xdc, 0x53, 0x36, 0xb6, 0x15, 0xd7, 0x44, 0xef, 0x29, 0xc0, 0xae,
1781 0x2a, 0xef, 0x4c, 0xd5, 0xc4, 0x9f, 0x38, 0x57, 0xad, 0x43, 0x31, 0xdf, 1790 0xba, 0x4a, 0xdb, 0x17, 0xb3, 0x55, 0xae, 0x20, 0x63, 0x51, 0xd1, 0x1a,
1782 0xb8, 0x5e, 0x4f, 0x1d, 0x87, 0x2a, 0x36, 0xbe, 0x19, 0x7b, 0x2a, 0x41, 1791 0x25, 0xe5, 0xd1, 0xf2, 0xd2, 0x3a, 0xed, 0x68, 0x58, 0xbe, 0x4e, 0xa4,
1783 0x7b, 0x2a, 0x5b, 0x72, 0xcd, 0xf9, 0x80, 0x51, 0xf8, 0x4e, 0x5e, 0xef, 1792 0x95, 0x60, 0xc4, 0xda, 0x1e, 0x0b, 0x72, 0x0c, 0x76, 0x59, 0xb7, 0x5e,
1784 0x26, 0xd2, 0xfa, 0xd8, 0x0c, 0xe1, 0x8a, 0x85, 0x70, 0xad, 0x58, 0x33, 1793 0xb3, 0x05, 0xd8, 0xb2, 0x76, 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x3d, 0x07, 0x63, 0x0b,
1814 0xe6, 0x94, 0x7d, 0x57, 0xde, 0xa1, 0x65, 0xfe, 0x01, 0x9f, 0xfa, 0x6b, 1823 0x8d, 0x97, 0x78, 0x86, 0xa6, 0x51, 0xf2, 0xc3, 0x0a, 0x7e, 0x83, 0xf1,
1815 0x87, 0xfe, 0xdd, 0x38, 0x14, 0x04, 0xe7, 0x06, 0xee, 0x86, 0xad, 0xe2, 1824 0xb1, 0x18, 0xab, 0x50, 0xea, 0xeb, 0xd6, 0xbf, 0x68, 0x97, 0x6c, 0xdb,
1816 0xb9, 0xdf, 0x97, 0xee, 0xc4, 0xb0, 0xb6, 0x9d, 0xb0, 0x46, 0x7b, 0x9b, 1825 0x3a, 0xcc, 0xfb, 0x6e, 0xbd, 0xe6, 0xb3, 0x25, 0xb3, 0xf7, 0x99, 0x3f,
1817 0x65, 0x9d, 0x77, 0xb3, 0xcd, 0x99, 0xc9, 0x41, 0x6e, 0xa6, 0x60, 0x33, 1826 0xc8, 0x98, 0x10, 0xcf, 0x49, 0x69, 0xfe, 0x4a, 0x0d, 0xc4, 0xba, 0x8d,
1818 0xf1, 0x4c, 0x70, 0x8f, 0x7d, 0x97, 0x0b, 0x9a, 0x41, 0x47, 0x1f, 0x13, 1827 0x3d, 0xeb, 0x7b, 0xad, 0xd2, 0x7c, 0x1a, 0x38, 0x8f, 0xdb, 0x71, 0x53,
1819 0x23, 0x63, 0xb2, 0x55, 0x19, 0xc3, 0x5c, 0x83, 0x34, 0x09, 0x39, 0x7a, 1828 0x80, 0xe9, 0x30, 0xd6, 0xe6, 0x3a, 0x2b, 0x93, 0x39, 0xf6, 0x47, 0x9b,
1820 0x44, 0x52, 0xfc, 0xee, 0x07, 0xc7, 0xce, 0xcb, 0xa5, 0xd0, 0xcb, 0x6c, 1829 0x18, 0x1b, 0x98, 0x2b, 0x45, 0x31, 0xc2, 0x98, 0x3d, 0xa3, 0xe9, 0xc7,
1821 0xa7, 0xbf, 0xd9, 0x83,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0x9e, 0xc1, 0x98, 0x84, 0xb6, 0xeb, 0x3d, 0x1d, 0x66, 1859 0x9b, 0xb3, 0xc4, 0xcc, 0x45, 0xbc, 0x03, 0x3c, 0xf5, 0xf1, 0x52, 0xba,
1851 0xaf, 0xf1, 0x3b, 0x58, 0xe3, 0x8d, 0x58, 0x83, 0x93, 0x72, 0x7e, 0x66, 1860 0x3f, 0x17, 0xa3, 0x1c, 0x9d, 0x96, 0xa3, 0xd5, 0x41, 0xe9, 0xd0, 0xe7,
1852 0xe3, 0x0a, 0x1b, 0x36, 0x69, 0x63, 0x82, 0x33, 0x56, 0xf7, 0xd6, 0x97, 1861 0x49, 0x5f, 0x37, 0x76, 0x9c, 0xad, 0x8f, 0x1d, 0x33, 0x9d, 0x80, 0xb1,
1853 0x11, 0xb5, 0xeb, 0x9f, 0xb0, 0x67, 0xcb, 0xc2, 0x1c, 0xa1, 0xa4, 0x5e, 1862 0xe3, 0xfd, 0x3f, 0x42, 0xec, 0x58, 0x1c, 0x13, 0x3b, 0x5e, 0xcb, 0xbf,
1854 0x9f, 0xd1, 0xca, 0x71, 0x8c, 0x37, 0x28, 0xe9, 0x19, 0xce, 0x73, 0xf9, 1863 0x9a, 0x28, 0x4f, 0x63, 0x5e, 0xcd, 0x90, 0x25, 0x0b, 0x4e, 0x7e, 0xae,
1855 0x9b, 0x11, 0x90, 0x87, 0x27, 0xa0, 0x57, 0x57, 0xd0, 0x25, 0xe8, 0x96, 1864 0x05, 0xf7, 0x0b, 0xb8, 0xc7, 0x71, 0xbf, 0x84, 0xbb, 0x87, 0xfb, 0x8b,
1856 0x73, 0x73, 0x40, 0xbb, 0x8f, 0xca, 0x6c, 0x89, 0xf0, 0xf5, 0x24, 0x22, 1865 0xb8, 0x27, 0x64, 0x62, 0x49, 0x67, 0x4c, 0x43, 0x6e, 0x50, 0x97, 0xb1,
1857 0xfa, 0xac, 0x19, 0x9e, 0x67, 0x4c, 0x8e, 0xfb, 0x70, 0x25, 0x3c, 0x67, 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1872 0x79, 0x0e, 0xf5, 0x8c, 0x85, 0xbb, 0x10, 0xdc, 0x63, 0xe4, 0xd5, 0x71, 1881 0x6d, 0x25, 0x65, 0x10, 0x74, 0x38, 0xa4, 0xcb, 0x13, 0x98, 0x0f, 0xf7,
1873 0x99, 0xaa, 0x30, 0x7f, 0xc4, 0xd1, 0x7c, 0x34, 0x59, 0x3e, 0x00, 0x9d, 1882 0xfd, 0x34, 0x1e, 0x20, 0x7b, 0xb8, 0xe7, 0x87, 0xb9, 0x57, 0xbf, 0x01,
1874 0xb4, 0xf2, 0xcc, 0xdf, 0xce, 0xea, 0x3a, 0x24, 0x67, 0x84, 0xb0, 0x70, 1883 0x7a, 0x77, 0xec, 0x19, 0x36, 0xd2, 0x58, 0x9f, 0x8c, 0x55, 0x92, 0xce,
1875 0x0d, 0x56, 0x9e, 0x87, 0xbf, 0xf8, 0xbf, 0x70, 0x5f, 0xd1, 0xc8, 0x50, 1884 0x58, 0xa5, 0xcf, 0x39, 0x54, 0xb1, 0xef, 0xfa, 0x8a, 0x58, 0x0f, 0xfc,
1876 0x0b, 0x47, 0x9a, 0xf2, 0xce, 0xc8, 0x95, 0x69, 0x39, 0x08, 0x78, 0x0e, 1885 0x9e, 0xee, 0x70, 0x46, 0x80, 0xaf, 0x62, 0xb9, 0xd3, 0xc9, 0xea, 0xbb,
1877 0xe3, 0x52, 0xf7, 0xf3, 0x3b, 0x2c, 0xf3, 0x92, 0x9f, 0xbb, 0x4f, 0xd4, 1886 0x6f, 0xef, 0x90, 0x03, 0x58, 0xab, 0x81, 0xe9, 0xa4, 0x96, 0xf3, 0xb5,
1878 0x43, 0xe7, 0x9d, 0xe8, 0x43, 0x07, 0x25, 0xf2, 0xd0, 0xa2, 0xd3, 0xf0, 1887 0xef, 0x61, 0x45, 0xeb, 0xfa, 0xa4, 0xde, 0x1b, 0x9a, 0x97, 0x69, 0xfd,
1879 0x50, 0xb7, 0xf6, 0xcb, 0x77, 0xfb, 0xdd, 0x89, 0x7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0x68, 0x1b, 0x65, 0xe3, 0xc0, 0xc1, 0x68,
1916 0xea, 0x33, 0xa6, 0xbf, 0xe1, 0x72, 0x73, 0x46, 0x81, 0x75, 0x5d, 0xd8, 1925 0x60, 0xe4, 0xf9, 0x80, 0x14, 0xb4, 0x8f, 0x67, 0xee, 0x59, 0x65, 0x62,
1917 0xa6, 0xb4, 0x73, 0x89, 0x47, 0xbd, 0x6e, 0x05, 0x25, 0x3c, 0x67, 0x00, 1926 0x66, 0x61, 0x38, 0x0b, 0xfb, 0x80, 0xdf, 0xc5, 0x9a, 0xa8, 0xce, 0xe1,
1918 0x6e, 0xae, 0x5c, 0xe1, 0xbe, 0x43, 0x91, 0x0e, 0x43, 0x5c, 0x7f, 0x5b, 1927 0xfa, 0x71, 0xbb, 0xa7, 0x3d, 0x7f, 0x99, 0x3d, 0x6d, 0x4f, 0x4e, 0x57,
1919 0xf3, 0xc9, 0x78, 0x81, 0xb1, 0x95, 0x47, 0x83, 0xf4, 0x28, 0x79, 0x8c, 1928 0xf5, 0x39, 0x79, 0x9d, 0x5f, 0x95, 0x52, 0xeb, 0xda, 0xf4, 0x5a, 0xa9,
1920 0x7d, 0xf0, 0x7d, 0x41, 0xc7, 0x73, 0xf7, 0xfa, 0x8c, 0x15, 0x75, 0x1f, 1929 0x2e, 0x9d, 0x93, 0x96, 0x95, 0x47, 0x12, 0x46, 0x0f, 0x13, 0xa6, 0x14,
1921 0xbf, 0x43, 0x85, 0x72, 0x0a, 0xfa, 0xb7, 0xb8, 0xe8, 0xf0, 0x1b, 0x78, 1930 0xe0, 0xd9, 0x09, 0x5c, 0x10, 0x1e, 0xd3, 0x46, 0xd4, 0x3b, 0xb7, 0x52,
1922 0x37, 0x0a, 0xee, 0xf3, 0x8b, 0xce, 0x77, 0xa7, 0x9f, 0xc5, 0x73, 0x83, 1931 0x1f, 0x2e, 0xca, 0xa7, 0x12, 0xd1, 0x19, 0x05, 0xf4, 0x03, 0x19, 0x37,
1923 0xfd, 0xee, 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0x84, 0x28, 0xf2,
1945 0xb4, 0x49, 0x19, 0x1b, 0x5d, 0xed, 0x48, 0xb9, 0x1f, 0x84, 0x00, 0x6d, 1954 0xc4, 0x56, 0xcd, 0x13, 0x8c, 0x1d, 0x91, 0x2f, 0xda, 0x21, 0x47, 0xc8,
1946 0x84, 0xbd, 0xb0, 0x0b, 0xab, 0x3d, 0x52, 0xa8, 0xb5, 0xf1, 0xff, 0x03, 1955 0x17, 0x17, 0x64, 0x11, 0x7c, 0xf1, 0x9c, 0xe2, 0xd8, 0x67, 0x68, 0x2b,
1947 0x6c, 0x7c, 0xb6, 0x91, 0xa8, 0xb1, 0xf1, 0x7f, 0xcd, 0xf2, 0x1a, 0x7f, 1956 0x4c, 0xd2, 0x27, 0x3b, 0x55, 0xee, 0x00, 0xbf, 0x2b, 0xf9, 0xaf, 0x53,
1948 0xbb, 0xda, 0xde, 0x3f, 0x00, 0xf8, 0x76, 0x2f, 0xdb, 0xfb, 0xec, 0x83, 1957 0x61, 0xb8, 0x00, 0x3f, 0xfd, 0x41, 0xd8, 0xf3, 0xae, 0xfe, 0x0e, 0xe4,
1949 0x76, 0x87, 0xc8, 0xf5, 0xb0, 0xf9, 0xde, 0x0d, 0x1e, 0xbc, 0x01, 0xbe, 1958 0x3c, 0xe8, 0x3e, 0xa2, 0xf7, 0x31, 0x07, 0xf4, 0x7e, 0x6c, 0x06, 0x73,
1950 0xd4, 0x7b, 0x0a, 0xae, 0xec, 0x29, 0xb4, 0xc3, 0xe7, 0xee, 0x94, 0xf7, 1959 0x18, 0x53, 0x9f, 0x82, 0x2f, 0xec, 0x61, 0x5d, 0x69, 0xe7, 0x9f, 0xd4,
1951 0x4e, 0x6f, 0x95, 0x9d, 0x25, 0xff, 0x12, 0x69, 0xee, 0x80, 0x8d, 0x5a, 1960 0x3c, 0xd4, 0x00, 0x7d, 0xf0, 0x68, 0x1f, 0x63, 0x4d, 0xbe, 0x77, 0x48,
1952 0x00, 0x9c, 0x11, 0x2b, 0xb7, 0xcf, 0x02, 0x6f, 0xdd, 0xc9, 0x9f, 0xa8, 1961 0x75, 0x16, 0x06, 0x01, 0x73, 0x4c, 0xdd, 0x2f, 0x8c, 0x73, 0xb4, 0xae,
1953 0x17, 0xad, 0x5d, 0xc4, 0xb3, 0x8e, 0xf5, 0xfa, 0x89, 0xa3, 0x3d, 0x63, 1962 0xb0, 0xf3, 0x29, 0x23, 0x86, 0x21, 0xeb, 0xcc, 0xbb, 0x42, 0xd8, 0x04,
1954 0x29, 0x1d, 0x72, 0xea, 0x18, 0xbd, 0xaf, 0x24, 0xec, 0x72, 0x1f, 0x36, 1963 0x9b, 0xb4, 0x49, 0x19, 0x1b, 0x5d, 0xed, 0x49, 0x7b, 0x3f, 0x07, 0x01,
1955 0xc9, 0x16, 0xf4, 0xc7, 0x78, 0xf2, 0x46, 0x79, 0xfa, 0xaa, 0xe8, 0x5d, 1964 0xda, 0x08, 0x7b, 0x61, 0x2f, 0x56, 0x7b, 0xb0, 0x54, 0x6f, 0xe3, 0xff,
1956 0x59, 0xcd, 0x87, 0x9d, 0x4e, 0x66, 0x1a, 0x3e, 0xc0, 0xde, 0x18, 0xe6, 1965 0x67, 0xd8, 0xf8, 0x6c, 0x23, 0xae, 0xb1, 0xf1, 0x7f, 0xc5, 0xf2, 0x1a,
1957 0xa0, 0xda, 0x37, 0xcb, 0x75, 0xb2, 0x53, 0xcf, 0x67, 0x46, 0x0e, 0x42, 1966 0x7f, 0x7b, 0xda, 0xde, 0x3f, 0x0c, 0xf8, 0xf6, 0x2d, 0xd9, 0xfb, 0xec,
1958 0x37, 0xff, 0x41, 0x61, 0xa7, 0x2c, 0x8d, 0xb6, 0xe1, 0x39, 0x26, 0x4f, 1967 0x83, 0x76, 0x87, 0xc8, 0x0d, 0xb0, 0xf9, 0xde, 0x09, 0x1e, 0xbc, 0x11,
1959 0x17, 0xfa, 0xe0, 0xfb, 0xbc, 0x0b, 0x38, 0x6a, 0xc4, 0x73, 0xa3, 0x0c, 1968 0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, 0x96, 0xa1, 0x36, 1990 0xe5, 0xba, 0x53, 0x9d, 0xc9, 0x0f, 0x61, 0x0e, 0x9d, 0x67, 0x19, 0xf7,
1982 0xe9, 0x19, 0xfc, 0xa9, 0x84, 0x36, 0xe7, 0x7f, 0xba, 0x84, 0xdf, 0xee, 1991 0x7e, 0xf2, 0x0a, 0xc6, 0x7d, 0x3a, 0xce, 0xf2, 0xde, 0xa4, 0xe5, 0x0f,
1983 0x7c, 0x5e, 0x51, 0x86, 0xbd, 0x0a, 0x19, 0x26, 0xaa, 0xbe, 0x0c, 0xc3, 1992 0xf1, 0x61, 0xbe, 0x71, 0x44, 0x99, 0x7c, 0x1a, 0x7e, 0x2e, 0x75, 0x78,
1984 0xbb, 0x32, 0xde, 0x95, 0xd9, 0xef, 0x8f, 0x7e, 0x3a, 0xe6, 0x52, 0x7e, 1993 0xa7, 0xfd, 0x1e, 0xc7, 0x9f, 0x5e, 0x41, 0xbf, 0x6d, 0x86, 0xf6, 0x54,
1985 0x50, 0x66, 0x40, 0x26, 0x15, 0x21, 0x93, 0x8a, 0x90, 0x53, 0x45, 0xc8, 1994 0x99, 0xfc, 0x48, 0x3d, 0x84, 0xfb, 0xb4, 0x23, 0xc5, 0x9a, 0xcc, 0x9a,
1986 0x25, 0xd8, 0x6c, 0x67, 0x8a, 0x90, 0x4b, 0x45, 0xc8, 0x25, 0xc8, 0xb8, 1995 0x23, 0x5f, 0x9d, 0x54, 0xcc, 0x65, 0x41, 0x59, 0xf5, 0x67, 0x42, 0xb3,
1987 0x27, 0x20, 0xe3, 0x8c, 0x4c, 0x1b, 0x85, 0x4c, 0x9b, 0x91, 0xfb, 0xac, 1996 0xc6, 0xe4, 0x05, 0x23, 0x97, 0xde, 0x67, 0xe4, 0xd2, 0x99, 0xf3, 0xcb,
1988 0xae, 0x37, 0xb1, 0x92, 0x7e, 0xeb, 0x23, 0x0d, 0xe8, 0x18, 0xf2, 0x99, 1997 0xe4, 0xd2, 0x25, 0x2d, 0x97, 0x0e, 0x0a, 0xee, 0x73, 0x97, 0x20, 0x97,
1989 0x9a, 0xd8, 0xe0, 0x8d, 0x47, 0x34, 0xbf, 0xbb, 0x9e, 0xba, 0xc2, 0x61, 1998 0x5e, 0xc0, 0xb3, 0xa7, 0xe5, 0x52, 0x42, 0xac, 0xbd, 0x2c, 0x3f, 0xd0,
1990 0x0e, 0xcd, 0x4f, 0xb4, 0xff, 0xbe, 0x9d, 0xbf, 0xa5, 0x09, 0x7c, 0xfd, 1999 0xe3, 0xcf, 0x96, 0x5d, 0x6d, 0x57, 0x15, 0xa7, 0x61, 0x93, 0x94, 0x27,
1991 0x03, 0xcb, 0xd7, 0xdb, 0x97, 0xf9, 0x3a, 0xe5, 0x30, 0x56, 0x5c, 0x9f, 2000 0xac, 0xfe, 0x96, 0x4c, 0xab, 0x74, 0xf5, 0xff, 0x50, 0x22, 0x9b, 0xf3,
1992 0xaf, 0x3b, 0xec, 0xbb, 0x5c, 0xb0, 0x0e, 0x7c, 0xbd, 0x6e, 0x15, 0x5f, 2001 0xcf, 0xae, 0xe0, 0xf7, 0x46, 0x9f, 0x53, 0x94, 0x61, 0xaf, 0x42, 0x86,
1993 0xc7, 0xc0, 0xd7, 0x7b, 0xd6, 0xf0, 0xf5, 0x06, 0x67, 0x58, 0xb7, 0xe1, 2002 0x89, 0x5a, 0x5b, 0x86, 0xe1, 0x5d, 0x05, 0xef, 0x2a, 0xec, 0xf7, 0x6f,
1994 0x19, 0x09, 0x3e, 0x37, 0x3a, 0x55, 0xbe, 0xbe, 0x47, 0xf3, 0xf5, 0x21, 2003 0x7f, 0x38, 0xe2, 0x51, 0x7e, 0x50, 0x66, 0x40, 0x26, 0x95, 0x21, 0x93,
1995 0xf0, 0xf5, 0x75, 0x35, 0x7c, 0xbd, 0x47, 0x52, 0x37, 0x67, 0x22, 0x5b, 2004 0xca, 0x90, 0x53, 0x65, 0xc8, 0x25, 0xd8, 0x6c, 0xe7, 0xcb, 0x90, 0x4b,
1996 0x65, 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fa, 0xff, 0x77, 0xfd, 0x33, 0x5b, 0x99, 0xbb,
2040 0x19, 0x1b, 0xe4, 0x99, 0xdd, 0x70, 0x2f, 0xa2, 0xd7, 0xca, 0xba, 0x96, 2049 0xcf, 0x33, 0xb0, 0x46, 0x1e, 0x47, 0xf4, 0x90, 0xdb, 0x6a, 0xf4, 0x02,
2041 0x9a, 0x98, 0x25, 0xf0, 0x3e, 0x2d, 0xc9, 0xcc, 0x00, 0xee, 0xf3, 0x1c, 2050 0xd7, 0x98, 0xcf, 0x90, 0x67, 0x90, 0x7f, 0xe7, 0x21, 0xff, 0x9e, 0x80,
2042 0x7b, 0xbf, 0x4c, 0x3d, 0x38, 0x01, 0x5b, 0x6e, 0x2f, 0x74, 0x0e, 0xcf, 2051 0xfc, 0x7b, 0x7c, 0xd9, 0x9e, 0x40, 0xbf, 0x8d, 0x47, 0x84, 0x72, 0x24,
2043 0x9f, 0x99, 0xef, 0x70, 0x13, 0x86, 0x59, 0xfd, 0xdd, 0x29, 0xfa, 0x80, 2052 0xa8, 0xe1, 0x63, 0xa1, 0x8f, 0xf8, 0x30, 0xf9, 0x27, 0xcc, 0xfd, 0x5d,
2044 0xa4, 0x87, 0x04, 0x9e, 0x67, 0x6c, 0x5c, 0x29, 0x21, 0xf9, 0xc2, 0x05, 2053 0x8e, 0x13, 0x57, 0xe7, 0x1c, 0x3d, 0x1a, 0xd4, 0xe3, 0x84, 0x70, 0xbf,
2045 0xf3, 0x6d, 0xcb, 0xc2, 0x4b, 0xb8, 0xbf, 0xde, 0x7a, 0x18, 0x3f, 0x64, 2054 0x5c, 0x37, 0x47, 0xfc, 0xae, 0xf0, 0xf9, 0x8c, 0xce, 0x23, 0x29, 0xea,
2046 0xd4, 0xdc, 0xd1, 0xd7, 0x92, 0xa4, 0xcb, 0x26, 0xc7, 0xa5, 0x1a, 0x37, 2055 0x3d, 0x28, 0xe2, 0x85, 0x7b, 0x50, 0xc4, 0x89, 0xab, 0xed, 0xfd, 0x62,
2047 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 0x2d, 0xd8, 2092 0x6c, 0x1f, 0x94, 0x9f, 0x46, 0x76, 0xef, 0x76, 0xe6, 0x6d, 0x19, 0x9f,
2084 0x0d, 0x3b, 0xb0, 0x1b, 0x76, 0xe0, 0x46, 0x39, 0x71, 0x15, 0x73, 0x4c, 2093 0xa3, 0x78, 0xba, 0x9f, 0xcd, 0x5b, 0x3e, 0x53, 0xce, 0xe7, 0xf1, 0x7e,
2085 0x72, 0xd7, 0xc2, 0x2b, 0x97, 0xef, 0xe8, 0x38, 0x7d, 0xe3, 0xcd, 0x23, 2094 0x33, 0xde, 0x93, 0xcf, 0x1e, 0xd7, 0x7c, 0xa6, 0xed, 0x13, 0xa7, 0xd7,
2086 0xf0, 0xd9, 0xc5, 0x4d, 0x8d, 0x32, 0x0f, 0x7f, 0xc9, 0x6d, 0xbc, 0x79, 2095 0xee, 0x2f, 0x2c, 0xed, 0x0d, 0x14, 0xc8, 0x67, 0xea, 0x84, 0x37, 0x6f,
2087 0xa7, 0x74, 0x0f, 0xe2, 0xfd, 0xe0, 0x05, 0xe9, 0xb9, 0xf9, 0x56, 0xa7, 2096 0xe4, 0x01, 0xf3, 0x54, 0x7f, 0x03, 0xba, 0x83, 0x6d, 0x51, 0xfe, 0x70,
2088 0x71, 0x74, 0x04, 0x78, 0x4c, 0x3b, 0xa9, 0xc4, 0x98, 0xb3, 0x80, 0x71, 2097 0x96, 0xbe, 0x2d, 0xfc, 0x9f, 0x8d, 0x78, 0x6e, 0xc3, 0xf3, 0x8c, 0xbc,
2089 0x32, 0xdb, 0x23, 0xc2, 0xb8, 0xe5, 0x02, 0x63, 0x11, 0x37, 0x77, 0x47, 2098 0xfb, 0x60, 0x5c, 0xcf, 0x7b, 0x02, 0xf3, 0x38, 0x7c, 0x1c, 0x73, 0x72,
2090 0xfa, 0x92, 0xe3, 0x4e, 0x6a, 0x54, 0x45, 0x52, 0xa3, 0x23, 0x4e, 0x58, 2099 0x8c, 0xed, 0xec, 0x9e, 0x75, 0xa5, 0xe1, 0x2c, 0xf9, 0x8e, 0x67, 0x6d,
2091 0x8f, 0xdf, 0x48, 0x85, 0x9c, 0x01, 0xac, 0x07, 0x8a, 0xd3, 0xa0, 0xa7, 2100 0xc2, 0xf0, 0x50, 0x2f, 0xe9, 0x36, 0xed, 0x0d, 0xe9, 0xb3, 0xa5, 0xbb,
2092 0xff, 0x28, 0xf9, 0x63, 0x2d, 0x32, 0x5f, 0xe8, 0x76, 0x33, 0x2a, 0xae, 2101 0x93, 0x31, 0xe0, 0xe4, 0x30, 0xd6, 0x63, 0xa2, 0xe4, 0x7b, 0x39, 0xc7,
2093 0x73, 0x4b, 0xd4, 0x09, 0x10, 0xfd, 0xa9, 0x98, 0xcc, 0x96, 0xb6, 0x8a, 2102 0x4f, 0x62, 0x9e, 0xb0, 0x01, 0x3b, 0x61, 0x0b, 0x76, 0xc2, 0x0e, 0xec,
2094 0xd2, 0xb6, 0x7b, 0x87, 0x64, 0xa6, 0x4b, 0x72, 0x6e, 0x40, 0xda, 0x14, 2103 0x84, 0x1d, 0xb8, 0x49, 0x4e, 0x5d, 0xc3, 0x1c, 0x93, 0xc2, 0x75, 0xf0,
2095 0xfa, 0xe7, 0xb7, 0x67, 0xd5, 0x09, 0xee, 0x25, 0x86, 0xbc, 0x70, 0x39, 2104 0xca, 0xe5, 0xaf, 0x75, 0x9c, 0xbe, 0xf1, 0xe6, 0x41, 0xf8, 0xec, 0xe2,
2096 0xf9, 0xa4, 0x04, 0x1c, 0x82, 0x6e, 0x19, 0xe3, 0x6d, 0x12, 0xca, 0xbd, 2105 0xa5, 0x87, 0x99, 0x87, 0xbf, 0xe8, 0x35, 0xde, 0x3c, 0x24, 0x9d, 0xfd,
2097 0x8f, 0xea, 0xf8, 0x29, 0x63, 0xb6, 0xb5, 0x7b, 0x0f, 0xe4, 0x8f, 0x58, 2106 0x78, 0xdf, 0xff, 0xa2, 0x74, 0xdd, 0x7c, 0xab, 0xd3, 0x38, 0x3c, 0x08,
2098 0x5d, 0xfe, 0x98, 0x2b, 0x72, 0x9f, 0x46, 0x72, 0x51, 0xc6, 0x88, 0x3d, 2107 0x3c, 0x66, 0x9d, 0x74, 0x72, 0xc4, 0x99, 0xc7, 0x38, 0xb9, 0xdd, 0x31,
2099 0xfc, 0x9e, 0x61, 0xdd, 0x26, 0x99, 0x1a, 0xc8, 0xd9, 0x3c, 0x8f, 0x47, 2108 0x61, 0xdc, 0x72, 0x9e, 0xb1, 0x88, 0x9b, 0x3b, 0x63, 0x3d, 0xa9, 0x51,
2100 0x12, 0xcc, 0x21, 0x26, 0x4e, 0xc6, 0x07, 0xc8, 0xeb, 0xab, 0xf7, 0x36, 2109 0x27, 0x3d, 0xac, 0x62, 0xe9, 0xe1, 0x41, 0x27, 0xaa, 0xc7, 0x6f, 0xae,
2101 0x62, 0x35, 0xf2, 0xc0, 0x91, 0xc5, 0x52, 0xb8, 0x17, 0xc2, 0xfe, 0xf0, 2110 0x42, 0xce, 0x00, 0xd6, 0xc3, 0xe5, 0x4f, 0x83, 0x9e, 0x8e, 0x48, 0xf1,
2102 0x3c, 0x63, 0xe4, 0x6d, 0x66, 0x4d, 0x3b, 0xc2, 0xc5, 0xfd, 0xca, 0x95, 2111 0x64, 0x8b, 0xcc, 0x95, 0x3a, 0xbd, 0x9c, 0x4a, 0xe8, 0xdc, 0x12, 0x75,
2103 0x32, 0x56, 0x79, 0x94, 0xa9, 0xae, 0x96, 0xaf, 0x8f, 0x55, 0x8c, 0x6c, 2112 0x0a, 0x44, 0x7f, 0x36, 0x2e, 0x33, 0x93, 0x3b, 0x45, 0x69, 0xdb, 0x7d,
2104 0x9d, 0xa9, 0x84, 0xba, 0x25, 0x66, 0x74, 0xe9, 0x1a, 0x7d, 0x62, 0xa2, 2113 0x9b, 0xe4, 0xa6, 0x26, 0xe5, 0x62, 0x9f, 0xb4, 0x2a, 0xf4, 0xcf, 0x6f,
2105 0x99, 0x55, 0x7d, 0x42, 0xbd, 0xa8, 0xe4, 0x03, 0xf3, 0x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, 2143 0xf9, 0x4a, 0x63, 0xcf, 0x6c, 0xb6, 0x76, 0x8c, 0x89, 0x53, 0xad, 0x6d,
2135 0x2e, 0xef, 0xd7, 0xee, 0xb1, 0x6d, 0xa7, 0xfc, 0xfb, 0x89, 0xa3, 0xe4, 2144 0xc3, 0xb0, 0x9f, 0xfa, 0x6f, 0x32, 0xee, 0x70, 0xc6, 0x27, 0x77, 0x3a,
2136 0x21, 0xe9, 0x81, 0x2e, 0x63, 0x0e, 0xc8, 0x6f, 0x69, 0x9c, 0x89, 0x22, 2145 0xc5, 0x49, 0xee, 0x65, 0xdb, 0xbf, 0xd1, 0xe1, 0xed, 0x77, 0x0e, 0xfb,
2137 0xed, 0x6d, 0xd2, 0x30, 0x5a, 0x39, 0x9f, 0x0c, 0x73, 0x38, 0xf2, 0xb6, 2146 0x3b, 0x50, 0xc6, 0x98, 0x25, 0x63, 0x36, 0xf7, 0x5f, 0xc9, 0x18, 0x6d,
2138 0xed, 0x84, 0xdd, 0x93, 0xcf, 0xcb, 0xdc, 0x65, 0xd4, 0x83, 0x23, 0x91, 2147 0xce, 0xe7, 0xd8, 0x2c, 0xdb, 0xe1, 0x4c, 0x4c, 0x76, 0xc2, 0x37, 0xe7,
2139 0xf5, 0xfc, 0x7e, 0x22, 0xda, 0xf6, 0x18, 0xbd, 0x28, 0x61, 0x5f, 0x7c, 2148 0xb9, 0x2a, 0xbe, 0x1f, 0xe2, 0xda, 0x41, 0x07, 0x7b, 0xfa, 0xcc, 0xee,
2140 0x6e, 0xa8, 0xe9, 0x9b, 0x76, 0x14, 0xef, 0xab, 0xcf, 0x91, 0x3d, 0xa3, 2149 0x98, 0x5c, 0x65, 0x63, 0xd0, 0xd4, 0xc3, 0x3f, 0xbd, 0x6c, 0xef, 0xf6,
2141 0xf7, 0x19, 0xcd, 0xf7, 0x12, 0x42, 0x3e, 0x21, 0xef, 0x24, 0xf5, 0x59, 2150 0x28, 0xf4, 0xd8, 0x2d, 0x90, 0x47, 0xd4, 0xc3, 0x47, 0xe5, 0x6d, 0x96,
2142 0x27, 0xef, 0x61, 0xda, 0x3d, 0xdc, 0x83, 0x75, 0x17, 0x26, 0xfd, 0x4f, 2151 0x9e, 0x97, 0xeb, 0xe1, 0x4b, 0xc2, 0x38, 0x71, 0x2f, 0xde, 0x15, 0xc2,
2143 0xe8, 0x6f, 0xfc, 0xcd, 0x88, 0x38, 0x79, 0xff, 0x36, 0x9d, 0x7b, 0x92, 2152 0x38, 0xe8, 0xe1, 0x58, 0x9d, 0xaf, 0x46, 0xbf, 0xaf, 0x29, 0x63, 0xf6,
2144 0xd7, 0xb1, 0xe6, 0x1c, 0xee, 0x55, 0x1f, 0xb5, 0xeb, 0x61, 0xfe, 0x4d, 2153 0xc3, 0x96, 0xfb, 0x7d, 0x90, 0x03, 0x89, 0xc8, 0xcf, 0x6b, 0x5c, 0xda,
2145 0x0b, 0x96, 0x65, 0x01, 0x1b, 0x75, 0x08, 0x65, 0x6f, 0x5c, 0xba, 0x8e, 2154 0xaf, 0xdd, 0x6f, 0xdb, 0x4e, 0x04, 0x7f, 0x44, 0x1c, 0xa5, 0x8e, 0xca,
2146 0x7e, 0x58, 0xf3, 0xc2, 0x66, 0xf8, 0x02, 0xc3, 0x47, 0xa1, 0xab, 0x8f, 2155 0x2f, 0x42, 0xa7, 0x31, 0x07, 0xe4, 0x2f, 0x34, 0xce, 0x44, 0x91, 0xf6,
2147 0x26, 0x64, 0xe7, 0x51, 0xad, 0x1b, 0xd3, 0x6b, 0x63, 0x05, 0x7d, 0x6e, 2156 0x36, 0x6b, 0x18, 0xad, 0x9c, 0x4f, 0x45, 0x39, 0x1c, 0x45, 0xdb, 0x76,
2148 0xd4, 0x79, 0x8f, 0x3e, 0xc7, 0xf6, 0xd6, 0xa3, 0x11, 0x39, 0x1c, 0xef, 2157 0xcc, 0xee, 0xc9, 0x17, 0xe5, 0xeb, 0x8c, 0x73, 0xa6, 0x06, 0x63, 0xeb,
2149 0x73, 0x7b, 0x9c, 0x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9f,
2200 0xf7, 0x37, 0x20, 0x23, 0x26, 0x66, 0xe6, 0x65, 0xf2, 0x41, 0x3e, 0x53, 2209 0x6c, 0x3c, 0x96, 0xb7, 0x65, 0xfe, 0x9e, 0xce, 0x82, 0x52, 0x7c, 0x17,
2201 0xbf, 0x45, 0xa0, 0xc3, 0x28, 0xc3, 0x73, 0x92, 0x19, 0x64, 0x99, 0x69, 2210 0xe5, 0x24, 0xd0, 0x2f, 0x69, 0xe0, 0xb7, 0x0a, 0xbb, 0xb3, 0x52, 0xbf,
2202 0x33, 0xa2, 0xfd, 0xe5, 0x93, 0x32, 0xbc, 0x3c, 0x3e, 0xf1, 0x7b, 0x57, 2211 0x27, 0x3d, 0xc5, 0x6f, 0x34, 0x71, 0x7f, 0x8c, 0x7f, 0x67, 0x23, 0xc5,
2203 0xcd, 0x77, 0xab, 0x69, 0xf3, 0xa4, 0x9d, 0x4c, 0x85, 0xef, 0xc3, 0x3d, 2212 0x3c, 0xab, 0xa2, 0x86, 0x37, 0x0d, 0xfd, 0xd1, 0xaf, 0x73, 0xab, 0xf8,
2204 0xf2, 0xbb, 0xec, 0xb7, 0xb3, 0xf8, 0xbe, 0xf6, 0x5b, 0xad, 0x5a, 0x74, 2213 0x37, 0x82, 0x62, 0xf0, 0xfb, 0x47, 0xfb, 0x68, 0x2b, 0x67, 0xec, 0x99,
2205 0xe0, 0x37, 0xbf, 0x87, 0x36, 0xe5, 0x8c, 0xa0, 0xcd, 0x82, 0xdb, 0x32, 2214 0xb0, 0x40, 0x9f, 0x53, 0xa9, 0xf1, 0x4f, 0xfd, 0x79, 0x68, 0xf2, 0x5d,
2206 0xaa, 0x86, 0x6e, 0x18, 0xe5, 0xb9, 0xb9, 0xd9, 0x35, 0xdf, 0xba, 0xae, 2215 0x8d, 0x6e, 0x8e, 0x2c, 0x7d, 0x77, 0xf0, 0xb4, 0x3c, 0xa5, 0x63, 0xc5,
2207 0xea, 0xc5, 0xbc, 0x5e, 0x53, 0xe6, 0x67,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 0x7f, 0xb9, 0x9d, 0xe7, 0xa6, 0xf9,
2241 0x2d, 0xaf, 0xa1, 0x6a, 0x94, 0x37, 0xbe, 0x56, 0xce, 0x38, 0xec, 0xfc,
2242 0x3d, 0x51, 0x8e, 0x5f, 0x9c, 0x39, 0xe3, 0xd2, 0x71, 0xb6, 0x05, 0xf7,
2243 0xef, 0x6e, 0xd7, 0x67, 0x9b, 0xcf, 0x8a, 0x2d, 0xd3, 0xf9, 0xe4, 0x78,
2244 0x5e, 0xf9, 0xbd, 0xb6, 0x88, 0x1f, 0x6a, 0x7f, 0xf7, 0x40, 0xe4, 0xff,
2245 0x02, 0x06, 0x86, 0xe5, 0x0a, 0xd4, 0x6f, 0x00, 0x00, 0x00 };
2227 2246
2228static const u32 bnx2_CP_b09FwData[(0x0/4) + 1] = { 0x0 }; 2247static const u32 bnx2_CP_b09FwData[(0x0/4) + 1] = { 0x0 };
2229static const u32 bnx2_CP_b09FwRodata[(0x118/4) + 1] = { 2248static const u32 bnx2_CP_b09FwRodata[(0x118/4) + 1] = {
2230 0x0800061c, 0x0800083c, 0x08000780, 0x080007a8, 0x080007d0, 0x080007f8, 2249 0x0800069c, 0x080008bc, 0x08000800, 0x08000828, 0x08000850, 0x08000878,
2231 0x08000654, 0x08000640, 0x08000864, 0x08000864, 0x08000670, 0x0800068c, 2250 0x080006d4, 0x080006c0, 0x080008e4, 0x080008e4, 0x080006f0, 0x0800070c,
2232 0x0800068c, 0x08000864, 0x080006a4, 0x080006b8, 0x08000864, 0x080006cc, 2251 0x0800070c, 0x080008e4, 0x08000724, 0x08000738, 0x080008e4, 0x0800074c,
2233 0x08000864, 0x08000864, 0x080006e0, 0x08000864, 0x08000864, 0x08000864, 2252 0x080008e4, 0x080008e4, 0x08000760, 0x080008e4, 0x080008e4, 0x080008e4,
2234 0x08000864, 0x08000864, 0x08000864, 0x08000864, 0x08000864, 0x08000864, 2253 0x080008e4, 0x080008e4, 0x080008e4, 0x080008e4, 0x080008e4, 0x080008e4,
2235 0x08000864, 0x080006f4, 0x08000864, 0x08000708, 0x0800071c, 0x08000730, 2254 0x080008e4, 0x08000774, 0x080008e4, 0x08000788, 0x0800079c, 0x080007b0,
2236 0x08000864, 0x08000744, 0x08000758, 0x0800076c, 0x08003200, 0x08003218, 2255 0x080008e4, 0x080007c4, 0x080007d8, 0x080007ec, 0x080032e8, 0x08003300,
2237 0x08003228, 0x08003238, 0x08003250, 0x08003268, 0x08003278, 0x08003288, 2256 0x08003310, 0x08003320, 0x08003338, 0x08003350, 0x08003360, 0x08003370,
2238 0x080032a8, 0x080032b8, 0x080032c8, 0x08003358, 0x08003298, 0x080032d8, 2257 0x08003390, 0x080033a0, 0x080033b0, 0x08003440, 0x08003380, 0x080033c0,
2239 0x080032e8, 0x08003300, 0x08003320, 0x08003358, 0x08003338, 0x08003338, 2258 0x080033d0, 0x080033e8, 0x08003408, 0x08003440, 0x08003420, 0x08003420,
2240 0x080050d4, 0x080050d4, 0x080050d4, 0x080050d4, 0x080050d4, 0x080050fc, 2259 0x080051bc, 0x080051bc, 0x080051bc, 0x080051bc, 0x080051bc, 0x080051e4,
2241 0x080050fc, 0x08005124, 0x08005174, 0x08005144, 0x00000000 }; 2260 0x080051e4, 0x0800520c, 0x0800525c, 0x0800522c, 0x00000000 };
2242 2261
2243static struct fw_info bnx2_cp_fw_09 = { 2262static struct fw_info bnx2_cp_fw_09 = {
2263 /* Firmware version: 3.7.1 */
2244 .ver_major = 0x3, 2264 .ver_major = 0x3,
2245 .ver_minor = 0x4, 2265 .ver_minor = 0x7,
2246 .ver_fix = 0x3, 2266 .ver_fix = 0x1,
2247 2267
2248 .start_addr = 0x0800006c, 2268 .start_addr = 0x0800006c,
2249 2269
2250 .text_addr = 0x08000000, 2270 .text_addr = 0x08000000,
2251 .text_len = 0x6ee8, 2271 .text_len = 0x6fd0,
2252 .text_index = 0x0, 2272 .text_index = 0x0,
2253 .gz_text = bnx2_CP_b09FwText, 2273 .gz_text = bnx2_CP_b09FwText,
2254 .gz_text_len = sizeof(bnx2_CP_b09FwText), 2274 .gz_text_len = sizeof(bnx2_CP_b09FwText),
2255 2275
2256 .data_addr = 0x08007020, 2276 .data_addr = 0x08007100,
2257 .data_len = 0x0, 2277 .data_len = 0x0,
2258 .data_index = 0x0, 2278 .data_index = 0x0,
2259 .data = bnx2_CP_b09FwData, 2279 .data = bnx2_CP_b09FwData,
2260 2280
2261 .sbss_addr = 0x08007024, 2281 .sbss_addr = 0x08007104,
2262 .sbss_len = 0xa1, 2282 .sbss_len = 0xa9,
2263 .sbss_index = 0x0, 2283 .sbss_index = 0x0,
2264 2284
2265 .bss_addr = 0x080070d0, 2285 .bss_addr = 0x080071b0,
2266 .bss_len = 0x3b0, 2286 .bss_len = 0x3b0,
2267 .bss_index = 0x0, 2287 .bss_index = 0x0,
2268 2288
2269 .rodata_addr = 0x08006ee8, 2289 .rodata_addr = 0x08006fd0,
2270 .rodata_len = 0x118, 2290 .rodata_len = 0x118,
2271 .rodata_index = 0x0, 2291 .rodata_index = 0x0,
2272 .rodata = bnx2_CP_b09FwRodata, 2292 .rodata = bnx2_CP_b09FwRodata,
2273}; 2293};
2274 2294
2275static u8 bnx2_RXP_b09FwText[] = { 2295static u8 bnx2_RXP_b09FwText[] = {
2276/* 0x1f, 0x8b, 0x08, 0x00, 0x0e, 0x34, 0xe7, 0x45, 0x00, 0x03, */ 2296 0xec, 0x5c, 0x7d, 0x6c, 0x1c, 0xc7, 0x75, 0x7f, 0x3b, 0xbb, 0xa4, 0x8e,
2277 0xec, 0x5c, 2297 0xd4, 0x91, 0x5c, 0x1e, 0x4f, 0xcc, 0x51, 0xa6, 0xed, 0x5b, 0x71, 0x25,
2278 0x5d, 0x6c, 0x1c, 0xd7, 0x75, 0x3e, 0xf3, 0x43, 0x6a, 0x49, 0xf1, 0x67, 2298 0x9e, 0x4d, 0xc6, 0x59, 0xd1, 0x07, 0x9b, 0x28, 0x0e, 0xc9, 0x66, 0xef,
2279 0xb8, 0x5c, 0xb1, 0x2b, 0x99, 0x96, 0x77, 0xc9, 0x91, 0xc8, 0x58, 0x8a, 2299 0x24, 0xb1, 0x86, 0x5b, 0x53, 0x35, 0x1d, 0x1b, 0x6d, 0xea, 0xb2, 0x47,
2280 0x31, 0xa2, 0x09, 0x5b, 0x48, 0x17, 0xf6, 0x76, 0x76, 0x25, 0xb1, 0xb1, 2300 0xb5, 0x29, 0x8c, 0x06, 0x90, 0xbf, 0x00, 0x17, 0xa8, 0xe4, 0xcb, 0x91,
2281 0x03, 0x53, 0xb6, 0x62, 0x07, 0x45, 0x6a, 0xb0, 0x4b, 0xb9, 0x0e, 0x8c, 2301 0x8a, 0x55, 0xf7, 0xc0, 0xbd, 0xc8, 0x8c, 0x18, 0x20, 0x6e, 0x7d, 0x25,
2282 0x06, 0x90, 0xff, 0x52, 0xbf, 0xb0, 0xde, 0x2c, 0xa9, 0x58, 0x4d, 0x17, 2302 0x29, 0x4a, 0x08, 0x0e, 0x3a, 0xa6, 0x71, 0x1a, 0xfd, 0x61, 0xd7, 0x04,
2283 0x9c, 0xb5, 0x4d, 0x9b, 0x0e, 0x60, 0xb7, 0x0b, 0x92, 0x12, 0xf5, 0xb0, 2303 0x2b, 0x1b, 0x6e, 0x91, 0xd6, 0x72, 0xe3, 0xb6, 0x46, 0x50, 0x04, 0x84,
2284 0xd0, 0xb2, 0xa9, 0xdb, 0xea, 0xc1, 0x8e, 0x09, 0x56, 0xb1, 0x53, 0xa0, 2304 0xec, 0x34, 0x6e, 0xd0, 0x0f, 0xa1, 0x2e, 0x6c, 0x03, 0x96, 0xbd, 0xfd,
2285 0x2d, 0x5c, 0x27, 0x69, 0xfc, 0x10, 0x14, 0xaa, 0xec, 0xc4, 0x42, 0xd1, 2305 0xbd, 0xd9, 0x5d, 0xf2, 0x48, 0x5b, 0x76, 0xd0, 0x3f, 0xfa, 0x4f, 0x77,
2286 0xa2, 0x02, 0x12, 0xd8, 0x29, 0x22, 0x7b, 0xfa, 0x7d, 0x77, 0x66, 0xc8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 0x5a, 0x23,
2301 0xac, 0xbd, 0x12, 0xeb, 0xc7, 0x9a, 0x17, 0x87, 0xfe, 0xa9, 0x4b, 0xba, 2321 0x8d, 0x56, 0x75, 0x7f, 0xc5, 0x72, 0x45, 0x61, 0x3a, 0x54, 0xae, 0xc7,
2302 0x22, 0x5c, 0x22, 0x0b, 0xe5, 0xb4, 0x73, 0x18, 0xcf, 0x33, 0xb5, 0x7d, 2322 0x68, 0x5d, 0xfe, 0x3b, 0x0f, 0xac, 0x69, 0x72, 0xff, 0x82, 0xe2, 0x34,
2303 0xce, 0x9a, 0x98, 0xb2, 0x6a, 0x05, 0x3b, 0x96, 0xca, 0x1a, 0xf1, 0x48, 2323 0x3c, 0xef, 0x8c, 0xe5, 0x79, 0x2f, 0xe1, 0xf7, 0x33, 0x0b, 0x63, 0xf7,
2304 0xa9, 0x16, 0x93, 0x8b, 0xea, 0xdf, 0x79, 0x60, 0x4f, 0x9b, 0xfd, 0xf3, 2324 0x43, 0xcf, 0xd6, 0x54, 0x12, 0xe6, 0x1f, 0x2b, 0xce, 0x62, 0x2b, 0x95,
2305 0x9a, 0x5b, 0xf7, 0xfd, 0xd3, 0x8e, 0xef, 0xbf, 0x8e, 0xdf, 0x7b, 0x0e, 2325 0xe7, 0x89, 0xa6, 0xdd, 0x18, 0x9d, 0x74, 0x4b, 0x4a, 0xa1, 0x51, 0x51,
2306 0xc6, 0xde, 0x47, 0x7e, 0xd6, 0x34, 0x44, 0xb7, 0xff, 0x4c, 0x73, 0x17, 2326 0x0e, 0x9c, 0x9d, 0x55, 0x0e, 0x9e, 0x3d, 0xa9, 0x1c, 0x3a, 0x5b, 0x55,
2307 0x5b, 0xa5, 0x34, 0x2f, 0x32, 0xed, 0xc5, 0xe4, 0x94, 0x57, 0xd4, 0xf2, 2327 0x9c, 0xb3, 0x54, 0x12, 0xfb, 0xe3, 0x64, 0xeb, 0xe7, 0x94, 0x7c, 0xa3,
2308 0xf5, 0xb2, 0x76, 0x68, 0x79, 0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x5a, 0x6e, 2335 0xec, 0x7d, 0xc6, 0x4d, 0x93, 0xc8, 0x91, 0xed, 0x64, 0xfb, 0xe9, 0x85,
2316 0x28, 0xa2, 0x4f, 0x52, 0xa4, 0xbf, 0xb0, 0xa4, 0x83, 0xce, 0xed, 0x52, 2336 0x46, 0x8a, 0xfe, 0xbc, 0x61, 0xa6, 0xca, 0xb4, 0x83, 0x8a, 0xc9, 0x24,
2317 0xa8, 0x5a, 0x32, 0xb1, 0xb4, 0x15, 0xfe, 0xa2, 0xff, 0xea, 0x50, 0x42, 2337 0x7d, 0x17, 0x38, 0xd3, 0x58, 0x5b, 0x98, 0xa6, 0x5e, 0x06, 0x6c, 0xb9,
2318 0xfe, 0xb2, 0x9e, 0x3e, 0x55, 0x04, 0x2f, 0x66, 0xbc, 0x94, 0x80, 0xcf, 2338 0xf1, 0x23, 0xfe, 0xb7, 0x31, 0xfa, 0x54, 0x56, 0xe2, 0x94, 0xc0, 0x67,
2319 0x59, 0x77, 0xb4, 0x5f, 0x5e, 0xab, 0x27, 0xe5, 0xbb, 0x75, 0x3b, 0x59, 2339 0x00, 0xcb, 0x7c, 0x4b, 0x58, 0xc9, 0xbb, 0x0f, 0x4b, 0xa5, 0xa9, 0x2c,
2320 0x92, 0x6d, 0x52, 0x48, 0x58, 0xb2, 0x82, 0x35, 0xd3, 0xa0, 0x43, 0xb7, 2340 0xe6, 0x1a, 0x4e, 0x20, 0xfb, 0x56, 0xec, 0x8f, 0x9f, 0x37, 0x28, 0xf9,
2321 0x6d, 0xab, 0x04, 0xd8, 0x52, 0xfd, 0x27, 0xfc, 0xb7, 0x32, 0xd6, 0xe4, 2341 0xf9, 0x1b, 0x20, 0x03, 0x4a, 0x0a, 0xda, 0x9b, 0x2a, 0x62, 0x66, 0xba,
2322 0xa8, 0x5a, 0x53, 0x04, 0xdd, 0x21, 0x2c, 0xcf, 0xa1, 0x60, 0xd5, 0x59, 2342 0x11, 0xc7, 0x98, 0x79, 0xf1, 0xbc, 0x43, 0x16, 0xe9, 0x65, 0xab, 0x0b,
2323 0x02, 0x58, 0x29, 0x4e, 0x8e, 0x62, 0xae, 0xfe, 0x85, 0x50, 0x16, 0xad, 2343 0xb2, 0x4a, 0x53, 0xd9, 0xea, 0x04, 0x4e, 0x0b, 0x75, 0x9b, 0xbc, 0x07,
2324 0x38, 0x2f, 0x9f, 0xbb, 0x71, 0xbe, 0xdd, 0xe0, 0x89, 0x24, 0x74, 0xd9, 2344 0xa6, 0xdb, 0x86, 0x79, 0xaf, 0x43, 0xcd, 0x79, 0xde, 0x54, 0x96, 0x3a,
2325 0x93, 0x2c, 0x60, 0x66, 0xba, 0xde, 0x81, 0x31, 0x69, 0xf1, 0xfd, 0x23, 2345 0xfd, 0xb9, 0x21, 0xd0, 0xd0, 0x68, 0x72, 0x5c, 0x01, 0xdc, 0xdb, 0xcc,
2326 0x8e, 0x58, 0x25, 0xa7, 0x1b, 0xbc, 0x4b, 0x49, 0xc9, 0xe9, 0xc2, 0x9a, 2346 0x5f, 0x2c, 0x91, 0xe3, 0x3e, 0x3f, 0xb3, 0xe4, 0xcc, 0xa6, 0x83, 0x75,
2327 0x16, 0xb1, 0x6c, 0x9e, 0x81, 0x78, 0xdb, 0x30, 0xef, 0x77, 0x1a, 0x19, 2347 0xe3, 0x54, 0x76, 0xaf, 0x0f, 0xfa, 0x90, 0xad, 0x8b, 0x3d, 0x5b, 0x7d,
2328 0xdf, 0x9f, 0x1c, 0x95, 0xae, 0x60, 0x6e, 0x1f, 0x70, 0x98, 0x32, 0x31, 2348 0x18, 0x2b, 0x37, 0x82, 0x8e, 0x55, 0x26, 0x5e, 0x63, 0x17, 0xad, 0x25,
2329 0xae, 0x01, 0xee, 0x03, 0xd2, 0x17, 0x8b, 0x67, 0xd8, 0xe7, 0x73, 0x54, 2349 0x49, 0x5c, 0xb6, 0x7a, 0x02, 0xb8, 0x4e, 0xf0, 0x1a, 0x9e, 0x71, 0x3b,
2330 0xdc, 0xd9, 0x54, 0xb8, 0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, 2357 0xcb, 0xc7, 0xe9, 0x0e, 0xf8, 0x61, 0xdd, 0x61, 0xbd, 0x11, 0x76, 0x61,
2338 0x2d, 0x70, 0xde, 0xee, 0xd2, 0x0e, 0x03, 0x57, 0x8b, 0xfd, 0xad, 0x0e, 2358 0xee, 0x8f, 0x7a, 0xca, 0xc3, 0x3b, 0x19, 0x06, 0xf6, 0x60, 0x3f, 0x30,
2339 0xe9, 0x32, 0x64, 0x9b, 0x1d, 0xc1, 0xc6, 0xe4, 0x5b, 0xa0, 0x6d, 0xcd, 2359 0x65, 0x3a, 0xdd, 0x1a, 0x95, 0x74, 0x41, 0x86, 0x9e, 0xa7, 0x1b, 0x69,
2340 0x49, 0x00, 0x4e, 0xba, 0x83, 0x35, 0x3d, 0x21, 0x3d, 0xd4, 0x25, 0xea, 2360 0xc6, 0x22, 0xca, 0x43, 0x9f, 0x85, 0xa9, 0x41, 0x46, 0x26, 0x64, 0xb4,
2341 0x91, 0x9e, 0xcd, 0xcf, 0xfd, 0x69, 0x6f, 0x69, 0xff, 0x76, 0xc2, 0xc0, 2361 0xb7, 0xa4, 0x8a, 0x7b, 0x41, 0xa2, 0xa4, 0x68, 0x81, 0x3c, 0x17, 0xe8,
2342 0x3e, 0x52, 0x0f, 0x4d, 0xda, 0x6e, 0x8f, 0x29, 0x45, 0x4b, 0x97, 0xb4, 2362 0x0e, 0x89, 0x2f, 0x72, 0x16, 0x74, 0xb0, 0x9d, 0xfb, 0x58, 0x37, 0x26,
2343 0x95, 0x93, 0x1b, 0x64, 0xc6, 0x11, 0xc9, 0x41, 0xbf, 0x75, 0xdb, 0x04, 2363 0xd7, 0x55, 0x73, 0x66, 0x6a, 0x91, 0x48, 0x11, 0xb9, 0x21, 0xd0, 0x63,
2344 0x8f, 0x6c, 0xf0, 0x68, 0xcf, 0xa9, 0x41, 0xfd, 0x0e, 0x49, 0xf5, 0x15, 2364 0xdd, 0x64, 0x38, 0x17, 0x3c, 0x32, 0xef, 0xdc, 0x37, 0x81, 0x13, 0x23,
2345 0x35, 0x33, 0xe4, 0xe7, 0x82, 0xdc, 0xa6, 0xd6, 0xeb, 0x19, 0x07, 0x3a, 2365 0xc7, 0xea, 0x68, 0xe2, 0x13, 0xfc, 0x24, 0x59, 0xe6, 0x2c, 0x43, 0xb9,
2346 0xd9, 0xce, 0x3e, 0xf6, 0x8d, 0xa9, 0x7d, 0x8d, 0x8c, 0x9d, 0x5c, 0x14, 2366 0x4f, 0x65, 0x73, 0x9f, 0xef, 0x7b, 0x83, 0x23, 0x1a, 0xbd, 0x24, 0xf7,
2347 0xd1, 0xf4, 0xcc, 0x3e, 0xe0, 0xa3, 0xae, 0x12, 0xee, 0x29, 0xd0, 0x48, 2367 0xcb, 0x76, 0xc4, 0x70, 0x72, 0x8f, 0xc4, 0xf2, 0x99, 0x76, 0x49, 0x29,
2348 0xda, 0xd9, 0xb7, 0xb1, 0x26, 0x26, 0xae, 0xd3, 0xd9, 0x40, 0x27, 0xe8, 2368 0x5a, 0xfa, 0x06, 0x2d, 0xe8, 0x85, 0x50, 0x73, 0x71, 0xca, 0x4b, 0xfe,
2349 0x49, 0x90, 0xe7, 0xe4, 0xa1, 0x3a, 0xa7, 0xb6, 0x71, 0xce, 0x5f, 0xfb, 2369 0x46, 0xb1, 0x16, 0xdb, 0x17, 0xec, 0xc4, 0xe4, 0xbd, 0xf0, 0x5c, 0x0e,
2350 0xdb, 0x46, 0x4c, 0x79, 0x5d, 0x9d, 0x97, 0x76, 0x45, 0x38, 0x75, 0x46, 2370 0xb6, 0x6a, 0x48, 0xfd, 0x29, 0x56, 0xd9, 0xfe, 0x99, 0xb7, 0x55, 0x43,
2351 0x21, 0x7f, 0xa6, 0x3d, 0xd1, 0x0a, 0x8e, 0xb5, 0x8e, 0x0b, 0x7a, 0xa1, 2371 0x50, 0x48, 0x4f, 0xf4, 0xaa, 0xd4, 0x45, 0xe3, 0xd6, 0x55, 0x4f, 0xec,
2352 0x1b, 0x99, 0x0e, 0xc9, 0x29, 0xfa, 0x0e, 0x62, 0x2f, 0xda, 0x1b, 0xec, 2372 0xc3, 0xfb, 0xe1, 0x14, 0x78, 0x33, 0xd2, 0xb0, 0xb6, 0x84, 0x4a, 0xb0,
2353 0xc6, 0xe6, 0x59, 0x38, 0x97, 0x81, 0xed, 0xa6, 0x95, 0xfe, 0x14, 0x2a, 2373 0x73, 0x6b, 0x28, 0xa5, 0x93, 0x89, 0xbd, 0x25, 0xc8, 0x1e, 0x5f, 0x85,
2354 0xf4, 0x07, 0xa4, 0x6d, 0x35, 0xad, 0x4b, 0x80, 0xaf, 0xf4, 0x6c, 0x37, 2374 0xe0, 0xaf, 0xc5, 0xa7, 0x4f, 0x17, 0x6c, 0xda, 0x0e, 0x78, 0x74, 0xac,
2355 0x68, 0xe3, 0x18, 0xb6, 0x67, 0xe3, 0xfd, 0x7e, 0xd8, 0xfa, 0xc1, 0x41, 2375 0x5b, 0xa5, 0xcc, 0x74, 0xec, 0x5f, 0x9d, 0x65, 0xf9, 0xb6, 0x43, 0xff,
2356 0xf0, 0x87, 0x70, 0x76, 0x0a, 0xf2, 0xce, 0xba, 0xd8, 0xd3, 0x75, 0x6e, 2376 0x15, 0x2a, 0x5a, 0x4c, 0x3b, 0xa4, 0x21, 0x68, 0xf0, 0xb6, 0x66, 0x1a,
2357 0x56, 0x3c, 0xe8, 0xc1, 0x79, 0x06, 0x67, 0xc9, 0xaf, 0x76, 0xe8, 0xb3, 2377 0xe1, 0xd9, 0xb2, 0xfe, 0x6a, 0x34, 0x32, 0xc2, 0xb0, 0x0c, 0xc7, 0xf0,
2358 0x26, 0x05, 0x27, 0x9d, 0xa2, 0xfc, 0x03, 0xda, 0x75, 0xd9, 0x76, 0x4b, 2378 0xc6, 0x68, 0x5a, 0xbc, 0xef, 0xed, 0xdf, 0xb2, 0xa6, 0x49, 0x62, 0x16,
2359 0x23, 0xed, 0x91, 0xac, 0xa8, 0x8f, 0xa6, 0xc4, 0x47, 0x08, 0x4b, 0x38, 2379 0x3c, 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c0, 0x82, 0x25, 0xf6, 0x99, 0x80, 0xc6, 0x81, 0x73, 2394 0x14, 0x98, 0x16, 0xe6, 0xb6, 0xcb, 0xc2, 0xf3, 0x66, 0x2c, 0xb6, 0x4f,
2375 0x91, 0x3f, 0x6c, 0x01, 0x3e, 0xd0, 0xe7, 0x6d, 0xc4, 0x09, 0x91, 0xf7, 2395 0xbd, 0xd9, 0x3e, 0xf7, 0xc3, 0x3e, 0xad, 0x56, 0x32, 0xac, 0xbf, 0x82,
2376 0x34, 0x98, 0x0a, 0xe6, 0xb6, 0xf2, 0x82, 0x3e, 0x98, 0xf6, 0x66, 0x35, 2396 0x7d, 0x3e, 0x61, 0x29, 0x90, 0x0d, 0xd1, 0xc5, 0x4a, 0x1c, 0xbe, 0x41,
2377 0xda, 0xdb, 0x01, 0xd8, 0x9b, 0xd3, 0x2a, 0x69, 0xe7, 0xef, 0x60, 0x6f, 2397 0x4b, 0xbd, 0x41, 0x7b, 0xd3, 0xd3, 0xd0, 0xcb, 0x33, 0x3c, 0x87, 0x23,
2378 0x4f, 0x39, 0x1a, 0x78, 0x23, 0x72, 0xa1, 0xdc, 0x01, 0x5b, 0x37, 0x93, 2398 0x3a, 0x21, 0xfd, 0xb5, 0xef, 0x0f, 0xd6, 0xd5, 0x6f, 0x80, 0x2f, 0xcf,
2379 0xef, 0xc8, 0x9e, 0xd4, 0xb4, 0x68, 0x72, 0x9a, 0x73, 0x35, 0xcc, 0x29, 2399 0x9b, 0x06, 0xcd, 0xe2, 0xb0, 0x1a, 0xd8, 0x62, 0x38, 0x6f, 0x23, 0x26,
2380 0xff, 0x1b, 0xd8, 0xf7, 0x45, 0xe3, 0x69, 0xd0, 0xe5, 0xfb, 0xd3, 0xc0, 2400 0x3a, 0x37, 0xa9, 0x54, 0xca, 0xb4, 0x90, 0x91, 0x59, 0x00, 0xed, 0x29,
2381 0x59, 0xd8, 0x6f, 0x84, 0xb6, 0x15, 0xcd, 0xa7, 0x10, 0xf3, 0xdc, 0xc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0x73, 0xdd, 0x5d, 0x81,
2418 0xdc, 0xa2, 0x00, 0xbb, 0x31, 0x33, 0x57, 0x64, 0x46, 0xf9, 0x48, 0x89, 2438 0x1e, 0x06, 0x3e, 0x5e, 0xfa, 0x5d, 0xc0, 0xbe, 0xb5, 0x0d, 0xf6, 0xcd,
2419 0xb5, 0x64, 0x9e, 0x00, 0xcc, 0x7f, 0xc0, 0xe6, 0xda, 0xba, 0x43, 0x3d, 2439 0x66, 0x58, 0xbc, 0x5f, 0xdf, 0xf6, 0xfe, 0x9f, 0xd9, 0x7e, 0xf1, 0x6e,
2420 0x0c, 0x7d, 0xbc, 0xf2, 0xbb, 0x80, 0xbd, 0xbc, 0x05, 0xf6, 0xdd, 0x46, 2440 0x15, 0xfe, 0xb4, 0x35, 0xb0, 0xfd, 0x8b, 0x54, 0x84, 0x6f, 0xd5, 0x4c,
2421 0x58, 0xbc, 0xbf, 0xb8, 0xe5, 0xfd, 0x4f, 0x69, 0xbf, 0x78, 0xb7, 0x0a, 2441 0xce, 0x2d, 0x0f, 0x02, 0x17, 0xe3, 0x3a, 0x78, 0x84, 0xbf, 0x40, 0x8c,
2422 0x7f, 0xda, 0x1a, 0xda, 0xfe, 0x05, 0x29, 0xc0, 0xb7, 0x9a, 0x36, 0x73, 2442 0x85, 0xbc, 0x11, 0x13, 0x92, 0x37, 0x72, 0x3e, 0x05, 0xd8, 0x34, 0x60,
2423 0xc7, 0xdb, 0xb0, 0x16, 0xe3, 0x1a, 0x68, 0x84, 0xbf, 0x40, 0xcc, 0x04, 2443 0xd9, 0xff, 0x32, 0xec, 0x85, 0x38, 0xcb, 0xbc, 0x58, 0x67, 0x1c, 0xf6,
2424 0xbf, 0x11, 0x13, 0x12, 0x37, 0x30, 0x3f, 0xa2, 0x9f, 0x00, 0x2c, 0xfd, 2444 0x55, 0xe4, 0x39, 0xd9, 0x36, 0x68, 0x94, 0xf7, 0x82, 0x6a, 0x86, 0xb0,
2425 0x2f, 0x61, 0x5f, 0xe9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6, 0x0b, 0x0d, 0xc8, 0x6e, 0x23,
2440 0xfa, 0xd2, 0x48, 0xc3, 0x7a, 0x5d, 0x51, 0xd1, 0x91, 0x93, 0xba, 0xa3, 2460 0xae, 0x6e, 0xc0, 0x94, 0x36, 0x61, 0xfc, 0xb8, 0x53, 0x68, 0x78, 0xc8,
2441 0x7b, 0x90, 0x77, 0xa4, 0x24, 0x5f, 0x07, 0xef, 0xd6, 0xe3, 0xea, 0x3a, 2461 0xfb, 0x9a, 0x63, 0x70, 0x06, 0xfd, 0x12, 0xf6, 0xba, 0x42, 0x53, 0xee,
2442 0x4c, 0x71, 0x03, 0x26, 0x88, 0x3b, 0xf9, 0xba, 0x8f, 0x3c, 0xae, 0x31, 2462 0x9a, 0x2d, 0xcc, 0x93, 0x32, 0x6f, 0x15, 0xe6, 0x93, 0x4a, 0x61, 0x91,
2443 0x06, 0x0f, 0xa3, 0x5f, 0xc4, 0x59, 0x57, 0x64, 0xd2, 0x5b, 0xcb, 0xea, 2463 0x73, 0xda, 0x18, 0xfa, 0xb2, 0x3e, 0x41, 0x8c, 0x3b, 0xa5, 0xd8, 0x67,
2444 0xf6, 0xa9, 0x20, 0x0f, 0xb5, 0xbf, 0xad, 0xe5, 0x17, 0x99, 0xa3, 0xc6, 2464 0xe7, 0x90, 0xcf, 0x2e, 0xe1, 0x77, 0x0e, 0xbf, 0x3a, 0x7e, 0x61, 0xdd,
2445 0xd0, 0x57, 0xf5, 0x07, 0x62, 0xdc, 0x33, 0x5a, 0x76, 0x79, 0x0e, 0xf9, 2465 0xf0, 0x2d, 0xd4, 0x1d, 0xd2, 0xdf, 0x23, 0x36, 0xf9, 0xeb, 0xff, 0x74,
2446 0xe9, 0x12, 0x7e, 0x67, 0xf1, 0xab, 0xe1, 0x17, 0xd5, 0x01, 0x2f, 0xa0, 2466 0x09, 0xf9, 0xf4, 0x5c, 0x92, 0x9e, 0x30, 0x45, 0x8f, 0xf0, 0x7d, 0x9c,
2447 0x8e, 0x50, 0xf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, 0x39, 0x4f, 0xa9, 0x47, 0xc7, 0x66, 0x4c, 0x3e, 0x57,
2462 0xb4, 0x28, 0xa6, 0xd2, 0x4f, 0xe7, 0x61, 0xab, 0x1c, 0x8f, 0x8b, 0x92, 2482 0x9d, 0xa6, 0x2b, 0xe1, 0xb9, 0xf2, 0x19, 0xa1, 0x0e, 0xad, 0x3e, 0x89,
2463 0xc1, 0x26, 0x79, 0x52, 0x8f, 0x56, 0xa7, 0x66, 0x6c, 0xca, 0xd5, 0x92, 2483 0x73, 0x15, 0x41, 0xcd, 0x02, 0x3f, 0x30, 0xc7, 0xe7, 0x8b, 0x3a, 0xb2,
2464 0xe9, 0x72, 0x24, 0x57, 0xca, 0x08, 0x75, 0x66, 0xe5, 0xdb, 0x90, 0xab, 2484 0x8a, 0x3c, 0xac, 0x4a, 0x09, 0xbf, 0xe6, 0x3a, 0x85, 0x3a, 0x05, 0xe7,
2465 0x1e, 0xd6, 0x20, 0xf0, 0x03, 0x73, 0x94, 0x2f, 0xea, 0xc4, 0x0a, 0xf2, 2485 0x57, 0x99, 0x03, 0x8d, 0x24, 0x9e, 0x4b, 0x78, 0xa6, 0xf0, 0x3c, 0x87,
2466 0xb0, 0x8a, 0xc4, 0x83, 0x1a, 0xea, 0x19, 0xd4, 0x1d, 0x90, 0x5f, 0x79, 2486 0x67, 0x3f, 0x9e, 0x75, 0xb6, 0x8f, 0x20, 0xef, 0xf9, 0x08, 0x3f, 0xb0,
2467 0x0e, 0x38, 0x12, 0x78, 0x2e, 0xe1, 0x99, 0xc4, 0xf3, 0x2c, 0x9e, 0xfd, 2487 0x93, 0x02, 0xdb, 0x34, 0xfd, 0x65, 0x23, 0x47, 0x3f, 0x68, 0x8c, 0xd2,
2468 0x78, 0xd6, 0x68, 0x1f, 0x61, 0xde, 0xf3, 0x31, 0x7a, 0x60, 0x27, 0x79, 2488 0x5f, 0x34, 0xb2, 0xf4, 0xfd, 0x86, 0x45, 0xcf, 0x36, 0x86, 0xe9, 0x7b,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0x69, 0x2a, 0xb9, 0x5c, 0x1a, 0x21, 0x7f, 2525 0x59, 0xae, 0x2f, 0x0f, 0x51, 0x39, 0xb1, 0x7e, 0x6c, 0xca, 0x44, 0x4d,
2506 0x6f, 0xef, 0x61, 0x2c, 0x37, 0x32, 0x2f, 0x85, 0x79, 0x46, 0x4c, 0x7e, 2526 0x8f, 0x38, 0x50, 0xde, 0x37, 0xe0, 0xeb, 0x55, 0x3f, 0xe3, 0x3c, 0x27,
2507 0x8c, 0xba, 0x6b, 0x12, 0xfe, 0x7f, 0x61, 0xef, 0x20, 0x68, 0x40, 0x7d, 2527 0xcf, 0xa4, 0x2c, 0x5a, 0xe9, 0x8b, 0x5a, 0x1a, 0xf8, 0x3c, 0x77, 0x29,
2508 0x9a, 0x54, 0xf1, 0x7c, 0xca, 0x05, 0x8e, 0x9c, 0xc2, 0xfd, 0xa6, 0x2c, 2528 0x38, 0xcf, 0x6f, 0x83, 0x1f, 0xf4, 0xeb, 0x3d, 0x81, 0xff, 0x4b, 0x40,
2509 0x01, 0xf7, 0x38, 0xf9, 0x00, 0xdc, 0x33, 0x9c, 0x57, 0x32, 0xc0, 0x7c, 2529 0x57, 0x87, 0xf4, 0xc3, 0x14, 0x0b, 0xfc, 0x5f, 0x82, 0x5e, 0x3d, 0xad,
2510 0x2d, 0x05, 0xbc, 0xbd, 0xa1, 0xff, 0x8b, 0x43, 0x57, 0xf7, 0x59, 0x77, 2530 0x42, 0x87, 0x58, 0x7f, 0xfa, 0xbb, 0x37, 0xf5, 0x87, 0xdf, 0xad, 0x1f,
2511 0x4b, 0x2c, 0xf4, 0x7f, 0x71, 0x79, 0xeb, 0x79, 0xe8, 0x7d, 0x9c, 0xfa, 2531 0x73, 0xc0, 0x63, 0x7e, 0xae, 0x95, 0x0a, 0xd5, 0x18, 0x4d, 0x65, 0x91,
2512 0x93, 0xe8, 0xd9, 0xd0, 0x9f, 0x46, 0xfc, 0xad, 0x92, 0xaf, 0xc4, 0x80, 2532 0x73, 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xe8, 0xf2, 0x1a, 0x2c,
2520 0xd1, 0x96, 0x87, 0x88, 0x1f, 0x74, 0x24, 0x12, 0xb2, 0xe8, 0x71, 0x8f, 2540 0x17, 0xf8, 0xba, 0x39, 0x9d, 0x1e, 0x96, 0xe7, 0xc7, 0xba, 0xc5, 0xf7,
2521 0xd5, 0x29, 0xf2, 0xb2, 0x30, 0x67, 0xc9, 0x09, 0x25, 0x3f, 0x9e, 0x9b, 2541 0x4d, 0x2a, 0xe5, 0x13, 0x03, 0xfa, 0x43, 0x64, 0x5c, 0x59, 0x53, 0x8d,
2522 0xf7, 0x47, 0x86, 0x4c, 0xc6, 0x07, 0xad, 0x47, 0x25, 0x7d, 0x65, 0xcd, 2542 0xea, 0x24, 0xe2, 0xea, 0xc2, 0xbc, 0x4a, 0x7b, 0x64, 0x1d, 0xc6, 0x67,
2523 0x48, 0xbf, 0x30, 0x81, 0xb8, 0xba, 0x30, 0x6f, 0x88, 0xab, 0xea, 0x30, 2543 0x64, 0x9c, 0x84, 0x35, 0x06, 0x7b, 0xff, 0x8d, 0xa6, 0xbd, 0x77, 0xd2,
2524 0xca, 0x28, 0x5d, 0x81, 0x35, 0x86, 0x67, 0xbf, 0xa7, 0xe1, 0xec, 0x5d, 2544 0xc5, 0xd3, 0x9f, 0x85, 0xdd, 0xb3, 0x5c, 0xb5, 0xf4, 0x11, 0xe4, 0x19,
2525 0x72, 0xe1, 0xf9, 0xcf, 0xc3, 0xee, 0x5f, 0x81, 0x2c, 0xcc, 0xd4, 0x71, 2545 0x73, 0x04, 0xf9, 0x22, 0x7f, 0xb6, 0x53, 0xe1, 0xb9, 0xb0, 0xbc, 0x77,
2526 0xe4, 0x19, 0xcf, 0xc9, 0xa0, 0x55, 0x42, 0xfe, 0x0c, 0xbe, 0xa3, 0xbd, 2546 0x49, 0xf9, 0x0b, 0x29, 0xff, 0x1b, 0xa8, 0xdc, 0xeb, 0xdb, 0x38, 0xbf,
2527 0xa2, 0x6c, 0x60, 0x41, 0x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0xd7, 0x18, 0x8f, 0x2c, 0xd9, 0xf2, 2576 0x87, 0xea, 0x86, 0x7e, 0x3f, 0x7c, 0x40, 0x71, 0xe3, 0x4e, 0xf7, 0x73,
2557 0x78, 0x6d, 0x58, 0x1e, 0xad, 0xa5, 0xad, 0xfb, 0xe1, 0x03, 0x0a, 0xeb, 2577 0x09, 0xae, 0x45, 0x34, 0xe4, 0x81, 0x2d, 0xa6, 0x9f, 0x17, 0x94, 0xb9,
2558 0x77, 0xb4, 0x43, 0x71, 0xfa, 0x2f, 0x13, 0x79, 0x60, 0x8b, 0x1d, 0xe4, 2578 0x66, 0x9b, 0x33, 0xf8, 0x1e, 0x47, 0xaf, 0xd1, 0xf6, 0xdc, 0xe1, 0xff,
2559 0x05, 0x25, 0xd6, 0x6c, 0x73, 0x69, 0xde, 0xe3, 0x58, 0x55, 0xd9, 0x9a, 2579 0x32, 0x6f, 0xe0, 0xf5, 0xd9, 0x5f, 0x23, 0x4f, 0x70, 0x91, 0x27, 0xb8,
2560 0x3b, 0xfc, 0x5f, 0xe6, 0x0d, 0xdc, 0x9f, 0xfe, 0x1a, 0x79, 0x82, 0x87, 2580 0xc8, 0x13, 0x5c, 0xe4, 0x09, 0x2e, 0xf2, 0x04, 0x17, 0x79, 0x82, 0x8b,
2561 0x3c, 0xc1, 0x43, 0x9e, 0xe0, 0x21, 0x4f, 0xf0, 0x90, 0x27, 0x78, 0xc8, 2581 0x3c, 0xc1, 0x45, 0x9e, 0x80, 0xd8, 0xed, 0xd7, 0x0b, 0x63, 0xc8, 0x7f,
2562 0x13, 0x3c, 0xe4, 0x09, 0x1e, 0xf2, 0x04, 0xc4, 0xee, 0xa0, 0x5e, 0x18, 2582 0xe1, 0xbf, 0xdc, 0xcf, 0x43, 0x4e, 0x7c, 0xdf, 0xc9, 0x31, 0x87, 0x63,
2563 0x43, 0xfe, 0x0b, 0xff, 0xe5, 0xdd, 0x06, 0x3e, 0xf1, 0xfe, 0x92, 0x31, 2583 0x33, 0xc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0xba, 0xcf, 0x43, 0xe0,
2571 0xc4, 0xdf, 0xe0, 0x1e, 0x50, 0x5f, 0x20, 0xff, 0x44, 0x7a, 0xce, 0x81, 2591 0xe7, 0x63, 0x94, 0x58, 0xde, 0x89, 0x39, 0x9d, 0x7a, 0xe4, 0x5d, 0x12,
2572 0xe1, 0xe7, 0x62, 0x12, 0x3f, 0xb3, 0x1d, 0x73, 0x96, 0xf4, 0xaa, 0xbb, 2592 0x8e, 0xf2, 0xbc, 0xd6, 0x43, 0xed, 0x26, 0x89, 0xf3, 0x7c, 0xe3, 0xc0,
2573 0x24, 0x88, 0xf2, 0xdc, 0x55, 0xc8, 0xcb, 0x16, 0xfd, 0x1c, 0x6f, 0x1c, 2593 0x74, 0xd9, 0xbf, 0x5e, 0x3a, 0x96, 0xaf, 0x5d, 0x92, 0x3a, 0x75, 0xb8,
2574 0x88, 0x97, 0xfe, 0x75, 0x65, 0x2a, 0x57, 0x5d, 0x51, 0x3a, 0x75, 0xb4, 2594 0x5e, 0x40, 0x7d, 0xd4, 0x07, 0x18, 0x0d, 0xb5, 0x55, 0x48, 0x9b, 0x69,
2575 0x96, 0x47, 0x7d, 0xd4, 0xd3, 0x2b, 0xed, 0x26, 0x6a, 0xab, 0x08, 0x37, 2595 0x5e, 0x4d, 0xc8, 0x9a, 0xe7, 0xfc, 0xc6, 0x79, 0xe2, 0xac, 0x79, 0x9d,
2576 0x71, 0xfe, 0x32, 0xae, 0x6a, 0x9e, 0x73, 0xeb, 0xf2, 0x84, 0xac, 0xb9, 2596 0x4b, 0xc7, 0xca, 0x55, 0x23, 0xc5, 0xb5, 0xb2, 0xad, 0x5f, 0x3a, 0x76,
2577 0xcf, 0xca, 0x54, 0xa9, 0x92, 0x4e, 0xb2, 0x56, 0xce, 0x5a, 0x2b, 0x53, 2597 0x02, 0x34, 0x16, 0x91, 0x1b, 0xa8, 0x72, 0xed, 0x4b, 0xc7, 0xa6, 0xab,
2578 0x27, 0x81, 0x63, 0x11, 0xb9, 0x81, 0xa1, 0xf6, 0x5e, 0x99, 0x9a, 0xae, 2598 0xfe, 0x7d, 0x96, 0xcf, 0x03, 0xe2, 0x60, 0xb6, 0x9d, 0xd4, 0x05, 0xff,
2579 0x04, 0xf7, 0x59, 0x01, 0x0d, 0x8c, 0x57, 0xed, 0x62, 0x2c, 0x04, 0xf7, 2599 0x5e, 0x4b, 0x48, 0x5c, 0xc6, 0x63, 0x7c, 0x0d, 0x78, 0x7c, 0x6e, 0x19,
2580 0x5a, 0xba, 0x5a, 0xcb, 0x75, 0x5c, 0x6f, 0x62, 0x1d, 0xe5, 0x36, 0x8c, 2600 0xe0, 0xf2, 0xd9, 0x31, 0x0f, 0x97, 0x8e, 0x95, 0x6a, 0xcd, 0x3c, 0x30,
2581 0xb5, 0x94, 0x1d, 0x69, 0x58, 0x99, 0x2a, 0x56, 0x1b, 0x69, 0x20, 0x1e, 2601 0x1d, 0xa6, 0x1b, 0xee, 0x87, 0xf7, 0x92, 0x20, 0xb1, 0xec, 0x79, 0xc5,
2582 0xe2, 0x8d, 0xce, 0xc3, 0xb3, 0xc4, 0x45, 0x3f, 0xe3, 0xfb, 0x85, 0x91, 2602 0x91, 0xfe, 0x20, 0xef, 0x3a, 0x81, 0xfc, 0x4e, 0x93, 0x7a, 0xee, 0x8f,
2583 0xfe, 0x30, 0xef, 0x3a, 0x89, 0xfc, 0xce, 0x0c, 0xf4, 0x5c, 0x8d, 0xbf, 2603 0xff, 0x4c, 0xc6, 0xa9, 0xb4, 0xe0, 0x79, 0x7e, 0xe2, 0x5d, 0xf6, 0x3b,
2584 0xa3, 0xe2, 0x54, 0x4a, 0xe7, 0x3c, 0x9f, 0x78, 0x37, 0xba, 0x80, 0x39, 2604 0x98, 0xc3, 0x78, 0x31, 0x84, 0x15, 0x01, 0x6c, 0x47, 0x93, 0x3c, 0x5b,
2585 0x8c, 0x17, 0x23, 0x58, 0x3d, 0x84, 0xed, 0x6c, 0xe0, 0x67, 0x4b, 0xb8, 2605 0x82, 0xf5, 0x98, 0x27, 0xde, 0xe7, 0xcf, 0xb1, 0x7f, 0x79, 0x07, 0xc7,
2586 0x1f, 0x69, 0xe2, 0x39, 0x2f, 0x61, 0x2f, 0xd2, 0x45, 0x98, 0x38, 0x68, 2606 0xf9, 0x18, 0xd6, 0xc5, 0x59, 0xba, 0xff, 0x5b, 0xd9, 0x37, 0xef, 0x89,
2587 0x83, 0x2c, 0xbd, 0xff, 0x2d, 0xef, 0x1b, 0xcf, 0x44, 0x9e, 0x9a, 0x58, 2607 0x65, 0xaa, 0x01, 0x87, 0xe1, 0x99, 0x46, 0x88, 0x83, 0x17, 0xe7, 0x7d,
2588 0x43, 0x78, 0xe2, 0x88, 0xd6, 0xe0, 0xc5, 0xb9, 0x60, 0x9d, 0xbe, 0x7e, 2608 0x3c, 0xb1, 0x71, 0xff, 0xf7, 0x49, 0xeb, 0x36, 0xf3, 0x1a, 0xae, 0x1f,
2589 0xff, 0xf7, 0x69, 0xfb, 0x36, 0xd2, 0x1a, 0xed, 0x1f, 0xe1, 0x19, 0x0e, 2609 0xd2, 0xc9, 0xf8, 0xe7, 0xb6, 0x81, 0x2f, 0xff, 0x4f, 0x31, 0x3c, 0xa1,
2590 0xe4, 0xb6, 0xbe, 0x5e, 0xfd, 0x9f, 0x61, 0x78, 0x42, 0x17, 0x3f, 0x76, 2610 0x8b, 0x1f, 0xb9, 0x47, 0xcd, 0x34, 0xd5, 0xa1, 0xe1, 0xfd, 0x05, 0xdf,
2591 0x8f, 0x3a, 0xdc, 0x50, 0x87, 0x46, 0xf7, 0x17, 0xbc, 0x0f, 0x60, 0x7d, 2611 0x07, 0x70, 0x7d, 0xcf, 0xdf, 0x1a, 0x9a, 0x6b, 0xc5, 0x67, 0x83, 0x58,
2592 0xcf, 0x6f, 0x07, 0x8d, 0xb5, 0xe2, 0xcb, 0x61, 0x2c, 0xdb, 0x29, 0x59, 2612 0xd6, 0x47, 0xb6, 0xc6, 0x75, 0xc3, 0x85, 0x60, 0xbc, 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, 0xbe, 0x0a, 0xff, 0xf1, 0x15, 2627 0xf8, 0x8f, 0xfb, 0xe0, 0x3f, 0x26, 0xe0, 0x3f, 0xc6, 0xe5, 0xdd, 0xd3,
2608 0xf8, 0x8f, 0x63, 0xf0, 0x1f, 0xe3, 0xea, 0xee, 0xe9, 0xa8, 0xb7, 0xf5, 2628 0x61, 0x77, 0xfb, 0x9d, 0x4a, 0xb8, 0x16, 0xb7, 0x9f, 0x12, 0x99, 0x25,
2609 0x4e, 0x25, 0xda, 0x8b, 0xed, 0x67, 0x22, 0x76, 0x11, 0x67, 0x1a, 0x93, 2629 0xec, 0x69, 0x8c, 0x6a, 0x0d, 0xae, 0x6f, 0x2c, 0x72, 0x46, 0xb9, 0xbe,
2610 0x6a, 0x9d, 0xf5, 0x8d, 0x23, 0xee, 0x41, 0xd6, 0x37, 0xc7, 0xb4, 0x09, 2630 0x99, 0x50, 0x26, 0x91, 0xbf, 0xdf, 0x3f, 0xcc, 0x75, 0x4f, 0x42, 0xc9,
2611 0xe4, 0xef, 0xf7, 0xef, 0x67, 0xdd, 0x13, 0xd7, 0x72, 0xaa, 0xee, 0x49, 2631 0xcb, 0xba, 0xc7, 0xb8, 0xe0, 0x20, 0x75, 0x43, 0xee, 0x87, 0x3d, 0x1b,
2612 0x9f, 0x77, 0x91, 0x22, 0x21, 0xf7, 0xc3, 0x99, 0xd3, 0x67, 0x73, 0xa0, 2632 0xe7, 0xf2, 0xe0, 0xc5, 0xcf, 0xf9, 0xba, 0x03, 0xbf, 0x17, 0xa7, 0xc5,
2613 0x25, 0xc8, 0xf9, 0x7a, 0x42, 0xbf, 0xd7, 0x21, 0x8b, 0xb3, 0xa8, 0x19, 2633 0x59, 0xd4, 0x0c, 0xee, 0x3f, 0x28, 0x45, 0xe9, 0x1b, 0x75, 0x8c, 0x51,
2614 0xbc, 0x1f, 0x6b, 0x05, 0xe5, 0x1b, 0x2d, 0x8c, 0x51, 0x2b, 0x7b, 0xff, 2634 0x2b, 0xbb, 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80, 0xfb, 0x49, 0xc5, 0xf7,
2622 0xa5, 0x1d, 0x81, 0x2f, 0x60, 0x3f, 0xa1, 0x05, 0xfe, 0xfd, 0x8f, 0x81, 2642 0xef, 0x8f, 0x83, 0x0e, 0x64, 0xed, 0x36, 0xd7, 0x70, 0x7a, 0x70, 0x97,
2623 0x07, 0xbc, 0xf6, 0x1a, 0x6b, 0x38, 0x2b, 0xbc, 0x4b, 0xb9, 0x32, 0xc5, 2643 0xa2, 0x1f, 0x9f, 0xe1, 0xb3, 0x96, 0xb4, 0xb9, 0xd6, 0xe3, 0xba, 0x2f,
2624 0xdc, 0xba, 0xa4, 0x70, 0xb3, 0xd6, 0x63, 0xdd, 0x17, 0xc5, 0x80, 0x08, 2644 0x8c, 0x01, 0x21, 0xad, 0xff, 0x48, 0xfa, 0x7c, 0xdf, 0x87, 0x9a, 0x8e,
2625 0xd7, 0xcf, 0x13, 0x01, 0xdd, 0xe3, 0xa8, 0xe9, 0x08, 0x13, 0x8d, 0x1b, 2645 0x61, 0xc2, 0x71, 0x73, 0xfd, 0x17, 0x0f, 0xee, 0xe1, 0x98, 0xd7, 0x58,
2626 0xeb, 0xbf, 0x8e, 0xf0, 0x1e, 0xee, 0x4a, 0x90, 0x57, 0x29, 0x7c, 0x66, 2646 0xc0, 0xab, 0x16, 0xd0, 0xfb, 0x77, 0xcf, 0xf7, 0x3d, 0x8c, 0xaf, 0x37,
2627 0x88, 0xef, 0x3f, 0xfd, 0xc0, 0xf7, 0x70, 0xbd, 0xd5, 0xb0, 0xfe, 0x3c, 2647 0xe1, 0x5f, 0x40, 0xae, 0xc7, 0x77, 0x26, 0xbb, 0xe5, 0x77, 0xc9, 0x77,
2628 0x72, 0x3d, 0xde, 0x99, 0xec, 0x52, 0xdf, 0x19, 0xdf, 0x9f, 0xed, 0x94, 2648 0x66, 0x3b, 0xe8, 0xed, 0x53, 0xc8, 0x59, 0x2d, 0x23, 0x73, 0x09, 0xb5,
2629 0x5f, 0x3c, 0xe3, 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, 0x38, 0xf3, 0x04, 2656 0xe7, 0x49, 0xd4, 0x5f, 0x47, 0x37, 0xea, 0x61, 0x5e, 0xe7, 0x56, 0x65,
2637 0xea, 0xaf, 0x13, 0xeb, 0xf5, 0x30, 0xf7, 0xb9, 0x59, 0x5b, 0x53, 0xb9, 2657 0x4d, 0xe6, 0xc6, 0xfb, 0x95, 0x52, 0xd2, 0xdf, 0xe3, 0xef, 0xc2, 0x5f,
2638 0xf1, 0x01, 0xad, 0x98, 0x08, 0xce, 0xf8, 0x87, 0xf0, 0x17, 0x86, 0xce, 2658 0xa8, 0x82, 0x71, 0xdf, 0x01, 0x6d, 0x85, 0x16, 0x4e, 0xa9, 0xf2, 0x0e,
2639 0xb5, 0xef, 0x03, 0xb7, 0x26, 0x0b, 0xcf, 0x18, 0xea, 0x0e, 0xb6, 0x30, 2659 0xb6, 0x38, 0xc2, 0x67, 0xcd, 0xcf, 0x8f, 0x93, 0x5d, 0xb8, 0xa7, 0x3f,
2640 0x42, 0x59, 0xf3, 0x79, 0x2d, 0xde, 0x45, 0x67, 0xfa, 0xf3, 0xf0, 0x4c, 2660 0x0d, 0xf6, 0x34, 0x16, 0xd4, 0xd3, 0xe1, 0x9e, 0x62, 0xf4, 0xe6, 0xac,
2641 0xd9, 0xb0, 0x9e, 0x8e, 0xce, 0x14, 0x93, 0x77, 0x67, 0x2d, 0xac, 0xfd, 2661 0x0e, 0xdc, 0x9b, 0x20, 0x8f, 0x02, 0x2d, 0x35, 0xd2, 0x9f, 0x42, 0xa7,
2642 0x1c, 0xf8, 0x91, 0x97, 0xa5, 0x7a, 0xea, 0x33, 0xf0, 0x94, 0x1b, 0x78, 2662 0xd2, 0x24, 0x1b, 0x6d, 0xdb, 0x19, 0x96, 0x36, 0x6b, 0xf8, 0xf1, 0x14,
2643 0x63, 0x6e, 0x91, 0x61, 0x71, 0xa3, 0x86, 0x1f, 0x4f, 0xc2, 0x0e, 0xbf, 2663 0xec, 0xf0, 0x78, 0x4f, 0x78, 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 0x2f, 0x4a, 0x7a, 0xf8, 2678 0x45, 0x32, 0x32, 0x27, 0x68, 0x48, 0x3f, 0x40, 0xaa, 0xfc, 0xd6, 0x97,
2659 0xa4, 0xec, 0xb3, 0x0e, 0xb1, 0x1e, 0xb3, 0x88, 0xc7, 0xbf, 0xbd, 0x25, 2679 0x16, 0xde, 0x17, 0x5a, 0x72, 0x9e, 0x77, 0x06, 0xbc, 0xbf, 0x28, 0xd7,
2660 0xe3, 0xfb, 0xa7, 0x41, 0xfb, 0xf7, 0xd5, 0x3e, 0x2f, 0x82, 0x7e, 0xf0, 2680 0x79, 0x1a, 0xfc, 0x43, 0x56, 0xb2, 0x26, 0x61, 0x5e, 0xf1, 0x4c, 0x32,
2661 0x4a, 0xd5, 0x24, 0xa4, 0x15, 0xcf, 0x04, 0xe9, 0x2d, 0xcb, 0xf1, 0xfa, 2681 0xbf, 0x15, 0x3a, 0xd2, 0xf8, 0x61, 0x70, 0x36, 0x8f, 0x90, 0xe3, 0xbe,
2662 0x85, 0x50, 0x36, 0x8f, 0x89, 0xeb, 0x5d, 0x36, 0x5c, 0xbb, 0x0c, 0xd8, 2682 0xa5, 0x3a, 0x66, 0x05, 0xb0, 0xdf, 0x09, 0x78, 0xcb, 0x81, 0x5f, 0xac,
2663 0x85, 0x90, 0xb6, 0x0c, 0xe8, 0xc5, 0xfe, 0xf5, 0xb7, 0x13, 0xf4, 0x0d, 2683 0xdf, 0x58, 0x4f, 0xb2, 0x6f, 0xe0, 0x33, 0x77, 0x90, 0x35, 0x3a, 0x23,
2664 0x94, 0xb9, 0x8b, 0xac, 0xd1, 0x1d, 0x41, 0x1e, 0x95, 0xf8, 0x24, 0x3f, 2684 0xc8, 0xa3, 0x92, 0xd7, 0xf2, 0x03, 0x09, 0xda, 0xea, 0x07, 0x18, 0x2f,
2665 0x10, 0x97, 0xcd, 0x7e, 0x80, 0xeb, 0xe2, 0xd7, 0xd0, 0x15, 0xd2, 0x51, 2685 0xf1, 0x31, 0xba, 0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, 0x2e, 0x62, 0xbe, 0x8b, 0x98, 0xef, 0x8e, 0x07, 0x79,
2695 0x30, 0x4f, 0x7b, 0x62, 0x3d, 0x4f, 0x5b, 0xa9, 0xf3, 0x3b, 0x94, 0xa2, 2715 0xda, 0x63, 0x1b, 0x79, 0xda, 0x4a, 0x83, 0xbf, 0x43, 0x49, 0x5e, 0x4a,
2696 0xa5, 0x58, 0x94, 0x20, 0xcf, 0x15, 0x9d, 0x39, 0x4d, 0x94, 0xe7, 0x5e, 2716 0x25, 0xf2, 0xf3, 0x5c, 0x12, 0x9c, 0xd3, 0x84, 0x79, 0xee, 0xc7, 0x7f,
2697 0xfb, 0x9b, 0x48, 0xb0, 0x8e, 0x39, 0x1e, 0xd7, 0x15, 0x35, 0xdd, 0xe6, 2717 0x13, 0xf1, 0xf1, 0x38, 0xc7, 0x63, 0xbc, 0x92, 0x22, 0x4c, 0xc6, 0xf3,
2698 0xba, 0x20, 0xcf, 0x63, 0x6d, 0xb5, 0x79, 0x0d, 0xf2, 0xb5, 0x0c, 0xfd, 2718 0xf3, 0x3c, 0xae, 0xad, 0xb6, 0xe2, 0x20, 0x5f, 0xcb, 0xb1, 0x3f, 0x63,
2699 0x19, 0xed, 0x22, 0x11, 0xd4, 0x8b, 0x99, 0xf3, 0xf7, 0xba, 0x88, 0xbf, 2719 0xbb, 0x48, 0xfa, 0xf5, 0x62, 0xee, 0xf5, 0x2f, 0xa1, 0x76, 0x3c, 0x5e,
2700 0x85, 0x9a, 0x8a, 0xc1, 0xbc, 0x17, 0xbc, 0x97, 0x7f, 0xb7, 0x00, 0x39, 2720 0xac, 0xcb, 0x18, 0x8c, 0xf1, 0x7b, 0x18, 0x6b, 0xac, 0x73, 0xfc, 0xee,
2701 0xf0, 0xdd, 0x7d, 0xac, 0x27, 0x0a, 0xb5, 0xa4, 0x14, 0x17, 0xa3, 0xfc, 2721 0x5e, 0xae, 0x27, 0x8a, 0xf5, 0x14, 0x95, 0x16, 0xc3, 0xfc, 0x07, 0x78,
2702 0x07, 0xeb, 0xbc, 0x7d, 0x5a, 0xbe, 0x42, 0xd9, 0xea, 0x32, 0x9d, 0x00, 2722 0xee, 0x90, 0x52, 0xa8, 0xf2, 0xd9, 0x0a, 0x9a, 0x4e, 0x42, 0x28, 0x66,
2703 0x53, 0xec, 0xc6, 0xbc, 0xee, 0x4d, 0x55, 0x23, 0xad, 0xd4, 0x49, 0xcf, 2723 0x73, 0x5e, 0x77, 0x49, 0xd6, 0x48, 0xfe, 0xdf, 0x05, 0x0d, 0x83, 0xb7,
2704 0x7e, 0xd0, 0x16, 0xdd, 0xe3, 0x8a, 0x18, 0xb3, 0x09, 0xd1, 0x67, 0x91, 2724 0xf0, 0x1e, 0x97, 0x48, 0x9d, 0x4d, 0xca, 0xbf, 0x31, 0x48, 0x98, 0x83,
2705 0xd3, 0xda, 0x43, 0xea, 0x6f, 0x1d, 0x7a, 0xb0, 0x8f, 0x3e, 0x3b, 0x10, 2725 0xf2, 0x6f, 0x1d, 0xba, 0xb1, 0x8e, 0x98, 0xdd, 0x13, 0xfe, 0xed, 0x06,
2706 0xfd, 0x2d, 0x06, 0xeb, 0xae, 0xec, 0xc6, 0xfd, 0x2b, 0xcf, 0x91, 0x80, 2726 0xd7, 0x5d, 0xf6, 0xe6, 0xfd, 0x2b, 0xef, 0x23, 0x09, 0x7b, 0xbd, 0xa7,
2707 0xbd, 0x7e, 0x69, 0x27, 0xce, 0x06, 0xb9, 0x5e, 0xde, 0xa1, 0xf2, 0x6e, 2727 0x0f, 0x7b, 0xc3, 0xb9, 0x5e, 0xd9, 0x25, 0xf3, 0x6e, 0xf8, 0xce, 0x33,
2708 0xf8, 0xce, 0xd3, 0x43, 0xe9, 0x3e, 0xe9, 0xda, 0x25, 0x67, 0x86, 0x58, 2728 0x83, 0x37, 0xf5, 0x52, 0xe7, 0x6e, 0x5a, 0x1e, 0xe4, 0x1a, 0xad, 0x0d,
2709 0xa3, 0xb5, 0x01, 0x1f, 0x61, 0x79, 0xe7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86, 0xdf, 0xcf, 0xe6, 0x2f, 0xc4, 0x81, 0x13, 0xe2, 0x80, 0x41, 0x54,
2717 0xff, 0x29, 0xdc, 0xea, 0x62, 0xdb, 0x3a, 0xcb, 0xf0, 0xfb, 0x1d, 0xe7, 2737 0xf3, 0x31, 0x07, 0xe2, 0xca, 0x44, 0x3d, 0x20, 0x32, 0x59, 0x15, 0x52,
2718 0xc7, 0x4d, 0xdd, 0xe4, 0x34, 0x71, 0x12, 0x27, 0xca, 0xc0, 0xc7, 0x39, 2738 0x2d, 0xdb, 0x50, 0xb7, 0x5d, 0x36, 0x77, 0xcb, 0xa6, 0x4c, 0xda, 0x22,
2719 0x49, 0x3d, 0x39, 0xd5, 0x4e, 0xa2, 0x14, 0x22, 0x88, 0x84, 0xe5, 0xfc, 2739 0x06, 0x49, 0x9b, 0x6a, 0xd2, 0x2e, 0x76, 0x31, 0xed, 0x2e, 0x96, 0x81,
2720 0xcc, 0x63, 0x14, 0x3c, 0xc8, 0xa6, 0x4e, 0x42, 0x55, 0x94, 0x74, 0x5b, 2740 0x34, 0xcd, 0xec, 0x1a, 0x56, 0x32, 0xa4, 0x5d, 0x4c, 0xae, 0x31, 0x04,
2721 0x27, 0xee, 0xb8, 0x40, 0x5c, 0x80, 0x6a, 0x39, 0x69, 0xe9, 0x86, 0x3d, 2741 0x88, 0x53, 0xab, 0x5b, 0x2f, 0x32, 0x4d, 0x53, 0x90, 0x57, 0x25, 0xdd,
2722 0xa7, 0x5b, 0xba, 0x00, 0x57, 0x9e, 0xe3, 0xa4, 0x4d, 0xe7, 0xcc, 0x1a, 2742 0x4d, 0x6f, 0x76, 0x3f, 0x55, 0x64, 0xad, 0x72, 0xd1, 0x25, 0x6a, 0xa7,
2723 0x03, 0x69, 0x70, 0x41, 0x23, 0x33, 0x6d, 0xe3, 0x66, 0x37, 0x48, 0x5c, 2743 0x6a, 0x7f, 0x17, 0x67, 0xcf, 0xf3, 0x9d, 0x63, 0x20, 0x6c, 0xd5, 0x90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fd, 0xf2, 0x93, 0x6a, 0x39, 0x6f, 0x25, 0xa9, 0x0b, 2751 0x2c, 0xf9, 0xc2, 0x84, 0x9a, 0x2b, 0x98, 0x09, 0xea, 0x02, 0x29, 0x71,
2732 0xcc, 0x88, 0xab, 0x66, 0x9c, 0x36, 0x60, 0x5c, 0x9b, 0xac, 0xae, 0x83, 2752 0x54, 0xca, 0x6e, 0x03, 0xc6, 0xb5, 0xc9, 0xc2, 0x0a, 0x68, 0x1e, 0xfb,
2733 0xe6, 0xb1, 0x8f, 0x76, 0x9b, 0xf1, 0xf2, 0x89, 0x3e, 0xf2, 0x4c, 0x10, 2753 0x68, 0xb7, 0x18, 0x2f, 0x7f, 0xb6, 0x97, 0x3c, 0xd3, 0x81, 0x6b, 0xf0,
2734 0xd7, 0x60, 0xd8, 0xc3, 0x11, 0xb4, 0x73, 0x5f, 0x74, 0x12, 0xe6, 0x39, 2754 0x59, 0x43, 0x21, 0xb4, 0x73, 0x5e, 0xb3, 0x63, 0xc6, 0x45, 0xed, 0xbf,
2735 0xed, 0xbf, 0xa1, 0x0e, 0xe3, 0xaa, 0x9c, 0xce, 0xfd, 0x60, 0x9b, 0x16, 2755 0xa1, 0x0e, 0xe3, 0xa8, 0xbc, 0xce, 0xfd, 0x60, 0x9b, 0x16, 0x79, 0x60,
2736 0xb9, 0x6d, 0xa7, 0xba, 0xfd, 0xdc, 0x20, 0xd8, 0xbb, 0xa9, 0x3e, 0xea, 2756 0x25, 0x7b, 0xbc, 0x5c, 0x22, 0xd8, 0xbb, 0x2f, 0xf6, 0x52, 0xbf, 0x78,
2737 0x17, 0x2f, 0x38, 0xcd, 0x3a, 0x73, 0x5f, 0x98, 0x77, 0x05, 0xa2, 0x79, 2757 0xd5, 0xde, 0xab, 0x33, 0x76, 0x85, 0x79, 0x5a, 0x20, 0x9a, 0x97, 0x45,
2738 0x4a, 0xa4, 0x54, 0x11, 0xb9, 0x86, 0xdf, 0x6f, 0x2a, 0x7e, 0xfc, 0x42, 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 0xad, 0x4e, 0xa0, 0xbd, 0x9d, 0x7d, 2780 0x57, 0x57, 0xfa, 0x83, 0x3a, 0x85, 0xf6, 0x56, 0xee, 0x7d, 0x45, 0xdd,
2761 0x4f, 0x51, 0xb7, 0xcb, 0xba, 0xad, 0xd0, 0xc5, 0xe7, 0xa0, 0x03, 0xa5, 2781 0x2e, 0xe7, 0xb4, 0x42, 0x17, 0x9f, 0x82, 0x0e, 0x94, 0xac, 0x5f, 0x91,
2762 0x6a, 0x17, 0xa4, 0x3e, 0x1e, 0x42, 0x1b, 0xea, 0x28, 0x1a, 0x4b, 0x64, 2782 0xc6, 0x58, 0x00, 0x6d, 0xa8, 0xa3, 0x68, 0x2c, 0x91, 0x54, 0x81, 0xf9,
2763 0x26, 0xcf, 0x7c, 0x2d, 0xe6, 0x4e, 0x61, 0x8d, 0x0b, 0xc4, 0x0d, 0xae, 2783 0x5d, 0xcc, 0xb5, 0xc2, 0x1a, 0xcf, 0x11, 0x37, 0xb8, 0xc6, 0x36, 0xc6,
2764 0xb1, 0x8d, 0x31, 0x38, 0xbf, 0xce, 0x06, 0x8d, 0xb0, 0x8e, 0xf4, 0x9d, 2784 0xe0, 0xbc, 0x3a, 0x0b, 0x34, 0xc2, 0x3a, 0xd2, 0x77, 0x02, 0x3c, 0x99,
2765 0x04, 0x4f, 0x26, 0x29, 0x37, 0x31, 0xde, 0x18, 0xc6, 0x63, 0xb9, 0x13, 2785 0xa0, 0xdc, 0xc4, 0x78, 0xa3, 0x18, 0x8f, 0xe5, 0x2e, 0x8c, 0x77, 0x45,
2766 0xe3, 0x5d, 0x90, 0x94, 0xd3, 0x18, 0x73, 0x0a, 0x6d, 0x88, 0x33, 0x53, 2786 0x92, 0x76, 0x73, 0xcc, 0x38, 0xda, 0x10, 0x67, 0xe2, 0xd0, 0x1f, 0x06,
2767 0xd0, 0x1f, 0x86, 0xd4, 0xec, 0x7a, 0x18, 0xf2, 0xbb, 0x4f, 0x66, 0xcd, 2787 0x55, 0x7a, 0x25, 0x08, 0xf9, 0xdd, 0x2b, 0x69, 0xe3, 0xc8, 0x81, 0x3d,
2768 0x23, 0x07, 0xf6, 0x98, 0xd5, 0xf6, 0x81, 0x61, 0x8c, 0xf9, 0x6b, 0xea, 2788 0xe6, 0xb4, 0x7d, 0xe0, 0xf3, 0x8d, 0x7a, 0x6b, 0xea, 0x3a, 0xb0, 0x26,
2769 0x3c, 0xb0, 0x26, 0xf6, 0xc7, 0x0f, 0xb6, 0x71, 0x6a, 0x7d, 0x0d, 0x38, 2789 0xf6, 0xc7, 0x0f, 0xb6, 0x71, 0x72, 0x65, 0x09, 0x38, 0xb5, 0xf4, 0x41,
2770 0xb5, 0xf6, 0x61, 0xca, 0x39, 0x2b, 0x33, 0x61, 0xae, 0x89, 0xf5, 0x61, 2790 0xd2, 0xbe, 0x20, 0xa9, 0x20, 0xd7, 0xc4, 0xfa, 0x20, 0xd6, 0x4c, 0x3f,
2771 0xac, 0x99, 0x7e, 0xac, 0x67, 0x81, 0x43, 0x47, 0xfc, 0x3a, 0xb6, 0x15, 2791 0xd6, 0x77, 0x81, 0x43, 0x47, 0xbc, 0x3a, 0xb6, 0x15, 0x5f, 0x12, 0x67,
2772 0x23, 0x85, 0xb3, 0xf7, 0xec, 0x5a, 0xd6, 0x7d, 0x56, 0x52, 0x6b, 0x19, 2792 0xef, 0xda, 0xb5, 0xac, 0xfb, 0x8a, 0x24, 0x97, 0xb2, 0x32, 0xad, 0xfb,
2773 0x99, 0xd7, 0xfd, 0x78, 0x86, 0x83, 0x5a, 0xf7, 0x20, 0xaf, 0xc6, 0x7a, 2793 0xf1, 0x0c, 0x07, 0xb4, 0xee, 0x41, 0x5e, 0x8d, 0x9c, 0xc0, 0x59, 0xc6,
2774 0x70, 0x96, 0x89, 0x07, 0x36, 0x70, 0xb4, 0x47, 0xcb, 0xcc, 0x7e, 0x8f, 2794 0xf6, 0x6d, 0xe0, 0xf0, 0x09, 0x72, 0x91, 0xd1, 0xe7, 0xf2, 0x2c, 0xbe,
2775 0x67, 0xf1, 0xad, 0x87, 0x77, 0xd4, 0x26, 0xb1, 0x6f, 0x40, 0x46, 0xe6, 2795 0x9d, 0xe0, 0x1d, 0xb5, 0x49, 0xe4, 0x5b, 0x90, 0x91, 0x85, 0x66, 0x7d,
2776 0x1b, 0xf5, 0x21, 0xf9, 0x24, 0xdf, 0xd1, 0xcf, 0x38, 0xcb, 0xdd, 0xbc, 2796 0x40, 0x3e, 0x2d, 0xf4, 0xf4, 0x31, 0xce, 0xf2, 0xd7, 0x82, 0x21, 0x1f,
2777 0x29, 0x1f, 0xe7, 0x75, 0x2c, 0x74, 0x31, 0x20, 0xd6, 0x79, 0xcf, 0x3e, 2797 0x17, 0x74, 0x2c, 0x74, 0xc6, 0x2f, 0xe6, 0x65, 0xd7, 0x3e, 0x1f, 0x9e,
2778 0x1f, 0x59, 0x5c, 0x55, 0xfc, 0x3e, 0x72, 0x7e, 0x4b, 0x05, 0xd1, 0x36, 2798 0x59, 0x50, 0xfc, 0x3e, 0x7c, 0x79, 0x5d, 0x75, 0xa0, 0x6d, 0x00, 0xed,
2779 0x84, 0x76, 0x5c, 0x87, 0x29, 0x73, 0xf9, 0xbf, 0xb9, 0x4b, 0xa3, 0xae, 2799 0xb8, 0x0e, 0x43, 0xa6, 0x0a, 0x9f, 0x3b, 0xb3, 0x23, 0x8e, 0x33, 0xad,
2780 0x3b, 0xaf, 0xf3, 0xc3, 0x12, 0xe6, 0xaa, 0x6a, 0xe8, 0xe4, 0x71, 0xc9, 2800 0xf3, 0xc3, 0x62, 0xc6, 0x82, 0x6a, 0xea, 0xe4, 0x51, 0x29, 0x04, 0xdb,
2781 0x87, 0xdb, 0x31, 0x57, 0xc2, 0xdc, 0x52, 0x23, 0x58, 0x0f, 0xcb, 0x3d, 2801 0x31, 0x57, 0xcc, 0x58, 0x57, 0xc3, 0x58, 0x0f, 0xcb, 0x27, 0xc8, 0x13,
2782 0xe4, 0x89, 0xc8, 0x9e, 0x70, 0x7c, 0x2b, 0xbd, 0xa9, 0x12, 0xd1, 0x61, 2802 0xa1, 0x1d, 0xe1, 0xf8, 0x66, 0x66, 0x4d, 0xc5, 0xc2, 0x43, 0xca, 0x4c,
2783 0x65, 0x25, 0x73, 0xf8, 0xb5, 0x28, 0x1d, 0x47, 0x8c, 0x44, 0x15, 0x78, 2803 0xe4, 0xf1, 0x6b, 0x51, 0x3a, 0x8e, 0x18, 0x0a, 0x2b, 0xf0, 0x2e, 0xf6,
2784 0x17, 0x7b, 0xb2, 0x4f, 0xba, 0x6e, 0xda, 0x66, 0x7d, 0xc2, 0x0c, 0x29, 2804 0x64, 0x9d, 0x76, 0x9c, 0x8c, 0xc5, 0xfa, 0x98, 0x11, 0x50, 0xf4, 0xb7,
2785 0xfa, 0x5b, 0x3a, 0x74, 0xbc, 0xf1, 0x72, 0x6f, 0xc2, 0x3c, 0xa9, 0x8e, 2805 0x74, 0xea, 0x78, 0xe3, 0xb5, 0x93, 0x31, 0xe3, 0xb4, 0x3a, 0xee, 0xbd,
2786 0xfb, 0xef, 0x53, 0xc0, 0xcc, 0xe6, 0x78, 0x67, 0x36, 0x95, 0x29, 0x2f, 2806 0xc7, 0x81, 0x99, 0x7b, 0xe3, 0x9d, 0x5f, 0x53, 0x86, 0xbc, 0x51, 0x88,
2787 0xe5, 0x13, 0xd1, 0x65, 0x65, 0x65, 0x30, 0x66, 0x66, 0x56, 0x11, 0x37, 2807 0x85, 0xe7, 0x94, 0x99, 0xc5, 0x98, 0xd9, 0xb4, 0x22, 0x6e, 0xc4, 0x8c,
2788 0x12, 0x66, 0x87, 0xa2, 0x4f, 0xb4, 0x5d, 0xef, 0x3b, 0x8d, 0xfe, 0x09, 2808 0x4e, 0x45, 0x9f, 0x68, 0xbb, 0xde, 0x77, 0x06, 0xfd, 0x63, 0xaa, 0xc5,
2789 0xd5, 0xe2, 0xaf, 0x87, 0xf7, 0xf5, 0xe3, 0x7e, 0x8f, 0x67, 0x88, 0x39, 2809 0x5b, 0x0f, 0xef, 0xeb, 0xed, 0x3e, 0x97, 0x67, 0x88, 0x39, 0x23, 0xc0,
2790 0xa3, 0xc0, 0x4c, 0xe6, 0x9a, 0xe9, 0xdc, 0x86, 0x64, 0x6c, 0x62, 0x54, 2810 0x4c, 0xe6, 0x9a, 0xe9, 0xdc, 0x86, 0x44, 0x64, 0x7c, 0x44, 0x63, 0xe8,
2791 0x63, 0xe8, 0xfd, 0x53, 0x7f, 0x47, 0x1d, 0xca, 0x25, 0xd6, 0xc5, 0x7d, 2811 0xe3, 0x33, 0x7f, 0x47, 0x1d, 0xca, 0x65, 0xd6, 0x45, 0x3d, 0x7e, 0x1b,
2792 0x7e, 0x1b, 0xd5, 0x3a, 0xf3, 0xfd, 0x53, 0x59, 0x9d, 0xc7, 0x58, 0x57, 2812 0xd1, 0x3a, 0xf3, 0xe3, 0x33, 0x39, 0x9d, 0xf7, 0xd8, 0x50, 0x11, 0x6f,
2793 0x31, 0x7f, 0xdf, 0xcd, 0x3b, 0x8b, 0xa6, 0x9c, 0x47, 0x38, 0xce, 0x5a, 2813 0xdf, 0x7b, 0x77, 0x16, 0x4e, 0xda, 0x4f, 0x71, 0x9c, 0x25, 0xff, 0x64,
2794 0x60, 0xba, 0x5d, 0x98, 0x23, 0x3a, 0x57, 0x6c, 0xd0, 0x06, 0xfd, 0x01, 2814 0xbb, 0x30, 0xa7, 0x74, 0xaa, 0xd4, 0xa4, 0x0d, 0xfa, 0x03, 0x98, 0x2f,
2795 0xcc, 0x17, 0x68, 0xc4, 0xbd, 0x2f, 0x88, 0x31, 0x11, 0x3c, 0x40, 0x27, 2815 0xd0, 0x8c, 0x7b, 0x5f, 0x11, 0xdf, 0x78, 0xc7, 0x01, 0x3a, 0x81, 0xae,
2796 0xd0, 0x35, 0xa1, 0xa3, 0x56, 0x30, 0x4e, 0x6e, 0x5d, 0xb2, 0x5e, 0x7f, 2816 0x09, 0x1d, 0xb5, 0x8a, 0x71, 0xf2, 0x2b, 0x92, 0x73, 0xfb, 0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, 0x39, 0x52, 0xad, 0x4d, 0xca, 0x6e, 0x2d, 2824 0x39, 0xfc, 0x17, 0x65, 0x4b, 0xad, 0x3e, 0x21, 0xb7, 0xeb, 0x51, 0xfd,
2805 0xae, 0xbf, 0x51, 0xae, 0xe5, 0x5e, 0x37, 0xe4, 0xf9, 0x51, 0x9d, 0x57, 2825 0x8d, 0x72, 0x2d, 0xff, 0x0b, 0x9f, 0xbc, 0x32, 0xa2, 0xf3, 0xea, 0xa2,
2806 0x17, 0x2f, 0x4b, 0xef, 0x00, 0x75, 0x9e, 0x2d, 0x9d, 0x63, 0x07, 0xec, 2826 0x15, 0x79, 0xaa, 0x9f, 0x3a, 0xcf, 0xba, 0xce, 0xb1, 0x03, 0x76, 0x40,
2807 0x80, 0xce, 0xf1, 0x33, 0xe8, 0x1c, 0xef, 0x40, 0xe7, 0xf8, 0x69, 0x11, 2827 0xe7, 0x78, 0x0f, 0x3a, 0xc7, 0x6f, 0xa0, 0x73, 0xfc, 0xba, 0x04, 0x7c,
2808 0xf8, 0x52, 0x4c, 0xfb, 0xf8, 0xbf, 0x08, 0x1c, 0xa2, 0xac, 0xb6, 0xce, 2828 0x29, 0x65, 0x3c, 0xfc, 0x9f, 0x01, 0x0e, 0x51, 0x56, 0x9b, 0xe7, 0x71,
2809 0xe0, 0x4e, 0x17, 0xb3, 0xa0, 0xc1, 0x5b, 0x92, 0x06, 0xde, 0xa6, 0xe4, 2829 0xa7, 0x33, 0x39, 0xd0, 0xe0, 0x47, 0x92, 0x01, 0xde, 0x26, 0x65, 0x73,
2810 0xfa, 0xc6, 0xbc, 0xec, 0x6c, 0x78, 0x79, 0xc8, 0x1f, 0x30, 0x07, 0x6c, 2830 0x75, 0x5a, 0xb6, 0x56, 0xdd, 0x3c, 0xe5, 0xfb, 0xcc, 0x01, 0x1b, 0xe3,
2811 0x9c, 0xf7, 0x14, 0x07, 0x0e, 0x1d, 0x91, 0xd8, 0x49, 0xe2, 0x47, 0x50, 2831 0x3d, 0x45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 2853 0x71, 0x04, 0xfd, 0x83, 0xf2, 0xc3, 0x62, 0xe0, 0x50, 0xd9, 0xc0, 0x73,
2834 0x65, 0x13, 0xcf, 0x31, 0x95, 0x2b, 0xdc, 0x73, 0x87, 0x75, 0xcc, 0x00, 2854 0x54, 0xe5, 0x8b, 0x8f, 0x9c, 0x21, 0x1d, 0x33, 0x80, 0x4e, 0x62, 0x38,
2835 0x3a, 0x89, 0xe9, 0xba, 0xcb, 0x0e, 0xe7, 0xeb, 0xc2, 0x7c, 0x7b, 0xe6, 2855 0xce, 0x9c, 0xcd, 0xf9, 0xba, 0x31, 0xdf, 0x8e, 0x71, 0x0c, 0xf2, 0xff,
2836 0x31, 0xc8, 0xff, 0xd3, 0x5a, 0x3e, 0x9f, 0x53, 0xb0, 0x7d, 0xc1, 0xdf, 2856 0xac, 0x96, 0xcf, 0x17, 0x15, 0x6c, 0x5f, 0xf0, 0x77, 0x50, 0xd2, 0x45,
2837 0x61, 0x99, 0x2d, 0x40, 0xc6, 0x2b, 0xe6, 0x9c, 0x52, 0x57, 0xb0, 0x22, 2857 0xc8, 0x78, 0xc5, 0x9c, 0x53, 0xea, 0x0a, 0x66, 0x68, 0x0e, 0xd8, 0x31,
2838 0xcb, 0xc0, 0x8e, 0x25, 0xe0, 0xcd, 0x93, 0x3a, 0xb6, 0xda, 0xa3, 0xb1, 2858 0x0b, 0xbc, 0x79, 0x49, 0xc7, 0x56, 0x4f, 0x68, 0xec, 0x99, 0x67, 0x39,
2839 0x67, 0x85, 0xe5, 0x8c, 0x24, 0xcb, 0x4e, 0xb7, 0x3e, 0xbf, 0xfd, 0xdd, 2859 0x2b, 0x89, 0x8a, 0xdd, 0xa3, 0xcf, 0x6f, 0xf7, 0xf6, 0x2f, 0x43, 0xee,
2840 0x57, 0x23, 0xde, 0x9d, 0x83, 0x8f, 0x33, 0x4a, 0xda, 0x60, 0x03, 0xcd, 2860 0x9d, 0x83, 0x8f, 0xb3, 0x4a, 0xda, 0x60, 0x03, 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 0x01, 2875 0x88, 0x8d, 0x31, 0x27, 0xe4, 0x26, 0xe6, 0xf1, 0x81, 0xbf, 0x47, 0x4e,
2856 0xfe, 0x1e, 0x3d, 0xa1, 0xf9, 0x7b, 0x4a, 0x02, 0x87, 0x79, 0x1c, 0xf4, 2876 0x69, 0xfe, 0x8e, 0x8b, 0xff, 0x30, 0x8f, 0x83, 0xde, 0x80, 0x41, 0x2e,
2857 0x06, 0x0c, 0xf2, 0x78, 0x3a, 0xe9, 0xd3, 0xe8, 0xd7, 0xc1, 0xbf, 0x16, 2877 0x4f, 0x27, 0x3c, 0x1a, 0xfd, 0x26, 0xf8, 0xd7, 0x84, 0x25, 0x16, 0x94,
2858 0x2c, 0xb1, 0xb0, 0xac, 0x82, 0xff, 0xb7, 0xf1, 0xfd, 0x66, 0x6d, 0x44, 2878 0x05, 0xf0, 0xff, 0x06, 0xbe, 0xdf, 0xad, 0x0f, 0xab, 0xf9, 0x25, 0xe5,
2859 0xad, 0xac, 0x29, 0x3f, 0x97, 0xe4, 0x19, 0xe8, 0xc9, 0xb7, 0x70, 0x76, 2879 0xe5, 0x92, 0x7c, 0x07, 0x7a, 0xf2, 0x43, 0x9c, 0x5d, 0x97, 0xd6, 0xdd,
2860 0x9d, 0x5a, 0x77, 0x8f, 0x8d, 0x33, 0x7e, 0x96, 0x56, 0x97, 0xed, 0x93, 2880 0x23, 0x63, 0x8c, 0x9f, 0x65, 0xd4, 0x35, 0xeb, 0xb4, 0xec, 0x8e, 0x4e,
2861 0xb2, 0x3f, 0x36, 0x89, 0xf2, 0x31, 0x3c, 0x0d, 0x9c, 0x43, 0x48, 0xc7, 2881 0xa0, 0x7c, 0x0c, 0x4f, 0x1f, 0xce, 0x21, 0xa0, 0xe3, 0xdf, 0x6b, 0x05,
2862 0xbf, 0x37, 0xf3, 0x8e, 0xf2, 0xfe, 0x67, 0x61, 0x42, 0xe7, 0xe7, 0x1b, 2882 0x5b, 0xb9, 0xff, 0xd3, 0x30, 0x8e, 0x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x4f, 0x25, 0xd0, 0x54, 0x19, 2897 0x8e, 0xca, 0xc0, 0xa7, 0x32, 0x68, 0xaa, 0x02, 0x7c, 0x2b, 0x03, 0xdf,
2878 0xf8, 0x56, 0x02, 0xbe, 0x95, 0x6a, 0x56, 0xbc, 0x82, 0x3d, 0x53, 0x66, 2898 0xca, 0x75, 0x33, 0x5a, 0xc5, 0x9e, 0x29, 0xb3, 0xd7, 0x41, 0x47, 0x1b,
2879 0x6f, 0x81, 0x8e, 0xb6, 0x6b, 0xbc, 0x7f, 0xbd, 0x66, 0x93, 0x72, 0xf0, 2899 0x75, 0xde, 0xbf, 0x5e, 0xb3, 0x41, 0x39, 0x78, 0x77, 0xef, 0xee, 0xff,
2880 0x66, 0xf3, 0xee, 0xff, 0x81, 0xbb, 0x1f, 0x92, 0x5d, 0xd8, 0x2d, 0x6f, 2900 0x81, 0xbb, 0x1f, 0x94, 0xdb, 0xb0, 0x5b, 0xde, 0x29, 0x8d, 0x02, 0x93,
2881 0x15, 0xc7, 0x80, 0x49, 0x02, 0x8c, 0x72, 0x40, 0x1b, 0x53, 0x72, 0xbd, 2901 0x04, 0x18, 0x65, 0x83, 0x36, 0xe2, 0xb2, 0x59, 0x9a, 0x94, 0x2d, 0xc8,
2882 0x38, 0x2d, 0x3b, 0x90, 0x4f, 0x37, 0x36, 0x62, 0xd0, 0xa7, 0x23, 0xb2, 2902 0xa7, 0xed, 0xd5, 0x08, 0xf4, 0xe9, 0x90, 0xcc, 0xbf, 0x35, 0x22, 0xb7,
2883 0xf2, 0xda, 0xa8, 0xbc, 0xb9, 0xa1, 0x64, 0x09, 0xf4, 0x9b, 0xdb, 0xa4, 2903 0x56, 0x95, 0xcc, 0x82, 0x7e, 0xf3, 0x6b, 0xf4, 0xbb, 0x83, 0x9e, 0xcb,
2884 0xdf, 0x1d, 0xf4, 0x5c, 0xea, 0xd0, 0x71, 0xfa, 0xd9, 0x8a, 0xe7, 0x7f, 2904 0x9d, 0x3a, 0x4e, 0x9f, 0xae, 0xba, 0xfe, 0xf7, 0xa9, 0x6a, 0x97, 0x4c,
2885 0x9f, 0xab, 0x74, 0xca, 0x7c, 0xc5, 0x94, 0xc7, 0x2b, 0xdd, 0xf2, 0xe5, 2905 0x57, 0x0d, 0x79, 0xbe, 0xda, 0x23, 0x2f, 0x56, 0x83, 0x72, 0x16, 0x76,
2886 0x4a, 0x58, 0x4e, 0xc3, 0x0e, 0xfc, 0x4a, 0x65, 0x50, 0x9e, 0xac, 0x0c, 2906 0xe0, 0xd7, 0xaa, 0x03, 0xf2, 0x52, 0x75, 0x50, 0xbe, 0x5e, 0x0b, 0xcb,
2887 0xc9, 0x57, 0xab, 0x51, 0xf9, 0x5a, 0xd5, 0x96, 0x4c, 0x35, 0x2e, 0xe9, 2907 0x37, 0x6a, 0x96, 0x64, 0x6b, 0x51, 0xc9, 0xd4, 0x46, 0xe5, 0x85, 0x1a,
2888 0xea, 0x98, 0x3c, 0x51, 0xa5, 0x5f, 0x1d, 0xf3, 0xe1, 0x37, 0xd3, 0xf4, 2908 0xfd, 0xea, 0x98, 0x0f, 0xbf, 0xd4, 0x9e, 0xbf, 0x82, 0xeb, 0xea, 0xc0,
2889 0x57, 0x70, 0x5d, 0x41, 0xac, 0x2b, 0xae, 0xe6, 0x74, 0x9c, 0x52, 0x32, 2909 0xba, 0xa2, 0x6a, 0x4a, 0xc7, 0x29, 0x25, 0xeb, 0xfa, 0x3c, 0x44, 0x2e,
2890 0x9e, 0xcf, 0x43, 0xe4, 0x39, 0x8c, 0x75, 0xf1, 0x35, 0x25, 0x65, 0x3d, 2910 0x61, 0xac, 0xc5, 0xb7, 0x94, 0x54, 0xf4, 0xfc, 0xcd, 0xff, 0x33, 0x09,
2891 0x7f, 0xe3, 0xff, 0x46, 0x42, 0xda, 0x36, 0x7a, 0xae, 0x34, 0x88, 0x36, 2911 0x68, 0xdb, 0xe8, 0x52, 0x79, 0x00, 0x6d, 0x20, 0xf7, 0x0a, 0x4d, 0xdf,
2892 0x90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 0x76, 0x76, 0x34, 0x3f, 0x37, 0x7d, 0x0c,
2914 0xfc, 0xdc, 0xf0, 0x31, 0xfc, 0x6e, 0x80, 0xb6, 0x2d, 0x71, 0xe3, 0x92, 2934 0x7f, 0xee, 0xa7, 0x6d, 0x4b, 0xdc, 0xb8, 0xea, 0xe6, 0x8e, 0x6a, 0x1b,
2915 0x97, 0x3b, 0xaa, 0x6d, 0x68, 0x60, 0x05, 0xea, 0xc8, 0xab, 0xe0, 0x93, 2935 0x1a, 0x58, 0x81, 0x3a, 0xf2, 0x2a, 0xf8, 0x64, 0xaf, 0x2d, 0xff, 0xfe,
2916 0x66, 0x5b, 0xfe, 0xfd, 0x07, 0x69, 0x3f, 0x51, 0x42, 0x6c, 0x67, 0x00, 2936 0x03, 0x9a, 0xb8, 0x8a, 0x6c, 0x8c, 0x67, 0x00, 0x00, 0x00 };
2917 0x00, 0x00 };
2918 2937
2919static const u32 bnx2_RXP_b09FwData[(0x0/4) + 1] = { 0x0 }; 2938static const u32 bnx2_RXP_b09FwData[(0x0/4) + 1] = { 0x0 };
2920static const u32 bnx2_RXP_b09FwRodata[(0x278/4) + 1] = { 2939static const u32 bnx2_RXP_b09FwRodata[(0x278/4) + 1] = {
2921 0x08004050, 0x08003f50, 0x08003ff4, 0x0800400c, 0x08004024, 0x08004044, 2940 0x08004070, 0x08003f70, 0x08004014, 0x0800402c, 0x08004044, 0x08004064,
2922 0x08004050, 0x08004050, 0x08003f58, 0x00000000, 0x08004a0c, 0x08004a44, 2941 0x08004070, 0x08004070, 0x08003f78, 0x00000000, 0x08004a2c, 0x08004a64,
2923 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004a7c, 0x08004c40, 2942 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004a9c, 0x08004c60,
2924 0x08004b88, 0x08004bc0, 0x08004c40, 0x08004b10, 0x08004c40, 0x08004c40, 2943 0x08004ba8, 0x08004be0, 0x08004c60, 0x08004b30, 0x08004c60, 0x08004c60,
2925 0x08004bc0, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2944 0x08004be0, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2926 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c00, 2945 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c20,
2927 0x08004c40, 0x08004c00, 0x08004b88, 0x08004c40, 0x08004c40, 0x08004c00, 2946 0x08004c60, 0x08004c20, 0x08004ba8, 0x08004c60, 0x08004c60, 0x08004c20,
2928 0x08004c00, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2947 0x08004c20, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2929 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2948 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2930 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2949 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2931 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2950 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2932 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2951 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2933 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2952 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2934 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2953 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2935 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2954 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2936 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2955 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2937 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2956 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2938 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2957 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2939 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2958 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2940 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2959 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2941 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2960 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2942 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2961 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2943 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 0x08004c40, 2962 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60, 0x08004c60,
2944 0x08004aec, 0x00000000, 0x08006058, 0x08006070, 0x08006070, 0x08006070, 2963 0x08004b0c, 0x00000000, 0x08006078, 0x08006090, 0x08006090, 0x08006090,
2945 0x08006058, 0x08006070, 0x08006070, 0x08006070, 0x08006058, 0x08006070, 2964 0x08006078, 0x08006090, 0x08006090, 0x08006090, 0x08006078, 0x08006090,
2946 0x08006070, 0x08006070, 0x08006058, 0x08006070, 0x08006070, 0x08006070, 2965 0x08006090, 0x08006090, 0x08006078, 0x08006090, 0x08006090, 0x08006090,
2947 0x08006064, 0x00000000, 0x00000000 }; 2966 0x08006084, 0x00000000, 0x00000000 };
2948 2967
2949static struct fw_info bnx2_rxp_fw_09 = { 2968static struct fw_info bnx2_rxp_fw_09 = {
2969 /* Firmware version: 3.7.1 */
2950 .ver_major = 0x3, 2970 .ver_major = 0x3,
2951 .ver_minor = 0x4, 2971 .ver_minor = 0x7,
2952 .ver_fix = 0x3, 2972 .ver_fix = 0x1,
2953 2973
2954 .start_addr = 0x08003184, 2974 .start_addr = 0x08003184,
2955 2975
2956 .text_addr = 0x08000000, 2976 .text_addr = 0x08000000,
2957 .text_len = 0x6768, 2977 .text_len = 0x6788,
2958 .text_index = 0x0, 2978 .text_index = 0x0,
2959 .gz_text = bnx2_RXP_b09FwText, 2979 .gz_text = bnx2_RXP_b09FwText,
2960 .gz_text_len = sizeof(bnx2_RXP_b09FwText), 2980 .gz_text_len = sizeof(bnx2_RXP_b09FwText),
2961 2981
2962 .data_addr = 0x08006a00, 2982 .data_addr = 0x08006a20,
2963 .data_len = 0x0, 2983 .data_len = 0x0,
2964 .data_index = 0x0, 2984 .data_index = 0x0,
2965 .data = bnx2_RXP_b09FwData, 2985 .data = bnx2_RXP_b09FwData,
2966 2986
2967 .sbss_addr = 0x08006a00, 2987 .sbss_addr = 0x08006a20,
2968 .sbss_len = 0x20, 2988 .sbss_len = 0x20,
2969 .sbss_index = 0x0, 2989 .sbss_index = 0x0,
2970 2990
2971 .bss_addr = 0x08006a20, 2991 .bss_addr = 0x08006a40,
2972 .bss_len = 0x13dc, 2992 .bss_len = 0x13dc,
2973 .bss_index = 0x0, 2993 .bss_index = 0x0,
2974 2994
2975 .rodata_addr = 0x08006768, 2995 .rodata_addr = 0x08006788,
2976 .rodata_len = 0x278, 2996 .rodata_len = 0x278,
2977 .rodata_index = 0x0, 2997 .rodata_index = 0x0,
2978 .rodata = bnx2_RXP_b09FwRodata, 2998 .rodata = bnx2_RXP_b09FwRodata,
2979}; 2999};
2980 3000
2981static u8 bnx2_TPAT_b09FwText[] = { 3001static u8 bnx2_TPAT_b09FwText[] = {
2982/* 0x1f, 0x8b, 0x08, 0x00, 0x0e, 0x34, 0xe7, 0x45, 0x00, 0x03, */ 3002 0xcd, 0x58, 0x5d, 0x6c, 0x1c, 0x57, 0x15, 0x3e, 0xf3, 0xb7, 0x3b, 0xde,
2983 0xcd, 0x58, 3003 0x38, 0xf1, 0x24, 0x19, 0xca, 0xa6, 0x72, 0xe9, 0x8c, 0x3d, 0x76, 0x8c,
2984 0x5d, 0x68, 0x1c, 0xd7, 0x15, 0x3e, 0xf3, 0xb7, 0x3b, 0x52, 0x24, 0xeb, 3004 0x6c, 0x35, 0xd3, 0x76, 0xd5, 0x58, 0x68, 0xa4, 0x4e, 0x67, 0x76, 0x1d,
2985 0x5a, 0xd9, 0xa6, 0xeb, 0xa0, 0x34, 0x33, 0xda, 0x91, 0xac, 0x22, 0x13, 3005 0x2b, 0xf4, 0xc1, 0x85, 0x48, 0x3c, 0xf0, 0xe2, 0xae, 0x1d, 0x05, 0x78,
2986 0x4f, 0x9d, 0x25, 0x16, 0x65, 0x21, 0x93, 0xd9, 0x91, 0xac, 0x98, 0x3c, 3006 0x2a, 0x28, 0x0f, 0x11, 0x2f, 0x59, 0x76, 0x37, 0xfd, 0x41, 0xdb, 0x2c,
2987 0x28, 0xc5, 0x90, 0x87, 0x52, 0x50, 0x57, 0x32, 0x09, 0x79, 0x69, 0xda, 3007 0x35, 0xc8, 0x41, 0x02, 0xa4, 0xb0, 0x69, 0xe2, 0x97, 0xad, 0x27, 0x2d,
2988 0xc6, 0x90, 0x3e, 0x79, 0x3b, 0x2b, 0xc7, 0x0e, 0x6c, 0xbc, 0x8d, 0x52, 3008 0x45, 0xea, 0x4b, 0x95, 0x28, 0x55, 0x2b, 0xc4, 0x13, 0x2f, 0x54, 0x79,
2989 0xe4, 0x52, 0xfa, 0x60, 0xd6, 0xb1, 0x05, 0xcd, 0x46, 0x93, 0xd4, 0x7e, 3009 0xac, 0x52, 0x5a, 0xf1, 0x00, 0x28, 0x42, 0x15, 0xaa, 0x68, 0xf0, 0xe5,
2990 0x35, 0x36, 0x4e, 0x93, 0xa7, 0x42, 0x9f, 0x52, 0xf4, 0x18, 0xd2, 0x12, 3010 0x3b, 0x77, 0x66, 0xdc, 0xdd, 0xc4, 0x49, 0xcb, 0x9f, 0x84, 0xa5, 0xf5,
2991 0xda, 0x52, 0x8a, 0x69, 0xa1, 0x09, 0x8d, 0xeb, 0xdb, 0xef, 0xdc, 0x99, 3011 0x9d, 0xb9, 0xf7, 0x9e, 0x73, 0xcf, 0x3d, 0x3f, 0xdf, 0x39, 0x67, 0xca,
2992 0x91, 0x57, 0xb6, 0xec, 0xa4, 0x25, 0x85, 0x0a, 0x56, 0x77, 0xe6, 0xce, 3012 0x2a, 0x95, 0x28, 0xfb, 0xdb, 0x8d, 0xdf, 0xc9, 0xa7, 0x9f, 0x39, 0x79,
2993 0x3d, 0xe7, 0x9e, 0x7b, 0xee, 0x77, 0xbe, 0x73, 0xee, 0x2d, 0xeb, 0x34, 3013 0xf8, 0xa1, 0x47, 0x1d, 0xa2, 0x87, 0x1f, 0x52, 0x94, 0xa2, 0x46, 0xff,
2994 0x48, 0xd9, 0xdf, 0x30, 0x7e, 0x2f, 0x7e, 0xf7, 0x85, 0x17, 0xab, 0x8f, 3014 0x85, 0x3f, 0x30, 0xb1, 0x72, 0xfe, 0xfc, 0x23, 0x53, 0x0d, 0x7e, 0xe3,
2995 0x3c, 0xea, 0x10, 0x3d, 0xfa, 0x88, 0x66, 0x98, 0x06, 0x7d, 0x09, 0x7f, 3015 0x44, 0x1e, 0x99, 0x5a, 0xb0, 0xf4, 0xe5, 0x15, 0x8f, 0x28, 0xec, 0xcf,
2996 0x50, 0x22, 0x72, 0xfd, 0xfc, 0x23, 0x5b, 0xaf, 0x9d, 0x72, 0x42, 0x8f, 3016 0x3a, 0x31, 0xfd, 0x43, 0x34, 0x6c, 0x9d, 0x78, 0xfe, 0x81, 0xe0, 0xd6,
2997 0x6c, 0xa3, 0x26, 0xbe, 0xbe, 0xe4, 0x11, 0x05, 0xbd, 0x69, 0xa7, 0x4e, 3017 0xa1, 0x37, 0x0f, 0xbb, 0x37, 0xcf, 0x6b, 0x64, 0x5a, 0xc1, 0xb2, 0x69,
2998 0xff, 0x92, 0xcd, 0x92, 0x49, 0xdc, 0xff, 0x50, 0xed, 0xc6, 0xfe, 0xcb, 3018 0x4d, 0x93, 0x39, 0x1e, 0x5c, 0x75, 0x7e, 0x7e, 0x30, 0x28, 0xd0, 0x9e,
2999 0x07, 0xdd, 0xeb, 0x67, 0x0d, 0xb2, 0x45, 0x6d, 0xd1, 0x16, 0x93, 0x64, 3019 0x9c, 0x97, 0x4d, 0xcd, 0x2e, 0x35, 0xf4, 0xc0, 0xa4, 0x5a, 0xe7, 0x94,
3000 0x8f, 0xd5, 0x9a, 0xce, 0x2f, 0xf6, 0x1e, 0x28, 0xd0, 0xae, 0x5c, 0x97, 3020 0x12, 0x75, 0x3d, 0xab, 0x0a, 0x1e, 0xa1, 0x0d, 0xfe, 0x1e, 0xde, 0x13,
3001 0xa0, 0xb8, 0x43, 0x4d, 0xab, 0x66, 0x53, 0xd4, 0x7e, 0x49, 0x0b, 0x3b, 3021 0x5d, 0xa9, 0x9e, 0x33, 0x49, 0x0d, 0x42, 0x3c, 0xcf, 0x51, 0xab, 0x2b,
3002 0x9e, 0x98, 0x85, 0x8e, 0xa0, 0x04, 0xfd, 0x1e, 0xde, 0x13, 0x53, 0x8b, 3022 0xc4, 0x0f, 0x7d, 0x85, 0x56, 0x7c, 0x93, 0x96, 0x2d, 0x77, 0x31, 0x54,
3003 0xce, 0xd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c7, 0xdb, 0xf8, 0xc6, 3030 0x0c, 0x8a, 0x2a, 0xb7, 0xaf, 0x8d, 0xe0, 0x59, 0xc1, 0xfc, 0x51, 0xc8,
3011 0x36, 0xb3, 0x7c, 0xbf, 0xec, 0x30, 0x9e, 0x9f, 0xc3, 0x38, 0x8b, 0xc2, 3031 0xc5, 0x7c, 0x1c, 0xc8, 0x31, 0x4e, 0xed, 0xee, 0x22, 0xee, 0x53, 0xa0,
3012 0xea, 0xed, 0xdf, 0x06, 0xf0, 0xac, 0xa1, 0xff, 0x30, 0xec, 0x62, 0x3d, 3032 0x86, 0x35, 0x35, 0x53, 0x27, 0x1d, 0x34, 0x1a, 0x85, 0xf6, 0x15, 0xa1,
3013 0x0e, 0xec, 0x28, 0xd3, 0x4a, 0x67, 0x1e, 0xeb, 0x29, 0x50, 0x53, 0x4c, 3033 0x06, 0x42, 0x44, 0x15, 0x6f, 0xa6, 0x27, 0xcf, 0x50, 0x49, 0xf3, 0x0a,
3014 0x4c, 0x35, 0xc8, 0x84, 0x8c, 0x41, 0x41, 0xe9, 0x8a, 0xd4, 0x6b, 0x52, 3034 0x54, 0xf5, 0x77, 0x53, 0xcb, 0xd2, 0xa8, 0x39, 0x67, 0x50, 0xb8, 0xa4,
3015 0x86, 0x55, 0x6f, 0xaa, 0xab, 0xe6, 0xd0, 0xc9, 0xf0, 0x0a, 0x14, 0xf9, 3035 0xe3, 0x8e, 0xfb, 0x40, 0xa7, 0x80, 0xfe, 0xa5, 0xcc, 0xe6, 0x45, 0x6a,
3016 0xc3, 0xd4, 0x12, 0x06, 0xc5, 0xfb, 0x2c, 0x0a, 0x16, 0x4c, 0xac, 0x71, 3036 0x5a, 0x05, 0xcc, 0x8f, 0x51, 0xd3, 0xde, 0xab, 0xa8, 0xc1, 0x0b, 0x98,
3017 0x14, 0x72, 0x1a, 0xe4, 0x5f, 0xcb, 0xf6, 0xbc, 0x48, 0xb1, 0x28, 0xa0, 3037 0x9f, 0xb2, 0x7a, 0xf4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0x75, 0xe5, 0xeb,
3025 0xa8, 0x60, 0x83, 0xe7, 0x02, 0xf0, 0x11, 0xcf, 0xe8, 0xd4, 0x2c, 0x17, 3045 0x19, 0x1d, 0xfb, 0xc6, 0xbb, 0x90, 0xb3, 0x61, 0x99, 0x70, 0xbc, 0xe5,
3026 0xc9, 0xf5, 0x8f, 0xa2, 0xf7, 0xd7, 0x6d, 0x83, 0xea, 0xec, 0x2b, 0xdf, 3046 0x63, 0x42, 0x5c, 0xf4, 0x85, 0x28, 0x04, 0xde, 0xcc, 0x25, 0x9a, 0x2d,
3027 0xcc, 0x64, 0x18, 0x1b, 0x1f, 0x64, 0x76, 0x0a, 0x5a, 0x3c, 0x22, 0xe5, 3047 0x1b, 0x34, 0x6d, 0x61, 0x84, 0x8e, 0xbd, 0x72, 0x9d, 0x8c, 0x5c, 0x9e,
3028 0x8a, 0x2f, 0xa5, 0x55, 0xf3, 0x9c, 0x13, 0x34, 0x5d, 0x36, 0x69, 0x52, 3048 0xdc, 0x37, 0xf1, 0xd7, 0x57, 0x08, 0x3e, 0x79, 0xa3, 0xf3, 0x7b, 0xd6,
3029 0xa0, 0x85, 0x8f, 0xbd, 0x72, 0x83, 0x2c, 0x60, 0xa1, 0x1f, 0xff, 0xfc, 3049 0xc7, 0xcc, 0x82, 0xa4, 0x11, 0xa2, 0x37, 0x7f, 0x2f, 0x9a, 0x5f, 0x67,
3030 0xf7, 0xa6, 0x86, 0x25, 0xd0, 0xb5, 0x36, 0xeb, 0x98, 0x70, 0x66, 0x95, 3050 0x34, 0x42, 0xd4, 0x2a, 0x7c, 0xae, 0x8b, 0x3b, 0xb3, 0x7f, 0x13, 0xd5,
3031 0x8c, 0x94, 0xf1, 0xcc, 0xbd, 0x64, 0x2e, 0x65, 0x32, 0x52, 0x46, 0x55, 3051 0xfa, 0xbe, 0x59, 0xef, 0x40, 0x3e, 0x0f, 0x63, 0x9f, 0xa8, 0xde, 0xe5,
3032 0x81, 0x3d, 0x6f, 0x0a, 0x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0xd8, 0x5a, 0xbd, 0xc3, 3081 0x07, 0x75, 0x25, 0x3a, 0x57, 0xc4, 0x59, 0x7f, 0x12, 0x91, 0x07, 0xdf,
3062 0x3e, 0x63, 0xfc, 0xd9, 0x19, 0xfe, 0x4c, 0x2d, 0x3c, 0x53, 0xc4, 0x5c, 3082 0x03, 0x96, 0xad, 0x54, 0xbe, 0x0f, 0xf9, 0x30, 0xd7, 0xe3, 0xb5, 0x9b,
3063 0x7f, 0x91, 0xa1, 0x27, 0xb1, 0x0f, 0x3a, 0x2d, 0x55, 0x7f, 0x04, 0xfb, 3083 0xd9, 0x3c, 0xf3, 0x00, 0x46, 0xf8, 0xfb, 0x29, 0x62, 0x3c, 0x38, 0xc6,
3064 0xd0, 0xd7, 0xe5, 0x6f, 0xd7, 0xb3, 0x7e, 0xd6, 0x01, 0x7e, 0xf0, 0xef, 3084 0x34, 0x45, 0x9a, 0x58, 0x63, 0x8c, 0xc1, 0xd8, 0xe3, 0x77, 0xbe, 0xdb,
3065 0xa7, 0x90, 0xb9, 0xe0, 0x08, 0xcb, 0x14, 0x69, 0x7c, 0x95, 0xf9, 0x05, 3085 0x08, 0xd5, 0xa1, 0x95, 0xfa, 0x8c, 0x0d, 0xb9, 0x54, 0x89, 0x19, 0x75,
3066 0x6d, 0x97, 0xdf, 0x79, 0x6d, 0x03, 0xd4, 0x80, 0x57, 0x1a, 0x53, 0x25, 3086 0x60, 0x88, 0xea, 0x95, 0x30, 0xf2, 0x79, 0x3f, 0xd3, 0xd2, 0xf8, 0xb7,
3067 0xd8, 0xa5, 0x2b, 0xbe, 0x68, 0x80, 0x3f, 0x74, 0x6f, 0x10, 0x2d, 0xcf, 3087 0xa5, 0xbd, 0x63, 0xf8, 0xaf, 0x0e, 0x79, 0x56, 0x69, 0xaa, 0x7c, 0x5c,
3068 0xf7, 0x73, 0x23, 0x8f, 0xa9, 0xb8, 0x33, 0x44, 0x75, 0xe0, 0xd7, 0x84, 3088 0xae, 0x61, 0xae, 0xc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88, 0xe7, 0x7c,
3076 0xf4, 0x5b, 0xd8, 0x53, 0x20, 0xaf, 0x6b, 0xd2, 0x1b, 0x6d, 0xf6, 0x85, 3096 0xb6, 0xc9, 0xbb, 0xd0, 0x0b, 0xe1, 0x86, 0x53, 0xf3, 0x37, 0x60, 0x9f,
3077 0x4d, 0x95, 0x35, 0x29, 0x4f, 0xfa, 0xbc, 0x27, 0xbf, 0x83, 0x5f, 0x08, 3097 0x8d, 0x3e, 0xdb, 0xc6, 0x90, 0x3a, 0xf1, 0xd6, 0xe6, 0x60, 0xd7, 0x99,
3078 0x2b, 0x9c, 0x98, 0xf9, 0x08, 0xfb, 0xb3, 0xde, 0xe3, 0xbd, 0xb1, 0x94, 3098 0x4c, 0x46, 0xb6, 0x97, 0x4e, 0xed, 0x8a, 0x4a, 0x17, 0x2b, 0x9f, 0x08,
3079 0x4f, 0xbc, 0xd5, 0x29, 0xec, 0xeb, 0x54, 0x66, 0x23, 0xef, 0x97, 0x49, 3099 0xd5, 0x63, 0x8c, 0x2d, 0x40, 0xb7, 0xd8, 0xd7, 0xc3, 0xbe, 0xa4, 0x00,
3080 0x2b, 0x55, 0x9d, 0xce, 0x57, 0x3f, 0x93, 0xba, 0xc7, 0xfc, 0x5a, 0x80, 3100 0x1d, 0xfe, 0x4d, 0x18, 0xc0, 0xdf, 0x8b, 0x15, 0xcc, 0xaf, 0x9d, 0x86,
3081 0x6f, 0x31, 0xae, 0x8b, 0x71, 0x49, 0x01, 0x3e, 0xfc, 0x07, 0x78, 0x45, 3101 0xac, 0x1a, 0x68, 0x53, 0x1f, 0x63, 0x79, 0x16, 0x3a, 0xf9, 0xfd, 0xbc,
3082 0xca, 0xf3, 0x55, 0xf4, 0xaf, 0x1e, 0x87, 0xad, 0x06, 0x64, 0x53, 0x8c, 3102 0xf9, 0xb7, 0x25, 0xbf, 0x51, 0x9a, 0xde, 0x1c, 0xa5, 0x13, 0xfd, 0x51,
3083 0xb1, 0x3d, 0x73, 0xed, 0x7c,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 0x7c, 3110 0xb9, 0x62, 0x2f, 0xe2, 0x60, 0x04, 0xf8, 0x7f, 0xbf, 0x3e, 0x9c, 0x2b,
3091 0x1f, 0x46, 0x1e, 0xc8, 0xf2, 0x84, 0xe0, 0x3c, 0xb1, 0x1b, 0x71, 0x30, 3111 0xb0, 0xcf, 0x3e, 0x80, 0xdc, 0x80, 0x44, 0x5d, 0x62, 0x5e, 0xfb, 0x31,
3092 0x00, 0xee, 0xdf, 0x63, 0x6e, 0xcf, 0x13, 0x18, 0x57, 0xda, 0x83, 0xbc, 3112 0x8e, 0xe0, 0xfd, 0x00, 0xf6, 0x0e, 0xe6, 0x89, 0x9c, 0xee, 0x6e, 0x39,
3093 0x70, 0x3f, 0xfa, 0x59, 0xd7, 0x28, 0xda, 0x01, 0xbc, 0xef, 0xc1, 0xd8, 3113 0x02, 0x31, 0xb1, 0x86, 0x58, 0x59, 0x9f, 0x61, 0xcc, 0x80, 0x3d, 0xd8,
3094 0xfe, 0x1c, 0x91, 0xcb, 0xdd, 0x2d, 0x3f, 0x20, 0x26, 0x56, 0x11, 0x2b, 3114 0xa6, 0x45, 0x60, 0xb8, 0x09, 0x1e, 0x6c, 0xdb, 0x22, 0x6c, 0xc8, 0x79,
3095 0x6b, 0x9c, 0x27, 0x38, 0x16, 0x79, 0x4f, 0x8b, 0xe0, 0x6f, 0x1b, 0x3a, 3115 0xce, 0xa2, 0xc9, 0x4d, 0x8e, 0xeb, 0x34, 0x8f, 0xc4, 0xdb, 0x79, 0x84,
3096 0x78, 0x6f, 0x8b, 0xd8, 0x43, 0xce, 0x71, 0x82, 0x2a, 0x1b, 0x3b, 0xe5, 3116 0x64, 0x4c, 0x34, 0x13, 0xf6, 0x89, 0xd0, 0x8c, 0xce, 0x6e, 0x09, 0xc4,
3097 0x0f, 0x5e, 0x0f, 0x38, 0xec, 0x34, 0xaf, 0xc5, 0x15, 0x0d, 0xf0, 0x59, 3117 0x70, 0x39, 0x66, 0x5c, 0xdb, 0x9c, 0x05, 0xbd, 0x86, 0xf8, 0xa8, 0x9a,
3098 0xb8, 0x31, 0x8d, 0xef, 0xc8, 0x85, 0x22, 0xb2, 0x1b, 0xa7, 0x53, 0x2e, 3118 0xf5, 0xb3, 0x29, 0xa6, 0xd5, 0x37, 0x1d, 0xe9, 0x93, 0xcd, 0xc4, 0xc2,
3099 0x6b, 0x6c, 0x8c, 0x29, 0x9c, 0xc6, 0x89, 0xc0, 0x3b, 0x73, 0x59, 0xce, 3119 0x3b, 0x63, 0x5a, 0x8e, 0x61, 0x4c, 0x4f, 0x61, 0x04, 0x7c, 0x8b, 0x34,
3100 0x5d, 0x8c, 0x25, 0x0a, 0x20, 0xbb, 0x19, 0x1a, 0x52, 0x2e, 0xf9, 0x23, 3120 0x21, 0x56, 0xfc, 0x31, 0xaa, 0xc3, 0x3f, 0x43, 0xe0, 0x5a, 0x1d, 0xb8,
3101 0xd4, 0x00, 0x2e, 0x03, 0xf0, 0x59, 0x03, 0x7c, 0x56, 0xef, 0xe3, 0xb3, 3121 0x16, 0x0f, 0xe0, 0x5a, 0xfc, 0x99, 0xb8, 0x06, 0xcc, 0xea, 0x02, 0xb3,
3102 0xfa, 0xe7, 0xf2, 0x19, 0xb8, 0xaa, 0x03, 0xae, 0xea, 0x80, 0xab, 0x50, 3122 0x50, 0x23, 0xbc, 0x06, 0x8c, 0x7f, 0x15, 0xe7, 0x5d, 0xee, 0xee, 0x84,
3103 0x1b, 0xbc, 0x03, 0xec, 0xbf, 0xdd, 0xd9, 0x89, 0xe3, 0x98, 0xdf, 0x98, 3123 0x75, 0x8c, 0x73, 0x8c, 0x77, 0x33, 0xf4, 0xe6, 0xc1, 0x7f, 0x15, 0xef,
3104 0xe7, 0xa6, 0xe8, 0xf2, 0xde, 0xff, 0x94, 0xe7, 0x8e, 0x83, 0x13, 0x6c, 3124 0xda, 0xc0, 0x06, 0x93, 0xbe, 0x7b, 0xf0, 0xde, 0x98, 0x77, 0x06, 0x98,
3105 0xfa, 0xfe, 0xde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 0x9f, 0x43, 0xde, 0xb6, 0x8b, 0x72, 0x6c, 0x24, 0xa7, 0xb3, 0xfd, 0xaa,
3171 0x34, 0x7c, 0x9c, 0x81, 0x50, 0x5b, 0xac, 0x24, 0x9c, 0xcf, 0xf7, 0xd9, 3191 0xdc, 0xc7, 0xf9, 0xa2, 0x99, 0xc8, 0x7e, 0x42, 0xa9, 0x76, 0xc9, 0xa9,
3172 0xba, 0xe2, 0xb9, 0x4d, 0xc8, 0xe0, 0x79, 0x83, 0xf4, 0x86, 0xcf, 0xf7, 3192 0xfb, 0xe8, 0x93, 0x50, 0x7b, 0xb4, 0x13, 0xce, 0xf5, 0x73, 0xa6, 0x2a,
3173 0x07, 0xd9, 0xdd, 0x46, 0x89, 0x86, 0x21, 0x0f, 0xbb, 0xc6, 0xd8, 0xae, 3193 0xb1, 0xef, 0x06, 0x68, 0xf0, 0xbc, 0x49, 0x6a, 0xdd, 0xe7, 0xef, 0x0c,
3174 0xa0, 0xa1, 0x6a, 0x11, 0xd6, 0xbd, 0x5f, 0x4f, 0xef, 0x5c, 0x7e, 0x93, 3194 0xfc, 0x0d, 0x04, 0xf1, 0x63, 0xd3, 0x6e, 0xd0, 0x43, 0xae, 0x71, 0x96,
3175 0xcd, 0x65, 0x83, 0x5f, 0x08, 0xe7, 0x1d, 0x9f, 0xf3, 0xda, 0xd7, 0x0c, 3195 0x2b, 0xac, 0xcb, 0x3a, 0x85, 0x79, 0x1f, 0x52, 0xd3, 0x6f, 0x33, 0xef,
3176 0xba, 0x4e, 0x8a, 0x23, 0xc5, 0x37, 0x90, 0xef, 0x0e, 0x42, 0x26, 0x50, 3196 0x66, 0x67, 0x99, 0x88, 0x1f, 0xc6, 0x5d, 0x9f, 0x73, 0xde, 0x97, 0x34,
3177 0xfc, 0x92, 0x9e, 0x19, 0x72, 0x99, 0x8a, 0xb1, 0x5d, 0xc7, 0x77, 0xcc, 3197 0xba, 0x49, 0x12, 0x37, 0xad, 0x87, 0x91, 0x0b, 0x0f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 0x6f, 0x50, 0xb0, 0x0f, 0xee, 0xff,
3229 0xc3, 0xf3, 0x13, 0x6c, 0x99, 0x98, 0xba, 0xa0, 0xce, 0x3d, 0xd3, 0xa8, 3249 0xfa, 0x1d, 0xf5, 0x67, 0x5e, 0x67, 0x32, 0xbd, 0x10, 0xcd, 0x79, 0x3e,
3230 0xf1, 0xb8, 0x95, 0xa8, 0x83, 0xf8, 0xae, 0x8b, 0x6b, 0x27, 0x89, 0xf8, 3250 0x9f, 0x20, 0xcb, 0xd4, 0xcc, 0x25, 0xd9, 0x13, 0xcd, 0xa2, 0xee, 0xe3,
3231 0x4f, 0x9f, 0x63, 0x3e, 0x13, 0xcd, 0xb0, 0x0e, 0x3e, 0x1b, 0x71, 0xfc, 3251 0x51, 0xa0, 0x26, 0xe2, 0xef, 0x61, 0xae, 0x55, 0xc7, 0x73, 0x35, 0x7b,
3232 0xfc, 0x1b, 0x2f, 0xf3, 0x0a, 0xbd, 0x68, 0x18, 0x00, 0x00, 0x00 }; 3252 0x6e, 0x72, 0xbf, 0x34, 0xcf, 0x3c, 0xb8, 0x6f, 0xe2, 0xf8, 0xf9, 0x27,
3253 0x6e, 0xb7, 0x92, 0x82, 0x90, 0x18, 0x00, 0x00, 0x00 };
3233 3254
3234static const u32 bnx2_TPAT_b09FwData[(0x0/4) + 1] = { 0x0 }; 3255static const u32 bnx2_TPAT_b09FwData[(0x0/4) + 1] = { 0x0 };
3235static const u32 bnx2_TPAT_b09FwRodata[(0x0/4) + 1] = { 0x0 }; 3256static const u32 bnx2_TPAT_b09FwRodata[(0x0/4) + 1] = { 0x0 };
3236 3257
3237static struct fw_info bnx2_tpat_fw_09 = { 3258static struct fw_info bnx2_tpat_fw_09 = {
3259 /* Firmware version: 3.7.1 */
3238 .ver_major = 0x3, 3260 .ver_major = 0x3,
3239 .ver_minor = 0x4, 3261 .ver_minor = 0x7,
3240 .ver_fix = 0x3, 3262 .ver_fix = 0x1,
3241 3263
3242 .start_addr = 0x08000860, 3264 .start_addr = 0x08000860,
3243 3265
3244 .text_addr = 0x08000800, 3266 .text_addr = 0x08000800,
3245 .text_len = 0x1864, 3267 .text_len = 0x188c,
3246 .text_index = 0x0, 3268 .text_index = 0x0,
3247 .gz_text = bnx2_TPAT_b09FwText, 3269 .gz_text = bnx2_TPAT_b09FwText,
3248 .gz_text_len = sizeof(bnx2_TPAT_b09FwText), 3270 .gz_text_len = sizeof(bnx2_TPAT_b09FwText),
3249 3271
3250 .data_addr = 0x08002080, 3272 .data_addr = 0x080020c0,
3251 .data_len = 0x0, 3273 .data_len = 0x0,
3252 .data_index = 0x0, 3274 .data_index = 0x0,
3253 .data = bnx2_TPAT_b09FwData, 3275 .data = bnx2_TPAT_b09FwData,
3254 3276
3255 .sbss_addr = 0x08002088, 3277 .sbss_addr = 0x080020c8,
3256 .sbss_len = 0x2c, 3278 .sbss_len = 0x30,
3257 .sbss_index = 0x0, 3279 .sbss_index = 0x0,
3258 3280
3259 .bss_addr = 0x080020c0, 3281 .bss_addr = 0x08002100,
3260 .bss_len = 0x850, 3282 .bss_len = 0x850,
3261 .bss_index = 0x0, 3283 .bss_index = 0x0,
3262 3284
@@ -3267,768 +3289,770 @@ static struct fw_info bnx2_tpat_fw_09 = {
3267}; 3289};
3268 3290
3269static u8 bnx2_TXP_b09FwText[] = { 3291static u8 bnx2_TXP_b09FwText[] = {
3270/* 0x1f, 0x8b, 0x08, 0x00, 0x0e, 0x34, 0xe7, 0x45, 0x00, 0x03, */ 3292 0xbd, 0x7c, 0x7d, 0x70, 0x1c, 0xe7, 0x79, 0xdf, 0xb3, 0xbb, 0x07, 0xe0,
3271 0xcd, 0x7c, 3293 0x00, 0x82, 0xe0, 0x12, 0x39, 0x52, 0x27, 0x0a, 0xa6, 0x6e, 0x89, 0x3d,
3272 0x6f, 0x70, 0x5b, 0xd7, 0x95, 0xdf, 0x79, 0xef, 0x81, 0x24, 0x48, 0xd1, 3294 0x08, 0x32, 0x20, 0x71, 0xc5, 0x20, 0x36, 0x26, 0xb9, 0xca, 0xab, 0xbb,
3273 0xd4, 0x13, 0x17, 0x56, 0x60, 0x87, 0x71, 0x00, 0xf1, 0x81, 0x66, 0x42, 3295 0x03, 0x78, 0x94, 0x31, 0x31, 0xc4, 0xc2, 0x16, 0xed, 0x70, 0xd4, 0xeb,
3274 0xae, 0x04, 0x2b, 0x4c, 0xc2, 0x6d, 0xd1, 0xf8, 0x05, 0x00, 0x29, 0x48, 3296 0x01, 0xa4, 0x95, 0x54, 0x9e, 0xb2, 0xb6, 0xda, 0x72, 0x5a, 0x35, 0x3a,
3275 0xd1, 0x6c, 0x68, 0x95, 0x49, 0x94, 0x54, 0xe3, 0x62, 0x41, 0x52, 0xf1, 3297 0x1f, 0xc0, 0x0f, 0x29, 0x47, 0x1c, 0x24, 0xc0, 0x84, 0xfe, 0x70, 0x93,
3276 0xb6, 0xce, 0x54, 0x9b, 0x78, 0x5a, 0x4d, 0xeb, 0xad, 0x11, 0x90, 0xfa, 3298 0x13, 0x0e, 0x24, 0x64, 0xf7, 0x88, 0x93, 0xfc, 0xd9, 0x3f, 0x62, 0x0b,
3277 0xe7, 0x85, 0x04, 0xda, 0x62, 0x44, 0x7f, 0xc8, 0x07, 0x18, 0x80, 0x24, 3299 0x03, 0xd2, 0xb4, 0x5a, 0xbb, 0xb5, 0xda, 0x28, 0x13, 0xcf, 0xf4, 0x63,
3278 0x6f, 0xf2, 0x44, 0x28, 0x9b, 0x7f, 0xfd, 0xd0, 0xac, 0x50, 0x4a, 0xd6, 3300 0x30, 0x14, 0xa5, 0x28, 0x71, 0xa7, 0x56, 0x9b, 0x4c, 0xa2, 0x36, 0x94,
3279 0xba, 0x9b, 0xb4, 0xa3, 0xed, 0x66, 0x67, 0x3b, 0xd3, 0x2f, 0x1c, 0x49, 3301 0xaf, 0xbf, 0xdf, 0xbb, 0xbb, 0xe0, 0x01, 0x22, 0x65, 0x51, 0x93, 0x14,
3280 0xf6, 0x7a, 0x77, 0x67, 0x36, 0xda, 0x6e, 0xb6, 0xab, 0xb6, 0xb2, 0xd1, 3302 0x33, 0x37, 0x77, 0xfb, 0xee, 0xbb, 0xef, 0xfb, 0x7c, 0xbd, 0xcf, 0xf3,
3281 0xdf, 0xef, 0xbe, 0xf7, 0x28, 0x90, 0xa6, 0x6c, 0xcb, 0xb3, 0xed, 0x94, 3303 0xfc, 0x9e, 0xf7, 0x5d, 0x44, 0x45, 0xda, 0xc4, 0xff, 0xdb, 0x8a, 0x4f,
3282 0x33, 0x18, 0xe0, 0xdd, 0x77, 0xdf, 0xb9, 0xe7, 0x9e, 0x73, 0xee, 0x39, 3304 0xec, 0xd8, 0xf1, 0xc7, 0xef, 0xfd, 0xf8, 0xbd, 0xbf, 0x8a, 0x9f, 0xf7,
3283 0xe7, 0x77, 0xee, 0x7d, 0x0c, 0x8b, 0x74, 0x89, 0xf7, 0xf7, 0x00, 0x3e, 3305 0x89, 0xd6, 0x62, 0xf0, 0xe6, 0x5b, 0x86, 0x48, 0xf6, 0xcf, 0xe5, 0x43,
3284 0x91, 0x43, 0x87, 0x9f, 0xd9, 0x3e, 0xb2, 0xfd, 0x13, 0xf8, 0xf9, 0x09, 3306 0xff, 0xe1, 0x71, 0x33, 0x18, 0x9f, 0x1f, 0x09, 0xeb, 0x89, 0x57, 0x87,
3285 0x31, 0x02, 0x06, 0x6f, 0xbe, 0x69, 0x88, 0x64, 0xff, 0x42, 0x3e, 0xf0, 3307 0x93, 0xb6, 0x84, 0x8d, 0x44, 0xfe, 0xa1, 0x71, 0x5b, 0xc4, 0xad, 0xf6,
3286 0x1f, 0x1e, 0x37, 0x7d, 0xfa, 0xfc, 0x48, 0x50, 0x4f, 0x4c, 0xec, 0x4a, 3308 0xc5, 0x52, 0xf2, 0x6e, 0x3d, 0x1f, 0x09, 0x09, 0xdb, 0x3f, 0x92, 0xb8,
3287 0x5a, 0x12, 0x34, 0x12, 0xb2, 0x6f, 0xca, 0x12, 0xb1, 0x9d, 0xa1, 0x48, 3309 0xf6, 0xe4, 0xf7, 0x3e, 0x6e, 0xbd, 0x5d, 0x36, 0x24, 0x6c, 0x26, 0xb2,
3288 0x4a, 0xde, 0x6a, 0xe6, 0x43, 0x01, 0x61, 0xfb, 0x47, 0x12, 0x77, 0x9e, 3310 0x62, 0xf6, 0x48, 0xb8, 0x0b, 0xcf, 0x7c, 0xf5, 0xae, 0x47, 0x0d, 0xe9,
3289 0xfb, 0xc9, 0xa7, 0xa3, 0xb7, 0xca, 0x86, 0x04, 0xcd, 0x44, 0x56, 0xcc, 3311 0x08, 0xc6, 0x7a, 0xab, 0xfe, 0xbd, 0xbb, 0x24, 0xbf, 0x2b, 0x51, 0x8f,
3290 0x01, 0x09, 0xf6, 0xe1, 0x99, 0x6f, 0x3f, 0x6a, 0x18, 0xd2, 0xb3, 0xca, 3312 0x85, 0x12, 0xef, 0xd6, 0xa7, 0x06, 0xc2, 0xa2, 0x27, 0xac, 0x68, 0xd2,
3291 0xab, 0xcc, 0x95, 0x56, 0x9a, 0x3f, 0x79, 0x34, 0x2c, 0xbf, 0x57, 0x0f, 3313 0x88, 0xc8, 0xcb, 0x35, 0x53, 0x5e, 0xac, 0xc5, 0x64, 0xb2, 0x26, 0x1d,
3292 0xc9, 0xf7, 0xea, 0xa6, 0x5c, 0xac, 0x07, 0xb4, 0xf1, 0x92, 0x29, 0xb3, 3314 0xe9, 0xda, 0x8d, 0x68, 0xaa, 0xa3, 0xef, 0xbb, 0xf5, 0xe4, 0x40, 0x28,
3293 0xa5, 0x69, 0xfd, 0x48, 0x31, 0x2f, 0xa9, 0x7a, 0x56, 0x2f, 0x2c, 0x98, 3315 0x6b, 0x24, 0xa4, 0x23, 0x59, 0x93, 0xd1, 0x63, 0xc5, 0xd6, 0x87, 0x9b,
3294 0x3d, 0xc9, 0xf3, 0x39, 0x7d, 0x76, 0xa1, 0xb7, 0x27, 0x75, 0x7e, 0x5a, 3316 0x12, 0x4f, 0xd6, 0x75, 0x5b, 0xb2, 0xa1, 0x84, 0x9d, 0xd7, 0x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x05, 0x25, 0x19, 0x7f, 0xab, 0xe9, 0x3e, 3324 0xe4, 0x2b, 0xf2, 0xc4, 0x94, 0xd3, 0x2e, 0x53, 0x4b, 0x47, 0x7d, 0x5d,
3303 0x13, 0xc4, 0x98, 0x81, 0x9e, 0xb1, 0x52, 0xb3, 0x99, 0x8e, 0x83, 0x7e, 3325 0x44, 0xd0, 0xd6, 0x2b, 0xf9, 0x5a, 0x14, 0x9f, 0x9f, 0xf8, 0xfc, 0xea,
3304 0xdc, 0x7f, 0xb6, 0x4d, 0xca, 0x21, 0xbb, 0x3c, 0x1b, 0xff, 0x6f, 0xba, 3326 0x22, 0x3b, 0x05, 0xcf, 0xf7, 0xa7, 0xdd, 0xea, 0xd7, 0xc2, 0x5e, 0xdb,
3305 0xab, 0x13, 0xce, 0x91, 0xd7, 0xb6, 0xe8, 0x56, 0x5e, 0x72, 0x21, 0x29, 3327 0x7f, 0xd9, 0xe2, 0x7d, 0x83, 0xdf, 0x12, 0xf8, 0x2d, 0x85, 0x65, 0xcd,
3306 0x17, 0xe2, 0x9f, 0x92, 0x13, 0xf1, 0x30, 0xe6, 0x17, 0x94, 0x63, 0x71, 3328 0x88, 0xca, 0xf7, 0xee, 0x8a, 0xc9, 0x54, 0x69, 0x0d, 0xb2, 0x89, 0xca,
3307 0xc8, 0xd1, 0x3a, 0xac, 0x25, 0xeb, 0xd1, 0x48, 0x56, 0x9e, 0x97, 0xe4, 3329 0x37, 0x6a, 0x11, 0x79, 0x49, 0xc9, 0x22, 0xa4, 0x0d, 0xa3, 0xcf, 0x64,
3308 0x62, 0xbf, 0x99, 0x16, 0x8c, 0x6d, 0x35, 0x3f, 0x9a, 0x8c, 0x63, 0xbc, 3330 0x69, 0x42, 0x3f, 0x51, 0xcc, 0x4b, 0xaa, 0x96, 0xd5, 0x0b, 0x73, 0x66,
3309 0xe1, 0xff, 0xd5, 0xb4, 0x43, 0xd1, 0x6c, 0x59, 0x06, 0xa5, 0x50, 0xea, 3331 0x47, 0x72, 0x29, 0xa7, 0x4f, 0xce, 0x75, 0x76, 0xa4, 0x96, 0x26, 0xf4,
3310 0x8f, 0xff, 0x4c, 0x34, 0x09, 0x5a, 0x62, 0x4f, 0x59, 0x26, 0xe4, 0x16, 3332 0x42, 0x31, 0x0a, 0x39, 0x98, 0x1d, 0xa9, 0xf9, 0x08, 0xae, 0x3b, 0x3b,
3311 0x1d, 0x4c, 0x19, 0x4d, 0xd9, 0x83, 0xf1, 0x93, 0x16, 0xee, 0xd7, 0x65, 3333 0x92, 0xf3, 0xd6, 0x0c, 0x26, 0x45, 0x9f, 0x68, 0x47, 0xaa, 0x64, 0x65,
3312 0xb3, 0x6e, 0xb5, 0x4b, 0xc1, 0x94, 0x50, 0x97, 0x3c, 0x22, 0x85, 0xd3, 3334 0x45, 0xba, 0x9d, 0x1f, 0x48, 0x57, 0x47, 0xaa, 0xf6, 0x5b, 0xfa, 0x8a,
3313 0x68, 0x8f, 0xdb, 0xbd, 0x3a, 0x9e, 0xc9, 0x8c, 0xb0, 0x4d, 0x34, 0x23, 3335 0xa9, 0x49, 0xe1, 0x1e, 0x31, 0xa3, 0x89, 0xb7, 0xeb, 0xb7, 0xdb, 0x9a,
3314 0x11, 0x33, 0x53, 0xe0, 0xa8, 0xe2, 0x0c, 0x62, 0xfc, 0x98, 0xdd, 0xa9, 3336 0x98, 0xf6, 0x3b, 0xf5, 0xed, 0x90, 0x4d, 0x6e, 0xb6, 0x15, 0xbc, 0x92,
3315 0x99, 0xb2, 0x62, 0x06, 0xa4, 0xea, 0xc4, 0xec, 0xb0, 0xd6, 0x2e, 0xc7, 3337 0x26, 0x53, 0x72, 0xf3, 0x7d, 0xe6, 0xaa, 0x34, 0x89, 0x1b, 0x09, 0xae,
3316 0x62, 0x5d, 0x90, 0x69, 0x18, 0xb4, 0xe5, 0x9b, 0x7a, 0x22, 0x16, 0xce, 3338 0xeb, 0xf5, 0xa4, 0xf3, 0x07, 0xe4, 0x91, 0xf2, 0xee, 0x18, 0x86, 0x5e,
3317 0x41, 0x51, 0x3a, 0x64, 0x35, 0x07, 0x7e, 0xe6, 0xe2, 0x59, 0x2d, 0x55, 3339 0x92, 0xa0, 0x39, 0xe9, 0xbc, 0x5b, 0xf7, 0x9e, 0x09, 0x63, 0xce, 0x50,
3318 0xff, 0x8a, 0x96, 0x3c, 0xbf, 0x5f, 0xdb, 0x75, 0x1e, 0x7d, 0xea, 0xe7, 3340 0xc7, 0x50, 0xa9, 0x5e, 0x4f, 0x3b, 0x18, 0xdf, 0x09, 0x9e, 0x6d, 0x92,
3319 0x3c, 0xbb, 0x0b, 0x83, 0x37, 0x1d, 0xcf, 0xb2, 0x1d, 0x3c, 0x2b, 0xde, 3341 0x72, 0xc4, 0x2d, 0x4f, 0x3a, 0x96, 0xe1, 0xc9, 0x87, 0xba, 0xe7, 0xb5,
3320 0xd1, 0x06, 0x5d, 0x36, 0x26, 0x43, 0x3d, 0x49, 0xa5, 0x4b, 0xf2, 0xa6, 3342 0x0b, 0x7d, 0xe4, 0x25, 0x17, 0x91, 0x72, 0xc1, 0xf9, 0x98, 0x3c, 0xe5,
3321 0x4b, 0x6e, 0x42, 0x93, 0x5e, 0xcb, 0x96, 0xe0, 0x27, 0xa1, 0xcf, 0x45, 3343 0x44, 0xc1, 0x5f, 0x58, 0x4e, 0x39, 0xb0, 0x2f, 0xfb, 0xb8, 0x96, 0xac,
3322 0xe8, 0x72, 0x31, 0x22, 0x47, 0x4a, 0x12, 0xd2, 0x85, 0x63, 0x65, 0xf5, 3344 0x59, 0xb1, 0xac, 0x3c, 0x2d, 0xc9, 0xf9, 0x6e, 0x33, 0x2d, 0x98, 0xdb,
3323 0xaa, 0x43, 0x7b, 0x80, 0x6e, 0xa1, 0xfb, 0x82, 0xc3, 0x67, 0xa1, 0xc3, 3345 0xae, 0xdf, 0x99, 0x74, 0x30, 0x5f, 0xff, 0xff, 0xad, 0xbb, 0x11, 0x2b,
3324 0x52, 0x1a, 0xf2, 0xc9, 0x60, 0xec, 0x7d, 0xda, 0x9e, 0xea, 0xa4, 0x96, 3346 0x5b, 0x96, 0x5e, 0x29, 0x94, 0xba, 0x9d, 0x1f, 0x43, 0x4f, 0x61, 0x5b,
3325 0x81, 0x9d, 0x14, 0x4e, 0x0f, 0x41, 0x77, 0xd1, 0xc8, 0x8a, 0x6c, 0x96, 3347 0xdc, 0x71, 0xdb, 0x84, 0xdc, 0xac, 0xde, 0x94, 0x51, 0x97, 0x07, 0x31,
3326 0x82, 0x65, 0x45, 0xbe, 0x2c, 0xdd, 0x72, 0x6c, 0xd1, 0x92, 0x23, 0x8b, 3348 0x7f, 0xd2, 0xc6, 0xfd, 0x9a, 0x6c, 0xd3, 0xed, 0x66, 0x29, 0x98, 0x12,
3327 0x21, 0xc9, 0x9b, 0x51, 0xb3, 0x26, 0x7d, 0xd9, 0x4d, 0x89, 0x1e, 0x79, 3349 0x69, 0x93, 0xdd, 0x52, 0x98, 0x45, 0xbb, 0xe3, 0x76, 0xea, 0x78, 0x26,
3328 0xfe, 0x74, 0x34, 0x53, 0x96, 0x7e, 0xfb, 0x75, 0xdc, 0xcf, 0x9d, 0xa4, 3350 0x33, 0xc0, 0x36, 0xd1, 0x8c, 0x04, 0x75, 0x2c, 0xb2, 0x50, 0xed, 0xc5,
3329 0x4e, 0x25, 0x9f, 0x8a, 0x1b, 0x92, 0x85, 0x4d, 0x18, 0xd6, 0x1f, 0x81, 3351 0xfc, 0x71, 0xb7, 0x55, 0x33, 0x65, 0xcd, 0x0c, 0x49, 0xa5, 0x1a, 0x77,
3330 0xff, 0xe6, 0x73, 0xc9, 0x78, 0x34, 0x2c, 0xa2, 0x4b, 0xea, 0x0b, 0xfd, 3352 0xa3, 0x5a, 0xb3, 0x9c, 0x8a, 0xb7, 0x41, 0xa6, 0x51, 0x8c, 0x2d, 0x5f,
3331 0xe6, 0x6e, 0x89, 0x9a, 0x19, 0xca, 0x3f, 0x3e, 0x04, 0x3d, 0xfc, 0x77, 3353 0xd6, 0x13, 0xf1, 0x68,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 0x90, 0x21, 3375 0xa2, 0xc6, 0xfe, 0x79, 0xd8, 0x58, 0x58, 0x96, 0xef, 0x6a, 0x97, 0x2c,
3354 0xdb, 0x75, 0xf0, 0xdc, 0x01, 0x1e, 0x82, 0x98, 0x4f, 0x3f, 0xd6, 0x43, 3376 0xda, 0x0b, 0xf3, 0xe2, 0x26, 0x1d, 0x1d, 0xcf, 0x74, 0x80, 0x97, 0x9d,
3355 0x07, 0xe8, 0x6f, 0xc2, 0x9c, 0x3a, 0x65, 0xfa, 0x74, 0x2f, 0x74, 0x61, 3377 0xf8, 0xb4, 0xc9, 0x78, 0xa5, 0xc5, 0xe5, 0x7a, 0x1d, 0xaf, 0x51, 0xff,
3356 0xa2, 0x6f, 0x50, 0x9e, 0x2f, 0x45, 0x61, 0x03, 0xec, 0x0f, 0x1d, 0x2c, 3378 0xf8, 0x2e, 0x05, 0x36, 0x40, 0xf9, 0xb2, 0x9d, 0xcf, 0xb1, 0xdd, 0x44,
3357 0x46, 0xc3, 0x55, 0xb1, 0x65, 0x2e, 0xde, 0x01, 0xfb, 0x6a, 0x36, 0x67, 3379 0x7b, 0x63, 0x1b, 0x6d, 0x7b, 0x1b, 0x65, 0xda, 0xcb, 0x35, 0x9a, 0x2b,
3358 0x60, 0x1f, 0xdf, 0x51, 0xfe, 0x62, 0xc8, 0x1c, 0xd3, 0x24, 0xdf, 0x91, 3380 0xc5, 0xcd, 0x43, 0xfc, 0xae, 0xd1, 0x1e, 0x1a, 0x6d, 0x21, 0x84, 0xfe,
3359 0x38, 0x0c, 0x7e, 0xa2, 0x4f, 0x89, 0xf0, 0x7a, 0x87, 0xc6, 0x35, 0x0b, 3381 0xd0, 0x63, 0x05, 0x73, 0xcd, 0x5e, 0xab, 0x37, 0x0d, 0xe0, 0xda, 0xfe,
3360 0x39, 0x72, 0x6c, 0xf8, 0xa4, 0xad, 0x90, 0x21, 0xfd, 0x56, 0x1f, 0xec, 3382 0x1d, 0xf0, 0xc9, 0xb9, 0x43, 0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x2f, 0x73, 0x8e, 0x88, 0xf7, 3426 0xdc, 0xf5, 0x74, 0x4e, 0x5d, 0xb7, 0xca, 0x11, 0x35, 0x6f, 0x5d, 0x42,
3405 0x8c, 0xfb, 0x16, 0x73, 0x9e, 0x7c, 0x20, 0xd1, 0x25, 0xf9, 0x2d, 0x5c, 3427 0xf7, 0x09, 0xbc, 0x8a, 0x3c, 0x60, 0x24, 0x2c, 0x8c, 0xa7, 0x63, 0x7e,
3406 0x8f, 0xf4, 0x73, 0xf4, 0x5d, 0xed, 0x1e, 0xdf, 0x7e, 0x8e, 0xa4, 0x78, 3428 0xea, 0x2b, 0x0e, 0x1a, 0x04, 0xfa, 0x6d, 0x57, 0xbe, 0x68, 0x3f, 0xf4,
3407 0x33, 0x30, 0x65, 0xf4, 0x41, 0x3e, 0x54, 0xe2, 0x3c, 0xde, 0xf2, 0xec, 3429 0xbe, 0x5a, 0xbd, 0x35, 0x5d, 0x65, 0x1a, 0x74, 0xf5, 0xe0, 0x06, 0x5d,
3408 0x89, 0xb9, 0x82, 0xb4, 0xb9, 0xbe, 0x61, 0x2f, 0x72, 0x01, 0xda, 0x81, 3430 0xb5, 0x48, 0x7f, 0x3c, 0xd0, 0xd1, 0x36, 0x49, 0xc6, 0xa9, 0xb3, 0x5b,
3409 0xaf, 0x73, 0xea, 0x9b, 0x39, 0x82, 0x44, 0x74, 0x8b, 0x39, 0x82, 0x98, 3431 0xd1, 0xd5, 0xb9, 0xbf, 0x25, 0x5d, 0x7d, 0xf7, 0x26, 0xba, 0xfa, 0xde,
3410 0x46, 0x62, 0x9f, 0x66, 0x43, 0xf7, 0x36, 0x74, 0x6f, 0x43, 0xf7, 0x36, 3432 0x26, 0x5d, 0xd9, 0xe6, 0x33, 0x1a, 0xc7, 0x66, 0xfc, 0xa0, 0x3f, 0xaa,
3411 0x74, 0x9f, 0xac, 0x1f, 0xc6, 0x3d, 0x95, 0x87, 0x80, 0x17, 0x97, 0x7e, 3433 0xdf, 0x39, 0xce, 0xfc, 0xa1, 0xc6, 0x35, 0x1d, 0xe4, 0x1d, 0x5c, 0xcf,
3412 0xda, 0xa5, 0x0f, 0x3e, 0xb7, 0x4a, 0x4e, 0xe9, 0x84, 0xf3, 0x45, 0xae, 3434 0x2f, 0xd7, 0x0d, 0xdb, 0x86, 0xec, 0xb8, 0xa6, 0x29, 0x37, 0xcb, 0xfc,
3413 0xa1, 0xfc, 0xf5, 0xb8, 0xe6, 0xfa, 0x6b, 0xd2, 0xcb, 0xe0, 0xf9, 0xdb, 3435 0x14, 0xe9, 0x47, 0xec, 0x18, 0x47, 0xac, 0xf1, 0x68, 0x68, 0x96, 0xf2,
3414 0x98, 0xa7, 0xad, 0xeb, 0xd6, 0x5d, 0x99, 0xcc, 0xb5, 0xc8, 0x64, 0xd6, 3436 0x76, 0xaf, 0xff, 0x78, 0xa9, 0xfe, 0x73, 0x3d, 0xf1, 0x0b, 0xe4, 0x95,
3415 0xa1, 0x8c, 0xd8, 0x9f, 0x3e, 0x77, 0x5a, 0xaf, 0xac, 0xca, 0x65, 0x2f, 3437 0xb6, 0x1f, 0x07, 0xc2, 0xf2, 0x85, 0x8a, 0x95, 0x75, 0xb5, 0x76, 0xc9,
3416 0x78, 0xe8, 0xe0, 0xdc, 0xbd, 0x79, 0x90, 0x7e, 0xaf, 0x47, 0xff, 0x6f, 3438 0xef, 0x40, 0xec, 0x29, 0xd1, 0x7f, 0xed, 0xbc, 0x49, 0x8c, 0xee, 0xf2,
3417 0xd1, 0x87, 0xfe, 0x75, 0xa3, 0x71, 0x39, 0x26, 0x73, 0xc6, 0x77, 0x9b, 3439 0x63, 0xf4, 0x9f, 0x81, 0x56, 0xe6, 0x57, 0xff, 0xe6, 0xdd, 0x95, 0x08,
3418 0x0f, 0x72, 0x66, 0xac, 0x81, 0xef, 0x21, 0x96, 0x5f, 0x44, 0x2c, 0x59, 3440 0xbf, 0xe3, 0xe6, 0x41, 0xf9, 0x2c, 0x79, 0x44, 0xbc, 0x67, 0xdc, 0xb7,
3419 0x31, 0x22, 0xf2, 0x93, 0x47, 0xaf, 0x21, 0x97, 0x96, 0xfc, 0xc3, 0x89, 3441 0x99, 0xf3, 0xe4, 0x43, 0x89, 0x36, 0xc9, 0x6f, 0xe7, 0x7a, 0xa4, 0x9f,
3420 0x66, 0x24, 0x90, 0x78, 0xab, 0x39, 0x37, 0x82, 0x18, 0x97, 0x88, 0x86, 3442 0xa3, 0xef, 0x6a, 0xf6, 0xe9, 0x0e, 0x72, 0x24, 0xfe, 0xb5, 0x18, 0x60,
3421 0x93, 0xc6, 0xb0, 0x5c, 0xaa, 0x0f, 0xca, 0x8f, 0xea, 0x96, 0xfc, 0xb0, 3443 0x19, 0x7d, 0x90, 0x0f, 0x95, 0xc8, 0xc7, 0xbb, 0xbe, 0x3d, 0x31, 0x57,
3422 0x1e, 0x91, 0x1f, 0x20, 0xe6, 0x7f, 0xbf, 0xde, 0x9a, 0x73, 0x47, 0x68, 3444 0x90, 0x26, 0xcf, 0x37, 0x8c, 0x20, 0x17, 0xa0, 0x1d, 0x04, 0x3a, 0xa7,
3423 0x4f, 0x3d, 0xe9, 0xfa, 0x46, 0xb9, 0x7f, 0x13, 0x34, 0xde, 0x82, 0x9d, 3445 0xbe, 0x99, 0x23, 0x48, 0x4c, 0xb7, 0x99, 0x23, 0x88, 0x69, 0x24, 0x0e,
3424 0x04, 0xb2, 0xc8, 0xf5, 0x19, 0xbf, 0x26, 0x0e, 0x15, 0x9f, 0x6b, 0x82, 3446 0x6a, 0x2e, 0x74, 0xef, 0x42, 0xf7, 0x2e, 0x74, 0xef, 0x42, 0xf7, 0xc9,
3425 0xb7, 0x6c, 0x5b, 0xc2, 0xca, 0xeb, 0x7a, 0xf7, 0xa8, 0xf9, 0x29, 0xb4, 3447 0xda, 0x71, 0xdc, 0x53, 0x79, 0x08, 0x68, 0xf1, 0xc6, 0x4f, 0x7b, 0xe3,
3426 0x39, 0xa3, 0x81, 0x6a, 0xb1, 0x53, 0xe5, 0x8b, 0xd0, 0x91, 0xd8, 0xf5, 3448 0x83, 0xce, 0x9d, 0x92, 0x53, 0x3a, 0x21, 0xbf, 0xc8, 0x35, 0x94, 0xbf,
3427 0x60, 0xb0, 0x56, 0xbc, 0x85, 0x7e, 0xcd, 0xe6, 0xa1, 0xf8, 0x6f, 0xed, 3449 0x1e, 0xd6, 0x3c, 0x7f, 0xcd, 0xf1, 0x32, 0x78, 0xfe, 0x7e, 0xe4, 0x73,
3428 0x30, 0xff, 0x81, 0x85, 0x35, 0xdd, 0xf9, 0x25, 0x23, 0xb1, 0x49, 0x66, 3450 0xae, 0xae, 0xdb, 0xd7, 0x65, 0x32, 0xd5, 0x20, 0x93, 0xc9, 0x2a, 0x65,
3429 0x43, 0xdf, 0x6f, 0x98, 0x03, 0x7d, 0x59, 0x3d, 0x11, 0x94, 0x74, 0x91, 3451 0xc4, 0xfe, 0xf4, 0xb9, 0x13, 0xfa, 0xc2, 0xba, 0x5c, 0x46, 0x40, 0x43,
3430 0x6b, 0x2a, 0x24, 0xb3, 0x55, 0x28, 0xff, 0x3c, 0xd7, 0x85, 0x3c, 0x3b, 3452 0x0b, 0x79, 0xf7, 0xf9, 0xe0, 0xf8, 0x9d, 0xfe, 0xf8, 0xbf, 0x81, 0x31,
3431 0x17, 0xef, 0x86, 0xed, 0xff, 0x9a, 0xe1, 0xae, 0x03, 0x18, 0x50, 0x75, 3453 0xe9, 0x5f, 0x6f, 0x34, 0x2f, 0xe7, 0x64, 0xce, 0xf8, 0x7e, 0xfc, 0x20,
3432 0x50, 0xf2, 0xe0, 0x37, 0x5f, 0x7f, 0xcb, 0xc3, 0x0e, 0xf0, 0x2a, 0x5b, 3454 0x67, 0xc6, 0x1a, 0x78, 0x69, 0x3d, 0x9f, 0x8e, 0x21, 0x9f, 0x7e, 0x07,
3433 0x21, 0xf8, 0xc4, 0x70, 0xda, 0x76, 0xfe, 0x30, 0x88, 0xb6, 0xe0, 0x56, 3455 0xb9, 0x74, 0xbd, 0xce, 0x38, 0x55, 0x40, 0x9e, 0x9b, 0x76, 0xb8, 0xae,
3434 0xeb, 0xce, 0x26, 0x7c, 0x3f, 0x10, 0xb2, 0x88, 0x4d, 0x24, 0xf3, 0x05, 3456 0x6f, 0x65, 0xdd, 0x6e, 0x58, 0xb3, 0x66, 0xd2, 0xe0, 0xb8, 0x61, 0xf1,
3435 0x7c, 0xff, 0x4a, 0x42, 0x36, 0xf7, 0xe2, 0x7b, 0x4b, 0x02, 0x26, 0x99, 3457 0xc6, 0xe4, 0xfd, 0x16, 0xe4, 0x82, 0xef, 0xe0, 0x37, 0x7d, 0x72, 0x90,
3436 0x60, 0xcc, 0xd5, 0x5a, 0x62, 0xae, 0x68, 0x69, 0xc8, 0x6e, 0x0e, 0x73, 3458 0xe7, 0xb1, 0x0f, 0x9f, 0x7f, 0x15, 0x73, 0xf7, 0x03, 0xcf, 0xf4, 0xca,
3437 0x4f, 0x43, 0x9e, 0x5f, 0xac, 0x07, 0xb5, 0xd4, 0xe9, 0x47, 0xc0, 0x87, 3459 0x77, 0x6a, 0xb6, 0x7c, 0x1b, 0x98, 0xe6, 0x5b, 0xc8, 0x2d, 0xbe, 0x59,
3438 0x9f, 0x3b, 0x23, 0x3f, 0x33, 0x97, 0xb7, 0x04, 0xe4, 0x16, 0x7c, 0x5c, 3460 0x0b, 0x72, 0xfb, 0xbd, 0x30, 0x75, 0xe6, 0xf7, 0x12, 0xde, 0x69, 0x13,
3439 0x12, 0x7e, 0xcc, 0x46, 0x6e, 0xb1, 0x03, 0xcb, 0x35, 0xfa, 0x5f, 0xbf, 3461 0x57, 0xe5, 0xf7, 0x7f, 0xda, 0x96, 0xad, 0x11, 0xfc, 0xfe, 0x95, 0x84,
3440 0x20, 0x5f, 0xf3, 0x78, 0x6b, 0x93, 0x05, 0x65, 0xa3, 0x6c, 0xcf, 0x67, 3462 0x6c, 0xeb, 0xc4, 0xf7, 0xf6, 0x04, 0x4c, 0x27, 0xc1, 0xd8, 0xa8, 0x35,
3441 0xfe, 0x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 0x6b, 0x03, 0xf0, 0x25, 0xbf, 0x0f, 0x9c, 0x66, 0x39, 0x4c,
3456 0x67, 0x97, 0x30, 0xf7, 0x68, 0x9c, 0x89, 0x65, 0x5b, 0x82, 0xeb, 0xe1, 3478 0x44, 0x9a, 0x12, 0xd4, 0xcd, 0x48, 0x2c, 0x69, 0xbf, 0x90, 0x59, 0xa8,
3457 0xcd, 0x08, 0x30, 0xe2, 0x6e, 0xe0, 0xbe, 0xdd, 0x67, 0xd5, 0xfa, 0x78, 3479 0xbe, 0x90, 0x39, 0xa7, 0x74, 0x35, 0x61, 0x79, 0x18, 0xf8, 0x09, 0x0b,
3458 0x33, 0xea, 0x61, 0xf7, 0x6d, 0xc0, 0xee, 0x78, 0x3e, 0x00, 0x4c, 0xc8, 3480 0x18, 0x18, 0xcf, 0x87, 0x80, 0x21, 0xd8, 0xde, 0x6e, 0x26, 0x91, 0xa3,
3459 0xf6, 0x2b, 0x66, 0x12, 0x7a, 0xaa, 0x3a, 0xf6, 0xee, 0x02, 0x3e, 0x73, 3481 0x54, 0xaa, 0x2b, 0x99, 0x02, 0x3e, 0x53, 0xaa, 0xef, 0x58, 0x8c, 0x7d,
3460 0xaa, 0xef, 0xad, 0x08, 0xfb, 0x76, 0x24, 0x12, 0xd1, 0x3f, 0xc3, 0x77, 3482 0x5b, 0x12, 0xe5, 0xd8, 0x9f, 0xe2, 0xbb, 0x39, 0x31, 0x67, 0x5d, 0xb6,
3461 0x7b, 0x22, 0xbc, 0xed, 0xaa, 0x45, 0xba, 0x87, 0xa2, 0x67, 0x15, 0x8d, 3483 0x39, 0xee, 0x6b, 0xb1, 0x73, 0x6a, 0x8c, 0x90, 0x14, 0xd4, 0xb3, 0x5f,
3462 0x80, 0x14, 0xd4, 0xb3, 0x91, 0x6d, 0x7c, 0xf6, 0x18, 0x62, 0xf6, 0x51, 3484 0xb5, 0xf8, 0xec, 0x29, 0xf8, 0xf8, 0x93, 0x55, 0x53, 0x4e, 0x54, 0xd7,
3463 0xc7, 0x94, 0x23, 0x4e, 0x76, 0x77, 0x0e, 0x1f, 0x62, 0xd5, 0x4b, 0x25, 3485 0x32, 0x39, 0x7c, 0x88, 0x6d, 0x5e, 0x2e, 0xf1, 0xfe, 0xb7, 0x70, 0x3f,
3464 0xde, 0x1f, 0xc5, 0xfd, 0x80, 0x30, 0x97, 0xfc, 0x2a, 0xfa, 0x1c, 0x44, 3486 0x24, 0xcc, 0x3d, 0x3e, 0x8f, 0x3e, 0x47, 0xd1, 0xe7, 0x48, 0x35, 0xc0,
3465 0x9f, 0x19, 0xc7, 0xd7, 0x05, 0xef, 0x37, 0x32, 0x29, 0xdc, 0x9f, 0x29, 3487 0x8d, 0xbc, 0xef, 0x66, 0x52, 0xb8, 0x7f, 0xa4, 0xe8, 0x66, 0xd2, 0x45,
3466 0x36, 0x32, 0xe9, 0x22, 0xf3, 0xd6, 0xa1, 0xf0, 0x11, 0xc8, 0x33, 0x8b, 3488 0xe6, 0x39, 0x7d, 0xd1, 0x13, 0x90, 0x67, 0x16, 0xb1, 0xdd, 0x15, 0xab,
3467 0x5c, 0xcd, 0x96, 0xe8, 0x60, 0x5e, 0x9e, 0xee, 0x1c, 0x07, 0x4e, 0x3a, 3489 0x37, 0x2f, 0x8f, 0xb5, 0x0e, 0x23, 0xaf, 0x3e, 0x8f, 0x98, 0xe3, 0x8e,
3468 0x87, 0x1c, 0xc2, 0x9e, 0x8c, 0xc6, 0xcb, 0xf2, 0xe1, 0xce, 0xe4, 0x69, 3490 0x59, 0x4e, 0x19, 0xcc, 0x4d, 0x95, 0xee, 0x90, 0xc2, 0x0c, 0x62, 0x8c,
3469 0xe4, 0x0b, 0xf1, 0xed, 0x90, 0x61, 0x23, 0xa3, 0xc7, 0x04, 0xb6, 0x1e, 3491 0x73, 0x0f, 0x73, 0xed, 0x8c, 0x1e, 0x77, 0xe0, 0x13, 0x06, 0x80, 0x27,
3470 0x87, 0x5f, 0x1e, 0xd1, 0x53, 0xc5, 0x7e, 0x73, 0x56, 0x1e, 0x95, 0x86, 3492 0xbb, 0x81, 0x85, 0xef, 0x92, 0x15, 0xd3, 0x8a, 0x0e, 0x03, 0x03, 0xa7,
3471 0x19, 0x0d, 0x8f, 0xcb, 0x26, 0x49, 0x05, 0xd0, 0x6f, 0xf0, 0x43, 0x92, 3493 0x42, 0xe8, 0xd3, 0x7b, 0x9b, 0x64, 0xa3, 0x94, 0xf5, 0x0e, 0xf8, 0x07,
3472 0x0d, 0x53, 0xd6, 0x0f, 0xc2, 0xdf, 0x6b, 0xd2, 0x61, 0xb5, 0xc6, 0x9e, 3494 0x4d, 0x5a, 0xec, 0x46, 0x5f, 0xf5, 0x17, 0x10, 0x2f, 0x92, 0xdf, 0x36,
3473 0x5b, 0x10, 0x6f, 0x2e, 0x40, 0x9f, 0xdd, 0x61, 0x75, 0x7a, 0x3a, 0xd9, 3495 0xb6, 0xb7, 0xfa, 0x3a, 0xd9, 0x22, 0xab, 0xef, 0xe9, 0xf7, 0x37, 0x0d,
3474 0x24, 0xcb, 0xef, 0xe8, 0x77, 0xbb, 0xa5, 0x5f, 0x6b, 0xfb, 0xdb, 0x68, 3496 0xfd, 0x1a, 0xdb, 0x35, 0x4d, 0xd0, 0x7f, 0x0d, 0x34, 0x84, 0xe2, 0x90,
3475 0xdf, 0x84, 0x9c, 0xb3, 0x91, 0x09, 0xc4, 0x20, 0x7f, 0xcc, 0xa1, 0x0d, 3497 0x3f, 0x78, 0x68, 0x82, 0x9d, 0x5c, 0x06, 0x3f, 0xf4, 0x9b, 0x85, 0x32,
3476 0x76, 0x72, 0x15, 0xf3, 0x61, 0x1c, 0x2c, 0x94, 0x99, 0xf7, 0x18, 0x52, 3498 0xe3, 0xa4, 0x21, 0x65, 0x13, 0xf7, 0xaa, 0xf5, 0xfa, 0x82, 0x0d, 0x5a,
3477 0x36, 0x71, 0xcf, 0x69, 0x36, 0x2b, 0x16, 0xf8, 0xbd, 0x40, 0x9e, 0x83, 3499 0x2f, 0x90, 0xde, 0xb0, 0x0c, 0x57, 0x7b, 0xc4, 0x5d, 0xa4, 0x1c, 0x2c,
3478 0x32, 0xee, 0x0c, 0x88, 0x5d, 0xa3, 0x1c, 0xa2, 0xf0, 0x4a, 0x0f, 0x77, 3500 0xac, 0x8e, 0x5d, 0x6d, 0xa9, 0x79, 0xcb, 0xcd, 0x63, 0x44, 0xe3, 0x42,
3479 0xa5, 0x16, 0xa3, 0x76, 0x1e, 0x14, 0x8d, 0x0b, 0x7d, 0x5d, 0x49, 0xe4, 3501 0x57, 0x5b, 0x12, 0x71, 0x51, 0xbf, 0x10, 0x6b, 0x4b, 0xc1, 0x1f, 0x18,
3480 0x39, 0xfa, 0x85, 0x48, 0x57, 0x0a, 0x36, 0x6b, 0x5c, 0x78, 0xa8, 0x2b, 3502 0x17, 0x6e, 0x6f, 0x4b, 0xcf, 0x92, 0x2e, 0x03, 0x71, 0xf1, 0x4e, 0xe0,
3481 0x7d, 0x9a, 0x7c, 0x19, 0xc8, 0x73, 0x3e, 0x0a, 0x9c, 0xdf, 0x94, 0xdf, 3503 0xc2, 0xba, 0x7c, 0x0d, 0xb9, 0x4f, 0xa1, 0x17, 0x31, 0x03, 0xab, 0x44,
3482 0x45, 0x2e, 0x5b, 0x18, 0x44, 0x0e, 0x80, 0xd5, 0xaf, 0x83, 0xef, 0xbc, 3504 0x07, 0xdd, 0x79, 0x53, 0xc2, 0x6d, 0x89, 0x79, 0xd0, 0xd7, 0xdf, 0x9a,
3483 0x29, 0xc1, 0xae, 0xc4, 0xab, 0xe0, 0x6f, 0x18, 0xb2, 0xd9, 0x84, 0x3e, 3505 0x9c, 0xdd, 0x82, 0x3e, 0x06, 0xda, 0x7b, 0x88, 0x21, 0x1b, 0xda, 0xed,
3484 0x06, 0xda, 0x07, 0x58, 0x13, 0x68, 0x69, 0xb7, 0xba, 0x10, 0x4f, 0x11, 3506 0x36, 0xf8, 0x5f, 0xf8, 0x3a, 0x09, 0x27, 0x07, 0xda, 0x31, 0xfe, 0xd9,
3485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 0xe8, 0x62, 0xe1, 0x5c, 3514 0x71, 0xb1, 0x70, 0x2e, 0x44, 0x37, 0x8d, 0xfb, 0x3f, 0xfd, 0x71, 0x4d,
3493 0x08, 0xaf, 0xa3, 0xfb, 0x57, 0x1e, 0x5d, 0x13, 0x74, 0xfb, 0x40, 0x93, 3515 0x8c, 0xdb, 0x85, 0x31, 0xc9, 0xe3, 0xed, 0xad, 0x43, 0xb3, 0xe2, 0xb6,
3494 0x73, 0x7c, 0xa8, 0x73, 0xec, 0xb4, 0xd8, 0x1d, 0xe0, 0x2f, 0x1d, 0x7b, 3516 0x80, 0xbe, 0x74, 0x7c, 0x97, 0x4c, 0x62, 0x9c, 0x93, 0x73, 0xf4, 0x85,
3495 0x58, 0x66, 0x41, 0xe7, 0xe8, 0x02, 0xfd, 0xa4, 0x6c, 0xc5, 0x67, 0xb8, 3517 0xb2, 0x13, 0x9f, 0xfe, 0x26, 0x89, 0xf7, 0x2e, 0x21, 0x2f, 0x1e, 0x52,
3496 0x4d, 0x62, 0x83, 0xe7, 0x81, 0x73, 0xc6, 0x14, 0x0d, 0x17, 0x73, 0xe8, 3518 0x63, 0x78, 0x39, 0xaa, 0x7e, 0x21, 0x01, 0x5c, 0xf3, 0x51, 0xd0, 0xc3,
3497 0x17, 0x12, 0xc0, 0xa9, 0x1f, 0x07, 0x3f, 0xcc, 0xb1, 0x38, 0xe7, 0x00, 3519 0x98, 0x4c, 0x9e, 0x43, 0xe0, 0x37, 0x81, 0x75, 0x48, 0x3c, 0xce, 0xf5,
3498 0xe6, 0x9b, 0xc0, 0x3a, 0x64, 0x7d, 0x85, 0xeb, 0x1b, 0xbf, 0xcf, 0x87, 3520 0x8d, 0xdf, 0x4b, 0xd1, 0xd6, 0xd4, 0x6c, 0x33, 0xd6, 0x9d, 0xec, 0x36,
3499 0x3b, 0x53, 0xa7, 0xdb, 0xb1, 0xee, 0xe4, 0x11, 0x43, 0xc5, 0x7e, 0xea, 3521 0x54, 0xac, 0xa0, 0x5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0x17, 0xb1, 0x74, 0xb2, 0x6a,
3529 0xdb, 0xb6, 0x5c, 0x6b, 0xce, 0x3a, 0xd1, 0xe3, 0xb6, 0x10, 0x6f, 0x99, 3551 0x9d, 0x76, 0x85, 0x39, 0xba, 0x29, 0x0b, 0xc0, 0xd5, 0x7b, 0xf6, 0x3d,
3530 0x52, 0x01, 0xa9, 0x6d, 0x3b, 0x3b, 0x88, 0x19, 0x2f, 0x8a, 0x1e, 0x91, 3552 0x0f, 0xda, 0xad, 0x17, 0x45, 0x8f, 0xe1, 0x37, 0x31, 0x0c, 0x79, 0x5c,
3531 0xe4, 0x29, 0x5b, 0x46, 0x76, 0xfa, 0xb9, 0xfb, 0x9d, 0x0e, 0xe9, 0x42, 3553 0x03, 0x7f, 0x1a, 0xae, 0x5b, 0xd6, 0x6b, 0x57, 0x85, 0x12, 0xf8, 0xac,
3532 0xdb, 0x52, 0x04, 0x7d, 0x88, 0x53, 0x39, 0xef, 0x2c, 0xe6, 0xac, 0xb9, 3554 0x1d, 0xcb, 0x5c, 0x9c, 0x06, 0xae, 0x83, 0x3e, 0x92, 0xd3, 0xc4, 0x9c,
3533 0xcf, 0x78, 0xf5, 0xc9, 0x42, 0x09, 0x73, 0xaf, 0xdf, 0xca, 0x5c, 0x3e, 3555 0x5b, 0x20, 0x93, 0x21, 0xd8, 0x05, 0xf5, 0x1d, 0xc7, 0xb3, 0x75, 0xf9,
3534 0x05, 0xec, 0x0e, 0x1d, 0x25, 0x4f, 0xb1, 0xae, 0xb0, 0x09, 0x72, 0x1a, 3556 0x92, 0x43, 0x1b, 0x78, 0x0e, 0x72, 0xc3, 0x58, 0xa1, 0x80, 0x6e, 0x60,
3535 0x83, 0xad, 0xd0, 0x06, 0xfa, 0xf1, 0x6c, 0x53, 0xbe, 0x11, 0xa7, 0x5d, 3557 0x80, 0x19, 0xca, 0x6a, 0x17, 0xf2, 0x36, 0x57, 0x06, 0xf6, 0x49, 0x78,
3536 0xbc, 0x04, 0x59, 0x82, 0x56, 0xc0, 0x9f, 0x0f, 0x70, 0xde, 0x3c, 0xe5, 3558 0x47, 0x62, 0x73, 0x4e, 0x76, 0x2c, 0xb3, 0x3a, 0x8d, 0xf1, 0x7b, 0x80,
3537 0x17, 0x46, 0x6e, 0xce, 0xb1, 0x25, 0xd8, 0x99, 0x58, 0x9f, 0x77, 0xdf, 3559 0x79, 0x84, 0xb5, 0x19, 0xfa, 0x60, 0x81, 0xed, 0xec, 0x87, 0x7e, 0x98,
3538 0xca, 0x2c, 0x9f, 0x02, 0xfd, 0x01, 0xd6, 0xde, 0xe0, 0xb3, 0x8b, 0xac, 3560 0x7b, 0x33, 0x47, 0xa3, 0x6f, 0x3a, 0xa8, 0xa5, 0x2a, 0x65, 0x43, 0x3a,
3539 0x1d, 0x32, 0x27, 0xdd, 0x05, 0x3d, 0xed, 0x55, 0xb5, 0xb8, 0x64, 0x35, 3561 0x0e, 0x21, 0xb7, 0x71, 0x64, 0x71, 0x9a, 0x39, 0x1a, 0xf3, 0x99, 0x20,
3540 0x2e, 0xd6, 0x49, 0xfa, 0x2c, 0x89, 0x18, 0xd6, 0x7e, 0xe4, 0xaf, 0x62, 3562 0x7f, 0xd1, 0x90, 0x4b, 0xa0, 0x7d, 0xf9, 0x25, 0xa5, 0x07, 0x03, 0xfa,
3541 0xea, 0x89, 0x49, 0xdc, 0xa3, 0x3c, 0x35, 0xe4, 0x1c, 0xb8, 0x7f, 0x61, 3563 0xca, 0xed, 0xbb, 0x9f, 0x7c, 0xcd, 0x18, 0x09, 0xf8, 0xbf, 0x01, 0xf2,
3542 0x45, 0xe9, 0xc4, 0x80, 0xee, 0x72, 0x3b, 0x99, 0x84, 0xc9, 0xbc, 0x91, 3564 0xa2, 0x68, 0x40, 0xce, 0xc6, 0x35, 0x17, 0x03, 0x5f, 0xf8, 0x5c, 0xcf,
3543 0x80, 0x2f, 0x1c, 0xe1, 0x1c, 0xd4, 0xd8, 0xc8, 0xc7, 0xb9, 0xfe, 0x30, 3565 0xdd, 0xd4, 0xdf, 0x64, 0xe9, 0x04, 0xec, 0x58, 0xf2, 0x4d, 0x09, 0xf0,
3544 0x67, 0xd8, 0x55, 0x4b, 0x5e, 0xae, 0xfe, 0x66, 0x4b, 0x47, 0x60, 0xd3, 3566 0x36, 0x80, 0xdf, 0x58, 0xf8, 0x27, 0xa1, 0xc3, 0x73, 0x03, 0xac, 0x91,
3545 0x92, 0x6f, 0x43, 0x3e, 0x90, 0x1c, 0xc1, 0x6f, 0x38, 0x81, 0xa3, 0xd0, 3567 0x3d, 0x07, 0xfc, 0x47, 0xfa, 0xe3, 0xb1, 0x13, 0x6a, 0xdd, 0xe2, 0xba,
3546 0xe7, 0xd9, 0x11, 0xd6, 0x3f, 0x5f, 0x02, 0xb6, 0x27, 0xdf, 0xb1, 0xc8, 3568 0xca, 0x3c, 0x62, 0x8b, 0x5c, 0x54, 0x7c, 0xde, 0xc1, 0xfc, 0x14, 0x7a,
3547 0x11, 0xb5, 0x86, 0x71, 0xed, 0x30, 0x97, 0xdb, 0x24, 0x97, 0xd5, 0xfc, 3569 0xb9, 0x15, 0x3e, 0x87, 0x3f, 0x24, 0x9f, 0xde, 0x3c, 0x8c, 0x5b, 0x49,
3548 0x1e, 0x22, 0xf6, 0x80, 0x9e, 0xee, 0x67, 0x7e, 0xe3, 0xf7, 0x39, 0x3f, 3570 0x3b, 0x26, 0xa9, 0xe2, 0xcb, 0x75, 0xaf, 0x0e, 0xfb, 0x47, 0xb0, 0x2b,
3549 0x97, 0x3e, 0x63, 0x57, 0xd2, 0x8a, 0x48, 0xaa, 0x78, 0xa9, 0x19, 0xb0, 3571 0x5c, 0x57, 0xc3, 0xa0, 0x87, 0x75, 0x99, 0x01, 0xa5, 0x5b, 0xd0, 0x43,
3550 0x2c, 0x60, 0x67, 0x57, 0x8f, 0x29, 0x27, 0x08, 0x3e, 0x58, 0x6b, 0xdb, 3572 0x9b, 0xc9, 0x87, 0x13, 0xdb, 0xe4, 0xfc, 0x4c, 0x87, 0x2c, 0xcc, 0xbc,
3551 0xa9, 0x74, 0x09, 0x3e, 0x68, 0x3b, 0xf9, 0x60, 0x62, 0xb3, 0x9c, 0x9b, 3573 0x26, 0x95, 0x99, 0x36, 0x59, 0x9a, 0xa9, 0xcb, 0x65, 0x47, 0xf9, 0x25,
3552 0xef, 0x91, 0xca, 0xfc, 0xcf, 0xa5, 0x3a, 0xdf, 0x25, 0xe7, 0xe7, 0x9b, 3574 0xbb, 0x59, 0xad, 0x69, 0xd9, 0xe5, 0x61, 0xf6, 0xf8, 0xe0, 0x15, 0x79,
3553 0x72, 0x35, 0xae, 0x7c, 0x93, 0xd5, 0xae, 0xd6, 0xb5, 0x3c, 0xec, 0xd6, 3575 0x5a, 0xce, 0x97, 0x3d, 0x1e, 0x32, 0x0d, 0x3c, 0xbc, 0x0a, 0x1b, 0xeb,
3554 0x61, 0x62, 0xa3, 0xd7, 0xe5, 0x79, 0x39, 0x57, 0x76, 0x79, 0xcf, 0xb4, 3576 0xec, 0x21, 0x0f, 0xb4, 0x07, 0xf2, 0xc3, 0xdc, 0x83, 0x39, 0xe6, 0x41,
3555 0xf0, 0x7e, 0x15, 0xb6, 0xf6, 0xaa, 0x45, 0xfe, 0x47, 0xa4, 0x52, 0x24, 3577 0xac, 0xa3, 0x11, 0x60, 0xa3, 0x83, 0x5a, 0xd2, 0xe7, 0x21, 0xe5, 0xf1,
3556 0xef, 0xfb, 0x14, 0xef, 0xbb, 0x56, 0x79, 0x97, 0xac, 0x61, 0x91, 0xff, 3578 0x90, 0x7d, 0x2f, 0x0f, 0x2d, 0x92, 0xdd, 0x49, 0x3e, 0xa0, 0x83, 0x69,
3557 0x8d, 0x78, 0xef, 0x90, 0xec, 0x56, 0xf2, 0x1f, 0xc1, 0xb3, 0xef, 0xb4, 3579 0xea, 0x25, 0xc0, 0x1b, 0x1e, 0xfd, 0xc9, 0xe5, 0x57, 0xeb, 0xfa, 0x74,
3558 0xbf, 0x8a, 0x73, 0xad, 0xb9, 0x5c, 0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0xca, 0x60, 0x99,
3573 0x85, 0x98, 0x5b, 0xa7, 0x0c, 0x96, 0x28, 0x27, 0xd6, 0xa9, 0x4c, 0xc9, 3595 0x72, 0x62, 0x6d, 0xc3, 0x94, 0xfc, 0xc2, 0xef, 0x42, 0x1e, 0x61, 0xd9,
3574 0x57, 0xbe, 0x0b, 0x79, 0x04, 0x65, 0x8b, 0x95, 0x85, 0x4f, 0x01, 0xff, 3596 0x6e, 0x67, 0xe1, 0x53, 0x98, 0xb7, 0xb8, 0xe0, 0x8d, 0xbe, 0xa7, 0x1b,
3575 0x98, 0xfb, 0x5c, 0x89, 0xb5, 0xc8, 0x7e, 0xc4, 0x31, 0x03, 0x42, 0x40, 3597 0xb1, 0xcc, 0x80, 0x10, 0x90, 0x57, 0x2d, 0x1b, 0xf2, 0x40, 0xa8, 0x0f,
3576 0x4e, 0xb5, 0x64, 0xc8, 0x67, 0x03, 0x43, 0xc8, 0x01, 0x9f, 0x45, 0xdf, 3598 0x79, 0xe0, 0xa7, 0xd0, 0x37, 0x24, 0xf9, 0x65, 0xc6, 0x84, 0x90, 0x4c,
3577 0x80, 0xe4, 0x97, 0x18, 0x0f, 0x02, 0x32, 0xb7, 0x24, 0x72, 0xfd, 0x14, 3599 0x2d, 0x8b, 0x5c, 0x99, 0xa6, 0x5f, 0x51, 0x7f, 0x90, 0xb9, 0x9b, 0x99,
3578 0xfd, 0x8a, 0xfa, 0x83, 0xcc, 0x1b, 0x99, 0x69, 0x62, 0xed, 0x79, 0xfa, 3600 0x20, 0x3e, 0x9b, 0xa1, 0x8f, 0xa1, 0xff, 0xd8, 0x01, 0x5d, 0xc4, 0x9f,
3579 0x18, 0xfa, 0x89, 0x07, 0xa1, 0x8b, 0xd8, 0x4b, 0xdf, 0x40, 0x6c, 0x9a, 3601 0xfb, 0x12, 0xe2, 0xd3, 0x64, 0xb1, 0x1b, 0x7e, 0x53, 0x56, 0x74, 0xc8,
3580 0x2d, 0xf6, 0xc3, 0x67, 0x4a, 0x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, 3609 0xb9, 0xef, 0x63, 0x69, 0x3c, 0xcb, 0x78, 0xf8, 0xb6, 0x8f, 0xe1, 0xd8,
3588 0xcf, 0x32, 0x16, 0xde, 0xf2, 0xf0, 0x38, 0xdb, 0x58, 0xa3, 0x45, 0x9e, 3610 0xc6, 0xba, 0x1e, 0x72, 0xf5, 0xf3, 0x26, 0xbe, 0x3b, 0x25, 0x7f, 0x3e,
3589 0x7e, 0xce, 0xc4, 0x77, 0xaf, 0xe4, 0xcf, 0x05, 0x21, 0x07, 0xe4, 0xc4, 3611 0x0c, 0x39, 0x20, 0x2f, 0x5e, 0xf0, 0xc6, 0x62, 0xee, 0x7b, 0x1a, 0x3a,
3590 0x15, 0x97, 0x16, 0xf3, 0xde, 0xe3, 0xd0, 0x91, 0x7e, 0x32, 0x28, 0x6d, 3612 0xd2, 0xcf, 0x84, 0xa5, 0xe9, 0x4c, 0xa7, 0x84, 0xbe, 0xd2, 0x26, 0xcd,
3591 0x27, 0x7b, 0x25, 0xf0, 0xad, 0x2e, 0x69, 0xff, 0xd6, 0x80, 0x18, 0xdf, 3613 0x5f, 0xe9, 0x11, 0xe3, 0x2b, 0xac, 0x3f, 0x58, 0xb1, 0x93, 0xaa, 0xf6,
3592 0x62, 0x2d, 0x29, 0x1a, 0x39, 0xaa, 0xea, 0x58, 0x69, 0x39, 0x86, 0xf8, 3614 0x91, 0x96, 0x53, 0x88, 0x61, 0x3a, 0xe2, 0xb1, 0xb2, 0x53, 0x73, 0xa7,
3593 0xa5, 0x23, 0x16, 0x2b, 0x3b, 0x35, 0xb7, 0x8a, 0x81, 0xc4, 0x55, 0x7f, 3615 0x18, 0x48, 0x5e, 0xf5, 0x67, 0x5c, 0xf9, 0xe2, 0xbe, 0x9f, 0xab, 0xda,
3594 0xc1, 0x96, 0xaf, 0xef, 0xfc, 0x85, 0xaa, 0xa3, 0x26, 0x47, 0x70, 0xfd, 3616 0x1b, 0x70, 0xb3, 0xe8, 0xcf, 0x67, 0xc4, 0xad,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 0x99, 0x2b, 0x91, 0x97, 0x22, 0xfc, 3653 0x55, 0x22, 0x2d, 0x45, 0xf8, 0xc3, 0x1b, 0xd9, 0x12, 0xe5, 0xe8, 0xf9,
3632 0xe1, 0x46, 0xb6, 0x44, 0x39, 0xba, 0x3e, 0xe5, 0x10, 0xec, 0x42, 0x5f, 3654 0x94, 0x63, 0xb0, 0x0b, 0x7d, 0xd9, 0xf4, 0x6d, 0x40, 0xe1, 0x67, 0xdc,
3633 0x32, 0x3d, 0x1b, 0xe0, 0xdf, 0x28, 0xee, 0x31, 0x06, 0xe0, 0xbb, 0xde, 3655 0x63, 0x0c, 0xc0, 0x77, 0xad, 0x09, 0xeb, 0x7d, 0x04, 0x32, 0xa2, 0x6e,
3634 0x86, 0xf5, 0xbe, 0x17, 0x32, 0xa2, 0x6e, 0xa0, 0xbf, 0x25, 0xee, 0xbb, 3656 0xa0, 0xbf, 0x65, 0xee, 0xd5, 0x41, 0x7f, 0xcb, 0x97, 0x7e, 0xe1, 0x76,
3635 0x42, 0x7f, 0x4b, 0x57, 0xde, 0xb6, 0x7b, 0xe9, 0xf3, 0x46, 0xe4, 0x18, 3657 0xd2, 0xe7, 0x0d, 0xc8, 0x29, 0xf8, 0xd1, 0x93, 0xf3, 0xa4, 0x27, 0xad,
3636 0xfc, 0xe8, 0xd1, 0x45, 0xf2, 0x93, 0xf6, 0x70, 0xd9, 0x30, 0x64, 0x42, 3658 0xd6, 0xce, 0x14, 0xe4, 0x7d, 0x42, 0xf9, 0xf8, 0x7e, 0x79, 0x73, 0xf1,
3637 0x1f, 0x3f, 0x2c, 0x6f, 0xd4, 0x7e, 0xa0, 0x70, 0xe0, 0xb6, 0x9d, 0x0d, 3659 0x5b, 0x0a, 0x0b, 0xee, 0xd9, 0xb7, 0x22, 0x13, 0xf0, 0x0f, 0x47, 0xaa,
3638 0x99, 0x86, 0x7f, 0x98, 0x71, 0x20, 0x7f, 0x33, 0x82, 0xf5, 0x19, 0x56, 3660 0x90, 0xb7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62, 0x44, 0x8d, 0xfb, 0x5e, 0x88, 0x11, 0x35, 0x1b, 0xeb, 0x66, 0x28, 3675 0xec, 0x58, 0x74, 0xb1, 0x9e, 0xfa, 0xa2, 0x06, 0x70, 0xa3, 0x21, 0x51,
3654 0x6c, 0x00, 0x1b, 0x1a, 0x12, 0xc6, 0x6f, 0x13, 0xbe, 0x17, 0xb4, 0x86, 3676 0xfc, 0x36, 0xe1, 0x93, 0xb9, 0x67, 0xde, 0x8d, 0x15, 0xd6, 0xac, 0x6a,
3655 0xfb, 0xb1, 0x92, 0xda, 0x55, 0x5d, 0xef, 0x88, 0xaa, 0x3b, 0x58, 0x32, 3677 0x4f, 0x27, 0x54, 0x4d, 0xc2, 0x96, 0xc9, 0x72, 0x90, 0xdb, 0xc5, 0x65,
3656 0x5b, 0xf6, 0x73, 0xb7, 0x98, 0x8c, 0xcd, 0x13, 0x6f, 0xca, 0x16, 0x3d, 3678 0x68, 0x86, 0x58, 0x54, 0xb6, 0xeb, 0x09, 0xe8, 0xa2, 0x4a, 0xfc, 0xc8,
3657 0x01, 0x1d, 0x38, 0xc4, 0x88, 0xdc, 0x27, 0xe4, 0xf8, 0xb1, 0xc1, 0x2a, 3679 0x3d, 0x27, 0xce, 0x1f, 0xef, 0xad, 0x60, 0xce, 0x82, 0xed, 0xd1, 0x77,
3658 0xc6, 0x2c, 0x58, 0x2e, 0x7f, 0x47, 0x9c, 0xbb, 0xcf, 0xec, 0x82, 0x7f, 3680 0xa2, 0xaa, 0xce, 0x05, 0xf8, 0xcf, 0x05, 0x67, 0x01, 0xe2, 0xb2, 0x7f,
3659 0xce, 0x14, 0x23, 0x32, 0x5e, 0x74, 0x31, 0x01, 0xf2, 0x9f, 0x75, 0xf5, 3681 0x86, 0x7b, 0xef, 0x31, 0x19, 0x2d, 0x3a, 0xc8, 0x65, 0x55, 0x8e, 0x84,
3660 0xe5, 0x5b, 0xd0, 0xc3, 0xad, 0xcc, 0x94, 0xb5, 0x6a, 0x1b, 0x91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1a, 0xe6, 0x36, 3733 0xec, 0x30, 0x3e, 0x13, 0xf0, 0x1f, 0xa3, 0x78, 0x26, 0x23, 0x93, 0xb3,
3712 0x2d, 0x57, 0xe6, 0x27, 0xc1, 0xdf, 0x73, 0x32, 0x17, 0xcf, 0xc3, 0x8f, 3734 0x5f, 0x00, 0x6f, 0x13, 0x72, 0x69, 0x66, 0x0c, 0xf4, 0x3d, 0x29, 0x53,
3713 0x70, 0xcf, 0x83, 0xb8, 0xad, 0xdf, 0xfb, 0x9e, 0xd6, 0xcf, 0x5a, 0x51, 3735 0x4e, 0x1e, 0x7e, 0x84, 0x7b, 0x21, 0xc4, 0x79, 0xdd, 0xfe, 0xf7, 0x84,
3714 0xe2, 0x46, 0xa9, 0x16, 0xe9, 0x83, 0xb9, 0x67, 0xc8, 0xbd, 0x61, 0xda, 3736 0x7e, 0xce, 0xb6, 0x88, 0x33, 0xa5, 0x52, 0xa4, 0x0f, 0xe6, 0xbe, 0x14,
3715 0x0f, 0xeb, 0x27, 0xc8, 0x5d, 0x99, 0xc3, 0x9e, 0xe2, 0xf8, 0x6b, 0x75, 3737 0xf7, 0x1f, 0x69, 0x3f, 0xac, 0xc3, 0x20, 0xd7, 0x65, 0xce, 0x3b, 0xcd,
3716 0xb2, 0xec, 0x10, 0x7f, 0x35, 0x32, 0x8d, 0x25, 0xe2, 0xc7, 0xf7, 0x8b, 3738 0xf9, 0x37, 0xea, 0x64, 0xb5, 0x4a, 0xbc, 0xe6, 0x66, 0x56, 0x96, 0x89,
3717 0x25, 0xa9, 0x07, 0xe2, 0xc9, 0xfb, 0xc1, 0x91, 0xd1, 0x79, 0x60, 0xc8, 3739 0x37, 0x3f, 0x28, 0xf6, 0xa4, 0x1e, 0x88, 0x3f, 0x6f, 0x05, 0x77, 0x5a,
3718 0x57, 0x1a, 0x7a, 0x2b, 0x8e, 0x74, 0x31, 0x64, 0x72, 0x29, 0x0b, 0x9a, 3740 0x33, 0xc0, 0x9c, 0x2f, 0xac, 0xe8, 0x8d, 0xb8, 0xd3, 0xc3, 0x9c, 0xc9,
3719 0x71, 0x85, 0x95, 0x91, 0xc7, 0xc1, 0xed, 0xf5, 0xe3, 0xd9, 0x7e, 0xe4, 3741 0xe5, 0x2c, 0xc6, 0x74, 0x14, 0xb6, 0x46, 0xde, 0x07, 0xb7, 0xd7, 0x8d,
3720 0xe4, 0x2e, 0x66, 0x4c, 0x01, 0x33, 0xfe, 0x06, 0x30, 0xe3, 0xac, 0x74, 3742 0x67, 0xbb, 0x91, 0xc3, 0x7b, 0x18, 0x33, 0x05, 0x8c, 0xf9, 0x0f, 0x81,
3721 0x76, 0x11, 0x33, 0xda, 0x1e, 0x66, 0x4c, 0xc3, 0x9e, 0x73, 0x6b, 0xec, 3743 0x31, 0x27, 0xe5, 0xad, 0x56, 0x62, 0x4c, 0xd7, 0xc7, 0x98, 0x69, 0xd8,
3722 0x59, 0x53, 0xb5, 0x28, 0xde, 0xcb, 0x01, 0xf3, 0xa5, 0x4e, 0x45, 0xef, 3744 0x73, 0x6e, 0x83, 0x3d, 0x6b, 0xaa, 0x76, 0xc5, 0x7b, 0x39, 0x60, 0xc4,
3723 0x03, 0x27, 0x6a, 0x12, 0x52, 0xe7, 0x52, 0x02, 0x2d, 0x34, 0x7d, 0x3c, 3745 0xd4, 0xb4, 0x75, 0x0b, 0xb8, 0x52, 0x93, 0x88, 0x3a, 0xfb, 0x10, 0x6a,
3724 0xb8, 0x4d, 0xe1, 0xbc, 0xdd, 0xa5, 0x4d, 0xc8, 0x51, 0x14, 0xee, 0xf3, 3746 0x18, 0x33, 0xc0, 0x8f, 0x7b, 0x14, 0x2e, 0x3c, 0x50, 0xda, 0x82, 0x1c,
3725 0xf6, 0x4b, 0x03, 0xeb, 0xf6, 0x90, 0x03, 0x2d, 0x7b, 0xc8, 0x77, 0xf1, 3747 0x46, 0xe1, 0x44, 0x7f, 0x4f, 0x2e, 0xb4, 0x69, 0x9f, 0x32, 0xd4, 0xb0,
3726 0x21, 0x9e, 0xf3, 0x6a, 0x7d, 0x6d, 0xf0, 0x05, 0xff, 0x13, 0x3c, 0x71, 3748 0x4f, 0x79, 0x1d, 0x4f, 0xe2, 0x39, 0xbf, 0x3e, 0xd8, 0x04, 0x5f, 0xf0,
3727 0x7d, 0x71, 0x2d, 0x68, 0xee, 0x7a, 0x59, 0x83, 0x13, 0xff, 0x7a, 0x1d, 3749 0x7f, 0x40, 0x13, 0xd7, 0x17, 0xd7, 0x82, 0xe6, 0xad, 0x97, 0xd1, 0x46,
3728 0x4e, 0x44, 0xec, 0x3a, 0x17, 0x92, 0x24, 0x30, 0xa2, 0xbd, 0x44, 0x5a, 3750 0x5c, 0xf9, 0xbf, 0x36, 0xe1, 0x4a, 0xc4, 0xae, 0xf3, 0x11, 0x49, 0x02,
3729 0x5c, 0xd3, 0xc3, 0xd2, 0x8e, 0xf9, 0x75, 0x9c, 0xea, 0x05, 0x36, 0xea, 3751 0x53, 0xba, 0xcb, 0x1c, 0x8b, 0x6b, 0xba, 0x5f, 0x9a, 0xc1, 0x5f, 0xcb,
3730 0x92, 0x20, 0x30, 0x52, 0x9b, 0xc2, 0x48, 0x03, 0xc4, 0x32, 0x83, 0x33, 3752 0x74, 0x27, 0xb0, 0x54, 0x9b, 0x84, 0x81, 0xa9, 0x9a, 0x14, 0xa6, 0xea,
3731 0xc0, 0x36, 0xb5, 0x55, 0x9c, 0x14, 0x8d, 0xff, 0x01, 0xf4, 0xf2, 0x94, 3753 0x21, 0xf6, 0xe9, 0x3d, 0x02, 0x2c, 0xb4, 0xb8, 0x8e, 0xab, 0x2c, 0xe7,
3732 0xf2, 0x3d, 0x69, 0x39, 0x01, 0x5f, 0xda, 0xbe, 0x04, 0x7c, 0x77, 0xce, 3754 0x87, 0xd0, 0xcb, 0xa3, 0xca, 0xf7, 0xa4, 0xe5, 0x29, 0xf8, 0xd2, 0xe6,
3733 0xc5, 0x4f, 0x6d, 0xeb, 0xf0, 0xd3, 0xc1, 0x0d, 0xf1, 0x93, 0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c, 0x9f, 0xc0, 0xf3,
3748 0x3b, 0xf3, 0x47, 0xff, 0x5c, 0x54, 0x7f, 0xe4, 0x88, 0xd0, 0x56, 0xc8, 3770 0xcf, 0x7a, 0x75, 0xfc, 0xa1, 0x52, 0x50, 0x9f, 0x67, 0x5e, 0x19, 0x9c,
3749 0x1f, 0xe9, 0x76, 0xcb, 0x94, 0xc2, 0x47, 0xb0, 0xa9, 0xd8, 0xbd, 0x31, 3771 0xbd, 0xe9, 0x8e, 0x9d, 0x10, 0xda, 0x0a, 0xe9, 0xe3, 0xb8, 0xed, 0x32,
3750 0x72, 0xe5, 0x94, 0x8f, 0x91, 0x43, 0x0a, 0x23, 0x57, 0x96, 0x7c, 0x8c, 3772 0xae, 0xf0, 0x14, 0x6c, 0x2a, 0x7e, 0x73, 0x4c, 0xbd, 0x30, 0x1d, 0x60,
3751 0x9c, 0xbc, 0x07, 0x46, 0x6e, 0x76, 0xb9, 0x71, 0x20, 0x28, 0x79, 0x85, 3773 0xea, 0x88, 0xc2, 0xd4, 0x0b, 0xcb, 0x01, 0xa6, 0x4e, 0xde, 0x04, 0x53,
3752 0x91, 0xef, 0x75, 0x96, 0x8c, 0xf7, 0xba, 0x88, 0x07, 0xc4, 0x3d, 0x5f, 3774 0xff, 0xf7, 0x36, 0x2f, 0x0e, 0x84, 0x25, 0xaf, 0x30, 0xf5, 0xcd, 0xce,
3753 0xd0, 0x7b, 0x8f, 0xb5, 0xe6, 0xe3, 0x66, 0xc6, 0xfe, 0xad, 0x32, 0x71, 3775 0x2b, 0xf1, 0x5e, 0x1b, 0xf1, 0x82, 0x78, 0x7b, 0xd8, 0x9d, 0x37, 0x59,
3754 0xe6, 0x2e, 0x6e, 0x76, 0xb1, 0x71, 0x34, 0x72, 0x48, 0xc5, 0x44, 0xe0, 3776 0x6b, 0x01, 0xce, 0x66, 0xec, 0xdf, 0x29, 0xa3, 0x67, 0xaf, 0xe3, 0x6c,
3755 0x84, 0x3a, 0xeb, 0xdf, 0xc4, 0xbe, 0x8c, 0x39, 0x01, 0x85, 0xcf, 0x72, 3777 0x0f, 0x4b, 0x5b, 0xb1, 0x63, 0x2a, 0x26, 0x02, 0xd7, 0xd5, 0x58, 0x2f,
3756 0x45, 0xe6, 0x01, 0x6c, 0x23, 0x16, 0xee, 0xe4, 0x31, 0x2b, 0x2f, 0x26, 3778 0x27, 0x56, 0x66, 0xcc, 0x09, 0x29, 0x3c, 0x97, 0x2b, 0x32, 0x0f, 0x60,
3757 0xf9, 0x58, 0xd3, 0x3f, 0xd7, 0xc2, 0x3d, 0x86, 0x37, 0x8d, 0xa4, 0x85, 3779 0x1b, 0xb1, 0x73, 0x2b, 0x8f, 0xf2, 0xf8, 0x31, 0x29, 0xc0, 0xa6, 0xc1,
3758 0x76, 0xc7, 0xcf, 0x15, 0xe2, 0xea, 0x3c, 0x50, 0x12, 0x58, 0x72, 0x6a, 3780 0xd9, 0x09, 0xee, 0x4b, 0xbc, 0x65, 0x24, 0x6d, 0xb4, 0x57, 0x83, 0x5c,
3759 0x15, 0x4b, 0xd2, 0x57, 0xfc, 0xf4, 0x6d, 0xdb, 0xa4, 0x5f, 0xf3, 0xb1, 3781 0xc1, 0x51, 0x67, 0x4e, 0x92, 0xc0, 0x3f, 0xe3, 0xeb, 0xd8, 0x93, 0xbe,
3760 0x22, 0x72, 0xa2, 0x12, 0xd7, 0xb6, 0x8f, 0x15, 0x5d, 0x9c, 0x98, 0x72, 3782 0xe2, 0x47, 0xbf, 0x70, 0x4d, 0xfa, 0xb5, 0x00, 0x5b, 0x22, 0x27, 0x2a,
3761 0x1a, 0xc0, 0xcb, 0x01, 0x19, 0x03, 0x4e, 0x6f, 0x7c, 0x89, 0x35, 0x28, 3783 0x71, 0x6d, 0x07, 0xd8, 0xd2, 0xc3, 0x95, 0xa9, 0xea, 0x0a, 0xf0, 0x75,
3762 0x1f, 0x1b, 0xd9, 0xf8, 0x6e, 0xad, 0x49, 0xf1, 0xba, 0x5d, 0xed, 0x05, 3784 0x48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0x26, 0x59, 3806 0x57, 0xec, 0x2e, 0xf9, 0x21, 0xda, 0xae, 0xe3, 0x1c, 0xf6, 0x9f, 0x72,
3785 0x37, 0x87, 0x9c, 0x0f, 0xa4, 0xa6, 0x14, 0x36, 0xf1, 0x31, 0xc9, 0xed, 3807 0x92, 0xf6, 0x28, 0xf0, 0xc9, 0xa8, 0x8f, 0x4f, 0xde, 0x7a, 0x20, 0x69,
3786 0x34, 0xc7, 0x9f, 0x75, 0x56, 0x80, 0x7d, 0x56, 0x3c, 0xec, 0x73, 0x60, 3808 0x8f, 0xb1, 0xce, 0x0e, 0x39, 0xff, 0x34, 0x39, 0xae, 0xb0, 0x49, 0x80,
3787 0xcc, 0xc5, 0x3e, 0xc1, 0xcf, 0x50, 0xff, 0x2e, 0xee, 0x59, 0xb1, 0x93, 3809 0x49, 0x1e, 0x4f, 0x73, 0xfe, 0xc9, 0x6a, 0x16, 0xd8, 0x27, 0xeb, 0x63,
3788 0x18, 0xa7, 0x0a, 0x4c, 0x52, 0x71, 0x0e, 0x48, 0xbe, 0xbe, 0x57, 0x7d, 3810 0x9f, 0x9f, 0xa6, 0x3d, 0xec, 0x33, 0xf5, 0xf7, 0xa8, 0x7f, 0x0f, 0xf7,
3789 0x8e, 0x94, 0xec, 0x68, 0x1b, 0xe4, 0xc4, 0xda, 0xeb, 0x49, 0xae, 0x4a, 3811 0x1c, 0x76, 0x93, 0x98, 0x07, 0xb8, 0x07, 0xd7, 0x87, 0x25, 0x5f, 0x1b,
3790 0x27, 0x6a, 0x16, 0xf1, 0x9d, 0x75, 0xa2, 0xe1, 0xdf, 0xf1, 0xae, 0x9f, 3812 0x51, 0x9f, 0x13, 0x25, 0xd7, 0x6a, 0x82, 0x9c, 0x58, 0xab, 0x3d, 0xc3,
3791 0xf7, 0xae, 0x4f, 0x78, 0xd7, 0xc7, 0x11, 0x87, 0x8f, 0xa9, 0x58, 0xca, 3813 0x55, 0x59, 0xb5, 0xcc, 0x22, 0xbe, 0xb3, 0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, 0x56, 0x8d, 0xbb, 0x32, 0xde, 0x65, 0xd9, 0x51, 0xe8, 0x7c, 0xf0, 3821 0x8f, 0x3a, 0x4f, 0x8a, 0x7e, 0xdf, 0x14, 0xfa, 0x89, 0x5e, 0xe8, 0xbf,
3800 0x18, 0x68, 0x27, 0xd5, 0xd9, 0xd8, 0x8c, 0x1c, 0x3d, 0xbd, 0xbc, 0xc5, 3822 0x5b, 0xed, 0xbf, 0x55, 0x1c, 0x4f, 0xc6, 0xfb, 0x6d, 0xd7, 0x82, 0xce,
3801 0xf5, 0xad, 0x51, 0xf3, 0x26, 0xf5, 0x8e, 0x79, 0xd8, 0xf0, 0x85, 0x19, 3823 0x7b, 0x4f, 0x61, 0xec, 0xa4, 0x3a, 0x7f, 0x99, 0x91, 0x93, 0xb3, 0xab,
3802 0xd8, 0xfb, 0x41, 0x27, 0xa0, 0x8d, 0x21, 0xde, 0x8c, 0x39, 0x37, 0x55, 3824 0xdb, 0x3d, 0xdf, 0x6a, 0x99, 0x57, 0xa9, 0x77, 0xf0, 0xe1, 0xc2, 0x17,
3803 0xbc, 0x81, 0xef, 0xca, 0xc4, 0x4e, 0x86, 0x70, 0xcd, 0xb3, 0x45, 0x88, 3825 0x66, 0x60, 0xef, 0x47, 0xab, 0x21, 0x6d, 0x08, 0xf1, 0x66, 0xa8, 0x7a,
3804 0x8b, 0xea, 0x6c, 0xe5, 0x32, 0xf0, 0x8d, 0xa6, 0xea, 0x80, 0xb3, 0xab, 3826 0x55, 0xc5, 0x9b, 0x54, 0xd5, 0xcd, 0xc4, 0xcf, 0x44, 0x70, 0xcd, 0x73,
3805 0xfb, 0x43, 0x86, 0xf2, 0x5b, 0xb1, 0x98, 0x2e, 0xb9, 0x11, 0xe2, 0xdc, 3827 0x31, 0x88, 0x8b, 0xea, 0xfc, 0xde, 0x2a, 0xf0, 0x8d, 0xa6, 0xea, 0x86,
3806 0xbd, 0x2a, 0x36, 0xd5, 0x8a, 0xf6, 0x43, 0xcc, 0x15, 0x6f, 0x08, 0xe3, 3828 0x93, 0xeb, 0xfb, 0x4a, 0xea, 0x7c, 0x71, 0x26, 0x1e, 0xd7, 0x25, 0x37,
3807 0xdc, 0xe3, 0xe8, 0xd7, 0x07, 0x7f, 0x8c, 0x7b, 0x75, 0xda, 0x27, 0xe7, 3829 0x40, 0x9c, 0x3b, 0xa2, 0x62, 0x13, 0xd6, 0xea, 0xed, 0xcc, 0x15, 0x5f,
3808 0xca, 0x67, 0xa6, 0xa5, 0x5a, 0x1e, 0xc5, 0x7c, 0xbd, 0x1c, 0x49, 0xe5, 3830 0xe7, 0xbb, 0x00, 0xf6, 0x27, 0xd0, 0xaf, 0x0b, 0xfe, 0x18, 0xf7, 0x6a,
3809 0x12, 0x11, 0xd8, 0xa3, 0xbf, 0x17, 0xe5, 0xd6, 0x4f, 0xaa, 0x8e, 0x8f, 3831 0xb4, 0x4f, 0xf2, 0xca, 0x67, 0x26, 0xa4, 0x52, 0x1e, 0x04, 0xbf, 0x7e,
3810 0x29, 0xba, 0xd1, 0x87, 0x79, 0x05, 0x64, 0xe4, 0xee, 0x9f, 0xa9, 0xbd, 3832 0x8e, 0xa4, 0x72, 0x89, 0x18, 0xec, 0x31, 0xd8, 0xc3, 0xf2, 0xea, 0x2a,
3811 0xb3, 0x82, 0x33, 0x0a, 0x39, 0x25, 0xd1, 0xce, 0x5a, 0x35, 0x7e, 0x97, 3833 0x95, 0x6a, 0x80, 0x29, 0xda, 0xd1, 0x87, 0x79, 0x05, 0x64, 0xe4, 0xed,
3812 0x75, 0x55, 0x13, 0x58, 0x31, 0x66, 0xa4, 0x56, 0x6e, 0x82, 0x5f, 0xc4, 3834 0xbf, 0xa9, 0xbd, 0xb7, 0x42, 0x75, 0x10, 0x72, 0x4a, 0xa2, 0x9d, 0xb5,
3813 0xdc, 0x2d, 0x33, 0x52, 0x29, 0x4f, 0xcb, 0x2b, 0xe5, 0x9f, 0x77, 0x03, 3835 0x6d, 0xfc, 0x2e, 0xeb, 0xaa,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0x2f, 0xcb, 0x9d, 0xc7, 0x93, 0xf1, 3850 0xa7, 0x2f, 0x76, 0x54, 0x78, 0x32, 0x8b, 0x79, 0xb5, 0xe5, 0x64, 0xe5,
3829 0x51, 0xad, 0x32, 0x89, 0xac, 0xe5, 0xe5, 0x49, 0xc6, 0xd9, 0x43, 0x22, 3851 0x12, 0xe2, 0xe4, 0x35, 0x62, 0x87, 0xde, 0x8b, 0x72, 0xed, 0x13, 0x49,
3830 0xc0, 0x97, 0x27, 0x47, 0x24, 0x5d, 0x54, 0xef, 0xa9, 0xf0, 0x9c, 0xad, 3852 0x67, 0x50, 0x5b, 0x18, 0x43, 0xd6, 0xf2, 0xfc, 0x18, 0xe3, 0xec, 0x31,
3831 0x36, 0x0d, 0xf9, 0xe1, 0xf9, 0x09, 0x06, 0x46, 0xdd, 0xea, 0x8f, 0xa4, 3853 0x11, 0xe0, 0xcb, 0x33, 0x03, 0x92, 0x2e, 0xaa, 0x77, 0x21, 0x78, 0x96,
3832 0xe5, 0x69, 0xd6, 0xc0, 0x24, 0xb7, 0x20, 0xdb, 0x92, 0xf0, 0xab, 0xf6, 3854 0x53, 0x9b, 0x80, 0xfc, 0xf0, 0xfc, 0x28, 0x03, 0xa3, 0x6e, 0x77, 0xc7,
3833 0x44, 0xbb, 0x4c, 0xd7, 0x1a, 0x99, 0xfe, 0x53, 0xcf, 0x82, 0xc6, 0x14, 3855 0xd2, 0xf2, 0x18, 0x6b, 0x63, 0x92, 0x9b, 0x93, 0x3d, 0x49, 0xf8, 0x55,
3834 0x68, 0xed, 0x45, 0x6e, 0x92, 0x45, 0xac, 0xa6, 0x7c, 0xe9, 0xbb, 0x9f, 3856 0x77, 0xb4, 0x59, 0x26, 0x16, 0xdd, 0x4c, 0xf7, 0xf4, 0x13, 0x18, 0x63,
3835 0x81, 0x8c, 0x3e, 0xc2, 0x3d, 0xe5, 0xd1, 0xac, 0x44, 0x27, 0xf2, 0x8a, 3857 0x1c, 0x63, 0x8d, 0x20, 0x37, 0xc9, 0x22, 0x56, 0x53, 0xbe, 0xf4, 0xdd,
3836 0xee, 0x5b, 0x5a, 0x6e, 0xf8, 0x57, 0x10, 0xeb, 0x02, 0xb2, 0x2b, 0x26, 3858 0x8f, 0x43, 0x46, 0x1f, 0xe1, 0x59, 0xd7, 0xc1, 0xac, 0x58, 0xa3, 0x79,
3837 0xfa, 0xde, 0x58, 0xe0, 0xed, 0x29, 0x8b, 0x6d, 0x41, 0xb6, 0xe9, 0x68, 3859 0x35, 0xee, 0xbb, 0x5a, 0xae, 0xff, 0x57, 0x10, 0xeb, 0x42, 0xb2, 0x3f,
3838 0x0b, 0xfc, 0x7a, 0x2c, 0xa8, 0x27, 0x63, 0xd1, 0x51, 0x9e, 0x8f, 0x36, 3860 0x2e, 0xfa, 0x48, 0x3c, 0xf4, 0x8b, 0x71, 0x9b, 0x6d, 0x61, 0xb6, 0xe9,
3839 0xac, 0x29, 0xee, 0x4d, 0x3c, 0x20, 0x5d, 0x7b, 0xa5, 0xe7, 0x42, 0x74, 3861 0x68, 0x0b, 0xfd, 0x66, 0x3c, 0xac, 0x27, 0xe3, 0xd6, 0x20, 0xcf, 0xe0,
3840 0xf4, 0x06, 0x78, 0x09, 0x28, 0x5f, 0x3f, 0x25, 0xba, 0xd7, 0xde, 0xbd, 3862 0x1a, 0xf6, 0xb8, 0x18, 0xcf, 0xd7, 0x21, 0x8b, 0x11, 0xe9, 0xb8, 0x60,
3841 0xda, 0x1e, 0xf0, 0xda, 0xf7, 0x4a, 0xd7, 0x85, 0x21, 0xf3, 0x75, 0x99, 3863 0x0d, 0xbe, 0x0e, 0x5a, 0x42, 0xca, 0xd7, 0x8f, 0x8b, 0xee, 0xb7, 0xb7,
3842 0x01, 0x4d, 0x43, 0xae, 0x23, 0xd7, 0xb1, 0x06, 0xa6, 0x60, 0x8b, 0x4f, 3864 0xaf, 0xb7, 0x87, 0xfc, 0xf6, 0x11, 0x69, 0xbb, 0xd0, 0x67, 0xbe, 0x21,
3843 0x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 0x6c, 0x58, 0x1b, 0x5f, 0xf3, 3872 0x6b, 0x3c, 0x83, 0xa1, 0xf6, 0x03, 0x16, 0x24, 0xb8, 0xe6, 0x38, 0x7d,
3851 0x6c, 0x97, 0x92, 0x91, 0x61, 0xb9, 0x7d, 0x66, 0xcb, 0x7b, 0xe5, 0x79, 3873 0xe6, 0xb0, 0x7a, 0xb6, 0xcf, 0x3c, 0xa9, 0x35, 0x3e, 0x1b, 0xd5, 0x86,
3852 0x87, 0xfd, 0xee, 0x34, 0x53, 0xd6, 0x03, 0xda, 0xd1, 0x07, 0xe9, 0x0b, 3874 0x37, 0x3c, 0xdb, 0xa6, 0x64, 0x64, 0xd8, 0x5e, 0x9f, 0xc9, 0xf2, 0x88,
3853 0xd9, 0xf7, 0xf6, 0xba, 0x71, 0x78, 0x7d, 0xaf, 0x31, 0x9a, 0xb2, 0x76, 3875 0x3c, 0x5d, 0x65, 0xbf, 0x6b, 0xf5, 0x94, 0xbd, 0x55, 0x3b, 0xb9, 0x83,
3854 0x8c, 0x4d, 0xaa, 0xcf, 0x55, 0xd5, 0x27, 0xa0, 0x64, 0xbd, 0x76, 0x9c, 3876 0xbe, 0x90, 0x7d, 0xdf, 0xd9, 0x34, 0x0f, 0xaf, 0x6f, 0x36, 0x47, 0x5d,
3855 0xbf, 0x91, 0xb5, 0xe3, 0x74, 0xad, 0xce, 0x79, 0x16, 0x34, 0x8f, 0xa1, 3877 0x36, 0xce, 0xb1, 0x45, 0xf5, 0xb9, 0xac, 0xfa, 0x84, 0x94, 0xac, 0x37,
3856 0x6f, 0xd1, 0xe9, 0x0f, 0x57, 0xe5, 0x76, 0x33, 0x67, 0xbd, 0x29, 0x57, 3878 0xce, 0xf3, 0x17, 0xb2, 0x71, 0x9e, 0xb6, 0x75, 0x9e, 0x27, 0x31, 0xe6,
3857 0x57, 0x69, 0xff, 0x12, 0xd7, 0xad, 0x3c, 0xfd, 0xd2, 0xe3, 0x91, 0xbf, 3879 0x29, 0xf4, 0x2d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x1a,
3894 0xae, 0x13, 0x83, 0x8c, 0xe0, 0xdb, 0x99, 0xf3, 0x62, 0x78, 0x50, 0x5e, 3916 0xae, 0x16, 0xe9, 0xb7, 0x81, 0x95, 0x22, 0x9d, 0x72, 0x65, 0x31, 0x26,
3895 0x2f, 0x6e, 0xc4, 0xc7, 0xb0, 0xdc, 0x28, 0xfa, 0xbc, 0x10, 0x0b, 0x33, 3917 0x57, 0x88, 0x41, 0x06, 0xf0, 0x5d, 0x9d, 0xf2, 0x63, 0x78, 0x58, 0xde,
3896 0x5f, 0x98, 0x92, 0x37, 0xe6, 0xfb, 0xa5, 0x31, 0x81, 0xb8, 0x3f, 0x40, 3918 0x28, 0xde, 0x88, 0x8e, 0x7e, 0x79, 0xbd, 0x18, 0xd0, 0x42, 0x2c, 0xcc,
3897 0x99, 0x0c, 0x99, 0x7b, 0xd4, 0x7b, 0x48, 0x77, 0x9a, 0x97, 0x2d, 0xd0, 3919 0x7c, 0x61, 0x5c, 0xde, 0x9c, 0xe9, 0x96, 0x95, 0x51, 0xc4, 0xfd, 0x1e,
3898 0x5f, 0x68, 0xca, 0x41, 0xee, 0x67, 0xf3, 0x77, 0xed, 0x21, 0x69, 0x30, 3920 0xca, 0xa4, 0xcf, 0x7c, 0x50, 0xbd, 0xeb, 0x72, 0xad, 0x7e, 0xd1, 0xc6,
3899 0xa7, 0x18, 0xe8, 0x95, 0xca, 0x02, 0xf2, 0xf9, 0x22, 0xe9, 0x53, 0x6e, 3921 0xf8, 0x73, 0x75, 0x39, 0xca, 0xfd, 0x6f, 0xfe, 0x5e, 0xbc, 0x5d, 0x56,
3900 0x7b, 0xd5, 0xef, 0x71, 0x8c, 0xf7, 0x39, 0xbe, 0x1f, 0x10, 0xa2, 0x6e, 3922 0x98, 0x53, 0xf4, 0x74, 0xca, 0xc2, 0x1c, 0xf2, 0xf9, 0x22, 0xc7, 0xa7,
3901 0xee, 0x34, 0x97, 0x2d, 0xee, 0x67, 0x4e, 0x49, 0x0d, 0xfa, 0xfb, 0xe7, 3923 0xdc, 0x46, 0xd4, 0xef, 0x61, 0xcc, 0xf7, 0x49, 0x9e, 0x41, 0x8f, 0x50,
3902 0x31, 0xee, 0xb7, 0xe7, 0xd4, 0xf9, 0xdb, 0x4a, 0x6d, 0x02, 0xb9, 0xc3, 3924 0x37, 0xd7, 0xea, 0xab, 0x36, 0xf7, 0x3f, 0xc7, 0x65, 0x11, 0xfa, 0xfb,
3903 0x9d, 0xe6, 0x9c, 0x75, 0x56, 0xe9, 0xad, 0x56, 0x7e, 0xc2, 0x6b, 0xe7, 3925 0x47, 0x71, 0xee, 0xcf, 0xe7, 0xd4, 0xfb, 0x85, 0x0b, 0x8b, 0xa3, 0xc8,
3904 0x35, 0xef, 0x35, 0x32, 0xdb, 0x06, 0x98, 0xaf, 0x3e, 0x81, 0x7c, 0x81, 3926 0x1d, 0xae, 0xd5, 0xa7, 0xec, 0x29, 0xa5, 0xb7, 0xc5, 0xf2, 0x43, 0x7e,
3905 0xb9, 0xea, 0x04, 0xf0, 0x1a, 0x65, 0x12, 0x91, 0xd9, 0x22, 0x69, 0x49, 3927 0x3b, 0xaf, 0x79, 0xcf, 0xcd, 0xec, 0xe9, 0x61, 0xbe, 0xfa, 0x10, 0xf2,
3906 0x68, 0x13, 0xf2, 0xfb, 0x9c, 0x8c, 0x83, 0x9f, 0x08, 0x72, 0x7b, 0xc6, 3928 0x05, 0xe6, 0xaa, 0xa3, 0xc0, 0x6b, 0x94, 0x49, 0x4c, 0x26, 0x8b, 0x1c,
3907 0x87, 0x47, 0x65, 0x39, 0xe4, 0xc6, 0x01, 0x9e, 0xfb, 0x5a, 0x46, 0x6c, 3929 0x4b, 0x22, 0x5b, 0x90, 0xdf, 0xe7, 0x64, 0x18, 0xf4, 0xc4, 0x90, 0xdb,
3908 0x58, 0x5e, 0x8d, 0x0d, 0x5b, 0x71, 0xdd, 0xc8, 0xc4, 0x07, 0xfe, 0x06, 3930 0x33, 0x3e, 0xdc, 0x25, 0xab, 0x11, 0x2f, 0x0e, 0xf0, 0xac, 0xd8, 0x2a,
3909 0xf4, 0x59, 0xb7, 0x61, 0x6c, 0x18, 0x45, 0x7f, 0xb6, 0xf5, 0xca, 0xec, 3931 0x62, 0xc3, 0xea, 0x7a, 0x6c, 0xd8, 0x89, 0x6b, 0x37, 0xe3, 0xf4, 0xfc,
3910 0x02, 0x92, 0x08, 0xe4, 0x2c, 0x15, 0xe1, 0x99, 0x8e, 0xac, 0x9c, 0xaa, 3932 0x67, 0x8c, 0xcf, 0xba, 0x0d, 0x63, 0xc3, 0x20, 0xfa, 0xb3, 0xad, 0x53,
3911 0xf5, 0x87, 0x2f, 0x6b, 0x69, 0x75, 0xf6, 0x23, 0x36, 0xc0, 0xf3, 0x2c, 3933 0x26, 0xe7, 0x90, 0x44, 0x20, 0x67, 0x59, 0x10, 0x9e, 0x01, 0xc9, 0xca,
3912 0xbd, 0x52, 0x5b, 0x90, 0x88, 0x91, 0x78, 0x52, 0x9c, 0x9a, 0x8b, 0xd9, 3934 0xf4, 0x62, 0x77, 0xf4, 0xa2, 0x96, 0x56, 0x67, 0x45, 0xe2, 0x98, 0x73,
3913 0xe7, 0x34, 0x9e, 0x69, 0xb1, 0xa5, 0xb6, 0xb6, 0x8f, 0x89, 0xdc, 0x57, 3935 0xa1, 0xd8, 0x29, 0x8b, 0x73, 0x12, 0x33, 0x12, 0x8f, 0x48, 0x75, 0xd1,
3914 0xbe, 0xe3, 0xf5, 0x49, 0xab, 0x3e, 0x7f, 0xdd, 0xc3, 0x3d, 0xb4, 0x9a, 3936 0xc3, 0xec, 0x53, 0x1a, 0xda, 0xab, 0xae, 0x2c, 0x6e, 0xec, 0x63, 0x1a,
3915 0xd3, 0x03, 0x1e, 0xc8, 0xdb, 0xc3, 0xad, 0xe3, 0x46, 0xee, 0x8e, 0xcb, 3937 0x89, 0xc3, 0xf2, 0x75, 0xbf, 0x4f, 0x5a, 0xf5, 0x79, 0xb5, 0x83, 0x7b,
3916 0x31, 0x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73, 0x87, 0x4b, 0x4d, 3945 0xde, 0x2d, 0x58, 0xdf, 0xe2, 0x86, 0x6c, 0xd6, 0x0b, 0x58, 0x0f, 0xfe,
3924 0xe4, 0x7a, 0x9b, 0x19, 0x5f, 0x73, 0x35, 0xde, 0x8f, 0x46, 0x44, 0x78, 3946 0xfa, 0x36, 0xe9, 0x60, 0xbd, 0x80, 0x79, 0xc3, 0x21, 0x7c, 0x33, 0x77,
3925 0x8f, 0x7e, 0xa3, 0x57, 0xda, 0xbe, 0x35, 0x08, 0x5f, 0xf1, 0x34, 0xb0, 3947 0x78, 0xb9, 0x9e, 0x74, 0x7e, 0xa6, 0xe2, 0x6b, 0x6e, 0x91, 0xf7, 0xad,
3926 0x37, 0xe8, 0x9e, 0x1c, 0x90, 0x80, 0x7b, 0x66, 0x42, 0xd5, 0x5b, 0xde, 3948 0x98, 0x08, 0xef, 0xd1, 0x6f, 0x74, 0x4a, 0xd3, 0x57, 0x7a, 0xe1, 0x2b,
3927 0x58, 0x88, 0x7a, 0xef, 0x73, 0xc9, 0xb6, 0xcb, 0x71, 0xd6, 0x44, 0xfb, 3949 0x1e, 0x03, 0xf6, 0xc6, 0xb8, 0x67, 0x7a, 0x24, 0xe4, 0x9d, 0xb1, 0x50,
3928 0x58, 0xf3, 0x41, 0x3f, 0xd1, 0x97, 0x91, 0x9f, 0x5e, 0xaf, 0x59, 0x9b, 3950 0xf5, 0x96, 0x37, 0xe7, 0x2c, 0xff, 0x9d, 0x21, 0xd9, 0x73, 0xd1, 0x61,
3929 0x79, 0x7e, 0xf3, 0x86, 0x83, 0x6b, 0x62, 0xff, 0x90, 0xc2, 0x98, 0xde, 3951 0x4d, 0xb4, 0x8b, 0x35, 0x1f, 0xf4, 0x13, 0x7d, 0x15, 0xf9, 0xe9, 0x95,
3930 0x3d, 0xfe, 0x46, 0xbe, 0xf4, 0x8e, 0x77, 0x13, 0x98, 0x4f, 0x4d, 0x7a, 3952 0x45, 0x63, 0x1b, 0xcf, 0x7c, 0xbe, 0x5e, 0xc5, 0x35, 0xb1, 0x7f, 0x44,
3931 0x67, 0xe7, 0x1a, 0x99, 0xa3, 0x6b, 0x72, 0xaa, 0x41, 0x55, 0xef, 0x6d, 3953 0x61, 0x4c, 0xff, 0x1e, 0x7f, 0x23, 0x5f, 0x7a, 0xcf, 0xf9, 0x77, 0xe6,
3932 0x38, 0x16, 0xfc, 0xe3, 0x08, 0xec, 0x93, 0x6b, 0xa0, 0xa9, 0x3d, 0x01, 3954 0x53, 0x63, 0xfe, 0x59, 0x3b, 0x37, 0x73, 0x72, 0x43, 0x4e, 0xd5, 0xab,
3933 0x6c, 0x16, 0xe9, 0x55, 0x39, 0xd1, 0xf1, 0x27, 0xc4, 0xb5, 0x77, 0x58, 3955 0xea, 0xbd, 0x2b, 0x55, 0x1b, 0xfe, 0x71, 0x00, 0xf6, 0xc9, 0x35, 0x50,
3934 0x99, 0xf2, 0x65, 0x8d, 0xb2, 0x9b, 0x83, 0x2c, 0x97, 0x33, 0xf2, 0x47, 3956 0xd7, 0x1e, 0x02, 0x36, 0x8b, 0x75, 0xaa, 0x9c, 0xe8, 0xf4, 0x43, 0xe2,
3935 0xce, 0x15, 0x55, 0x6b, 0x9d, 0x47, 0x5e, 0x12, 0x38, 0xa5, 0x72, 0xb2, 3957 0xd9, 0x3b, 0xac, 0x4c, 0xf9, 0xb2, 0x95, 0xb2, 0x97, 0x83, 0xac, 0x96,
3936 0x16, 0x7c, 0x0b, 0xbf, 0xf7, 0xe2, 0xd7, 0xb1, 0x16, 0xa3, 0xea, 0x8c, 3958 0x33, 0xf2, 0x9f, 0xaa, 0x97, 0x54, 0xad, 0x75, 0x06, 0x79, 0x49, 0x68,
3937 0x82, 0x7e, 0xae, 0xd9, 0x4c, 0xc1, 0x7f, 0xe8, 0x96, 0x65, 0x16, 0x10, 3959 0x5a, 0xe5, 0x64, 0x0d, 0xf8, 0x16, 0x7e, 0xef, 0xd9, 0x2f, 0x62, 0x2d,
3938 0x0f, 0x53, 0xea, 0x9c, 0x0b, 0xd7, 0xf1, 0x6f, 0x2b, 0xff, 0x2c, 0x15, 3960 0x5a, 0xea, 0x4c, 0x83, 0x7e, 0xbe, 0x5e, 0x4f, 0xc1, 0x7f, 0xe8, 0xb6,
3939 0xc8, 0xe6, 0x4c, 0x04, 0x74, 0x34, 0x65, 0x9f, 0x86, 0xd2, 0xc3, 0x13, 3961 0x6d, 0x16, 0x10, 0x0f, 0x53, 0xea, 0x5c, 0x0c, 0xd7, 0xf1, 0x61, 0xe5,
3940 0x0a, 0xf3, 0x1a, 0xe7, 0xe0, 0xb0, 0x96, 0x06, 0x44, 0xce, 0x65, 0x64, 3962 0x9f, 0x65, 0x01, 0xb2, 0x39, 0x1b, 0xc3, 0x38, 0x9a, 0xb2, 0x4f, 0x43,
3941 0x0e, 0x6b, 0x38, 0xb0, 0x44, 0x1d, 0x50, 0xb6, 0x93, 0xd2, 0x06, 0xd9, 3963 0xe9, 0xe1, 0x21, 0x85, 0x79, 0x8d, 0xf3, 0x70, 0x58, 0xcb, 0x3d, 0x22,
3942 0x1f, 0x01, 0xf6, 0x30, 0x4e, 0x51, 0xc6, 0x61, 0xac, 0x8b, 0x5e, 0x09, 3964 0xe7, 0x33, 0x32, 0x85, 0x35, 0x1c, 0x5a, 0xa6, 0x0e, 0x28, 0xdb, 0x31,
3943 0x9c, 0x81, 0x8c, 0x4f, 0x01, 0x23, 0x2c, 0xb4, 0xcb, 0xf7, 0x6a, 0xbe, 3965 0x69, 0x82, 0xec, 0x4f, 0x00, 0x7b, 0x18, 0xd3, 0x94, 0x71, 0x14, 0xeb,
3944 0x4c, 0x2f, 0xf1, 0x5c, 0xbf, 0x3e, 0x35, 0xd2, 0x47, 0x1c, 0x25, 0xd5, 3966 0xa2, 0x53, 0x42, 0x67, 0x21, 0xe3, 0x69, 0x60, 0x84, 0xb9, 0x66, 0x79,
3945 0xda, 0x9c, 0xcc, 0x9d, 0x66, 0xce, 0x3e, 0xa9, 0xce, 0x0c, 0x04, 0xd4, 3967 0x69, 0x31, 0x90, 0xe9, 0xcb, 0x3c, 0xef, 0xaf, 0x8f, 0x0f, 0x74, 0x11,
3946 0x99, 0x15, 0x37, 0x67, 0x76, 0xbf, 0x5d, 0x8c, 0x59, 0x15, 0xee, 0xb5, 3968 0x47, 0x49, 0x65, 0x71, 0x4a, 0xa6, 0x66, 0x99, 0xb3, 0x8f, 0xa9, 0x33,
3947 0x09, 0x6c, 0x67, 0x18, 0xe3, 0x6e, 0x24, 0x5f, 0x37, 0x57, 0x1d, 0x07, 3969 0x06, 0x21, 0x75, 0xc6, 0xc5, 0xcb, 0x99, 0xbd, 0x6f, 0x0f, 0x63, 0x56,
3948 0xbf, 0x97, 0xe7, 0xa3, 0x99, 0xbc, 0xc4, 0x79, 0x76, 0x7a, 0xc2, 0xc6, 3970 0x84, 0x7b, 0x6d, 0x02, 0xdb, 0xe9, 0xc7, 0xbc, 0x37, 0x92, 0xaf, 0x97,
3949 0xfc, 0x97, 0xe1, 0x3f, 0xe7, 0x4a, 0x3c, 0x27, 0x5d, 0xc0, 0x0a, 0xcb, 3971 0xab, 0x0e, 0x83, 0xde, 0x8b, 0x33, 0x56, 0x26, 0x2f, 0x0e, 0xcf, 0x5b,
3950 0xc8, 0xe5, 0x22, 0x73, 0xc6, 0x8f, 0x43, 0x6f, 0xbc, 0x2e, 0x8c, 0x1a, 3972 0x8f, 0xba, 0xe0, 0x7f, 0x15, 0xfe, 0x73, 0xaa, 0x74, 0x2f, 0xf8, 0x2c,
3951 0xf0, 0x03, 0x2b, 0xea, 0xdd, 0xcf, 0xa8, 0xdd, 0x40, 0x0e, 0x1b, 0xd1, 3973 0x60, 0x85, 0x65, 0xe4, 0x62, 0x91, 0x39, 0xe3, 0x47, 0xa1, 0x37, 0x5e,
3952 0xf6, 0x43, 0xd7, 0x79, 0xb3, 0xcd, 0xb3, 0x07, 0x9e, 0xc5, 0x3f, 0x0b, 3974 0x17, 0x06, 0x0d, 0xf8, 0x81, 0x35, 0x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x13, 0xe8, 0xdb,
3982 0xf7, 0xb4, 0x21, 0x77, 0x8e, 0x69, 0x12, 0x53, 0x67, 0xdc, 0x5a, 0x49, 4004 0xd4, 0xd0, 0x77, 0x02, 0xfd, 0xda, 0x11, 0x07, 0xdb, 0x15, 0x4f, 0x93,
3983 0xd4, 0x8c, 0x68, 0xef, 0xa8, 0xf7, 0x28, 0x1b, 0x18, 0xb3, 0x80, 0x7b, 4005 0xa0, 0xeb, 0x4a, 0x51, 0xbd, 0x0b, 0x0c, 0xb9, 0x73, 0x4e, 0x93, 0x98,
3984 0xe7, 0x27, 0xb4, 0x54, 0x35, 0x87, 0x98, 0xf5, 0x30, 0xf1, 0x53, 0xdc, 4006 0x3a, 0xe3, 0xd5, 0x4a, 0x2c, 0x33, 0xa6, 0xbd, 0xa7, 0xde, 0xa3, 0x6c,
3985 0x46, 0xcc, 0xac, 0x80, 0x5e, 0xad, 0xd8, 0xe0, 0x79, 0x6a, 0xd8, 0xc5, 4007 0x60, 0xc8, 0x06, 0xee, 0x9d, 0x19, 0xd5, 0x52, 0x95, 0x1c, 0x62, 0xd6,
3986 0x2d, 0xe2, 0xec, 0x87, 0x0d, 0x75, 0xae, 0x21, 0xad, 0x6a, 0x76, 0x95, 4008 0x2e, 0xe2, 0x27, 0xc7, 0x45, 0xcc, 0x5c, 0xc0, 0x78, 0x8b, 0xc5, 0x15,
3987 0xa2, 0x98, 0xc9, 0x11, 0x9e, 0x65, 0xf8, 0x0c, 0xd6, 0xe5, 0x57, 0xd0, 4009 0x9e, 0xc1, 0x86, 0x5d, 0xbc, 0x4d, 0x9c, 0xbd, 0xcb, 0x50, 0x67, 0x1e,
3988 0x96, 0x44, 0x7c, 0x3c, 0xa0, 0x25, 0xcf, 0x8f, 0xe3, 0xfa, 0x49, 0x5c, 4010 0xd2, 0xaa, 0x66, 0xb7, 0x50, 0x14, 0x33, 0x39, 0xc0, 0x33, 0x0e, 0xf7,
3989 0xc3, 0x1f, 0x2f, 0x64, 0x71, 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0x42, 4018 0x79, 0x80, 0x26, 0x69, 0xfb, 0x49, 0x29, 0x38, 0xf0, 0x2b, 0x15, 0x43,
3997 0x99, 0xb8, 0x9f, 0x75, 0x26, 0xd6, 0xa6, 0x58, 0x5f, 0xca, 0x41, 0x06, 4019 0x52, 0x91, 0x3c, 0x7e, 0xe7, 0x25, 0x39, 0x88, 0xfb, 0x15, 0xda, 0x02,
3998 0x21, 0xda, 0xef, 0x06, 0x35, 0x31, 0xf7, 0x8c, 0x34, 0xe2, 0xb2, 0x96, 4020 0xfb, 0xfd, 0x89, 0x14, 0xca, 0xc4, 0xfd, 0xac, 0x33, 0xb1, 0x36, 0xc5,
3999 0xac, 0x72, 0xdf, 0xaf, 0x91, 0xb9, 0x6c, 0xf1, 0xfd, 0xb1, 0x69, 0xee, 4021 0xfa, 0x52, 0x0e, 0x32, 0x88, 0xd0, 0x7e, 0x6f, 0x50, 0x13, 0xf3, 0xce,
4000 0x23, 0x16, 0x8c, 0x04, 0xeb, 0x23, 0xaa, 0xbe, 0x1e, 0x77, 0xf7, 0x07, 4022 0x55, 0x23, 0x2e, 0x6b, 0xc9, 0x0a, 0xf7, 0xfd, 0xdc, 0xcc, 0x45, 0x9b,
4001 0x5b, 0xcf, 0xa4, 0xf8, 0xeb, 0x85, 0xe3, 0x7e, 0x0d, 0xcf, 0xbb, 0xf5, 4023 0xef, 0x28, 0x4d, 0x70, 0x1f, 0xb1, 0x60, 0x24, 0x58, 0x1f, 0x51, 0xf5,
4002 0xac, 0x54, 0xfd, 0x9d, 0xba, 0xe0, 0x3b, 0x00, 0xe7, 0xa0, 0x8b, 0xcb, 4024 0x75, 0xc7, 0xdb, 0x1f, 0xe4, 0xb8, 0x63, 0xe0, 0xb7, 0xb1, 0x6e, 0xc5,
4003 0x2a, 0x37, 0xe6, 0x1e, 0xee, 0xbb, 0xe5, 0x54, 0xc8, 0x61, 0x8a, 0xac, 4025 0x79, 0xbf, 0x80, 0xe7, 0xbd, 0x7a, 0x56, 0xaa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0x0c, 0xda, 0x42, 0xfe, 0x39, 0x0f, 0xc6, 0x30, 0x7f, 0xaf, 0xd5, 0x9f, 4033 0xa0, 0xce, 0xfd, 0x06, 0x32, 0x08, 0xea, 0x77, 0x37, 0xb6, 0xbd, 0x61,
4012 0x83, 0x3f, 0xcf, 0xfb, 0x95, 0x0f, 0xf9, 0xfd, 0xe4, 0x16, 0xe9, 0xca, 4034 0x9b, 0xb4, 0xdd, 0xce, 0xf3, 0x10, 0xbd, 0xae, 0x90, 0x7e, 0xf2, 0xc1,
4013 0x98, 0x86, 0xc5, 0xd8, 0xf0, 0xb8, 0xb7, 0x3f, 0xf0, 0x7f, 0x43, 0xce, 4035 0x18, 0x16, 0xec, 0xb5, 0x06, 0x3c, 0x04, 0x7c, 0xde, 0xaa, 0x7c, 0x48,
4014 0xae, 0x2c, 0x02, 0x09, 0x99, 0xf5, 0xde, 0xbf, 0xde, 0xc0, 0x1e, 0xd6, 4036 0x6f, 0x64, 0xbb, 0xb4, 0x65, 0x4c, 0xc3, 0x66, 0x6c, 0xf8, 0x84, 0xbf,
4015 0xef, 0x35, 0x37, 0x32, 0x67, 0xad, 0xbb, 0xf3, 0xae, 0x6c, 0x30, 0xef, 4037 0x3f, 0xf0, 0x77, 0x21, 0x67, 0x4f, 0x16, 0xa1, 0x84, 0x4c, 0xfa, 0xef,
4016 0x8a, 0x37, 0xef, 0xea, 0x7d, 0xf2, 0x5b, 0x99, 0xb7, 0x31, 0x67, 0xda, 4038 0xf8, 0xde, 0xc0, 0x1e, 0x36, 0xef, 0x35, 0xbb, 0x99, 0x73, 0xf6, 0x75,
4017 0xdc, 0x46, 0xf6, 0x28, 0xea, 0xdd, 0xb0, 0x15, 0x23, 0x18, 0xb4, 0x9d, 4039 0xbe, 0x17, 0x6e, 0xc0, 0xf7, 0x82, 0xcf, 0x77, 0xe5, 0x16, 0xe9, 0x5d,
4018 0x7b, 0xd5, 0x50, 0x99, 0x57, 0xbb, 0x76, 0x79, 0x16, 0xb1, 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f3, 0xb0, 0x52, 0x75, 0x14, 0x7e, 0x1f, 0xb9,
4026 0x05, 0xd9, 0xc2, 0x33, 0x25, 0x65, 0xb5, 0xcf, 0xe6, 0xd6, 0xc5, 0xa7, 4048 0x84, 0xbd, 0x55, 0x0a, 0xc8, 0xb9, 0xcf, 0xd9, 0x0f, 0x6f, 0x27, 0xce,
4027 0xc5, 0xff, 0x7f, 0x1d, 0x41, 0x2f, 0x16, 0xf2, 0x5c, 0x0b, 0xdf, 0x73, 4049 0xe1, 0x58, 0xab, 0x18, 0xeb, 0xe2, 0x9c, 0x6c, 0xe7, 0x99, 0x92, 0xb2,
4028 0xa6, 0xaf, 0x40, 0x1e, 0x34, 0xc1, 0x7d, 0x9c, 0x66, 0xd3, 0xad, 0x9b, 4050 0xda, 0x67, 0xf3, 0xea, 0xe2, 0x13, 0x12, 0xfc, 0x4f, 0x88, 0xb0, 0x1f,
4029 0x37, 0xb1, 0x2e, 0xda, 0xf8, 0x0e, 0x05, 0xfe, 0x0e, 0xc3, 0x7e, 0xb0, 4051 0x0b, 0x79, 0xae, 0x85, 0xef, 0xd2, 0xd2, 0x57, 0x20, 0x0f, 0x1a, 0xe5,
4030 0x4e, 0x56, 0xdb, 0x79, 0xcd, 0xdc, 0xc3, 0xbf, 0x66, 0x60, 0xfb, 0x3f, 4052 0x3e, 0x4e, 0xbd, 0xee, 0xd5, 0xcd, 0xeb, 0x58, 0x17, 0x4d, 0x7c, 0xef,
4031 0xe8, 0xf3, 0x49, 0x14, 0x38, 0x46, 0x00, 0x00, 0x00 }; 4053 0x02, 0x7f, 0xc7, 0x61, 0x3f, 0x58, 0x27, 0xeb, 0xed, 0xbc, 0x66, 0xee,
4054 0x11, 0x5c, 0x33, 0xb0, 0xfd, 0x3f, 0xd4, 0x46, 0x90, 0x7c, 0xb4, 0x45,
4055 0x00, 0x00, 0x00 };
4032 4056
4033static const u32 bnx2_TXP_b09FwData[(0xd0/4) + 1] = { 4057static const u32 bnx2_TXP_b09FwData[(0xd0/4) + 1] = {
4034 0x00000000, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000010, 4058 0x00000000, 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000010,
@@ -4041,37 +4065,38 @@ static const u32 bnx2_TXP_b09FwData[(0xd0/4) + 1] = {
4041 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 4065 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
4042 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; 4066 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
4043static const u32 bnx2_TXP_b09FwRodata[(0x30/4) + 1] = { 4067static const u32 bnx2_TXP_b09FwRodata[(0x30/4) + 1] = {
4044 0x08004060, 0x0800408c, 0x080040d4, 0x080040d4, 0x08003f60, 0x08003f8c, 4068 0x08003fdc, 0x08004008, 0x08004050, 0x08004050, 0x08003edc, 0x08003f08,
4045 0x08003f8c, 0x080040d4, 0x080040d4, 0x080040d4, 0x08003ff4, 0x00000000, 4069 0x08003f08, 0x08004050, 0x08004050, 0x08004050, 0x08003f70, 0x00000000,
4046 0x00000000 }; 4070 0x00000000 };
4047 4071
4048static struct fw_info bnx2_txp_fw_09 = { 4072static struct fw_info bnx2_txp_fw_09 = {
4073 /* Firmware version: 3.7.1 */
4049 .ver_major = 0x3, 4074 .ver_major = 0x3,
4050 .ver_minor = 0x4, 4075 .ver_minor = 0x7,
4051 .ver_fix = 0x3, 4076 .ver_fix = 0x1,
4052 4077
4053 .start_addr = 0x08000060, 4078 .start_addr = 0x08000060,
4054 4079
4055 .text_addr = 0x08000000, 4080 .text_addr = 0x08000000,
4056 .text_len = 0x4634, 4081 .text_len = 0x45b0,
4057 .text_index = 0x0, 4082 .text_index = 0x0,
4058 .gz_text = bnx2_TXP_b09FwText, 4083 .gz_text = bnx2_TXP_b09FwText,
4059 .gz_text_len = sizeof(bnx2_TXP_b09FwText), 4084 .gz_text_len = sizeof(bnx2_TXP_b09FwText),
4060 4085
4061 .data_addr = 0x08004680, 4086 .data_addr = 0x08004600,
4062 .data_len = 0xd0, 4087 .data_len = 0xd0,
4063 .data_index = 0x0, 4088 .data_index = 0x0,
4064 .data = bnx2_TXP_b09FwData, 4089 .data = bnx2_TXP_b09FwData,
4065 4090
4066 .sbss_addr = 0x08004750, 4091 .sbss_addr = 0x080046d0,
4067 .sbss_len = 0x8c, 4092 .sbss_len = 0x8c,
4068 .sbss_index = 0x0, 4093 .sbss_index = 0x0,
4069 4094
4070 .bss_addr = 0x080047e0, 4095 .bss_addr = 0x08004760,
4071 .bss_len = 0xa20, 4096 .bss_len = 0xa20,
4072 .bss_index = 0x0, 4097 .bss_index = 0x0,
4073 4098
4074 .rodata_addr = 0x08004638, 4099 .rodata_addr = 0x080045b0,
4075 .rodata_len = 0x30, 4100 .rodata_len = 0x30,
4076 .rodata_index = 0x0, 4101 .rodata_index = 0x0,
4077 .rodata = bnx2_TXP_b09FwRodata, 4102 .rodata = bnx2_TXP_b09FwRodata,
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 7a045a37056e..084f0292ea6e 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -126,7 +126,7 @@ static struct aggregator *__get_active_agg(struct aggregator *aggregator);
126 126
127// ================= main 802.3ad protocol functions ================== 127// ================= main 802.3ad protocol functions ==================
128static int ad_lacpdu_send(struct port *port); 128static int ad_lacpdu_send(struct port *port);
129static int ad_marker_send(struct port *port, struct marker *marker); 129static int ad_marker_send(struct port *port, struct bond_marker *marker);
130static void ad_mux_machine(struct port *port); 130static void ad_mux_machine(struct port *port);
131static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port); 131static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port);
132static void ad_tx_machine(struct port *port); 132static void ad_tx_machine(struct port *port);
@@ -139,8 +139,8 @@ static void ad_initialize_port(struct port *port, int lacp_fast);
139static void ad_initialize_lacpdu(struct lacpdu *Lacpdu); 139static void ad_initialize_lacpdu(struct lacpdu *Lacpdu);
140static void ad_enable_collecting_distributing(struct port *port); 140static void ad_enable_collecting_distributing(struct port *port);
141static void ad_disable_collecting_distributing(struct port *port); 141static void ad_disable_collecting_distributing(struct port *port);
142static void ad_marker_info_received(struct marker *marker_info, struct port *port); 142static void ad_marker_info_received(struct bond_marker *marker_info, struct port *port);
143static void ad_marker_response_received(struct marker *marker, struct port *port); 143static void ad_marker_response_received(struct bond_marker *marker, struct port *port);
144 144
145 145
146///////////////////////////////////////////////////////////////////////////////// 146/////////////////////////////////////////////////////////////////////////////////
@@ -889,12 +889,12 @@ static int ad_lacpdu_send(struct port *port)
889 * Returns: 0 on success 889 * Returns: 0 on success
890 * < 0 on error 890 * < 0 on error
891 */ 891 */
892static int ad_marker_send(struct port *port, struct marker *marker) 892static int ad_marker_send(struct port *port, struct bond_marker *marker)
893{ 893{
894 struct slave *slave = port->slave; 894 struct slave *slave = port->slave;
895 struct sk_buff *skb; 895 struct sk_buff *skb;
896 struct marker_header *marker_header; 896 struct bond_marker_header *marker_header;
897 int length = sizeof(struct marker_header); 897 int length = sizeof(struct bond_marker_header);
898 struct mac_addr lacpdu_multicast_address = AD_MULTICAST_LACPDU_ADDR; 898 struct mac_addr lacpdu_multicast_address = AD_MULTICAST_LACPDU_ADDR;
899 899
900 skb = dev_alloc_skb(length + 16); 900 skb = dev_alloc_skb(length + 16);
@@ -909,7 +909,7 @@ static int ad_marker_send(struct port *port, struct marker *marker)
909 skb->network_header = skb->mac_header + ETH_HLEN; 909 skb->network_header = skb->mac_header + ETH_HLEN;
910 skb->protocol = PKT_TYPE_LACPDU; 910 skb->protocol = PKT_TYPE_LACPDU;
911 911
912 marker_header = (struct marker_header *)skb_put(skb, length); 912 marker_header = (struct bond_marker_header *)skb_put(skb, length);
913 913
914 marker_header->ad_header.destination_address = lacpdu_multicast_address; 914 marker_header->ad_header.destination_address = lacpdu_multicast_address;
915 /* Note: source addres is set to be the member's PERMANENT address, because we use it 915 /* Note: source addres is set to be the member's PERMANENT address, because we use it
@@ -1709,7 +1709,7 @@ static void ad_disable_collecting_distributing(struct port *port)
1709 */ 1709 */
1710static void ad_marker_info_send(struct port *port) 1710static void ad_marker_info_send(struct port *port)
1711{ 1711{
1712 struct marker marker; 1712 struct bond_marker marker;
1713 u16 index; 1713 u16 index;
1714 1714
1715 // fill the marker PDU with the appropriate values 1715 // fill the marker PDU with the appropriate values
@@ -1742,13 +1742,14 @@ static void ad_marker_info_send(struct port *port)
1742 * @port: the port we're looking at 1742 * @port: the port we're looking at
1743 * 1743 *
1744 */ 1744 */
1745static void ad_marker_info_received(struct marker *marker_info,struct port *port) 1745static void ad_marker_info_received(struct bond_marker *marker_info,
1746 struct port *port)
1746{ 1747{
1747 struct marker marker; 1748 struct bond_marker marker;
1748 1749
1749 // copy the received marker data to the response marker 1750 // copy the received marker data to the response marker
1750 //marker = *marker_info; 1751 //marker = *marker_info;
1751 memcpy(&marker, marker_info, sizeof(struct marker)); 1752 memcpy(&marker, marker_info, sizeof(struct bond_marker));
1752 // change the marker subtype to marker response 1753 // change the marker subtype to marker response
1753 marker.tlv_type=AD_MARKER_RESPONSE_SUBTYPE; 1754 marker.tlv_type=AD_MARKER_RESPONSE_SUBTYPE;
1754 // send the marker response 1755 // send the marker response
@@ -1767,7 +1768,8 @@ static void ad_marker_info_received(struct marker *marker_info,struct port *port
1767 * response for marker PDU's, in this stage, but only to respond to marker 1768 * response for marker PDU's, in this stage, but only to respond to marker
1768 * information. 1769 * information.
1769 */ 1770 */
1770static void ad_marker_response_received(struct marker *marker, struct port *port) 1771static void ad_marker_response_received(struct bond_marker *marker,
1772 struct port *port)
1771{ 1773{
1772 marker=NULL; // just to satisfy the compiler 1774 marker=NULL; // just to satisfy the compiler
1773 port=NULL; // just to satisfy the compiler 1775 port=NULL; // just to satisfy the compiler
@@ -2164,15 +2166,15 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
2164 case AD_TYPE_MARKER: 2166 case AD_TYPE_MARKER:
2165 // No need to convert fields to Little Endian since we don't use the marker's fields. 2167 // No need to convert fields to Little Endian since we don't use the marker's fields.
2166 2168
2167 switch (((struct marker *)lacpdu)->tlv_type) { 2169 switch (((struct bond_marker *)lacpdu)->tlv_type) {
2168 case AD_MARKER_INFORMATION_SUBTYPE: 2170 case AD_MARKER_INFORMATION_SUBTYPE:
2169 dprintk("Received Marker Information on port %d\n", port->actor_port_number); 2171 dprintk("Received Marker Information on port %d\n", port->actor_port_number);
2170 ad_marker_info_received((struct marker *)lacpdu, port); 2172 ad_marker_info_received((struct bond_marker *)lacpdu, port);
2171 break; 2173 break;
2172 2174
2173 case AD_MARKER_RESPONSE_SUBTYPE: 2175 case AD_MARKER_RESPONSE_SUBTYPE:
2174 dprintk("Received Marker Response on port %d\n", port->actor_port_number); 2176 dprintk("Received Marker Response on port %d\n", port->actor_port_number);
2175 ad_marker_response_received((struct marker *)lacpdu, port); 2177 ad_marker_response_received((struct bond_marker *)lacpdu, port);
2176 break; 2178 break;
2177 2179
2178 default: 2180 default:
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h
index 862952fa6fd9..f16557264944 100644
--- a/drivers/net/bonding/bond_3ad.h
+++ b/drivers/net/bonding/bond_3ad.h
@@ -92,7 +92,7 @@ typedef enum {
92typedef enum { 92typedef enum {
93 AD_MARKER_INFORMATION_SUBTYPE = 1, // marker imformation subtype 93 AD_MARKER_INFORMATION_SUBTYPE = 1, // marker imformation subtype
94 AD_MARKER_RESPONSE_SUBTYPE // marker response subtype 94 AD_MARKER_RESPONSE_SUBTYPE // marker response subtype
95} marker_subtype_t; 95} bond_marker_subtype_t;
96 96
97// timers types(43.4.9 in the 802.3ad standard) 97// timers types(43.4.9 in the 802.3ad standard)
98typedef enum { 98typedef enum {
@@ -148,7 +148,7 @@ typedef struct lacpdu_header {
148} lacpdu_header_t; 148} lacpdu_header_t;
149 149
150// Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard) 150// Marker Protocol Data Unit(PDU) structure(43.5.3.2 in the 802.3ad standard)
151typedef struct marker { 151typedef struct bond_marker {
152 u8 subtype; // = 0x02 (marker PDU) 152 u8 subtype; // = 0x02 (marker PDU)
153 u8 version_number; // = 0x01 153 u8 version_number; // = 0x01
154 u8 tlv_type; // = 0x01 (marker information) 154 u8 tlv_type; // = 0x01 (marker information)
@@ -161,12 +161,12 @@ typedef struct marker {
161 u8 tlv_type_terminator; // = 0x00 161 u8 tlv_type_terminator; // = 0x00
162 u8 terminator_length; // = 0x00 162 u8 terminator_length; // = 0x00
163 u8 reserved_90[90]; // = 0 163 u8 reserved_90[90]; // = 0
164} marker_t; 164} bond_marker_t;
165 165
166typedef struct marker_header { 166typedef struct bond_marker_header {
167 struct ad_header ad_header; 167 struct ad_header ad_header;
168 struct marker marker; 168 struct bond_marker marker;
169} marker_header_t; 169} bond_marker_header_t;
170 170
171#pragma pack() 171#pragma pack()
172 172
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 80c0c8c415ed..855dc10ffa1b 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -55,7 +55,7 @@ static int expected_refcount = -1;
55static struct class *netdev_class; 55static struct class *netdev_class;
56/*--------------------------- Data Structures -----------------------------*/ 56/*--------------------------- Data Structures -----------------------------*/
57 57
58/* Bonding sysfs lock. Why can't we just use the subsytem lock? 58/* Bonding sysfs lock. Why can't we just use the subsystem lock?
59 * Because kobject_register tries to acquire the subsystem lock. If 59 * Because kobject_register tries to acquire the subsystem lock. If
60 * we already hold the lock (which we would if the user was creating 60 * we already hold the lock (which we would if the user was creating
61 * a new bond through the sysfs interface), we deadlock. 61 * a new bond through the sysfs interface), we deadlock.
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 314b2f68f78f..edd6828f0a78 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -234,6 +234,7 @@
234#include <linux/spinlock.h> 234#include <linux/spinlock.h>
235#include <linux/errno.h> 235#include <linux/errno.h>
236#include <linux/init.h> 236#include <linux/init.h>
237#include <linux/bitops.h>
237 238
238#include <linux/if.h> 239#include <linux/if.h>
239#include <linux/mii.h> 240#include <linux/mii.h>
@@ -247,7 +248,6 @@
247#include <asm/irq.h> 248#include <asm/irq.h>
248#include <asm/dma.h> 249#include <asm/dma.h>
249#include <asm/system.h> 250#include <asm/system.h>
250#include <asm/bitops.h>
251#include <asm/ethernet.h> 251#include <asm/ethernet.h>
252#include <asm/cache.h> 252#include <asm/cache.h>
253 253
diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 044261703381..2a3df145850d 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -41,9 +41,9 @@
41#include <linux/timer.h> 41#include <linux/timer.h>
42#include <linux/cache.h> 42#include <linux/cache.h>
43#include <linux/mutex.h> 43#include <linux/mutex.h>
44#include <linux/bitops.h>
44#include "t3cdev.h" 45#include "t3cdev.h"
45#include <asm/semaphore.h> 46#include <asm/semaphore.h>
46#include <asm/bitops.h>
47#include <asm/io.h> 47#include <asm/io.h>
48 48
49typedef irqreturn_t(*intr_handler_t) (int, void *); 49typedef irqreturn_t(*intr_handler_t) (int, void *);
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 27ac010900ab..3286d2a0a870 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -542,7 +542,8 @@ dm9000_probe(struct platform_device *pdev)
542 542
543 if (id_val != DM9000_ID) { 543 if (id_val != DM9000_ID) {
544 printk("%s: wrong id: 0x%08x\n", CARDNAME, id_val); 544 printk("%s: wrong id: 0x%08x\n", CARDNAME, id_val);
545 goto release; 545 ret = -ENODEV;
546 goto out;
546 } 547 }
547 548
548 /* from this point we assume that we have found a DM9000 */ 549 /* from this point we assume that we have found a DM9000 */
@@ -602,8 +603,7 @@ dm9000_probe(struct platform_device *pdev)
602 } 603 }
603 return 0; 604 return 0;
604 605
605 release: 606out:
606 out:
607 printk("%s: not found (%d).\n", CARDNAME, ret); 607 printk("%s: not found (%d).\n", CARDNAME, ret);
608 608
609 dm9000_release_board(pdev, db); 609 dm9000_release_board(pdev, db);
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 64f35e20fd48..3dbaec680b46 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1324,7 +1324,7 @@ static inline int e100_exec_cb_wait(struct nic *nic, struct sk_buff *skb,
1324 if (!--counter) break; 1324 if (!--counter) break;
1325 } 1325 }
1326 1326
1327 /* ack any interupts, something could have been set */ 1327 /* ack any interrupts, something could have been set */
1328 iowrite8(~0, &nic->csr->scb.stat_ack); 1328 iowrite8(~0, &nic->csr->scb.stat_ack);
1329 1329
1330 /* if the command failed, or is not OK, notify and return */ 1330 /* if the command failed, or is not OK, notify and return */
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 047263830e6a..f1ce348470cc 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3590,7 +3590,7 @@ e1000_update_stats(struct e1000_adapter *adapter)
3590 3590
3591 spin_lock_irqsave(&adapter->stats_lock, flags); 3591 spin_lock_irqsave(&adapter->stats_lock, flags);
3592 3592
3593 /* these counters are modified from e1000_adjust_tbi_stats, 3593 /* these counters are modified from e1000_tbi_adjust_stats,
3594 * called from the interrupt context, so they must only 3594 * called from the interrupt context, so they must only
3595 * be written while holding adapter->stats_lock 3595 * be written while holding adapter->stats_lock
3596 */ 3596 */
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index fe5ffac7ac57..2809c99906e0 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -3218,7 +3218,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
3218 /* get adapter properties */ 3218 /* get adapter properties */
3219 ret = ehea_sense_adapter_attr(adapter); 3219 ret = ehea_sense_adapter_attr(adapter);
3220 if (ret) { 3220 if (ret) {
3221 dev_err(&dev->dev, "sense_adapter_attr failed: %d", ret); 3221 dev_err(&dev->dev, "sense_adapter_attr failed: %d\n", ret);
3222 goto out_free_ad; 3222 goto out_free_ad;
3223 } 3223 }
3224 3224
@@ -3226,7 +3226,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
3226 EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); 3226 EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1);
3227 if (!adapter->neq) { 3227 if (!adapter->neq) {
3228 ret = -EIO; 3228 ret = -EIO;
3229 dev_err(&dev->dev, "NEQ creation failed"); 3229 dev_err(&dev->dev, "NEQ creation failed\n");
3230 goto out_free_ad; 3230 goto out_free_ad;
3231 } 3231 }
3232 3232
@@ -3237,7 +3237,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
3237 ehea_interrupt_neq, IRQF_DISABLED, 3237 ehea_interrupt_neq, IRQF_DISABLED,
3238 "ehea_neq", adapter); 3238 "ehea_neq", adapter);
3239 if (ret) { 3239 if (ret) {
3240 dev_err(&dev->dev, "requesting NEQ IRQ failed"); 3240 dev_err(&dev->dev, "requesting NEQ IRQ failed\n");
3241 goto out_kill_eq; 3241 goto out_kill_eq;
3242 } 3242 }
3243 3243
@@ -3247,7 +3247,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
3247 3247
3248 ret = ehea_setup_ports(adapter); 3248 ret = ehea_setup_ports(adapter);
3249 if (ret) { 3249 if (ret) {
3250 dev_err(&dev->dev, "setup_ports failed"); 3250 dev_err(&dev->dev, "setup_ports failed\n");
3251 goto out_rem_dev_sysfs; 3251 goto out_rem_dev_sysfs;
3252 } 3252 }
3253 3253
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index 243fc6b354b5..e3dd8b136908 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -170,7 +170,6 @@ static char *version =
170 170
171 171
172/* Few macros */ 172/* Few macros */
173#define BIT(a) ( (1 << (a)) )
174#define BITSET(ioaddr, bnum) ((outb(((inb(ioaddr)) | (bnum)), ioaddr))) 173#define BITSET(ioaddr, bnum) ((outb(((inb(ioaddr)) | (bnum)), ioaddr)))
175#define BITCLR(ioaddr, bnum) ((outb(((inb(ioaddr)) & (~(bnum))), ioaddr))) 174#define BITCLR(ioaddr, bnum) ((outb(((inb(ioaddr)) & (~(bnum))), ioaddr)))
176 175
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index 43f7647ff246..7bb9c728a1d3 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -111,7 +111,6 @@ MODULE_AUTHOR("Myson or whoever");
111MODULE_DESCRIPTION("Myson MTD-8xx 100/10M Ethernet PCI Adapter Driver"); 111MODULE_DESCRIPTION("Myson MTD-8xx 100/10M Ethernet PCI Adapter Driver");
112MODULE_LICENSE("GPL"); 112MODULE_LICENSE("GPL");
113module_param(max_interrupt_work, int, 0); 113module_param(max_interrupt_work, int, 0);
114//MODULE_PARM(min_pci_latency, "i");
115module_param(debug, int, 0); 114module_param(debug, int, 0);
116module_param(rx_copybreak, int, 0); 115module_param(rx_copybreak, int, 0);
117module_param(multicast_filter_limit, int, 0); 116module_param(multicast_filter_limit, int, 0);
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index cfbb7aacfe94..70ddf1acfd88 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -992,7 +992,7 @@ static void nv_enable_irq(struct net_device *dev)
992 if (np->msi_flags & NV_MSI_X_ENABLED) 992 if (np->msi_flags & NV_MSI_X_ENABLED)
993 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 993 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
994 else 994 else
995 enable_irq(dev->irq); 995 enable_irq(np->pci_dev->irq);
996 } else { 996 } else {
997 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); 997 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
998 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); 998 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
@@ -1008,7 +1008,7 @@ static void nv_disable_irq(struct net_device *dev)
1008 if (np->msi_flags & NV_MSI_X_ENABLED) 1008 if (np->msi_flags & NV_MSI_X_ENABLED)
1009 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 1009 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
1010 else 1010 else
1011 disable_irq(dev->irq); 1011 disable_irq(np->pci_dev->irq);
1012 } else { 1012 } else {
1013 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); 1013 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
1014 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector); 1014 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
@@ -1607,7 +1607,7 @@ static void nv_do_rx_refill(unsigned long data)
1607 if (np->msi_flags & NV_MSI_X_ENABLED) 1607 if (np->msi_flags & NV_MSI_X_ENABLED)
1608 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 1608 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
1609 else 1609 else
1610 disable_irq(dev->irq); 1610 disable_irq(np->pci_dev->irq);
1611 } else { 1611 } else {
1612 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); 1612 disable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
1613 } 1613 }
@@ -1625,7 +1625,7 @@ static void nv_do_rx_refill(unsigned long data)
1625 if (np->msi_flags & NV_MSI_X_ENABLED) 1625 if (np->msi_flags & NV_MSI_X_ENABLED)
1626 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 1626 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
1627 else 1627 else
1628 enable_irq(dev->irq); 1628 enable_irq(np->pci_dev->irq);
1629 } else { 1629 } else {
1630 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector); 1630 enable_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
1631 } 1631 }
@@ -2408,13 +2408,13 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
2408 struct fe_priv *np = netdev_priv(dev); 2408 struct fe_priv *np = netdev_priv(dev);
2409 u32 flags; 2409 u32 flags;
2410 u32 vlanflags = 0; 2410 u32 vlanflags = 0;
2411 u32 rx_processed_cnt = 0; 2411 int rx_work = 0;
2412 struct sk_buff *skb; 2412 struct sk_buff *skb;
2413 int len; 2413 int len;
2414 2414
2415 while((np->get_rx.ex != np->put_rx.ex) && 2415 while((np->get_rx.ex != np->put_rx.ex) &&
2416 !((flags = le32_to_cpu(np->get_rx.ex->flaglen)) & NV_RX2_AVAIL) && 2416 !((flags = le32_to_cpu(np->get_rx.ex->flaglen)) & NV_RX2_AVAIL) &&
2417 (rx_processed_cnt++ < limit)) { 2417 (rx_work < limit)) {
2418 2418
2419 dprintk(KERN_DEBUG "%s: nv_rx_process_optimized: flags 0x%x.\n", 2419 dprintk(KERN_DEBUG "%s: nv_rx_process_optimized: flags 0x%x.\n",
2420 dev->name, flags); 2420 dev->name, flags);
@@ -2517,9 +2517,11 @@ next_pkt:
2517 np->get_rx.ex = np->first_rx.ex; 2517 np->get_rx.ex = np->first_rx.ex;
2518 if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx)) 2518 if (unlikely(np->get_rx_ctx++ == np->last_rx_ctx))
2519 np->get_rx_ctx = np->first_rx_ctx; 2519 np->get_rx_ctx = np->first_rx_ctx;
2520
2521 rx_work++;
2520 } 2522 }
2521 2523
2522 return rx_processed_cnt; 2524 return rx_work;
2523} 2525}
2524 2526
2525static void set_bufsize(struct net_device *dev) 2527static void set_bufsize(struct net_device *dev)
@@ -3558,10 +3560,12 @@ static int nv_request_irq(struct net_device *dev, int intr_test)
3558 if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) { 3560 if (ret != 0 && np->msi_flags & NV_MSI_CAPABLE) {
3559 if ((ret = pci_enable_msi(np->pci_dev)) == 0) { 3561 if ((ret = pci_enable_msi(np->pci_dev)) == 0) {
3560 np->msi_flags |= NV_MSI_ENABLED; 3562 np->msi_flags |= NV_MSI_ENABLED;
3563 dev->irq = np->pci_dev->irq;
3561 if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, dev->name, dev) != 0) { 3564 if (request_irq(np->pci_dev->irq, handler, IRQF_SHARED, dev->name, dev) != 0) {
3562 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret); 3565 printk(KERN_INFO "forcedeth: request_irq failed %d\n", ret);
3563 pci_disable_msi(np->pci_dev); 3566 pci_disable_msi(np->pci_dev);
3564 np->msi_flags &= ~NV_MSI_ENABLED; 3567 np->msi_flags &= ~NV_MSI_ENABLED;
3568 dev->irq = np->pci_dev->irq;
3565 goto out_err; 3569 goto out_err;
3566 } 3570 }
3567 3571
@@ -3624,7 +3628,7 @@ static void nv_do_nic_poll(unsigned long data)
3624 if (np->msi_flags & NV_MSI_X_ENABLED) 3628 if (np->msi_flags & NV_MSI_X_ENABLED)
3625 disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 3629 disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
3626 else 3630 else
3627 disable_irq_lockdep(dev->irq); 3631 disable_irq_lockdep(np->pci_dev->irq);
3628 mask = np->irqmask; 3632 mask = np->irqmask;
3629 } else { 3633 } else {
3630 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { 3634 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
@@ -3642,6 +3646,8 @@ static void nv_do_nic_poll(unsigned long data)
3642 } 3646 }
3643 np->nic_poll_irq = 0; 3647 np->nic_poll_irq = 0;
3644 3648
3649 /* disable_irq() contains synchronize_irq, thus no irq handler can run now */
3650
3645 if (np->recover_error) { 3651 if (np->recover_error) {
3646 np->recover_error = 0; 3652 np->recover_error = 0;
3647 printk(KERN_INFO "forcedeth: MAC in recoverable error state\n"); 3653 printk(KERN_INFO "forcedeth: MAC in recoverable error state\n");
@@ -3678,7 +3684,6 @@ static void nv_do_nic_poll(unsigned long data)
3678 } 3684 }
3679 } 3685 }
3680 3686
3681 /* FIXME: Do we need synchronize_irq(dev->irq) here? */
3682 3687
3683 writel(mask, base + NvRegIrqMask); 3688 writel(mask, base + NvRegIrqMask);
3684 pci_push(base); 3689 pci_push(base);
@@ -3691,7 +3696,7 @@ static void nv_do_nic_poll(unsigned long data)
3691 if (np->msi_flags & NV_MSI_X_ENABLED) 3696 if (np->msi_flags & NV_MSI_X_ENABLED)
3692 enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); 3697 enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);
3693 else 3698 else
3694 enable_irq_lockdep(dev->irq); 3699 enable_irq_lockdep(np->pci_dev->irq);
3695 } else { 3700 } else {
3696 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) { 3701 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
3697 nv_nic_irq_rx(0, dev); 3702 nv_nic_irq_rx(0, dev);
@@ -4948,7 +4953,7 @@ static int nv_close(struct net_device *dev)
4948#ifdef CONFIG_FORCEDETH_NAPI 4953#ifdef CONFIG_FORCEDETH_NAPI
4949 napi_disable(&np->napi); 4954 napi_disable(&np->napi);
4950#endif 4955#endif
4951 synchronize_irq(dev->irq); 4956 synchronize_irq(np->pci_dev->irq);
4952 4957
4953 del_timer_sync(&np->oom_kick); 4958 del_timer_sync(&np->oom_kick);
4954 del_timer_sync(&np->nic_poll); 4959 del_timer_sync(&np->nic_poll);
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index 04c6faec88d2..f2a4d399a6e5 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -88,7 +88,7 @@ static void skb_align(struct sk_buff *skb, int align)
88static int fs_enet_rx_napi(struct napi_struct *napi, int budget) 88static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
89{ 89{
90 struct fs_enet_private *fep = container_of(napi, struct fs_enet_private, napi); 90 struct fs_enet_private *fep = container_of(napi, struct fs_enet_private, napi);
91 struct net_device *dev = to_net_dev(fep->dev); 91 struct net_device *dev = fep->ndev;
92 const struct fs_platform_info *fpi = fep->fpi; 92 const struct fs_platform_info *fpi = fep->fpi;
93 cbd_t __iomem *bdp; 93 cbd_t __iomem *bdp;
94 struct sk_buff *skb, *skbn, *skbt; 94 struct sk_buff *skb, *skbn, *skbt;
@@ -217,7 +217,7 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
217 217
218 fep->cur_rx = bdp; 218 fep->cur_rx = bdp;
219 219
220 if (received >= budget) { 220 if (received < budget) {
221 /* done */ 221 /* done */
222 netif_rx_complete(dev, napi); 222 netif_rx_complete(dev, napi);
223 (*fep->ops->napi_enable_rx)(dev); 223 (*fep->ops->napi_enable_rx)(dev);
@@ -807,20 +807,23 @@ static int fs_enet_open(struct net_device *dev)
807 int r; 807 int r;
808 int err; 808 int err;
809 809
810 napi_enable(&fep->napi); 810 if (fep->fpi->use_napi)
811 napi_enable(&fep->napi);
811 812
812 /* Install our interrupt handler. */ 813 /* Install our interrupt handler. */
813 r = fs_request_irq(dev, fep->interrupt, "fs_enet-mac", fs_enet_interrupt); 814 r = fs_request_irq(dev, fep->interrupt, "fs_enet-mac", fs_enet_interrupt);
814 if (r != 0) { 815 if (r != 0) {
815 printk(KERN_ERR DRV_MODULE_NAME 816 printk(KERN_ERR DRV_MODULE_NAME
816 ": %s Could not allocate FS_ENET IRQ!", dev->name); 817 ": %s Could not allocate FS_ENET IRQ!", dev->name);
817 napi_disable(&fep->napi); 818 if (fep->fpi->use_napi)
819 napi_disable(&fep->napi);
818 return -EINVAL; 820 return -EINVAL;
819 } 821 }
820 822
821 err = fs_init_phy(dev); 823 err = fs_init_phy(dev);
822 if(err) { 824 if (err) {
823 napi_disable(&fep->napi); 825 if (fep->fpi->use_napi)
826 napi_disable(&fep->napi);
824 return err; 827 return err;
825 } 828 }
826 phy_start(fep->phydev); 829 phy_start(fep->phydev);
@@ -1232,7 +1235,7 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1232 fpi->rx_ring = 32; 1235 fpi->rx_ring = 32;
1233 fpi->tx_ring = 32; 1236 fpi->tx_ring = 32;
1234 fpi->rx_copybreak = 240; 1237 fpi->rx_copybreak = 240;
1235 fpi->use_napi = 0; 1238 fpi->use_napi = 1;
1236 fpi->napi_weight = 17; 1239 fpi->napi_weight = 17;
1237 1240
1238 ret = find_phy(ofdev->node, fpi); 1241 ret = find_phy(ofdev->node, fpi);
@@ -1249,11 +1252,11 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1249 goto out_free_fpi; 1252 goto out_free_fpi;
1250 } 1253 }
1251 1254
1252 SET_MODULE_OWNER(ndev);
1253 dev_set_drvdata(&ofdev->dev, ndev); 1255 dev_set_drvdata(&ofdev->dev, ndev);
1254 1256
1255 fep = netdev_priv(ndev); 1257 fep = netdev_priv(ndev);
1256 fep->dev = &ofdev->dev; 1258 fep->dev = &ofdev->dev;
1259 fep->ndev = ndev;
1257 fep->fpi = fpi; 1260 fep->fpi = fpi;
1258 fep->ops = match->data; 1261 fep->ops = match->data;
1259 1262
@@ -1288,10 +1291,11 @@ static int __devinit fs_enet_probe(struct of_device *ofdev,
1288 ndev->stop = fs_enet_close; 1291 ndev->stop = fs_enet_close;
1289 ndev->get_stats = fs_enet_get_stats; 1292 ndev->get_stats = fs_enet_get_stats;
1290 ndev->set_multicast_list = fs_set_multicast_list; 1293 ndev->set_multicast_list = fs_set_multicast_list;
1291 if (fpi->use_napi) { 1294
1292 ndev->poll = fs_enet_rx_napi; 1295 if (fpi->use_napi)
1293 ndev->weight = fpi->napi_weight; 1296 netif_napi_add(ndev, &fep->napi, fs_enet_rx_napi,
1294 } 1297 fpi->napi_weight);
1298
1295 ndev->ethtool_ops = &fs_ethtool_ops; 1299 ndev->ethtool_ops = &fs_ethtool_ops;
1296 ndev->do_ioctl = fs_ioctl; 1300 ndev->do_ioctl = fs_ioctl;
1297 1301
diff --git a/drivers/net/fs_enet/fs_enet.h b/drivers/net/fs_enet/fs_enet.h
index baf6477165af..c675e29aadcc 100644
--- a/drivers/net/fs_enet/fs_enet.h
+++ b/drivers/net/fs_enet/fs_enet.h
@@ -75,6 +75,7 @@ struct phy_info {
75struct fs_enet_private { 75struct fs_enet_private {
76 struct napi_struct napi; 76 struct napi_struct napi;
77 struct device *dev; /* pointer back to the device (must be initialized first) */ 77 struct device *dev; /* pointer back to the device (must be initialized first) */
78 struct net_device *ndev;
78 spinlock_t lock; /* during all ops except TX pckt processing */ 79 spinlock_t lock; /* during all ops except TX pckt processing */
79 spinlock_t tx_lock; /* during fs_start_xmit and fs_tx */ 80 spinlock_t tx_lock; /* during fs_start_xmit and fs_tx */
80 struct fs_platform_info *fpi; 81 struct fs_platform_info *fpi;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index cc288d8f6a53..38268d7335a8 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -956,10 +956,12 @@ static int gfar_enet_open(struct net_device *dev)
956 } 956 }
957 957
958 err = startup_gfar(dev); 958 err = startup_gfar(dev);
959 if (err) 959 if (err) {
960#ifdef CONFIG_GFAR_NAPI 960#ifdef CONFIG_GFAR_NAPI
961 napi_disable(&priv->napi); 961 napi_disable(&priv->napi);
962#endif 962#endif
963 return err;
964 }
963 965
964 netif_start_queue(dev); 966 netif_start_queue(dev);
965 967
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index c16cc8b946a9..46cd7735e6fe 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -749,7 +749,6 @@ struct gfar_private {
749 uint32_t msg_enable; 749 uint32_t msg_enable;
750 750
751 /* Network Statistics */ 751 /* Network Statistics */
752 struct net_device_stats stats;
753 struct gfar_extra_stats extra_stats; 752 struct gfar_extra_stats extra_stats;
754}; 753};
755 754
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index ad9e327c3b03..e0119f6a3319 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -3,7 +3,7 @@
3 * devices like TTY. It interfaces between a raw TTY and the 3 * devices like TTY. It interfaces between a raw TTY and the
4 * kernel's AX.25 protocol layers. 4 * kernel's AX.25 protocol layers.
5 * 5 *
6 * Authors: Andreas Könsgen <ajk@iehk.rwth-aachen.de> 6 * Authors: Andreas Könsgen <ajk@iehk.rwth-aachen.de>
7 * Ralf Baechle DL5RB <ralf@linux-mips.org> 7 * Ralf Baechle DL5RB <ralf@linux-mips.org>
8 * 8 *
9 * Quite a lot of stuff "stolen" by Joerg Reuter from slip.c, written by 9 * Quite a lot of stuff "stolen" by Joerg Reuter from slip.c, written by
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig
index 36d2c7d4f4d0..62d5d5cfd6a6 100644
--- a/drivers/net/hamradio/Kconfig
+++ b/drivers/net/hamradio/Kconfig
@@ -64,7 +64,7 @@ config DMASCC
64 dmascc. If you don't pass any parameter to the driver, all 64 dmascc. If you don't pass any parameter to the driver, all
65 possible I/O addresses are probed. This could irritate other devices 65 possible I/O addresses are probed. This could irritate other devices
66 that are currently not in use. You may specify the list of addresses 66 that are currently not in use. You may specify the list of addresses
67 to be probed by "dmascc=addr1,addr2,..." (when compiled into the 67 to be probed by "dmascc.io=addr1,addr2,..." (when compiled into the
68 kernel image) or "io=addr1,addr2,..." (when loaded as a module). The 68 kernel image) or "io=addr1,addr2,..." (when loaded as a module). The
69 network interfaces will be called dmascc0 and dmascc1 for the board 69 network interfaces will be called dmascc0 and dmascc1 for the board
70 detected first, dmascc2 and dmascc3 for the second one, and so on. 70 detected first, dmascc2 and dmascc3 for the second one, and so on.
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index bc02e4694804..11b83dae00ac 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -21,6 +21,7 @@
21 21
22 22
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/bitops.h>
24#include <linux/delay.h> 25#include <linux/delay.h>
25#include <linux/errno.h> 26#include <linux/errno.h>
26#include <linux/if_arp.h> 27#include <linux/if_arp.h>
@@ -35,7 +36,6 @@
35#include <linux/sockios.h> 36#include <linux/sockios.h>
36#include <linux/workqueue.h> 37#include <linux/workqueue.h>
37#include <asm/atomic.h> 38#include <asm/atomic.h>
38#include <asm/bitops.h>
39#include <asm/dma.h> 39#include <asm/dma.h>
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/irq.h> 41#include <asm/irq.h>
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c
index a680eb05ba60..9a88f71db004 100644
--- a/drivers/net/ibm_newemac/mal.c
+++ b/drivers/net/ibm_newemac/mal.c
@@ -322,7 +322,7 @@ void mal_poll_disable(struct mal_instance *mal, struct mal_commac *commac)
322 msleep(1); 322 msleep(1);
323 323
324 /* Synchronize with the MAL NAPI poller */ 324 /* Synchronize with the MAL NAPI poller */
325 __napi_synchronize(&mal->napi); 325 napi_synchronize(&mal->napi);
326} 326}
327 327
328void mal_poll_enable(struct mal_instance *mal, struct mal_commac *commac) 328void mal_poll_enable(struct mal_instance *mal, struct mal_commac *commac)
diff --git a/drivers/net/irda/actisys-sir.c b/drivers/net/irda/actisys-sir.c
index ccf6ec548a64..736d2473b7e1 100644
--- a/drivers/net/irda/actisys-sir.c
+++ b/drivers/net/irda/actisys-sir.c
@@ -21,7 +21,7 @@
21 * published by the Free Software Foundation; either version 2 of 21 * published by the Free Software Foundation; either version 2 of
22 * the License, or (at your option) any later version. 22 * the License, or (at your option) any later version.
23 * 23 *
24 * Neither Dag Brattli nor University of Tromsø admit liability nor 24 * Neither Dag Brattli nor University of Tromsø admit liability nor
25 * provide warranty for any of this software. This material is 25 * provide warranty for any of this software. This material is
26 * provided "AS-IS" and at no charge. 26 * provided "AS-IS" and at no charge.
27 * 27 *
diff --git a/drivers/net/irda/actisys.c b/drivers/net/irda/actisys.c
index b2e31f4a384c..ae0b80a5680c 100644
--- a/drivers/net/irda/actisys.c
+++ b/drivers/net/irda/actisys.c
@@ -19,7 +19,7 @@
19 * published by the Free Software Foundation; either version 2 of 19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version. 20 * the License, or (at your option) any later version.
21 * 21 *
22 * Neither Dag Brattli nor University of Tromsø admit liability nor 22 * Neither Dag Brattli nor University of Tromsø admit liability nor
23 * provide warranty for any of this software. This material is 23 * provide warranty for any of this software. This material is
24 * provided "AS-IS" and at no charge. 24 * provided "AS-IS" and at no charge.
25 * 25 *
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
index a82d8f98383d..1257e1a7e819 100644
--- a/drivers/net/irda/donauboe.c
+++ b/drivers/net/irda/donauboe.c
@@ -595,7 +595,7 @@ toshoboe_startchip (struct toshoboe_cb *self)
595 OUTB ((physaddr >> 18) & 0xff, OBOE_RING_BASE1); 595 OUTB ((physaddr >> 18) & 0xff, OBOE_RING_BASE1);
596 OUTB ((physaddr >> 26) & 0x3f, OBOE_RING_BASE2); 596 OUTB ((physaddr >> 26) & 0x3f, OBOE_RING_BASE2);
597 597
598 /*Enable DMA controler in byte mode and RX */ 598 /*Enable DMA controller in byte mode and RX */
599 OUTB (CONFIG0H_DMA_ON, OBOE_CONFIG0H); 599 OUTB (CONFIG0H_DMA_ON, OBOE_CONFIG0H);
600 600
601 /* Start up the clocks */ 601 /* Start up the clocks */
diff --git a/drivers/net/irda/girbil-sir.c b/drivers/net/irda/girbil-sir.c
index 0d2fe87fb9b7..738531b16bd3 100644
--- a/drivers/net/irda/girbil-sir.c
+++ b/drivers/net/irda/girbil-sir.c
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/drivers/net/irda/girbil.c b/drivers/net/irda/girbil.c
index 248aeb0c726c..1f57391a618b 100644
--- a/drivers/net/irda/girbil.c
+++ b/drivers/net/irda/girbil.c
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/drivers/net/irda/irport.h b/drivers/net/irda/irport.h
index 3f46b84c6c85..66fc2433e97d 100644
--- a/drivers/net/irda/irport.h
+++ b/drivers/net/irda/irport.h
@@ -17,7 +17,7 @@
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsø admit liability nor 20 * Neither Dag Brattli nor University of Tromsø admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 6f5f697ec9f8..2c6f7be36e8a 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -20,7 +20,7 @@
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsø admit liability nor 23 * Neither Dag Brattli nor University of Tromsø admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
diff --git a/drivers/net/irda/nsc-ircc.c b/drivers/net/irda/nsc-ircc.c
index 12b9378c587f..a873d2b315ca 100644
--- a/drivers/net/irda/nsc-ircc.c
+++ b/drivers/net/irda/nsc-ircc.c
@@ -20,7 +20,7 @@
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsø admit liability nor 23 * Neither Dag Brattli nor University of Tromsø admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
diff --git a/drivers/net/irda/nsc-ircc.h b/drivers/net/irda/nsc-ircc.h
index dacf671abcd6..bbdc97ff83ca 100644
--- a/drivers/net/irda/nsc-ircc.h
+++ b/drivers/net/irda/nsc-ircc.h
@@ -19,7 +19,7 @@
19 * published by the Free Software Foundation; either version 2 of 19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version. 20 * the License, or (at your option) any later version.
21 * 21 *
22 * Neither Dag Brattli nor University of Tromsø admit liability nor 22 * Neither Dag Brattli nor University of Tromsø admit liability nor
23 * provide warranty for any of this software. This material is 23 * provide warranty for any of this software. This material is
24 * provided "AS-IS" and at no charge. 24 * provided "AS-IS" and at no charge.
25 * 25 *
diff --git a/drivers/net/irda/tekram-sir.c b/drivers/net/irda/tekram-sir.c
index 0dd6bc7af3f2..d1ce5ae6a172 100644
--- a/drivers/net/irda/tekram-sir.c
+++ b/drivers/net/irda/tekram-sir.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/drivers/net/irda/tekram.c b/drivers/net/irda/tekram.c
index 8f6258221cb0..9bfd2441adbf 100644
--- a/drivers/net/irda/tekram.c
+++ b/drivers/net/irda/tekram.c
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/drivers/net/irda/w83977af_ir.h b/drivers/net/irda/w83977af_ir.h
index 0b7661deafee..87c3975baf62 100644
--- a/drivers/net/irda/w83977af_ir.h
+++ b/drivers/net/irda/w83977af_ir.h
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c
index 30854f094965..a19b5958cee9 100644
--- a/drivers/net/mac89x0.c
+++ b/drivers/net/mac89x0.c
@@ -99,9 +99,9 @@ static char *version =
99#include <linux/etherdevice.h> 99#include <linux/etherdevice.h>
100#include <linux/skbuff.h> 100#include <linux/skbuff.h>
101#include <linux/delay.h> 101#include <linux/delay.h>
102#include <linux/bitops.h>
102 103
103#include <asm/system.h> 104#include <asm/system.h>
104#include <asm/bitops.h>
105#include <asm/io.h> 105#include <asm/io.h>
106#include <asm/hwtest.h> 106#include <asm/hwtest.h>
107#include <asm/macints.h> 107#include <asm/macints.h>
diff --git a/drivers/net/meth.h b/drivers/net/meth.h
index ea3b8fc86d1e..a78dc1ca8c29 100644
--- a/drivers/net/meth.h
+++ b/drivers/net/meth.h
@@ -28,9 +28,6 @@
28#define RX_BUFFER_OFFSET (sizeof(rx_status_vector)+2) /* staus vector + 2 bytes of padding */ 28#define RX_BUFFER_OFFSET (sizeof(rx_status_vector)+2) /* staus vector + 2 bytes of padding */
29#define RX_BUCKET_SIZE 256 29#define RX_BUCKET_SIZE 256
30 30
31#undef BIT
32#define BIT(x) (1UL << (x))
33
34/* For more detailed explanations of what each field menas, 31/* For more detailed explanations of what each field menas,
35 see Nick's great comments to #defines below (or docs, if 32 see Nick's great comments to #defines below (or docs, if
36 you are lucky enough toget hold of them :)*/ 33 you are lucky enough toget hold of them :)*/
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 64c8151f2004..366e62a2b1e5 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -3058,7 +3058,8 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3058 if (status != 0) { 3058 if (status != 0) {
3059 dac_enabled = 0; 3059 dac_enabled = 0;
3060 dev_err(&pdev->dev, 3060 dev_err(&pdev->dev,
3061 "64-bit pci address mask was refused, trying 32-bit"); 3061 "64-bit pci address mask was refused, "
3062 "trying 32-bit\n");
3062 status = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 3063 status = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
3063 } 3064 }
3064 if (status != 0) { 3065 if (status != 0) {
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 50e1ec67ef9c..953117152bbd 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -996,7 +996,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
996 a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that 996 a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that
997 made udelay() unreliable. 997 made udelay() unreliable.
998 The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is 998 The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is
999 depricated. 999 deprecated.
1000*/ 1000*/
1001#define eeprom_delay(ee_addr) readl(ee_addr) 1001#define eeprom_delay(ee_addr) readl(ee_addr)
1002 1002
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 2a1d6d7ec351..601051c584e8 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -53,9 +53,6 @@ static char netxen_nic_driver_string[] = "NetXen Network Driver version "
53#define NETXEN_ADAPTER_UP_MAGIC 777 53#define NETXEN_ADAPTER_UP_MAGIC 777
54#define NETXEN_NIC_PEG_TUNE 0 54#define NETXEN_NIC_PEG_TUNE 0
55 55
56#define DMA_32BIT_MASK 0x00000000ffffffffULL
57#define DMA_35BIT_MASK 0x00000007ffffffffULL
58
59/* Local functions to NetXen NIC driver */ 56/* Local functions to NetXen NIC driver */
60static int __devinit netxen_nic_probe(struct pci_dev *pdev, 57static int __devinit netxen_nic_probe(struct pci_dev *pdev,
61 const struct pci_device_id *ent); 58 const struct pci_device_id *ent);
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 5f994b5beda1..ff92aca0a7b3 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -282,7 +282,6 @@ struct pcnet32_private {
282 282
283 struct net_device *dev; 283 struct net_device *dev;
284 struct napi_struct napi; 284 struct napi_struct napi;
285 struct net_device_stats stats;
286 char tx_full; 285 char tx_full;
287 char phycount; /* number of phys found */ 286 char phycount; /* number of phys found */
288 int options; 287 int options;
@@ -442,7 +441,9 @@ static struct pcnet32_access pcnet32_dwio = {
442 441
443static void pcnet32_netif_stop(struct net_device *dev) 442static void pcnet32_netif_stop(struct net_device *dev)
444{ 443{
444#ifdef CONFIG_PCNET32_NAPI
445 struct pcnet32_private *lp = netdev_priv(dev); 445 struct pcnet32_private *lp = netdev_priv(dev);
446#endif
446 dev->trans_start = jiffies; 447 dev->trans_start = jiffies;
447#ifdef CONFIG_PCNET32_NAPI 448#ifdef CONFIG_PCNET32_NAPI
448 napi_disable(&lp->napi); 449 napi_disable(&lp->napi);
@@ -452,7 +453,9 @@ static void pcnet32_netif_stop(struct net_device *dev)
452 453
453static void pcnet32_netif_start(struct net_device *dev) 454static void pcnet32_netif_start(struct net_device *dev)
454{ 455{
456#ifdef CONFIG_PCNET32_NAPI
455 struct pcnet32_private *lp = netdev_priv(dev); 457 struct pcnet32_private *lp = netdev_priv(dev);
458#endif
456 netif_wake_queue(dev); 459 netif_wake_queue(dev);
457#ifdef CONFIG_PCNET32_NAPI 460#ifdef CONFIG_PCNET32_NAPI
458 napi_enable(&lp->napi); 461 napi_enable(&lp->napi);
@@ -1178,15 +1181,15 @@ static void pcnet32_rx_entry(struct net_device *dev,
1178 * buffers, with only the last correctly noting the error. 1181 * buffers, with only the last correctly noting the error.
1179 */ 1182 */
1180 if (status & 0x01) /* Only count a general error at the */ 1183 if (status & 0x01) /* Only count a general error at the */
1181 lp->stats.rx_errors++; /* end of a packet. */ 1184 dev->stats.rx_errors++; /* end of a packet. */
1182 if (status & 0x20) 1185 if (status & 0x20)
1183 lp->stats.rx_frame_errors++; 1186 dev->stats.rx_frame_errors++;
1184 if (status & 0x10) 1187 if (status & 0x10)
1185 lp->stats.rx_over_errors++; 1188 dev->stats.rx_over_errors++;
1186 if (status & 0x08) 1189 if (status & 0x08)
1187 lp->stats.rx_crc_errors++; 1190 dev->stats.rx_crc_errors++;
1188 if (status & 0x04) 1191 if (status & 0x04)
1189 lp->stats.rx_fifo_errors++; 1192 dev->stats.rx_fifo_errors++;
1190 return; 1193 return;
1191 } 1194 }
1192 1195
@@ -1197,13 +1200,13 @@ static void pcnet32_rx_entry(struct net_device *dev,
1197 if (netif_msg_drv(lp)) 1200 if (netif_msg_drv(lp))
1198 printk(KERN_ERR "%s: Impossible packet size %d!\n", 1201 printk(KERN_ERR "%s: Impossible packet size %d!\n",
1199 dev->name, pkt_len); 1202 dev->name, pkt_len);
1200 lp->stats.rx_errors++; 1203 dev->stats.rx_errors++;
1201 return; 1204 return;
1202 } 1205 }
1203 if (pkt_len < 60) { 1206 if (pkt_len < 60) {
1204 if (netif_msg_rx_err(lp)) 1207 if (netif_msg_rx_err(lp))
1205 printk(KERN_ERR "%s: Runt packet!\n", dev->name); 1208 printk(KERN_ERR "%s: Runt packet!\n", dev->name);
1206 lp->stats.rx_errors++; 1209 dev->stats.rx_errors++;
1207 return; 1210 return;
1208 } 1211 }
1209 1212
@@ -1237,7 +1240,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
1237 printk(KERN_ERR 1240 printk(KERN_ERR
1238 "%s: Memory squeeze, dropping packet.\n", 1241 "%s: Memory squeeze, dropping packet.\n",
1239 dev->name); 1242 dev->name);
1240 lp->stats.rx_dropped++; 1243 dev->stats.rx_dropped++;
1241 return; 1244 return;
1242 } 1245 }
1243 skb->dev = dev; 1246 skb->dev = dev;
@@ -1256,7 +1259,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
1256 pkt_len, 1259 pkt_len,
1257 PCI_DMA_FROMDEVICE); 1260 PCI_DMA_FROMDEVICE);
1258 } 1261 }
1259 lp->stats.rx_bytes += skb->len; 1262 dev->stats.rx_bytes += skb->len;
1260 skb->protocol = eth_type_trans(skb, dev); 1263 skb->protocol = eth_type_trans(skb, dev);
1261#ifdef CONFIG_PCNET32_NAPI 1264#ifdef CONFIG_PCNET32_NAPI
1262 netif_receive_skb(skb); 1265 netif_receive_skb(skb);
@@ -1264,7 +1267,7 @@ static void pcnet32_rx_entry(struct net_device *dev,
1264 netif_rx(skb); 1267 netif_rx(skb);
1265#endif 1268#endif
1266 dev->last_rx = jiffies; 1269 dev->last_rx = jiffies;
1267 lp->stats.rx_packets++; 1270 dev->stats.rx_packets++;
1268 return; 1271 return;
1269} 1272}
1270 1273
@@ -1312,21 +1315,21 @@ static int pcnet32_tx(struct net_device *dev)
1312 if (status & 0x4000) { 1315 if (status & 0x4000) {
1313 /* There was a major error, log it. */ 1316 /* There was a major error, log it. */
1314 int err_status = le32_to_cpu(lp->tx_ring[entry].misc); 1317 int err_status = le32_to_cpu(lp->tx_ring[entry].misc);
1315 lp->stats.tx_errors++; 1318 dev->stats.tx_errors++;
1316 if (netif_msg_tx_err(lp)) 1319 if (netif_msg_tx_err(lp))
1317 printk(KERN_ERR 1320 printk(KERN_ERR
1318 "%s: Tx error status=%04x err_status=%08x\n", 1321 "%s: Tx error status=%04x err_status=%08x\n",
1319 dev->name, status, 1322 dev->name, status,
1320 err_status); 1323 err_status);
1321 if (err_status & 0x04000000) 1324 if (err_status & 0x04000000)
1322 lp->stats.tx_aborted_errors++; 1325 dev->stats.tx_aborted_errors++;
1323 if (err_status & 0x08000000) 1326 if (err_status & 0x08000000)
1324 lp->stats.tx_carrier_errors++; 1327 dev->stats.tx_carrier_errors++;
1325 if (err_status & 0x10000000) 1328 if (err_status & 0x10000000)
1326 lp->stats.tx_window_errors++; 1329 dev->stats.tx_window_errors++;
1327#ifndef DO_DXSUFLO 1330#ifndef DO_DXSUFLO
1328 if (err_status & 0x40000000) { 1331 if (err_status & 0x40000000) {
1329 lp->stats.tx_fifo_errors++; 1332 dev->stats.tx_fifo_errors++;
1330 /* Ackk! On FIFO errors the Tx unit is turned off! */ 1333 /* Ackk! On FIFO errors the Tx unit is turned off! */
1331 /* Remove this verbosity later! */ 1334 /* Remove this verbosity later! */
1332 if (netif_msg_tx_err(lp)) 1335 if (netif_msg_tx_err(lp))
@@ -1337,7 +1340,7 @@ static int pcnet32_tx(struct net_device *dev)
1337 } 1340 }
1338#else 1341#else
1339 if (err_status & 0x40000000) { 1342 if (err_status & 0x40000000) {
1340 lp->stats.tx_fifo_errors++; 1343 dev->stats.tx_fifo_errors++;
1341 if (!lp->dxsuflo) { /* If controller doesn't recover ... */ 1344 if (!lp->dxsuflo) { /* If controller doesn't recover ... */
1342 /* Ackk! On FIFO errors the Tx unit is turned off! */ 1345 /* Ackk! On FIFO errors the Tx unit is turned off! */
1343 /* Remove this verbosity later! */ 1346 /* Remove this verbosity later! */
@@ -1351,8 +1354,8 @@ static int pcnet32_tx(struct net_device *dev)
1351#endif 1354#endif
1352 } else { 1355 } else {
1353 if (status & 0x1800) 1356 if (status & 0x1800)
1354 lp->stats.collisions++; 1357 dev->stats.collisions++;
1355 lp->stats.tx_packets++; 1358 dev->stats.tx_packets++;
1356 } 1359 }
1357 1360
1358 /* We must free the original skb */ 1361 /* We must free the original skb */
@@ -1849,6 +1852,9 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
1849 lp->mii_if.mdio_read = mdio_read; 1852 lp->mii_if.mdio_read = mdio_read;
1850 lp->mii_if.mdio_write = mdio_write; 1853 lp->mii_if.mdio_write = mdio_write;
1851 1854
1855 /* napi.weight is used in both the napi and non-napi cases */
1856 lp->napi.weight = lp->rx_ring_size / 2;
1857
1852#ifdef CONFIG_PCNET32_NAPI 1858#ifdef CONFIG_PCNET32_NAPI
1853 netif_napi_add(dev, &lp->napi, pcnet32_poll, lp->rx_ring_size / 2); 1859 netif_napi_add(dev, &lp->napi, pcnet32_poll, lp->rx_ring_size / 2);
1854#endif 1860#endif
@@ -2471,7 +2477,7 @@ static void pcnet32_tx_timeout(struct net_device *dev)
2471 "%s: transmit timed out, status %4.4x, resetting.\n", 2477 "%s: transmit timed out, status %4.4x, resetting.\n",
2472 dev->name, lp->a.read_csr(ioaddr, CSR0)); 2478 dev->name, lp->a.read_csr(ioaddr, CSR0));
2473 lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); 2479 lp->a.write_csr(ioaddr, CSR0, CSR0_STOP);
2474 lp->stats.tx_errors++; 2480 dev->stats.tx_errors++;
2475 if (netif_msg_tx_err(lp)) { 2481 if (netif_msg_tx_err(lp)) {
2476 int i; 2482 int i;
2477 printk(KERN_DEBUG 2483 printk(KERN_DEBUG
@@ -2541,7 +2547,7 @@ static int pcnet32_start_xmit(struct sk_buff *skb, struct net_device *dev)
2541 lp->tx_ring[entry].status = cpu_to_le16(status); 2547 lp->tx_ring[entry].status = cpu_to_le16(status);
2542 2548
2543 lp->cur_tx++; 2549 lp->cur_tx++;
2544 lp->stats.tx_bytes += skb->len; 2550 dev->stats.tx_bytes += skb->len;
2545 2551
2546 /* Trigger an immediate send poll. */ 2552 /* Trigger an immediate send poll. */
2547 lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL); 2553 lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL);
@@ -2586,7 +2592,7 @@ pcnet32_interrupt(int irq, void *dev_id)
2586 2592
2587 /* Log misc errors. */ 2593 /* Log misc errors. */
2588 if (csr0 & 0x4000) 2594 if (csr0 & 0x4000)
2589 lp->stats.tx_errors++; /* Tx babble. */ 2595 dev->stats.tx_errors++; /* Tx babble. */
2590 if (csr0 & 0x1000) { 2596 if (csr0 & 0x1000) {
2591 /* 2597 /*
2592 * This happens when our receive ring is full. This 2598 * This happens when our receive ring is full. This
@@ -2599,7 +2605,7 @@ pcnet32_interrupt(int irq, void *dev_id)
2599 * don't get a rx interrupt, but a missed frame 2605 * don't get a rx interrupt, but a missed frame
2600 * interrupt sooner or later. 2606 * interrupt sooner or later.
2601 */ 2607 */
2602 lp->stats.rx_errors++; /* Missed a Rx frame. */ 2608 dev->stats.rx_errors++; /* Missed a Rx frame. */
2603 } 2609 }
2604 if (csr0 & 0x0800) { 2610 if (csr0 & 0x0800) {
2605 if (netif_msg_drv(lp)) 2611 if (netif_msg_drv(lp))
@@ -2661,7 +2667,7 @@ static int pcnet32_close(struct net_device *dev)
2661 2667
2662 spin_lock_irqsave(&lp->lock, flags); 2668 spin_lock_irqsave(&lp->lock, flags);
2663 2669
2664 lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); 2670 dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
2665 2671
2666 if (netif_msg_ifdown(lp)) 2672 if (netif_msg_ifdown(lp))
2667 printk(KERN_DEBUG 2673 printk(KERN_DEBUG
@@ -2698,10 +2704,10 @@ static struct net_device_stats *pcnet32_get_stats(struct net_device *dev)
2698 unsigned long flags; 2704 unsigned long flags;
2699 2705
2700 spin_lock_irqsave(&lp->lock, flags); 2706 spin_lock_irqsave(&lp->lock, flags);
2701 lp->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112); 2707 dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
2702 spin_unlock_irqrestore(&lp->lock, flags); 2708 spin_unlock_irqrestore(&lp->lock, flags);
2703 2709
2704 return &lp->stats; 2710 return &dev->stats;
2705} 2711}
2706 2712
2707/* taken from the sunlance driver, which it took from the depca driver */ 2713/* taken from the sunlance driver, which it took from the depca driver */
diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c
index 8cd243d92af3..2747b1f89ffe 100644
--- a/drivers/net/phy/mdio-bitbang.c
+++ b/drivers/net/phy/mdio-bitbang.c
@@ -185,3 +185,5 @@ void free_mdio_bitbang(struct mii_bus *bus)
185 module_put(ctrl->ops->owner); 185 module_put(ctrl->ops->owner);
186 kfree(bus); 186 kfree(bus);
187} 187}
188
189MODULE_LICENSE("GPL");
diff --git a/drivers/net/s2io-regs.h b/drivers/net/s2io-regs.h
index aef66e2d98d2..01f08d726ace 100644
--- a/drivers/net/s2io-regs.h
+++ b/drivers/net/s2io-regs.h
@@ -20,17 +20,17 @@ struct XENA_dev_config {
20 20
21/* General Control-Status Registers */ 21/* General Control-Status Registers */
22 u64 general_int_status; 22 u64 general_int_status;
23#define GEN_INTR_TXPIC BIT(0) 23#define GEN_INTR_TXPIC s2BIT(0)
24#define GEN_INTR_TXDMA BIT(1) 24#define GEN_INTR_TXDMA s2BIT(1)
25#define GEN_INTR_TXMAC BIT(2) 25#define GEN_INTR_TXMAC s2BIT(2)
26#define GEN_INTR_TXXGXS BIT(3) 26#define GEN_INTR_TXXGXS s2BIT(3)
27#define GEN_INTR_TXTRAFFIC BIT(8) 27#define GEN_INTR_TXTRAFFIC s2BIT(8)
28#define GEN_INTR_RXPIC BIT(32) 28#define GEN_INTR_RXPIC s2BIT(32)
29#define GEN_INTR_RXDMA BIT(33) 29#define GEN_INTR_RXDMA s2BIT(33)
30#define GEN_INTR_RXMAC BIT(34) 30#define GEN_INTR_RXMAC s2BIT(34)
31#define GEN_INTR_MC BIT(35) 31#define GEN_INTR_MC s2BIT(35)
32#define GEN_INTR_RXXGXS BIT(36) 32#define GEN_INTR_RXXGXS s2BIT(36)
33#define GEN_INTR_RXTRAFFIC BIT(40) 33#define GEN_INTR_RXTRAFFIC s2BIT(40)
34#define GEN_ERROR_INTR GEN_INTR_TXPIC | GEN_INTR_RXPIC | \ 34#define GEN_ERROR_INTR GEN_INTR_TXPIC | GEN_INTR_RXPIC | \
35 GEN_INTR_TXDMA | GEN_INTR_RXDMA | \ 35 GEN_INTR_TXDMA | GEN_INTR_RXDMA | \
36 GEN_INTR_TXMAC | GEN_INTR_RXMAC | \ 36 GEN_INTR_TXMAC | GEN_INTR_RXMAC | \
@@ -54,36 +54,36 @@ struct XENA_dev_config {
54 54
55 55
56 u64 adapter_status; 56 u64 adapter_status;
57#define ADAPTER_STATUS_TDMA_READY BIT(0) 57#define ADAPTER_STATUS_TDMA_READY s2BIT(0)
58#define ADAPTER_STATUS_RDMA_READY BIT(1) 58#define ADAPTER_STATUS_RDMA_READY s2BIT(1)
59#define ADAPTER_STATUS_PFC_READY BIT(2) 59#define ADAPTER_STATUS_PFC_READY s2BIT(2)
60#define ADAPTER_STATUS_TMAC_BUF_EMPTY BIT(3) 60#define ADAPTER_STATUS_TMAC_BUF_EMPTY s2BIT(3)
61#define ADAPTER_STATUS_PIC_QUIESCENT BIT(5) 61#define ADAPTER_STATUS_PIC_QUIESCENT s2BIT(5)
62#define ADAPTER_STATUS_RMAC_REMOTE_FAULT BIT(6) 62#define ADAPTER_STATUS_RMAC_REMOTE_FAULT s2BIT(6)
63#define ADAPTER_STATUS_RMAC_LOCAL_FAULT BIT(7) 63#define ADAPTER_STATUS_RMAC_LOCAL_FAULT s2BIT(7)
64#define ADAPTER_STATUS_RMAC_PCC_IDLE vBIT(0xFF,8,8) 64#define ADAPTER_STATUS_RMAC_PCC_IDLE vBIT(0xFF,8,8)
65#define ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE vBIT(0x0F,8,8) 65#define ADAPTER_STATUS_RMAC_PCC_FOUR_IDLE vBIT(0x0F,8,8)
66#define ADAPTER_STATUS_RC_PRC_QUIESCENT vBIT(0xFF,16,8) 66#define ADAPTER_STATUS_RC_PRC_QUIESCENT vBIT(0xFF,16,8)
67#define ADAPTER_STATUS_MC_DRAM_READY BIT(24) 67#define ADAPTER_STATUS_MC_DRAM_READY s2BIT(24)
68#define ADAPTER_STATUS_MC_QUEUES_READY BIT(25) 68#define ADAPTER_STATUS_MC_QUEUES_READY s2BIT(25)
69#define ADAPTER_STATUS_M_PLL_LOCK BIT(30) 69#define ADAPTER_STATUS_M_PLL_LOCK s2BIT(30)
70#define ADAPTER_STATUS_P_PLL_LOCK BIT(31) 70#define ADAPTER_STATUS_P_PLL_LOCK s2BIT(31)
71 71
72 u64 adapter_control; 72 u64 adapter_control;
73#define ADAPTER_CNTL_EN BIT(7) 73#define ADAPTER_CNTL_EN s2BIT(7)
74#define ADAPTER_EOI_TX_ON BIT(15) 74#define ADAPTER_EOI_TX_ON s2BIT(15)
75#define ADAPTER_LED_ON BIT(23) 75#define ADAPTER_LED_ON s2BIT(23)
76#define ADAPTER_UDPI(val) vBIT(val,36,4) 76#define ADAPTER_UDPI(val) vBIT(val,36,4)
77#define ADAPTER_WAIT_INT BIT(48) 77#define ADAPTER_WAIT_INT s2BIT(48)
78#define ADAPTER_ECC_EN BIT(55) 78#define ADAPTER_ECC_EN s2BIT(55)
79 79
80 u64 serr_source; 80 u64 serr_source;
81#define SERR_SOURCE_PIC BIT(0) 81#define SERR_SOURCE_PIC s2BIT(0)
82#define SERR_SOURCE_TXDMA BIT(1) 82#define SERR_SOURCE_TXDMA s2BIT(1)
83#define SERR_SOURCE_RXDMA BIT(2) 83#define SERR_SOURCE_RXDMA s2BIT(2)
84#define SERR_SOURCE_MAC BIT(3) 84#define SERR_SOURCE_MAC s2BIT(3)
85#define SERR_SOURCE_MC BIT(4) 85#define SERR_SOURCE_MC s2BIT(4)
86#define SERR_SOURCE_XGXS BIT(5) 86#define SERR_SOURCE_XGXS s2BIT(5)
87#define SERR_SOURCE_ANY (SERR_SOURCE_PIC | \ 87#define SERR_SOURCE_ANY (SERR_SOURCE_PIC | \
88 SERR_SOURCE_TXDMA | \ 88 SERR_SOURCE_TXDMA | \
89 SERR_SOURCE_RXDMA | \ 89 SERR_SOURCE_RXDMA | \
@@ -101,41 +101,41 @@ struct XENA_dev_config {
101#define PCI_MODE_PCIX_M2_66 0x5 101#define PCI_MODE_PCIX_M2_66 0x5
102#define PCI_MODE_PCIX_M2_100 0x6 102#define PCI_MODE_PCIX_M2_100 0x6
103#define PCI_MODE_PCIX_M2_133 0x7 103#define PCI_MODE_PCIX_M2_133 0x7
104#define PCI_MODE_UNSUPPORTED BIT(0) 104#define PCI_MODE_UNSUPPORTED s2BIT(0)
105#define PCI_MODE_32_BITS BIT(8) 105#define PCI_MODE_32_BITS s2BIT(8)
106#define PCI_MODE_UNKNOWN_MODE BIT(9) 106#define PCI_MODE_UNKNOWN_MODE s2BIT(9)
107 107
108 u8 unused_0[0x800 - 0x128]; 108 u8 unused_0[0x800 - 0x128];
109 109
110/* PCI-X Controller registers */ 110/* PCI-X Controller registers */
111 u64 pic_int_status; 111 u64 pic_int_status;
112 u64 pic_int_mask; 112 u64 pic_int_mask;
113#define PIC_INT_TX BIT(0) 113#define PIC_INT_TX s2BIT(0)
114#define PIC_INT_FLSH BIT(1) 114#define PIC_INT_FLSH s2BIT(1)
115#define PIC_INT_MDIO BIT(2) 115#define PIC_INT_MDIO s2BIT(2)
116#define PIC_INT_IIC BIT(3) 116#define PIC_INT_IIC s2BIT(3)
117#define PIC_INT_GPIO BIT(4) 117#define PIC_INT_GPIO s2BIT(4)
118#define PIC_INT_RX BIT(32) 118#define PIC_INT_RX s2BIT(32)
119 119
120 u64 txpic_int_reg; 120 u64 txpic_int_reg;
121 u64 txpic_int_mask; 121 u64 txpic_int_mask;
122#define PCIX_INT_REG_ECC_SG_ERR BIT(0) 122#define PCIX_INT_REG_ECC_SG_ERR s2BIT(0)
123#define PCIX_INT_REG_ECC_DB_ERR BIT(1) 123#define PCIX_INT_REG_ECC_DB_ERR s2BIT(1)
124#define PCIX_INT_REG_FLASHR_R_FSM_ERR BIT(8) 124#define PCIX_INT_REG_FLASHR_R_FSM_ERR s2BIT(8)
125#define PCIX_INT_REG_FLASHR_W_FSM_ERR BIT(9) 125#define PCIX_INT_REG_FLASHR_W_FSM_ERR s2BIT(9)
126#define PCIX_INT_REG_INI_TX_FSM_SERR BIT(10) 126#define PCIX_INT_REG_INI_TX_FSM_SERR s2BIT(10)
127#define PCIX_INT_REG_INI_TXO_FSM_ERR BIT(11) 127#define PCIX_INT_REG_INI_TXO_FSM_ERR s2BIT(11)
128#define PCIX_INT_REG_TRT_FSM_SERR BIT(13) 128#define PCIX_INT_REG_TRT_FSM_SERR s2BIT(13)
129#define PCIX_INT_REG_SRT_FSM_SERR BIT(14) 129#define PCIX_INT_REG_SRT_FSM_SERR s2BIT(14)
130#define PCIX_INT_REG_PIFR_FSM_SERR BIT(15) 130#define PCIX_INT_REG_PIFR_FSM_SERR s2BIT(15)
131#define PCIX_INT_REG_WRC_TX_SEND_FSM_SERR BIT(21) 131#define PCIX_INT_REG_WRC_TX_SEND_FSM_SERR s2BIT(21)
132#define PCIX_INT_REG_RRC_TX_REQ_FSM_SERR BIT(23) 132#define PCIX_INT_REG_RRC_TX_REQ_FSM_SERR s2BIT(23)
133#define PCIX_INT_REG_INI_RX_FSM_SERR BIT(48) 133#define PCIX_INT_REG_INI_RX_FSM_SERR s2BIT(48)
134#define PCIX_INT_REG_RA_RX_FSM_SERR BIT(50) 134#define PCIX_INT_REG_RA_RX_FSM_SERR s2BIT(50)
135/* 135/*
136#define PCIX_INT_REG_WRC_RX_SEND_FSM_SERR BIT(52) 136#define PCIX_INT_REG_WRC_RX_SEND_FSM_SERR s2BIT(52)
137#define PCIX_INT_REG_RRC_RX_REQ_FSM_SERR BIT(54) 137#define PCIX_INT_REG_RRC_RX_REQ_FSM_SERR s2BIT(54)
138#define PCIX_INT_REG_RRC_RX_SPLIT_FSM_SERR BIT(58) 138#define PCIX_INT_REG_RRC_RX_SPLIT_FSM_SERR s2BIT(58)
139*/ 139*/
140 u64 txpic_alarms; 140 u64 txpic_alarms;
141 u64 rxpic_int_reg; 141 u64 rxpic_int_reg;
@@ -144,92 +144,92 @@ struct XENA_dev_config {
144 144
145 u64 flsh_int_reg; 145 u64 flsh_int_reg;
146 u64 flsh_int_mask; 146 u64 flsh_int_mask;
147#define PIC_FLSH_INT_REG_CYCLE_FSM_ERR BIT(63) 147#define PIC_FLSH_INT_REG_CYCLE_FSM_ERR s2BIT(63)
148#define PIC_FLSH_INT_REG_ERR BIT(62) 148#define PIC_FLSH_INT_REG_ERR s2BIT(62)
149 u64 flash_alarms; 149 u64 flash_alarms;
150 150
151 u64 mdio_int_reg; 151 u64 mdio_int_reg;
152 u64 mdio_int_mask; 152 u64 mdio_int_mask;
153#define MDIO_INT_REG_MDIO_BUS_ERR BIT(0) 153#define MDIO_INT_REG_MDIO_BUS_ERR s2BIT(0)
154#define MDIO_INT_REG_DTX_BUS_ERR BIT(8) 154#define MDIO_INT_REG_DTX_BUS_ERR s2BIT(8)
155#define MDIO_INT_REG_LASI BIT(39) 155#define MDIO_INT_REG_LASI s2BIT(39)
156 u64 mdio_alarms; 156 u64 mdio_alarms;
157 157
158 u64 iic_int_reg; 158 u64 iic_int_reg;
159 u64 iic_int_mask; 159 u64 iic_int_mask;
160#define IIC_INT_REG_BUS_FSM_ERR BIT(4) 160#define IIC_INT_REG_BUS_FSM_ERR s2BIT(4)
161#define IIC_INT_REG_BIT_FSM_ERR BIT(5) 161#define IIC_INT_REG_BIT_FSM_ERR s2BIT(5)
162#define IIC_INT_REG_CYCLE_FSM_ERR BIT(6) 162#define IIC_INT_REG_CYCLE_FSM_ERR s2BIT(6)
163#define IIC_INT_REG_REQ_FSM_ERR BIT(7) 163#define IIC_INT_REG_REQ_FSM_ERR s2BIT(7)
164#define IIC_INT_REG_ACK_ERR BIT(8) 164#define IIC_INT_REG_ACK_ERR s2BIT(8)
165 u64 iic_alarms; 165 u64 iic_alarms;
166 166
167 u8 unused4[0x08]; 167 u8 unused4[0x08];
168 168
169 u64 gpio_int_reg; 169 u64 gpio_int_reg;
170#define GPIO_INT_REG_DP_ERR_INT BIT(0) 170#define GPIO_INT_REG_DP_ERR_INT s2BIT(0)
171#define GPIO_INT_REG_LINK_DOWN BIT(1) 171#define GPIO_INT_REG_LINK_DOWN s2BIT(1)
172#define GPIO_INT_REG_LINK_UP BIT(2) 172#define GPIO_INT_REG_LINK_UP s2BIT(2)
173 u64 gpio_int_mask; 173 u64 gpio_int_mask;
174#define GPIO_INT_MASK_LINK_DOWN BIT(1) 174#define GPIO_INT_MASK_LINK_DOWN s2BIT(1)
175#define GPIO_INT_MASK_LINK_UP BIT(2) 175#define GPIO_INT_MASK_LINK_UP s2BIT(2)
176 u64 gpio_alarms; 176 u64 gpio_alarms;
177 177
178 u8 unused5[0x38]; 178 u8 unused5[0x38];
179 179
180 u64 tx_traffic_int; 180 u64 tx_traffic_int;
181#define TX_TRAFFIC_INT_n(n) BIT(n) 181#define TX_TRAFFIC_INT_n(n) s2BIT(n)
182 u64 tx_traffic_mask; 182 u64 tx_traffic_mask;
183 183
184 u64 rx_traffic_int; 184 u64 rx_traffic_int;
185#define RX_TRAFFIC_INT_n(n) BIT(n) 185#define RX_TRAFFIC_INT_n(n) s2BIT(n)
186 u64 rx_traffic_mask; 186 u64 rx_traffic_mask;
187 187
188/* PIC Control registers */ 188/* PIC Control registers */
189 u64 pic_control; 189 u64 pic_control;
190#define PIC_CNTL_RX_ALARM_MAP_1 BIT(0) 190#define PIC_CNTL_RX_ALARM_MAP_1 s2BIT(0)
191#define PIC_CNTL_SHARED_SPLITS(n) vBIT(n,11,5) 191#define PIC_CNTL_SHARED_SPLITS(n) vBIT(n,11,5)
192 192
193 u64 swapper_ctrl; 193 u64 swapper_ctrl;
194#define SWAPPER_CTRL_PIF_R_FE BIT(0) 194#define SWAPPER_CTRL_PIF_R_FE s2BIT(0)
195#define SWAPPER_CTRL_PIF_R_SE BIT(1) 195#define SWAPPER_CTRL_PIF_R_SE s2BIT(1)
196#define SWAPPER_CTRL_PIF_W_FE BIT(8) 196#define SWAPPER_CTRL_PIF_W_FE s2BIT(8)
197#define SWAPPER_CTRL_PIF_W_SE BIT(9) 197#define SWAPPER_CTRL_PIF_W_SE s2BIT(9)
198#define SWAPPER_CTRL_TXP_FE BIT(16) 198#define SWAPPER_CTRL_TXP_FE s2BIT(16)
199#define SWAPPER_CTRL_TXP_SE BIT(17) 199#define SWAPPER_CTRL_TXP_SE s2BIT(17)
200#define SWAPPER_CTRL_TXD_R_FE BIT(18) 200#define SWAPPER_CTRL_TXD_R_FE s2BIT(18)
201#define SWAPPER_CTRL_TXD_R_SE BIT(19) 201#define SWAPPER_CTRL_TXD_R_SE s2BIT(19)
202#define SWAPPER_CTRL_TXD_W_FE BIT(20) 202#define SWAPPER_CTRL_TXD_W_FE s2BIT(20)
203#define SWAPPER_CTRL_TXD_W_SE BIT(21) 203#define SWAPPER_CTRL_TXD_W_SE s2BIT(21)
204#define SWAPPER_CTRL_TXF_R_FE BIT(22) 204#define SWAPPER_CTRL_TXF_R_FE s2BIT(22)
205#define SWAPPER_CTRL_TXF_R_SE BIT(23) 205#define SWAPPER_CTRL_TXF_R_SE s2BIT(23)
206#define SWAPPER_CTRL_RXD_R_FE BIT(32) 206#define SWAPPER_CTRL_RXD_R_FE s2BIT(32)
207#define SWAPPER_CTRL_RXD_R_SE BIT(33) 207#define SWAPPER_CTRL_RXD_R_SE s2BIT(33)
208#define SWAPPER_CTRL_RXD_W_FE BIT(34) 208#define SWAPPER_CTRL_RXD_W_FE s2BIT(34)
209#define SWAPPER_CTRL_RXD_W_SE BIT(35) 209#define SWAPPER_CTRL_RXD_W_SE s2BIT(35)
210#define SWAPPER_CTRL_RXF_W_FE BIT(36) 210#define SWAPPER_CTRL_RXF_W_FE s2BIT(36)
211#define SWAPPER_CTRL_RXF_W_SE BIT(37) 211#define SWAPPER_CTRL_RXF_W_SE s2BIT(37)
212#define SWAPPER_CTRL_XMSI_FE BIT(40) 212#define SWAPPER_CTRL_XMSI_FE s2BIT(40)
213#define SWAPPER_CTRL_XMSI_SE BIT(41) 213#define SWAPPER_CTRL_XMSI_SE s2BIT(41)
214#define SWAPPER_CTRL_STATS_FE BIT(48) 214#define SWAPPER_CTRL_STATS_FE s2BIT(48)
215#define SWAPPER_CTRL_STATS_SE BIT(49) 215#define SWAPPER_CTRL_STATS_SE s2BIT(49)
216 216
217 u64 pif_rd_swapper_fb; 217 u64 pif_rd_swapper_fb;
218#define IF_RD_SWAPPER_FB 0x0123456789ABCDEF 218#define IF_RD_SWAPPER_FB 0x0123456789ABCDEF
219 219
220 u64 scheduled_int_ctrl; 220 u64 scheduled_int_ctrl;
221#define SCHED_INT_CTRL_TIMER_EN BIT(0) 221#define SCHED_INT_CTRL_TIMER_EN s2BIT(0)
222#define SCHED_INT_CTRL_ONE_SHOT BIT(1) 222#define SCHED_INT_CTRL_ONE_SHOT s2BIT(1)
223#define SCHED_INT_CTRL_INT2MSI(val) vBIT(val,10,6) 223#define SCHED_INT_CTRL_INT2MSI(val) vBIT(val,10,6)
224#define SCHED_INT_PERIOD TBD 224#define SCHED_INT_PERIOD TBD
225 225
226 u64 txreqtimeout; 226 u64 txreqtimeout;
227#define TXREQTO_VAL(val) vBIT(val,0,32) 227#define TXREQTO_VAL(val) vBIT(val,0,32)
228#define TXREQTO_EN BIT(63) 228#define TXREQTO_EN s2BIT(63)
229 229
230 u64 statsreqtimeout; 230 u64 statsreqtimeout;
231#define STATREQTO_VAL(n) TBD 231#define STATREQTO_VAL(n) TBD
232#define STATREQTO_EN BIT(63) 232#define STATREQTO_EN s2BIT(63)
233 233
234 u64 read_retry_delay; 234 u64 read_retry_delay;
235 u64 read_retry_acceleration; 235 u64 read_retry_acceleration;
@@ -255,10 +255,10 @@ struct XENA_dev_config {
255 255
256 /* Automated statistics collection */ 256 /* Automated statistics collection */
257 u64 stat_cfg; 257 u64 stat_cfg;
258#define STAT_CFG_STAT_EN BIT(0) 258#define STAT_CFG_STAT_EN s2BIT(0)
259#define STAT_CFG_ONE_SHOT_EN BIT(1) 259#define STAT_CFG_ONE_SHOT_EN s2BIT(1)
260#define STAT_CFG_STAT_NS_EN BIT(8) 260#define STAT_CFG_STAT_NS_EN s2BIT(8)
261#define STAT_CFG_STAT_RO BIT(9) 261#define STAT_CFG_STAT_RO s2BIT(9)
262#define STAT_TRSF_PER(n) TBD 262#define STAT_TRSF_PER(n) TBD
263#define PER_SEC 0x208d5 263#define PER_SEC 0x208d5
264#define SET_UPDT_PERIOD(n) vBIT((PER_SEC*n),32,32) 264#define SET_UPDT_PERIOD(n) vBIT((PER_SEC*n),32,32)
@@ -290,18 +290,18 @@ struct XENA_dev_config {
290#define I2C_CONTROL_DEV_ID(id) vBIT(id,1,3) 290#define I2C_CONTROL_DEV_ID(id) vBIT(id,1,3)
291#define I2C_CONTROL_ADDR(addr) vBIT(addr,5,11) 291#define I2C_CONTROL_ADDR(addr) vBIT(addr,5,11)
292#define I2C_CONTROL_BYTE_CNT(cnt) vBIT(cnt,22,2) 292#define I2C_CONTROL_BYTE_CNT(cnt) vBIT(cnt,22,2)
293#define I2C_CONTROL_READ BIT(24) 293#define I2C_CONTROL_READ s2BIT(24)
294#define I2C_CONTROL_NACK BIT(25) 294#define I2C_CONTROL_NACK s2BIT(25)
295#define I2C_CONTROL_CNTL_START vBIT(0xE,28,4) 295#define I2C_CONTROL_CNTL_START vBIT(0xE,28,4)
296#define I2C_CONTROL_CNTL_END(val) (val & vBIT(0x1,28,4)) 296#define I2C_CONTROL_CNTL_END(val) (val & vBIT(0x1,28,4))
297#define I2C_CONTROL_GET_DATA(val) (u32)(val & 0xFFFFFFFF) 297#define I2C_CONTROL_GET_DATA(val) (u32)(val & 0xFFFFFFFF)
298#define I2C_CONTROL_SET_DATA(val) vBIT(val,32,32) 298#define I2C_CONTROL_SET_DATA(val) vBIT(val,32,32)
299 299
300 u64 gpio_control; 300 u64 gpio_control;
301#define GPIO_CTRL_GPIO_0 BIT(8) 301#define GPIO_CTRL_GPIO_0 s2BIT(8)
302 u64 misc_control; 302 u64 misc_control;
303#define FAULT_BEHAVIOUR BIT(0) 303#define FAULT_BEHAVIOUR s2BIT(0)
304#define EXT_REQ_EN BIT(1) 304#define EXT_REQ_EN s2BIT(1)
305#define MISC_LINK_STABILITY_PRD(val) vBIT(val,29,3) 305#define MISC_LINK_STABILITY_PRD(val) vBIT(val,29,3)
306 306
307 u8 unused7_1[0x230 - 0x208]; 307 u8 unused7_1[0x230 - 0x208];
@@ -317,29 +317,29 @@ struct XENA_dev_config {
317/* TxDMA registers */ 317/* TxDMA registers */
318 u64 txdma_int_status; 318 u64 txdma_int_status;
319 u64 txdma_int_mask; 319 u64 txdma_int_mask;
320#define TXDMA_PFC_INT BIT(0) 320#define TXDMA_PFC_INT s2BIT(0)
321#define TXDMA_TDA_INT BIT(1) 321#define TXDMA_TDA_INT s2BIT(1)
322#define TXDMA_PCC_INT BIT(2) 322#define TXDMA_PCC_INT s2BIT(2)
323#define TXDMA_TTI_INT BIT(3) 323#define TXDMA_TTI_INT s2BIT(3)
324#define TXDMA_LSO_INT BIT(4) 324#define TXDMA_LSO_INT s2BIT(4)
325#define TXDMA_TPA_INT BIT(5) 325#define TXDMA_TPA_INT s2BIT(5)
326#define TXDMA_SM_INT BIT(6) 326#define TXDMA_SM_INT s2BIT(6)
327 u64 pfc_err_reg; 327 u64 pfc_err_reg;
328#define PFC_ECC_SG_ERR BIT(7) 328#define PFC_ECC_SG_ERR s2BIT(7)
329#define PFC_ECC_DB_ERR BIT(15) 329#define PFC_ECC_DB_ERR s2BIT(15)
330#define PFC_SM_ERR_ALARM BIT(23) 330#define PFC_SM_ERR_ALARM s2BIT(23)
331#define PFC_MISC_0_ERR BIT(31) 331#define PFC_MISC_0_ERR s2BIT(31)
332#define PFC_MISC_1_ERR BIT(32) 332#define PFC_MISC_1_ERR s2BIT(32)
333#define PFC_PCIX_ERR BIT(39) 333#define PFC_PCIX_ERR s2BIT(39)
334 u64 pfc_err_mask; 334 u64 pfc_err_mask;
335 u64 pfc_err_alarm; 335 u64 pfc_err_alarm;
336 336
337 u64 tda_err_reg; 337 u64 tda_err_reg;
338#define TDA_Fn_ECC_SG_ERR vBIT(0xff,0,8) 338#define TDA_Fn_ECC_SG_ERR vBIT(0xff,0,8)
339#define TDA_Fn_ECC_DB_ERR vBIT(0xff,8,8) 339#define TDA_Fn_ECC_DB_ERR vBIT(0xff,8,8)
340#define TDA_SM0_ERR_ALARM BIT(22) 340#define TDA_SM0_ERR_ALARM s2BIT(22)
341#define TDA_SM1_ERR_ALARM BIT(23) 341#define TDA_SM1_ERR_ALARM s2BIT(23)
342#define TDA_PCIX_ERR BIT(39) 342#define TDA_PCIX_ERR s2BIT(39)
343 u64 tda_err_mask; 343 u64 tda_err_mask;
344 u64 tda_err_alarm; 344 u64 tda_err_alarm;
345 345
@@ -351,40 +351,40 @@ struct XENA_dev_config {
351#define PCC_SM_ERR_ALARM vBIT(0xff,32,8) 351#define PCC_SM_ERR_ALARM vBIT(0xff,32,8)
352#define PCC_WR_ERR_ALARM vBIT(0xff,40,8) 352#define PCC_WR_ERR_ALARM vBIT(0xff,40,8)
353#define PCC_N_SERR vBIT(0xff,48,8) 353#define PCC_N_SERR vBIT(0xff,48,8)
354#define PCC_6_COF_OV_ERR BIT(56) 354#define PCC_6_COF_OV_ERR s2BIT(56)
355#define PCC_7_COF_OV_ERR BIT(57) 355#define PCC_7_COF_OV_ERR s2BIT(57)
356#define PCC_6_LSO_OV_ERR BIT(58) 356#define PCC_6_LSO_OV_ERR s2BIT(58)
357#define PCC_7_LSO_OV_ERR BIT(59) 357#define PCC_7_LSO_OV_ERR s2BIT(59)
358#define PCC_ENABLE_FOUR vBIT(0x0F,0,8) 358#define PCC_ENABLE_FOUR vBIT(0x0F,0,8)
359 u64 pcc_err_mask; 359 u64 pcc_err_mask;
360 u64 pcc_err_alarm; 360 u64 pcc_err_alarm;
361 361
362 u64 tti_err_reg; 362 u64 tti_err_reg;
363#define TTI_ECC_SG_ERR BIT(7) 363#define TTI_ECC_SG_ERR s2BIT(7)
364#define TTI_ECC_DB_ERR BIT(15) 364#define TTI_ECC_DB_ERR s2BIT(15)
365#define TTI_SM_ERR_ALARM BIT(23) 365#define TTI_SM_ERR_ALARM s2BIT(23)
366 u64 tti_err_mask; 366 u64 tti_err_mask;
367 u64 tti_err_alarm; 367 u64 tti_err_alarm;
368 368
369 u64 lso_err_reg; 369 u64 lso_err_reg;
370#define LSO6_SEND_OFLOW BIT(12) 370#define LSO6_SEND_OFLOW s2BIT(12)
371#define LSO7_SEND_OFLOW BIT(13) 371#define LSO7_SEND_OFLOW s2BIT(13)
372#define LSO6_ABORT BIT(14) 372#define LSO6_ABORT s2BIT(14)
373#define LSO7_ABORT BIT(15) 373#define LSO7_ABORT s2BIT(15)
374#define LSO6_SM_ERR_ALARM BIT(22) 374#define LSO6_SM_ERR_ALARM s2BIT(22)
375#define LSO7_SM_ERR_ALARM BIT(23) 375#define LSO7_SM_ERR_ALARM s2BIT(23)
376 u64 lso_err_mask; 376 u64 lso_err_mask;
377 u64 lso_err_alarm; 377 u64 lso_err_alarm;
378 378
379 u64 tpa_err_reg; 379 u64 tpa_err_reg;
380#define TPA_TX_FRM_DROP BIT(7) 380#define TPA_TX_FRM_DROP s2BIT(7)
381#define TPA_SM_ERR_ALARM BIT(23) 381#define TPA_SM_ERR_ALARM s2BIT(23)
382 382
383 u64 tpa_err_mask; 383 u64 tpa_err_mask;
384 u64 tpa_err_alarm; 384 u64 tpa_err_alarm;
385 385
386 u64 sm_err_reg; 386 u64 sm_err_reg;
387#define SM_SM_ERR_ALARM BIT(15) 387#define SM_SM_ERR_ALARM s2BIT(15)
388 u64 sm_err_mask; 388 u64 sm_err_mask;
389 u64 sm_err_alarm; 389 u64 sm_err_alarm;
390 390
@@ -397,7 +397,7 @@ struct XENA_dev_config {
397#define X_MAX_FIFOS 8 397#define X_MAX_FIFOS 8
398#define X_FIFO_MAX_LEN 0x1FFF /*8191 */ 398#define X_FIFO_MAX_LEN 0x1FFF /*8191 */
399 u64 tx_fifo_partition_0; 399 u64 tx_fifo_partition_0;
400#define TX_FIFO_PARTITION_EN BIT(0) 400#define TX_FIFO_PARTITION_EN s2BIT(0)
401#define TX_FIFO_PARTITION_0_PRI(val) vBIT(val,5,3) 401#define TX_FIFO_PARTITION_0_PRI(val) vBIT(val,5,3)
402#define TX_FIFO_PARTITION_0_LEN(val) vBIT(val,19,13) 402#define TX_FIFO_PARTITION_0_LEN(val) vBIT(val,19,13)
403#define TX_FIFO_PARTITION_1_PRI(val) vBIT(val,37,3) 403#define TX_FIFO_PARTITION_1_PRI(val) vBIT(val,37,3)
@@ -437,16 +437,16 @@ struct XENA_dev_config {
437 u64 tx_w_round_robin_4; 437 u64 tx_w_round_robin_4;
438 438
439 u64 tti_command_mem; 439 u64 tti_command_mem;
440#define TTI_CMD_MEM_WE BIT(7) 440#define TTI_CMD_MEM_WE s2BIT(7)
441#define TTI_CMD_MEM_STROBE_NEW_CMD BIT(15) 441#define TTI_CMD_MEM_STROBE_NEW_CMD s2BIT(15)
442#define TTI_CMD_MEM_STROBE_BEING_EXECUTED BIT(15) 442#define TTI_CMD_MEM_STROBE_BEING_EXECUTED s2BIT(15)
443#define TTI_CMD_MEM_OFFSET(n) vBIT(n,26,6) 443#define TTI_CMD_MEM_OFFSET(n) vBIT(n,26,6)
444 444
445 u64 tti_data1_mem; 445 u64 tti_data1_mem;
446#define TTI_DATA1_MEM_TX_TIMER_VAL(n) vBIT(n,6,26) 446#define TTI_DATA1_MEM_TX_TIMER_VAL(n) vBIT(n,6,26)
447#define TTI_DATA1_MEM_TX_TIMER_AC_CI(n) vBIT(n,38,2) 447#define TTI_DATA1_MEM_TX_TIMER_AC_CI(n) vBIT(n,38,2)
448#define TTI_DATA1_MEM_TX_TIMER_AC_EN BIT(38) 448#define TTI_DATA1_MEM_TX_TIMER_AC_EN s2BIT(38)
449#define TTI_DATA1_MEM_TX_TIMER_CI_EN BIT(39) 449#define TTI_DATA1_MEM_TX_TIMER_CI_EN s2BIT(39)
450#define TTI_DATA1_MEM_TX_URNG_A(n) vBIT(n,41,7) 450#define TTI_DATA1_MEM_TX_URNG_A(n) vBIT(n,41,7)
451#define TTI_DATA1_MEM_TX_URNG_B(n) vBIT(n,49,7) 451#define TTI_DATA1_MEM_TX_URNG_B(n) vBIT(n,49,7)
452#define TTI_DATA1_MEM_TX_URNG_C(n) vBIT(n,57,7) 452#define TTI_DATA1_MEM_TX_URNG_C(n) vBIT(n,57,7)
@@ -459,11 +459,11 @@ struct XENA_dev_config {
459 459
460/* Tx Protocol assist */ 460/* Tx Protocol assist */
461 u64 tx_pa_cfg; 461 u64 tx_pa_cfg;
462#define TX_PA_CFG_IGNORE_FRM_ERR BIT(1) 462#define TX_PA_CFG_IGNORE_FRM_ERR s2BIT(1)
463#define TX_PA_CFG_IGNORE_SNAP_OUI BIT(2) 463#define TX_PA_CFG_IGNORE_SNAP_OUI s2BIT(2)
464#define TX_PA_CFG_IGNORE_LLC_CTRL BIT(3) 464#define TX_PA_CFG_IGNORE_LLC_CTRL s2BIT(3)
465#define TX_PA_CFG_IGNORE_L2_ERR BIT(6) 465#define TX_PA_CFG_IGNORE_L2_ERR s2BIT(6)
466#define RX_PA_CFG_STRIP_VLAN_TAG BIT(15) 466#define RX_PA_CFG_STRIP_VLAN_TAG s2BIT(15)
467 467
468/* Recent add, used only debug purposes. */ 468/* Recent add, used only debug purposes. */
469 u64 pcc_enable; 469 u64 pcc_enable;
@@ -477,31 +477,31 @@ struct XENA_dev_config {
477/* RxDMA Registers */ 477/* RxDMA Registers */
478 u64 rxdma_int_status; 478 u64 rxdma_int_status;
479 u64 rxdma_int_mask; 479 u64 rxdma_int_mask;
480#define RXDMA_INT_RC_INT_M BIT(0) 480#define RXDMA_INT_RC_INT_M s2BIT(0)
481#define RXDMA_INT_RPA_INT_M BIT(1) 481#define RXDMA_INT_RPA_INT_M s2BIT(1)
482#define RXDMA_INT_RDA_INT_M BIT(2) 482#define RXDMA_INT_RDA_INT_M s2BIT(2)
483#define RXDMA_INT_RTI_INT_M BIT(3) 483#define RXDMA_INT_RTI_INT_M s2BIT(3)
484 484
485 u64 rda_err_reg; 485 u64 rda_err_reg;
486#define RDA_RXDn_ECC_SG_ERR vBIT(0xFF,0,8) 486#define RDA_RXDn_ECC_SG_ERR vBIT(0xFF,0,8)
487#define RDA_RXDn_ECC_DB_ERR vBIT(0xFF,8,8) 487#define RDA_RXDn_ECC_DB_ERR vBIT(0xFF,8,8)
488#define RDA_FRM_ECC_SG_ERR BIT(23) 488#define RDA_FRM_ECC_SG_ERR s2BIT(23)
489#define RDA_FRM_ECC_DB_N_AERR BIT(31) 489#define RDA_FRM_ECC_DB_N_AERR s2BIT(31)
490#define RDA_SM1_ERR_ALARM BIT(38) 490#define RDA_SM1_ERR_ALARM s2BIT(38)
491#define RDA_SM0_ERR_ALARM BIT(39) 491#define RDA_SM0_ERR_ALARM s2BIT(39)
492#define RDA_MISC_ERR BIT(47) 492#define RDA_MISC_ERR s2BIT(47)
493#define RDA_PCIX_ERR BIT(55) 493#define RDA_PCIX_ERR s2BIT(55)
494#define RDA_RXD_ECC_DB_SERR BIT(63) 494#define RDA_RXD_ECC_DB_SERR s2BIT(63)
495 u64 rda_err_mask; 495 u64 rda_err_mask;
496 u64 rda_err_alarm; 496 u64 rda_err_alarm;
497 497
498 u64 rc_err_reg; 498 u64 rc_err_reg;
499#define RC_PRCn_ECC_SG_ERR vBIT(0xFF,0,8) 499#define RC_PRCn_ECC_SG_ERR vBIT(0xFF,0,8)
500#define RC_PRCn_ECC_DB_ERR vBIT(0xFF,8,8) 500#define RC_PRCn_ECC_DB_ERR vBIT(0xFF,8,8)
501#define RC_FTC_ECC_SG_ERR BIT(23) 501#define RC_FTC_ECC_SG_ERR s2BIT(23)
502#define RC_FTC_ECC_DB_ERR BIT(31) 502#define RC_FTC_ECC_DB_ERR s2BIT(31)
503#define RC_PRCn_SM_ERR_ALARM vBIT(0xFF,32,8) 503#define RC_PRCn_SM_ERR_ALARM vBIT(0xFF,32,8)
504#define RC_FTC_SM_ERR_ALARM BIT(47) 504#define RC_FTC_SM_ERR_ALARM s2BIT(47)
505#define RC_RDA_FAIL_WR_Rn vBIT(0xFF,48,8) 505#define RC_RDA_FAIL_WR_Rn vBIT(0xFF,48,8)
506 u64 rc_err_mask; 506 u64 rc_err_mask;
507 u64 rc_err_alarm; 507 u64 rc_err_alarm;
@@ -517,18 +517,18 @@ struct XENA_dev_config {
517 u64 prc_pcix_err_alarm; 517 u64 prc_pcix_err_alarm;
518 518
519 u64 rpa_err_reg; 519 u64 rpa_err_reg;
520#define RPA_ECC_SG_ERR BIT(7) 520#define RPA_ECC_SG_ERR s2BIT(7)
521#define RPA_ECC_DB_ERR BIT(15) 521#define RPA_ECC_DB_ERR s2BIT(15)
522#define RPA_FLUSH_REQUEST BIT(22) 522#define RPA_FLUSH_REQUEST s2BIT(22)
523#define RPA_SM_ERR_ALARM BIT(23) 523#define RPA_SM_ERR_ALARM s2BIT(23)
524#define RPA_CREDIT_ERR BIT(31) 524#define RPA_CREDIT_ERR s2BIT(31)
525 u64 rpa_err_mask; 525 u64 rpa_err_mask;
526 u64 rpa_err_alarm; 526 u64 rpa_err_alarm;
527 527
528 u64 rti_err_reg; 528 u64 rti_err_reg;
529#define RTI_ECC_SG_ERR BIT(7) 529#define RTI_ECC_SG_ERR s2BIT(7)
530#define RTI_ECC_DB_ERR BIT(15) 530#define RTI_ECC_DB_ERR s2BIT(15)
531#define RTI_SM_ERR_ALARM BIT(23) 531#define RTI_SM_ERR_ALARM s2BIT(23)
532 u64 rti_err_mask; 532 u64 rti_err_mask;
533 u64 rti_err_alarm; 533 u64 rti_err_alarm;
534 534
@@ -568,49 +568,49 @@ struct XENA_dev_config {
568#endif 568#endif
569 u64 prc_rxd0_n[RX_MAX_RINGS]; 569 u64 prc_rxd0_n[RX_MAX_RINGS];
570 u64 prc_ctrl_n[RX_MAX_RINGS]; 570 u64 prc_ctrl_n[RX_MAX_RINGS];
571#define PRC_CTRL_RC_ENABLED BIT(7) 571#define PRC_CTRL_RC_ENABLED s2BIT(7)
572#define PRC_CTRL_RING_MODE (BIT(14)|BIT(15)) 572#define PRC_CTRL_RING_MODE (s2BIT(14)|s2BIT(15))
573#define PRC_CTRL_RING_MODE_1 vBIT(0,14,2) 573#define PRC_CTRL_RING_MODE_1 vBIT(0,14,2)
574#define PRC_CTRL_RING_MODE_3 vBIT(1,14,2) 574#define PRC_CTRL_RING_MODE_3 vBIT(1,14,2)
575#define PRC_CTRL_RING_MODE_5 vBIT(2,14,2) 575#define PRC_CTRL_RING_MODE_5 vBIT(2,14,2)
576#define PRC_CTRL_RING_MODE_x vBIT(3,14,2) 576#define PRC_CTRL_RING_MODE_x vBIT(3,14,2)
577#define PRC_CTRL_NO_SNOOP (BIT(22)|BIT(23)) 577#define PRC_CTRL_NO_SNOOP (s2BIT(22)|s2BIT(23))
578#define PRC_CTRL_NO_SNOOP_DESC BIT(22) 578#define PRC_CTRL_NO_SNOOP_DESC s2BIT(22)
579#define PRC_CTRL_NO_SNOOP_BUFF BIT(23) 579#define PRC_CTRL_NO_SNOOP_BUFF s2BIT(23)
580#define PRC_CTRL_BIMODAL_INTERRUPT BIT(37) 580#define PRC_CTRL_BIMODAL_INTERRUPT s2BIT(37)
581#define PRC_CTRL_GROUP_READS BIT(38) 581#define PRC_CTRL_GROUP_READS s2BIT(38)
582#define PRC_CTRL_RXD_BACKOFF_INTERVAL(val) vBIT(val,40,24) 582#define PRC_CTRL_RXD_BACKOFF_INTERVAL(val) vBIT(val,40,24)
583 583
584 u64 prc_alarm_action; 584 u64 prc_alarm_action;
585#define PRC_ALARM_ACTION_RR_R0_STOP BIT(3) 585#define PRC_ALARM_ACTION_RR_R0_STOP s2BIT(3)
586#define PRC_ALARM_ACTION_RW_R0_STOP BIT(7) 586#define PRC_ALARM_ACTION_RW_R0_STOP s2BIT(7)
587#define PRC_ALARM_ACTION_RR_R1_STOP BIT(11) 587#define PRC_ALARM_ACTION_RR_R1_STOP s2BIT(11)
588#define PRC_ALARM_ACTION_RW_R1_STOP BIT(15) 588#define PRC_ALARM_ACTION_RW_R1_STOP s2BIT(15)
589#define PRC_ALARM_ACTION_RR_R2_STOP BIT(19) 589#define PRC_ALARM_ACTION_RR_R2_STOP s2BIT(19)
590#define PRC_ALARM_ACTION_RW_R2_STOP BIT(23) 590#define PRC_ALARM_ACTION_RW_R2_STOP s2BIT(23)
591#define PRC_ALARM_ACTION_RR_R3_STOP BIT(27) 591#define PRC_ALARM_ACTION_RR_R3_STOP s2BIT(27)
592#define PRC_ALARM_ACTION_RW_R3_STOP BIT(31) 592#define PRC_ALARM_ACTION_RW_R3_STOP s2BIT(31)
593#define PRC_ALARM_ACTION_RR_R4_STOP BIT(35) 593#define PRC_ALARM_ACTION_RR_R4_STOP s2BIT(35)
594#define PRC_ALARM_ACTION_RW_R4_STOP BIT(39) 594#define PRC_ALARM_ACTION_RW_R4_STOP s2BIT(39)
595#define PRC_ALARM_ACTION_RR_R5_STOP BIT(43) 595#define PRC_ALARM_ACTION_RR_R5_STOP s2BIT(43)
596#define PRC_ALARM_ACTION_RW_R5_STOP BIT(47) 596#define PRC_ALARM_ACTION_RW_R5_STOP s2BIT(47)
597#define PRC_ALARM_ACTION_RR_R6_STOP BIT(51) 597#define PRC_ALARM_ACTION_RR_R6_STOP s2BIT(51)
598#define PRC_ALARM_ACTION_RW_R6_STOP BIT(55) 598#define PRC_ALARM_ACTION_RW_R6_STOP s2BIT(55)
599#define PRC_ALARM_ACTION_RR_R7_STOP BIT(59) 599#define PRC_ALARM_ACTION_RR_R7_STOP s2BIT(59)
600#define PRC_ALARM_ACTION_RW_R7_STOP BIT(63) 600#define PRC_ALARM_ACTION_RW_R7_STOP s2BIT(63)
601 601
602/* Receive traffic interrupts */ 602/* Receive traffic interrupts */
603 u64 rti_command_mem; 603 u64 rti_command_mem;
604#define RTI_CMD_MEM_WE BIT(7) 604#define RTI_CMD_MEM_WE s2BIT(7)
605#define RTI_CMD_MEM_STROBE BIT(15) 605#define RTI_CMD_MEM_STROBE s2BIT(15)
606#define RTI_CMD_MEM_STROBE_NEW_CMD BIT(15) 606#define RTI_CMD_MEM_STROBE_NEW_CMD s2BIT(15)
607#define RTI_CMD_MEM_STROBE_CMD_BEING_EXECUTED BIT(15) 607#define RTI_CMD_MEM_STROBE_CMD_BEING_EXECUTED s2BIT(15)
608#define RTI_CMD_MEM_OFFSET(n) vBIT(n,29,3) 608#define RTI_CMD_MEM_OFFSET(n) vBIT(n,29,3)
609 609
610 u64 rti_data1_mem; 610 u64 rti_data1_mem;
611#define RTI_DATA1_MEM_RX_TIMER_VAL(n) vBIT(n,3,29) 611#define RTI_DATA1_MEM_RX_TIMER_VAL(n) vBIT(n,3,29)
612#define RTI_DATA1_MEM_RX_TIMER_AC_EN BIT(38) 612#define RTI_DATA1_MEM_RX_TIMER_AC_EN s2BIT(38)
613#define RTI_DATA1_MEM_RX_TIMER_CI_EN BIT(39) 613#define RTI_DATA1_MEM_RX_TIMER_CI_EN s2BIT(39)
614#define RTI_DATA1_MEM_RX_URNG_A(n) vBIT(n,41,7) 614#define RTI_DATA1_MEM_RX_URNG_A(n) vBIT(n,41,7)
615#define RTI_DATA1_MEM_RX_URNG_B(n) vBIT(n,49,7) 615#define RTI_DATA1_MEM_RX_URNG_B(n) vBIT(n,49,7)
616#define RTI_DATA1_MEM_RX_URNG_C(n) vBIT(n,57,7) 616#define RTI_DATA1_MEM_RX_URNG_C(n) vBIT(n,57,7)
@@ -622,10 +622,10 @@ struct XENA_dev_config {
622#define RTI_DATA2_MEM_RX_UFC_D(n) vBIT(n,48,16) 622#define RTI_DATA2_MEM_RX_UFC_D(n) vBIT(n,48,16)
623 623
624 u64 rx_pa_cfg; 624 u64 rx_pa_cfg;
625#define RX_PA_CFG_IGNORE_FRM_ERR BIT(1) 625#define RX_PA_CFG_IGNORE_FRM_ERR s2BIT(1)
626#define RX_PA_CFG_IGNORE_SNAP_OUI BIT(2) 626#define RX_PA_CFG_IGNORE_SNAP_OUI s2BIT(2)
627#define RX_PA_CFG_IGNORE_LLC_CTRL BIT(3) 627#define RX_PA_CFG_IGNORE_LLC_CTRL s2BIT(3)
628#define RX_PA_CFG_IGNORE_L2_ERR BIT(6) 628#define RX_PA_CFG_IGNORE_L2_ERR s2BIT(6)
629 629
630 u64 unused_11_1; 630 u64 unused_11_1;
631 631
@@ -641,64 +641,64 @@ struct XENA_dev_config {
641/* Media Access Controller Register */ 641/* Media Access Controller Register */
642 u64 mac_int_status; 642 u64 mac_int_status;
643 u64 mac_int_mask; 643 u64 mac_int_mask;
644#define MAC_INT_STATUS_TMAC_INT BIT(0) 644#define MAC_INT_STATUS_TMAC_INT s2BIT(0)
645#define MAC_INT_STATUS_RMAC_INT BIT(1) 645#define MAC_INT_STATUS_RMAC_INT s2BIT(1)
646 646
647 u64 mac_tmac_err_reg; 647 u64 mac_tmac_err_reg;
648#define TMAC_ECC_SG_ERR BIT(7) 648#define TMAC_ECC_SG_ERR s2BIT(7)
649#define TMAC_ECC_DB_ERR BIT(15) 649#define TMAC_ECC_DB_ERR s2BIT(15)
650#define TMAC_TX_BUF_OVRN BIT(23) 650#define TMAC_TX_BUF_OVRN s2BIT(23)
651#define TMAC_TX_CRI_ERR BIT(31) 651#define TMAC_TX_CRI_ERR s2BIT(31)
652#define TMAC_TX_SM_ERR BIT(39) 652#define TMAC_TX_SM_ERR s2BIT(39)
653#define TMAC_DESC_ECC_SG_ERR BIT(47) 653#define TMAC_DESC_ECC_SG_ERR s2BIT(47)
654#define TMAC_DESC_ECC_DB_ERR BIT(55) 654#define TMAC_DESC_ECC_DB_ERR s2BIT(55)
655 655
656 u64 mac_tmac_err_mask; 656 u64 mac_tmac_err_mask;
657 u64 mac_tmac_err_alarm; 657 u64 mac_tmac_err_alarm;
658 658
659 u64 mac_rmac_err_reg; 659 u64 mac_rmac_err_reg;
660#define RMAC_RX_BUFF_OVRN BIT(0) 660#define RMAC_RX_BUFF_OVRN s2BIT(0)
661#define RMAC_FRM_RCVD_INT BIT(1) 661#define RMAC_FRM_RCVD_INT s2BIT(1)
662#define RMAC_UNUSED_INT BIT(2) 662#define RMAC_UNUSED_INT s2BIT(2)
663#define RMAC_RTS_PNUM_ECC_SG_ERR BIT(5) 663#define RMAC_RTS_PNUM_ECC_SG_ERR s2BIT(5)
664#define RMAC_RTS_DS_ECC_SG_ERR BIT(6) 664#define RMAC_RTS_DS_ECC_SG_ERR s2BIT(6)
665#define RMAC_RD_BUF_ECC_SG_ERR BIT(7) 665#define RMAC_RD_BUF_ECC_SG_ERR s2BIT(7)
666#define RMAC_RTH_MAP_ECC_SG_ERR BIT(8) 666#define RMAC_RTH_MAP_ECC_SG_ERR s2BIT(8)
667#define RMAC_RTH_SPDM_ECC_SG_ERR BIT(9) 667#define RMAC_RTH_SPDM_ECC_SG_ERR s2BIT(9)
668#define RMAC_RTS_VID_ECC_SG_ERR BIT(10) 668#define RMAC_RTS_VID_ECC_SG_ERR s2BIT(10)
669#define RMAC_DA_SHADOW_ECC_SG_ERR BIT(11) 669#define RMAC_DA_SHADOW_ECC_SG_ERR s2BIT(11)
670#define RMAC_RTS_PNUM_ECC_DB_ERR BIT(13) 670#define RMAC_RTS_PNUM_ECC_DB_ERR s2BIT(13)
671#define RMAC_RTS_DS_ECC_DB_ERR BIT(14) 671#define RMAC_RTS_DS_ECC_DB_ERR s2BIT(14)
672#define RMAC_RD_BUF_ECC_DB_ERR BIT(15) 672#define RMAC_RD_BUF_ECC_DB_ERR s2BIT(15)
673#define RMAC_RTH_MAP_ECC_DB_ERR BIT(16) 673#define RMAC_RTH_MAP_ECC_DB_ERR s2BIT(16)
674#define RMAC_RTH_SPDM_ECC_DB_ERR BIT(17) 674#define RMAC_RTH_SPDM_ECC_DB_ERR s2BIT(17)
675#define RMAC_RTS_VID_ECC_DB_ERR BIT(18) 675#define RMAC_RTS_VID_ECC_DB_ERR s2BIT(18)
676#define RMAC_DA_SHADOW_ECC_DB_ERR BIT(19) 676#define RMAC_DA_SHADOW_ECC_DB_ERR s2BIT(19)
677#define RMAC_LINK_STATE_CHANGE_INT BIT(31) 677#define RMAC_LINK_STATE_CHANGE_INT s2BIT(31)
678#define RMAC_RX_SM_ERR BIT(39) 678#define RMAC_RX_SM_ERR s2BIT(39)
679#define RMAC_SINGLE_ECC_ERR (BIT(5) | BIT(6) | BIT(7) |\ 679#define RMAC_SINGLE_ECC_ERR (s2BIT(5) | s2BIT(6) | s2BIT(7) |\
680 BIT(8) | BIT(9) | BIT(10)|\ 680 s2BIT(8) | s2BIT(9) | s2BIT(10)|\
681 BIT(11)) 681 s2BIT(11))
682#define RMAC_DOUBLE_ECC_ERR (BIT(13) | BIT(14) | BIT(15) |\ 682#define RMAC_DOUBLE_ECC_ERR (s2BIT(13) | s2BIT(14) | s2BIT(15) |\
683 BIT(16) | BIT(17) | BIT(18)|\ 683 s2BIT(16) | s2BIT(17) | s2BIT(18)|\
684 BIT(19)) 684 s2BIT(19))
685 u64 mac_rmac_err_mask; 685 u64 mac_rmac_err_mask;
686 u64 mac_rmac_err_alarm; 686 u64 mac_rmac_err_alarm;
687 687
688 u8 unused14[0x100 - 0x40]; 688 u8 unused14[0x100 - 0x40];
689 689
690 u64 mac_cfg; 690 u64 mac_cfg;
691#define MAC_CFG_TMAC_ENABLE BIT(0) 691#define MAC_CFG_TMAC_ENABLE s2BIT(0)
692#define MAC_CFG_RMAC_ENABLE BIT(1) 692#define MAC_CFG_RMAC_ENABLE s2BIT(1)
693#define MAC_CFG_LAN_NOT_WAN BIT(2) 693#define MAC_CFG_LAN_NOT_WAN s2BIT(2)
694#define MAC_CFG_TMAC_LOOPBACK BIT(3) 694#define MAC_CFG_TMAC_LOOPBACK s2BIT(3)
695#define MAC_CFG_TMAC_APPEND_PAD BIT(4) 695#define MAC_CFG_TMAC_APPEND_PAD s2BIT(4)
696#define MAC_CFG_RMAC_STRIP_FCS BIT(5) 696#define MAC_CFG_RMAC_STRIP_FCS s2BIT(5)
697#define MAC_CFG_RMAC_STRIP_PAD BIT(6) 697#define MAC_CFG_RMAC_STRIP_PAD s2BIT(6)
698#define MAC_CFG_RMAC_PROM_ENABLE BIT(7) 698#define MAC_CFG_RMAC_PROM_ENABLE s2BIT(7)
699#define MAC_RMAC_DISCARD_PFRM BIT(8) 699#define MAC_RMAC_DISCARD_PFRM s2BIT(8)
700#define MAC_RMAC_BCAST_ENABLE BIT(9) 700#define MAC_RMAC_BCAST_ENABLE s2BIT(9)
701#define MAC_RMAC_ALL_ADDR_ENABLE BIT(10) 701#define MAC_RMAC_ALL_ADDR_ENABLE s2BIT(10)
702#define MAC_RMAC_INVLD_IPG_THR(val) vBIT(val,16,8) 702#define MAC_RMAC_INVLD_IPG_THR(val) vBIT(val,16,8)
703 703
704 u64 tmac_avg_ipg; 704 u64 tmac_avg_ipg;
@@ -710,14 +710,14 @@ struct XENA_dev_config {
710#define RMAC_MAX_PYLD_LEN_JUMBO_DEF vBIT(9600,2,14) 710#define RMAC_MAX_PYLD_LEN_JUMBO_DEF vBIT(9600,2,14)
711 711
712 u64 rmac_err_cfg; 712 u64 rmac_err_cfg;
713#define RMAC_ERR_FCS BIT(0) 713#define RMAC_ERR_FCS s2BIT(0)
714#define RMAC_ERR_FCS_ACCEPT BIT(1) 714#define RMAC_ERR_FCS_ACCEPT s2BIT(1)
715#define RMAC_ERR_TOO_LONG BIT(1) 715#define RMAC_ERR_TOO_LONG s2BIT(1)
716#define RMAC_ERR_TOO_LONG_ACCEPT BIT(1) 716#define RMAC_ERR_TOO_LONG_ACCEPT s2BIT(1)
717#define RMAC_ERR_RUNT BIT(2) 717#define RMAC_ERR_RUNT s2BIT(2)
718#define RMAC_ERR_RUNT_ACCEPT BIT(2) 718#define RMAC_ERR_RUNT_ACCEPT s2BIT(2)
719#define RMAC_ERR_LEN_MISMATCH BIT(3) 719#define RMAC_ERR_LEN_MISMATCH s2BIT(3)
720#define RMAC_ERR_LEN_MISMATCH_ACCEPT BIT(3) 720#define RMAC_ERR_LEN_MISMATCH_ACCEPT s2BIT(3)
721 721
722 u64 rmac_cfg_key; 722 u64 rmac_cfg_key;
723#define RMAC_CFG_KEY(val) vBIT(val,0,16) 723#define RMAC_CFG_KEY(val) vBIT(val,0,16)
@@ -728,15 +728,15 @@ struct XENA_dev_config {
728#define MAC_MC_ADDR_START_OFFSET 16 728#define MAC_MC_ADDR_START_OFFSET 16
729#define MAC_MC_ALL_MC_ADDR_OFFSET 63 /* enables all multicast pkts */ 729#define MAC_MC_ALL_MC_ADDR_OFFSET 63 /* enables all multicast pkts */
730 u64 rmac_addr_cmd_mem; 730 u64 rmac_addr_cmd_mem;
731#define RMAC_ADDR_CMD_MEM_WE BIT(7) 731#define RMAC_ADDR_CMD_MEM_WE s2BIT(7)
732#define RMAC_ADDR_CMD_MEM_RD 0 732#define RMAC_ADDR_CMD_MEM_RD 0
733#define RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD BIT(15) 733#define RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD s2BIT(15)
734#define RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING BIT(15) 734#define RMAC_ADDR_CMD_MEM_STROBE_CMD_EXECUTING s2BIT(15)
735#define RMAC_ADDR_CMD_MEM_OFFSET(n) vBIT(n,26,6) 735#define RMAC_ADDR_CMD_MEM_OFFSET(n) vBIT(n,26,6)
736 736
737 u64 rmac_addr_data0_mem; 737 u64 rmac_addr_data0_mem;
738#define RMAC_ADDR_DATA0_MEM_ADDR(n) vBIT(n,0,48) 738#define RMAC_ADDR_DATA0_MEM_ADDR(n) vBIT(n,0,48)
739#define RMAC_ADDR_DATA0_MEM_USER BIT(48) 739#define RMAC_ADDR_DATA0_MEM_USER s2BIT(48)
740 740
741 u64 rmac_addr_data1_mem; 741 u64 rmac_addr_data1_mem;
742#define RMAC_ADDR_DATA1_MEM_MASK(n) vBIT(n,0,48) 742#define RMAC_ADDR_DATA1_MEM_MASK(n) vBIT(n,0,48)
@@ -753,10 +753,10 @@ struct XENA_dev_config {
753 u64 tmac_ipg_cfg; 753 u64 tmac_ipg_cfg;
754 754
755 u64 rmac_pause_cfg; 755 u64 rmac_pause_cfg;
756#define RMAC_PAUSE_GEN BIT(0) 756#define RMAC_PAUSE_GEN s2BIT(0)
757#define RMAC_PAUSE_GEN_ENABLE BIT(0) 757#define RMAC_PAUSE_GEN_ENABLE s2BIT(0)
758#define RMAC_PAUSE_RX BIT(1) 758#define RMAC_PAUSE_RX s2BIT(1)
759#define RMAC_PAUSE_RX_ENABLE BIT(1) 759#define RMAC_PAUSE_RX_ENABLE s2BIT(1)
760#define RMAC_PAUSE_HG_PTIME_DEF vBIT(0xFFFF,16,16) 760#define RMAC_PAUSE_HG_PTIME_DEF vBIT(0xFFFF,16,16)
761#define RMAC_PAUSE_HG_PTIME(val) vBIT(val,16,16) 761#define RMAC_PAUSE_HG_PTIME(val) vBIT(val,16,16)
762 762
@@ -787,29 +787,29 @@ struct XENA_dev_config {
787#define MAX_DIX_MAP 4 787#define MAX_DIX_MAP 4
788 u64 rts_dix_map_n[MAX_DIX_MAP]; 788 u64 rts_dix_map_n[MAX_DIX_MAP];
789#define RTS_DIX_MAP_ETYPE(val) vBIT(val,0,16) 789#define RTS_DIX_MAP_ETYPE(val) vBIT(val,0,16)
790#define RTS_DIX_MAP_SCW(val) BIT(val,21) 790#define RTS_DIX_MAP_SCW(val) s2BIT(val,21)
791 791
792 u64 rts_q_alternates; 792 u64 rts_q_alternates;
793 u64 rts_default_q; 793 u64 rts_default_q;
794 794
795 u64 rts_ctrl; 795 u64 rts_ctrl;
796#define RTS_CTRL_IGNORE_SNAP_OUI BIT(2) 796#define RTS_CTRL_IGNORE_SNAP_OUI s2BIT(2)
797#define RTS_CTRL_IGNORE_LLC_CTRL BIT(3) 797#define RTS_CTRL_IGNORE_LLC_CTRL s2BIT(3)
798 798
799 u64 rts_pn_cam_ctrl; 799 u64 rts_pn_cam_ctrl;
800#define RTS_PN_CAM_CTRL_WE BIT(7) 800#define RTS_PN_CAM_CTRL_WE s2BIT(7)
801#define RTS_PN_CAM_CTRL_STROBE_NEW_CMD BIT(15) 801#define RTS_PN_CAM_CTRL_STROBE_NEW_CMD s2BIT(15)
802#define RTS_PN_CAM_CTRL_STROBE_BEING_EXECUTED BIT(15) 802#define RTS_PN_CAM_CTRL_STROBE_BEING_EXECUTED s2BIT(15)
803#define RTS_PN_CAM_CTRL_OFFSET(n) vBIT(n,24,8) 803#define RTS_PN_CAM_CTRL_OFFSET(n) vBIT(n,24,8)
804 u64 rts_pn_cam_data; 804 u64 rts_pn_cam_data;
805#define RTS_PN_CAM_DATA_TCP_SELECT BIT(7) 805#define RTS_PN_CAM_DATA_TCP_SELECT s2BIT(7)
806#define RTS_PN_CAM_DATA_PORT(val) vBIT(val,8,16) 806#define RTS_PN_CAM_DATA_PORT(val) vBIT(val,8,16)
807#define RTS_PN_CAM_DATA_SCW(val) vBIT(val,24,8) 807#define RTS_PN_CAM_DATA_SCW(val) vBIT(val,24,8)
808 808
809 u64 rts_ds_mem_ctrl; 809 u64 rts_ds_mem_ctrl;
810#define RTS_DS_MEM_CTRL_WE BIT(7) 810#define RTS_DS_MEM_CTRL_WE s2BIT(7)
811#define RTS_DS_MEM_CTRL_STROBE_NEW_CMD BIT(15) 811#define RTS_DS_MEM_CTRL_STROBE_NEW_CMD s2BIT(15)
812#define RTS_DS_MEM_CTRL_STROBE_CMD_BEING_EXECUTED BIT(15) 812#define RTS_DS_MEM_CTRL_STROBE_CMD_BEING_EXECUTED s2BIT(15)
813#define RTS_DS_MEM_CTRL_OFFSET(n) vBIT(n,26,6) 813#define RTS_DS_MEM_CTRL_OFFSET(n) vBIT(n,26,6)
814 u64 rts_ds_mem_data; 814 u64 rts_ds_mem_data;
815#define RTS_DS_MEM_DATA(n) vBIT(n,0,8) 815#define RTS_DS_MEM_DATA(n) vBIT(n,0,8)
@@ -823,23 +823,23 @@ struct XENA_dev_config {
823 823
824/* memory controller registers */ 824/* memory controller registers */
825 u64 mc_int_status; 825 u64 mc_int_status;
826#define MC_INT_STATUS_MC_INT BIT(0) 826#define MC_INT_STATUS_MC_INT s2BIT(0)
827 u64 mc_int_mask; 827 u64 mc_int_mask;
828#define MC_INT_MASK_MC_INT BIT(0) 828#define MC_INT_MASK_MC_INT s2BIT(0)
829 829
830 u64 mc_err_reg; 830 u64 mc_err_reg;
831#define MC_ERR_REG_ECC_DB_ERR_L BIT(14) 831#define MC_ERR_REG_ECC_DB_ERR_L s2BIT(14)
832#define MC_ERR_REG_ECC_DB_ERR_U BIT(15) 832#define MC_ERR_REG_ECC_DB_ERR_U s2BIT(15)
833#define MC_ERR_REG_MIRI_ECC_DB_ERR_0 BIT(18) 833#define MC_ERR_REG_MIRI_ECC_DB_ERR_0 s2BIT(18)
834#define MC_ERR_REG_MIRI_ECC_DB_ERR_1 BIT(20) 834#define MC_ERR_REG_MIRI_ECC_DB_ERR_1 s2BIT(20)
835#define MC_ERR_REG_MIRI_CRI_ERR_0 BIT(22) 835#define MC_ERR_REG_MIRI_CRI_ERR_0 s2BIT(22)
836#define MC_ERR_REG_MIRI_CRI_ERR_1 BIT(23) 836#define MC_ERR_REG_MIRI_CRI_ERR_1 s2BIT(23)
837#define MC_ERR_REG_SM_ERR BIT(31) 837#define MC_ERR_REG_SM_ERR s2BIT(31)
838#define MC_ERR_REG_ECC_ALL_SNG (BIT(2) | BIT(3) | BIT(4) | BIT(5) |\ 838#define MC_ERR_REG_ECC_ALL_SNG (s2BIT(2) | s2BIT(3) | s2BIT(4) | s2BIT(5) |\
839 BIT(17) | BIT(19)) 839 s2BIT(17) | s2BIT(19))
840#define MC_ERR_REG_ECC_ALL_DBL (BIT(10) | BIT(11) | BIT(12) |\ 840#define MC_ERR_REG_ECC_ALL_DBL (s2BIT(10) | s2BIT(11) | s2BIT(12) |\
841 BIT(13) | BIT(18) | BIT(20)) 841 s2BIT(13) | s2BIT(18) | s2BIT(20))
842#define PLL_LOCK_N BIT(39) 842#define PLL_LOCK_N s2BIT(39)
843 u64 mc_err_mask; 843 u64 mc_err_mask;
844 u64 mc_err_alarm; 844 u64 mc_err_alarm;
845 845
@@ -857,8 +857,8 @@ struct XENA_dev_config {
857#define RX_QUEUE_CFG_Q7_SZ(n) vBIT(n,56,8) 857#define RX_QUEUE_CFG_Q7_SZ(n) vBIT(n,56,8)
858 858
859 u64 mc_rldram_mrs; 859 u64 mc_rldram_mrs;
860#define MC_RLDRAM_QUEUE_SIZE_ENABLE BIT(39) 860#define MC_RLDRAM_QUEUE_SIZE_ENABLE s2BIT(39)
861#define MC_RLDRAM_MRS_ENABLE BIT(47) 861#define MC_RLDRAM_MRS_ENABLE s2BIT(47)
862 862
863 u64 mc_rldram_interleave; 863 u64 mc_rldram_interleave;
864 864
@@ -871,11 +871,11 @@ struct XENA_dev_config {
871 u64 mc_rldram_ref_per; 871 u64 mc_rldram_ref_per;
872 u8 unused20[0x220 - 0x208]; 872 u8 unused20[0x220 - 0x208];
873 u64 mc_rldram_test_ctrl; 873 u64 mc_rldram_test_ctrl;
874#define MC_RLDRAM_TEST_MODE BIT(47) 874#define MC_RLDRAM_TEST_MODE s2BIT(47)
875#define MC_RLDRAM_TEST_WRITE BIT(7) 875#define MC_RLDRAM_TEST_WRITE s2BIT(7)
876#define MC_RLDRAM_TEST_GO BIT(15) 876#define MC_RLDRAM_TEST_GO s2BIT(15)
877#define MC_RLDRAM_TEST_DONE BIT(23) 877#define MC_RLDRAM_TEST_DONE s2BIT(23)
878#define MC_RLDRAM_TEST_PASS BIT(31) 878#define MC_RLDRAM_TEST_PASS s2BIT(31)
879 879
880 u8 unused21[0x240 - 0x228]; 880 u8 unused21[0x240 - 0x228];
881 u64 mc_rldram_test_add; 881 u64 mc_rldram_test_add;
@@ -888,7 +888,7 @@ struct XENA_dev_config {
888 888
889 u8 unused24_1[0x360 - 0x308]; 889 u8 unused24_1[0x360 - 0x308];
890 u64 mc_rldram_ctrl; 890 u64 mc_rldram_ctrl;
891#define MC_RLDRAM_ENABLE_ODT BIT(7) 891#define MC_RLDRAM_ENABLE_ODT s2BIT(7)
892 892
893 u8 unused24_2[0x640 - 0x368]; 893 u8 unused24_2[0x640 - 0x368];
894 u64 mc_rldram_ref_per_herc; 894 u64 mc_rldram_ref_per_herc;
@@ -906,24 +906,24 @@ struct XENA_dev_config {
906 /* XGXS control registers */ 906 /* XGXS control registers */
907 907
908 u64 xgxs_int_status; 908 u64 xgxs_int_status;
909#define XGXS_INT_STATUS_TXGXS BIT(0) 909#define XGXS_INT_STATUS_TXGXS s2BIT(0)
910#define XGXS_INT_STATUS_RXGXS BIT(1) 910#define XGXS_INT_STATUS_RXGXS s2BIT(1)
911 u64 xgxs_int_mask; 911 u64 xgxs_int_mask;
912#define XGXS_INT_MASK_TXGXS BIT(0) 912#define XGXS_INT_MASK_TXGXS s2BIT(0)
913#define XGXS_INT_MASK_RXGXS BIT(1) 913#define XGXS_INT_MASK_RXGXS s2BIT(1)
914 914
915 u64 xgxs_txgxs_err_reg; 915 u64 xgxs_txgxs_err_reg;
916#define TXGXS_ECC_SG_ERR BIT(7) 916#define TXGXS_ECC_SG_ERR s2BIT(7)
917#define TXGXS_ECC_DB_ERR BIT(15) 917#define TXGXS_ECC_DB_ERR s2BIT(15)
918#define TXGXS_ESTORE_UFLOW BIT(31) 918#define TXGXS_ESTORE_UFLOW s2BIT(31)
919#define TXGXS_TX_SM_ERR BIT(39) 919#define TXGXS_TX_SM_ERR s2BIT(39)
920 920
921 u64 xgxs_txgxs_err_mask; 921 u64 xgxs_txgxs_err_mask;
922 u64 xgxs_txgxs_err_alarm; 922 u64 xgxs_txgxs_err_alarm;
923 923
924 u64 xgxs_rxgxs_err_reg; 924 u64 xgxs_rxgxs_err_reg;
925#define RXGXS_ESTORE_OFLOW BIT(7) 925#define RXGXS_ESTORE_OFLOW s2BIT(7)
926#define RXGXS_RX_SM_ERR BIT(39) 926#define RXGXS_RX_SM_ERR s2BIT(39)
927 u64 xgxs_rxgxs_err_mask; 927 u64 xgxs_rxgxs_err_mask;
928 u64 xgxs_rxgxs_err_alarm; 928 u64 xgxs_rxgxs_err_alarm;
929 929
@@ -942,10 +942,10 @@ struct XENA_dev_config {
942#define SPI_CONTROL_BYTECNT(cnt) vBIT(cnt,29,3) 942#define SPI_CONTROL_BYTECNT(cnt) vBIT(cnt,29,3)
943#define SPI_CONTROL_CMD(cmd) vBIT(cmd,32,8) 943#define SPI_CONTROL_CMD(cmd) vBIT(cmd,32,8)
944#define SPI_CONTROL_ADDR(addr) vBIT(addr,40,24) 944#define SPI_CONTROL_ADDR(addr) vBIT(addr,40,24)
945#define SPI_CONTROL_SEL1 BIT(4) 945#define SPI_CONTROL_SEL1 s2BIT(4)
946#define SPI_CONTROL_REQ BIT(7) 946#define SPI_CONTROL_REQ s2BIT(7)
947#define SPI_CONTROL_NACK BIT(5) 947#define SPI_CONTROL_NACK s2BIT(5)
948#define SPI_CONTROL_DONE BIT(6) 948#define SPI_CONTROL_DONE s2BIT(6)
949 u64 spi_data; 949 u64 spi_data;
950#define SPI_DATA_WRITE(data,len) vBIT(data,0,len) 950#define SPI_DATA_WRITE(data,len) vBIT(data,0,len)
951}; 951};
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 22e4054d4fcb..b8c0e7b4ca1c 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -1716,7 +1716,7 @@ static int init_nic(struct s2io_nic *nic)
1716 MISC_LINK_STABILITY_PRD(3); 1716 MISC_LINK_STABILITY_PRD(3);
1717 writeq(val64, &bar0->misc_control); 1717 writeq(val64, &bar0->misc_control);
1718 val64 = readq(&bar0->pic_control2); 1718 val64 = readq(&bar0->pic_control2);
1719 val64 &= ~(BIT(13)|BIT(14)|BIT(15)); 1719 val64 &= ~(s2BIT(13)|s2BIT(14)|s2BIT(15));
1720 writeq(val64, &bar0->pic_control2); 1720 writeq(val64, &bar0->pic_control2);
1721 } 1721 }
1722 if (strstr(nic->product_name, "CX4")) { 1722 if (strstr(nic->product_name, "CX4")) {
@@ -2427,7 +2427,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2427 } 2427 }
2428 if ((rxdp->Control_1 & RXD_OWN_XENA) && 2428 if ((rxdp->Control_1 & RXD_OWN_XENA) &&
2429 ((nic->rxd_mode == RXD_MODE_3B) && 2429 ((nic->rxd_mode == RXD_MODE_3B) &&
2430 (rxdp->Control_2 & BIT(0)))) { 2430 (rxdp->Control_2 & s2BIT(0)))) {
2431 mac_control->rings[ring_no].rx_curr_put_info. 2431 mac_control->rings[ring_no].rx_curr_put_info.
2432 offset = off; 2432 offset = off;
2433 goto end; 2433 goto end;
@@ -2540,7 +2540,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
2540 rxdp->Control_2 |= SET_BUFFER2_SIZE_3 2540 rxdp->Control_2 |= SET_BUFFER2_SIZE_3
2541 (dev->mtu + 4); 2541 (dev->mtu + 4);
2542 } 2542 }
2543 rxdp->Control_2 |= BIT(0); 2543 rxdp->Control_2 |= s2BIT(0);
2544 } 2544 }
2545 rxdp->Host_Control = (unsigned long) (skb); 2545 rxdp->Host_Control = (unsigned long) (skb);
2546 if (alloc_tab & ((1 << rxsync_frequency) - 1)) 2546 if (alloc_tab & ((1 << rxsync_frequency) - 1))
@@ -3377,7 +3377,7 @@ static void s2io_reset(struct s2io_nic * sp)
3377 pci_write_config_dword(sp->pdev, 0x68, 0x7C); 3377 pci_write_config_dword(sp->pdev, 0x68, 0x7C);
3378 3378
3379 /* Clearing PCI_STATUS error reflected here */ 3379 /* Clearing PCI_STATUS error reflected here */
3380 writeq(BIT(62), &bar0->txpic_int_reg); 3380 writeq(s2BIT(62), &bar0->txpic_int_reg);
3381 } 3381 }
3382 3382
3383 /* Reset device statistics maintained by OS */ 3383 /* Reset device statistics maintained by OS */
@@ -3575,7 +3575,7 @@ static int wait_for_msix_trans(struct s2io_nic *nic, int i)
3575 3575
3576 do { 3576 do {
3577 val64 = readq(&bar0->xmsi_access); 3577 val64 = readq(&bar0->xmsi_access);
3578 if (!(val64 & BIT(15))) 3578 if (!(val64 & s2BIT(15)))
3579 break; 3579 break;
3580 mdelay(1); 3580 mdelay(1);
3581 cnt++; 3581 cnt++;
@@ -3597,7 +3597,7 @@ static void restore_xmsi_data(struct s2io_nic *nic)
3597 for (i=0; i < MAX_REQUESTED_MSI_X; i++) { 3597 for (i=0; i < MAX_REQUESTED_MSI_X; i++) {
3598 writeq(nic->msix_info[i].addr, &bar0->xmsi_address); 3598 writeq(nic->msix_info[i].addr, &bar0->xmsi_address);
3599 writeq(nic->msix_info[i].data, &bar0->xmsi_data); 3599 writeq(nic->msix_info[i].data, &bar0->xmsi_data);
3600 val64 = (BIT(7) | BIT(15) | vBIT(i, 26, 6)); 3600 val64 = (s2BIT(7) | s2BIT(15) | vBIT(i, 26, 6));
3601 writeq(val64, &bar0->xmsi_access); 3601 writeq(val64, &bar0->xmsi_access);
3602 if (wait_for_msix_trans(nic, i)) { 3602 if (wait_for_msix_trans(nic, i)) {
3603 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); 3603 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__);
@@ -3614,7 +3614,7 @@ static void store_xmsi_data(struct s2io_nic *nic)
3614 3614
3615 /* Store and display */ 3615 /* Store and display */
3616 for (i=0; i < MAX_REQUESTED_MSI_X; i++) { 3616 for (i=0; i < MAX_REQUESTED_MSI_X; i++) {
3617 val64 = (BIT(15) | vBIT(i, 26, 6)); 3617 val64 = (s2BIT(15) | vBIT(i, 26, 6));
3618 writeq(val64, &bar0->xmsi_access); 3618 writeq(val64, &bar0->xmsi_access);
3619 if (wait_for_msix_trans(nic, i)) { 3619 if (wait_for_msix_trans(nic, i)) {
3620 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__); 3620 DBG_PRINT(ERR_DBG, "failed in %s\n", __FUNCTION__);
@@ -4634,7 +4634,7 @@ static void s2io_updt_stats(struct s2io_nic *sp)
4634 do { 4634 do {
4635 udelay(100); 4635 udelay(100);
4636 val64 = readq(&bar0->stat_cfg); 4636 val64 = readq(&bar0->stat_cfg);
4637 if (!(val64 & BIT(0))) 4637 if (!(val64 & s2BIT(0)))
4638 break; 4638 break;
4639 cnt++; 4639 cnt++;
4640 if (cnt == 5) 4640 if (cnt == 5)
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index f6b45565304f..cc1797a071aa 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -14,7 +14,7 @@
14#define _S2IO_H 14#define _S2IO_H
15 15
16#define TBD 0 16#define TBD 0
17#define BIT(loc) (0x8000000000000000ULL >> (loc)) 17#define s2BIT(loc) (0x8000000000000000ULL >> (loc))
18#define vBIT(val, loc, sz) (((u64)val) << (64-loc-sz)) 18#define vBIT(val, loc, sz) (((u64)val) << (64-loc-sz))
19#define INV(d) ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| ((d>>24)&0xff) 19#define INV(d) ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| ((d>>24)&0xff)
20 20
@@ -473,42 +473,42 @@ struct TxFIFO_element {
473 473
474 u64 List_Control; 474 u64 List_Control;
475#define TX_FIFO_LAST_TXD_NUM( val) vBIT(val,0,8) 475#define TX_FIFO_LAST_TXD_NUM( val) vBIT(val,0,8)
476#define TX_FIFO_FIRST_LIST BIT(14) 476#define TX_FIFO_FIRST_LIST s2BIT(14)
477#define TX_FIFO_LAST_LIST BIT(15) 477#define TX_FIFO_LAST_LIST s2BIT(15)
478#define TX_FIFO_FIRSTNLAST_LIST vBIT(3,14,2) 478#define TX_FIFO_FIRSTNLAST_LIST vBIT(3,14,2)
479#define TX_FIFO_SPECIAL_FUNC BIT(23) 479#define TX_FIFO_SPECIAL_FUNC s2BIT(23)
480#define TX_FIFO_DS_NO_SNOOP BIT(31) 480#define TX_FIFO_DS_NO_SNOOP s2BIT(31)
481#define TX_FIFO_BUFF_NO_SNOOP BIT(30) 481#define TX_FIFO_BUFF_NO_SNOOP s2BIT(30)
482}; 482};
483 483
484/* Tx descriptor structure */ 484/* Tx descriptor structure */
485struct TxD { 485struct TxD {
486 u64 Control_1; 486 u64 Control_1;
487/* bit mask */ 487/* bit mask */
488#define TXD_LIST_OWN_XENA BIT(7) 488#define TXD_LIST_OWN_XENA s2BIT(7)
489#define TXD_T_CODE (BIT(12)|BIT(13)|BIT(14)|BIT(15)) 489#define TXD_T_CODE (s2BIT(12)|s2BIT(13)|s2BIT(14)|s2BIT(15))
490#define TXD_T_CODE_OK(val) (|(val & TXD_T_CODE)) 490#define TXD_T_CODE_OK(val) (|(val & TXD_T_CODE))
491#define GET_TXD_T_CODE(val) ((val & TXD_T_CODE)<<12) 491#define GET_TXD_T_CODE(val) ((val & TXD_T_CODE)<<12)
492#define TXD_GATHER_CODE (BIT(22) | BIT(23)) 492#define TXD_GATHER_CODE (s2BIT(22) | s2BIT(23))
493#define TXD_GATHER_CODE_FIRST BIT(22) 493#define TXD_GATHER_CODE_FIRST s2BIT(22)
494#define TXD_GATHER_CODE_LAST BIT(23) 494#define TXD_GATHER_CODE_LAST s2BIT(23)
495#define TXD_TCP_LSO_EN BIT(30) 495#define TXD_TCP_LSO_EN s2BIT(30)
496#define TXD_UDP_COF_EN BIT(31) 496#define TXD_UDP_COF_EN s2BIT(31)
497#define TXD_UFO_EN BIT(31) | BIT(30) 497#define TXD_UFO_EN s2BIT(31) | s2BIT(30)
498#define TXD_TCP_LSO_MSS(val) vBIT(val,34,14) 498#define TXD_TCP_LSO_MSS(val) vBIT(val,34,14)
499#define TXD_UFO_MSS(val) vBIT(val,34,14) 499#define TXD_UFO_MSS(val) vBIT(val,34,14)
500#define TXD_BUFFER0_SIZE(val) vBIT(val,48,16) 500#define TXD_BUFFER0_SIZE(val) vBIT(val,48,16)
501 501
502 u64 Control_2; 502 u64 Control_2;
503#define TXD_TX_CKO_CONTROL (BIT(5)|BIT(6)|BIT(7)) 503#define TXD_TX_CKO_CONTROL (s2BIT(5)|s2BIT(6)|s2BIT(7))
504#define TXD_TX_CKO_IPV4_EN BIT(5) 504#define TXD_TX_CKO_IPV4_EN s2BIT(5)
505#define TXD_TX_CKO_TCP_EN BIT(6) 505#define TXD_TX_CKO_TCP_EN s2BIT(6)
506#define TXD_TX_CKO_UDP_EN BIT(7) 506#define TXD_TX_CKO_UDP_EN s2BIT(7)
507#define TXD_VLAN_ENABLE BIT(15) 507#define TXD_VLAN_ENABLE s2BIT(15)
508#define TXD_VLAN_TAG(val) vBIT(val,16,16) 508#define TXD_VLAN_TAG(val) vBIT(val,16,16)
509#define TXD_INT_NUMBER(val) vBIT(val,34,6) 509#define TXD_INT_NUMBER(val) vBIT(val,34,6)
510#define TXD_INT_TYPE_PER_LIST BIT(47) 510#define TXD_INT_TYPE_PER_LIST s2BIT(47)
511#define TXD_INT_TYPE_UTILZ BIT(46) 511#define TXD_INT_TYPE_UTILZ s2BIT(46)
512#define TXD_SET_MARKER vBIT(0x6,0,4) 512#define TXD_SET_MARKER vBIT(0x6,0,4)
513 513
514 u64 Buffer_Pointer; 514 u64 Buffer_Pointer;
@@ -525,14 +525,14 @@ struct list_info_hold {
525struct RxD_t { 525struct RxD_t {
526 u64 Host_Control; /* reserved for host */ 526 u64 Host_Control; /* reserved for host */
527 u64 Control_1; 527 u64 Control_1;
528#define RXD_OWN_XENA BIT(7) 528#define RXD_OWN_XENA s2BIT(7)
529#define RXD_T_CODE (BIT(12)|BIT(13)|BIT(14)|BIT(15)) 529#define RXD_T_CODE (s2BIT(12)|s2BIT(13)|s2BIT(14)|s2BIT(15))
530#define RXD_FRAME_PROTO vBIT(0xFFFF,24,8) 530#define RXD_FRAME_PROTO vBIT(0xFFFF,24,8)
531#define RXD_FRAME_PROTO_IPV4 BIT(27) 531#define RXD_FRAME_PROTO_IPV4 s2BIT(27)
532#define RXD_FRAME_PROTO_IPV6 BIT(28) 532#define RXD_FRAME_PROTO_IPV6 s2BIT(28)
533#define RXD_FRAME_IP_FRAG BIT(29) 533#define RXD_FRAME_IP_FRAG s2BIT(29)
534#define RXD_FRAME_PROTO_TCP BIT(30) 534#define RXD_FRAME_PROTO_TCP s2BIT(30)
535#define RXD_FRAME_PROTO_UDP BIT(31) 535#define RXD_FRAME_PROTO_UDP s2BIT(31)
536#define TCP_OR_UDP_FRAME (RXD_FRAME_PROTO_TCP | RXD_FRAME_PROTO_UDP) 536#define TCP_OR_UDP_FRAME (RXD_FRAME_PROTO_TCP | RXD_FRAME_PROTO_UDP)
537#define RXD_GET_L3_CKSUM(val) ((u16)(val>> 16) & 0xFFFF) 537#define RXD_GET_L3_CKSUM(val) ((u16)(val>> 16) & 0xFFFF)
538#define RXD_GET_L4_CKSUM(val) ((u16)(val) & 0xFFFF) 538#define RXD_GET_L4_CKSUM(val) ((u16)(val) & 0xFFFF)
@@ -998,26 +998,26 @@ static inline void SPECIAL_REG_WRITE(u64 val, void __iomem *addr, int order)
998/* Interrupt masks for the general interrupt mask register */ 998/* Interrupt masks for the general interrupt mask register */
999#define DISABLE_ALL_INTRS 0xFFFFFFFFFFFFFFFFULL 999#define DISABLE_ALL_INTRS 0xFFFFFFFFFFFFFFFFULL
1000 1000
1001#define TXPIC_INT_M BIT(0) 1001#define TXPIC_INT_M s2BIT(0)
1002#define TXDMA_INT_M BIT(1) 1002#define TXDMA_INT_M s2BIT(1)
1003#define TXMAC_INT_M BIT(2) 1003#define TXMAC_INT_M s2BIT(2)
1004#define TXXGXS_INT_M BIT(3) 1004#define TXXGXS_INT_M s2BIT(3)
1005#define TXTRAFFIC_INT_M BIT(8) 1005#define TXTRAFFIC_INT_M s2BIT(8)
1006#define PIC_RX_INT_M BIT(32) 1006#define PIC_RX_INT_M s2BIT(32)
1007#define RXDMA_INT_M BIT(33) 1007#define RXDMA_INT_M s2BIT(33)
1008#define RXMAC_INT_M BIT(34) 1008#define RXMAC_INT_M s2BIT(34)
1009#define MC_INT_M BIT(35) 1009#define MC_INT_M s2BIT(35)
1010#define RXXGXS_INT_M BIT(36) 1010#define RXXGXS_INT_M s2BIT(36)
1011#define RXTRAFFIC_INT_M BIT(40) 1011#define RXTRAFFIC_INT_M s2BIT(40)
1012 1012
1013/* PIC level Interrupts TODO*/ 1013/* PIC level Interrupts TODO*/
1014 1014
1015/* DMA level Inressupts */ 1015/* DMA level Inressupts */
1016#define TXDMA_PFC_INT_M BIT(0) 1016#define TXDMA_PFC_INT_M s2BIT(0)
1017#define TXDMA_PCC_INT_M BIT(2) 1017#define TXDMA_PCC_INT_M s2BIT(2)
1018 1018
1019/* PFC block interrupts */ 1019/* PFC block interrupts */
1020#define PFC_MISC_ERR_1 BIT(0) /* Interrupt to indicate FIFO full */ 1020#define PFC_MISC_ERR_1 s2BIT(0) /* Interrupt to indicate FIFO full */
1021 1021
1022/* PCC block interrupts. */ 1022/* PCC block interrupts. */
1023#define PCC_FB_ECC_ERR vBIT(0xff, 16, 8) /* Interrupt to indicate 1023#define PCC_FB_ECC_ERR vBIT(0xff, 16, 8) /* Interrupt to indicate
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 7967240534d5..24cfb6275d9b 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1384,13 +1384,9 @@ static int sky2_up(struct net_device *dev)
1384 sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, 1384 sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map,
1385 TX_RING_SIZE - 1); 1385 TX_RING_SIZE - 1);
1386 1386
1387 napi_enable(&hw->napi);
1388
1389 err = sky2_rx_start(sky2); 1387 err = sky2_rx_start(sky2);
1390 if (err) { 1388 if (err)
1391 napi_disable(&hw->napi);
1392 goto err_out; 1389 goto err_out;
1393 }
1394 1390
1395 /* Enable interrupts from phy/mac for port */ 1391 /* Enable interrupts from phy/mac for port */
1396 imask = sky2_read32(hw, B0_IMSK); 1392 imask = sky2_read32(hw, B0_IMSK);
@@ -1679,13 +1675,13 @@ static int sky2_down(struct net_device *dev)
1679 /* Stop more packets from being queued */ 1675 /* Stop more packets from being queued */
1680 netif_stop_queue(dev); 1676 netif_stop_queue(dev);
1681 1677
1682 napi_disable(&hw->napi);
1683
1684 /* Disable port IRQ */ 1678 /* Disable port IRQ */
1685 imask = sky2_read32(hw, B0_IMSK); 1679 imask = sky2_read32(hw, B0_IMSK);
1686 imask &= ~portirq_msk[port]; 1680 imask &= ~portirq_msk[port];
1687 sky2_write32(hw, B0_IMSK, imask); 1681 sky2_write32(hw, B0_IMSK, imask);
1688 1682
1683 synchronize_irq(hw->pdev->irq);
1684
1689 sky2_gmac_reset(hw, port); 1685 sky2_gmac_reset(hw, port);
1690 1686
1691 /* Stop transmitter */ 1687 /* Stop transmitter */
@@ -1699,6 +1695,9 @@ static int sky2_down(struct net_device *dev)
1699 ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA); 1695 ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA);
1700 gma_write16(hw, port, GM_GP_CTRL, ctrl); 1696 gma_write16(hw, port, GM_GP_CTRL, ctrl);
1701 1697
1698 /* Make sure no packets are pending */
1699 napi_synchronize(&hw->napi);
1700
1702 sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); 1701 sky2_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET);
1703 1702
1704 /* Workaround shared GMAC reset */ 1703 /* Workaround shared GMAC reset */
@@ -1736,8 +1735,6 @@ static int sky2_down(struct net_device *dev)
1736 /* turn off LED's */ 1735 /* turn off LED's */
1737 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF); 1736 sky2_write16(hw, B0_Y2LED, LED_STAT_OFF);
1738 1737
1739 synchronize_irq(hw->pdev->irq);
1740
1741 sky2_tx_clean(dev); 1738 sky2_tx_clean(dev);
1742 sky2_rx_clean(sky2); 1739 sky2_rx_clean(sky2);
1743 1740
@@ -2048,9 +2045,6 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
2048 err = sky2_rx_start(sky2); 2045 err = sky2_rx_start(sky2);
2049 sky2_write32(hw, B0_IMSK, imask); 2046 sky2_write32(hw, B0_IMSK, imask);
2050 2047
2051 /* Unconditionally re-enable NAPI because even if we
2052 * call dev_close() that will do a napi_disable().
2053 */
2054 napi_enable(&hw->napi); 2048 napi_enable(&hw->napi);
2055 2049
2056 if (err) 2050 if (err)
@@ -2915,6 +2909,7 @@ static void sky2_restart(struct work_struct *work)
2915 rtnl_lock(); 2909 rtnl_lock();
2916 sky2_write32(hw, B0_IMSK, 0); 2910 sky2_write32(hw, B0_IMSK, 0);
2917 sky2_read32(hw, B0_IMSK); 2911 sky2_read32(hw, B0_IMSK);
2912 napi_disable(&hw->napi);
2918 2913
2919 for (i = 0; i < hw->ports; i++) { 2914 for (i = 0; i < hw->ports; i++) {
2920 dev = hw->dev[i]; 2915 dev = hw->dev[i];
@@ -2924,6 +2919,7 @@ static void sky2_restart(struct work_struct *work)
2924 2919
2925 sky2_reset(hw); 2920 sky2_reset(hw);
2926 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 2921 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
2922 napi_enable(&hw->napi);
2927 2923
2928 for (i = 0; i < hw->ports; i++) { 2924 for (i = 0; i < hw->ports; i++) {
2929 dev = hw->dev[i]; 2925 dev = hw->dev[i];
@@ -3961,7 +3957,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
3961 struct net_device *dev = alloc_etherdev(sizeof(*sky2)); 3957 struct net_device *dev = alloc_etherdev(sizeof(*sky2));
3962 3958
3963 if (!dev) { 3959 if (!dev) {
3964 dev_err(&hw->pdev->dev, "etherdev alloc failed"); 3960 dev_err(&hw->pdev->dev, "etherdev alloc failed\n");
3965 return NULL; 3961 return NULL;
3966 } 3962 }
3967 3963
@@ -4191,7 +4187,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4191 err = -ENOMEM; 4187 err = -ENOMEM;
4192 goto err_out_free_pci; 4188 goto err_out_free_pci;
4193 } 4189 }
4194 netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT);
4195 4190
4196 if (!disable_msi && pci_enable_msi(pdev) == 0) { 4191 if (!disable_msi && pci_enable_msi(pdev) == 0) {
4197 err = sky2_test_msi(hw); 4192 err = sky2_test_msi(hw);
@@ -4207,6 +4202,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4207 goto err_out_free_netdev; 4202 goto err_out_free_netdev;
4208 } 4203 }
4209 4204
4205 netif_napi_add(dev, &hw->napi, sky2_poll, NAPI_WEIGHT);
4206
4210 err = request_irq(pdev->irq, sky2_intr, 4207 err = request_irq(pdev->irq, sky2_intr,
4211 (hw->flags & SKY2_HW_USE_MSI) ? 0 : IRQF_SHARED, 4208 (hw->flags & SKY2_HW_USE_MSI) ? 0 : IRQF_SHARED,
4212 dev->name, hw); 4209 dev->name, hw);
@@ -4215,6 +4212,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4215 goto err_out_unregister; 4212 goto err_out_unregister;
4216 } 4213 }
4217 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 4214 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
4215 napi_enable(&hw->napi);
4218 4216
4219 sky2_show_addr(dev); 4217 sky2_show_addr(dev);
4220 4218
@@ -4265,23 +4263,18 @@ err_out:
4265static void __devexit sky2_remove(struct pci_dev *pdev) 4263static void __devexit sky2_remove(struct pci_dev *pdev)
4266{ 4264{
4267 struct sky2_hw *hw = pci_get_drvdata(pdev); 4265 struct sky2_hw *hw = pci_get_drvdata(pdev);
4268 struct net_device *dev0, *dev1; 4266 int i;
4269 4267
4270 if (!hw) 4268 if (!hw)
4271 return; 4269 return;
4272 4270
4273 del_timer_sync(&hw->watchdog_timer); 4271 del_timer_sync(&hw->watchdog_timer);
4272 cancel_work_sync(&hw->restart_work);
4274 4273
4275 flush_scheduled_work(); 4274 for (i = hw->ports; i >= 0; --i)
4275 unregister_netdev(hw->dev[i]);
4276 4276
4277 sky2_write32(hw, B0_IMSK, 0); 4277 sky2_write32(hw, B0_IMSK, 0);
4278 synchronize_irq(hw->pdev->irq);
4279
4280 dev0 = hw->dev[0];
4281 dev1 = hw->dev[1];
4282 if (dev1)
4283 unregister_netdev(dev1);
4284 unregister_netdev(dev0);
4285 4278
4286 sky2_power_aux(hw); 4279 sky2_power_aux(hw);
4287 4280
@@ -4296,9 +4289,9 @@ static void __devexit sky2_remove(struct pci_dev *pdev)
4296 pci_release_regions(pdev); 4289 pci_release_regions(pdev);
4297 pci_disable_device(pdev); 4290 pci_disable_device(pdev);
4298 4291
4299 if (dev1) 4292 for (i = hw->ports; i >= 0; --i)
4300 free_netdev(dev1); 4293 free_netdev(hw->dev[i]);
4301 free_netdev(dev0); 4294
4302 iounmap(hw->regs); 4295 iounmap(hw->regs);
4303 kfree(hw); 4296 kfree(hw);
4304 4297
@@ -4328,6 +4321,7 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
4328 } 4321 }
4329 4322
4330 sky2_write32(hw, B0_IMSK, 0); 4323 sky2_write32(hw, B0_IMSK, 0);
4324 napi_disable(&hw->napi);
4331 sky2_power_aux(hw); 4325 sky2_power_aux(hw);
4332 4326
4333 pci_save_state(pdev); 4327 pci_save_state(pdev);
@@ -4362,8 +4356,8 @@ static int sky2_resume(struct pci_dev *pdev)
4362 pci_write_config_dword(pdev, PCI_DEV_REG3, 0); 4356 pci_write_config_dword(pdev, PCI_DEV_REG3, 0);
4363 4357
4364 sky2_reset(hw); 4358 sky2_reset(hw);
4365
4366 sky2_write32(hw, B0_IMSK, Y2_IS_BASE); 4359 sky2_write32(hw, B0_IMSK, Y2_IS_BASE);
4360 napi_enable(&hw->napi);
4367 4361
4368 for (i = 0; i < hw->ports; i++) { 4362 for (i = 0; i < hw->ports; i++) {
4369 struct net_device *dev = hw->dev[i]; 4363 struct net_device *dev = hw->dev[i];
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 7c60df46fc65..dd18af0ce676 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -1223,7 +1223,7 @@ static irqreturn_t smc911x_interrupt(int irq, void *dev_id)
1223 } 1223 }
1224#endif 1224#endif
1225 1225
1226 /* Handle PHY interupt condition */ 1226 /* Handle PHY interrupt condition */
1227 if (status & INT_STS_PHY_INT_) { 1227 if (status & INT_STS_PHY_INT_) {
1228 DBG(SMC_DEBUG_MISC, "%s: PHY irq\n", dev->name); 1228 DBG(SMC_DEBUG_MISC, "%s: PHY irq\n", dev->name);
1229 smc911x_phy_interrupt(dev); 1229 smc911x_phy_interrupt(dev);
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index fab055ffcc90..bccae7e5c6ad 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -46,7 +46,7 @@
46#include <linux/vmalloc.h> 46#include <linux/vmalloc.h>
47#include <linux/wait.h> 47#include <linux/wait.h>
48#include <linux/workqueue.h> 48#include <linux/workqueue.h>
49#include <asm/bitops.h> 49#include <linux/bitops.h>
50#include <asm/pci-bridge.h> 50#include <asm/pci-bridge.h>
51#include <net/checksum.h> 51#include <net/checksum.h>
52 52
@@ -1639,7 +1639,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg)
1639 1639
1640/** 1640/**
1641 * spider_net_interrupt - interrupt handler for spider_net 1641 * spider_net_interrupt - interrupt handler for spider_net
1642 * @irq: interupt number 1642 * @irq: interrupt number
1643 * @ptr: pointer to net_device 1643 * @ptr: pointer to net_device
1644 * @regs: PU registers 1644 * @regs: PU registers
1645 * 1645 *
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 8038f2882c9b..d887c05588d5 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -1654,7 +1654,7 @@ tc35815_rx(struct net_device *dev)
1654 panic_queues(dev); 1654 panic_queues(dev);
1655 } 1655 }
1656#endif 1656#endif
1657 /* pass BD to controler */ 1657 /* pass BD to controller */
1658#ifndef TC35815_USE_PACKEDBUFFER 1658#ifndef TC35815_USE_PACKEDBUFFER
1659 if (!lp->rx_skbs[curid].skb) { 1659 if (!lp->rx_skbs[curid].skb) {
1660 lp->rx_skbs[curid].skb = 1660 lp->rx_skbs[curid].skb =
@@ -1694,7 +1694,7 @@ tc35815_rx(struct net_device *dev)
1694 } 1694 }
1695#endif 1695#endif
1696 for (i = 0; i < (bd_count + 1) / 2 + 1; i++) { 1696 for (i = 0; i < (bd_count + 1) / 2 + 1; i++) {
1697 /* pass FD to controler */ 1697 /* pass FD to controller */
1698#ifdef DEBUG 1698#ifdef DEBUG
1699 lp->rfd_cur->fd.FDNext = cpu_to_le32(0xdeaddead); 1699 lp->rfd_cur->fd.FDNext = cpu_to_le32(0xdeaddead);
1700#else 1700#else
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c
index df10af7df7b8..35d15e850075 100644
--- a/drivers/net/tsi108_eth.c
+++ b/drivers/net/tsi108_eth.c
@@ -1629,7 +1629,7 @@ tsi108_init_one(struct platform_device *pdev)
1629 goto register_fail; 1629 goto register_fail;
1630 } 1630 }
1631 1631
1632 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n" 1632 printk(KERN_INFO "%s: Tsi108 Gigabit Ethernet, MAC: %s\n",
1633 dev->name, print_mac(mac, dev->dev_addr)); 1633 dev->name, print_mac(mac, dev->dev_addr));
1634#ifdef DEBUG 1634#ifdef DEBUG
1635 data->msg_enable = DEBUG; 1635 data->msg_enable = DEBUG;
diff --git a/drivers/net/tulip/Kconfig b/drivers/net/tulip/Kconfig
index 1c537d5a3062..49d7a290dbbc 100644
--- a/drivers/net/tulip/Kconfig
+++ b/drivers/net/tulip/Kconfig
@@ -67,7 +67,7 @@ config TULIP_MMIO
67 If in doubt, say N. 67 If in doubt, say N.
68 68
69config TULIP_NAPI 69config TULIP_NAPI
70 bool "Use NAPI RX polling " 70 bool "Use RX polling (NAPI)"
71 depends on TULIP 71 depends on TULIP
72 help 72 help
73 NAPI is a new driver API designed to reduce CPU and interrupt load 73 NAPI is a new driver API designed to reduce CPU and interrupt load
@@ -78,18 +78,16 @@ config TULIP_NAPI
78 deployed on potentially unfriendly networks (e.g. in a firewall), 78 deployed on potentially unfriendly networks (e.g. in a firewall),
79 then say Y here. 79 then say Y here.
80 80
81 See <file:Documentation/networking/NAPI_HOWTO.txt> for more
82 information.
83
84 If in doubt, say N. 81 If in doubt, say N.
85 82
86config TULIP_NAPI_HW_MITIGATION 83config TULIP_NAPI_HW_MITIGATION
87 bool "Use Interrupt Mitigation " 84 bool "Use Interrupt Mitigation"
88 depends on TULIP_NAPI 85 depends on TULIP_NAPI
89 ---help--- 86 ---help---
90 Use HW to reduce RX interrupts. Not strict necessary since NAPI reduces 87 Use HW to reduce RX interrupts. Not strictly necessary since NAPI
91 RX interrupts but itself. Although this reduces RX interrupts even at 88 reduces RX interrupts by itself. Interrupt mitigation reduces RX
92 low levels traffic at the cost of a small latency. 89 interrupts even at low levels of traffic at the cost of a small
90 latency.
93 91
94 If in doubt, say Y. 92 If in doubt, say Y.
95 93
diff --git a/drivers/net/tulip/uli526x.c b/drivers/net/tulip/uli526x.c
index 76e55612430b..a7afeea156bd 100644
--- a/drivers/net/tulip/uli526x.c
+++ b/drivers/net/tulip/uli526x.c
@@ -34,9 +34,9 @@
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/spinlock.h> 35#include <linux/spinlock.h>
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <linux/bitops.h>
37 38
38#include <asm/processor.h> 39#include <asm/processor.h>
39#include <asm/bitops.h>
40#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/dma.h> 41#include <asm/dma.h>
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
index 3c8e3b63be07..35d0cfcf8c47 100644
--- a/drivers/net/tulip/winbond-840.c
+++ b/drivers/net/tulip/winbond-840.c
@@ -483,7 +483,7 @@ err_out_netdev:
483 a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that 483 a delay. Note that pre-2.0.34 kernels had a cache-alignment bug that
484 made udelay() unreliable. 484 made udelay() unreliable.
485 The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is 485 The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is
486 depricated. 486 deprecated.
487*/ 487*/
488#define eeprom_delay(ee_addr) ioread32(ee_addr) 488#define eeprom_delay(ee_addr) ioread32(ee_addr)
489 489
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 8dc09a3790cb..5a96d74e4ce8 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -71,7 +71,7 @@ config USB_PEGASUS
71 select MII 71 select MII
72 ---help--- 72 ---help---
73 Say Y here if you know you have Pegasus or Pegasus-II based adapter. 73 Say Y here if you know you have Pegasus or Pegasus-II based adapter.
74 If in doubt then look at <file:drivers/usb/net/pegasus.h> for the 74 If in doubt then look at <file:drivers/net/usb/pegasus.h> for the
75 complete list of supported devices. 75 complete list of supported devices.
76 76
77 If your particular adapter is not in the list and you are _sure_ it 77 If your particular adapter is not in the list and you are _sure_ it
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 6240b978fe3d..f55a5951733a 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -114,8 +114,8 @@ static void mcs7830_async_cmd_callback(struct urb *urb)
114 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; 114 struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
115 115
116 if (urb->status < 0) 116 if (urb->status < 0)
117 printk(KERN_DEBUG "mcs7830_async_cmd_callback() failed with %d", 117 printk(KERN_DEBUG "%s() failed with %d\n",
118 urb->status); 118 __FUNCTION__, urb->status);
119 119
120 kfree(req); 120 kfree(req);
121 usb_free_urb(urb); 121 usb_free_urb(urb);
@@ -129,15 +129,15 @@ static void mcs7830_set_reg_async(struct usbnet *dev, u16 index, u16 size, void
129 129
130 urb = usb_alloc_urb(0, GFP_ATOMIC); 130 urb = usb_alloc_urb(0, GFP_ATOMIC);
131 if (!urb) { 131 if (!urb) {
132 dev_dbg(&dev->udev->dev, "Error allocating URB " 132 dev_dbg(&dev->udev->dev,
133 "in write_cmd_async!"); 133 "Error allocating URB in write_cmd_async!\n");
134 return; 134 return;
135 } 135 }
136 136
137 req = kmalloc(sizeof *req, GFP_ATOMIC); 137 req = kmalloc(sizeof *req, GFP_ATOMIC);
138 if (!req) { 138 if (!req) {
139 dev_err(&dev->udev->dev, "Failed to allocate memory for " 139 dev_err(&dev->udev->dev,
140 "control request"); 140 "Failed to allocate memory for control request\n");
141 goto out; 141 goto out;
142 } 142 }
143 req->bRequestType = MCS7830_WR_BMREQ; 143 req->bRequestType = MCS7830_WR_BMREQ;
@@ -153,8 +153,8 @@ static void mcs7830_set_reg_async(struct usbnet *dev, u16 index, u16 size, void
153 153
154 ret = usb_submit_urb(urb, GFP_ATOMIC); 154 ret = usb_submit_urb(urb, GFP_ATOMIC);
155 if (ret < 0) { 155 if (ret < 0) {
156 dev_err(&dev->udev->dev, "Error submitting the control " 156 dev_err(&dev->udev->dev,
157 "message: ret=%d", ret); 157 "Error submitting the control message: ret=%d\n", ret);
158 goto out; 158 goto out;
159 } 159 }
160 return; 160 return;
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 4ae05799ac44..5c4a92de9a07 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -1648,7 +1648,7 @@ static int velocity_alloc_rx_buf(struct velocity_info *vptr, int idx)
1648 * 1648 *
1649 * Scan the queues looking for transmitted packets that 1649 * Scan the queues looking for transmitted packets that
1650 * we can complete and clean up. Update any statistics as 1650 * we can complete and clean up. Update any statistics as
1651 * neccessary/ 1651 * necessary/
1652 */ 1652 */
1653 1653
1654static int velocity_tx_srv(struct velocity_info *vptr, u32 status) 1654static int velocity_tx_srv(struct velocity_info *vptr, u32 status)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index c141a264ac45..9d9ff76a9bc6 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -49,7 +49,6 @@
49#include "pio.h" 49#include "pio.h"
50#include "sysfs.h" 50#include "sysfs.h"
51#include "xmit.h" 51#include "xmit.h"
52#include "sysfs.h"
53#include "lo.h" 52#include "lo.h"
54#include "pcmcia.h" 53#include "pcmcia.h"
55 54
@@ -3495,7 +3494,7 @@ static int b43_start(struct ieee80211_hw *hw)
3495 struct b43_wl *wl = hw_to_b43_wl(hw); 3494 struct b43_wl *wl = hw_to_b43_wl(hw);
3496 struct b43_wldev *dev = wl->current_dev; 3495 struct b43_wldev *dev = wl->current_dev;
3497 int did_init = 0; 3496 int did_init = 0;
3498 int err; 3497 int err = 0;
3499 3498
3500 mutex_lock(&wl->mutex); 3499 mutex_lock(&wl->mutex);
3501 3500
@@ -3521,7 +3520,7 @@ static int b43_start(struct ieee80211_hw *hw)
3521 return err; 3520 return err;
3522} 3521}
3523 3522
3524void b43_stop(struct ieee80211_hw *hw) 3523static void b43_stop(struct ieee80211_hw *hw)
3525{ 3524{
3526 struct b43_wl *wl = hw_to_b43_wl(hw); 3525 struct b43_wl *wl = hw_to_b43_wl(hw);
3527 struct b43_wldev *dev = wl->current_dev; 3526 struct b43_wldev *dev = wl->current_dev;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index f0749510bcd7..d09479e816cd 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -3306,7 +3306,7 @@ static int b43legacy_start(struct ieee80211_hw *hw)
3306 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); 3306 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
3307 struct b43legacy_wldev *dev = wl->current_dev; 3307 struct b43legacy_wldev *dev = wl->current_dev;
3308 int did_init = 0; 3308 int did_init = 0;
3309 int err; 3309 int err = 0;
3310 3310
3311 mutex_lock(&wl->mutex); 3311 mutex_lock(&wl->mutex);
3312 3312
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
index 8f198befba39..cb51dc51cce6 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
@@ -29,7 +29,7 @@
29#include "bcm43xx_radio.h" 29#include "bcm43xx_radio.h"
30#include "bcm43xx.h" 30#include "bcm43xx.h"
31 31
32#include <asm/bitops.h> 32#include <linux/bitops.h>
33 33
34 34
35static void bcm43xx_led_changestate(struct bcm43xx_led *led) 35static void bcm43xx_led_changestate(struct bcm43xx_led *led)
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.h b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.h
index 9ecf2bf0d25d..47c135a7f4dc 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.h
@@ -87,7 +87,7 @@ void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm,
87 87
88/* RX header as received from the hardware. */ 88/* RX header as received from the hardware. */
89struct bcm43xx_rxhdr { 89struct bcm43xx_rxhdr {
90 /* Frame Length. Must be generated explicitely in PIO mode. */ 90 /* Frame Length. Must be generated explicitly in PIO mode. */
91 __le16 frame_length; 91 __le16 frame_length;
92 PAD_BYTES(2); 92 PAD_BYTES(2);
93 /* Flags field 1 */ 93 /* Flags field 1 */
diff --git a/drivers/net/wireless/hostap/hostap_common.h b/drivers/net/wireless/hostap/hostap_common.h
index ceb7f1e5e9e0..517f89845144 100644
--- a/drivers/net/wireless/hostap/hostap_common.h
+++ b/drivers/net/wireless/hostap/hostap_common.h
@@ -4,9 +4,6 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/if_ether.h> 5#include <linux/if_ether.h>
6 6
7#define BIT(x) (1 << (x))
8
9
10/* IEEE 802.11 defines */ 7/* IEEE 802.11 defines */
11 8
12/* Information Element IDs */ 9/* Information Element IDs */
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 40f516d42c5e..d8f5efcfcab9 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -2920,7 +2920,7 @@ static int prism2_ioctl_priv_monitor(struct net_device *dev, int *i)
2920 2920
2921 printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor " 2921 printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor "
2922 "- update software to use iwconfig mode monitor\n", 2922 "- update software to use iwconfig mode monitor\n",
2923 dev->name, current->pid, current->comm); 2923 dev->name, task_pid_nr(current), current->comm);
2924 2924
2925 /* Backward compatibility code - this can be removed at some point */ 2925 /* Backward compatibility code - this can be removed at some point */
2926 2926
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index 2d46a16c0945..a6c7904de282 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -1858,14 +1858,6 @@ static void ipw2100_down(struct ipw2100_priv *priv)
1858 1858
1859 modify_acceptable_latency("ipw2100", INFINITE_LATENCY); 1859 modify_acceptable_latency("ipw2100", INFINITE_LATENCY);
1860 1860
1861#ifdef ACPI_CSTATE_LIMIT_DEFINED
1862 if (priv->config & CFG_C3_DISABLED) {
1863 IPW_DEBUG_INFO(": Resetting C3 transitions.\n");
1864 acpi_set_cstate_limit(priv->cstate_limit);
1865 priv->config &= ~CFG_C3_DISABLED;
1866 }
1867#endif
1868
1869 /* We have to signal any supplicant if we are disassociating */ 1861 /* We have to signal any supplicant if we are disassociating */
1870 if (associated) 1862 if (associated)
1871 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL); 1863 wireless_send_event(priv->net_dev, SIOCGIWAP, &wrqu, NULL);
@@ -2091,26 +2083,52 @@ static void isr_indicate_rf_kill(struct ipw2100_priv *priv, u32 status)
2091 /* RF_KILL is now enabled (else we wouldn't be here) */ 2083 /* RF_KILL is now enabled (else we wouldn't be here) */
2092 priv->status |= STATUS_RF_KILL_HW; 2084 priv->status |= STATUS_RF_KILL_HW;
2093 2085
2094#ifdef ACPI_CSTATE_LIMIT_DEFINED
2095 if (priv->config & CFG_C3_DISABLED) {
2096 IPW_DEBUG_INFO(": Resetting C3 transitions.\n");
2097 acpi_set_cstate_limit(priv->cstate_limit);
2098 priv->config &= ~CFG_C3_DISABLED;
2099 }
2100#endif
2101
2102 /* Make sure the RF Kill check timer is running */ 2086 /* Make sure the RF Kill check timer is running */
2103 priv->stop_rf_kill = 0; 2087 priv->stop_rf_kill = 0;
2104 cancel_delayed_work(&priv->rf_kill); 2088 cancel_delayed_work(&priv->rf_kill);
2105 queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ)); 2089 queue_delayed_work(priv->workqueue, &priv->rf_kill, round_jiffies(HZ));
2106} 2090}
2107 2091
2092static void send_scan_event(void *data)
2093{
2094 struct ipw2100_priv *priv = data;
2095 union iwreq_data wrqu;
2096
2097 wrqu.data.length = 0;
2098 wrqu.data.flags = 0;
2099 wireless_send_event(priv->net_dev, SIOCGIWSCAN, &wrqu, NULL);
2100}
2101
2102static void ipw2100_scan_event_later(struct work_struct *work)
2103{
2104 send_scan_event(container_of(work, struct ipw2100_priv,
2105 scan_event_later.work));
2106}
2107
2108static void ipw2100_scan_event_now(struct work_struct *work)
2109{
2110 send_scan_event(container_of(work, struct ipw2100_priv,
2111 scan_event_now));
2112}
2113
2108static void isr_scan_complete(struct ipw2100_priv *priv, u32 status) 2114static void isr_scan_complete(struct ipw2100_priv *priv, u32 status)
2109{ 2115{
2110 IPW_DEBUG_SCAN("scan complete\n"); 2116 IPW_DEBUG_SCAN("scan complete\n");
2111 /* Age the scan results... */ 2117 /* Age the scan results... */
2112 priv->ieee->scans++; 2118 priv->ieee->scans++;
2113 priv->status &= ~STATUS_SCANNING; 2119 priv->status &= ~STATUS_SCANNING;
2120
2121 /* Only userspace-requested scan completion events go out immediately */
2122 if (!priv->user_requested_scan) {
2123 if (!delayed_work_pending(&priv->scan_event_later))
2124 queue_delayed_work(priv->workqueue,
2125 &priv->scan_event_later,
2126 round_jiffies(msecs_to_jiffies(4000)));
2127 } else {
2128 priv->user_requested_scan = 0;
2129 cancel_delayed_work(&priv->scan_event_later);
2130 queue_work(priv->workqueue, &priv->scan_event_now);
2131 }
2114} 2132}
2115 2133
2116#ifdef CONFIG_IPW2100_DEBUG 2134#ifdef CONFIG_IPW2100_DEBUG
@@ -2329,23 +2347,10 @@ static void ipw2100_corruption_detected(struct ipw2100_priv *priv, int i)
2329 u32 match, reg; 2347 u32 match, reg;
2330 int j; 2348 int j;
2331#endif 2349#endif
2332#ifdef ACPI_CSTATE_LIMIT_DEFINED
2333 int limit;
2334#endif
2335 2350
2336 IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n", 2351 IPW_DEBUG_INFO(": PCI latency error detected at 0x%04zX.\n",
2337 i * sizeof(struct ipw2100_status)); 2352 i * sizeof(struct ipw2100_status));
2338 2353
2339#ifdef ACPI_CSTATE_LIMIT_DEFINED
2340 IPW_DEBUG_INFO(": Disabling C3 transitions.\n");
2341 limit = acpi_get_cstate_limit();
2342 if (limit > 2) {
2343 priv->cstate_limit = limit;
2344 acpi_set_cstate_limit(2);
2345 priv->config |= CFG_C3_DISABLED;
2346 }
2347#endif
2348
2349#ifdef IPW2100_DEBUG_C3 2354#ifdef IPW2100_DEBUG_C3
2350 /* Halt the fimrware so we can get a good image */ 2355 /* Halt the fimrware so we can get a good image */
2351 write_register(priv->net_dev, IPW_REG_RESET_REG, 2356 write_register(priv->net_dev, IPW_REG_RESET_REG,
@@ -4378,6 +4383,7 @@ static void ipw2100_kill_workqueue(struct ipw2100_priv *priv)
4378 cancel_delayed_work(&priv->wx_event_work); 4383 cancel_delayed_work(&priv->wx_event_work);
4379 cancel_delayed_work(&priv->hang_check); 4384 cancel_delayed_work(&priv->hang_check);
4380 cancel_delayed_work(&priv->rf_kill); 4385 cancel_delayed_work(&priv->rf_kill);
4386 cancel_delayed_work(&priv->scan_event_later);
4381 destroy_workqueue(priv->workqueue); 4387 destroy_workqueue(priv->workqueue);
4382 priv->workqueue = NULL; 4388 priv->workqueue = NULL;
4383 } 4389 }
@@ -6041,7 +6047,7 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6041 * ends up causing problems. So, we just handle 6047 * ends up causing problems. So, we just handle
6042 * the WX extensions through the ipw2100_ioctl interface */ 6048 * the WX extensions through the ipw2100_ioctl interface */
6043 6049
6044 /* memset() puts everything to 0, so we only have explicitely set 6050 /* memset() puts everything to 0, so we only have explicitly set
6045 * those values that need to be something else */ 6051 * those values that need to be something else */
6046 6052
6047 /* If power management is turned on, default to AUTO mode */ 6053 /* If power management is turned on, default to AUTO mode */
@@ -6121,6 +6127,8 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev,
6121 INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work); 6127 INIT_DELAYED_WORK(&priv->wx_event_work, ipw2100_wx_event_work);
6122 INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check); 6128 INIT_DELAYED_WORK(&priv->hang_check, ipw2100_hang_check);
6123 INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill); 6129 INIT_DELAYED_WORK(&priv->rf_kill, ipw2100_rf_kill);
6130 INIT_WORK(&priv->scan_event_now, ipw2100_scan_event_now);
6131 INIT_DELAYED_WORK(&priv->scan_event_later, ipw2100_scan_event_later);
6124 6132
6125 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long)) 6133 tasklet_init(&priv->irq_tasklet, (void (*)(unsigned long))
6126 ipw2100_irq_tasklet, (unsigned long)priv); 6134 ipw2100_irq_tasklet, (unsigned long)priv);
@@ -7425,6 +7433,8 @@ static int ipw2100_wx_set_scan(struct net_device *dev,
7425 } 7433 }
7426 7434
7427 IPW_DEBUG_WX("Initiating scan...\n"); 7435 IPW_DEBUG_WX("Initiating scan...\n");
7436
7437 priv->user_requested_scan = 1;
7428 if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) { 7438 if (ipw2100_set_scan_options(priv) || ipw2100_start_scan(priv)) {
7429 IPW_DEBUG_WX("Start scan failed.\n"); 7439 IPW_DEBUG_WX("Start scan failed.\n");
7430 7440
@@ -7499,7 +7509,7 @@ static int ipw2100_wx_set_power(struct net_device *dev,
7499 switch (wrqu->power.flags & IW_POWER_MODE) { 7509 switch (wrqu->power.flags & IW_POWER_MODE) {
7500 case IW_POWER_ON: /* If not specified */ 7510 case IW_POWER_ON: /* If not specified */
7501 case IW_POWER_MODE: /* If set all mask */ 7511 case IW_POWER_MODE: /* If set all mask */
7502 case IW_POWER_ALL_R: /* If explicitely state all */ 7512 case IW_POWER_ALL_R: /* If explicitly state all */
7503 break; 7513 break;
7504 default: /* Otherwise we don't support it */ 7514 default: /* Otherwise we don't support it */
7505 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", 7515 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n",
diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h
index de7d384d38af..bbf1ddcafba8 100644
--- a/drivers/net/wireless/ipw2100.h
+++ b/drivers/net/wireless/ipw2100.h
@@ -479,7 +479,6 @@ enum {
479#define CFG_ASSOCIATE (1<<6) 479#define CFG_ASSOCIATE (1<<6)
480#define CFG_FIXED_RATE (1<<7) 480#define CFG_FIXED_RATE (1<<7)
481#define CFG_ADHOC_CREATE (1<<8) 481#define CFG_ADHOC_CREATE (1<<8)
482#define CFG_C3_DISABLED (1<<9)
483#define CFG_PASSIVE_SCAN (1<<10) 482#define CFG_PASSIVE_SCAN (1<<10)
484#ifdef CONFIG_IPW2100_MONITOR 483#ifdef CONFIG_IPW2100_MONITOR
485#define CFG_CRC_CHECK (1<<11) 484#define CFG_CRC_CHECK (1<<11)
@@ -508,7 +507,6 @@ struct ipw2100_priv {
508 u8 bssid[ETH_ALEN]; 507 u8 bssid[ETH_ALEN];
509 u8 channel; 508 u8 channel;
510 int last_mode; 509 int last_mode;
511 int cstate_limit;
512 510
513 unsigned long connect_start; 511 unsigned long connect_start;
514 unsigned long last_reset; 512 unsigned long last_reset;
@@ -588,6 +586,10 @@ struct ipw2100_priv {
588 struct delayed_work wx_event_work; 586 struct delayed_work wx_event_work;
589 struct delayed_work hang_check; 587 struct delayed_work hang_check;
590 struct delayed_work rf_kill; 588 struct delayed_work rf_kill;
589 struct work_struct scan_event_now;
590 struct delayed_work scan_event_later;
591
592 int user_requested_scan;
591 593
592 u32 interrupts; 594 u32 interrupts;
593 int tx_interrupts; 595 int tx_interrupts;
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index feb8fcbab2d5..e3c828401b9a 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -9603,7 +9603,7 @@ static int ipw_wx_set_power(struct net_device *dev,
9603 switch (wrqu->power.flags & IW_POWER_MODE) { 9603 switch (wrqu->power.flags & IW_POWER_MODE) {
9604 case IW_POWER_ON: /* If not specified */ 9604 case IW_POWER_ON: /* If not specified */
9605 case IW_POWER_MODE: /* If set all mask */ 9605 case IW_POWER_MODE: /* If set all mask */
9606 case IW_POWER_ALL_R: /* If explicitely state all */ 9606 case IW_POWER_ALL_R: /* If explicitly state all */
9607 break; 9607 break;
9608 default: /* Otherwise we don't support it */ 9608 default: /* Otherwise we don't support it */
9609 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n", 9609 IPW_DEBUG_WX("SET PM Mode: %X not supported.\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index f4aabcf480e4..262ab0b55824 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -37,9 +37,6 @@
37 37
38#include <linux/workqueue.h> 38#include <linux/workqueue.h>
39 39
40#include <net/mac80211.h>
41#include <linux/wireless.h>
42
43#define IWL 3945 40#define IWL 3945
44 41
45#include "../net/mac80211/ieee80211_rate.h" 42#include "../net/mac80211/ieee80211_rate.h"
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index acb38750535f..19bcb01e2784 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -38,7 +38,6 @@
38#include <net/mac80211.h> 38#include <net/mac80211.h>
39 39
40#include <linux/etherdevice.h> 40#include <linux/etherdevice.h>
41#include <linux/delay.h>
42 41
43#define IWL 3945 42#define IWL 3945
44 43
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 287c75705c44..8dc78c0bf1ff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -36,9 +36,6 @@
36 36
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38 38
39#include <net/mac80211.h>
40#include <linux/wireless.h>
41
42#define IWL 4965 39#define IWL 4965
43 40
44#include "../net/mac80211/ieee80211_rate.h" 41#include "../net/mac80211/ieee80211_rate.h"
@@ -2024,12 +2021,18 @@ static int open_file_generic(struct inode *inode, struct file *file)
2024static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv, 2021static void rs_dbgfs_set_mcs(struct iwl_rate_scale_priv *rs_priv,
2025 struct iwl_rate *mcs, int index) 2022 struct iwl_rate *mcs, int index)
2026{ 2023{
2027 const u32 cck_rate = 0x820A; 2024 u32 base_rate;
2025
2026 if (rs_priv->phymode == (u8) MODE_IEEE80211A)
2027 base_rate = 0x800D;
2028 else
2029 base_rate = 0x820A;
2030
2028 if (rs_priv->dbg_fixed.rate_n_flags) { 2031 if (rs_priv->dbg_fixed.rate_n_flags) {
2029 if (index < 12) 2032 if (index < 12)
2030 mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags; 2033 mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags;
2031 else 2034 else
2032 mcs->rate_n_flags = cck_rate; 2035 mcs->rate_n_flags = base_rate;
2033 IWL_DEBUG_RATE("Fixed rate ON\n"); 2036 IWL_DEBUG_RATE("Fixed rate ON\n");
2034 return; 2037 return;
2035 } 2038 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index b50d20267c8a..557deebca1b9 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -35,9 +35,7 @@
35#include <linux/netdevice.h> 35#include <linux/netdevice.h>
36#include <linux/wireless.h> 36#include <linux/wireless.h>
37#include <net/mac80211.h> 37#include <net/mac80211.h>
38#include <linux/netdevice.h>
39#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
40#include <linux/delay.h>
41 39
42#define IWL 4965 40#define IWL 4965
43 41
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 75e3b5c3f155..83019d1d7ccc 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -48,8 +48,6 @@
48#include <linux/netdevice.h> 48#include <linux/netdevice.h>
49#include <linux/wireless.h> 49#include <linux/wireless.h>
50#include <linux/firmware.h> 50#include <linux/firmware.h>
51#include <linux/skbuff.h>
52#include <linux/netdevice.h>
53#include <linux/etherdevice.h> 51#include <linux/etherdevice.h>
54#include <linux/if_arp.h> 52#include <linux/if_arp.h>
55 53
@@ -1749,21 +1747,22 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv)
1749 * return : set the bit for each supported rate insert in ie 1747 * return : set the bit for each supported rate insert in ie
1750 */ 1748 */
1751static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, 1749static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1752 u16 basic_rate, int max_count) 1750 u16 basic_rate, int *left)
1753{ 1751{
1754 u16 ret_rates = 0, bit; 1752 u16 ret_rates = 0, bit;
1755 int i; 1753 int i;
1756 u8 *rates; 1754 u8 *cnt = ie;
1757 1755 u8 *rates = ie + 1;
1758 rates = &(ie[1]);
1759 1756
1760 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { 1757 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) {
1761 if (bit & supported_rate) { 1758 if (bit & supported_rate) {
1762 ret_rates |= bit; 1759 ret_rates |= bit;
1763 rates[*ie] = iwl_rates[i].ieee | 1760 rates[*cnt] = iwl_rates[i].ieee |
1764 ((bit & basic_rate) ? 0x80 : 0x00); 1761 ((bit & basic_rate) ? 0x80 : 0x00);
1765 *ie = *ie + 1; 1762 (*cnt)++;
1766 if (*ie >= max_count) 1763 (*left)--;
1764 if ((*left <= 0) ||
1765 (*cnt >= IWL_SUPPORTED_RATES_IE_LEN))
1767 break; 1766 break;
1768 } 1767 }
1769 } 1768 }
@@ -1780,7 +1779,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1780{ 1779{
1781 int len = 0; 1780 int len = 0;
1782 u8 *pos = NULL; 1781 u8 *pos = NULL;
1783 u16 ret_rates; 1782 u16 active_rates, ret_rates, cck_rates;
1784 1783
1785 /* Make sure there is enough space for the probe request, 1784 /* Make sure there is enough space for the probe request,
1786 * two mandatory IEs and the data */ 1785 * two mandatory IEs and the data */
@@ -1825,19 +1824,27 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1825 left -= 2; 1824 left -= 2;
1826 if (left < 0) 1825 if (left < 0)
1827 return 0; 1826 return 0;
1827
1828 /* ... fill it in... */ 1828 /* ... fill it in... */
1829 *pos++ = WLAN_EID_SUPP_RATES; 1829 *pos++ = WLAN_EID_SUPP_RATES;
1830 *pos = 0; 1830 *pos = 0;
1831 ret_rates = priv->active_rate = priv->rates_mask; 1831
1832 priv->active_rate = priv->rates_mask;
1833 active_rates = priv->active_rate;
1832 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 1834 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
1833 1835
1834 iwl_supported_rate_to_ie(pos, priv->active_rate, 1836 cck_rates = IWL_CCK_RATES_MASK & active_rates;
1835 priv->active_rate_basic, left); 1837 ret_rates = iwl_supported_rate_to_ie(pos, cck_rates,
1838 priv->active_rate_basic, &left);
1839 active_rates &= ~ret_rates;
1840
1841 ret_rates = iwl_supported_rate_to_ie(pos, active_rates,
1842 priv->active_rate_basic, &left);
1843 active_rates &= ~ret_rates;
1844
1836 len += 2 + *pos; 1845 len += 2 + *pos;
1837 pos += (*pos) + 1; 1846 pos += (*pos) + 1;
1838 ret_rates = ~ret_rates & priv->active_rate; 1847 if (active_rates == 0)
1839
1840 if (ret_rates == 0)
1841 goto fill_end; 1848 goto fill_end;
1842 1849
1843 /* fill in supported extended rate */ 1850 /* fill in supported extended rate */
@@ -1848,7 +1855,8 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1848 /* ... fill it in... */ 1855 /* ... fill it in... */
1849 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1856 *pos++ = WLAN_EID_EXT_SUPP_RATES;
1850 *pos = 0; 1857 *pos = 0;
1851 iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); 1858 iwl_supported_rate_to_ie(pos, active_rates,
1859 priv->active_rate_basic, &left);
1852 if (*pos > 0) 1860 if (*pos > 0)
1853 len += 2 + *pos; 1861 len += 2 + *pos;
1854 1862
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index b1a6e39f7821..5e1279263b22 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -48,8 +48,6 @@
48#include <linux/netdevice.h> 48#include <linux/netdevice.h>
49#include <linux/wireless.h> 49#include <linux/wireless.h>
50#include <linux/firmware.h> 50#include <linux/firmware.h>
51#include <linux/skbuff.h>
52#include <linux/netdevice.h>
53#include <linux/etherdevice.h> 51#include <linux/etherdevice.h>
54#include <linux/if_arp.h> 52#include <linux/if_arp.h>
55 53
@@ -1802,21 +1800,22 @@ static void iwl_unset_hw_setting(struct iwl_priv *priv)
1802 * return : set the bit for each supported rate insert in ie 1800 * return : set the bit for each supported rate insert in ie
1803 */ 1801 */
1804static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate, 1802static u16 iwl_supported_rate_to_ie(u8 *ie, u16 supported_rate,
1805 u16 basic_rate, int max_count) 1803 u16 basic_rate, int *left)
1806{ 1804{
1807 u16 ret_rates = 0, bit; 1805 u16 ret_rates = 0, bit;
1808 int i; 1806 int i;
1809 u8 *rates; 1807 u8 *cnt = ie;
1810 1808 u8 *rates = ie + 1;
1811 rates = &(ie[1]);
1812 1809
1813 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) { 1810 for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) {
1814 if (bit & supported_rate) { 1811 if (bit & supported_rate) {
1815 ret_rates |= bit; 1812 ret_rates |= bit;
1816 rates[*ie] = iwl_rates[i].ieee | 1813 rates[*cnt] = iwl_rates[i].ieee |
1817 ((bit & basic_rate) ? 0x80 : 0x00); 1814 ((bit & basic_rate) ? 0x80 : 0x00);
1818 *ie = *ie + 1; 1815 (*cnt)++;
1819 if (*ie >= max_count) 1816 (*left)--;
1817 if ((*left <= 0) ||
1818 (*cnt >= IWL_SUPPORTED_RATES_IE_LEN))
1820 break; 1819 break;
1821 } 1820 }
1822 } 1821 }
@@ -1839,7 +1838,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1839{ 1838{
1840 int len = 0; 1839 int len = 0;
1841 u8 *pos = NULL; 1840 u8 *pos = NULL;
1842 u16 ret_rates; 1841 u16 active_rates, ret_rates, cck_rates;
1843 1842
1844 /* Make sure there is enough space for the probe request, 1843 /* Make sure there is enough space for the probe request,
1845 * two mandatory IEs and the data */ 1844 * two mandatory IEs and the data */
@@ -1884,19 +1883,27 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1884 left -= 2; 1883 left -= 2;
1885 if (left < 0) 1884 if (left < 0)
1886 return 0; 1885 return 0;
1886
1887 /* ... fill it in... */ 1887 /* ... fill it in... */
1888 *pos++ = WLAN_EID_SUPP_RATES; 1888 *pos++ = WLAN_EID_SUPP_RATES;
1889 *pos = 0; 1889 *pos = 0;
1890 ret_rates = priv->active_rate = priv->rates_mask; 1890
1891 priv->active_rate = priv->rates_mask;
1892 active_rates = priv->active_rate;
1891 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK; 1893 priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
1892 1894
1893 iwl_supported_rate_to_ie(pos, priv->active_rate, 1895 cck_rates = IWL_CCK_RATES_MASK & active_rates;
1894 priv->active_rate_basic, left); 1896 ret_rates = iwl_supported_rate_to_ie(pos, cck_rates,
1897 priv->active_rate_basic, &left);
1898 active_rates &= ~ret_rates;
1899
1900 ret_rates = iwl_supported_rate_to_ie(pos, active_rates,
1901 priv->active_rate_basic, &left);
1902 active_rates &= ~ret_rates;
1903
1895 len += 2 + *pos; 1904 len += 2 + *pos;
1896 pos += (*pos) + 1; 1905 pos += (*pos) + 1;
1897 ret_rates = ~ret_rates & priv->active_rate; 1906 if (active_rates == 0)
1898
1899 if (ret_rates == 0)
1900 goto fill_end; 1907 goto fill_end;
1901 1908
1902 /* fill in supported extended rate */ 1909 /* fill in supported extended rate */
@@ -1907,7 +1914,8 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
1907 /* ... fill it in... */ 1914 /* ... fill it in... */
1908 *pos++ = WLAN_EID_EXT_SUPP_RATES; 1915 *pos++ = WLAN_EID_EXT_SUPP_RATES;
1909 *pos = 0; 1916 *pos = 0;
1910 iwl_supported_rate_to_ie(pos, ret_rates, priv->active_rate_basic, left); 1917 iwl_supported_rate_to_ie(pos, active_rates,
1918 priv->active_rate_basic, &left);
1911 if (*pos > 0) 1919 if (*pos > 0)
1912 len += 2 + *pos; 1920 len += 2 + *pos;
1913 1921
@@ -4494,13 +4502,13 @@ static u8 ratio2dB[100] = {
4494 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */ 4502 * Conversion assumes that levels are voltages (20*log), not powers (10*log). */
4495int iwl_calc_db_from_ratio(int sig_ratio) 4503int iwl_calc_db_from_ratio(int sig_ratio)
4496{ 4504{
4497 /* Anything above 1000:1 just report as 60 dB */ 4505 /* 1000:1 or higher just report as 60 dB */
4498 if (sig_ratio > 1000) 4506 if (sig_ratio >= 1000)
4499 return 60; 4507 return 60;
4500 4508
4501 /* Above 100:1, divide by 10 and use table, 4509 /* 100:1 or higher, divide by 10 and use table,
4502 * add 20 dB to make up for divide by 10 */ 4510 * add 20 dB to make up for divide by 10 */
4503 if (sig_ratio > 100) 4511 if (sig_ratio >= 100)
4504 return (20 + (int)ratio2dB[sig_ratio/10]); 4512 return (20 + (int)ratio2dB[sig_ratio/10]);
4505 4513
4506 /* We shouldn't see this */ 4514 /* We shouldn't see this */
diff --git a/drivers/net/wireless/iwlwifi/iwlwifi.h b/drivers/net/wireless/iwlwifi/iwlwifi.h
index e0b97c341215..432ce887807f 100644
--- a/drivers/net/wireless/iwlwifi/iwlwifi.h
+++ b/drivers/net/wireless/iwlwifi/iwlwifi.h
@@ -39,18 +39,13 @@ struct iwl_priv;
39/* Hardware specific file defines the PCI IDs table for that hardware module */ 39/* Hardware specific file defines the PCI IDs table for that hardware module */
40extern struct pci_device_id iwl_hw_card_ids[]; 40extern struct pci_device_id iwl_hw_card_ids[];
41 41
42#include "iwl-hw.h"
42#if IWL == 3945 43#if IWL == 3945
43
44#define DRV_NAME "iwl3945" 44#define DRV_NAME "iwl3945"
45#include "iwl-hw.h"
46#include "iwl-3945-hw.h" 45#include "iwl-3945-hw.h"
47
48#elif IWL == 4965 46#elif IWL == 4965
49
50#define DRV_NAME "iwl4965" 47#define DRV_NAME "iwl4965"
51#include "iwl-hw.h"
52#include "iwl-4965-hw.h" 48#include "iwl-4965-hw.h"
53
54#endif 49#endif
55 50
56#include "iwl-prph.h" 51#include "iwl-prph.h"
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c
index c2d71afd57e5..2402cb8dd328 100644
--- a/drivers/net/wireless/netwave_cs.c
+++ b/drivers/net/wireless/netwave_cs.c
@@ -4,18 +4,18 @@
4 * Version: 0.4.1 4 * Version: 0.4.1
5 * Description: Netwave AirSurfer Wireless LAN PC Card driver 5 * Description: Netwave AirSurfer Wireless LAN PC Card driver
6 * Status: Experimental. 6 * Status: Experimental.
7 * Authors: John Markus Bjørndalen <johnm@cs.uit.no> 7 * Authors: John Markus Bjørndalen <johnm@cs.uit.no>
8 * Dag Brattli <dagb@cs.uit.no> 8 * Dag Brattli <dagb@cs.uit.no>
9 * David Hinds <dahinds@users.sourceforge.net> 9 * David Hinds <dahinds@users.sourceforge.net>
10 * Created at: A long time ago! 10 * Created at: A long time ago!
11 * Modified at: Mon Nov 10 11:54:37 1997 11 * Modified at: Mon Nov 10 11:54:37 1997
12 * Modified by: Dag Brattli <dagb@cs.uit.no> 12 * Modified by: Dag Brattli <dagb@cs.uit.no>
13 * 13 *
14 * Copyright (c) 1997 University of Tromsø, Norway 14 * Copyright (c) 1997 University of Tromsø, Norway
15 * 15 *
16 * Revision History: 16 * Revision History:
17 * 17 *
18 * 08-Nov-97 15:14:47 John Markus Bjørndalen <johnm@cs.uit.no> 18 * 08-Nov-97 15:14:47 John Markus Bjørndalen <johnm@cs.uit.no>
19 * - Fixed some bugs in netwave_rx and cleaned it up a bit. 19 * - Fixed some bugs in netwave_rx and cleaned it up a bit.
20 * (One of the bugs would have destroyed packets when receiving 20 * (One of the bugs would have destroyed packets when receiving
21 * multiple packets per interrupt). 21 * multiple packets per interrupt).
@@ -158,7 +158,7 @@ static int pc_debug = PCMCIA_DEBUG;
158module_param(pc_debug, int, 0); 158module_param(pc_debug, int, 0);
159#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) 159#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
160static char *version = 160static char *version =
161"netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n"; 161"netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n";
162#else 162#else
163#define DEBUG(n, args...) 163#define DEBUG(n, args...)
164#endif 164#endif
diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c
index 2c63cf0ad2cd..1437db0cf4b2 100644
--- a/drivers/net/wireless/p54common.c
+++ b/drivers/net/wireless/p54common.c
@@ -577,7 +577,7 @@ static int p54_set_filter(struct ieee80211_hw *dev, u16 filter_type,
577 struct p54_tx_control_filter *filter; 577 struct p54_tx_control_filter *filter;
578 578
579 hdr = kzalloc(sizeof(*hdr) + sizeof(*filter) + 579 hdr = kzalloc(sizeof(*hdr) + sizeof(*filter) +
580 priv->tx_hdr_len, GFP_KERNEL); 580 priv->tx_hdr_len, GFP_ATOMIC);
581 if (!hdr) 581 if (!hdr)
582 return -ENOMEM; 582 return -ENOMEM;
583 583
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index bb6f46cfbb9f..ff399f8083e9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -550,7 +550,7 @@ void rt2x00lib_write_tx_desc(struct rt2x00_dev *rt2x00dev,
550 /* 550 /*
551 * Check if we need to set the Length Extension 551 * Check if we need to set the Length Extension
552 */ 552 */
553 if (bitrate == 110 && residual <= 3) 553 if (bitrate == 110 && residual <= 30)
554 desc.service |= 0x80; 554 desc.service |= 0x80;
555 } 555 }
556 556
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 3e42759473c3..46c8c0840a65 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2029,6 +2029,7 @@ static struct usb_device_id rt73usb_device_table[] = {
2029 { USB_DEVICE(0x050d, 0x7050), USB_DEVICE_DATA(&rt73usb_ops) }, 2029 { USB_DEVICE(0x050d, 0x7050), USB_DEVICE_DATA(&rt73usb_ops) },
2030 { USB_DEVICE(0x050d, 0x705a), USB_DEVICE_DATA(&rt73usb_ops) }, 2030 { USB_DEVICE(0x050d, 0x705a), USB_DEVICE_DATA(&rt73usb_ops) },
2031 { USB_DEVICE(0x050d, 0x905b), USB_DEVICE_DATA(&rt73usb_ops) }, 2031 { USB_DEVICE(0x050d, 0x905b), USB_DEVICE_DATA(&rt73usb_ops) },
2032 { USB_DEVICE(0x050d, 0x905c), USB_DEVICE_DATA(&rt73usb_ops) },
2032 /* Billionton */ 2033 /* Billionton */
2033 { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) }, 2034 { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) },
2034 /* Buffalo */ 2035 /* Buffalo */
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index 0ef887dd2867..de61c8fe6492 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -131,7 +131,8 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
131 struct rtl8187_tx_hdr *hdr; 131 struct rtl8187_tx_hdr *hdr;
132 struct rtl8187_tx_info *info; 132 struct rtl8187_tx_info *info;
133 struct urb *urb; 133 struct urb *urb;
134 u32 tmp; 134 __le16 rts_dur = 0;
135 u32 flags;
135 136
136 urb = usb_alloc_urb(0, GFP_ATOMIC); 137 urb = usb_alloc_urb(0, GFP_ATOMIC);
137 if (!urb) { 138 if (!urb) {
@@ -139,24 +140,24 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb,
139 return 0; 140 return 0;
140 } 141 }
141 142
142 hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr)); 143 flags = skb->len;
143 tmp = skb->len - sizeof(*hdr); 144 flags |= RTL8187_TX_FLAG_NO_ENCRYPT;
144 tmp |= RTL8187_TX_FLAG_NO_ENCRYPT; 145 flags |= control->rts_cts_rate << 19;
145 tmp |= control->rts_cts_rate << 19; 146 flags |= control->tx_rate << 24;
146 tmp |= control->tx_rate << 24; 147 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb->data))
147 if (ieee80211_get_morefrag((struct ieee80211_hdr *)skb)) 148 flags |= RTL8187_TX_FLAG_MORE_FRAG;
148 tmp |= RTL8187_TX_FLAG_MORE_FRAG;
149 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 149 if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
150 tmp |= RTL8187_TX_FLAG_RTS; 150 flags |= RTL8187_TX_FLAG_RTS;
151 hdr->rts_duration = 151 rts_dur = ieee80211_rts_duration(dev, priv->if_id, skb->len, control);
152 ieee80211_rts_duration(dev, priv->if_id, skb->len, control);
153 } 152 }
154 if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 153 if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)
155 tmp |= RTL8187_TX_FLAG_CTS; 154 flags |= RTL8187_TX_FLAG_CTS;
156 hdr->flags = cpu_to_le32(tmp); 155
156 hdr = (struct rtl8187_tx_hdr *)skb_push(skb, sizeof(*hdr));
157 hdr->flags = cpu_to_le32(flags);
157 hdr->len = 0; 158 hdr->len = 0;
158 tmp = control->retry_limit << 8; 159 hdr->rts_duration = rts_dur;
159 hdr->retry = cpu_to_le32(tmp); 160 hdr->retry = cpu_to_le32(control->retry_limit << 8);
160 161
161 info = (struct rtl8187_tx_info *)skb->cb; 162 info = (struct rtl8187_tx_info *)skb->cb;
162 info->control = kmemdup(control, sizeof(*control), GFP_ATOMIC); 163 info->control = kmemdup(control, sizeof(*control), GFP_ATOMIC);
@@ -587,8 +588,6 @@ static void rtl8187_configure_filter(struct ieee80211_hw *dev,
587 588
588 *total_flags = 0; 589 *total_flags = 0;
589 590
590 if (changed_flags & FIF_PROMISC_IN_BSS)
591 priv->rx_conf ^= RTL818X_RX_CONF_NICMAC;
592 if (changed_flags & FIF_ALLMULTI) 591 if (changed_flags & FIF_ALLMULTI)
593 priv->rx_conf ^= RTL818X_RX_CONF_MULTICAST; 592 priv->rx_conf ^= RTL818X_RX_CONF_MULTICAST;
594 if (changed_flags & FIF_FCSFAIL) 593 if (changed_flags & FIF_FCSFAIL)
@@ -601,8 +600,6 @@ static void rtl8187_configure_filter(struct ieee80211_hw *dev,
601 if (mc_count > 0) 600 if (mc_count > 0)
602 priv->rx_conf |= RTL818X_RX_CONF_MULTICAST; 601 priv->rx_conf |= RTL818X_RX_CONF_MULTICAST;
603 602
604 if (priv->rx_conf & RTL818X_RX_CONF_NICMAC)
605 *total_flags |= FIF_PROMISC_IN_BSS;
606 if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST) 603 if (priv->rx_conf & RTL818X_RX_CONF_MULTICAST)
607 *total_flags |= FIF_ALLMULTI; 604 *total_flags |= FIF_ALLMULTI;
608 if (priv->rx_conf & RTL818X_RX_CONF_FCS) 605 if (priv->rx_conf & RTL818X_RX_CONF_FCS)
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index 935b144d9b56..d5c0c66188ca 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -327,8 +327,8 @@ static void zd1201_usbrx(struct urb *urb)
327 memcpy(skb_put(skb, 6), &data[datalen-8], 6); 327 memcpy(skb_put(skb, 6), &data[datalen-8], 6);
328 memcpy(skb_put(skb, 2), &data[datalen-24], 2); 328 memcpy(skb_put(skb, 2), &data[datalen-24], 2);
329 memcpy(skb_put(skb, len), data, len); 329 memcpy(skb_put(skb, len), data, len);
330 skb->dev->last_rx = jiffies;
331 skb->protocol = eth_type_trans(skb, zd->dev); 330 skb->protocol = eth_type_trans(skb, zd->dev);
331 skb->dev->last_rx = jiffies;
332 zd->stats.rx_packets++; 332 zd->stats.rx_packets++;
333 zd->stats.rx_bytes += skb->len; 333 zd->stats.rx_bytes += skb->len;
334 netif_rx(skb); 334 netif_rx(skb);
@@ -384,8 +384,8 @@ static void zd1201_usbrx(struct urb *urb)
384 memcpy(skb_put(skb, 2), &data[6], 2); 384 memcpy(skb_put(skb, 2), &data[6], 2);
385 memcpy(skb_put(skb, len), data+8, len); 385 memcpy(skb_put(skb, len), data+8, len);
386 } 386 }
387 skb->dev->last_rx = jiffies;
388 skb->protocol = eth_type_trans(skb, zd->dev); 387 skb->protocol = eth_type_trans(skb, zd->dev);
388 skb->dev->last_rx = jiffies;
389 zd->stats.rx_packets++; 389 zd->stats.rx_packets++;
390 zd->stats.rx_bytes += skb->len; 390 zd->stats.rx_bytes += skb->len;
391 netif_rx(skb); 391 netif_rx(skb);
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index b0684f965761..c755b6923812 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -1044,14 +1044,17 @@ error:
1044static void disconnect(struct usb_interface *intf) 1044static void disconnect(struct usb_interface *intf)
1045{ 1045{
1046 struct net_device *netdev = zd_intf_to_netdev(intf); 1046 struct net_device *netdev = zd_intf_to_netdev(intf);
1047 struct zd_mac *mac = zd_netdev_mac(netdev); 1047 struct zd_mac *mac;
1048 struct zd_usb *usb = &mac->chip.usb; 1048 struct zd_usb *usb;
1049 1049
1050 /* Either something really bad happened, or we're just dealing with 1050 /* Either something really bad happened, or we're just dealing with
1051 * a DEVICE_INSTALLER. */ 1051 * a DEVICE_INSTALLER. */
1052 if (netdev == NULL) 1052 if (netdev == NULL)
1053 return; 1053 return;
1054 1054
1055 mac = zd_netdev_mac(netdev);
1056 usb = &mac->chip.usb;
1057
1055 dev_dbg_f(zd_usb_dev(usb), "\n"); 1058 dev_dbg_f(zd_usb_dev(usb), "\n");
1056 1059
1057 zd_netdev_disconnect(netdev); 1060 zd_netdev_disconnect(netdev);
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 7fd505cc4f7a..2a8fc431099f 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1526,7 +1526,7 @@ static int xennet_connect(struct net_device *dev)
1526 1526
1527 if (!feature_rx_copy) { 1527 if (!feature_rx_copy) {
1528 dev_info(&dev->dev, 1528 dev_info(&dev->dev,
1529 "backend does not support copying recieve path"); 1529 "backend does not support copying receive path\n");
1530 return -ENODEV; 1530 return -ENODEV;
1531 } 1531 }
1532 1532
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 864f09fd9f86..b47bb2d7476a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -12,6 +12,7 @@
12 * 12 *
13 */ 13 */
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/module.h>
15#include <linux/device.h> 16#include <linux/device.h>
16#include <linux/of_device.h> 17#include <linux/of_device.h>
17#include <linux/of_platform.h> 18#include <linux/of_platform.h>
@@ -94,3 +95,23 @@ int of_bus_type_init(struct bus_type *bus, const char *name)
94 bus->resume = of_platform_device_resume; 95 bus->resume = of_platform_device_resume;
95 return bus_register(bus); 96 return bus_register(bus);
96} 97}
98
99int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
100{
101 /* initialize common driver fields */
102 if (!drv->driver.name)
103 drv->driver.name = drv->name;
104 if (!drv->driver.owner)
105 drv->driver.owner = drv->owner;
106 drv->driver.bus = bus;
107
108 /* register with core */
109 return driver_register(&drv->driver);
110}
111EXPORT_SYMBOL(of_register_driver);
112
113void of_unregister_driver(struct of_platform_driver *drv)
114{
115 driver_unregister(&drv->driver);
116}
117EXPORT_SYMBOL(of_unregister_driver);
diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c
index ff9f34453530..5bbff2028f8f 100644
--- a/drivers/parport/daisy.c
+++ b/drivers/parport/daisy.c
@@ -275,35 +275,6 @@ void parport_close(struct pardevice *dev)
275 parport_unregister_device(dev); 275 parport_unregister_device(dev);
276} 276}
277 277
278/**
279 * parport_device_num - convert device coordinates
280 * @parport: parallel port number
281 * @mux: multiplexor port number (-1 for no multiplexor)
282 * @daisy: daisy chain address (-1 for no daisy chain address)
283 *
284 * This tries to locate a device on the given parallel port,
285 * multiplexor port and daisy chain address, and returns its
286 * device number or %-ENXIO if no device with those coordinates
287 * exists.
288 **/
289
290int parport_device_num(int parport, int mux, int daisy)
291{
292 int res = -ENXIO;
293 struct daisydev *dev;
294
295 spin_lock(&topology_lock);
296 dev = topology;
297 while (dev && dev->port->portnum != parport &&
298 dev->port->muxport != mux && dev->daisy != daisy)
299 dev = dev->next;
300 if (dev)
301 res = dev->devnum;
302 spin_unlock(&topology_lock);
303
304 return res;
305}
306
307/* Send a daisy-chain-style CPP command packet. */ 278/* Send a daisy-chain-style CPP command packet. */
308static int cpp_daisy(struct parport *port, int cmd) 279static int cpp_daisy(struct parport *port, int cmd)
309{ 280{
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index bdbdab9285ca..ed82e41210d1 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -237,7 +237,7 @@ static int do_hardware_modes (ctl_table *table, int write,
237#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \ 237#define PARPORT_PARPORT_DIR(CHILD) { .ctl_name = DEV_PARPORT, .procname = "parport", \
238 .mode = 0555, .child = CHILD } 238 .mode = 0555, .child = CHILD }
239#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD } 239#define PARPORT_DEV_DIR(CHILD) { .ctl_name = CTL_DEV, .procname = "dev", .mode = 0555, .child = CHILD }
240#define PARPORT_DEVICES_ROOT_DIR { .ctl_name = DEV_PARPORT_DEVICES, .procname = "devices", \ 240#define PARPORT_DEVICES_ROOT_DIR { .procname = "devices", \
241 .mode = 0555, .child = NULL } 241 .mode = 0555, .child = NULL }
242 242
243static const unsigned long parport_min_timeslice_value = 243static const unsigned long parport_min_timeslice_value =
@@ -266,7 +266,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
266 .sysctl_header = NULL, 266 .sysctl_header = NULL,
267 { 267 {
268 { 268 {
269 .ctl_name = DEV_PARPORT_SPINTIME,
270 .procname = "spintime", 269 .procname = "spintime",
271 .data = NULL, 270 .data = NULL,
272 .maxlen = sizeof(int), 271 .maxlen = sizeof(int),
@@ -276,7 +275,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
276 .extra2 = (void*) &parport_max_spintime_value 275 .extra2 = (void*) &parport_max_spintime_value
277 }, 276 },
278 { 277 {
279 .ctl_name = DEV_PARPORT_BASE_ADDR,
280 .procname = "base-addr", 278 .procname = "base-addr",
281 .data = NULL, 279 .data = NULL,
282 .maxlen = 0, 280 .maxlen = 0,
@@ -284,7 +282,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
284 .proc_handler = &do_hardware_base_addr 282 .proc_handler = &do_hardware_base_addr
285 }, 283 },
286 { 284 {
287 .ctl_name = DEV_PARPORT_IRQ,
288 .procname = "irq", 285 .procname = "irq",
289 .data = NULL, 286 .data = NULL,
290 .maxlen = 0, 287 .maxlen = 0,
@@ -292,7 +289,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
292 .proc_handler = &do_hardware_irq 289 .proc_handler = &do_hardware_irq
293 }, 290 },
294 { 291 {
295 .ctl_name = DEV_PARPORT_DMA,
296 .procname = "dma", 292 .procname = "dma",
297 .data = NULL, 293 .data = NULL,
298 .maxlen = 0, 294 .maxlen = 0,
@@ -300,7 +296,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
300 .proc_handler = &do_hardware_dma 296 .proc_handler = &do_hardware_dma
301 }, 297 },
302 { 298 {
303 .ctl_name = DEV_PARPORT_MODES,
304 .procname = "modes", 299 .procname = "modes",
305 .data = NULL, 300 .data = NULL,
306 .maxlen = 0, 301 .maxlen = 0,
@@ -310,7 +305,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
310 PARPORT_DEVICES_ROOT_DIR, 305 PARPORT_DEVICES_ROOT_DIR,
311#ifdef CONFIG_PARPORT_1284 306#ifdef CONFIG_PARPORT_1284
312 { 307 {
313 .ctl_name = DEV_PARPORT_AUTOPROBE,
314 .procname = "autoprobe", 308 .procname = "autoprobe",
315 .data = NULL, 309 .data = NULL,
316 .maxlen = 0, 310 .maxlen = 0,
@@ -318,7 +312,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
318 .proc_handler = &do_autoprobe 312 .proc_handler = &do_autoprobe
319 }, 313 },
320 { 314 {
321 .ctl_name = DEV_PARPORT_AUTOPROBE + 1,
322 .procname = "autoprobe0", 315 .procname = "autoprobe0",
323 .data = NULL, 316 .data = NULL,
324 .maxlen = 0, 317 .maxlen = 0,
@@ -326,7 +319,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
326 .proc_handler = &do_autoprobe 319 .proc_handler = &do_autoprobe
327 }, 320 },
328 { 321 {
329 .ctl_name = DEV_PARPORT_AUTOPROBE + 2,
330 .procname = "autoprobe1", 322 .procname = "autoprobe1",
331 .data = NULL, 323 .data = NULL,
332 .maxlen = 0, 324 .maxlen = 0,
@@ -334,7 +326,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
334 .proc_handler = &do_autoprobe 326 .proc_handler = &do_autoprobe
335 }, 327 },
336 { 328 {
337 .ctl_name = DEV_PARPORT_AUTOPROBE + 3,
338 .procname = "autoprobe2", 329 .procname = "autoprobe2",
339 .data = NULL, 330 .data = NULL,
340 .maxlen = 0, 331 .maxlen = 0,
@@ -342,7 +333,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
342 .proc_handler = &do_autoprobe 333 .proc_handler = &do_autoprobe
343 }, 334 },
344 { 335 {
345 .ctl_name = DEV_PARPORT_AUTOPROBE + 4,
346 .procname = "autoprobe3", 336 .procname = "autoprobe3",
347 .data = NULL, 337 .data = NULL,
348 .maxlen = 0, 338 .maxlen = 0,
@@ -354,7 +344,6 @@ static const struct parport_sysctl_table parport_sysctl_template = {
354 }, 344 },
355 { 345 {
356 { 346 {
357 .ctl_name = DEV_PARPORT_DEVICES_ACTIVE,
358 .procname = "active", 347 .procname = "active",
359 .data = NULL, 348 .data = NULL,
360 .maxlen = 0, 349 .maxlen = 0,
@@ -393,7 +382,6 @@ parport_device_sysctl_template = {
393 .sysctl_header = NULL, 382 .sysctl_header = NULL,
394 { 383 {
395 { 384 {
396 .ctl_name = DEV_PARPORT_DEVICE_TIMESLICE,
397 .procname = "timeslice", 385 .procname = "timeslice",
398 .data = NULL, 386 .data = NULL,
399 .maxlen = sizeof(int), 387 .maxlen = sizeof(int),
@@ -449,7 +437,6 @@ parport_default_sysctl_table = {
449 .sysctl_header = NULL, 437 .sysctl_header = NULL,
450 { 438 {
451 { 439 {
452 .ctl_name = DEV_PARPORT_DEFAULT_TIMESLICE,
453 .procname = "timeslice", 440 .procname = "timeslice",
454 .data = &parport_default_timeslice, 441 .data = &parport_default_timeslice,
455 .maxlen = sizeof(parport_default_timeslice), 442 .maxlen = sizeof(parport_default_timeslice),
@@ -459,7 +446,6 @@ parport_default_sysctl_table = {
459 .extra2 = (void*) &parport_max_timeslice_value 446 .extra2 = (void*) &parport_max_timeslice_value
460 }, 447 },
461 { 448 {
462 .ctl_name = DEV_PARPORT_DEFAULT_SPINTIME,
463 .procname = "spintime", 449 .procname = "spintime",
464 .data = &parport_default_spintime, 450 .data = &parport_default_spintime,
465 .maxlen = sizeof(parport_default_spintime), 451 .maxlen = sizeof(parport_default_spintime),
@@ -502,7 +488,7 @@ int parport_proc_register(struct parport *port)
502 488
503 t->device_dir[0].extra1 = port; 489 t->device_dir[0].extra1 = port;
504 490
505 for (i = 0; i < 8; i++) 491 for (i = 0; i < 5; i++)
506 t->vars[i].extra1 = port; 492 t->vars[i].extra1 = port;
507 493
508 t->vars[0].data = &port->spintime; 494 t->vars[0].data = &port->spintime;
@@ -512,7 +498,7 @@ int parport_proc_register(struct parport *port)
512 t->vars[6 + i].extra2 = &port->probe_info[i]; 498 t->vars[6 + i].extra2 = &port->probe_info[i];
513 499
514 t->port_dir[0].procname = port->name; 500 t->port_dir[0].procname = port->name;
515 t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ 501 t->port_dir[0].ctl_name = 0;
516 502
517 t->port_dir[0].child = t->vars; 503 t->port_dir[0].child = t->vars;
518 t->parport_dir[0].child = t->port_dir; 504 t->parport_dir[0].child = t->port_dir;
@@ -551,26 +537,12 @@ int parport_device_proc_register(struct pardevice *device)
551 t->dev_dir[0].child = t->parport_dir; 537 t->dev_dir[0].child = t->parport_dir;
552 t->parport_dir[0].child = t->port_dir; 538 t->parport_dir[0].child = t->port_dir;
553 t->port_dir[0].procname = port->name; 539 t->port_dir[0].procname = port->name;
554 t->port_dir[0].ctl_name = port->number + 1; /* nb 0 isn't legal here */ 540 t->port_dir[0].ctl_name = 0;
555 t->port_dir[0].child = t->devices_root_dir; 541 t->port_dir[0].child = t->devices_root_dir;
556 t->devices_root_dir[0].child = t->device_dir; 542 t->devices_root_dir[0].child = t->device_dir;
557 543
558#ifdef CONFIG_PARPORT_1284 544 t->device_dir[0].ctl_name = 0;
559
560 t->device_dir[0].ctl_name =
561 parport_device_num(port->number, port->muxport,
562 device->daisy)
563 + 1; /* nb 0 isn't legal here */
564
565#else /* No IEEE 1284 support */
566
567 /* parport_device_num isn't available. */
568 t->device_dir[0].ctl_name = 1;
569
570#endif /* IEEE 1284 support or not */
571
572 t->device_dir[0].procname = device->name; 545 t->device_dir[0].procname = device->name;
573 t->device_dir[0].extra1 = device;
574 t->device_dir[0].child = t->vars; 546 t->device_dir[0].child = t->vars;
575 t->vars[0].data = &device->timeslice; 547 t->vars[0].data = &device->timeslice;
576 548
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c
index 67d28ee80f22..c5e0d89c3ece 100644
--- a/drivers/pcmcia/m32r_pcc.c
+++ b/drivers/pcmcia/m32r_pcc.c
@@ -22,9 +22,9 @@
22#include <linux/workqueue.h> 22#include <linux/workqueue.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/bitops.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/io.h> 27#include <asm/io.h>
27#include <asm/bitops.h>
28#include <asm/system.h> 28#include <asm/system.h>
29#include <asm/addrspace.h> 29#include <asm/addrspace.h>
30 30
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index b01985498460..d182760f035b 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -48,9 +48,9 @@
48#include <linux/delay.h> 48#include <linux/delay.h>
49#include <linux/interrupt.h> 49#include <linux/interrupt.h>
50#include <linux/fsl_devices.h> 50#include <linux/fsl_devices.h>
51#include <linux/bitops.h>
51 52
52#include <asm/io.h> 53#include <asm/io.h>
53#include <asm/bitops.h>
54#include <asm/system.h> 54#include <asm/system.h>
55#include <asm/time.h> 55#include <asm/time.h>
56#include <asm/mpc8xx.h> 56#include <asm/mpc8xx.h>
diff --git a/drivers/power/ds2760_battery.c b/drivers/power/ds2760_battery.c
index be7021ee3611..bdb9b7285b3d 100644
--- a/drivers/power/ds2760_battery.c
+++ b/drivers/power/ds2760_battery.c
@@ -366,7 +366,7 @@ static int ds2760_battery_probe(struct platform_device *pdev)
366 366
367 retval = power_supply_register(&pdev->dev, &di->bat); 367 retval = power_supply_register(&pdev->dev, &di->bat);
368 if (retval) { 368 if (retval) {
369 dev_err(di->dev, "failed to register battery"); 369 dev_err(di->dev, "failed to register battery\n");
370 goto batt_failed; 370 goto batt_failed;
371 } 371 }
372 372
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c
index 397f4ce849dc..87b3493d88e5 100644
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -729,7 +729,7 @@ static void ps3av_monitor_info_dump(const struct ps3av_pkt_av_get_monitor_info *
729 729
730static const struct ps3av_monitor_quirk { 730static const struct ps3av_monitor_quirk {
731 const char *monitor_name; 731 const char *monitor_name;
732 u32 clear_60, clear_50, clear_vesa; 732 u32 clear_60;
733} ps3av_monitor_quirks[] = { 733} ps3av_monitor_quirks[] = {
734 { 734 {
735 .monitor_name = "DELL 2007WFP", 735 .monitor_name = "DELL 2007WFP",
@@ -757,10 +757,6 @@ static void ps3av_fixup_monitor_info(struct ps3av_info_monitor *info)
757 quirk->monitor_name); 757 quirk->monitor_name);
758 info->res_60.res_bits &= ~quirk->clear_60; 758 info->res_60.res_bits &= ~quirk->clear_60;
759 info->res_60.native &= ~quirk->clear_60; 759 info->res_60.native &= ~quirk->clear_60;
760 info->res_50.res_bits &= ~quirk->clear_50;
761 info->res_50.native &= ~quirk->clear_50;
762 info->res_vesa.res_bits &= ~quirk->clear_vesa;
763 info->res_vesa.native &= ~quirk->clear_vesa;
764 break; 760 break;
765 } 761 }
766 } 762 }
diff --git a/drivers/ps3/ps3stor_lib.c b/drivers/ps3/ps3stor_lib.c
index 3a9824e3b251..55955f16ad91 100644
--- a/drivers/ps3/ps3stor_lib.c
+++ b/drivers/ps3/ps3stor_lib.c
@@ -66,7 +66,7 @@ static int ps3stor_probe_access(struct ps3_storage_device *dev)
66 if (n > 1) 66 if (n > 1)
67 dev_info(&dev->sbd.core, 67 dev_info(&dev->sbd.core,
68 "%s:%u: %lu accessible regions found. Only the first " 68 "%s:%u: %lu accessible regions found. Only the first "
69 "one will be used", 69 "one will be used\n",
70 __func__, __LINE__, n); 70 __func__, __LINE__, n);
71 dev->region_idx = __ffs(dev->accessible_regions); 71 dev->region_idx = __ffs(dev->accessible_regions);
72 dev_info(&dev->sbd.core, 72 dev_info(&dev->sbd.core,
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c
index bea25a1391ee..9dea585ef806 100644
--- a/drivers/ps3/vuart.c
+++ b/drivers/ps3/vuart.c
@@ -22,11 +22,11 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25#include <linux/bitops.h>
25#include <asm/ps3.h> 26#include <asm/ps3.h>
26 27
27#include <asm/firmware.h> 28#include <asm/firmware.h>
28#include <asm/lv1call.h> 29#include <asm/lv1call.h>
29#include <asm/bitops.h>
30 30
31#include "vuart.h" 31#include "vuart.h"
32 32
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 6420a90a4a92..cbde770eb121 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -240,7 +240,7 @@ config RTC_DRV_TWL92330
240 depends on MENELAUS 240 depends on MENELAUS
241 help 241 help
242 If you say yes here you get support for the RTC on the 242 If you say yes here you get support for the RTC on the
243 TWL92330 "Menelaus" power mangement chip, used with OMAP2 243 TWL92330 "Menelaus" power management chip, used with OMAP2
244 platforms. The support is integrated with the rest of 244 platforms. The support is integrated with the rest of
245 the Menelaus driver; it's not separate module. 245 the Menelaus driver; it's not separate module.
246 246
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index e4bf68ca96f7..2fd49edcc712 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -21,11 +21,11 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/bitops.h>
24 25
25#include <linux/amba/bus.h> 26#include <linux/amba/bus.h>
26 27
27#include <asm/io.h> 28#include <asm/io.h>
28#include <asm/bitops.h>
29#include <asm/hardware.h> 29#include <asm/hardware.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/rtc.h> 31#include <asm/rtc.h>
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index 0918b787c4dd..6f1e9a9804bc 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -29,8 +29,8 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/pm.h> 31#include <linux/pm.h>
32#include <linux/bitops.h>
32 33
33#include <asm/bitops.h>
34#include <asm/hardware.h> 34#include <asm/hardware.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/rtc.h> 36#include <asm/rtc.h>
diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c
index 6cad0841f3c4..2ae0e8304d3a 100644
--- a/drivers/rtc/rtc-sysfs.c
+++ b/drivers/rtc/rtc-sysfs.c
@@ -200,9 +200,8 @@ void rtc_sysfs_add_device(struct rtc_device *rtc)
200 200
201 err = device_create_file(&rtc->dev, &dev_attr_wakealarm); 201 err = device_create_file(&rtc->dev, &dev_attr_wakealarm);
202 if (err) 202 if (err)
203 dev_err(rtc->dev.parent, "failed to create " 203 dev_err(rtc->dev.parent,
204 "alarm attribute, %d", 204 "failed to create alarm attribute, %d\n", err);
205 err);
206} 205}
207 206
208void rtc_sysfs_del_device(struct rtc_device *rtc) 207void rtc_sysfs_del_device(struct rtc_device *rtc)
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c
index 8b9d68f6e016..5b7385e430ea 100644
--- a/drivers/s390/block/dasd_3990_erp.c
+++ b/drivers/s390/block/dasd_3990_erp.c
@@ -40,7 +40,7 @@ struct DCTL_data {
40 * 40 *
41 * Each bit configuration leading to an action code 2 (Exit with 41 * Each bit configuration leading to an action code 2 (Exit with
42 * programming error or unusual condition indication) 42 * programming error or unusual condition indication)
43 * are handled as fatal error´s. 43 * are handled as fatal errors.
44 * 44 *
45 * All other configurations are handled as recoverable errors. 45 * All other configurations are handled as recoverable errors.
46 * 46 *
@@ -2001,7 +2001,7 @@ dasd_3990_erp_compound_code(struct dasd_ccw_req * erp, char *sense)
2001 switch (sense[28]) { 2001 switch (sense[28]) {
2002 case 0x17: 2002 case 0x17:
2003 /* issue a Diagnostic Control command with an 2003 /* issue a Diagnostic Control command with an
2004 * Inhibit Write subcommand and controler modifier */ 2004 * Inhibit Write subcommand and controller modifier */
2005 erp = dasd_3990_erp_DCTL(erp, 0x20); 2005 erp = dasd_3990_erp_DCTL(erp, 0x20);
2006 break; 2006 break;
2007 2007
diff --git a/drivers/s390/char/sclp_cpi.c b/drivers/s390/char/sclp_cpi.c
index 29fe2a5ec2fe..82a13d9fdfe4 100644
--- a/drivers/s390/char/sclp_cpi.c
+++ b/drivers/s390/char/sclp_cpi.c
@@ -157,7 +157,7 @@ cpi_prepare_req(void)
157 sclp_ascebc_str(evb->system_name, CPI_LENGTH_SYSTEM_NAME); 157 sclp_ascebc_str(evb->system_name, CPI_LENGTH_SYSTEM_NAME);
158 EBC_TOUPPER(evb->system_name, CPI_LENGTH_SYSTEM_NAME); 158 EBC_TOUPPER(evb->system_name, CPI_LENGTH_SYSTEM_NAME);
159 159
160 /* set sytem level */ 160 /* set system level */
161 evb->system_level = LINUX_VERSION_CODE; 161 evb->system_level = LINUX_VERSION_CODE;
162 162
163 /* set sysplex name */ 163 /* set sysplex name */
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index b960f66843e4..725b0dd14269 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -158,7 +158,7 @@ static inline u64 time_to_avg_nsec(u32 value, u32 count)
158 if (count == 0) 158 if (count == 0)
159 return 0; 159 return 0;
160 160
161 /* value comes in units of 128 µsec */ 161 /* value comes in units of 128 µsec */
162 ret = time_to_nsec(value); 162 ret = time_to_nsec(value);
163 do_div(ret, count); 163 do_div(ret, count);
164 164
diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c
index 16ea828e99f7..ef7bc0a125ef 100644
--- a/drivers/s390/cio/idset.c
+++ b/drivers/s390/cio/idset.c
@@ -6,7 +6,7 @@
6 */ 6 */
7 7
8#include <linux/slab.h> 8#include <linux/slab.h>
9#include <asm/bitops.h> 9#include <linux/bitops.h>
10#include "idset.h" 10#include "idset.h"
11#include "css.h" 11#include "css.h"
12 12
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index 399695f7b1af..3561982749e3 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -59,13 +59,13 @@
59 * 1.15 Changed for 2.6 Kernel No longer compiles on 2.4 or lower 59 * 1.15 Changed for 2.6 Kernel No longer compiles on 2.4 or lower
60 * 1.25 Added Packing support 60 * 1.25 Added Packing support
61 */ 61 */
62#include <asm/bitops.h>
63#include <asm/ccwdev.h> 62#include <asm/ccwdev.h>
64#include <asm/ccwgroup.h> 63#include <asm/ccwgroup.h>
65#include <asm/debug.h> 64#include <asm/debug.h>
66#include <asm/idals.h> 65#include <asm/idals.h>
67#include <asm/io.h> 66#include <asm/io.h>
68 67
68#include <linux/bitops.h>
69#include <linux/ctype.h> 69#include <linux/ctype.h>
70#include <linux/delay.h> 70#include <linux/delay.h>
71#include <linux/errno.h> 71#include <linux/errno.h>
diff --git a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
index 449937233732..6bf3ebbe985a 100644
--- a/drivers/s390/net/ctcmain.c
+++ b/drivers/s390/net/ctcmain.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation 4 * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
5 * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com) 5 * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
6 * Fixes by : Jochen Röhrig (roehrig@de.ibm.com) 6 * Fixes by : Jochen Röhrig (roehrig@de.ibm.com)
7 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 7 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
8 Peter Tiedemann (ptiedem@de.ibm.com) 8 Peter Tiedemann (ptiedem@de.ibm.com)
9 * Driver Model stuff by : Cornelia Huck <cornelia.huck@de.ibm.com> 9 * Driver Model stuff by : Cornelia Huck <cornelia.huck@de.ibm.com>
@@ -19,7 +19,7 @@
19 * Dieter Wellerdiek (wel@de.ibm.com) 19 * Dieter Wellerdiek (wel@de.ibm.com)
20 * Martin Schwidefsky (schwidefsky@de.ibm.com) 20 * Martin Schwidefsky (schwidefsky@de.ibm.com)
21 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) 21 * Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
22 * Jochen Röhrig (roehrig@de.ibm.com) 22 * Jochen Röhrig (roehrig@de.ibm.com)
23 * 23 *
24 * This program is free software; you can redistribute it and/or modify 24 * This program is free software; you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by 25 * it under the terms of the GNU General Public License as published by
@@ -885,7 +885,7 @@ ch_action_firstio(fsm_instance * fi, int event, void *arg)
885 } 885 }
886 886
887 /** 887 /**
888 * Don´t setup a timer for receiving the initial RX frame 888 * Don't setup a timer for receiving the initial RX frame
889 * if in compatibility mode, since VM TCP delays the initial 889 * if in compatibility mode, since VM TCP delays the initial
890 * frame until it has some data to send. 890 * frame until it has some data to send.
891 */ 891 */
@@ -905,10 +905,10 @@ ch_action_firstio(fsm_instance * fi, int event, void *arg)
905 ccw_check_return_code(ch, rc, "init IO"); 905 ccw_check_return_code(ch, rc, "init IO");
906 } 906 }
907 /** 907 /**
908 * If in compatibility mode since we don´t setup a timer, we 908 * If in compatibility mode since we don't setup a timer, we
909 * also signal RX channel up immediately. This enables us 909 * also signal RX channel up immediately. This enables us
910 * to send packets early which in turn usually triggers some 910 * to send packets early which in turn usually triggers some
911 * reply from VM TCP which brings up the RX channel to it´s 911 * reply from VM TCP which brings up the RX channel to it's
912 * final state. 912 * final state.
913 */ 913 */
914 if ((CHANNEL_DIRECTION(ch->flags) == READ) && 914 if ((CHANNEL_DIRECTION(ch->flags) == READ) &&
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index a2d08c9ba3c4..ff999ff0b627 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -6643,7 +6643,8 @@ qeth_netdev_init(struct net_device *dev)
6643 dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid; 6643 dev->vlan_rx_kill_vid = qeth_vlan_rx_kill_vid;
6644 dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid; 6644 dev->vlan_rx_add_vid = qeth_vlan_rx_add_vid;
6645#endif 6645#endif
6646 dev->header_ops = &qeth_null_ops; 6646 if (qeth_get_netdev_flags(card) & IFF_NOARP)
6647 dev->header_ops = &qeth_null_ops;
6647 6648
6648#ifdef CONFIG_QETH_IPV6 6649#ifdef CONFIG_QETH_IPV6
6649 /*IPv6 address autoconfiguration stuff*/ 6650 /*IPv6 address autoconfiguration stuff*/
diff --git a/drivers/sbus/char/vfc.h b/drivers/sbus/char/vfc.h
index 63941a259b92..f1aa1389ea4a 100644
--- a/drivers/sbus/char/vfc.h
+++ b/drivers/sbus/char/vfc.h
@@ -126,7 +126,7 @@ struct vfc_dev {
126 volatile struct vfc_regs __iomem *regs; 126 volatile struct vfc_regs __iomem *regs;
127 struct vfc_regs *phys_regs; 127 struct vfc_regs *phys_regs;
128 unsigned int control_reg; 128 unsigned int control_reg;
129 struct semaphore device_lock_sem; 129 struct mutex device_lock_mtx;
130 int instance; 130 int instance;
131 int busy; 131 int busy;
132 unsigned long which_io; 132 unsigned long which_io;
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c
index 9269f7fbd363..d4f8fcded51d 100644
--- a/drivers/sbus/char/vfc_dev.c
+++ b/drivers/sbus/char/vfc_dev.c
@@ -22,6 +22,7 @@
22#include <linux/fs.h> 22#include <linux/fs.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/mutex.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26 27
27#include <asm/openprom.h> 28#include <asm/openprom.h>
@@ -54,12 +55,12 @@ static unsigned char saa9051_init_array[VFC_SAA9051_NR] = {
54 55
55void vfc_lock_device(struct vfc_dev *dev) 56void vfc_lock_device(struct vfc_dev *dev)
56{ 57{
57 down(&dev->device_lock_sem); 58 mutex_lock(&dev->device_lock_mtx);
58} 59}
59 60
60void vfc_unlock_device(struct vfc_dev *dev) 61void vfc_unlock_device(struct vfc_dev *dev)
61{ 62{
62 up(&dev->device_lock_sem); 63 mutex_unlock(&dev->device_lock_mtx);
63} 64}
64 65
65 66
@@ -133,7 +134,7 @@ int init_vfc_hw(struct vfc_dev *dev)
133int init_vfc_devstruct(struct vfc_dev *dev, int instance) 134int init_vfc_devstruct(struct vfc_dev *dev, int instance)
134{ 135{
135 dev->instance=instance; 136 dev->instance=instance;
136 init_MUTEX(&dev->device_lock_sem); 137 mutex_init(&dev->device_lock_mtx);
137 dev->control_reg=0; 138 dev->control_reg=0;
138 dev->busy=0; 139 dev->busy=0;
139 return 0; 140 return 0;
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
index a7f916c0c9cd..1c9078191d9e 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -25,9 +25,6 @@
25 25
26#define FAILURE 0xFFFFFFFFL 26#define FAILURE 0xFFFFFFFFL
27 27
28#define BIT(x) ((unsigned char)(1<<(x))) /* single-bit mask in bit position x */
29#define BITW(x) ((unsigned short)(1<<(x))) /* single-bit mask in bit position x */
30
31struct sccb; 28struct sccb;
32typedef void (*CALL_BK_FN) (struct sccb *); 29typedef void (*CALL_BK_FN) (struct sccb *);
33 30
@@ -374,9 +371,9 @@ typedef struct SCCBscam_info {
374#define SCAM_ENABLED BIT(2) 371#define SCAM_ENABLED BIT(2)
375#define SCAM_LEVEL2 BIT(3) 372#define SCAM_LEVEL2 BIT(3)
376 373
377#define RENEGO_ENA BITW(10) 374#define RENEGO_ENA BIT(10)
378#define CONNIO_ENA BITW(11) 375#define CONNIO_ENA BIT(11)
379#define GREEN_PC_ENA BITW(12) 376#define GREEN_PC_ENA BIT(12)
380 377
381#define AUTO_RATE_00 00 378#define AUTO_RATE_00 00
382#define AUTO_RATE_05 01 379#define AUTO_RATE_05 01
@@ -511,23 +508,23 @@ typedef struct SCCBscam_info {
511 508
512#define hp_intena 0x40 509#define hp_intena 0x40
513 510
514#define RESET BITW(7) 511#define RESET BIT(7)
515#define PROG_HLT BITW(6) 512#define PROG_HLT BIT(6)
516#define PARITY BITW(5) 513#define PARITY BIT(5)
517#define FIFO BITW(4) 514#define FIFO BIT(4)
518#define SEL BITW(3) 515#define SEL BIT(3)
519#define SCAM_SEL BITW(2) 516#define SCAM_SEL BIT(2)
520#define RSEL BITW(1) 517#define RSEL BIT(1)
521#define TIMEOUT BITW(0) 518#define TIMEOUT BIT(0)
522#define BUS_FREE BITW(15) 519#define BUS_FREE BIT(15)
523#define XFER_CNT_0 BITW(14) 520#define XFER_CNT_0 BIT(14)
524#define PHASE BITW(13) 521#define PHASE BIT(13)
525#define IUNKWN BITW(12) 522#define IUNKWN BIT(12)
526#define ICMD_COMP BITW(11) 523#define ICMD_COMP BIT(11)
527#define ITICKLE BITW(10) 524#define ITICKLE BIT(10)
528#define IDO_STRT BITW(9) 525#define IDO_STRT BIT(9)
529#define ITAR_DISC BITW(8) 526#define ITAR_DISC BIT(8)
530#define AUTO_INT (BITW(12)+BITW(11)+BITW(10)+BITW(9)+BITW(8)) 527#define AUTO_INT (BIT(12)+BIT(11)+BIT(10)+BIT(9)+BIT(8))
531#define CLR_ALL_INT 0xFFFF 528#define CLR_ALL_INT 0xFFFF
532#define CLR_ALL_INT_1 0xFF00 529#define CLR_ALL_INT_1 0xFF00
533 530
@@ -674,37 +671,37 @@ typedef struct SCCBscam_info {
674#define BIOS_DATA_OFFSET 0x60 671#define BIOS_DATA_OFFSET 0x60
675#define BIOS_RELATIVE_CARD 0x64 672#define BIOS_RELATIVE_CARD 0x64
676 673
677#define AR3 (BITW(9) + BITW(8)) 674#define AR3 (BIT(9) + BIT(8))
678#define SDATA BITW(10) 675#define SDATA BIT(10)
679 676
680#define CRD_OP BITW(11) /* Cmp Reg. w/ Data */ 677#define CRD_OP BIT(11) /* Cmp Reg. w/ Data */
681 678
682#define CRR_OP BITW(12) /* Cmp Reg. w. Reg. */ 679#define CRR_OP BIT(12) /* Cmp Reg. w. Reg. */
683 680
684#define CPE_OP (BITW(14)+BITW(11)) /* Cmp SCSI phs & Branch EQ */ 681#define CPE_OP (BIT(14)+BIT(11)) /* Cmp SCSI phs & Branch EQ */
685 682
686#define CPN_OP (BITW(14)+BITW(12)) /* Cmp SCSI phs & Branch NOT EQ */ 683#define CPN_OP (BIT(14)+BIT(12)) /* Cmp SCSI phs & Branch NOT EQ */
687 684
688#define ADATA_OUT 0x00 685#define ADATA_OUT 0x00
689#define ADATA_IN BITW(8) 686#define ADATA_IN BIT(8)
690#define ACOMMAND BITW(10) 687#define ACOMMAND BIT(10)
691#define ASTATUS (BITW(10)+BITW(8)) 688#define ASTATUS (BIT(10)+BIT(8))
692#define AMSG_OUT (BITW(10)+BITW(9)) 689#define AMSG_OUT (BIT(10)+BIT(9))
693#define AMSG_IN (BITW(10)+BITW(9)+BITW(8)) 690#define AMSG_IN (BIT(10)+BIT(9)+BIT(8))
694 691
695#define BRH_OP BITW(13) /* Branch */ 692#define BRH_OP BIT(13) /* Branch */
696 693
697#define ALWAYS 0x00 694#define ALWAYS 0x00
698#define EQUAL BITW(8) 695#define EQUAL BIT(8)
699#define NOT_EQ BITW(9) 696#define NOT_EQ BIT(9)
700 697
701#define TCB_OP (BITW(13)+BITW(11)) /* Test condition & branch */ 698#define TCB_OP (BIT(13)+BIT(11)) /* Test condition & branch */
702 699
703#define FIFO_0 BITW(10) 700#define FIFO_0 BIT(10)
704 701
705#define MPM_OP BITW(15) /* Match phase and move data */ 702#define MPM_OP BIT(15) /* Match phase and move data */
706 703
707#define MRR_OP BITW(14) /* Move DReg. to Reg. */ 704#define MRR_OP BIT(14) /* Move DReg. to Reg. */
708 705
709#define S_IDREG (BIT(2)+BIT(1)+BIT(0)) 706#define S_IDREG (BIT(2)+BIT(1)+BIT(0))
710 707
@@ -712,9 +709,9 @@ typedef struct SCCBscam_info {
712#define D_AR1 BIT(0) 709#define D_AR1 BIT(0)
713#define D_BUCKET (BIT(2) + BIT(1) + BIT(0)) 710#define D_BUCKET (BIT(2) + BIT(1) + BIT(0))
714 711
715#define RAT_OP (BITW(14)+BITW(13)+BITW(11)) 712#define RAT_OP (BIT(14)+BIT(13)+BIT(11))
716 713
717#define SSI_OP (BITW(15)+BITW(11)) 714#define SSI_OP (BIT(15)+BIT(11))
718 715
719#define SSI_ITAR_DISC (ITAR_DISC >> 8) 716#define SSI_ITAR_DISC (ITAR_DISC >> 8)
720#define SSI_IDO_STRT (IDO_STRT >> 8) 717#define SSI_IDO_STRT (IDO_STRT >> 8)
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 30905cebefbb..a5763c6e9362 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -521,7 +521,7 @@ config SCSI_DPT_I2O
521 521
522config SCSI_ADVANSYS 522config SCSI_ADVANSYS
523 tristate "AdvanSys SCSI support" 523 tristate "AdvanSys SCSI support"
524 depends on SCSI 524 depends on SCSI && VIRT_TO_BUS
525 depends on ISA || EISA || PCI 525 depends on ISA || EISA || PCI
526 help 526 help
527 This is a driver for all SCSI host adapters manufactured by 527 This is a driver for all SCSI host adapters manufactured by
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 03b51025a8f4..9abba8b90f70 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1526,7 +1526,7 @@ struct aac_mntent {
1526 __le32 capacityhigh; 1526 __le32 capacityhigh;
1527}; 1527};
1528 1528
1529#define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */ 1529#define FSCS_NOTCLEAN 0x0001 /* fsck is necessary before mounting */
1530#define FSCS_READONLY 0x0002 /* possible result of broken mirror */ 1530#define FSCS_READONLY 0x0002 /* possible result of broken mirror */
1531#define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */ 1531#define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */
1532 1532
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index f08e71e0205a..a58c265dc8af 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -1,6 +1,6 @@
1/* aha152x.c -- Adaptec AHA-152x driver 1/* aha152x.c -- Adaptec AHA-152x driver
2 * Author: Jürgen E. Fischer, fischer@norbit.de 2 * Author: Jürgen E. Fischer, fischer@norbit.de
3 * Copyright 1993-2004 Jürgen E. Fischer 3 * Copyright 1993-2004 Jürgen E. Fischer
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 6 * under the terms of the GNU General Public License as published by the
@@ -357,7 +357,7 @@ enum {
357 check_condition = 0x0800, /* requesting sense after CHECK CONDITION */ 357 check_condition = 0x0800, /* requesting sense after CHECK CONDITION */
358}; 358};
359 359
360MODULE_AUTHOR("Jürgen Fischer"); 360MODULE_AUTHOR("Jürgen Fischer");
361MODULE_DESCRIPTION(AHA152X_REVID); 361MODULE_DESCRIPTION(AHA152X_REVID);
362MODULE_LICENSE("GPL"); 362MODULE_LICENSE("GPL");
363 363
diff --git a/drivers/scsi/aic7xxx/cam.h b/drivers/scsi/aic7xxx/cam.h
index 26f17e3fc45c..687aef6ef185 100644
--- a/drivers/scsi/aic7xxx/cam.h
+++ b/drivers/scsi/aic7xxx/cam.h
@@ -48,7 +48,7 @@ typedef enum {
48 CAM_REQ_ABORTED, /* CCB request aborted by the host */ 48 CAM_REQ_ABORTED, /* CCB request aborted by the host */
49 CAM_UA_ABORT, /* Unable to abort CCB request */ 49 CAM_UA_ABORT, /* Unable to abort CCB request */
50 CAM_REQ_CMP_ERR, /* CCB request completed with an error */ 50 CAM_REQ_CMP_ERR, /* CCB request completed with an error */
51 CAM_BUSY, /* CAM subsytem is busy */ 51 CAM_BUSY, /* CAM subsystem is busy */
52 CAM_REQ_INVALID, /* CCB request was invalid */ 52 CAM_REQ_INVALID, /* CCB request was invalid */
53 CAM_PATH_INVALID, /* Supplied Path ID is invalid */ 53 CAM_PATH_INVALID, /* Supplied Path ID is invalid */
54 CAM_SEL_TIMEOUT, /* Target Selection Timeout */ 54 CAM_SEL_TIMEOUT, /* Target Selection Timeout */
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index fd42d4789202..a9def6e1d30e 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -1808,12 +1808,12 @@ static irqreturn_t dc395x_interrupt(int irq, void *dev_id)
1808 irqreturn_t handled = IRQ_NONE; 1808 irqreturn_t handled = IRQ_NONE;
1809 1809
1810 /* 1810 /*
1811 * Check for pending interupt 1811 * Check for pending interrupt
1812 */ 1812 */
1813 scsi_status = DC395x_read16(acb, TRM_S1040_SCSI_STATUS); 1813 scsi_status = DC395x_read16(acb, TRM_S1040_SCSI_STATUS);
1814 dma_status = DC395x_read8(acb, TRM_S1040_DMA_STATUS); 1814 dma_status = DC395x_read8(acb, TRM_S1040_DMA_STATUS);
1815 if (scsi_status & SCSIINTERRUPT) { 1815 if (scsi_status & SCSIINTERRUPT) {
1816 /* interupt pending - let's process it! */ 1816 /* interrupt pending - let's process it! */
1817 dc395x_handle_interrupt(acb, scsi_status); 1817 dc395x_handle_interrupt(acb, scsi_status);
1818 handled = IRQ_HANDLED; 1818 handled = IRQ_HANDLED;
1819 } 1819 }
@@ -4579,7 +4579,7 @@ static void adapter_uninit_chip(struct AdapterCtlBlk *acb)
4579 if (acb->config & HCC_SCSI_RESET) 4579 if (acb->config & HCC_SCSI_RESET)
4580 reset_scsi_bus(acb); 4580 reset_scsi_bus(acb);
4581 4581
4582 /* clear any pending interupt state */ 4582 /* clear any pending interrupt state */
4583 DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS); 4583 DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS);
4584} 4584}
4585 4585
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index fa7ba64483fb..252d1806467f 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -47,9 +47,9 @@
47#include <linux/scatterlist.h> 47#include <linux/scatterlist.h>
48#include <linux/delay.h> 48#include <linux/delay.h>
49#include <linux/mutex.h> 49#include <linux/mutex.h>
50#include <linux/bitops.h>
50 51
51#include <asm/io.h> 52#include <asm/io.h>
52#include <asm/bitops.h>
53#include <asm/uaccess.h> 53#include <asm/uaccess.h>
54 54
55#include <scsi/scsi.h> 55#include <scsi/scsi.h>
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index b41dfb539021..c316a0bcae6c 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -5134,6 +5134,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5134 u32 ioadl_flags = 0; 5134 u32 ioadl_flags = 0;
5135 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 5135 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
5136 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; 5136 struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
5137 struct ipr_ioadl_desc *last_ioadl = NULL;
5137 int len = qc->nbytes + qc->pad_len; 5138 int len = qc->nbytes + qc->pad_len;
5138 struct scatterlist *sg; 5139 struct scatterlist *sg;
5139 5140
@@ -5156,11 +5157,13 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd,
5156 ata_for_each_sg(sg, qc) { 5157 ata_for_each_sg(sg, qc) {
5157 ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg)); 5158 ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg));
5158 ioadl->address = cpu_to_be32(sg_dma_address(sg)); 5159 ioadl->address = cpu_to_be32(sg_dma_address(sg));
5159 if (ata_sg_is_last(sg, qc)) 5160
5160 ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST); 5161 last_ioadl = ioadl;
5161 else 5162 ioadl++;
5162 ioadl++;
5163 } 5163 }
5164
5165 if (likely(last_ioadl))
5166 last_ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST);
5164} 5167}
5165 5168
5166/** 5169/**
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
index 7ef0afc3cd68..5f3a0d7b18de 100644
--- a/drivers/scsi/libsas/sas_discover.c
+++ b/drivers/scsi/libsas/sas_discover.c
@@ -285,7 +285,7 @@ static void sas_discover_domain(struct work_struct *work)
285 dev = port->port_dev; 285 dev = port->port_dev;
286 286
287 SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, 287 SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id,
288 current->pid); 288 task_pid_nr(current));
289 289
290 switch (dev->dev_type) { 290 switch (dev->dev_type) {
291 case SAS_END_DEV: 291 case SAS_END_DEV:
@@ -320,7 +320,7 @@ static void sas_discover_domain(struct work_struct *work)
320 } 320 }
321 321
322 SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id, 322 SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id,
323 current->pid, error); 323 task_pid_nr(current), error);
324} 324}
325 325
326static void sas_revalidate_domain(struct work_struct *work) 326static void sas_revalidate_domain(struct work_struct *work)
@@ -334,12 +334,12 @@ static void sas_revalidate_domain(struct work_struct *work)
334 &port->disc.pending); 334 &port->disc.pending);
335 335
336 SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, 336 SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id,
337 current->pid); 337 task_pid_nr(current));
338 if (port->port_dev) 338 if (port->port_dev)
339 res = sas_ex_revalidate_domain(port->port_dev); 339 res = sas_ex_revalidate_domain(port->port_dev);
340 340
341 SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", 341 SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
342 port->id, current->pid, res); 342 port->id, task_pid_nr(current), res);
343} 343}
344 344
345/* ---------- Events ---------- */ 345/* ---------- Events ---------- */
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e5337ad4121e..ce348c5c706c 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -1243,7 +1243,8 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
1243 memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); 1243 memset(adaptermsg, 0, LPFC_MAX_ADPTMSG);
1244 memcpy(&adaptermsg[0], (uint8_t *) irsp, 1244 memcpy(&adaptermsg[0], (uint8_t *) irsp,
1245 MAX_MSG_DATA); 1245 MAX_MSG_DATA);
1246 dev_warn(&((phba->pcidev)->dev), "lpfc%d: %s", 1246 dev_warn(&((phba->pcidev)->dev),
1247 "lpfc%d: %s\n",
1247 phba->brd_no, adaptermsg); 1248 phba->brd_no, adaptermsg);
1248 } else { 1249 } else {
1249 /* Unknown IOCB command */ 1250 /* Unknown IOCB command */
@@ -1430,7 +1431,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
1430 memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); 1431 memset(adaptermsg, 0, LPFC_MAX_ADPTMSG);
1431 memcpy(&adaptermsg[0], (uint8_t *) irsp, 1432 memcpy(&adaptermsg[0], (uint8_t *) irsp,
1432 MAX_MSG_DATA); 1433 MAX_MSG_DATA);
1433 dev_warn(&((phba->pcidev)->dev), "lpfc%d: %s", 1434 dev_warn(&((phba->pcidev)->dev),
1435 "lpfc%d: %s\n",
1434 phba->brd_no, adaptermsg); 1436 phba->brd_no, adaptermsg);
1435 } else { 1437 } else {
1436 /* Unknown IOCB command */ 1438 /* Unknown IOCB command */
@@ -1681,7 +1683,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
1681 memcpy(&adaptermsg[0], (uint8_t *) irsp, 1683 memcpy(&adaptermsg[0], (uint8_t *) irsp,
1682 MAX_MSG_DATA); 1684 MAX_MSG_DATA);
1683 dev_warn(&((phba->pcidev)->dev), 1685 dev_warn(&((phba->pcidev)->dev),
1684 "lpfc%d: %s", 1686 "lpfc%d: %s\n",
1685 phba->brd_no, adaptermsg); 1687 phba->brd_no, adaptermsg);
1686 } else { 1688 } else {
1687 /* Unknown IOCB command */ 1689 /* Unknown IOCB command */
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index e4e4c6a39ed6..78779209ac89 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -427,7 +427,7 @@ megaraid_exit(void)
427 * @id : pci device id of the class of controllers 427 * @id : pci device id of the class of controllers
428 * 428 *
429 * This routine should be called whenever a new adapter is detected by the 429 * This routine should be called whenever a new adapter is detected by the
430 * PCI hotplug susbsytem. 430 * PCI hotplug susbsystem.
431 */ 431 */
432static int __devinit 432static int __devinit
433megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) 433megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
diff --git a/drivers/scsi/nsp32.h b/drivers/scsi/nsp32.h
index a976e8193d16..6715ecb3bfca 100644
--- a/drivers/scsi/nsp32.h
+++ b/drivers/scsi/nsp32.h
@@ -69,11 +69,6 @@ typedef u32 u32_le;
69typedef u16 u16_le; 69typedef u16 u16_le;
70 70
71/* 71/*
72 * MACRO
73 */
74#define BIT(x) (1UL << (x))
75
76/*
77 * BASIC Definitions 72 * BASIC Definitions
78 */ 73 */
79#ifndef TRUE 74#ifndef TRUE
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index b7f0fa246413..98397559c53b 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -24,7 +24,6 @@
24/************************************ 24/************************************
25 * Some useful macros... 25 * Some useful macros...
26 */ 26 */
27#define BIT(x) (1L << (x))
28 27
29/* SCSI initiator must be ID 7 */ 28/* SCSI initiator must be ID 7 */
30#define NSP_INITIATOR_ID 7 29#define NSP_INITIATOR_ID 7
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 9bb3d1d2a925..fe415ec85655 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -671,7 +671,7 @@ struct continuation_t1_entry {
671#define ET_CONTINUE ET_CONT_T1 671#define ET_CONTINUE ET_CONT_T1
672 672
673/* Marker entry structure*/ 673/* Marker entry structure*/
674struct marker_entry { 674struct qla4_marker_entry {
675 struct qla4_header hdr; /* 00-03 */ 675 struct qla4_header hdr; /* 00-03 */
676 676
677 uint32_t system_defined; /* 04-07 */ 677 uint32_t system_defined; /* 04-07 */
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 1e29f51d596b..d692c713416a 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -1006,7 +1006,7 @@ int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a)
1006 * qla4xxx_start_firmware - starts qla4xxx firmware 1006 * qla4xxx_start_firmware - starts qla4xxx firmware
1007 * @ha: Pointer to host adapter structure. 1007 * @ha: Pointer to host adapter structure.
1008 * 1008 *
1009 * This routine performs the neccessary steps to start the firmware for 1009 * This routine performs the necessary steps to start the firmware for
1010 * the QLA4010 adapter. 1010 * the QLA4010 adapter.
1011 **/ 1011 **/
1012static int qla4xxx_start_firmware(struct scsi_qla_host *ha) 1012static int qla4xxx_start_firmware(struct scsi_qla_host *ha)
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index 5006ecb3ef5e..e4461b5d767a 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -69,7 +69,7 @@ static int qla4xxx_get_req_pkt(struct scsi_qla_host *ha,
69static int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, 69static int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
70 struct ddb_entry *ddb_entry, int lun) 70 struct ddb_entry *ddb_entry, int lun)
71{ 71{
72 struct marker_entry *marker_entry; 72 struct qla4_marker_entry *marker_entry;
73 unsigned long flags = 0; 73 unsigned long flags = 0;
74 uint8_t status = QLA_SUCCESS; 74 uint8_t status = QLA_SUCCESS;
75 75
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 03b68d4f3bd0..89460d27c689 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -1286,7 +1286,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
1286 1286
1287 ret = scsi_init_shared_tag_map(host, MAX_SRBS); 1287 ret = scsi_init_shared_tag_map(host, MAX_SRBS);
1288 if (ret) { 1288 if (ret) {
1289 dev_warn(&ha->pdev->dev, "scsi_init_shared_tag_map failed"); 1289 dev_warn(&ha->pdev->dev, "scsi_init_shared_tag_map failed\n");
1290 goto probe_failed; 1290 goto probe_failed;
1291 } 1291 }
1292 1292
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 69f542c4923c..a69b155f39a2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -676,7 +676,7 @@ static int sd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
676 * success as well). Returns a negated errno value in case of error. 676 * success as well). Returns a negated errno value in case of error.
677 * 677 *
678 * Note: most ioctls are forward onto the block subsystem or further 678 * Note: most ioctls are forward onto the block subsystem or further
679 * down in the scsi subsytem. 679 * down in the scsi subsystem.
680 **/ 680 **/
681static int sd_ioctl(struct inode * inode, struct file * filp, 681static int sd_ioctl(struct inode * inode, struct file * filp,
682 unsigned int cmd, unsigned long arg) 682 unsigned int cmd, unsigned long arg)
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index dc15a22105f7..4aafe89b557f 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -1596,7 +1596,7 @@ static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd,
1596 * IO while SEL is true. But again, there are some disks out the in the 1596 * IO while SEL is true. But again, there are some disks out the in the
1597 * world that do that nevertheless. (Somebody claimed that this announces 1597 * world that do that nevertheless. (Somebody claimed that this announces
1598 * reselection capability of the target.) So we better skip that test and 1598 * reselection capability of the target.) So we better skip that test and
1599 * only wait for BSY... (Famous german words: Der Klügere gibt nach :-) 1599 * only wait for BSY... (Famous german words: Der Klügere gibt nach :-)
1600 */ 1600 */
1601 1601
1602 while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & 1602 while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) &
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw2.h b/drivers/scsi/sym53c8xx_2/sym_fw2.h
index 6e5b952312e3..ae1fb179b88e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw2.h
+++ b/drivers/scsi/sym53c8xx_2/sym_fw2.h
@@ -1781,7 +1781,7 @@ static struct SYM_FWB_SCR SYM_FWB_SCR = {
1781 * While testing with bogus QUANTUM drives, the C1010 1781 * While testing with bogus QUANTUM drives, the C1010
1782 * sometimes raised a spurious phase mismatch with 1782 * sometimes raised a spurious phase mismatch with
1783 * WSR and the CHMOV(1) triggered another PM. 1783 * WSR and the CHMOV(1) triggered another PM.
1784 * Waiting explicitely for the PHASE seemed to avoid 1784 * Waiting explicitly for the PHASE seemed to avoid
1785 * the nested phase mismatch. Btw, this didn't happen 1785 * the nested phase mismatch. Btw, this didn't happen
1786 * using my IBM drives. 1786 * using my IBM drives.
1787 */ 1787 */
diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h
index 61ffb860dacc..00123f2383d7 100644
--- a/drivers/scsi/wd33c93.h
+++ b/drivers/scsi/wd33c93.h
@@ -155,7 +155,7 @@
155#define WD33C93_FS_12_15 OWNID_FS_12 155#define WD33C93_FS_12_15 OWNID_FS_12
156#define WD33C93_FS_16_20 OWNID_FS_16 156#define WD33C93_FS_16_20 OWNID_FS_16
157 157
158 /* pass input-clock explicitely. accepted mhz values are 8-10,12-20 */ 158 /* pass input-clock explicitly. accepted mhz values are 8-10,12-20 */
159#define WD33C93_FS_MHZ(mhz) (mhz) 159#define WD33C93_FS_MHZ(mhz) (mhz)
160 160
161 /* Control register */ 161 /* Control register */
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d6ae38e55d01..87665d7df6f2 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -62,11 +62,11 @@ config SERIAL_8250_CONSOLE
62 kernel will automatically use the first serial line, /dev/ttyS0, as 62 kernel will automatically use the first serial line, /dev/ttyS0, as
63 system console. 63 system console.
64 64
65 you can set that using a kernel command line option such as 65 You can set that using a kernel command line option such as
66 "console=uart8250,io,0x3f8,9600n8" 66 "console=uart8250,io,0x3f8,9600n8"
67 "console=uart8250,mmio,0xff5e0000,115200n8". 67 "console=uart8250,mmio,0xff5e0000,115200n8".
68 and it will switch to normal serial console when correponding port is 68 and it will switch to normal serial console when the corresponding
69 ready. 69 port is ready.
70 "earlycon=uart8250,io,0x3f8,9600n8" 70 "earlycon=uart8250,io,0x3f8,9600n8"
71 "earlycon=uart8250,mmio,0xff5e0000,115200n8". 71 "earlycon=uart8250,mmio,0xff5e0000,115200n8".
72 it will not only setup early console. 72 it will not only setup early console.
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 72229df9dc11..40604a092921 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -263,15 +263,15 @@ static unsigned int pl01x_get_mctrl(struct uart_port *port)
263 unsigned int result = 0; 263 unsigned int result = 0;
264 unsigned int status = readw(uap->port.membase + UART01x_FR); 264 unsigned int status = readw(uap->port.membase + UART01x_FR);
265 265
266#define BIT(uartbit, tiocmbit) \ 266#define TIOCMBIT(uartbit, tiocmbit) \
267 if (status & uartbit) \ 267 if (status & uartbit) \
268 result |= tiocmbit 268 result |= tiocmbit
269 269
270 BIT(UART01x_FR_DCD, TIOCM_CAR); 270 TIOCMBIT(UART01x_FR_DCD, TIOCM_CAR);
271 BIT(UART01x_FR_DSR, TIOCM_DSR); 271 TIOCMBIT(UART01x_FR_DSR, TIOCM_DSR);
272 BIT(UART01x_FR_CTS, TIOCM_CTS); 272 TIOCMBIT(UART01x_FR_CTS, TIOCM_CTS);
273 BIT(UART011_FR_RI, TIOCM_RNG); 273 TIOCMBIT(UART011_FR_RI, TIOCM_RNG);
274#undef BIT 274#undef TIOCMBIT
275 return result; 275 return result;
276} 276}
277 277
@@ -282,18 +282,18 @@ static void pl011_set_mctrl(struct uart_port *port, unsigned int mctrl)
282 282
283 cr = readw(uap->port.membase + UART011_CR); 283 cr = readw(uap->port.membase + UART011_CR);
284 284
285#define BIT(tiocmbit, uartbit) \ 285#define TIOCMBIT(tiocmbit, uartbit) \
286 if (mctrl & tiocmbit) \ 286 if (mctrl & tiocmbit) \
287 cr |= uartbit; \ 287 cr |= uartbit; \
288 else \ 288 else \
289 cr &= ~uartbit 289 cr &= ~uartbit
290 290
291 BIT(TIOCM_RTS, UART011_CR_RTS); 291 TIOCMBIT(TIOCM_RTS, UART011_CR_RTS);
292 BIT(TIOCM_DTR, UART011_CR_DTR); 292 TIOCMBIT(TIOCM_DTR, UART011_CR_DTR);
293 BIT(TIOCM_OUT1, UART011_CR_OUT1); 293 TIOCMBIT(TIOCM_OUT1, UART011_CR_OUT1);
294 BIT(TIOCM_OUT2, UART011_CR_OUT2); 294 TIOCMBIT(TIOCM_OUT2, UART011_CR_OUT2);
295 BIT(TIOCM_LOOP, UART011_CR_LBE); 295 TIOCMBIT(TIOCM_LOOP, UART011_CR_LBE);
296#undef BIT 296#undef TIOCMBIT
297 297
298 writew(cr, uap->port.membase + UART011_CR); 298 writew(cr, uap->port.membase + UART011_CR);
299} 299}
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 7e8724d3571f..f523cdf4b02b 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -442,11 +442,11 @@ static char *serial_version = "$Revision: 1.25 $";
442#include <asm/uaccess.h> 442#include <asm/uaccess.h>
443#include <linux/kernel.h> 443#include <linux/kernel.h>
444#include <linux/mutex.h> 444#include <linux/mutex.h>
445#include <linux/bitops.h>
445 446
446#include <asm/io.h> 447#include <asm/io.h>
447#include <asm/irq.h> 448#include <asm/irq.h>
448#include <asm/system.h> 449#include <asm/system.h>
449#include <asm/bitops.h>
450#include <linux/delay.h> 450#include <linux/delay.h>
451 451
452#include <asm/arch/svinto.h> 452#include <asm/arch/svinto.h>
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 3f26c4b2f322..e773c8e14962 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -20,8 +20,8 @@
20 * - S3C2410 and S3C2440 serial support 20 * - S3C2410 and S3C2440 serial support
21 * - Power Management support 21 * - Power Management support
22 * - Fix console via IrDA devices 22 * - Fix console via IrDA devices
23 * - SysReq (Herbert Pötzl) 23 * - SysReq (Herbert Pötzl)
24 * - Break character handling (Herbert Pötzl) 24 * - Break character handling (Herbert Pötzl)
25 * - spin-lock initialisation (Dimitry Andric) 25 * - spin-lock initialisation (Dimitry Andric)
26 * - added clock control 26 * - added clock control
27 * - updated init code to use platform_device info 27 * - updated init code to use platform_device info
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 68aa4da01865..103189095c80 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1959,12 +1959,11 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
1959 1959
1960 mutex_lock(&state->mutex); 1960 mutex_lock(&state->mutex);
1961 1961
1962#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND 1962 if (!console_suspend_enabled && uart_console(port)) {
1963 if (uart_console(port)) { 1963 /* we're going to avoid suspending serial console */
1964 mutex_unlock(&state->mutex); 1964 mutex_unlock(&state->mutex);
1965 return 0; 1965 return 0;
1966 } 1966 }
1967#endif
1968 1967
1969 tty_dev = device_find_child(port->dev, &match, serial_match_port); 1968 tty_dev = device_find_child(port->dev, &match, serial_match_port);
1970 if (device_may_wakeup(tty_dev)) { 1969 if (device_may_wakeup(tty_dev)) {
@@ -2016,12 +2015,11 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2016 2015
2017 mutex_lock(&state->mutex); 2016 mutex_lock(&state->mutex);
2018 2017
2019#ifdef CONFIG_DISABLE_CONSOLE_SUSPEND 2018 if (!console_suspend_enabled && uart_console(port)) {
2020 if (uart_console(port)) { 2019 /* no need to resume serial console, it wasn't suspended */
2021 mutex_unlock(&state->mutex); 2020 mutex_unlock(&state->mutex);
2022 return 0; 2021 return 0;
2023 } 2022 }
2024#endif
2025 2023
2026 if (!port->suspended) { 2024 if (!port->suspended) {
2027 disable_irq_wake(port->irq); 2025 disable_irq_wake(port->irq);
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index e9aba932f217..7051e6c5edc3 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -181,7 +181,7 @@ static int mpc52xx_psc_spi_transfer_rxtx(struct spi_device *spi,
181 } 181 }
182 182
183 183
184 /* enable interupts and wait for wake up 184 /* enable interrupts and wait for wake up
185 * if just one byte is expected the Rx FIFO genererates no 185 * if just one byte is expected the Rx FIFO genererates no
186 * FFULL interrupt, so activate the RxRDY interrupt 186 * FFULL interrupt, so activate the RxRDY interrupt
187 */ 187 */
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 6cb71d74738f..2ef11bb70b2e 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -1070,7 +1070,7 @@ static int setup(struct spi_device *spi)
1070 return -ENODEV; 1070 return -ENODEV;
1071 } 1071 }
1072 1072
1073 dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d,", 1073 dev_dbg(&spi->dev, "setup spi chip %s, width is %d, dma is %d\n",
1074 spi->modalias, chip->width, chip->enable_dma); 1074 spi->modalias, chip->width, chip->enable_dma);
1075 dev_dbg(&spi->dev, "ctl_reg is 0x%x, flag_reg is 0x%x\n", 1075 dev_dbg(&spi->dev, "ctl_reg is 0x%x, flag_reg is 0x%x\n",
1076 chip->ctl_reg, chip->flag); 1076 chip->ctl_reg, chip->flag);
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 3b4650ae6f1a..7686ba34430f 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -1194,7 +1194,7 @@ static int setup(struct spi_device *spi)
1194 chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); 1194 chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
1195 if (!chip) { 1195 if (!chip) {
1196 dev_err(&spi->dev, 1196 dev_err(&spi->dev,
1197 "setup - cannot allocate controller state"); 1197 "setup - cannot allocate controller state\n");
1198 return -ENOMEM; 1198 return -ENOMEM;
1199 } 1199 }
1200 chip->control = SPI_DEFAULT_CONTROL; 1200 chip->control = SPI_DEFAULT_CONTROL;
@@ -1206,7 +1206,7 @@ static int setup(struct spi_device *spi)
1206 if (!chip_info) { 1206 if (!chip_info) {
1207 dev_err(&spi->dev, 1207 dev_err(&spi->dev,
1208 "setup - " 1208 "setup - "
1209 "cannot allocate controller data"); 1209 "cannot allocate controller data\n");
1210 status = -ENOMEM; 1210 status = -ENOMEM;
1211 goto err_first_setup; 1211 goto err_first_setup;
1212 } 1212 }
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
index b4a5e5e9d9fc..d976660cb7f0 100644
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -22,7 +22,7 @@ config SSB
22 22
23config SSB_PCIHOST_POSSIBLE 23config SSB_PCIHOST_POSSIBLE
24 bool 24 bool
25 depends on SSB && PCI 25 depends on SSB && (PCI = y || PCI = SSB)
26 default y 26 default y
27 27
28config SSB_PCIHOST 28config SSB_PCIHOST
@@ -37,7 +37,7 @@ config SSB_PCIHOST
37 37
38config SSB_PCMCIAHOST_POSSIBLE 38config SSB_PCMCIAHOST_POSSIBLE
39 bool 39 bool
40 depends on SSB && PCMCIA && EXPERIMENTAL 40 depends on SSB && (PCMCIA = y || PCMCIA = SSB) && EXPERIMENTAL
41 default y 41 default y
42 42
43config SSB_PCMCIAHOST 43config SSB_PCMCIAHOST
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index ab8691a32580..3d3dd32bf3ab 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -173,7 +173,7 @@ u32 ssb_cpu_clock(struct ssb_mipscore *mcore)
173 173
174void ssb_mipscore_init(struct ssb_mipscore *mcore) 174void ssb_mipscore_init(struct ssb_mipscore *mcore)
175{ 175{
176 struct ssb_bus *bus = mcore->dev->bus; 176 struct ssb_bus *bus;
177 struct ssb_device *dev; 177 struct ssb_device *dev;
178 unsigned long hz, ns; 178 unsigned long hz, ns;
179 unsigned int irq, i; 179 unsigned int irq, i;
@@ -183,6 +183,7 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
183 183
184 ssb_dprintk(KERN_INFO PFX "Initializing MIPS core...\n"); 184 ssb_dprintk(KERN_INFO PFX "Initializing MIPS core...\n");
185 185
186 bus = mcore->dev->bus;
186 hz = ssb_clockspeed(bus); 187 hz = ssb_clockspeed(bus);
187 if (!hz) 188 if (!hz)
188 hz = 100000000; 189 hz = 100000000;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index f51e22490edf..912d97aaf9bf 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -332,7 +332,7 @@ static void acm_read_bulk(struct urb *urb)
332 return; 332 return;
333 333
334 if (status) 334 if (status)
335 dev_dbg(&acm->data->dev, "bulk rx status %d", status); 335 dev_dbg(&acm->data->dev, "bulk rx status %d\n", status);
336 336
337 buf = rcv->buffer; 337 buf = rcv->buffer;
338 buf->size = urb->actual_length; 338 buf->size = urb->actual_length;
@@ -831,13 +831,13 @@ static int acm_probe (struct usb_interface *intf,
831 831
832 /* normal probing*/ 832 /* normal probing*/
833 if (!buffer) { 833 if (!buffer) {
834 err("Wierd descriptor references\n"); 834 err("Weird descriptor references\n");
835 return -EINVAL; 835 return -EINVAL;
836 } 836 }
837 837
838 if (!buflen) { 838 if (!buflen) {
839 if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) { 839 if (intf->cur_altsetting->endpoint->extralen && intf->cur_altsetting->endpoint->extra) {
840 dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint"); 840 dev_dbg(&intf->dev,"Seeking extra descriptors on endpoint\n");
841 buflen = intf->cur_altsetting->endpoint->extralen; 841 buflen = intf->cur_altsetting->endpoint->extralen;
842 buffer = intf->cur_altsetting->endpoint->extra; 842 buffer = intf->cur_altsetting->endpoint->extra;
843 } else { 843 } else {
@@ -887,24 +887,24 @@ next_desc:
887 887
888 if (!union_header) { 888 if (!union_header) {
889 if (call_interface_num > 0) { 889 if (call_interface_num > 0) {
890 dev_dbg(&intf->dev,"No union descriptor, using call management descriptor"); 890 dev_dbg(&intf->dev,"No union descriptor, using call management descriptor\n");
891 data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num)); 891 data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = call_interface_num));
892 control_interface = intf; 892 control_interface = intf;
893 } else { 893 } else {
894 dev_dbg(&intf->dev,"No union descriptor, giving up"); 894 dev_dbg(&intf->dev,"No union descriptor, giving up\n");
895 return -ENODEV; 895 return -ENODEV;
896 } 896 }
897 } else { 897 } else {
898 control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0); 898 control_interface = usb_ifnum_to_if(usb_dev, union_header->bMasterInterface0);
899 data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0)); 899 data_interface = usb_ifnum_to_if(usb_dev, (data_interface_num = union_header->bSlaveInterface0));
900 if (!control_interface || !data_interface) { 900 if (!control_interface || !data_interface) {
901 dev_dbg(&intf->dev,"no interfaces"); 901 dev_dbg(&intf->dev,"no interfaces\n");
902 return -ENODEV; 902 return -ENODEV;
903 } 903 }
904 } 904 }
905 905
906 if (data_interface_num != call_interface_num) 906 if (data_interface_num != call_interface_num)
907 dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported."); 907 dev_dbg(&intf->dev,"Seperate call control interface. That is not fully supported.\n");
908 908
909skip_normal_probe: 909skip_normal_probe:
910 910
@@ -912,7 +912,7 @@ skip_normal_probe:
912 if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) { 912 if (data_interface->cur_altsetting->desc.bInterfaceClass != CDC_DATA_INTERFACE_TYPE) {
913 if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) { 913 if (control_interface->cur_altsetting->desc.bInterfaceClass == CDC_DATA_INTERFACE_TYPE) {
914 struct usb_interface *t; 914 struct usb_interface *t;
915 dev_dbg(&intf->dev,"Your device has switched interfaces."); 915 dev_dbg(&intf->dev,"Your device has switched interfaces.\n");
916 916
917 t = control_interface; 917 t = control_interface;
918 control_interface = data_interface; 918 control_interface = data_interface;
@@ -927,7 +927,7 @@ skip_normal_probe:
927 return -ENODEV; 927 return -ENODEV;
928 928
929 if (usb_interface_claimed(data_interface)) { /* valid in this context */ 929 if (usb_interface_claimed(data_interface)) { /* valid in this context */
930 dev_dbg(&intf->dev,"The data interface isn't available"); 930 dev_dbg(&intf->dev,"The data interface isn't available\n");
931 return -EBUSY; 931 return -EBUSY;
932 } 932 }
933 933
@@ -944,7 +944,7 @@ skip_normal_probe:
944 if (!usb_endpoint_dir_in(epread)) { 944 if (!usb_endpoint_dir_in(epread)) {
945 /* descriptors are swapped */ 945 /* descriptors are swapped */
946 struct usb_endpoint_descriptor *t; 946 struct usb_endpoint_descriptor *t;
947 dev_dbg(&intf->dev,"The data interface has switched endpoints"); 947 dev_dbg(&intf->dev,"The data interface has switched endpoints\n");
948 948
949 t = epread; 949 t = epread;
950 epread = epwrite; 950 epread = epwrite;
@@ -959,7 +959,7 @@ skip_normal_probe:
959 } 959 }
960 960
961 if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) { 961 if (!(acm = kzalloc(sizeof(struct acm), GFP_KERNEL))) {
962 dev_dbg(&intf->dev, "out of memory (acm kzalloc)"); 962 dev_dbg(&intf->dev, "out of memory (acm kzalloc)\n");
963 goto alloc_fail; 963 goto alloc_fail;
964 } 964 }
965 965
@@ -985,26 +985,26 @@ skip_normal_probe:
985 985
986 buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); 986 buf = usb_buffer_alloc(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma);
987 if (!buf) { 987 if (!buf) {
988 dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)"); 988 dev_dbg(&intf->dev, "out of memory (ctrl buffer alloc)\n");
989 goto alloc_fail2; 989 goto alloc_fail2;
990 } 990 }
991 acm->ctrl_buffer = buf; 991 acm->ctrl_buffer = buf;
992 992
993 if (acm_write_buffers_alloc(acm) < 0) { 993 if (acm_write_buffers_alloc(acm) < 0) {
994 dev_dbg(&intf->dev, "out of memory (write buffer alloc)"); 994 dev_dbg(&intf->dev, "out of memory (write buffer alloc)\n");
995 goto alloc_fail4; 995 goto alloc_fail4;
996 } 996 }
997 997
998 acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL); 998 acm->ctrlurb = usb_alloc_urb(0, GFP_KERNEL);
999 if (!acm->ctrlurb) { 999 if (!acm->ctrlurb) {
1000 dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)"); 1000 dev_dbg(&intf->dev, "out of memory (ctrlurb kmalloc)\n");
1001 goto alloc_fail5; 1001 goto alloc_fail5;
1002 } 1002 }
1003 for (i = 0; i < num_rx_buf; i++) { 1003 for (i = 0; i < num_rx_buf; i++) {
1004 struct acm_ru *rcv = &(acm->ru[i]); 1004 struct acm_ru *rcv = &(acm->ru[i]);
1005 1005
1006 if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) { 1006 if (!(rcv->urb = usb_alloc_urb(0, GFP_KERNEL))) {
1007 dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)"); 1007 dev_dbg(&intf->dev, "out of memory (read urbs usb_alloc_urb)\n");
1008 goto alloc_fail7; 1008 goto alloc_fail7;
1009 } 1009 }
1010 1010
@@ -1015,13 +1015,13 @@ skip_normal_probe:
1015 struct acm_rb *buf = &(acm->rb[i]); 1015 struct acm_rb *buf = &(acm->rb[i]);
1016 1016
1017 if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) { 1017 if (!(buf->base = usb_buffer_alloc(acm->dev, readsize, GFP_KERNEL, &buf->dma))) {
1018 dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)"); 1018 dev_dbg(&intf->dev, "out of memory (read bufs usb_buffer_alloc)\n");
1019 goto alloc_fail7; 1019 goto alloc_fail7;
1020 } 1020 }
1021 } 1021 }
1022 acm->writeurb = usb_alloc_urb(0, GFP_KERNEL); 1022 acm->writeurb = usb_alloc_urb(0, GFP_KERNEL);
1023 if (!acm->writeurb) { 1023 if (!acm->writeurb) {
1024 dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)"); 1024 dev_dbg(&intf->dev, "out of memory (writeurb kmalloc)\n");
1025 goto alloc_fail7; 1025 goto alloc_fail7;
1026 } 1026 }
1027 1027
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index f013b4012c9a..1f4f6d02fe25 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -460,7 +460,7 @@ static int checkintf(struct dev_state *ps, unsigned int ifnum)
460 return 0; 460 return 0;
461 /* if not yet claimed, claim it for the driver */ 461 /* if not yet claimed, claim it for the driver */
462 dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n", 462 dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
463 current->pid, current->comm, ifnum); 463 task_pid_nr(current), current->comm, ifnum);
464 return claimintf(ps, ifnum); 464 return claimintf(ps, ifnum);
465} 465}
466 466
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 7dc123d6b2d0..99e5a68a3f12 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -291,7 +291,7 @@ int usb_create_ep_files(struct device *parent,
291 291
292 retval = endpoint_get_minor(ep_dev); 292 retval = endpoint_get_minor(ep_dev);
293 if (retval) { 293 if (retval) {
294 dev_err(parent, "can not allocate minor number for %s", 294 dev_err(parent, "can not allocate minor number for %s\n",
295 ep_dev->dev.bus_id); 295 ep_dev->dev.bus_id);
296 goto error_register; 296 goto error_register;
297 } 297 }
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 60a8f55a0cc7..036c3dea855e 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2870,10 +2870,9 @@ static int hub_thread(void *__unused)
2870 set_freezable(); 2870 set_freezable();
2871 do { 2871 do {
2872 hub_events(); 2872 hub_events();
2873 wait_event_interruptible(khubd_wait, 2873 wait_event_freezable(khubd_wait,
2874 !list_empty(&hub_event_list) || 2874 !list_empty(&hub_event_list) ||
2875 kthread_should_stop()); 2875 kthread_should_stop());
2876 try_to_freeze();
2877 } while (!kthread_should_stop() || !list_empty(&hub_event_list)); 2876 } while (!kthread_should_stop() || !list_empty(&hub_event_list));
2878 2877
2879 pr_debug("%s: khubd exiting\n", usbcore_name); 2878 pr_debug("%s: khubd exiting\n", usbcore_name);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index c021af390372..8dd5a6afd513 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1526,7 +1526,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
1526 new_interfaces = kmalloc(nintf * sizeof(*new_interfaces), 1526 new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),
1527 GFP_KERNEL); 1527 GFP_KERNEL);
1528 if (!new_interfaces) { 1528 if (!new_interfaces) {
1529 dev_err(&dev->dev, "Out of memory"); 1529 dev_err(&dev->dev, "Out of memory\n");
1530 return -ENOMEM; 1530 return -ENOMEM;
1531 } 1531 }
1532 1532
@@ -1535,7 +1535,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
1535 sizeof(struct usb_interface), 1535 sizeof(struct usb_interface),
1536 GFP_KERNEL); 1536 GFP_KERNEL);
1537 if (!new_interfaces[n]) { 1537 if (!new_interfaces[n]) {
1538 dev_err(&dev->dev, "Out of memory"); 1538 dev_err(&dev->dev, "Out of memory\n");
1539 ret = -ENOMEM; 1539 ret = -ENOMEM;
1540free_interfaces: 1540free_interfaces:
1541 while (--n >= 0) 1541 while (--n >= 0)
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index 73726c570a6e..1d174dcb3ac9 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -4006,7 +4006,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
4006 DBG(fsg, "removable=%d, stall=%d, buflen=%u\n", 4006 DBG(fsg, "removable=%d, stall=%d, buflen=%u\n",
4007 mod_data.removable, mod_data.can_stall, 4007 mod_data.removable, mod_data.can_stall,
4008 mod_data.buflen); 4008 mod_data.buflen);
4009 DBG(fsg, "I/O thread pid: %d\n", fsg->thread_task->pid); 4009 DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task));
4010 4010
4011 set_bit(REGISTERED, &fsg->atomic_bitflags); 4011 set_bit(REGISTERED, &fsg->atomic_bitflags);
4012 4012
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index e78c2ddc1f88..367b75c0b25b 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -1272,7 +1272,7 @@ static int lh7a40x_set_halt(struct usb_ep *_ep, int value)
1272 /* 1272 /*
1273 * Attempts to halt IN endpoints will fail (returning -EAGAIN) 1273 * Attempts to halt IN endpoints will fail (returning -EAGAIN)
1274 * if any transfer requests are still queued, or if the controller 1274 * if any transfer requests are still queued, or if the controller
1275 * FIFO still holds bytes that the host hasnt collected. 1275 * FIFO still holds bytes that the host hasn't collected.
1276 */ 1276 */
1277 spin_unlock_irqrestore(&ep->dev->lock, flags); 1277 spin_unlock_irqrestore(&ep->dev->lock, flags);
1278 DEBUG 1278 DEBUG
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 0dcb4164dc83..735db4aec831 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -451,7 +451,7 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
451 451
452 /* Some boards (mostly VIA?) report bogus overcurrent indications, 452 /* Some boards (mostly VIA?) report bogus overcurrent indications,
453 * causing massive log spam unless we completely ignore them. It 453 * causing massive log spam unless we completely ignore them. It
454 * may be relevant that VIA VT8235 controlers, where PORT_POWER is 454 * may be relevant that VIA VT8235 controllers, where PORT_POWER is
455 * always set, seem to clear PORT_OCC and PORT_CSC when writing to 455 * always set, seem to clear PORT_OCC and PORT_CSC when writing to
456 * PORT_POWER; that's surprising, but maybe within-spec. 456 * PORT_POWER; that's surprising, but maybe within-spec.
457 */ 457 */
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 6829814b7aaf..44b79e8a6e25 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -358,7 +358,7 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
358 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; 358 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
359 359
360 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { 360 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
361 dev_err(&dev->dev, "request_mem_region failed"); 361 dev_err(&dev->dev, "request_mem_region failed\n");
362 retval = -EBUSY; 362 retval = -EBUSY;
363 goto err_put; 363 goto err_put;
364 } 364 }
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 94d859aa73f8..ba370c56172c 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1556,7 +1556,7 @@ sl811h_start(struct usb_hcd *hcd)
1556 hcd->power_budget = sl811->board->power * 2; 1556 hcd->power_budget = sl811->board->power * 2;
1557 } 1557 }
1558 1558
1559 /* enable power and interupts */ 1559 /* enable power and interrupts */
1560 port_power(sl811, 1); 1560 port_power(sl811, 1);
1561 1561
1562 return 0; 1562 return 0;
diff --git a/drivers/usb/image/Kconfig b/drivers/usb/image/Kconfig
index 95ce703110d2..7595dfb38e3b 100644
--- a/drivers/usb/image/Kconfig
+++ b/drivers/usb/image/Kconfig
@@ -1,5 +1,5 @@
1# 1#
2# USB Imageing devices configuration 2# USB Imaging devices configuration
3# 3#
4comment "USB Imaging devices" 4comment "USB Imaging devices"
5 depends on USB 5 depends on USB
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
index 5131cbfb2f52..c567aa7a41ea 100644
--- a/drivers/usb/misc/adutux.c
+++ b/drivers/usb/misc/adutux.c
@@ -805,7 +805,7 @@ static int adu_probe(struct usb_interface *interface,
805 dev->minor = interface->minor; 805 dev->minor = interface->minor;
806 806
807 /* let the user know what node this device is now attached to */ 807 /* let the user know what node this device is now attached to */
808 dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d", 808 dev_info(&interface->dev, "ADU%d %s now attached to /dev/usb/adutux%d\n",
809 udev->descriptor.idProduct, dev->serial_number, 809 udev->descriptor.idProduct, dev->serial_number,
810 (dev->minor - ADU_MINOR_BASE)); 810 (dev->minor - ADU_MINOR_BASE));
811exit: 811exit:
@@ -851,7 +851,7 @@ static void adu_disconnect(struct usb_interface *interface)
851 mutex_unlock(&dev->mtx); 851 mutex_unlock(&dev->mtx);
852 } 852 }
853 853
854 dev_info(&interface->dev, "ADU device adutux%d now disconnected", 854 dev_info(&interface->dev, "ADU device adutux%d now disconnected\n",
855 (minor - ADU_MINOR_BASE)); 855 (minor - ADU_MINOR_BASE));
856 856
857 dbg(2," %s : leave", __FUNCTION__); 857 dbg(2," %s : leave", __FUNCTION__);
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 04e87acd6e46..2677fea147d9 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -118,7 +118,7 @@ static ssize_t set_brightness(struct device *dev, struct device_attribute *attr,
118 cytherm->brightness, buffer, 8); 118 cytherm->brightness, buffer, 8);
119 if (retval) 119 if (retval)
120 dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval); 120 dev_dbg(&cytherm->udev->dev, "retval = %d\n", retval);
121 /* Inform µC that we have changed the brightness setting */ 121 /* Inform µC that we have changed the brightness setting */
122 retval = vendor_command(cytherm->udev, WRITE_RAM, BRIGHTNESS_SEM, 122 retval = vendor_command(cytherm->udev, WRITE_RAM, BRIGHTNESS_SEM,
123 0x01, buffer, 8); 123 0x01, buffer, 8);
124 if (retval) 124 if (retval)
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
index 5c0a26cbd128..cd137577bb2d 100644
--- a/drivers/usb/misc/emi26.c
+++ b/drivers/usb/misc/emi26.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Emagic EMI 2|6 usb audio interface firmware loader. 2 * Emagic EMI 2|6 usb audio interface firmware loader.
3 * Copyright (C) 2002 3 * Copyright (C) 2002
4 * Tapio Laxström (tapio.laxstrom@iptime.fi) 4 * Tapio Laxström (tapio.laxstrom@iptime.fi)
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, as published by 7 * it under the terms of the GNU General Public License, as published by
@@ -249,7 +249,7 @@ static void __exit emi26_exit (void)
249module_init(emi26_init); 249module_init(emi26_init);
250module_exit(emi26_exit); 250module_exit(emi26_exit);
251 251
252MODULE_AUTHOR("tapio laxström"); 252MODULE_AUTHOR("Tapio Laxström");
253MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader."); 253MODULE_DESCRIPTION("Emagic EMI 2|6 firmware loader.");
254MODULE_LICENSE("GPL"); 254MODULE_LICENSE("GPL");
255 255
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
index 23153eac0dfa..4758cc5ccebc 100644
--- a/drivers/usb/misc/emi62.c
+++ b/drivers/usb/misc/emi62.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Emagic EMI 2|6 usb audio interface firmware loader. 2 * Emagic EMI 2|6 usb audio interface firmware loader.
3 * Copyright (C) 2002 3 * Copyright (C) 2002
4 * Tapio Laxström (tapio.laxstrom@iptime.fi) 4 * Tapio Laxström (tapio.laxstrom@iptime.fi)
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, as published by 7 * it under the terms of the GNU General Public License, as published by
@@ -292,7 +292,7 @@ static void __exit emi62_exit (void)
292module_init(emi62_init); 292module_init(emi62_init);
293module_exit(emi62_exit); 293module_exit(emi62_exit);
294 294
295MODULE_AUTHOR("tapio laxström"); 295MODULE_AUTHOR("Tapio Laxström");
296MODULE_DESCRIPTION("Emagic EMI 6|2m firmware loader."); 296MODULE_DESCRIPTION("Emagic EMI 6|2m firmware loader.");
297MODULE_LICENSE("GPL"); 297MODULE_LICENSE("GPL");
298 298
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 46d9f27ec173..d372fbc4effb 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -216,7 +216,7 @@ static void iowarrior_callback(struct urb *urb)
216exit: 216exit:
217 retval = usb_submit_urb(urb, GFP_ATOMIC); 217 retval = usb_submit_urb(urb, GFP_ATOMIC);
218 if (retval) 218 if (retval)
219 dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d", 219 dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d\n",
220 __FUNCTION__, retval); 220 __FUNCTION__, retval);
221 221
222} 222}
@@ -451,7 +451,7 @@ static ssize_t iowarrior_write(struct file *file,
451 break; 451 break;
452 default: 452 default:
453 /* what do we have here ? An unsupported Product-ID ? */ 453 /* what do we have here ? An unsupported Product-ID ? */
454 dev_err(&dev->interface->dev, "%s - not supported for product=0x%x", 454 dev_err(&dev->interface->dev, "%s - not supported for product=0x%x\n",
455 __FUNCTION__, dev->product_id); 455 __FUNCTION__, dev->product_id);
456 retval = -EFAULT; 456 retval = -EFAULT;
457 goto exit; 457 goto exit;
@@ -526,7 +526,7 @@ static int iowarrior_ioctl(struct inode *inode, struct file *file,
526 } else { 526 } else {
527 retval = -EINVAL; 527 retval = -EINVAL;
528 dev_err(&dev->interface->dev, 528 dev_err(&dev->interface->dev,
529 "ioctl 'IOW_WRITE' is not supported for product=0x%x.", 529 "ioctl 'IOW_WRITE' is not supported for product=0x%x.\n",
530 dev->product_id); 530 dev->product_id);
531 } 531 }
532 break; 532 break;
@@ -752,7 +752,7 @@ static int iowarrior_probe(struct usb_interface *interface,
752 /* allocate memory for our device state and intialize it */ 752 /* allocate memory for our device state and intialize it */
753 dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL); 753 dev = kzalloc(sizeof(struct iowarrior), GFP_KERNEL);
754 if (dev == NULL) { 754 if (dev == NULL) {
755 dev_err(&interface->dev, "Out of memory"); 755 dev_err(&interface->dev, "Out of memory\n");
756 return retval; 756 return retval;
757 } 757 }
758 758
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c
index df0ebcdb9d6a..2ad09b1f4848 100644
--- a/drivers/usb/misc/phidgetmotorcontrol.c
+++ b/drivers/usb/misc/phidgetmotorcontrol.c
@@ -155,7 +155,7 @@ resubmit:
155 retval = usb_submit_urb(urb, GFP_ATOMIC); 155 retval = usb_submit_urb(urb, GFP_ATOMIC);
156 if (retval) 156 if (retval)
157 dev_err(&mc->intf->dev, 157 dev_err(&mc->intf->dev,
158 "can't resubmit intr, %s-%s/motorcontrol0, retval %d", 158 "can't resubmit intr, %s-%s/motorcontrol0, retval %d\n",
159 mc->udev->bus->bus_name, 159 mc->udev->bus->bus_name,
160 mc->udev->devpath, retval); 160 mc->udev->devpath, retval);
161} 161}
diff --git a/drivers/usb/serial/ChangeLog.history b/drivers/usb/serial/ChangeLog.history
index 52c4f7bd7a80..c1b279939bbf 100644
--- a/drivers/usb/serial/ChangeLog.history
+++ b/drivers/usb/serial/ChangeLog.history
@@ -400,7 +400,7 @@ visor.c Change Log comments:
400 400
401 (11/11/2001) gkh 401 (11/11/2001) gkh
402 Added support for the m125 devices, and added check to prevent oopses 402 Added support for the m125 devices, and added check to prevent oopses
403 for Clié devices that lie about the number of ports they have. 403 for Clié devices that lie about the number of ports they have.
404 404
405 (08/30/2001) gkh 405 (08/30/2001) gkh
406 Added support for the Clie devices, both the 3.5 and 4.0 os versions. 406 Added support for the Clie devices, both the 3.5 and 4.0 os versions.
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig
index 99fefed77919..4a86696e6c7d 100644
--- a/drivers/usb/serial/Kconfig
+++ b/drivers/usb/serial/Kconfig
@@ -527,7 +527,7 @@ config USB_SERIAL_CYBERJACK
527 depends on USB_SERIAL && EXPERIMENTAL 527 depends on USB_SERIAL && EXPERIMENTAL
528 ---help--- 528 ---help---
529 Say Y here if you want to use a cyberJack pinpad/e-com USB chipcard 529 Say Y here if you want to use a cyberJack pinpad/e-com USB chipcard
530 reader. This is an interface to ISO 7816 compatible contactbased 530 reader. This is an interface to ISO 7816 compatible contact-based
531 chipcards, e.g. GSM SIMs. 531 chipcards, e.g. GSM SIMs.
532 532
533 To compile this driver as a module, choose M here: the 533 To compile this driver as a module, choose M here: the
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index e4c248c98e84..8a8a6b9fb05b 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -83,7 +83,7 @@
83 * 83 *
84 * (18/Jun/2003) Ian Abbott 84 * (18/Jun/2003) Ian Abbott
85 * Added Device ID of the USB relais from Rudolf Gugler (backported from 85 * Added Device ID of the USB relais from Rudolf Gugler (backported from
86 * Philipp Gühring's patch for 2.5.x kernel). 86 * Philipp Gühring's patch for 2.5.x kernel).
87 * Moved read transfer buffer reallocation into startup function. 87 * Moved read transfer buffer reallocation into startup function.
88 * Free existing write urb and transfer buffer in startup function. 88 * Free existing write urb and transfer buffer in startup function.
89 * Only use urbs in write urb pool that were successfully allocated. 89 * Only use urbs in write urb pool that were successfully allocated.
@@ -1071,7 +1071,7 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a
1071 (char*) &latency, 1, WDR_TIMEOUT); 1071 (char*) &latency, 1, WDR_TIMEOUT);
1072 1072
1073 if (rv < 0) { 1073 if (rv < 0) {
1074 dev_err(dev, "Unable to read latency timer: %i", rv); 1074 dev_err(dev, "Unable to read latency timer: %i\n", rv);
1075 return -EIO; 1075 return -EIO;
1076 } 1076 }
1077 return sprintf(buf, "%i\n", latency); 1077 return sprintf(buf, "%i\n", latency);
@@ -1098,7 +1098,7 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute *
1098 buf, 0, WDR_TIMEOUT); 1098 buf, 0, WDR_TIMEOUT);
1099 1099
1100 if (rv < 0) { 1100 if (rv < 0) {
1101 dev_err(dev, "Unable to write latency timer: %i", rv); 1101 dev_err(dev, "Unable to write latency timer: %i\n", rv);
1102 return -EIO; 1102 return -EIO;
1103 } 1103 }
1104 1104
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index b57b90ae9f9d..b51cbb0eaa05 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -17,7 +17,7 @@
17 * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the 17 * Bill Ryder - bryder@sgi.com formerly of Silicon Graphics, Inc.- wrote the
18 * FTDI_SIO implementation. 18 * FTDI_SIO implementation.
19 * 19 *
20 * Philipp Gühring - pg@futureware.at - added the Device ID of the USB relais 20 * Philipp Gühring - pg@futureware.at - added the Device ID of the USB relais
21 * from Rudolf Gugler 21 * from Rudolf Gugler
22 * 22 *
23 */ 23 */
@@ -44,7 +44,7 @@
44#define FTDI_ACTZWAVE_PID 0xF2D0 44#define FTDI_ACTZWAVE_PID 0xF2D0
45 45
46 46
47/* www.starting-point-systems.com µChameleon device */ 47/* www.starting-point-systems.com µChameleon device */
48#define FTDI_MICRO_CHAMELEON_PID 0xCAA0 /* Product Id */ 48#define FTDI_MICRO_CHAMELEON_PID 0xCAA0 /* Product Id */
49 49
50/* www.irtrans.de device */ 50/* www.irtrans.de device */
@@ -419,7 +419,7 @@
419 419
420/* 420/*
421 * Teratronik product ids. 421 * Teratronik product ids.
422 * Submitted by O. Wölfelschneider. 422 * Submitted by O. Wölfelschneider.
423 */ 423 */
424#define FTDI_TERATRONIK_VCP_PID 0xEC88 /* Teratronik device (preferring VCP driver on windows) */ 424#define FTDI_TERATRONIK_VCP_PID 0xEC88 /* Teratronik device (preferring VCP driver on windows) */
425#define FTDI_TERATRONIK_D2XX_PID 0xEC89 /* Teratronik device (preferring D2XX driver on windows) */ 425#define FTDI_TERATRONIK_D2XX_PID 0xEC89 /* Teratronik device (preferring D2XX driver on windows) */
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 2ecb1d2a034d..8dd3abc99d63 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2882,7 +2882,7 @@ static int edge_startup (struct usb_serial *serial)
2882 (edge_serial->product_info.NumPorts != serial->num_ports)) { 2882 (edge_serial->product_info.NumPorts != serial->num_ports)) {
2883 dev_warn(&serial->dev->dev, "Device Reported %d serial ports " 2883 dev_warn(&serial->dev->dev, "Device Reported %d serial ports "
2884 "vs. core thinking we have %d ports, email " 2884 "vs. core thinking we have %d ports, email "
2885 "greg@kroah.com this information.", 2885 "greg@kroah.com this information.\n",
2886 edge_serial->product_info.NumPorts, 2886 edge_serial->product_info.NumPorts,
2887 serial->num_ports); 2887 serial->num_ports);
2888 } 2888 }
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index e836ad07fdb9..9b38a08ac83a 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -306,7 +306,7 @@ static struct usb_device_id ipaq_id_table [] = {
306 { USB_DEVICE(0x0930, 0x0705) }, /* TOSHIBA Pocket PC e310 */ 306 { USB_DEVICE(0x0930, 0x0705) }, /* TOSHIBA Pocket PC e310 */
307 { USB_DEVICE(0x0930, 0x0706) }, /* TOSHIBA Pocket PC e740 */ 307 { USB_DEVICE(0x0930, 0x0706) }, /* TOSHIBA Pocket PC e740 */
308 { USB_DEVICE(0x0930, 0x0707) }, /* TOSHIBA Pocket PC e330 Series */ 308 { USB_DEVICE(0x0930, 0x0707) }, /* TOSHIBA Pocket PC e330 Series */
309 { USB_DEVICE(0x0930, 0x0708) }, /* TOSHIBA Pocket PC e350 Series */ 309 { USB_DEVICE(0x0930, 0x0708) }, /* TOSHIBA Pocket PC e350 Series */
310 { USB_DEVICE(0x0930, 0x0709) }, /* TOSHIBA Pocket PC e750 Series */ 310 { USB_DEVICE(0x0930, 0x0709) }, /* TOSHIBA Pocket PC e750 Series */
311 { USB_DEVICE(0x0930, 0x070A) }, /* TOSHIBA Pocket PC e400 Series */ 311 { USB_DEVICE(0x0930, 0x070A) }, /* TOSHIBA Pocket PC e400 Series */
312 { USB_DEVICE(0x0930, 0x070B) }, /* TOSHIBA Pocket PC e800 Series */ 312 { USB_DEVICE(0x0930, 0x070B) }, /* TOSHIBA Pocket PC e800 Series */
@@ -488,7 +488,7 @@ static struct usb_device_id ipaq_id_table [] = {
488 { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */ 488 { USB_DEVICE(0x0BF8, 0x1001) }, /* Fujitsu Siemens Computers USB Sync */
489 { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */ 489 { USB_DEVICE(0x0C44, 0x03A2) }, /* Motorola iDEN Smartphone */
490 { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */ 490 { USB_DEVICE(0x0C8E, 0x6000) }, /* Cesscom Luxian Series */
491 { USB_DEVICE(0x0CAD, 0x9001) }, /* Motorola PowerPad Pocket PC Device */ 491 { USB_DEVICE(0x0CAD, 0x9001) }, /* Motorola PowerPad Pocket PC Device */
492 { USB_DEVICE(0x0F4E, 0x0200) }, /* Freedom Scientific USB Sync */ 492 { USB_DEVICE(0x0F4E, 0x0200) }, /* Freedom Scientific USB Sync */
493 { USB_DEVICE(0x0F98, 0x0201) }, /* Cyberbank USB Sync */ 493 { USB_DEVICE(0x0F98, 0x0201) }, /* Cyberbank USB Sync */
494 { USB_DEVICE(0x0FB8, 0x3001) }, /* Wistron USB Sync */ 494 { USB_DEVICE(0x0FB8, 0x3001) }, /* Wistron USB Sync */
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index 1b94daa61584..cbe5530f3db2 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -227,7 +227,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp)
227 0, 227 0,
228 100000); 228 100000);
229 if (result < 0) 229 if (result < 0)
230 dev_err(&port->dev, "Init of modem failed (error = %d)", result); 230 dev_err(&port->dev, "Init of modem failed (error = %d)\n", result);
231 231
232 /* reset the bulk pipes */ 232 /* reset the bulk pipes */
233 usb_clear_halt(dev, usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress)); 233 usb_clear_halt(dev, usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress));
@@ -255,7 +255,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp)
255 0, 255 0,
256 100000); 256 100000);
257 if (result < 0) 257 if (result < 0)
258 dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)", result); 258 dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)\n", result);
259 259
260 /*--4: setup the initial flowcontrol */ 260 /*--4: setup the initial flowcontrol */
261 dbg("%s:setting init flowcontrol (%s)",__FUNCTION__,buf_flow_init); 261 dbg("%s:setting init flowcontrol (%s)",__FUNCTION__,buf_flow_init);
@@ -268,7 +268,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp)
268 0x10, 268 0x10,
269 200000); 269 200000);
270 if (result < 0) 270 if (result < 0)
271 dev_err(&port->dev, "initial flowcontrol failed (error = %d)", result); 271 dev_err(&port->dev, "initial flowcontrol failed (error = %d)\n", result);
272 272
273 273
274 /*--5: raise the dtr */ 274 /*--5: raise the dtr */
@@ -282,7 +282,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp)
282 0, 282 0,
283 200000); 283 200000);
284 if (result < 0) 284 if (result < 0)
285 dev_err(&port->dev, "setting dtr failed (error = %d)", result); 285 dev_err(&port->dev, "setting dtr failed (error = %d)\n", result);
286 286
287 /*--6: raise the rts */ 287 /*--6: raise the rts */
288 dbg("%s:raising rts",__FUNCTION__); 288 dbg("%s:raising rts",__FUNCTION__);
@@ -295,7 +295,7 @@ static int ipw_open(struct usb_serial_port *port, struct file *filp)
295 0, 295 0,
296 200000); 296 200000);
297 if (result < 0) 297 if (result < 0)
298 dev_err(&port->dev, "setting dtr failed (error = %d)", result); 298 dev_err(&port->dev, "setting dtr failed (error = %d)\n", result);
299 299
300 kfree(buf_flow_init); 300 kfree(buf_flow_init);
301 return 0; 301 return 0;
@@ -322,7 +322,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp)
322 0, 322 0,
323 200000); 323 200000);
324 if (result < 0) 324 if (result < 0)
325 dev_err(&port->dev, "dropping dtr failed (error = %d)", result); 325 dev_err(&port->dev, "dropping dtr failed (error = %d)\n", result);
326 326
327 /*--2: drop the rts */ 327 /*--2: drop the rts */
328 dbg("%s:dropping rts",__FUNCTION__); 328 dbg("%s:dropping rts",__FUNCTION__);
@@ -334,7 +334,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp)
334 0, 334 0,
335 200000); 335 200000);
336 if (result < 0) 336 if (result < 0)
337 dev_err(&port->dev, "dropping rts failed (error = %d)", result); 337 dev_err(&port->dev, "dropping rts failed (error = %d)\n", result);
338 338
339 339
340 /*--3: purge */ 340 /*--3: purge */
@@ -347,7 +347,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp)
347 0, 347 0,
348 200000); 348 200000);
349 if (result < 0) 349 if (result < 0)
350 dev_err(&port->dev, "purge failed (error = %d)", result); 350 dev_err(&port->dev, "purge failed (error = %d)\n", result);
351 351
352 352
353 /* send RXBULK_off (tell modem to stop transmitting bulk data on rx chan) */ 353 /* send RXBULK_off (tell modem to stop transmitting bulk data on rx chan) */
@@ -361,7 +361,7 @@ static void ipw_close(struct usb_serial_port *port, struct file * filp)
361 100000); 361 100000);
362 362
363 if (result < 0) 363 if (result < 0)
364 dev_err(&port->dev, "Disabling bulk RxRead failed (error = %d)", result); 364 dev_err(&port->dev, "Disabling bulk RxRead failed (error = %d)\n", result);
365 365
366 /* shutdown any in-flight urbs that we know about */ 366 /* shutdown any in-flight urbs that we know about */
367 usb_kill_urb(port->read_urb); 367 usb_kill_urb(port->read_urb);
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 01e811becec4..e02c198016b0 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -478,7 +478,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp)
478 response = usb_submit_urb(port0->interrupt_in_urb, GFP_KERNEL); 478 response = usb_submit_urb(port0->interrupt_in_urb, GFP_KERNEL);
479 if (response) 479 if (response)
480 dev_err(&port->dev, 480 dev_err(&port->dev,
481 "%s - Error %d submitting control urb", 481 "%s - Error %d submitting control urb\n",
482 __FUNCTION__, response); 482 __FUNCTION__, response);
483 } 483 }
484 484
@@ -492,7 +492,7 @@ static int mos7720_open(struct usb_serial_port *port, struct file * filp)
492 response = usb_submit_urb(port->read_urb, GFP_KERNEL); 492 response = usb_submit_urb(port->read_urb, GFP_KERNEL);
493 if (response) 493 if (response)
494 dev_err(&port->dev, 494 dev_err(&port->dev,
495 "%s - Error %d submitting read urb", __FUNCTION__, response); 495 "%s - Error %d submitting read urb\n", __FUNCTION__, response);
496 496
497 /* initialize our icount structure */ 497 /* initialize our icount structure */
498 memset(&(mos7720_port->icount), 0x00, sizeof(mos7720_port->icount)); 498 memset(&(mos7720_port->icount), 0x00, sizeof(mos7720_port->icount));
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index d19861166b50..eea226ae37bd 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -256,7 +256,7 @@ static void setup_line(struct work_struct *work)
256 100); 256 100);
257 257
258 if (result != OTI6858_CTRL_PKT_SIZE) { 258 if (result != OTI6858_CTRL_PKT_SIZE) {
259 dev_err(&port->dev, "%s(): error reading status", __FUNCTION__); 259 dev_err(&port->dev, "%s(): error reading status\n", __FUNCTION__);
260 kfree(new_setup); 260 kfree(new_setup);
261 /* we will try again */ 261 /* we will try again */
262 schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2)); 262 schedule_delayed_work(&priv->delayed_setup_work, msecs_to_jiffies(2));
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 0bb8de4cc524..959b3e4e9077 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -48,7 +48,7 @@ enum devicetype {
48static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) 48static int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
49{ 49{
50 int result; 50 int result;
51 dev_dbg(&udev->dev, "%s", "SET POWER STATE"); 51 dev_dbg(&udev->dev, "%s", "SET POWER STATE\n");
52 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 52 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
53 0x00, /* __u8 request */ 53 0x00, /* __u8 request */
54 0x40, /* __u8 request type */ 54 0x40, /* __u8 request type */
@@ -63,7 +63,7 @@ static int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
63static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode) 63static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
64{ 64{
65 int result; 65 int result;
66 dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH"); 66 dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH\n");
67 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 67 result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
68 SWIMS_USB_REQUEST_SetMode, /* __u8 request */ 68 SWIMS_USB_REQUEST_SetMode, /* __u8 request */
69 SWIMS_USB_REQUEST_TYPE_SetMode, /* __u8 request type */ 69 SWIMS_USB_REQUEST_TYPE_SetMode, /* __u8 request type */
@@ -397,7 +397,7 @@ static void sierra_indat_callback(struct urb *urb)
397 err = usb_submit_urb(urb, GFP_ATOMIC); 397 err = usb_submit_urb(urb, GFP_ATOMIC);
398 if (err) 398 if (err)
399 dev_err(&port->dev, "resubmit read urb failed." 399 dev_err(&port->dev, "resubmit read urb failed."
400 "(%d)", err); 400 "(%d)\n", err);
401 } 401 }
402 } 402 }
403 return; 403 return;
@@ -525,7 +525,7 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
525 525
526 result = usb_submit_urb(urb, GFP_KERNEL); 526 result = usb_submit_urb(urb, GFP_KERNEL);
527 if (result) { 527 if (result) {
528 dev_err(&port->dev, "submit urb %d failed (%d) %d", 528 dev_err(&port->dev, "submit urb %d failed (%d) %d\n",
529 i, result, urb->transfer_buffer_length); 529 i, result, urb->transfer_buffer_length);
530 } 530 }
531 } 531 }
@@ -538,7 +538,7 @@ static int sierra_open(struct usb_serial_port *port, struct file *filp)
538 if (port->interrupt_in_urb) { 538 if (port->interrupt_in_urb) {
539 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 539 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
540 if (result) 540 if (result)
541 dev_err(&port->dev, "submit irq_in urb failed %d", 541 dev_err(&port->dev, "submit irq_in urb failed %d\n",
542 result); 542 result);
543 } 543 }
544 return 0; 544 return 0;
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 6831dca93c1b..93a7724e167a 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -3,7 +3,7 @@
3 * $Id: isd200.c,v 1.16 2002/04/22 03:39:43 mdharm Exp $ 3 * $Id: isd200.c,v 1.16 2002/04/22 03:39:43 mdharm Exp $
4 * 4 *
5 * Current development and maintenance: 5 * Current development and maintenance:
6 * (C) 2001-2002 Björn Stenberg (bjorn@haxx.se) 6 * (C) 2001-2002 Björn Stenberg (bjorn@haxx.se)
7 * 7 *
8 * Developed with the assistance of: 8 * Developed with the assistance of:
9 * (C) 2002 Alan Stern <stern@rowland.org> 9 * (C) 2002 Alan Stern <stern@rowland.org>
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 9b656ec427d0..22ab2380367d 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -407,7 +407,7 @@ UNUSUAL_DEV( 0x04cb, 0x0100, 0x0000, 0x2210,
407 "FinePix 1400Zoom", 407 "FinePix 1400Zoom",
408 US_SC_UFI, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN), 408 US_SC_UFI, US_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN),
409 409
410/* Reported by Peter Wächtler <pwaechtler@loewe-komp.de> 410/* Reported by Peter Wächtler <pwaechtler@loewe-komp.de>
411 * The device needs the flags only. 411 * The device needs the flags only.
412 */ 412 */
413UNUSUAL_DEV( 0x04ce, 0x0002, 0x0074, 0x0074, 413UNUSUAL_DEV( 0x04ce, 0x0002, 0x0074, 0x0074,
@@ -1551,7 +1551,7 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
1551 US_FL_GO_SLOW ), 1551 US_FL_GO_SLOW ),
1552 1552
1553/* 1553/*
1554 * David Härdeman <david@2gen.com> 1554 * David Härdeman <david@2gen.com>
1555 * The key makes the SCSI stack print confusing (but harmless) messages 1555 * The key makes the SCSI stack print confusing (but harmless) messages
1556 */ 1556 */
1557UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100, 1557UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100,
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 3451e8d03ab0..ac6114eea0c3 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -907,12 +907,9 @@ static int usb_stor_scan_thread(void * __us)
907 if (delay_use > 0) { 907 if (delay_use > 0) {
908 printk(KERN_DEBUG "usb-storage: waiting for device " 908 printk(KERN_DEBUG "usb-storage: waiting for device "
909 "to settle before scanning\n"); 909 "to settle before scanning\n");
910retry: 910 wait_event_freezable_timeout(us->delay_wait,
911 wait_event_interruptible_timeout(us->delay_wait,
912 test_bit(US_FLIDX_DISCONNECTING, &us->flags), 911 test_bit(US_FLIDX_DISCONNECTING, &us->flags),
913 delay_use * HZ); 912 delay_use * HZ);
914 if (try_to_freeze())
915 goto retry;
916 } 913 }
917 914
918 /* If the device is still connected, perform the scanning */ 915 /* If the device is still connected, perform the scanning */
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index b3bf4ecc983a..fb9d8d0b2c04 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -661,7 +661,7 @@ config FB_HECUBA
661 help 661 help
662 This enables support for the Hecuba board. This driver was tested 662 This enables support for the Hecuba board. This driver was tested
663 with an E-Ink 800x600 display and x86 SBCs through a 16 bit GPIO 663 with an E-Ink 800x600 display and x86 SBCs through a 16 bit GPIO
664 interface (8 bit data, 4 bit control). If you anticpate using 664 interface (8 bit data, 4 bit control). If you anticipate using
665 this driver, say Y or M; otherwise say N. You must specify the 665 this driver, say Y or M; otherwise say N. You must specify the
666 GPIO IO address to be used for setting control and data. 666 GPIO IO address to be used for setting control and data.
667 667
@@ -815,7 +815,7 @@ config FB_XVR500
815 help 815 help
816 This is the framebuffer device for the Sun XVR-500 and similar 816 This is the framebuffer device for the Sun XVR-500 and similar
817 graphics cards based upon the 3DLABS Wildcat chipset. The driver 817 graphics cards based upon the 3DLABS Wildcat chipset. The driver
818 only works on sparc64 systems where the system firwmare has 818 only works on sparc64 systems where the system firmware has
819 mostly initialized the card already. It is treated as a 819 mostly initialized the card already. It is treated as a
820 completely dumb framebuffer device. 820 completely dumb framebuffer device.
821 821
@@ -828,7 +828,7 @@ config FB_XVR2500
828 help 828 help
829 This is the framebuffer device for the Sun XVR-2500 and similar 829 This is the framebuffer device for the Sun XVR-2500 and similar
830 graphics cards based upon the 3DLABS Wildcat chipset. The driver 830 graphics cards based upon the 3DLABS Wildcat chipset. The driver
831 only works on sparc64 systems where the system firwmare has 831 only works on sparc64 systems where the system firmware has
832 mostly initialized the card already. It is treated as a 832 mostly initialized the card already. It is treated as a
833 completely dumb framebuffer device. 833 completely dumb framebuffer device.
834 834
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c
index f2e243c353f9..4c9ec3f58c52 100644
--- a/drivers/video/amifb.c
+++ b/drivers/video/amifb.c
@@ -112,7 +112,7 @@
112 +----------+---------------------------------------------+----------+-------+ 112 +----------+---------------------------------------------+----------+-------+
113 | | ^ | | | 113 | | ^ | | |
114 | | |upper_margin | | | 114 | | |upper_margin | | |
115 | | ¥ | | | 115 | | v | | |
116 +----------###############################################----------+-------+ 116 +----------###############################################----------+-------+
117 | # ^ # | | 117 | # ^ # | |
118 | # | # | | 118 | # | # | |
@@ -133,15 +133,15 @@
133 | # | # | | 133 | # | # | |
134 | # | # | | 134 | # | # | |
135 | # | # | | 135 | # | # | |
136 | # ¥ # | | 136 | # v # | |
137 +----------###############################################----------+-------+ 137 +----------###############################################----------+-------+
138 | | ^ | | | 138 | | ^ | | |
139 | | |lower_margin | | | 139 | | |lower_margin | | |
140 | | ¥ | | | 140 | | v | | |
141 +----------+---------------------------------------------+----------+-------+ 141 +----------+---------------------------------------------+----------+-------+
142 | | ^ | | | 142 | | ^ | | |
143 | | |vsync_len | | | 143 | | |vsync_len | | |
144 | | ¥ | | | 144 | | v | | |
145 +----------+---------------------------------------------+----------+-------+ 145 +----------+---------------------------------------------+----------+-------+
146 146
147 147
@@ -325,7 +325,7 @@
325 CCIR -> PAL 325 CCIR -> PAL
326 ----------- 326 -----------
327 327
328 - a scanline is 64 µs long, of which 52.48 µs are visible. This is about 328 - a scanline is 64 µs long, of which 52.48 µs are visible. This is about
329 736 visible 70 ns pixels per line. 329 736 visible 70 ns pixels per line.
330 - we have 625 scanlines, of which 575 are visible (interlaced); after 330 - we have 625 scanlines, of which 575 are visible (interlaced); after
331 rounding this becomes 576. 331 rounding this becomes 576.
@@ -333,7 +333,7 @@
333 RETMA -> NTSC 333 RETMA -> NTSC
334 ------------- 334 -------------
335 335
336 - a scanline is 63.5 µs long, of which 53.5 µs are visible. This is about 336 - a scanline is 63.5 µs long, of which 53.5 µs are visible. This is about
337 736 visible 70 ns pixels per line. 337 736 visible 70 ns pixels per line.
338 - we have 525 scanlines, of which 485 are visible (interlaced); after 338 - we have 525 scanlines, of which 485 are visible (interlaced); after
339 rounding this becomes 484. 339 rounding this becomes 484.
@@ -802,7 +802,7 @@ static u_short ecs_palette[32];
802 802
803static u_short do_vmode_full = 0; /* Change the Video Mode */ 803static u_short do_vmode_full = 0; /* Change the Video Mode */
804static u_short do_vmode_pan = 0; /* Update the Video Mode */ 804static u_short do_vmode_pan = 0; /* Update the Video Mode */
805static short do_blank = 0; /* (Un)Blank the Screen (±1) */ 805static short do_blank = 0; /* (Un)Blank the Screen (±1) */
806static u_short do_cursor = 0; /* Move the Cursor */ 806static u_short do_cursor = 0; /* Move the Cursor */
807 807
808 808
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index abe0c435a664..d775eb6590b6 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -26,7 +26,7 @@
26 * Anthony Tong <atong@uiuc.edu> 26 * Anthony Tong <atong@uiuc.edu>
27 * 27 *
28 * Generic LCD support written by Daniel Mantione, ported from 2.4.20 by Alex Kern 28 * Generic LCD support written by Daniel Mantione, ported from 2.4.20 by Alex Kern
29 * Many Thanks to Ville Syrjälä for patches and fixing nasting 16 bit color bug. 29 * Many Thanks to Ville Syrjälä for patches and fixing nasting 16 bit color bug.
30 * 30 *
31 * This file is subject to the terms and conditions of the GNU General Public 31 * This file is subject to the terms and conditions of the GNU General Public
32 * License. See the file COPYING in the main directory of this archive for 32 * License. See the file COPYING in the main directory of this archive for
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c
index 832e4613673a..62bd4441b5e0 100644
--- a/drivers/video/au1100fb.c
+++ b/drivers/video/au1100fb.c
@@ -457,7 +457,7 @@ static struct fb_ops au1100fb_ops =
457 457
458/* AU1100 LCD controller device driver */ 458/* AU1100 LCD controller device driver */
459 459
460int au1100fb_drv_probe(struct device *dev) 460static int __init au1100fb_drv_probe(struct device *dev)
461{ 461{
462 struct au1100fb_device *fbdev = NULL; 462 struct au1100fb_device *fbdev = NULL;
463 struct resource *regs_res; 463 struct resource *regs_res;
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index a22ccf9485a4..267422f66255 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -27,7 +27,7 @@ config VGACON_SOFT_SCROLLBACK
27 The scrollback buffer of the standard VGA console is located in 27 The scrollback buffer of the standard VGA console is located in
28 the VGA RAM. The size of this RAM is fixed and is quite small. 28 the VGA RAM. The size of this RAM is fixed and is quite small.
29 If you require a larger scrollback buffer, this can be placed in 29 If you require a larger scrollback buffer, this can be placed in
30 System RAM which is dynamically allocated during intialization. 30 System RAM which is dynamically allocated during initialization.
31 Placing the scrollback buffer in System RAM will slightly slow 31 Placing the scrollback buffer in System RAM will slightly slow
32 down the console. 32 down the console.
33 33
diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c
index f57d7b2758b7..d31b203bf654 100644
--- a/drivers/video/console/newport_con.c
+++ b/drivers/video/console/newport_con.c
@@ -98,7 +98,7 @@ static inline void newport_init_cmap(void)
98 } 98 }
99} 99}
100 100
101static struct linux_logo *newport_show_logo(void) 101static const struct linux_logo *newport_show_logo(void)
102{ 102{
103#ifdef CONFIG_LOGO_SGI_CLUT224 103#ifdef CONFIG_LOGO_SGI_CLUT224
104 const struct linux_logo *logo = fb_find_logo(8); 104 const struct linux_logo *logo = fb_find_logo(8);
@@ -108,8 +108,8 @@ static struct linux_logo *newport_show_logo(void)
108 108
109 if (!logo) 109 if (!logo)
110 return NULL; 110 return NULL;
111 *clut = logo->clut; 111 clut = logo->clut;
112 *data = logo->data; 112 data = logo->data;
113 113
114 for (i = 0; i < logo->clutsize; i++) { 114 for (i = 0; i < logo->clutsize; i++) {
115 newport_bfwait(npregs); 115 newport_bfwait(npregs);
diff --git a/drivers/video/cyber2000fb.c b/drivers/video/cyber2000fb.c
index 9bb2cbfe4a3d..5fb8675e0d6b 100644
--- a/drivers/video/cyber2000fb.c
+++ b/drivers/video/cyber2000fb.c
@@ -62,7 +62,7 @@ struct cfb_info {
62 struct display_switch *dispsw; 62 struct display_switch *dispsw;
63 struct display *display; 63 struct display *display;
64 struct pci_dev *dev; 64 struct pci_dev *dev;
65 unsigned char __iomem *region; 65 unsigned char __iomem *region;
66 unsigned char __iomem *regs; 66 unsigned char __iomem *regs;
67 u_int id; 67 u_int id;
68 int func_use_count; 68 int func_use_count;
@@ -97,11 +97,11 @@ MODULE_PARM_DESC(default_font, "Default font name");
97/* 97/*
98 * Our access methods. 98 * Our access methods.
99 */ 99 */
100#define cyber2000fb_writel(val,reg,cfb) writel(val, (cfb)->regs + (reg)) 100#define cyber2000fb_writel(val, reg, cfb) writel(val, (cfb)->regs + (reg))
101#define cyber2000fb_writew(val,reg,cfb) writew(val, (cfb)->regs + (reg)) 101#define cyber2000fb_writew(val, reg, cfb) writew(val, (cfb)->regs + (reg))
102#define cyber2000fb_writeb(val,reg,cfb) writeb(val, (cfb)->regs + (reg)) 102#define cyber2000fb_writeb(val, reg, cfb) writeb(val, (cfb)->regs + (reg))
103 103
104#define cyber2000fb_readb(reg,cfb) readb((cfb)->regs + (reg)) 104#define cyber2000fb_readb(reg, cfb) readb((cfb)->regs + (reg))
105 105
106static inline void 106static inline void
107cyber2000_crtcw(unsigned int reg, unsigned int val, struct cfb_info *cfb) 107cyber2000_crtcw(unsigned int reg, unsigned int val, struct cfb_info *cfb)
@@ -221,12 +221,8 @@ cyber2000fb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
221static void 221static void
222cyber2000fb_imageblit(struct fb_info *info, const struct fb_image *image) 222cyber2000fb_imageblit(struct fb_info *info, const struct fb_image *image)
223{ 223{
224// struct cfb_info *cfb = (struct cfb_info *)info; 224 cfb_imageblit(info, image);
225 225 return;
226// if (!(cfb->fb.var.accel_flags & FB_ACCELF_TEXT)) {
227 cfb_imageblit(info, image);
228 return;
229// }
230} 226}
231 227
232static int cyber2000fb_sync(struct fb_info *info) 228static int cyber2000fb_sync(struct fb_info *info)
@@ -277,12 +273,12 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
277 273
278 /* 274 /*
279 * Pseudocolour: 275 * Pseudocolour:
280 * 8 8 276 * 8 8
281 * pixel --/--+--/--> red lut --> red dac 277 * pixel --/--+--/--> red lut --> red dac
282 * | 8 278 * | 8
283 * +--/--> green lut --> green dac 279 * +--/--> green lut --> green dac
284 * | 8 280 * | 8
285 * +--/--> blue lut --> blue dac 281 * +--/--> blue lut --> blue dac
286 */ 282 */
287 case FB_VISUAL_PSEUDOCOLOR: 283 case FB_VISUAL_PSEUDOCOLOR:
288 if (regno >= NR_PALETTE) 284 if (regno >= NR_PALETTE)
@@ -292,9 +288,9 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
292 green >>= 8; 288 green >>= 8;
293 blue >>= 8; 289 blue >>= 8;
294 290
295 cfb->palette[regno].red = red; 291 cfb->palette[regno].red = red;
296 cfb->palette[regno].green = green; 292 cfb->palette[regno].green = green;
297 cfb->palette[regno].blue = blue; 293 cfb->palette[regno].blue = blue;
298 294
299 cyber2000fb_writeb(regno, 0x3c8, cfb); 295 cyber2000fb_writeb(regno, 0x3c8, cfb);
300 cyber2000fb_writeb(red, 0x3c9, cfb); 296 cyber2000fb_writeb(red, 0x3c9, cfb);
@@ -304,12 +300,12 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
304 300
305 /* 301 /*
306 * Direct colour: 302 * Direct colour:
307 * n rl 303 * n rl
308 * pixel --/--+--/--> red lut --> red dac 304 * pixel --/--+--/--> red lut --> red dac
309 * | gl 305 * | gl
310 * +--/--> green lut --> green dac 306 * +--/--> green lut --> green dac
311 * | bl 307 * | bl
312 * +--/--> blue lut --> blue dac 308 * +--/--> blue lut --> blue dac
313 * n = bpp, rl = red length, gl = green length, bl = blue length 309 * n = bpp, rl = red length, gl = green length, bl = blue length
314 */ 310 */
315 case FB_VISUAL_DIRECTCOLOR: 311 case FB_VISUAL_DIRECTCOLOR:
@@ -325,9 +321,11 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
325 * to the high 6 bits of the LUT. 321 * to the high 6 bits of the LUT.
326 */ 322 */
327 cyber2000fb_writeb(regno << 2, 0x3c8, cfb); 323 cyber2000fb_writeb(regno << 2, 0x3c8, cfb);
328 cyber2000fb_writeb(cfb->palette[regno >> 1].red, 0x3c9, cfb); 324 cyber2000fb_writeb(cfb->palette[regno >> 1].red,
325 0x3c9, cfb);
329 cyber2000fb_writeb(green, 0x3c9, cfb); 326 cyber2000fb_writeb(green, 0x3c9, cfb);
330 cyber2000fb_writeb(cfb->palette[regno >> 1].blue, 0x3c9, cfb); 327 cyber2000fb_writeb(cfb->palette[regno >> 1].blue,
328 0x3c9, cfb);
331 329
332 green = cfb->palette[regno << 3].green; 330 green = cfb->palette[regno << 3].green;
333 331
@@ -335,9 +333,9 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
335 } 333 }
336 334
337 if (var->green.length >= 5 && regno < 32) { 335 if (var->green.length >= 5 && regno < 32) {
338 cfb->palette[regno << 3].red = red; 336 cfb->palette[regno << 3].red = red;
339 cfb->palette[regno << 3].green = green; 337 cfb->palette[regno << 3].green = green;
340 cfb->palette[regno << 3].blue = blue; 338 cfb->palette[regno << 3].blue = blue;
341 339
342 /* 340 /*
343 * The 5 bits of each colour component are 341 * The 5 bits of each colour component are
@@ -351,9 +349,9 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
351 } 349 }
352 350
353 if (var->green.length == 4 && regno < 16) { 351 if (var->green.length == 4 && regno < 16) {
354 cfb->palette[regno << 4].red = red; 352 cfb->palette[regno << 4].red = red;
355 cfb->palette[regno << 4].green = green; 353 cfb->palette[regno << 4].green = green;
356 cfb->palette[regno << 4].blue = blue; 354 cfb->palette[regno << 4].blue = blue;
357 355
358 /* 356 /*
359 * The 5 bits of each colour component are 357 * The 5 bits of each colour component are
@@ -377,12 +375,12 @@ cyber2000fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
377 375
378 /* 376 /*
379 * True colour: 377 * True colour:
380 * n rl 378 * n rl
381 * pixel --/--+--/--> red dac 379 * pixel --/--+--/--> red dac
382 * | gl 380 * | gl
383 * +--/--> green dac 381 * +--/--> green dac
384 * | bl 382 * | bl
385 * +--/--> blue dac 383 * +--/--> blue dac
386 * n = bpp, rl = red length, gl = green length, bl = blue length 384 * n = bpp, rl = red length, gl = green length, bl = blue length
387 */ 385 */
388 case FB_VISUAL_TRUECOLOR: 386 case FB_VISUAL_TRUECOLOR:
@@ -494,9 +492,9 @@ static void cyber2000fb_set_timing(struct cfb_info *cfb, struct par_info *hw)
494 492
495 /* PLL registers */ 493 /* PLL registers */
496 cyber2000_grphw(EXT_DCLK_MULT, hw->clock_mult, cfb); 494 cyber2000_grphw(EXT_DCLK_MULT, hw->clock_mult, cfb);
497 cyber2000_grphw(EXT_DCLK_DIV, hw->clock_div, cfb); 495 cyber2000_grphw(EXT_DCLK_DIV, hw->clock_div, cfb);
498 cyber2000_grphw(EXT_MCLK_MULT, cfb->mclk_mult, cfb); 496 cyber2000_grphw(EXT_MCLK_MULT, cfb->mclk_mult, cfb);
499 cyber2000_grphw(EXT_MCLK_DIV, cfb->mclk_div, cfb); 497 cyber2000_grphw(EXT_MCLK_DIV, cfb->mclk_div, cfb);
500 cyber2000_grphw(0x90, 0x01, cfb); 498 cyber2000_grphw(0x90, 0x01, cfb);
501 cyber2000_grphw(0xb9, 0x80, cfb); 499 cyber2000_grphw(0xb9, 0x80, cfb);
502 cyber2000_grphw(0xb9, 0x00, cfb); 500 cyber2000_grphw(0xb9, 0x00, cfb);
@@ -515,8 +513,8 @@ static void cyber2000fb_set_timing(struct cfb_info *cfb, struct par_info *hw)
515 /* 513 /*
516 * Set up accelerator registers 514 * Set up accelerator registers
517 */ 515 */
518 cyber2000fb_writew(hw->width, CO_REG_SRC_WIDTH, cfb); 516 cyber2000fb_writew(hw->width, CO_REG_SRC_WIDTH, cfb);
519 cyber2000fb_writew(hw->width, CO_REG_DEST_WIDTH, cfb); 517 cyber2000fb_writew(hw->width, CO_REG_DEST_WIDTH, cfb);
520 cyber2000fb_writeb(hw->co_pixfmt, CO_REG_PIXFMT, cfb); 518 cyber2000fb_writeb(hw->co_pixfmt, CO_REG_PIXFMT, cfb);
521} 519}
522 520
@@ -549,15 +547,15 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
549{ 547{
550 u_int Htotal, Hblankend, Hsyncend; 548 u_int Htotal, Hblankend, Hsyncend;
551 u_int Vtotal, Vdispend, Vblankstart, Vblankend, Vsyncstart, Vsyncend; 549 u_int Vtotal, Vdispend, Vblankstart, Vblankend, Vsyncstart, Vsyncend;
552#define BIT(v,b1,m,b2) (((v >> b1) & m) << b2) 550#define ENCODE_BIT(v, b1, m, b2) ((((v) >> (b1)) & (m)) << (b2))
553 551
554 hw->crtc[13] = hw->pitch; 552 hw->crtc[13] = hw->pitch;
555 hw->crtc[17] = 0xe3; 553 hw->crtc[17] = 0xe3;
556 hw->crtc[14] = 0; 554 hw->crtc[14] = 0;
557 hw->crtc[8] = 0; 555 hw->crtc[8] = 0;
558 556
559 Htotal = var->xres + var->right_margin + 557 Htotal = var->xres + var->right_margin +
560 var->hsync_len + var->left_margin; 558 var->hsync_len + var->left_margin;
561 559
562 if (Htotal > 2080) 560 if (Htotal > 2080)
563 return -EINVAL; 561 return -EINVAL;
@@ -567,15 +565,15 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
567 hw->crtc[2] = var->xres >> 3; 565 hw->crtc[2] = var->xres >> 3;
568 hw->crtc[4] = (var->xres + var->right_margin) >> 3; 566 hw->crtc[4] = (var->xres + var->right_margin) >> 3;
569 567
570 Hblankend = (Htotal - 4*8) >> 3; 568 Hblankend = (Htotal - 4 * 8) >> 3;
571 569
572 hw->crtc[3] = BIT(Hblankend, 0, 0x1f, 0) | 570 hw->crtc[3] = ENCODE_BIT(Hblankend, 0, 0x1f, 0) |
573 BIT(1, 0, 0x01, 7); 571 ENCODE_BIT(1, 0, 0x01, 7);
574 572
575 Hsyncend = (var->xres + var->right_margin + var->hsync_len) >> 3; 573 Hsyncend = (var->xres + var->right_margin + var->hsync_len) >> 3;
576 574
577 hw->crtc[5] = BIT(Hsyncend, 0, 0x1f, 0) | 575 hw->crtc[5] = ENCODE_BIT(Hsyncend, 0, 0x1f, 0) |
578 BIT(Hblankend, 5, 0x01, 7); 576 ENCODE_BIT(Hblankend, 5, 0x01, 7);
579 577
580 Vdispend = var->yres - 1; 578 Vdispend = var->yres - 1;
581 Vsyncstart = var->yres + var->lower_margin; 579 Vsyncstart = var->yres + var->lower_margin;
@@ -590,20 +588,20 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
590 Vblankend = Vtotal - 10; 588 Vblankend = Vtotal - 10;
591 589
592 hw->crtc[6] = Vtotal; 590 hw->crtc[6] = Vtotal;
593 hw->crtc[7] = BIT(Vtotal, 8, 0x01, 0) | 591 hw->crtc[7] = ENCODE_BIT(Vtotal, 8, 0x01, 0) |
594 BIT(Vdispend, 8, 0x01, 1) | 592 ENCODE_BIT(Vdispend, 8, 0x01, 1) |
595 BIT(Vsyncstart, 8, 0x01, 2) | 593 ENCODE_BIT(Vsyncstart, 8, 0x01, 2) |
596 BIT(Vblankstart,8, 0x01, 3) | 594 ENCODE_BIT(Vblankstart, 8, 0x01, 3) |
597 BIT(1, 0, 0x01, 4) | 595 ENCODE_BIT(1, 0, 0x01, 4) |
598 BIT(Vtotal, 9, 0x01, 5) | 596 ENCODE_BIT(Vtotal, 9, 0x01, 5) |
599 BIT(Vdispend, 9, 0x01, 6) | 597 ENCODE_BIT(Vdispend, 9, 0x01, 6) |
600 BIT(Vsyncstart, 9, 0x01, 7); 598 ENCODE_BIT(Vsyncstart, 9, 0x01, 7);
601 hw->crtc[9] = BIT(0, 0, 0x1f, 0) | 599 hw->crtc[9] = ENCODE_BIT(0, 0, 0x1f, 0) |
602 BIT(Vblankstart,9, 0x01, 5) | 600 ENCODE_BIT(Vblankstart, 9, 0x01, 5) |
603 BIT(1, 0, 0x01, 6); 601 ENCODE_BIT(1, 0, 0x01, 6);
604 hw->crtc[10] = Vsyncstart; 602 hw->crtc[10] = Vsyncstart;
605 hw->crtc[11] = BIT(Vsyncend, 0, 0x0f, 0) | 603 hw->crtc[11] = ENCODE_BIT(Vsyncend, 0, 0x0f, 0) |
606 BIT(1, 0, 0x01, 7); 604 ENCODE_BIT(1, 0, 0x01, 7);
607 hw->crtc[12] = Vdispend; 605 hw->crtc[12] = Vdispend;
608 hw->crtc[15] = Vblankstart; 606 hw->crtc[15] = Vblankstart;
609 hw->crtc[16] = Vblankend; 607 hw->crtc[16] = Vblankend;
@@ -615,10 +613,10 @@ cyber2000fb_decode_crtc(struct par_info *hw, struct cfb_info *cfb,
615 * 4=LINECOMP:10 5-IVIDEO 6=FIXCNT 613 * 4=LINECOMP:10 5-IVIDEO 6=FIXCNT
616 */ 614 */
617 hw->crtc_ofl = 615 hw->crtc_ofl =
618 BIT(Vtotal, 10, 0x01, 0) | 616 ENCODE_BIT(Vtotal, 10, 0x01, 0) |
619 BIT(Vdispend, 10, 0x01, 1) | 617 ENCODE_BIT(Vdispend, 10, 0x01, 1) |
620 BIT(Vsyncstart, 10, 0x01, 2) | 618 ENCODE_BIT(Vsyncstart, 10, 0x01, 2) |
621 BIT(Vblankstart,10, 0x01, 3) | 619 ENCODE_BIT(Vblankstart, 10, 0x01, 3) |
622 EXT_CRT_VRTOFL_LINECOMP10; 620 EXT_CRT_VRTOFL_LINECOMP10;
623 621
624 /* woody: set the interlaced bit... */ 622 /* woody: set the interlaced bit... */
@@ -750,11 +748,11 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
750 var->red.msb_right = 0; 748 var->red.msb_right = 0;
751 var->green.msb_right = 0; 749 var->green.msb_right = 0;
752 var->blue.msb_right = 0; 750 var->blue.msb_right = 0;
751 var->transp.offset = 0;
752 var->transp.length = 0;
753 753
754 switch (var->bits_per_pixel) { 754 switch (var->bits_per_pixel) {
755 case 8: /* PSEUDOCOLOUR, 256 */ 755 case 8: /* PSEUDOCOLOUR, 256 */
756 var->transp.offset = 0;
757 var->transp.length = 0;
758 var->red.offset = 0; 756 var->red.offset = 0;
759 var->red.length = 8; 757 var->red.length = 8;
760 var->green.offset = 0; 758 var->green.offset = 0;
@@ -766,8 +764,6 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
766 case 16:/* DIRECTCOLOUR, 64k or 32k */ 764 case 16:/* DIRECTCOLOUR, 64k or 32k */
767 switch (var->green.length) { 765 switch (var->green.length) {
768 case 6: /* RGB565, 64k */ 766 case 6: /* RGB565, 64k */
769 var->transp.offset = 0;
770 var->transp.length = 0;
771 var->red.offset = 11; 767 var->red.offset = 11;
772 var->red.length = 5; 768 var->red.length = 5;
773 var->green.offset = 5; 769 var->green.offset = 5;
@@ -778,8 +774,6 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
778 774
779 default: 775 default:
780 case 5: /* RGB555, 32k */ 776 case 5: /* RGB555, 32k */
781 var->transp.offset = 0;
782 var->transp.length = 0;
783 var->red.offset = 10; 777 var->red.offset = 10;
784 var->red.length = 5; 778 var->red.length = 5;
785 var->green.offset = 5; 779 var->green.offset = 5;
@@ -802,8 +796,6 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
802 break; 796 break;
803 797
804 case 24:/* TRUECOLOUR, 16m */ 798 case 24:/* TRUECOLOUR, 16m */
805 var->transp.offset = 0;
806 var->transp.length = 0;
807 var->red.offset = 16; 799 var->red.offset = 16;
808 var->red.length = 8; 800 var->red.length = 8;
809 var->green.offset = 8; 801 var->green.offset = 8;
@@ -830,7 +822,7 @@ cyber2000fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
830 mem = var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8); 822 mem = var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8);
831 if (mem > cfb->fb.fix.smem_len) 823 if (mem > cfb->fb.fix.smem_len)
832 var->yres_virtual = cfb->fb.fix.smem_len * 8 / 824 var->yres_virtual = cfb->fb.fix.smem_len * 8 /
833 (var->bits_per_pixel * var->xres_virtual); 825 (var->bits_per_pixel * var->xres_virtual);
834 826
835 if (var->yres > var->yres_virtual) 827 if (var->yres > var->yres_virtual)
836 var->yres = var->yres_virtual; 828 var->yres = var->yres_virtual;
@@ -921,7 +913,7 @@ static int cyber2000fb_set_par(struct fb_info *info)
921 hw.fetch <<= 1; 913 hw.fetch <<= 1;
922 hw.fetch += 1; 914 hw.fetch += 1;
923 915
924 cfb->fb.fix.line_length = var->xres_virtual * var->bits_per_pixel / 8; 916 cfb->fb.fix.line_length = var->xres_virtual * var->bits_per_pixel / 8;
925 917
926 /* 918 /*
927 * Same here - if the size of the video mode exceeds the 919 * Same here - if the size of the video mode exceeds the
@@ -952,7 +944,6 @@ static int cyber2000fb_set_par(struct fb_info *info)
952 return 0; 944 return 0;
953} 945}
954 946
955
956/* 947/*
957 * Pan or Wrap the Display 948 * Pan or Wrap the Display
958 */ 949 */
@@ -1002,15 +993,15 @@ static int cyber2000fb_blank(int blank, struct fb_info *info)
1002 switch (blank) { 993 switch (blank) {
1003 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */ 994 case FB_BLANK_POWERDOWN: /* powerdown - both sync lines down */
1004 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_0; 995 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_0;
1005 break; 996 break;
1006 case FB_BLANK_HSYNC_SUSPEND: /* hsync off */ 997 case FB_BLANK_HSYNC_SUSPEND: /* hsync off */
1007 sync = EXT_SYNC_CTL_VS_NORMAL | EXT_SYNC_CTL_HS_0; 998 sync = EXT_SYNC_CTL_VS_NORMAL | EXT_SYNC_CTL_HS_0;
1008 break; 999 break;
1009 case FB_BLANK_VSYNC_SUSPEND: /* vsync off */ 1000 case FB_BLANK_VSYNC_SUSPEND: /* vsync off */
1010 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_NORMAL; 1001 sync = EXT_SYNC_CTL_VS_0 | EXT_SYNC_CTL_HS_NORMAL;
1011 break; 1002 break;
1012 case FB_BLANK_NORMAL: /* soft blank */ 1003 case FB_BLANK_NORMAL: /* soft blank */
1013 default: /* unblank */ 1004 default: /* unblank */
1014 break; 1005 break;
1015 } 1006 }
1016 1007
@@ -1018,7 +1009,8 @@ static int cyber2000fb_blank(int blank, struct fb_info *info)
1018 1009
1019 if (blank <= 1) { 1010 if (blank <= 1) {
1020 /* turn on ramdacs */ 1011 /* turn on ramdacs */
1021 cfb->ramdac_powerdown &= ~(RAMDAC_DACPWRDN | RAMDAC_BYPASS | RAMDAC_RAMPWRDN); 1012 cfb->ramdac_powerdown &= ~(RAMDAC_DACPWRDN | RAMDAC_BYPASS |
1013 RAMDAC_RAMPWRDN);
1022 cyber2000fb_write_ramdac_ctrl(cfb); 1014 cyber2000fb_write_ramdac_ctrl(cfb);
1023 } 1015 }
1024 1016
@@ -1043,7 +1035,8 @@ static int cyber2000fb_blank(int blank, struct fb_info *info)
1043 1035
1044 if (blank >= 2) { 1036 if (blank >= 2) {
1045 /* turn off ramdacs */ 1037 /* turn off ramdacs */
1046 cfb->ramdac_powerdown |= RAMDAC_DACPWRDN | RAMDAC_BYPASS | RAMDAC_RAMPWRDN; 1038 cfb->ramdac_powerdown |= RAMDAC_DACPWRDN | RAMDAC_BYPASS |
1039 RAMDAC_RAMPWRDN;
1047 cyber2000fb_write_ramdac_ctrl(cfb); 1040 cyber2000fb_write_ramdac_ctrl(cfb);
1048 } 1041 }
1049 1042
@@ -1068,7 +1061,7 @@ static struct fb_ops cyber2000fb_ops = {
1068 * of this driver. It is here solely at the moment to support the other 1061 * of this driver. It is here solely at the moment to support the other
1069 * CyberPro modules external to this driver. 1062 * CyberPro modules external to this driver.
1070 */ 1063 */
1071static struct cfb_info *int_cfb_info; 1064static struct cfb_info *int_cfb_info;
1072 1065
1073/* 1066/*
1074 * Enable access to the extended registers 1067 * Enable access to the extended registers
@@ -1085,6 +1078,7 @@ void cyber2000fb_enable_extregs(struct cfb_info *cfb)
1085 cyber2000_grphw(EXT_FUNC_CTL, old, cfb); 1078 cyber2000_grphw(EXT_FUNC_CTL, old, cfb);
1086 } 1079 }
1087} 1080}
1081EXPORT_SYMBOL(cyber2000fb_enable_extregs);
1088 1082
1089/* 1083/*
1090 * Disable access to the extended registers 1084 * Disable access to the extended registers
@@ -1104,11 +1098,13 @@ void cyber2000fb_disable_extregs(struct cfb_info *cfb)
1104 else 1098 else
1105 cfb->func_use_count -= 1; 1099 cfb->func_use_count -= 1;
1106} 1100}
1101EXPORT_SYMBOL(cyber2000fb_disable_extregs);
1107 1102
1108void cyber2000fb_get_fb_var(struct cfb_info *cfb, struct fb_var_screeninfo *var) 1103void cyber2000fb_get_fb_var(struct cfb_info *cfb, struct fb_var_screeninfo *var)
1109{ 1104{
1110 memcpy(var, &cfb->fb.var, sizeof(struct fb_var_screeninfo)); 1105 memcpy(var, &cfb->fb.var, sizeof(struct fb_var_screeninfo));
1111} 1106}
1107EXPORT_SYMBOL(cyber2000fb_get_fb_var);
1112 1108
1113/* 1109/*
1114 * Attach a capture/tv driver to the core CyberX0X0 driver. 1110 * Attach a capture/tv driver to the core CyberX0X0 driver.
@@ -1122,13 +1118,15 @@ int cyber2000fb_attach(struct cyberpro_info *info, int idx)
1122 info->fb_size = int_cfb_info->fb.fix.smem_len; 1118 info->fb_size = int_cfb_info->fb.fix.smem_len;
1123 info->enable_extregs = cyber2000fb_enable_extregs; 1119 info->enable_extregs = cyber2000fb_enable_extregs;
1124 info->disable_extregs = cyber2000fb_disable_extregs; 1120 info->disable_extregs = cyber2000fb_disable_extregs;
1125 info->info = int_cfb_info; 1121 info->info = int_cfb_info;
1126 1122
1127 strlcpy(info->dev_name, int_cfb_info->fb.fix.id, sizeof(info->dev_name)); 1123 strlcpy(info->dev_name, int_cfb_info->fb.fix.id,
1124 sizeof(info->dev_name));
1128 } 1125 }
1129 1126
1130 return int_cfb_info != NULL; 1127 return int_cfb_info != NULL;
1131} 1128}
1129EXPORT_SYMBOL(cyber2000fb_attach);
1132 1130
1133/* 1131/*
1134 * Detach a capture/tv driver from the core CyberX0X0 driver. 1132 * Detach a capture/tv driver from the core CyberX0X0 driver.
@@ -1136,12 +1134,7 @@ int cyber2000fb_attach(struct cyberpro_info *info, int idx)
1136void cyber2000fb_detach(int idx) 1134void cyber2000fb_detach(int idx)
1137{ 1135{
1138} 1136}
1139
1140EXPORT_SYMBOL(cyber2000fb_attach);
1141EXPORT_SYMBOL(cyber2000fb_detach); 1137EXPORT_SYMBOL(cyber2000fb_detach);
1142EXPORT_SYMBOL(cyber2000fb_enable_extregs);
1143EXPORT_SYMBOL(cyber2000fb_disable_extregs);
1144EXPORT_SYMBOL(cyber2000fb_get_fb_var);
1145 1138
1146/* 1139/*
1147 * These parameters give 1140 * These parameters give
@@ -1205,7 +1198,7 @@ static void cyberpro_init_hw(struct cfb_info *cfb)
1205 int i; 1198 int i;
1206 1199
1207 for (i = 0; i < sizeof(igs_regs); i += 2) 1200 for (i = 0; i < sizeof(igs_regs); i += 2)
1208 cyber2000_grphw(igs_regs[i], igs_regs[i+1], cfb); 1201 cyber2000_grphw(igs_regs[i], igs_regs[i + 1], cfb);
1209 1202
1210 if (cfb->id == ID_CYBERPRO_5000) { 1203 if (cfb->id == ID_CYBERPRO_5000) {
1211 unsigned char val; 1204 unsigned char val;
@@ -1215,8 +1208,8 @@ static void cyberpro_init_hw(struct cfb_info *cfb)
1215 } 1208 }
1216} 1209}
1217 1210
1218static struct cfb_info * __devinit 1211static struct cfb_info __devinit *cyberpro_alloc_fb_info(unsigned int id,
1219cyberpro_alloc_fb_info(unsigned int id, char *name) 1212 char *name)
1220{ 1213{
1221 struct cfb_info *cfb; 1214 struct cfb_info *cfb;
1222 1215
@@ -1228,9 +1221,9 @@ cyberpro_alloc_fb_info(unsigned int id, char *name)
1228 cfb->id = id; 1221 cfb->id = id;
1229 1222
1230 if (id == ID_CYBERPRO_5000) 1223 if (id == ID_CYBERPRO_5000)
1231 cfb->ref_ps = 40690; // 24.576 MHz 1224 cfb->ref_ps = 40690; /* 24.576 MHz */
1232 else 1225 else
1233 cfb->ref_ps = 69842; // 14.31818 MHz (69841?) 1226 cfb->ref_ps = 69842; /* 14.31818 MHz (69841?) */
1234 1227
1235 cfb->divisors[0] = 1; 1228 cfb->divisors[0] = 1;
1236 cfb->divisors[1] = 2; 1229 cfb->divisors[1] = 2;
@@ -1282,8 +1275,7 @@ cyberpro_alloc_fb_info(unsigned int id, char *name)
1282 return cfb; 1275 return cfb;
1283} 1276}
1284 1277
1285static void 1278static void cyberpro_free_fb_info(struct cfb_info *cfb)
1286cyberpro_free_fb_info(struct cfb_info *cfb)
1287{ 1279{
1288 if (cfb) { 1280 if (cfb) {
1289 /* 1281 /*
@@ -1300,8 +1292,7 @@ cyberpro_free_fb_info(struct cfb_info *cfb)
1300 * video=cyber2000:font:fontname 1292 * video=cyber2000:font:fontname
1301 */ 1293 */
1302#ifndef MODULE 1294#ifndef MODULE
1303static int 1295static int cyber2000fb_setup(char *options)
1304cyber2000fb_setup(char *options)
1305{ 1296{
1306 char *opt; 1297 char *opt;
1307 1298
@@ -1315,7 +1306,8 @@ cyber2000fb_setup(char *options)
1315 if (strncmp(opt, "font:", 5) == 0) { 1306 if (strncmp(opt, "font:", 5) == 0) {
1316 static char default_font_storage[40]; 1307 static char default_font_storage[40];
1317 1308
1318 strlcpy(default_font_storage, opt + 5, sizeof(default_font_storage)); 1309 strlcpy(default_font_storage, opt + 5,
1310 sizeof(default_font_storage));
1319 default_font = default_font_storage; 1311 default_font = default_font_storage;
1320 continue; 1312 continue;
1321 } 1313 }
@@ -1354,10 +1346,18 @@ static int __devinit cyberpro_common_probe(struct cfb_info *cfb)
1354 * Determine the size of the memory. 1346 * Determine the size of the memory.
1355 */ 1347 */
1356 switch (cfb->mem_ctl2 & MEM_CTL2_SIZE_MASK) { 1348 switch (cfb->mem_ctl2 & MEM_CTL2_SIZE_MASK) {
1357 case MEM_CTL2_SIZE_4MB: smem_size = 0x00400000; break; 1349 case MEM_CTL2_SIZE_4MB:
1358 case MEM_CTL2_SIZE_2MB: smem_size = 0x00200000; break; 1350 smem_size = 0x00400000;
1359 case MEM_CTL2_SIZE_1MB: smem_size = 0x00100000; break; 1351 break;
1360 default: smem_size = 0x00100000; break; 1352 case MEM_CTL2_SIZE_2MB:
1353 smem_size = 0x00200000;
1354 break;
1355 case MEM_CTL2_SIZE_1MB:
1356 smem_size = 0x00100000;
1357 break;
1358 default:
1359 smem_size = 0x00100000;
1360 break;
1361 } 1361 }
1362 1362
1363 cfb->fb.fix.smem_len = smem_size; 1363 cfb->fb.fix.smem_len = smem_size;
@@ -1366,8 +1366,8 @@ static int __devinit cyberpro_common_probe(struct cfb_info *cfb)
1366 1366
1367 err = -EINVAL; 1367 err = -EINVAL;
1368 if (!fb_find_mode(&cfb->fb.var, &cfb->fb, NULL, NULL, 0, 1368 if (!fb_find_mode(&cfb->fb.var, &cfb->fb, NULL, NULL, 0,
1369 &cyber2000fb_default_mode, 8)) { 1369 &cyber2000fb_default_mode, 8)) {
1370 printk("%s: no valid mode found\n", cfb->fb.fix.id); 1370 printk(KERN_ERR "%s: no valid mode found\n", cfb->fb.fix.id);
1371 goto failed; 1371 goto failed;
1372 } 1372 }
1373 1373
@@ -1377,7 +1377,7 @@ static int __devinit cyberpro_common_probe(struct cfb_info *cfb)
1377 if (cfb->fb.var.yres_virtual < cfb->fb.var.yres) 1377 if (cfb->fb.var.yres_virtual < cfb->fb.var.yres)
1378 cfb->fb.var.yres_virtual = cfb->fb.var.yres; 1378 cfb->fb.var.yres_virtual = cfb->fb.var.yres;
1379 1379
1380// fb_set_var(&cfb->fb.var, -1, &cfb->fb); 1380/* fb_set_var(&cfb->fb.var, -1, &cfb->fb); */
1381 1381
1382 /* 1382 /*
1383 * Calculate the hsync and vsync frequencies. Note that 1383 * Calculate the hsync and vsync frequencies. Note that
@@ -1425,20 +1425,20 @@ static void cyberpro_common_resume(struct cfb_info *cfb)
1425 1425
1426#include <asm/arch/hardware.h> 1426#include <asm/arch/hardware.h>
1427 1427
1428static int __devinit 1428static int __devinit cyberpro_vl_probe(void)
1429cyberpro_vl_probe(void)
1430{ 1429{
1431 struct cfb_info *cfb; 1430 struct cfb_info *cfb;
1432 int err = -ENOMEM; 1431 int err = -ENOMEM;
1433 1432
1434 if (!request_mem_region(FB_START,FB_SIZE,"CyberPro2010")) return err; 1433 if (!request_mem_region(FB_START, FB_SIZE, "CyberPro2010"))
1434 return err;
1435 1435
1436 cfb = cyberpro_alloc_fb_info(ID_CYBERPRO_2010, "CyberPro2010"); 1436 cfb = cyberpro_alloc_fb_info(ID_CYBERPRO_2010, "CyberPro2010");
1437 if (!cfb) 1437 if (!cfb)
1438 goto failed_release; 1438 goto failed_release;
1439 1439
1440 cfb->dev = NULL; 1440 cfb->dev = NULL;
1441 cfb->region = ioremap(FB_START,FB_SIZE); 1441 cfb->region = ioremap(FB_START, FB_SIZE);
1442 if (!cfb->region) 1442 if (!cfb->region)
1443 goto failed_ioremap; 1443 goto failed_ioremap;
1444 1444
@@ -1475,7 +1475,7 @@ failed:
1475failed_ioremap: 1475failed_ioremap:
1476 cyberpro_free_fb_info(cfb); 1476 cyberpro_free_fb_info(cfb);
1477failed_release: 1477failed_release:
1478 release_mem_region(FB_START,FB_SIZE); 1478 release_mem_region(FB_START, FB_SIZE);
1479 1479
1480 return err; 1480 return err;
1481} 1481}
@@ -1538,7 +1538,8 @@ static int cyberpro_pci_enable_mmio(struct cfb_info *cfb)
1538 * Allow the CyberPro to accept PCI burst accesses 1538 * Allow the CyberPro to accept PCI burst accesses
1539 */ 1539 */
1540 if (cfb->id == ID_CYBERPRO_2010) { 1540 if (cfb->id == ID_CYBERPRO_2010) {
1541 printk(KERN_INFO "%s: NOT enabling PCI bursts\n", cfb->fb.fix.id); 1541 printk(KERN_INFO "%s: NOT enabling PCI bursts\n",
1542 cfb->fb.fix.id);
1542 } else { 1543 } else {
1543 val = cyber2000_grphr(EXT_BUS_CTL, cfb); 1544 val = cyber2000_grphr(EXT_BUS_CTL, cfb);
1544 if (!(val & EXT_BUS_CTL_PCIBURST_WRITE)) { 1545 if (!(val & EXT_BUS_CTL_PCIBURST_WRITE)) {
@@ -1688,9 +1689,10 @@ static int cyberpro_pci_resume(struct pci_dev *dev)
1688} 1689}
1689 1690
1690static struct pci_device_id cyberpro_pci_table[] = { 1691static struct pci_device_id cyberpro_pci_table[] = {
1691// Not yet 1692/* Not yet
1692// { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682, 1693 * { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_1682,
1693// PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 }, 1694 * PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_IGA_1682 },
1695 */
1694 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000, 1696 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2000,
1695 PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 }, 1697 PCI_ANY_ID, PCI_ANY_ID, 0, 0, ID_CYBERPRO_2000 },
1696 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010, 1698 { PCI_VENDOR_ID_INTERG, PCI_DEVICE_ID_INTERG_2010,
@@ -1700,7 +1702,7 @@ static struct pci_device_id cyberpro_pci_table[] = {
1700 { 0, } 1702 { 0, }
1701}; 1703};
1702 1704
1703MODULE_DEVICE_TABLE(pci,cyberpro_pci_table); 1705MODULE_DEVICE_TABLE(pci, cyberpro_pci_table);
1704 1706
1705static struct pci_driver cyberpro_driver = { 1707static struct pci_driver cyberpro_driver = {
1706 .name = "CyberPro", 1708 .name = "CyberPro",
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index 7f3f18d06718..febf09c63492 100644
--- a/drivers/video/geode/video_gx.c
+++ b/drivers/video/geode/video_gx.c
@@ -127,7 +127,7 @@ static void gx_set_dclk_frequency(struct fb_info *info)
127 int timeout = 1000; 127 int timeout = 1000;
128 128
129 /* Rev. 1 Geode GXs use a 14 MHz reference clock instead of 48 MHz. */ 129 /* Rev. 1 Geode GXs use a 14 MHz reference clock instead of 48 MHz. */
130 if (cpu_data->x86_mask == 1) { 130 if (cpu_data(0).x86_mask == 1) {
131 pll_table = gx_pll_table_14MHz; 131 pll_table = gx_pll_table_14MHz;
132 pll_table_len = ARRAY_SIZE(gx_pll_table_14MHz); 132 pll_table_len = ARRAY_SIZE(gx_pll_table_14MHz);
133 } else { 133 } else {
diff --git a/drivers/video/gxt4500.c b/drivers/video/gxt4500.c
index 23a6bcc3e3ce..e92337bef50d 100644
--- a/drivers/video/gxt4500.c
+++ b/drivers/video/gxt4500.c
@@ -636,7 +636,7 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev,
636 636
637 info = framebuffer_alloc(sizeof(struct gxt4500_par), &pdev->dev); 637 info = framebuffer_alloc(sizeof(struct gxt4500_par), &pdev->dev);
638 if (!info) { 638 if (!info) {
639 dev_err(&pdev->dev, "gxt4500: cannot alloc FB info record"); 639 dev_err(&pdev->dev, "gxt4500: cannot alloc FB info record\n");
640 goto err_free_fb; 640 goto err_free_fb;
641 } 641 }
642 par = info->par; 642 par = info->par;
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index e8e38edb9b5b..481d58f7535d 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -4,7 +4,7 @@
4 * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/ 4 * Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/
5 * 945G/945GM integrated graphics chips. 5 * 945G/945GM integrated graphics chips.
6 * 6 *
7 * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org> 7 * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org>
8 * 2004 Sylvain Meyer 8 * 2004 Sylvain Meyer
9 * 2006 David Airlie 9 * 2006 David Airlie
10 * 10 *
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 2a0e32074f7d..5f6fb7d2c408 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Linux framebuffer driver for Intel(R) 865G integrated graphics chips. 4 * Linux framebuffer driver for Intel(R) 865G integrated graphics chips.
5 * 5 *
6 * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org> 6 * Copyright © 2002, 2003 David Dawes <dawes@xfree86.org>
7 * 2004 Sylvain Meyer 7 * 2004 Sylvain Meyer
8 * 8 *
9 * This driver consists of two parts. The first part (intelfbdrv.c) provides 9 * This driver consists of two parts. The first part (intelfbdrv.c) provides
diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
index a9283bae7790..fc72684aae5a 100644
--- a/drivers/video/logo/logo.c
+++ b/drivers/video/logo/logo.c
@@ -78,10 +78,7 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
78#endif 78#endif
79#ifdef CONFIG_LOGO_DEC_CLUT224 79#ifdef CONFIG_LOGO_DEC_CLUT224
80 /* DEC Linux logo on MIPS/MIPS64 or ALPHA */ 80 /* DEC Linux logo on MIPS/MIPS64 or ALPHA */
81#ifndef CONFIG_ALPHA 81 logo = &logo_dec_clut224;
82 if (mips_machgroup == MACH_GROUP_DEC)
83#endif
84 logo = &logo_dec_clut224;
85#endif 82#endif
86#ifdef CONFIG_LOGO_MAC_CLUT224 83#ifdef CONFIG_LOGO_MAC_CLUT224
87 /* Macintosh Linux logo on m68k */ 84 /* Macintosh Linux logo on m68k */
@@ -94,10 +91,7 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
94#endif 91#endif
95#ifdef CONFIG_LOGO_SGI_CLUT224 92#ifdef CONFIG_LOGO_SGI_CLUT224
96 /* SGI Linux logo on MIPS/MIPS64 and VISWS */ 93 /* SGI Linux logo on MIPS/MIPS64 and VISWS */
97#ifndef CONFIG_X86_VISWS 94 logo = &logo_sgi_clut224;
98 if (mips_machgroup == MACH_GROUP_SGI)
99#endif
100 logo = &logo_sgi_clut224;
101#endif 95#endif
102#ifdef CONFIG_LOGO_SUN_CLUT224 96#ifdef CONFIG_LOGO_SUN_CLUT224
103 /* Sun Linux logo */ 97 /* Sun Linux logo */
diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c
index 42f5d76a8777..8d81ef019c6c 100644
--- a/drivers/video/modedb.c
+++ b/drivers/video/modedb.c
@@ -510,7 +510,9 @@ int fb_find_mode(struct fb_var_screeninfo *var,
510 default_bpp = 8; 510 default_bpp = 8;
511 511
512 /* Did the user specify a video mode? */ 512 /* Did the user specify a video mode? */
513 if (mode_option || (mode_option = fb_mode_option)) { 513 if (!mode_option)
514 mode_option = fb_mode_option;
515 if (mode_option) {
514 const char *name = mode_option; 516 const char *name = mode_option;
515 unsigned int namelen = strlen(name); 517 unsigned int namelen = strlen(name);
516 int res_specified = 0, bpp_specified = 0, refresh_specified = 0; 518 int res_specified = 0, bpp_specified = 0, refresh_specified = 0;
diff --git a/drivers/video/omap/Kconfig b/drivers/video/omap/Kconfig
index 7f4d25b8a184..f4fcf11b290d 100644
--- a/drivers/video/omap/Kconfig
+++ b/drivers/video/omap/Kconfig
@@ -8,7 +8,7 @@ config FB_OMAP
8 Frame buffer driver for OMAP based boards. 8 Frame buffer driver for OMAP based boards.
9 9
10config FB_OMAP_BOOTLOADER_INIT 10config FB_OMAP_BOOTLOADER_INIT
11 bool "Check bootloader initializaion" 11 bool "Check bootloader initialization"
12 depends on FB_OMAP 12 depends on FB_OMAP
13 help 13 help
14 Say Y here if you want to enable checking if the bootloader has 14 Say Y here if you want to enable checking if the bootloader has
diff --git a/drivers/video/omap/blizzard.c b/drivers/video/omap/blizzard.c
index e682940a97a4..4d8ad9cd0e19 100644
--- a/drivers/video/omap/blizzard.c
+++ b/drivers/video/omap/blizzard.c
@@ -225,7 +225,7 @@ static void blizzard_restart_sdram(void)
225 while (!(blizzard_read_reg(BLIZZARD_MEM_BANK0_STATUS) & 0x01)) { 225 while (!(blizzard_read_reg(BLIZZARD_MEM_BANK0_STATUS) & 0x01)) {
226 if (time_after(jiffies, tmo)) { 226 if (time_after(jiffies, tmo)) {
227 dev_err(blizzard.fbdev->dev, 227 dev_err(blizzard.fbdev->dev,
228 "s1d1374x: SDRAM not ready"); 228 "s1d1374x: SDRAM not ready\n");
229 break; 229 break;
230 } 230 }
231 msleep(1); 231 msleep(1);
diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index f4c23434de6f..ab32ceb06178 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -880,19 +880,19 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *dev)
880static int get_dss_clocks(void) 880static int get_dss_clocks(void)
881{ 881{
882 if (IS_ERR((dispc.dss_ick = clk_get(dispc.fbdev->dev, "dss_ick")))) { 882 if (IS_ERR((dispc.dss_ick = clk_get(dispc.fbdev->dev, "dss_ick")))) {
883 dev_err(dispc.fbdev->dev, "can't get dss_ick"); 883 dev_err(dispc.fbdev->dev, "can't get dss_ick\n");
884 return PTR_ERR(dispc.dss_ick); 884 return PTR_ERR(dispc.dss_ick);
885 } 885 }
886 886
887 if (IS_ERR((dispc.dss1_fck = clk_get(dispc.fbdev->dev, "dss1_fck")))) { 887 if (IS_ERR((dispc.dss1_fck = clk_get(dispc.fbdev->dev, "dss1_fck")))) {
888 dev_err(dispc.fbdev->dev, "can't get dss1_fck"); 888 dev_err(dispc.fbdev->dev, "can't get dss1_fck\n");
889 clk_put(dispc.dss_ick); 889 clk_put(dispc.dss_ick);
890 return PTR_ERR(dispc.dss1_fck); 890 return PTR_ERR(dispc.dss1_fck);
891 } 891 }
892 892
893 if (IS_ERR((dispc.dss_54m_fck = 893 if (IS_ERR((dispc.dss_54m_fck =
894 clk_get(dispc.fbdev->dev, "dss_54m_fck")))) { 894 clk_get(dispc.fbdev->dev, "dss_54m_fck")))) {
895 dev_err(dispc.fbdev->dev, "can't get dss_54m_fck"); 895 dev_err(dispc.fbdev->dev, "can't get dss_54m_fck\n");
896 clk_put(dispc.dss_ick); 896 clk_put(dispc.dss_ick);
897 clk_put(dispc.dss1_fck); 897 clk_put(dispc.dss1_fck);
898 return PTR_ERR(dispc.dss_54m_fck); 898 return PTR_ERR(dispc.dss_54m_fck);
diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c
index dc48e02f215c..1e642b7a20fe 100644
--- a/drivers/video/omap/hwa742.c
+++ b/drivers/video/omap/hwa742.c
@@ -508,7 +508,7 @@ int hwa742_update_window_async(struct fb_info *fbi,
508 if (unlikely(win->format & 508 if (unlikely(win->format &
509 ~(0x03 | OMAPFB_FORMAT_FLAG_DOUBLE | 509 ~(0x03 | OMAPFB_FORMAT_FLAG_DOUBLE |
510 OMAPFB_FORMAT_FLAG_TEARSYNC | OMAPFB_FORMAT_FLAG_FORCE_VSYNC))) { 510 OMAPFB_FORMAT_FLAG_TEARSYNC | OMAPFB_FORMAT_FLAG_FORCE_VSYNC))) {
511 dev_dbg(hwa742.fbdev->dev, "invalid window flag"); 511 dev_dbg(hwa742.fbdev->dev, "invalid window flag\n");
512 r = -EINVAL; 512 r = -EINVAL;
513 goto out; 513 goto out;
514 } 514 }
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c
index 2b4269813b22..789cfd23c36b 100644
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -84,12 +84,12 @@ static inline u32 rfbi_read_reg(int idx)
84static int rfbi_get_clocks(void) 84static int rfbi_get_clocks(void)
85{ 85{
86 if (IS_ERR((rfbi.dss_ick = clk_get(rfbi.fbdev->dev, "dss_ick")))) { 86 if (IS_ERR((rfbi.dss_ick = clk_get(rfbi.fbdev->dev, "dss_ick")))) {
87 dev_err(rfbi.fbdev->dev, "can't get dss_ick"); 87 dev_err(rfbi.fbdev->dev, "can't get dss_ick\n");
88 return PTR_ERR(rfbi.dss_ick); 88 return PTR_ERR(rfbi.dss_ick);
89 } 89 }
90 90
91 if (IS_ERR((rfbi.dss1_fck = clk_get(rfbi.fbdev->dev, "dss1_fck")))) { 91 if (IS_ERR((rfbi.dss1_fck = clk_get(rfbi.fbdev->dev, "dss1_fck")))) {
92 dev_err(rfbi.fbdev->dev, "can't get dss1_fck"); 92 dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
93 clk_put(rfbi.dss_ick); 93 clk_put(rfbi.dss_ick);
94 return PTR_ERR(rfbi.dss1_fck); 94 return PTR_ERR(rfbi.dss1_fck);
95 } 95 }
diff --git a/drivers/video/pnx4008/sdum.h b/drivers/video/pnx4008/sdum.h
index e8c5dcdd8813..189c3d641383 100644
--- a/drivers/video/pnx4008/sdum.h
+++ b/drivers/video/pnx4008/sdum.h
@@ -77,9 +77,6 @@
77#define CONF_DIRTYDETECTION_OFF (0x600) 77#define CONF_DIRTYDETECTION_OFF (0x600)
78#define CONF_DIRTYDETECTION_ON (0x601) 78#define CONF_DIRTYDETECTION_ON (0x601)
79 79
80/* Set the corresponding bit. */
81#define BIT(n) (0x1U << (n))
82
83struct dumchannel_uf { 80struct dumchannel_uf {
84 int channelnr; 81 int channelnr;
85 u32 *dirty; 82 u32 *dirty;
diff --git a/drivers/video/s3c2410fb.c b/drivers/video/s3c2410fb.c
index ae08d4587091..5857ccf5f6b1 100644
--- a/drivers/video/s3c2410fb.c
+++ b/drivers/video/s3c2410fb.c
@@ -56,7 +56,7 @@
56 * - Add support for different devices 56 * - Add support for different devices
57 * - Backlight support 57 * - Backlight support
58 * 58 *
59 * 2004-09-05: Herbert Pötzl <herbert@13thfloor.at> 59 * 2004-09-05: Herbert Pötzl <herbert@13thfloor.at>
60 * - added clock (de-)allocation code 60 * - added clock (de-)allocation code
61 * - added fixem fbmem option 61 * - added fixem fbmem option
62 * 62 *
@@ -64,7 +64,7 @@
64 * - code cleanup 64 * - code cleanup
65 * - added a forgotten return in h1940fb_init 65 * - added a forgotten return in h1940fb_init
66 * 66 *
67 * 2004-07-19: Herbert Pötzl <herbert@13thfloor.at> 67 * 2004-07-19: Herbert Pötzl <herbert@13thfloor.at>
68 * - code cleanup and extended debugging 68 * - code cleanup and extended debugging
69 * 69 *
70 * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org> 70 * 2004-07-15: Arnaud Patard <arnaud.patard@rtp-net.org>
diff --git a/drivers/video/vermilion/vermilion.c b/drivers/video/vermilion/vermilion.c
index ff9e805c43bc..c31f549ebea0 100644
--- a/drivers/video/vermilion/vermilion.c
+++ b/drivers/video/vermilion/vermilion.c
@@ -23,8 +23,8 @@
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 * 24 *
25 * Authors: 25 * Authors:
26 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 26 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
27 * Michel Dänzer <michel-at-tungstengraphics-dot-com> 27 * Michel Dänzer <michel-at-tungstengraphics-dot-com>
28 * Alan Hourihane <alanh-at-tungstengraphics-dot-com> 28 * Alan Hourihane <alanh-at-tungstengraphics-dot-com>
29 */ 29 */
30 30
diff --git a/drivers/video/vermilion/vermilion.h b/drivers/video/vermilion/vermilion.h
index 1fc6695a49d2..c4aba59d4809 100644
--- a/drivers/video/vermilion/vermilion.h
+++ b/drivers/video/vermilion/vermilion.h
@@ -23,7 +23,7 @@
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 * 24 *
25 * Authors: 25 * Authors:
26 * Thomas Hellström <thomas-at-tungstengraphics-dot-com> 26 * Thomas Hellström <thomas-at-tungstengraphics-dot-com>
27 */ 27 */
28 28
29#ifndef _VERMILION_H_ 29#ifndef _VERMILION_H_
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index 4b696641ce33..5747997f8d7d 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -307,7 +307,7 @@ static void ds1wm_search(void *data, u8 search_type,
307 rom_id |= (unsigned long long) r << (i * 4); 307 rom_id |= (unsigned long long) r << (i * 4);
308 308
309 } 309 }
310 dev_dbg(&ds1wm_data->pdev->dev, "found 0x%08llX", rom_id); 310 dev_dbg(&ds1wm_data->pdev->dev, "found 0x%08llX\n", rom_id);
311 311
312 ds1wm_write_register(ds1wm_data, DS1WM_CMD, ~DS1WM_CMD_SRA); 312 ds1wm_write_register(ds1wm_data, DS1WM_CMD, ~DS1WM_CMD_SRA);
313 ds1wm_reset(ds1wm_data); 313 ds1wm_reset(ds1wm_data);
diff --git a/drivers/char/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 37bddc1802de..37bddc1802de 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
diff --git a/drivers/char/watchdog/Makefile b/drivers/watchdog/Makefile
index 389f8b14ccc4..389f8b14ccc4 100644
--- a/drivers/char/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
diff --git a/drivers/char/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c
index 85269c365a10..85269c365a10 100644
--- a/drivers/char/watchdog/acquirewdt.c
+++ b/drivers/watchdog/acquirewdt.c
diff --git a/drivers/char/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c
index 8121cc247343..8121cc247343 100644
--- a/drivers/char/watchdog/advantechwdt.c
+++ b/drivers/watchdog/advantechwdt.c
diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/watchdog/alim1535_wdt.c
index c404fc69e7e6..c404fc69e7e6 100644
--- a/drivers/char/watchdog/alim1535_wdt.c
+++ b/drivers/watchdog/alim1535_wdt.c
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 67aed9f8c362..67aed9f8c362 100644
--- a/drivers/char/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
diff --git a/drivers/char/watchdog/at32ap700x_wdt.c b/drivers/watchdog/at32ap700x_wdt.c
index 54a516169d07..54a516169d07 100644
--- a/drivers/char/watchdog/at32ap700x_wdt.c
+++ b/drivers/watchdog/at32ap700x_wdt.c
diff --git a/drivers/char/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
index 38bd37372599..a684b1e87372 100644
--- a/drivers/char/watchdog/at91rm9200_wdt.c
+++ b/drivers/watchdog/at91rm9200_wdt.c
@@ -9,6 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/bitops.h>
12#include <linux/errno.h> 13#include <linux/errno.h>
13#include <linux/fs.h> 14#include <linux/fs.h>
14#include <linux/init.h> 15#include <linux/init.h>
@@ -19,7 +20,6 @@
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/types.h> 21#include <linux/types.h>
21#include <linux/watchdog.h> 22#include <linux/watchdog.h>
22#include <asm/bitops.h>
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <asm/arch/at91_st.h> 24#include <asm/arch/at91_st.h>
25 25
diff --git a/drivers/char/watchdog/bfin_wdt.c b/drivers/watchdog/bfin_wdt.c
index 309d27913fc1..309d27913fc1 100644
--- a/drivers/char/watchdog/bfin_wdt.c
+++ b/drivers/watchdog/bfin_wdt.c
diff --git a/drivers/char/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index d362f5bf658a..d362f5bf658a 100644
--- a/drivers/char/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c
index 5941ca601a3a..5941ca601a3a 100644
--- a/drivers/char/watchdog/cpu5wdt.c
+++ b/drivers/watchdog/cpu5wdt.c
diff --git a/drivers/char/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 19db5302ba6e..19db5302ba6e 100644
--- a/drivers/char/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
diff --git a/drivers/char/watchdog/ep93xx_wdt.c b/drivers/watchdog/ep93xx_wdt.c
index 0e4787a0bb87..0e4787a0bb87 100644
--- a/drivers/char/watchdog/ep93xx_wdt.c
+++ b/drivers/watchdog/ep93xx_wdt.c
diff --git a/drivers/char/watchdog/eurotechwdt.c b/drivers/watchdog/eurotechwdt.c
index b14e9d1f164d..b14e9d1f164d 100644
--- a/drivers/char/watchdog/eurotechwdt.c
+++ b/drivers/watchdog/eurotechwdt.c
diff --git a/drivers/char/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c
index c5982502c03d..f236954d2536 100644
--- a/drivers/char/watchdog/i6300esb.c
+++ b/drivers/watchdog/i6300esb.c
@@ -2,7 +2,7 @@
2 * i6300esb: Watchdog timer driver for Intel 6300ESB chipset 2 * i6300esb: Watchdog timer driver for Intel 6300ESB chipset
3 * 3 *
4 * (c) Copyright 2004 Google Inc. 4 * (c) Copyright 2004 Google Inc.
5 * (c) Copyright 2005 David Härdeman <david@2gen.com> 5 * (c) Copyright 2005 David Härdeman <david@2gen.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -19,7 +19,7 @@
19 * Initial version 0.01 19 * Initial version 0.01
20 * 2004YYZZ Ross Biro 20 * 2004YYZZ Ross Biro
21 * Version 0.02 21 * Version 0.02
22 * 20050210 David Härdeman <david@2gen.com> 22 * 20050210 David Härdeman <david@2gen.com>
23 * Ported driver to kernel 2.6 23 * Ported driver to kernel 2.6
24 */ 24 */
25 25
@@ -521,7 +521,7 @@ static void __exit watchdog_cleanup (void)
521module_init(watchdog_init); 521module_init(watchdog_init);
522module_exit(watchdog_cleanup); 522module_exit(watchdog_cleanup);
523 523
524MODULE_AUTHOR("Ross Biro and David Härdeman"); 524MODULE_AUTHOR("Ross Biro and David Härdeman");
525MODULE_DESCRIPTION("Watchdog driver for Intel 6300ESB chipsets"); 525MODULE_DESCRIPTION("Watchdog driver for Intel 6300ESB chipsets");
526MODULE_LICENSE("GPL"); 526MODULE_LICENSE("GPL");
527MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 527MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/char/watchdog/iTCO_vendor_support.c b/drivers/watchdog/iTCO_vendor_support.c
index 415083990097..cafc465f2ae3 100644
--- a/drivers/char/watchdog/iTCO_vendor_support.c
+++ b/drivers/watchdog/iTCO_vendor_support.c
@@ -115,7 +115,7 @@ static void supermicro_old_pre_keepalive(unsigned long acpibase)
115 * For P4DPx: 115 * For P4DPx:
116 * BIOS setup -> Advanced -> I/O Device Configuration -> Watch Dog 116 * BIOS setup -> Advanced -> I/O Device Configuration -> Watch Dog
117 * This setting enables or disables Watchdog function. When enabled, the 117 * This setting enables or disables Watchdog function. When enabled, the
118 * default watchdog timer is set to be 5 minutes (about 4’35â€). It is 118 * default watchdog timer is set to be 5 minutes (about 4m35s). It is
119 * enough to load and run the OS. The application (service or driver) has 119 * enough to load and run the OS. The application (service or driver) has
120 * to take over the control once OS is running up and before watchdog 120 * to take over the control once OS is running up and before watchdog
121 * expires. 121 * expires.
diff --git a/drivers/char/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index cd5a565bc3a0..cd5a565bc3a0 100644
--- a/drivers/char/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
diff --git a/drivers/char/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index c3a60f52ccb9..c3a60f52ccb9 100644
--- a/drivers/char/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
diff --git a/drivers/char/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c
index 94155f6136c2..94155f6136c2 100644
--- a/drivers/char/watchdog/ibmasr.c
+++ b/drivers/watchdog/ibmasr.c
diff --git a/drivers/char/watchdog/indydog.c b/drivers/watchdog/indydog.c
index 788245bdaa7f..788245bdaa7f 100644
--- a/drivers/char/watchdog/indydog.c
+++ b/drivers/watchdog/indydog.c
diff --git a/drivers/char/watchdog/iop_wdt.c b/drivers/watchdog/iop_wdt.c
index bbbd91af754d..bbbd91af754d 100644
--- a/drivers/char/watchdog/iop_wdt.c
+++ b/drivers/watchdog/iop_wdt.c
diff --git a/drivers/char/watchdog/ixp2000_wdt.c b/drivers/watchdog/ixp2000_wdt.c
index dc7548dcaf35..dc7548dcaf35 100644
--- a/drivers/char/watchdog/ixp2000_wdt.c
+++ b/drivers/watchdog/ixp2000_wdt.c
diff --git a/drivers/char/watchdog/ixp4xx_wdt.c b/drivers/watchdog/ixp4xx_wdt.c
index 5864bb865cfe..5864bb865cfe 100644
--- a/drivers/char/watchdog/ixp4xx_wdt.c
+++ b/drivers/watchdog/ixp4xx_wdt.c
diff --git a/drivers/char/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c
index 7150fb945eaf..e3a29c302309 100644
--- a/drivers/char/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10
11#include <linux/bitops.h>
11#include <linux/errno.h> 12#include <linux/errno.h>
12#include <linux/fs.h> 13#include <linux/fs.h>
13#include <linux/init.h> 14#include <linux/init.h>
@@ -18,7 +19,6 @@
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/types.h> 20#include <linux/types.h>
20#include <linux/watchdog.h> 21#include <linux/watchdog.h>
21#include <asm/bitops.h>
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24#include <asm/arch/regs-timer.h> 24#include <asm/arch/regs-timer.h>
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
index 6d35bb112a5f..6d35bb112a5f 100644
--- a/drivers/char/watchdog/machzwd.c
+++ b/drivers/watchdog/machzwd.c
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
index 1adf1d56027d..1adf1d56027d 100644
--- a/drivers/char/watchdog/mixcomwd.c
+++ b/drivers/watchdog/mixcomwd.c
diff --git a/drivers/char/watchdog/mpc5200_wdt.c b/drivers/watchdog/mpc5200_wdt.c
index 9cfb97576623..9cfb97576623 100644
--- a/drivers/char/watchdog/mpc5200_wdt.c
+++ b/drivers/watchdog/mpc5200_wdt.c
diff --git a/drivers/char/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
index a0bf95fb9763..a0bf95fb9763 100644
--- a/drivers/char/watchdog/mpc83xx_wdt.c
+++ b/drivers/watchdog/mpc83xx_wdt.c
diff --git a/drivers/char/watchdog/mpc8xx_wdt.c b/drivers/watchdog/mpc8xx_wdt.c
index 85b5734403a5..85b5734403a5 100644
--- a/drivers/char/watchdog/mpc8xx_wdt.c
+++ b/drivers/watchdog/mpc8xx_wdt.c
diff --git a/drivers/char/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 0d2b27735419..0d2b27735419 100644
--- a/drivers/char/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
diff --git a/drivers/char/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
index dcfd401a7ad7..dcfd401a7ad7 100644
--- a/drivers/char/watchdog/mtx-1_wdt.c
+++ b/drivers/watchdog/mtx-1_wdt.c
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/watchdog/mv64x60_wdt.c
index 0365c317f7e1..0365c317f7e1 100644
--- a/drivers/char/watchdog/mv64x60_wdt.c
+++ b/drivers/watchdog/mv64x60_wdt.c
diff --git a/drivers/char/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 719b066f73c4..635ca454f56b 100644
--- a/drivers/char/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -39,11 +39,11 @@
39#include <linux/platform_device.h> 39#include <linux/platform_device.h>
40#include <linux/moduleparam.h> 40#include <linux/moduleparam.h>
41#include <linux/clk.h> 41#include <linux/clk.h>
42#include <linux/bitops.h>
42 43
43#include <asm/io.h> 44#include <asm/io.h>
44#include <asm/uaccess.h> 45#include <asm/uaccess.h>
45#include <asm/hardware.h> 46#include <asm/hardware.h>
46#include <asm/bitops.h>
47 47
48#include <asm/arch/prcm.h> 48#include <asm/arch/prcm.h>
49 49
diff --git a/drivers/char/watchdog/omap_wdt.h b/drivers/watchdog/omap_wdt.h
index 52a532a5114a..52a532a5114a 100644
--- a/drivers/char/watchdog/omap_wdt.h
+++ b/drivers/watchdog/omap_wdt.h
diff --git a/drivers/char/watchdog/pc87413_wdt.c b/drivers/watchdog/pc87413_wdt.c
index 3d3deae0d64b..3d3deae0d64b 100644
--- a/drivers/char/watchdog/pc87413_wdt.c
+++ b/drivers/watchdog/pc87413_wdt.c
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/watchdog/pcwd.c
index 7b41434fac8c..7b41434fac8c 100644
--- a/drivers/char/watchdog/pcwd.c
+++ b/drivers/watchdog/pcwd.c
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c
index 61a89e959642..61a89e959642 100644
--- a/drivers/char/watchdog/pcwd_pci.c
+++ b/drivers/watchdog/pcwd_pci.c
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/watchdog/pcwd_usb.c
index 0f3fd6c9c354..0f3fd6c9c354 100644
--- a/drivers/char/watchdog/pcwd_usb.c
+++ b/drivers/watchdog/pcwd_usb.c
diff --git a/drivers/char/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 22f8873dd092..22f8873dd092 100644
--- a/drivers/char/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
diff --git a/drivers/char/watchdog/rm9k_wdt.c b/drivers/watchdog/rm9k_wdt.c
index 5c921e471564..5c921e471564 100644
--- a/drivers/char/watchdog/rm9k_wdt.c
+++ b/drivers/watchdog/rm9k_wdt.c
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 5d1c15f83d23..5d1c15f83d23 100644
--- a/drivers/char/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index 3475f47aaa45..34a2b3b81800 100644
--- a/drivers/char/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -25,13 +25,13 @@
25#include <linux/miscdevice.h> 25#include <linux/miscdevice.h>
26#include <linux/watchdog.h> 26#include <linux/watchdog.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/bitops.h>
28 29
29#ifdef CONFIG_ARCH_PXA 30#ifdef CONFIG_ARCH_PXA
30#include <asm/arch/pxa-regs.h> 31#include <asm/arch/pxa-regs.h>
31#endif 32#endif
32 33
33#include <asm/hardware.h> 34#include <asm/hardware.h>
34#include <asm/bitops.h>
35#include <asm/uaccess.h> 35#include <asm/uaccess.h>
36 36
37#define OSCR_FREQ CLOCK_TICK_RATE 37#define OSCR_FREQ CLOCK_TICK_RATE
diff --git a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index e4f3cb6090bc..e4f3cb6090bc 100644
--- a/drivers/char/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
diff --git a/drivers/char/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c
index 285d85289532..285d85289532 100644
--- a/drivers/char/watchdog/sbc8360.c
+++ b/drivers/watchdog/sbc8360.c
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/watchdog/sbc_epx_c3.c
index 82cbd8809a69..82cbd8809a69 100644
--- a/drivers/char/watchdog/sbc_epx_c3.c
+++ b/drivers/watchdog/sbc_epx_c3.c
diff --git a/drivers/char/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c
index 9670d47190d0..9670d47190d0 100644
--- a/drivers/char/watchdog/sc1200wdt.c
+++ b/drivers/watchdog/sc1200wdt.c
diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index e8594c64d1e6..e8594c64d1e6 100644
--- a/drivers/char/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
diff --git a/drivers/char/watchdog/scx200_wdt.c b/drivers/watchdog/scx200_wdt.c
index d4fd0fa2f176..d4fd0fa2f176 100644
--- a/drivers/char/watchdog/scx200_wdt.c
+++ b/drivers/watchdog/scx200_wdt.c
diff --git a/drivers/char/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
index cecbedd473a4..cecbedd473a4 100644
--- a/drivers/char/watchdog/shwdt.c
+++ b/drivers/watchdog/shwdt.c
diff --git a/drivers/char/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index d3cb0a766020..d3cb0a766020 100644
--- a/drivers/char/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
diff --git a/drivers/char/watchdog/softdog.c b/drivers/watchdog/softdog.c
index 9c3694909243..9c3694909243 100644
--- a/drivers/char/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
diff --git a/drivers/char/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index df33b3b5a53c..df33b3b5a53c 100644
--- a/drivers/char/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
diff --git a/drivers/char/watchdog/w83697hf_wdt.c b/drivers/watchdog/w83697hf_wdt.c
index d9e821d08deb..51826c216d6d 100644
--- a/drivers/char/watchdog/w83697hf_wdt.c
+++ b/drivers/watchdog/w83697hf_wdt.c
@@ -8,7 +8,7 @@
8 * which is based on wdt.c. 8 * which is based on wdt.c.
9 * Original copyright messages: 9 * Original copyright messages:
10 * 10 *
11 * (c) Copyright 2003 Pádraig Brady <P@draigBrady.com> 11 * (c) Copyright 2003 Pádraig Brady <P@draigBrady.com>
12 * 12 *
13 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl> 13 * (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl>
14 * 14 *
diff --git a/drivers/char/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index 3c88fe18f4f4..3c88fe18f4f4 100644
--- a/drivers/char/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
diff --git a/drivers/char/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c
index 157968442891..157968442891 100644
--- a/drivers/char/watchdog/w83977f_wdt.c
+++ b/drivers/watchdog/w83977f_wdt.c
diff --git a/drivers/char/watchdog/wafer5823wdt.c b/drivers/watchdog/wafer5823wdt.c
index 950905d3c39f..950905d3c39f 100644
--- a/drivers/char/watchdog/wafer5823wdt.c
+++ b/drivers/watchdog/wafer5823wdt.c
diff --git a/drivers/char/watchdog/wd501p.h b/drivers/watchdog/wd501p.h
index a4504f40394d..a4504f40394d 100644
--- a/drivers/char/watchdog/wd501p.h
+++ b/drivers/watchdog/wd501p.h
diff --git a/drivers/char/watchdog/wdrtas.c b/drivers/watchdog/wdrtas.c
index 1d64e277567d..1d64e277567d 100644
--- a/drivers/char/watchdog/wdrtas.c
+++ b/drivers/watchdog/wdrtas.c
diff --git a/drivers/char/watchdog/wdt.c b/drivers/watchdog/wdt.c
index 0a3de6a02442..0a3de6a02442 100644
--- a/drivers/char/watchdog/wdt.c
+++ b/drivers/watchdog/wdt.c
diff --git a/drivers/char/watchdog/wdt285.c b/drivers/watchdog/wdt285.c
index e4cf661dc890..e4cf661dc890 100644
--- a/drivers/char/watchdog/wdt285.c
+++ b/drivers/watchdog/wdt285.c
diff --git a/drivers/char/watchdog/wdt977.c b/drivers/watchdog/wdt977.c
index 7d300ff7ab07..7d300ff7ab07 100644
--- a/drivers/char/watchdog/wdt977.c
+++ b/drivers/watchdog/wdt977.c
diff --git a/drivers/char/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c
index 6baf4ae42c9d..6baf4ae42c9d 100644
--- a/drivers/char/watchdog/wdt_pci.c
+++ b/drivers/watchdog/wdt_pci.c
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 0b769f7c4a48..4750de316ad3 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -185,13 +185,14 @@ static void otherend_changed(struct xenbus_watch *watch,
185 if (!dev->otherend || 185 if (!dev->otherend ||
186 strncmp(dev->otherend, vec[XS_WATCH_PATH], 186 strncmp(dev->otherend, vec[XS_WATCH_PATH],
187 strlen(dev->otherend))) { 187 strlen(dev->otherend))) {
188 dev_dbg(&dev->dev, "Ignoring watch at %s", vec[XS_WATCH_PATH]); 188 dev_dbg(&dev->dev, "Ignoring watch at %s\n",
189 vec[XS_WATCH_PATH]);
189 return; 190 return;
190 } 191 }
191 192
192 state = xenbus_read_driver_state(dev->otherend); 193 state = xenbus_read_driver_state(dev->otherend);
193 194
194 dev_dbg(&dev->dev, "state is %d, (%s), %s, %s", 195 dev_dbg(&dev->dev, "state is %d, (%s), %s, %s\n",
195 state, xenbus_strstate(state), dev->otherend_watch.node, 196 state, xenbus_strstate(state), dev->otherend_watch.node,
196 vec[XS_WATCH_PATH]); 197 vec[XS_WATCH_PATH]);
197 198
diff --git a/drivers/zorro/zorro.ids b/drivers/zorro/zorro.ids
index 5bd4b05d4c45..560fef2a7b1c 100644
--- a/drivers/zorro/zorro.ids
+++ b/drivers/zorro/zorro.ids
@@ -295,7 +295,7 @@
295 0100 RH 800C [HD Controller] 295 0100 RH 800C [HD Controller]
296 0200 RH 800C [RAM Expansion] 296 0200 RH 800C [RAM Expansion]
2970861 Kato 2970861 Kato
298# The Rainbow II and III are actually made by Ingenieurbüro Helfrich 298# The Rainbow II and III are actually made by Ingenieurbüro Helfrich
299 2000 Rainbow II [Graphics Card] 299 2000 Rainbow II [Graphics Card]
300 2100 Rainbow III [Graphics Card] 300 2100 Rainbow III [Graphics Card]
301 8000 Melody MPEG [Audio Card] 301 8000 Melody MPEG [Audio Card]
diff --git a/fs/Kconfig b/fs/Kconfig
index d8062745716a..cc28a69246a7 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -140,6 +140,7 @@ config EXT4DEV_FS
140 tristate "Ext4dev/ext4 extended fs support development (EXPERIMENTAL)" 140 tristate "Ext4dev/ext4 extended fs support development (EXPERIMENTAL)"
141 depends on EXPERIMENTAL 141 depends on EXPERIMENTAL
142 select JBD2 142 select JBD2
143 select CRC16
143 help 144 help
144 Ext4dev is a predecessor filesystem of the next generation 145 Ext4dev is a predecessor filesystem of the next generation
145 extended fs ext4, based on ext3 filesystem code. It will be 146 extended fs ext4, based on ext3 filesystem code. It will be
@@ -219,7 +220,7 @@ config JBD
219 220
220config JBD_DEBUG 221config JBD_DEBUG
221 bool "JBD (ext3) debugging support" 222 bool "JBD (ext3) debugging support"
222 depends on JBD 223 depends on JBD && DEBUG_FS
223 help 224 help
224 If you are using the ext3 journaled file system (or potentially any 225 If you are using the ext3 journaled file system (or potentially any
225 other file system/device using JBD), this option allows you to 226 other file system/device using JBD), this option allows you to
@@ -228,10 +229,10 @@ config JBD_DEBUG
228 debugging output will be turned off. 229 debugging output will be turned off.
229 230
230 If you select Y here, then you will be able to turn on debugging 231 If you select Y here, then you will be able to turn on debugging
231 with "echo N > /proc/sys/fs/jbd-debug", where N is a number between 232 with "echo N > /sys/kernel/debug/jbd/jbd-debug", where N is a
232 1 and 5, the higher the number, the more debugging output is 233 number between 1 and 5, the higher the number, the more debugging
233 generated. To turn debugging off again, do 234 output is generated. To turn debugging off again, do
234 "echo 0 > /proc/sys/fs/jbd-debug". 235 "echo 0 > /sys/kernel/debug/jbd/jbd-debug".
235 236
236config JBD2 237config JBD2
237 tristate 238 tristate
diff --git a/fs/aio.c b/fs/aio.c
index d02f43b50a3d..f12db415c0f6 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -710,18 +710,9 @@ static ssize_t aio_run_iocb(struct kiocb *iocb)
710 710
711 /* 711 /*
712 * Now we are all set to call the retry method in async 712 * Now we are all set to call the retry method in async
713 * context. By setting this thread's io_wait context 713 * context.
714 * to point to the wait queue entry inside the currently
715 * running iocb for the duration of the retry, we ensure
716 * that async notification wakeups are queued by the
717 * operation instead of blocking waits, and when notified,
718 * cause the iocb to be kicked for continuation (through
719 * the aio_wake_function callback).
720 */ 714 */
721 BUG_ON(current->io_wait != NULL);
722 current->io_wait = &iocb->ki_wait;
723 ret = retry(iocb); 715 ret = retry(iocb);
724 current->io_wait = NULL;
725 716
726 if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) { 717 if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) {
727 BUG_ON(!list_empty(&iocb->ki_wait.task_list)); 718 BUG_ON(!list_empty(&iocb->ki_wait.task_list));
@@ -1508,10 +1499,7 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb)
1508 * Simply triggers a retry of the operation via kick_iocb. 1499 * Simply triggers a retry of the operation via kick_iocb.
1509 * 1500 *
1510 * This callback is specified in the wait queue entry in 1501 * This callback is specified in the wait queue entry in
1511 * a kiocb (current->io_wait points to this wait queue 1502 * a kiocb.
1512 * entry when an aio operation executes; it is used
1513 * instead of a synchronous wait when an i/o blocking
1514 * condition is encountered during aio).
1515 * 1503 *
1516 * Note: 1504 * Note:
1517 * This routine is executed with the wait queue lock held. 1505 * This routine is executed with the wait queue lock held.
diff --git a/fs/attr.c b/fs/attr.c
index ae58bd3f875f..966b73e25f82 100644
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -103,12 +103,11 @@ EXPORT_SYMBOL(inode_setattr);
103int notify_change(struct dentry * dentry, struct iattr * attr) 103int notify_change(struct dentry * dentry, struct iattr * attr)
104{ 104{
105 struct inode *inode = dentry->d_inode; 105 struct inode *inode = dentry->d_inode;
106 mode_t mode; 106 mode_t mode = inode->i_mode;
107 int error; 107 int error;
108 struct timespec now; 108 struct timespec now;
109 unsigned int ia_valid = attr->ia_valid; 109 unsigned int ia_valid = attr->ia_valid;
110 110
111 mode = inode->i_mode;
112 now = current_fs_time(inode->i_sb); 111 now = current_fs_time(inode->i_sb);
113 112
114 attr->ia_ctime = now; 113 attr->ia_ctime = now;
@@ -125,18 +124,25 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
125 if (error) 124 if (error)
126 return error; 125 return error;
127 } 126 }
127
128 /*
129 * We now pass ATTR_KILL_S*ID to the lower level setattr function so
130 * that the function has the ability to reinterpret a mode change
131 * that's due to these bits. This adds an implicit restriction that
132 * no function will ever call notify_change with both ATTR_MODE and
133 * ATTR_KILL_S*ID set.
134 */
135 if ((ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) &&
136 (ia_valid & ATTR_MODE))
137 BUG();
138
128 if (ia_valid & ATTR_KILL_SUID) { 139 if (ia_valid & ATTR_KILL_SUID) {
129 attr->ia_valid &= ~ATTR_KILL_SUID;
130 if (mode & S_ISUID) { 140 if (mode & S_ISUID) {
131 if (!(ia_valid & ATTR_MODE)) { 141 ia_valid = attr->ia_valid |= ATTR_MODE;
132 ia_valid = attr->ia_valid |= ATTR_MODE; 142 attr->ia_mode = (inode->i_mode & ~S_ISUID);
133 attr->ia_mode = inode->i_mode;
134 }
135 attr->ia_mode &= ~S_ISUID;
136 } 143 }
137 } 144 }
138 if (ia_valid & ATTR_KILL_SGID) { 145 if (ia_valid & ATTR_KILL_SGID) {
139 attr->ia_valid &= ~ ATTR_KILL_SGID;
140 if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { 146 if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
141 if (!(ia_valid & ATTR_MODE)) { 147 if (!(ia_valid & ATTR_MODE)) {
142 ia_valid = attr->ia_valid |= ATTR_MODE; 148 ia_valid = attr->ia_valid |= ATTR_MODE;
@@ -145,7 +151,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
145 attr->ia_mode &= ~S_ISGID; 151 attr->ia_mode &= ~S_ISGID;
146 } 152 }
147 } 153 }
148 if (!attr->ia_valid) 154 if (!(attr->ia_valid & ~(ATTR_KILL_SUID | ATTR_KILL_SGID)))
149 return 0; 155 return 0;
150 156
151 if (ia_valid & ATTR_SIZE) 157 if (ia_valid & ATTR_SIZE)
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index e7204d71acc9..45f5992a0957 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -80,7 +80,7 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
80 80
81 *uid = current->uid; 81 *uid = current->uid;
82 *gid = current->gid; 82 *gid = current->gid;
83 *pgrp = process_group(current); 83 *pgrp = task_pgrp_nr(current);
84 84
85 *minproto = *maxproto = AUTOFS_PROTO_VERSION; 85 *minproto = *maxproto = AUTOFS_PROTO_VERSION;
86 86
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index c1489533277a..5efff3c0d886 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -214,8 +214,8 @@ static struct dentry *autofs_root_lookup(struct inode *dir, struct dentry *dentr
214 214
215 oz_mode = autofs_oz_mode(sbi); 215 oz_mode = autofs_oz_mode(sbi);
216 DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, " 216 DPRINTK(("autofs_lookup: pid = %u, pgrp = %u, catatonic = %d, "
217 "oz_mode = %d\n", pid_nr(task_pid(current)), 217 "oz_mode = %d\n", task_pid_nr(current),
218 process_group(current), sbi->catatonic, 218 task_pgrp_nr(current), sbi->catatonic,
219 oz_mode)); 219 oz_mode));
220 220
221 /* 221 /*
@@ -536,7 +536,7 @@ static int autofs_root_ioctl(struct inode *inode, struct file *filp,
536 struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb); 536 struct autofs_sb_info *sbi = autofs_sbi(inode->i_sb);
537 void __user *argp = (void __user *)arg; 537 void __user *argp = (void __user *)arg;
538 538
539 DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,process_group(current))); 539 DPRINTK(("autofs_ioctl: cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u\n",cmd,arg,sbi,task_pgrp_nr(current)));
540 540
541 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || 541 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
542 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) 542 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
diff --git a/fs/autofs/waitq.c b/fs/autofs/waitq.c
index 19a9cafb5ddf..be46805972f0 100644
--- a/fs/autofs/waitq.c
+++ b/fs/autofs/waitq.c
@@ -182,7 +182,7 @@ int autofs_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_toke
182{ 182{
183 struct autofs_wait_queue *wq, **wql; 183 struct autofs_wait_queue *wq, **wql;
184 184
185 for ( wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next ) { 185 for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) {
186 if ( wq->wait_queue_token == wait_queue_token ) 186 if ( wq->wait_queue_token == wait_queue_token )
187 break; 187 break;
188 } 188 }
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index d85f42fa9206..2d4ae40718d9 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -131,7 +131,7 @@ static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry)
131 filesystem without "magic".) */ 131 filesystem without "magic".) */
132 132
133static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) { 133static inline int autofs4_oz_mode(struct autofs_sb_info *sbi) {
134 return sbi->catatonic || process_group(current) == sbi->oz_pgrp; 134 return sbi->catatonic || task_pgrp_nr(current) == sbi->oz_pgrp;
135} 135}
136 136
137/* Does a dentry have some pending activity? */ 137/* Does a dentry have some pending activity? */
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index cd81f0836671..7f05d6ccdb13 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -226,7 +226,7 @@ static int parse_options(char *options, int *pipefd, uid_t *uid, gid_t *gid,
226 226
227 *uid = current->uid; 227 *uid = current->uid;
228 *gid = current->gid; 228 *gid = current->gid;
229 *pgrp = process_group(current); 229 *pgrp = task_pgrp_nr(current);
230 230
231 *minproto = AUTOFS_MIN_PROTO_VERSION; 231 *minproto = AUTOFS_MIN_PROTO_VERSION;
232 *maxproto = AUTOFS_MAX_PROTO_VERSION; 232 *maxproto = AUTOFS_MAX_PROTO_VERSION;
@@ -323,7 +323,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
323 sbi->pipe = NULL; 323 sbi->pipe = NULL;
324 sbi->catatonic = 1; 324 sbi->catatonic = 1;
325 sbi->exp_timeout = 0; 325 sbi->exp_timeout = 0;
326 sbi->oz_pgrp = process_group(current); 326 sbi->oz_pgrp = task_pgrp_nr(current);
327 sbi->sb = s; 327 sbi->sb = s;
328 sbi->version = 0; 328 sbi->version = 0;
329 sbi->sub_version = 0; 329 sbi->sub_version = 0;
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 45ff3d63b758..2bbcc8151dc3 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -582,7 +582,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
582 oz_mode = autofs4_oz_mode(sbi); 582 oz_mode = autofs4_oz_mode(sbi);
583 583
584 DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d", 584 DPRINTK("pid = %u, pgrp = %u, catatonic = %d, oz_mode = %d",
585 current->pid, process_group(current), sbi->catatonic, oz_mode); 585 current->pid, task_pgrp_nr(current), sbi->catatonic, oz_mode);
586 586
587 unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name); 587 unhashed = autofs4_lookup_unhashed(sbi, dentry->d_parent, &dentry->d_name);
588 if (!unhashed) { 588 if (!unhashed) {
@@ -976,7 +976,7 @@ static int autofs4_root_ioctl(struct inode *inode, struct file *filp,
976 void __user *p = (void __user *)arg; 976 void __user *p = (void __user *)arg;
977 977
978 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u", 978 DPRINTK("cmd = 0x%08x, arg = 0x%08lx, sbi = %p, pgrp = %u",
979 cmd,arg,sbi,process_group(current)); 979 cmd,arg,sbi,task_pgrp_nr(current));
980 980
981 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) || 981 if (_IOC_TYPE(cmd) != _IOC_TYPE(AUTOFS_IOC_FIRST) ||
982 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT) 982 _IOC_NR(cmd) - _IOC_NR(AUTOFS_IOC_FIRST) >= AUTOFS_IOC_COUNT)
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
index 0d041a9cb348..1fe28e4754c2 100644
--- a/fs/autofs4/waitq.c
+++ b/fs/autofs4/waitq.c
@@ -376,7 +376,7 @@ int autofs4_wait_release(struct autofs_sb_info *sbi, autofs_wqt_t wait_queue_tok
376 struct autofs_wait_queue *wq, **wql; 376 struct autofs_wait_queue *wq, **wql;
377 377
378 mutex_lock(&sbi->wq_mutex); 378 mutex_lock(&sbi->wq_mutex);
379 for (wql = &sbi->queues ; (wq = *wql) != 0 ; wql = &wq->next) { 379 for (wql = &sbi->queues; (wq = *wql) != NULL; wql = &wq->next) {
380 if (wq->wait_queue_token == wait_queue_token) 380 if (wq->wait_queue_token == wait_queue_token)
381 break; 381 break;
382 } 382 }
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 6e2f3b8dde7f..ba8de7ca260b 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1383,10 +1383,10 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
1383 prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; 1383 prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
1384 prstatus->pr_sigpend = p->pending.signal.sig[0]; 1384 prstatus->pr_sigpend = p->pending.signal.sig[0];
1385 prstatus->pr_sighold = p->blocked.sig[0]; 1385 prstatus->pr_sighold = p->blocked.sig[0];
1386 prstatus->pr_pid = p->pid; 1386 prstatus->pr_pid = task_pid_vnr(p);
1387 prstatus->pr_ppid = p->parent->pid; 1387 prstatus->pr_ppid = task_pid_vnr(p->parent);
1388 prstatus->pr_pgrp = process_group(p); 1388 prstatus->pr_pgrp = task_pgrp_vnr(p);
1389 prstatus->pr_sid = process_session(p); 1389 prstatus->pr_sid = task_session_vnr(p);
1390 if (thread_group_leader(p)) { 1390 if (thread_group_leader(p)) {
1391 /* 1391 /*
1392 * This is the record for the group leader. Add in the 1392 * This is the record for the group leader. Add in the
@@ -1429,10 +1429,10 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
1429 psinfo->pr_psargs[i] = ' '; 1429 psinfo->pr_psargs[i] = ' ';
1430 psinfo->pr_psargs[len] = 0; 1430 psinfo->pr_psargs[len] = 0;
1431 1431
1432 psinfo->pr_pid = p->pid; 1432 psinfo->pr_pid = task_pid_vnr(p);
1433 psinfo->pr_ppid = p->parent->pid; 1433 psinfo->pr_ppid = task_pid_vnr(p->parent);
1434 psinfo->pr_pgrp = process_group(p); 1434 psinfo->pr_pgrp = task_pgrp_vnr(p);
1435 psinfo->pr_sid = process_session(p); 1435 psinfo->pr_sid = task_session_vnr(p);
1436 1436
1437 i = p->state ? ffz(~p->state) + 1 : 0; 1437 i = p->state ? ffz(~p->state) + 1 : 0;
1438 psinfo->pr_state = i; 1438 psinfo->pr_state = i;
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 033861c6b8f1..32649f2a1654 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1342,10 +1342,10 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
1342 prstatus->pr_info.si_signo = prstatus->pr_cursig = signr; 1342 prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
1343 prstatus->pr_sigpend = p->pending.signal.sig[0]; 1343 prstatus->pr_sigpend = p->pending.signal.sig[0];
1344 prstatus->pr_sighold = p->blocked.sig[0]; 1344 prstatus->pr_sighold = p->blocked.sig[0];
1345 prstatus->pr_pid = p->pid; 1345 prstatus->pr_pid = task_pid_vnr(p);
1346 prstatus->pr_ppid = p->parent->pid; 1346 prstatus->pr_ppid = task_pid_vnr(p->parent);
1347 prstatus->pr_pgrp = process_group(p); 1347 prstatus->pr_pgrp = task_pgrp_vnr(p);
1348 prstatus->pr_sid = process_session(p); 1348 prstatus->pr_sid = task_session_vnr(p);
1349 if (thread_group_leader(p)) { 1349 if (thread_group_leader(p)) {
1350 /* 1350 /*
1351 * This is the record for the group leader. Add in the 1351 * This is the record for the group leader. Add in the
@@ -1391,10 +1391,10 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
1391 psinfo->pr_psargs[i] = ' '; 1391 psinfo->pr_psargs[i] = ' ';
1392 psinfo->pr_psargs[len] = 0; 1392 psinfo->pr_psargs[len] = 0;
1393 1393
1394 psinfo->pr_pid = p->pid; 1394 psinfo->pr_pid = task_pid_vnr(p);
1395 psinfo->pr_ppid = p->parent->pid; 1395 psinfo->pr_ppid = task_pid_vnr(p->parent);
1396 psinfo->pr_pgrp = process_group(p); 1396 psinfo->pr_pgrp = task_pgrp_vnr(p);
1397 psinfo->pr_sid = process_session(p); 1397 psinfo->pr_sid = task_session_vnr(p);
1398 1398
1399 i = p->state ? ffz(~p->state) + 1 : 0; 1399 i = p->state ? ffz(~p->state) + 1 : 0;
1400 psinfo->pr_state = i; 1400 psinfo->pr_state = i;
diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c
index 576dd7de2278..f95ae9789c91 100644
--- a/fs/binfmt_em86.c
+++ b/fs/binfmt_em86.c
@@ -2,7 +2,7 @@
2 * linux/fs/binfmt_em86.c 2 * linux/fs/binfmt_em86.c
3 * 3 *
4 * Based on linux/fs/binfmt_script.c 4 * Based on linux/fs/binfmt_script.c
5 * Copyright (C) 1996 Martin von Löwis 5 * Copyright (C) 1996 Martin von Löwis
6 * original #!-checking implemented by tytso. 6 * original #!-checking implemented by tytso.
7 * 7 *
8 * em86 changes Copyright (C) 1997 Jim Paradis 8 * em86 changes Copyright (C) 1997 Jim Paradis
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 42e94b3ab7be..b53c7e5f41bb 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * binfmt_misc.c 2 * binfmt_misc.c
3 * 3 *
4 * Copyright (C) 1997 Richard Günther 4 * Copyright (C) 1997 Richard Günther
5 * 5 *
6 * binfmt_misc detects binaries via a magic or filename extension and invokes 6 * binfmt_misc detects binaries via a magic or filename extension and invokes
7 * a specified wrapper. This should obsolete binfmt_java, binfmt_em86 and 7 * a specified wrapper. This should obsolete binfmt_java, binfmt_em86 and
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index 4d0e0f6d3273..ab33939b12a7 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/fs/binfmt_script.c 2 * linux/fs/binfmt_script.c
3 * 3 *
4 * Copyright (C) 1996 Martin von Löwis 4 * Copyright (C) 1996 Martin von Löwis
5 * original #!-checking implemented by tytso. 5 * original #!-checking implemented by tytso.
6 */ 6 */
7 7
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index bed6215c0794..3d419163c3d3 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,3 +1,19 @@
1Version 1.51
2------------
3Fix memory leak in statfs when mounted to very old servers (e.g.
4Windows 9x). Add new feature "POSIX open" which allows servers
5which support the current POSIX Extensions to provide better semantics
6(e.g. delete for open files opened with posix open). Take into
7account umask on posix mkdir not just older style mkdir. Add
8ability to mount to IPC$ share (which allows CIFS named pipes to be
9opened, read and written as if they were files). When 1st tree
10connect fails (e.g. due to signing negotiation failure) fix
11leak that causes cifsd not to stop and rmmod to fail to cleanup
12cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on
13bigendian architectures. Fix possible memory corruption when
14EAGAIN returned on kern_recvmsg. Return better error if server
15requires packet signing but client has disabled it.
16
1Version 1.50 17Version 1.50
2------------ 18------------
3Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is 19Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
@@ -6,7 +22,10 @@ done with "serverino" mount option). Add support for POSIX Unlink
6Samba supports newer POSIX CIFS Protocol Extensions). Add "nounix" 22Samba supports newer POSIX CIFS Protocol Extensions). Add "nounix"
7mount option to allow disabling the CIFS Unix Extensions for just 23mount option to allow disabling the CIFS Unix Extensions for just
8that mount. Fix hang on spinlock in find_writable_file (race when 24that mount. Fix hang on spinlock in find_writable_file (race when
9reopening file after session crash). 25reopening file after session crash). Byte range unlock request to
26windows server could unlock more bytes (on server copy of file)
27than intended if start of unlock request is well before start of
28a previous byte range lock that we issued.
10 29
11Version 1.49 30Version 1.49
12------------ 31------------
diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile
index 6ecd9d6ba3f3..ff6ba8d823f0 100644
--- a/fs/cifs/Makefile
+++ b/fs/cifs/Makefile
@@ -3,4 +3,4 @@
3# 3#
4obj-$(CONFIG_CIFS) += cifs.o 4obj-$(CONFIG_CIFS) += cifs.o
5 5
6cifs-objs := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o md4.o md5.o cifs_unicode.o nterr.o xattr.o cifsencrypt.o fcntl.o readdir.o ioctl.o sess.o export.o 6cifs-objs := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o md4.o md5.o cifs_unicode.o nterr.o xattr.o cifsencrypt.o fcntl.o readdir.o ioctl.o sess.o export.o cifsacl.o
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index f50a88d58f78..2a01f3ef96a0 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -385,10 +385,9 @@ asn1_oid_decode(struct asn1_ctx *ctx,
385 unsigned long *optr; 385 unsigned long *optr;
386 386
387 size = eoc - ctx->pointer + 1; 387 size = eoc - ctx->pointer + 1;
388 *oid = kmalloc(size * sizeof (unsigned long), GFP_ATOMIC); 388 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
389 if (*oid == NULL) { 389 if (*oid == NULL)
390 return 0; 390 return 0;
391 }
392 391
393 optr = *oid; 392 optr = *oid;
394 393
@@ -581,9 +580,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
581 return 0; 580 return 0;
582 } else if ((cls != ASN1_UNI) || (con != ASN1_CON) 581 } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
583 || (tag != ASN1_SEQ)) { 582 || (tag != ASN1_SEQ)) {
584 cFYI(1, 583 cFYI(1, ("cls = %d con = %d tag = %d end = %p (%d)",
585 ("Exit 6 cls = %d con = %d tag = %d end = %p (%d)", 584 cls, con, tag, end, *end));
586 cls, con, tag, end, *end));
587 } 585 }
588 586
589 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { 587 if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 1bf8cf522ad6..73c4c419663c 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -209,13 +209,16 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
209 i++; 209 i++;
210 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 210 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
211 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); 211 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
212 length = 212 length = sprintf(buf, "\n%d) %s Uses: %d ", i,
213 sprintf(buf, 213 tcon->treeName, atomic_read(&tcon->useCount));
214 "\n%d) %s Uses: %d Type: %s DevInfo: 0x%x " 214 buf += length;
215 "Attributes: 0x%x\nPathComponentMax: %d Status: %d", 215 if (tcon->nativeFileSystem) {
216 i, tcon->treeName, 216 length = sprintf(buf, "Type: %s ",
217 atomic_read(&tcon->useCount), 217 tcon->nativeFileSystem);
218 tcon->nativeFileSystem, 218 buf += length;
219 }
220 length = sprintf(buf, "DevInfo: 0x%x Attributes: 0x%x"
221 "\nPathComponentMax: %d Status: %d",
219 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), 222 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
220 le32_to_cpu(tcon->fsAttrInfo.Attributes), 223 le32_to_cpu(tcon->fsAttrInfo.Attributes),
221 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), 224 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
@@ -876,11 +879,16 @@ security_flags_write(struct file *file, const char __user *buffer,
876 if (count < 3) { 879 if (count < 3) {
877 /* single char or single char followed by null */ 880 /* single char or single char followed by null */
878 c = flags_string[0]; 881 c = flags_string[0];
879 if (c == '0' || c == 'n' || c == 'N') 882 if (c == '0' || c == 'n' || c == 'N') {
880 extended_security = CIFSSEC_DEF; /* default */ 883 extended_security = CIFSSEC_DEF; /* default */
881 else if (c == '1' || c == 'y' || c == 'Y') 884 return count;
885 } else if (c == '1' || c == 'y' || c == 'Y') {
882 extended_security = CIFSSEC_MAX; 886 extended_security = CIFSSEC_MAX;
883 return count; 887 return count;
888 } else if (!isdigit(c)) {
889 cERROR(1, ("invalid flag %c", c));
890 return -EINVAL;
891 }
884 } 892 }
885 /* else we have a number */ 893 /* else we have a number */
886 894
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
new file mode 100644
index 000000000000..e8e56353f5a1
--- /dev/null
+++ b/fs/cifs/cifsacl.c
@@ -0,0 +1,333 @@
1/*
2 * fs/cifs/cifsacl.c
3 *
4 * Copyright (C) International Business Machines Corp., 2007
5 * Author(s): Steve French (sfrench@us.ibm.com)
6 *
7 * Contains the routines for mapping CIFS/NTFS ACLs
8 *
9 * This library is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/fs.h>
25#include "cifspdu.h"
26#include "cifsglob.h"
27#include "cifsacl.h"
28#include "cifsproto.h"
29#include "cifs_debug.h"
30
31
32#ifdef CONFIG_CIFS_EXPERIMENTAL
33
34static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
35 {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"},
36 {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"},
37 {{1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(11), 0, 0, 0, 0} }, "net-users"},
38 {{1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(18), 0, 0, 0, 0} }, "sys"},
39 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(544), 0, 0, 0} }, "root"},
40 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(545), 0, 0, 0} }, "users"},
41 {{1, 2, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(32), cpu_to_le32(546), 0, 0, 0} }, "guest"}
42};
43
44
45/* security id for everyone */
46static const struct cifs_sid sid_everyone =
47 {1, 1, {0, 0, 0, 0, 0, 0}, {} };
48/* group users */
49static const struct cifs_sid sid_user =
50 {1, 2 , {0, 0, 0, 0, 0, 5}, {} };
51
52
53int match_sid(struct cifs_sid *ctsid)
54{
55 int i, j;
56 int num_subauth, num_sat, num_saw;
57 struct cifs_sid *cwsid;
58
59 if (!ctsid)
60 return (-1);
61
62 for (i = 0; i < NUM_WK_SIDS; ++i) {
63 cwsid = &(wksidarr[i].cifssid);
64
65 /* compare the revision */
66 if (ctsid->revision != cwsid->revision)
67 continue;
68
69 /* compare all of the six auth values */
70 for (j = 0; j < 6; ++j) {
71 if (ctsid->authority[j] != cwsid->authority[j])
72 break;
73 }
74 if (j < 6)
75 continue; /* all of the auth values did not match */
76
77 /* compare all of the subauth values if any */
78 num_sat = ctsid->num_subauth;
79 num_saw = cwsid->num_subauth;
80 num_subauth = num_sat < num_saw ? num_sat : num_saw;
81 if (num_subauth) {
82 for (j = 0; j < num_subauth; ++j) {
83 if (ctsid->sub_auth[j] != cwsid->sub_auth[j])
84 break;
85 }
86 if (j < num_subauth)
87 continue; /* all sub_auth values do not match */
88 }
89
90 cFYI(1, ("matching sid: %s\n", wksidarr[i].sidname));
91 return (0); /* sids compare/match */
92 }
93
94 cFYI(1, ("No matching sid"));
95 return (-1);
96}
97
98/* if the two SIDs (roughly equivalent to a UUID for a user or group) are
99 the same returns 1, if they do not match returns 0 */
100int compare_sids(struct cifs_sid *ctsid, struct cifs_sid *cwsid)
101{
102 int i;
103 int num_subauth, num_sat, num_saw;
104
105 if ((!ctsid) || (!cwsid))
106 return (0);
107
108 /* compare the revision */
109 if (ctsid->revision != cwsid->revision)
110 return (0);
111
112 /* compare all of the six auth values */
113 for (i = 0; i < 6; ++i) {
114 if (ctsid->authority[i] != cwsid->authority[i])
115 return (0);
116 }
117
118 /* compare all of the subauth values if any */
119 num_sat = ctsid->num_subauth;
120 num_saw = cwsid->num_subauth;
121 num_subauth = num_sat < num_saw ? num_sat : num_saw;
122 if (num_subauth) {
123 for (i = 0; i < num_subauth; ++i) {
124 if (ctsid->sub_auth[i] != cwsid->sub_auth[i])
125 return (0);
126 }
127 }
128
129 return (1); /* sids compare/match */
130}
131
132
133static void parse_ace(struct cifs_ace *pace, char *end_of_acl)
134{
135 int num_subauth;
136
137 /* validate that we do not go past end of acl */
138
139 /* XXX this if statement can be removed
140 if (end_of_acl < (char *)pace + sizeof(struct cifs_ace)) {
141 cERROR(1, ("ACL too small to parse ACE"));
142 return;
143 } */
144
145 num_subauth = pace->num_subauth;
146 if (num_subauth) {
147#ifdef CONFIG_CIFS_DEBUG2
148 int i;
149 cFYI(1, ("ACE revision %d num_subauth %d",
150 pace->revision, pace->num_subauth));
151 for (i = 0; i < num_subauth; ++i) {
152 cFYI(1, ("ACE sub_auth[%d]: 0x%x", i,
153 le32_to_cpu(pace->sub_auth[i])));
154 }
155
156 /* BB add length check to make sure that we do not have huge
157 num auths and therefore go off the end */
158
159 cFYI(1, ("RID %d", le32_to_cpu(pace->sub_auth[num_subauth-1])));
160#endif
161 }
162
163 return;
164}
165
166static void parse_ntace(struct cifs_ntace *pntace, char *end_of_acl)
167{
168 /* validate that we do not go past end of acl */
169 if (end_of_acl < (char *)pntace + sizeof(struct cifs_ntace)) {
170 cERROR(1, ("ACL too small to parse NT ACE"));
171 return;
172 }
173
174#ifdef CONFIG_CIFS_DEBUG2
175 cFYI(1, ("NTACE type %d flags 0x%x size %d, access Req 0x%x",
176 pntace->type, pntace->flags, pntace->size,
177 pntace->access_req));
178#endif
179 return;
180}
181
182
183
184static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
185 struct cifs_sid *pownersid, struct cifs_sid *pgrpsid)
186{
187 int i;
188 int num_aces = 0;
189 int acl_size;
190 char *acl_base;
191 struct cifs_ntace **ppntace;
192 struct cifs_ace **ppace;
193
194 /* BB need to add parm so we can store the SID BB */
195
196 /* validate that we do not go past end of acl */
197 if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {
198 cERROR(1, ("ACL too small to parse DACL"));
199 return;
200 }
201
202#ifdef CONFIG_CIFS_DEBUG2
203 cFYI(1, ("DACL revision %d size %d num aces %d",
204 le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size),
205 le32_to_cpu(pdacl->num_aces)));
206#endif
207
208 acl_base = (char *)pdacl;
209 acl_size = sizeof(struct cifs_acl);
210
211 num_aces = le32_to_cpu(pdacl->num_aces);
212 if (num_aces > 0) {
213 ppntace = kmalloc(num_aces * sizeof(struct cifs_ntace *),
214 GFP_KERNEL);
215 ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
216 GFP_KERNEL);
217
218/* cifscred->cecount = pdacl->num_aces;
219 cifscred->ntaces = kmalloc(num_aces *
220 sizeof(struct cifs_ntace *), GFP_KERNEL);
221 cifscred->aces = kmalloc(num_aces *
222 sizeof(struct cifs_ace *), GFP_KERNEL);*/
223
224 for (i = 0; i < num_aces; ++i) {
225 ppntace[i] = (struct cifs_ntace *)
226 (acl_base + acl_size);
227 ppace[i] = (struct cifs_ace *) ((char *)ppntace[i] +
228 sizeof(struct cifs_ntace));
229
230 parse_ntace(ppntace[i], end_of_acl);
231 if (end_of_acl < ((char *)ppace[i] +
232 (le16_to_cpu(ppntace[i]->size) -
233 sizeof(struct cifs_ntace)))) {
234 cERROR(1, ("ACL too small to parse ACE"));
235 break;
236 } else
237 parse_ace(ppace[i], end_of_acl);
238
239/* memcpy((void *)(&(cifscred->ntaces[i])),
240 (void *)ppntace[i],
241 sizeof(struct cifs_ntace));
242 memcpy((void *)(&(cifscred->aces[i])),
243 (void *)ppace[i],
244 sizeof(struct cifs_ace)); */
245
246 acl_base = (char *)ppntace[i];
247 acl_size = le16_to_cpu(ppntace[i]->size);
248 }
249
250 kfree(ppace);
251 kfree(ppntace);
252 }
253
254 return;
255}
256
257
258static int parse_sid(struct cifs_sid *psid, char *end_of_acl)
259{
260
261 /* BB need to add parm so we can store the SID BB */
262
263 /* validate that we do not go past end of acl */
264 if (end_of_acl < (char *)psid + sizeof(struct cifs_sid)) {
265 cERROR(1, ("ACL too small to parse SID"));
266 return -EINVAL;
267 }
268
269 if (psid->num_subauth) {
270#ifdef CONFIG_CIFS_DEBUG2
271 int i;
272 cFYI(1, ("SID revision %d num_auth %d First subauth 0x%x",
273 psid->revision, psid->num_subauth, psid->sub_auth[0]));
274
275 for (i = 0; i < psid->num_subauth; i++) {
276 cFYI(1, ("SID sub_auth[%d]: 0x%x ", i,
277 le32_to_cpu(psid->sub_auth[i])));
278 }
279
280 /* BB add length check to make sure that we do not have huge
281 num auths and therefore go off the end */
282 cFYI(1, ("RID 0x%x",
283 le32_to_cpu(psid->sub_auth[psid->num_subauth-1])));
284#endif
285 }
286
287 return 0;
288}
289
290
291/* Convert CIFS ACL to POSIX form */
292int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len)
293{
294 int rc;
295 struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
296 struct cifs_acl *dacl_ptr; /* no need for SACL ptr */
297 char *end_of_acl = ((char *)pntsd) + acl_len;
298
299 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
300 le32_to_cpu(pntsd->osidoffset));
301 group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
302 le32_to_cpu(pntsd->gsidoffset));
303 dacl_ptr = (struct cifs_acl *)((char *)pntsd +
304 le32_to_cpu(pntsd->dacloffset));
305#ifdef CONFIG_CIFS_DEBUG2
306 cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x "
307 "sacloffset 0x%x dacloffset 0x%x",
308 pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset),
309 le32_to_cpu(pntsd->gsidoffset),
310 le32_to_cpu(pntsd->sacloffset),
311 le32_to_cpu(pntsd->dacloffset)));
312#endif
313 rc = parse_sid(owner_sid_ptr, end_of_acl);
314 if (rc)
315 return rc;
316
317 rc = parse_sid(group_sid_ptr, end_of_acl);
318 if (rc)
319 return rc;
320
321 parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, group_sid_ptr);
322
323/* cifscred->uid = owner_sid_ptr->rid;
324 cifscred->gid = group_sid_ptr->rid;
325 memcpy((void *)(&(cifscred->osid)), (void *)owner_sid_ptr,
326 sizeof (struct cifs_sid));
327 memcpy((void *)(&(cifscred->gsid)), (void *)group_sid_ptr,
328 sizeof (struct cifs_sid)); */
329
330
331 return (0);
332}
333#endif /* CONFIG_CIFS_EXPERIMENTAL */
diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h
index 5eff35d6e564..420f87813647 100644
--- a/fs/cifs/cifsacl.h
+++ b/fs/cifs/cifsacl.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/cifsacl.h 2 * fs/cifs/cifsacl.h
3 * 3 *
4 * Copyright (c) International Business Machines Corp., 2005 4 * Copyright (c) International Business Machines Corp., 2007
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * This library is free software; you can redistribute it and/or modify 7 * This library is free software; you can redistribute it and/or modify
@@ -22,17 +22,65 @@
22#ifndef _CIFSACL_H 22#ifndef _CIFSACL_H
23#define _CIFSACL_H 23#define _CIFSACL_H
24 24
25
26#define NUM_AUTHS 6 /* number of authority fields */
27#define NUM_SUBAUTHS 5 /* number of sub authority fields */
28#define NUM_WK_SIDS 7 /* number of well known sids */
29#define SIDNAMELENGTH 20 /* long enough for the ones we care about */
30
31#define READ_BIT 0x4
32#define WRITE_BIT 0x2
33#define EXEC_BIT 0x1
34
35#define UBITSHIFT 6
36#define GBITSHIFT 3
37
38struct cifs_ntsd {
39 __le16 revision; /* revision level */
40 __le16 type;
41 __le32 osidoffset;
42 __le32 gsidoffset;
43 __le32 sacloffset;
44 __le32 dacloffset;
45} __attribute__((packed));
46
25struct cifs_sid { 47struct cifs_sid {
26 __u8 revision; /* revision level */ 48 __u8 revision; /* revision level */
27 __u8 num_subauths; 49 __u8 num_subauth;
50 __u8 authority[6];
51 __le32 sub_auth[5]; /* sub_auth[num_subauth] */ /* BB FIXME endianness BB */
52} __attribute__((packed));
53
54struct cifs_acl {
55 __le16 revision; /* revision level */
56 __le16 size;
57 __le32 num_aces;
58} __attribute__((packed));
59
60struct cifs_ntace { /* first part of ACE which contains perms */
61 __u8 type;
62 __u8 flags;
63 __le16 size;
64 __le32 access_req;
65} __attribute__((packed));
66
67struct cifs_ace { /* last part of ACE which includes user info */
68 __u8 revision; /* revision level */
69 __u8 num_subauth;
28 __u8 authority[6]; 70 __u8 authority[6];
29 __u32 sub_auth[4]; 71 __le32 sub_auth[5];
30 /* next sub_auth if any ... */
31} __attribute__((packed)); 72} __attribute__((packed));
32 73
33/* everyone */ 74struct cifs_wksid {
34/* extern const struct cifs_sid sid_everyone;*/ 75 struct cifs_sid cifssid;
35/* group users */ 76 char sidname[SIDNAMELENGTH];
36/* extern const struct cifs_sid sid_user;*/ 77} __attribute__((packed));
78
79#ifdef CONFIG_CIFS_EXPERIMENTAL
80
81extern int match_sid(struct cifs_sid *);
82extern int compare_sids(struct cifs_sid *, struct cifs_sid *);
83
84#endif /* CONFIG_CIFS_EXPERIMENTAL */
37 85
38#endif /* _CIFSACL_H */ 86#endif /* _CIFSACL_H */
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 36272293027d..632070b4275d 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -345,7 +345,7 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses,
345 user = kmalloc(2 + (len * 2), GFP_KERNEL); 345 user = kmalloc(2 + (len * 2), GFP_KERNEL);
346 if (user == NULL) 346 if (user == NULL)
347 goto calc_exit_2; 347 goto calc_exit_2;
348 len = cifs_strtoUCS(user, ses->userName, len, nls_cp); 348 len = cifs_strtoUCS((__le16 *)user, ses->userName, len, nls_cp);
349 UniStrupr(user); 349 UniStrupr(user);
350 hmac_md5_update((char *)user, 2*len, pctxt); 350 hmac_md5_update((char *)user, 2*len, pctxt);
351 351
@@ -356,7 +356,8 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses,
356 domain = kmalloc(2 + (len * 2), GFP_KERNEL); 356 domain = kmalloc(2 + (len * 2), GFP_KERNEL);
357 if (domain == NULL) 357 if (domain == NULL)
358 goto calc_exit_1; 358 goto calc_exit_1;
359 len = cifs_strtoUCS(domain, ses->domainName, len, nls_cp); 359 len = cifs_strtoUCS((__le16 *)domain, ses->domainName, len,
360 nls_cp);
360 /* the following line was removed since it didn't work well 361 /* the following line was removed since it didn't work well
361 with lower cased domain name that passed as an option. 362 with lower cased domain name that passed as an option.
362 Maybe converting the domain name earlier makes sense */ 363 Maybe converting the domain name earlier makes sense */
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index ba8f7868cb23..a6fbea57c4b1 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -49,10 +49,6 @@
49static struct quotactl_ops cifs_quotactl_ops; 49static struct quotactl_ops cifs_quotactl_ops;
50#endif /* QUOTA */ 50#endif /* QUOTA */
51 51
52#ifdef CONFIG_CIFS_EXPERIMENTAL
53extern struct export_operations cifs_export_ops;
54#endif /* EXPERIMENTAL */
55
56int cifsFYI = 0; 52int cifsFYI = 0;
57int cifsERROR = 1; 53int cifsERROR = 1;
58int traceSMB = 0; 54int traceSMB = 0;
@@ -240,9 +236,9 @@ static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd)
240 236
241 cifs_sb = CIFS_SB(inode->i_sb); 237 cifs_sb = CIFS_SB(inode->i_sb);
242 238
243 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) { 239 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM)
244 return 0; 240 return 0;
245 } else /* file mode might have been restricted at mount time 241 else /* file mode might have been restricted at mount time
246 on the client (above and beyond ACL on servers) for 242 on the client (above and beyond ACL on servers) for
247 servers which do not support setting and viewing mode bits, 243 servers which do not support setting and viewing mode bits,
248 so allowing client to check permissions is useful */ 244 so allowing client to check permissions is useful */
@@ -312,15 +308,15 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
312 seq_printf(s, ",domain=%s", 308 seq_printf(s, ",domain=%s",
313 cifs_sb->tcon->ses->domainName); 309 cifs_sb->tcon->ses->domainName);
314 } 310 }
311 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) ||
312 !(cifs_sb->tcon->unix_ext))
313 seq_printf(s, ",uid=%d", cifs_sb->mnt_uid);
314 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) ||
315 !(cifs_sb->tcon->unix_ext))
316 seq_printf(s, ",gid=%d", cifs_sb->mnt_gid);
315 } 317 }
316 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) 318 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
317 seq_printf(s, ",posixpaths"); 319 seq_printf(s, ",posixpaths");
318 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) ||
319 !(cifs_sb->tcon->unix_ext))
320 seq_printf(s, ",uid=%d", cifs_sb->mnt_uid);
321 if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) ||
322 !(cifs_sb->tcon->unix_ext))
323 seq_printf(s, ",gid=%d", cifs_sb->mnt_gid);
324 seq_printf(s, ",rsize=%d", cifs_sb->rsize); 320 seq_printf(s, ",rsize=%d", cifs_sb->rsize);
325 seq_printf(s, ",wsize=%d", cifs_sb->wsize); 321 seq_printf(s, ",wsize=%d", cifs_sb->wsize);
326 } 322 }
@@ -346,7 +342,7 @@ int cifs_xquota_set(struct super_block *sb, int quota_type, qid_t qid,
346 if (pTcon) { 342 if (pTcon) {
347 cFYI(1, ("set type: 0x%x id: %d", quota_type, qid)); 343 cFYI(1, ("set type: 0x%x id: %d", quota_type, qid));
348 } else { 344 } else {
349 return -EIO; 345 rc = -EIO;
350 } 346 }
351 347
352 FreeXid(xid); 348 FreeXid(xid);
@@ -716,7 +712,7 @@ static int
716cifs_init_inodecache(void) 712cifs_init_inodecache(void)
717{ 713{
718 cifs_inode_cachep = kmem_cache_create("cifs_inode_cache", 714 cifs_inode_cachep = kmem_cache_create("cifs_inode_cache",
719 sizeof (struct cifsInodeInfo), 715 sizeof(struct cifsInodeInfo),
720 0, (SLAB_RECLAIM_ACCOUNT| 716 0, (SLAB_RECLAIM_ACCOUNT|
721 SLAB_MEM_SPREAD), 717 SLAB_MEM_SPREAD),
722 cifs_init_once); 718 cifs_init_once);
@@ -816,8 +812,8 @@ static int
816cifs_init_mids(void) 812cifs_init_mids(void)
817{ 813{
818 cifs_mid_cachep = kmem_cache_create("cifs_mpx_ids", 814 cifs_mid_cachep = kmem_cache_create("cifs_mpx_ids",
819 sizeof (struct mid_q_entry), 0, 815 sizeof(struct mid_q_entry), 0,
820 SLAB_HWCACHE_ALIGN, NULL); 816 SLAB_HWCACHE_ALIGN, NULL);
821 if (cifs_mid_cachep == NULL) 817 if (cifs_mid_cachep == NULL)
822 return -ENOMEM; 818 return -ENOMEM;
823 819
@@ -829,8 +825,8 @@ cifs_init_mids(void)
829 } 825 }
830 826
831 cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs", 827 cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs",
832 sizeof (struct oplock_q_entry), 0, 828 sizeof(struct oplock_q_entry), 0,
833 SLAB_HWCACHE_ALIGN, NULL); 829 SLAB_HWCACHE_ALIGN, NULL);
834 if (cifs_oplock_cachep == NULL) { 830 if (cifs_oplock_cachep == NULL) {
835 mempool_destroy(cifs_mid_poolp); 831 mempool_destroy(cifs_mid_poolp);
836 kmem_cache_destroy(cifs_mid_cachep); 832 kmem_cache_destroy(cifs_mid_cachep);
@@ -882,7 +878,8 @@ static int cifs_oplock_thread(void *dummyarg)
882 the call */ 878 the call */
883 /* mutex_lock(&inode->i_mutex);*/ 879 /* mutex_lock(&inode->i_mutex);*/
884 if (S_ISREG(inode->i_mode)) { 880 if (S_ISREG(inode->i_mode)) {
885 rc = filemap_fdatawrite(inode->i_mapping); 881 rc =
882 filemap_fdatawrite(inode->i_mapping);
886 if (CIFS_I(inode)->clientCanCacheRead 883 if (CIFS_I(inode)->clientCanCacheRead
887 == 0) { 884 == 0) {
888 filemap_fdatawait(inode->i_mapping); 885 filemap_fdatawait(inode->i_mapping);
@@ -907,8 +904,7 @@ static int cifs_oplock_thread(void *dummyarg)
907 0 /* len */ , 0 /* offset */, 0, 904 0 /* len */ , 0 /* offset */, 0,
908 0, LOCKING_ANDX_OPLOCK_RELEASE, 905 0, LOCKING_ANDX_OPLOCK_RELEASE,
909 0 /* wait flag */); 906 0 /* wait flag */);
910 cFYI(1, 907 cFYI(1, ("Oplock release rc = %d", rc));
911 ("Oplock release rc = %d ", rc));
912 } 908 }
913 } else 909 } else
914 spin_unlock(&GlobalMid_Lock); 910 spin_unlock(&GlobalMid_Lock);
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index a20de77a3856..0a3ee5a322b0 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/cifsfs.h 2 * fs/cifs/cifsfs.h
3 * 3 *
4 * Copyright (c) International Business Machines Corp., 2002, 2005 4 * Copyright (c) International Business Machines Corp., 2002, 2007
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * This library is free software; you can redistribute it and/or modify 7 * This library is free software; you can redistribute it and/or modify
@@ -99,7 +99,12 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
99 size_t, int); 99 size_t, int);
100extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); 100extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
101extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); 101extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
102extern int cifs_ioctl (struct inode *inode, struct file *filep, 102extern int cifs_ioctl(struct inode *inode, struct file *filep,
103 unsigned int command, unsigned long arg); 103 unsigned int command, unsigned long arg);
104#define CIFS_VERSION "1.50" 104
105#ifdef CONFIG_CIFS_EXPERIMENTAL
106extern struct export_operations cifs_export_ops;
107#endif /* EXPERIMENTAL */
108
109#define CIFS_VERSION "1.51"
105#endif /* _CIFSFS_H */ 110#endif /* _CIFSFS_H */
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index b98742fc3b5a..87f51f23276f 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -19,6 +19,7 @@
19#include <linux/in.h> 19#include <linux/in.h>
20#include <linux/in6.h> 20#include <linux/in6.h>
21#include "cifs_fs_sb.h" 21#include "cifs_fs_sb.h"
22#include "cifsacl.h"
22/* 23/*
23 * The sizes of various internal tables and strings 24 * The sizes of various internal tables and strings
24 */ 25 */
@@ -89,7 +90,8 @@ enum statusEnum {
89}; 90};
90 91
91enum securityEnum { 92enum securityEnum {
92 LANMAN = 0, /* Legacy LANMAN auth */ 93 PLAINTXT = 0, /* Legacy with Plaintext passwords */
94 LANMAN, /* Legacy LANMAN auth */
93 NTLM, /* Legacy NTLM012 auth with NTLM hash */ 95 NTLM, /* Legacy NTLM012 auth with NTLM hash */
94 NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */ 96 NTLMv2, /* Legacy NTLM auth with NTLMv2 hash */
95 RawNTLMSSP, /* NTLMSSP without SPNEGO */ 97 RawNTLMSSP, /* NTLMSSP without SPNEGO */
@@ -115,6 +117,17 @@ struct mac_key {
115 } data; 117 } data;
116}; 118};
117 119
120struct cifs_cred {
121 int uid;
122 int gid;
123 int mode;
124 int cecount;
125 struct cifs_sid osid;
126 struct cifs_sid gsid;
127 struct cifs_ntace *ntaces;
128 struct cifs_ace *aces;
129};
130
118/* 131/*
119 ***************************************************************** 132 *****************************************************************
120 * Except the CIFS PDUs themselves all the 133 * Except the CIFS PDUs themselves all the
@@ -279,6 +292,7 @@ struct cifsTconInfo {
279 FILE_SYSTEM_DEVICE_INFO fsDevInfo; 292 FILE_SYSTEM_DEVICE_INFO fsDevInfo;
280 FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */ 293 FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */
281 FILE_SYSTEM_UNIX_INFO fsUnixInfo; 294 FILE_SYSTEM_UNIX_INFO fsUnixInfo;
295 unsigned ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */
282 unsigned retry:1; 296 unsigned retry:1;
283 unsigned nocase:1; 297 unsigned nocase:1;
284 unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol 298 unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol
@@ -329,6 +343,7 @@ struct cifsFileInfo {
329 struct list_head llist; /* list of byte range locks we have. */ 343 struct list_head llist; /* list of byte range locks we have. */
330 unsigned closePend:1; /* file is marked to close */ 344 unsigned closePend:1; /* file is marked to close */
331 unsigned invalidHandle:1; /* file closed via session abend */ 345 unsigned invalidHandle:1; /* file closed via session abend */
346 unsigned messageMode:1; /* for pipes: message vs byte mode */
332 atomic_t wrtPending; /* handle in use - defer close */ 347 atomic_t wrtPending; /* handle in use - defer close */
333 struct semaphore fh_sem; /* prevents reopen race after dead ses*/ 348 struct semaphore fh_sem; /* prevents reopen race after dead ses*/
334 char *search_resume_name; /* BB removeme BB */ 349 char *search_resume_name; /* BB removeme BB */
@@ -464,6 +479,9 @@ struct dir_notify_req {
464#ifdef CONFIG_CIFS_WEAK_PW_HASH 479#ifdef CONFIG_CIFS_WEAK_PW_HASH
465#define CIFSSEC_MAY_LANMAN 0x00010 480#define CIFSSEC_MAY_LANMAN 0x00010
466#define CIFSSEC_MAY_PLNTXT 0x00020 481#define CIFSSEC_MAY_PLNTXT 0x00020
482#else
483#define CIFSSEC_MAY_LANMAN 0
484#define CIFSSEC_MAY_PLNTXT 0
467#endif /* weak passwords */ 485#endif /* weak passwords */
468#define CIFSSEC_MAY_SEAL 0x00040 /* not supported yet */ 486#define CIFSSEC_MAY_SEAL 0x00040 /* not supported yet */
469 487
@@ -477,14 +495,23 @@ require use of the stronger protocol */
477#ifdef CONFIG_CIFS_WEAK_PW_HASH 495#ifdef CONFIG_CIFS_WEAK_PW_HASH
478#define CIFSSEC_MUST_LANMAN 0x10010 496#define CIFSSEC_MUST_LANMAN 0x10010
479#define CIFSSEC_MUST_PLNTXT 0x20020 497#define CIFSSEC_MUST_PLNTXT 0x20020
498#ifdef CONFIG_CIFS_UPCALL
499#define CIFSSEC_MASK 0x3F03F /* allows weak security but also krb5 */
500#else
480#define CIFSSEC_MASK 0x37037 /* current flags supported if weak */ 501#define CIFSSEC_MASK 0x37037 /* current flags supported if weak */
502#endif /* UPCALL */
503#else /* do not allow weak pw hash */
504#ifdef CONFIG_CIFS_UPCALL
505#define CIFSSEC_MASK 0x0F00F /* flags supported if no weak allowed */
481#else 506#else
482#define CIFSSEC_MASK 0x07007 /* flags supported if no weak config */ 507#define CIFSSEC_MASK 0x07007 /* flags supported if no weak allowed */
508#endif /* UPCALL */
483#endif /* WEAK_PW_HASH */ 509#endif /* WEAK_PW_HASH */
484#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */ 510#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */
485 511
486#define CIFSSEC_DEF CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2 512#define CIFSSEC_DEF CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2
487#define CIFSSEC_MAX CIFSSEC_MUST_SIGN | CIFSSEC_MUST_NTLMV2 513#define CIFSSEC_MAX CIFSSEC_MUST_SIGN | CIFSSEC_MUST_NTLMV2
514#define CIFSSEC_AUTH_MASK (CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_LANMAN | CIFSSEC_MAY_PLNTXT | CIFSSEC_MAY_KRB5)
488/* 515/*
489 ***************************************************************** 516 *****************************************************************
490 * All constants go here 517 * All constants go here
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 6a2056e58ceb..c41ff74e9128 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -215,6 +215,12 @@
215 /* file_execute, file_read_attributes*/ 215 /* file_execute, file_read_attributes*/
216 /* write_dac, and delete. */ 216 /* write_dac, and delete. */
217 217
218#define FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES)
219#define FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \
220 | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
221#define FILE_EXEC_RIGHTS (FILE_EXECUTE)
222
223
218/* 224/*
219 * Invalid readdir handle 225 * Invalid readdir handle
220 */ 226 */
@@ -360,10 +366,10 @@ struct smb_hdr {
360 __u8 WordCount; 366 __u8 WordCount;
361} __attribute__((packed)); 367} __attribute__((packed));
362/* given a pointer to an smb_hdr retrieve the value of byte count */ 368/* given a pointer to an smb_hdr retrieve the value of byte count */
363#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) 369#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount)))
364#define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) 370#define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount)))
365/* given a pointer to an smb_hdr retrieve the pointer to the byte area */ 371/* given a pointer to an smb_hdr retrieve the pointer to the byte area */
366#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) 372#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount) + 2)
367 373
368/* 374/*
369 * Computer Name Length (since Netbios name was length 16 with last byte 0x20) 375 * Computer Name Length (since Netbios name was length 16 with last byte 0x20)
@@ -716,6 +722,14 @@ typedef struct smb_com_findclose_req {
716#define REQ_OPENDIRONLY 0x00000008 722#define REQ_OPENDIRONLY 0x00000008
717#define REQ_EXTENDED_INFO 0x00000010 723#define REQ_EXTENDED_INFO 0x00000010
718 724
725/* File type */
726#define DISK_TYPE 0x0000
727#define BYTE_PIPE_TYPE 0x0001
728#define MESSAGE_PIPE_TYPE 0x0002
729#define PRINTER_TYPE 0x0003
730#define COMM_DEV_TYPE 0x0004
731#define UNKNOWN_TYPE 0xFFFF
732
719typedef struct smb_com_open_req { /* also handles create */ 733typedef struct smb_com_open_req { /* also handles create */
720 struct smb_hdr hdr; /* wct = 24 */ 734 struct smb_hdr hdr; /* wct = 24 */
721 __u8 AndXCommand; 735 __u8 AndXCommand;
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 04a69dafedba..1a883663b22d 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -50,7 +50,8 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
50 int * /* bytes returned */ , const int long_op); 50 int * /* bytes returned */ , const int long_op);
51extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, 51extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *,
52 struct kvec *, int /* nvec to send */, 52 struct kvec *, int /* nvec to send */,
53 int * /* type of buf returned */ , const int long_op); 53 int * /* type of buf returned */ , const int long_op,
54 const int logError /* whether to log status code*/ );
54extern int SendReceiveBlockingLock(const unsigned int /* xid */ , 55extern int SendReceiveBlockingLock(const unsigned int /* xid */ ,
55 struct cifsTconInfo *, 56 struct cifsTconInfo *,
56 struct smb_hdr * /* input */ , 57 struct smb_hdr * /* input */ ,
@@ -65,7 +66,7 @@ extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
65extern int decode_negTokenInit(unsigned char *security_blob, int length, 66extern int decode_negTokenInit(unsigned char *security_blob, int length,
66 enum securityEnum *secType); 67 enum securityEnum *secType);
67extern int cifs_inet_pton(int, char *source, void *dst); 68extern int cifs_inet_pton(int, char *source, void *dst);
68extern int map_smb_to_linux_error(struct smb_hdr *smb); 69extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr);
69extern void header_assemble(struct smb_hdr *, char /* command */ , 70extern void header_assemble(struct smb_hdr *, char /* command */ ,
70 const struct cifsTconInfo *, int /* length of 71 const struct cifsTconInfo *, int /* length of
71 fixed section (word count) in two byte units */); 72 fixed section (word count) in two byte units */);
@@ -304,12 +305,13 @@ extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn,
304 const char *pass); 305 const char *pass);
305extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, 306extern int CalcNTLMv2_partial_mac_key(struct cifsSesInfo *,
306 const struct nls_table *); 307 const struct nls_table *);
307extern void CalcNTLMv2_response(const struct cifsSesInfo *, char * ); 308extern void CalcNTLMv2_response(const struct cifsSesInfo *, char *);
308extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, 309extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *,
309 const struct nls_table *); 310 const struct nls_table *);
310#ifdef CONFIG_CIFS_WEAK_PW_HASH 311#ifdef CONFIG_CIFS_WEAK_PW_HASH
311extern void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key); 312extern void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key);
312#endif /* CIFS_WEAK_PW_HASH */ 313#endif /* CIFS_WEAK_PW_HASH */
314extern int parse_sec_desc(struct cifs_ntsd *, int);
313extern int CIFSSMBCopy(int xid, 315extern int CIFSSMBCopy(int xid,
314 struct cifsTconInfo *source_tcon, 316 struct cifsTconInfo *source_tcon,
315 const char *fromName, 317 const char *fromName,
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 8eb102f940d4..f0d9a485d095 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -34,10 +34,10 @@
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35#include "cifspdu.h" 35#include "cifspdu.h"
36#include "cifsglob.h" 36#include "cifsglob.h"
37#include "cifsacl.h"
37#include "cifsproto.h" 38#include "cifsproto.h"
38#include "cifs_unicode.h" 39#include "cifs_unicode.h"
39#include "cifs_debug.h" 40#include "cifs_debug.h"
40#include "cifsacl.h"
41 41
42#ifdef CONFIG_CIFS_POSIX 42#ifdef CONFIG_CIFS_POSIX
43static struct { 43static struct {
@@ -94,9 +94,8 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon)
94 write_lock(&GlobalSMBSeslock); 94 write_lock(&GlobalSMBSeslock);
95 list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { 95 list_for_each_safe(tmp, tmp1, &pTcon->openFileList) {
96 open_file = list_entry(tmp, struct cifsFileInfo, tlist); 96 open_file = list_entry(tmp, struct cifsFileInfo, tlist);
97 if (open_file) { 97 if (open_file)
98 open_file->invalidHandle = TRUE; 98 open_file->invalidHandle = TRUE;
99 }
100 } 99 }
101 write_unlock(&GlobalSMBSeslock); 100 write_unlock(&GlobalSMBSeslock);
102 /* BB Add call to invalidate_inodes(sb) for all superblocks mounted 101 /* BB Add call to invalidate_inodes(sb) for all superblocks mounted
@@ -439,8 +438,13 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
439 438
440 pSMB->hdr.Mid = GetNextMid(server); 439 pSMB->hdr.Mid = GetNextMid(server);
441 pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS); 440 pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
441
442 if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5) 442 if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)
443 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; 443 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
444 else if ((secFlags & CIFSSEC_AUTH_MASK) == CIFSSEC_MAY_KRB5) {
445 cFYI(1, ("Kerberos only mechanism, enable extended security"));
446 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
447 }
444 448
445 count = 0; 449 count = 0;
446 for (i = 0; i < CIFS_NUM_PROT; i++) { 450 for (i = 0; i < CIFS_NUM_PROT; i++) {
@@ -513,7 +517,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
513 (int)ts.tv_sec, (int)utc.tv_sec, 517 (int)ts.tv_sec, (int)utc.tv_sec,
514 (int)(utc.tv_sec - ts.tv_sec))); 518 (int)(utc.tv_sec - ts.tv_sec)));
515 val = (int)(utc.tv_sec - ts.tv_sec); 519 val = (int)(utc.tv_sec - ts.tv_sec);
516 seconds = val < 0 ? -val : val; 520 seconds = abs(val);
517 result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ; 521 result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ;
518 remain = seconds % MIN_TZ_ADJ; 522 remain = seconds % MIN_TZ_ADJ;
519 if (remain >= (MIN_TZ_ADJ / 2)) 523 if (remain >= (MIN_TZ_ADJ / 2))
@@ -574,7 +578,20 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
574 server->secType = NTLM; 578 server->secType = NTLM;
575 else if (secFlags & CIFSSEC_MAY_NTLMV2) 579 else if (secFlags & CIFSSEC_MAY_NTLMV2)
576 server->secType = NTLMv2; 580 server->secType = NTLMv2;
577 /* else krb5 ... any others ... */ 581 else if (secFlags & CIFSSEC_MAY_KRB5)
582 server->secType = Kerberos;
583 else if (secFlags & CIFSSEC_MAY_LANMAN)
584 server->secType = LANMAN;
585/* #ifdef CONFIG_CIFS_EXPERIMENTAL
586 else if (secFlags & CIFSSEC_MAY_PLNTXT)
587 server->secType = ??
588#endif */
589 else {
590 rc = -EOPNOTSUPP;
591 cERROR(1, ("Invalid security type"));
592 goto neg_err_exit;
593 }
594 /* else ... any others ...? */
578 595
579 /* one byte, so no need to convert this or EncryptionKeyLen from 596 /* one byte, so no need to convert this or EncryptionKeyLen from
580 little endian */ 597 little endian */
@@ -604,22 +621,26 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
604 if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) && 621 if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) &&
605 (server->capabilities & CAP_EXTENDED_SECURITY)) { 622 (server->capabilities & CAP_EXTENDED_SECURITY)) {
606 count = pSMBr->ByteCount; 623 count = pSMBr->ByteCount;
607 if (count < 16) 624 if (count < 16) {
608 rc = -EIO; 625 rc = -EIO;
609 else if (count == 16) { 626 goto neg_err_exit;
610 server->secType = RawNTLMSSP; 627 }
611 if (server->socketUseCount.counter > 1) { 628
612 if (memcmp(server->server_GUID, 629 if (server->socketUseCount.counter > 1) {
613 pSMBr->u.extended_response. 630 if (memcmp(server->server_GUID,
614 GUID, 16) != 0) { 631 pSMBr->u.extended_response.
615 cFYI(1, ("server UID changed")); 632 GUID, 16) != 0) {
616 memcpy(server->server_GUID, 633 cFYI(1, ("server UID changed"));
617 pSMBr->u.extended_response.GUID,
618 16);
619 }
620 } else
621 memcpy(server->server_GUID, 634 memcpy(server->server_GUID,
622 pSMBr->u.extended_response.GUID, 16); 635 pSMBr->u.extended_response.GUID,
636 16);
637 }
638 } else
639 memcpy(server->server_GUID,
640 pSMBr->u.extended_response.GUID, 16);
641
642 if (count == 16) {
643 server->secType = RawNTLMSSP;
623 } else { 644 } else {
624 rc = decode_negTokenInit(pSMBr->u.extended_response. 645 rc = decode_negTokenInit(pSMBr->u.extended_response.
625 SecurityBlob, 646 SecurityBlob,
@@ -642,10 +663,12 @@ signing_check:
642 /* MUST_SIGN already includes the MAY_SIGN FLAG 663 /* MUST_SIGN already includes the MAY_SIGN FLAG
643 so if this is zero it means that signing is disabled */ 664 so if this is zero it means that signing is disabled */
644 cFYI(1, ("Signing disabled")); 665 cFYI(1, ("Signing disabled"));
645 if (server->secMode & SECMODE_SIGN_REQUIRED) 666 if (server->secMode & SECMODE_SIGN_REQUIRED) {
646 cERROR(1, ("Server requires " 667 cERROR(1, ("Server requires "
647 "/proc/fs/cifs/PacketSigningEnabled " 668 "packet signing to be enabled in "
648 "to be on")); 669 "/proc/fs/cifs/SecurityFlags."));
670 rc = -EOPNOTSUPP;
671 }
649 server->secMode &= 672 server->secMode &=
650 ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); 673 ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED);
651 } else if ((secFlags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN) { 674 } else if ((secFlags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN) {
@@ -1052,7 +1075,7 @@ PsxCreat:
1052 InformationLevel) - 4; 1075 InformationLevel) - 4;
1053 offset = param_offset + params; 1076 offset = param_offset + params;
1054 pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset); 1077 pdata = (OPEN_PSX_REQ *)(((char *)&pSMB->hdr.Protocol) + offset);
1055 pdata->Level = SMB_QUERY_FILE_UNIX_BASIC; 1078 pdata->Level = cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC);
1056 pdata->Permissions = cpu_to_le64(mode); 1079 pdata->Permissions = cpu_to_le64(mode);
1057 pdata->PosixOpenFlags = cpu_to_le32(posix_flags); 1080 pdata->PosixOpenFlags = cpu_to_le32(posix_flags);
1058 pdata->OpenFlags = cpu_to_le32(*pOplock); 1081 pdata->OpenFlags = cpu_to_le32(*pOplock);
@@ -1098,8 +1121,8 @@ PsxCreat:
1098 if (cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction) 1121 if (cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction)
1099 *pOplock |= CIFS_CREATE_ACTION; 1122 *pOplock |= CIFS_CREATE_ACTION;
1100 /* check to make sure response data is there */ 1123 /* check to make sure response data is there */
1101 if (psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC) { 1124 if (psx_rsp->ReturnedLevel != cpu_to_le16(SMB_QUERY_FILE_UNIX_BASIC)) {
1102 pRetData->Type = -1; /* unknown */ 1125 pRetData->Type = cpu_to_le32(-1); /* unknown */
1103#ifdef CONFIG_CIFS_DEBUG2 1126#ifdef CONFIG_CIFS_DEBUG2
1104 cFYI(1, ("unknown type")); 1127 cFYI(1, ("unknown type"));
1105#endif 1128#endif
@@ -1107,12 +1130,12 @@ PsxCreat:
1107 if (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP) 1130 if (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP)
1108 + sizeof(FILE_UNIX_BASIC_INFO)) { 1131 + sizeof(FILE_UNIX_BASIC_INFO)) {
1109 cERROR(1, ("Open response data too small")); 1132 cERROR(1, ("Open response data too small"));
1110 pRetData->Type = -1; 1133 pRetData->Type = cpu_to_le32(-1);
1111 goto psx_create_err; 1134 goto psx_create_err;
1112 } 1135 }
1113 memcpy((char *) pRetData, 1136 memcpy((char *) pRetData,
1114 (char *)psx_rsp + sizeof(OPEN_PSX_RSP), 1137 (char *)psx_rsp + sizeof(OPEN_PSX_RSP),
1115 sizeof (FILE_UNIX_BASIC_INFO)); 1138 sizeof(FILE_UNIX_BASIC_INFO));
1116 } 1139 }
1117 1140
1118psx_create_err: 1141psx_create_err:
@@ -1193,9 +1216,9 @@ OldOpenRetry:
1193 } 1216 }
1194 if (*pOplock & REQ_OPLOCK) 1217 if (*pOplock & REQ_OPLOCK)
1195 pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK); 1218 pSMB->OpenFlags = cpu_to_le16(REQ_OPLOCK);
1196 else if (*pOplock & REQ_BATCHOPLOCK) { 1219 else if (*pOplock & REQ_BATCHOPLOCK)
1197 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK); 1220 pSMB->OpenFlags = cpu_to_le16(REQ_BATCHOPLOCK);
1198 } 1221
1199 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO); 1222 pSMB->OpenFlags |= cpu_to_le16(REQ_MORE_INFO);
1200 /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */ 1223 /* BB fixme add conversion for access_flags to bits 0 - 2 of mode */
1201 /* 0 = read 1224 /* 0 = read
@@ -1310,9 +1333,8 @@ openRetry:
1310 } 1333 }
1311 if (*pOplock & REQ_OPLOCK) 1334 if (*pOplock & REQ_OPLOCK)
1312 pSMB->OpenFlags = cpu_to_le32(REQ_OPLOCK); 1335 pSMB->OpenFlags = cpu_to_le32(REQ_OPLOCK);
1313 else if (*pOplock & REQ_BATCHOPLOCK) { 1336 else if (*pOplock & REQ_BATCHOPLOCK)
1314 pSMB->OpenFlags = cpu_to_le32(REQ_BATCHOPLOCK); 1337 pSMB->OpenFlags = cpu_to_le32(REQ_BATCHOPLOCK);
1315 }
1316 pSMB->DesiredAccess = cpu_to_le32(access_flags); 1338 pSMB->DesiredAccess = cpu_to_le32(access_flags);
1317 pSMB->AllocationSize = 0; 1339 pSMB->AllocationSize = 0;
1318 /* set file as system file if special file such 1340 /* set file as system file if special file such
@@ -1424,9 +1446,8 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1424 1446
1425 iov[0].iov_base = (char *)pSMB; 1447 iov[0].iov_base = (char *)pSMB;
1426 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 1448 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
1427 rc = SendReceive2(xid, tcon->ses, iov, 1449 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */,
1428 1 /* num iovecs */, 1450 &resp_buf_type, 0 /* not long op */, 1 /* log err */ );
1429 &resp_buf_type, 0);
1430 cifs_stats_inc(&tcon->num_reads); 1451 cifs_stats_inc(&tcon->num_reads);
1431 pSMBr = (READ_RSP *)iov[0].iov_base; 1452 pSMBr = (READ_RSP *)iov[0].iov_base;
1432 if (rc) { 1453 if (rc) {
@@ -1446,11 +1467,11 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1446 *nbytes = 0; 1467 *nbytes = 0;
1447 } else { 1468 } else {
1448 pReadData = (char *) (&pSMBr->hdr.Protocol) + 1469 pReadData = (char *) (&pSMBr->hdr.Protocol) +
1449 le16_to_cpu(pSMBr->DataOffset); 1470 le16_to_cpu(pSMBr->DataOffset);
1450/* if (rc = copy_to_user(buf, pReadData, data_length)) { 1471/* if (rc = copy_to_user(buf, pReadData, data_length)) {
1451 cERROR(1,("Faulting on read rc = %d",rc)); 1472 cERROR(1,("Faulting on read rc = %d",rc));
1452 rc = -EFAULT; 1473 rc = -EFAULT;
1453 }*/ /* can not use copy_to_user when using page cache*/ 1474 }*/ /* can not use copy_to_user when using page cache*/
1454 if (*buf) 1475 if (*buf)
1455 memcpy(*buf, pReadData, data_length); 1476 memcpy(*buf, pReadData, data_length);
1456 } 1477 }
@@ -1645,7 +1666,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
1645 1666
1646 1667
1647 rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type, 1668 rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type,
1648 long_op); 1669 long_op, 0 /* do not log STATUS code */ );
1649 cifs_stats_inc(&tcon->num_writes); 1670 cifs_stats_inc(&tcon->num_writes);
1650 if (rc) { 1671 if (rc) {
1651 cFYI(1, ("Send error Write2 = %d", rc)); 1672 cFYI(1, ("Send error Write2 = %d", rc));
@@ -2538,7 +2559,7 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata,
2538 cFYI(1, ("data starts after end of smb")); 2559 cFYI(1, ("data starts after end of smb"));
2539 return -EINVAL; 2560 return -EINVAL;
2540 } else if (data_count + *ppdata > end_of_smb) { 2561 } else if (data_count + *ppdata > end_of_smb) {
2541 cFYI(1,("data %p + count %d (%p) ends after end of smb %p start %p", 2562 cFYI(1, ("data %p + count %d (%p) ends after end of smb %p start %p",
2542 *ppdata, data_count, (data_count + *ppdata), 2563 *ppdata, data_count, (data_count + *ppdata),
2543 end_of_smb, pSMBr)); 2564 end_of_smb, pSMBr));
2544 return -EINVAL; 2565 return -EINVAL;
@@ -2615,7 +2636,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
2615 reparse_buf->TargetNameOffset + 2636 reparse_buf->TargetNameOffset +
2616 reparse_buf->TargetNameLen) > 2637 reparse_buf->TargetNameLen) >
2617 end_of_smb) { 2638 end_of_smb) {
2618 cFYI(1,("reparse buf goes beyond SMB")); 2639 cFYI(1, ("reparse buf beyond SMB"));
2619 rc = -EIO; 2640 rc = -EIO;
2620 goto qreparse_out; 2641 goto qreparse_out;
2621 } 2642 }
@@ -3042,25 +3063,12 @@ GetExtAttrOut:
3042 3063
3043#endif /* CONFIG_POSIX */ 3064#endif /* CONFIG_POSIX */
3044 3065
3045 3066#ifdef CONFIG_CIFS_EXPERIMENTAL
3046/* security id for everyone */
3047static const struct cifs_sid sid_everyone =
3048 {1, 1, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0}};
3049/* group users */
3050static const struct cifs_sid sid_user =
3051 {1, 2 , {0, 0, 0, 0, 0, 5}, {32, 545, 0, 0}};
3052
3053/* Convert CIFS ACL to POSIX form */
3054static int parse_sec_desc(struct cifs_sid *psec_desc, int acl_len)
3055{
3056 return 0;
3057}
3058
3059/* Get Security Descriptor (by handle) from remote server for a file or dir */ 3067/* Get Security Descriptor (by handle) from remote server for a file or dir */
3060int 3068int
3061CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, 3069CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3062 /* BB fix up return info */ char *acl_inf, const int buflen, 3070 /* BB fix up return info */ char *acl_inf, const int buflen,
3063 const int acl_type /* ACCESS/DEFAULT not sure implication */) 3071 const int acl_type)
3064{ 3072{
3065 int rc = 0; 3073 int rc = 0;
3066 int buf_type = 0; 3074 int buf_type = 0;
@@ -3085,12 +3093,13 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3085 iov[0].iov_base = (char *)pSMB; 3093 iov[0].iov_base = (char *)pSMB;
3086 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4; 3094 iov[0].iov_len = pSMB->hdr.smb_buf_length + 4;
3087 3095
3088 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, 0); 3096 rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type,
3097 0 /* not long op */, 0 /* do not log STATUS codes */ );
3089 cifs_stats_inc(&tcon->num_acl_get); 3098 cifs_stats_inc(&tcon->num_acl_get);
3090 if (rc) { 3099 if (rc) {
3091 cFYI(1, ("Send error in QuerySecDesc = %d", rc)); 3100 cFYI(1, ("Send error in QuerySecDesc = %d", rc));
3092 } else { /* decode response */ 3101 } else { /* decode response */
3093 struct cifs_sid *psec_desc; 3102 struct cifs_ntsd *psec_desc;
3094 __le32 * parm; 3103 __le32 * parm;
3095 int parm_len; 3104 int parm_len;
3096 int data_len; 3105 int data_len;
@@ -3105,8 +3114,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3105 goto qsec_out; 3114 goto qsec_out;
3106 pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base; 3115 pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base;
3107 3116
3108 cERROR(1, ("smb %p parm %p data %p", 3117 cFYI(1, ("smb %p parm %p data %p", pSMBr, parm, psec_desc));
3109 pSMBr, parm, psec_desc)); /* BB removeme BB */
3110 3118
3111 if (le32_to_cpu(pSMBr->ParameterCount) != 4) { 3119 if (le32_to_cpu(pSMBr->ParameterCount) != 4) {
3112 rc = -EIO; /* bad smb */ 3120 rc = -EIO; /* bad smb */
@@ -3115,7 +3123,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid,
3115 3123
3116/* BB check that data area is minimum length and as big as acl_len */ 3124/* BB check that data area is minimum length and as big as acl_len */
3117 3125
3118 acl_len = le32_to_cpu(*(__le32 *)parm); 3126 acl_len = le32_to_cpu(*parm);
3119 /* BB check if (acl_len > bufsize) */ 3127 /* BB check if (acl_len > bufsize) */
3120 3128
3121 parse_sec_desc(psec_desc, acl_len); 3129 parse_sec_desc(psec_desc, acl_len);
@@ -3128,6 +3136,7 @@ qsec_out:
3128/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ 3136/* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */
3129 return rc; 3137 return rc;
3130} 3138}
3139#endif /* CONFIG_CIFS_EXPERIMENTAL */
3131 3140
3132/* Legacy Query Path Information call for lookup to old servers such 3141/* Legacy Query Path Information call for lookup to old servers such
3133 as Win9x/WinME */ 3142 as Win9x/WinME */
@@ -3363,6 +3372,9 @@ UnixQPathInfoRetry:
3363 rc = validate_t2((struct smb_t2_rsp *)pSMBr); 3372 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
3364 3373
3365 if (rc || (pSMBr->ByteCount < sizeof(FILE_UNIX_BASIC_INFO))) { 3374 if (rc || (pSMBr->ByteCount < sizeof(FILE_UNIX_BASIC_INFO))) {
3375 cERROR(1, ("Malformed FILE_UNIX_BASIC_INFO response.\n"
3376 "Unix Extensions can be disabled on mount "
3377 "by specifying the nosfu mount option."));
3366 rc = -EIO; /* bad smb */ 3378 rc = -EIO; /* bad smb */
3367 } else { 3379 } else {
3368 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); 3380 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
@@ -3883,12 +3895,10 @@ getDFSRetry:
3883 pSMB->hdr.Mid = GetNextMid(ses->server); 3895 pSMB->hdr.Mid = GetNextMid(ses->server);
3884 pSMB->hdr.Tid = ses->ipc_tid; 3896 pSMB->hdr.Tid = ses->ipc_tid;
3885 pSMB->hdr.Uid = ses->Suid; 3897 pSMB->hdr.Uid = ses->Suid;
3886 if (ses->capabilities & CAP_STATUS32) { 3898 if (ses->capabilities & CAP_STATUS32)
3887 pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS; 3899 pSMB->hdr.Flags2 |= SMBFLG2_ERR_STATUS;
3888 } 3900 if (ses->capabilities & CAP_DFS)
3889 if (ses->capabilities & CAP_DFS) {
3890 pSMB->hdr.Flags2 |= SMBFLG2_DFS; 3901 pSMB->hdr.Flags2 |= SMBFLG2_DFS;
3891 }
3892 3902
3893 if (ses->capabilities & CAP_UNICODE) { 3903 if (ses->capabilities & CAP_UNICODE) {
3894 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; 3904 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
@@ -4060,10 +4070,6 @@ oldQFSInfoRetry:
4060 (void **) &pSMBr); 4070 (void **) &pSMBr);
4061 if (rc) 4071 if (rc)
4062 return rc; 4072 return rc;
4063 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4064 (void **) &pSMBr);
4065 if (rc)
4066 return rc;
4067 4073
4068 params = 2; /* level */ 4074 params = 2; /* level */
4069 pSMB->TotalDataCount = 0; 4075 pSMB->TotalDataCount = 0;
@@ -4265,7 +4271,7 @@ QFSAttributeRetry:
4265 *) (((char *) &pSMBr->hdr.Protocol) + 4271 *) (((char *) &pSMBr->hdr.Protocol) +
4266 data_offset); 4272 data_offset);
4267 memcpy(&tcon->fsAttrInfo, response_data, 4273 memcpy(&tcon->fsAttrInfo, response_data,
4268 sizeof (FILE_SYSTEM_ATTRIBUTE_INFO)); 4274 sizeof(FILE_SYSTEM_ATTRIBUTE_INFO));
4269 } 4275 }
4270 } 4276 }
4271 cifs_buf_release(pSMB); 4277 cifs_buf_release(pSMB);
@@ -4334,7 +4340,7 @@ QFSDeviceRetry:
4334 (((char *) &pSMBr->hdr.Protocol) + 4340 (((char *) &pSMBr->hdr.Protocol) +
4335 data_offset); 4341 data_offset);
4336 memcpy(&tcon->fsDevInfo, response_data, 4342 memcpy(&tcon->fsDevInfo, response_data,
4337 sizeof (FILE_SYSTEM_DEVICE_INFO)); 4343 sizeof(FILE_SYSTEM_DEVICE_INFO));
4338 } 4344 }
4339 } 4345 }
4340 cifs_buf_release(pSMB); 4346 cifs_buf_release(pSMB);
@@ -4402,7 +4408,7 @@ QFSUnixRetry:
4402 *) (((char *) &pSMBr->hdr.Protocol) + 4408 *) (((char *) &pSMBr->hdr.Protocol) +
4403 data_offset); 4409 data_offset);
4404 memcpy(&tcon->fsUnixInfo, response_data, 4410 memcpy(&tcon->fsUnixInfo, response_data,
4405 sizeof (FILE_SYSTEM_UNIX_INFO)); 4411 sizeof(FILE_SYSTEM_UNIX_INFO));
4406 } 4412 }
4407 } 4413 }
4408 cifs_buf_release(pSMB); 4414 cifs_buf_release(pSMB);
@@ -4612,7 +4618,7 @@ SetEOFRetry:
4612 strncpy(pSMB->FileName, fileName, name_len); 4618 strncpy(pSMB->FileName, fileName, name_len);
4613 } 4619 }
4614 params = 6 + name_len; 4620 params = 6 + name_len;
4615 data_count = sizeof (struct file_end_of_file_info); 4621 data_count = sizeof(struct file_end_of_file_info);
4616 pSMB->MaxParameterCount = cpu_to_le16(2); 4622 pSMB->MaxParameterCount = cpu_to_le16(2);
4617 pSMB->MaxDataCount = cpu_to_le16(4100); 4623 pSMB->MaxDataCount = cpu_to_le16(4100);
4618 pSMB->MaxSetupCount = 0; 4624 pSMB->MaxSetupCount = 0;
@@ -4800,7 +4806,7 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
4800 4806
4801 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 4807 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
4802 4808
4803 count = sizeof (FILE_BASIC_INFO); 4809 count = sizeof(FILE_BASIC_INFO);
4804 pSMB->MaxParameterCount = cpu_to_le16(2); 4810 pSMB->MaxParameterCount = cpu_to_le16(2);
4805 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ 4811 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */
4806 pSMB->SetupCount = 1; 4812 pSMB->SetupCount = 1;
@@ -4871,7 +4877,7 @@ SetTimesRetry:
4871 } 4877 }
4872 4878
4873 params = 6 + name_len; 4879 params = 6 + name_len;
4874 count = sizeof (FILE_BASIC_INFO); 4880 count = sizeof(FILE_BASIC_INFO);
4875 pSMB->MaxParameterCount = cpu_to_le16(2); 4881 pSMB->MaxParameterCount = cpu_to_le16(2);
4876 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 4882 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */
4877 pSMB->MaxSetupCount = 0; 4883 pSMB->MaxSetupCount = 0;
@@ -4900,7 +4906,7 @@ SetTimesRetry:
4900 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO); 4906 pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO);
4901 pSMB->Reserved4 = 0; 4907 pSMB->Reserved4 = 0;
4902 pSMB->hdr.smb_buf_length += byte_count; 4908 pSMB->hdr.smb_buf_length += byte_count;
4903 memcpy(data_offset, data, sizeof (FILE_BASIC_INFO)); 4909 memcpy(data_offset, data, sizeof(FILE_BASIC_INFO));
4904 pSMB->ByteCount = cpu_to_le16(byte_count); 4910 pSMB->ByteCount = cpu_to_le16(byte_count);
4905 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 4911 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
4906 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 4912 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
@@ -5003,7 +5009,7 @@ setPermsRetry:
5003 } 5009 }
5004 5010
5005 params = 6 + name_len; 5011 params = 6 + name_len;
5006 count = sizeof (FILE_UNIX_BASIC_INFO); 5012 count = sizeof(FILE_UNIX_BASIC_INFO);
5007 pSMB->MaxParameterCount = cpu_to_le16(2); 5013 pSMB->MaxParameterCount = cpu_to_le16(2);
5008 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ 5014 pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */
5009 pSMB->MaxSetupCount = 0; 5015 pSMB->MaxSetupCount = 0;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 4af3588c1a96..19ee11f7f35a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -124,7 +124,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
124 struct mid_q_entry *mid_entry; 124 struct mid_q_entry *mid_entry;
125 125
126 spin_lock(&GlobalMid_Lock); 126 spin_lock(&GlobalMid_Lock);
127 if ( kthread_should_stop() ) { 127 if (kthread_should_stop()) {
128 /* the demux thread will exit normally 128 /* the demux thread will exit normally
129 next time through the loop */ 129 next time through the loop */
130 spin_unlock(&GlobalMid_Lock); 130 spin_unlock(&GlobalMid_Lock);
@@ -151,9 +151,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
151 } 151 }
152 list_for_each(tmp, &GlobalTreeConnectionList) { 152 list_for_each(tmp, &GlobalTreeConnectionList) {
153 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 153 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
154 if ((tcon) && (tcon->ses) && (tcon->ses->server == server)) { 154 if ((tcon) && (tcon->ses) && (tcon->ses->server == server))
155 tcon->tidStatus = CifsNeedReconnect; 155 tcon->tidStatus = CifsNeedReconnect;
156 }
157 } 156 }
158 read_unlock(&GlobalSMBSeslock); 157 read_unlock(&GlobalSMBSeslock);
159 /* do not want to be sending data on a socket we are freeing */ 158 /* do not want to be sending data on a socket we are freeing */
@@ -187,7 +186,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
187 spin_unlock(&GlobalMid_Lock); 186 spin_unlock(&GlobalMid_Lock);
188 up(&server->tcpSem); 187 up(&server->tcpSem);
189 188
190 while ( (!kthread_should_stop()) && (server->tcpStatus != CifsGood)) { 189 while ((!kthread_should_stop()) && (server->tcpStatus != CifsGood)) {
191 try_to_freeze(); 190 try_to_freeze();
192 if (server->protocolType == IPV6) { 191 if (server->protocolType == IPV6) {
193 rc = ipv6_connect(&server->addr.sockAddr6, 192 rc = ipv6_connect(&server->addr.sockAddr6,
@@ -204,7 +203,7 @@ cifs_reconnect(struct TCP_Server_Info *server)
204 } else { 203 } else {
205 atomic_inc(&tcpSesReconnectCount); 204 atomic_inc(&tcpSesReconnectCount);
206 spin_lock(&GlobalMid_Lock); 205 spin_lock(&GlobalMid_Lock);
207 if ( !kthread_should_stop() ) 206 if (!kthread_should_stop())
208 server->tcpStatus = CifsGood; 207 server->tcpStatus = CifsGood;
209 server->sequence_number = 0; 208 server->sequence_number = 0;
210 spin_unlock(&GlobalMid_Lock); 209 spin_unlock(&GlobalMid_Lock);
@@ -352,17 +351,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
352 351
353 current->flags |= PF_MEMALLOC; 352 current->flags |= PF_MEMALLOC;
354 server->tsk = current; /* save process info to wake at shutdown */ 353 server->tsk = current; /* save process info to wake at shutdown */
355 cFYI(1, ("Demultiplex PID: %d", current->pid)); 354 cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current)));
356 write_lock(&GlobalSMBSeslock); 355 write_lock(&GlobalSMBSeslock);
357 atomic_inc(&tcpSesAllocCount); 356 atomic_inc(&tcpSesAllocCount);
358 length = tcpSesAllocCount.counter; 357 length = tcpSesAllocCount.counter;
359 write_unlock(&GlobalSMBSeslock); 358 write_unlock(&GlobalSMBSeslock);
360 complete(&cifsd_complete); 359 complete(&cifsd_complete);
361 if (length > 1) { 360 if (length > 1)
362 mempool_resize(cifs_req_poolp, 361 mempool_resize(cifs_req_poolp, length + cifs_min_rcv,
363 length + cifs_min_rcv, 362 GFP_KERNEL);
364 GFP_KERNEL);
365 }
366 363
367 set_freezable(); 364 set_freezable();
368 while (!kthread_should_stop()) { 365 while (!kthread_should_stop()) {
@@ -378,7 +375,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
378 } 375 }
379 } else if (isLargeBuf) { 376 } else if (isLargeBuf) {
380 /* we are reusing a dirty large buf, clear its start */ 377 /* we are reusing a dirty large buf, clear its start */
381 memset(bigbuf, 0, sizeof (struct smb_hdr)); 378 memset(bigbuf, 0, sizeof(struct smb_hdr));
382 } 379 }
383 380
384 if (smallbuf == NULL) { 381 if (smallbuf == NULL) {
@@ -391,7 +388,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
391 } 388 }
392 /* beginning of smb buffer is cleared in our buf_get */ 389 /* beginning of smb buffer is cleared in our buf_get */
393 } else /* if existing small buf clear beginning */ 390 } else /* if existing small buf clear beginning */
394 memset(smallbuf, 0, sizeof (struct smb_hdr)); 391 memset(smallbuf, 0, sizeof(struct smb_hdr));
395 392
396 isLargeBuf = FALSE; 393 isLargeBuf = FALSE;
397 isMultiRsp = FALSE; 394 isMultiRsp = FALSE;
@@ -400,11 +397,13 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
400 iov.iov_len = 4; 397 iov.iov_len = 4;
401 smb_msg.msg_control = NULL; 398 smb_msg.msg_control = NULL;
402 smb_msg.msg_controllen = 0; 399 smb_msg.msg_controllen = 0;
400 pdu_length = 4; /* enough to get RFC1001 header */
401incomplete_rcv:
403 length = 402 length =
404 kernel_recvmsg(csocket, &smb_msg, 403 kernel_recvmsg(csocket, &smb_msg,
405 &iov, 1, 4, 0 /* BB see socket.h flags */); 404 &iov, 1, pdu_length, 0 /* BB other flags? */);
406 405
407 if ( kthread_should_stop() ) { 406 if (kthread_should_stop()) {
408 break; 407 break;
409 } else if (server->tcpStatus == CifsNeedReconnect) { 408 } else if (server->tcpStatus == CifsNeedReconnect) {
410 cFYI(1, ("Reconnect after server stopped responding")); 409 cFYI(1, ("Reconnect after server stopped responding"));
@@ -416,7 +415,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
416 msleep(1); /* minimum sleep to prevent looping 415 msleep(1); /* minimum sleep to prevent looping
417 allowing socket to clear and app threads to set 416 allowing socket to clear and app threads to set
418 tcpStatus CifsNeedReconnect if server hung */ 417 tcpStatus CifsNeedReconnect if server hung */
419 continue; 418 if (pdu_length < 4)
419 goto incomplete_rcv;
420 else
421 continue;
420 } else if (length <= 0) { 422 } else if (length <= 0) {
421 if (server->tcpStatus == CifsNew) { 423 if (server->tcpStatus == CifsNew) {
422 cFYI(1, ("tcp session abend after SMBnegprot")); 424 cFYI(1, ("tcp session abend after SMBnegprot"));
@@ -437,13 +439,11 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
437 wake_up(&server->response_q); 439 wake_up(&server->response_q);
438 continue; 440 continue;
439 } else if (length < 4) { 441 } else if (length < 4) {
440 cFYI(1, 442 cFYI(1, ("less than four bytes received (%d bytes)",
441 ("Frame under four bytes received (%d bytes long)",
442 length)); 443 length));
443 cifs_reconnect(server); 444 pdu_length -= length;
444 csocket = server->ssocket; 445 msleep(1);
445 wake_up(&server->response_q); 446 goto incomplete_rcv;
446 continue;
447 } 447 }
448 448
449 /* The right amount was read from socket - 4 bytes */ 449 /* The right amount was read from socket - 4 bytes */
@@ -504,7 +504,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
504 504
505 /* else we have an SMB response */ 505 /* else we have an SMB response */
506 if ((pdu_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) || 506 if ((pdu_length > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) ||
507 (pdu_length < sizeof (struct smb_hdr) - 1 - 4)) { 507 (pdu_length < sizeof(struct smb_hdr) - 1 - 4)) {
508 cERROR(1, ("Invalid size SMB length %d pdu_length %d", 508 cERROR(1, ("Invalid size SMB length %d pdu_length %d",
509 length, pdu_length+4)); 509 length, pdu_length+4));
510 cifs_reconnect(server); 510 cifs_reconnect(server);
@@ -528,7 +528,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
528 total_read += length) { 528 total_read += length) {
529 length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, 529 length = kernel_recvmsg(csocket, &smb_msg, &iov, 1,
530 pdu_length - total_read, 0); 530 pdu_length - total_read, 0);
531 if ( kthread_should_stop() || 531 if (kthread_should_stop() ||
532 (length == -EINTR)) { 532 (length == -EINTR)) {
533 /* then will exit */ 533 /* then will exit */
534 reconnect = 2; 534 reconnect = 2;
@@ -546,6 +546,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
546 allowing socket to clear and app 546 allowing socket to clear and app
547 threads to set tcpStatus 547 threads to set tcpStatus
548 CifsNeedReconnect if server hung*/ 548 CifsNeedReconnect if server hung*/
549 length = 0;
549 continue; 550 continue;
550 } else if (length <= 0) { 551 } else if (length <= 0) {
551 cERROR(1, ("Received no data, expecting %d", 552 cERROR(1, ("Received no data, expecting %d",
@@ -631,9 +632,9 @@ multi_t2_fnd:
631 /* Was previous buf put in mpx struct for multi-rsp? */ 632 /* Was previous buf put in mpx struct for multi-rsp? */
632 if (!isMultiRsp) { 633 if (!isMultiRsp) {
633 /* smb buffer will be freed by user thread */ 634 /* smb buffer will be freed by user thread */
634 if (isLargeBuf) { 635 if (isLargeBuf)
635 bigbuf = NULL; 636 bigbuf = NULL;
636 } else 637 else
637 smallbuf = NULL; 638 smallbuf = NULL;
638 } 639 }
639 wake_up_process(task_to_wake); 640 wake_up_process(task_to_wake);
@@ -676,9 +677,8 @@ multi_t2_fnd:
676 server->ssocket = NULL; 677 server->ssocket = NULL;
677 } 678 }
678 /* buffer usuallly freed in free_mid - need to free it here on exit */ 679 /* buffer usuallly freed in free_mid - need to free it here on exit */
679 if (bigbuf != NULL) 680 cifs_buf_release(bigbuf);
680 cifs_buf_release(bigbuf); 681 if (smallbuf) /* no sense logging a debug message if NULL */
681 if (smallbuf != NULL)
682 cifs_small_buf_release(smallbuf); 682 cifs_small_buf_release(smallbuf);
683 683
684 read_lock(&GlobalSMBSeslock); 684 read_lock(&GlobalSMBSeslock);
@@ -702,9 +702,8 @@ multi_t2_fnd:
702 list_for_each(tmp, &GlobalSMBSessionList) { 702 list_for_each(tmp, &GlobalSMBSessionList) {
703 ses = list_entry(tmp, struct cifsSesInfo, 703 ses = list_entry(tmp, struct cifsSesInfo,
704 cifsSessionList); 704 cifsSessionList);
705 if (ses->server == server) { 705 if (ses->server == server)
706 ses->status = CifsExiting; 706 ses->status = CifsExiting;
707 }
708 } 707 }
709 708
710 spin_lock(&GlobalMid_Lock); 709 spin_lock(&GlobalMid_Lock);
@@ -714,9 +713,8 @@ multi_t2_fnd:
714 cFYI(1, ("Clearing Mid 0x%x - waking up ", 713 cFYI(1, ("Clearing Mid 0x%x - waking up ",
715 mid_entry->mid)); 714 mid_entry->mid));
716 task_to_wake = mid_entry->tsk; 715 task_to_wake = mid_entry->tsk;
717 if (task_to_wake) { 716 if (task_to_wake)
718 wake_up_process(task_to_wake); 717 wake_up_process(task_to_wake);
719 }
720 } 718 }
721 } 719 }
722 spin_unlock(&GlobalMid_Lock); 720 spin_unlock(&GlobalMid_Lock);
@@ -749,18 +747,15 @@ multi_t2_fnd:
749 list_for_each(tmp, &GlobalSMBSessionList) { 747 list_for_each(tmp, &GlobalSMBSessionList) {
750 ses = list_entry(tmp, struct cifsSesInfo, 748 ses = list_entry(tmp, struct cifsSesInfo,
751 cifsSessionList); 749 cifsSessionList);
752 if (ses->server == server) { 750 if (ses->server == server)
753 ses->server = NULL; 751 ses->server = NULL;
754 }
755 } 752 }
756 write_unlock(&GlobalSMBSeslock); 753 write_unlock(&GlobalSMBSeslock);
757 754
758 kfree(server); 755 kfree(server);
759 if (length > 0) { 756 if (length > 0)
760 mempool_resize(cifs_req_poolp, 757 mempool_resize(cifs_req_poolp, length + cifs_min_rcv,
761 length + cifs_min_rcv, 758 GFP_KERNEL);
762 GFP_KERNEL);
763 }
764 759
765 return 0; 760 return 0;
766} 761}
@@ -1477,7 +1472,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1477 if (psin_server->sin_port) { /* user overrode default port */ 1472 if (psin_server->sin_port) { /* user overrode default port */
1478 rc = (*csocket)->ops->connect(*csocket, 1473 rc = (*csocket)->ops->connect(*csocket,
1479 (struct sockaddr *) psin_server, 1474 (struct sockaddr *) psin_server,
1480 sizeof (struct sockaddr_in), 0); 1475 sizeof(struct sockaddr_in), 0);
1481 if (rc >= 0) 1476 if (rc >= 0)
1482 connected = 1; 1477 connected = 1;
1483 } 1478 }
@@ -1493,7 +1488,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1493 1488
1494 rc = (*csocket)->ops->connect(*csocket, 1489 rc = (*csocket)->ops->connect(*csocket,
1495 (struct sockaddr *) psin_server, 1490 (struct sockaddr *) psin_server,
1496 sizeof (struct sockaddr_in), 0); 1491 sizeof(struct sockaddr_in), 0);
1497 if (rc >= 0) 1492 if (rc >= 0)
1498 connected = 1; 1493 connected = 1;
1499 } 1494 }
@@ -1502,7 +1497,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1502 psin_server->sin_port = htons(RFC1001_PORT); 1497 psin_server->sin_port = htons(RFC1001_PORT);
1503 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *) 1498 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *)
1504 psin_server, 1499 psin_server,
1505 sizeof (struct sockaddr_in), 0); 1500 sizeof(struct sockaddr_in), 0);
1506 if (rc >= 0) 1501 if (rc >= 0)
1507 connected = 1; 1502 connected = 1;
1508 } 1503 }
@@ -1610,7 +1605,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1610 if (psin_server->sin6_port) { /* user overrode default port */ 1605 if (psin_server->sin6_port) { /* user overrode default port */
1611 rc = (*csocket)->ops->connect(*csocket, 1606 rc = (*csocket)->ops->connect(*csocket,
1612 (struct sockaddr *) psin_server, 1607 (struct sockaddr *) psin_server,
1613 sizeof (struct sockaddr_in6), 0); 1608 sizeof(struct sockaddr_in6), 0);
1614 if (rc >= 0) 1609 if (rc >= 0)
1615 connected = 1; 1610 connected = 1;
1616 } 1611 }
@@ -1626,7 +1621,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1626 1621
1627 rc = (*csocket)->ops->connect(*csocket, 1622 rc = (*csocket)->ops->connect(*csocket,
1628 (struct sockaddr *) psin_server, 1623 (struct sockaddr *) psin_server,
1629 sizeof (struct sockaddr_in6), 0); 1624 sizeof(struct sockaddr_in6), 0);
1630 if (rc >= 0) 1625 if (rc >= 0)
1631 connected = 1; 1626 connected = 1;
1632 } 1627 }
@@ -1634,7 +1629,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1634 if (!connected) { 1629 if (!connected) {
1635 psin_server->sin6_port = htons(RFC1001_PORT); 1630 psin_server->sin6_port = htons(RFC1001_PORT);
1636 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *) 1631 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *)
1637 psin_server, sizeof (struct sockaddr_in6), 0); 1632 psin_server, sizeof(struct sockaddr_in6), 0);
1638 if (rc >= 0) 1633 if (rc >= 0)
1639 connected = 1; 1634 connected = 1;
1640 } 1635 }
@@ -1750,7 +1745,16 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
1750 cFYI(1, ("very large write cap")); 1745 cFYI(1, ("very large write cap"));
1751#endif /* CIFS_DEBUG2 */ 1746#endif /* CIFS_DEBUG2 */
1752 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) { 1747 if (CIFSSMBSetFSUnixInfo(xid, tcon, cap)) {
1753 cFYI(1, ("setting capabilities failed")); 1748 if (vol_info == NULL) {
1749 cFYI(1, ("resetting capabilities failed"));
1750 } else
1751 cERROR(1, ("Negotiating Unix capabilities "
1752 "with the server failed. Consider "
1753 "mounting with the Unix Extensions\n"
1754 "disabled, if problems are found, "
1755 "by specifying the nounix mount "
1756 "option."));
1757
1754 } 1758 }
1755 } 1759 }
1756} 1760}
@@ -1909,8 +1913,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1909 return rc; 1913 return rc;
1910 } 1914 }
1911 1915
1912 srvTcp = kmalloc(sizeof (struct TCP_Server_Info), GFP_KERNEL); 1916 srvTcp = kzalloc(sizeof(struct TCP_Server_Info), GFP_KERNEL);
1913 if (srvTcp == NULL) { 1917 if (!srvTcp) {
1914 rc = -ENOMEM; 1918 rc = -ENOMEM;
1915 sock_release(csocket); 1919 sock_release(csocket);
1916 kfree(volume_info.UNC); 1920 kfree(volume_info.UNC);
@@ -1919,9 +1923,8 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1919 FreeXid(xid); 1923 FreeXid(xid);
1920 return rc; 1924 return rc;
1921 } else { 1925 } else {
1922 memset(srvTcp, 0, sizeof (struct TCP_Server_Info));
1923 memcpy(&srvTcp->addr.sockAddr, &sin_server, 1926 memcpy(&srvTcp->addr.sockAddr, &sin_server,
1924 sizeof (struct sockaddr_in)); 1927 sizeof(struct sockaddr_in));
1925 atomic_set(&srvTcp->inFlight, 0); 1928 atomic_set(&srvTcp->inFlight, 0);
1926 /* BB Add code for ipv6 case too */ 1929 /* BB Add code for ipv6 case too */
1927 srvTcp->ssocket = csocket; 1930 srvTcp->ssocket = csocket;
@@ -2173,8 +2176,18 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2173 if (tsk) 2176 if (tsk)
2174 kthread_stop(tsk); 2177 kthread_stop(tsk);
2175 } 2178 }
2176 } else 2179 } else {
2177 cFYI(1, ("No session or bad tcon")); 2180 cFYI(1, ("No session or bad tcon"));
2181 if ((pSesInfo->server) &&
2182 (pSesInfo->server->tsk)) {
2183 struct task_struct *tsk;
2184 force_sig(SIGKILL,
2185 pSesInfo->server->tsk);
2186 tsk = pSesInfo->server->tsk;
2187 if (tsk)
2188 kthread_stop(tsk);
2189 }
2190 }
2178 sesInfoFree(pSesInfo); 2191 sesInfoFree(pSesInfo);
2179 /* pSesInfo = NULL; */ 2192 /* pSesInfo = NULL; */
2180 } 2193 }
@@ -2185,8 +2198,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
2185 tcon->ses = pSesInfo; 2198 tcon->ses = pSesInfo;
2186 2199
2187 /* do not care if following two calls succeed - informational */ 2200 /* do not care if following two calls succeed - informational */
2188 CIFSSMBQFSDeviceInfo(xid, tcon); 2201 if (!tcon->ipc) {
2189 CIFSSMBQFSAttributeInfo(xid, tcon); 2202 CIFSSMBQFSDeviceInfo(xid, tcon);
2203 CIFSSMBQFSAttributeInfo(xid, tcon);
2204 }
2190 2205
2191 /* tell server which Unix caps we support */ 2206 /* tell server which Unix caps we support */
2192 if (tcon->ses->capabilities & CAP_UNIX) 2207 if (tcon->ses->capabilities & CAP_UNIX)
@@ -2526,8 +2541,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2526sesssetup_nomem: /* do not return an error on nomem for the info strings, 2541sesssetup_nomem: /* do not return an error on nomem for the info strings,
2527 since that could make reconnection harder, and 2542 since that could make reconnection harder, and
2528 reconnection might be needed to free memory */ 2543 reconnection might be needed to free memory */
2529 if (smb_buffer) 2544 cifs_buf_release(smb_buffer);
2530 cifs_buf_release(smb_buffer);
2531 2545
2532 return rc; 2546 return rc;
2533} 2547}
@@ -2547,7 +2561,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2547 int remaining_words = 0; 2561 int remaining_words = 0;
2548 int bytes_returned = 0; 2562 int bytes_returned = 0;
2549 int len; 2563 int len;
2550 int SecurityBlobLength = sizeof (NEGOTIATE_MESSAGE); 2564 int SecurityBlobLength = sizeof(NEGOTIATE_MESSAGE);
2551 PNEGOTIATE_MESSAGE SecurityBlob; 2565 PNEGOTIATE_MESSAGE SecurityBlob;
2552 PCHALLENGE_MESSAGE SecurityBlob2; 2566 PCHALLENGE_MESSAGE SecurityBlob2;
2553 __u32 negotiate_flags, capabilities; 2567 __u32 negotiate_flags, capabilities;
@@ -2865,15 +2879,14 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2865 rc = -EIO; 2879 rc = -EIO;
2866 } 2880 }
2867 2881
2868 if (smb_buffer) 2882 cifs_buf_release(smb_buffer);
2869 cifs_buf_release(smb_buffer);
2870 2883
2871 return rc; 2884 return rc;
2872} 2885}
2873static int 2886static int
2874CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, 2887CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2875 char *ntlm_session_key, int ntlmv2_flag, 2888 char *ntlm_session_key, int ntlmv2_flag,
2876 const struct nls_table *nls_codepage) 2889 const struct nls_table *nls_codepage)
2877{ 2890{
2878 struct smb_hdr *smb_buffer; 2891 struct smb_hdr *smb_buffer;
2879 struct smb_hdr *smb_buffer_response; 2892 struct smb_hdr *smb_buffer_response;
@@ -2886,7 +2899,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2886 int remaining_words = 0; 2899 int remaining_words = 0;
2887 int bytes_returned = 0; 2900 int bytes_returned = 0;
2888 int len; 2901 int len;
2889 int SecurityBlobLength = sizeof (AUTHENTICATE_MESSAGE); 2902 int SecurityBlobLength = sizeof(AUTHENTICATE_MESSAGE);
2890 PAUTHENTICATE_MESSAGE SecurityBlob; 2903 PAUTHENTICATE_MESSAGE SecurityBlob;
2891 __u32 negotiate_flags, capabilities; 2904 __u32 negotiate_flags, capabilities;
2892 __u16 count; 2905 __u16 count;
@@ -2901,8 +2914,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2901 return -ENOMEM; 2914 return -ENOMEM;
2902 } 2915 }
2903 smb_buffer_response = smb_buffer; 2916 smb_buffer_response = smb_buffer;
2904 pSMB = (SESSION_SETUP_ANDX *) smb_buffer; 2917 pSMB = (SESSION_SETUP_ANDX *)smb_buffer;
2905 pSMBr = (SESSION_SETUP_ANDX *) smb_buffer_response; 2918 pSMBr = (SESSION_SETUP_ANDX *)smb_buffer_response;
2906 2919
2907 /* send SMBsessionSetup here */ 2920 /* send SMBsessionSetup here */
2908 header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX, 2921 header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX,
@@ -2921,7 +2934,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2921 smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; 2934 smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
2922 2935
2923 capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | 2936 capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS |
2924 CAP_EXTENDED_SECURITY; 2937 CAP_EXTENDED_SECURITY;
2925 if (ses->capabilities & CAP_UNICODE) { 2938 if (ses->capabilities & CAP_UNICODE) {
2926 smb_buffer->Flags2 |= SMBFLG2_UNICODE; 2939 smb_buffer->Flags2 |= SMBFLG2_UNICODE;
2927 capabilities |= CAP_UNICODE; 2940 capabilities |= CAP_UNICODE;
@@ -2936,15 +2949,14 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2936 } 2949 }
2937 pSMB->req.Capabilities = cpu_to_le32(capabilities); 2950 pSMB->req.Capabilities = cpu_to_le32(capabilities);
2938 2951
2939 bcc_ptr = (char *) &pSMB->req.SecurityBlob; 2952 bcc_ptr = (char *)&pSMB->req.SecurityBlob;
2940 SecurityBlob = (PAUTHENTICATE_MESSAGE) bcc_ptr; 2953 SecurityBlob = (PAUTHENTICATE_MESSAGE)bcc_ptr;
2941 strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); 2954 strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8);
2942 SecurityBlob->MessageType = NtLmAuthenticate; 2955 SecurityBlob->MessageType = NtLmAuthenticate;
2943 bcc_ptr += SecurityBlobLength; 2956 bcc_ptr += SecurityBlobLength;
2944 negotiate_flags = 2957 negotiate_flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_REQUEST_TARGET |
2945 NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_REQUEST_TARGET | 2958 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO |
2946 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO | 2959 0x80000000 | NTLMSSP_NEGOTIATE_128;
2947 0x80000000 | NTLMSSP_NEGOTIATE_128;
2948 if (sign_CIFS_PDUs) 2960 if (sign_CIFS_PDUs)
2949 negotiate_flags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN; 2961 negotiate_flags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN;
2950 if (ntlmv2_flag) 2962 if (ntlmv2_flag)
@@ -2979,36 +2991,32 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2979 SecurityBlob->DomainName.Length = 0; 2991 SecurityBlob->DomainName.Length = 0;
2980 SecurityBlob->DomainName.MaximumLength = 0; 2992 SecurityBlob->DomainName.MaximumLength = 0;
2981 } else { 2993 } else {
2982 __u16 len = 2994 __u16 ln = cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
2983 cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
2984 nls_codepage); 2995 nls_codepage);
2985 len *= 2; 2996 ln *= 2;
2986 SecurityBlob->DomainName.MaximumLength = 2997 SecurityBlob->DomainName.MaximumLength =
2987 cpu_to_le16(len); 2998 cpu_to_le16(ln);
2988 SecurityBlob->DomainName.Buffer = 2999 SecurityBlob->DomainName.Buffer =
2989 cpu_to_le32(SecurityBlobLength); 3000 cpu_to_le32(SecurityBlobLength);
2990 bcc_ptr += len; 3001 bcc_ptr += ln;
2991 SecurityBlobLength += len; 3002 SecurityBlobLength += ln;
2992 SecurityBlob->DomainName.Length = 3003 SecurityBlob->DomainName.Length = cpu_to_le16(ln);
2993 cpu_to_le16(len);
2994 } 3004 }
2995 if (user == NULL) { 3005 if (user == NULL) {
2996 SecurityBlob->UserName.Buffer = 0; 3006 SecurityBlob->UserName.Buffer = 0;
2997 SecurityBlob->UserName.Length = 0; 3007 SecurityBlob->UserName.Length = 0;
2998 SecurityBlob->UserName.MaximumLength = 0; 3008 SecurityBlob->UserName.MaximumLength = 0;
2999 } else { 3009 } else {
3000 __u16 len = 3010 __u16 ln = cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
3001 cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
3002 nls_codepage); 3011 nls_codepage);
3003 len *= 2; 3012 ln *= 2;
3004 SecurityBlob->UserName.MaximumLength = 3013 SecurityBlob->UserName.MaximumLength =
3005 cpu_to_le16(len); 3014 cpu_to_le16(ln);
3006 SecurityBlob->UserName.Buffer = 3015 SecurityBlob->UserName.Buffer =
3007 cpu_to_le32(SecurityBlobLength); 3016 cpu_to_le32(SecurityBlobLength);
3008 bcc_ptr += len; 3017 bcc_ptr += ln;
3009 SecurityBlobLength += len; 3018 SecurityBlobLength += ln;
3010 SecurityBlob->UserName.Length = 3019 SecurityBlob->UserName.Length = cpu_to_le16(ln);
3011 cpu_to_le16(len);
3012 } 3020 }
3013 3021
3014 /* SecurityBlob->WorkstationName.Length = 3022 /* SecurityBlob->WorkstationName.Length =
@@ -3052,33 +3060,32 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3052 SecurityBlob->DomainName.Length = 0; 3060 SecurityBlob->DomainName.Length = 0;
3053 SecurityBlob->DomainName.MaximumLength = 0; 3061 SecurityBlob->DomainName.MaximumLength = 0;
3054 } else { 3062 } else {
3055 __u16 len; 3063 __u16 ln;
3056 negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED; 3064 negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED;
3057 strncpy(bcc_ptr, domain, 63); 3065 strncpy(bcc_ptr, domain, 63);
3058 len = strnlen(domain, 64); 3066 ln = strnlen(domain, 64);
3059 SecurityBlob->DomainName.MaximumLength = 3067 SecurityBlob->DomainName.MaximumLength =
3060 cpu_to_le16(len); 3068 cpu_to_le16(ln);
3061 SecurityBlob->DomainName.Buffer = 3069 SecurityBlob->DomainName.Buffer =
3062 cpu_to_le32(SecurityBlobLength); 3070 cpu_to_le32(SecurityBlobLength);
3063 bcc_ptr += len; 3071 bcc_ptr += ln;
3064 SecurityBlobLength += len; 3072 SecurityBlobLength += ln;
3065 SecurityBlob->DomainName.Length = cpu_to_le16(len); 3073 SecurityBlob->DomainName.Length = cpu_to_le16(ln);
3066 } 3074 }
3067 if (user == NULL) { 3075 if (user == NULL) {
3068 SecurityBlob->UserName.Buffer = 0; 3076 SecurityBlob->UserName.Buffer = 0;
3069 SecurityBlob->UserName.Length = 0; 3077 SecurityBlob->UserName.Length = 0;
3070 SecurityBlob->UserName.MaximumLength = 0; 3078 SecurityBlob->UserName.MaximumLength = 0;
3071 } else { 3079 } else {
3072 __u16 len; 3080 __u16 ln;
3073 strncpy(bcc_ptr, user, 63); 3081 strncpy(bcc_ptr, user, 63);
3074 len = strnlen(user, 64); 3082 ln = strnlen(user, 64);
3075 SecurityBlob->UserName.MaximumLength = 3083 SecurityBlob->UserName.MaximumLength = cpu_to_le16(ln);
3076 cpu_to_le16(len);
3077 SecurityBlob->UserName.Buffer = 3084 SecurityBlob->UserName.Buffer =
3078 cpu_to_le32(SecurityBlobLength); 3085 cpu_to_le32(SecurityBlobLength);
3079 bcc_ptr += len; 3086 bcc_ptr += ln;
3080 SecurityBlobLength += len; 3087 SecurityBlobLength += ln;
3081 SecurityBlob->UserName.Length = cpu_to_le16(len); 3088 SecurityBlob->UserName.Length = cpu_to_le16(ln);
3082 } 3089 }
3083 /* BB fill in our workstation name if known BB */ 3090 /* BB fill in our workstation name if known BB */
3084 3091
@@ -3100,12 +3107,11 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3100 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 3107 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
3101 &bytes_returned, 1); 3108 &bytes_returned, 1);
3102 if (rc) { 3109 if (rc) {
3103/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ 3110/* rc = map_smb_to_linux_error(smb_buffer_response) done in SendReceive now */
3104 } else if ((smb_buffer_response->WordCount == 3) 3111 } else if ((smb_buffer_response->WordCount == 3) ||
3105 || (smb_buffer_response->WordCount == 4)) { 3112 (smb_buffer_response->WordCount == 4)) {
3106 __u16 action = le16_to_cpu(pSMBr->resp.Action); 3113 __u16 action = le16_to_cpu(pSMBr->resp.Action);
3107 __u16 blob_len = 3114 __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength);
3108 le16_to_cpu(pSMBr->resp.SecurityBlobLength);
3109 if (action & GUEST_LOGIN) 3115 if (action & GUEST_LOGIN)
3110 cFYI(1, (" Guest login")); /* BB Should we set anything 3116 cFYI(1, (" Guest login")); /* BB Should we set anything
3111 in SesInfo struct ? */ 3117 in SesInfo struct ? */
@@ -3145,8 +3151,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3145 } else { 3151 } else {
3146 remaining_words = BCC(smb_buffer_response) / 2; 3152 remaining_words = BCC(smb_buffer_response) / 2;
3147 } 3153 }
3148 len = 3154 len = UniStrnlen((wchar_t *) bcc_ptr,
3149 UniStrnlen((wchar_t *) bcc_ptr,remaining_words - 1); 3155 remaining_words - 1);
3150/* We look for obvious messed up bcc or strings in response so we do not go off 3156/* We look for obvious messed up bcc or strings in response so we do not go off
3151 the end since (at least) WIN2K and Windows XP have a major bug in not null 3157 the end since (at least) WIN2K and Windows XP have a major bug in not null
3152 terminating last Unicode string in response */ 3158 terminating last Unicode string in response */
@@ -3230,7 +3236,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3230 <= BCC(smb_buffer_response)) { 3236 <= BCC(smb_buffer_response)) {
3231 if (ses->serverOS) 3237 if (ses->serverOS)
3232 kfree(ses->serverOS); 3238 kfree(ses->serverOS);
3233 ses->serverOS = kzalloc(len + 1,GFP_KERNEL); 3239 ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
3234 strncpy(ses->serverOS,bcc_ptr, len); 3240 strncpy(ses->serverOS,bcc_ptr, len);
3235 3241
3236 bcc_ptr += len; 3242 bcc_ptr += len;
@@ -3259,28 +3265,24 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3259 bcc_ptr[0] = 0; 3265 bcc_ptr[0] = 0;
3260 bcc_ptr++; 3266 bcc_ptr++;
3261 } else 3267 } else
3262 cFYI(1, 3268 cFYI(1, ("field of length %d "
3263 ("field of length %d "
3264 "extends beyond end of smb ", 3269 "extends beyond end of smb ",
3265 len)); 3270 len));
3266 } 3271 }
3267 } else { 3272 } else {
3268 cERROR(1, 3273 cERROR(1, ("Security Blob extends beyond end "
3269 (" Security Blob extends beyond end "
3270 "of SMB")); 3274 "of SMB"));
3271 } 3275 }
3272 } else { 3276 } else {
3273 cERROR(1, ("No session structure passed in.")); 3277 cERROR(1, ("No session structure passed in."));
3274 } 3278 }
3275 } else { 3279 } else {
3276 cERROR(1, 3280 cERROR(1, ("Invalid Word count %d: ",
3277 (" Invalid Word count %d: ",
3278 smb_buffer_response->WordCount)); 3281 smb_buffer_response->WordCount));
3279 rc = -EIO; 3282 rc = -EIO;
3280 } 3283 }
3281 3284
3282 if (smb_buffer) 3285 cifs_buf_release(smb_buffer);
3283 cifs_buf_release(smb_buffer);
3284 3286
3285 return rc; 3287 return rc;
3286} 3288}
@@ -3389,6 +3391,18 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3389 bcc_ptr = pByteArea(smb_buffer_response); 3391 bcc_ptr = pByteArea(smb_buffer_response);
3390 length = strnlen(bcc_ptr, BCC(smb_buffer_response) - 2); 3392 length = strnlen(bcc_ptr, BCC(smb_buffer_response) - 2);
3391 /* skip service field (NB: this field is always ASCII) */ 3393 /* skip service field (NB: this field is always ASCII) */
3394 if (length == 3) {
3395 if ((bcc_ptr[0] == 'I') && (bcc_ptr[1] == 'P') &&
3396 (bcc_ptr[2] == 'C')) {
3397 cFYI(1, ("IPC connection"));
3398 tcon->ipc = 1;
3399 }
3400 } else if (length == 2) {
3401 if ((bcc_ptr[0] == 'A') && (bcc_ptr[1] == ':')) {
3402 /* the most common case */
3403 cFYI(1, ("disk share connection"));
3404 }
3405 }
3392 bcc_ptr += length + 1; 3406 bcc_ptr += length + 1;
3393 strncpy(tcon->treeName, tree, MAX_TREE_SIZE); 3407 strncpy(tcon->treeName, tree, MAX_TREE_SIZE);
3394 if (smb_buffer->Flags2 & SMBFLG2_UNICODE) { 3408 if (smb_buffer->Flags2 & SMBFLG2_UNICODE) {
@@ -3399,9 +3413,11 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3399 kfree(tcon->nativeFileSystem); 3413 kfree(tcon->nativeFileSystem);
3400 tcon->nativeFileSystem = 3414 tcon->nativeFileSystem =
3401 kzalloc(length + 2, GFP_KERNEL); 3415 kzalloc(length + 2, GFP_KERNEL);
3402 cifs_strfromUCS_le(tcon->nativeFileSystem, 3416 if (tcon->nativeFileSystem)
3403 (__le16 *) bcc_ptr, 3417 cifs_strfromUCS_le(
3404 length, nls_codepage); 3418 tcon->nativeFileSystem,
3419 (__le16 *) bcc_ptr,
3420 length, nls_codepage);
3405 bcc_ptr += 2 * length; 3421 bcc_ptr += 2 * length;
3406 bcc_ptr[0] = 0; /* null terminate the string */ 3422 bcc_ptr[0] = 0; /* null terminate the string */
3407 bcc_ptr[1] = 0; 3423 bcc_ptr[1] = 0;
@@ -3416,8 +3432,9 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3416 kfree(tcon->nativeFileSystem); 3432 kfree(tcon->nativeFileSystem);
3417 tcon->nativeFileSystem = 3433 tcon->nativeFileSystem =
3418 kzalloc(length + 1, GFP_KERNEL); 3434 kzalloc(length + 1, GFP_KERNEL);
3419 strncpy(tcon->nativeFileSystem, bcc_ptr, 3435 if (tcon->nativeFileSystem)
3420 length); 3436 strncpy(tcon->nativeFileSystem, bcc_ptr,
3437 length);
3421 } 3438 }
3422 /* else do not bother copying these information fields*/ 3439 /* else do not bother copying these information fields*/
3423 } 3440 }
@@ -3433,8 +3450,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3433 ses->ipc_tid = smb_buffer_response->Tid; 3450 ses->ipc_tid = smb_buffer_response->Tid;
3434 } 3451 }
3435 3452
3436 if (smb_buffer) 3453 cifs_buf_release(smb_buffer);
3437 cifs_buf_release(smb_buffer);
3438 return rc; 3454 return rc;
3439} 3455}
3440 3456
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 4830acc86d74..793404b10925 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * vfs operations that deal with dentries 4 * vfs operations that deal with dentries
5 * 5 *
6 * Copyright (C) International Business Machines Corp., 2002,2005 6 * Copyright (C) International Business Machines Corp., 2002,2007
7 * Author(s): Steve French (sfrench@us.ibm.com) 7 * Author(s): Steve French (sfrench@us.ibm.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or modify 9 * This library is free software; you can redistribute it and/or modify
@@ -269,7 +269,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
269 CIFSSMBClose(xid, pTcon, fileHandle); 269 CIFSSMBClose(xid, pTcon, fileHandle);
270 } else if (newinode) { 270 } else if (newinode) {
271 pCifsFile = 271 pCifsFile =
272 kzalloc(sizeof (struct cifsFileInfo), GFP_KERNEL); 272 kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
273 273
274 if (pCifsFile == NULL) 274 if (pCifsFile == NULL)
275 goto cifs_create_out; 275 goto cifs_create_out;
@@ -397,7 +397,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
397 /* BB Do not bother to decode buf since no 397 /* BB Do not bother to decode buf since no
398 local inode yet to put timestamps in, 398 local inode yet to put timestamps in,
399 but we can reuse it safely */ 399 but we can reuse it safely */
400 int bytes_written; 400 unsigned int bytes_written;
401 struct win_dev *pdev; 401 struct win_dev *pdev;
402 pdev = (struct win_dev *)buf; 402 pdev = (struct win_dev *)buf;
403 if (S_ISCHR(mode)) { 403 if (S_ISCHR(mode)) {
@@ -450,8 +450,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
450 450
451 xid = GetXid(); 451 xid = GetXid();
452 452
453 cFYI(1, 453 cFYI(1, (" parent inode = 0x%p name is: %s and dentry = 0x%p",
454 (" parent inode = 0x%p name is: %s and dentry = 0x%p",
455 parent_dir_inode, direntry->d_name.name, direntry)); 454 parent_dir_inode, direntry->d_name.name, direntry));
456 455
457 /* check whether path exists */ 456 /* check whether path exists */
diff --git a/fs/cifs/export.c b/fs/cifs/export.c
index 893fd0aebff8..d614b91caeca 100644
--- a/fs/cifs/export.c
+++ b/fs/cifs/export.c
@@ -43,6 +43,7 @@
43#include <linux/exportfs.h> 43#include <linux/exportfs.h>
44#include "cifsglob.h" 44#include "cifsglob.h"
45#include "cifs_debug.h" 45#include "cifs_debug.h"
46#include "cifsfs.h"
46 47
47#ifdef CONFIG_CIFS_EXPERIMENTAL 48#ifdef CONFIG_CIFS_EXPERIMENTAL
48static struct dentry *cifs_get_parent(struct dentry *dentry) 49static struct dentry *cifs_get_parent(struct dentry *dentry)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 894b1f7b299d..1e7e4c06d9e3 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -467,7 +467,7 @@ reopen_error_exit:
467int cifs_close(struct inode *inode, struct file *file) 467int cifs_close(struct inode *inode, struct file *file)
468{ 468{
469 int rc = 0; 469 int rc = 0;
470 int xid; 470 int xid, timeout;
471 struct cifs_sb_info *cifs_sb; 471 struct cifs_sb_info *cifs_sb;
472 struct cifsTconInfo *pTcon; 472 struct cifsTconInfo *pTcon;
473 struct cifsFileInfo *pSMBFile = 473 struct cifsFileInfo *pSMBFile =
@@ -485,9 +485,9 @@ int cifs_close(struct inode *inode, struct file *file)
485 /* no sense reconnecting to close a file that is 485 /* no sense reconnecting to close a file that is
486 already closed */ 486 already closed */
487 if (pTcon->tidStatus != CifsNeedReconnect) { 487 if (pTcon->tidStatus != CifsNeedReconnect) {
488 int timeout = 2; 488 timeout = 2;
489 while ((atomic_read(&pSMBFile->wrtPending) != 0) 489 while ((atomic_read(&pSMBFile->wrtPending) != 0)
490 && (timeout < 1000) ) { 490 && (timeout <= 2048)) {
491 /* Give write a better chance to get to 491 /* Give write a better chance to get to
492 server ahead of the close. We do not 492 server ahead of the close. We do not
493 want to add a wait_q here as it would 493 want to add a wait_q here as it would
@@ -522,12 +522,30 @@ int cifs_close(struct inode *inode, struct file *file)
522 list_del(&pSMBFile->flist); 522 list_del(&pSMBFile->flist);
523 list_del(&pSMBFile->tlist); 523 list_del(&pSMBFile->tlist);
524 write_unlock(&GlobalSMBSeslock); 524 write_unlock(&GlobalSMBSeslock);
525 timeout = 10;
526 /* We waited above to give the SMBWrite a chance to issue
527 on the wire (so we do not get SMBWrite returning EBADF
528 if writepages is racing with close. Note that writepages
529 does not specify a file handle, so it is possible for a file
530 to be opened twice, and the application close the "wrong"
531 file handle - in these cases we delay long enough to allow
532 the SMBWrite to get on the wire before the SMB Close.
533 We allow total wait here over 45 seconds, more than
534 oplock break time, and more than enough to allow any write
535 to complete on the server, or to time out on the client */
536 while ((atomic_read(&pSMBFile->wrtPending) != 0)
537 && (timeout <= 50000)) {
538 cERROR(1, ("writes pending, delay free of handle"));
539 msleep(timeout);
540 timeout *= 8;
541 }
525 kfree(pSMBFile->search_resume_name); 542 kfree(pSMBFile->search_resume_name);
526 kfree(file->private_data); 543 kfree(file->private_data);
527 file->private_data = NULL; 544 file->private_data = NULL;
528 } else 545 } else
529 rc = -EBADF; 546 rc = -EBADF;
530 547
548 read_lock(&GlobalSMBSeslock);
531 if (list_empty(&(CIFS_I(inode)->openFileList))) { 549 if (list_empty(&(CIFS_I(inode)->openFileList))) {
532 cFYI(1, ("closing last open instance for inode %p", inode)); 550 cFYI(1, ("closing last open instance for inode %p", inode));
533 /* if the file is not open we do not know if we can cache info 551 /* if the file is not open we do not know if we can cache info
@@ -535,6 +553,7 @@ int cifs_close(struct inode *inode, struct file *file)
535 CIFS_I(inode)->clientCanCacheRead = FALSE; 553 CIFS_I(inode)->clientCanCacheRead = FALSE;
536 CIFS_I(inode)->clientCanCacheAll = FALSE; 554 CIFS_I(inode)->clientCanCacheAll = FALSE;
537 } 555 }
556 read_unlock(&GlobalSMBSeslock);
538 if ((rc == 0) && CIFS_I(inode)->write_behind_rc) 557 if ((rc == 0) && CIFS_I(inode)->write_behind_rc)
539 rc = CIFS_I(inode)->write_behind_rc; 558 rc = CIFS_I(inode)->write_behind_rc;
540 FreeXid(xid); 559 FreeXid(xid);
@@ -767,7 +786,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
767 mutex_lock(&fid->lock_mutex); 786 mutex_lock(&fid->lock_mutex);
768 list_for_each_entry_safe(li, tmp, &fid->llist, llist) { 787 list_for_each_entry_safe(li, tmp, &fid->llist, llist) {
769 if (pfLock->fl_start <= li->offset && 788 if (pfLock->fl_start <= li->offset &&
770 length >= li->length) { 789 (pfLock->fl_start + length) >=
790 (li->offset + li->length)) {
771 stored_rc = CIFSSMBLock(xid, pTcon, 791 stored_rc = CIFSSMBLock(xid, pTcon,
772 netfid, 792 netfid,
773 li->length, li->offset, 793 li->length, li->offset,
@@ -1022,6 +1042,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
1022 } 1042 }
1023 1043
1024 read_lock(&GlobalSMBSeslock); 1044 read_lock(&GlobalSMBSeslock);
1045refind_writable:
1025 list_for_each_entry(open_file, &cifs_inode->openFileList, flist) { 1046 list_for_each_entry(open_file, &cifs_inode->openFileList, flist) {
1026 if (open_file->closePend) 1047 if (open_file->closePend)
1027 continue; 1048 continue;
@@ -1029,24 +1050,49 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
1029 ((open_file->pfile->f_flags & O_RDWR) || 1050 ((open_file->pfile->f_flags & O_RDWR) ||
1030 (open_file->pfile->f_flags & O_WRONLY))) { 1051 (open_file->pfile->f_flags & O_WRONLY))) {
1031 atomic_inc(&open_file->wrtPending); 1052 atomic_inc(&open_file->wrtPending);
1053
1054 if (!open_file->invalidHandle) {
1055 /* found a good writable file */
1056 read_unlock(&GlobalSMBSeslock);
1057 return open_file;
1058 }
1059
1032 read_unlock(&GlobalSMBSeslock); 1060 read_unlock(&GlobalSMBSeslock);
1033 if ((open_file->invalidHandle) && 1061 /* Had to unlock since following call can block */
1034 (!open_file->closePend) /* BB fixme -since the second clause can not be true remove it BB */) { 1062 rc = cifs_reopen_file(open_file->pfile, FALSE);
1035 rc = cifs_reopen_file(open_file->pfile, FALSE); 1063 if (!rc) {
1036 /* if it fails, try another handle - might be */ 1064 if (!open_file->closePend)
1037 /* dangerous to hold up writepages with retry */ 1065 return open_file;
1038 if (rc) { 1066 else { /* start over in case this was deleted */
1039 cFYI(1, 1067 /* since the list could be modified */
1040 ("failed on reopen file in wp"));
1041 read_lock(&GlobalSMBSeslock); 1068 read_lock(&GlobalSMBSeslock);
1042 /* can not use this handle, no write 1069 atomic_dec(&open_file->wrtPending);
1043 pending on this one after all */ 1070 goto refind_writable;
1044 atomic_dec
1045 (&open_file->wrtPending);
1046 continue;
1047 } 1071 }
1048 } 1072 }
1049 return open_file; 1073
1074 /* if it fails, try another handle if possible -
1075 (we can not do this if closePending since
1076 loop could be modified - in which case we
1077 have to start at the beginning of the list
1078 again. Note that it would be bad
1079 to hold up writepages here (rather than
1080 in caller) with continuous retries */
1081 cFYI(1, ("wp failed on reopen file"));
1082 read_lock(&GlobalSMBSeslock);
1083 /* can not use this handle, no write
1084 pending on this one after all */
1085 atomic_dec(&open_file->wrtPending);
1086
1087 if (open_file->closePend) /* list could have changed */
1088 goto refind_writable;
1089 /* else we simply continue to the next entry. Thus
1090 we do not loop on reopen errors. If we
1091 can not reopen the file, for example if we
1092 reconnected to a server with another client
1093 racing to delete or lock the file we would not
1094 make progress if we restarted before the beginning
1095 of the loop here. */
1050 } 1096 }
1051 } 1097 }
1052 read_unlock(&GlobalSMBSeslock); 1098 read_unlock(&GlobalSMBSeslock);
@@ -1709,7 +1755,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1709 struct page *page; 1755 struct page *page;
1710 struct cifs_sb_info *cifs_sb; 1756 struct cifs_sb_info *cifs_sb;
1711 struct cifsTconInfo *pTcon; 1757 struct cifsTconInfo *pTcon;
1712 int bytes_read = 0; 1758 unsigned int bytes_read = 0;
1713 unsigned int read_size, i; 1759 unsigned int read_size, i;
1714 char *smb_read_data = NULL; 1760 char *smb_read_data = NULL;
1715 struct smb_com_read_rsp *pSMBr; 1761 struct smb_com_read_rsp *pSMBr;
@@ -1803,7 +1849,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1803 1849
1804 i += bytes_read >> PAGE_CACHE_SHIFT; 1850 i += bytes_read >> PAGE_CACHE_SHIFT;
1805 cifs_stats_bytes_read(pTcon, bytes_read); 1851 cifs_stats_bytes_read(pTcon, bytes_read);
1806 if ((int)(bytes_read & PAGE_CACHE_MASK) != bytes_read) { 1852 if ((bytes_read & PAGE_CACHE_MASK) != bytes_read) {
1807 i++; /* account for partial page */ 1853 i++; /* account for partial page */
1808 1854
1809 /* server copy of file can have smaller size 1855 /* server copy of file can have smaller size
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index dd4167762a8e..5e8b388be3b6 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -115,7 +115,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
115 inode->i_mode = le64_to_cpu(findData.Permissions); 115 inode->i_mode = le64_to_cpu(findData.Permissions);
116 /* since we set the inode type below we need to mask off 116 /* since we set the inode type below we need to mask off
117 to avoid strange results if bits set above */ 117 to avoid strange results if bits set above */
118 inode->i_mode &= ~S_IFMT; 118 inode->i_mode &= ~S_IFMT;
119 if (type == UNIX_FILE) { 119 if (type == UNIX_FILE) {
120 inode->i_mode |= S_IFREG; 120 inode->i_mode |= S_IFREG;
121 } else if (type == UNIX_SYMLINK) { 121 } else if (type == UNIX_SYMLINK) {
@@ -575,19 +575,33 @@ int cifs_get_inode_info(struct inode **pinode,
575 return rc; 575 return rc;
576} 576}
577 577
578static const struct inode_operations cifs_ipc_inode_ops = {
579 .lookup = cifs_lookup,
580};
581
578/* gets root inode */ 582/* gets root inode */
579void cifs_read_inode(struct inode *inode) 583void cifs_read_inode(struct inode *inode)
580{ 584{
581 int xid; 585 int xid, rc;
582 struct cifs_sb_info *cifs_sb; 586 struct cifs_sb_info *cifs_sb;
583 587
584 cifs_sb = CIFS_SB(inode->i_sb); 588 cifs_sb = CIFS_SB(inode->i_sb);
585 xid = GetXid(); 589 xid = GetXid();
586 590
587 if (cifs_sb->tcon->unix_ext) 591 if (cifs_sb->tcon->unix_ext)
588 cifs_get_inode_info_unix(&inode, "", inode->i_sb, xid); 592 rc = cifs_get_inode_info_unix(&inode, "", inode->i_sb, xid);
589 else 593 else
590 cifs_get_inode_info(&inode, "", NULL, inode->i_sb, xid); 594 rc = cifs_get_inode_info(&inode, "", NULL, inode->i_sb, xid);
595 if (rc && cifs_sb->tcon->ipc) {
596 cFYI(1, ("ipc connection - fake read inode"));
597 inode->i_mode |= S_IFDIR;
598 inode->i_nlink = 2;
599 inode->i_op = &cifs_ipc_inode_ops;
600 inode->i_fop = &simple_dir_operations;
601 inode->i_uid = cifs_sb->mnt_uid;
602 inode->i_gid = cifs_sb->mnt_gid;
603 }
604
591 /* can not call macro FreeXid here since in a void func */ 605 /* can not call macro FreeXid here since in a void func */
592 _FreeXid(xid); 606 _FreeXid(xid);
593} 607}
@@ -919,18 +933,25 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
919 goto mkdir_out; 933 goto mkdir_out;
920 } 934 }
921 935
936 mode &= ~current->fs->umask;
922 rc = CIFSPOSIXCreate(xid, pTcon, SMB_O_DIRECTORY | SMB_O_CREAT, 937 rc = CIFSPOSIXCreate(xid, pTcon, SMB_O_DIRECTORY | SMB_O_CREAT,
923 mode, NULL /* netfid */, pInfo, &oplock, 938 mode, NULL /* netfid */, pInfo, &oplock,
924 full_path, cifs_sb->local_nls, 939 full_path, cifs_sb->local_nls,
925 cifs_sb->mnt_cifs_flags & 940 cifs_sb->mnt_cifs_flags &
926 CIFS_MOUNT_MAP_SPECIAL_CHR); 941 CIFS_MOUNT_MAP_SPECIAL_CHR);
927 if (rc) { 942 if (rc == -EOPNOTSUPP) {
943 kfree(pInfo);
944 goto mkdir_retry_old;
945 } else if (rc) {
928 cFYI(1, ("posix mkdir returned 0x%x", rc)); 946 cFYI(1, ("posix mkdir returned 0x%x", rc));
929 d_drop(direntry); 947 d_drop(direntry);
930 } else { 948 } else {
931 int obj_type; 949 int obj_type;
932 if (pInfo->Type == -1) /* no return info - go query */ 950 if (pInfo->Type == cpu_to_le32(-1)) {
951 /* no return info, go query for it */
952 kfree(pInfo);
933 goto mkdir_get_info; 953 goto mkdir_get_info;
954 }
934/*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need 955/*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need
935 to set uid/gid */ 956 to set uid/gid */
936 inc_nlink(inode); 957 inc_nlink(inode);
@@ -940,8 +961,10 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
940 direntry->d_op = &cifs_dentry_ops; 961 direntry->d_op = &cifs_dentry_ops;
941 962
942 newinode = new_inode(inode->i_sb); 963 newinode = new_inode(inode->i_sb);
943 if (newinode == NULL) 964 if (newinode == NULL) {
965 kfree(pInfo);
944 goto mkdir_get_info; 966 goto mkdir_get_info;
967 }
945 /* Is an i_ino of zero legal? */ 968 /* Is an i_ino of zero legal? */
946 /* Are there sanity checks we can use to ensure that 969 /* Are there sanity checks we can use to ensure that
947 the server is really filling in that field? */ 970 the server is really filling in that field? */
@@ -972,7 +995,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
972 kfree(pInfo); 995 kfree(pInfo);
973 goto mkdir_out; 996 goto mkdir_out;
974 } 997 }
975 998mkdir_retry_old:
976 /* BB add setting the equivalent of mode via CreateX w/ACLs */ 999 /* BB add setting the equivalent of mode via CreateX w/ACLs */
977 rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls, 1000 rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls,
978 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 1001 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -1377,8 +1400,17 @@ static int cifs_vmtruncate(struct inode *inode, loff_t offset)
1377 } 1400 }
1378 i_size_write(inode, offset); 1401 i_size_write(inode, offset);
1379 spin_unlock(&inode->i_lock); 1402 spin_unlock(&inode->i_lock);
1403 /*
1404 * unmap_mapping_range is called twice, first simply for efficiency
1405 * so that truncate_inode_pages does fewer single-page unmaps. However
1406 * after this first call, and before truncate_inode_pages finishes,
1407 * it is possible for private pages to be COWed, which remain after
1408 * truncate_inode_pages finishes, hence the second unmap_mapping_range
1409 * call must be made for correctness.
1410 */
1380 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); 1411 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
1381 truncate_inode_pages(mapping, offset); 1412 truncate_inode_pages(mapping, offset);
1413 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
1382 goto out_truncate; 1414 goto out_truncate;
1383 1415
1384do_expand: 1416do_expand:
@@ -1469,7 +1501,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1469 atomic_dec(&open_file->wrtPending); 1501 atomic_dec(&open_file->wrtPending);
1470 cFYI(1, ("SetFSize for attrs rc = %d", rc)); 1502 cFYI(1, ("SetFSize for attrs rc = %d", rc));
1471 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { 1503 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
1472 int bytes_written; 1504 unsigned int bytes_written;
1473 rc = CIFSSMBWrite(xid, pTcon, 1505 rc = CIFSSMBWrite(xid, pTcon,
1474 nfid, 0, attrs->ia_size, 1506 nfid, 0, attrs->ia_size,
1475 &bytes_written, NULL, NULL, 1507 &bytes_written, NULL, NULL,
@@ -1502,7 +1534,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1502 cifs_sb->mnt_cifs_flags & 1534 cifs_sb->mnt_cifs_flags &
1503 CIFS_MOUNT_MAP_SPECIAL_CHR); 1535 CIFS_MOUNT_MAP_SPECIAL_CHR);
1504 if (rc == 0) { 1536 if (rc == 0) {
1505 int bytes_written; 1537 unsigned int bytes_written;
1506 rc = CIFSSMBWrite(xid, pTcon, 1538 rc = CIFSSMBWrite(xid, pTcon,
1507 netfid, 0, 1539 netfid, 0,
1508 attrs->ia_size, 1540 attrs->ia_size,
@@ -1538,6 +1570,11 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1538 } 1570 }
1539 1571
1540 time_buf.Attributes = 0; 1572 time_buf.Attributes = 0;
1573
1574 /* skip mode change if it's just for clearing setuid/setgid */
1575 if (attrs->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
1576 attrs->ia_valid &= ~ATTR_MODE;
1577
1541 if (attrs->ia_valid & ATTR_MODE) { 1578 if (attrs->ia_valid & ATTR_MODE) {
1542 cFYI(1, ("Mode changed to 0x%x", attrs->ia_mode)); 1579 cFYI(1, ("Mode changed to 0x%x", attrs->ia_mode));
1543 mode = attrs->ia_mode; 1580 mode = attrs->ia_mode;
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 6a85ef7b8797..11f265726db7 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -237,7 +237,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
237 char *tmp_path = NULL; 237 char *tmp_path = NULL;
238 char *tmpbuffer; 238 char *tmpbuffer;
239 unsigned char *referrals = NULL; 239 unsigned char *referrals = NULL;
240 int num_referrals = 0; 240 unsigned int num_referrals = 0;
241 int len; 241 int len;
242 __u16 fid; 242 __u16 fid;
243 243
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 0bcec0844bee..51ec681fe74a 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -169,7 +169,6 @@ cifs_buf_get(void)
169void 169void
170cifs_buf_release(void *buf_to_free) 170cifs_buf_release(void *buf_to_free)
171{ 171{
172
173 if (buf_to_free == NULL) { 172 if (buf_to_free == NULL) {
174 /* cFYI(1, ("Null buffer passed to cifs_buf_release"));*/ 173 /* cFYI(1, ("Null buffer passed to cifs_buf_release"));*/
175 return; 174 return;
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 2bfed3f45d0f..f06359cb22ee 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -114,10 +114,16 @@ static const struct smb_to_posix_error mapping_table_ERRSRV[] = {
114 {ERRusempx, -EIO}, 114 {ERRusempx, -EIO},
115 {ERRusestd, -EIO}, 115 {ERRusestd, -EIO},
116 {ERR_NOTIFY_ENUM_DIR, -ENOBUFS}, 116 {ERR_NOTIFY_ENUM_DIR, -ENOBUFS},
117 {ERRaccountexpired, -EACCES}, 117 {ERRnoSuchUser, -EACCES},
118/* {ERRaccountexpired, -EACCES},
118 {ERRbadclient, -EACCES}, 119 {ERRbadclient, -EACCES},
119 {ERRbadLogonTime, -EACCES}, 120 {ERRbadLogonTime, -EACCES},
120 {ERRpasswordExpired, -EACCES}, 121 {ERRpasswordExpired, -EACCES},*/
122 {ERRaccountexpired, -EKEYEXPIRED},
123 {ERRbadclient, -EACCES},
124 {ERRbadLogonTime, -EACCES},
125 {ERRpasswordExpired, -EKEYEXPIRED},
126
121 {ERRnosupport, -EINVAL}, 127 {ERRnosupport, -EINVAL},
122 {0, 0} 128 {0, 0}
123}; 129};
@@ -270,7 +276,7 @@ static const struct {
270 from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE 276 from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
271 during the session setup } */ 277 during the session setup } */
272 { 278 {
273 ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { 279 ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { /* could map to 2238 */
274 ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, { 280 ERRHRD, ERRgeneral, NT_STATUS_GROUP_EXISTS}, {
275 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, { 281 ERRHRD, ERRgeneral, NT_STATUS_NO_SUCH_GROUP}, {
276 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, { 282 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_IN_GROUP}, {
@@ -285,10 +291,10 @@ static const struct {
285 ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, { 291 ERRHRD, ERRgeneral, NT_STATUS_PASSWORD_RESTRICTION}, {
286 ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, { 292 ERRDOS, ERRnoaccess, NT_STATUS_LOGON_FAILURE}, {
287 ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, { 293 ERRHRD, ERRgeneral, NT_STATUS_ACCOUNT_RESTRICTION}, {
288 ERRSRV, 2241, NT_STATUS_INVALID_LOGON_HOURS}, { 294 ERRSRV, ERRbadLogonTime, NT_STATUS_INVALID_LOGON_HOURS}, {
289 ERRSRV, 2240, NT_STATUS_INVALID_WORKSTATION}, { 295 ERRSRV, ERRbadclient, NT_STATUS_INVALID_WORKSTATION}, {
290 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, { 296 ERRSRV, ERRpasswordExpired, NT_STATUS_PASSWORD_EXPIRED}, {
291 ERRSRV, 2239, NT_STATUS_ACCOUNT_DISABLED}, { 297 ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_DISABLED}, {
292 ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, { 298 ERRHRD, ERRgeneral, NT_STATUS_NONE_MAPPED}, {
293 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, { 299 ERRHRD, ERRgeneral, NT_STATUS_TOO_MANY_LUIDS_REQUESTED}, {
294 ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, { 300 ERRHRD, ERRgeneral, NT_STATUS_LUIDS_EXHAUSTED}, {
@@ -585,7 +591,7 @@ static const struct {
585 ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, { 591 ERRDOS, ERRnoaccess, NT_STATUS_TRUST_FAILURE}, {
586 ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, { 592 ERRHRD, ERRgeneral, NT_STATUS_MUTANT_LIMIT_EXCEEDED}, {
587 ERRDOS, ERRnetlogonNotStarted, NT_STATUS_NETLOGON_NOT_STARTED}, { 593 ERRDOS, ERRnetlogonNotStarted, NT_STATUS_NETLOGON_NOT_STARTED}, {
588 ERRSRV, 2239, NT_STATUS_ACCOUNT_EXPIRED}, { 594 ERRSRV, ERRaccountexpired, NT_STATUS_ACCOUNT_EXPIRED}, {
589 ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, { 595 ERRHRD, ERRgeneral, NT_STATUS_POSSIBLE_DEADLOCK}, {
590 ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, { 596 ERRHRD, ERRgeneral, NT_STATUS_NETWORK_CREDENTIAL_CONFLICT}, {
591 ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, { 597 ERRHRD, ERRgeneral, NT_STATUS_REMOTE_SESSION_LIMIT}, {
@@ -754,7 +760,7 @@ ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode)
754} 760}
755 761
756int 762int
757map_smb_to_linux_error(struct smb_hdr *smb) 763map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
758{ 764{
759 unsigned int i; 765 unsigned int i;
760 int rc = -EIO; /* if transport error smb error may not be set */ 766 int rc = -EIO; /* if transport error smb error may not be set */
@@ -771,7 +777,9 @@ map_smb_to_linux_error(struct smb_hdr *smb)
771 /* translate the newer STATUS codes to old style SMB errors 777 /* translate the newer STATUS codes to old style SMB errors
772 * and then to POSIX errors */ 778 * and then to POSIX errors */
773 __u32 err = le32_to_cpu(smb->Status.CifsError); 779 __u32 err = le32_to_cpu(smb->Status.CifsError);
774 if (cifsFYI & CIFS_RC) 780 if (logErr && (err != (NT_STATUS_MORE_PROCESSING_REQUIRED)))
781 cifs_print_status(err);
782 else if (cifsFYI & CIFS_RC)
775 cifs_print_status(err); 783 cifs_print_status(err);
776 ntstatus_to_dos(err, &smberrclass, &smberrcode); 784 ntstatus_to_dos(err, &smberrclass, &smberrcode);
777 } else { 785 } else {
@@ -813,7 +821,7 @@ map_smb_to_linux_error(struct smb_hdr *smb)
813 } 821 }
814 /* else ERRHRD class errors or junk - return EIO */ 822 /* else ERRHRD class errors or junk - return EIO */
815 823
816 cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!", 824 cFYI(1, ("Mapping smb error code %d to POSIX err %d",
817 smberrcode, rc)); 825 smberrcode, rc));
818 826
819 /* generic corrective action e.g. reconnect SMB session on 827 /* generic corrective action e.g. reconnect SMB session on
@@ -899,8 +907,11 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
899 cERROR(1, ("illegal hours %d", st->Hours)); 907 cERROR(1, ("illegal hours %d", st->Hours));
900 days = sd->Day; 908 days = sd->Day;
901 month = sd->Month; 909 month = sd->Month;
902 if ((days > 31) || (month > 12)) 910 if ((days > 31) || (month > 12)) {
903 cERROR(1, ("illegal date, month %d day: %d", month, days)); 911 cERROR(1, ("illegal date, month %d day: %d", month, days));
912 if (month > 12)
913 month = 12;
914 }
904 month -= 1; 915 month -= 1;
905 days += total_days_of_prev_months[month]; 916 days += total_days_of_prev_months[month];
906 days += 3652; /* account for difference in days between 1980 and 1970 */ 917 days += 3652; /* account for difference in days between 1980 and 1970 */
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 916df9431336..3746580e9701 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -121,7 +121,7 @@ static void AdjustForTZ(struct cifsTconInfo *tcon, struct inode *inode)
121 121
122 122
123static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, 123static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
124 char *buf, int *pobject_type, int isNewInode) 124 char *buf, unsigned int *pobject_type, int isNewInode)
125{ 125{
126 loff_t local_size; 126 loff_t local_size;
127 struct timespec local_mtime; 127 struct timespec local_mtime;
@@ -294,7 +294,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
294} 294}
295 295
296static void unix_fill_in_inode(struct inode *tmp_inode, 296static void unix_fill_in_inode(struct inode *tmp_inode,
297 FILE_UNIX_INFO *pfindData, int *pobject_type, int isNewInode) 297 FILE_UNIX_INFO *pfindData, unsigned int *pobject_type, int isNewInode)
298{ 298{
299 loff_t local_size; 299 loff_t local_size;
300 struct timespec local_mtime; 300 struct timespec local_mtime;
@@ -826,7 +826,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
826 int rc = 0; 826 int rc = 0;
827 struct qstr qstring; 827 struct qstr qstring;
828 struct cifsFileInfo *pCifsF; 828 struct cifsFileInfo *pCifsF;
829 unsigned obj_type; 829 unsigned int obj_type;
830 ino_t inum; 830 ino_t inum;
831 struct cifs_sb_info *cifs_sb; 831 struct cifs_sb_info *cifs_sb;
832 struct inode *tmp_inode; 832 struct inode *tmp_inode;
@@ -1067,7 +1067,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
1067 for (i = 0; (i < num_to_fill) && (rc == 0); i++) { 1067 for (i = 0; (i < num_to_fill) && (rc == 0); i++) {
1068 if (current_entry == NULL) { 1068 if (current_entry == NULL) {
1069 /* evaluate whether this case is an error */ 1069 /* evaluate whether this case is an error */
1070 cERROR(1,("past end of SMB num to fill %d i %d", 1070 cERROR(1, ("past SMB end, num to fill %d i %d",
1071 num_to_fill, i)); 1071 num_to_fill, i));
1072 break; 1072 break;
1073 } 1073 }
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 892be9b4d1f3..899dc6078d9a 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -67,14 +67,59 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
67 pSMB->req.hdr.Flags2 |= SMBFLG2_DFS; 67 pSMB->req.hdr.Flags2 |= SMBFLG2_DFS;
68 capabilities |= CAP_DFS; 68 capabilities |= CAP_DFS;
69 } 69 }
70 if (ses->capabilities & CAP_UNIX) { 70 if (ses->capabilities & CAP_UNIX)
71 capabilities |= CAP_UNIX; 71 capabilities |= CAP_UNIX;
72 }
73 72
74 /* BB check whether to init vcnum BB */ 73 /* BB check whether to init vcnum BB */
75 return capabilities; 74 return capabilities;
76} 75}
77 76
77static void
78unicode_oslm_strings(char **pbcc_area, const struct nls_table *nls_cp)
79{
80 char *bcc_ptr = *pbcc_area;
81 int bytes_ret = 0;
82
83 /* Copy OS version */
84 bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32,
85 nls_cp);
86 bcc_ptr += 2 * bytes_ret;
87 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release,
88 32, nls_cp);
89 bcc_ptr += 2 * bytes_ret;
90 bcc_ptr += 2; /* trailing null */
91
92 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
93 32, nls_cp);
94 bcc_ptr += 2 * bytes_ret;
95 bcc_ptr += 2; /* trailing null */
96
97 *pbcc_area = bcc_ptr;
98}
99
100static void unicode_domain_string(char **pbcc_area, struct cifsSesInfo *ses,
101 const struct nls_table *nls_cp)
102{
103 char *bcc_ptr = *pbcc_area;
104 int bytes_ret = 0;
105
106 /* copy domain */
107 if (ses->domainName == NULL) {
108 /* Sending null domain better than using a bogus domain name (as
109 we did briefly in 2.6.18) since server will use its default */
110 *bcc_ptr = 0;
111 *(bcc_ptr+1) = 0;
112 bytes_ret = 0;
113 } else
114 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName,
115 256, nls_cp);
116 bcc_ptr += 2 * bytes_ret;
117 bcc_ptr += 2; /* account for null terminator */
118
119 *pbcc_area = bcc_ptr;
120}
121
122
78static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, 123static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
79 const struct nls_table *nls_cp) 124 const struct nls_table *nls_cp)
80{ 125{
@@ -100,32 +145,9 @@ static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
100 } 145 }
101 bcc_ptr += 2 * bytes_ret; 146 bcc_ptr += 2 * bytes_ret;
102 bcc_ptr += 2; /* account for null termination */ 147 bcc_ptr += 2; /* account for null termination */
103 /* copy domain */
104 if (ses->domainName == NULL) {
105 /* Sending null domain better than using a bogus domain name (as
106 we did briefly in 2.6.18) since server will use its default */
107 *bcc_ptr = 0;
108 *(bcc_ptr+1) = 0;
109 bytes_ret = 0;
110 } else
111 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName,
112 256, nls_cp);
113 bcc_ptr += 2 * bytes_ret;
114 bcc_ptr += 2; /* account for null terminator */
115
116 /* Copy OS version */
117 bytes_ret = cifs_strtoUCS((__le16 *)bcc_ptr, "Linux version ", 32,
118 nls_cp);
119 bcc_ptr += 2 * bytes_ret;
120 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, init_utsname()->release,
121 32, nls_cp);
122 bcc_ptr += 2 * bytes_ret;
123 bcc_ptr += 2; /* trailing null */
124 148
125 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS, 149 unicode_domain_string(&bcc_ptr, ses, nls_cp);
126 32, nls_cp); 150 unicode_oslm_strings(&bcc_ptr, nls_cp);
127 bcc_ptr += 2 * bytes_ret;
128 bcc_ptr += 2; /* trailing null */
129 151
130 *pbcc_area = bcc_ptr; 152 *pbcc_area = bcc_ptr;
131} 153}
@@ -203,14 +225,11 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
203 if (len >= words_left) 225 if (len >= words_left)
204 return rc; 226 return rc;
205 227
206 if (ses->serverOS) 228 kfree(ses->serverOS);
207 kfree(ses->serverOS);
208 /* UTF-8 string will not grow more than four times as big as UCS-16 */ 229 /* UTF-8 string will not grow more than four times as big as UCS-16 */
209 ses->serverOS = kzalloc(4 * len, GFP_KERNEL); 230 ses->serverOS = kzalloc(4 * len, GFP_KERNEL);
210 if (ses->serverOS != NULL) { 231 if (ses->serverOS != NULL)
211 cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, 232 cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp);
212 nls_cp);
213 }
214 data += 2 * (len + 1); 233 data += 2 * (len + 1);
215 words_left -= len + 1; 234 words_left -= len + 1;
216 235
@@ -220,8 +239,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
220 if (len >= words_left) 239 if (len >= words_left)
221 return rc; 240 return rc;
222 241
223 if (ses->serverNOS) 242 kfree(ses->serverNOS);
224 kfree(ses->serverNOS);
225 ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */ 243 ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */
226 if (ses->serverNOS != NULL) { 244 if (ses->serverNOS != NULL) {
227 cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len, 245 cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len,
@@ -240,8 +258,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
240 if (len > words_left) 258 if (len > words_left)
241 return rc; 259 return rc;
242 260
243 if (ses->serverDomain) 261 kfree(ses->serverDomain);
244 kfree(ses->serverDomain);
245 ses->serverDomain = kzalloc(2 * (len + 1), GFP_KERNEL); /* BB FIXME wrong length */ 262 ses->serverDomain = kzalloc(2 * (len + 1), GFP_KERNEL); /* BB FIXME wrong length */
246 if (ses->serverDomain != NULL) { 263 if (ses->serverDomain != NULL) {
247 cifs_strfromUCS_le(ses->serverDomain, (__le16 *)data, len, 264 cifs_strfromUCS_le(ses->serverDomain, (__le16 *)data, len,
@@ -271,8 +288,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
271 if (len >= bleft) 288 if (len >= bleft)
272 return rc; 289 return rc;
273 290
274 if (ses->serverOS) 291 kfree(ses->serverOS);
275 kfree(ses->serverOS);
276 292
277 ses->serverOS = kzalloc(len + 1, GFP_KERNEL); 293 ses->serverOS = kzalloc(len + 1, GFP_KERNEL);
278 if (ses->serverOS) 294 if (ses->serverOS)
@@ -289,8 +305,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
289 if (len >= bleft) 305 if (len >= bleft)
290 return rc; 306 return rc;
291 307
292 if (ses->serverNOS) 308 kfree(ses->serverNOS);
293 kfree(ses->serverNOS);
294 309
295 ses->serverNOS = kzalloc(len + 1, GFP_KERNEL); 310 ses->serverNOS = kzalloc(len + 1, GFP_KERNEL);
296 if (ses->serverNOS) 311 if (ses->serverNOS)
@@ -479,7 +494,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
479 if (ses->capabilities & CAP_UNICODE) { 494 if (ses->capabilities & CAP_UNICODE) {
480 if (iov[0].iov_len % 2) { 495 if (iov[0].iov_len % 2) {
481 *bcc_ptr = 0; 496 *bcc_ptr = 0;
482 } bcc_ptr++; 497 bcc_ptr++;
498 }
483 unicode_ssetup_strings(&bcc_ptr, ses, nls_cp); 499 unicode_ssetup_strings(&bcc_ptr, ses, nls_cp);
484 } else 500 } else
485 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); 501 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
@@ -497,7 +513,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
497 513
498 iov[1].iov_base = str_area; 514 iov[1].iov_base = str_area;
499 iov[1].iov_len = count; 515 iov[1].iov_len = count;
500 rc = SendReceive2(xid, ses, iov, 2 /* num_iovecs */, &resp_buf_type, 0); 516 rc = SendReceive2(xid, ses, iov, 2 /* num_iovecs */, &resp_buf_type,
517 0 /* not long op */, 1 /* log NT STATUS if any */ );
501 /* SMB request buf freed in SendReceive2 */ 518 /* SMB request buf freed in SendReceive2 */
502 519
503 cFYI(1, ("ssetup rc from sendrecv2 is %d", rc)); 520 cFYI(1, ("ssetup rc from sendrecv2 is %d", rc));
diff --git a/fs/cifs/smberr.h b/fs/cifs/smberr.h
index 2ef0be288820..7f50e8577c1c 100644
--- a/fs/cifs/smberr.h
+++ b/fs/cifs/smberr.h
@@ -173,9 +173,10 @@
173#define ERRusestd 251 /* temporarily unable to use either raw 173#define ERRusestd 251 /* temporarily unable to use either raw
174 or mpx */ 174 or mpx */
175#define ERR_NOTIFY_ENUM_DIR 1024 175#define ERR_NOTIFY_ENUM_DIR 1024
176#define ERRnoSuchUser 2238 /* user account does not exist */
176#define ERRaccountexpired 2239 177#define ERRaccountexpired 2239
177#define ERRbadclient 2240 178#define ERRbadclient 2240 /* can not logon from this client */
178#define ERRbadLogonTime 2241 179#define ERRbadLogonTime 2241 /* logon hours do not allow this */
179#define ERRpasswordExpired 2242 180#define ERRpasswordExpired 2242
180#define ERRnetlogonNotStarted 2455 181#define ERRnetlogonNotStarted 2455
181#define ERRnosupport 0xFFFF 182#define ERRnosupport 0xFFFF
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 746bc9405db1..7ed32b3cb781 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -55,7 +55,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
55 if (temp == NULL) 55 if (temp == NULL)
56 return temp; 56 return temp;
57 else { 57 else {
58 memset(temp, 0, sizeof (struct mid_q_entry)); 58 memset(temp, 0, sizeof(struct mid_q_entry));
59 temp->mid = smb_buffer->Mid; /* always LE */ 59 temp->mid = smb_buffer->Mid; /* always LE */
60 temp->pid = current->pid; 60 temp->pid = current->pid;
61 temp->command = smb_buffer->Command; 61 temp->command = smb_buffer->Command;
@@ -158,7 +158,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
158 iov.iov_len = len; 158 iov.iov_len = len;
159 159
160 smb_msg.msg_name = sin; 160 smb_msg.msg_name = sin;
161 smb_msg.msg_namelen = sizeof (struct sockaddr); 161 smb_msg.msg_namelen = sizeof(struct sockaddr);
162 smb_msg.msg_control = NULL; 162 smb_msg.msg_control = NULL;
163 smb_msg.msg_controllen = 0; 163 smb_msg.msg_controllen = 0;
164 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ 164 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/
@@ -228,7 +228,7 @@ smb_send2(struct socket *ssocket, struct kvec *iov, int n_vec,
228 return -ENOTSOCK; /* BB eventually add reconnect code here */ 228 return -ENOTSOCK; /* BB eventually add reconnect code here */
229 229
230 smb_msg.msg_name = sin; 230 smb_msg.msg_name = sin;
231 smb_msg.msg_namelen = sizeof (struct sockaddr); 231 smb_msg.msg_namelen = sizeof(struct sockaddr);
232 smb_msg.msg_control = NULL; 232 smb_msg.msg_control = NULL;
233 smb_msg.msg_controllen = 0; 233 smb_msg.msg_controllen = 0;
234 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/ 234 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/
@@ -363,9 +363,8 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
363 } /* else ok - we are setting up session */ 363 } /* else ok - we are setting up session */
364 } 364 }
365 *ppmidQ = AllocMidQEntry(in_buf, ses); 365 *ppmidQ = AllocMidQEntry(in_buf, ses);
366 if (*ppmidQ == NULL) { 366 if (*ppmidQ == NULL)
367 return -ENOMEM; 367 return -ENOMEM;
368 }
369 return 0; 368 return 0;
370} 369}
371 370
@@ -419,7 +418,7 @@ static int wait_for_response(struct cifsSesInfo *ses,
419int 418int
420SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, 419SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
421 struct kvec *iov, int n_vec, int *pRespBufType /* ret */, 420 struct kvec *iov, int n_vec, int *pRespBufType /* ret */,
422 const int long_op) 421 const int long_op, const int logError)
423{ 422{
424 int rc = 0; 423 int rc = 0;
425 unsigned int receive_len; 424 unsigned int receive_len;
@@ -465,7 +464,6 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
465 wake_up(&ses->server->request_q); 464 wake_up(&ses->server->request_q);
466 return rc; 465 return rc;
467 } 466 }
468
469 rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); 467 rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number);
470 468
471 midQ->midState = MID_REQUEST_SUBMITTED; 469 midQ->midState = MID_REQUEST_SUBMITTED;
@@ -568,13 +566,11 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
568 } 566 }
569 567
570 /* BB special case reconnect tid and uid here? */ 568 /* BB special case reconnect tid and uid here? */
571 /* BB special case Errbadpassword and pwdexpired here */ 569 rc = map_smb_to_linux_error(midQ->resp_buf, logError);
572 rc = map_smb_to_linux_error(midQ->resp_buf);
573 570
574 /* convert ByteCount if necessary */ 571 /* convert ByteCount if necessary */
575 if (receive_len >= 572 if (receive_len >= sizeof(struct smb_hdr) - 4
576 sizeof (struct smb_hdr) - 573 /* do not count RFC1001 header */ +
577 4 /* do not count RFC1001 header */ +
578 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ ) 574 (2 * midQ->resp_buf->WordCount) + 2 /* bcc */ )
579 BCC(midQ->resp_buf) = 575 BCC(midQ->resp_buf) =
580 le16_to_cpu(BCC_LE(midQ->resp_buf)); 576 le16_to_cpu(BCC_LE(midQ->resp_buf));
@@ -749,12 +745,11 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
749 *pbytes_returned = out_buf->smb_buf_length; 745 *pbytes_returned = out_buf->smb_buf_length;
750 746
751 /* BB special case reconnect tid and uid here? */ 747 /* BB special case reconnect tid and uid here? */
752 rc = map_smb_to_linux_error(out_buf); 748 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ );
753 749
754 /* convert ByteCount if necessary */ 750 /* convert ByteCount if necessary */
755 if (receive_len >= 751 if (receive_len >= sizeof(struct smb_hdr) - 4
756 sizeof (struct smb_hdr) - 752 /* do not count RFC1001 header */ +
757 4 /* do not count RFC1001 header */ +
758 (2 * out_buf->WordCount) + 2 /* bcc */ ) 753 (2 * out_buf->WordCount) + 2 /* bcc */ )
759 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); 754 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf));
760 } else { 755 } else {
@@ -993,12 +988,11 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
993 *pbytes_returned = out_buf->smb_buf_length; 988 *pbytes_returned = out_buf->smb_buf_length;
994 989
995 /* BB special case reconnect tid and uid here? */ 990 /* BB special case reconnect tid and uid here? */
996 rc = map_smb_to_linux_error(out_buf); 991 rc = map_smb_to_linux_error(out_buf, 0 /* no log */ );
997 992
998 /* convert ByteCount if necessary */ 993 /* convert ByteCount if necessary */
999 if (receive_len >= 994 if (receive_len >= sizeof(struct smb_hdr) - 4
1000 sizeof (struct smb_hdr) - 995 /* do not count RFC1001 header */ +
1001 4 /* do not count RFC1001 header */ +
1002 (2 * out_buf->WordCount) + 2 /* bcc */ ) 996 (2 * out_buf->WordCount) + 2 /* bcc */ )
1003 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf)); 997 BCC(out_buf) = le16_to_cpu(BCC_LE(out_buf));
1004 } else { 998 } else {
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index f61e433d281c..369e838bebd3 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -261,21 +261,26 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
261 cifs_sb->local_nls, 261 cifs_sb->local_nls,
262 cifs_sb->mnt_cifs_flags & 262 cifs_sb->mnt_cifs_flags &
263 CIFS_MOUNT_MAP_SPECIAL_CHR); 263 CIFS_MOUNT_MAP_SPECIAL_CHR);
264/* else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { 264#ifdef CONFIG_CIFS_EXPERIMENTAL
265 else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
265 __u16 fid; 266 __u16 fid;
266 int oplock = FALSE; 267 int oplock = FALSE;
267 rc = CIFSSMBOpen(xid, pTcon, full_path, 268 if (experimEnabled)
268 FILE_OPEN, GENERIC_READ, 0, &fid, 269 rc = CIFSSMBOpen(xid, pTcon, full_path,
269 &oplock, NULL, cifs_sb->local_nls, 270 FILE_OPEN, GENERIC_READ, 0, &fid,
270 cifs_sb->mnt_cifs_flags & 271 &oplock, NULL, cifs_sb->local_nls,
271 CIFS_MOUNT_MAP_SPECIAL_CHR); 272 cifs_sb->mnt_cifs_flags &
273 CIFS_MOUNT_MAP_SPECIAL_CHR);
274 /* else rc is EOPNOTSUPP from above */
275
272 if(rc == 0) { 276 if(rc == 0) {
273 rc = CIFSSMBGetCIFSACL(xid, pTcon, fid, 277 rc = CIFSSMBGetCIFSACL(xid, pTcon, fid,
274 ea_value, buf_size, 278 ea_value, buf_size,
275 ACL_TYPE_ACCESS); 279 ACL_TYPE_ACCESS);
276 CIFSSMBClose(xid, pTcon, fid); 280 CIFSSMBClose(xid, pTcon, fid);
277 } 281 }
278 } */ /* BB enable after fixing up return data */ 282 }
283#endif /* EXPERIMENTAL */
279#else 284#else
280 cFYI(1, ("query POSIX ACL not supported yet")); 285 cFYI(1, ("query POSIX ACL not supported yet"));
281#endif /* CONFIG_CIFS_POSIX */ 286#endif /* CONFIG_CIFS_POSIX */
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
index cdb4c07a7870..359e531094dd 100644
--- a/fs/coda/upcall.c
+++ b/fs/coda/upcall.c
@@ -51,7 +51,7 @@ static void *alloc_upcall(int opcode, int size)
51 51
52 inp->ih.opcode = opcode; 52 inp->ih.opcode = opcode;
53 inp->ih.pid = current->pid; 53 inp->ih.pid = current->pid;
54 inp->ih.pgid = process_group(current); 54 inp->ih.pgid = task_pgrp_nr(current);
55#ifdef CONFIG_CODA_FS_OLD_API 55#ifdef CONFIG_CODA_FS_OLD_API
56 memset(&inp->ih.cred, 0, sizeof(struct coda_cred)); 56 memset(&inp->ih.cred, 0, sizeof(struct coda_cred));
57 inp->ih.cred.cr_fsuid = current->fsuid; 57 inp->ih.cred.cr_fsuid = current->fsuid;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 6dacd39bf048..a4284ccac1f9 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -3001,7 +3001,7 @@ static int __init init_sys32_ioctl(void)
3001 int i; 3001 int i;
3002 3002
3003 for (i = 0; i < ARRAY_SIZE(ioctl_start); i++) { 3003 for (i = 0; i < ARRAY_SIZE(ioctl_start); i++) {
3004 if (ioctl_start[i].next != 0) { 3004 if (ioctl_start[i].next) {
3005 printk("ioctl translation %d bad\n",i); 3005 printk("ioctl translation %d bad\n",i);
3006 return -1; 3006 return -1;
3007 } 3007 }
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 5c817bd08389..350680fd7da7 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -148,7 +148,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
148{ 148{
149 struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; 149 struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;
150 struct page *pages[BLKS_PER_BUF]; 150 struct page *pages[BLKS_PER_BUF];
151 unsigned i, blocknr, buffer, unread; 151 unsigned i, blocknr, buffer;
152 unsigned long devsize; 152 unsigned long devsize;
153 char *data; 153 char *data;
154 154
@@ -175,7 +175,6 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
175 devsize = mapping->host->i_size >> PAGE_CACHE_SHIFT; 175 devsize = mapping->host->i_size >> PAGE_CACHE_SHIFT;
176 176
177 /* Ok, read in BLKS_PER_BUF pages completely first. */ 177 /* Ok, read in BLKS_PER_BUF pages completely first. */
178 unread = 0;
179 for (i = 0; i < BLKS_PER_BUF; i++) { 178 for (i = 0; i < BLKS_PER_BUF; i++) {
180 struct page *page = NULL; 179 struct page *page = NULL;
181 180
@@ -362,7 +361,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
362 if (offset & 3) 361 if (offset & 3)
363 return -EINVAL; 362 return -EINVAL;
364 363
365 buf = kmalloc(256, GFP_KERNEL); 364 buf = kmalloc(CRAMFS_MAXPATHLEN, GFP_KERNEL);
366 if (!buf) 365 if (!buf)
367 return -ENOMEM; 366 return -ENOMEM;
368 367
@@ -376,7 +375,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
376 int namelen, error; 375 int namelen, error;
377 376
378 mutex_lock(&read_mutex); 377 mutex_lock(&read_mutex);
379 de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+256); 378 de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+CRAMFS_MAXPATHLEN);
380 name = (char *)(de+1); 379 name = (char *)(de+1);
381 380
382 /* 381 /*
@@ -426,7 +425,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s
426 char *name; 425 char *name;
427 int namelen, retval; 426 int namelen, retval;
428 427
429 de = cramfs_read(dir->i_sb, OFFSET(dir) + offset, sizeof(*de)+256); 428 de = cramfs_read(dir->i_sb, OFFSET(dir) + offset, sizeof(*de)+CRAMFS_MAXPATHLEN);
430 name = (char *)(de+1); 429 name = (char *)(de+1);
431 430
432 /* Try to take advantage of sorted directories */ 431 /* Try to take advantage of sorted directories */
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index 6438941ab1f8..4f741546f4bb 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -456,7 +456,7 @@ static int check_version(struct dlm_write_request *req)
456 printk(KERN_DEBUG "dlm: process %s (%d) version mismatch " 456 printk(KERN_DEBUG "dlm: process %s (%d) version mismatch "
457 "user (%d.%d.%d) kernel (%d.%d.%d)\n", 457 "user (%d.%d.%d) kernel (%d.%d.%d)\n",
458 current->comm, 458 current->comm,
459 current->pid, 459 task_pid_nr(current),
460 req->version[0], 460 req->version[0],
461 req->version[1], 461 req->version[1],
462 req->version[2], 462 req->version[2],
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 5701f816faf4..0b1ab016fa2e 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -914,6 +914,14 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
914 if (rc < 0) 914 if (rc < 0)
915 goto out; 915 goto out;
916 } 916 }
917
918 /*
919 * mode change is for clearing setuid/setgid bits. Allow lower fs
920 * to interpret this in its own way.
921 */
922 if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
923 ia->ia_valid &= ~ATTR_MODE;
924
917 rc = notify_change(lower_dentry, ia); 925 rc = notify_change(lower_dentry, ia);
918out: 926out:
919 fsstack_copy_attr_all(inode, lower_inode, NULL); 927 fsstack_copy_attr_all(inode, lower_inode, NULL);
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 77b9953624f4..34f68f3a069a 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -325,15 +325,14 @@ static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq)
325 int wake_nests = 0; 325 int wake_nests = 0;
326 unsigned long flags; 326 unsigned long flags;
327 struct task_struct *this_task = current; 327 struct task_struct *this_task = current;
328 struct list_head *lsthead = &psw->wake_task_list, *lnk; 328 struct list_head *lsthead = &psw->wake_task_list;
329 struct wake_task_node *tncur; 329 struct wake_task_node *tncur;
330 struct wake_task_node tnode; 330 struct wake_task_node tnode;
331 331
332 spin_lock_irqsave(&psw->lock, flags); 332 spin_lock_irqsave(&psw->lock, flags);
333 333
334 /* Try to see if the current task is already inside this wakeup call */ 334 /* Try to see if the current task is already inside this wakeup call */
335 list_for_each(lnk, lsthead) { 335 list_for_each_entry(tncur, lsthead, llink) {
336 tncur = list_entry(lnk, struct wake_task_node, llink);
337 336
338 if (tncur->wq == wq || 337 if (tncur->wq == wq ||
339 (tncur->task == this_task && ++wake_nests > EP_MAX_POLLWAKE_NESTS)) { 338 (tncur->task == this_task && ++wake_nests > EP_MAX_POLLWAKE_NESTS)) {
@@ -463,7 +462,7 @@ static void ep_free(struct eventpoll *ep)
463 * holding "epmutex" we can be sure that no file cleanup code will hit 462 * holding "epmutex" we can be sure that no file cleanup code will hit
464 * us during this operation. So we can avoid the lock on "ep->lock". 463 * us during this operation. So we can avoid the lock on "ep->lock".
465 */ 464 */
466 while ((rbp = rb_first(&ep->rbr)) != 0) { 465 while ((rbp = rb_first(&ep->rbr)) != NULL) {
467 epi = rb_entry(rbp, struct epitem, rbn); 466 epi = rb_entry(rbp, struct epitem, rbn);
468 ep_remove(ep, epi); 467 ep_remove(ep, epi);
469 } 468 }
diff --git a/fs/exec.c b/fs/exec.c
index 070ddf13cb71..2c942e2d14ea 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -234,7 +234,7 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
234 vma->vm_start = vma->vm_end - PAGE_SIZE; 234 vma->vm_start = vma->vm_end - PAGE_SIZE;
235 235
236 vma->vm_flags = VM_STACK_FLAGS; 236 vma->vm_flags = VM_STACK_FLAGS;
237 vma->vm_page_prot = protection_map[vma->vm_flags & 0x7]; 237 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
238 err = insert_vm_struct(mm, vma); 238 err = insert_vm_struct(mm, vma);
239 if (err) { 239 if (err) {
240 up_write(&mm->mmap_sem); 240 up_write(&mm->mmap_sem);
@@ -775,8 +775,8 @@ static int de_thread(struct task_struct *tsk)
775 * Reparenting needs write_lock on tasklist_lock, 775 * Reparenting needs write_lock on tasklist_lock,
776 * so it is safe to do it under read_lock. 776 * so it is safe to do it under read_lock.
777 */ 777 */
778 if (unlikely(tsk->group_leader == child_reaper(tsk))) 778 if (unlikely(tsk->group_leader == task_child_reaper(tsk)))
779 tsk->nsproxy->pid_ns->child_reaper = tsk; 779 task_active_pid_ns(tsk)->child_reaper = tsk;
780 780
781 zap_other_threads(tsk); 781 zap_other_threads(tsk);
782 read_unlock(&tasklist_lock); 782 read_unlock(&tasklist_lock);
@@ -841,8 +841,8 @@ static int de_thread(struct task_struct *tsk)
841 */ 841 */
842 tsk->start_time = leader->start_time; 842 tsk->start_time = leader->start_time;
843 843
844 BUG_ON(leader->tgid != tsk->tgid); 844 BUG_ON(!same_thread_group(leader, tsk));
845 BUG_ON(tsk->pid == tsk->tgid); 845 BUG_ON(has_group_leader_pid(tsk));
846 /* 846 /*
847 * An exec() starts a new thread group with the 847 * An exec() starts a new thread group with the
848 * TGID of the previous thread group. Rehash the 848 * TGID of the previous thread group. Rehash the
@@ -857,7 +857,7 @@ static int de_thread(struct task_struct *tsk)
857 */ 857 */
858 detach_pid(tsk, PIDTYPE_PID); 858 detach_pid(tsk, PIDTYPE_PID);
859 tsk->pid = leader->pid; 859 tsk->pid = leader->pid;
860 attach_pid(tsk, PIDTYPE_PID, find_pid(tsk->pid)); 860 attach_pid(tsk, PIDTYPE_PID, task_pid(leader));
861 transfer_pid(leader, tsk, PIDTYPE_PGID); 861 transfer_pid(leader, tsk, PIDTYPE_PGID);
862 transfer_pid(leader, tsk, PIDTYPE_SID); 862 transfer_pid(leader, tsk, PIDTYPE_SID);
863 list_replace_rcu(&leader->tasks, &tsk->tasks); 863 list_replace_rcu(&leader->tasks, &tsk->tasks);
@@ -1433,7 +1433,7 @@ static int format_corename(char *corename, const char *pattern, long signr)
1433 case 'p': 1433 case 'p':
1434 pid_in_pattern = 1; 1434 pid_in_pattern = 1;
1435 rc = snprintf(out_ptr, out_end - out_ptr, 1435 rc = snprintf(out_ptr, out_end - out_ptr,
1436 "%d", current->tgid); 1436 "%d", task_tgid_vnr(current));
1437 if (rc > out_end - out_ptr) 1437 if (rc > out_end - out_ptr)
1438 goto out; 1438 goto out;
1439 out_ptr += rc; 1439 out_ptr += rc;
@@ -1513,7 +1513,7 @@ static int format_corename(char *corename, const char *pattern, long signr)
1513 if (!ispipe && !pid_in_pattern 1513 if (!ispipe && !pid_in_pattern
1514 && (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) { 1514 && (core_uses_pid || atomic_read(&current->mm->mm_users) != 1)) {
1515 rc = snprintf(out_ptr, out_end - out_ptr, 1515 rc = snprintf(out_ptr, out_end - out_ptr,
1516 ".%d", current->tgid); 1516 ".%d", task_tgid_vnr(current));
1517 if (rc > out_end - out_ptr) 1517 if (rc > out_end - out_ptr)
1518 goto out; 1518 goto out;
1519 out_ptr += rc; 1519 out_ptr += rc;
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c
index dd1fd3c0fc05..a588e23841d4 100644
--- a/fs/ext3/fsync.c
+++ b/fs/ext3/fsync.c
@@ -47,7 +47,7 @@ int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync)
47 struct inode *inode = dentry->d_inode; 47 struct inode *inode = dentry->d_inode;
48 int ret = 0; 48 int ret = 0;
49 49
50 J_ASSERT(ext3_journal_current_handle() == 0); 50 J_ASSERT(ext3_journal_current_handle() == NULL);
51 51
52 /* 52 /*
53 * data=writeback: 53 * data=writeback:
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 2f2b6864db10..9b162cd6c16c 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1028,7 +1028,7 @@ struct buffer_head *ext3_getblk(handle_t *handle, struct inode *inode,
1028 } 1028 }
1029 if (buffer_new(&dummy)) { 1029 if (buffer_new(&dummy)) {
1030 J_ASSERT(create != 0); 1030 J_ASSERT(create != 0);
1031 J_ASSERT(handle != 0); 1031 J_ASSERT(handle != NULL);
1032 1032
1033 /* 1033 /*
1034 * Now that we do not always journal data, we should 1034 * Now that we do not always journal data, we should
@@ -2954,7 +2954,7 @@ int ext3_write_inode(struct inode *inode, int wait)
2954 return 0; 2954 return 0;
2955 2955
2956 if (ext3_journal_current_handle()) { 2956 if (ext3_journal_current_handle()) {
2957 jbd_debug(0, "called recursively, non-PF_MEMALLOC!\n"); 2957 jbd_debug(1, "called recursively, non-PF_MEMALLOC!\n");
2958 dump_stack(); 2958 dump_stack();
2959 return -EIO; 2959 return -EIO;
2960 } 2960 }
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 771f7ada15d9..44de1453c301 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -245,10 +245,10 @@ static int setup_new_group_blocks(struct super_block *sb,
245 brelse(gdb); 245 brelse(gdb);
246 goto exit_bh; 246 goto exit_bh;
247 } 247 }
248 lock_buffer(bh); 248 lock_buffer(gdb);
249 memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, bh->b_size); 249 memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, gdb->b_size);
250 set_buffer_uptodate(gdb); 250 set_buffer_uptodate(gdb);
251 unlock_buffer(bh); 251 unlock_buffer(gdb);
252 ext3_journal_dirty_metadata(handle, gdb); 252 ext3_journal_dirty_metadata(handle, gdb);
253 ext3_set_bit(bit, bh->b_data); 253 ext3_set_bit(bit, bh->b_data);
254 brelse(gdb); 254 brelse(gdb);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 141573de7a9a..81868c0bc40e 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1620,7 +1620,11 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1620 } 1620 }
1621 1621
1622 brelse (bh); 1622 brelse (bh);
1623 sb_set_blocksize(sb, blocksize); 1623 if (!sb_set_blocksize(sb, blocksize)) {
1624 printk(KERN_ERR "EXT3-fs: bad blocksize %d.\n",
1625 blocksize);
1626 goto out_fail;
1627 }
1624 logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize; 1628 logic_sb_block = (sb_block * EXT3_MIN_BLOCK_SIZE) / blocksize;
1625 offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize; 1629 offset = (sb_block * EXT3_MIN_BLOCK_SIZE) % blocksize;
1626 bh = sb_bread(sb, logic_sb_block); 1630 bh = sb_bread(sb, logic_sb_block);
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index f58cbb26323e..408373819e34 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -741,12 +741,11 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
741 } 741 }
742 } else { 742 } else {
743 /* Allocate a buffer where we construct the new block. */ 743 /* Allocate a buffer where we construct the new block. */
744 s->base = kmalloc(sb->s_blocksize, GFP_KERNEL); 744 s->base = kzalloc(sb->s_blocksize, GFP_KERNEL);
745 /* assert(header == s->base) */ 745 /* assert(header == s->base) */
746 error = -ENOMEM; 746 error = -ENOMEM;
747 if (s->base == NULL) 747 if (s->base == NULL)
748 goto cleanup; 748 goto cleanup;
749 memset(s->base, 0, sb->s_blocksize);
750 header(s->base)->h_magic = cpu_to_le32(EXT3_XATTR_MAGIC); 749 header(s->base)->h_magic = cpu_to_le32(EXT3_XATTR_MAGIC);
751 header(s->base)->h_blocks = cpu_to_le32(1); 750 header(s->base)->h_blocks = cpu_to_le32(1);
752 header(s->base)->h_refcount = cpu_to_le32(1); 751 header(s->base)->h_refcount = cpu_to_le32(1);
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index b74bf4368441..e906b65448e2 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -20,6 +20,7 @@
20#include <linux/quotaops.h> 20#include <linux/quotaops.h>
21#include <linux/buffer_head.h> 21#include <linux/buffer_head.h>
22 22
23#include "group.h"
23/* 24/*
24 * balloc.c contains the blocks allocation and deallocation routines 25 * balloc.c contains the blocks allocation and deallocation routines
25 */ 26 */
@@ -42,6 +43,94 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr,
42 43
43} 44}
44 45
46/* Initializes an uninitialized block bitmap if given, and returns the
47 * number of blocks free in the group. */
48unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
49 int block_group, struct ext4_group_desc *gdp)
50{
51 unsigned long start;
52 int bit, bit_max;
53 unsigned free_blocks, group_blocks;
54 struct ext4_sb_info *sbi = EXT4_SB(sb);
55
56 if (bh) {
57 J_ASSERT_BH(bh, buffer_locked(bh));
58
59 /* If checksum is bad mark all blocks used to prevent allocation
60 * essentially implementing a per-group read-only flag. */
61 if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
62 ext4_error(sb, __FUNCTION__,
63 "Checksum bad for group %u\n", block_group);
64 gdp->bg_free_blocks_count = 0;
65 gdp->bg_free_inodes_count = 0;
66 gdp->bg_itable_unused = 0;
67 memset(bh->b_data, 0xff, sb->s_blocksize);
68 return 0;
69 }
70 memset(bh->b_data, 0, sb->s_blocksize);
71 }
72
73 /* Check for superblock and gdt backups in this group */
74 bit_max = ext4_bg_has_super(sb, block_group);
75
76 if (!EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_META_BG) ||
77 block_group < le32_to_cpu(sbi->s_es->s_first_meta_bg) *
78 sbi->s_desc_per_block) {
79 if (bit_max) {
80 bit_max += ext4_bg_num_gdb(sb, block_group);
81 bit_max +=
82 le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks);
83 }
84 } else { /* For META_BG_BLOCK_GROUPS */
85 int group_rel = (block_group -
86 le32_to_cpu(sbi->s_es->s_first_meta_bg)) %
87 EXT4_DESC_PER_BLOCK(sb);
88 if (group_rel == 0 || group_rel == 1 ||
89 (group_rel == EXT4_DESC_PER_BLOCK(sb) - 1))
90 bit_max += 1;
91 }
92
93 if (block_group == sbi->s_groups_count - 1) {
94 /*
95 * Even though mke2fs always initialize first and last group
96 * if some other tool enabled the EXT4_BG_BLOCK_UNINIT we need
97 * to make sure we calculate the right free blocks
98 */
99 group_blocks = ext4_blocks_count(sbi->s_es) -
100 le32_to_cpu(sbi->s_es->s_first_data_block) -
101 (EXT4_BLOCKS_PER_GROUP(sb) * (sbi->s_groups_count -1));
102 } else {
103 group_blocks = EXT4_BLOCKS_PER_GROUP(sb);
104 }
105
106 free_blocks = group_blocks - bit_max;
107
108 if (bh) {
109 for (bit = 0; bit < bit_max; bit++)
110 ext4_set_bit(bit, bh->b_data);
111
112 start = block_group * EXT4_BLOCKS_PER_GROUP(sb) +
113 le32_to_cpu(sbi->s_es->s_first_data_block);
114
115 /* Set bits for block and inode bitmaps, and inode table */
116 ext4_set_bit(ext4_block_bitmap(sb, gdp) - start, bh->b_data);
117 ext4_set_bit(ext4_inode_bitmap(sb, gdp) - start, bh->b_data);
118 for (bit = (ext4_inode_table(sb, gdp) - start),
119 bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++)
120 ext4_set_bit(bit, bh->b_data);
121
122 /*
123 * Also if the number of blocks within the group is
124 * less than the blocksize * 8 ( which is the size
125 * of bitmap ), set rest of the block bitmap to 1
126 */
127 mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data);
128 }
129
130 return free_blocks - sbi->s_itb_per_group - 2;
131}
132
133
45/* 134/*
46 * The free blocks are managed by bitmaps. A file system contains several 135 * The free blocks are managed by bitmaps. A file system contains several
47 * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap 136 * blocks groups. Each group contains 1 bitmap block for blocks, 1 bitmap
@@ -119,7 +208,7 @@ block_in_use(ext4_fsblk_t block, struct super_block *sb, unsigned char *map)
119 * 208 *
120 * Return buffer_head on success or NULL in case of failure. 209 * Return buffer_head on success or NULL in case of failure.
121 */ 210 */
122static struct buffer_head * 211struct buffer_head *
123read_block_bitmap(struct super_block *sb, unsigned int block_group) 212read_block_bitmap(struct super_block *sb, unsigned int block_group)
124{ 213{
125 int i; 214 int i;
@@ -127,11 +216,24 @@ read_block_bitmap(struct super_block *sb, unsigned int block_group)
127 struct buffer_head * bh = NULL; 216 struct buffer_head * bh = NULL;
128 ext4_fsblk_t bitmap_blk; 217 ext4_fsblk_t bitmap_blk;
129 218
130 desc = ext4_get_group_desc (sb, block_group, NULL); 219 desc = ext4_get_group_desc(sb, block_group, NULL);
131 if (!desc) 220 if (!desc)
132 return NULL; 221 return NULL;
133 bitmap_blk = ext4_block_bitmap(sb, desc); 222 bitmap_blk = ext4_block_bitmap(sb, desc);
134 bh = sb_bread(sb, bitmap_blk); 223 if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
224 bh = sb_getblk(sb, bitmap_blk);
225 if (!buffer_uptodate(bh)) {
226 lock_buffer(bh);
227 if (!buffer_uptodate(bh)) {
228 ext4_init_block_bitmap(sb, bh, block_group,
229 desc);
230 set_buffer_uptodate(bh);
231 }
232 unlock_buffer(bh);
233 }
234 } else {
235 bh = sb_bread(sb, bitmap_blk);
236 }
135 if (!bh) 237 if (!bh)
136 ext4_error (sb, __FUNCTION__, 238 ext4_error (sb, __FUNCTION__,
137 "Cannot read block bitmap - " 239 "Cannot read block bitmap - "
@@ -627,6 +729,7 @@ do_more:
627 desc->bg_free_blocks_count = 729 desc->bg_free_blocks_count =
628 cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) + 730 cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
629 group_freed); 731 group_freed);
732 desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc);
630 spin_unlock(sb_bgl_lock(sbi, block_group)); 733 spin_unlock(sb_bgl_lock(sbi, block_group));
631 percpu_counter_add(&sbi->s_freeblocks_counter, count); 734 percpu_counter_add(&sbi->s_freeblocks_counter, count);
632 735
@@ -1685,8 +1788,11 @@ allocated:
1685 ret_block, goal_hits, goal_attempts); 1788 ret_block, goal_hits, goal_attempts);
1686 1789
1687 spin_lock(sb_bgl_lock(sbi, group_no)); 1790 spin_lock(sb_bgl_lock(sbi, group_no));
1791 if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))
1792 gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
1688 gdp->bg_free_blocks_count = 1793 gdp->bg_free_blocks_count =
1689 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num); 1794 cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count)-num);
1795 gdp->bg_checksum = ext4_group_desc_csum(sbi, group_no, gdp);
1690 spin_unlock(sb_bgl_lock(sbi, group_no)); 1796 spin_unlock(sb_bgl_lock(sbi, group_no));
1691 percpu_counter_sub(&sbi->s_freeblocks_counter, num); 1797 percpu_counter_sub(&sbi->s_freeblocks_counter, num);
1692 1798
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 0fb1e62b20d0..f612bef98315 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -47,9 +47,7 @@ const struct file_operations ext4_dir_operations = {
47 .compat_ioctl = ext4_compat_ioctl, 47 .compat_ioctl = ext4_compat_ioctl,
48#endif 48#endif
49 .fsync = ext4_sync_file, /* BKL held */ 49 .fsync = ext4_sync_file, /* BKL held */
50#ifdef CONFIG_EXT4_INDEX
51 .release = ext4_release_dir, 50 .release = ext4_release_dir,
52#endif
53}; 51};
54 52
55 53
@@ -107,7 +105,6 @@ static int ext4_readdir(struct file * filp,
107 105
108 sb = inode->i_sb; 106 sb = inode->i_sb;
109 107
110#ifdef CONFIG_EXT4_INDEX
111 if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb, 108 if (EXT4_HAS_COMPAT_FEATURE(inode->i_sb,
112 EXT4_FEATURE_COMPAT_DIR_INDEX) && 109 EXT4_FEATURE_COMPAT_DIR_INDEX) &&
113 ((EXT4_I(inode)->i_flags & EXT4_INDEX_FL) || 110 ((EXT4_I(inode)->i_flags & EXT4_INDEX_FL) ||
@@ -123,7 +120,6 @@ static int ext4_readdir(struct file * filp,
123 */ 120 */
124 EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL; 121 EXT4_I(filp->f_path.dentry->d_inode)->i_flags &= ~EXT4_INDEX_FL;
125 } 122 }
126#endif
127 stored = 0; 123 stored = 0;
128 offset = filp->f_pos & (sb->s_blocksize - 1); 124 offset = filp->f_pos & (sb->s_blocksize - 1);
129 125
@@ -232,7 +228,6 @@ out:
232 return ret; 228 return ret;
233} 229}
234 230
235#ifdef CONFIG_EXT4_INDEX
236/* 231/*
237 * These functions convert from the major/minor hash to an f_pos 232 * These functions convert from the major/minor hash to an f_pos
238 * value. 233 * value.
@@ -518,5 +513,3 @@ static int ext4_release_dir (struct inode * inode, struct file * filp)
518 513
519 return 0; 514 return 0;
520} 515}
521
522#endif
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 78beb096f57d..85287742f2ae 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -33,7 +33,7 @@
33#include <linux/fs.h> 33#include <linux/fs.h>
34#include <linux/time.h> 34#include <linux/time.h>
35#include <linux/ext4_jbd2.h> 35#include <linux/ext4_jbd2.h>
36#include <linux/jbd.h> 36#include <linux/jbd2.h>
37#include <linux/highuid.h> 37#include <linux/highuid.h>
38#include <linux/pagemap.h> 38#include <linux/pagemap.h>
39#include <linux/quotaops.h> 39#include <linux/quotaops.h>
@@ -52,7 +52,7 @@ static ext4_fsblk_t ext_pblock(struct ext4_extent *ex)
52{ 52{
53 ext4_fsblk_t block; 53 ext4_fsblk_t block;
54 54
55 block = le32_to_cpu(ex->ee_start); 55 block = le32_to_cpu(ex->ee_start_lo);
56 block |= ((ext4_fsblk_t) le16_to_cpu(ex->ee_start_hi) << 31) << 1; 56 block |= ((ext4_fsblk_t) le16_to_cpu(ex->ee_start_hi) << 31) << 1;
57 return block; 57 return block;
58} 58}
@@ -65,7 +65,7 @@ static ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix)
65{ 65{
66 ext4_fsblk_t block; 66 ext4_fsblk_t block;
67 67
68 block = le32_to_cpu(ix->ei_leaf); 68 block = le32_to_cpu(ix->ei_leaf_lo);
69 block |= ((ext4_fsblk_t) le16_to_cpu(ix->ei_leaf_hi) << 31) << 1; 69 block |= ((ext4_fsblk_t) le16_to_cpu(ix->ei_leaf_hi) << 31) << 1;
70 return block; 70 return block;
71} 71}
@@ -77,7 +77,7 @@ static ext4_fsblk_t idx_pblock(struct ext4_extent_idx *ix)
77 */ 77 */
78static void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb) 78static void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
79{ 79{
80 ex->ee_start = cpu_to_le32((unsigned long) (pb & 0xffffffff)); 80 ex->ee_start_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
81 ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff); 81 ex->ee_start_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
82} 82}
83 83
@@ -88,7 +88,7 @@ static void ext4_ext_store_pblock(struct ext4_extent *ex, ext4_fsblk_t pb)
88 */ 88 */
89static void ext4_idx_store_pblock(struct ext4_extent_idx *ix, ext4_fsblk_t pb) 89static void ext4_idx_store_pblock(struct ext4_extent_idx *ix, ext4_fsblk_t pb)
90{ 90{
91 ix->ei_leaf = cpu_to_le32((unsigned long) (pb & 0xffffffff)); 91 ix->ei_leaf_lo = cpu_to_le32((unsigned long) (pb & 0xffffffff));
92 ix->ei_leaf_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff); 92 ix->ei_leaf_hi = cpu_to_le16((unsigned long) ((pb >> 31) >> 1) & 0xffff);
93} 93}
94 94
@@ -1409,8 +1409,7 @@ has_space:
1409 eh->eh_entries = cpu_to_le16(le16_to_cpu(eh->eh_entries)+1); 1409 eh->eh_entries = cpu_to_le16(le16_to_cpu(eh->eh_entries)+1);
1410 nearex = path[depth].p_ext; 1410 nearex = path[depth].p_ext;
1411 nearex->ee_block = newext->ee_block; 1411 nearex->ee_block = newext->ee_block;
1412 nearex->ee_start = newext->ee_start; 1412 ext4_ext_store_pblock(nearex, ext_pblock(newext));
1413 nearex->ee_start_hi = newext->ee_start_hi;
1414 nearex->ee_len = newext->ee_len; 1413 nearex->ee_len = newext->ee_len;
1415 1414
1416merge: 1415merge:
@@ -2177,7 +2176,6 @@ int ext4_ext_convert_to_initialized(handle_t *handle, struct inode *inode,
2177 } 2176 }
2178 /* ex2: iblock to iblock + maxblocks-1 : initialised */ 2177 /* ex2: iblock to iblock + maxblocks-1 : initialised */
2179 ex2->ee_block = cpu_to_le32(iblock); 2178 ex2->ee_block = cpu_to_le32(iblock);
2180 ex2->ee_start = cpu_to_le32(newblock);
2181 ext4_ext_store_pblock(ex2, newblock); 2179 ext4_ext_store_pblock(ex2, newblock);
2182 ex2->ee_len = cpu_to_le16(allocated); 2180 ex2->ee_len = cpu_to_le16(allocated);
2183 if (ex2 != ex) 2181 if (ex2 != ex)
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 2a167d7131fa..8d50879d1c2c 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -47,7 +47,7 @@ int ext4_sync_file(struct file * file, struct dentry *dentry, int datasync)
47 struct inode *inode = dentry->d_inode; 47 struct inode *inode = dentry->d_inode;
48 int ret = 0; 48 int ret = 0;
49 49
50 J_ASSERT(ext4_journal_current_handle() == 0); 50 J_ASSERT(ext4_journal_current_handle() == NULL);
51 51
52 /* 52 /*
53 * data=writeback: 53 * data=writeback:
diff --git a/fs/ext4/group.h b/fs/ext4/group.h
new file mode 100644
index 000000000000..1577910bb58b
--- /dev/null
+++ b/fs/ext4/group.h
@@ -0,0 +1,27 @@
1/*
2 * linux/fs/ext4/group.h
3 *
4 * Copyright (C) 2007 Cluster File Systems, Inc
5 *
6 * Author: Andreas Dilger <adilger@clusterfs.com>
7 */
8
9#ifndef _LINUX_EXT4_GROUP_H
10#define _LINUX_EXT4_GROUP_H
11
12extern __le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 group,
13 struct ext4_group_desc *gdp);
14extern int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 group,
15 struct ext4_group_desc *gdp);
16struct buffer_head *read_block_bitmap(struct super_block *sb,
17 unsigned int block_group);
18extern unsigned ext4_init_block_bitmap(struct super_block *sb,
19 struct buffer_head *bh, int group,
20 struct ext4_group_desc *desc);
21#define ext4_free_blocks_after_init(sb, group, desc) \
22 ext4_init_block_bitmap(sb, NULL, group, desc)
23extern unsigned ext4_init_inode_bitmap(struct super_block *sb,
24 struct buffer_head *bh, int group,
25 struct ext4_group_desc *desc);
26extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap);
27#endif /* _LINUX_EXT4_GROUP_H */
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index d0c7793d9393..c61f37fd3f05 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -28,6 +28,7 @@
28 28
29#include "xattr.h" 29#include "xattr.h"
30#include "acl.h" 30#include "acl.h"
31#include "group.h"
31 32
32/* 33/*
33 * ialloc.c contains the inodes allocation and deallocation routines 34 * ialloc.c contains the inodes allocation and deallocation routines
@@ -43,6 +44,52 @@
43 * the free blocks count in the block. 44 * the free blocks count in the block.
44 */ 45 */
45 46
47/*
48 * To avoid calling the atomic setbit hundreds or thousands of times, we only
49 * need to use it within a single byte (to ensure we get endianness right).
50 * We can use memset for the rest of the bitmap as there are no other users.
51 */
52void mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
53{
54 int i;
55
56 if (start_bit >= end_bit)
57 return;
58
59 ext4_debug("mark end bits +%d through +%d used\n", start_bit, end_bit);
60 for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
61 ext4_set_bit(i, bitmap);
62 if (i < end_bit)
63 memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
64}
65
66/* Initializes an uninitialized inode bitmap */
67unsigned ext4_init_inode_bitmap(struct super_block *sb,
68 struct buffer_head *bh, int block_group,
69 struct ext4_group_desc *gdp)
70{
71 struct ext4_sb_info *sbi = EXT4_SB(sb);
72
73 J_ASSERT_BH(bh, buffer_locked(bh));
74
75 /* If checksum is bad mark all blocks and inodes use to prevent
76 * allocation, essentially implementing a per-group read-only flag. */
77 if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
78 ext4_error(sb, __FUNCTION__, "Checksum bad for group %u\n",
79 block_group);
80 gdp->bg_free_blocks_count = 0;
81 gdp->bg_free_inodes_count = 0;
82 gdp->bg_itable_unused = 0;
83 memset(bh->b_data, 0xff, sb->s_blocksize);
84 return 0;
85 }
86
87 memset(bh->b_data, 0, (EXT4_INODES_PER_GROUP(sb) + 7) / 8);
88 mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), EXT4_BLOCKS_PER_GROUP(sb),
89 bh->b_data);
90
91 return EXT4_INODES_PER_GROUP(sb);
92}
46 93
47/* 94/*
48 * Read the inode allocation bitmap for a given block_group, reading 95 * Read the inode allocation bitmap for a given block_group, reading
@@ -59,8 +106,20 @@ read_inode_bitmap(struct super_block * sb, unsigned long block_group)
59 desc = ext4_get_group_desc(sb, block_group, NULL); 106 desc = ext4_get_group_desc(sb, block_group, NULL);
60 if (!desc) 107 if (!desc)
61 goto error_out; 108 goto error_out;
62 109 if (desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
63 bh = sb_bread(sb, ext4_inode_bitmap(sb, desc)); 110 bh = sb_getblk(sb, ext4_inode_bitmap(sb, desc));
111 if (!buffer_uptodate(bh)) {
112 lock_buffer(bh);
113 if (!buffer_uptodate(bh)) {
114 ext4_init_inode_bitmap(sb, bh, block_group,
115 desc);
116 set_buffer_uptodate(bh);
117 }
118 unlock_buffer(bh);
119 }
120 } else {
121 bh = sb_bread(sb, ext4_inode_bitmap(sb, desc));
122 }
64 if (!bh) 123 if (!bh)
65 ext4_error(sb, "read_inode_bitmap", 124 ext4_error(sb, "read_inode_bitmap",
66 "Cannot read inode bitmap - " 125 "Cannot read inode bitmap - "
@@ -169,6 +228,8 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
169 if (is_directory) 228 if (is_directory)
170 gdp->bg_used_dirs_count = cpu_to_le16( 229 gdp->bg_used_dirs_count = cpu_to_le16(
171 le16_to_cpu(gdp->bg_used_dirs_count) - 1); 230 le16_to_cpu(gdp->bg_used_dirs_count) - 1);
231 gdp->bg_checksum = ext4_group_desc_csum(sbi,
232 block_group, gdp);
172 spin_unlock(sb_bgl_lock(sbi, block_group)); 233 spin_unlock(sb_bgl_lock(sbi, block_group));
173 percpu_counter_inc(&sbi->s_freeinodes_counter); 234 percpu_counter_inc(&sbi->s_freeinodes_counter);
174 if (is_directory) 235 if (is_directory)
@@ -435,7 +496,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
435 struct ext4_sb_info *sbi; 496 struct ext4_sb_info *sbi;
436 int err = 0; 497 int err = 0;
437 struct inode *ret; 498 struct inode *ret;
438 int i; 499 int i, free = 0;
439 500
440 /* Cannot create files in a deleted directory */ 501 /* Cannot create files in a deleted directory */
441 if (!dir || !dir->i_nlink) 502 if (!dir || !dir->i_nlink)
@@ -517,11 +578,13 @@ repeat_in_this_group:
517 goto out; 578 goto out;
518 579
519got: 580got:
520 ino += group * EXT4_INODES_PER_GROUP(sb) + 1; 581 ino++;
521 if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { 582 if ((group == 0 && ino < EXT4_FIRST_INO(sb)) ||
522 ext4_error (sb, "ext4_new_inode", 583 ino > EXT4_INODES_PER_GROUP(sb)) {
523 "reserved inode or inode > inodes count - " 584 ext4_error(sb, __FUNCTION__,
524 "block_group = %d, inode=%lu", group, ino); 585 "reserved inode or inode > inodes count - "
586 "block_group = %d, inode=%lu", group,
587 ino + group * EXT4_INODES_PER_GROUP(sb));
525 err = -EIO; 588 err = -EIO;
526 goto fail; 589 goto fail;
527 } 590 }
@@ -529,13 +592,78 @@ got:
529 BUFFER_TRACE(bh2, "get_write_access"); 592 BUFFER_TRACE(bh2, "get_write_access");
530 err = ext4_journal_get_write_access(handle, bh2); 593 err = ext4_journal_get_write_access(handle, bh2);
531 if (err) goto fail; 594 if (err) goto fail;
595
596 /* We may have to initialize the block bitmap if it isn't already */
597 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM) &&
598 gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
599 struct buffer_head *block_bh = read_block_bitmap(sb, group);
600
601 BUFFER_TRACE(block_bh, "get block bitmap access");
602 err = ext4_journal_get_write_access(handle, block_bh);
603 if (err) {
604 brelse(block_bh);
605 goto fail;
606 }
607
608 free = 0;
609 spin_lock(sb_bgl_lock(sbi, group));
610 /* recheck and clear flag under lock if we still need to */
611 if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
612 gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
613 free = ext4_free_blocks_after_init(sb, group, gdp);
614 gdp->bg_free_blocks_count = cpu_to_le16(free);
615 }
616 spin_unlock(sb_bgl_lock(sbi, group));
617
618 /* Don't need to dirty bitmap block if we didn't change it */
619 if (free) {
620 BUFFER_TRACE(block_bh, "dirty block bitmap");
621 err = ext4_journal_dirty_metadata(handle, block_bh);
622 }
623
624 brelse(block_bh);
625 if (err)
626 goto fail;
627 }
628
532 spin_lock(sb_bgl_lock(sbi, group)); 629 spin_lock(sb_bgl_lock(sbi, group));
630 /* If we didn't allocate from within the initialized part of the inode
631 * table then we need to initialize up to this inode. */
632 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
633 if (gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
634 gdp->bg_flags &= cpu_to_le16(~EXT4_BG_INODE_UNINIT);
635
636 /* When marking the block group with
637 * ~EXT4_BG_INODE_UNINIT we don't want to depend
638 * on the value of bg_itable_unsed even though
639 * mke2fs could have initialized the same for us.
640 * Instead we calculated the value below
641 */
642
643 free = 0;
644 } else {
645 free = EXT4_INODES_PER_GROUP(sb) -
646 le16_to_cpu(gdp->bg_itable_unused);
647 }
648
649 /*
650 * Check the relative inode number against the last used
651 * relative inode number in this group. if it is greater
652 * we need to update the bg_itable_unused count
653 *
654 */
655 if (ino > free)
656 gdp->bg_itable_unused =
657 cpu_to_le16(EXT4_INODES_PER_GROUP(sb) - ino);
658 }
659
533 gdp->bg_free_inodes_count = 660 gdp->bg_free_inodes_count =
534 cpu_to_le16(le16_to_cpu(gdp->bg_free_inodes_count) - 1); 661 cpu_to_le16(le16_to_cpu(gdp->bg_free_inodes_count) - 1);
535 if (S_ISDIR(mode)) { 662 if (S_ISDIR(mode)) {
536 gdp->bg_used_dirs_count = 663 gdp->bg_used_dirs_count =
537 cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1); 664 cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1);
538 } 665 }
666 gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp);
539 spin_unlock(sb_bgl_lock(sbi, group)); 667 spin_unlock(sb_bgl_lock(sbi, group));
540 BUFFER_TRACE(bh2, "call ext4_journal_dirty_metadata"); 668 BUFFER_TRACE(bh2, "call ext4_journal_dirty_metadata");
541 err = ext4_journal_dirty_metadata(handle, bh2); 669 err = ext4_journal_dirty_metadata(handle, bh2);
@@ -557,7 +685,7 @@ got:
557 inode->i_gid = current->fsgid; 685 inode->i_gid = current->fsgid;
558 inode->i_mode = mode; 686 inode->i_mode = mode;
559 687
560 inode->i_ino = ino; 688 inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb);
561 /* This is the optimal IO size (for stat), not the fs block size */ 689 /* This is the optimal IO size (for stat), not the fs block size */
562 inode->i_blocks = 0; 690 inode->i_blocks = 0;
563 inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime = 691 inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
@@ -573,11 +701,6 @@ got:
573 /* dirsync only applies to directories */ 701 /* dirsync only applies to directories */
574 if (!S_ISDIR(mode)) 702 if (!S_ISDIR(mode))
575 ei->i_flags &= ~EXT4_DIRSYNC_FL; 703 ei->i_flags &= ~EXT4_DIRSYNC_FL;
576#ifdef EXT4_FRAGMENTS
577 ei->i_faddr = 0;
578 ei->i_frag_no = 0;
579 ei->i_frag_size = 0;
580#endif
581 ei->i_file_acl = 0; 704 ei->i_file_acl = 0;
582 ei->i_dir_acl = 0; 705 ei->i_dir_acl = 0;
583 ei->i_dtime = 0; 706 ei->i_dtime = 0;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0df2b1e06d0b..5489703d9573 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1027,7 +1027,7 @@ struct buffer_head *ext4_getblk(handle_t *handle, struct inode *inode,
1027 } 1027 }
1028 if (buffer_new(&dummy)) { 1028 if (buffer_new(&dummy)) {
1029 J_ASSERT(create != 0); 1029 J_ASSERT(create != 0);
1030 J_ASSERT(handle != 0); 1030 J_ASSERT(handle != NULL);
1031 1031
1032 /* 1032 /*
1033 * Now that we do not always journal data, we should 1033 * Now that we do not always journal data, we should
@@ -2711,11 +2711,6 @@ void ext4_read_inode(struct inode * inode)
2711 } 2711 }
2712 inode->i_blocks = le32_to_cpu(raw_inode->i_blocks); 2712 inode->i_blocks = le32_to_cpu(raw_inode->i_blocks);
2713 ei->i_flags = le32_to_cpu(raw_inode->i_flags); 2713 ei->i_flags = le32_to_cpu(raw_inode->i_flags);
2714#ifdef EXT4_FRAGMENTS
2715 ei->i_faddr = le32_to_cpu(raw_inode->i_faddr);
2716 ei->i_frag_no = raw_inode->i_frag;
2717 ei->i_frag_size = raw_inode->i_fsize;
2718#endif
2719 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl); 2714 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl);
2720 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != 2715 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
2721 cpu_to_le32(EXT4_OS_HURD)) 2716 cpu_to_le32(EXT4_OS_HURD))
@@ -2860,11 +2855,6 @@ static int ext4_do_update_inode(handle_t *handle,
2860 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks); 2855 raw_inode->i_blocks = cpu_to_le32(inode->i_blocks);
2861 raw_inode->i_dtime = cpu_to_le32(ei->i_dtime); 2856 raw_inode->i_dtime = cpu_to_le32(ei->i_dtime);
2862 raw_inode->i_flags = cpu_to_le32(ei->i_flags); 2857 raw_inode->i_flags = cpu_to_le32(ei->i_flags);
2863#ifdef EXT4_FRAGMENTS
2864 raw_inode->i_faddr = cpu_to_le32(ei->i_faddr);
2865 raw_inode->i_frag = ei->i_frag_no;
2866 raw_inode->i_fsize = ei->i_frag_size;
2867#endif
2868 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != 2858 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
2869 cpu_to_le32(EXT4_OS_HURD)) 2859 cpu_to_le32(EXT4_OS_HURD))
2870 raw_inode->i_file_acl_high = 2860 raw_inode->i_file_acl_high =
@@ -3243,12 +3233,14 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode)
3243 iloc, handle); 3233 iloc, handle);
3244 if (ret) { 3234 if (ret) {
3245 EXT4_I(inode)->i_state |= EXT4_STATE_NO_EXPAND; 3235 EXT4_I(inode)->i_state |= EXT4_STATE_NO_EXPAND;
3246 if (mnt_count != sbi->s_es->s_mnt_count) { 3236 if (mnt_count !=
3237 le16_to_cpu(sbi->s_es->s_mnt_count)) {
3247 ext4_warning(inode->i_sb, __FUNCTION__, 3238 ext4_warning(inode->i_sb, __FUNCTION__,
3248 "Unable to expand inode %lu. Delete" 3239 "Unable to expand inode %lu. Delete"
3249 " some EAs or run e2fsck.", 3240 " some EAs or run e2fsck.",
3250 inode->i_ino); 3241 inode->i_ino);
3251 mnt_count = sbi->s_es->s_mnt_count; 3242 mnt_count =
3243 le16_to_cpu(sbi->s_es->s_mnt_count);
3252 } 3244 }
3253 } 3245 }
3254 } 3246 }
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 5fdb862e71c4..94ee6f315dc1 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -144,7 +144,6 @@ struct dx_map_entry
144 u16 size; 144 u16 size;
145}; 145};
146 146
147#ifdef CONFIG_EXT4_INDEX
148static inline unsigned dx_get_block (struct dx_entry *entry); 147static inline unsigned dx_get_block (struct dx_entry *entry);
149static void dx_set_block (struct dx_entry *entry, unsigned value); 148static void dx_set_block (struct dx_entry *entry, unsigned value);
150static inline unsigned dx_get_hash (struct dx_entry *entry); 149static inline unsigned dx_get_hash (struct dx_entry *entry);
@@ -766,8 +765,6 @@ static void dx_insert_block(struct dx_frame *frame, u32 hash, u32 block)
766 dx_set_block(new, block); 765 dx_set_block(new, block);
767 dx_set_count(entries, count + 1); 766 dx_set_count(entries, count + 1);
768} 767}
769#endif
770
771 768
772static void ext4_update_dx_flag(struct inode *inode) 769static void ext4_update_dx_flag(struct inode *inode)
773{ 770{
@@ -869,7 +866,6 @@ static struct buffer_head * ext4_find_entry (struct dentry *dentry,
869 name = dentry->d_name.name; 866 name = dentry->d_name.name;
870 if (namelen > EXT4_NAME_LEN) 867 if (namelen > EXT4_NAME_LEN)
871 return NULL; 868 return NULL;
872#ifdef CONFIG_EXT4_INDEX
873 if (is_dx(dir)) { 869 if (is_dx(dir)) {
874 bh = ext4_dx_find_entry(dentry, res_dir, &err); 870 bh = ext4_dx_find_entry(dentry, res_dir, &err);
875 /* 871 /*
@@ -881,7 +877,6 @@ static struct buffer_head * ext4_find_entry (struct dentry *dentry,
881 return bh; 877 return bh;
882 dxtrace(printk("ext4_find_entry: dx failed, falling back\n")); 878 dxtrace(printk("ext4_find_entry: dx failed, falling back\n"));
883 } 879 }
884#endif
885 nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb); 880 nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb);
886 start = EXT4_I(dir)->i_dir_start_lookup; 881 start = EXT4_I(dir)->i_dir_start_lookup;
887 if (start >= nblocks) 882 if (start >= nblocks)
@@ -957,7 +952,6 @@ cleanup_and_exit:
957 return ret; 952 return ret;
958} 953}
959 954
960#ifdef CONFIG_EXT4_INDEX
961static struct buffer_head * ext4_dx_find_entry(struct dentry *dentry, 955static struct buffer_head * ext4_dx_find_entry(struct dentry *dentry,
962 struct ext4_dir_entry_2 **res_dir, int *err) 956 struct ext4_dir_entry_2 **res_dir, int *err)
963{ 957{
@@ -1025,7 +1019,6 @@ errout:
1025 dx_release (frames); 1019 dx_release (frames);
1026 return NULL; 1020 return NULL;
1027} 1021}
1028#endif
1029 1022
1030static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) 1023static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd)
1031{ 1024{
@@ -1121,7 +1114,6 @@ static inline void ext4_set_de_type(struct super_block *sb,
1121 de->file_type = ext4_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; 1114 de->file_type = ext4_type_by_mode[(mode & S_IFMT)>>S_SHIFT];
1122} 1115}
1123 1116
1124#ifdef CONFIG_EXT4_INDEX
1125/* 1117/*
1126 * Move count entries from end of map between two memory locations. 1118 * Move count entries from end of map between two memory locations.
1127 * Returns pointer to last entry moved. 1119 * Returns pointer to last entry moved.
@@ -1266,8 +1258,6 @@ errout:
1266 *error = err; 1258 *error = err;
1267 return NULL; 1259 return NULL;
1268} 1260}
1269#endif
1270
1271 1261
1272/* 1262/*
1273 * Add a new entry into a directory (leaf) block. If de is non-NULL, 1263 * Add a new entry into a directory (leaf) block. If de is non-NULL,
@@ -1364,7 +1354,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1364 return 0; 1354 return 0;
1365} 1355}
1366 1356
1367#ifdef CONFIG_EXT4_INDEX
1368/* 1357/*
1369 * This converts a one block unindexed directory to a 3 block indexed 1358 * This converts a one block unindexed directory to a 3 block indexed
1370 * directory, and adds the dentry to the indexed directory. 1359 * directory, and adds the dentry to the indexed directory.
@@ -1443,7 +1432,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1443 1432
1444 return add_dirent_to_buf(handle, dentry, inode, de, bh); 1433 return add_dirent_to_buf(handle, dentry, inode, de, bh);
1445} 1434}
1446#endif
1447 1435
1448/* 1436/*
1449 * ext4_add_entry() 1437 * ext4_add_entry()
@@ -1464,9 +1452,7 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1464 struct ext4_dir_entry_2 *de; 1452 struct ext4_dir_entry_2 *de;
1465 struct super_block * sb; 1453 struct super_block * sb;
1466 int retval; 1454 int retval;
1467#ifdef CONFIG_EXT4_INDEX
1468 int dx_fallback=0; 1455 int dx_fallback=0;
1469#endif
1470 unsigned blocksize; 1456 unsigned blocksize;
1471 u32 block, blocks; 1457 u32 block, blocks;
1472 1458
@@ -1474,7 +1460,6 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1474 blocksize = sb->s_blocksize; 1460 blocksize = sb->s_blocksize;
1475 if (!dentry->d_name.len) 1461 if (!dentry->d_name.len)
1476 return -EINVAL; 1462 return -EINVAL;
1477#ifdef CONFIG_EXT4_INDEX
1478 if (is_dx(dir)) { 1463 if (is_dx(dir)) {
1479 retval = ext4_dx_add_entry(handle, dentry, inode); 1464 retval = ext4_dx_add_entry(handle, dentry, inode);
1480 if (!retval || (retval != ERR_BAD_DX_DIR)) 1465 if (!retval || (retval != ERR_BAD_DX_DIR))
@@ -1483,7 +1468,6 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1483 dx_fallback++; 1468 dx_fallback++;
1484 ext4_mark_inode_dirty(handle, dir); 1469 ext4_mark_inode_dirty(handle, dir);
1485 } 1470 }
1486#endif
1487 blocks = dir->i_size >> sb->s_blocksize_bits; 1471 blocks = dir->i_size >> sb->s_blocksize_bits;
1488 for (block = 0, offset = 0; block < blocks; block++) { 1472 for (block = 0, offset = 0; block < blocks; block++) {
1489 bh = ext4_bread(handle, dir, block, 0, &retval); 1473 bh = ext4_bread(handle, dir, block, 0, &retval);
@@ -1493,11 +1477,9 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1493 if (retval != -ENOSPC) 1477 if (retval != -ENOSPC)
1494 return retval; 1478 return retval;
1495 1479
1496#ifdef CONFIG_EXT4_INDEX
1497 if (blocks == 1 && !dx_fallback && 1480 if (blocks == 1 && !dx_fallback &&
1498 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) 1481 EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX))
1499 return make_indexed_dir(handle, dentry, inode, bh); 1482 return make_indexed_dir(handle, dentry, inode, bh);
1500#endif
1501 brelse(bh); 1483 brelse(bh);
1502 } 1484 }
1503 bh = ext4_append(handle, dir, &block, &retval); 1485 bh = ext4_append(handle, dir, &block, &retval);
@@ -1509,7 +1491,6 @@ static int ext4_add_entry (handle_t *handle, struct dentry *dentry,
1509 return add_dirent_to_buf(handle, dentry, inode, de, bh); 1491 return add_dirent_to_buf(handle, dentry, inode, de, bh);
1510} 1492}
1511 1493
1512#ifdef CONFIG_EXT4_INDEX
1513/* 1494/*
1514 * Returns 0 for success, or a negative error value 1495 * Returns 0 for success, or a negative error value
1515 */ 1496 */
@@ -1644,7 +1625,6 @@ cleanup:
1644 dx_release(frames); 1625 dx_release(frames);
1645 return err; 1626 return err;
1646} 1627}
1647#endif
1648 1628
1649/* 1629/*
1650 * ext4_delete_entry deletes a directory entry by merging it with the 1630 * ext4_delete_entry deletes a directory entry by merging it with the
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 472fc0d3e1c0..bd8a52bb3999 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -16,6 +16,7 @@
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18 18
19#include "group.h"
19 20
20#define outside(b, first, last) ((b) < (first) || (b) >= (last)) 21#define outside(b, first, last) ((b) < (first) || (b) >= (last))
21#define inside(b, first, last) ((b) >= (first) && (b) < (last)) 22#define inside(b, first, last) ((b) >= (first) && (b) < (last))
@@ -140,22 +141,29 @@ static struct buffer_head *bclean(handle_t *handle, struct super_block *sb,
140} 141}
141 142
142/* 143/*
143 * To avoid calling the atomic setbit hundreds or thousands of times, we only 144 * If we have fewer than thresh credits, extend by EXT4_MAX_TRANS_DATA.
144 * need to use it within a single byte (to ensure we get endianness right). 145 * If that fails, restart the transaction & regain write access for the
145 * We can use memset for the rest of the bitmap as there are no other users. 146 * buffer head which is used for block_bitmap modifications.
146 */ 147 */
147static void mark_bitmap_end(int start_bit, int end_bit, char *bitmap) 148static int extend_or_restart_transaction(handle_t *handle, int thresh,
149 struct buffer_head *bh)
148{ 150{
149 int i; 151 int err;
152
153 if (handle->h_buffer_credits >= thresh)
154 return 0;
150 155
151 if (start_bit >= end_bit) 156 err = ext4_journal_extend(handle, EXT4_MAX_TRANS_DATA);
152 return; 157 if (err < 0)
158 return err;
159 if (err) {
160 if ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA)))
161 return err;
162 if ((err = ext4_journal_get_write_access(handle, bh)))
163 return err;
164 }
153 165
154 ext4_debug("mark end bits +%d through +%d used\n", start_bit, end_bit); 166 return 0;
155 for (i = start_bit; i < ((start_bit + 7) & ~7UL); i++)
156 ext4_set_bit(i, bitmap);
157 if (i < end_bit)
158 memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
159} 167}
160 168
161/* 169/*
@@ -180,8 +188,9 @@ static int setup_new_group_blocks(struct super_block *sb,
180 int i; 188 int i;
181 int err = 0, err2; 189 int err = 0, err2;
182 190
183 handle = ext4_journal_start_sb(sb, reserved_gdb + gdblocks + 191 /* This transaction may be extended/restarted along the way */
184 2 + sbi->s_itb_per_group); 192 handle = ext4_journal_start_sb(sb, EXT4_MAX_TRANS_DATA);
193
185 if (IS_ERR(handle)) 194 if (IS_ERR(handle))
186 return PTR_ERR(handle); 195 return PTR_ERR(handle);
187 196
@@ -208,6 +217,9 @@ static int setup_new_group_blocks(struct super_block *sb,
208 217
209 ext4_debug("update backup group %#04lx (+%d)\n", block, bit); 218 ext4_debug("update backup group %#04lx (+%d)\n", block, bit);
210 219
220 if ((err = extend_or_restart_transaction(handle, 1, bh)))
221 goto exit_bh;
222
211 gdb = sb_getblk(sb, block); 223 gdb = sb_getblk(sb, block);
212 if (!gdb) { 224 if (!gdb) {
213 err = -EIO; 225 err = -EIO;
@@ -217,10 +229,10 @@ static int setup_new_group_blocks(struct super_block *sb,
217 brelse(gdb); 229 brelse(gdb);
218 goto exit_bh; 230 goto exit_bh;
219 } 231 }
220 lock_buffer(bh); 232 lock_buffer(gdb);
221 memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, bh->b_size); 233 memcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, gdb->b_size);
222 set_buffer_uptodate(gdb); 234 set_buffer_uptodate(gdb);
223 unlock_buffer(bh); 235 unlock_buffer(gdb);
224 ext4_journal_dirty_metadata(handle, gdb); 236 ext4_journal_dirty_metadata(handle, gdb);
225 ext4_set_bit(bit, bh->b_data); 237 ext4_set_bit(bit, bh->b_data);
226 brelse(gdb); 238 brelse(gdb);
@@ -233,6 +245,9 @@ static int setup_new_group_blocks(struct super_block *sb,
233 245
234 ext4_debug("clear reserved block %#04lx (+%d)\n", block, bit); 246 ext4_debug("clear reserved block %#04lx (+%d)\n", block, bit);
235 247
248 if ((err = extend_or_restart_transaction(handle, 1, bh)))
249 goto exit_bh;
250
236 if (IS_ERR(gdb = bclean(handle, sb, block))) { 251 if (IS_ERR(gdb = bclean(handle, sb, block))) {
237 err = PTR_ERR(bh); 252 err = PTR_ERR(bh);
238 goto exit_bh; 253 goto exit_bh;
@@ -254,6 +269,10 @@ static int setup_new_group_blocks(struct super_block *sb,
254 struct buffer_head *it; 269 struct buffer_head *it;
255 270
256 ext4_debug("clear inode block %#04lx (+%d)\n", block, bit); 271 ext4_debug("clear inode block %#04lx (+%d)\n", block, bit);
272
273 if ((err = extend_or_restart_transaction(handle, 1, bh)))
274 goto exit_bh;
275
257 if (IS_ERR(it = bclean(handle, sb, block))) { 276 if (IS_ERR(it = bclean(handle, sb, block))) {
258 err = PTR_ERR(it); 277 err = PTR_ERR(it);
259 goto exit_bh; 278 goto exit_bh;
@@ -262,6 +281,10 @@ static int setup_new_group_blocks(struct super_block *sb,
262 brelse(it); 281 brelse(it);
263 ext4_set_bit(bit, bh->b_data); 282 ext4_set_bit(bit, bh->b_data);
264 } 283 }
284
285 if ((err = extend_or_restart_transaction(handle, 2, bh)))
286 goto exit_bh;
287
265 mark_bitmap_end(input->blocks_count, EXT4_BLOCKS_PER_GROUP(sb), 288 mark_bitmap_end(input->blocks_count, EXT4_BLOCKS_PER_GROUP(sb),
266 bh->b_data); 289 bh->b_data);
267 ext4_journal_dirty_metadata(handle, bh); 290 ext4_journal_dirty_metadata(handle, bh);
@@ -289,7 +312,6 @@ exit_journal:
289 return err; 312 return err;
290} 313}
291 314
292
293/* 315/*
294 * Iterate through the groups which hold BACKUP superblock/GDT copies in an 316 * Iterate through the groups which hold BACKUP superblock/GDT copies in an
295 * ext4 filesystem. The counters should be initialized to 1, 5, and 7 before 317 * ext4 filesystem. The counters should be initialized to 1, 5, and 7 before
@@ -842,6 +864,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
842 ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */ 864 ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */
843 gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count); 865 gdp->bg_free_blocks_count = cpu_to_le16(input->free_blocks_count);
844 gdp->bg_free_inodes_count = cpu_to_le16(EXT4_INODES_PER_GROUP(sb)); 866 gdp->bg_free_inodes_count = cpu_to_le16(EXT4_INODES_PER_GROUP(sb));
867 gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp);
845 868
846 /* 869 /*
847 * Make the new blocks and inodes valid next. We do this before 870 * Make the new blocks and inodes valid next. We do this before
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 4c8d31c61454..b11e9e2bcd01 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -37,12 +37,14 @@
37#include <linux/quotaops.h> 37#include <linux/quotaops.h>
38#include <linux/seq_file.h> 38#include <linux/seq_file.h>
39#include <linux/log2.h> 39#include <linux/log2.h>
40#include <linux/crc16.h>
40 41
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42 43
43#include "xattr.h" 44#include "xattr.h"
44#include "acl.h" 45#include "acl.h"
45#include "namei.h" 46#include "namei.h"
47#include "group.h"
46 48
47static int ext4_load_journal(struct super_block *, struct ext4_super_block *, 49static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
48 unsigned long journal_devnum); 50 unsigned long journal_devnum);
@@ -68,31 +70,31 @@ static void ext4_write_super_lockfs(struct super_block *sb);
68ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, 70ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
69 struct ext4_group_desc *bg) 71 struct ext4_group_desc *bg)
70{ 72{
71 return le32_to_cpu(bg->bg_block_bitmap) | 73 return le32_to_cpu(bg->bg_block_bitmap_lo) |
72 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? 74 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
73 (ext4_fsblk_t)le32_to_cpu(bg->bg_block_bitmap_hi) << 32 : 0); 75 (ext4_fsblk_t)le32_to_cpu(bg->bg_block_bitmap_hi) << 32 : 0);
74} 76}
75 77
76ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, 78ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
77 struct ext4_group_desc *bg) 79 struct ext4_group_desc *bg)
78{ 80{
79 return le32_to_cpu(bg->bg_inode_bitmap) | 81 return le32_to_cpu(bg->bg_inode_bitmap_lo) |
80 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? 82 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
81 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0); 83 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_bitmap_hi) << 32 : 0);
82} 84}
83 85
84ext4_fsblk_t ext4_inode_table(struct super_block *sb, 86ext4_fsblk_t ext4_inode_table(struct super_block *sb,
85 struct ext4_group_desc *bg) 87 struct ext4_group_desc *bg)
86{ 88{
87 return le32_to_cpu(bg->bg_inode_table) | 89 return le32_to_cpu(bg->bg_inode_table_lo) |
88 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? 90 (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ?
89 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0); 91 (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0);
90} 92}
91 93
92void ext4_block_bitmap_set(struct super_block *sb, 94void ext4_block_bitmap_set(struct super_block *sb,
93 struct ext4_group_desc *bg, ext4_fsblk_t blk) 95 struct ext4_group_desc *bg, ext4_fsblk_t blk)
94{ 96{
95 bg->bg_block_bitmap = cpu_to_le32((u32)blk); 97 bg->bg_block_bitmap_lo = cpu_to_le32((u32)blk);
96 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) 98 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT)
97 bg->bg_block_bitmap_hi = cpu_to_le32(blk >> 32); 99 bg->bg_block_bitmap_hi = cpu_to_le32(blk >> 32);
98} 100}
@@ -100,7 +102,7 @@ void ext4_block_bitmap_set(struct super_block *sb,
100void ext4_inode_bitmap_set(struct super_block *sb, 102void ext4_inode_bitmap_set(struct super_block *sb,
101 struct ext4_group_desc *bg, ext4_fsblk_t blk) 103 struct ext4_group_desc *bg, ext4_fsblk_t blk)
102{ 104{
103 bg->bg_inode_bitmap = cpu_to_le32((u32)blk); 105 bg->bg_inode_bitmap_lo = cpu_to_le32((u32)blk);
104 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) 106 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT)
105 bg->bg_inode_bitmap_hi = cpu_to_le32(blk >> 32); 107 bg->bg_inode_bitmap_hi = cpu_to_le32(blk >> 32);
106} 108}
@@ -108,7 +110,7 @@ void ext4_inode_bitmap_set(struct super_block *sb,
108void ext4_inode_table_set(struct super_block *sb, 110void ext4_inode_table_set(struct super_block *sb,
109 struct ext4_group_desc *bg, ext4_fsblk_t blk) 111 struct ext4_group_desc *bg, ext4_fsblk_t blk)
110{ 112{
111 bg->bg_inode_table = cpu_to_le32((u32)blk); 113 bg->bg_inode_table_lo = cpu_to_le32((u32)blk);
112 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) 114 if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT)
113 bg->bg_inode_table_hi = cpu_to_le32(blk >> 32); 115 bg->bg_inode_table_hi = cpu_to_le32(blk >> 32);
114} 116}
@@ -1037,7 +1039,7 @@ static int parse_options (char *options, struct super_block *sb,
1037 if (option < 0) 1039 if (option < 0)
1038 return 0; 1040 return 0;
1039 if (option == 0) 1041 if (option == 0)
1040 option = JBD_DEFAULT_MAX_COMMIT_AGE; 1042 option = JBD2_DEFAULT_MAX_COMMIT_AGE;
1041 sbi->s_commit_interval = HZ * option; 1043 sbi->s_commit_interval = HZ * option;
1042 break; 1044 break;
1043 case Opt_data_journal: 1045 case Opt_data_journal:
@@ -1308,6 +1310,43 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
1308 return res; 1310 return res;
1309} 1311}
1310 1312
1313__le16 ext4_group_desc_csum(struct ext4_sb_info *sbi, __u32 block_group,
1314 struct ext4_group_desc *gdp)
1315{
1316 __u16 crc = 0;
1317
1318 if (sbi->s_es->s_feature_ro_compat &
1319 cpu_to_le32(EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) {
1320 int offset = offsetof(struct ext4_group_desc, bg_checksum);
1321 __le32 le_group = cpu_to_le32(block_group);
1322
1323 crc = crc16(~0, sbi->s_es->s_uuid, sizeof(sbi->s_es->s_uuid));
1324 crc = crc16(crc, (__u8 *)&le_group, sizeof(le_group));
1325 crc = crc16(crc, (__u8 *)gdp, offset);
1326 offset += sizeof(gdp->bg_checksum); /* skip checksum */
1327 /* for checksum of struct ext4_group_desc do the rest...*/
1328 if ((sbi->s_es->s_feature_incompat &
1329 cpu_to_le32(EXT4_FEATURE_INCOMPAT_64BIT)) &&
1330 offset < le16_to_cpu(sbi->s_es->s_desc_size))
1331 crc = crc16(crc, (__u8 *)gdp + offset,
1332 le16_to_cpu(sbi->s_es->s_desc_size) -
1333 offset);
1334 }
1335
1336 return cpu_to_le16(crc);
1337}
1338
1339int ext4_group_desc_csum_verify(struct ext4_sb_info *sbi, __u32 block_group,
1340 struct ext4_group_desc *gdp)
1341{
1342 if ((sbi->s_es->s_feature_ro_compat &
1343 cpu_to_le32(EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) &&
1344 (gdp->bg_checksum != ext4_group_desc_csum(sbi, block_group, gdp)))
1345 return 0;
1346
1347 return 1;
1348}
1349
1311/* Called at mount-time, super-block is locked */ 1350/* Called at mount-time, super-block is locked */
1312static int ext4_check_descriptors (struct super_block * sb) 1351static int ext4_check_descriptors (struct super_block * sb)
1313{ 1352{
@@ -1319,13 +1358,17 @@ static int ext4_check_descriptors (struct super_block * sb)
1319 ext4_fsblk_t inode_table; 1358 ext4_fsblk_t inode_table;
1320 struct ext4_group_desc * gdp = NULL; 1359 struct ext4_group_desc * gdp = NULL;
1321 int desc_block = 0; 1360 int desc_block = 0;
1361 int flexbg_flag = 0;
1322 int i; 1362 int i;
1323 1363
1364 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG))
1365 flexbg_flag = 1;
1366
1324 ext4_debug ("Checking group descriptors"); 1367 ext4_debug ("Checking group descriptors");
1325 1368
1326 for (i = 0; i < sbi->s_groups_count; i++) 1369 for (i = 0; i < sbi->s_groups_count; i++)
1327 { 1370 {
1328 if (i == sbi->s_groups_count - 1) 1371 if (i == sbi->s_groups_count - 1 || flexbg_flag)
1329 last_block = ext4_blocks_count(sbi->s_es) - 1; 1372 last_block = ext4_blocks_count(sbi->s_es) - 1;
1330 else 1373 else
1331 last_block = first_block + 1374 last_block = first_block +
@@ -1362,7 +1405,16 @@ static int ext4_check_descriptors (struct super_block * sb)
1362 i, inode_table); 1405 i, inode_table);
1363 return 0; 1406 return 0;
1364 } 1407 }
1365 first_block += EXT4_BLOCKS_PER_GROUP(sb); 1408 if (!ext4_group_desc_csum_verify(sbi, i, gdp)) {
1409 ext4_error(sb, __FUNCTION__,
1410 "Checksum for group %d failed (%u!=%u)\n", i,
1411 le16_to_cpu(ext4_group_desc_csum(sbi, i,
1412 gdp)),
1413 le16_to_cpu(gdp->bg_checksum));
1414 return 0;
1415 }
1416 if (!flexbg_flag)
1417 first_block += EXT4_BLOCKS_PER_GROUP(sb);
1366 gdp = (struct ext4_group_desc *) 1418 gdp = (struct ext4_group_desc *)
1367 ((__u8 *)gdp + EXT4_DESC_SIZE(sb)); 1419 ((__u8 *)gdp + EXT4_DESC_SIZE(sb));
1368 } 1420 }
@@ -1726,14 +1778,6 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1726 if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) 1778 if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)
1727 sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2); 1779 sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2);
1728 } 1780 }
1729 sbi->s_frag_size = EXT4_MIN_FRAG_SIZE <<
1730 le32_to_cpu(es->s_log_frag_size);
1731 if (blocksize != sbi->s_frag_size) {
1732 printk(KERN_ERR
1733 "EXT4-fs: fragsize %lu != blocksize %u (unsupported)\n",
1734 sbi->s_frag_size, blocksize);
1735 goto failed_mount;
1736 }
1737 sbi->s_desc_size = le16_to_cpu(es->s_desc_size); 1781 sbi->s_desc_size = le16_to_cpu(es->s_desc_size);
1738 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { 1782 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
1739 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || 1783 if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
@@ -1747,7 +1791,6 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1747 } else 1791 } else
1748 sbi->s_desc_size = EXT4_MIN_DESC_SIZE; 1792 sbi->s_desc_size = EXT4_MIN_DESC_SIZE;
1749 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); 1793 sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
1750 sbi->s_frags_per_group = le32_to_cpu(es->s_frags_per_group);
1751 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); 1794 sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
1752 if (EXT4_INODE_SIZE(sb) == 0) 1795 if (EXT4_INODE_SIZE(sb) == 0)
1753 goto cantfind_ext4; 1796 goto cantfind_ext4;
@@ -1771,12 +1814,6 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1771 sbi->s_blocks_per_group); 1814 sbi->s_blocks_per_group);
1772 goto failed_mount; 1815 goto failed_mount;
1773 } 1816 }
1774 if (sbi->s_frags_per_group > blocksize * 8) {
1775 printk (KERN_ERR
1776 "EXT4-fs: #fragments per group too big: %lu\n",
1777 sbi->s_frags_per_group);
1778 goto failed_mount;
1779 }
1780 if (sbi->s_inodes_per_group > blocksize * 8) { 1817 if (sbi->s_inodes_per_group > blocksize * 8) {
1781 printk (KERN_ERR 1818 printk (KERN_ERR
1782 "EXT4-fs: #inodes per group too big: %lu\n", 1819 "EXT4-fs: #inodes per group too big: %lu\n",
@@ -2630,7 +2667,7 @@ static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf)
2630 2667
2631 if (test_opt(sb, MINIX_DF)) { 2668 if (test_opt(sb, MINIX_DF)) {
2632 sbi->s_overhead_last = 0; 2669 sbi->s_overhead_last = 0;
2633 } else if (sbi->s_blocks_last != le32_to_cpu(es->s_blocks_count)) { 2670 } else if (sbi->s_blocks_last != ext4_blocks_count(es)) {
2634 unsigned long ngroups = sbi->s_groups_count, i; 2671 unsigned long ngroups = sbi->s_groups_count, i;
2635 ext4_fsblk_t overhead = 0; 2672 ext4_fsblk_t overhead = 0;
2636 smp_rmb(); 2673 smp_rmb();
@@ -2665,14 +2702,14 @@ static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf)
2665 overhead += ngroups * (2 + sbi->s_itb_per_group); 2702 overhead += ngroups * (2 + sbi->s_itb_per_group);
2666 sbi->s_overhead_last = overhead; 2703 sbi->s_overhead_last = overhead;
2667 smp_wmb(); 2704 smp_wmb();
2668 sbi->s_blocks_last = le32_to_cpu(es->s_blocks_count); 2705 sbi->s_blocks_last = ext4_blocks_count(es);
2669 } 2706 }
2670 2707
2671 buf->f_type = EXT4_SUPER_MAGIC; 2708 buf->f_type = EXT4_SUPER_MAGIC;
2672 buf->f_bsize = sb->s_blocksize; 2709 buf->f_bsize = sb->s_blocksize;
2673 buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last; 2710 buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last;
2674 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); 2711 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter);
2675 es->s_free_blocks_count = cpu_to_le32(buf->f_bfree); 2712 ext4_free_blocks_count_set(es, buf->f_bfree);
2676 buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es); 2713 buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es);
2677 if (buf->f_bfree < ext4_r_blocks_count(es)) 2714 if (buf->f_bfree < ext4_r_blocks_count(es))
2678 buf->f_bavail = 0; 2715 buf->f_bavail = 0;
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index b10d68fffb55..86387302c2a9 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -750,12 +750,11 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
750 } 750 }
751 } else { 751 } else {
752 /* Allocate a buffer where we construct the new block. */ 752 /* Allocate a buffer where we construct the new block. */
753 s->base = kmalloc(sb->s_blocksize, GFP_KERNEL); 753 s->base = kzalloc(sb->s_blocksize, GFP_KERNEL);
754 /* assert(header == s->base) */ 754 /* assert(header == s->base) */
755 error = -ENOMEM; 755 error = -ENOMEM;
756 if (s->base == NULL) 756 if (s->base == NULL)
757 goto cleanup; 757 goto cleanup;
758 memset(s->base, 0, sb->s_blocksize);
759 header(s->base)->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC); 758 header(s->base)->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
760 header(s->base)->h_blocks = cpu_to_le32(1); 759 header(s->base)->h_blocks = cpu_to_le32(1);
761 header(s->base)->h_refcount = cpu_to_le32(1); 760 header(s->base)->h_refcount = cpu_to_le32(1);
@@ -1121,7 +1120,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
1121 int total_ino, total_blk; 1120 int total_ino, total_blk;
1122 void *base, *start, *end; 1121 void *base, *start, *end;
1123 int extra_isize = 0, error = 0, tried_min_extra_isize = 0; 1122 int extra_isize = 0, error = 0, tried_min_extra_isize = 0;
1124 int s_min_extra_isize = EXT4_SB(inode->i_sb)->s_es->s_min_extra_isize; 1123 int s_min_extra_isize = le16_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_min_extra_isize);
1125 1124
1126 down_write(&EXT4_I(inode)->xattr_sem); 1125 down_write(&EXT4_I(inode)->xattr_sem);
1127retry: 1126retry:
@@ -1293,7 +1292,7 @@ retry:
1293 1292
1294 i.name = b_entry_name; 1293 i.name = b_entry_name;
1295 i.value = buffer; 1294 i.value = buffer;
1296 i.value_len = cpu_to_le32(size); 1295 i.value_len = size;
1297 error = ext4_xattr_block_find(inode, &i, bs); 1296 error = ext4_xattr_block_find(inode, &i, bs);
1298 if (error) 1297 if (error)
1299 goto cleanup; 1298 goto cleanup;
diff --git a/fs/fcntl.c b/fs/fcntl.c
index c9db73fc5e3d..8685263ccc4a 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -18,6 +18,7 @@
18#include <linux/ptrace.h> 18#include <linux/ptrace.h>
19#include <linux/signal.h> 19#include <linux/signal.h>
20#include <linux/rcupdate.h> 20#include <linux/rcupdate.h>
21#include <linux/pid_namespace.h>
21 22
22#include <asm/poll.h> 23#include <asm/poll.h>
23#include <asm/siginfo.h> 24#include <asm/siginfo.h>
@@ -292,7 +293,7 @@ int f_setown(struct file *filp, unsigned long arg, int force)
292 who = -who; 293 who = -who;
293 } 294 }
294 rcu_read_lock(); 295 rcu_read_lock();
295 pid = find_pid(who); 296 pid = find_vpid(who);
296 result = __f_setown(filp, pid, type, force); 297 result = __f_setown(filp, pid, type, force);
297 rcu_read_unlock(); 298 rcu_read_unlock();
298 return result; 299 return result;
@@ -308,7 +309,7 @@ pid_t f_getown(struct file *filp)
308{ 309{
309 pid_t pid; 310 pid_t pid;
310 read_lock(&filp->f_owner.lock); 311 read_lock(&filp->f_owner.lock);
311 pid = pid_nr(filp->f_owner.pid); 312 pid = pid_nr_ns(filp->f_owner.pid, current->nsproxy->pid_ns);
312 if (filp->f_owner.pid_type == PIDTYPE_PGID) 313 if (filp->f_owner.pid_type == PIDTYPE_PGID)
313 pid = -pid; 314 pid = -pid;
314 read_unlock(&filp->f_owner.lock); 315 read_unlock(&filp->f_owner.lock);
diff --git a/fs/file_table.c b/fs/file_table.c
index 3176fefc92e1..664e3f2309b8 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -323,12 +323,11 @@ void file_kill(struct file *file)
323 323
324int fs_may_remount_ro(struct super_block *sb) 324int fs_may_remount_ro(struct super_block *sb)
325{ 325{
326 struct list_head *p; 326 struct file *file;
327 327
328 /* Check that no files are currently opened for writing. */ 328 /* Check that no files are currently opened for writing. */
329 file_list_lock(); 329 file_list_lock();
330 list_for_each(p, &sb->s_files) { 330 list_for_each_entry(file, &sb->s_files, f_u.fu_list) {
331 struct file *file = list_entry(p, struct file, f_u.fu_list);
332 struct inode *inode = file->f_path.dentry->d_inode; 331 struct inode *inode = file->f_path.dentry->d_inode;
333 332
334 /* File with pending delete? */ 333 /* File with pending delete? */
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 686734ff973d..0fca82021d76 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -89,7 +89,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
89 if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev")) 89 if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev"))
90 printk(KERN_DEBUG 90 printk(KERN_DEBUG
91 "%s(%d): dirtied inode %lu (%s) on %s\n", 91 "%s(%d): dirtied inode %lu (%s) on %s\n",
92 current->comm, current->pid, inode->i_ino, 92 current->comm, task_pid_nr(current), inode->i_ino,
93 name, inode->i_sb->s_id); 93 name, inode->i_sb->s_id);
94 } 94 }
95 95
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index d1acab931330..3763757f9fe7 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -63,13 +63,21 @@ static u64 time_to_jiffies(unsigned long sec, unsigned long nsec)
63 * Set dentry and possibly attribute timeouts from the lookup/mk* 63 * Set dentry and possibly attribute timeouts from the lookup/mk*
64 * replies 64 * replies
65 */ 65 */
66static void fuse_change_timeout(struct dentry *entry, struct fuse_entry_out *o) 66static void fuse_change_entry_timeout(struct dentry *entry,
67 struct fuse_entry_out *o)
67{ 68{
68 fuse_dentry_settime(entry, 69 fuse_dentry_settime(entry,
69 time_to_jiffies(o->entry_valid, o->entry_valid_nsec)); 70 time_to_jiffies(o->entry_valid, o->entry_valid_nsec));
70 if (entry->d_inode) 71}
71 get_fuse_inode(entry->d_inode)->i_time = 72
72 time_to_jiffies(o->attr_valid, o->attr_valid_nsec); 73static u64 attr_timeout(struct fuse_attr_out *o)
74{
75 return time_to_jiffies(o->attr_valid, o->attr_valid_nsec);
76}
77
78static u64 entry_attr_timeout(struct fuse_entry_out *o)
79{
80 return time_to_jiffies(o->attr_valid, o->attr_valid_nsec);
73} 81}
74 82
75/* 83/*
@@ -108,13 +116,19 @@ static void fuse_lookup_init(struct fuse_req *req, struct inode *dir,
108 struct dentry *entry, 116 struct dentry *entry,
109 struct fuse_entry_out *outarg) 117 struct fuse_entry_out *outarg)
110{ 118{
119 struct fuse_conn *fc = get_fuse_conn(dir);
120
121 memset(outarg, 0, sizeof(struct fuse_entry_out));
111 req->in.h.opcode = FUSE_LOOKUP; 122 req->in.h.opcode = FUSE_LOOKUP;
112 req->in.h.nodeid = get_node_id(dir); 123 req->in.h.nodeid = get_node_id(dir);
113 req->in.numargs = 1; 124 req->in.numargs = 1;
114 req->in.args[0].size = entry->d_name.len + 1; 125 req->in.args[0].size = entry->d_name.len + 1;
115 req->in.args[0].value = entry->d_name.name; 126 req->in.args[0].value = entry->d_name.name;
116 req->out.numargs = 1; 127 req->out.numargs = 1;
117 req->out.args[0].size = sizeof(struct fuse_entry_out); 128 if (fc->minor < 9)
129 req->out.args[0].size = FUSE_COMPAT_ENTRY_OUT_SIZE;
130 else
131 req->out.args[0].size = sizeof(struct fuse_entry_out);
118 req->out.args[0].value = outarg; 132 req->out.args[0].value = outarg;
119} 133}
120 134
@@ -140,6 +154,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
140 struct fuse_req *req; 154 struct fuse_req *req;
141 struct fuse_req *forget_req; 155 struct fuse_req *forget_req;
142 struct dentry *parent; 156 struct dentry *parent;
157 u64 attr_version;
143 158
144 /* For negative dentries, always do a fresh lookup */ 159 /* For negative dentries, always do a fresh lookup */
145 if (!inode) 160 if (!inode)
@@ -156,6 +171,10 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
156 return 0; 171 return 0;
157 } 172 }
158 173
174 spin_lock(&fc->lock);
175 attr_version = fc->attr_version;
176 spin_unlock(&fc->lock);
177
159 parent = dget_parent(entry); 178 parent = dget_parent(entry);
160 fuse_lookup_init(req, parent->d_inode, entry, &outarg); 179 fuse_lookup_init(req, parent->d_inode, entry, &outarg);
161 request_send(fc, req); 180 request_send(fc, req);
@@ -180,8 +199,10 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
180 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) 199 if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT)
181 return 0; 200 return 0;
182 201
183 fuse_change_attributes(inode, &outarg.attr); 202 fuse_change_attributes(inode, &outarg.attr,
184 fuse_change_timeout(entry, &outarg); 203 entry_attr_timeout(&outarg),
204 attr_version);
205 fuse_change_entry_timeout(entry, &outarg);
185 } 206 }
186 return 1; 207 return 1;
187} 208}
@@ -228,6 +249,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
228 struct fuse_conn *fc = get_fuse_conn(dir); 249 struct fuse_conn *fc = get_fuse_conn(dir);
229 struct fuse_req *req; 250 struct fuse_req *req;
230 struct fuse_req *forget_req; 251 struct fuse_req *forget_req;
252 u64 attr_version;
231 253
232 if (entry->d_name.len > FUSE_NAME_MAX) 254 if (entry->d_name.len > FUSE_NAME_MAX)
233 return ERR_PTR(-ENAMETOOLONG); 255 return ERR_PTR(-ENAMETOOLONG);
@@ -242,6 +264,10 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
242 return ERR_PTR(PTR_ERR(forget_req)); 264 return ERR_PTR(PTR_ERR(forget_req));
243 } 265 }
244 266
267 spin_lock(&fc->lock);
268 attr_version = fc->attr_version;
269 spin_unlock(&fc->lock);
270
245 fuse_lookup_init(req, dir, entry, &outarg); 271 fuse_lookup_init(req, dir, entry, &outarg);
246 request_send(fc, req); 272 request_send(fc, req);
247 err = req->out.h.error; 273 err = req->out.h.error;
@@ -253,7 +279,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
253 err = -EIO; 279 err = -EIO;
254 if (!err && outarg.nodeid) { 280 if (!err && outarg.nodeid) {
255 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 281 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
256 &outarg.attr); 282 &outarg.attr, entry_attr_timeout(&outarg),
283 attr_version);
257 if (!inode) { 284 if (!inode) {
258 fuse_send_forget(fc, forget_req, outarg.nodeid, 1); 285 fuse_send_forget(fc, forget_req, outarg.nodeid, 1);
259 return ERR_PTR(-ENOMEM); 286 return ERR_PTR(-ENOMEM);
@@ -276,7 +303,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
276 303
277 entry->d_op = &fuse_dentry_operations; 304 entry->d_op = &fuse_dentry_operations;
278 if (!err) 305 if (!err)
279 fuse_change_timeout(entry, &outarg); 306 fuse_change_entry_timeout(entry, &outarg);
280 else 307 else
281 fuse_invalidate_entry_cache(entry); 308 fuse_invalidate_entry_cache(entry);
282 return NULL; 309 return NULL;
@@ -335,6 +362,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
335 362
336 flags &= ~O_NOCTTY; 363 flags &= ~O_NOCTTY;
337 memset(&inarg, 0, sizeof(inarg)); 364 memset(&inarg, 0, sizeof(inarg));
365 memset(&outentry, 0, sizeof(outentry));
338 inarg.flags = flags; 366 inarg.flags = flags;
339 inarg.mode = mode; 367 inarg.mode = mode;
340 req->in.h.opcode = FUSE_CREATE; 368 req->in.h.opcode = FUSE_CREATE;
@@ -345,7 +373,10 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
345 req->in.args[1].size = entry->d_name.len + 1; 373 req->in.args[1].size = entry->d_name.len + 1;
346 req->in.args[1].value = entry->d_name.name; 374 req->in.args[1].value = entry->d_name.name;
347 req->out.numargs = 2; 375 req->out.numargs = 2;
348 req->out.args[0].size = sizeof(outentry); 376 if (fc->minor < 9)
377 req->out.args[0].size = FUSE_COMPAT_ENTRY_OUT_SIZE;
378 else
379 req->out.args[0].size = sizeof(outentry);
349 req->out.args[0].value = &outentry; 380 req->out.args[0].value = &outentry;
350 req->out.args[1].size = sizeof(outopen); 381 req->out.args[1].size = sizeof(outopen);
351 req->out.args[1].value = &outopen; 382 req->out.args[1].value = &outopen;
@@ -363,7 +394,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
363 394
364 fuse_put_request(fc, req); 395 fuse_put_request(fc, req);
365 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, 396 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation,
366 &outentry.attr); 397 &outentry.attr, entry_attr_timeout(&outentry), 0);
367 if (!inode) { 398 if (!inode) {
368 flags &= ~(O_CREAT | O_EXCL | O_TRUNC); 399 flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
369 ff->fh = outopen.fh; 400 ff->fh = outopen.fh;
@@ -373,7 +404,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
373 } 404 }
374 fuse_put_request(fc, forget_req); 405 fuse_put_request(fc, forget_req);
375 d_instantiate(entry, inode); 406 d_instantiate(entry, inode);
376 fuse_change_timeout(entry, &outentry); 407 fuse_change_entry_timeout(entry, &outentry);
377 file = lookup_instantiate_filp(nd, entry, generic_file_open); 408 file = lookup_instantiate_filp(nd, entry, generic_file_open);
378 if (IS_ERR(file)) { 409 if (IS_ERR(file)) {
379 ff->fh = outopen.fh; 410 ff->fh = outopen.fh;
@@ -410,9 +441,13 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
410 return PTR_ERR(forget_req); 441 return PTR_ERR(forget_req);
411 } 442 }
412 443
444 memset(&outarg, 0, sizeof(outarg));
413 req->in.h.nodeid = get_node_id(dir); 445 req->in.h.nodeid = get_node_id(dir);
414 req->out.numargs = 1; 446 req->out.numargs = 1;
415 req->out.args[0].size = sizeof(outarg); 447 if (fc->minor < 9)
448 req->out.args[0].size = FUSE_COMPAT_ENTRY_OUT_SIZE;
449 else
450 req->out.args[0].size = sizeof(outarg);
416 req->out.args[0].value = &outarg; 451 req->out.args[0].value = &outarg;
417 request_send(fc, req); 452 request_send(fc, req);
418 err = req->out.h.error; 453 err = req->out.h.error;
@@ -428,7 +463,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
428 goto out_put_forget_req; 463 goto out_put_forget_req;
429 464
430 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 465 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
431 &outarg.attr); 466 &outarg.attr, entry_attr_timeout(&outarg), 0);
432 if (!inode) { 467 if (!inode) {
433 fuse_send_forget(fc, forget_req, outarg.nodeid, 1); 468 fuse_send_forget(fc, forget_req, outarg.nodeid, 1);
434 return -ENOMEM; 469 return -ENOMEM;
@@ -451,7 +486,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
451 } else 486 } else
452 d_instantiate(entry, inode); 487 d_instantiate(entry, inode);
453 488
454 fuse_change_timeout(entry, &outarg); 489 fuse_change_entry_timeout(entry, &outarg);
455 fuse_invalidate_attr(dir); 490 fuse_invalidate_attr(dir);
456 return 0; 491 return 0;
457 492
@@ -663,52 +698,84 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
663 return err; 698 return err;
664} 699}
665 700
666static int fuse_do_getattr(struct inode *inode) 701static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr,
702 struct kstat *stat)
703{
704 stat->dev = inode->i_sb->s_dev;
705 stat->ino = attr->ino;
706 stat->mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
707 stat->nlink = attr->nlink;
708 stat->uid = attr->uid;
709 stat->gid = attr->gid;
710 stat->rdev = inode->i_rdev;
711 stat->atime.tv_sec = attr->atime;
712 stat->atime.tv_nsec = attr->atimensec;
713 stat->mtime.tv_sec = attr->mtime;
714 stat->mtime.tv_nsec = attr->mtimensec;
715 stat->ctime.tv_sec = attr->ctime;
716 stat->ctime.tv_nsec = attr->ctimensec;
717 stat->size = attr->size;
718 stat->blocks = attr->blocks;
719 stat->blksize = (1 << inode->i_blkbits);
720}
721
722static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
723 struct file *file)
667{ 724{
668 int err; 725 int err;
669 struct fuse_attr_out arg; 726 struct fuse_getattr_in inarg;
727 struct fuse_attr_out outarg;
670 struct fuse_conn *fc = get_fuse_conn(inode); 728 struct fuse_conn *fc = get_fuse_conn(inode);
671 struct fuse_req *req = fuse_get_req(fc); 729 struct fuse_req *req;
730 u64 attr_version;
731
732 req = fuse_get_req(fc);
672 if (IS_ERR(req)) 733 if (IS_ERR(req))
673 return PTR_ERR(req); 734 return PTR_ERR(req);
674 735
736 spin_lock(&fc->lock);
737 attr_version = fc->attr_version;
738 spin_unlock(&fc->lock);
739
740 memset(&inarg, 0, sizeof(inarg));
741 memset(&outarg, 0, sizeof(outarg));
742 /* Directories have separate file-handle space */
743 if (file && S_ISREG(inode->i_mode)) {
744 struct fuse_file *ff = file->private_data;
745
746 inarg.getattr_flags |= FUSE_GETATTR_FH;
747 inarg.fh = ff->fh;
748 }
675 req->in.h.opcode = FUSE_GETATTR; 749 req->in.h.opcode = FUSE_GETATTR;
676 req->in.h.nodeid = get_node_id(inode); 750 req->in.h.nodeid = get_node_id(inode);
751 req->in.numargs = 1;
752 req->in.args[0].size = sizeof(inarg);
753 req->in.args[0].value = &inarg;
677 req->out.numargs = 1; 754 req->out.numargs = 1;
678 req->out.args[0].size = sizeof(arg); 755 if (fc->minor < 9)
679 req->out.args[0].value = &arg; 756 req->out.args[0].size = FUSE_COMPAT_ATTR_OUT_SIZE;
757 else
758 req->out.args[0].size = sizeof(outarg);
759 req->out.args[0].value = &outarg;
680 request_send(fc, req); 760 request_send(fc, req);
681 err = req->out.h.error; 761 err = req->out.h.error;
682 fuse_put_request(fc, req); 762 fuse_put_request(fc, req);
683 if (!err) { 763 if (!err) {
684 if ((inode->i_mode ^ arg.attr.mode) & S_IFMT) { 764 if ((inode->i_mode ^ outarg.attr.mode) & S_IFMT) {
685 make_bad_inode(inode); 765 make_bad_inode(inode);
686 err = -EIO; 766 err = -EIO;
687 } else { 767 } else {
688 struct fuse_inode *fi = get_fuse_inode(inode); 768 fuse_change_attributes(inode, &outarg.attr,
689 fuse_change_attributes(inode, &arg.attr); 769 attr_timeout(&outarg),
690 fi->i_time = time_to_jiffies(arg.attr_valid, 770 attr_version);
691 arg.attr_valid_nsec); 771 if (stat)
772 fuse_fillattr(inode, &outarg.attr, stat);
692 } 773 }
693 } 774 }
694 return err; 775 return err;
695} 776}
696 777
697/* 778/*
698 * Check if attributes are still valid, and if not send a GETATTR
699 * request to refresh them.
700 */
701static int fuse_refresh_attributes(struct inode *inode)
702{
703 struct fuse_inode *fi = get_fuse_inode(inode);
704
705 if (fi->i_time < get_jiffies_64())
706 return fuse_do_getattr(inode);
707 else
708 return 0;
709}
710
711/*
712 * Calling into a user-controlled filesystem gives the filesystem 779 * Calling into a user-controlled filesystem gives the filesystem
713 * daemon ptrace-like capabilities over the requester process. This 780 * daemon ptrace-like capabilities over the requester process. This
714 * means, that the filesystem daemon is able to record the exact 781 * means, that the filesystem daemon is able to record the exact
@@ -721,7 +788,7 @@ static int fuse_refresh_attributes(struct inode *inode)
721 * for which the owner of the mount has ptrace privilege. This 788 * for which the owner of the mount has ptrace privilege. This
722 * excludes processes started by other users, suid or sgid processes. 789 * excludes processes started by other users, suid or sgid processes.
723 */ 790 */
724static int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task) 791int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task)
725{ 792{
726 if (fc->flags & FUSE_ALLOW_OTHER) 793 if (fc->flags & FUSE_ALLOW_OTHER)
727 return 1; 794 return 1;
@@ -795,11 +862,14 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
795 */ 862 */
796 if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) || 863 if ((fc->flags & FUSE_DEFAULT_PERMISSIONS) ||
797 ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) { 864 ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))) {
798 err = fuse_refresh_attributes(inode); 865 struct fuse_inode *fi = get_fuse_inode(inode);
799 if (err) 866 if (fi->i_time < get_jiffies_64()) {
800 return err; 867 err = fuse_do_getattr(inode, NULL, NULL);
868 if (err)
869 return err;
801 870
802 refreshed = true; 871 refreshed = true;
872 }
803 } 873 }
804 874
805 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 875 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
@@ -809,7 +879,7 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
809 attributes. This is also needed, because the root 879 attributes. This is also needed, because the root
810 node will at first have no permissions */ 880 node will at first have no permissions */
811 if (err == -EACCES && !refreshed) { 881 if (err == -EACCES && !refreshed) {
812 err = fuse_do_getattr(inode); 882 err = fuse_do_getattr(inode, NULL, NULL);
813 if (!err) 883 if (!err)
814 err = generic_permission(inode, mask, NULL); 884 err = generic_permission(inode, mask, NULL);
815 } 885 }
@@ -825,7 +895,7 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
825 if (refreshed) 895 if (refreshed)
826 return -EACCES; 896 return -EACCES;
827 897
828 err = fuse_do_getattr(inode); 898 err = fuse_do_getattr(inode, NULL, NULL);
829 if (!err && !(inode->i_mode & S_IXUGO)) 899 if (!err && !(inode->i_mode & S_IXUGO))
830 return -EACCES; 900 return -EACCES;
831 } 901 }
@@ -962,6 +1032,20 @@ static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync)
962 return file ? fuse_fsync_common(file, de, datasync, 1) : 0; 1032 return file ? fuse_fsync_common(file, de, datasync, 1) : 0;
963} 1033}
964 1034
1035static bool update_mtime(unsigned ivalid)
1036{
1037 /* Always update if mtime is explicitly set */
1038 if (ivalid & ATTR_MTIME_SET)
1039 return true;
1040
1041 /* If it's an open(O_TRUNC) or an ftruncate(), don't update */
1042 if ((ivalid & ATTR_SIZE) && (ivalid & (ATTR_OPEN | ATTR_FILE)))
1043 return false;
1044
1045 /* In all other cases update */
1046 return true;
1047}
1048
965static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg) 1049static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
966{ 1050{
967 unsigned ivalid = iattr->ia_valid; 1051 unsigned ivalid = iattr->ia_valid;
@@ -974,16 +1058,19 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
974 arg->valid |= FATTR_GID, arg->gid = iattr->ia_gid; 1058 arg->valid |= FATTR_GID, arg->gid = iattr->ia_gid;
975 if (ivalid & ATTR_SIZE) 1059 if (ivalid & ATTR_SIZE)
976 arg->valid |= FATTR_SIZE, arg->size = iattr->ia_size; 1060 arg->valid |= FATTR_SIZE, arg->size = iattr->ia_size;
977 /* You can only _set_ these together (they may change by themselves) */ 1061 if (ivalid & ATTR_ATIME) {
978 if ((ivalid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) { 1062 arg->valid |= FATTR_ATIME;
979 arg->valid |= FATTR_ATIME | FATTR_MTIME;
980 arg->atime = iattr->ia_atime.tv_sec; 1063 arg->atime = iattr->ia_atime.tv_sec;
981 arg->mtime = iattr->ia_mtime.tv_sec; 1064 arg->atimensec = iattr->ia_atime.tv_nsec;
1065 if (!(ivalid & ATTR_ATIME_SET))
1066 arg->valid |= FATTR_ATIME_NOW;
982 } 1067 }
983 if (ivalid & ATTR_FILE) { 1068 if ((ivalid & ATTR_MTIME) && update_mtime(ivalid)) {
984 struct fuse_file *ff = iattr->ia_file->private_data; 1069 arg->valid |= FATTR_MTIME;
985 arg->valid |= FATTR_FH; 1070 arg->mtime = iattr->ia_mtime.tv_sec;
986 arg->fh = ff->fh; 1071 arg->mtimensec = iattr->ia_mtime.tv_nsec;
1072 if (!(ivalid & ATTR_MTIME_SET))
1073 arg->valid |= FATTR_MTIME_NOW;
987 } 1074 }
988} 1075}
989 1076
@@ -995,22 +1082,28 @@ static void iattr_to_fattr(struct iattr *iattr, struct fuse_setattr_in *arg)
995 * vmtruncate() doesn't allow for this case, so do the rlimit checking 1082 * vmtruncate() doesn't allow for this case, so do the rlimit checking
996 * and the actual truncation by hand. 1083 * and the actual truncation by hand.
997 */ 1084 */
998static int fuse_setattr(struct dentry *entry, struct iattr *attr) 1085static int fuse_do_setattr(struct dentry *entry, struct iattr *attr,
1086 struct file *file)
999{ 1087{
1000 struct inode *inode = entry->d_inode; 1088 struct inode *inode = entry->d_inode;
1001 struct fuse_conn *fc = get_fuse_conn(inode); 1089 struct fuse_conn *fc = get_fuse_conn(inode);
1002 struct fuse_inode *fi = get_fuse_inode(inode);
1003 struct fuse_req *req; 1090 struct fuse_req *req;
1004 struct fuse_setattr_in inarg; 1091 struct fuse_setattr_in inarg;
1005 struct fuse_attr_out outarg; 1092 struct fuse_attr_out outarg;
1006 int err; 1093 int err;
1007 1094
1095 if (!fuse_allow_task(fc, current))
1096 return -EACCES;
1097
1008 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 1098 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
1009 err = inode_change_ok(inode, attr); 1099 err = inode_change_ok(inode, attr);
1010 if (err) 1100 if (err)
1011 return err; 1101 return err;
1012 } 1102 }
1013 1103
1104 if ((attr->ia_valid & ATTR_OPEN) && fc->atomic_o_trunc)
1105 return 0;
1106
1014 if (attr->ia_valid & ATTR_SIZE) { 1107 if (attr->ia_valid & ATTR_SIZE) {
1015 unsigned long limit; 1108 unsigned long limit;
1016 if (IS_SWAPFILE(inode)) 1109 if (IS_SWAPFILE(inode))
@@ -1027,14 +1120,28 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1027 return PTR_ERR(req); 1120 return PTR_ERR(req);
1028 1121
1029 memset(&inarg, 0, sizeof(inarg)); 1122 memset(&inarg, 0, sizeof(inarg));
1123 memset(&outarg, 0, sizeof(outarg));
1030 iattr_to_fattr(attr, &inarg); 1124 iattr_to_fattr(attr, &inarg);
1125 if (file) {
1126 struct fuse_file *ff = file->private_data;
1127 inarg.valid |= FATTR_FH;
1128 inarg.fh = ff->fh;
1129 }
1130 if (attr->ia_valid & ATTR_SIZE) {
1131 /* For mandatory locking in truncate */
1132 inarg.valid |= FATTR_LOCKOWNER;
1133 inarg.lock_owner = fuse_lock_owner_id(fc, current->files);
1134 }
1031 req->in.h.opcode = FUSE_SETATTR; 1135 req->in.h.opcode = FUSE_SETATTR;
1032 req->in.h.nodeid = get_node_id(inode); 1136 req->in.h.nodeid = get_node_id(inode);
1033 req->in.numargs = 1; 1137 req->in.numargs = 1;
1034 req->in.args[0].size = sizeof(inarg); 1138 req->in.args[0].size = sizeof(inarg);
1035 req->in.args[0].value = &inarg; 1139 req->in.args[0].value = &inarg;
1036 req->out.numargs = 1; 1140 req->out.numargs = 1;
1037 req->out.args[0].size = sizeof(outarg); 1141 if (fc->minor < 9)
1142 req->out.args[0].size = FUSE_COMPAT_ATTR_OUT_SIZE;
1143 else
1144 req->out.args[0].size = sizeof(outarg);
1038 req->out.args[0].value = &outarg; 1145 req->out.args[0].value = &outarg;
1039 request_send(fc, req); 1146 request_send(fc, req);
1040 err = req->out.h.error; 1147 err = req->out.h.error;
@@ -1050,11 +1157,18 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1050 return -EIO; 1157 return -EIO;
1051 } 1158 }
1052 1159
1053 fuse_change_attributes(inode, &outarg.attr); 1160 fuse_change_attributes(inode, &outarg.attr, attr_timeout(&outarg), 0);
1054 fi->i_time = time_to_jiffies(outarg.attr_valid, outarg.attr_valid_nsec);
1055 return 0; 1161 return 0;
1056} 1162}
1057 1163
1164static int fuse_setattr(struct dentry *entry, struct iattr *attr)
1165{
1166 if (attr->ia_valid & ATTR_FILE)
1167 return fuse_do_setattr(entry, attr, attr->ia_file);
1168 else
1169 return fuse_do_setattr(entry, attr, NULL);
1170}
1171
1058static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry, 1172static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1059 struct kstat *stat) 1173 struct kstat *stat)
1060{ 1174{
@@ -1066,8 +1180,10 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
1066 if (!fuse_allow_task(fc, current)) 1180 if (!fuse_allow_task(fc, current))
1067 return -EACCES; 1181 return -EACCES;
1068 1182
1069 err = fuse_refresh_attributes(inode); 1183 if (fi->i_time < get_jiffies_64())
1070 if (!err) { 1184 err = fuse_do_getattr(inode, stat, NULL);
1185 else {
1186 err = 0;
1071 generic_fillattr(inode, stat); 1187 generic_fillattr(inode, stat);
1072 stat->mode = fi->orig_i_mode; 1188 stat->mode = fi->orig_i_mode;
1073 } 1189 }
@@ -1172,6 +1288,9 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
1172 struct fuse_getxattr_out outarg; 1288 struct fuse_getxattr_out outarg;
1173 ssize_t ret; 1289 ssize_t ret;
1174 1290
1291 if (!fuse_allow_task(fc, current))
1292 return -EACCES;
1293
1175 if (fc->no_listxattr) 1294 if (fc->no_listxattr)
1176 return -EOPNOTSUPP; 1295 return -EOPNOTSUPP;
1177 1296
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index c4b98c03a46e..0fcdba9d47c0 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -28,7 +28,9 @@ static int fuse_send_open(struct inode *inode, struct file *file, int isdir,
28 return PTR_ERR(req); 28 return PTR_ERR(req);
29 29
30 memset(&inarg, 0, sizeof(inarg)); 30 memset(&inarg, 0, sizeof(inarg));
31 inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); 31 inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY);
32 if (!fc->atomic_o_trunc)
33 inarg.flags &= ~O_TRUNC;
32 req->in.h.opcode = isdir ? FUSE_OPENDIR : FUSE_OPEN; 34 req->in.h.opcode = isdir ? FUSE_OPENDIR : FUSE_OPEN;
33 req->in.h.nodeid = get_node_id(inode); 35 req->in.h.nodeid = get_node_id(inode);
34 req->in.numargs = 1; 36 req->in.numargs = 1;
@@ -54,6 +56,7 @@ struct fuse_file *fuse_file_alloc(void)
54 kfree(ff); 56 kfree(ff);
55 ff = NULL; 57 ff = NULL;
56 } 58 }
59 INIT_LIST_HEAD(&ff->write_entry);
57 atomic_set(&ff->count, 0); 60 atomic_set(&ff->count, 0);
58 } 61 }
59 return ff; 62 return ff;
@@ -148,12 +151,18 @@ int fuse_release_common(struct inode *inode, struct file *file, int isdir)
148{ 151{
149 struct fuse_file *ff = file->private_data; 152 struct fuse_file *ff = file->private_data;
150 if (ff) { 153 if (ff) {
154 struct fuse_conn *fc = get_fuse_conn(inode);
155
151 fuse_release_fill(ff, get_node_id(inode), file->f_flags, 156 fuse_release_fill(ff, get_node_id(inode), file->f_flags,
152 isdir ? FUSE_RELEASEDIR : FUSE_RELEASE); 157 isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
153 158
154 /* Hold vfsmount and dentry until release is finished */ 159 /* Hold vfsmount and dentry until release is finished */
155 ff->reserved_req->vfsmount = mntget(file->f_path.mnt); 160 ff->reserved_req->vfsmount = mntget(file->f_path.mnt);
156 ff->reserved_req->dentry = dget(file->f_path.dentry); 161 ff->reserved_req->dentry = dget(file->f_path.dentry);
162
163 spin_lock(&fc->lock);
164 list_del(&ff->write_entry);
165 spin_unlock(&fc->lock);
157 /* 166 /*
158 * Normally this will send the RELEASE request, 167 * Normally this will send the RELEASE request,
159 * however if some asynchronous READ or WRITE requests 168 * however if some asynchronous READ or WRITE requests
@@ -180,7 +189,7 @@ static int fuse_release(struct inode *inode, struct file *file)
180 * Scramble the ID space with XTEA, so that the value of the files_struct 189 * Scramble the ID space with XTEA, so that the value of the files_struct
181 * pointer is not exposed to userspace. 190 * pointer is not exposed to userspace.
182 */ 191 */
183static u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id) 192u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id)
184{ 193{
185 u32 *k = fc->scramble_key; 194 u32 *k = fc->scramble_key;
186 u64 v = (unsigned long) id; 195 u64 v = (unsigned long) id;
@@ -299,11 +308,19 @@ void fuse_read_fill(struct fuse_req *req, struct fuse_file *ff,
299} 308}
300 309
301static size_t fuse_send_read(struct fuse_req *req, struct file *file, 310static size_t fuse_send_read(struct fuse_req *req, struct file *file,
302 struct inode *inode, loff_t pos, size_t count) 311 struct inode *inode, loff_t pos, size_t count,
312 fl_owner_t owner)
303{ 313{
304 struct fuse_conn *fc = get_fuse_conn(inode); 314 struct fuse_conn *fc = get_fuse_conn(inode);
305 struct fuse_file *ff = file->private_data; 315 struct fuse_file *ff = file->private_data;
316
306 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ); 317 fuse_read_fill(req, ff, inode, pos, count, FUSE_READ);
318 if (owner != NULL) {
319 struct fuse_read_in *inarg = &req->misc.read_in;
320
321 inarg->read_flags |= FUSE_READ_LOCKOWNER;
322 inarg->lock_owner = fuse_lock_owner_id(fc, owner);
323 }
307 request_send(fc, req); 324 request_send(fc, req);
308 return req->out.args[0].size; 325 return req->out.args[0].size;
309} 326}
@@ -327,7 +344,8 @@ static int fuse_readpage(struct file *file, struct page *page)
327 req->out.page_zeroing = 1; 344 req->out.page_zeroing = 1;
328 req->num_pages = 1; 345 req->num_pages = 1;
329 req->pages[0] = page; 346 req->pages[0] = page;
330 fuse_send_read(req, file, inode, page_offset(page), PAGE_CACHE_SIZE); 347 fuse_send_read(req, file, inode, page_offset(page), PAGE_CACHE_SIZE,
348 NULL);
331 err = req->out.h.error; 349 err = req->out.h.error;
332 fuse_put_request(fc, req); 350 fuse_put_request(fc, req);
333 if (!err) 351 if (!err)
@@ -434,30 +452,47 @@ out:
434 return err; 452 return err;
435} 453}
436 454
437static size_t fuse_send_write(struct fuse_req *req, struct file *file, 455static void fuse_write_fill(struct fuse_req *req, struct fuse_file *ff,
438 struct inode *inode, loff_t pos, size_t count) 456 struct inode *inode, loff_t pos, size_t count,
457 int writepage)
439{ 458{
440 struct fuse_conn *fc = get_fuse_conn(inode); 459 struct fuse_conn *fc = get_fuse_conn(inode);
441 struct fuse_file *ff = file->private_data; 460 struct fuse_write_in *inarg = &req->misc.write.in;
442 struct fuse_write_in inarg; 461 struct fuse_write_out *outarg = &req->misc.write.out;
443 struct fuse_write_out outarg;
444 462
445 memset(&inarg, 0, sizeof(struct fuse_write_in)); 463 memset(inarg, 0, sizeof(struct fuse_write_in));
446 inarg.fh = ff->fh; 464 inarg->fh = ff->fh;
447 inarg.offset = pos; 465 inarg->offset = pos;
448 inarg.size = count; 466 inarg->size = count;
467 inarg->write_flags = writepage ? FUSE_WRITE_CACHE : 0;
449 req->in.h.opcode = FUSE_WRITE; 468 req->in.h.opcode = FUSE_WRITE;
450 req->in.h.nodeid = get_node_id(inode); 469 req->in.h.nodeid = get_node_id(inode);
451 req->in.argpages = 1; 470 req->in.argpages = 1;
452 req->in.numargs = 2; 471 req->in.numargs = 2;
453 req->in.args[0].size = sizeof(struct fuse_write_in); 472 if (fc->minor < 9)
454 req->in.args[0].value = &inarg; 473 req->in.args[0].size = FUSE_COMPAT_WRITE_IN_SIZE;
474 else
475 req->in.args[0].size = sizeof(struct fuse_write_in);
476 req->in.args[0].value = inarg;
455 req->in.args[1].size = count; 477 req->in.args[1].size = count;
456 req->out.numargs = 1; 478 req->out.numargs = 1;
457 req->out.args[0].size = sizeof(struct fuse_write_out); 479 req->out.args[0].size = sizeof(struct fuse_write_out);
458 req->out.args[0].value = &outarg; 480 req->out.args[0].value = outarg;
481}
482
483static size_t fuse_send_write(struct fuse_req *req, struct file *file,
484 struct inode *inode, loff_t pos, size_t count,
485 fl_owner_t owner)
486{
487 struct fuse_conn *fc = get_fuse_conn(inode);
488 fuse_write_fill(req, file->private_data, inode, pos, count, 0);
489 if (owner != NULL) {
490 struct fuse_write_in *inarg = &req->misc.write.in;
491 inarg->write_flags |= FUSE_WRITE_LOCKOWNER;
492 inarg->lock_owner = fuse_lock_owner_id(fc, owner);
493 }
459 request_send(fc, req); 494 request_send(fc, req);
460 return outarg.size; 495 return req->misc.write.out.size;
461} 496}
462 497
463static int fuse_write_begin(struct file *file, struct address_space *mapping, 498static int fuse_write_begin(struct file *file, struct address_space *mapping,
@@ -478,6 +513,7 @@ static int fuse_buffered_write(struct file *file, struct inode *inode,
478 int err; 513 int err;
479 size_t nres; 514 size_t nres;
480 struct fuse_conn *fc = get_fuse_conn(inode); 515 struct fuse_conn *fc = get_fuse_conn(inode);
516 struct fuse_inode *fi = get_fuse_inode(inode);
481 unsigned offset = pos & (PAGE_CACHE_SIZE - 1); 517 unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
482 struct fuse_req *req; 518 struct fuse_req *req;
483 519
@@ -491,7 +527,7 @@ static int fuse_buffered_write(struct file *file, struct inode *inode,
491 req->num_pages = 1; 527 req->num_pages = 1;
492 req->pages[0] = page; 528 req->pages[0] = page;
493 req->page_offset = offset; 529 req->page_offset = offset;
494 nres = fuse_send_write(req, file, inode, pos, count); 530 nres = fuse_send_write(req, file, inode, pos, count, NULL);
495 err = req->out.h.error; 531 err = req->out.h.error;
496 fuse_put_request(fc, req); 532 fuse_put_request(fc, req);
497 if (!err && !nres) 533 if (!err && !nres)
@@ -499,6 +535,7 @@ static int fuse_buffered_write(struct file *file, struct inode *inode,
499 if (!err) { 535 if (!err) {
500 pos += nres; 536 pos += nres;
501 spin_lock(&fc->lock); 537 spin_lock(&fc->lock);
538 fi->attr_version = ++fc->attr_version;
502 if (pos > inode->i_size) 539 if (pos > inode->i_size)
503 i_size_write(inode, pos); 540 i_size_write(inode, pos);
504 spin_unlock(&fc->lock); 541 spin_unlock(&fc->lock);
@@ -591,9 +628,11 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
591 nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset; 628 nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset;
592 nbytes = min(count, nbytes); 629 nbytes = min(count, nbytes);
593 if (write) 630 if (write)
594 nres = fuse_send_write(req, file, inode, pos, nbytes); 631 nres = fuse_send_write(req, file, inode, pos, nbytes,
632 current->files);
595 else 633 else
596 nres = fuse_send_read(req, file, inode, pos, nbytes); 634 nres = fuse_send_read(req, file, inode, pos, nbytes,
635 current->files);
597 fuse_release_user_pages(req, !write); 636 fuse_release_user_pages(req, !write);
598 if (req->out.h.error) { 637 if (req->out.h.error) {
599 if (!res) 638 if (!res)
@@ -695,7 +734,8 @@ static int convert_fuse_file_lock(const struct fuse_file_lock *ffl,
695} 734}
696 735
697static void fuse_lk_fill(struct fuse_req *req, struct file *file, 736static void fuse_lk_fill(struct fuse_req *req, struct file *file,
698 const struct file_lock *fl, int opcode, pid_t pid) 737 const struct file_lock *fl, int opcode, pid_t pid,
738 int flock)
699{ 739{
700 struct inode *inode = file->f_path.dentry->d_inode; 740 struct inode *inode = file->f_path.dentry->d_inode;
701 struct fuse_conn *fc = get_fuse_conn(inode); 741 struct fuse_conn *fc = get_fuse_conn(inode);
@@ -708,6 +748,8 @@ static void fuse_lk_fill(struct fuse_req *req, struct file *file,
708 arg->lk.end = fl->fl_end; 748 arg->lk.end = fl->fl_end;
709 arg->lk.type = fl->fl_type; 749 arg->lk.type = fl->fl_type;
710 arg->lk.pid = pid; 750 arg->lk.pid = pid;
751 if (flock)
752 arg->lk_flags |= FUSE_LK_FLOCK;
711 req->in.h.opcode = opcode; 753 req->in.h.opcode = opcode;
712 req->in.h.nodeid = get_node_id(inode); 754 req->in.h.nodeid = get_node_id(inode);
713 req->in.numargs = 1; 755 req->in.numargs = 1;
@@ -727,7 +769,7 @@ static int fuse_getlk(struct file *file, struct file_lock *fl)
727 if (IS_ERR(req)) 769 if (IS_ERR(req))
728 return PTR_ERR(req); 770 return PTR_ERR(req);
729 771
730 fuse_lk_fill(req, file, fl, FUSE_GETLK, 0); 772 fuse_lk_fill(req, file, fl, FUSE_GETLK, 0, 0);
731 req->out.numargs = 1; 773 req->out.numargs = 1;
732 req->out.args[0].size = sizeof(outarg); 774 req->out.args[0].size = sizeof(outarg);
733 req->out.args[0].value = &outarg; 775 req->out.args[0].value = &outarg;
@@ -740,7 +782,7 @@ static int fuse_getlk(struct file *file, struct file_lock *fl)
740 return err; 782 return err;
741} 783}
742 784
743static int fuse_setlk(struct file *file, struct file_lock *fl) 785static int fuse_setlk(struct file *file, struct file_lock *fl, int flock)
744{ 786{
745 struct inode *inode = file->f_path.dentry->d_inode; 787 struct inode *inode = file->f_path.dentry->d_inode;
746 struct fuse_conn *fc = get_fuse_conn(inode); 788 struct fuse_conn *fc = get_fuse_conn(inode);
@@ -757,7 +799,7 @@ static int fuse_setlk(struct file *file, struct file_lock *fl)
757 if (IS_ERR(req)) 799 if (IS_ERR(req))
758 return PTR_ERR(req); 800 return PTR_ERR(req);
759 801
760 fuse_lk_fill(req, file, fl, opcode, pid); 802 fuse_lk_fill(req, file, fl, opcode, pid, flock);
761 request_send(fc, req); 803 request_send(fc, req);
762 err = req->out.h.error; 804 err = req->out.h.error;
763 /* locking is restartable */ 805 /* locking is restartable */
@@ -783,8 +825,25 @@ static int fuse_file_lock(struct file *file, int cmd, struct file_lock *fl)
783 if (fc->no_lock) 825 if (fc->no_lock)
784 err = posix_lock_file_wait(file, fl); 826 err = posix_lock_file_wait(file, fl);
785 else 827 else
786 err = fuse_setlk(file, fl); 828 err = fuse_setlk(file, fl, 0);
829 }
830 return err;
831}
832
833static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
834{
835 struct inode *inode = file->f_path.dentry->d_inode;
836 struct fuse_conn *fc = get_fuse_conn(inode);
837 int err;
838
839 if (fc->no_lock) {
840 err = flock_lock_file_wait(file, fl);
841 } else {
842 /* emulate flock with POSIX locks */
843 fl->fl_owner = (fl_owner_t) file;
844 err = fuse_setlk(file, fl, 1);
787 } 845 }
846
788 return err; 847 return err;
789} 848}
790 849
@@ -836,6 +895,7 @@ static const struct file_operations fuse_file_operations = {
836 .release = fuse_release, 895 .release = fuse_release,
837 .fsync = fuse_fsync, 896 .fsync = fuse_fsync,
838 .lock = fuse_file_lock, 897 .lock = fuse_file_lock,
898 .flock = fuse_file_flock,
839 .splice_read = generic_file_splice_read, 899 .splice_read = generic_file_splice_read,
840}; 900};
841 901
@@ -848,6 +908,7 @@ static const struct file_operations fuse_direct_io_file_operations = {
848 .release = fuse_release, 908 .release = fuse_release,
849 .fsync = fuse_fsync, 909 .fsync = fuse_fsync,
850 .lock = fuse_file_lock, 910 .lock = fuse_file_lock,
911 .flock = fuse_file_flock,
851 /* no mmap and splice_read */ 912 /* no mmap and splice_read */
852}; 913};
853 914
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 1764506fdd11..6c5461de1a5f 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -67,6 +67,12 @@ struct fuse_inode {
67 /** The sticky bit in inode->i_mode may have been removed, so 67 /** The sticky bit in inode->i_mode may have been removed, so
68 preserve the original mode */ 68 preserve the original mode */
69 mode_t orig_i_mode; 69 mode_t orig_i_mode;
70
71 /** Version of last attribute change */
72 u64 attr_version;
73
74 /** Files usable in writepage. Protected by fc->lock */
75 struct list_head write_files;
70}; 76};
71 77
72/** FUSE specific file data */ 78/** FUSE specific file data */
@@ -79,6 +85,9 @@ struct fuse_file {
79 85
80 /** Refcount */ 86 /** Refcount */
81 atomic_t count; 87 atomic_t count;
88
89 /** Entry on inode's write_files list */
90 struct list_head write_entry;
82}; 91};
83 92
84/** One input argument of a request */ 93/** One input argument of a request */
@@ -210,6 +219,10 @@ struct fuse_req {
210 struct fuse_init_in init_in; 219 struct fuse_init_in init_in;
211 struct fuse_init_out init_out; 220 struct fuse_init_out init_out;
212 struct fuse_read_in read_in; 221 struct fuse_read_in read_in;
222 struct {
223 struct fuse_write_in in;
224 struct fuse_write_out out;
225 } write;
213 struct fuse_lk_in lk_in; 226 struct fuse_lk_in lk_in;
214 } misc; 227 } misc;
215 228
@@ -317,6 +330,9 @@ struct fuse_conn {
317 /** Do readpages asynchronously? Only set in INIT */ 330 /** Do readpages asynchronously? Only set in INIT */
318 unsigned async_read : 1; 331 unsigned async_read : 1;
319 332
333 /** Do not send separate SETATTR request before open(O_TRUNC) */
334 unsigned atomic_o_trunc : 1;
335
320 /* 336 /*
321 * The following bitfields are only for optimization purposes 337 * The following bitfields are only for optimization purposes
322 * and hence races in setting them will not cause malfunction 338 * and hence races in setting them will not cause malfunction
@@ -387,6 +403,9 @@ struct fuse_conn {
387 403
388 /** Reserved request for the DESTROY message */ 404 /** Reserved request for the DESTROY message */
389 struct fuse_req *destroy_req; 405 struct fuse_req *destroy_req;
406
407 /** Version counter for attribute changes */
408 u64 attr_version;
390}; 409};
391 410
392static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) 411static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
@@ -416,7 +435,8 @@ extern const struct file_operations fuse_dev_operations;
416 * Get a filled in inode 435 * Get a filled in inode
417 */ 436 */
418struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, 437struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
419 int generation, struct fuse_attr *attr); 438 int generation, struct fuse_attr *attr,
439 u64 attr_valid, u64 attr_version);
420 440
421/** 441/**
422 * Send FORGET command 442 * Send FORGET command
@@ -477,7 +497,8 @@ void fuse_init_symlink(struct inode *inode);
477/** 497/**
478 * Change attributes of an inode 498 * Change attributes of an inode
479 */ 499 */
480void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr); 500void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
501 u64 attr_valid, u64 attr_version);
481 502
482/** 503/**
483 * Initialize the client device 504 * Initialize the client device
@@ -565,3 +586,10 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc);
565 * Is file type valid? 586 * Is file type valid?
566 */ 587 */
567int fuse_valid_type(int m); 588int fuse_valid_type(int m);
589
590/**
591 * Is task allowed to perform filesystem operation?
592 */
593int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);
594
595u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index fd0735715c14..9a68d6970845 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -56,6 +56,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
56 fi->i_time = 0; 56 fi->i_time = 0;
57 fi->nodeid = 0; 57 fi->nodeid = 0;
58 fi->nlookup = 0; 58 fi->nlookup = 0;
59 INIT_LIST_HEAD(&fi->write_files);
59 fi->forget_req = fuse_request_alloc(); 60 fi->forget_req = fuse_request_alloc();
60 if (!fi->forget_req) { 61 if (!fi->forget_req) {
61 kmem_cache_free(fuse_inode_cachep, inode); 62 kmem_cache_free(fuse_inode_cachep, inode);
@@ -68,6 +69,7 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
68static void fuse_destroy_inode(struct inode *inode) 69static void fuse_destroy_inode(struct inode *inode)
69{ 70{
70 struct fuse_inode *fi = get_fuse_inode(inode); 71 struct fuse_inode *fi = get_fuse_inode(inode);
72 BUG_ON(!list_empty(&fi->write_files));
71 if (fi->forget_req) 73 if (fi->forget_req)
72 fuse_request_free(fi->forget_req); 74 fuse_request_free(fi->forget_req);
73 kmem_cache_free(fuse_inode_cachep, inode); 75 kmem_cache_free(fuse_inode_cachep, inode);
@@ -117,12 +119,22 @@ static void fuse_truncate(struct address_space *mapping, loff_t offset)
117 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); 119 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
118} 120}
119 121
120void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr) 122
123void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
124 u64 attr_valid, u64 attr_version)
121{ 125{
122 struct fuse_conn *fc = get_fuse_conn(inode); 126 struct fuse_conn *fc = get_fuse_conn(inode);
123 struct fuse_inode *fi = get_fuse_inode(inode); 127 struct fuse_inode *fi = get_fuse_inode(inode);
124 loff_t oldsize; 128 loff_t oldsize;
125 129
130 spin_lock(&fc->lock);
131 if (attr_version != 0 && fi->attr_version > attr_version) {
132 spin_unlock(&fc->lock);
133 return;
134 }
135 fi->attr_version = ++fc->attr_version;
136 fi->i_time = attr_valid;
137
126 inode->i_ino = attr->ino; 138 inode->i_ino = attr->ino;
127 inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777); 139 inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
128 inode->i_nlink = attr->nlink; 140 inode->i_nlink = attr->nlink;
@@ -136,6 +148,11 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
136 inode->i_ctime.tv_sec = attr->ctime; 148 inode->i_ctime.tv_sec = attr->ctime;
137 inode->i_ctime.tv_nsec = attr->ctimensec; 149 inode->i_ctime.tv_nsec = attr->ctimensec;
138 150
151 if (attr->blksize != 0)
152 inode->i_blkbits = ilog2(attr->blksize);
153 else
154 inode->i_blkbits = inode->i_sb->s_blocksize_bits;
155
139 /* 156 /*
140 * Don't set the sticky bit in i_mode, unless we want the VFS 157 * Don't set the sticky bit in i_mode, unless we want the VFS
141 * to check permissions. This prevents failures due to the 158 * to check permissions. This prevents failures due to the
@@ -145,7 +162,6 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
145 if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS)) 162 if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
146 inode->i_mode &= ~S_ISVTX; 163 inode->i_mode &= ~S_ISVTX;
147 164
148 spin_lock(&fc->lock);
149 oldsize = inode->i_size; 165 oldsize = inode->i_size;
150 i_size_write(inode, attr->size); 166 i_size_write(inode, attr->size);
151 spin_unlock(&fc->lock); 167 spin_unlock(&fc->lock);
@@ -194,7 +210,8 @@ static int fuse_inode_set(struct inode *inode, void *_nodeidp)
194} 210}
195 211
196struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid, 212struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
197 int generation, struct fuse_attr *attr) 213 int generation, struct fuse_attr *attr,
214 u64 attr_valid, u64 attr_version)
198{ 215{
199 struct inode *inode; 216 struct inode *inode;
200 struct fuse_inode *fi; 217 struct fuse_inode *fi;
@@ -222,7 +239,8 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
222 spin_lock(&fc->lock); 239 spin_lock(&fc->lock);
223 fi->nlookup ++; 240 fi->nlookup ++;
224 spin_unlock(&fc->lock); 241 spin_unlock(&fc->lock);
225 fuse_change_attributes(inode, attr); 242 fuse_change_attributes(inode, attr, attr_valid, attr_version);
243
226 return inode; 244 return inode;
227} 245}
228 246
@@ -287,6 +305,11 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf)
287 struct fuse_statfs_out outarg; 305 struct fuse_statfs_out outarg;
288 int err; 306 int err;
289 307
308 if (!fuse_allow_task(fc, current)) {
309 buf->f_type = FUSE_SUPER_MAGIC;
310 return 0;
311 }
312
290 req = fuse_get_req(fc); 313 req = fuse_get_req(fc);
291 if (IS_ERR(req)) 314 if (IS_ERR(req))
292 return PTR_ERR(req); 315 return PTR_ERR(req);
@@ -452,6 +475,7 @@ static struct fuse_conn *new_conn(void)
452 } 475 }
453 fc->reqctr = 0; 476 fc->reqctr = 0;
454 fc->blocked = 1; 477 fc->blocked = 1;
478 fc->attr_version = 1;
455 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); 479 get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
456 } 480 }
457out: 481out:
@@ -483,7 +507,7 @@ static struct inode *get_root_inode(struct super_block *sb, unsigned mode)
483 attr.mode = mode; 507 attr.mode = mode;
484 attr.ino = FUSE_ROOT_ID; 508 attr.ino = FUSE_ROOT_ID;
485 attr.nlink = 1; 509 attr.nlink = 1;
486 return fuse_iget(sb, 1, 0, &attr); 510 return fuse_iget(sb, 1, 0, &attr, 0, 0);
487} 511}
488 512
489static const struct super_operations fuse_super_operations = { 513static const struct super_operations fuse_super_operations = {
@@ -514,6 +538,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
514 fc->async_read = 1; 538 fc->async_read = 1;
515 if (!(arg->flags & FUSE_POSIX_LOCKS)) 539 if (!(arg->flags & FUSE_POSIX_LOCKS))
516 fc->no_lock = 1; 540 fc->no_lock = 1;
541 if (arg->flags & FUSE_ATOMIC_O_TRUNC)
542 fc->atomic_o_trunc = 1;
517 } else { 543 } else {
518 ra_pages = fc->max_read / PAGE_CACHE_SIZE; 544 ra_pages = fc->max_read / PAGE_CACHE_SIZE;
519 fc->no_lock = 1; 545 fc->no_lock = 1;
@@ -536,7 +562,8 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
536 arg->major = FUSE_KERNEL_VERSION; 562 arg->major = FUSE_KERNEL_VERSION;
537 arg->minor = FUSE_KERNEL_MINOR_VERSION; 563 arg->minor = FUSE_KERNEL_MINOR_VERSION;
538 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE; 564 arg->max_readahead = fc->bdi.ra_pages * PAGE_CACHE_SIZE;
539 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS; 565 arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_FILE_OPS |
566 FUSE_ATOMIC_O_TRUNC;
540 req->in.h.opcode = FUSE_INIT; 567 req->in.h.opcode = FUSE_INIT;
541 req->in.numargs = 1; 568 req->in.numargs = 1;
542 req->in.args[0].size = sizeof(*arg); 569 req->in.args[0].size = sizeof(*arg);
diff --git a/fs/ioprio.c b/fs/ioprio.c
index 10d2c211d18b..d6ff77e8e7ec 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -25,6 +25,7 @@
25#include <linux/capability.h> 25#include <linux/capability.h>
26#include <linux/syscalls.h> 26#include <linux/syscalls.h>
27#include <linux/security.h> 27#include <linux/security.h>
28#include <linux/pid_namespace.h>
28 29
29static int set_task_ioprio(struct task_struct *task, int ioprio) 30static int set_task_ioprio(struct task_struct *task, int ioprio)
30{ 31{
@@ -93,7 +94,7 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
93 if (!who) 94 if (!who)
94 p = current; 95 p = current;
95 else 96 else
96 p = find_task_by_pid(who); 97 p = find_task_by_vpid(who);
97 if (p) 98 if (p)
98 ret = set_task_ioprio(p, ioprio); 99 ret = set_task_ioprio(p, ioprio);
99 break; 100 break;
@@ -101,7 +102,7 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
101 if (!who) 102 if (!who)
102 pgrp = task_pgrp(current); 103 pgrp = task_pgrp(current);
103 else 104 else
104 pgrp = find_pid(who); 105 pgrp = find_vpid(who);
105 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 106 do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
106 ret = set_task_ioprio(p, ioprio); 107 ret = set_task_ioprio(p, ioprio);
107 if (ret) 108 if (ret)
@@ -180,7 +181,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
180 if (!who) 181 if (!who)
181 p = current; 182 p = current;
182 else 183 else
183 p = find_task_by_pid(who); 184 p = find_task_by_vpid(who);
184 if (p) 185 if (p)
185 ret = get_task_ioprio(p); 186 ret = get_task_ioprio(p);
186 break; 187 break;
@@ -188,7 +189,7 @@ asmlinkage long sys_ioprio_get(int which, int who)
188 if (!who) 189 if (!who)
189 pgrp = task_pgrp(current); 190 pgrp = task_pgrp(current);
190 else 191 else
191 pgrp = find_pid(who); 192 pgrp = find_vpid(who);
192 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 193 do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
193 tmpio = get_task_ioprio(p); 194 tmpio = get_task_ioprio(p);
194 if (tmpio < 0) 195 if (tmpio < 0)
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index aa359a2e4ce6..09e3d306e96f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * (C) 1991 Linus Torvalds - minix filesystem 4 * (C) 1991 Linus Torvalds - minix filesystem
5 * 1992, 1993, 1994 Eric Youngdale Modified for ISO 9660 filesystem. 5 * 1992, 1993, 1994 Eric Youngdale Modified for ISO 9660 filesystem.
6 * 1994 Eberhard Moenkeberg - multi session handling. 6 * 1994 Eberhard Mönkeberg - multi session handling.
7 * 1995 Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs. 7 * 1995 Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs.
8 * 1997 Gordon Chaffee - Joliet CDs 8 * 1997 Gordon Chaffee - Joliet CDs
9 * 1998 Eric Lammerts - ISO 9660 Level 3 9 * 1998 Eric Lammerts - ISO 9660 Level 3
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index a003d50edcdb..8f1f2aa5fb39 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -375,7 +375,7 @@ void journal_commit_transaction(journal_t *journal)
375 struct buffer_head *bh = jh2bh(jh); 375 struct buffer_head *bh = jh2bh(jh);
376 376
377 jbd_lock_bh_state(bh); 377 jbd_lock_bh_state(bh);
378 jbd_slab_free(jh->b_committed_data, bh->b_size); 378 jbd_free(jh->b_committed_data, bh->b_size);
379 jh->b_committed_data = NULL; 379 jh->b_committed_data = NULL;
380 jbd_unlock_bh_state(bh); 380 jbd_unlock_bh_state(bh);
381 } 381 }
@@ -466,7 +466,7 @@ void journal_commit_transaction(journal_t *journal)
466 spin_unlock(&journal->j_list_lock); 466 spin_unlock(&journal->j_list_lock);
467 467
468 if (err) 468 if (err)
469 __journal_abort_hard(journal); 469 journal_abort(journal, err);
470 470
471 journal_write_revoke_records(journal, commit_transaction); 471 journal_write_revoke_records(journal, commit_transaction);
472 472
@@ -524,7 +524,7 @@ void journal_commit_transaction(journal_t *journal)
524 524
525 descriptor = journal_get_descriptor_buffer(journal); 525 descriptor = journal_get_descriptor_buffer(journal);
526 if (!descriptor) { 526 if (!descriptor) {
527 __journal_abort_hard(journal); 527 journal_abort(journal, -EIO);
528 continue; 528 continue;
529 } 529 }
530 530
@@ -557,7 +557,7 @@ void journal_commit_transaction(journal_t *journal)
557 and repeat this loop: we'll fall into the 557 and repeat this loop: we'll fall into the
558 refile-on-abort condition above. */ 558 refile-on-abort condition above. */
559 if (err) { 559 if (err) {
560 __journal_abort_hard(journal); 560 journal_abort(journal, err);
561 continue; 561 continue;
562 } 562 }
563 563
@@ -748,7 +748,7 @@ wait_for_iobuf:
748 err = -EIO; 748 err = -EIO;
749 749
750 if (err) 750 if (err)
751 __journal_abort_hard(journal); 751 journal_abort(journal, err);
752 752
753 /* End of a transaction! Finally, we can do checkpoint 753 /* End of a transaction! Finally, we can do checkpoint
754 processing: any buffers committed as a result of this 754 processing: any buffers committed as a result of this
@@ -792,14 +792,14 @@ restart_loop:
792 * Otherwise, we can just throw away the frozen data now. 792 * Otherwise, we can just throw away the frozen data now.
793 */ 793 */
794 if (jh->b_committed_data) { 794 if (jh->b_committed_data) {
795 jbd_slab_free(jh->b_committed_data, bh->b_size); 795 jbd_free(jh->b_committed_data, bh->b_size);
796 jh->b_committed_data = NULL; 796 jh->b_committed_data = NULL;
797 if (jh->b_frozen_data) { 797 if (jh->b_frozen_data) {
798 jh->b_committed_data = jh->b_frozen_data; 798 jh->b_committed_data = jh->b_frozen_data;
799 jh->b_frozen_data = NULL; 799 jh->b_frozen_data = NULL;
800 } 800 }
801 } else if (jh->b_frozen_data) { 801 } else if (jh->b_frozen_data) {
802 jbd_slab_free(jh->b_frozen_data, bh->b_size); 802 jbd_free(jh->b_frozen_data, bh->b_size);
803 jh->b_frozen_data = NULL; 803 jh->b_frozen_data = NULL;
804 } 804 }
805 805
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index a6be78c05dce..5d14243499d4 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -35,6 +35,7 @@
35#include <linux/kthread.h> 35#include <linux/kthread.h>
36#include <linux/poison.h> 36#include <linux/poison.h>
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/debugfs.h>
38 39
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40#include <asm/page.h> 41#include <asm/page.h>
@@ -83,7 +84,6 @@ EXPORT_SYMBOL(journal_force_commit);
83 84
84static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); 85static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *);
85static void __journal_abort_soft (journal_t *journal, int errno); 86static void __journal_abort_soft (journal_t *journal, int errno);
86static int journal_create_jbd_slab(size_t slab_size);
87 87
88/* 88/*
89 * Helper function used to manage commit timeouts 89 * Helper function used to manage commit timeouts
@@ -218,7 +218,7 @@ static int journal_start_thread(journal_t *journal)
218 if (IS_ERR(t)) 218 if (IS_ERR(t))
219 return PTR_ERR(t); 219 return PTR_ERR(t);
220 220
221 wait_event(journal->j_wait_done_commit, journal->j_task != 0); 221 wait_event(journal->j_wait_done_commit, journal->j_task != NULL);
222 return 0; 222 return 0;
223} 223}
224 224
@@ -230,7 +230,8 @@ static void journal_kill_thread(journal_t *journal)
230 while (journal->j_task) { 230 while (journal->j_task) {
231 wake_up(&journal->j_wait_commit); 231 wake_up(&journal->j_wait_commit);
232 spin_unlock(&journal->j_state_lock); 232 spin_unlock(&journal->j_state_lock);
233 wait_event(journal->j_wait_done_commit, journal->j_task == 0); 233 wait_event(journal->j_wait_done_commit,
234 journal->j_task == NULL);
234 spin_lock(&journal->j_state_lock); 235 spin_lock(&journal->j_state_lock);
235 } 236 }
236 spin_unlock(&journal->j_state_lock); 237 spin_unlock(&journal->j_state_lock);
@@ -334,10 +335,10 @@ repeat:
334 char *tmp; 335 char *tmp;
335 336
336 jbd_unlock_bh_state(bh_in); 337 jbd_unlock_bh_state(bh_in);
337 tmp = jbd_slab_alloc(bh_in->b_size, GFP_NOFS); 338 tmp = jbd_alloc(bh_in->b_size, GFP_NOFS);
338 jbd_lock_bh_state(bh_in); 339 jbd_lock_bh_state(bh_in);
339 if (jh_in->b_frozen_data) { 340 if (jh_in->b_frozen_data) {
340 jbd_slab_free(tmp, bh_in->b_size); 341 jbd_free(tmp, bh_in->b_size);
341 goto repeat; 342 goto repeat;
342 } 343 }
343 344
@@ -654,10 +655,9 @@ static journal_t * journal_init_common (void)
654 journal_t *journal; 655 journal_t *journal;
655 int err; 656 int err;
656 657
657 journal = jbd_kmalloc(sizeof(*journal), GFP_KERNEL); 658 journal = kzalloc(sizeof(*journal), GFP_KERNEL);
658 if (!journal) 659 if (!journal)
659 goto fail; 660 goto fail;
660 memset(journal, 0, sizeof(*journal));
661 661
662 init_waitqueue_head(&journal->j_wait_transaction_locked); 662 init_waitqueue_head(&journal->j_wait_transaction_locked);
663 init_waitqueue_head(&journal->j_wait_logspace); 663 init_waitqueue_head(&journal->j_wait_logspace);
@@ -1095,13 +1095,6 @@ int journal_load(journal_t *journal)
1095 } 1095 }
1096 } 1096 }
1097 1097
1098 /*
1099 * Create a slab for this blocksize
1100 */
1101 err = journal_create_jbd_slab(be32_to_cpu(sb->s_blocksize));
1102 if (err)
1103 return err;
1104
1105 /* Let the recovery code check whether it needs to recover any 1098 /* Let the recovery code check whether it needs to recover any
1106 * data from the journal. */ 1099 * data from the journal. */
1107 if (journal_recover(journal)) 1100 if (journal_recover(journal))
@@ -1615,86 +1608,6 @@ int journal_blocks_per_page(struct inode *inode)
1615} 1608}
1616 1609
1617/* 1610/*
1618 * Simple support for retrying memory allocations. Introduced to help to
1619 * debug different VM deadlock avoidance strategies.
1620 */
1621void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry)
1622{
1623 return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0));
1624}
1625
1626/*
1627 * jbd slab management: create 1k, 2k, 4k, 8k slabs as needed
1628 * and allocate frozen and commit buffers from these slabs.
1629 *
1630 * Reason for doing this is to avoid, SLAB_DEBUG - since it could
1631 * cause bh to cross page boundary.
1632 */
1633
1634#define JBD_MAX_SLABS 5
1635#define JBD_SLAB_INDEX(size) (size >> 11)
1636
1637static struct kmem_cache *jbd_slab[JBD_MAX_SLABS];
1638static const char *jbd_slab_names[JBD_MAX_SLABS] = {
1639 "jbd_1k", "jbd_2k", "jbd_4k", NULL, "jbd_8k"
1640};
1641
1642static void journal_destroy_jbd_slabs(void)
1643{
1644 int i;
1645
1646 for (i = 0; i < JBD_MAX_SLABS; i++) {
1647 if (jbd_slab[i])
1648 kmem_cache_destroy(jbd_slab[i]);
1649 jbd_slab[i] = NULL;
1650 }
1651}
1652
1653static int journal_create_jbd_slab(size_t slab_size)
1654{
1655 int i = JBD_SLAB_INDEX(slab_size);
1656
1657 BUG_ON(i >= JBD_MAX_SLABS);
1658
1659 /*
1660 * Check if we already have a slab created for this size
1661 */
1662 if (jbd_slab[i])
1663 return 0;
1664
1665 /*
1666 * Create a slab and force alignment to be same as slabsize -
1667 * this will make sure that allocations won't cross the page
1668 * boundary.
1669 */
1670 jbd_slab[i] = kmem_cache_create(jbd_slab_names[i],
1671 slab_size, slab_size, 0, NULL);
1672 if (!jbd_slab[i]) {
1673 printk(KERN_EMERG "JBD: no memory for jbd_slab cache\n");
1674 return -ENOMEM;
1675 }
1676 return 0;
1677}
1678
1679void * jbd_slab_alloc(size_t size, gfp_t flags)
1680{
1681 int idx;
1682
1683 idx = JBD_SLAB_INDEX(size);
1684 BUG_ON(jbd_slab[idx] == NULL);
1685 return kmem_cache_alloc(jbd_slab[idx], flags | __GFP_NOFAIL);
1686}
1687
1688void jbd_slab_free(void *ptr, size_t size)
1689{
1690 int idx;
1691
1692 idx = JBD_SLAB_INDEX(size);
1693 BUG_ON(jbd_slab[idx] == NULL);
1694 kmem_cache_free(jbd_slab[idx], ptr);
1695}
1696
1697/*
1698 * Journal_head storage management 1611 * Journal_head storage management
1699 */ 1612 */
1700static struct kmem_cache *journal_head_cache; 1613static struct kmem_cache *journal_head_cache;
@@ -1739,14 +1652,14 @@ static struct journal_head *journal_alloc_journal_head(void)
1739 atomic_inc(&nr_journal_heads); 1652 atomic_inc(&nr_journal_heads);
1740#endif 1653#endif
1741 ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); 1654 ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
1742 if (ret == 0) { 1655 if (ret == NULL) {
1743 jbd_debug(1, "out of memory for journal_head\n"); 1656 jbd_debug(1, "out of memory for journal_head\n");
1744 if (time_after(jiffies, last_warning + 5*HZ)) { 1657 if (time_after(jiffies, last_warning + 5*HZ)) {
1745 printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", 1658 printk(KERN_NOTICE "ENOMEM in %s, retrying.\n",
1746 __FUNCTION__); 1659 __FUNCTION__);
1747 last_warning = jiffies; 1660 last_warning = jiffies;
1748 } 1661 }
1749 while (ret == 0) { 1662 while (ret == NULL) {
1750 yield(); 1663 yield();
1751 ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS); 1664 ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
1752 } 1665 }
@@ -1881,13 +1794,13 @@ static void __journal_remove_journal_head(struct buffer_head *bh)
1881 printk(KERN_WARNING "%s: freeing " 1794 printk(KERN_WARNING "%s: freeing "
1882 "b_frozen_data\n", 1795 "b_frozen_data\n",
1883 __FUNCTION__); 1796 __FUNCTION__);
1884 jbd_slab_free(jh->b_frozen_data, bh->b_size); 1797 jbd_free(jh->b_frozen_data, bh->b_size);
1885 } 1798 }
1886 if (jh->b_committed_data) { 1799 if (jh->b_committed_data) {
1887 printk(KERN_WARNING "%s: freeing " 1800 printk(KERN_WARNING "%s: freeing "
1888 "b_committed_data\n", 1801 "b_committed_data\n",
1889 __FUNCTION__); 1802 __FUNCTION__);
1890 jbd_slab_free(jh->b_committed_data, bh->b_size); 1803 jbd_free(jh->b_committed_data, bh->b_size);
1891 } 1804 }
1892 bh->b_private = NULL; 1805 bh->b_private = NULL;
1893 jh->b_bh = NULL; /* debug, really */ 1806 jh->b_bh = NULL; /* debug, really */
@@ -1939,64 +1852,41 @@ void journal_put_journal_head(struct journal_head *jh)
1939} 1852}
1940 1853
1941/* 1854/*
1942 * /proc tunables 1855 * debugfs tunables
1943 */ 1856 */
1944#if defined(CONFIG_JBD_DEBUG) 1857#ifdef CONFIG_JBD_DEBUG
1945int journal_enable_debug;
1946EXPORT_SYMBOL(journal_enable_debug);
1947#endif
1948 1858
1949#if defined(CONFIG_JBD_DEBUG) && defined(CONFIG_PROC_FS) 1859u8 journal_enable_debug __read_mostly;
1860EXPORT_SYMBOL(journal_enable_debug);
1950 1861
1951static struct proc_dir_entry *proc_jbd_debug; 1862static struct dentry *jbd_debugfs_dir;
1863static struct dentry *jbd_debug;
1952 1864
1953static int read_jbd_debug(char *page, char **start, off_t off, 1865static void __init jbd_create_debugfs_entry(void)
1954 int count, int *eof, void *data)
1955{ 1866{
1956 int ret; 1867 jbd_debugfs_dir = debugfs_create_dir("jbd", NULL);
1957 1868 if (jbd_debugfs_dir)
1958 ret = sprintf(page + off, "%d\n", journal_enable_debug); 1869 jbd_debug = debugfs_create_u8("jbd-debug", S_IRUGO,
1959 *eof = 1; 1870 jbd_debugfs_dir,
1960 return ret; 1871 &journal_enable_debug);
1961} 1872}
1962 1873
1963static int write_jbd_debug(struct file *file, const char __user *buffer, 1874static void __exit jbd_remove_debugfs_entry(void)
1964 unsigned long count, void *data)
1965{ 1875{
1966 char buf[32]; 1876 debugfs_remove(jbd_debug);
1967 1877 debugfs_remove(jbd_debugfs_dir);
1968 if (count > ARRAY_SIZE(buf) - 1)
1969 count = ARRAY_SIZE(buf) - 1;
1970 if (copy_from_user(buf, buffer, count))
1971 return -EFAULT;
1972 buf[ARRAY_SIZE(buf) - 1] = '\0';
1973 journal_enable_debug = simple_strtoul(buf, NULL, 10);
1974 return count;
1975} 1878}
1976 1879
1977#define JBD_PROC_NAME "sys/fs/jbd-debug" 1880#else
1978 1881
1979static void __init create_jbd_proc_entry(void) 1882static inline void jbd_create_debugfs_entry(void)
1980{ 1883{
1981 proc_jbd_debug = create_proc_entry(JBD_PROC_NAME, 0644, NULL);
1982 if (proc_jbd_debug) {
1983 /* Why is this so hard? */
1984 proc_jbd_debug->read_proc = read_jbd_debug;
1985 proc_jbd_debug->write_proc = write_jbd_debug;
1986 }
1987} 1884}
1988 1885
1989static void __exit remove_jbd_proc_entry(void) 1886static inline void jbd_remove_debugfs_entry(void)
1990{ 1887{
1991 if (proc_jbd_debug)
1992 remove_proc_entry(JBD_PROC_NAME, NULL);
1993} 1888}
1994 1889
1995#else
1996
1997#define create_jbd_proc_entry() do {} while (0)
1998#define remove_jbd_proc_entry() do {} while (0)
1999
2000#endif 1890#endif
2001 1891
2002struct kmem_cache *jbd_handle_cache; 1892struct kmem_cache *jbd_handle_cache;
@@ -2042,7 +1932,6 @@ static void journal_destroy_caches(void)
2042 journal_destroy_revoke_caches(); 1932 journal_destroy_revoke_caches();
2043 journal_destroy_journal_head_cache(); 1933 journal_destroy_journal_head_cache();
2044 journal_destroy_handle_cache(); 1934 journal_destroy_handle_cache();
2045 journal_destroy_jbd_slabs();
2046} 1935}
2047 1936
2048static int __init journal_init(void) 1937static int __init journal_init(void)
@@ -2054,7 +1943,7 @@ static int __init journal_init(void)
2054 ret = journal_init_caches(); 1943 ret = journal_init_caches();
2055 if (ret != 0) 1944 if (ret != 0)
2056 journal_destroy_caches(); 1945 journal_destroy_caches();
2057 create_jbd_proc_entry(); 1946 jbd_create_debugfs_entry();
2058 return ret; 1947 return ret;
2059} 1948}
2060 1949
@@ -2065,7 +1954,7 @@ static void __exit journal_exit(void)
2065 if (n) 1954 if (n)
2066 printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n); 1955 printk(KERN_EMERG "JBD: leaked %d journal_heads!\n", n);
2067#endif 1956#endif
2068 remove_jbd_proc_entry(); 1957 jbd_remove_debugfs_entry();
2069 journal_destroy_caches(); 1958 journal_destroy_caches();
2070} 1959}
2071 1960
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c
index 2a5f4b833e35..c5d9694b6a2f 100644
--- a/fs/jbd/recovery.c
+++ b/fs/jbd/recovery.c
@@ -250,10 +250,10 @@ int journal_recover(journal_t *journal)
250 if (!err) 250 if (!err)
251 err = do_one_pass(journal, &info, PASS_REPLAY); 251 err = do_one_pass(journal, &info, PASS_REPLAY);
252 252
253 jbd_debug(0, "JBD: recovery, exit status %d, " 253 jbd_debug(1, "JBD: recovery, exit status %d, "
254 "recovered transactions %u to %u\n", 254 "recovered transactions %u to %u\n",
255 err, info.start_transaction, info.end_transaction); 255 err, info.start_transaction, info.end_transaction);
256 jbd_debug(0, "JBD: Replayed %d and revoked %d/%d blocks\n", 256 jbd_debug(1, "JBD: Replayed %d and revoked %d/%d blocks\n",
257 info.nr_replays, info.nr_revoke_hits, info.nr_revokes); 257 info.nr_replays, info.nr_revoke_hits, info.nr_revokes);
258 258
259 /* Restart the log at the next transaction ID, thus invalidating 259 /* Restart the log at the next transaction ID, thus invalidating
@@ -297,7 +297,7 @@ int journal_skip_recovery(journal_t *journal)
297#ifdef CONFIG_JBD_DEBUG 297#ifdef CONFIG_JBD_DEBUG
298 int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); 298 int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence);
299#endif 299#endif
300 jbd_debug(0, 300 jbd_debug(1,
301 "JBD: ignoring %d transaction%s from the journal.\n", 301 "JBD: ignoring %d transaction%s from the journal.\n",
302 dropped, (dropped == 1) ? "" : "s"); 302 dropped, (dropped == 1) ? "" : "s");
303 journal->j_transaction_sequence = ++info.end_transaction; 303 journal->j_transaction_sequence = ++info.end_transaction;
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index 8df5bac0b7a5..08ff6c7028cc 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -96,13 +96,12 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
96 96
97alloc_transaction: 97alloc_transaction:
98 if (!journal->j_running_transaction) { 98 if (!journal->j_running_transaction) {
99 new_transaction = jbd_kmalloc(sizeof(*new_transaction), 99 new_transaction = kzalloc(sizeof(*new_transaction),
100 GFP_NOFS); 100 GFP_NOFS|__GFP_NOFAIL);
101 if (!new_transaction) { 101 if (!new_transaction) {
102 ret = -ENOMEM; 102 ret = -ENOMEM;
103 goto out; 103 goto out;
104 } 104 }
105 memset(new_transaction, 0, sizeof(*new_transaction));
106 } 105 }
107 106
108 jbd_debug(3, "New handle %p going live.\n", handle); 107 jbd_debug(3, "New handle %p going live.\n", handle);
@@ -675,7 +674,7 @@ repeat:
675 JBUFFER_TRACE(jh, "allocate memory for buffer"); 674 JBUFFER_TRACE(jh, "allocate memory for buffer");
676 jbd_unlock_bh_state(bh); 675 jbd_unlock_bh_state(bh);
677 frozen_buffer = 676 frozen_buffer =
678 jbd_slab_alloc(jh2bh(jh)->b_size, 677 jbd_alloc(jh2bh(jh)->b_size,
679 GFP_NOFS); 678 GFP_NOFS);
680 if (!frozen_buffer) { 679 if (!frozen_buffer) {
681 printk(KERN_EMERG 680 printk(KERN_EMERG
@@ -735,7 +734,7 @@ done:
735 734
736out: 735out:
737 if (unlikely(frozen_buffer)) /* It's usually NULL */ 736 if (unlikely(frozen_buffer)) /* It's usually NULL */
738 jbd_slab_free(frozen_buffer, bh->b_size); 737 jbd_free(frozen_buffer, bh->b_size);
739 738
740 JBUFFER_TRACE(jh, "exit"); 739 JBUFFER_TRACE(jh, "exit");
741 return error; 740 return error;
@@ -888,7 +887,7 @@ int journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
888 887
889repeat: 888repeat:
890 if (!jh->b_committed_data) { 889 if (!jh->b_committed_data) {
891 committed_data = jbd_slab_alloc(jh2bh(jh)->b_size, GFP_NOFS); 890 committed_data = jbd_alloc(jh2bh(jh)->b_size, GFP_NOFS);
892 if (!committed_data) { 891 if (!committed_data) {
893 printk(KERN_EMERG "%s: No memory for committed data\n", 892 printk(KERN_EMERG "%s: No memory for committed data\n",
894 __FUNCTION__); 893 __FUNCTION__);
@@ -915,7 +914,7 @@ repeat:
915out: 914out:
916 journal_put_journal_head(jh); 915 journal_put_journal_head(jh);
917 if (unlikely(committed_data)) 916 if (unlikely(committed_data))
918 jbd_slab_free(committed_data, bh->b_size); 917 jbd_free(committed_data, bh->b_size);
919 return err; 918 return err;
920} 919}
921 920
@@ -1172,7 +1171,7 @@ int journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
1172 } 1171 }
1173 1172
1174 /* That test should have eliminated the following case: */ 1173 /* That test should have eliminated the following case: */
1175 J_ASSERT_JH(jh, jh->b_frozen_data == 0); 1174 J_ASSERT_JH(jh, jh->b_frozen_data == NULL);
1176 1175
1177 JBUFFER_TRACE(jh, "file as BJ_Metadata"); 1176 JBUFFER_TRACE(jh, "file as BJ_Metadata");
1178 spin_lock(&journal->j_list_lock); 1177 spin_lock(&journal->j_list_lock);
@@ -1522,7 +1521,7 @@ static void __journal_temp_unlink_buffer(struct journal_head *jh)
1522 1521
1523 J_ASSERT_JH(jh, jh->b_jlist < BJ_Types); 1522 J_ASSERT_JH(jh, jh->b_jlist < BJ_Types);
1524 if (jh->b_jlist != BJ_None) 1523 if (jh->b_jlist != BJ_None)
1525 J_ASSERT_JH(jh, transaction != 0); 1524 J_ASSERT_JH(jh, transaction != NULL);
1526 1525
1527 switch (jh->b_jlist) { 1526 switch (jh->b_jlist) {
1528 case BJ_None: 1527 case BJ_None:
@@ -1591,11 +1590,11 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
1591 if (buffer_locked(bh) || buffer_dirty(bh)) 1590 if (buffer_locked(bh) || buffer_dirty(bh))
1592 goto out; 1591 goto out;
1593 1592
1594 if (jh->b_next_transaction != 0) 1593 if (jh->b_next_transaction != NULL)
1595 goto out; 1594 goto out;
1596 1595
1597 spin_lock(&journal->j_list_lock); 1596 spin_lock(&journal->j_list_lock);
1598 if (jh->b_transaction != 0 && jh->b_cp_transaction == 0) { 1597 if (jh->b_transaction != NULL && jh->b_cp_transaction == NULL) {
1599 if (jh->b_jlist == BJ_SyncData || jh->b_jlist == BJ_Locked) { 1598 if (jh->b_jlist == BJ_SyncData || jh->b_jlist == BJ_Locked) {
1600 /* A written-back ordered data buffer */ 1599 /* A written-back ordered data buffer */
1601 JBUFFER_TRACE(jh, "release data"); 1600 JBUFFER_TRACE(jh, "release data");
@@ -1603,7 +1602,7 @@ __journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)
1603 journal_remove_journal_head(bh); 1602 journal_remove_journal_head(bh);
1604 __brelse(bh); 1603 __brelse(bh);
1605 } 1604 }
1606 } else if (jh->b_cp_transaction != 0 && jh->b_transaction == 0) { 1605 } else if (jh->b_cp_transaction != NULL && jh->b_transaction == NULL) {
1607 /* written-back checkpointed metadata buffer */ 1606 /* written-back checkpointed metadata buffer */
1608 if (jh->b_jlist == BJ_None) { 1607 if (jh->b_jlist == BJ_None) {
1609 JBUFFER_TRACE(jh, "remove from checkpoint list"); 1608 JBUFFER_TRACE(jh, "remove from checkpoint list");
@@ -1963,7 +1962,7 @@ void __journal_file_buffer(struct journal_head *jh,
1963 1962
1964 J_ASSERT_JH(jh, jh->b_jlist < BJ_Types); 1963 J_ASSERT_JH(jh, jh->b_jlist < BJ_Types);
1965 J_ASSERT_JH(jh, jh->b_transaction == transaction || 1964 J_ASSERT_JH(jh, jh->b_transaction == transaction ||
1966 jh->b_transaction == 0); 1965 jh->b_transaction == NULL);
1967 1966
1968 if (jh->b_transaction && jh->b_jlist == jlist) 1967 if (jh->b_transaction && jh->b_jlist == jlist)
1969 return; 1968 return;
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index c0f59d1b13dc..6986f334c643 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -278,7 +278,7 @@ static inline void write_tag_block(int tag_bytes, journal_block_tag_t *tag,
278 unsigned long long block) 278 unsigned long long block)
279{ 279{
280 tag->t_blocknr = cpu_to_be32(block & (u32)~0); 280 tag->t_blocknr = cpu_to_be32(block & (u32)~0);
281 if (tag_bytes > JBD_TAG_SIZE32) 281 if (tag_bytes > JBD2_TAG_SIZE32)
282 tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1); 282 tag->t_blocknr_high = cpu_to_be32((block >> 31) >> 1);
283} 283}
284 284
@@ -384,7 +384,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
384 struct buffer_head *bh = jh2bh(jh); 384 struct buffer_head *bh = jh2bh(jh);
385 385
386 jbd_lock_bh_state(bh); 386 jbd_lock_bh_state(bh);
387 jbd2_slab_free(jh->b_committed_data, bh->b_size); 387 jbd2_free(jh->b_committed_data, bh->b_size);
388 jh->b_committed_data = NULL; 388 jh->b_committed_data = NULL;
389 jbd_unlock_bh_state(bh); 389 jbd_unlock_bh_state(bh);
390 } 390 }
@@ -475,7 +475,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
475 spin_unlock(&journal->j_list_lock); 475 spin_unlock(&journal->j_list_lock);
476 476
477 if (err) 477 if (err)
478 __jbd2_journal_abort_hard(journal); 478 jbd2_journal_abort(journal, err);
479 479
480 jbd2_journal_write_revoke_records(journal, commit_transaction); 480 jbd2_journal_write_revoke_records(journal, commit_transaction);
481 481
@@ -533,7 +533,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
533 533
534 descriptor = jbd2_journal_get_descriptor_buffer(journal); 534 descriptor = jbd2_journal_get_descriptor_buffer(journal);
535 if (!descriptor) { 535 if (!descriptor) {
536 __jbd2_journal_abort_hard(journal); 536 jbd2_journal_abort(journal, -EIO);
537 continue; 537 continue;
538 } 538 }
539 539
@@ -566,7 +566,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
566 and repeat this loop: we'll fall into the 566 and repeat this loop: we'll fall into the
567 refile-on-abort condition above. */ 567 refile-on-abort condition above. */
568 if (err) { 568 if (err) {
569 __jbd2_journal_abort_hard(journal); 569 jbd2_journal_abort(journal, err);
570 continue; 570 continue;
571 } 571 }
572 572
@@ -757,7 +757,7 @@ wait_for_iobuf:
757 err = -EIO; 757 err = -EIO;
758 758
759 if (err) 759 if (err)
760 __jbd2_journal_abort_hard(journal); 760 jbd2_journal_abort(journal, err);
761 761
762 /* End of a transaction! Finally, we can do checkpoint 762 /* End of a transaction! Finally, we can do checkpoint
763 processing: any buffers committed as a result of this 763 processing: any buffers committed as a result of this
@@ -801,14 +801,14 @@ restart_loop:
801 * Otherwise, we can just throw away the frozen data now. 801 * Otherwise, we can just throw away the frozen data now.
802 */ 802 */
803 if (jh->b_committed_data) { 803 if (jh->b_committed_data) {
804 jbd2_slab_free(jh->b_committed_data, bh->b_size); 804 jbd2_free(jh->b_committed_data, bh->b_size);
805 jh->b_committed_data = NULL; 805 jh->b_committed_data = NULL;
806 if (jh->b_frozen_data) { 806 if (jh->b_frozen_data) {
807 jh->b_committed_data = jh->b_frozen_data; 807 jh->b_committed_data = jh->b_frozen_data;
808 jh->b_frozen_data = NULL; 808 jh->b_frozen_data = NULL;
809 } 809 }
810 } else if (jh->b_frozen_data) { 810 } else if (jh->b_frozen_data) {
811 jbd2_slab_free(jh->b_frozen_data, bh->b_size); 811 jbd2_free(jh->b_frozen_data, bh->b_size);
812 jh->b_frozen_data = NULL; 812 jh->b_frozen_data = NULL;
813 } 813 }
814 814
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index f37324aee817..6ddc5531587c 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -84,7 +84,6 @@ EXPORT_SYMBOL(jbd2_journal_force_commit);
84 84
85static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *); 85static int journal_convert_superblock_v1(journal_t *, journal_superblock_t *);
86static void __journal_abort_soft (journal_t *journal, int errno); 86static void __journal_abort_soft (journal_t *journal, int errno);
87static int jbd2_journal_create_jbd_slab(size_t slab_size);
88 87
89/* 88/*
90 * Helper function used to manage commit timeouts 89 * Helper function used to manage commit timeouts
@@ -335,10 +334,10 @@ repeat:
335 char *tmp; 334 char *tmp;
336 335
337 jbd_unlock_bh_state(bh_in); 336 jbd_unlock_bh_state(bh_in);
338 tmp = jbd2_slab_alloc(bh_in->b_size, GFP_NOFS); 337 tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
339 jbd_lock_bh_state(bh_in); 338 jbd_lock_bh_state(bh_in);
340 if (jh_in->b_frozen_data) { 339 if (jh_in->b_frozen_data) {
341 jbd2_slab_free(tmp, bh_in->b_size); 340 jbd2_free(tmp, bh_in->b_size);
342 goto repeat; 341 goto repeat;
343 } 342 }
344 343
@@ -655,10 +654,9 @@ static journal_t * journal_init_common (void)
655 journal_t *journal; 654 journal_t *journal;
656 int err; 655 int err;
657 656
658 journal = jbd_kmalloc(sizeof(*journal), GFP_KERNEL); 657 journal = kzalloc(sizeof(*journal), GFP_KERNEL|__GFP_NOFAIL);
659 if (!journal) 658 if (!journal)
660 goto fail; 659 goto fail;
661 memset(journal, 0, sizeof(*journal));
662 660
663 init_waitqueue_head(&journal->j_wait_transaction_locked); 661 init_waitqueue_head(&journal->j_wait_transaction_locked);
664 init_waitqueue_head(&journal->j_wait_logspace); 662 init_waitqueue_head(&journal->j_wait_logspace);
@@ -672,7 +670,7 @@ static journal_t * journal_init_common (void)
672 spin_lock_init(&journal->j_list_lock); 670 spin_lock_init(&journal->j_list_lock);
673 spin_lock_init(&journal->j_state_lock); 671 spin_lock_init(&journal->j_state_lock);
674 672
675 journal->j_commit_interval = (HZ * JBD_DEFAULT_MAX_COMMIT_AGE); 673 journal->j_commit_interval = (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE);
676 674
677 /* The journal is marked for error until we succeed with recovery! */ 675 /* The journal is marked for error until we succeed with recovery! */
678 journal->j_flags = JBD2_ABORT; 676 journal->j_flags = JBD2_ABORT;
@@ -1096,13 +1094,6 @@ int jbd2_journal_load(journal_t *journal)
1096 } 1094 }
1097 } 1095 }
1098 1096
1099 /*
1100 * Create a slab for this blocksize
1101 */
1102 err = jbd2_journal_create_jbd_slab(be32_to_cpu(sb->s_blocksize));
1103 if (err)
1104 return err;
1105
1106 /* Let the recovery code check whether it needs to recover any 1097 /* Let the recovery code check whether it needs to recover any
1107 * data from the journal. */ 1098 * data from the journal. */
1108 if (jbd2_journal_recover(journal)) 1099 if (jbd2_journal_recover(journal))
@@ -1621,89 +1612,9 @@ int jbd2_journal_blocks_per_page(struct inode *inode)
1621size_t journal_tag_bytes(journal_t *journal) 1612size_t journal_tag_bytes(journal_t *journal)
1622{ 1613{
1623 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT)) 1614 if (JBD2_HAS_INCOMPAT_FEATURE(journal, JBD2_FEATURE_INCOMPAT_64BIT))
1624 return JBD_TAG_SIZE64; 1615 return JBD2_TAG_SIZE64;
1625 else 1616 else
1626 return JBD_TAG_SIZE32; 1617 return JBD2_TAG_SIZE32;
1627}
1628
1629/*
1630 * Simple support for retrying memory allocations. Introduced to help to
1631 * debug different VM deadlock avoidance strategies.
1632 */
1633void * __jbd2_kmalloc (const char *where, size_t size, gfp_t flags, int retry)
1634{
1635 return kmalloc(size, flags | (retry ? __GFP_NOFAIL : 0));
1636}
1637
1638/*
1639 * jbd slab management: create 1k, 2k, 4k, 8k slabs as needed
1640 * and allocate frozen and commit buffers from these slabs.
1641 *
1642 * Reason for doing this is to avoid, SLAB_DEBUG - since it could
1643 * cause bh to cross page boundary.
1644 */
1645
1646#define JBD_MAX_SLABS 5
1647#define JBD_SLAB_INDEX(size) (size >> 11)
1648
1649static struct kmem_cache *jbd_slab[JBD_MAX_SLABS];
1650static const char *jbd_slab_names[JBD_MAX_SLABS] = {
1651 "jbd2_1k", "jbd2_2k", "jbd2_4k", NULL, "jbd2_8k"
1652};
1653
1654static void jbd2_journal_destroy_jbd_slabs(void)
1655{
1656 int i;
1657
1658 for (i = 0; i < JBD_MAX_SLABS; i++) {
1659 if (jbd_slab[i])
1660 kmem_cache_destroy(jbd_slab[i]);
1661 jbd_slab[i] = NULL;
1662 }
1663}
1664
1665static int jbd2_journal_create_jbd_slab(size_t slab_size)
1666{
1667 int i = JBD_SLAB_INDEX(slab_size);
1668
1669 BUG_ON(i >= JBD_MAX_SLABS);
1670
1671 /*
1672 * Check if we already have a slab created for this size
1673 */
1674 if (jbd_slab[i])
1675 return 0;
1676
1677 /*
1678 * Create a slab and force alignment to be same as slabsize -
1679 * this will make sure that allocations won't cross the page
1680 * boundary.
1681 */
1682 jbd_slab[i] = kmem_cache_create(jbd_slab_names[i],
1683 slab_size, slab_size, 0, NULL);
1684 if (!jbd_slab[i]) {
1685 printk(KERN_EMERG "JBD: no memory for jbd_slab cache\n");
1686 return -ENOMEM;
1687 }
1688 return 0;
1689}
1690
1691void * jbd2_slab_alloc(size_t size, gfp_t flags)
1692{
1693 int idx;
1694
1695 idx = JBD_SLAB_INDEX(size);
1696 BUG_ON(jbd_slab[idx] == NULL);
1697 return kmem_cache_alloc(jbd_slab[idx], flags | __GFP_NOFAIL);
1698}
1699
1700void jbd2_slab_free(void *ptr, size_t size)
1701{
1702 int idx;
1703
1704 idx = JBD_SLAB_INDEX(size);
1705 BUG_ON(jbd_slab[idx] == NULL);
1706 kmem_cache_free(jbd_slab[idx], ptr);
1707} 1618}
1708 1619
1709/* 1620/*
@@ -1770,7 +1681,7 @@ static void journal_free_journal_head(struct journal_head *jh)
1770{ 1681{
1771#ifdef CONFIG_JBD2_DEBUG 1682#ifdef CONFIG_JBD2_DEBUG
1772 atomic_dec(&nr_journal_heads); 1683 atomic_dec(&nr_journal_heads);
1773 memset(jh, JBD_POISON_FREE, sizeof(*jh)); 1684 memset(jh, JBD2_POISON_FREE, sizeof(*jh));
1774#endif 1685#endif
1775 kmem_cache_free(jbd2_journal_head_cache, jh); 1686 kmem_cache_free(jbd2_journal_head_cache, jh);
1776} 1687}
@@ -1893,13 +1804,13 @@ static void __journal_remove_journal_head(struct buffer_head *bh)
1893 printk(KERN_WARNING "%s: freeing " 1804 printk(KERN_WARNING "%s: freeing "
1894 "b_frozen_data\n", 1805 "b_frozen_data\n",
1895 __FUNCTION__); 1806 __FUNCTION__);
1896 jbd2_slab_free(jh->b_frozen_data, bh->b_size); 1807 jbd2_free(jh->b_frozen_data, bh->b_size);
1897 } 1808 }
1898 if (jh->b_committed_data) { 1809 if (jh->b_committed_data) {
1899 printk(KERN_WARNING "%s: freeing " 1810 printk(KERN_WARNING "%s: freeing "
1900 "b_committed_data\n", 1811 "b_committed_data\n",
1901 __FUNCTION__); 1812 __FUNCTION__);
1902 jbd2_slab_free(jh->b_committed_data, bh->b_size); 1813 jbd2_free(jh->b_committed_data, bh->b_size);
1903 } 1814 }
1904 bh->b_private = NULL; 1815 bh->b_private = NULL;
1905 jh->b_bh = NULL; /* debug, really */ 1816 jh->b_bh = NULL; /* debug, really */
@@ -1953,16 +1864,14 @@ void jbd2_journal_put_journal_head(struct journal_head *jh)
1953/* 1864/*
1954 * debugfs tunables 1865 * debugfs tunables
1955 */ 1866 */
1956#if defined(CONFIG_JBD2_DEBUG) 1867#ifdef CONFIG_JBD2_DEBUG
1957u8 jbd2_journal_enable_debug; 1868u8 jbd2_journal_enable_debug __read_mostly;
1958EXPORT_SYMBOL(jbd2_journal_enable_debug); 1869EXPORT_SYMBOL(jbd2_journal_enable_debug);
1959#endif
1960
1961#if defined(CONFIG_JBD2_DEBUG) && defined(CONFIG_DEBUG_FS)
1962 1870
1963#define JBD2_DEBUG_NAME "jbd2-debug" 1871#define JBD2_DEBUG_NAME "jbd2-debug"
1964 1872
1965struct dentry *jbd2_debugfs_dir, *jbd2_debug; 1873static struct dentry *jbd2_debugfs_dir;
1874static struct dentry *jbd2_debug;
1966 1875
1967static void __init jbd2_create_debugfs_entry(void) 1876static void __init jbd2_create_debugfs_entry(void)
1968{ 1877{
@@ -1975,24 +1884,18 @@ static void __init jbd2_create_debugfs_entry(void)
1975 1884
1976static void __exit jbd2_remove_debugfs_entry(void) 1885static void __exit jbd2_remove_debugfs_entry(void)
1977{ 1886{
1978 if (jbd2_debug) 1887 debugfs_remove(jbd2_debug);
1979 debugfs_remove(jbd2_debug); 1888 debugfs_remove(jbd2_debugfs_dir);
1980 if (jbd2_debugfs_dir)
1981 debugfs_remove(jbd2_debugfs_dir);
1982} 1889}
1983 1890
1984#else 1891#else
1985 1892
1986static void __init jbd2_create_debugfs_entry(void) 1893static void __init jbd2_create_debugfs_entry(void)
1987{ 1894{
1988 do {
1989 } while (0);
1990} 1895}
1991 1896
1992static void __exit jbd2_remove_debugfs_entry(void) 1897static void __exit jbd2_remove_debugfs_entry(void)
1993{ 1898{
1994 do {
1995 } while (0);
1996} 1899}
1997 1900
1998#endif 1901#endif
@@ -2040,7 +1943,6 @@ static void jbd2_journal_destroy_caches(void)
2040 jbd2_journal_destroy_revoke_caches(); 1943 jbd2_journal_destroy_revoke_caches();
2041 jbd2_journal_destroy_jbd2_journal_head_cache(); 1944 jbd2_journal_destroy_jbd2_journal_head_cache();
2042 jbd2_journal_destroy_handle_cache(); 1945 jbd2_journal_destroy_handle_cache();
2043 jbd2_journal_destroy_jbd_slabs();
2044} 1946}
2045 1947
2046static int __init journal_init(void) 1948static int __init journal_init(void)
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index b50be8a044eb..d0ce627539ef 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -311,7 +311,7 @@ int jbd2_journal_skip_recovery(journal_t *journal)
311static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag) 311static inline unsigned long long read_tag_block(int tag_bytes, journal_block_tag_t *tag)
312{ 312{
313 unsigned long long block = be32_to_cpu(tag->t_blocknr); 313 unsigned long long block = be32_to_cpu(tag->t_blocknr);
314 if (tag_bytes > JBD_TAG_SIZE32) 314 if (tag_bytes > JBD2_TAG_SIZE32)
315 block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32; 315 block |= (u64)be32_to_cpu(tag->t_blocknr_high) << 32;
316 return block; 316 return block;
317} 317}
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index 01d88975e0c5..3595fd432d5b 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -352,7 +352,7 @@ int jbd2_journal_revoke(handle_t *handle, unsigned long long blocknr,
352 if (bh) 352 if (bh)
353 BUFFER_TRACE(bh, "found on hash"); 353 BUFFER_TRACE(bh, "found on hash");
354 } 354 }
355#ifdef JBD_EXPENSIVE_CHECKING 355#ifdef JBD2_EXPENSIVE_CHECKING
356 else { 356 else {
357 struct buffer_head *bh2; 357 struct buffer_head *bh2;
358 358
@@ -453,7 +453,7 @@ int jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh)
453 } 453 }
454 } 454 }
455 455
456#ifdef JBD_EXPENSIVE_CHECKING 456#ifdef JBD2_EXPENSIVE_CHECKING
457 /* There better not be one left behind by now! */ 457 /* There better not be one left behind by now! */
458 record = find_revoke_record(journal, bh->b_blocknr); 458 record = find_revoke_record(journal, bh->b_blocknr);
459 J_ASSERT_JH(jh, record == NULL); 459 J_ASSERT_JH(jh, record == NULL);
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 7946ff43fc40..b1fcf2b3dca3 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -96,13 +96,12 @@ static int start_this_handle(journal_t *journal, handle_t *handle)
96 96
97alloc_transaction: 97alloc_transaction:
98 if (!journal->j_running_transaction) { 98 if (!journal->j_running_transaction) {
99 new_transaction = jbd_kmalloc(sizeof(*new_transaction), 99 new_transaction = kzalloc(sizeof(*new_transaction),
100 GFP_NOFS); 100 GFP_NOFS|__GFP_NOFAIL);
101 if (!new_transaction) { 101 if (!new_transaction) {
102 ret = -ENOMEM; 102 ret = -ENOMEM;
103 goto out; 103 goto out;
104 } 104 }
105 memset(new_transaction, 0, sizeof(*new_transaction));
106 } 105 }
107 106
108 jbd_debug(3, "New handle %p going live.\n", handle); 107 jbd_debug(3, "New handle %p going live.\n", handle);
@@ -236,7 +235,7 @@ out:
236/* Allocate a new handle. This should probably be in a slab... */ 235/* Allocate a new handle. This should probably be in a slab... */
237static handle_t *new_handle(int nblocks) 236static handle_t *new_handle(int nblocks)
238{ 237{
239 handle_t *handle = jbd_alloc_handle(GFP_NOFS); 238 handle_t *handle = jbd2_alloc_handle(GFP_NOFS);
240 if (!handle) 239 if (!handle)
241 return NULL; 240 return NULL;
242 memset(handle, 0, sizeof(*handle)); 241 memset(handle, 0, sizeof(*handle));
@@ -282,7 +281,7 @@ handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
282 281
283 err = start_this_handle(journal, handle); 282 err = start_this_handle(journal, handle);
284 if (err < 0) { 283 if (err < 0) {
285 jbd_free_handle(handle); 284 jbd2_free_handle(handle);
286 current->journal_info = NULL; 285 current->journal_info = NULL;
287 handle = ERR_PTR(err); 286 handle = ERR_PTR(err);
288 } 287 }
@@ -668,7 +667,7 @@ repeat:
668 JBUFFER_TRACE(jh, "allocate memory for buffer"); 667 JBUFFER_TRACE(jh, "allocate memory for buffer");
669 jbd_unlock_bh_state(bh); 668 jbd_unlock_bh_state(bh);
670 frozen_buffer = 669 frozen_buffer =
671 jbd2_slab_alloc(jh2bh(jh)->b_size, 670 jbd2_alloc(jh2bh(jh)->b_size,
672 GFP_NOFS); 671 GFP_NOFS);
673 if (!frozen_buffer) { 672 if (!frozen_buffer) {
674 printk(KERN_EMERG 673 printk(KERN_EMERG
@@ -728,7 +727,7 @@ done:
728 727
729out: 728out:
730 if (unlikely(frozen_buffer)) /* It's usually NULL */ 729 if (unlikely(frozen_buffer)) /* It's usually NULL */
731 jbd2_slab_free(frozen_buffer, bh->b_size); 730 jbd2_free(frozen_buffer, bh->b_size);
732 731
733 JBUFFER_TRACE(jh, "exit"); 732 JBUFFER_TRACE(jh, "exit");
734 return error; 733 return error;
@@ -881,7 +880,7 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
881 880
882repeat: 881repeat:
883 if (!jh->b_committed_data) { 882 if (!jh->b_committed_data) {
884 committed_data = jbd2_slab_alloc(jh2bh(jh)->b_size, GFP_NOFS); 883 committed_data = jbd2_alloc(jh2bh(jh)->b_size, GFP_NOFS);
885 if (!committed_data) { 884 if (!committed_data) {
886 printk(KERN_EMERG "%s: No memory for committed data\n", 885 printk(KERN_EMERG "%s: No memory for committed data\n",
887 __FUNCTION__); 886 __FUNCTION__);
@@ -908,7 +907,7 @@ repeat:
908out: 907out:
909 jbd2_journal_put_journal_head(jh); 908 jbd2_journal_put_journal_head(jh);
910 if (unlikely(committed_data)) 909 if (unlikely(committed_data))
911 jbd2_slab_free(committed_data, bh->b_size); 910 jbd2_free(committed_data, bh->b_size);
912 return err; 911 return err;
913} 912}
914 913
@@ -1411,7 +1410,7 @@ int jbd2_journal_stop(handle_t *handle)
1411 spin_unlock(&journal->j_state_lock); 1410 spin_unlock(&journal->j_state_lock);
1412 } 1411 }
1413 1412
1414 jbd_free_handle(handle); 1413 jbd2_free_handle(handle);
1415 return err; 1414 return err;
1416} 1415}
1417 1416
diff --git a/fs/jffs2/debug.h b/fs/jffs2/debug.h
index 2a49f2c51a9f..4130adabd76e 100644
--- a/fs/jffs2/debug.h
+++ b/fs/jffs2/debug.h
@@ -80,28 +80,28 @@
80#define JFFS2_ERROR(fmt, ...) \ 80#define JFFS2_ERROR(fmt, ...) \
81 do { \ 81 do { \
82 printk(JFFS2_ERR_MSG_PREFIX \ 82 printk(JFFS2_ERR_MSG_PREFIX \
83 " (%d) %s: " fmt, current->pid, \ 83 " (%d) %s: " fmt, task_pid_nr(current), \
84 __FUNCTION__ , ##__VA_ARGS__); \ 84 __FUNCTION__ , ##__VA_ARGS__); \
85 } while(0) 85 } while(0)
86 86
87#define JFFS2_WARNING(fmt, ...) \ 87#define JFFS2_WARNING(fmt, ...) \
88 do { \ 88 do { \
89 printk(JFFS2_WARN_MSG_PREFIX \ 89 printk(JFFS2_WARN_MSG_PREFIX \
90 " (%d) %s: " fmt, current->pid, \ 90 " (%d) %s: " fmt, task_pid_nr(current), \
91 __FUNCTION__ , ##__VA_ARGS__); \ 91 __FUNCTION__ , ##__VA_ARGS__); \
92 } while(0) 92 } while(0)
93 93
94#define JFFS2_NOTICE(fmt, ...) \ 94#define JFFS2_NOTICE(fmt, ...) \
95 do { \ 95 do { \
96 printk(JFFS2_NOTICE_MSG_PREFIX \ 96 printk(JFFS2_NOTICE_MSG_PREFIX \
97 " (%d) %s: " fmt, current->pid, \ 97 " (%d) %s: " fmt, task_pid_nr(current), \
98 __FUNCTION__ , ##__VA_ARGS__); \ 98 __FUNCTION__ , ##__VA_ARGS__); \
99 } while(0) 99 } while(0)
100 100
101#define JFFS2_DEBUG(fmt, ...) \ 101#define JFFS2_DEBUG(fmt, ...) \
102 do { \ 102 do { \
103 printk(JFFS2_DBG_MSG_PREFIX \ 103 printk(JFFS2_DBG_MSG_PREFIX \
104 " (%d) %s: " fmt, current->pid, \ 104 " (%d) %s: " fmt, task_pid_nr(current), \
105 __FUNCTION__ , ##__VA_ARGS__); \ 105 __FUNCTION__ , ##__VA_ARGS__); \
106 } while(0) 106 } while(0)
107 107
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index df0b8535de84..df25ecc418af 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -773,7 +773,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
773 getChild: 773 getChild:
774 /* update max. number of pages to split */ 774 /* update max. number of pages to split */
775 if (BT_STACK_FULL(btstack)) { 775 if (BT_STACK_FULL(btstack)) {
776 /* Something's corrupted, mark filesytem dirty so 776 /* Something's corrupted, mark filesystem dirty so
777 * chkdsk will fix it. 777 * chkdsk will fix it.
778 */ 778 */
779 jfs_error(sb, "stack overrun in dtSearch!"); 779 jfs_error(sb, "stack overrun in dtSearch!");
diff --git a/fs/namei.c b/fs/namei.c
index 464eeccb675b..1e5c71669164 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1659,8 +1659,10 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1659 error = locks_verify_locked(inode); 1659 error = locks_verify_locked(inode);
1660 if (!error) { 1660 if (!error) {
1661 DQUOT_INIT(inode); 1661 DQUOT_INIT(inode);
1662 1662
1663 error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL); 1663 error = do_truncate(dentry, 0,
1664 ATTR_MTIME|ATTR_CTIME|ATTR_OPEN,
1665 NULL);
1664 } 1666 }
1665 put_write_access(inode); 1667 put_write_access(inode);
1666 if (error) 1668 if (error)
diff --git a/fs/namespace.c b/fs/namespace.c
index 07daa7972591..860752998fb3 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1411,7 +1411,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
1411 mnt_flags |= MNT_RELATIME; 1411 mnt_flags |= MNT_RELATIME;
1412 1412
1413 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | 1413 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
1414 MS_NOATIME | MS_NODIRATIME | MS_RELATIME); 1414 MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT);
1415 1415
1416 /* ... and get the mountpoint */ 1416 /* ... and get the mountpoint */
1417 retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd); 1417 retval = path_lookup(dir_name, LOOKUP_FOLLOW, &nd);
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index af8b235d405d..11833f4caeaa 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -168,7 +168,8 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
168 spin_unlock(&inode->i_lock); 168 spin_unlock(&inode->i_lock);
169 169
170 spin_unlock(&clp->cl_lock); 170 spin_unlock(&clp->cl_lock);
171 kfree(delegation); 171 if (delegation != NULL)
172 nfs_free_delegation(delegation);
172 return status; 173 return status;
173} 174}
174 175
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 8ec7fbd8240c..35334539d947 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -562,6 +562,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
562 nfs_fattr_init(&fattr); 562 nfs_fattr_init(&fattr);
563 desc->entry = &my_entry; 563 desc->entry = &my_entry;
564 564
565 nfs_block_sillyrename(dentry);
565 while(!desc->entry->eof) { 566 while(!desc->entry->eof) {
566 res = readdir_search_pagecache(desc); 567 res = readdir_search_pagecache(desc);
567 568
@@ -592,6 +593,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
592 break; 593 break;
593 } 594 }
594 } 595 }
596 nfs_unblock_sillyrename(dentry);
595 unlock_kernel(); 597 unlock_kernel();
596 if (res > 0) 598 if (res > 0)
597 res = 0; 599 res = 0;
@@ -866,6 +868,7 @@ struct dentry_operations nfs_dentry_operations = {
866static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) 868static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
867{ 869{
868 struct dentry *res; 870 struct dentry *res;
871 struct dentry *parent;
869 struct inode *inode = NULL; 872 struct inode *inode = NULL;
870 int error; 873 int error;
871 struct nfs_fh fhandle; 874 struct nfs_fh fhandle;
@@ -894,26 +897,31 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
894 goto out_unlock; 897 goto out_unlock;
895 } 898 }
896 899
900 parent = dentry->d_parent;
901 /* Protect against concurrent sillydeletes */
902 nfs_block_sillyrename(parent);
897 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr); 903 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr);
898 if (error == -ENOENT) 904 if (error == -ENOENT)
899 goto no_entry; 905 goto no_entry;
900 if (error < 0) { 906 if (error < 0) {
901 res = ERR_PTR(error); 907 res = ERR_PTR(error);
902 goto out_unlock; 908 goto out_unblock_sillyrename;
903 } 909 }
904 inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr); 910 inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr);
905 res = (struct dentry *)inode; 911 res = (struct dentry *)inode;
906 if (IS_ERR(res)) 912 if (IS_ERR(res))
907 goto out_unlock; 913 goto out_unblock_sillyrename;
908 914
909no_entry: 915no_entry:
910 res = d_materialise_unique(dentry, inode); 916 res = d_materialise_unique(dentry, inode);
911 if (res != NULL) { 917 if (res != NULL) {
912 if (IS_ERR(res)) 918 if (IS_ERR(res))
913 goto out_unlock; 919 goto out_unblock_sillyrename;
914 dentry = res; 920 dentry = res;
915 } 921 }
916 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 922 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
923out_unblock_sillyrename:
924 nfs_unblock_sillyrename(parent);
917out_unlock: 925out_unlock:
918 unlock_kernel(); 926 unlock_kernel();
919out: 927out:
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index d29f90d00aa2..b3bb89f7d5d2 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -131,7 +131,7 @@ nfs_file_release(struct inode *inode, struct file *filp)
131{ 131{
132 /* Ensure that dirty pages are flushed out with the right creds */ 132 /* Ensure that dirty pages are flushed out with the right creds */
133 if (filp->f_mode & FMODE_WRITE) 133 if (filp->f_mode & FMODE_WRITE)
134 filemap_fdatawrite(filp->f_mapping); 134 nfs_wb_all(filp->f_path.dentry->d_inode);
135 nfs_inc_stats(inode, NFSIOS_VFSRELEASE); 135 nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
136 return NFS_PROTO(inode)->file_release(inode, filp); 136 return NFS_PROTO(inode)->file_release(inode, filp);
137} 137}
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6c22453d77ae..db5d96dc6107 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -357,6 +357,10 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
357 357
358 nfs_inc_stats(inode, NFSIOS_VFSSETATTR); 358 nfs_inc_stats(inode, NFSIOS_VFSSETATTR);
359 359
360 /* skip mode change if it's just for clearing setuid/setgid */
361 if (attr->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
362 attr->ia_valid &= ~ATTR_MODE;
363
360 if (attr->ia_valid & ATTR_SIZE) { 364 if (attr->ia_valid & ATTR_SIZE) {
361 if (!S_ISREG(inode->i_mode) || attr->ia_size == i_size_read(inode)) 365 if (!S_ISREG(inode->i_mode) || attr->ia_size == i_size_read(inode))
362 attr->ia_valid &= ~ATTR_SIZE; 366 attr->ia_valid &= ~ATTR_SIZE;
@@ -510,7 +514,7 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
510 return ctx; 514 return ctx;
511} 515}
512 516
513void put_nfs_open_context(struct nfs_open_context *ctx) 517static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait)
514{ 518{
515 struct inode *inode = ctx->path.dentry->d_inode; 519 struct inode *inode = ctx->path.dentry->d_inode;
516 520
@@ -518,8 +522,12 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
518 return; 522 return;
519 list_del(&ctx->list); 523 list_del(&ctx->list);
520 spin_unlock(&inode->i_lock); 524 spin_unlock(&inode->i_lock);
521 if (ctx->state != NULL) 525 if (ctx->state != NULL) {
522 nfs4_close_state(&ctx->path, ctx->state, ctx->mode); 526 if (wait)
527 nfs4_close_sync(&ctx->path, ctx->state, ctx->mode);
528 else
529 nfs4_close_state(&ctx->path, ctx->state, ctx->mode);
530 }
523 if (ctx->cred != NULL) 531 if (ctx->cred != NULL)
524 put_rpccred(ctx->cred); 532 put_rpccred(ctx->cred);
525 dput(ctx->path.dentry); 533 dput(ctx->path.dentry);
@@ -527,6 +535,16 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
527 kfree(ctx); 535 kfree(ctx);
528} 536}
529 537
538void put_nfs_open_context(struct nfs_open_context *ctx)
539{
540 __put_nfs_open_context(ctx, 0);
541}
542
543static void put_nfs_open_context_sync(struct nfs_open_context *ctx)
544{
545 __put_nfs_open_context(ctx, 1);
546}
547
530/* 548/*
531 * Ensure that mmap has a recent RPC credential for use when writing out 549 * Ensure that mmap has a recent RPC credential for use when writing out
532 * shared pages 550 * shared pages
@@ -573,7 +591,7 @@ static void nfs_file_clear_open_context(struct file *filp)
573 spin_lock(&inode->i_lock); 591 spin_lock(&inode->i_lock);
574 list_move_tail(&ctx->list, &NFS_I(inode)->open_files); 592 list_move_tail(&ctx->list, &NFS_I(inode)->open_files);
575 spin_unlock(&inode->i_lock); 593 spin_unlock(&inode->i_lock);
576 put_nfs_open_context(ctx); 594 put_nfs_open_context_sync(ctx);
577 } 595 }
578} 596}
579 597
@@ -1165,6 +1183,9 @@ static void init_once(struct kmem_cache * cachep, void *foo)
1165 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); 1183 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC);
1166 nfsi->ncommit = 0; 1184 nfsi->ncommit = 0;
1167 nfsi->npages = 0; 1185 nfsi->npages = 0;
1186 atomic_set(&nfsi->silly_count, 1);
1187 INIT_HLIST_HEAD(&nfsi->silly_list);
1188 init_waitqueue_head(&nfsi->waitqueue);
1168 nfs4_init_once(nfsi); 1189 nfs4_init_once(nfsi);
1169} 1190}
1170 1191
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index d2802b1ca3b9..b35069a2aa9e 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -178,7 +178,7 @@ extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struc
178extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct rpc_cred *); 178extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct rpc_cred *);
179extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *); 179extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *);
180extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); 180extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *);
181extern int nfs4_do_close(struct path *path, struct nfs4_state *state); 181extern int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait);
182extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); 182extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *);
183extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *); 183extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *);
184extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); 184extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
@@ -209,6 +209,7 @@ extern void nfs4_drop_state_owner(struct nfs4_state_owner *);
209extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 209extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
210extern void nfs4_put_open_state(struct nfs4_state *); 210extern void nfs4_put_open_state(struct nfs4_state *);
211extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); 211extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t);
212extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t);
212extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t); 213extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t);
213extern void nfs4_schedule_state_recovery(struct nfs_client *); 214extern void nfs4_schedule_state_recovery(struct nfs_client *);
214extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); 215extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
@@ -235,6 +236,7 @@ extern struct svc_version nfs4_callback_version1;
235#else 236#else
236 237
237#define nfs4_close_state(a, b, c) do { } while (0) 238#define nfs4_close_state(a, b, c) do { } while (0)
239#define nfs4_close_sync(a, b, c) do { } while (0)
238 240
239#endif /* CONFIG_NFS_V4 */ 241#endif /* CONFIG_NFS_V4 */
240#endif /* __LINUX_FS_NFS_NFS4_FS.H */ 242#endif /* __LINUX_FS_NFS_NFS4_FS.H */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index cb99fd90a9ac..f03d9d5f5ba4 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1305,7 +1305,7 @@ static const struct rpc_call_ops nfs4_close_ops = {
1305 * 1305 *
1306 * NOTE: Caller must be holding the sp->so_owner semaphore! 1306 * NOTE: Caller must be holding the sp->so_owner semaphore!
1307 */ 1307 */
1308int nfs4_do_close(struct path *path, struct nfs4_state *state) 1308int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
1309{ 1309{
1310 struct nfs_server *server = NFS_SERVER(state->inode); 1310 struct nfs_server *server = NFS_SERVER(state->inode);
1311 struct nfs4_closedata *calldata; 1311 struct nfs4_closedata *calldata;
@@ -1333,8 +1333,11 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state)
1333 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata); 1333 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata);
1334 if (IS_ERR(task)) 1334 if (IS_ERR(task))
1335 return PTR_ERR(task); 1335 return PTR_ERR(task);
1336 status = 0;
1337 if (wait)
1338 status = rpc_wait_for_completion_task(task);
1336 rpc_put_task(task); 1339 rpc_put_task(task);
1337 return 0; 1340 return status;
1338out_free_calldata: 1341out_free_calldata:
1339 kfree(calldata); 1342 kfree(calldata);
1340out: 1343out:
@@ -1365,13 +1368,14 @@ static int nfs4_intent_set_file(struct nameidata *nd, struct path *path, struct
1365 } 1368 }
1366 ret = PTR_ERR(filp); 1369 ret = PTR_ERR(filp);
1367out_close: 1370out_close:
1368 nfs4_close_state(path, state, nd->intent.open.flags); 1371 nfs4_close_sync(path, state, nd->intent.open.flags);
1369 return ret; 1372 return ret;
1370} 1373}
1371 1374
1372struct dentry * 1375struct dentry *
1373nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 1376nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1374{ 1377{
1378 struct dentry *parent;
1375 struct path path = { 1379 struct path path = {
1376 .mnt = nd->mnt, 1380 .mnt = nd->mnt,
1377 .dentry = dentry, 1381 .dentry = dentry,
@@ -1394,6 +1398,9 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1394 cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); 1398 cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0);
1395 if (IS_ERR(cred)) 1399 if (IS_ERR(cred))
1396 return (struct dentry *)cred; 1400 return (struct dentry *)cred;
1401 parent = dentry->d_parent;
1402 /* Protect against concurrent sillydeletes */
1403 nfs_block_sillyrename(parent);
1397 state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred); 1404 state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred);
1398 put_rpccred(cred); 1405 put_rpccred(cred);
1399 if (IS_ERR(state)) { 1406 if (IS_ERR(state)) {
@@ -1401,12 +1408,14 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1401 d_add(dentry, NULL); 1408 d_add(dentry, NULL);
1402 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1409 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1403 } 1410 }
1411 nfs_unblock_sillyrename(parent);
1404 return (struct dentry *)state; 1412 return (struct dentry *)state;
1405 } 1413 }
1406 res = d_add_unique(dentry, igrab(state->inode)); 1414 res = d_add_unique(dentry, igrab(state->inode));
1407 if (res != NULL) 1415 if (res != NULL)
1408 path.dentry = res; 1416 path.dentry = res;
1409 nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir)); 1417 nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir));
1418 nfs_unblock_sillyrename(parent);
1410 nfs4_intent_set_file(nd, &path, state); 1419 nfs4_intent_set_file(nd, &path, state);
1411 return res; 1420 return res;
1412} 1421}
@@ -1444,7 +1453,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
1444 nfs4_intent_set_file(nd, &path, state); 1453 nfs4_intent_set_file(nd, &path, state);
1445 return 1; 1454 return 1;
1446 } 1455 }
1447 nfs4_close_state(&path, state, openflags); 1456 nfs4_close_sync(&path, state, openflags);
1448out_drop: 1457out_drop:
1449 d_drop(dentry); 1458 d_drop(dentry);
1450 return 0; 1459 return 0;
@@ -1898,7 +1907,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
1898 if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0) 1907 if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0)
1899 status = nfs4_intent_set_file(nd, &path, state); 1908 status = nfs4_intent_set_file(nd, &path, state);
1900 else 1909 else
1901 nfs4_close_state(&path, state, flags); 1910 nfs4_close_sync(&path, state, flags);
1902out: 1911out:
1903 return status; 1912 return status;
1904} 1913}
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index bfb36261cecb..23a9a36556bf 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -425,7 +425,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
425/* 425/*
426 * Close the current file. 426 * Close the current file.
427 */ 427 */
428void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) 428static void __nfs4_close(struct path *path, struct nfs4_state *state, mode_t mode, int wait)
429{ 429{
430 struct nfs4_state_owner *owner = state->owner; 430 struct nfs4_state_owner *owner = state->owner;
431 int call_close = 0; 431 int call_close = 0;
@@ -466,7 +466,17 @@ void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode)
466 nfs4_put_open_state(state); 466 nfs4_put_open_state(state);
467 nfs4_put_state_owner(owner); 467 nfs4_put_state_owner(owner);
468 } else 468 } else
469 nfs4_do_close(path, state); 469 nfs4_do_close(path, state, wait);
470}
471
472void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode)
473{
474 __nfs4_close(path, state, mode, 0);
475}
476
477void nfs4_close_sync(struct path *path, struct nfs4_state *state, mode_t mode)
478{
479 __nfs4_close(path, state, mode, 1);
470} 480}
471 481
472/* 482/*
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index e87b44ee9ac9..4b0334590ee5 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -43,7 +43,7 @@
43 * from being used (thanks to Leo Spiekman) 43 * from being used (thanks to Leo Spiekman)
44 * Andy Walker : Allow to specify the NFS server in nfs_root 44 * Andy Walker : Allow to specify the NFS server in nfs_root
45 * without giving a path name 45 * without giving a path name
46 * Swen Thümmler : Allow to specify the NFS options in nfs_root 46 * Swen Thümmler : Allow to specify the NFS options in nfs_root
47 * without giving a path name. Fix BOOTP request 47 * without giving a path name. Fix BOOTP request
48 * for domainname (domainname is NIS domain, not 48 * for domainname (domainname is NIS domain, not
49 * DNS domain!). Skip dummy devices for BOOTP. 49 * DNS domain!). Skip dummy devices for BOOTP.
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 1aed850d18f2..ce558c2e4d53 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -11,9 +11,11 @@
11#include <linux/sunrpc/sched.h> 11#include <linux/sunrpc/sched.h>
12#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/clnt.h>
13#include <linux/nfs_fs.h> 13#include <linux/nfs_fs.h>
14 14#include <linux/sched.h>
15#include <linux/wait.h>
15 16
16struct nfs_unlinkdata { 17struct nfs_unlinkdata {
18 struct hlist_node list;
17 struct nfs_removeargs args; 19 struct nfs_removeargs args;
18 struct nfs_removeres res; 20 struct nfs_removeres res;
19 struct inode *dir; 21 struct inode *dir;
@@ -52,6 +54,20 @@ static int nfs_copy_dname(struct dentry *dentry, struct nfs_unlinkdata *data)
52 return 0; 54 return 0;
53} 55}
54 56
57static void nfs_free_dname(struct nfs_unlinkdata *data)
58{
59 kfree(data->args.name.name);
60 data->args.name.name = NULL;
61 data->args.name.len = 0;
62}
63
64static void nfs_dec_sillycount(struct inode *dir)
65{
66 struct nfs_inode *nfsi = NFS_I(dir);
67 if (atomic_dec_return(&nfsi->silly_count) == 1)
68 wake_up(&nfsi->waitqueue);
69}
70
55/** 71/**
56 * nfs_async_unlink_init - Initialize the RPC info 72 * nfs_async_unlink_init - Initialize the RPC info
57 * task: rpc_task of the sillydelete 73 * task: rpc_task of the sillydelete
@@ -95,6 +111,8 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
95static void nfs_async_unlink_release(void *calldata) 111static void nfs_async_unlink_release(void *calldata)
96{ 112{
97 struct nfs_unlinkdata *data = calldata; 113 struct nfs_unlinkdata *data = calldata;
114
115 nfs_dec_sillycount(data->dir);
98 nfs_free_unlinkdata(data); 116 nfs_free_unlinkdata(data);
99} 117}
100 118
@@ -104,33 +122,100 @@ static const struct rpc_call_ops nfs_unlink_ops = {
104 .rpc_release = nfs_async_unlink_release, 122 .rpc_release = nfs_async_unlink_release,
105}; 123};
106 124
107static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) 125static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data)
108{ 126{
109 struct rpc_task *task; 127 struct rpc_task *task;
128 struct dentry *alias;
129
130 alias = d_lookup(parent, &data->args.name);
131 if (alias != NULL) {
132 int ret = 0;
133 /*
134 * Hey, we raced with lookup... See if we need to transfer
135 * the sillyrename information to the aliased dentry.
136 */
137 nfs_free_dname(data);
138 spin_lock(&alias->d_lock);
139 if (!(alias->d_flags & DCACHE_NFSFS_RENAMED)) {
140 alias->d_fsdata = data;
141 alias->d_flags ^= DCACHE_NFSFS_RENAMED;
142 ret = 1;
143 }
144 spin_unlock(&alias->d_lock);
145 nfs_dec_sillycount(dir);
146 dput(alias);
147 return ret;
148 }
149 data->dir = igrab(dir);
150 if (!data->dir) {
151 nfs_dec_sillycount(dir);
152 return 0;
153 }
154 data->args.fh = NFS_FH(dir);
155 nfs_fattr_init(&data->res.dir_attr);
156
157 task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data);
158 if (!IS_ERR(task))
159 rpc_put_task(task);
160 return 1;
161}
162
163static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data)
164{
110 struct dentry *parent; 165 struct dentry *parent;
111 struct inode *dir; 166 struct inode *dir;
167 int ret = 0;
112 168
113 if (nfs_copy_dname(dentry, data) < 0)
114 goto out_free;
115 169
116 parent = dget_parent(dentry); 170 parent = dget_parent(dentry);
117 if (parent == NULL) 171 if (parent == NULL)
118 goto out_free; 172 goto out_free;
119 dir = igrab(parent->d_inode); 173 dir = parent->d_inode;
174 if (nfs_copy_dname(dentry, data) == 0)
175 goto out_dput;
176 /* Non-exclusive lock protects against concurrent lookup() calls */
177 spin_lock(&dir->i_lock);
178 if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) {
179 /* Deferred delete */
180 hlist_add_head(&data->list, &NFS_I(dir)->silly_list);
181 spin_unlock(&dir->i_lock);
182 ret = 1;
183 goto out_dput;
184 }
185 spin_unlock(&dir->i_lock);
186 ret = nfs_do_call_unlink(parent, dir, data);
187out_dput:
120 dput(parent); 188 dput(parent);
121 if (dir == NULL) 189out_free:
122 goto out_free; 190 return ret;
191}
123 192
124 data->dir = dir; 193void nfs_block_sillyrename(struct dentry *dentry)
125 data->args.fh = NFS_FH(dir); 194{
126 nfs_fattr_init(&data->res.dir_attr); 195 struct nfs_inode *nfsi = NFS_I(dentry->d_inode);
127 196
128 task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data); 197 wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1);
129 if (!IS_ERR(task)) 198}
130 rpc_put_task(task); 199
131 return 1; 200void nfs_unblock_sillyrename(struct dentry *dentry)
132out_free: 201{
133 return 0; 202 struct inode *dir = dentry->d_inode;
203 struct nfs_inode *nfsi = NFS_I(dir);
204 struct nfs_unlinkdata *data;
205
206 atomic_inc(&nfsi->silly_count);
207 spin_lock(&dir->i_lock);
208 while (!hlist_empty(&nfsi->silly_list)) {
209 if (!atomic_inc_not_zero(&nfsi->silly_count))
210 break;
211 data = hlist_entry(nfsi->silly_list.first, struct nfs_unlinkdata, list);
212 hlist_del(&data->list);
213 spin_unlock(&dir->i_lock);
214 if (nfs_do_call_unlink(dentry, dir, data) == 0)
215 nfs_free_unlinkdata(data);
216 spin_lock(&dir->i_lock);
217 }
218 spin_unlock(&dir->i_lock);
134} 219}
135 220
136/** 221/**
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 0cf9d1cd9bd2..89527a487ed7 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -174,8 +174,6 @@ static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int
174 return; 174 return;
175 if (count != nfs_page_length(page)) 175 if (count != nfs_page_length(page))
176 return; 176 return;
177 if (count != PAGE_CACHE_SIZE)
178 zero_user_page(page, count, PAGE_CACHE_SIZE - count, KM_USER0);
179 SetPageUptodate(page); 177 SetPageUptodate(page);
180} 178}
181 179
@@ -627,7 +625,8 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
627 return ERR_PTR(error); 625 return ERR_PTR(error);
628 } 626 }
629 spin_unlock(&inode->i_lock); 627 spin_unlock(&inode->i_lock);
630 return new; 628 req = new;
629 goto zero_page;
631 } 630 }
632 spin_unlock(&inode->i_lock); 631 spin_unlock(&inode->i_lock);
633 632
@@ -655,13 +654,23 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
655 if (offset < req->wb_offset) { 654 if (offset < req->wb_offset) {
656 req->wb_offset = offset; 655 req->wb_offset = offset;
657 req->wb_pgbase = offset; 656 req->wb_pgbase = offset;
658 req->wb_bytes = rqend - req->wb_offset; 657 req->wb_bytes = max(end, rqend) - req->wb_offset;
658 goto zero_page;
659 } 659 }
660 660
661 if (end > rqend) 661 if (end > rqend)
662 req->wb_bytes = end - req->wb_offset; 662 req->wb_bytes = end - req->wb_offset;
663 663
664 return req; 664 return req;
665zero_page:
666 /* If this page might potentially be marked as up to date,
667 * then we need to zero any uninitalised data. */
668 if (req->wb_pgbase == 0 && req->wb_bytes != PAGE_CACHE_SIZE
669 && !PageUptodate(req->wb_page))
670 zero_user_page(req->wb_page, req->wb_bytes,
671 PAGE_CACHE_SIZE - req->wb_bytes,
672 KM_USER0);
673 return req;
665} 674}
666 675
667int nfs_flush_incompatible(struct file *file, struct page *page) 676int nfs_flush_incompatible(struct file *file, struct page *page)
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 819545d21670..d0199189924c 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -364,14 +364,23 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
364 if (iap->ia_valid & ATTR_MODE) { 364 if (iap->ia_valid & ATTR_MODE) {
365 iap->ia_mode &= S_IALLUGO; 365 iap->ia_mode &= S_IALLUGO;
366 imode = iap->ia_mode |= (imode & ~S_IALLUGO); 366 imode = iap->ia_mode |= (imode & ~S_IALLUGO);
367 /* if changing uid/gid revoke setuid/setgid in mode */
368 if ((iap->ia_valid & ATTR_UID) && iap->ia_uid != inode->i_uid) {
369 iap->ia_valid |= ATTR_KILL_PRIV;
370 iap->ia_mode &= ~S_ISUID;
371 }
372 if ((iap->ia_valid & ATTR_GID) && iap->ia_gid != inode->i_gid)
373 iap->ia_mode &= ~S_ISGID;
374 } else {
375 /*
376 * Revoke setuid/setgid bit on chown/chgrp
377 */
378 if ((iap->ia_valid & ATTR_UID) && iap->ia_uid != inode->i_uid)
379 iap->ia_valid |= ATTR_KILL_SUID | ATTR_KILL_PRIV;
380 if ((iap->ia_valid & ATTR_GID) && iap->ia_gid != inode->i_gid)
381 iap->ia_valid |= ATTR_KILL_SGID;
367 } 382 }
368 383
369 /* Revoke setuid/setgid bit on chown/chgrp */
370 if ((iap->ia_valid & ATTR_UID) && iap->ia_uid != inode->i_uid)
371 iap->ia_valid |= ATTR_KILL_SUID | ATTR_KILL_PRIV;
372 if ((iap->ia_valid & ATTR_GID) && iap->ia_gid != inode->i_gid)
373 iap->ia_valid |= ATTR_KILL_SGID;
374
375 /* Change the attributes. */ 384 /* Change the attributes. */
376 385
377 iap->ia_valid |= ATTR_CTIME; 386 iap->ia_valid |= ATTR_CTIME;
@@ -1020,13 +1029,13 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
1020 if (EX_WGATHER(exp)) { 1029 if (EX_WGATHER(exp)) {
1021 if (atomic_read(&inode->i_writecount) > 1 1030 if (atomic_read(&inode->i_writecount) > 1
1022 || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) { 1031 || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) {
1023 dprintk("nfsd: write defer %d\n", current->pid); 1032 dprintk("nfsd: write defer %d\n", task_pid_nr(current));
1024 msleep(10); 1033 msleep(10);
1025 dprintk("nfsd: write resume %d\n", current->pid); 1034 dprintk("nfsd: write resume %d\n", task_pid_nr(current));
1026 } 1035 }
1027 1036
1028 if (inode->i_state & I_DIRTY) { 1037 if (inode->i_state & I_DIRTY) {
1029 dprintk("nfsd: write sync %d\n", current->pid); 1038 dprintk("nfsd: write sync %d\n", task_pid_nr(current));
1030 host_err=nfsd_sync(file); 1039 host_err=nfsd_sync(file);
1031 } 1040 }
1032#if 0 1041#if 0
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index e7905816c4ca..64965e1c21c4 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -111,7 +111,7 @@ utf8_wctomb(__u8 *s, wchar_t wc, int maxlen)
111 int c, nc; 111 int c, nc;
112 const struct utf8_table *t; 112 const struct utf8_table *t;
113 113
114 if (s == 0) 114 if (!s)
115 return 0; 115 return 0;
116 116
117 l = wc; 117 l = wc;
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 345798ebd366..37c11e194372 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -382,7 +382,7 @@ ToDo/Notes:
382 own locking so it does not matter if the vfs inode is locked. 382 own locking so it does not matter if the vfs inode is locked.
383 - Fix bug in mft record writing where we forgot to set the device in 383 - Fix bug in mft record writing where we forgot to set the device in
384 the buffers when mapping them after the VM had discarded them. 384 the buffers when mapping them after the VM had discarded them.
385 Thanks to Martin MOKREJÅ  for the bug report. 385 Thanks to Martin MOKREJÃ… for the bug report.
386 386
3872.1.22 - Many bug and race fixes and error handling improvements. 3872.1.22 - Many bug and race fixes and error handling improvements.
388 388
@@ -1585,7 +1585,7 @@ tng-0.0.4 - Big changes, getting in line with Al Viro's comments.
1585 for reading $MFT (ntfs_mft_readpage). In the process create dedicated 1585 for reading $MFT (ntfs_mft_readpage). In the process create dedicated
1586 address space operations (ntfs_mft_aops) for $MFT inode mapping. Also 1586 address space operations (ntfs_mft_aops) for $MFT inode mapping. Also
1587 removed the now superfluous exports from the kernel core patch. 1587 removed the now superfluous exports from the kernel core patch.
1588 - Fix a bug where kfree() was used insted of ntfs_free(). 1588 - Fix a bug where kfree() was used instead of ntfs_free().
1589 - Change map_mft_record() to take ntfs_inode as argument instead of 1589 - Change map_mft_record() to take ntfs_inode as argument instead of
1590 vfs inode. Dito for unmap_mft_record(). Adapt all callers. 1590 vfs inode. Dito for unmap_mft_record(). Adapt all callers.
1591 - Add pointer to ntfs_volume to ntfs_inode. 1591 - Add pointer to ntfs_volume to ntfs_inode.
diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c
index 4847fbfb0107..9ef85e628fe1 100644
--- a/fs/ntfs/sysctl.c
+++ b/fs/ntfs/sysctl.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of 2 * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of
3 * the Linux-NTFS project. Adapted from the old NTFS driver, 3 * the Linux-NTFS project. Adapted from the old NTFS driver,
4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne 4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne
5 * 5 *
6 * Copyright (c) 2002-2005 Anton Altaparmakov 6 * Copyright (c) 2002-2005 Anton Altaparmakov
7 * 7 *
diff --git a/fs/ntfs/sysctl.h b/fs/ntfs/sysctl.h
index beda5bf96405..d4f8ce920d95 100644
--- a/fs/ntfs/sysctl.h
+++ b/fs/ntfs/sysctl.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * sysctl.h - Defines for sysctl handling in NTFS Linux kernel driver. Part of 2 * sysctl.h - Defines for sysctl handling in NTFS Linux kernel driver. Part of
3 * the Linux-NTFS project. Adapted from the old NTFS driver, 3 * the Linux-NTFS project. Adapted from the old NTFS driver,
4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne 4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne
5 * 5 *
6 * Copyright (c) 2002-2004 Anton Altaparmakov 6 * Copyright (c) 2002-2004 Anton Altaparmakov
7 * 7 *
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index f14b541fab95..9cc7c0418b70 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1372,7 +1372,7 @@ static ssize_t o2hb_region_pid_read(struct o2hb_region *reg,
1372 1372
1373 spin_lock(&o2hb_live_lock); 1373 spin_lock(&o2hb_live_lock);
1374 if (reg->hr_task) 1374 if (reg->hr_task)
1375 pid = reg->hr_task->pid; 1375 pid = task_pid_nr(reg->hr_task);
1376 spin_unlock(&o2hb_live_lock); 1376 spin_unlock(&o2hb_live_lock);
1377 1377
1378 if (!pid) 1378 if (!pid)
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index 75cd877f6d42..cd046060114e 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -192,7 +192,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
192 * previous token if args expands to nothing. 192 * previous token if args expands to nothing.
193 */ 193 */
194#define __mlog_printk(level, fmt, args...) \ 194#define __mlog_printk(level, fmt, args...) \
195 printk(level "(%u,%lu):%s:%d " fmt, current->pid, \ 195 printk(level "(%u,%lu):%s:%d " fmt, task_pid_nr(current), \
196 __mlog_cpu_guess, __PRETTY_FUNCTION__, __LINE__ , \ 196 __mlog_cpu_guess, __PRETTY_FUNCTION__, __LINE__ , \
197 ##args) 197 ##args)
198 198
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 014e73978dac..3094ddb7a254 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -376,7 +376,7 @@ out:
376 * directory locks. The dentries have already been deleted on other 376 * directory locks. The dentries have already been deleted on other
377 * nodes via ocfs2_remote_dentry_delete(). 377 * nodes via ocfs2_remote_dentry_delete().
378 * 378 *
379 * Normally, the VFS handles the d_move() for the file sytem, after 379 * Normally, the VFS handles the d_move() for the file system, after
380 * the ->rename() callback. OCFS2 wants to handle this internally, so 380 * the ->rename() callback. OCFS2 wants to handle this internally, so
381 * the new lock can be created atomically with respect to the cluster. 381 * the new lock can be created atomically with respect to the cluster.
382 */ 382 */
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index a2c33160bfd6..2fde7bf91434 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -259,7 +259,7 @@ static void dlm_print_reco_node_status(struct dlm_ctxt *dlm)
259 struct dlm_lock_resource *res; 259 struct dlm_lock_resource *res;
260 260
261 mlog(ML_NOTICE, "%s(%d): recovery info, state=%s, dead=%u, master=%u\n", 261 mlog(ML_NOTICE, "%s(%d): recovery info, state=%s, dead=%u, master=%u\n",
262 dlm->name, dlm->dlm_reco_thread_task->pid, 262 dlm->name, task_pid_nr(dlm->dlm_reco_thread_task),
263 dlm->reco.state & DLM_RECO_STATE_ACTIVE ? "ACTIVE" : "inactive", 263 dlm->reco.state & DLM_RECO_STATE_ACTIVE ? "ACTIVE" : "inactive",
264 dlm->reco.dead_node, dlm->reco.new_master); 264 dlm->reco.dead_node, dlm->reco.new_master);
265 265
@@ -420,7 +420,7 @@ void dlm_wait_for_recovery(struct dlm_ctxt *dlm)
420 if (dlm_in_recovery(dlm)) { 420 if (dlm_in_recovery(dlm)) {
421 mlog(0, "%s: reco thread %d in recovery: " 421 mlog(0, "%s: reco thread %d in recovery: "
422 "state=%d, master=%u, dead=%u\n", 422 "state=%d, master=%u, dead=%u\n",
423 dlm->name, dlm->dlm_reco_thread_task->pid, 423 dlm->name, task_pid_nr(dlm->dlm_reco_thread_task),
424 dlm->reco.state, dlm->reco.new_master, 424 dlm->reco.state, dlm->reco.new_master,
425 dlm->reco.dead_node); 425 dlm->reco.dead_node);
426 } 426 }
@@ -483,7 +483,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm)
483 return 0; 483 return 0;
484 } 484 }
485 mlog(0, "%s(%d):recovery thread found node %u in the recovery map!\n", 485 mlog(0, "%s(%d):recovery thread found node %u in the recovery map!\n",
486 dlm->name, dlm->dlm_reco_thread_task->pid, 486 dlm->name, task_pid_nr(dlm->dlm_reco_thread_task),
487 dlm->reco.dead_node); 487 dlm->reco.dead_node);
488 spin_unlock(&dlm->spinlock); 488 spin_unlock(&dlm->spinlock);
489 489
@@ -507,7 +507,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm)
507 mlog(0, "another node will master this recovery session.\n"); 507 mlog(0, "another node will master this recovery session.\n");
508 } 508 }
509 mlog(0, "dlm=%s (%d), new_master=%u, this node=%u, dead_node=%u\n", 509 mlog(0, "dlm=%s (%d), new_master=%u, this node=%u, dead_node=%u\n",
510 dlm->name, dlm->dlm_reco_thread_task->pid, dlm->reco.new_master, 510 dlm->name, task_pid_nr(dlm->dlm_reco_thread_task), dlm->reco.new_master,
511 dlm->node_num, dlm->reco.dead_node); 511 dlm->node_num, dlm->reco.dead_node);
512 512
513 /* it is safe to start everything back up here 513 /* it is safe to start everything back up here
@@ -520,7 +520,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm)
520 520
521master_here: 521master_here:
522 mlog(0, "(%d) mastering recovery of %s:%u here(this=%u)!\n", 522 mlog(0, "(%d) mastering recovery of %s:%u here(this=%u)!\n",
523 dlm->dlm_reco_thread_task->pid, 523 task_pid_nr(dlm->dlm_reco_thread_task),
524 dlm->name, dlm->reco.dead_node, dlm->node_num); 524 dlm->name, dlm->reco.dead_node, dlm->node_num);
525 525
526 status = dlm_remaster_locks(dlm, dlm->reco.dead_node); 526 status = dlm_remaster_locks(dlm, dlm->reco.dead_node);
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 27b59f5f3bd1..63c95afb561f 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -77,6 +77,7 @@
77#include <linux/cpuset.h> 77#include <linux/cpuset.h>
78#include <linux/rcupdate.h> 78#include <linux/rcupdate.h>
79#include <linux/delayacct.h> 79#include <linux/delayacct.h>
80#include <linux/pid_namespace.h>
80 81
81#include <asm/pgtable.h> 82#include <asm/pgtable.h>
82#include <asm/processor.h> 83#include <asm/processor.h>
@@ -145,8 +146,7 @@ static inline const char *get_task_state(struct task_struct *tsk)
145 TASK_UNINTERRUPTIBLE | 146 TASK_UNINTERRUPTIBLE |
146 TASK_STOPPED | 147 TASK_STOPPED |
147 TASK_TRACED)) | 148 TASK_TRACED)) |
148 (tsk->exit_state & (EXIT_ZOMBIE | 149 tsk->exit_state;
149 EXIT_DEAD));
150 const char **p = &task_state_array[0]; 150 const char **p = &task_state_array[0];
151 151
152 while (state) { 152 while (state) {
@@ -161,8 +161,15 @@ static inline char *task_state(struct task_struct *p, char *buffer)
161 struct group_info *group_info; 161 struct group_info *group_info;
162 int g; 162 int g;
163 struct fdtable *fdt = NULL; 163 struct fdtable *fdt = NULL;
164 struct pid_namespace *ns;
165 pid_t ppid, tpid;
164 166
167 ns = current->nsproxy->pid_ns;
165 rcu_read_lock(); 168 rcu_read_lock();
169 ppid = pid_alive(p) ?
170 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
171 tpid = pid_alive(p) && p->ptrace ?
172 task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0;
166 buffer += sprintf(buffer, 173 buffer += sprintf(buffer,
167 "State:\t%s\n" 174 "State:\t%s\n"
168 "Tgid:\t%d\n" 175 "Tgid:\t%d\n"
@@ -172,9 +179,9 @@ static inline char *task_state(struct task_struct *p, char *buffer)
172 "Uid:\t%d\t%d\t%d\t%d\n" 179 "Uid:\t%d\t%d\t%d\t%d\n"
173 "Gid:\t%d\t%d\t%d\t%d\n", 180 "Gid:\t%d\t%d\t%d\t%d\n",
174 get_task_state(p), 181 get_task_state(p),
175 p->tgid, p->pid, 182 task_tgid_nr_ns(p, ns),
176 pid_alive(p) ? rcu_dereference(p->real_parent)->tgid : 0, 183 task_pid_nr_ns(p, ns),
177 pid_alive(p) && p->ptrace ? rcu_dereference(p->parent)->pid : 0, 184 ppid, tpid,
178 p->uid, p->euid, p->suid, p->fsuid, 185 p->uid, p->euid, p->suid, p->fsuid,
179 p->gid, p->egid, p->sgid, p->fsgid); 186 p->gid, p->egid, p->sgid, p->fsgid);
180 187
@@ -394,6 +401,9 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
394 unsigned long rsslim = 0; 401 unsigned long rsslim = 0;
395 char tcomm[sizeof(task->comm)]; 402 char tcomm[sizeof(task->comm)];
396 unsigned long flags; 403 unsigned long flags;
404 struct pid_namespace *ns;
405
406 ns = current->nsproxy->pid_ns;
397 407
398 state = *get_task_state(task); 408 state = *get_task_state(task);
399 vsize = eip = esp = 0; 409 vsize = eip = esp = 0;
@@ -416,7 +426,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
416 struct signal_struct *sig = task->signal; 426 struct signal_struct *sig = task->signal;
417 427
418 if (sig->tty) { 428 if (sig->tty) {
419 tty_pgrp = pid_nr(sig->tty->pgrp); 429 tty_pgrp = pid_nr_ns(sig->tty->pgrp, ns);
420 tty_nr = new_encode_dev(tty_devnum(sig->tty)); 430 tty_nr = new_encode_dev(tty_devnum(sig->tty));
421 } 431 }
422 432
@@ -446,12 +456,12 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
446 maj_flt += sig->maj_flt; 456 maj_flt += sig->maj_flt;
447 utime = cputime_add(utime, sig->utime); 457 utime = cputime_add(utime, sig->utime);
448 stime = cputime_add(stime, sig->stime); 458 stime = cputime_add(stime, sig->stime);
449 gtime += cputime_add(gtime, sig->gtime); 459 gtime = cputime_add(gtime, sig->gtime);
450 } 460 }
451 461
452 sid = signal_session(sig); 462 sid = task_session_nr_ns(task, ns);
453 pgid = process_group(task); 463 pgid = task_pgrp_nr_ns(task, ns);
454 ppid = rcu_dereference(task->real_parent)->tgid; 464 ppid = task_ppid_nr_ns(task, ns);
455 465
456 unlock_task_sighand(task, &flags); 466 unlock_task_sighand(task, &flags);
457 } 467 }
@@ -483,7 +493,7 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
483 res = sprintf(buffer, "%d (%s) %c %d %d %d %d %d %u %lu \ 493 res = sprintf(buffer, "%d (%s) %c %d %d %d %d %d %u %lu \
484%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \ 494%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
485%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n", 495%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n",
486 task->pid, 496 task_pid_nr_ns(task, ns),
487 tcomm, 497 tcomm,
488 state, 498 state,
489 ppid, 499 ppid,
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 4fe74d156416..39a3d7c969c5 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -63,16 +63,19 @@
63#include <linux/mm.h> 63#include <linux/mm.h>
64#include <linux/rcupdate.h> 64#include <linux/rcupdate.h>
65#include <linux/kallsyms.h> 65#include <linux/kallsyms.h>
66#include <linux/resource.h>
66#include <linux/module.h> 67#include <linux/module.h>
67#include <linux/mount.h> 68#include <linux/mount.h>
68#include <linux/security.h> 69#include <linux/security.h>
69#include <linux/ptrace.h> 70#include <linux/ptrace.h>
71#include <linux/cgroup.h>
70#include <linux/cpuset.h> 72#include <linux/cpuset.h>
71#include <linux/audit.h> 73#include <linux/audit.h>
72#include <linux/poll.h> 74#include <linux/poll.h>
73#include <linux/nsproxy.h> 75#include <linux/nsproxy.h>
74#include <linux/oom.h> 76#include <linux/oom.h>
75#include <linux/elf.h> 77#include <linux/elf.h>
78#include <linux/pid_namespace.h>
76#include "internal.h" 79#include "internal.h"
77 80
78/* NOTE: 81/* NOTE:
@@ -301,6 +304,78 @@ static int proc_oom_score(struct task_struct *task, char *buffer)
301 return sprintf(buffer, "%lu\n", points); 304 return sprintf(buffer, "%lu\n", points);
302} 305}
303 306
307struct limit_names {
308 char *name;
309 char *unit;
310};
311
312static const struct limit_names lnames[RLIM_NLIMITS] = {
313 [RLIMIT_CPU] = {"Max cpu time", "ms"},
314 [RLIMIT_FSIZE] = {"Max file size", "bytes"},
315 [RLIMIT_DATA] = {"Max data size", "bytes"},
316 [RLIMIT_STACK] = {"Max stack size", "bytes"},
317 [RLIMIT_CORE] = {"Max core file size", "bytes"},
318 [RLIMIT_RSS] = {"Max resident set", "bytes"},
319 [RLIMIT_NPROC] = {"Max processes", "processes"},
320 [RLIMIT_NOFILE] = {"Max open files", "files"},
321 [RLIMIT_MEMLOCK] = {"Max locked memory", "bytes"},
322 [RLIMIT_AS] = {"Max address space", "bytes"},
323 [RLIMIT_LOCKS] = {"Max file locks", "locks"},
324 [RLIMIT_SIGPENDING] = {"Max pending signals", "signals"},
325 [RLIMIT_MSGQUEUE] = {"Max msgqueue size", "bytes"},
326 [RLIMIT_NICE] = {"Max nice priority", NULL},
327 [RLIMIT_RTPRIO] = {"Max realtime priority", NULL},
328};
329
330/* Display limits for a process */
331static int proc_pid_limits(struct task_struct *task, char *buffer)
332{
333 unsigned int i;
334 int count = 0;
335 unsigned long flags;
336 char *bufptr = buffer;
337
338 struct rlimit rlim[RLIM_NLIMITS];
339
340 rcu_read_lock();
341 if (!lock_task_sighand(task,&flags)) {
342 rcu_read_unlock();
343 return 0;
344 }
345 memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS);
346 unlock_task_sighand(task, &flags);
347 rcu_read_unlock();
348
349 /*
350 * print the file header
351 */
352 count += sprintf(&bufptr[count], "%-25s %-20s %-20s %-10s\n",
353 "Limit", "Soft Limit", "Hard Limit", "Units");
354
355 for (i = 0; i < RLIM_NLIMITS; i++) {
356 if (rlim[i].rlim_cur == RLIM_INFINITY)
357 count += sprintf(&bufptr[count], "%-25s %-20s ",
358 lnames[i].name, "unlimited");
359 else
360 count += sprintf(&bufptr[count], "%-25s %-20lu ",
361 lnames[i].name, rlim[i].rlim_cur);
362
363 if (rlim[i].rlim_max == RLIM_INFINITY)
364 count += sprintf(&bufptr[count], "%-20s ", "unlimited");
365 else
366 count += sprintf(&bufptr[count], "%-20lu ",
367 rlim[i].rlim_max);
368
369 if (lnames[i].unit)
370 count += sprintf(&bufptr[count], "%-10s\n",
371 lnames[i].unit);
372 else
373 count += sprintf(&bufptr[count], "\n");
374 }
375
376 return count;
377}
378
304/************************************************************************/ 379/************************************************************************/
305/* Here the fs part begins */ 380/* Here the fs part begins */
306/************************************************************************/ 381/************************************************************************/
@@ -349,18 +424,21 @@ struct proc_mounts {
349static int mounts_open(struct inode *inode, struct file *file) 424static int mounts_open(struct inode *inode, struct file *file)
350{ 425{
351 struct task_struct *task = get_proc_task(inode); 426 struct task_struct *task = get_proc_task(inode);
427 struct nsproxy *nsp;
352 struct mnt_namespace *ns = NULL; 428 struct mnt_namespace *ns = NULL;
353 struct proc_mounts *p; 429 struct proc_mounts *p;
354 int ret = -EINVAL; 430 int ret = -EINVAL;
355 431
356 if (task) { 432 if (task) {
357 task_lock(task); 433 rcu_read_lock();
358 if (task->nsproxy) { 434 nsp = task_nsproxy(task);
359 ns = task->nsproxy->mnt_ns; 435 if (nsp) {
436 ns = nsp->mnt_ns;
360 if (ns) 437 if (ns)
361 get_mnt_ns(ns); 438 get_mnt_ns(ns);
362 } 439 }
363 task_unlock(task); 440 rcu_read_unlock();
441
364 put_task_struct(task); 442 put_task_struct(task);
365 } 443 }
366 444
@@ -423,16 +501,20 @@ static int mountstats_open(struct inode *inode, struct file *file)
423 501
424 if (!ret) { 502 if (!ret) {
425 struct seq_file *m = file->private_data; 503 struct seq_file *m = file->private_data;
504 struct nsproxy *nsp;
426 struct mnt_namespace *mnt_ns = NULL; 505 struct mnt_namespace *mnt_ns = NULL;
427 struct task_struct *task = get_proc_task(inode); 506 struct task_struct *task = get_proc_task(inode);
428 507
429 if (task) { 508 if (task) {
430 task_lock(task); 509 rcu_read_lock();
431 if (task->nsproxy) 510 nsp = task_nsproxy(task);
432 mnt_ns = task->nsproxy->mnt_ns; 511 if (nsp) {
433 if (mnt_ns) 512 mnt_ns = nsp->mnt_ns;
434 get_mnt_ns(mnt_ns); 513 if (mnt_ns)
435 task_unlock(task); 514 get_mnt_ns(mnt_ns);
515 }
516 rcu_read_unlock();
517
436 put_task_struct(task); 518 put_task_struct(task);
437 } 519 }
438 520
@@ -1437,7 +1519,7 @@ static int proc_readfd_common(struct file * filp, void * dirent,
1437 struct dentry *dentry = filp->f_path.dentry; 1519 struct dentry *dentry = filp->f_path.dentry;
1438 struct inode *inode = dentry->d_inode; 1520 struct inode *inode = dentry->d_inode;
1439 struct task_struct *p = get_proc_task(inode); 1521 struct task_struct *p = get_proc_task(inode);
1440 unsigned int fd, tid, ino; 1522 unsigned int fd, ino;
1441 int retval; 1523 int retval;
1442 struct files_struct * files; 1524 struct files_struct * files;
1443 struct fdtable *fdt; 1525 struct fdtable *fdt;
@@ -1446,7 +1528,6 @@ static int proc_readfd_common(struct file * filp, void * dirent,
1446 if (!p) 1528 if (!p)
1447 goto out_no_task; 1529 goto out_no_task;
1448 retval = 0; 1530 retval = 0;
1449 tid = p->pid;
1450 1531
1451 fd = filp->f_pos; 1532 fd = filp->f_pos;
1452 switch (fd) { 1533 switch (fd) {
@@ -1681,7 +1762,6 @@ static int proc_pident_readdir(struct file *filp,
1681 const struct pid_entry *ents, unsigned int nents) 1762 const struct pid_entry *ents, unsigned int nents)
1682{ 1763{
1683 int i; 1764 int i;
1684 int pid;
1685 struct dentry *dentry = filp->f_path.dentry; 1765 struct dentry *dentry = filp->f_path.dentry;
1686 struct inode *inode = dentry->d_inode; 1766 struct inode *inode = dentry->d_inode;
1687 struct task_struct *task = get_proc_task(inode); 1767 struct task_struct *task = get_proc_task(inode);
@@ -1694,7 +1774,6 @@ static int proc_pident_readdir(struct file *filp,
1694 goto out_no_task; 1774 goto out_no_task;
1695 1775
1696 ret = 0; 1776 ret = 0;
1697 pid = task->pid;
1698 i = filp->f_pos; 1777 i = filp->f_pos;
1699 switch (i) { 1778 switch (i) {
1700 case 0: 1779 case 0:
@@ -1928,14 +2007,14 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
1928 int buflen) 2007 int buflen)
1929{ 2008{
1930 char tmp[PROC_NUMBUF]; 2009 char tmp[PROC_NUMBUF];
1931 sprintf(tmp, "%d", current->tgid); 2010 sprintf(tmp, "%d", task_tgid_vnr(current));
1932 return vfs_readlink(dentry,buffer,buflen,tmp); 2011 return vfs_readlink(dentry,buffer,buflen,tmp);
1933} 2012}
1934 2013
1935static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) 2014static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
1936{ 2015{
1937 char tmp[PROC_NUMBUF]; 2016 char tmp[PROC_NUMBUF];
1938 sprintf(tmp, "%d", current->tgid); 2017 sprintf(tmp, "%d", task_tgid_vnr(current));
1939 return ERR_PTR(vfs_follow_link(nd,tmp)); 2018 return ERR_PTR(vfs_follow_link(nd,tmp));
1940} 2019}
1941 2020
@@ -2101,6 +2180,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2101 REG("environ", S_IRUSR, environ), 2180 REG("environ", S_IRUSR, environ),
2102 INF("auxv", S_IRUSR, pid_auxv), 2181 INF("auxv", S_IRUSR, pid_auxv),
2103 INF("status", S_IRUGO, pid_status), 2182 INF("status", S_IRUGO, pid_status),
2183 INF("limits", S_IRUSR, pid_limits),
2104#ifdef CONFIG_SCHED_DEBUG 2184#ifdef CONFIG_SCHED_DEBUG
2105 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2185 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
2106#endif 2186#endif
@@ -2130,9 +2210,12 @@ static const struct pid_entry tgid_base_stuff[] = {
2130#ifdef CONFIG_SCHEDSTATS 2210#ifdef CONFIG_SCHEDSTATS
2131 INF("schedstat", S_IRUGO, pid_schedstat), 2211 INF("schedstat", S_IRUGO, pid_schedstat),
2132#endif 2212#endif
2133#ifdef CONFIG_CPUSETS 2213#ifdef CONFIG_PROC_PID_CPUSET
2134 REG("cpuset", S_IRUGO, cpuset), 2214 REG("cpuset", S_IRUGO, cpuset),
2135#endif 2215#endif
2216#ifdef CONFIG_CGROUPS
2217 REG("cgroup", S_IRUGO, cgroup),
2218#endif
2136 INF("oom_score", S_IRUGO, oom_score), 2219 INF("oom_score", S_IRUGO, oom_score),
2137 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), 2220 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust),
2138#ifdef CONFIG_AUDITSYSCALL 2221#ifdef CONFIG_AUDITSYSCALL
@@ -2193,27 +2276,27 @@ static const struct inode_operations proc_tgid_base_inode_operations = {
2193 * that no dcache entries will exist at process exit time it 2276 * that no dcache entries will exist at process exit time it
2194 * just makes it very unlikely that any will persist. 2277 * just makes it very unlikely that any will persist.
2195 */ 2278 */
2196void proc_flush_task(struct task_struct *task) 2279static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
2197{ 2280{
2198 struct dentry *dentry, *leader, *dir; 2281 struct dentry *dentry, *leader, *dir;
2199 char buf[PROC_NUMBUF]; 2282 char buf[PROC_NUMBUF];
2200 struct qstr name; 2283 struct qstr name;
2201 2284
2202 name.name = buf; 2285 name.name = buf;
2203 name.len = snprintf(buf, sizeof(buf), "%d", task->pid); 2286 name.len = snprintf(buf, sizeof(buf), "%d", pid);
2204 dentry = d_hash_and_lookup(proc_mnt->mnt_root, &name); 2287 dentry = d_hash_and_lookup(mnt->mnt_root, &name);
2205 if (dentry) { 2288 if (dentry) {
2206 shrink_dcache_parent(dentry); 2289 shrink_dcache_parent(dentry);
2207 d_drop(dentry); 2290 d_drop(dentry);
2208 dput(dentry); 2291 dput(dentry);
2209 } 2292 }
2210 2293
2211 if (thread_group_leader(task)) 2294 if (tgid == 0)
2212 goto out; 2295 goto out;
2213 2296
2214 name.name = buf; 2297 name.name = buf;
2215 name.len = snprintf(buf, sizeof(buf), "%d", task->tgid); 2298 name.len = snprintf(buf, sizeof(buf), "%d", tgid);
2216 leader = d_hash_and_lookup(proc_mnt->mnt_root, &name); 2299 leader = d_hash_and_lookup(mnt->mnt_root, &name);
2217 if (!leader) 2300 if (!leader)
2218 goto out; 2301 goto out;
2219 2302
@@ -2224,7 +2307,7 @@ void proc_flush_task(struct task_struct *task)
2224 goto out_put_leader; 2307 goto out_put_leader;
2225 2308
2226 name.name = buf; 2309 name.name = buf;
2227 name.len = snprintf(buf, sizeof(buf), "%d", task->pid); 2310 name.len = snprintf(buf, sizeof(buf), "%d", pid);
2228 dentry = d_hash_and_lookup(dir, &name); 2311 dentry = d_hash_and_lookup(dir, &name);
2229 if (dentry) { 2312 if (dentry) {
2230 shrink_dcache_parent(dentry); 2313 shrink_dcache_parent(dentry);
@@ -2239,6 +2322,36 @@ out:
2239 return; 2322 return;
2240} 2323}
2241 2324
2325/*
2326 * when flushing dentries from proc one need to flush them from global
2327 * proc (proc_mnt) and from all the namespaces' procs this task was seen
2328 * in. this call is supposed to make all this job.
2329 */
2330
2331void proc_flush_task(struct task_struct *task)
2332{
2333 int i, leader;
2334 struct pid *pid, *tgid;
2335 struct upid *upid;
2336
2337 leader = thread_group_leader(task);
2338 proc_flush_task_mnt(proc_mnt, task->pid, leader ? task->tgid : 0);
2339 pid = task_pid(task);
2340 if (pid->level == 0)
2341 return;
2342
2343 tgid = task_tgid(task);
2344 for (i = 1; i <= pid->level; i++) {
2345 upid = &pid->numbers[i];
2346 proc_flush_task_mnt(upid->ns->proc_mnt, upid->nr,
2347 leader ? 0 : tgid->numbers[i].nr);
2348 }
2349
2350 upid = &pid->numbers[pid->level];
2351 if (upid->nr == 1)
2352 pid_ns_release_proc(upid->ns);
2353}
2354
2242static struct dentry *proc_pid_instantiate(struct inode *dir, 2355static struct dentry *proc_pid_instantiate(struct inode *dir,
2243 struct dentry * dentry, 2356 struct dentry * dentry,
2244 struct task_struct *task, const void *ptr) 2357 struct task_struct *task, const void *ptr)
@@ -2274,6 +2387,7 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct
2274 struct dentry *result = ERR_PTR(-ENOENT); 2387 struct dentry *result = ERR_PTR(-ENOENT);
2275 struct task_struct *task; 2388 struct task_struct *task;
2276 unsigned tgid; 2389 unsigned tgid;
2390 struct pid_namespace *ns;
2277 2391
2278 result = proc_base_lookup(dir, dentry); 2392 result = proc_base_lookup(dir, dentry);
2279 if (!IS_ERR(result) || PTR_ERR(result) != -ENOENT) 2393 if (!IS_ERR(result) || PTR_ERR(result) != -ENOENT)
@@ -2283,8 +2397,9 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct
2283 if (tgid == ~0U) 2397 if (tgid == ~0U)
2284 goto out; 2398 goto out;
2285 2399
2400 ns = dentry->d_sb->s_fs_info;
2286 rcu_read_lock(); 2401 rcu_read_lock();
2287 task = find_task_by_pid(tgid); 2402 task = find_task_by_pid_ns(tgid, ns);
2288 if (task) 2403 if (task)
2289 get_task_struct(task); 2404 get_task_struct(task);
2290 rcu_read_unlock(); 2405 rcu_read_unlock();
@@ -2301,7 +2416,8 @@ out:
2301 * Find the first task with tgid >= tgid 2416 * Find the first task with tgid >= tgid
2302 * 2417 *
2303 */ 2418 */
2304static struct task_struct *next_tgid(unsigned int tgid) 2419static struct task_struct *next_tgid(unsigned int tgid,
2420 struct pid_namespace *ns)
2305{ 2421{
2306 struct task_struct *task; 2422 struct task_struct *task;
2307 struct pid *pid; 2423 struct pid *pid;
@@ -2309,9 +2425,9 @@ static struct task_struct *next_tgid(unsigned int tgid)
2309 rcu_read_lock(); 2425 rcu_read_lock();
2310retry: 2426retry:
2311 task = NULL; 2427 task = NULL;
2312 pid = find_ge_pid(tgid); 2428 pid = find_ge_pid(tgid, ns);
2313 if (pid) { 2429 if (pid) {
2314 tgid = pid->nr + 1; 2430 tgid = pid_nr_ns(pid, ns) + 1;
2315 task = pid_task(pid, PIDTYPE_PID); 2431 task = pid_task(pid, PIDTYPE_PID);
2316 /* What we to know is if the pid we have find is the 2432 /* What we to know is if the pid we have find is the
2317 * pid of a thread_group_leader. Testing for task 2433 * pid of a thread_group_leader. Testing for task
@@ -2351,6 +2467,7 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2351 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode); 2467 struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
2352 struct task_struct *task; 2468 struct task_struct *task;
2353 int tgid; 2469 int tgid;
2470 struct pid_namespace *ns;
2354 2471
2355 if (!reaper) 2472 if (!reaper)
2356 goto out_no_task; 2473 goto out_no_task;
@@ -2361,11 +2478,12 @@ int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
2361 goto out; 2478 goto out;
2362 } 2479 }
2363 2480
2481 ns = filp->f_dentry->d_sb->s_fs_info;
2364 tgid = filp->f_pos - TGID_OFFSET; 2482 tgid = filp->f_pos - TGID_OFFSET;
2365 for (task = next_tgid(tgid); 2483 for (task = next_tgid(tgid, ns);
2366 task; 2484 task;
2367 put_task_struct(task), task = next_tgid(tgid + 1)) { 2485 put_task_struct(task), task = next_tgid(tgid + 1, ns)) {
2368 tgid = task->pid; 2486 tgid = task_pid_nr_ns(task, ns);
2369 filp->f_pos = tgid + TGID_OFFSET; 2487 filp->f_pos = tgid + TGID_OFFSET;
2370 if (proc_pid_fill_cache(filp, dirent, filldir, task, tgid) < 0) { 2488 if (proc_pid_fill_cache(filp, dirent, filldir, task, tgid) < 0) {
2371 put_task_struct(task); 2489 put_task_struct(task);
@@ -2388,6 +2506,7 @@ static const struct pid_entry tid_base_stuff[] = {
2388 REG("environ", S_IRUSR, environ), 2506 REG("environ", S_IRUSR, environ),
2389 INF("auxv", S_IRUSR, pid_auxv), 2507 INF("auxv", S_IRUSR, pid_auxv),
2390 INF("status", S_IRUGO, pid_status), 2508 INF("status", S_IRUGO, pid_status),
2509 INF("limits", S_IRUSR, pid_limits),
2391#ifdef CONFIG_SCHED_DEBUG 2510#ifdef CONFIG_SCHED_DEBUG
2392 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2511 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
2393#endif 2512#endif
@@ -2416,9 +2535,12 @@ static const struct pid_entry tid_base_stuff[] = {
2416#ifdef CONFIG_SCHEDSTATS 2535#ifdef CONFIG_SCHEDSTATS
2417 INF("schedstat", S_IRUGO, pid_schedstat), 2536 INF("schedstat", S_IRUGO, pid_schedstat),
2418#endif 2537#endif
2419#ifdef CONFIG_CPUSETS 2538#ifdef CONFIG_PROC_PID_CPUSET
2420 REG("cpuset", S_IRUGO, cpuset), 2539 REG("cpuset", S_IRUGO, cpuset),
2421#endif 2540#endif
2541#ifdef CONFIG_CGROUPS
2542 REG("cgroup", S_IRUGO, cgroup),
2543#endif
2422 INF("oom_score", S_IRUGO, oom_score), 2544 INF("oom_score", S_IRUGO, oom_score),
2423 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), 2545 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust),
2424#ifdef CONFIG_AUDITSYSCALL 2546#ifdef CONFIG_AUDITSYSCALL
@@ -2486,6 +2608,7 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry
2486 struct task_struct *task; 2608 struct task_struct *task;
2487 struct task_struct *leader = get_proc_task(dir); 2609 struct task_struct *leader = get_proc_task(dir);
2488 unsigned tid; 2610 unsigned tid;
2611 struct pid_namespace *ns;
2489 2612
2490 if (!leader) 2613 if (!leader)
2491 goto out_no_task; 2614 goto out_no_task;
@@ -2494,14 +2617,15 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry
2494 if (tid == ~0U) 2617 if (tid == ~0U)
2495 goto out; 2618 goto out;
2496 2619
2620 ns = dentry->d_sb->s_fs_info;
2497 rcu_read_lock(); 2621 rcu_read_lock();
2498 task = find_task_by_pid(tid); 2622 task = find_task_by_pid_ns(tid, ns);
2499 if (task) 2623 if (task)
2500 get_task_struct(task); 2624 get_task_struct(task);
2501 rcu_read_unlock(); 2625 rcu_read_unlock();
2502 if (!task) 2626 if (!task)
2503 goto out; 2627 goto out;
2504 if (leader->tgid != task->tgid) 2628 if (!same_thread_group(leader, task))
2505 goto out_drop_task; 2629 goto out_drop_task;
2506 2630
2507 result = proc_task_instantiate(dir, dentry, task, NULL); 2631 result = proc_task_instantiate(dir, dentry, task, NULL);
@@ -2526,14 +2650,14 @@ out_no_task:
2526 * threads past it. 2650 * threads past it.
2527 */ 2651 */
2528static struct task_struct *first_tid(struct task_struct *leader, 2652static struct task_struct *first_tid(struct task_struct *leader,
2529 int tid, int nr) 2653 int tid, int nr, struct pid_namespace *ns)
2530{ 2654{
2531 struct task_struct *pos; 2655 struct task_struct *pos;
2532 2656
2533 rcu_read_lock(); 2657 rcu_read_lock();
2534 /* Attempt to start with the pid of a thread */ 2658 /* Attempt to start with the pid of a thread */
2535 if (tid && (nr > 0)) { 2659 if (tid && (nr > 0)) {
2536 pos = find_task_by_pid(tid); 2660 pos = find_task_by_pid_ns(tid, ns);
2537 if (pos && (pos->group_leader == leader)) 2661 if (pos && (pos->group_leader == leader))
2538 goto found; 2662 goto found;
2539 } 2663 }
@@ -2602,6 +2726,7 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
2602 ino_t ino; 2726 ino_t ino;
2603 int tid; 2727 int tid;
2604 unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */ 2728 unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */
2729 struct pid_namespace *ns;
2605 2730
2606 task = get_proc_task(inode); 2731 task = get_proc_task(inode);
2607 if (!task) 2732 if (!task)
@@ -2635,12 +2760,13 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
2635 /* f_version caches the tgid value that the last readdir call couldn't 2760 /* f_version caches the tgid value that the last readdir call couldn't
2636 * return. lseek aka telldir automagically resets f_version to 0. 2761 * return. lseek aka telldir automagically resets f_version to 0.
2637 */ 2762 */
2763 ns = filp->f_dentry->d_sb->s_fs_info;
2638 tid = (int)filp->f_version; 2764 tid = (int)filp->f_version;
2639 filp->f_version = 0; 2765 filp->f_version = 0;
2640 for (task = first_tid(leader, tid, pos - 2); 2766 for (task = first_tid(leader, tid, pos - 2, ns);
2641 task; 2767 task;
2642 task = next_tid(task), pos++) { 2768 task = next_tid(task), pos++) {
2643 tid = task->pid; 2769 tid = task_pid_nr_ns(task, ns);
2644 if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) { 2770 if (proc_task_fill_cache(filp, dirent, filldir, task, tid) < 0) {
2645 /* returning this tgid failed, save it as the first 2771 /* returning this tgid failed, save it as the first
2646 * pid for the next readir call */ 2772 * pid for the next readir call */
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 99ca00485fc3..abe6a3f04368 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -448,7 +448,7 @@ out_mod:
448 return NULL; 448 return NULL;
449} 449}
450 450
451int proc_fill_super(struct super_block *s, void *data, int silent) 451int proc_fill_super(struct super_block *s)
452{ 452{
453 struct inode * root_inode; 453 struct inode * root_inode;
454 454
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index d6dc72c78bc1..e0d064e9764e 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -91,7 +91,8 @@ static int loadavg_read_proc(char *page, char **start, off_t off,
91 LOAD_INT(a), LOAD_FRAC(a), 91 LOAD_INT(a), LOAD_FRAC(a),
92 LOAD_INT(b), LOAD_FRAC(b), 92 LOAD_INT(b), LOAD_FRAC(b),
93 LOAD_INT(c), LOAD_FRAC(c), 93 LOAD_INT(c), LOAD_FRAC(c),
94 nr_running(), nr_threads, current->nsproxy->pid_ns->last_pid); 94 nr_running(), nr_threads,
95 task_active_pid_ns(current)->last_pid);
95 return proc_calc_metrics(page, start, off, count, eof, len); 96 return proc_calc_metrics(page, start, off, count, eof, len);
96} 97}
97 98
diff --git a/fs/proc/root.c b/fs/proc/root.c
index cf3046638b09..ec9cb3b6c93b 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -18,32 +18,90 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/mount.h> 20#include <linux/mount.h>
21#include <linux/pid_namespace.h>
21 22
22#include "internal.h" 23#include "internal.h"
23 24
24struct proc_dir_entry *proc_bus, *proc_root_fs, *proc_root_driver; 25struct proc_dir_entry *proc_bus, *proc_root_fs, *proc_root_driver;
25 26
27static int proc_test_super(struct super_block *sb, void *data)
28{
29 return sb->s_fs_info == data;
30}
31
32static int proc_set_super(struct super_block *sb, void *data)
33{
34 struct pid_namespace *ns;
35
36 ns = (struct pid_namespace *)data;
37 sb->s_fs_info = get_pid_ns(ns);
38 return set_anon_super(sb, NULL);
39}
40
26static int proc_get_sb(struct file_system_type *fs_type, 41static int proc_get_sb(struct file_system_type *fs_type,
27 int flags, const char *dev_name, void *data, struct vfsmount *mnt) 42 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
28{ 43{
44 int err;
45 struct super_block *sb;
46 struct pid_namespace *ns;
47 struct proc_inode *ei;
48
29 if (proc_mnt) { 49 if (proc_mnt) {
30 /* Seed the root directory with a pid so it doesn't need 50 /* Seed the root directory with a pid so it doesn't need
31 * to be special in base.c. I would do this earlier but 51 * to be special in base.c. I would do this earlier but
32 * the only task alive when /proc is mounted the first time 52 * the only task alive when /proc is mounted the first time
33 * is the init_task and it doesn't have any pids. 53 * is the init_task and it doesn't have any pids.
34 */ 54 */
35 struct proc_inode *ei;
36 ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode); 55 ei = PROC_I(proc_mnt->mnt_sb->s_root->d_inode);
37 if (!ei->pid) 56 if (!ei->pid)
38 ei->pid = find_get_pid(1); 57 ei->pid = find_get_pid(1);
39 } 58 }
40 return get_sb_single(fs_type, flags, data, proc_fill_super, mnt); 59
60 if (flags & MS_KERNMOUNT)
61 ns = (struct pid_namespace *)data;
62 else
63 ns = current->nsproxy->pid_ns;
64
65 sb = sget(fs_type, proc_test_super, proc_set_super, ns);
66 if (IS_ERR(sb))
67 return PTR_ERR(sb);
68
69 if (!sb->s_root) {
70 sb->s_flags = flags;
71 err = proc_fill_super(sb);
72 if (err) {
73 up_write(&sb->s_umount);
74 deactivate_super(sb);
75 return err;
76 }
77
78 ei = PROC_I(sb->s_root->d_inode);
79 if (!ei->pid) {
80 rcu_read_lock();
81 ei->pid = get_pid(find_pid_ns(1, ns));
82 rcu_read_unlock();
83 }
84
85 sb->s_flags |= MS_ACTIVE;
86 ns->proc_mnt = mnt;
87 }
88
89 return simple_set_mnt(mnt, sb);
90}
91
92static void proc_kill_sb(struct super_block *sb)
93{
94 struct pid_namespace *ns;
95
96 ns = (struct pid_namespace *)sb->s_fs_info;
97 kill_anon_super(sb);
98 put_pid_ns(ns);
41} 99}
42 100
43static struct file_system_type proc_fs_type = { 101static struct file_system_type proc_fs_type = {
44 .name = "proc", 102 .name = "proc",
45 .get_sb = proc_get_sb, 103 .get_sb = proc_get_sb,
46 .kill_sb = kill_anon_super, 104 .kill_sb = proc_kill_sb,
47}; 105};
48 106
49void __init proc_root_init(void) 107void __init proc_root_init(void)
@@ -54,12 +112,13 @@ void __init proc_root_init(void)
54 err = register_filesystem(&proc_fs_type); 112 err = register_filesystem(&proc_fs_type);
55 if (err) 113 if (err)
56 return; 114 return;
57 proc_mnt = kern_mount(&proc_fs_type); 115 proc_mnt = kern_mount_data(&proc_fs_type, &init_pid_ns);
58 err = PTR_ERR(proc_mnt); 116 err = PTR_ERR(proc_mnt);
59 if (IS_ERR(proc_mnt)) { 117 if (IS_ERR(proc_mnt)) {
60 unregister_filesystem(&proc_fs_type); 118 unregister_filesystem(&proc_fs_type);
61 return; 119 return;
62 } 120 }
121
63 proc_misc_init(); 122 proc_misc_init();
64 123
65 proc_net_init(); 124 proc_net_init();
@@ -153,6 +212,22 @@ struct proc_dir_entry proc_root = {
153 .parent = &proc_root, 212 .parent = &proc_root,
154}; 213};
155 214
215int pid_ns_prepare_proc(struct pid_namespace *ns)
216{
217 struct vfsmount *mnt;
218
219 mnt = kern_mount_data(&proc_fs_type, ns);
220 if (IS_ERR(mnt))
221 return PTR_ERR(mnt);
222
223 return 0;
224}
225
226void pid_ns_release_proc(struct pid_namespace *ns)
227{
228 mntput(ns->proc_mnt);
229}
230
156EXPORT_SYMBOL(proc_symlink); 231EXPORT_SYMBOL(proc_symlink);
157EXPORT_SYMBOL(proc_mkdir); 232EXPORT_SYMBOL(proc_mkdir);
158EXPORT_SYMBOL(create_proc_entry); 233EXPORT_SYMBOL(create_proc_entry);
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index 2a5dd34649b3..16b331dd9913 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -47,7 +47,9 @@
47 test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)) 47 test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s))
48 48
49static inline void get_bit_address(struct super_block *s, 49static inline void get_bit_address(struct super_block *s,
50 b_blocknr_t block, int *bmap_nr, int *offset) 50 b_blocknr_t block,
51 unsigned int *bmap_nr,
52 unsigned int *offset)
51{ 53{
52 /* It is in the bitmap block number equal to the block 54 /* It is in the bitmap block number equal to the block
53 * number divided by the number of bits in a block. */ 55 * number divided by the number of bits in a block. */
@@ -56,10 +58,10 @@ static inline void get_bit_address(struct super_block *s,
56 *offset = block & ((s->s_blocksize << 3) - 1); 58 *offset = block & ((s->s_blocksize << 3) - 1);
57} 59}
58 60
59#ifdef CONFIG_REISERFS_CHECK
60int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) 61int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
61{ 62{
62 int bmap, offset; 63 unsigned int bmap, offset;
64 unsigned int bmap_count = reiserfs_bmap_count(s);
63 65
64 if (block == 0 || block >= SB_BLOCK_COUNT(s)) { 66 if (block == 0 || block >= SB_BLOCK_COUNT(s)) {
65 reiserfs_warning(s, 67 reiserfs_warning(s,
@@ -75,25 +77,26 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
75 if (unlikely(test_bit(REISERFS_OLD_FORMAT, 77 if (unlikely(test_bit(REISERFS_OLD_FORMAT,
76 &(REISERFS_SB(s)->s_properties)))) { 78 &(REISERFS_SB(s)->s_properties)))) {
77 b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1; 79 b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1;
78 if (block >= bmap1 && block <= bmap1 + SB_BMAP_NR(s)) { 80 if (block >= bmap1 &&
81 block <= bmap1 + bmap_count) {
79 reiserfs_warning(s, "vs: 4019: is_reusable: " 82 reiserfs_warning(s, "vs: 4019: is_reusable: "
80 "bitmap block %lu(%u) can't be freed or reused", 83 "bitmap block %lu(%u) can't be freed or reused",
81 block, SB_BMAP_NR(s)); 84 block, bmap_count);
82 return 0; 85 return 0;
83 } 86 }
84 } else { 87 } else {
85 if (offset == 0) { 88 if (offset == 0) {
86 reiserfs_warning(s, "vs: 4020: is_reusable: " 89 reiserfs_warning(s, "vs: 4020: is_reusable: "
87 "bitmap block %lu(%u) can't be freed or reused", 90 "bitmap block %lu(%u) can't be freed or reused",
88 block, SB_BMAP_NR(s)); 91 block, bmap_count);
89 return 0; 92 return 0;
90 } 93 }
91 } 94 }
92 95
93 if (bmap >= SB_BMAP_NR(s)) { 96 if (bmap >= bmap_count) {
94 reiserfs_warning(s, 97 reiserfs_warning(s,
95 "vs-4030: is_reusable: there is no so many bitmap blocks: " 98 "vs-4030: is_reusable: there is no so many bitmap blocks: "
96 "block=%lu, bitmap_nr=%d", block, bmap); 99 "block=%lu, bitmap_nr=%u", block, bmap);
97 return 0; 100 return 0;
98 } 101 }
99 102
@@ -106,12 +109,11 @@ int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value)
106 109
107 return 1; 110 return 1;
108} 111}
109#endif /* CONFIG_REISERFS_CHECK */
110 112
111/* searches in journal structures for a given block number (bmap, off). If block 113/* searches in journal structures for a given block number (bmap, off). If block
112 is found in reiserfs journal it suggests next free block candidate to test. */ 114 is found in reiserfs journal it suggests next free block candidate to test. */
113static inline int is_block_in_journal(struct super_block *s, int bmap, int 115static inline int is_block_in_journal(struct super_block *s, unsigned int bmap,
114 off, int *next) 116 int off, int *next)
115{ 117{
116 b_blocknr_t tmp; 118 b_blocknr_t tmp;
117 119
@@ -132,8 +134,8 @@ static inline int is_block_in_journal(struct super_block *s, int bmap, int
132/* it searches for a window of zero bits with given minimum and maximum lengths in one bitmap 134/* it searches for a window of zero bits with given minimum and maximum lengths in one bitmap
133 * block; */ 135 * block; */
134static int scan_bitmap_block(struct reiserfs_transaction_handle *th, 136static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
135 int bmap_n, int *beg, int boundary, int min, 137 unsigned int bmap_n, int *beg, int boundary,
136 int max, int unfm) 138 int min, int max, int unfm)
137{ 139{
138 struct super_block *s = th->t_super; 140 struct super_block *s = th->t_super;
139 struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n]; 141 struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n];
@@ -143,8 +145,8 @@ static int scan_bitmap_block(struct reiserfs_transaction_handle *th,
143 145
144 BUG_ON(!th->t_trans_id); 146 BUG_ON(!th->t_trans_id);
145 147
146 RFALSE(bmap_n >= SB_BMAP_NR(s), "Bitmap %d is out of range (0..%d)", 148 RFALSE(bmap_n >= reiserfs_bmap_count(s), "Bitmap %u is out of "
147 bmap_n, SB_BMAP_NR(s) - 1); 149 "range (0..%u)", bmap_n, reiserfs_bmap_count(s) - 1);
148 PROC_INFO_INC(s, scan_bitmap.bmap); 150 PROC_INFO_INC(s, scan_bitmap.bmap);
149/* this is unclear and lacks comments, explain how journal bitmaps 151/* this is unclear and lacks comments, explain how journal bitmaps
150 work here for the reader. Convey a sense of the design here. What 152 work here for the reader. Convey a sense of the design here. What
@@ -249,12 +251,12 @@ static int bmap_hash_id(struct super_block *s, u32 id)
249 } else { 251 } else {
250 hash_in = (char *)(&id); 252 hash_in = (char *)(&id);
251 hash = keyed_hash(hash_in, 4); 253 hash = keyed_hash(hash_in, 4);
252 bm = hash % SB_BMAP_NR(s); 254 bm = hash % reiserfs_bmap_count(s);
253 if (!bm) 255 if (!bm)
254 bm = 1; 256 bm = 1;
255 } 257 }
256 /* this can only be true when SB_BMAP_NR = 1 */ 258 /* this can only be true when SB_BMAP_NR = 1 */
257 if (bm >= SB_BMAP_NR(s)) 259 if (bm >= reiserfs_bmap_count(s))
258 bm = 0; 260 bm = 0;
259 return bm; 261 return bm;
260} 262}
@@ -273,7 +275,7 @@ static inline int block_group_used(struct super_block *s, u32 id)
273 * to make a better decision. This favors long-term performace gain 275 * to make a better decision. This favors long-term performace gain
274 * with a better on-disk layout vs. a short term gain of skipping the 276 * with a better on-disk layout vs. a short term gain of skipping the
275 * read and potentially having a bad placement. */ 277 * read and potentially having a bad placement. */
276 if (info->first_zero_hint == 0) { 278 if (info->free_count == UINT_MAX) {
277 struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm); 279 struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm);
278 brelse(bh); 280 brelse(bh);
279 } 281 }
@@ -309,16 +311,16 @@ __le32 reiserfs_choose_packing(struct inode * dir)
309 * bitmap and place new blocks there. Returns number of allocated blocks. */ 311 * bitmap and place new blocks there. Returns number of allocated blocks. */
310static int scan_bitmap(struct reiserfs_transaction_handle *th, 312static int scan_bitmap(struct reiserfs_transaction_handle *th,
311 b_blocknr_t * start, b_blocknr_t finish, 313 b_blocknr_t * start, b_blocknr_t finish,
312 int min, int max, int unfm, unsigned long file_block) 314 int min, int max, int unfm, sector_t file_block)
313{ 315{
314 int nr_allocated = 0; 316 int nr_allocated = 0;
315 struct super_block *s = th->t_super; 317 struct super_block *s = th->t_super;
316 /* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr 318 /* find every bm and bmap and bmap_nr in this file, and change them all to bitmap_blocknr
317 * - Hans, it is not a block number - Zam. */ 319 * - Hans, it is not a block number - Zam. */
318 320
319 int bm, off; 321 unsigned int bm, off;
320 int end_bm, end_off; 322 unsigned int end_bm, end_off;
321 int off_max = s->s_blocksize << 3; 323 unsigned int off_max = s->s_blocksize << 3;
322 324
323 BUG_ON(!th->t_trans_id); 325 BUG_ON(!th->t_trans_id);
324 326
@@ -328,10 +330,10 @@ static int scan_bitmap(struct reiserfs_transaction_handle *th,
328 330
329 get_bit_address(s, *start, &bm, &off); 331 get_bit_address(s, *start, &bm, &off);
330 get_bit_address(s, finish, &end_bm, &end_off); 332 get_bit_address(s, finish, &end_bm, &end_off);
331 if (bm > SB_BMAP_NR(s)) 333 if (bm > reiserfs_bmap_count(s))
332 return 0; 334 return 0;
333 if (end_bm > SB_BMAP_NR(s)) 335 if (end_bm > reiserfs_bmap_count(s))
334 end_bm = SB_BMAP_NR(s); 336 end_bm = reiserfs_bmap_count(s);
335 337
336 /* When the bitmap is more than 10% free, anyone can allocate. 338 /* When the bitmap is more than 10% free, anyone can allocate.
337 * When it's less than 10% free, only files that already use the 339 * When it's less than 10% free, only files that already use the
@@ -385,7 +387,7 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
385 struct reiserfs_super_block *rs; 387 struct reiserfs_super_block *rs;
386 struct buffer_head *sbh, *bmbh; 388 struct buffer_head *sbh, *bmbh;
387 struct reiserfs_bitmap_info *apbi; 389 struct reiserfs_bitmap_info *apbi;
388 int nr, offset; 390 unsigned int nr, offset;
389 391
390 BUG_ON(!th->t_trans_id); 392 BUG_ON(!th->t_trans_id);
391 393
@@ -397,10 +399,12 @@ static void _reiserfs_free_block(struct reiserfs_transaction_handle *th,
397 399
398 get_bit_address(s, block, &nr, &offset); 400 get_bit_address(s, block, &nr, &offset);
399 401
400 if (nr >= sb_bmap_nr(rs)) { 402 if (nr >= reiserfs_bmap_count(s)) {
401 reiserfs_warning(s, "vs-4075: reiserfs_free_block: " 403 reiserfs_warning(s, "vs-4075: reiserfs_free_block: "
402 "block %lu is out of range on %s", 404 "block %lu is out of range on %s "
403 block, reiserfs_bdevname(s)); 405 "(nr=%u,max=%u)", block,
406 reiserfs_bdevname(s), nr,
407 reiserfs_bmap_count(s));
404 return; 408 return;
405 } 409 }
406 410
@@ -434,12 +438,19 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
434 int for_unformatted) 438 int for_unformatted)
435{ 439{
436 struct super_block *s = th->t_super; 440 struct super_block *s = th->t_super;
437
438 BUG_ON(!th->t_trans_id); 441 BUG_ON(!th->t_trans_id);
439 442
440 RFALSE(!s, "vs-4061: trying to free block on nonexistent device"); 443 RFALSE(!s, "vs-4061: trying to free block on nonexistent device");
441 RFALSE(is_reusable(s, block, 1) == 0, 444 if (!is_reusable(s, block, 1))
442 "vs-4071: can not free such block"); 445 return;
446
447 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) {
448 reiserfs_panic(th->t_super, "bitmap-4072",
449 "Trying to free block outside file system "
450 "boundaries (%lu > %lu)",
451 block, sb_block_count(REISERFS_SB(s)->s_rs));
452 return;
453 }
443 /* mark it before we clear it, just in case */ 454 /* mark it before we clear it, just in case */
444 journal_mark_freed(th, s, block); 455 journal_mark_freed(th, s, block);
445 _reiserfs_free_block(th, inode, block, for_unformatted); 456 _reiserfs_free_block(th, inode, block, for_unformatted);
@@ -449,11 +460,11 @@ void reiserfs_free_block(struct reiserfs_transaction_handle *th,
449static void reiserfs_free_prealloc_block(struct reiserfs_transaction_handle *th, 460static void reiserfs_free_prealloc_block(struct reiserfs_transaction_handle *th,
450 struct inode *inode, b_blocknr_t block) 461 struct inode *inode, b_blocknr_t block)
451{ 462{
463 BUG_ON(!th->t_trans_id);
452 RFALSE(!th->t_super, 464 RFALSE(!th->t_super,
453 "vs-4060: trying to free block on nonexistent device"); 465 "vs-4060: trying to free block on nonexistent device");
454 RFALSE(is_reusable(th->t_super, block, 1) == 0, 466 if (!is_reusable(th->t_super, block, 1))
455 "vs-4070: can not free such block"); 467 return;
456 BUG_ON(!th->t_trans_id);
457 _reiserfs_free_block(th, inode, block, 1); 468 _reiserfs_free_block(th, inode, block, 1);
458} 469}
459 470
@@ -1207,27 +1218,22 @@ void reiserfs_cache_bitmap_metadata(struct super_block *sb,
1207{ 1218{
1208 unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size); 1219 unsigned long *cur = (unsigned long *)(bh->b_data + bh->b_size);
1209 1220
1210 info->first_zero_hint = 1 << (sb->s_blocksize_bits + 3); 1221 /* The first bit must ALWAYS be 1 */
1222 BUG_ON(!reiserfs_test_le_bit(0, (unsigned long *)bh->b_data));
1223
1224 info->free_count = 0;
1211 1225
1212 while (--cur >= (unsigned long *)bh->b_data) { 1226 while (--cur >= (unsigned long *)bh->b_data) {
1213 int base = ((char *)cur - bh->b_data) << 3; 1227 int i;
1214 1228
1215 /* 0 and ~0 are special, we can optimize for them */ 1229 /* 0 and ~0 are special, we can optimize for them */
1216 if (*cur == 0) { 1230 if (*cur == 0)
1217 info->first_zero_hint = base;
1218 info->free_count += BITS_PER_LONG; 1231 info->free_count += BITS_PER_LONG;
1219 } else if (*cur != ~0L) { /* A mix, investigate */ 1232 else if (*cur != ~0L) /* A mix, investigate */
1220 int b; 1233 for (i = BITS_PER_LONG - 1; i >= 0; i--)
1221 for (b = BITS_PER_LONG - 1; b >= 0; b--) { 1234 if (!reiserfs_test_le_bit(i, cur))
1222 if (!reiserfs_test_le_bit(b, cur)) {
1223 info->first_zero_hint = base + b;
1224 info->free_count++; 1235 info->free_count++;
1225 }
1226 }
1227 }
1228 } 1236 }
1229 /* The first bit must ALWAYS be 1 */
1230 BUG_ON(info->first_zero_hint == 0);
1231} 1237}
1232 1238
1233struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, 1239struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
@@ -1257,7 +1263,7 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
1257 BUG_ON(!buffer_uptodate(bh)); 1263 BUG_ON(!buffer_uptodate(bh));
1258 BUG_ON(atomic_read(&bh->b_count) == 0); 1264 BUG_ON(atomic_read(&bh->b_count) == 0);
1259 1265
1260 if (info->first_zero_hint == 0) 1266 if (info->free_count == UINT_MAX)
1261 reiserfs_cache_bitmap_metadata(sb, bh, info); 1267 reiserfs_cache_bitmap_metadata(sb, bh, info);
1262 } 1268 }
1263 1269
@@ -1267,12 +1273,13 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb,
1267int reiserfs_init_bitmap_cache(struct super_block *sb) 1273int reiserfs_init_bitmap_cache(struct super_block *sb)
1268{ 1274{
1269 struct reiserfs_bitmap_info *bitmap; 1275 struct reiserfs_bitmap_info *bitmap;
1276 unsigned int bmap_nr = reiserfs_bmap_count(sb);
1270 1277
1271 bitmap = vmalloc(sizeof (*bitmap) * SB_BMAP_NR(sb)); 1278 bitmap = vmalloc(sizeof(*bitmap) * bmap_nr);
1272 if (bitmap == NULL) 1279 if (bitmap == NULL)
1273 return -ENOMEM; 1280 return -ENOMEM;
1274 1281
1275 memset(bitmap, 0, sizeof (*bitmap) * SB_BMAP_NR(sb)); 1282 memset(bitmap, 0xff, sizeof(*bitmap) * bmap_nr);
1276 1283
1277 SB_AP_BITMAP(sb) = bitmap; 1284 SB_AP_BITMAP(sb) = bitmap;
1278 1285
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 9ea12004fa57..a991af96f3f0 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -199,7 +199,7 @@ static inline void set_block_dev_mapped(struct buffer_head *bh,
199// files which were created in the earlier version can not be longer, 199// files which were created in the earlier version can not be longer,
200// than 2 gb 200// than 2 gb
201// 201//
202static int file_capable(struct inode *inode, long block) 202static int file_capable(struct inode *inode, sector_t block)
203{ 203{
204 if (get_inode_item_key_version(inode) != KEY_FORMAT_3_5 || // it is new file. 204 if (get_inode_item_key_version(inode) != KEY_FORMAT_3_5 || // it is new file.
205 block < (1 << (31 - inode->i_sb->s_blocksize_bits))) // old file, but 'block' is inside of 2gb 205 block < (1 << (31 - inode->i_sb->s_blocksize_bits))) // old file, but 'block' is inside of 2gb
@@ -242,7 +242,7 @@ static int restart_transaction(struct reiserfs_transaction_handle *th,
242// Please improve the english/clarity in the comment above, as it is 242// Please improve the english/clarity in the comment above, as it is
243// hard to understand. 243// hard to understand.
244 244
245static int _get_block_create_0(struct inode *inode, long block, 245static int _get_block_create_0(struct inode *inode, sector_t block,
246 struct buffer_head *bh_result, int args) 246 struct buffer_head *bh_result, int args)
247{ 247{
248 INITIALIZE_PATH(path); 248 INITIALIZE_PATH(path);
@@ -250,7 +250,7 @@ static int _get_block_create_0(struct inode *inode, long block,
250 struct buffer_head *bh; 250 struct buffer_head *bh;
251 struct item_head *ih, tmp_ih; 251 struct item_head *ih, tmp_ih;
252 int fs_gen; 252 int fs_gen;
253 int blocknr; 253 b_blocknr_t blocknr;
254 char *p = NULL; 254 char *p = NULL;
255 int chars; 255 int chars;
256 int ret; 256 int ret;
@@ -569,7 +569,7 @@ static int convert_tail_for_hole(struct inode *inode,
569} 569}
570 570
571static inline int _allocate_block(struct reiserfs_transaction_handle *th, 571static inline int _allocate_block(struct reiserfs_transaction_handle *th,
572 long block, 572 sector_t block,
573 struct inode *inode, 573 struct inode *inode,
574 b_blocknr_t * allocated_block_nr, 574 b_blocknr_t * allocated_block_nr,
575 struct treepath *path, int flags) 575 struct treepath *path, int flags)
@@ -3061,7 +3061,11 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3061{ 3061{
3062 struct inode *inode = dentry->d_inode; 3062 struct inode *inode = dentry->d_inode;
3063 int error; 3063 int error;
3064 unsigned int ia_valid = attr->ia_valid; 3064 unsigned int ia_valid;
3065
3066 /* must be turned off for recursive notify_change calls */
3067 ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
3068
3065 reiserfs_write_lock(inode->i_sb); 3069 reiserfs_write_lock(inode->i_sb);
3066 if (attr->ia_valid & ATTR_SIZE) { 3070 if (attr->ia_valid & ATTR_SIZE) {
3067 /* version 2 items will be caught by the s_maxbytes check 3071 /* version 2 items will be caught by the s_maxbytes check
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 4cad9e75ef56..bb05a3e51b93 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -219,11 +219,12 @@ static void allocate_bitmap_nodes(struct super_block *p_s_sb)
219 } 219 }
220} 220}
221 221
222static int set_bit_in_list_bitmap(struct super_block *p_s_sb, int block, 222static int set_bit_in_list_bitmap(struct super_block *p_s_sb,
223 b_blocknr_t block,
223 struct reiserfs_list_bitmap *jb) 224 struct reiserfs_list_bitmap *jb)
224{ 225{
225 int bmap_nr = block / (p_s_sb->s_blocksize << 3); 226 unsigned int bmap_nr = block / (p_s_sb->s_blocksize << 3);
226 int bit_nr = block % (p_s_sb->s_blocksize << 3); 227 unsigned int bit_nr = block % (p_s_sb->s_blocksize << 3);
227 228
228 if (!jb->bitmaps[bmap_nr]) { 229 if (!jb->bitmaps[bmap_nr]) {
229 jb->bitmaps[bmap_nr] = get_bitmap_node(p_s_sb); 230 jb->bitmaps[bmap_nr] = get_bitmap_node(p_s_sb);
@@ -239,7 +240,7 @@ static void cleanup_bitmap_list(struct super_block *p_s_sb,
239 if (jb->bitmaps == NULL) 240 if (jb->bitmaps == NULL)
240 return; 241 return;
241 242
242 for (i = 0; i < SB_BMAP_NR(p_s_sb); i++) { 243 for (i = 0; i < reiserfs_bmap_count(p_s_sb); i++) {
243 if (jb->bitmaps[i]) { 244 if (jb->bitmaps[i]) {
244 free_bitmap_node(p_s_sb, jb->bitmaps[i]); 245 free_bitmap_node(p_s_sb, jb->bitmaps[i]);
245 jb->bitmaps[i] = NULL; 246 jb->bitmaps[i] = NULL;
@@ -289,7 +290,7 @@ static int free_bitmap_nodes(struct super_block *p_s_sb)
289*/ 290*/
290int reiserfs_allocate_list_bitmaps(struct super_block *p_s_sb, 291int reiserfs_allocate_list_bitmaps(struct super_block *p_s_sb,
291 struct reiserfs_list_bitmap *jb_array, 292 struct reiserfs_list_bitmap *jb_array,
292 int bmap_nr) 293 unsigned int bmap_nr)
293{ 294{
294 int i; 295 int i;
295 int failed = 0; 296 int failed = 0;
@@ -483,7 +484,7 @@ static inline struct reiserfs_journal_cnode *get_journal_hash_dev(struct
483** 484**
484*/ 485*/
485int reiserfs_in_journal(struct super_block *p_s_sb, 486int reiserfs_in_journal(struct super_block *p_s_sb,
486 int bmap_nr, int bit_nr, int search_all, 487 unsigned int bmap_nr, int bit_nr, int search_all,
487 b_blocknr_t * next_zero_bit) 488 b_blocknr_t * next_zero_bit)
488{ 489{
489 struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); 490 struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb);
@@ -1013,7 +1014,7 @@ static int flush_commit_list(struct super_block *s,
1013 struct reiserfs_journal_list *jl, int flushall) 1014 struct reiserfs_journal_list *jl, int flushall)
1014{ 1015{
1015 int i; 1016 int i;
1016 int bn; 1017 b_blocknr_t bn;
1017 struct buffer_head *tbh = NULL; 1018 struct buffer_head *tbh = NULL;
1018 unsigned long trans_id = jl->j_trans_id; 1019 unsigned long trans_id = jl->j_trans_id;
1019 struct reiserfs_journal *journal = SB_JOURNAL(s); 1020 struct reiserfs_journal *journal = SB_JOURNAL(s);
@@ -2307,8 +2308,9 @@ static int journal_read_transaction(struct super_block *p_s_sb,
2307 Right now it is only used from journal code. But later we might use it 2308 Right now it is only used from journal code. But later we might use it
2308 from other places. 2309 from other places.
2309 Note: Do not use journal_getblk/sb_getblk functions here! */ 2310 Note: Do not use journal_getblk/sb_getblk functions here! */
2310static struct buffer_head *reiserfs_breada(struct block_device *dev, int block, 2311static struct buffer_head *reiserfs_breada(struct block_device *dev,
2311 int bufsize, unsigned int max_block) 2312 b_blocknr_t block, int bufsize,
2313 b_blocknr_t max_block)
2312{ 2314{
2313 struct buffer_head *bhlist[BUFNR]; 2315 struct buffer_head *bhlist[BUFNR];
2314 unsigned int blocks = BUFNR; 2316 unsigned int blocks = BUFNR;
@@ -2732,7 +2734,7 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
2732 journal->j_persistent_trans = 0; 2734 journal->j_persistent_trans = 0;
2733 if (reiserfs_allocate_list_bitmaps(p_s_sb, 2735 if (reiserfs_allocate_list_bitmaps(p_s_sb,
2734 journal->j_list_bitmap, 2736 journal->j_list_bitmap,
2735 SB_BMAP_NR(p_s_sb))) 2737 reiserfs_bmap_count(p_s_sb)))
2736 goto free_and_return; 2738 goto free_and_return;
2737 allocate_bitmap_nodes(p_s_sb); 2739 allocate_bitmap_nodes(p_s_sb);
2738 2740
@@ -2740,7 +2742,7 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
2740 SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) = (old_format ? 2742 SB_JOURNAL_1st_RESERVED_BLOCK(p_s_sb) = (old_format ?
2741 REISERFS_OLD_DISK_OFFSET_IN_BYTES 2743 REISERFS_OLD_DISK_OFFSET_IN_BYTES
2742 / p_s_sb->s_blocksize + 2744 / p_s_sb->s_blocksize +
2743 SB_BMAP_NR(p_s_sb) + 2745 reiserfs_bmap_count(p_s_sb) +
2744 1 : 2746 1 :
2745 REISERFS_DISK_OFFSET_IN_BYTES / 2747 REISERFS_DISK_OFFSET_IN_BYTES /
2746 p_s_sb->s_blocksize + 2); 2748 p_s_sb->s_blocksize + 2);
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c
index bc808a91eeaa..5e7388b32d02 100644
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -356,13 +356,11 @@ extern struct tree_balance *cur_tb;
356void reiserfs_panic(struct super_block *sb, const char *fmt, ...) 356void reiserfs_panic(struct super_block *sb, const char *fmt, ...)
357{ 357{
358 do_reiserfs_warning(fmt); 358 do_reiserfs_warning(fmt);
359 printk(KERN_EMERG "REISERFS: panic (device %s): %s\n",
360 reiserfs_bdevname(sb), error_buf);
361 BUG();
362 359
363 /* this is not actually called, but makes reiserfs_panic() "noreturn" */ 360 dump_stack();
364 panic("REISERFS: panic (device %s): %s\n", 361
365 reiserfs_bdevname(sb), error_buf); 362 panic(KERN_EMERG "REISERFS: panic (device %s): %s\n",
363 reiserfs_bdevname(sb), error_buf);
366} 364}
367 365
368void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...) 366void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...)
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index 976cc7887a0d..f71c3948edef 100644
--- a/fs/reiserfs/resize.c
+++ b/fs/reiserfs/resize.c
@@ -61,7 +61,8 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
61 } 61 }
62 62
63 /* count used bits in last bitmap block */ 63 /* count used bits in last bitmap block */
64 block_r = SB_BLOCK_COUNT(s) - (SB_BMAP_NR(s) - 1) * s->s_blocksize * 8; 64 block_r = SB_BLOCK_COUNT(s) -
65 (reiserfs_bmap_count(s) - 1) * s->s_blocksize * 8;
65 66
66 /* count bitmap blocks in new fs */ 67 /* count bitmap blocks in new fs */
67 bmap_nr_new = block_count_new / (s->s_blocksize * 8); 68 bmap_nr_new = block_count_new / (s->s_blocksize * 8);
@@ -73,7 +74,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
73 74
74 /* save old values */ 75 /* save old values */
75 block_count = SB_BLOCK_COUNT(s); 76 block_count = SB_BLOCK_COUNT(s);
76 bmap_nr = SB_BMAP_NR(s); 77 bmap_nr = reiserfs_bmap_count(s);
77 78
78 /* resizing of reiserfs bitmaps (journal and real), if needed */ 79 /* resizing of reiserfs bitmaps (journal and real), if needed */
79 if (bmap_nr_new > bmap_nr) { 80 if (bmap_nr_new > bmap_nr) {
@@ -119,7 +120,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
119 return -ENOMEM; 120 return -ENOMEM;
120 } 121 }
121 memset(bitmap, 0, 122 memset(bitmap, 0,
122 sizeof(struct reiserfs_bitmap_info) * SB_BMAP_NR(s)); 123 sizeof(struct reiserfs_bitmap_info) * bmap_nr_new);
123 for (i = 0; i < bmap_nr; i++) 124 for (i = 0; i < bmap_nr; i++)
124 bitmap[i] = old_bitmap[i]; 125 bitmap[i] = old_bitmap[i];
125 126
@@ -143,7 +144,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
143 mark_buffer_dirty(bh); 144 mark_buffer_dirty(bh);
144 sync_dirty_buffer(bh); 145 sync_dirty_buffer(bh);
145 // update bitmap_info stuff 146 // update bitmap_info stuff
146 bitmap[i].first_zero_hint = 1;
147 bitmap[i].free_count = sb_blocksize(sb) * 8 - 1; 147 bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
148 brelse(bh); 148 brelse(bh);
149 } 149 }
@@ -173,8 +173,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
173 for (i = block_r; i < s->s_blocksize * 8; i++) 173 for (i = block_r; i < s->s_blocksize * 8; i++)
174 reiserfs_test_and_clear_le_bit(i, bh->b_data); 174 reiserfs_test_and_clear_le_bit(i, bh->b_data);
175 info->free_count += s->s_blocksize * 8 - block_r; 175 info->free_count += s->s_blocksize * 8 - block_r;
176 if (!info->first_zero_hint)
177 info->first_zero_hint = block_r;
178 176
179 journal_mark_dirty(&th, s, bh); 177 journal_mark_dirty(&th, s, bh);
180 brelse(bh); 178 brelse(bh);
@@ -196,9 +194,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
196 brelse(bh); 194 brelse(bh);
197 195
198 info->free_count -= s->s_blocksize * 8 - block_r_new; 196 info->free_count -= s->s_blocksize * 8 - block_r_new;
199 /* Extreme case where last bitmap is the only valid block in itself. */
200 if (!info->free_count)
201 info->first_zero_hint = 0;
202 /* update super */ 197 /* update super */
203 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1); 198 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
204 free_blocks = SB_FREE_BLOCKS(s); 199 free_blocks = SB_FREE_BLOCKS(s);
@@ -206,7 +201,7 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
206 free_blocks + (block_count_new - block_count - 201 free_blocks + (block_count_new - block_count -
207 (bmap_nr_new - bmap_nr))); 202 (bmap_nr_new - bmap_nr)));
208 PUT_SB_BLOCK_COUNT(s, block_count_new); 203 PUT_SB_BLOCK_COUNT(s, block_count_new);
209 PUT_SB_BMAP_NR(s, bmap_nr_new); 204 PUT_SB_BMAP_NR(s, bmap_would_wrap(bmap_nr_new) ? : bmap_nr_new);
210 s->s_dirt = 1; 205 s->s_dirt = 1;
211 206
212 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s)); 207 journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 981027d1187b..ca41567d7890 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -559,7 +559,7 @@ static int is_tree_node(struct buffer_head *bh, int level)
559/* The function is NOT SCHEDULE-SAFE! */ 559/* The function is NOT SCHEDULE-SAFE! */
560static void search_by_key_reada(struct super_block *s, 560static void search_by_key_reada(struct super_block *s,
561 struct buffer_head **bh, 561 struct buffer_head **bh,
562 unsigned long *b, int num) 562 b_blocknr_t *b, int num)
563{ 563{
564 int i, j; 564 int i, j;
565 565
@@ -611,7 +611,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /*
611 DISK_LEAF_NODE_LEVEL */ 611 DISK_LEAF_NODE_LEVEL */
612 ) 612 )
613{ 613{
614 int n_block_number; 614 b_blocknr_t n_block_number;
615 int expected_level; 615 int expected_level;
616 struct buffer_head *p_s_bh; 616 struct buffer_head *p_s_bh;
617 struct path_element *p_s_last_element; 617 struct path_element *p_s_last_element;
@@ -619,7 +619,7 @@ int search_by_key(struct super_block *p_s_sb, const struct cpu_key *p_s_key, /*
619 int right_neighbor_of_leaf_node; 619 int right_neighbor_of_leaf_node;
620 int fs_gen; 620 int fs_gen;
621 struct buffer_head *reada_bh[SEARCH_BY_KEY_READA]; 621 struct buffer_head *reada_bh[SEARCH_BY_KEY_READA];
622 unsigned long reada_blocks[SEARCH_BY_KEY_READA]; 622 b_blocknr_t reada_blocks[SEARCH_BY_KEY_READA];
623 int reada_count = 0; 623 int reada_count = 0;
624 624
625#ifdef CONFIG_REISERFS_CHECK 625#ifdef CONFIG_REISERFS_CHECK
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index b82897ae090b..98c3781bc069 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -319,7 +319,7 @@ static int finish_unfinished(struct super_block *s)
319 319
320/* to protect file being unlinked from getting lost we "safe" link files 320/* to protect file being unlinked from getting lost we "safe" link files
321 being unlinked. This link will be deleted in the same transaction with last 321 being unlinked. This link will be deleted in the same transaction with last
322 item of file. mounting the filesytem we scan all these links and remove 322 item of file. mounting the filesystem we scan all these links and remove
323 files which almost got lost */ 323 files which almost got lost */
324void add_save_link(struct reiserfs_transaction_handle *th, 324void add_save_link(struct reiserfs_transaction_handle *th,
325 struct inode *inode, int truncate) 325 struct inode *inode, int truncate)
@@ -1725,6 +1725,21 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1725 set_sb_umount_state(rs, REISERFS_ERROR_FS); 1725 set_sb_umount_state(rs, REISERFS_ERROR_FS);
1726 set_sb_fs_state(rs, 0); 1726 set_sb_fs_state(rs, 0);
1727 1727
1728 /* Clear out s_bmap_nr if it would wrap. We can handle this
1729 * case, but older revisions can't. This will cause the
1730 * file system to fail mount on those older implementations,
1731 * avoiding corruption. -jeffm */
1732 if (bmap_would_wrap(reiserfs_bmap_count(s)) &&
1733 sb_bmap_nr(rs) != 0) {
1734 reiserfs_warning(s, "super-2030: This file system "
1735 "claims to use %u bitmap blocks in "
1736 "its super block, but requires %u. "
1737 "Clearing to zero.", sb_bmap_nr(rs),
1738 reiserfs_bmap_count(s));
1739
1740 set_sb_bmap_nr(rs, 0);
1741 }
1742
1728 if (old_format_only(s)) { 1743 if (old_format_only(s)) {
1729 /* filesystem of format 3.5 either with standard or non-standard 1744 /* filesystem of format 3.5 either with standard or non-standard
1730 journal */ 1745 journal */
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index fab4b9b2664f..1597f6b649e0 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -484,7 +484,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
484 /* Resize it so we're ok to write there */ 484 /* Resize it so we're ok to write there */
485 newattrs.ia_size = buffer_size; 485 newattrs.ia_size = buffer_size;
486 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 486 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
487 mutex_lock(&xinode->i_mutex); 487 mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR);
488 err = notify_change(fp->f_path.dentry, &newattrs); 488 err = notify_change(fp->f_path.dentry, &newattrs);
489 if (err) 489 if (err)
490 goto out_filp; 490 goto out_filp;
@@ -1223,7 +1223,8 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags)
1223 if (!IS_ERR(dentry)) { 1223 if (!IS_ERR(dentry)) {
1224 if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) { 1224 if (!(mount_flags & MS_RDONLY) && !dentry->d_inode) {
1225 struct inode *inode = dentry->d_parent->d_inode; 1225 struct inode *inode = dentry->d_parent->d_inode;
1226 mutex_lock(&inode->i_mutex); 1226 mutex_lock_nested(&inode->i_mutex,
1227 I_MUTEX_XATTR);
1227 err = inode->i_op->mkdir(inode, dentry, 0700); 1228 err = inode->i_op->mkdir(inode, dentry, 0700);
1228 mutex_unlock(&inode->i_mutex); 1229 mutex_unlock(&inode->i_mutex);
1229 if (err) { 1230 if (err) {
diff --git a/fs/select.c b/fs/select.c
index 7dede89658f5..47f47925aea2 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -177,11 +177,6 @@ get_max:
177 return max; 177 return max;
178} 178}
179 179
180#define BIT(i) (1UL << ((i)&(__NFDBITS-1)))
181#define MEM(i,m) ((m)+(unsigned)(i)/__NFDBITS)
182#define ISSET(i,m) (((i)&*(m)) != 0)
183#define SET(i,m) (*(m) |= (i))
184
185#define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR) 180#define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR)
186#define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR) 181#define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR)
187#define POLLEX_SET (POLLPRI) 182#define POLLEX_SET (POLLPRI)
diff --git a/fs/super.c b/fs/super.c
index 1bfcca2104be..ceaf2e3d594c 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -15,7 +15,7 @@
15 * Added kerneld support: Jacques Gelinas and Bjorn Ekwall 15 * Added kerneld support: Jacques Gelinas and Bjorn Ekwall
16 * Added change_root: Werner Almesberger & Hans Lermen, Feb '96 16 * Added change_root: Werner Almesberger & Hans Lermen, Feb '96
17 * Added options to /proc/mounts: 17 * Added options to /proc/mounts:
18 * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996. 18 * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996.
19 * Added devfs support: Richard Gooch <rgooch@atnf.csiro.au>, 13-JAN-1998 19 * Added devfs support: Richard Gooch <rgooch@atnf.csiro.au>, 13-JAN-1998
20 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000 20 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
21 */ 21 */
@@ -40,10 +40,6 @@
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41 41
42 42
43void get_filesystem(struct file_system_type *fs);
44void put_filesystem(struct file_system_type *fs);
45struct file_system_type *get_fs_type(const char *name);
46
47LIST_HEAD(super_blocks); 43LIST_HEAD(super_blocks);
48DEFINE_SPINLOCK(sb_lock); 44DEFINE_SPINLOCK(sb_lock);
49 45
@@ -336,21 +332,21 @@ struct super_block *sget(struct file_system_type *type,
336 void *data) 332 void *data)
337{ 333{
338 struct super_block *s = NULL; 334 struct super_block *s = NULL;
339 struct list_head *p; 335 struct super_block *old;
340 int err; 336 int err;
341 337
342retry: 338retry:
343 spin_lock(&sb_lock); 339 spin_lock(&sb_lock);
344 if (test) list_for_each(p, &type->fs_supers) { 340 if (test) {
345 struct super_block *old; 341 list_for_each_entry(old, &type->fs_supers, s_instances) {
346 old = list_entry(p, struct super_block, s_instances); 342 if (!test(old, data))
347 if (!test(old, data)) 343 continue;
348 continue; 344 if (!grab_super(old))
349 if (!grab_super(old)) 345 goto retry;
350 goto retry; 346 if (s)
351 if (s) 347 destroy_super(s);
352 destroy_super(s); 348 return old;
353 return old; 349 }
354 } 350 }
355 if (!s) { 351 if (!s) {
356 spin_unlock(&sb_lock); 352 spin_unlock(&sb_lock);
@@ -421,7 +417,7 @@ restart:
421} 417}
422 418
423/* 419/*
424 * Call the ->sync_fs super_op against all filesytems which are r/w and 420 * Call the ->sync_fs super_op against all filesystems which are r/w and
425 * which implement it. 421 * which implement it.
426 * 422 *
427 * This operation is careful to avoid the livelock which could easily happen 423 * This operation is careful to avoid the livelock which could easily happen
@@ -429,7 +425,7 @@ restart:
429 * is used only here. We set it against all filesystems and then clear it as 425 * is used only here. We set it against all filesystems and then clear it as
430 * we sync them. So redirtied filesystems are skipped. 426 * we sync them. So redirtied filesystems are skipped.
431 * 427 *
432 * But if process A is currently running sync_filesytems and then process B 428 * But if process A is currently running sync_filesystems and then process B
433 * calls sync_filesystems as well, process B will set all the s_need_sync_fs 429 * calls sync_filesystems as well, process B will set all the s_need_sync_fs
434 * flags again, which will cause process A to resync everything. Fix that with 430 * flags again, which will cause process A to resync everything. Fix that with
435 * a local mutex. 431 * a local mutex.
@@ -948,9 +944,9 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
948 return mnt; 944 return mnt;
949} 945}
950 946
951struct vfsmount *kern_mount(struct file_system_type *type) 947struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
952{ 948{
953 return vfs_kern_mount(type, 0, type->name, NULL); 949 return vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
954} 950}
955 951
956EXPORT_SYMBOL(kern_mount); 952EXPORT_SYMBOL_GPL(kern_mount_data);
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index d3be1e7fb48b..27d1785b7644 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -540,7 +540,7 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr,
540/** 540/**
541 * sysfs_create_file - create an attribute file for an object. 541 * sysfs_create_file - create an attribute file for an object.
542 * @kobj: object we're creating for. 542 * @kobj: object we're creating for.
543 * @attr: atrribute descriptor. 543 * @attr: attribute descriptor.
544 */ 544 */
545 545
546int sysfs_create_file(struct kobject * kobj, const struct attribute * attr) 546int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index 726449d4fd22..3586c7a28d2c 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -54,8 +54,8 @@ xfs_fs_decode_fh(
54 struct dentry *de), 54 struct dentry *de),
55 void *context) 55 void *context)
56{ 56{
57 xfs_fid2_t ifid; 57 xfs_fid_t ifid;
58 xfs_fid2_t pfid; 58 xfs_fid_t pfid;
59 void *parent = NULL; 59 void *parent = NULL;
60 int is64 = 0; 60 int is64 = 0;
61 __u32 *p = fh; 61 __u32 *p = fh;
@@ -144,7 +144,7 @@ xfs_fs_get_dentry(
144 struct dentry *result; 144 struct dentry *result;
145 int error; 145 int error;
146 146
147 error = xfs_vget(XFS_M(sb), &vp, (fid_t *)data); 147 error = xfs_vget(XFS_M(sb), &vp, data);
148 if (error || vp == NULL) 148 if (error || vp == NULL)
149 return ERR_PTR(-ESTALE) ; 149 return ERR_PTR(-ESTALE) ;
150 150
diff --git a/fs/xfs/linux-2.6/xfs_export.h b/fs/xfs/linux-2.6/xfs_export.h
index e794ca4efc76..2f36071a86f7 100644
--- a/fs/xfs/linux-2.6/xfs_export.h
+++ b/fs/xfs/linux-2.6/xfs_export.h
@@ -71,13 +71,13 @@ xfs_fileid_length(int hasparent, int is64)
71 71
72/* 72/*
73 * Decode encoded inode information (either for the inode itself 73 * Decode encoded inode information (either for the inode itself
74 * or the parent) into an xfs_fid2_t structure. Advances and 74 * or the parent) into an xfs_fid_t structure. Advances and
75 * returns the new data pointer 75 * returns the new data pointer
76 */ 76 */
77static inline __u32 * 77static inline __u32 *
78xfs_fileid_decode_fid2(__u32 *p, xfs_fid2_t *fid, int is64) 78xfs_fileid_decode_fid2(__u32 *p, xfs_fid_t *fid, int is64)
79{ 79{
80 fid->fid_len = sizeof(xfs_fid2_t) - sizeof(fid->fid_len); 80 fid->fid_len = sizeof(xfs_fid_t) - sizeof(fid->fid_len);
81 fid->fid_pad = 0; 81 fid->fid_pad = 0;
82 fid->fid_ino = *p++; 82 fid->fid_ino = *p++;
83#if XFS_BIG_INUMS 83#if XFS_BIG_INUMS
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index ffec630e7db7..2b34bad48b07 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -152,11 +152,11 @@ xfs_find_handle(
152 lock_mode = xfs_ilock_map_shared(ip); 152 lock_mode = xfs_ilock_map_shared(ip);
153 153
154 /* fill in fid section of handle from inode */ 154 /* fill in fid section of handle from inode */
155 handle.ha_fid.xfs_fid_len = sizeof(xfs_fid_t) - 155 handle.ha_fid.fid_len = sizeof(xfs_fid_t) -
156 sizeof(handle.ha_fid.xfs_fid_len); 156 sizeof(handle.ha_fid.fid_len);
157 handle.ha_fid.xfs_fid_pad = 0; 157 handle.ha_fid.fid_pad = 0;
158 handle.ha_fid.xfs_fid_gen = ip->i_d.di_gen; 158 handle.ha_fid.fid_gen = ip->i_d.di_gen;
159 handle.ha_fid.xfs_fid_ino = ip->i_ino; 159 handle.ha_fid.fid_ino = ip->i_ino;
160 160
161 xfs_iunlock_map_shared(ip, lock_mode); 161 xfs_iunlock_map_shared(ip, lock_mode);
162 162
@@ -222,10 +222,10 @@ xfs_vget_fsop_handlereq(
222 if (hlen < sizeof(*handlep)) 222 if (hlen < sizeof(*handlep))
223 memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen); 223 memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen);
224 if (hlen > sizeof(handlep->ha_fsid)) { 224 if (hlen > sizeof(handlep->ha_fsid)) {
225 if (handlep->ha_fid.xfs_fid_len != 225 if (handlep->ha_fid.fid_len !=
226 (hlen - sizeof(handlep->ha_fsid) 226 (hlen - sizeof(handlep->ha_fsid) -
227 - sizeof(handlep->ha_fid.xfs_fid_len)) 227 sizeof(handlep->ha_fid.fid_len)) ||
228 || handlep->ha_fid.xfs_fid_pad) 228 handlep->ha_fid.fid_pad)
229 return XFS_ERROR(EINVAL); 229 return XFS_ERROR(EINVAL);
230 } 230 }
231 231
@@ -233,9 +233,9 @@ xfs_vget_fsop_handlereq(
233 * Crack the handle, obtain the inode # & generation # 233 * Crack the handle, obtain the inode # & generation #
234 */ 234 */
235 xfid = (struct xfs_fid *)&handlep->ha_fid; 235 xfid = (struct xfs_fid *)&handlep->ha_fid;
236 if (xfid->xfs_fid_len == sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) { 236 if (xfid->fid_len == sizeof(*xfid) - sizeof(xfid->fid_len)) {
237 ino = xfid->xfs_fid_ino; 237 ino = xfid->fid_ino;
238 igen = xfid->xfs_fid_gen; 238 igen = xfid->fid_gen;
239 } else { 239 } else {
240 return XFS_ERROR(EINVAL); 240 return XFS_ERROR(EINVAL);
241 } 241 }
diff --git a/fs/xfs/xfs_dmops.c b/fs/xfs/xfs_dmops.c
index 6cd5704258a2..a1e55fb9d5dd 100644
--- a/fs/xfs/xfs_dmops.c
+++ b/fs/xfs/xfs_dmops.c
@@ -41,29 +41,16 @@ int
41xfs_dmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) 41xfs_dmops_get(struct xfs_mount *mp, struct xfs_mount_args *args)
42{ 42{
43 if (args->flags & XFSMNT_DMAPI) { 43 if (args->flags & XFSMNT_DMAPI) {
44 struct xfs_dmops *ops; 44 cmn_err(CE_WARN,
45 45 "XFS: dmapi support not available in this kernel.");
46 ops = symbol_get(xfs_dmcore_xfs); 46 return EINVAL;
47 if (!ops) {
48 request_module("xfs_dmapi");
49 ops = symbol_get(xfs_dmcore_xfs);
50 }
51
52 if (!ops) {
53 cmn_err(CE_WARN, "XFS: no dmapi support available.");
54 return EINVAL;
55 }
56 mp->m_dm_ops = ops;
57 } else {
58 mp->m_dm_ops = &xfs_dmcore_stub;
59 } 47 }
60 48
49 mp->m_dm_ops = &xfs_dmcore_stub;
61 return 0; 50 return 0;
62} 51}
63 52
64void 53void
65xfs_dmops_put(struct xfs_mount *mp) 54xfs_dmops_put(struct xfs_mount *mp)
66{ 55{
67 if (mp->m_dm_ops != &xfs_dmcore_stub)
68 symbol_put(xfs_dmcore_xfs);
69} 56}
diff --git a/fs/xfs/xfs_fs.h b/fs/xfs/xfs_fs.h
index ec3c9c27e0de..aab966276517 100644
--- a/fs/xfs/xfs_fs.h
+++ b/fs/xfs/xfs_fs.h
@@ -389,30 +389,13 @@ typedef struct xfs_fsop_attrmulti_handlereq {
389 */ 389 */
390typedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */ 390typedef struct { __u32 val[2]; } xfs_fsid_t; /* file system id type */
391 391
392
393#ifndef HAVE_FID
394#define MAXFIDSZ 46
395
396typedef struct fid {
397 __u16 fid_len; /* length of data in bytes */
398 unsigned char fid_data[MAXFIDSZ]; /* data (fid_len worth) */
399} fid_t;
400#endif
401
402typedef struct xfs_fid { 392typedef struct xfs_fid {
403 __u16 xfs_fid_len; /* length of remainder */ 393 __u16 fid_len; /* length of remainder */
404 __u16 xfs_fid_pad; 394 __u16 fid_pad;
405 __u32 xfs_fid_gen; /* generation number */ 395 __u32 fid_gen; /* generation number */
406 __u64 xfs_fid_ino; /* 64 bits inode number */ 396 __u64 fid_ino; /* 64 bits inode number */
407} xfs_fid_t; 397} xfs_fid_t;
408 398
409typedef struct xfs_fid2 {
410 __u16 fid_len; /* length of remainder */
411 __u16 fid_pad; /* padding, must be zero */
412 __u32 fid_gen; /* generation number */
413 __u64 fid_ino; /* inode number */
414} xfs_fid2_t;
415
416typedef struct xfs_handle { 399typedef struct xfs_handle {
417 union { 400 union {
418 __s64 align; /* force alignment of ha_fid */ 401 __s64 align; /* force alignment of ha_fid */
@@ -422,9 +405,9 @@ typedef struct xfs_handle {
422} xfs_handle_t; 405} xfs_handle_t;
423#define ha_fsid ha_u._ha_fsid 406#define ha_fsid ha_u._ha_fsid
424 407
425#define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.xfs_fid_pad \ 408#define XFS_HSIZE(handle) (((char *) &(handle).ha_fid.fid_pad \
426 - (char *) &(handle)) \ 409 - (char *) &(handle)) \
427 + (handle).ha_fid.xfs_fid_len) 410 + (handle).ha_fid.fid_len)
428 411
429/* 412/*
430 * Flags for going down operation 413 * Flags for going down operation
diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c
index c266a0184b42..2ec1d8a27352 100644
--- a/fs/xfs/xfs_qmops.c
+++ b/fs/xfs/xfs_qmops.c
@@ -135,19 +135,13 @@ int
135xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) 135xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args)
136{ 136{
137 if (args->flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA)) { 137 if (args->flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA)) {
138 struct xfs_qmops *ops; 138#ifdef CONFIG_XFS_QUOTA
139 139 mp->m_qm_ops = &xfs_qmcore_xfs;
140 ops = symbol_get(xfs_qmcore_xfs); 140#else
141 if (!ops) { 141 cmn_err(CE_WARN,
142 request_module("xfs_quota"); 142 "XFS: qouta support not available in this kernel.");
143 ops = symbol_get(xfs_qmcore_xfs); 143 return EINVAL;
144 } 144#endif
145
146 if (!ops) {
147 cmn_err(CE_WARN, "XFS: no quota support available.");
148 return EINVAL;
149 }
150 mp->m_qm_ops = ops;
151 } else { 145 } else {
152 mp->m_qm_ops = &xfs_qmcore_stub; 146 mp->m_qm_ops = &xfs_qmcore_stub;
153 } 147 }
@@ -158,6 +152,4 @@ xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args)
158void 152void
159xfs_qmops_put(struct xfs_mount *mp) 153xfs_qmops_put(struct xfs_mount *mp)
160{ 154{
161 if (mp->m_qm_ops != &xfs_qmcore_stub)
162 symbol_put(xfs_qmcore_xfs);
163} 155}
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index a5a8454f2a63..a1544597bcd3 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -1635,9 +1635,8 @@ int
1635xfs_vget( 1635xfs_vget(
1636 xfs_mount_t *mp, 1636 xfs_mount_t *mp,
1637 bhv_vnode_t **vpp, 1637 bhv_vnode_t **vpp,
1638 fid_t *fidp) 1638 xfs_fid_t *xfid)
1639{ 1639{
1640 xfs_fid_t *xfid = (struct xfs_fid *)fidp;
1641 xfs_inode_t *ip; 1640 xfs_inode_t *ip;
1642 int error; 1641 int error;
1643 xfs_ino_t ino; 1642 xfs_ino_t ino;
@@ -1647,11 +1646,11 @@ xfs_vget(
1647 * Invalid. Since handles can be created in user space and passed in 1646 * Invalid. Since handles can be created in user space and passed in
1648 * via gethandle(), this is not cause for a panic. 1647 * via gethandle(), this is not cause for a panic.
1649 */ 1648 */
1650 if (xfid->xfs_fid_len != sizeof(*xfid) - sizeof(xfid->xfs_fid_len)) 1649 if (xfid->fid_len != sizeof(*xfid) - sizeof(xfid->fid_len))
1651 return XFS_ERROR(EINVAL); 1650 return XFS_ERROR(EINVAL);
1652 1651
1653 ino = xfid->xfs_fid_ino; 1652 ino = xfid->fid_ino;
1654 igen = xfid->xfs_fid_gen; 1653 igen = xfid->fid_gen;
1655 1654
1656 /* 1655 /*
1657 * NFS can sometimes send requests for ino 0. Fail them gracefully. 1656 * NFS can sometimes send requests for ino 0. Fail them gracefully.
diff --git a/fs/xfs/xfs_vfsops.h b/fs/xfs/xfs_vfsops.h
index bc99e3eb7dbb..a592fe02a339 100644
--- a/fs/xfs/xfs_vfsops.h
+++ b/fs/xfs/xfs_vfsops.h
@@ -2,7 +2,7 @@
2#define _XFS_VFSOPS_H 1 2#define _XFS_VFSOPS_H 1
3 3
4struct cred; 4struct cred;
5struct fid; 5struct xfs_fid;
6struct inode; 6struct inode;
7struct kstatfs; 7struct kstatfs;
8struct xfs_mount; 8struct xfs_mount;
@@ -17,7 +17,7 @@ int xfs_root(struct xfs_mount *mp, bhv_vnode_t **vpp);
17int xfs_statvfs(struct xfs_mount *mp, struct kstatfs *statp, 17int xfs_statvfs(struct xfs_mount *mp, struct kstatfs *statp,
18 bhv_vnode_t *vp); 18 bhv_vnode_t *vp);
19int xfs_sync(struct xfs_mount *mp, int flags); 19int xfs_sync(struct xfs_mount *mp, int flags);
20int xfs_vget(struct xfs_mount *mp, bhv_vnode_t **vpp, struct fid *fidp); 20int xfs_vget(struct xfs_mount *mp, bhv_vnode_t **vpp, struct xfs_fid *xfid);
21int xfs_parseargs(struct xfs_mount *mp, char *options, 21int xfs_parseargs(struct xfs_mount *mp, char *options,
22 struct xfs_mount_args *args, int update); 22 struct xfs_mount_args *args, int update);
23int xfs_showargs(struct xfs_mount *mp, struct seq_file *m); 23int xfs_showargs(struct xfs_mount *mp, struct seq_file *m);
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 5e3c57ca9981..efd5aff9eaf6 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -3466,23 +3466,14 @@ std_return:
3466} 3466}
3467 3467
3468 3468
3469/*
3470 * xfs_fid2
3471 *
3472 * A fid routine that takes a pointer to a previously allocated
3473 * fid structure (like xfs_fast_fid) but uses a 64 bit inode number.
3474 */
3475int 3469int
3476xfs_fid2( 3470xfs_fid2(
3477 xfs_inode_t *ip, 3471 xfs_inode_t *ip,
3478 fid_t *fidp) 3472 xfs_fid_t *xfid)
3479{ 3473{
3480 xfs_fid2_t *xfid = (xfs_fid2_t *)fidp;
3481
3482 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address); 3474 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
3483 ASSERT(sizeof(fid_t) >= sizeof(xfs_fid2_t));
3484 3475
3485 xfid->fid_len = sizeof(xfs_fid2_t) - sizeof(xfid->fid_len); 3476 xfid->fid_len = sizeof(xfs_fid_t) - sizeof(xfid->fid_len);
3486 xfid->fid_pad = 0; 3477 xfid->fid_pad = 0;
3487 /* 3478 /*
3488 * use memcpy because the inode is a long long and there's no 3479 * use memcpy because the inode is a long long and there's no
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index f36e74f2f0c2..b7e461c40cfb 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -39,7 +39,7 @@ int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize,
39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry, 39int xfs_symlink(struct xfs_inode *dp, bhv_vname_t *dentry,
40 char *target_path, mode_t mode, bhv_vnode_t **vpp, 40 char *target_path, mode_t mode, bhv_vnode_t **vpp,
41 struct cred *credp); 41 struct cred *credp);
42int xfs_fid2(struct xfs_inode *ip, fid_t *fidp); 42int xfs_fid2(struct xfs_inode *ip, struct xfs_fid *xfid);
43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); 43int xfs_rwlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype); 44void xfs_rwunlock(struct xfs_inode *ip, bhv_vrwlock_t locktype);
45int xfs_inode_flush(struct xfs_inode *ip, int flags); 45int xfs_inode_flush(struct xfs_inode *ip, int flags);
diff --git a/include/acpi/achware.h b/include/acpi/achware.h
index 9df275cf7bc1..4053df943453 100644
--- a/include/acpi/achware.h
+++ b/include/acpi/achware.h
@@ -71,9 +71,9 @@ u32 acpi_hw_get_mode(void);
71struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id); 71struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
72 72
73acpi_status 73acpi_status
74acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value); 74acpi_hw_register_read(u32 register_id, u32 * return_value);
75 75
76acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value); 76acpi_status acpi_hw_register_write(u32 register_id, u32 value);
77 77
78acpi_status 78acpi_status
79acpi_hw_low_level_read(u32 width, 79acpi_hw_low_level_read(u32 width,
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 86aea44ce6d4..7b74b60a68a4 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -264,7 +264,6 @@ struct acpi_device_wakeup_flags {
264 264
265struct acpi_device_wakeup_state { 265struct acpi_device_wakeup_state {
266 u8 enabled:1; 266 u8 enabled:1;
267 u8 active:1;
268}; 267};
269 268
270struct acpi_device_wakeup { 269struct acpi_device_wakeup {
@@ -333,6 +332,7 @@ int acpi_bus_get_power(acpi_handle handle, int *state);
333int acpi_bus_set_power(acpi_handle handle, int state); 332int acpi_bus_set_power(acpi_handle handle, int state);
334#ifdef CONFIG_ACPI_PROC_EVENT 333#ifdef CONFIG_ACPI_PROC_EVENT
335int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data); 334int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data);
335int acpi_bus_generate_proc_event4(const char *class, const char *bid, u8 type, int data);
336int acpi_bus_receive_event(struct acpi_bus_event *event); 336int acpi_bus_receive_event(struct acpi_bus_event *event);
337#else 337#else
338static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data) 338static inline int acpi_bus_generate_proc_event(struct acpi_device *device, u8 type, int data)
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 3d7ab9e0c9fe..9512f0456ad1 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -314,6 +314,8 @@ acpi_resource_to_address64(struct acpi_resource *resource,
314 */ 314 */
315acpi_status acpi_get_register(u32 register_id, u32 * return_value); 315acpi_status acpi_get_register(u32 register_id, u32 * return_value);
316 316
317acpi_status acpi_get_register_unlocked(u32 register_id, u32 *return_value);
318
317acpi_status acpi_set_register(u32 register_id, u32 value); 319acpi_status acpi_set_register(u32 register_id, u32 value);
318 320
319acpi_status 321acpi_status
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 99934a999e66..26d79f6db8a0 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/cpu.h> 5#include <linux/cpu.h>
6#include <linux/cpuidle.h>
6 7
7#include <asm/acpi.h> 8#include <asm/acpi.h>
8 9
@@ -75,7 +76,9 @@ struct acpi_processor_cx {
75}; 76};
76 77
77struct acpi_processor_power { 78struct acpi_processor_power {
79 struct cpuidle_device dev;
78 struct acpi_processor_cx *state; 80 struct acpi_processor_cx *state;
81 struct acpi_processor_cx *bm_state;
79 unsigned long bm_check_timestamp; 82 unsigned long bm_check_timestamp;
80 u32 default_state; 83 u32 default_state;
81 u32 bm_activity; 84 u32 bm_activity;
@@ -199,6 +202,7 @@ struct acpi_processor_flags {
199 u8 bm_check:1; 202 u8 bm_check:1;
200 u8 has_cst:1; 203 u8 has_cst:1;
201 u8 power_setup_done:1; 204 u8 power_setup_done:1;
205 u8 bm_rld_set:1;
202}; 206};
203 207
204struct acpi_processor { 208struct acpi_processor {
@@ -322,6 +326,7 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
322 struct acpi_device *device); 326 struct acpi_device *device);
323int acpi_processor_suspend(struct acpi_device * device, pm_message_t state); 327int acpi_processor_suspend(struct acpi_device * device, pm_message_t state);
324int acpi_processor_resume(struct acpi_device * device); 328int acpi_processor_resume(struct acpi_device * device);
329extern struct cpuidle_driver acpi_idle_driver;
325 330
326/* in processor_thermal.c */ 331/* in processor_thermal.c */
327int acpi_processor_get_limit_info(struct acpi_processor *pr); 332int acpi_processor_get_limit_info(struct acpi_processor *pr);
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h
index 9e71201000d5..9e19a704d484 100644
--- a/include/asm-alpha/bitops.h
+++ b/include/asm-alpha/bitops.h
@@ -1,7 +1,12 @@
1#ifndef _ALPHA_BITOPS_H 1#ifndef _ALPHA_BITOPS_H
2#define _ALPHA_BITOPS_H 2#define _ALPHA_BITOPS_H
3 3
4#ifndef _LINUX_BITOPS_H
5#error only <linux/bitops.h> can be included directly
6#endif
7
4#include <asm/compiler.h> 8#include <asm/compiler.h>
9#include <asm/barrier.h>
5 10
6/* 11/*
7 * Copyright 1994, Linus Torvalds. 12 * Copyright 1994, Linus Torvalds.
@@ -69,6 +74,13 @@ clear_bit(unsigned long nr, volatile void * addr)
69 :"Ir" (1UL << (nr & 31)), "m" (*m)); 74 :"Ir" (1UL << (nr & 31)), "m" (*m));
70} 75}
71 76
77static inline void
78clear_bit_unlock(unsigned long nr, volatile void * addr)
79{
80 smp_mb();
81 clear_bit(nr, addr);
82}
83
72/* 84/*
73 * WARNING: non atomic version. 85 * WARNING: non atomic version.
74 */ 86 */
@@ -81,6 +93,13 @@ __clear_bit(unsigned long nr, volatile void * addr)
81} 93}
82 94
83static inline void 95static inline void
96__clear_bit_unlock(unsigned long nr, volatile void * addr)
97{
98 smp_mb();
99 __clear_bit(nr, addr);
100}
101
102static inline void
84change_bit(unsigned long nr, volatile void * addr) 103change_bit(unsigned long nr, volatile void * addr)
85{ 104{
86 unsigned long temp; 105 unsigned long temp;
@@ -117,6 +136,36 @@ test_and_set_bit(unsigned long nr, volatile void *addr)
117 int *m = ((int *) addr) + (nr >> 5); 136 int *m = ((int *) addr) + (nr >> 5);
118 137
119 __asm__ __volatile__( 138 __asm__ __volatile__(
139#ifdef CONFIG_SMP
140 " mb\n"
141#endif
142 "1: ldl_l %0,%4\n"
143 " and %0,%3,%2\n"
144 " bne %2,2f\n"
145 " xor %0,%3,%0\n"
146 " stl_c %0,%1\n"
147 " beq %0,3f\n"
148 "2:\n"
149#ifdef CONFIG_SMP
150 " mb\n"
151#endif
152 ".subsection 2\n"
153 "3: br 1b\n"
154 ".previous"
155 :"=&r" (temp), "=m" (*m), "=&r" (oldbit)
156 :"Ir" (1UL << (nr & 31)), "m" (*m) : "memory");
157
158 return oldbit != 0;
159}
160
161static inline int
162test_and_set_bit_lock(unsigned long nr, volatile void *addr)
163{
164 unsigned long oldbit;
165 unsigned long temp;
166 int *m = ((int *) addr) + (nr >> 5);
167
168 __asm__ __volatile__(
120 "1: ldl_l %0,%4\n" 169 "1: ldl_l %0,%4\n"
121 " and %0,%3,%2\n" 170 " and %0,%3,%2\n"
122 " bne %2,2f\n" 171 " bne %2,2f\n"
@@ -158,6 +207,9 @@ test_and_clear_bit(unsigned long nr, volatile void * addr)
158 int *m = ((int *) addr) + (nr >> 5); 207 int *m = ((int *) addr) + (nr >> 5);
159 208
160 __asm__ __volatile__( 209 __asm__ __volatile__(
210#ifdef CONFIG_SMP
211 " mb\n"
212#endif
161 "1: ldl_l %0,%4\n" 213 "1: ldl_l %0,%4\n"
162 " and %0,%3,%2\n" 214 " and %0,%3,%2\n"
163 " beq %2,2f\n" 215 " beq %2,2f\n"
@@ -199,6 +251,9 @@ test_and_change_bit(unsigned long nr, volatile void * addr)
199 int *m = ((int *) addr) + (nr >> 5); 251 int *m = ((int *) addr) + (nr >> 5);
200 252
201 __asm__ __volatile__( 253 __asm__ __volatile__(
254#ifdef CONFIG_SMP
255 " mb\n"
256#endif
202 "1: ldl_l %0,%4\n" 257 "1: ldl_l %0,%4\n"
203 " and %0,%3,%2\n" 258 " and %0,%3,%2\n"
204 " xor %0,%3,%0\n" 259 " xor %0,%3,%0\n"
diff --git a/include/asm-alpha/ide.h b/include/asm-alpha/ide.h
index 2a5cc0b367ab..b7bf68d0407b 100644
--- a/include/asm-alpha/ide.h
+++ b/include/asm-alpha/ide.h
@@ -40,7 +40,6 @@ static inline unsigned long ide_default_io_base(int index)
40 } 40 }
41} 41}
42 42
43#define IDE_ARCH_OBSOLETE_INIT
44#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 43#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
45 44
46#ifdef CONFIG_PCI 45#ifdef CONFIG_PCI
diff --git a/include/asm-alpha/tlbflush.h b/include/asm-alpha/tlbflush.h
index 1ca3ed3bd6d3..eefab3fb51ae 100644
--- a/include/asm-alpha/tlbflush.h
+++ b/include/asm-alpha/tlbflush.h
@@ -92,17 +92,6 @@ flush_tlb_other(struct mm_struct *mm)
92 if (*mmc) *mmc = 0; 92 if (*mmc) *mmc = 0;
93} 93}
94 94
95/* Flush a specified range of user mapping page tables from TLB.
96 Although Alpha uses VPTE caches, this can be a nop, as Alpha does
97 not have finegrained tlb flushing, so it will flush VPTE stuff
98 during next flush_tlb_range. */
99
100static inline void
101flush_tlb_pgtables(struct mm_struct *mm, unsigned long start,
102 unsigned long end)
103{
104}
105
106#ifndef CONFIG_SMP 95#ifndef CONFIG_SMP
107/* Flush everything (kernel mapping may also have changed 96/* Flush everything (kernel mapping may also have changed
108 due to vmalloc/vfree). */ 97 due to vmalloc/vfree). */
diff --git a/include/asm-arm/arch-aaec2000/aaec2000.h b/include/asm-arm/arch-aaec2000/aaec2000.h
index 002227924b9f..a6d1ee0980f2 100644
--- a/include/asm-arm/arch-aaec2000/aaec2000.h
+++ b/include/asm-arm/arch-aaec2000/aaec2000.h
@@ -140,11 +140,11 @@
140#define TIMER3_CLEAR __REG(0x80000e0c) /* Timer 3 Clear Register */ 140#define TIMER3_CLEAR __REG(0x80000e0c) /* Timer 3 Clear Register */
141 141
142/* Timer Control register bits */ 142/* Timer Control register bits */
143#define TIMER_CTRL_ENABLE (1 << 7) /* Enable (Start° Timer */ 143#define TIMER_CTRL_ENABLE (1 << 7) /* Enable (Start Timer) */
144#define TIMER_CTRL_PERIODIC (1 << 6) /* Periodic Running Mode */ 144#define TIMER_CTRL_PERIODIC (1 << 6) /* Periodic Running Mode */
145#define TIMER_CTRL_FREE_RUNNING (0 << 6) /* Normal Running Mode */ 145#define TIMER_CTRL_FREE_RUNNING (0 << 6) /* Normal Running Mode */
146#define TIMER_CTRL_CLKSEL_508K (1 << 3) /* 508KHz Clock select (Timer 1, 2) */ 146#define TIMER_CTRL_CLKSEL_508K (1 << 3) /* 508KHz Clock select (Timer 1, 2) */
147#define TIMER_CTRL_CLKSEL_2K (0 << 3) /* 2KHz Clock Select (Timer 1, 2)*/ 147#define TIMER_CTRL_CLKSEL_2K (0 << 3) /* 2KHz Clock Select (Timer 1, 2) */
148 148
149/* Power and State Control */ 149/* Power and State Control */
150#define POWER_BASE __REG(0x80000400) 150#define POWER_BASE __REG(0x80000400)
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index c72f9d79417c..eeeea90cd5a9 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -17,9 +17,6 @@
17 17
18#define IO_SPACE_LIMIT 0xffff0000 18#define IO_SPACE_LIMIT 0xffff0000
19 19
20#define BIT(x) ((1)<<(x))
21
22
23extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data); 20extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
24extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data); 21extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
25 22
diff --git a/include/asm-arm/arch-pxa/pm.h b/include/asm-arm/arch-pxa/pm.h
index 6903db7fae15..9d9f4b54b2ce 100644
--- a/include/asm-arm/arch-pxa/pm.h
+++ b/include/asm-arm/arch-pxa/pm.h
@@ -7,6 +7,8 @@
7 * 7 *
8 */ 8 */
9 9
10#include <linux/suspend.h>
11
10struct pxa_cpu_pm_fns { 12struct pxa_cpu_pm_fns {
11 int save_size; 13 int save_size;
12 void (*save)(unsigned long *); 14 void (*save)(unsigned long *);
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h
index b41831b6432f..47a6b086eee2 100644
--- a/include/asm-arm/bitops.h
+++ b/include/asm-arm/bitops.h
@@ -19,6 +19,10 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#ifndef _LINUX_BITOPS_H
23#error only <linux/bitops.h> can be included directly
24#endif
25
22#include <linux/compiler.h> 26#include <linux/compiler.h>
23#include <asm/system.h> 27#include <asm/system.h>
24 28
@@ -286,6 +290,7 @@ static inline int constant_fls(int x)
286 290
287#include <asm-generic/bitops/sched.h> 291#include <asm-generic/bitops/sched.h>
288#include <asm-generic/bitops/hweight.h> 292#include <asm-generic/bitops/hweight.h>
293#include <asm-generic/bitops/lock.h>
289 294
290/* 295/*
291 * Ext2 is defined to use little-endian byte ordering. 296 * Ext2 is defined to use little-endian byte ordering.
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index 678134bf2475..1eb8aac43228 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -401,7 +401,7 @@ extern void dma_sync_sg_for_device(struct device*, struct scatterlist*, int, enu
401 * 401 *
402 * On the SA-1111, a bug limits DMA to only certain regions of RAM. 402 * On the SA-1111, a bug limits DMA to only certain regions of RAM.
403 * On the IXP425, the PCI inbound window is 64MB (256MB total RAM) 403 * On the IXP425, the PCI inbound window is 64MB (256MB total RAM)
404 * On some ADI engineering sytems, PCI inbound window is 32MB (12MB total RAM) 404 * On some ADI engineering systems, PCI inbound window is 32MB (12MB total RAM)
405 * 405 *
406 * The following are helper functions used by the dmabounce subystem 406 * The following are helper functions used by the dmabounce subystem
407 * 407 *
diff --git a/include/asm-arm/ide.h b/include/asm-arm/ide.h
index 4f68c8a5a199..f348fcf3150b 100644
--- a/include/asm-arm/ide.h
+++ b/include/asm-arm/ide.h
@@ -18,7 +18,6 @@
18#endif 18#endif
19 19
20#if !defined(CONFIG_ARCH_L7200) 20#if !defined(CONFIG_ARCH_L7200)
21# define IDE_ARCH_OBSOLETE_INIT
22# ifdef CONFIG_ARCH_CLPS7500 21# ifdef CONFIG_ARCH_CLPS7500
23# define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 22# define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
24# else 23# else
diff --git a/include/asm-arm/tlbflush.h b/include/asm-arm/tlbflush.h
index 71be4fded7e2..8c6bc1bb9d1a 100644
--- a/include/asm-arm/tlbflush.h
+++ b/include/asm-arm/tlbflush.h
@@ -463,11 +463,6 @@ extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
463 */ 463 */
464extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte); 464extern void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte);
465 465
466/*
467 * ARM processors do not cache TLB tables in RAM.
468 */
469#define flush_tlb_pgtables(mm,start,end) do { } while (0)
470
471#endif 466#endif
472 467
473#endif /* CONFIG_MMU */ 468#endif /* CONFIG_MMU */
diff --git a/include/asm-avr32/bitops.h b/include/asm-avr32/bitops.h
index 5299f8c8e11d..1a50b69b1a19 100644
--- a/include/asm-avr32/bitops.h
+++ b/include/asm-avr32/bitops.h
@@ -8,6 +8,10 @@
8#ifndef __ASM_AVR32_BITOPS_H 8#ifndef __ASM_AVR32_BITOPS_H
9#define __ASM_AVR32_BITOPS_H 9#define __ASM_AVR32_BITOPS_H
10 10
11#ifndef _LINUX_BITOPS_H
12#error only <linux/bitops.h> can be included directly
13#endif
14
11#include <asm/byteorder.h> 15#include <asm/byteorder.h>
12#include <asm/system.h> 16#include <asm/system.h>
13 17
@@ -288,6 +292,7 @@ static inline int ffs(unsigned long word)
288#include <asm-generic/bitops/fls64.h> 292#include <asm-generic/bitops/fls64.h>
289#include <asm-generic/bitops/sched.h> 293#include <asm-generic/bitops/sched.h>
290#include <asm-generic/bitops/hweight.h> 294#include <asm-generic/bitops/hweight.h>
295#include <asm-generic/bitops/lock.h>
291 296
292#include <asm-generic/bitops/ext2-non-atomic.h> 297#include <asm-generic/bitops/ext2-non-atomic.h>
293#include <asm-generic/bitops/ext2-atomic.h> 298#include <asm-generic/bitops/ext2-atomic.h>
diff --git a/include/asm-avr32/tlbflush.h b/include/asm-avr32/tlbflush.h
index 730e268f81f3..5bc7c88a5770 100644
--- a/include/asm-avr32/tlbflush.h
+++ b/include/asm-avr32/tlbflush.h
@@ -19,7 +19,6 @@
19 * - flush_tlb_page(vma, vmaddr) flushes one page 19 * - flush_tlb_page(vma, vmaddr) flushes one page
20 * - flush_tlb_range(vma, start, end) flushes a range of pages 20 * - flush_tlb_range(vma, start, end) flushes a range of pages
21 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 21 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
22 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
23 */ 22 */
24extern void flush_tlb(void); 23extern void flush_tlb(void);
25extern void flush_tlb_all(void); 24extern void flush_tlb_all(void);
@@ -29,12 +28,6 @@ extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
29extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); 28extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
30extern void __flush_tlb_page(unsigned long asid, unsigned long page); 29extern void __flush_tlb_page(unsigned long asid, unsigned long page);
31 30
32static inline void flush_tlb_pgtables(struct mm_struct *mm,
33 unsigned long start, unsigned long end)
34{
35 /* Nothing to do */
36}
37
38extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); 31extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
39 32
40#endif /* __ASM_AVR32_TLBFLUSH_H */ 33#endif /* __ASM_AVR32_TLBFLUSH_H */
diff --git a/include/asm-blackfin/bitops.h b/include/asm-blackfin/bitops.h
index 27c2d0e48e1b..b39a175c79c1 100644
--- a/include/asm-blackfin/bitops.h
+++ b/include/asm-blackfin/bitops.h
@@ -11,6 +11,10 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13 13
14#ifndef _LINUX_BITOPS_H
15#error only <linux/bitops.h> can be included directly
16#endif
17
14#include <asm-generic/bitops/ffs.h> 18#include <asm-generic/bitops/ffs.h>
15#include <asm-generic/bitops/__ffs.h> 19#include <asm-generic/bitops/__ffs.h>
16#include <asm-generic/bitops/sched.h> 20#include <asm-generic/bitops/sched.h>
@@ -199,6 +203,7 @@ static __inline__ int __test_bit(int nr, const void *addr)
199 203
200#include <asm-generic/bitops/find.h> 204#include <asm-generic/bitops/find.h>
201#include <asm-generic/bitops/hweight.h> 205#include <asm-generic/bitops/hweight.h>
206#include <asm-generic/bitops/lock.h>
202 207
203#include <asm-generic/bitops/ext2-atomic.h> 208#include <asm-generic/bitops/ext2-atomic.h>
204#include <asm-generic/bitops/ext2-non-atomic.h> 209#include <asm-generic/bitops/ext2-non-atomic.h>
diff --git a/include/asm-blackfin/ide.h b/include/asm-blackfin/ide.h
index 41b2db46a168..121e272581d6 100644
--- a/include/asm-blackfin/ide.h
+++ b/include/asm-blackfin/ide.h
@@ -20,7 +20,6 @@
20#define MAX_HWIFS 1 20#define MAX_HWIFS 1
21 21
22/* Legacy ... BLK_DEV_IDECS */ 22/* Legacy ... BLK_DEV_IDECS */
23#define IDE_ARCH_OBSOLETE_INIT
24#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 23#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
25 24
26 25
diff --git a/include/asm-blackfin/processor.h b/include/asm-blackfin/processor.h
index 6bb3e0d4705d..c571e958558c 100644
--- a/include/asm-blackfin/processor.h
+++ b/include/asm-blackfin/processor.h
@@ -104,13 +104,13 @@ unsigned long get_wchan(struct task_struct *p);
104#define cpu_relax() barrier() 104#define cpu_relax() barrier()
105 105
106/* Get the Silicon Revision of the chip */ 106/* Get the Silicon Revision of the chip */
107static inline __attribute_pure__ uint32_t bfin_revid(void) 107static inline uint32_t __pure bfin_revid(void)
108{ 108{
109 /* stored in the upper 4 bits */ 109 /* stored in the upper 4 bits */
110 return bfin_read_CHIPID() >> 28; 110 return bfin_read_CHIPID() >> 28;
111} 111}
112 112
113static inline __attribute_pure__ uint32_t bfin_compiled_revid(void) 113static inline uint32_t __pure bfin_compiled_revid(void)
114{ 114{
115#if defined(CONFIG_BF_REV_0_0) 115#if defined(CONFIG_BF_REV_0_0)
116 return 0; 116 return 0;
diff --git a/include/asm-blackfin/system.h b/include/asm-blackfin/system.h
index 2b3d47d0bbb6..4a927379ee1c 100644
--- a/include/asm-blackfin/system.h
+++ b/include/asm-blackfin/system.h
@@ -128,9 +128,7 @@ extern unsigned long irq_flags;
128#define mb() asm volatile ("" : : :"memory") 128#define mb() asm volatile ("" : : :"memory")
129#define rmb() asm volatile ("" : : :"memory") 129#define rmb() asm volatile ("" : : :"memory")
130#define wmb() asm volatile ("" : : :"memory") 130#define wmb() asm volatile ("" : : :"memory")
131#define set_rmb(var, value) do { (void) xchg(&var, value); } while (0) 131#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
132#define set_mb(var, value) set_rmb(var, value)
133#define set_wmb(var, value) do { var = value; wmb(); } while (0)
134 132
135#define read_barrier_depends() do { } while(0) 133#define read_barrier_depends() do { } while(0)
136 134
diff --git a/include/asm-blackfin/tlbflush.h b/include/asm-blackfin/tlbflush.h
index 10a07ba1e011..277b400924b8 100644
--- a/include/asm-blackfin/tlbflush.h
+++ b/include/asm-blackfin/tlbflush.h
@@ -53,10 +53,4 @@ static inline void flush_tlb_kernel_page(unsigned long addr)
53 BUG(); 53 BUG();
54} 54}
55 55
56static inline void flush_tlb_pgtables(struct mm_struct *mm,
57 unsigned long start, unsigned long end)
58{
59 BUG();
60}
61
62#endif 56#endif
diff --git a/include/asm-cris/arch-v32/ide.h b/include/asm-cris/arch-v32/ide.h
index 6590f657500d..11296170d057 100644
--- a/include/asm-cris/arch-v32/ide.h
+++ b/include/asm-cris/arch-v32/ide.h
@@ -54,7 +54,7 @@ static inline unsigned long ide_default_io_base(int index)
54#define SUPPORT_VLB_SYNC 0 54#define SUPPORT_VLB_SYNC 0
55 55
56#define IDE_ARCH_ACK_INTR 56#define IDE_ARCH_ACK_INTR
57#define ide_ack_intr(hwif) (hwif)->hw.ack_intr(hwif) 57#define ide_ack_intr(hwif) ((hwif)->ack_intr(hwif))
58 58
59#endif /* __KERNEL__ */ 59#endif /* __KERNEL__ */
60 60
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h
index a569065113d9..e2f49c27ed29 100644
--- a/include/asm-cris/bitops.h
+++ b/include/asm-cris/bitops.h
@@ -14,6 +14,10 @@
14/* Currently this is unsuitable for consumption outside the kernel. */ 14/* Currently this is unsuitable for consumption outside the kernel. */
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17#ifndef _LINUX_BITOPS_H
18#error only <linux/bitops.h> can be included directly
19#endif
20
17#include <asm/arch/bitops.h> 21#include <asm/arch/bitops.h>
18#include <asm/system.h> 22#include <asm/system.h>
19#include <asm/atomic.h> 23#include <asm/atomic.h>
@@ -154,6 +158,7 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
154#include <asm-generic/bitops/fls64.h> 158#include <asm-generic/bitops/fls64.h>
155#include <asm-generic/bitops/hweight.h> 159#include <asm-generic/bitops/hweight.h>
156#include <asm-generic/bitops/find.h> 160#include <asm-generic/bitops/find.h>
161#include <asm-generic/bitops/lock.h>
157 162
158#include <asm-generic/bitops/ext2-non-atomic.h> 163#include <asm-generic/bitops/ext2-non-atomic.h>
159 164
diff --git a/include/asm-cris/posix_types.h b/include/asm-cris/posix_types.h
index 7b9ed22ab5dd..92000d0c3f97 100644
--- a/include/asm-cris/posix_types.h
+++ b/include/asm-cris/posix_types.h
@@ -52,7 +52,7 @@ typedef struct {
52} __kernel_fsid_t; 52} __kernel_fsid_t;
53 53
54#ifdef __KERNEL__ 54#ifdef __KERNEL__
55#include <asm/bitops.h> 55#include <linux/bitops.h>
56 56
57#undef __FD_SET 57#undef __FD_SET
58#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp)) 58#define __FD_SET(fd,fdsetp) set_bit(fd, (void *)(fdsetp))
diff --git a/include/asm-cris/tlbflush.h b/include/asm-cris/tlbflush.h
index 0569612477e3..20697e7ef4f2 100644
--- a/include/asm-cris/tlbflush.h
+++ b/include/asm-cris/tlbflush.h
@@ -38,13 +38,6 @@ static inline void flush_tlb_range(struct vm_area_struct * vma, unsigned long st
38 flush_tlb_mm(vma->vm_mm); 38 flush_tlb_mm(vma->vm_mm);
39} 39}
40 40
41static inline void flush_tlb_pgtables(struct mm_struct *mm,
42 unsigned long start, unsigned long end)
43{
44 /* CRIS does not keep any page table caches in TLB */
45}
46
47
48static inline void flush_tlb(void) 41static inline void flush_tlb(void)
49{ 42{
50 flush_tlb_mm(current->mm); 43 flush_tlb_mm(current->mm);
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h
index f8560edf59ff..e29de7131b79 100644
--- a/include/asm-frv/bitops.h
+++ b/include/asm-frv/bitops.h
@@ -21,6 +21,10 @@
21 21
22#ifdef __KERNEL__ 22#ifdef __KERNEL__
23 23
24#ifndef _LINUX_BITOPS_H
25#error only <linux/bitops.h> can be included directly
26#endif
27
24#include <asm-generic/bitops/ffz.h> 28#include <asm-generic/bitops/ffz.h>
25 29
26/* 30/*
@@ -302,6 +306,7 @@ int __ilog2_u64(u64 n)
302 306
303#include <asm-generic/bitops/sched.h> 307#include <asm-generic/bitops/sched.h>
304#include <asm-generic/bitops/hweight.h> 308#include <asm-generic/bitops/hweight.h>
309#include <asm-generic/bitops/lock.h>
305 310
306#include <asm-generic/bitops/ext2-non-atomic.h> 311#include <asm-generic/bitops/ext2-non-atomic.h>
307 312
diff --git a/include/asm-frv/tlbflush.h b/include/asm-frv/tlbflush.h
index 8370f97e41ee..7ac5eafc5d98 100644
--- a/include/asm-frv/tlbflush.h
+++ b/include/asm-frv/tlbflush.h
@@ -57,7 +57,6 @@ do { \
57#define __flush_tlb_global() flush_tlb_all() 57#define __flush_tlb_global() flush_tlb_all()
58#define flush_tlb() flush_tlb_all() 58#define flush_tlb() flush_tlb_all()
59#define flush_tlb_kernel_range(start, end) flush_tlb_all() 59#define flush_tlb_kernel_range(start, end) flush_tlb_all()
60#define flush_tlb_pgtables(mm,start,end) do { } while(0)
61 60
62#else 61#else
63 62
@@ -66,7 +65,6 @@ do { \
66#define flush_tlb_mm(mm) BUG() 65#define flush_tlb_mm(mm) BUG()
67#define flush_tlb_page(vma,addr) BUG() 66#define flush_tlb_page(vma,addr) BUG()
68#define flush_tlb_range(mm,start,end) BUG() 67#define flush_tlb_range(mm,start,end) BUG()
69#define flush_tlb_pgtables(mm,start,end) BUG()
70#define flush_tlb_kernel_range(start, end) BUG() 68#define flush_tlb_kernel_range(start, end) BUG()
71 69
72#endif 70#endif
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index 1f9d99193df8..15e6f253dda4 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -19,9 +19,14 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22#ifndef _LINUX_BITOPS_H
23#error only <linux/bitops.h> can be included directly
24#endif
25
22#include <asm-generic/bitops/sched.h> 26#include <asm-generic/bitops/sched.h>
23#include <asm-generic/bitops/ffs.h> 27#include <asm-generic/bitops/ffs.h>
24#include <asm-generic/bitops/hweight.h> 28#include <asm-generic/bitops/hweight.h>
29#include <asm-generic/bitops/lock.h>
25 30
26#include <asm-generic/bitops/ext2-non-atomic.h> 31#include <asm-generic/bitops/ext2-non-atomic.h>
27#include <asm-generic/bitops/ext2-atomic.h> 32#include <asm-generic/bitops/ext2-atomic.h>
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index cd8a9641bd66..4657f3e410fc 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -3,9 +3,6 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8
9#ifdef CONFIG_SMP 6#ifdef CONFIG_SMP
10#include <asm/spinlock.h> 7#include <asm/spinlock.h>
11#include <asm/cache.h> /* we use L1_CACHE_BYTES */ 8#include <asm/cache.h> /* we use L1_CACHE_BYTES */
@@ -66,8 +63,8 @@ extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
66 */ 63 */
67static inline void set_bit(int nr, volatile unsigned long *addr) 64static inline void set_bit(int nr, volatile unsigned long *addr)
68{ 65{
69 unsigned long mask = BITOP_MASK(nr); 66 unsigned long mask = BIT_MASK(nr);
70 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 67 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
71 unsigned long flags; 68 unsigned long flags;
72 69
73 _atomic_spin_lock_irqsave(p, flags); 70 _atomic_spin_lock_irqsave(p, flags);
@@ -87,8 +84,8 @@ static inline void set_bit(int nr, volatile unsigned long *addr)
87 */ 84 */
88static inline void clear_bit(int nr, volatile unsigned long *addr) 85static inline void clear_bit(int nr, volatile unsigned long *addr)
89{ 86{
90 unsigned long mask = BITOP_MASK(nr); 87 unsigned long mask = BIT_MASK(nr);
91 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 88 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
92 unsigned long flags; 89 unsigned long flags;
93 90
94 _atomic_spin_lock_irqsave(p, flags); 91 _atomic_spin_lock_irqsave(p, flags);
@@ -108,8 +105,8 @@ static inline void clear_bit(int nr, volatile unsigned long *addr)
108 */ 105 */
109static inline void change_bit(int nr, volatile unsigned long *addr) 106static inline void change_bit(int nr, volatile unsigned long *addr)
110{ 107{
111 unsigned long mask = BITOP_MASK(nr); 108 unsigned long mask = BIT_MASK(nr);
112 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 109 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
113 unsigned long flags; 110 unsigned long flags;
114 111
115 _atomic_spin_lock_irqsave(p, flags); 112 _atomic_spin_lock_irqsave(p, flags);
@@ -128,8 +125,8 @@ static inline void change_bit(int nr, volatile unsigned long *addr)
128 */ 125 */
129static inline int test_and_set_bit(int nr, volatile unsigned long *addr) 126static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
130{ 127{
131 unsigned long mask = BITOP_MASK(nr); 128 unsigned long mask = BIT_MASK(nr);
132 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 129 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
133 unsigned long old; 130 unsigned long old;
134 unsigned long flags; 131 unsigned long flags;
135 132
@@ -152,8 +149,8 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
152 */ 149 */
153static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) 150static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
154{ 151{
155 unsigned long mask = BITOP_MASK(nr); 152 unsigned long mask = BIT_MASK(nr);
156 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 153 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
157 unsigned long old; 154 unsigned long old;
158 unsigned long flags; 155 unsigned long flags;
159 156
@@ -175,8 +172,8 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
175 */ 172 */
176static inline int test_and_change_bit(int nr, volatile unsigned long *addr) 173static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
177{ 174{
178 unsigned long mask = BITOP_MASK(nr); 175 unsigned long mask = BIT_MASK(nr);
179 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 176 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
180 unsigned long old; 177 unsigned long old;
181 unsigned long flags; 178 unsigned long flags;
182 179
diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h
new file mode 100644
index 000000000000..308a9e22c802
--- /dev/null
+++ b/include/asm-generic/bitops/lock.h
@@ -0,0 +1,45 @@
1#ifndef _ASM_GENERIC_BITOPS_LOCK_H_
2#define _ASM_GENERIC_BITOPS_LOCK_H_
3
4/**
5 * test_and_set_bit_lock - Set a bit and return its old value, for lock
6 * @nr: Bit to set
7 * @addr: Address to count from
8 *
9 * This operation is atomic and provides acquire barrier semantics.
10 * It can be used to implement bit locks.
11 */
12#define test_and_set_bit_lock(nr, addr) test_and_set_bit(nr, addr)
13
14/**
15 * clear_bit_unlock - Clear a bit in memory, for unlock
16 * @nr: the bit to set
17 * @addr: the address to start counting from
18 *
19 * This operation is atomic and provides release barrier semantics.
20 */
21#define clear_bit_unlock(nr, addr) \
22do { \
23 smp_mb__before_clear_bit(); \
24 clear_bit(nr, addr); \
25} while (0)
26
27/**
28 * __clear_bit_unlock - Clear a bit in memory, for unlock
29 * @nr: the bit to set
30 * @addr: the address to start counting from
31 *
32 * This operation is like clear_bit_unlock, however it is not atomic.
33 * It does provide release barrier semantics so it can be used to unlock
34 * a bit lock, however it would only be used if no other CPU can modify
35 * any bits in the memory until the lock is released (a good example is
36 * if the bit lock itself protects access to the other bits in the word).
37 */
38#define __clear_bit_unlock(nr, addr) \
39do { \
40 smp_mb(); \
41 __clear_bit(nr, addr); \
42} while (0)
43
44#endif /* _ASM_GENERIC_BITOPS_LOCK_H_ */
45
diff --git a/include/asm-generic/bitops/non-atomic.h b/include/asm-generic/bitops/non-atomic.h
index 46a825cf2ae1..697cc2b7e0f0 100644
--- a/include/asm-generic/bitops/non-atomic.h
+++ b/include/asm-generic/bitops/non-atomic.h
@@ -3,9 +3,6 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8
9/** 6/**
10 * __set_bit - Set a bit in memory 7 * __set_bit - Set a bit in memory
11 * @nr: the bit to set 8 * @nr: the bit to set
@@ -17,16 +14,16 @@
17 */ 14 */
18static inline void __set_bit(int nr, volatile unsigned long *addr) 15static inline void __set_bit(int nr, volatile unsigned long *addr)
19{ 16{
20 unsigned long mask = BITOP_MASK(nr); 17 unsigned long mask = BIT_MASK(nr);
21 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 18 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
22 19
23 *p |= mask; 20 *p |= mask;
24} 21}
25 22
26static inline void __clear_bit(int nr, volatile unsigned long *addr) 23static inline void __clear_bit(int nr, volatile unsigned long *addr)
27{ 24{
28 unsigned long mask = BITOP_MASK(nr); 25 unsigned long mask = BIT_MASK(nr);
29 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 26 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
30 27
31 *p &= ~mask; 28 *p &= ~mask;
32} 29}
@@ -42,8 +39,8 @@ static inline void __clear_bit(int nr, volatile unsigned long *addr)
42 */ 39 */
43static inline void __change_bit(int nr, volatile unsigned long *addr) 40static inline void __change_bit(int nr, volatile unsigned long *addr)
44{ 41{
45 unsigned long mask = BITOP_MASK(nr); 42 unsigned long mask = BIT_MASK(nr);
46 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 43 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
47 44
48 *p ^= mask; 45 *p ^= mask;
49} 46}
@@ -59,8 +56,8 @@ static inline void __change_bit(int nr, volatile unsigned long *addr)
59 */ 56 */
60static inline int __test_and_set_bit(int nr, volatile unsigned long *addr) 57static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
61{ 58{
62 unsigned long mask = BITOP_MASK(nr); 59 unsigned long mask = BIT_MASK(nr);
63 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 60 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
64 unsigned long old = *p; 61 unsigned long old = *p;
65 62
66 *p = old | mask; 63 *p = old | mask;
@@ -78,8 +75,8 @@ static inline int __test_and_set_bit(int nr, volatile unsigned long *addr)
78 */ 75 */
79static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr) 76static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
80{ 77{
81 unsigned long mask = BITOP_MASK(nr); 78 unsigned long mask = BIT_MASK(nr);
82 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 79 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
83 unsigned long old = *p; 80 unsigned long old = *p;
84 81
85 *p = old & ~mask; 82 *p = old & ~mask;
@@ -90,8 +87,8 @@ static inline int __test_and_clear_bit(int nr, volatile unsigned long *addr)
90static inline int __test_and_change_bit(int nr, 87static inline int __test_and_change_bit(int nr,
91 volatile unsigned long *addr) 88 volatile unsigned long *addr)
92{ 89{
93 unsigned long mask = BITOP_MASK(nr); 90 unsigned long mask = BIT_MASK(nr);
94 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 91 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
95 unsigned long old = *p; 92 unsigned long old = *p;
96 93
97 *p = old ^ mask; 94 *p = old ^ mask;
@@ -105,7 +102,7 @@ static inline int __test_and_change_bit(int nr,
105 */ 102 */
106static inline int test_bit(int nr, const volatile unsigned long *addr) 103static inline int test_bit(int nr, const volatile unsigned long *addr)
107{ 104{
108 return 1UL & (addr[BITOP_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); 105 return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
109} 106}
110 107
111#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */ 108#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 5615440027ec..9f584cc5c5fb 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -12,7 +12,11 @@
12/* .data section */ 12/* .data section */
13#define DATA_DATA \ 13#define DATA_DATA \
14 *(.data) \ 14 *(.data) \
15 *(.data.init.refok) 15 *(.data.init.refok) \
16 . = ALIGN(8); \
17 VMLINUX_SYMBOL(__start___markers) = .; \
18 *(__markers) \
19 VMLINUX_SYMBOL(__stop___markers) = .;
16 20
17#define RO_DATA(align) \ 21#define RO_DATA(align) \
18 . = ALIGN((align)); \ 22 . = ALIGN((align)); \
@@ -20,6 +24,7 @@
20 VMLINUX_SYMBOL(__start_rodata) = .; \ 24 VMLINUX_SYMBOL(__start_rodata) = .; \
21 *(.rodata) *(.rodata.*) \ 25 *(.rodata) *(.rodata.*) \
22 *(__vermagic) /* Kernel version magic */ \ 26 *(__vermagic) /* Kernel version magic */ \
27 *(__markers_strings) /* Markers: strings */ \
23 } \ 28 } \
24 \ 29 \
25 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \ 30 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h
index d76299c98b81..cb18e3b0aa94 100644
--- a/include/asm-h8300/bitops.h
+++ b/include/asm-h8300/bitops.h
@@ -10,6 +10,11 @@
10#include <asm/system.h> 10#include <asm/system.h>
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13
14#ifndef _LINUX_BITOPS_H
15#error only <linux/bitops.h> can be included directly
16#endif
17
13/* 18/*
14 * Function prototypes to keep gcc -Wall happy 19 * Function prototypes to keep gcc -Wall happy
15 */ 20 */
@@ -194,6 +199,7 @@ static __inline__ unsigned long __ffs(unsigned long word)
194#include <asm-generic/bitops/find.h> 199#include <asm-generic/bitops/find.h>
195#include <asm-generic/bitops/sched.h> 200#include <asm-generic/bitops/sched.h>
196#include <asm-generic/bitops/hweight.h> 201#include <asm-generic/bitops/hweight.h>
202#include <asm-generic/bitops/lock.h>
197#include <asm-generic/bitops/ext2-non-atomic.h> 203#include <asm-generic/bitops/ext2-non-atomic.h>
198#include <asm-generic/bitops/ext2-atomic.h> 204#include <asm-generic/bitops/ext2-atomic.h>
199#include <asm-generic/bitops/minix.h> 205#include <asm-generic/bitops/minix.h>
diff --git a/include/asm-h8300/system.h b/include/asm-h8300/system.h
index 7807018f8500..2c1e83f7b419 100644
--- a/include/asm-h8300/system.h
+++ b/include/asm-h8300/system.h
@@ -82,8 +82,7 @@ asmlinkage void resume(void);
82#define mb() asm volatile ("" : : :"memory") 82#define mb() asm volatile ("" : : :"memory")
83#define rmb() asm volatile ("" : : :"memory") 83#define rmb() asm volatile ("" : : :"memory")
84#define wmb() asm volatile ("" : : :"memory") 84#define wmb() asm volatile ("" : : :"memory")
85#define set_rmb(var, value) do { xchg(&var, value); } while (0) 85#define set_mb(var, value) do { xchg(&var, value); } while (0)
86#define set_mb(var, value) set_rmb(var, value)
87 86
88#ifdef CONFIG_SMP 87#ifdef CONFIG_SMP
89#define smp_mb() mb() 88#define smp_mb() mb()
diff --git a/include/asm-h8300/tlbflush.h b/include/asm-h8300/tlbflush.h
index 9a2c5c9fd700..41c148a9208e 100644
--- a/include/asm-h8300/tlbflush.h
+++ b/include/asm-h8300/tlbflush.h
@@ -52,10 +52,4 @@ static inline void flush_tlb_kernel_page(unsigned long addr)
52 BUG(); 52 BUG();
53} 53}
54 54
55static inline void flush_tlb_pgtables(struct mm_struct *mm,
56 unsigned long start, unsigned long end)
57{
58 BUG();
59}
60
61#endif /* _H8300_TLBFLUSH_H */ 55#endif /* _H8300_TLBFLUSH_H */
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h
index 6cc517e212a9..a977affaebec 100644
--- a/include/asm-ia64/bitops.h
+++ b/include/asm-ia64/bitops.h
@@ -9,6 +9,10 @@
9 * O(1) scheduler patch 9 * O(1) scheduler patch
10 */ 10 */
11 11
12#ifndef _LINUX_BITOPS_H
13#error only <linux/bitops.h> can be included directly
14#endif
15
12#include <linux/compiler.h> 16#include <linux/compiler.h>
13#include <linux/types.h> 17#include <linux/types.h>
14#include <asm/intrinsics.h> 18#include <asm/intrinsics.h>
@@ -94,6 +98,38 @@ clear_bit (int nr, volatile void *addr)
94} 98}
95 99
96/** 100/**
101 * clear_bit_unlock - Clears a bit in memory with release
102 * @nr: Bit to clear
103 * @addr: Address to start counting from
104 *
105 * clear_bit_unlock() is atomic and may not be reordered. It does
106 * contain a memory barrier suitable for unlock type operations.
107 */
108static __inline__ void
109clear_bit_unlock (int nr, volatile void *addr)
110{
111 __u32 mask, old, new;
112 volatile __u32 *m;
113 CMPXCHG_BUGCHECK_DECL
114
115 m = (volatile __u32 *) addr + (nr >> 5);
116 mask = ~(1 << (nr & 31));
117 do {
118 CMPXCHG_BUGCHECK(m);
119 old = *m;
120 new = old & mask;
121 } while (cmpxchg_rel(m, old, new) != old);
122}
123
124/**
125 * __clear_bit_unlock - Non-atomically clear a bit with release
126 *
127 * This is like clear_bit_unlock, but the implementation may use a non-atomic
128 * store (this one uses an atomic, however).
129 */
130#define __clear_bit_unlock clear_bit_unlock
131
132/**
97 * __clear_bit - Clears a bit in memory (non-atomic version) 133 * __clear_bit - Clears a bit in memory (non-atomic version)
98 */ 134 */
99static __inline__ void 135static __inline__ void
@@ -170,6 +206,15 @@ test_and_set_bit (int nr, volatile void *addr)
170} 206}
171 207
172/** 208/**
209 * test_and_set_bit_lock - Set a bit and return its old value for lock
210 * @nr: Bit to set
211 * @addr: Address to count from
212 *
213 * This is the same as test_and_set_bit on ia64
214 */
215#define test_and_set_bit_lock test_and_set_bit
216
217/**
173 * __test_and_set_bit - Set a bit and return its old value 218 * __test_and_set_bit - Set a bit and return its old value
174 * @nr: Bit to set 219 * @nr: Bit to set
175 * @addr: Address to count from 220 * @addr: Address to count from
diff --git a/include/asm-ia64/cacheflush.h b/include/asm-ia64/cacheflush.h
index 4906916d715b..afcfbda76e20 100644
--- a/include/asm-ia64/cacheflush.h
+++ b/include/asm-ia64/cacheflush.h
@@ -7,8 +7,8 @@
7 */ 7 */
8 8
9#include <linux/page-flags.h> 9#include <linux/page-flags.h>
10#include <linux/bitops.h>
10 11
11#include <asm/bitops.h>
12#include <asm/page.h> 12#include <asm/page.h>
13 13
14/* 14/*
diff --git a/include/asm-ia64/ide.h b/include/asm-ia64/ide.h
index e928675de352..1ccf23809329 100644
--- a/include/asm-ia64/ide.h
+++ b/include/asm-ia64/ide.h
@@ -46,7 +46,6 @@ static inline unsigned long ide_default_io_base(int index)
46 } 46 }
47} 47}
48 48
49#define IDE_ARCH_OBSOLETE_INIT
50#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 49#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
51 50
52#ifdef CONFIG_PCI 51#ifdef CONFIG_PCI
diff --git a/include/asm-ia64/meminit.h b/include/asm-ia64/meminit.h
index 3a62878e84f3..f93308f54b61 100644
--- a/include/asm-ia64/meminit.h
+++ b/include/asm-ia64/meminit.h
@@ -35,7 +35,7 @@ extern void find_memory (void);
35extern void reserve_memory (void); 35extern void reserve_memory (void);
36extern void find_initrd (void); 36extern void find_initrd (void);
37extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg); 37extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
38extern void efi_memmap_init(unsigned long *, unsigned long *); 38extern unsigned long efi_memmap_init(unsigned long *s, unsigned long *e);
39extern int find_max_min_low_pfn (unsigned long , unsigned long, void *); 39extern int find_max_min_low_pfn (unsigned long , unsigned long, void *);
40 40
41extern unsigned long vmcore_find_descriptor_size(unsigned long address); 41extern unsigned long vmcore_find_descriptor_size(unsigned long address);
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index 0971ec90807e..e6204f14f614 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -150,7 +150,7 @@
150# ifndef __ASSEMBLY__ 150# ifndef __ASSEMBLY__
151 151
152#include <linux/sched.h> /* for mm_struct */ 152#include <linux/sched.h> /* for mm_struct */
153#include <asm/bitops.h> 153#include <linux/bitops.h>
154#include <asm/cacheflush.h> 154#include <asm/cacheflush.h>
155#include <asm/mmu_context.h> 155#include <asm/mmu_context.h>
156#include <asm/processor.h> 156#include <asm/processor.h>
diff --git a/include/asm-ia64/smp.h b/include/asm-ia64/smp.h
index 1703c9d885bd..471cc2ee9ac4 100644
--- a/include/asm-ia64/smp.h
+++ b/include/asm-ia64/smp.h
@@ -14,8 +14,8 @@
14#include <linux/threads.h> 14#include <linux/threads.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/cpumask.h> 16#include <linux/cpumask.h>
17#include <linux/bitops.h>
17 18
18#include <asm/bitops.h>
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/param.h> 20#include <asm/param.h>
21#include <asm/processor.h> 21#include <asm/processor.h>
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index ff857e31738a..0229fb95fb38 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -11,9 +11,9 @@
11 11
12#include <linux/compiler.h> 12#include <linux/compiler.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/bitops.h>
14 15
15#include <asm/atomic.h> 16#include <asm/atomic.h>
16#include <asm/bitops.h>
17#include <asm/intrinsics.h> 17#include <asm/intrinsics.h>
18#include <asm/system.h> 18#include <asm/system.h>
19 19
diff --git a/include/asm-ia64/tlbflush.h b/include/asm-ia64/tlbflush.h
index e37f9fbf33af..80bcb0a38e8a 100644
--- a/include/asm-ia64/tlbflush.h
+++ b/include/asm-ia64/tlbflush.h
@@ -84,19 +84,6 @@ flush_tlb_page (struct vm_area_struct *vma, unsigned long addr)
84} 84}
85 85
86/* 86/*
87 * Flush the TLB entries mapping the virtually mapped linear page
88 * table corresponding to address range [START-END).
89 */
90static inline void
91flush_tlb_pgtables (struct mm_struct *mm, unsigned long start, unsigned long end)
92{
93 /*
94 * Deprecated. The virtual page table is now flushed via the normal gather/flush
95 * interface (see tlb.h).
96 */
97}
98
99/*
100 * Flush the local TLB. Invoked from another cpu using an IPI. 87 * Flush the local TLB. Invoked from another cpu using an IPI.
101 */ 88 */
102#ifdef CONFIG_SMP 89#ifdef CONFIG_SMP
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h
index 66ab672162cd..6dc9b81bf9f3 100644
--- a/include/asm-m32r/bitops.h
+++ b/include/asm-m32r/bitops.h
@@ -11,6 +11,10 @@
11 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> 11 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org>
12 */ 12 */
13 13
14#ifndef _LINUX_BITOPS_H
15#error only <linux/bitops.h> can be included directly
16#endif
17
14#include <linux/compiler.h> 18#include <linux/compiler.h>
15#include <asm/assembler.h> 19#include <asm/assembler.h>
16#include <asm/system.h> 20#include <asm/system.h>
@@ -255,6 +259,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
255#include <asm-generic/bitops/find.h> 259#include <asm-generic/bitops/find.h>
256#include <asm-generic/bitops/ffs.h> 260#include <asm-generic/bitops/ffs.h>
257#include <asm-generic/bitops/hweight.h> 261#include <asm-generic/bitops/hweight.h>
262#include <asm-generic/bitops/lock.h>
258 263
259#endif /* __KERNEL__ */ 264#endif /* __KERNEL__ */
260 265
diff --git a/include/asm-m32r/ide.h b/include/asm-m32r/ide.h
index 4672a49e8760..5d2044e529ab 100644
--- a/include/asm-m32r/ide.h
+++ b/include/asm-m32r/ide.h
@@ -65,7 +65,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
65 } 65 }
66} 66}
67 67
68#define IDE_ARCH_OBSOLETE_INIT
69#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 68#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
70 69
71#ifdef CONFIG_BLK_DEV_IDEPCI 70#ifdef CONFIG_BLK_DEV_IDEPCI
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
index 92d7266783fd..86505387be08 100644
--- a/include/asm-m32r/pgtable.h
+++ b/include/asm-m32r/pgtable.h
@@ -21,9 +21,9 @@
21#ifndef __ASSEMBLY__ 21#ifndef __ASSEMBLY__
22 22
23#include <linux/threads.h> 23#include <linux/threads.h>
24#include <linux/bitops.h>
24#include <asm/processor.h> 25#include <asm/processor.h>
25#include <asm/addrspace.h> 26#include <asm/addrspace.h>
26#include <asm/bitops.h>
27#include <asm/page.h> 27#include <asm/page.h>
28 28
29struct mm_struct; 29struct mm_struct;
diff --git a/include/asm-m32r/tlbflush.h b/include/asm-m32r/tlbflush.h
index 3d37ac002bcc..0ef95307784e 100644
--- a/include/asm-m32r/tlbflush.h
+++ b/include/asm-m32r/tlbflush.h
@@ -12,7 +12,6 @@
12 * - flush_tlb_page(vma, vmaddr) flushes one page 12 * - flush_tlb_page(vma, vmaddr) flushes one page
13 * - flush_tlb_range(vma, start, end) flushes a range of pages 13 * - flush_tlb_range(vma, start, end) flushes a range of pages
14 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 14 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
15 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
16 */ 15 */
17 16
18extern void local_flush_tlb_all(void); 17extern void local_flush_tlb_all(void);
@@ -93,8 +92,6 @@ static __inline__ void __flush_tlb_all(void)
93 ); 92 );
94} 93}
95 94
96#define flush_tlb_pgtables(mm, start, end) do { } while (0)
97
98extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 95extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
99 96
100#endif /* _ASM_M32R_TLBFLUSH_H */ 97#endif /* _ASM_M32R_TLBFLUSH_H */
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
index 1a61fdb56aaf..2976b5d68e96 100644
--- a/include/asm-m68k/bitops.h
+++ b/include/asm-m68k/bitops.h
@@ -8,6 +8,10 @@
8 * for more details. 8 * for more details.
9 */ 9 */
10 10
11#ifndef _LINUX_BITOPS_H
12#error only <linux/bitops.h> can be included directly
13#endif
14
11#include <linux/compiler.h> 15#include <linux/compiler.h>
12 16
13/* 17/*
@@ -314,6 +318,7 @@ static inline int fls(int x)
314#include <asm-generic/bitops/fls64.h> 318#include <asm-generic/bitops/fls64.h>
315#include <asm-generic/bitops/sched.h> 319#include <asm-generic/bitops/sched.h>
316#include <asm-generic/bitops/hweight.h> 320#include <asm-generic/bitops/hweight.h>
321#include <asm-generic/bitops/lock.h>
317 322
318/* Bitmap functions for the minix filesystem */ 323/* Bitmap functions for the minix filesystem */
319 324
diff --git a/include/asm-m68k/ide.h b/include/asm-m68k/ide.h
index f9ffb2cbbae8..909c6dfd3851 100644
--- a/include/asm-m68k/ide.h
+++ b/include/asm-m68k/ide.h
@@ -137,7 +137,7 @@ ide_get_lock(irq_handler_t handler, void *data)
137#endif /* CONFIG_BLK_DEV_FALCON_IDE */ 137#endif /* CONFIG_BLK_DEV_FALCON_IDE */
138 138
139#define IDE_ARCH_ACK_INTR 139#define IDE_ARCH_ACK_INTR
140#define ide_ack_intr(hwif) ((hwif)->hw.ack_intr ? (hwif)->hw.ack_intr(hwif) : 1) 140#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
141 141
142#endif /* __KERNEL__ */ 142#endif /* __KERNEL__ */
143#endif /* _M68K_IDE_H */ 143#endif /* _M68K_IDE_H */
diff --git a/include/asm-m68k/tlbflush.h b/include/asm-m68k/tlbflush.h
index 31678831ee47..17707ec315e2 100644
--- a/include/asm-m68k/tlbflush.h
+++ b/include/asm-m68k/tlbflush.h
@@ -92,11 +92,6 @@ static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end
92 flush_tlb_all(); 92 flush_tlb_all();
93} 93}
94 94
95static inline void flush_tlb_pgtables(struct mm_struct *mm,
96 unsigned long start, unsigned long end)
97{
98}
99
100#else 95#else
101 96
102 97
@@ -219,11 +214,6 @@ static inline void flush_tlb_kernel_page (unsigned long addr)
219 sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG); 214 sun3_put_segmap (addr & ~(SUN3_PMEG_SIZE - 1), SUN3_INVALID_PMEG);
220} 215}
221 216
222static inline void flush_tlb_pgtables(struct mm_struct *mm,
223 unsigned long start, unsigned long end)
224{
225}
226
227#endif 217#endif
228 218
229#endif /* _M68K_TLBFLUSH_H */ 219#endif /* _M68K_TLBFLUSH_H */
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h
index 7d6075d9b5cb..f8dfb7ba2e25 100644
--- a/include/asm-m68knommu/bitops.h
+++ b/include/asm-m68knommu/bitops.h
@@ -10,6 +10,10 @@
10 10
11#ifdef __KERNEL__ 11#ifdef __KERNEL__
12 12
13#ifndef _LINUX_BITOPS_H
14#error only <linux/bitops.h> can be included directly
15#endif
16
13#include <asm-generic/bitops/ffs.h> 17#include <asm-generic/bitops/ffs.h>
14#include <asm-generic/bitops/__ffs.h> 18#include <asm-generic/bitops/__ffs.h>
15#include <asm-generic/bitops/sched.h> 19#include <asm-generic/bitops/sched.h>
@@ -160,6 +164,7 @@ static __inline__ int __test_bit(int nr, const volatile unsigned long * addr)
160 164
161#include <asm-generic/bitops/find.h> 165#include <asm-generic/bitops/find.h>
162#include <asm-generic/bitops/hweight.h> 166#include <asm-generic/bitops/hweight.h>
167#include <asm-generic/bitops/lock.h>
163 168
164static __inline__ int ext2_set_bit(int nr, volatile void * addr) 169static __inline__ int ext2_set_bit(int nr, volatile void * addr)
165{ 170{
diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
index 1bd1142685e1..15b4c7d45c94 100644
--- a/include/asm-m68knommu/system.h
+++ b/include/asm-m68knommu/system.h
@@ -104,8 +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_rmb(var, value) do { xchg(&var, value); } while (0) 107#define set_mb(var, value) do { xchg(&var, value); } while (0)
108#define set_mb(var, value) set_rmb(var, value)
109 108
110#ifdef CONFIG_SMP 109#ifdef CONFIG_SMP
111#define smp_mb() mb() 110#define smp_mb() mb()
diff --git a/include/asm-m68knommu/tlbflush.h b/include/asm-m68knommu/tlbflush.h
index de858db28b00..a470cfb803eb 100644
--- a/include/asm-m68knommu/tlbflush.h
+++ b/include/asm-m68knommu/tlbflush.h
@@ -52,10 +52,4 @@ static inline void flush_tlb_kernel_page(unsigned long addr)
52 BUG(); 52 BUG();
53} 53}
54 54
55static inline void flush_tlb_pgtables(struct mm_struct *mm,
56 unsigned long start, unsigned long end)
57{
58 BUG();
59}
60
61#endif /* _M68KNOMMU_TLBFLUSH_H */ 55#endif /* _M68KNOMMU_TLBFLUSH_H */
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 899357a72ac4..ec75ce4cdb8c 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -9,6 +9,10 @@
9#ifndef _ASM_BITOPS_H 9#ifndef _ASM_BITOPS_H
10#define _ASM_BITOPS_H 10#define _ASM_BITOPS_H
11 11
12#ifndef _LINUX_BITOPS_H
13#error only <linux/bitops.h> can be included directly
14#endif
15
12#include <linux/compiler.h> 16#include <linux/compiler.h>
13#include <linux/irqflags.h> 17#include <linux/irqflags.h>
14#include <linux/types.h> 18#include <linux/types.h>
@@ -172,6 +176,20 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
172} 176}
173 177
174/* 178/*
179 * clear_bit_unlock - Clears a bit in memory
180 * @nr: Bit to clear
181 * @addr: Address to start counting from
182 *
183 * clear_bit() is atomic and implies release semantics before the memory
184 * operation. It can be used for an unlock.
185 */
186static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
187{
188 smp_mb__before_clear_bit();
189 clear_bit(nr, addr);
190}
191
192/*
175 * change_bit - Toggle a bit in memory 193 * change_bit - Toggle a bit in memory
176 * @nr: Bit to change 194 * @nr: Bit to change
177 * @addr: Address to start counting from 195 * @addr: Address to start counting from
@@ -240,6 +258,8 @@ static inline int test_and_set_bit(unsigned long nr,
240 unsigned short bit = nr & SZLONG_MASK; 258 unsigned short bit = nr & SZLONG_MASK;
241 unsigned long res; 259 unsigned long res;
242 260
261 smp_llsc_mb();
262
243 if (cpu_has_llsc && R10000_LLSC_WAR) { 263 if (cpu_has_llsc && R10000_LLSC_WAR) {
244 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 264 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
245 unsigned long temp; 265 unsigned long temp;
@@ -295,6 +315,73 @@ static inline int test_and_set_bit(unsigned long nr,
295} 315}
296 316
297/* 317/*
318 * test_and_set_bit_lock - Set a bit and return its old value
319 * @nr: Bit to set
320 * @addr: Address to count from
321 *
322 * This operation is atomic and implies acquire ordering semantics
323 * after the memory operation.
324 */
325static inline int test_and_set_bit_lock(unsigned long nr,
326 volatile unsigned long *addr)
327{
328 unsigned short bit = nr & SZLONG_MASK;
329 unsigned long res;
330
331 if (cpu_has_llsc && R10000_LLSC_WAR) {
332 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
333 unsigned long temp;
334
335 __asm__ __volatile__(
336 " .set mips3 \n"
337 "1: " __LL "%0, %1 # test_and_set_bit \n"
338 " or %2, %0, %3 \n"
339 " " __SC "%2, %1 \n"
340 " beqzl %2, 1b \n"
341 " and %2, %0, %3 \n"
342 " .set mips0 \n"
343 : "=&r" (temp), "=m" (*m), "=&r" (res)
344 : "r" (1UL << bit), "m" (*m)
345 : "memory");
346 } else if (cpu_has_llsc) {
347 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
348 unsigned long temp;
349
350 __asm__ __volatile__(
351 " .set push \n"
352 " .set noreorder \n"
353 " .set mips3 \n"
354 "1: " __LL "%0, %1 # test_and_set_bit \n"
355 " or %2, %0, %3 \n"
356 " " __SC "%2, %1 \n"
357 " beqz %2, 2f \n"
358 " and %2, %0, %3 \n"
359 " .subsection 2 \n"
360 "2: b 1b \n"
361 " nop \n"
362 " .previous \n"
363 " .set pop \n"
364 : "=&r" (temp), "=m" (*m), "=&r" (res)
365 : "r" (1UL << bit), "m" (*m)
366 : "memory");
367 } else {
368 volatile unsigned long *a = addr;
369 unsigned long mask;
370 unsigned long flags;
371
372 a += nr >> SZLONG_LOG;
373 mask = 1UL << bit;
374 raw_local_irq_save(flags);
375 res = (mask & *a);
376 *a |= mask;
377 raw_local_irq_restore(flags);
378 }
379
380 smp_llsc_mb();
381
382 return res != 0;
383}
384/*
298 * test_and_clear_bit - Clear a bit and return its old value 385 * test_and_clear_bit - Clear a bit and return its old value
299 * @nr: Bit to clear 386 * @nr: Bit to clear
300 * @addr: Address to count from 387 * @addr: Address to count from
@@ -308,6 +395,8 @@ static inline int test_and_clear_bit(unsigned long nr,
308 unsigned short bit = nr & SZLONG_MASK; 395 unsigned short bit = nr & SZLONG_MASK;
309 unsigned long res; 396 unsigned long res;
310 397
398 smp_llsc_mb();
399
311 if (cpu_has_llsc && R10000_LLSC_WAR) { 400 if (cpu_has_llsc && R10000_LLSC_WAR) {
312 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 401 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
313 unsigned long temp; 402 unsigned long temp;
@@ -396,6 +485,8 @@ static inline int test_and_change_bit(unsigned long nr,
396 unsigned short bit = nr & SZLONG_MASK; 485 unsigned short bit = nr & SZLONG_MASK;
397 unsigned long res; 486 unsigned long res;
398 487
488 smp_llsc_mb();
489
399 if (cpu_has_llsc && R10000_LLSC_WAR) { 490 if (cpu_has_llsc && R10000_LLSC_WAR) {
400 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 491 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
401 unsigned long temp; 492 unsigned long temp;
@@ -453,6 +544,21 @@ static inline int test_and_change_bit(unsigned long nr,
453#include <asm-generic/bitops/non-atomic.h> 544#include <asm-generic/bitops/non-atomic.h>
454 545
455/* 546/*
547 * __clear_bit_unlock - Clears a bit in memory
548 * @nr: Bit to clear
549 * @addr: Address to start counting from
550 *
551 * __clear_bit() is non-atomic and implies release semantics before the memory
552 * operation. It can be used for an unlock if no other CPUs can concurrently
553 * modify other bits in the word.
554 */
555static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
556{
557 smp_mb();
558 __clear_bit(nr, addr);
559}
560
561/*
456 * Return the bit position (0..63) of the most significant 1 bit in a word 562 * Return the bit position (0..63) of the most significant 1 bit in a word
457 * Returns -1 if no 1 bit exists 563 * Returns -1 if no 1 bit exists
458 */ 564 */
diff --git a/include/asm-mips/fpu.h b/include/asm-mips/fpu.h
index 483685b1592e..e59d4c039661 100644
--- a/include/asm-mips/fpu.h
+++ b/include/asm-mips/fpu.h
@@ -12,12 +12,12 @@
12 12
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/thread_info.h> 14#include <linux/thread_info.h>
15#include <linux/bitops.h>
15 16
16#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
17#include <asm/cpu.h> 18#include <asm/cpu.h>
18#include <asm/cpu-features.h> 19#include <asm/cpu-features.h>
19#include <asm/hazards.h> 20#include <asm/hazards.h>
20#include <asm/bitops.h>
21#include <asm/processor.h> 21#include <asm/processor.h>
22#include <asm/current.h> 22#include <asm/current.h>
23 23
diff --git a/include/asm-mips/ip32/crime.h b/include/asm-mips/ip32/crime.h
index a13702fafa85..7c36b0e5b1c6 100644
--- a/include/asm-mips/ip32/crime.h
+++ b/include/asm-mips/ip32/crime.h
@@ -17,9 +17,6 @@
17 */ 17 */
18#define CRIME_BASE 0x14000000 /* physical */ 18#define CRIME_BASE 0x14000000 /* physical */
19 19
20#undef BIT
21#define BIT(x) (1UL << (x))
22
23struct sgi_crime { 20struct sgi_crime {
24 volatile unsigned long id; 21 volatile unsigned long id;
25#define CRIME_ID_MASK 0xff 22#define CRIME_ID_MASK 0xff
diff --git a/include/asm-mips/ip32/mace.h b/include/asm-mips/ip32/mace.h
index 990082c81f39..d08d7c672139 100644
--- a/include/asm-mips/ip32/mace.h
+++ b/include/asm-mips/ip32/mace.h
@@ -17,9 +17,6 @@
17 */ 17 */
18#define MACE_BASE 0x1f000000 /* physical */ 18#define MACE_BASE 0x1f000000 /* physical */
19 19
20#undef BIT
21#define BIT(x) (1UL << (x))
22
23/* 20/*
24 * PCI interface 21 * PCI interface
25 */ 22 */
diff --git a/include/asm-mips/mach-generic/ide.h b/include/asm-mips/mach-generic/ide.h
index a77128362a7d..4ec2b930dfbb 100644
--- a/include/asm-mips/mach-generic/ide.h
+++ b/include/asm-mips/mach-generic/ide.h
@@ -98,7 +98,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
98 } 98 }
99} 99}
100 100
101#define IDE_ARCH_OBSOLETE_INIT
102#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 101#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
103 102
104#ifdef CONFIG_BLK_DEV_IDEPCI 103#ifdef CONFIG_BLK_DEV_IDEPCI
diff --git a/include/asm-mips/mach-ip27/kernel-entry-init.h b/include/asm-mips/mach-ip27/kernel-entry-init.h
index c1a10314b317..624d66c7f290 100644
--- a/include/asm-mips/mach-ip27/kernel-entry-init.h
+++ b/include/asm-mips/mach-ip27/kernel-entry-init.h
@@ -46,7 +46,14 @@
46 lh t1, KV_RO_NASID_OFFSET(t0) 46 lh t1, KV_RO_NASID_OFFSET(t0)
47 lh t2, KV_RW_NASID_OFFSET(t0) 47 lh t2, KV_RW_NASID_OFFSET(t0)
48 MAPPED_KERNEL_SETUP_TLB 48 MAPPED_KERNEL_SETUP_TLB
49 ARC64_TWIDDLE_PC 49
50 /*
51 * We might not get launched at the address the kernel is linked to,
52 * so we jump there.
53 */
54 PTR_LA t0, 0f
55 jr t0
560:
50 .endm 57 .endm
51 58
52#endif /* __ASM_MACH_IP27_KERNEL_ENTRY_H */ 59#endif /* __ASM_MACH_IP27_KERNEL_ENTRY_H */
diff --git a/include/asm-mips/pci/bridge.h b/include/asm-mips/pci/bridge.h
index b84feebf2cef..5f4b9d4e4114 100644
--- a/include/asm-mips/pci/bridge.h
+++ b/include/asm-mips/pci/bridge.h
@@ -538,7 +538,7 @@ typedef struct bridge_err_cmdword_s {
538 BRIDGE_ISR_PMU_ESIZE_FAULT) 538 BRIDGE_ISR_PMU_ESIZE_FAULT)
539 539
540/* 540/*
541 * List of Errors which are fatal and kill the sytem 541 * List of Errors which are fatal and kill the system
542 */ 542 */
543#define BRIDGE_ISR_ERROR_FATAL \ 543#define BRIDGE_ISR_ERROR_FATAL \
544 ((BRIDGE_ISR_XTALK_ERROR & ~BRIDGE_ISR_XREAD_REQ_TIMEOUT)|\ 544 ((BRIDGE_ISR_XTALK_ERROR & ~BRIDGE_ISR_XREAD_REQ_TIMEOUT)|\
diff --git a/include/asm-mips/sni.h b/include/asm-mips/sni.h
index 4d43dbb7f8b8..af081457f847 100644
--- a/include/asm-mips/sni.h
+++ b/include/asm-mips/sni.h
@@ -141,8 +141,6 @@ extern unsigned int sni_brd_type;
141#define A20R_PT_TIM0_ACK 0xbc050000 141#define A20R_PT_TIM0_ACK 0xbc050000
142#define A20R_PT_TIM1_ACK 0xbc060000 142#define A20R_PT_TIM1_ACK 0xbc060000
143 143
144#define SNI_MIPS_IRQ_CPU_TIMER (MIPS_CPU_IRQ_BASE+7)
145
146#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE 144#define SNI_A20R_IRQ_BASE MIPS_CPU_IRQ_BASE
147#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5) 145#define SNI_A20R_IRQ_TIMER (SNI_A20R_IRQ_BASE+5)
148 146
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h
index 35555bd5c52d..bc47af313bcd 100644
--- a/include/asm-mips/time.h
+++ b/include/asm-mips/time.h
@@ -21,6 +21,7 @@
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/rtc.h> 22#include <linux/rtc.h>
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/clockchips.h>
24#include <linux/clocksource.h> 25#include <linux/clocksource.h>
25 26
26extern spinlock_t rtc_lock; 27extern spinlock_t rtc_lock;
@@ -40,7 +41,6 @@ extern int rtc_mips_set_mmss(unsigned long);
40 * mips_timer_ack may be NULL if the interrupt is self-recoverable. 41 * mips_timer_ack may be NULL if the interrupt is self-recoverable.
41 */ 42 */
42extern int (*mips_timer_state)(void); 43extern int (*mips_timer_state)(void);
43extern void (*mips_timer_ack)(void);
44 44
45/* 45/*
46 * High precision timer clocksource. 46 * High precision timer clocksource.
@@ -76,6 +76,16 @@ extern int (*perf_irq)(void);
76/* 76/*
77 * Initialize the calling CPU's compare interrupt as clockevent device 77 * Initialize the calling CPU's compare interrupt as clockevent device
78 */ 78 */
79#ifdef CONFIG_CEVT_R4K
79extern void mips_clockevent_init(void); 80extern void mips_clockevent_init(void);
81#else
82static inline void mips_clockevent_init(void)
83{
84}
85#endif
86
87extern void clocksource_set_clock(struct clocksource *cs, unsigned int clock);
88extern void clockevent_set_clock(struct clock_event_device *cd,
89 unsigned int clock);
80 90
81#endif /* _ASM_TIME_H */ 91#endif /* _ASM_TIME_H */
diff --git a/include/asm-mips/tlbflush.h b/include/asm-mips/tlbflush.h
index 730e841fb08a..86b21de12e91 100644
--- a/include/asm-mips/tlbflush.h
+++ b/include/asm-mips/tlbflush.h
@@ -11,7 +11,6 @@
11 * - flush_tlb_page(vma, vmaddr) flushes one page 11 * - flush_tlb_page(vma, vmaddr) flushes one page
12 * - flush_tlb_range(vma, start, end) flushes a range of pages 12 * - flush_tlb_range(vma, start, end) flushes a range of pages
13 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 13 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
14 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
15 */ 14 */
16extern void local_flush_tlb_all(void); 15extern void local_flush_tlb_all(void);
17extern void local_flush_tlb_mm(struct mm_struct *mm); 16extern void local_flush_tlb_mm(struct mm_struct *mm);
@@ -45,10 +44,4 @@ extern void flush_tlb_one(unsigned long vaddr);
45 44
46#endif /* CONFIG_SMP */ 45#endif /* CONFIG_SMP */
47 46
48static inline void flush_tlb_pgtables(struct mm_struct *mm,
49 unsigned long start, unsigned long end)
50{
51 /* Nothing to do on MIPS. */
52}
53
54#endif /* __ASM_TLBFLUSH_H */ 47#endif /* __ASM_TLBFLUSH_H */
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h
index 015cb0d379bd..f8eebcbad01f 100644
--- a/include/asm-parisc/bitops.h
+++ b/include/asm-parisc/bitops.h
@@ -1,6 +1,10 @@
1#ifndef _PARISC_BITOPS_H 1#ifndef _PARISC_BITOPS_H
2#define _PARISC_BITOPS_H 2#define _PARISC_BITOPS_H
3 3
4#ifndef _LINUX_BITOPS_H
5#error only <linux/bitops.h> can be included directly
6#endif
7
4#include <linux/compiler.h> 8#include <linux/compiler.h>
5#include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */ 9#include <asm/types.h> /* for BITS_PER_LONG/SHIFT_PER_LONG */
6#include <asm/byteorder.h> 10#include <asm/byteorder.h>
@@ -208,6 +212,7 @@ static __inline__ int fls(int x)
208 212
209#include <asm-generic/bitops/fls64.h> 213#include <asm-generic/bitops/fls64.h>
210#include <asm-generic/bitops/hweight.h> 214#include <asm-generic/bitops/hweight.h>
215#include <asm-generic/bitops/lock.h>
211#include <asm-generic/bitops/sched.h> 216#include <asm-generic/bitops/sched.h>
212 217
213#endif /* __KERNEL__ */ 218#endif /* __KERNEL__ */
diff --git a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h
index b27bf7aeb256..be8760fbc8ee 100644
--- a/include/asm-parisc/ide.h
+++ b/include/asm-parisc/ide.h
@@ -17,7 +17,6 @@
17#define MAX_HWIFS 2 17#define MAX_HWIFS 2
18#endif 18#endif
19 19
20#define IDE_ARCH_OBSOLETE_INIT
21#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 20#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
22 21
23#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id)) 22#define ide_request_irq(irq,hand,flg,dev,id) request_irq((irq),(hand),(flg),(dev),(id))
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
index b5a8797dcc5c..cd0fa4f73320 100644
--- a/include/asm-parisc/pgtable.h
+++ b/include/asm-parisc/pgtable.h
@@ -11,9 +11,9 @@
11 */ 11 */
12 12
13#include <linux/mm.h> /* for vm_area_struct */ 13#include <linux/mm.h> /* for vm_area_struct */
14#include <linux/bitops.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
15#include <asm/cache.h> 16#include <asm/cache.h>
16#include <asm/bitops.h>
17 17
18/* 18/*
19 * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel 19 * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
diff --git a/include/asm-parisc/tlbflush.h b/include/asm-parisc/tlbflush.h
index 7758ee3832af..b72ec66db699 100644
--- a/include/asm-parisc/tlbflush.h
+++ b/include/asm-parisc/tlbflush.h
@@ -57,10 +57,6 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
57#endif 57#endif
58} 58}
59 59
60static inline void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end)
61{
62}
63
64static inline void flush_tlb_page(struct vm_area_struct *vma, 60static inline void flush_tlb_page(struct vm_area_struct *vma,
65 unsigned long addr) 61 unsigned long addr)
66{ 62{
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 8144a2788db6..733b4af7f4f1 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -38,6 +38,10 @@
38 38
39#ifdef __KERNEL__ 39#ifdef __KERNEL__
40 40
41#ifndef _LINUX_BITOPS_H
42#error only <linux/bitops.h> can be included directly
43#endif
44
41#include <linux/compiler.h> 45#include <linux/compiler.h>
42#include <asm/asm-compat.h> 46#include <asm/asm-compat.h>
43#include <asm/synch.h> 47#include <asm/synch.h>
@@ -86,6 +90,24 @@ static __inline__ void clear_bit(int nr, volatile unsigned long *addr)
86 : "cc" ); 90 : "cc" );
87} 91}
88 92
93static __inline__ void clear_bit_unlock(int nr, volatile unsigned long *addr)
94{
95 unsigned long old;
96 unsigned long mask = BITOP_MASK(nr);
97 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
98
99 __asm__ __volatile__(
100 LWSYNC_ON_SMP
101"1:" PPC_LLARX "%0,0,%3 # clear_bit_unlock\n"
102 "andc %0,%0,%2\n"
103 PPC405_ERR77(0,%3)
104 PPC_STLCX "%0,0,%3\n"
105 "bne- 1b"
106 : "=&r" (old), "+m" (*p)
107 : "r" (mask), "r" (p)
108 : "cc", "memory");
109}
110
89static __inline__ void change_bit(int nr, volatile unsigned long *addr) 111static __inline__ void change_bit(int nr, volatile unsigned long *addr)
90{ 112{
91 unsigned long old; 113 unsigned long old;
@@ -125,6 +147,27 @@ static __inline__ int test_and_set_bit(unsigned long nr,
125 return (old & mask) != 0; 147 return (old & mask) != 0;
126} 148}
127 149
150static __inline__ int test_and_set_bit_lock(unsigned long nr,
151 volatile unsigned long *addr)
152{
153 unsigned long old, t;
154 unsigned long mask = BITOP_MASK(nr);
155 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
156
157 __asm__ __volatile__(
158"1:" PPC_LLARX "%0,0,%3 # test_and_set_bit_lock\n"
159 "or %1,%0,%2 \n"
160 PPC405_ERR77(0,%3)
161 PPC_STLCX "%1,0,%3 \n"
162 "bne- 1b"
163 ISYNC_ON_SMP
164 : "=&r" (old), "=&r" (t)
165 : "r" (mask), "r" (p)
166 : "cc", "memory");
167
168 return (old & mask) != 0;
169}
170
128static __inline__ int test_and_clear_bit(unsigned long nr, 171static __inline__ int test_and_clear_bit(unsigned long nr,
129 volatile unsigned long *addr) 172 volatile unsigned long *addr)
130{ 173{
@@ -185,6 +228,12 @@ static __inline__ void set_bits(unsigned long mask, unsigned long *addr)
185 228
186#include <asm-generic/bitops/non-atomic.h> 229#include <asm-generic/bitops/non-atomic.h>
187 230
231static __inline__ void __clear_bit_unlock(int nr, volatile unsigned long *addr)
232{
233 __asm__ __volatile__(LWSYNC_ON_SMP "" ::: "memory");
234 __clear_bit(nr, addr);
235}
236
188/* 237/*
189 * Return the zero-based bit position (LE, not IBM bit numbering) of 238 * Return the zero-based bit position (LE, not IBM bit numbering) of
190 * the most significant 1-bit in a double word. 239 * the most significant 1-bit in a double word.
diff --git a/include/asm-powerpc/ide.h b/include/asm-powerpc/ide.h
index 1644e44c8757..fd7f5a430f0a 100644
--- a/include/asm-powerpc/ide.h
+++ b/include/asm-powerpc/ide.h
@@ -69,12 +69,11 @@ static __inline__ unsigned long ide_default_io_base(int index)
69 69
70#ifdef CONFIG_BLK_DEV_MPC8xx_IDE 70#ifdef CONFIG_BLK_DEV_MPC8xx_IDE
71#define IDE_ARCH_ACK_INTR 1 71#define IDE_ARCH_ACK_INTR 1
72#define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1) 72#define ide_ack_intr(hwif) ((hwif)->ack_intr ? (hwif)->ack_intr(hwif) : 1)
73#endif 73#endif
74 74
75#endif /* __powerpc64__ */ 75#endif /* __powerpc64__ */
76 76
77#define IDE_ARCH_OBSOLETE_INIT
78#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 77#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
79 78
80#endif /* __KERNEL__ */ 79#endif /* __KERNEL__ */
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index bf14ab4ef4c9..e44cdfc8493a 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -522,7 +522,7 @@ static inline void name at \
522#else 522#else
523/* 523/*
524 * Enforce synchronisation of stores vs. spin_unlock 524 * Enforce synchronisation of stores vs. spin_unlock
525 * (this does it explicitely, though our implementation of spin_unlock 525 * (this does it explicitly, though our implementation of spin_unlock
526 * does it implicitely too) 526 * does it implicitely too)
527 */ 527 */
528static inline void mmiowb(void) 528static inline void mmiowb(void)
diff --git a/include/asm-powerpc/iommu.h b/include/asm-powerpc/iommu.h
index 870967e47204..4a82fdccee92 100644
--- a/include/asm-powerpc/iommu.h
+++ b/include/asm-powerpc/iommu.h
@@ -26,9 +26,9 @@
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/bitops.h>
29#include <asm/machdep.h> 30#include <asm/machdep.h>
30#include <asm/types.h> 31#include <asm/types.h>
31#include <asm/bitops.h>
32 32
33#define IOMMU_PAGE_SHIFT 12 33#define IOMMU_PAGE_SHIFT 12
34#define IOMMU_PAGE_SIZE (ASM_CONST(1) << IOMMU_PAGE_SHIFT) 34#define IOMMU_PAGE_SIZE (ASM_CONST(1) << IOMMU_PAGE_SHIFT)
diff --git a/include/asm-powerpc/mmu_context.h b/include/asm-powerpc/mmu_context.h
index f863ac21409e..9102b8bf0ead 100644
--- a/include/asm-powerpc/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -8,7 +8,7 @@
8 8
9#ifndef CONFIG_PPC64 9#ifndef CONFIG_PPC64
10#include <asm/atomic.h> 10#include <asm/atomic.h>
11#include <asm/bitops.h> 11#include <linux/bitops.h>
12 12
13/* 13/*
14 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs 14 * On 32-bit PowerPC 6xx/7xx/7xxx CPUs, we use a set of 16 VSIDs
diff --git a/include/asm-powerpc/mpc52xx.h b/include/asm-powerpc/mpc52xx.h
index 24751df791ac..568135fe52ea 100644
--- a/include/asm-powerpc/mpc52xx.h
+++ b/include/asm-powerpc/mpc52xx.h
@@ -18,6 +18,8 @@
18#include <asm/prom.h> 18#include <asm/prom.h>
19#endif /* __ASSEMBLY__ */ 19#endif /* __ASSEMBLY__ */
20 20
21#include <linux/suspend.h>
22
21 23
22/* ======================================================================== */ 24/* ======================================================================== */
23/* Structures mapping of some unit register set */ 25/* Structures mapping of some unit register set */
@@ -267,9 +269,9 @@ extern int mpc52xx_set_wakeup_gpio(u8 pin, u8 level);
267extern int __init lite5200_pm_init(void); 269extern int __init lite5200_pm_init(void);
268 270
269/* lite5200 calls mpc5200 suspend functions, so here they are */ 271/* lite5200 calls mpc5200 suspend functions, so here they are */
270extern int mpc52xx_pm_prepare(suspend_state_t); 272extern int mpc52xx_pm_prepare(void);
271extern int mpc52xx_pm_enter(suspend_state_t); 273extern int mpc52xx_pm_enter(suspend_state_t);
272extern int mpc52xx_pm_finish(suspend_state_t); 274extern void mpc52xx_pm_finish(void);
273extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */ 275extern char saved_sram[0x4000]; /* reuse buffer from mpc52xx suspend */
274#endif 276#endif
275#endif /* CONFIG_PM */ 277#endif /* CONFIG_PM */
diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h
index fcd7b428ed0b..f6dfce025adf 100644
--- a/include/asm-powerpc/paca.h
+++ b/include/asm-powerpc/paca.h
@@ -114,11 +114,12 @@ struct paca_struct {
114 u64 user_time; /* accumulated usermode TB ticks */ 114 u64 user_time; /* accumulated usermode TB ticks */
115 u64 system_time; /* accumulated system TB ticks */ 115 u64 system_time; /* accumulated system TB ticks */
116 u64 startpurr; /* PURR/TB value snapshot */ 116 u64 startpurr; /* PURR/TB value snapshot */
117 u64 startspurr; /* SPURR value snapshot */
118 u64 purrdelta; /* FIXME: document */
119 u64 spurrdelta; /* FIXME: document */
117}; 120};
118 121
119extern struct paca_struct paca[]; 122extern struct paca_struct paca[];
120 123
121void setup_boot_paca(void);
122
123#endif /* __KERNEL__ */ 124#endif /* __KERNEL__ */
124#endif /* _ASM_POWERPC_PACA_H */ 125#endif /* _ASM_POWERPC_PACA_H */
diff --git a/include/asm-powerpc/tlbflush.h b/include/asm-powerpc/tlbflush.h
index a022f806bb21..b6b036ccee34 100644
--- a/include/asm-powerpc/tlbflush.h
+++ b/include/asm-powerpc/tlbflush.h
@@ -8,7 +8,6 @@
8 * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB 8 * - flush_tlb_page_nohash(vma, vmaddr) flushes one page if SW loaded TLB
9 * - flush_tlb_range(vma, start, end) flushes a range of pages 9 * - flush_tlb_range(vma, start, end) flushes a range of pages
10 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 10 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
11 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
12 * 11 *
13 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
@@ -174,15 +173,5 @@ extern void __flush_hash_table_range(struct mm_struct *mm, unsigned long start,
174 */ 173 */
175extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 174extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
176 175
177/*
178 * This is called in munmap when we have freed up some page-table
179 * pages. We don't need to do anything here, there's nothing special
180 * about our page-table pages. -- paulus
181 */
182static inline void flush_tlb_pgtables(struct mm_struct *mm,
183 unsigned long start, unsigned long end)
184{
185}
186
187#endif /*__KERNEL__ */ 176#endif /*__KERNEL__ */
188#endif /* _ASM_POWERPC_TLBFLUSH_H */ 177#endif /* _ASM_POWERPC_TLBFLUSH_H */
diff --git a/include/asm-ppc/mmu_context.h b/include/asm-ppc/mmu_context.h
index a6441a063e5d..b2e25d8997bf 100644
--- a/include/asm-ppc/mmu_context.h
+++ b/include/asm-ppc/mmu_context.h
@@ -2,8 +2,9 @@
2#ifndef __PPC_MMU_CONTEXT_H 2#ifndef __PPC_MMU_CONTEXT_H
3#define __PPC_MMU_CONTEXT_H 3#define __PPC_MMU_CONTEXT_H
4 4
5#include <linux/bitops.h>
6
5#include <asm/atomic.h> 7#include <asm/atomic.h>
6#include <asm/bitops.h>
7#include <asm/mmu.h> 8#include <asm/mmu.h>
8#include <asm/cputable.h> 9#include <asm/cputable.h>
9#include <asm-generic/mm_hooks.h> 10#include <asm-generic/mm_hooks.h>
diff --git a/include/asm-ppc/time.h b/include/asm-ppc/time.h
index f7eadf6ac806..81dbcd43a501 100644
--- a/include/asm-ppc/time.h
+++ b/include/asm-ppc/time.h
@@ -57,7 +57,7 @@ static __inline__ void set_dec(unsigned int val)
57/* Accessor functions for the timebase (RTC on 601) registers. */ 57/* Accessor functions for the timebase (RTC on 601) registers. */
58/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */ 58/* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
59#ifdef CONFIG_6xx 59#ifdef CONFIG_6xx
60extern __inline__ int __attribute_pure__ __USE_RTC(void) { 60extern __inline__ int __pure __USE_RTC(void) {
61 return (mfspr(SPRN_PVR)>>16) == 1; 61 return (mfspr(SPRN_PVR)>>16) == 1;
62} 62}
63#else 63#else
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h
index f79c9b792af1..34d9a6357c38 100644
--- a/include/asm-s390/bitops.h
+++ b/include/asm-s390/bitops.h
@@ -15,6 +15,10 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#ifndef _LINUX_BITOPS_H
19#error only <linux/bitops.h> can be included directly
20#endif
21
18#include <linux/compiler.h> 22#include <linux/compiler.h>
19 23
20/* 24/*
@@ -746,6 +750,7 @@ static inline int sched_find_first_bit(unsigned long *b)
746#include <asm-generic/bitops/fls64.h> 750#include <asm-generic/bitops/fls64.h>
747 751
748#include <asm-generic/bitops/hweight.h> 752#include <asm-generic/bitops/hweight.h>
753#include <asm-generic/bitops/lock.h>
749 754
750/* 755/*
751 * ATTENTION: intel byte ordering convention for ext2 and minix !! 756 * ATTENTION: intel byte ordering convention for ext2 and minix !!
diff --git a/include/asm-s390/tlbflush.h b/include/asm-s390/tlbflush.h
index 66793f55c8b2..6de2632a3e4f 100644
--- a/include/asm-s390/tlbflush.h
+++ b/include/asm-s390/tlbflush.h
@@ -14,7 +14,6 @@
14 * - flush_tlb_page(vma, vmaddr) flushes one page 14 * - flush_tlb_page(vma, vmaddr) flushes one page
15 * - flush_tlb_range(vma, start, end) flushes a range of pages 15 * - flush_tlb_range(vma, start, end) flushes a range of pages
16 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 16 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
17 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
18 */ 17 */
19 18
20/* 19/*
@@ -152,10 +151,4 @@ static inline void flush_tlb_range(struct vm_area_struct *vma,
152 151
153#endif 152#endif
154 153
155static inline void flush_tlb_pgtables(struct mm_struct *mm,
156 unsigned long start, unsigned long end)
157{
158 /* S/390 does not keep any page table caches in TLB */
159}
160
161#endif /* _S390_TLBFLUSH_H */ 154#endif /* _S390_TLBFLUSH_H */
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
index 1c16792cee1d..df805f20b267 100644
--- a/include/asm-sh/bitops.h
+++ b/include/asm-sh/bitops.h
@@ -2,6 +2,11 @@
2#define __ASM_SH_BITOPS_H 2#define __ASM_SH_BITOPS_H
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5
6#ifndef _LINUX_BITOPS_H
7#error only <linux/bitops.h> can be included directly
8#endif
9
5#include <asm/system.h> 10#include <asm/system.h>
6/* For __swab32 */ 11/* For __swab32 */
7#include <asm/byteorder.h> 12#include <asm/byteorder.h>
@@ -137,6 +142,7 @@ static inline unsigned long __ffs(unsigned long word)
137#include <asm-generic/bitops/find.h> 142#include <asm-generic/bitops/find.h>
138#include <asm-generic/bitops/ffs.h> 143#include <asm-generic/bitops/ffs.h>
139#include <asm-generic/bitops/hweight.h> 144#include <asm-generic/bitops/hweight.h>
145#include <asm-generic/bitops/lock.h>
140#include <asm-generic/bitops/sched.h> 146#include <asm-generic/bitops/sched.h>
141#include <asm-generic/bitops/ext2-non-atomic.h> 147#include <asm-generic/bitops/ext2-non-atomic.h>
142#include <asm-generic/bitops/ext2-atomic.h> 148#include <asm-generic/bitops/ext2-atomic.h>
diff --git a/include/asm-sh/se7751.h b/include/asm-sh/se7751.h
index 02ca9347f043..b36792ac5d66 100644
--- a/include/asm-sh/se7751.h
+++ b/include/asm-sh/se7751.h
@@ -36,7 +36,7 @@
36#define PA_LED 0xba000000 /* LED */ 36#define PA_LED 0xba000000 /* LED */
37#define PA_BCR 0xbb000000 /* FPGA on the MS7751SE01 */ 37#define PA_BCR 0xbb000000 /* FPGA on the MS7751SE01 */
38 38
39#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controler */ 39#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controller */
40#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */ 40#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */
41#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */ 41#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */
42#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */ 42#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */
diff --git a/include/asm-sh/systemh7751.h b/include/asm-sh/systemh7751.h
index b143bb2a2ca7..4161122c84ef 100644
--- a/include/asm-sh/systemh7751.h
+++ b/include/asm-sh/systemh7751.h
@@ -36,7 +36,7 @@
36#define PA_LED 0xba000000 /* LED */ 36#define PA_LED 0xba000000 /* LED */
37#define PA_BCR 0xbb000000 /* FPGA on the MS7751SE01 */ 37#define PA_BCR 0xbb000000 /* FPGA on the MS7751SE01 */
38 38
39#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controler */ 39#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controller */
40#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */ 40#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */
41#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */ 41#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */
42#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */ 42#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */
diff --git a/include/asm-sh/tlbflush.h b/include/asm-sh/tlbflush.h
index 455fb8da441e..e0ac97221ae6 100644
--- a/include/asm-sh/tlbflush.h
+++ b/include/asm-sh/tlbflush.h
@@ -9,7 +9,6 @@
9 * - flush_tlb_page(vma, vmaddr) flushes one page 9 * - flush_tlb_page(vma, vmaddr) flushes one page
10 * - flush_tlb_range(vma, start, end) flushes a range of pages 10 * - flush_tlb_range(vma, start, end) flushes a range of pages
11 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 11 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
12 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
13 */ 12 */
14extern void local_flush_tlb_all(void); 13extern void local_flush_tlb_all(void);
15extern void local_flush_tlb_mm(struct mm_struct *mm); 14extern void local_flush_tlb_mm(struct mm_struct *mm);
@@ -47,9 +46,4 @@ extern void flush_tlb_one(unsigned long asid, unsigned long page);
47 46
48#endif /* CONFIG_SMP */ 47#endif /* CONFIG_SMP */
49 48
50static inline void flush_tlb_pgtables(struct mm_struct *mm,
51 unsigned long start, unsigned long end)
52{
53 /* Nothing to do */
54}
55#endif /* __ASM_SH_TLBFLUSH_H */ 49#endif /* __ASM_SH_TLBFLUSH_H */
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h
index f3bdcdb5d046..600c59efb4c2 100644
--- a/include/asm-sh64/bitops.h
+++ b/include/asm-sh64/bitops.h
@@ -13,6 +13,11 @@
13 */ 13 */
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16
17#ifndef _LINUX_BITOPS_H
18#error only <linux/bitops.h> can be included directly
19#endif
20
16#include <linux/compiler.h> 21#include <linux/compiler.h>
17#include <asm/system.h> 22#include <asm/system.h>
18/* For __swab32 */ 23/* For __swab32 */
@@ -136,6 +141,7 @@ static __inline__ unsigned long ffz(unsigned long word)
136#include <asm-generic/bitops/__ffs.h> 141#include <asm-generic/bitops/__ffs.h>
137#include <asm-generic/bitops/find.h> 142#include <asm-generic/bitops/find.h>
138#include <asm-generic/bitops/hweight.h> 143#include <asm-generic/bitops/hweight.h>
144#include <asm-generic/bitops/lock.h>
139#include <asm-generic/bitops/sched.h> 145#include <asm-generic/bitops/sched.h>
140#include <asm-generic/bitops/ffs.h> 146#include <asm-generic/bitops/ffs.h>
141#include <asm-generic/bitops/ext2-non-atomic.h> 147#include <asm-generic/bitops/ext2-non-atomic.h>
diff --git a/include/asm-sh64/ide.h b/include/asm-sh64/ide.h
index c9d84d5f772e..b6e31e8b9410 100644
--- a/include/asm-sh64/ide.h
+++ b/include/asm-sh64/ide.h
@@ -19,7 +19,6 @@
19/* Without this, the initialisation of PCI IDE cards end up calling 19/* Without this, the initialisation of PCI IDE cards end up calling
20 * ide_init_hwif_ports, which won't work. */ 20 * ide_init_hwif_ports, which won't work. */
21#ifdef CONFIG_BLK_DEV_IDEPCI 21#ifdef CONFIG_BLK_DEV_IDEPCI
22#define IDE_ARCH_OBSOLETE_INIT 1
23#define ide_default_io_ctl(base) (0) 22#define ide_default_io_ctl(base) (0)
24#endif 23#endif
25 24
diff --git a/include/asm-sh64/system.h b/include/asm-sh64/system.h
index 5ff94644e8c8..be2a15ffcc55 100644
--- a/include/asm-sh64/system.h
+++ b/include/asm-sh64/system.h
@@ -62,8 +62,7 @@ extern void __xchg_called_with_bad_pointer(void);
62#define smp_read_barrier_depends() do { } while (0) 62#define smp_read_barrier_depends() do { } while (0)
63#endif /* CONFIG_SMP */ 63#endif /* CONFIG_SMP */
64 64
65#define set_rmb(var, value) do { (void)xchg(&var, value); } while (0) 65#define set_mb(var, value) do { (void)xchg(&var, value); } while (0)
66#define set_mb(var, value) set_rmb(var, value)
67 66
68/* Interrupt Control */ 67/* Interrupt Control */
69#ifndef HARD_CLI 68#ifndef HARD_CLI
diff --git a/include/asm-sh64/tlbflush.h b/include/asm-sh64/tlbflush.h
index e45beadc29ee..16a164a23754 100644
--- a/include/asm-sh64/tlbflush.h
+++ b/include/asm-sh64/tlbflush.h
@@ -20,10 +20,6 @@ extern void flush_tlb_mm(struct mm_struct *mm);
20extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, 20extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
21 unsigned long end); 21 unsigned long end);
22extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page); 22extern void flush_tlb_page(struct vm_area_struct *vma, unsigned long page);
23static inline void flush_tlb_pgtables(struct mm_struct *mm,
24 unsigned long start, unsigned long end)
25{
26}
27 23
28extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); 24extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
29 25
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h
index 329e696e7751..cb3cefab6e09 100644
--- a/include/asm-sparc/bitops.h
+++ b/include/asm-sparc/bitops.h
@@ -14,6 +14,10 @@
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16 16
17#ifndef _LINUX_BITOPS_H
18#error only <linux/bitops.h> can be included directly
19#endif
20
17extern unsigned long ___set_bit(unsigned long *addr, unsigned long mask); 21extern unsigned long ___set_bit(unsigned long *addr, unsigned long mask);
18extern unsigned long ___clear_bit(unsigned long *addr, unsigned long mask); 22extern unsigned long ___clear_bit(unsigned long *addr, unsigned long mask);
19extern unsigned long ___change_bit(unsigned long *addr, unsigned long mask); 23extern unsigned long ___change_bit(unsigned long *addr, unsigned long mask);
@@ -96,6 +100,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
96#include <asm-generic/bitops/fls.h> 100#include <asm-generic/bitops/fls.h>
97#include <asm-generic/bitops/fls64.h> 101#include <asm-generic/bitops/fls64.h>
98#include <asm-generic/bitops/hweight.h> 102#include <asm-generic/bitops/hweight.h>
103#include <asm-generic/bitops/lock.h>
99#include <asm-generic/bitops/find.h> 104#include <asm-generic/bitops/find.h>
100#include <asm-generic/bitops/ext2-non-atomic.h> 105#include <asm-generic/bitops/ext2-non-atomic.h>
101#include <asm-generic/bitops/ext2-atomic.h> 106#include <asm-generic/bitops/ext2-atomic.h>
diff --git a/include/asm-sparc/ide.h b/include/asm-sparc/ide.h
index a6d735a1310e..404022765fc7 100644
--- a/include/asm-sparc/ide.h
+++ b/include/asm-sparc/ide.h
@@ -18,7 +18,6 @@
18#undef MAX_HWIFS 18#undef MAX_HWIFS
19#define MAX_HWIFS 2 19#define MAX_HWIFS 2
20 20
21#define IDE_ARCH_OBSOLETE_INIT
22#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 21#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
23 22
24#define __ide_insl(data_reg, buffer, wcount) \ 23#define __ide_insl(data_reg, buffer, wcount) \
diff --git a/include/asm-sparc/ioctls.h b/include/asm-sparc/ioctls.h
index bdf77b0dfd8e..058c2064f706 100644
--- a/include/asm-sparc/ioctls.h
+++ b/include/asm-sparc/ioctls.h
@@ -15,6 +15,10 @@
15#define TCSETS _IOW('T', 9, struct termios) 15#define TCSETS _IOW('T', 9, struct termios)
16#define TCSETSW _IOW('T', 10, struct termios) 16#define TCSETSW _IOW('T', 10, struct termios)
17#define TCSETSF _IOW('T', 11, struct termios) 17#define TCSETSF _IOW('T', 11, struct termios)
18#define TCGETS2 _IOR('T', 12, struct termios2)
19#define TCSETS2 _IOW('T', 13, struct termios2)
20#define TCSETSW2 _IOW('T', 14, struct termios2)
21#define TCSETSF2 _IOW('T', 15, struct termios2)
18 22
19/* Note that all the ioctls that are not available in Linux have a 23/* Note that all the ioctls that are not available in Linux have a
20 * double underscore on the front to: a) avoid some programs to 24 * double underscore on the front to: a) avoid some programs to
diff --git a/include/asm-sparc/of_platform.h b/include/asm-sparc/of_platform.h
index 64a230064ef2..d638737ff13c 100644
--- a/include/asm-sparc/of_platform.h
+++ b/include/asm-sparc/of_platform.h
@@ -18,12 +18,9 @@
18 18
19extern struct bus_type ebus_bus_type; 19extern struct bus_type ebus_bus_type;
20extern struct bus_type sbus_bus_type; 20extern struct bus_type sbus_bus_type;
21extern struct bus_type of_platform_bus_type; 21
22#define of_bus_type of_platform_bus_type /* for compatibility */ 22#define of_bus_type of_platform_bus_type /* for compatibility */
23 23
24extern int of_register_driver(struct of_platform_driver *drv,
25 struct bus_type *bus);
26extern void of_unregister_driver(struct of_platform_driver *drv);
27extern struct of_device *of_platform_device_create(struct device_node *np, 24extern struct of_device *of_platform_device_create(struct device_node *np,
28 const char *bus_id, 25 const char *bus_id,
29 struct device *parent, 26 struct device *parent,
diff --git a/include/asm-sparc/termbits.h b/include/asm-sparc/termbits.h
index 5eb00a105d7c..90cf2210118b 100644
--- a/include/asm-sparc/termbits.h
+++ b/include/asm-sparc/termbits.h
@@ -31,6 +31,18 @@ struct termios {
31#endif 31#endif
32}; 32};
33 33
34struct termios2 {
35 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */
37 tcflag_t c_cflag; /* control mode flags */
38 tcflag_t c_lflag; /* local mode flags */
39 cc_t c_line; /* line discipline */
40 cc_t c_cc[NCCS]; /* control characters */
41 cc_t _x_cc[2]; /* padding to match ktermios */
42 speed_t c_ispeed; /* input speed */
43 speed_t c_ospeed; /* output speed */
44};
45
34struct ktermios { 46struct ktermios {
35 tcflag_t c_iflag; /* input mode flags */ 47 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */ 48 tcflag_t c_oflag; /* output mode flags */
@@ -160,6 +172,7 @@ struct ktermios {
160#define CLOCAL 0x00000800 172#define CLOCAL 0x00000800
161#define CBAUDEX 0x00001000 173#define CBAUDEX 0x00001000
162/* We'll never see these speeds with the Zilogs, but for completeness... */ 174/* We'll never see these speeds with the Zilogs, but for completeness... */
175#define BOTHER 0x00001000
163#define B57600 0x00001001 176#define B57600 0x00001001
164#define B115200 0x00001002 177#define B115200 0x00001002
165#define B230400 0x00001003 178#define B230400 0x00001003
@@ -189,6 +202,8 @@ struct ktermios {
189#define CMSPAR 0x40000000 /* mark or space (stick) parity */ 202#define CMSPAR 0x40000000 /* mark or space (stick) parity */
190#define CRTSCTS 0x80000000 /* flow control */ 203#define CRTSCTS 0x80000000 /* flow control */
191 204
205#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
206
192/* c_lflag bits */ 207/* c_lflag bits */
193#define ISIG 0x00000001 208#define ISIG 0x00000001
194#define ICANON 0x00000002 209#define ICANON 0x00000002
diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h
index d767f206ab33..4333232abb9f 100644
--- a/include/asm-sparc/termios.h
+++ b/include/asm-sparc/termios.h
@@ -108,13 +108,55 @@ struct winsize {
108 108
109#define user_termios_to_kernel_termios(k, u) \ 109#define user_termios_to_kernel_termios(k, u) \
110({ \ 110({ \
111 int err; \
112 err = get_user((k)->c_iflag, &(u)->c_iflag); \
113 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
114 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
115 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
116 err |= get_user((k)->c_line, &(u)->c_line); \
117 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
118 if ((k)->c_lflag & ICANON) { \
119 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
120 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
121 } else { \
122 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
123 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
124 } \
125 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
126 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
127 err; \
128})
129
130#define kernel_termios_to_user_termios(u, k) \
131({ \
132 int err; \
133 err = put_user((k)->c_iflag, &(u)->c_iflag); \
134 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
135 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
136 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
137 err |= put_user((k)->c_line, &(u)->c_line); \
138 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
139 if (!((k)->c_lflag & ICANON)) { \
140 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
141 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
142 } else { \
143 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
144 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
145 } \
146 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
147 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
148 err; \
149})
150
151#define user_termios_to_kernel_termios_1(k, u) \
152({ \
111 get_user((k)->c_iflag, &(u)->c_iflag); \ 153 get_user((k)->c_iflag, &(u)->c_iflag); \
112 get_user((k)->c_oflag, &(u)->c_oflag); \ 154 get_user((k)->c_oflag, &(u)->c_oflag); \
113 get_user((k)->c_cflag, &(u)->c_cflag); \ 155 get_user((k)->c_cflag, &(u)->c_cflag); \
114 get_user((k)->c_lflag, &(u)->c_lflag); \ 156 get_user((k)->c_lflag, &(u)->c_lflag); \
115 get_user((k)->c_line, &(u)->c_line); \ 157 get_user((k)->c_line, &(u)->c_line); \
116 copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \ 158 copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
117 if((k)->c_lflag & ICANON) { \ 159 if ((k)->c_lflag & ICANON) { \
118 get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ 160 get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
119 get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ 161 get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
120 } else { \ 162 } else { \
@@ -124,7 +166,7 @@ struct winsize {
124 0; \ 166 0; \
125}) 167})
126 168
127#define kernel_termios_to_user_termios(u, k) \ 169#define kernel_termios_to_user_termios_1(u, k) \
128({ \ 170({ \
129 put_user((k)->c_iflag, &(u)->c_iflag); \ 171 put_user((k)->c_iflag, &(u)->c_iflag); \
130 put_user((k)->c_oflag, &(u)->c_oflag); \ 172 put_user((k)->c_oflag, &(u)->c_oflag); \
@@ -132,7 +174,7 @@ struct winsize {
132 put_user((k)->c_lflag, &(u)->c_lflag); \ 174 put_user((k)->c_lflag, &(u)->c_lflag); \
133 put_user((k)->c_line, &(u)->c_line); \ 175 put_user((k)->c_line, &(u)->c_line); \
134 copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \ 176 copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
135 if(!((k)->c_lflag & ICANON)) { \ 177 if (!((k)->c_lflag & ICANON)) { \
136 put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ 178 put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
137 put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ 179 put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
138 } else { \ 180 } else { \
diff --git a/include/asm-sparc/tlbflush.h b/include/asm-sparc/tlbflush.h
index a619da5cfaa9..b957e29d2ae1 100644
--- a/include/asm-sparc/tlbflush.h
+++ b/include/asm-sparc/tlbflush.h
@@ -13,7 +13,6 @@
13 * - flush_tlb_page(vma, vmaddr) flushes one page 13 * - flush_tlb_page(vma, vmaddr) flushes one page
14 * - flush_tlb_range(vma, start, end) flushes a range of pages 14 * - flush_tlb_range(vma, start, end) flushes a range of pages
15 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 15 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
16 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
17 */ 16 */
18 17
19#ifdef CONFIG_SMP 18#ifdef CONFIG_SMP
@@ -42,11 +41,6 @@ BTFIXUPDEF_CALL(void, flush_tlb_mm, struct mm_struct *)
42BTFIXUPDEF_CALL(void, flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long) 41BTFIXUPDEF_CALL(void, flush_tlb_range, struct vm_area_struct *, unsigned long, unsigned long)
43BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long) 42BTFIXUPDEF_CALL(void, flush_tlb_page, struct vm_area_struct *, unsigned long)
44 43
45// Thanks to Anton Blanchard, our pagetables became uncached in 2.4. Wee!
46// extern void flush_tlb_pgtables(struct mm_struct *mm,
47// unsigned long start, unsigned long end);
48#define flush_tlb_pgtables(mm, start, end) do{ }while(0)
49
50#define flush_tlb_all() BTFIXUP_CALL(flush_tlb_all)() 44#define flush_tlb_all() BTFIXUP_CALL(flush_tlb_all)()
51#define flush_tlb_mm(mm) BTFIXUP_CALL(flush_tlb_mm)(mm) 45#define flush_tlb_mm(mm) BTFIXUP_CALL(flush_tlb_mm)(mm)
52#define flush_tlb_range(vma,start,end) BTFIXUP_CALL(flush_tlb_range)(vma,start,end) 46#define flush_tlb_range(vma,start,end) BTFIXUP_CALL(flush_tlb_range)(vma,start,end)
diff --git a/include/asm-sparc64/backoff.h b/include/asm-sparc64/backoff.h
new file mode 100644
index 000000000000..0e32f8b62fd2
--- /dev/null
+++ b/include/asm-sparc64/backoff.h
@@ -0,0 +1,28 @@
1#ifndef _SPARC64_BACKOFF_H
2#define _SPARC64_BACKOFF_H
3
4#define BACKOFF_LIMIT (4 * 1024)
5
6#ifdef CONFIG_SMP
7
8#define BACKOFF_SETUP(reg) \
9 mov 1, reg
10
11#define BACKOFF_SPIN(reg, tmp, label) \
12 mov reg, tmp; \
1388: brnz,pt tmp, 88b; \
14 sub tmp, 1, tmp; \
15 cmp reg, BACKOFF_LIMIT; \
16 bg,pn %xcc, label; \
17 nop; \
18 ba,pt %xcc, label; \
19 sllx reg, 1, reg;
20
21#else
22
23#define BACKOFF_SETUP(reg)
24#define BACKOFF_SPIN(reg, tmp, label)
25
26#endif
27
28#endif /* _SPARC64_BACKOFF_H */
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h
index 3d5e1af84723..982ce8992b91 100644
--- a/include/asm-sparc64/bitops.h
+++ b/include/asm-sparc64/bitops.h
@@ -7,6 +7,10 @@
7#ifndef _SPARC64_BITOPS_H 7#ifndef _SPARC64_BITOPS_H
8#define _SPARC64_BITOPS_H 8#define _SPARC64_BITOPS_H
9 9
10#ifndef _LINUX_BITOPS_H
11#error only <linux/bitops.h> can be included directly
12#endif
13
10#include <linux/compiler.h> 14#include <linux/compiler.h>
11#include <asm/byteorder.h> 15#include <asm/byteorder.h>
12 16
@@ -81,6 +85,7 @@ static inline unsigned int hweight8(unsigned int w)
81#include <asm-generic/bitops/hweight.h> 85#include <asm-generic/bitops/hweight.h>
82 86
83#endif 87#endif
88#include <asm-generic/bitops/lock.h>
84#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
85 90
86#include <asm-generic/bitops/find.h> 91#include <asm-generic/bitops/find.h>
diff --git a/include/asm-sparc64/ide.h b/include/asm-sparc64/ide.h
index 55149cf933c2..ac7eb210b941 100644
--- a/include/asm-sparc64/ide.h
+++ b/include/asm-sparc64/ide.h
@@ -24,7 +24,6 @@
24# endif 24# endif
25#endif 25#endif
26 26
27#define IDE_ARCH_OBSOLETE_INIT
28#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 27#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
29 28
30#define __ide_insl(data_reg, buffer, wcount) \ 29#define __ide_insl(data_reg, buffer, wcount) \
diff --git a/include/asm-sparc64/ioctls.h b/include/asm-sparc64/ioctls.h
index 2223b6d0e5ed..083c9a0f37de 100644
--- a/include/asm-sparc64/ioctls.h
+++ b/include/asm-sparc64/ioctls.h
@@ -16,6 +16,10 @@
16#define TCSETS _IOW('T', 9, struct termios) 16#define TCSETS _IOW('T', 9, struct termios)
17#define TCSETSW _IOW('T', 10, struct termios) 17#define TCSETSW _IOW('T', 10, struct termios)
18#define TCSETSF _IOW('T', 11, struct termios) 18#define TCSETSF _IOW('T', 11, struct termios)
19#define TCGETS2 _IOR('T', 12, struct termios2)
20#define TCSETS2 _IOW('T', 13, struct termios2)
21#define TCSETSW2 _IOW('T', 14, struct termios2)
22#define TCSETSF2 _IOW('T', 15, struct termios2)
19 23
20/* Note that all the ioctls that are not available in Linux have a 24/* Note that all the ioctls that are not available in Linux have a
21 * double underscore on the front to: a) avoid some programs to 25 * double underscore on the front to: a) avoid some programs to
diff --git a/include/asm-sparc64/of_platform.h b/include/asm-sparc64/of_platform.h
index f7c1f17c7d52..f15cfa723916 100644
--- a/include/asm-sparc64/of_platform.h
+++ b/include/asm-sparc64/of_platform.h
@@ -19,12 +19,9 @@
19extern struct bus_type isa_bus_type; 19extern struct bus_type isa_bus_type;
20extern struct bus_type ebus_bus_type; 20extern struct bus_type ebus_bus_type;
21extern struct bus_type sbus_bus_type; 21extern struct bus_type sbus_bus_type;
22extern struct bus_type of_platform_bus_type; 22
23#define of_bus_type of_platform_bus_type /* for compatibility */ 23#define of_bus_type of_platform_bus_type /* for compatibility */
24 24
25extern int of_register_driver(struct of_platform_driver *drv,
26 struct bus_type *bus);
27extern void of_unregister_driver(struct of_platform_driver *drv);
28extern struct of_device *of_platform_device_create(struct device_node *np, 25extern struct of_device *of_platform_device_create(struct device_node *np,
29 const char *bus_id, 26 const char *bus_id,
30 struct device *parent, 27 struct device *parent,
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 42c09949526c..1c1c5ea5cea5 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -26,7 +26,7 @@
26 * Private routines/data 26 * Private routines/data
27 */ 27 */
28 28
29#include <asm/bitops.h> 29#include <linux/bitops.h>
30#include <asm/atomic.h> 30#include <asm/atomic.h>
31#include <asm/percpu.h> 31#include <asm/percpu.h>
32 32
diff --git a/include/asm-sparc64/termbits.h b/include/asm-sparc64/termbits.h
index 705cd44b4173..ebe31c152f16 100644
--- a/include/asm-sparc64/termbits.h
+++ b/include/asm-sparc64/termbits.h
@@ -5,8 +5,6 @@
5 5
6typedef unsigned char cc_t; 6typedef unsigned char cc_t;
7typedef unsigned int speed_t; 7typedef unsigned int speed_t;
8
9/* XXX is this right for sparc64? it was an unsigned long... XXX */
10typedef unsigned int tcflag_t; 8typedef unsigned int tcflag_t;
11 9
12#define NCC 8 10#define NCC 8
@@ -33,6 +31,18 @@ struct termios {
33#endif 31#endif
34}; 32};
35 33
34struct termios2 {
35 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */
37 tcflag_t c_cflag; /* control mode flags */
38 tcflag_t c_lflag; /* local mode flags */
39 cc_t c_line; /* line discipline */
40 cc_t c_cc[NCCS]; /* control characters */
41 cc_t _x_cc[2]; /* padding to match ktermios */
42 speed_t c_ispeed; /* input speed */
43 speed_t c_ospeed; /* output speed */
44};
45
36struct ktermios { 46struct ktermios {
37 tcflag_t c_iflag; /* input mode flags */ 47 tcflag_t c_iflag; /* input mode flags */
38 tcflag_t c_oflag; /* output mode flags */ 48 tcflag_t c_oflag; /* output mode flags */
@@ -161,6 +171,7 @@ struct ktermios {
161#define HUPCL 0x00000400 171#define HUPCL 0x00000400
162#define CLOCAL 0x00000800 172#define CLOCAL 0x00000800
163#define CBAUDEX 0x00001000 173#define CBAUDEX 0x00001000
174#define BOTHER 0x00001000
164#define B57600 0x00001001 175#define B57600 0x00001001
165#define B115200 0x00001002 176#define B115200 0x00001002
166#define B230400 0x00001003 177#define B230400 0x00001003
@@ -190,6 +201,8 @@ struct ktermios {
190#define CMSPAR 0x40000000 /* mark or space (stick) parity */ 201#define CMSPAR 0x40000000 /* mark or space (stick) parity */
191#define CRTSCTS 0x80000000 /* flow control */ 202#define CRTSCTS 0x80000000 /* flow control */
192 203
204#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
205
193/* c_lflag bits */ 206/* c_lflag bits */
194#define ISIG 0x00000001 207#define ISIG 0x00000001
195#define ICANON 0x00000002 208#define ICANON 0x00000002
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h
index f05d390993d5..ef527211f8a8 100644
--- a/include/asm-sparc64/termios.h
+++ b/include/asm-sparc64/termios.h
@@ -123,6 +123,8 @@ struct winsize {
123 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ 123 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
124 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ 124 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
125 } \ 125 } \
126 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
127 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
126 err; \ 128 err; \
127}) 129})
128 130
@@ -142,6 +144,46 @@ struct winsize {
142 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ 144 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
143 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ 145 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
144 } \ 146 } \
147 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
148 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
149 err; \
150})
151
152#define user_termios_to_kernel_termios_1(k, u) \
153({ \
154 int err; \
155 err = get_user((k)->c_iflag, &(u)->c_iflag); \
156 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
157 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
158 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
159 err |= get_user((k)->c_line, &(u)->c_line); \
160 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
161 if((k)->c_lflag & ICANON) { \
162 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
163 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
164 } else { \
165 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
166 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
167 } \
168 err; \
169})
170
171#define kernel_termios_to_user_termios_1(u, k) \
172({ \
173 int err; \
174 err = put_user((k)->c_iflag, &(u)->c_iflag); \
175 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
176 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
177 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
178 err |= put_user((k)->c_line, &(u)->c_line); \
179 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
180 if(!((k)->c_lflag & ICANON)) { \
181 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
182 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
183 } else { \
184 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
185 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
186 } \
145 err; \ 187 err; \
146}) 188})
147 189
diff --git a/include/asm-sparc64/tlbflush.h b/include/asm-sparc64/tlbflush.h
index 3487328570ed..fbb675dbe0c9 100644
--- a/include/asm-sparc64/tlbflush.h
+++ b/include/asm-sparc64/tlbflush.h
@@ -41,11 +41,4 @@ do { flush_tsb_kernel_range(start,end); \
41 41
42#endif /* ! CONFIG_SMP */ 42#endif /* ! CONFIG_SMP */
43 43
44static inline void flush_tlb_pgtables(struct mm_struct *mm, unsigned long start, unsigned long end)
45{
46 /* We don't use virtual page tables for TLB miss processing
47 * any more. Nowadays we use the TSB.
48 */
49}
50
51#endif /* _SPARC64_TLBFLUSH_H */ 44#endif /* _SPARC64_TLBFLUSH_H */
diff --git a/include/asm-um/bitops.h b/include/asm-um/bitops.h
index 46d781953d3a..e4d38d437b97 100644
--- a/include/asm-um/bitops.h
+++ b/include/asm-um/bitops.h
@@ -1,6 +1,10 @@
1#ifndef __UM_BITOPS_H 1#ifndef __UM_BITOPS_H
2#define __UM_BITOPS_H 2#define __UM_BITOPS_H
3 3
4#ifndef _LINUX_BITOPS_H
5#error only <linux/bitops.h> can be included directly
6#endif
7
4#include "asm/arch/bitops.h" 8#include "asm/arch/bitops.h"
5 9
6#endif 10#endif
diff --git a/include/asm-um/tlbflush.h b/include/asm-um/tlbflush.h
index 9d647c55350b..614f2c091178 100644
--- a/include/asm-um/tlbflush.h
+++ b/include/asm-um/tlbflush.h
@@ -17,7 +17,6 @@
17 * - flush_tlb_page(vma, vmaddr) flushes one page 17 * - flush_tlb_page(vma, vmaddr) flushes one page
18 * - flush_tlb_kernel_vm() flushes the kernel vm area 18 * - flush_tlb_kernel_vm() flushes the kernel vm area
19 * - flush_tlb_range(vma, start, end) flushes a range of pages 19 * - flush_tlb_range(vma, start, end) flushes a range of pages
20 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
21 */ 20 */
22 21
23extern void flush_tlb_all(void); 22extern void flush_tlb_all(void);
@@ -29,9 +28,4 @@ extern void flush_tlb_kernel_vm(void);
29extern void flush_tlb_kernel_range(unsigned long start, unsigned long end); 28extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
30extern void __flush_tlb_one(unsigned long addr); 29extern void __flush_tlb_one(unsigned long addr);
31 30
32static inline void flush_tlb_pgtables(struct mm_struct *mm,
33 unsigned long start, unsigned long end)
34{
35}
36
37#endif 31#endif
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h
index 1fa99baf4e25..f82f5b4a56e0 100644
--- a/include/asm-v850/bitops.h
+++ b/include/asm-v850/bitops.h
@@ -13,6 +13,9 @@
13#ifndef __V850_BITOPS_H__ 13#ifndef __V850_BITOPS_H__
14#define __V850_BITOPS_H__ 14#define __V850_BITOPS_H__
15 15
16#ifndef _LINUX_BITOPS_H
17#error only <linux/bitops.h> can be included directly
18#endif
16 19
17#include <linux/compiler.h> /* unlikely */ 20#include <linux/compiler.h> /* unlikely */
18#include <asm/byteorder.h> /* swab32 */ 21#include <asm/byteorder.h> /* swab32 */
@@ -145,6 +148,7 @@ static inline int __test_bit (int nr, const void *addr)
145#include <asm-generic/bitops/find.h> 148#include <asm-generic/bitops/find.h>
146#include <asm-generic/bitops/sched.h> 149#include <asm-generic/bitops/sched.h>
147#include <asm-generic/bitops/hweight.h> 150#include <asm-generic/bitops/hweight.h>
151#include <asm-generic/bitops/lock.h>
148 152
149#include <asm-generic/bitops/ext2-non-atomic.h> 153#include <asm-generic/bitops/ext2-non-atomic.h>
150#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a) 154#define ext2_set_bit_atomic(l,n,a) test_and_set_bit(n,a)
diff --git a/include/asm-v850/system.h b/include/asm-v850/system.h
index 0de2481fd990..a34ddfafd561 100644
--- a/include/asm-v850/system.h
+++ b/include/asm-v850/system.h
@@ -66,8 +66,7 @@ static inline int irqs_disabled (void)
66#define rmb() mb () 66#define rmb() mb ()
67#define wmb() mb () 67#define wmb() mb ()
68#define read_barrier_depends() ((void)0) 68#define read_barrier_depends() ((void)0)
69#define set_rmb(var, value) do { xchg (&var, value); } while (0) 69#define set_mb(var, value) do { xchg (&var, value); } while (0)
70#define set_mb(var, value) set_rmb (var, value)
71 70
72#define smp_mb() mb () 71#define smp_mb() mb ()
73#define smp_rmb() rmb () 72#define smp_rmb() rmb ()
diff --git a/include/asm-v850/tlbflush.h b/include/asm-v850/tlbflush.h
index 5f2f85f636ea..c44aa64449c8 100644
--- a/include/asm-v850/tlbflush.h
+++ b/include/asm-v850/tlbflush.h
@@ -61,10 +61,4 @@ static inline void flush_tlb_kernel_page(unsigned long addr)
61 BUG (); 61 BUG ();
62} 62}
63 63
64static inline void flush_tlb_pgtables(struct mm_struct *mm,
65 unsigned long start, unsigned long end)
66{
67 BUG ();
68}
69
70#endif /* __V850_TLBFLUSH_H__ */ 64#endif /* __V850_TLBFLUSH_H__ */
diff --git a/include/asm-x86/acpi_32.h b/include/asm-x86/acpi_32.h
index 125179adf044..723493e6c851 100644
--- a/include/asm-x86/acpi_32.h
+++ b/include/asm-x86/acpi_32.h
@@ -81,11 +81,7 @@ int __acpi_release_global_lock(unsigned int *lock);
81 :"=r"(n_hi), "=r"(n_lo) \ 81 :"=r"(n_hi), "=r"(n_lo) \
82 :"0"(n_hi), "1"(n_lo)) 82 :"0"(n_hi), "1"(n_lo))
83 83
84#ifdef CONFIG_X86_IO_APIC 84extern void early_quirks(void);
85extern void check_acpi_pci(void);
86#else
87static inline void check_acpi_pci(void) { }
88#endif
89 85
90#ifdef CONFIG_ACPI 86#ifdef CONFIG_ACPI
91extern int acpi_lapic; 87extern int acpi_lapic;
diff --git a/include/asm-x86/bitops_32.h b/include/asm-x86/bitops_32.h
index a20fe9822f60..3268a341cf49 100644
--- a/include/asm-x86/bitops_32.h
+++ b/include/asm-x86/bitops_32.h
@@ -5,6 +5,10 @@
5 * Copyright 1992, Linus Torvalds. 5 * Copyright 1992, Linus Torvalds.
6 */ 6 */
7 7
8#ifndef _LINUX_BITOPS_H
9#error only <linux/bitops.h> can be included directly
10#endif
11
8#include <linux/compiler.h> 12#include <linux/compiler.h>
9#include <asm/alternative.h> 13#include <asm/alternative.h>
10 14
@@ -402,6 +406,7 @@ static inline int fls(int x)
402} 406}
403 407
404#include <asm-generic/bitops/hweight.h> 408#include <asm-generic/bitops/hweight.h>
409#include <asm-generic/bitops/lock.h>
405 410
406#endif /* __KERNEL__ */ 411#endif /* __KERNEL__ */
407 412
diff --git a/include/asm-x86/bitops_64.h b/include/asm-x86/bitops_64.h
index 1d7d9b4bcacb..dacaa5f1febc 100644
--- a/include/asm-x86/bitops_64.h
+++ b/include/asm-x86/bitops_64.h
@@ -5,6 +5,10 @@
5 * Copyright 1992, Linus Torvalds. 5 * Copyright 1992, Linus Torvalds.
6 */ 6 */
7 7
8#ifndef _LINUX_BITOPS_H
9#error only <linux/bitops.h> can be included directly
10#endif
11
8#include <asm/alternative.h> 12#include <asm/alternative.h>
9 13
10#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1) 14#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)
@@ -408,6 +412,7 @@ static __inline__ int fls(int x)
408#define ARCH_HAS_FAST_MULTIPLIER 1 412#define ARCH_HAS_FAST_MULTIPLIER 1
409 413
410#include <asm-generic/bitops/hweight.h> 414#include <asm-generic/bitops/hweight.h>
415#include <asm-generic/bitops/lock.h>
411 416
412#endif /* __KERNEL__ */ 417#endif /* __KERNEL__ */
413 418
diff --git a/include/asm-x86/compat.h b/include/asm-x86/compat.h
index 53cb96b68a62..66ba7987184a 100644
--- a/include/asm-x86/compat.h
+++ b/include/asm-x86/compat.h
@@ -6,6 +6,7 @@
6 */ 6 */
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <asm/user32.h>
9 10
10#define COMPAT_USER_HZ 100 11#define COMPAT_USER_HZ 100
11 12
@@ -181,6 +182,11 @@ struct compat_shmid64_ds {
181}; 182};
182 183
183/* 184/*
185 * The type of struct elf_prstatus.pr_reg in compatible core dumps.
186 */
187typedef struct user_regs_struct32 compat_elf_gregset_t;
188
189/*
184 * A pointer passed in from user mode. This should not 190 * A pointer passed in from user mode. This should not
185 * be used for syscall parameters, just declare them 191 * be used for syscall parameters, just declare them
186 * as pointers because the syscall entry code will have 192 * as pointers because the syscall entry code will have
diff --git a/include/asm-x86/desc_64.h b/include/asm-x86/desc_64.h
index ac991b5ca0fd..7d9c938e69fd 100644
--- a/include/asm-x86/desc_64.h
+++ b/include/asm-x86/desc_64.h
@@ -20,6 +20,16 @@ extern struct desc_struct cpu_gdt_table[GDT_ENTRIES];
20#define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8)) 20#define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8))
21#define clear_LDT() asm volatile("lldt %w0"::"r" (0)) 21#define clear_LDT() asm volatile("lldt %w0"::"r" (0))
22 22
23static inline unsigned long __store_tr(void)
24{
25 unsigned long tr;
26
27 asm volatile ("str %w0":"=r" (tr));
28 return tr;
29}
30
31#define store_tr(tr) (tr) = __store_tr()
32
23/* 33/*
24 * This is the ldt that every process will get unless we need 34 * This is the ldt that every process will get unless we need
25 * something other than this. 35 * something other than this.
@@ -31,6 +41,16 @@ extern struct desc_ptr cpu_gdt_descr[];
31/* the cpu gdt accessor */ 41/* the cpu gdt accessor */
32#define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address) 42#define cpu_gdt(_cpu) ((struct desc_struct *)cpu_gdt_descr[_cpu].address)
33 43
44static inline void load_gdt(const struct desc_ptr *ptr)
45{
46 asm volatile("lgdt %w0"::"m" (*ptr));
47}
48
49static inline void store_gdt(struct desc_ptr *ptr)
50{
51 asm("sgdt %w0":"=m" (*ptr));
52}
53
34static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist) 54static inline void _set_gate(void *adr, unsigned type, unsigned long func, unsigned dpl, unsigned ist)
35{ 55{
36 struct gate_struct s; 56 struct gate_struct s;
@@ -71,6 +91,16 @@ static inline void set_system_gate_ist(int nr, void *func, unsigned ist)
71 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist); 91 _set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist);
72} 92}
73 93
94static inline void load_idt(const struct desc_ptr *ptr)
95{
96 asm volatile("lidt %w0"::"m" (*ptr));
97}
98
99static inline void store_idt(struct desc_ptr *dtr)
100{
101 asm("sidt %w0":"=m" (*dtr));
102}
103
74static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, 104static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type,
75 unsigned size) 105 unsigned size)
76{ 106{
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h
index d94898831bac..771af336734f 100644
--- a/include/asm-x86/geode.h
+++ b/include/asm-x86/geode.h
@@ -38,6 +38,8 @@ extern int geode_get_dev_base(unsigned int dev);
38#define MSR_LBAR_ACPI 0x5140000E 38#define MSR_LBAR_ACPI 0x5140000E
39#define MSR_LBAR_PMS 0x5140000F 39#define MSR_LBAR_PMS 0x5140000F
40 40
41#define MSR_DIVIL_SOFT_RESET 0x51400017
42
41#define MSR_PIC_YSEL_LOW 0x51400020 43#define MSR_PIC_YSEL_LOW 0x51400020
42#define MSR_PIC_YSEL_HIGH 0x51400021 44#define MSR_PIC_YSEL_HIGH 0x51400021
43#define MSR_PIC_ZSEL_LOW 0x51400022 45#define MSR_PIC_ZSEL_LOW 0x51400022
diff --git a/include/asm-x86/hpet.h b/include/asm-x86/hpet.h
index d4ab6db050b6..b1f3c1ea55d9 100644
--- a/include/asm-x86/hpet.h
+++ b/include/asm-x86/hpet.h
@@ -3,12 +3,6 @@
3 3
4#ifdef CONFIG_HPET_TIMER 4#ifdef CONFIG_HPET_TIMER
5 5
6/*
7 * Documentation on HPET can be found at:
8 * http://www.intel.com/ial/home/sp/pcmmspec.htm
9 * ftp://download.intel.com/ial/home/sp/mmts098.pdf
10 */
11
12#define HPET_MMAP_SIZE 1024 6#define HPET_MMAP_SIZE 1024
13 7
14#define HPET_ID 0x000 8#define HPET_ID 0x000
@@ -64,6 +58,7 @@
64/* hpet memory map physical address */ 58/* hpet memory map physical address */
65extern unsigned long hpet_address; 59extern unsigned long hpet_address;
66extern unsigned long force_hpet_address; 60extern unsigned long force_hpet_address;
61extern int hpet_force_user;
67extern int is_hpet_enabled(void); 62extern int is_hpet_enabled(void);
68extern int hpet_enable(void); 63extern int hpet_enable(void);
69extern unsigned long hpet_readl(unsigned long a); 64extern unsigned long hpet_readl(unsigned long a);
diff --git a/include/asm-x86/ide.h b/include/asm-x86/ide.h
index e7817a3d6578..42130adf9c7c 100644
--- a/include/asm-x86/ide.h
+++ b/include/asm-x86/ide.h
@@ -62,7 +62,6 @@ static __inline__ unsigned long ide_default_io_base(int index)
62 } 62 }
63} 63}
64 64
65#define IDE_ARCH_OBSOLETE_INIT
66#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */ 65#define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
67 66
68#ifdef CONFIG_BLK_DEV_IDEPCI 67#ifdef CONFIG_BLK_DEV_IDEPCI
diff --git a/include/asm-x86/io_apic_64.h b/include/asm-x86/io_apic_64.h
index d9f2e54324d5..e2c13675ee4e 100644
--- a/include/asm-x86/io_apic_64.h
+++ b/include/asm-x86/io_apic_64.h
@@ -133,4 +133,6 @@ void enable_NMI_through_LVT0 (void * dummy);
133 133
134extern spinlock_t i8259A_lock; 134extern spinlock_t i8259A_lock;
135 135
136extern int timer_over_8254;
137
136#endif 138#endif
diff --git a/include/asm-x86/ipi.h b/include/asm-x86/ipi.h
index a7c75ea408a8..6d011bd6067d 100644
--- a/include/asm-x86/ipi.h
+++ b/include/asm-x86/ipi.h
@@ -119,7 +119,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
119 */ 119 */
120 local_irq_save(flags); 120 local_irq_save(flags);
121 for_each_cpu_mask(query_cpu, mask) { 121 for_each_cpu_mask(query_cpu, mask) {
122 __send_IPI_dest_field(x86_cpu_to_apicid[query_cpu], 122 __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu),
123 vector, APIC_DEST_PHYSICAL); 123 vector, APIC_DEST_PHYSICAL);
124 } 124 }
125 local_irq_restore(flags); 125 local_irq_restore(flags);
diff --git a/include/asm-x86/irq_32.h b/include/asm-x86/irq_32.h
index 36f310632c49..aca9c96e8e6b 100644
--- a/include/asm-x86/irq_32.h
+++ b/include/asm-x86/irq_32.h
@@ -45,4 +45,7 @@ unsigned int do_IRQ(struct pt_regs *regs);
45void init_IRQ(void); 45void init_IRQ(void);
46void __init native_init_IRQ(void); 46void __init native_init_IRQ(void);
47 47
48/* Interrupt vector management */
49extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
50
48#endif /* _ASM_IRQ_H */ 51#endif /* _ASM_IRQ_H */
diff --git a/include/asm-x86/msr-index.h b/include/asm-x86/msr-index.h
index a02eb2991349..a4944732be04 100644
--- a/include/asm-x86/msr-index.h
+++ b/include/asm-x86/msr-index.h
@@ -73,8 +73,32 @@
73#define MSR_P6_EVNTSEL0 0x00000186 73#define MSR_P6_EVNTSEL0 0x00000186
74#define MSR_P6_EVNTSEL1 0x00000187 74#define MSR_P6_EVNTSEL1 0x00000187
75 75
76/* K7/K8 MSRs. Not complete. See the architecture manual for a more 76/* AMD64 MSRs. Not complete. See the architecture manual for a more
77 complete list. */ 77 complete list. */
78
79#define MSR_AMD64_IBSFETCHCTL 0xc0011030
80#define MSR_AMD64_IBSFETCHLINAD 0xc0011031
81#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032
82#define MSR_AMD64_IBSOPCTL 0xc0011033
83#define MSR_AMD64_IBSOPRIP 0xc0011034
84#define MSR_AMD64_IBSOPDATA 0xc0011035
85#define MSR_AMD64_IBSOPDATA2 0xc0011036
86#define MSR_AMD64_IBSOPDATA3 0xc0011037
87#define MSR_AMD64_IBSDCLINAD 0xc0011038
88#define MSR_AMD64_IBSDCPHYSAD 0xc0011039
89#define MSR_AMD64_IBSCTL 0xc001103a
90
91/* K8 MSRs */
92#define MSR_K8_TOP_MEM1 0xc001001a
93#define MSR_K8_TOP_MEM2 0xc001001d
94#define MSR_K8_SYSCFG 0xc0010010
95#define MSR_K8_HWCR 0xc0010015
96#define MSR_K8_ENABLE_C1E 0xc0010055
97#define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */
98#define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */
99#define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */
100
101/* K7 MSRs */
78#define MSR_K7_EVNTSEL0 0xc0010000 102#define MSR_K7_EVNTSEL0 0xc0010000
79#define MSR_K7_PERFCTR0 0xc0010004 103#define MSR_K7_PERFCTR0 0xc0010004
80#define MSR_K7_EVNTSEL1 0xc0010001 104#define MSR_K7_EVNTSEL1 0xc0010001
@@ -83,20 +107,10 @@
83#define MSR_K7_PERFCTR2 0xc0010006 107#define MSR_K7_PERFCTR2 0xc0010006
84#define MSR_K7_EVNTSEL3 0xc0010003 108#define MSR_K7_EVNTSEL3 0xc0010003
85#define MSR_K7_PERFCTR3 0xc0010007 109#define MSR_K7_PERFCTR3 0xc0010007
86#define MSR_K8_TOP_MEM1 0xc001001a
87#define MSR_K7_CLK_CTL 0xc001001b 110#define MSR_K7_CLK_CTL 0xc001001b
88#define MSR_K8_TOP_MEM2 0xc001001d
89#define MSR_K8_SYSCFG 0xc0010010
90
91#define K8_MTRRFIXRANGE_DRAM_ENABLE 0x00040000 /* MtrrFixDramEn bit */
92#define K8_MTRRFIXRANGE_DRAM_MODIFY 0x00080000 /* MtrrFixDramModEn bit */
93#define K8_MTRR_RDMEM_WRMEM_MASK 0x18181818 /* Mask: RdMem|WrMem */
94
95#define MSR_K7_HWCR 0xc0010015 111#define MSR_K7_HWCR 0xc0010015
96#define MSR_K8_HWCR 0xc0010015
97#define MSR_K7_FID_VID_CTL 0xc0010041 112#define MSR_K7_FID_VID_CTL 0xc0010041
98#define MSR_K7_FID_VID_STATUS 0xc0010042 113#define MSR_K7_FID_VID_STATUS 0xc0010042
99#define MSR_K8_ENABLE_C1E 0xc0010055
100 114
101/* K6 MSRs */ 115/* K6 MSRs */
102#define MSR_K6_EFER 0xc0000080 116#define MSR_K6_EFER 0xc0000080
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index acd4b339c49b..ed3e70d8d04b 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -17,10 +17,7 @@
17#include <linux/threads.h> 17#include <linux/threads.h>
18#include <asm/paravirt.h> 18#include <asm/paravirt.h>
19 19
20#ifndef _I386_BITOPS_H 20#include <linux/bitops.h>
21#include <asm/bitops.h>
22#endif
23
24#include <linux/slab.h> 21#include <linux/slab.h>
25#include <linux/list.h> 22#include <linux/list.h>
26#include <linux/spinlock.h> 23#include <linux/spinlock.h>
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index a79f5355e3b0..9b0ff477b39e 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -9,7 +9,7 @@
9 * the x86-64 page table tree. 9 * the x86-64 page table tree.
10 */ 10 */
11#include <asm/processor.h> 11#include <asm/processor.h>
12#include <asm/bitops.h> 12#include <linux/bitops.h>
13#include <linux/threads.h> 13#include <linux/threads.h>
14#include <asm/pda.h> 14#include <asm/pda.h>
15 15
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h
index 83800e7496ee..13976b086837 100644
--- a/include/asm-x86/processor_32.h
+++ b/include/asm-x86/processor_32.h
@@ -79,6 +79,7 @@ struct cpuinfo_x86 {
79 unsigned char booted_cores; /* number of cores as seen by OS */ 79 unsigned char booted_cores; /* number of cores as seen by OS */
80 __u8 phys_proc_id; /* Physical processor id. */ 80 __u8 phys_proc_id; /* Physical processor id. */
81 __u8 cpu_core_id; /* Core id */ 81 __u8 cpu_core_id; /* Core id */
82 __u8 cpu_index; /* index into per_cpu list */
82#endif 83#endif
83} __attribute__((__aligned__(SMP_CACHE_BYTES))); 84} __attribute__((__aligned__(SMP_CACHE_BYTES)));
84 85
@@ -103,14 +104,19 @@ extern struct tss_struct doublefault_tss;
103DECLARE_PER_CPU(struct tss_struct, init_tss); 104DECLARE_PER_CPU(struct tss_struct, init_tss);
104 105
105#ifdef CONFIG_SMP 106#ifdef CONFIG_SMP
106extern struct cpuinfo_x86 cpu_data[]; 107DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
107#define current_cpu_data cpu_data[smp_processor_id()] 108#define cpu_data(cpu) per_cpu(cpu_info, cpu)
109#define current_cpu_data cpu_data(smp_processor_id())
108#else 110#else
109#define cpu_data (&boot_cpu_data) 111#define cpu_data(cpu) boot_cpu_data
110#define current_cpu_data boot_cpu_data 112#define current_cpu_data boot_cpu_data
111#endif 113#endif
112 114
113extern int cpu_llc_id[NR_CPUS]; 115/*
116 * the following now lives in the per cpu area:
117 * extern int cpu_llc_id[NR_CPUS];
118 */
119DECLARE_PER_CPU(u8, cpu_llc_id);
114extern char ignore_fpu_irq; 120extern char ignore_fpu_irq;
115 121
116void __init cpu_detect(struct cpuinfo_x86 *c); 122void __init cpu_detect(struct cpuinfo_x86 *c);
diff --git a/include/asm-x86/processor_64.h b/include/asm-x86/processor_64.h
index f422becbddd9..e4f19970a82b 100644
--- a/include/asm-x86/processor_64.h
+++ b/include/asm-x86/processor_64.h
@@ -74,6 +74,7 @@ struct cpuinfo_x86 {
74 __u8 booted_cores; /* number of cores as seen by OS */ 74 __u8 booted_cores; /* number of cores as seen by OS */
75 __u8 phys_proc_id; /* Physical Processor id. */ 75 __u8 phys_proc_id; /* Physical Processor id. */
76 __u8 cpu_core_id; /* Core id. */ 76 __u8 cpu_core_id; /* Core id. */
77 __u8 cpu_index; /* index into per_cpu list */
77#endif 78#endif
78} ____cacheline_aligned; 79} ____cacheline_aligned;
79 80
@@ -88,11 +89,12 @@ struct cpuinfo_x86 {
88#define X86_VENDOR_UNKNOWN 0xff 89#define X86_VENDOR_UNKNOWN 0xff
89 90
90#ifdef CONFIG_SMP 91#ifdef CONFIG_SMP
91extern struct cpuinfo_x86 cpu_data[]; 92DECLARE_PER_CPU(struct cpuinfo_x86, cpu_info);
92#define current_cpu_data cpu_data[smp_processor_id()] 93#define cpu_data(cpu) per_cpu(cpu_info, cpu)
94#define current_cpu_data cpu_data(smp_processor_id())
93#else 95#else
94#define cpu_data (&boot_cpu_data) 96#define cpu_data(cpu) boot_cpu_data
95#define current_cpu_data boot_cpu_data 97#define current_cpu_data boot_cpu_data
96#endif 98#endif
97 99
98extern char ignore_irq13; 100extern char ignore_irq13;
@@ -390,12 +392,6 @@ static inline void sync_core(void)
390 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory"); 392 asm volatile("cpuid" : "=a" (tmp) : "0" (1) : "ebx","ecx","edx","memory");
391} 393}
392 394
393#define ARCH_HAS_PREFETCH
394static inline void prefetch(void *x)
395{
396 asm volatile("prefetcht0 (%0)" :: "r" (x));
397}
398
399#define ARCH_HAS_PREFETCHW 1 395#define ARCH_HAS_PREFETCHW 1
400static inline void prefetchw(void *x) 396static inline void prefetchw(void *x)
401{ 397{
diff --git a/include/asm-x86/proto.h b/include/asm-x86/proto.h
index c44a3a93b5a4..dabba55f7ed8 100644
--- a/include/asm-x86/proto.h
+++ b/include/asm-x86/proto.h
@@ -83,8 +83,6 @@ extern unsigned tsc_khz;
83extern int reboot_force; 83extern int reboot_force;
84extern int notsc_setup(char *); 84extern int notsc_setup(char *);
85 85
86extern int timer_over_8254;
87
88extern int gsi_irq_sharing(int gsi); 86extern int gsi_irq_sharing(int gsi);
89 87
90extern int force_mwait; 88extern int force_mwait;
diff --git a/include/asm-x86/ptrace_32.h b/include/asm-x86/ptrace_32.h
index 6002597b9e12..78d063dabe0a 100644
--- a/include/asm-x86/ptrace_32.h
+++ b/include/asm-x86/ptrace_32.h
@@ -55,6 +55,8 @@ static inline int v8086_mode(struct pt_regs *regs)
55} 55}
56 56
57#define instruction_pointer(regs) ((regs)->eip) 57#define instruction_pointer(regs) ((regs)->eip)
58#define frame_pointer(regs) ((regs)->ebp)
59#define stack_pointer(regs) ((regs)->esp)
58#define regs_return_value(regs) ((regs)->eax) 60#define regs_return_value(regs) ((regs)->eax)
59 61
60extern unsigned long profile_pc(struct pt_regs *regs); 62extern unsigned long profile_pc(struct pt_regs *regs);
diff --git a/include/asm-x86/ptrace_64.h b/include/asm-x86/ptrace_64.h
index 7f166ccb0606..7bfe61e1b705 100644
--- a/include/asm-x86/ptrace_64.h
+++ b/include/asm-x86/ptrace_64.h
@@ -40,6 +40,8 @@ struct pt_regs {
40#define user_mode(regs) (!!((regs)->cs & 3)) 40#define user_mode(regs) (!!((regs)->cs & 3))
41#define user_mode_vm(regs) user_mode(regs) 41#define user_mode_vm(regs) user_mode(regs)
42#define instruction_pointer(regs) ((regs)->rip) 42#define instruction_pointer(regs) ((regs)->rip)
43#define frame_pointer(regs) ((regs)->rbp)
44#define stack_pointer(regs) ((regs)->rsp)
43#define regs_return_value(regs) ((regs)->rax) 45#define regs_return_value(regs) ((regs)->rax)
44 46
45extern unsigned long profile_pc(struct pt_regs *regs); 47extern unsigned long profile_pc(struct pt_regs *regs);
diff --git a/include/asm-x86/smp_32.h b/include/asm-x86/smp_32.h
index ee46038d126c..7056d8684522 100644
--- a/include/asm-x86/smp_32.h
+++ b/include/asm-x86/smp_32.h
@@ -11,7 +11,7 @@
11#endif 11#endif
12 12
13#if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__) 13#if defined(CONFIG_X86_LOCAL_APIC) && !defined(__ASSEMBLY__)
14#include <asm/bitops.h> 14#include <linux/bitops.h>
15#include <asm/mpspec.h> 15#include <asm/mpspec.h>
16#include <asm/apic.h> 16#include <asm/apic.h>
17#ifdef CONFIG_X86_IO_APIC 17#ifdef CONFIG_X86_IO_APIC
@@ -39,9 +39,11 @@ extern void lock_ipi_call_lock(void);
39extern void unlock_ipi_call_lock(void); 39extern void unlock_ipi_call_lock(void);
40 40
41#define MAX_APICID 256 41#define MAX_APICID 256
42extern u8 x86_cpu_to_apicid[]; 42extern u8 __initdata x86_cpu_to_apicid_init[];
43extern void *x86_cpu_to_apicid_ptr;
44DECLARE_PER_CPU(u8, x86_cpu_to_apicid);
43 45
44#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 46#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
45 47
46extern void set_cpu_sibling_map(int cpu); 48extern void set_cpu_sibling_map(int cpu);
47 49
diff --git a/include/asm-x86/smp_64.h b/include/asm-x86/smp_64.h
index d30e9b684fdd..6f0e0273b646 100644
--- a/include/asm-x86/smp_64.h
+++ b/include/asm-x86/smp_64.h
@@ -37,6 +37,8 @@ extern void lock_ipi_call_lock(void);
37extern void unlock_ipi_call_lock(void); 37extern void unlock_ipi_call_lock(void);
38extern int smp_num_siblings; 38extern int smp_num_siblings;
39extern void smp_send_reschedule(int cpu); 39extern void smp_send_reschedule(int cpu);
40extern int smp_call_function_mask(cpumask_t mask, void (*func)(void *),
41 void *info, int wait);
40 42
41/* 43/*
42 * cpu_sibling_map and cpu_core_map now live 44 * cpu_sibling_map and cpu_core_map now live
@@ -47,7 +49,7 @@ extern void smp_send_reschedule(int cpu);
47 */ 49 */
48DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 50DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
49DECLARE_PER_CPU(cpumask_t, cpu_core_map); 51DECLARE_PER_CPU(cpumask_t, cpu_core_map);
50extern u8 cpu_llc_id[NR_CPUS]; 52DECLARE_PER_CPU(u8, cpu_llc_id);
51 53
52#define SMP_TRAMPOLINE_BASE 0x6000 54#define SMP_TRAMPOLINE_BASE 0x6000
53 55
@@ -84,7 +86,9 @@ static inline int hard_smp_processor_id(void)
84 * Some lowlevel functions might want to know about 86 * Some lowlevel functions might want to know about
85 * the real APIC ID <-> CPU # mapping. 87 * the real APIC ID <-> CPU # mapping.
86 */ 88 */
87extern u8 x86_cpu_to_apicid[NR_CPUS]; /* physical ID */ 89extern u8 __initdata x86_cpu_to_apicid_init[];
90extern void *x86_cpu_to_apicid_ptr;
91DECLARE_PER_CPU(u8, x86_cpu_to_apicid); /* physical ID */
88extern u8 bios_cpu_apicid[]; 92extern u8 bios_cpu_apicid[];
89 93
90static inline int cpu_present_to_apicid(int mps_cpu) 94static inline int cpu_present_to_apicid(int mps_cpu)
@@ -115,8 +119,9 @@ static __inline int logical_smp_processor_id(void)
115} 119}
116 120
117#ifdef CONFIG_SMP 121#ifdef CONFIG_SMP
118#define cpu_physical_id(cpu) x86_cpu_to_apicid[cpu] 122#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
119#else 123#else
124extern unsigned int boot_cpu_id;
120#define cpu_physical_id(cpu) boot_cpu_id 125#define cpu_physical_id(cpu) boot_cpu_id
121#endif /* !CONFIG_SMP */ 126#endif /* !CONFIG_SMP */
122#endif 127#endif
diff --git a/include/asm-x86/suspend_64.h b/include/asm-x86/suspend_64.h
index b897e8cb55fb..9440a7a1b99a 100644
--- a/include/asm-x86/suspend_64.h
+++ b/include/asm-x86/suspend_64.h
@@ -53,3 +53,5 @@ extern unsigned long saved_rdi;
53 53
54/* routines for saving/restoring kernel state */ 54/* routines for saving/restoring kernel state */
55extern int acpi_save_state_mem(void); 55extern int acpi_save_state_mem(void);
56extern char core_restore_code;
57extern char restore_registers;
diff --git a/include/asm-x86/system_32.h b/include/asm-x86/system_32.h
index db6283eb5e46..ef8468883bac 100644
--- a/include/asm-x86/system_32.h
+++ b/include/asm-x86/system_32.h
@@ -315,5 +315,6 @@ extern unsigned long arch_align_stack(unsigned long sp);
315extern void free_init_pages(char *what, unsigned long begin, unsigned long end); 315extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
316 316
317void default_idle(void); 317void default_idle(void);
318void __show_registers(struct pt_regs *, int all);
318 319
319#endif 320#endif
diff --git a/include/asm-x86/tlbflush_32.h b/include/asm-x86/tlbflush_32.h
index a50fa6741486..2bd5b95e2048 100644
--- a/include/asm-x86/tlbflush_32.h
+++ b/include/asm-x86/tlbflush_32.h
@@ -78,7 +78,6 @@
78 * - flush_tlb_page(vma, vmaddr) flushes one page 78 * - flush_tlb_page(vma, vmaddr) flushes one page
79 * - flush_tlb_range(vma, start, end) flushes a range of pages 79 * - flush_tlb_range(vma, start, end) flushes a range of pages
80 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 80 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
81 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
82 * - flush_tlb_others(cpumask, mm, va) flushes a TLBs on other cpus 81 * - flush_tlb_others(cpumask, mm, va) flushes a TLBs on other cpus
83 * 82 *
84 * ..but the i386 has somewhat limited tlb flushing capabilities, 83 * ..but the i386 has somewhat limited tlb flushing capabilities,
@@ -166,10 +165,4 @@ static inline void flush_tlb_kernel_range(unsigned long start,
166 flush_tlb_all(); 165 flush_tlb_all();
167} 166}
168 167
169static inline void flush_tlb_pgtables(struct mm_struct *mm,
170 unsigned long start, unsigned long end)
171{
172 /* i386 does not keep any page table caches in TLB */
173}
174
175#endif /* _I386_TLBFLUSH_H */ 168#endif /* _I386_TLBFLUSH_H */
diff --git a/include/asm-x86/tlbflush_64.h b/include/asm-x86/tlbflush_64.h
index 888eb4abdd07..7731fd23d572 100644
--- a/include/asm-x86/tlbflush_64.h
+++ b/include/asm-x86/tlbflush_64.h
@@ -31,7 +31,6 @@ static inline void __flush_tlb_all(void)
31 * - flush_tlb_page(vma, vmaddr) flushes one page 31 * - flush_tlb_page(vma, vmaddr) flushes one page
32 * - flush_tlb_range(vma, start, end) flushes a range of pages 32 * - flush_tlb_range(vma, start, end) flushes a range of pages
33 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages 33 * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
34 * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
35 * 34 *
36 * x86-64 can only flush individual pages or full VMs. For a range flush 35 * x86-64 can only flush individual pages or full VMs. For a range flush
37 * we always do the full VM. Might be worth trying if for a small 36 * we always do the full VM. Might be worth trying if for a small
@@ -98,12 +97,4 @@ static inline void flush_tlb_kernel_range(unsigned long start,
98 flush_tlb_all(); 97 flush_tlb_all();
99} 98}
100 99
101static inline void flush_tlb_pgtables(struct mm_struct *mm,
102 unsigned long start, unsigned long end)
103{
104 /* x86_64 does not keep any page table caches in a software TLB.
105 The CPUs do in their hardware TLBs, but they are handled
106 by the normal TLB flushing algorithms. */
107}
108
109#endif /* _X8664_TLBFLUSH_H */ 100#endif /* _X8664_TLBFLUSH_H */
diff --git a/include/asm-x86/topology_32.h b/include/asm-x86/topology_32.h
index ae1074603c4b..9040f5a61278 100644
--- a/include/asm-x86/topology_32.h
+++ b/include/asm-x86/topology_32.h
@@ -28,8 +28,8 @@
28#define _ASM_I386_TOPOLOGY_H 28#define _ASM_I386_TOPOLOGY_H
29 29
30#ifdef CONFIG_X86_HT 30#ifdef CONFIG_X86_HT
31#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) 31#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
32#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) 32#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
33#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) 33#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
34#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 34#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
35#endif 35#endif
diff --git a/include/asm-x86/topology_64.h b/include/asm-x86/topology_64.h
index 848c17f92226..a718dda037e0 100644
--- a/include/asm-x86/topology_64.h
+++ b/include/asm-x86/topology_64.h
@@ -5,7 +5,7 @@
5#ifdef CONFIG_NUMA 5#ifdef CONFIG_NUMA
6 6
7#include <asm/mpspec.h> 7#include <asm/mpspec.h>
8#include <asm/bitops.h> 8#include <linux/bitops.h>
9 9
10extern cpumask_t cpu_online_map; 10extern cpumask_t cpu_online_map;
11 11
@@ -56,8 +56,8 @@ extern int __node_distance(int, int);
56#endif 56#endif
57 57
58#ifdef CONFIG_SMP 58#ifdef CONFIG_SMP
59#define topology_physical_package_id(cpu) (cpu_data[cpu].phys_proc_id) 59#define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
60#define topology_core_id(cpu) (cpu_data[cpu].cpu_core_id) 60#define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
61#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu)) 61#define topology_core_siblings(cpu) (per_cpu(cpu_core_map, cpu))
62#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu)) 62#define topology_thread_siblings(cpu) (per_cpu(cpu_sibling_map, cpu))
63#define mc_capable() (boot_cpu_data.x86_max_cores > 1) 63#define mc_capable() (boot_cpu_data.x86_max_cores > 1)
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h
index 1c1e0d933eea..23261e8f2e5a 100644
--- a/include/asm-xtensa/bitops.h
+++ b/include/asm-xtensa/bitops.h
@@ -15,6 +15,10 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#ifndef _LINUX_BITOPS_H
19#error only <linux/bitops.h> can be included directly
20#endif
21
18#include <asm/processor.h> 22#include <asm/processor.h>
19#include <asm/byteorder.h> 23#include <asm/byteorder.h>
20#include <asm/system.h> 24#include <asm/system.h>
@@ -108,6 +112,7 @@ static inline int fls (unsigned int x)
108#endif 112#endif
109 113
110#include <asm-generic/bitops/hweight.h> 114#include <asm-generic/bitops/hweight.h>
115#include <asm-generic/bitops/lock.h>
111#include <asm-generic/bitops/sched.h> 116#include <asm-generic/bitops/sched.h>
112#include <asm-generic/bitops/minix.h> 117#include <asm-generic/bitops/minix.h>
113 118
diff --git a/include/asm-xtensa/tlbflush.h b/include/asm-xtensa/tlbflush.h
index 7c637b3c352c..46d240074f74 100644
--- a/include/asm-xtensa/tlbflush.h
+++ b/include/asm-xtensa/tlbflush.h
@@ -41,17 +41,6 @@ extern void flush_tlb_range(struct vm_area_struct*,unsigned long,unsigned long);
41 41
42#define flush_tlb_kernel_range(start,end) flush_tlb_all() 42#define flush_tlb_kernel_range(start,end) flush_tlb_all()
43 43
44
45/* This is calld in munmap when we have freed up some page-table pages.
46 * We don't need to do anything here, there's nothing special about our
47 * page-table pages.
48 */
49
50static inline void flush_tlb_pgtables(struct mm_struct *mm,
51 unsigned long start, unsigned long end)
52{
53}
54
55/* TLB operations. */ 44/* TLB operations. */
56 45
57static inline unsigned long itlb_probe(unsigned long addr) 46static inline unsigned long itlb_probe(unsigned long addr)
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 7ac8303c8471..e3ffd14a3f0b 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -47,6 +47,7 @@ header-y += coda_psdev.h
47header-y += coff.h 47header-y += coff.h
48header-y += comstats.h 48header-y += comstats.h
49header-y += const.h 49header-y += const.h
50header-y += cgroupstats.h
50header-y += cycx_cfm.h 51header-y += cycx_cfm.h
51header-y += dlm_device.h 52header-y += dlm_device.h
52header-y += dlm_netlink.h 53header-y += dlm_netlink.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index bf5e0009de75..8ccedf7a0a5a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -189,32 +189,6 @@ extern int ec_transaction(u8 command,
189extern int acpi_blacklisted(void); 189extern int acpi_blacklisted(void);
190extern void acpi_bios_year(char *s); 190extern void acpi_bios_year(char *s);
191 191
192#define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
193#ifdef CONFIG_ACPI
194
195/*
196 * Set highest legal C-state
197 * 0: C0 okay, but not C1
198 * 1: C1 okay, but not C2
199 * 2: C2 okay, but not C3 etc.
200 */
201
202extern unsigned int max_cstate;
203
204static inline unsigned int acpi_get_cstate_limit(void)
205{
206 return max_cstate;
207}
208static inline void acpi_set_cstate_limit(unsigned int new_limit)
209{
210 max_cstate = new_limit;
211 return;
212}
213#else
214static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
215static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
216#endif
217
218#ifdef CONFIG_ACPI_NUMA 192#ifdef CONFIG_ACPI_NUMA
219int acpi_get_pxm(acpi_handle handle); 193int acpi_get_pxm(acpi_handle handle);
220int acpi_get_node(acpi_handle *handle); 194int acpi_get_node(acpi_handle *handle);
diff --git a/include/linux/aio.h b/include/linux/aio.h
index d10e608f232d..7ef8de662001 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -232,18 +232,6 @@ int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
232 __put_ioctx(kioctx); \ 232 __put_ioctx(kioctx); \
233} while (0) 233} while (0)
234 234
235#define in_aio() (unlikely(!is_sync_wait(current->io_wait)))
236
237/* may be used for debugging */
238#define warn_if_async() \
239do { \
240 if (in_aio()) { \
241 printk(KERN_ERR "%s(%s:%d) called in async context!\n", \
242 __FUNCTION__, __FILE__, __LINE__); \
243 dump_stack(); \
244 } \
245} while (0)
246
247#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait) 235#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
248 236
249#include <linux/aio_abi.h> 237#include <linux/aio_abi.h>
diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
index 6b20af0bbb79..7113a32a86ea 100644
--- a/include/linux/bit_spinlock.h
+++ b/include/linux/bit_spinlock.h
@@ -18,7 +18,7 @@ static inline void bit_spin_lock(int bitnum, unsigned long *addr)
18 */ 18 */
19 preempt_disable(); 19 preempt_disable();
20#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 20#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
21 while (test_and_set_bit(bitnum, addr)) { 21 while (unlikely(test_and_set_bit_lock(bitnum, addr))) {
22 while (test_bit(bitnum, addr)) { 22 while (test_bit(bitnum, addr)) {
23 preempt_enable(); 23 preempt_enable();
24 cpu_relax(); 24 cpu_relax();
@@ -36,7 +36,7 @@ static inline int bit_spin_trylock(int bitnum, unsigned long *addr)
36{ 36{
37 preempt_disable(); 37 preempt_disable();
38#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 38#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
39 if (test_and_set_bit(bitnum, addr)) { 39 if (unlikely(test_and_set_bit_lock(bitnum, addr))) {
40 preempt_enable(); 40 preempt_enable();
41 return 0; 41 return 0;
42 } 42 }
@@ -50,10 +50,28 @@ static inline int bit_spin_trylock(int bitnum, unsigned long *addr)
50 */ 50 */
51static inline void bit_spin_unlock(int bitnum, unsigned long *addr) 51static inline void bit_spin_unlock(int bitnum, unsigned long *addr)
52{ 52{
53#ifdef CONFIG_DEBUG_SPINLOCK
54 BUG_ON(!test_bit(bitnum, addr));
55#endif
53#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) 56#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
57 clear_bit_unlock(bitnum, addr);
58#endif
59 preempt_enable();
60 __release(bitlock);
61}
62
63/*
64 * bit-based spin_unlock()
65 * non-atomic version, which can be used eg. if the bit lock itself is
66 * protecting the rest of the flags in the word.
67 */
68static inline void __bit_spin_unlock(int bitnum, unsigned long *addr)
69{
70#ifdef CONFIG_DEBUG_SPINLOCK
54 BUG_ON(!test_bit(bitnum, addr)); 71 BUG_ON(!test_bit(bitnum, addr));
55 smp_mb__before_clear_bit(); 72#endif
56 clear_bit(bitnum, addr); 73#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
74 __clear_bit_unlock(bitnum, addr);
57#endif 75#endif
58 preempt_enable(); 76 preempt_enable();
59 __release(bitlock); 77 __release(bitlock);
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 64b4641904fe..acad1105d942 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -6,6 +6,7 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/bitops.h> 7#include <linux/bitops.h>
8#include <linux/string.h> 8#include <linux/string.h>
9#include <linux/kernel.h>
9 10
10/* 11/*
11 * bitmaps provide bit arrays that consume one or more unsigned 12 * bitmaps provide bit arrays that consume one or more unsigned
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index b9fb8ee3308b..69c1edb9fe54 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -2,6 +2,14 @@
2#define _LINUX_BITOPS_H 2#define _LINUX_BITOPS_H
3#include <asm/types.h> 3#include <asm/types.h>
4 4
5#ifdef __KERNEL__
6#define BIT(nr) (1UL << (nr))
7#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
8#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
9#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
10#define BITS_PER_BYTE 8
11#endif
12
5/* 13/*
6 * Include this here because some architectures need generic_ffs/fls in 14 * Include this here because some architectures need generic_ffs/fls in
7 * scope 15 * scope
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 8961e7fb755c..7a8d7ade28a0 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -310,10 +310,6 @@ typedef __u32 kernel_cap_t;
310#define CAP_SETFCAP 31 310#define CAP_SETFCAP 31
311 311
312#ifdef __KERNEL__ 312#ifdef __KERNEL__
313/*
314 * Bounding set
315 */
316extern kernel_cap_t cap_bset;
317 313
318/* 314/*
319 * Internal kernel functions only 315 * Internal kernel functions only
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index 2b641b176e7f..c6d3e22c0624 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -2,7 +2,7 @@
2 * -- <linux/cdrom.h> 2 * -- <linux/cdrom.h>
3 * General header file for linux CD-ROM drivers 3 * General header file for linux CD-ROM drivers
4 * Copyright (C) 1992 David Giller, rafetmad@oxy.edu 4 * Copyright (C) 1992 David Giller, rafetmad@oxy.edu
5 * 1994, 1995 Eberhard Moenkeberg, emoenke@gwdg.de 5 * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de
6 * 1996 David van Leeuwen, david@tm.tno.nl 6 * 1996 David van Leeuwen, david@tm.tno.nl
7 * 1997, 1998 Erik Andersen, andersee@debian.org 7 * 1997, 1998 Erik Andersen, andersee@debian.org
8 * 1998-2002 Jens Axboe, axboe@suse.de 8 * 1998-2002 Jens Axboe, axboe@suse.de
@@ -76,7 +76,7 @@
76 (struct cdrom_multisession) */ 76 (struct cdrom_multisession) */
77#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code" 77#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
78 if available (struct cdrom_mcn) */ 78 if available (struct cdrom_mcn) */
79#define CDROM_GET_UPC CDROM_GET_MCN /* This one is depricated, 79#define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated,
80 but here anyway for compatibility */ 80 but here anyway for compatibility */
81#define CDROMRESET 0x5312 /* hard-reset the drive */ 81#define CDROMRESET 0x5312 /* hard-reset the drive */
82#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting 82#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting
@@ -506,7 +506,7 @@ struct cdrom_generic_command
506#define GPMODE_TO_PROTECT_PAGE 0x1d 506#define GPMODE_TO_PROTECT_PAGE 0x1d
507#define GPMODE_CAPABILITIES_PAGE 0x2a 507#define GPMODE_CAPABILITIES_PAGE 0x2a
508#define GPMODE_ALL_PAGES 0x3f 508#define GPMODE_ALL_PAGES 0x3f
509/* Not in Mt. Fuji, but in ATAPI 2.6 -- depricated now in favor 509/* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor
510 * of MODE_SENSE_POWER_PAGE */ 510 * of MODE_SENSE_POWER_PAGE */
511#define GPMODE_CDROM_PAGE 0x0d 511#define GPMODE_CDROM_PAGE 0x0d
512 512
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
new file mode 100644
index 000000000000..87479328d46d
--- /dev/null
+++ b/include/linux/cgroup.h
@@ -0,0 +1,327 @@
1#ifndef _LINUX_CGROUP_H
2#define _LINUX_CGROUP_H
3/*
4 * cgroup interface
5 *
6 * Copyright (C) 2003 BULL SA
7 * Copyright (C) 2004-2006 Silicon Graphics, Inc.
8 *
9 */
10
11#include <linux/sched.h>
12#include <linux/kref.h>
13#include <linux/cpumask.h>
14#include <linux/nodemask.h>
15#include <linux/rcupdate.h>
16#include <linux/cgroupstats.h>
17
18#ifdef CONFIG_CGROUPS
19
20struct cgroupfs_root;
21struct cgroup_subsys;
22struct inode;
23
24extern int cgroup_init_early(void);
25extern int cgroup_init(void);
26extern void cgroup_init_smp(void);
27extern void cgroup_lock(void);
28extern void cgroup_unlock(void);
29extern void cgroup_fork(struct task_struct *p);
30extern void cgroup_fork_callbacks(struct task_struct *p);
31extern void cgroup_post_fork(struct task_struct *p);
32extern void cgroup_exit(struct task_struct *p, int run_callbacks);
33extern int cgroupstats_build(struct cgroupstats *stats,
34 struct dentry *dentry);
35
36extern struct file_operations proc_cgroup_operations;
37
38/* Define the enumeration of all cgroup subsystems */
39#define SUBSYS(_x) _x ## _subsys_id,
40enum cgroup_subsys_id {
41#include <linux/cgroup_subsys.h>
42 CGROUP_SUBSYS_COUNT
43};
44#undef SUBSYS
45
46/* Per-subsystem/per-cgroup state maintained by the system. */
47struct cgroup_subsys_state {
48 /* The cgroup that this subsystem is attached to. Useful
49 * for subsystems that want to know about the cgroup
50 * hierarchy structure */
51 struct cgroup *cgroup;
52
53 /* State maintained by the cgroup system to allow
54 * subsystems to be "busy". Should be accessed via css_get()
55 * and css_put() */
56
57 atomic_t refcnt;
58
59 unsigned long flags;
60};
61
62/* bits in struct cgroup_subsys_state flags field */
63enum {
64 CSS_ROOT, /* This CSS is the root of the subsystem */
65};
66
67/*
68 * Call css_get() to hold a reference on the cgroup;
69 *
70 */
71
72static inline void css_get(struct cgroup_subsys_state *css)
73{
74 /* We don't need to reference count the root state */
75 if (!test_bit(CSS_ROOT, &css->flags))
76 atomic_inc(&css->refcnt);
77}
78/*
79 * css_put() should be called to release a reference taken by
80 * css_get()
81 */
82
83extern void __css_put(struct cgroup_subsys_state *css);
84static inline void css_put(struct cgroup_subsys_state *css)
85{
86 if (!test_bit(CSS_ROOT, &css->flags))
87 __css_put(css);
88}
89
90struct cgroup {
91 unsigned long flags; /* "unsigned long" so bitops work */
92
93 /* count users of this cgroup. >0 means busy, but doesn't
94 * necessarily indicate the number of tasks in the
95 * cgroup */
96 atomic_t count;
97
98 /*
99 * We link our 'sibling' struct into our parent's 'children'.
100 * Our children link their 'sibling' into our 'children'.
101 */
102 struct list_head sibling; /* my parent's children */
103 struct list_head children; /* my children */
104
105 struct cgroup *parent; /* my parent */
106 struct dentry *dentry; /* cgroup fs entry */
107
108 /* Private pointers for each registered subsystem */
109 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
110
111 struct cgroupfs_root *root;
112 struct cgroup *top_cgroup;
113
114 /*
115 * List of cg_cgroup_links pointing at css_sets with
116 * tasks in this cgroup. Protected by css_set_lock
117 */
118 struct list_head css_sets;
119
120 /*
121 * Linked list running through all cgroups that can
122 * potentially be reaped by the release agent. Protected by
123 * release_list_lock
124 */
125 struct list_head release_list;
126};
127
128/* A css_set is a structure holding pointers to a set of
129 * cgroup_subsys_state objects. This saves space in the task struct
130 * object and speeds up fork()/exit(), since a single inc/dec and a
131 * list_add()/del() can bump the reference count on the entire
132 * cgroup set for a task.
133 */
134
135struct css_set {
136
137 /* Reference count */
138 struct kref ref;
139
140 /*
141 * List running through all cgroup groups. Protected by
142 * css_set_lock
143 */
144 struct list_head list;
145
146 /*
147 * List running through all tasks using this cgroup
148 * group. Protected by css_set_lock
149 */
150 struct list_head tasks;
151
152 /*
153 * List of cg_cgroup_link objects on link chains from
154 * cgroups referenced from this css_set. Protected by
155 * css_set_lock
156 */
157 struct list_head cg_links;
158
159 /*
160 * Set of subsystem states, one for each subsystem. This array
161 * is immutable after creation apart from the init_css_set
162 * during subsystem registration (at boot time).
163 */
164 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
165
166};
167
168/* struct cftype:
169 *
170 * The files in the cgroup filesystem mostly have a very simple read/write
171 * handling, some common function will take care of it. Nevertheless some cases
172 * (read tasks) are special and therefore I define this structure for every
173 * kind of file.
174 *
175 *
176 * When reading/writing to a file:
177 * - the cgroup to use in file->f_dentry->d_parent->d_fsdata
178 * - the 'cftype' of the file is file->f_dentry->d_fsdata
179 */
180
181#define MAX_CFTYPE_NAME 64
182struct cftype {
183 /* By convention, the name should begin with the name of the
184 * subsystem, followed by a period */
185 char name[MAX_CFTYPE_NAME];
186 int private;
187 int (*open) (struct inode *inode, struct file *file);
188 ssize_t (*read) (struct cgroup *cont, struct cftype *cft,
189 struct file *file,
190 char __user *buf, size_t nbytes, loff_t *ppos);
191 /*
192 * read_uint() is a shortcut for the common case of returning a
193 * single integer. Use it in place of read()
194 */
195 u64 (*read_uint) (struct cgroup *cont, struct cftype *cft);
196 ssize_t (*write) (struct cgroup *cont, struct cftype *cft,
197 struct file *file,
198 const char __user *buf, size_t nbytes, loff_t *ppos);
199
200 /*
201 * write_uint() is a shortcut for the common case of accepting
202 * a single integer (as parsed by simple_strtoull) from
203 * userspace. Use in place of write(); return 0 or error.
204 */
205 int (*write_uint) (struct cgroup *cont, struct cftype *cft, u64 val);
206
207 int (*release) (struct inode *inode, struct file *file);
208};
209
210/* Add a new file to the given cgroup directory. Should only be
211 * called by subsystems from within a populate() method */
212int cgroup_add_file(struct cgroup *cont, struct cgroup_subsys *subsys,
213 const struct cftype *cft);
214
215/* Add a set of new files to the given cgroup directory. Should
216 * only be called by subsystems from within a populate() method */
217int cgroup_add_files(struct cgroup *cont,
218 struct cgroup_subsys *subsys,
219 const struct cftype cft[],
220 int count);
221
222int cgroup_is_removed(const struct cgroup *cont);
223
224int cgroup_path(const struct cgroup *cont, char *buf, int buflen);
225
226int cgroup_task_count(const struct cgroup *cont);
227
228/* Return true if the cgroup is a descendant of the current cgroup */
229int cgroup_is_descendant(const struct cgroup *cont);
230
231/* Control Group subsystem type. See Documentation/cgroups.txt for details */
232
233struct cgroup_subsys {
234 struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss,
235 struct cgroup *cont);
236 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont);
237 int (*can_attach)(struct cgroup_subsys *ss,
238 struct cgroup *cont, struct task_struct *tsk);
239 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cont,
240 struct cgroup *old_cont, struct task_struct *tsk);
241 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
242 void (*exit)(struct cgroup_subsys *ss, struct task_struct *task);
243 int (*populate)(struct cgroup_subsys *ss,
244 struct cgroup *cont);
245 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cont);
246 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
247 int subsys_id;
248 int active;
249 int early_init;
250#define MAX_CGROUP_TYPE_NAMELEN 32
251 const char *name;
252
253 /* Protected by RCU */
254 struct cgroupfs_root *root;
255
256 struct list_head sibling;
257
258 void *private;
259};
260
261#define SUBSYS(_x) extern struct cgroup_subsys _x ## _subsys;
262#include <linux/cgroup_subsys.h>
263#undef SUBSYS
264
265static inline struct cgroup_subsys_state *cgroup_subsys_state(
266 struct cgroup *cont, int subsys_id)
267{
268 return cont->subsys[subsys_id];
269}
270
271static inline struct cgroup_subsys_state *task_subsys_state(
272 struct task_struct *task, int subsys_id)
273{
274 return rcu_dereference(task->cgroups->subsys[subsys_id]);
275}
276
277static inline struct cgroup* task_cgroup(struct task_struct *task,
278 int subsys_id)
279{
280 return task_subsys_state(task, subsys_id)->cgroup;
281}
282
283int cgroup_path(const struct cgroup *cont, char *buf, int buflen);
284
285int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss);
286
287/* A cgroup_iter should be treated as an opaque object */
288struct cgroup_iter {
289 struct list_head *cg_link;
290 struct list_head *task;
291};
292
293/* To iterate across the tasks in a cgroup:
294 *
295 * 1) call cgroup_iter_start to intialize an iterator
296 *
297 * 2) call cgroup_iter_next() to retrieve member tasks until it
298 * returns NULL or until you want to end the iteration
299 *
300 * 3) call cgroup_iter_end() to destroy the iterator.
301 */
302void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it);
303struct task_struct *cgroup_iter_next(struct cgroup *cont,
304 struct cgroup_iter *it);
305void cgroup_iter_end(struct cgroup *cont, struct cgroup_iter *it);
306
307#else /* !CONFIG_CGROUPS */
308
309static inline int cgroup_init_early(void) { return 0; }
310static inline int cgroup_init(void) { return 0; }
311static inline void cgroup_init_smp(void) {}
312static inline void cgroup_fork(struct task_struct *p) {}
313static inline void cgroup_fork_callbacks(struct task_struct *p) {}
314static inline void cgroup_post_fork(struct task_struct *p) {}
315static inline void cgroup_exit(struct task_struct *p, int callbacks) {}
316
317static inline void cgroup_lock(void) {}
318static inline void cgroup_unlock(void) {}
319static inline int cgroupstats_build(struct cgroupstats *stats,
320 struct dentry *dentry)
321{
322 return -EINVAL;
323}
324
325#endif /* !CONFIG_CGROUPS */
326
327#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
new file mode 100644
index 000000000000..0b9bfbde8168
--- /dev/null
+++ b/include/linux/cgroup_subsys.h
@@ -0,0 +1,38 @@
1/* Add subsystem definitions of the form SUBSYS(<name>) in this
2 * file. Surround each one by a line of comment markers so that
3 * patches don't collide
4 */
5
6/* */
7
8/* */
9
10#ifdef CONFIG_CPUSETS
11SUBSYS(cpuset)
12#endif
13
14/* */
15
16#ifdef CONFIG_CGROUP_CPUACCT
17SUBSYS(cpuacct)
18#endif
19
20/* */
21
22#ifdef CONFIG_CGROUP_DEBUG
23SUBSYS(debug)
24#endif
25
26/* */
27
28#ifdef CONFIG_CGROUP_NS
29SUBSYS(ns)
30#endif
31
32/* */
33
34#ifdef CONFIG_FAIR_CGROUP_SCHED
35SUBSYS(cpu_cgroup)
36#endif
37
38/* */
diff --git a/include/linux/cgroupstats.h b/include/linux/cgroupstats.h
new file mode 100644
index 000000000000..4f53abf6855d
--- /dev/null
+++ b/include/linux/cgroupstats.h
@@ -0,0 +1,70 @@
1/* cgroupstats.h - exporting per-cgroup statistics
2 *
3 * Copyright IBM Corporation, 2007
4 * Author Balbir Singh <balbir@linux.vnet.ibm.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it would be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 */
14
15#ifndef _LINUX_CGROUPSTATS_H
16#define _LINUX_CGROUPSTATS_H
17
18#include <linux/taskstats.h>
19
20/*
21 * Data shared between user space and kernel space on a per cgroup
22 * basis. This data is shared using taskstats.
23 *
24 * Most of these states are derived by looking at the task->state value
25 * For the nr_io_wait state, a flag in the delay accounting structure
26 * indicates that the task is waiting on IO
27 *
28 * Each member is aligned to a 8 byte boundary.
29 */
30struct cgroupstats {
31 __u64 nr_sleeping; /* Number of tasks sleeping */
32 __u64 nr_running; /* Number of tasks running */
33 __u64 nr_stopped; /* Number of tasks in stopped state */
34 __u64 nr_uninterruptible; /* Number of tasks in uninterruptible */
35 /* state */
36 __u64 nr_io_wait; /* Number of tasks waiting on IO */
37};
38
39/*
40 * Commands sent from userspace
41 * Not versioned. New commands should only be inserted at the enum's end
42 * prior to __CGROUPSTATS_CMD_MAX
43 */
44
45enum {
46 CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX, /* Reserved */
47 CGROUPSTATS_CMD_GET, /* user->kernel request/get-response */
48 CGROUPSTATS_CMD_NEW, /* kernel->user event */
49 __CGROUPSTATS_CMD_MAX,
50};
51
52#define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1)
53
54enum {
55 CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */
56 CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */
57 __CGROUPSTATS_TYPE_MAX,
58};
59
60#define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1)
61
62enum {
63 CGROUPSTATS_CMD_ATTR_UNSPEC = 0,
64 CGROUPSTATS_CMD_ATTR_FD,
65 __CGROUPSTATS_CMD_ATTR_MAX,
66};
67
68#define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1)
69
70#endif /* _LINUX_CGROUPSTATS_H */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 16ea3374dddf..107787aacb64 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -221,10 +221,15 @@ extern void clocksource_resume(void);
221 221
222#ifdef CONFIG_GENERIC_TIME_VSYSCALL 222#ifdef CONFIG_GENERIC_TIME_VSYSCALL
223extern void update_vsyscall(struct timespec *ts, struct clocksource *c); 223extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
224extern void update_vsyscall_tz(void);
224#else 225#else
225static inline void update_vsyscall(struct timespec *ts, struct clocksource *c) 226static inline void update_vsyscall(struct timespec *ts, struct clocksource *c)
226{ 227{
227} 228}
229
230static inline void update_vsyscall_tz(void)
231{
232}
228#endif 233#endif
229 234
230#endif /* _LINUX_CLOCKSOURCE_H */ 235#endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index acd583384bd9..fe23792f05c1 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -36,10 +36,20 @@
36#define __weak __attribute__((weak)) 36#define __weak __attribute__((weak))
37#define __naked __attribute__((naked)) 37#define __naked __attribute__((naked))
38#define __noreturn __attribute__((noreturn)) 38#define __noreturn __attribute__((noreturn))
39
40/*
41 * From the GCC manual:
42 *
43 * Many functions have no effects except the return value and their
44 * return value depends only on the parameters and/or global
45 * variables. Such a function can be subject to common subexpression
46 * elimination and loop optimization just as an arithmetic operator
47 * would be.
48 * [...]
49 */
39#define __pure __attribute__((pure)) 50#define __pure __attribute__((pure))
40#define __aligned(x) __attribute__((aligned(x))) 51#define __aligned(x) __attribute__((aligned(x)))
41#define __printf(a,b) __attribute__((format(printf,a,b))) 52#define __printf(a,b) __attribute__((format(printf,a,b)))
42#define noinline __attribute__((noinline)) 53#define noinline __attribute__((noinline))
43#define __attribute_pure__ __attribute__((pure))
44#define __attribute_const__ __attribute__((__const__)) 54#define __attribute_const__ __attribute__((__const__))
45#define __maybe_unused __attribute__((unused)) 55#define __maybe_unused __attribute__((unused))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 86f9a3a6137d..c811c8b979ac 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -132,20 +132,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
132# define __maybe_unused /* unimplemented */ 132# define __maybe_unused /* unimplemented */
133#endif 133#endif
134 134
135/*
136 * From the GCC manual:
137 *
138 * Many functions have no effects except the return value and their
139 * return value depends only on the parameters and/or global
140 * variables. Such a function can be subject to common subexpression
141 * elimination and loop optimization just as an arithmetic operator
142 * would be.
143 * [...]
144 */
145#ifndef __attribute_pure__
146# define __attribute_pure__ /* unimplemented */
147#endif
148
149#ifndef noinline 135#ifndef noinline
150#define noinline 136#define noinline
151#endif 137#endif
diff --git a/include/linux/console.h b/include/linux/console.h
index 0a4542ddb73d..a5f88a6a259d 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -122,14 +122,11 @@ extern void console_stop(struct console *);
122extern void console_start(struct console *); 122extern void console_start(struct console *);
123extern int is_console_locked(void); 123extern int is_console_locked(void);
124 124
125#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND 125extern int console_suspend_enabled;
126
126/* Suspend and resume console messages over PM events */ 127/* Suspend and resume console messages over PM events */
127extern void suspend_console(void); 128extern void suspend_console(void);
128extern void resume_console(void); 129extern void resume_console(void);
129#else
130static inline void suspend_console(void) {}
131static inline void resume_console(void) {}
132#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
133 130
134int mda_console_init(void); 131int mda_console_init(void);
135void prom_con_init(void); 132void prom_con_init(void);
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 0ad72c4cf312..b79c57569367 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -119,8 +119,9 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
119#define lock_cpu_hotplug() do { } while (0) 119#define lock_cpu_hotplug() do { } while (0)
120#define unlock_cpu_hotplug() do { } while (0) 120#define unlock_cpu_hotplug() do { } while (0)
121#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 121#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
122#define register_hotcpu_notifier(nb) do { (void)(nb); } while (0) 122/* These aren't inline functions due to a GCC bug. */
123#define unregister_hotcpu_notifier(nb) do { (void)(nb); } while (0) 123#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
124#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
124 125
125/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */ 126/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
126static inline int cpu_is_offline(int cpu) { return 0; } 127static inline int cpu_is_offline(int cpu) { return 0; }
diff --git a/include/linux/cpu_acct.h b/include/linux/cpu_acct.h
new file mode 100644
index 000000000000..6b5fd8a66c8d
--- /dev/null
+++ b/include/linux/cpu_acct.h
@@ -0,0 +1,14 @@
1
2#ifndef _LINUX_CPU_ACCT_H
3#define _LINUX_CPU_ACCT_H
4
5#include <linux/cgroup.h>
6#include <asm/cputime.h>
7
8#ifdef CONFIG_CGROUP_CPUACCT
9extern void cpuacct_charge(struct task_struct *, cputime_t cputime);
10#else
11static void inline cpuacct_charge(struct task_struct *p, cputime_t cputime) {}
12#endif
13
14#endif
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
new file mode 100644
index 000000000000..16a51546db44
--- /dev/null
+++ b/include/linux/cpuidle.h
@@ -0,0 +1,180 @@
1/*
2 * cpuidle.h - a generic framework for CPU idle power management
3 *
4 * (C) 2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
5 * Shaohua Li <shaohua.li@intel.com>
6 * Adam Belay <abelay@novell.com>
7 *
8 * This code is licenced under the GPL.
9 */
10
11#ifndef _LINUX_CPUIDLE_H
12#define _LINUX_CPUIDLE_H
13
14#include <linux/percpu.h>
15#include <linux/list.h>
16#include <linux/module.h>
17#include <linux/kobject.h>
18#include <linux/completion.h>
19
20#define CPUIDLE_STATE_MAX 8
21#define CPUIDLE_NAME_LEN 16
22
23struct cpuidle_device;
24
25
26/****************************
27 * CPUIDLE DEVICE INTERFACE *
28 ****************************/
29
30struct cpuidle_state {
31 char name[CPUIDLE_NAME_LEN];
32 void *driver_data;
33
34 unsigned int flags;
35 unsigned int exit_latency; /* in US */
36 unsigned int power_usage; /* in mW */
37 unsigned int target_residency; /* in US */
38
39 unsigned int usage;
40 unsigned int time; /* in US */
41
42 int (*enter) (struct cpuidle_device *dev,
43 struct cpuidle_state *state);
44};
45
46/* Idle State Flags */
47#define CPUIDLE_FLAG_TIME_VALID (0x01) /* is residency time measurable? */
48#define CPUIDLE_FLAG_CHECK_BM (0x02) /* BM activity will exit state */
49#define CPUIDLE_FLAG_SHALLOW (0x10) /* low latency, minimal savings */
50#define CPUIDLE_FLAG_BALANCED (0x20) /* medium latency, moderate savings */
51#define CPUIDLE_FLAG_DEEP (0x40) /* high latency, large savings */
52
53#define CPUIDLE_DRIVER_FLAGS_MASK (0xFFFF0000)
54
55/**
56 * cpuidle_get_statedata - retrieves private driver state data
57 * @state: the state
58 */
59static inline void * cpuidle_get_statedata(struct cpuidle_state *state)
60{
61 return state->driver_data;
62}
63
64/**
65 * cpuidle_set_statedata - stores private driver state data
66 * @state: the state
67 * @data: the private data
68 */
69static inline void
70cpuidle_set_statedata(struct cpuidle_state *state, void *data)
71{
72 state->driver_data = data;
73}
74
75struct cpuidle_state_kobj {
76 struct cpuidle_state *state;
77 struct completion kobj_unregister;
78 struct kobject kobj;
79};
80
81struct cpuidle_device {
82 int enabled:1;
83 unsigned int cpu;
84
85 int last_residency;
86 int state_count;
87 struct cpuidle_state states[CPUIDLE_STATE_MAX];
88 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
89 struct cpuidle_state *last_state;
90
91 struct list_head device_list;
92 struct kobject kobj;
93 struct completion kobj_unregister;
94 void *governor_data;
95};
96
97DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
98
99/**
100 * cpuidle_get_last_residency - retrieves the last state's residency time
101 * @dev: the target CPU
102 *
103 * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_VALID isn't set
104 */
105static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
106{
107 return dev->last_residency;
108}
109
110
111/****************************
112 * CPUIDLE DRIVER INTERFACE *
113 ****************************/
114
115struct cpuidle_driver {
116 char name[CPUIDLE_NAME_LEN];
117 struct module *owner;
118};
119
120#ifdef CONFIG_CPU_IDLE
121
122extern int cpuidle_register_driver(struct cpuidle_driver *drv);
123extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
124extern int cpuidle_register_device(struct cpuidle_device *dev);
125extern void cpuidle_unregister_device(struct cpuidle_device *dev);
126
127extern void cpuidle_pause_and_lock(void);
128extern void cpuidle_resume_and_unlock(void);
129extern int cpuidle_enable_device(struct cpuidle_device *dev);
130extern void cpuidle_disable_device(struct cpuidle_device *dev);
131
132#else
133
134static inline int cpuidle_register_driver(struct cpuidle_driver *drv)
135{return 0;}
136static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }
137static inline int cpuidle_register_device(struct cpuidle_device *dev)
138{return 0;}
139static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { }
140
141static inline void cpuidle_pause_and_lock(void) { }
142static inline void cpuidle_resume_and_unlock(void) { }
143static inline int cpuidle_enable_device(struct cpuidle_device *dev)
144{return 0;}
145static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
146
147#endif
148
149/******************************
150 * CPUIDLE GOVERNOR INTERFACE *
151 ******************************/
152
153struct cpuidle_governor {
154 char name[CPUIDLE_NAME_LEN];
155 struct list_head governor_list;
156 unsigned int rating;
157
158 int (*enable) (struct cpuidle_device *dev);
159 void (*disable) (struct cpuidle_device *dev);
160
161 int (*select) (struct cpuidle_device *dev);
162 void (*reflect) (struct cpuidle_device *dev);
163
164 struct module *owner;
165};
166
167#ifdef CONFIG_CPU_IDLE
168
169extern int cpuidle_register_governor(struct cpuidle_governor *gov);
170extern void cpuidle_unregister_governor(struct cpuidle_governor *gov);
171
172#else
173
174static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
175{return 0;}
176static inline void cpuidle_unregister_governor(struct cpuidle_governor *gov) { }
177
178#endif
179
180#endif /* _LINUX_CPUIDLE_H */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index ea44d2e768a0..ecae585ec3da 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -11,6 +11,7 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/nodemask.h> 13#include <linux/nodemask.h>
14#include <linux/cgroup.h>
14 15
15#ifdef CONFIG_CPUSETS 16#ifdef CONFIG_CPUSETS
16 17
@@ -19,9 +20,8 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
19extern int cpuset_init_early(void); 20extern int cpuset_init_early(void);
20extern int cpuset_init(void); 21extern int cpuset_init(void);
21extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
22extern void cpuset_fork(struct task_struct *p);
23extern void cpuset_exit(struct task_struct *p);
24extern cpumask_t cpuset_cpus_allowed(struct task_struct *p); 23extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
24extern cpumask_t cpuset_cpus_allowed_locked(struct task_struct *p);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 25extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed) 26#define cpuset_current_mems_allowed (current->mems_allowed)
27void cpuset_init_current_mems_allowed(void); 27void cpuset_init_current_mems_allowed(void);
@@ -76,18 +76,22 @@ static inline int cpuset_do_slab_mem_spread(void)
76 76
77extern void cpuset_track_online_nodes(void); 77extern void cpuset_track_online_nodes(void);
78 78
79extern int current_cpuset_is_being_rebound(void);
80
79#else /* !CONFIG_CPUSETS */ 81#else /* !CONFIG_CPUSETS */
80 82
81static inline int cpuset_init_early(void) { return 0; } 83static inline int cpuset_init_early(void) { return 0; }
82static inline int cpuset_init(void) { return 0; } 84static inline int cpuset_init(void) { return 0; }
83static inline void cpuset_init_smp(void) {} 85static inline void cpuset_init_smp(void) {}
84static inline void cpuset_fork(struct task_struct *p) {}
85static inline void cpuset_exit(struct task_struct *p) {}
86 86
87static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p) 87static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
88{ 88{
89 return cpu_possible_map; 89 return cpu_possible_map;
90} 90}
91static inline cpumask_t cpuset_cpus_allowed_locked(struct task_struct *p)
92{
93 return cpu_possible_map;
94}
91 95
92static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) 96static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
93{ 97{
@@ -148,6 +152,11 @@ static inline int cpuset_do_slab_mem_spread(void)
148 152
149static inline void cpuset_track_online_nodes(void) {} 153static inline void cpuset_track_online_nodes(void) {}
150 154
155static inline int current_cpuset_is_being_rebound(void)
156{
157 return 0;
158}
159
151#endif /* !CONFIG_CPUSETS */ 160#endif /* !CONFIG_CPUSETS */
152 161
153#endif /* _LINUX_CPUSET_H */ 162#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index fc32694287e2..f3110ebe894a 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -6,7 +6,7 @@
6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au> 6 * Copyright (c) 2005 Herbert Xu <herbert@gondor.apana.org.au>
7 * 7 *
8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no> 8 * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>
9 * and Nettle, by Niels Möller. 9 * and Nettle, by Niels Möller.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the Free 12 * under the terms of the GNU General Public License as published by the Free
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 72aa00cc4b2d..8f3dcd30828f 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -512,11 +512,11 @@ struct cyclades_card {
512 void __iomem *base_addr; 512 void __iomem *base_addr;
513 void __iomem *ctl_addr; 513 void __iomem *ctl_addr;
514 int irq; 514 int irq;
515 int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ 515 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
516 int first_line; /* minor number of first channel on card */ 516 unsigned int first_line; /* minor number of first channel on card */
517 int nports; /* Number of ports in the card */ 517 unsigned int nports; /* Number of ports in the card */
518 int bus_index; /* address shift - 0 for ISA, 1 for PCI */ 518 int bus_index; /* address shift - 0 for ISA, 1 for PCI */
519 int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */ 519 int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */
520 spinlock_t card_lock; 520 spinlock_t card_lock;
521 struct cyclades_port *ports; 521 struct cyclades_port *ports;
522}; 522};
@@ -566,10 +566,9 @@ struct cyclades_port {
566 int rtsdtr_inv; 566 int rtsdtr_inv;
567 int chip_rev; 567 int chip_rev;
568 int custom_divisor; 568 int custom_divisor;
569 int x_char; /* to be pushed out ASAP */ 569 u8 x_char; /* to be pushed out ASAP */
570 int close_delay; 570 int close_delay;
571 unsigned short closing_wait; 571 unsigned short closing_wait;
572 unsigned long event;
573 int count; /* # of fd on device */ 572 int count; /* # of fd on device */
574 int breakon; 573 int breakon;
575 int breakoff; 574 int breakoff;
@@ -584,7 +583,6 @@ struct cyclades_port {
584 struct cyclades_monitor mon; 583 struct cyclades_monitor mon;
585 struct cyclades_idle_stats idle_stats; 584 struct cyclades_idle_stats idle_stats;
586 struct cyclades_icount icount; 585 struct cyclades_icount icount;
587 struct work_struct tqueue;
588 wait_queue_head_t open_wait; 586 wait_queue_head_t open_wait;
589 wait_queue_head_t close_wait; 587 wait_queue_head_t close_wait;
590 struct completion shutdown_wait; 588 struct completion shutdown_wait;
@@ -592,19 +590,6 @@ struct cyclades_port {
592 int throttle; 590 int throttle;
593}; 591};
594 592
595/*
596 * Events are used to schedule things to happen at timer-interrupt
597 * time, instead of at cy interrupt time.
598 */
599#define Cy_EVENT_READ_PROCESS 0
600#define Cy_EVENT_WRITE_WAKEUP 1
601#define Cy_EVENT_HANGUP 2
602#define Cy_EVENT_BREAK 3
603#define Cy_EVENT_OPEN_WAKEUP 4
604#define Cy_EVENT_SHUTDOWN_WAKEUP 5
605#define Cy_EVENT_DELTA_WAKEUP 6
606#define Cy_EVENT_Z_RX_FULL 7
607
608#define CLOSING_WAIT_DELAY 30*HZ 593#define CLOSING_WAIT_DELAY 30*HZ
609#define CY_CLOSING_WAIT_NONE 65535 594#define CY_CLOSING_WAIT_NONE 65535
610#define CY_CLOSING_WAIT_INF 0 595#define CY_CLOSING_WAIT_INF 0
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index 55d1ca5e60f5..ab94bc083558 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -26,6 +26,7 @@
26 * Used to set current->delays->flags 26 * Used to set current->delays->flags
27 */ 27 */
28#define DELAYACCT_PF_SWAPIN 0x00000001 /* I am doing a swapin */ 28#define DELAYACCT_PF_SWAPIN 0x00000001 /* I am doing a swapin */
29#define DELAYACCT_PF_BLKIO 0x00000002 /* I am waiting on IO */
29 30
30#ifdef CONFIG_TASK_DELAY_ACCT 31#ifdef CONFIG_TASK_DELAY_ACCT
31 32
@@ -39,6 +40,14 @@ extern void __delayacct_blkio_end(void);
39extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *); 40extern int __delayacct_add_tsk(struct taskstats *, struct task_struct *);
40extern __u64 __delayacct_blkio_ticks(struct task_struct *); 41extern __u64 __delayacct_blkio_ticks(struct task_struct *);
41 42
43static inline int delayacct_is_task_waiting_on_io(struct task_struct *p)
44{
45 if (p->delays)
46 return (p->delays->flags & DELAYACCT_PF_BLKIO);
47 else
48 return 0;
49}
50
42static inline void delayacct_set_flag(int flag) 51static inline void delayacct_set_flag(int flag)
43{ 52{
44 if (current->delays) 53 if (current->delays)
@@ -71,6 +80,7 @@ static inline void delayacct_tsk_free(struct task_struct *tsk)
71 80
72static inline void delayacct_blkio_start(void) 81static inline void delayacct_blkio_start(void)
73{ 82{
83 delayacct_set_flag(DELAYACCT_PF_BLKIO);
74 if (current->delays) 84 if (current->delays)
75 __delayacct_blkio_start(); 85 __delayacct_blkio_start();
76} 86}
@@ -79,6 +89,7 @@ static inline void delayacct_blkio_end(void)
79{ 89{
80 if (current->delays) 90 if (current->delays)
81 __delayacct_blkio_end(); 91 __delayacct_blkio_end();
92 delayacct_clear_flag(DELAYACCT_PF_BLKIO);
82} 93}
83 94
84static inline int delayacct_add_tsk(struct taskstats *d, 95static inline int delayacct_add_tsk(struct taskstats *d,
@@ -116,6 +127,8 @@ static inline int delayacct_add_tsk(struct taskstats *d,
116{ return 0; } 127{ return 0; }
117static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk) 128static inline __u64 delayacct_blkio_ticks(struct task_struct *tsk)
118{ return 0; } 129{ return 0; }
130static inline int delayacct_is_task_waiting_on_io(struct task_struct *p)
131{ return 0; }
119#endif /* CONFIG_TASK_DELAY_ACCT */ 132#endif /* CONFIG_TASK_DELAY_ACCT */
120 133
121#endif 134#endif
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 499f5373e213..37c66d1254b5 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -183,11 +183,14 @@ int dm_resume(struct mapped_device *md);
183 */ 183 */
184uint32_t dm_get_event_nr(struct mapped_device *md); 184uint32_t dm_get_event_nr(struct mapped_device *md);
185int dm_wait_event(struct mapped_device *md, int event_nr); 185int dm_wait_event(struct mapped_device *md, int event_nr);
186uint32_t dm_next_uevent_seq(struct mapped_device *md);
187void dm_uevent_add(struct mapped_device *md, struct list_head *elist);
186 188
187/* 189/*
188 * Info functions. 190 * Info functions.
189 */ 191 */
190const char *dm_device_name(struct mapped_device *md); 192const char *dm_device_name(struct mapped_device *md);
193int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
191struct gendisk *dm_disk(struct mapped_device *md); 194struct gendisk *dm_disk(struct mapped_device *md);
192int dm_suspended(struct mapped_device *md); 195int dm_suspended(struct mapped_device *md);
193int dm_noflush_suspending(struct dm_target *ti); 196int dm_noflush_suspending(struct dm_target *ti);
diff --git a/include/linux/dm-ioctl.h b/include/linux/dm-ioctl.h
index b93486107821..523281c5b7f5 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/linux/dm-ioctl.h
@@ -131,6 +131,7 @@ struct dm_ioctl {
131 char name[DM_NAME_LEN]; /* device name */ 131 char name[DM_NAME_LEN]; /* device name */
132 char uuid[DM_UUID_LEN]; /* unique identifier for 132 char uuid[DM_UUID_LEN]; /* unique identifier for
133 * the block device */ 133 * the block device */
134 char data[7]; /* padding or data */
134}; 135};
135 136
136/* 137/*
@@ -285,9 +286,9 @@ typedef char ioctl_struct[308];
285#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 286#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
286 287
287#define DM_VERSION_MAJOR 4 288#define DM_VERSION_MAJOR 4
288#define DM_VERSION_MINOR 11 289#define DM_VERSION_MINOR 12
289#define DM_VERSION_PATCHLEVEL 0 290#define DM_VERSION_PATCHLEVEL 0
290#define DM_VERSION_EXTRA "-ioctl (2006-10-12)" 291#define DM_VERSION_EXTRA "-ioctl (2007-10-02)"
291 292
292/* Status bits */ 293/* Status bits */
293#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 294#define DM_READONLY_FLAG (1 << 0) /* In/Out */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 0ebfafbd338c..101a2d4636be 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -13,16 +13,26 @@ enum dma_data_direction {
13 DMA_NONE = 3, 13 DMA_NONE = 3,
14}; 14};
15 15
16#define DMA_64BIT_MASK 0xffffffffffffffffULL 16#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
17#define DMA_48BIT_MASK 0x0000ffffffffffffULL 17
18#define DMA_40BIT_MASK 0x000000ffffffffffULL 18/*
19#define DMA_39BIT_MASK 0x0000007fffffffffULL 19 * NOTE: do not use the below macros in new code and do not add new definitions
20#define DMA_32BIT_MASK 0x00000000ffffffffULL 20 * here.
21#define DMA_31BIT_MASK 0x000000007fffffffULL 21 *
22#define DMA_30BIT_MASK 0x000000003fffffffULL 22 * Instead, just open-code DMA_BIT_MASK(n) within your driver
23#define DMA_29BIT_MASK 0x000000001fffffffULL 23 */
24#define DMA_28BIT_MASK 0x000000000fffffffULL 24#define DMA_64BIT_MASK DMA_BIT_MASK(64)
25#define DMA_24BIT_MASK 0x0000000000ffffffULL 25#define DMA_48BIT_MASK DMA_BIT_MASK(48)
26#define DMA_47BIT_MASK DMA_BIT_MASK(47)
27#define DMA_40BIT_MASK DMA_BIT_MASK(40)
28#define DMA_39BIT_MASK DMA_BIT_MASK(39)
29#define DMA_35BIT_MASK DMA_BIT_MASK(35)
30#define DMA_32BIT_MASK DMA_BIT_MASK(32)
31#define DMA_31BIT_MASK DMA_BIT_MASK(31)
32#define DMA_30BIT_MASK DMA_BIT_MASK(30)
33#define DMA_29BIT_MASK DMA_BIT_MASK(29)
34#define DMA_28BIT_MASK DMA_BIT_MASK(28)
35#define DMA_24BIT_MASK DMA_BIT_MASK(24)
26 36
27#define DMA_MASK_NONE 0x0ULL 37#define DMA_MASK_NONE 0x0ULL
28 38
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 589b0b355d84..64134456ed8c 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -72,8 +72,8 @@
72 * Macro-instructions used to manage several block sizes 72 * Macro-instructions used to manage several block sizes
73 */ 73 */
74#define EXT3_MIN_BLOCK_SIZE 1024 74#define EXT3_MIN_BLOCK_SIZE 1024
75#define EXT3_MAX_BLOCK_SIZE 4096 75#define EXT3_MAX_BLOCK_SIZE 65536
76#define EXT3_MIN_BLOCK_LOG_SIZE 10 76#define EXT3_MIN_BLOCK_LOG_SIZE 10
77#ifdef __KERNEL__ 77#ifdef __KERNEL__
78# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize) 78# define EXT3_BLOCK_SIZE(s) ((s)->s_blocksize)
79#else 79#else
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index cdee7aaa57aa..97dd409d5f4a 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -36,10 +36,6 @@
36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */ 36/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
37#define EXT4_MAX_RESERVE_BLOCKS 1027 37#define EXT4_MAX_RESERVE_BLOCKS 1027
38#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0 38#define EXT4_RESERVE_WINDOW_NOT_ALLOCATED 0
39/*
40 * Always enable hashed directories
41 */
42#define CONFIG_EXT4_INDEX
43 39
44/* 40/*
45 * Debug code 41 * Debug code
@@ -105,37 +101,29 @@
105#define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits))) 101#define EXT4_BLOCK_ALIGN(size, blkbits) ALIGN((size), (1 << (blkbits)))
106 102
107/* 103/*
108 * Macro-instructions used to manage fragments
109 */
110#define EXT4_MIN_FRAG_SIZE 1024
111#define EXT4_MAX_FRAG_SIZE 4096
112#define EXT4_MIN_FRAG_LOG_SIZE 10
113#ifdef __KERNEL__
114# define EXT4_FRAG_SIZE(s) (EXT4_SB(s)->s_frag_size)
115# define EXT4_FRAGS_PER_BLOCK(s) (EXT4_SB(s)->s_frags_per_block)
116#else
117# define EXT4_FRAG_SIZE(s) (EXT4_MIN_FRAG_SIZE << (s)->s_log_frag_size)
118# define EXT4_FRAGS_PER_BLOCK(s) (EXT4_BLOCK_SIZE(s) / EXT4_FRAG_SIZE(s))
119#endif
120
121/*
122 * Structure of a blocks group descriptor 104 * Structure of a blocks group descriptor
123 */ 105 */
124struct ext4_group_desc 106struct ext4_group_desc
125{ 107{
126 __le32 bg_block_bitmap; /* Blocks bitmap block */ 108 __le32 bg_block_bitmap_lo; /* Blocks bitmap block */
127 __le32 bg_inode_bitmap; /* Inodes bitmap block */ 109 __le32 bg_inode_bitmap_lo; /* Inodes bitmap block */
128 __le32 bg_inode_table; /* Inodes table block */ 110 __le32 bg_inode_table_lo; /* Inodes table block */
129 __le16 bg_free_blocks_count; /* Free blocks count */ 111 __le16 bg_free_blocks_count; /* Free blocks count */
130 __le16 bg_free_inodes_count; /* Free inodes count */ 112 __le16 bg_free_inodes_count; /* Free inodes count */
131 __le16 bg_used_dirs_count; /* Directories count */ 113 __le16 bg_used_dirs_count; /* Directories count */
132 __u16 bg_flags; 114 __le16 bg_flags; /* EXT4_BG_flags (INODE_UNINIT, etc) */
133 __u32 bg_reserved[3]; 115 __u32 bg_reserved[2]; /* Likely block/inode bitmap checksum */
116 __le16 bg_itable_unused; /* Unused inodes count */
117 __le16 bg_checksum; /* crc16(sb_uuid+group+desc) */
134 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ 118 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
135 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ 119 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
136 __le32 bg_inode_table_hi; /* Inodes table block MSB */ 120 __le32 bg_inode_table_hi; /* Inodes table block MSB */
137}; 121};
138 122
123#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
124#define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */
125#define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */
126
139#ifdef __KERNEL__ 127#ifdef __KERNEL__
140#include <linux/ext4_fs_i.h> 128#include <linux/ext4_fs_i.h>
141#include <linux/ext4_fs_sb.h> 129#include <linux/ext4_fs_sb.h>
@@ -311,27 +299,24 @@ struct ext4_inode {
311 __le32 i_generation; /* File version (for NFS) */ 299 __le32 i_generation; /* File version (for NFS) */
312 __le32 i_file_acl; /* File ACL */ 300 __le32 i_file_acl; /* File ACL */
313 __le32 i_dir_acl; /* Directory ACL */ 301 __le32 i_dir_acl; /* Directory ACL */
314 __le32 i_faddr; /* Fragment address */ 302 __le32 i_obso_faddr; /* Obsoleted fragment address */
315 union { 303 union {
316 struct { 304 struct {
317 __u8 l_i_frag; /* Fragment number */ 305 __le16 l_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
318 __u8 l_i_fsize; /* Fragment size */
319 __le16 l_i_file_acl_high; 306 __le16 l_i_file_acl_high;
320 __le16 l_i_uid_high; /* these 2 fields */ 307 __le16 l_i_uid_high; /* these 2 fields */
321 __le16 l_i_gid_high; /* were reserved2[0] */ 308 __le16 l_i_gid_high; /* were reserved2[0] */
322 __u32 l_i_reserved2; 309 __u32 l_i_reserved2;
323 } linux2; 310 } linux2;
324 struct { 311 struct {
325 __u8 h_i_frag; /* Fragment number */ 312 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
326 __u8 h_i_fsize; /* Fragment size */
327 __u16 h_i_mode_high; 313 __u16 h_i_mode_high;
328 __u16 h_i_uid_high; 314 __u16 h_i_uid_high;
329 __u16 h_i_gid_high; 315 __u16 h_i_gid_high;
330 __u32 h_i_author; 316 __u32 h_i_author;
331 } hurd2; 317 } hurd2;
332 struct { 318 struct {
333 __u8 m_i_frag; /* Fragment number */ 319 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
334 __u8 m_i_fsize; /* Fragment size */
335 __le16 m_i_file_acl_high; 320 __le16 m_i_file_acl_high;
336 __u32 m_i_reserved2[2]; 321 __u32 m_i_reserved2[2];
337 } masix2; 322 } masix2;
@@ -419,8 +404,6 @@ do { \
419 404
420#if defined(__KERNEL__) || defined(__linux__) 405#if defined(__KERNEL__) || defined(__linux__)
421#define i_reserved1 osd1.linux1.l_i_reserved1 406#define i_reserved1 osd1.linux1.l_i_reserved1
422#define i_frag osd2.linux2.l_i_frag
423#define i_fsize osd2.linux2.l_i_fsize
424#define i_file_acl_high osd2.linux2.l_i_file_acl_high 407#define i_file_acl_high osd2.linux2.l_i_file_acl_high
425#define i_uid_low i_uid 408#define i_uid_low i_uid
426#define i_gid_low i_gid 409#define i_gid_low i_gid
@@ -431,8 +414,6 @@ do { \
431#elif defined(__GNU__) 414#elif defined(__GNU__)
432 415
433#define i_translator osd1.hurd1.h_i_translator 416#define i_translator osd1.hurd1.h_i_translator
434#define i_frag osd2.hurd2.h_i_frag;
435#define i_fsize osd2.hurd2.h_i_fsize;
436#define i_uid_high osd2.hurd2.h_i_uid_high 417#define i_uid_high osd2.hurd2.h_i_uid_high
437#define i_gid_high osd2.hurd2.h_i_gid_high 418#define i_gid_high osd2.hurd2.h_i_gid_high
438#define i_author osd2.hurd2.h_i_author 419#define i_author osd2.hurd2.h_i_author
@@ -440,8 +421,6 @@ do { \
440#elif defined(__masix__) 421#elif defined(__masix__)
441 422
442#define i_reserved1 osd1.masix1.m_i_reserved1 423#define i_reserved1 osd1.masix1.m_i_reserved1
443#define i_frag osd2.masix2.m_i_frag
444#define i_fsize osd2.masix2.m_i_fsize
445#define i_file_acl_high osd2.masix2.m_i_file_acl_high 424#define i_file_acl_high osd2.masix2.m_i_file_acl_high
446#define i_reserved2 osd2.masix2.m_i_reserved2 425#define i_reserved2 osd2.masix2.m_i_reserved2
447 426
@@ -522,15 +501,15 @@ do { \
522 */ 501 */
523struct ext4_super_block { 502struct ext4_super_block {
524/*00*/ __le32 s_inodes_count; /* Inodes count */ 503/*00*/ __le32 s_inodes_count; /* Inodes count */
525 __le32 s_blocks_count; /* Blocks count */ 504 __le32 s_blocks_count_lo; /* Blocks count */
526 __le32 s_r_blocks_count; /* Reserved blocks count */ 505 __le32 s_r_blocks_count_lo; /* Reserved blocks count */
527 __le32 s_free_blocks_count; /* Free blocks count */ 506 __le32 s_free_blocks_count_lo; /* Free blocks count */
528/*10*/ __le32 s_free_inodes_count; /* Free inodes count */ 507/*10*/ __le32 s_free_inodes_count; /* Free inodes count */
529 __le32 s_first_data_block; /* First Data Block */ 508 __le32 s_first_data_block; /* First Data Block */
530 __le32 s_log_block_size; /* Block size */ 509 __le32 s_log_block_size; /* Block size */
531 __le32 s_log_frag_size; /* Fragment size */ 510 __le32 s_obso_log_frag_size; /* Obsoleted fragment size */
532/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */ 511/*20*/ __le32 s_blocks_per_group; /* # Blocks per group */
533 __le32 s_frags_per_group; /* # Fragments per group */ 512 __le32 s_obso_frags_per_group; /* Obsoleted fragments per group */
534 __le32 s_inodes_per_group; /* # Inodes per group */ 513 __le32 s_inodes_per_group; /* # Inodes per group */
535 __le32 s_mtime; /* Mount time */ 514 __le32 s_mtime; /* Mount time */
536/*30*/ __le32 s_wtime; /* Write time */ 515/*30*/ __le32 s_wtime; /* Write time */
@@ -595,13 +574,13 @@ struct ext4_super_block {
595/*150*/ __le32 s_blocks_count_hi; /* Blocks count */ 574/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
596 __le32 s_r_blocks_count_hi; /* Reserved blocks count */ 575 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
597 __le32 s_free_blocks_count_hi; /* Free blocks count */ 576 __le32 s_free_blocks_count_hi; /* Free blocks count */
598 __u16 s_min_extra_isize; /* All inodes have at least # bytes */ 577 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
599 __u16 s_want_extra_isize; /* New inodes should reserve # bytes */ 578 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
600 __u32 s_flags; /* Miscellaneous flags */ 579 __le32 s_flags; /* Miscellaneous flags */
601 __u16 s_raid_stride; /* RAID stride */ 580 __le16 s_raid_stride; /* RAID stride */
602 __u16 s_mmp_interval; /* # seconds to wait in MMP checking */ 581 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
603 __u64 s_mmp_block; /* Block for multi-mount protection */ 582 __le64 s_mmp_block; /* Block for multi-mount protection */
604 __u32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/ 583 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
605 __u32 s_reserved[163]; /* Padding to the end of the block */ 584 __u32 s_reserved[163]; /* Padding to the end of the block */
606}; 585};
607 586
@@ -692,6 +671,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
692#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 671#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
693#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 672#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
694#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 673#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
674#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
695#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 675#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
696#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 676#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
697 677
@@ -702,15 +682,18 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
702#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010 682#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
703#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ 683#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
704#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 684#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
685#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
705 686
706#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR 687#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
707#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ 688#define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \
708 EXT4_FEATURE_INCOMPAT_RECOVER| \ 689 EXT4_FEATURE_INCOMPAT_RECOVER| \
709 EXT4_FEATURE_INCOMPAT_META_BG| \ 690 EXT4_FEATURE_INCOMPAT_META_BG| \
710 EXT4_FEATURE_INCOMPAT_EXTENTS| \ 691 EXT4_FEATURE_INCOMPAT_EXTENTS| \
711 EXT4_FEATURE_INCOMPAT_64BIT) 692 EXT4_FEATURE_INCOMPAT_64BIT| \
693 EXT4_FEATURE_INCOMPAT_FLEX_BG)
712#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ 694#define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
713 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ 695 EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \
696 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
714 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ 697 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
715 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ 698 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
716 EXT4_FEATURE_RO_COMPAT_BTREE_DIR) 699 EXT4_FEATURE_RO_COMPAT_BTREE_DIR)
@@ -789,17 +772,11 @@ struct ext4_dir_entry_2 {
789 * (c) Daniel Phillips, 2001 772 * (c) Daniel Phillips, 2001
790 */ 773 */
791 774
792#ifdef CONFIG_EXT4_INDEX 775#define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \
793 #define is_dx(dir) (EXT4_HAS_COMPAT_FEATURE(dir->i_sb, \ 776 EXT4_FEATURE_COMPAT_DIR_INDEX) && \
794 EXT4_FEATURE_COMPAT_DIR_INDEX) && \
795 (EXT4_I(dir)->i_flags & EXT4_INDEX_FL)) 777 (EXT4_I(dir)->i_flags & EXT4_INDEX_FL))
796#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX) 778#define EXT4_DIR_LINK_MAX(dir) (!is_dx(dir) && (dir)->i_nlink >= EXT4_LINK_MAX)
797#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1) 779#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2 || (dir)->i_nlink == 1)
798#else
799 #define is_dx(dir) 0
800#define EXT4_DIR_LINK_MAX(dir) ((dir)->i_nlink >= EXT4_LINK_MAX)
801#define EXT4_DIR_LINK_EMPTY(dir) ((dir)->i_nlink == 2)
802#endif
803 780
804/* Legal values for the dx_root hash_version field: */ 781/* Legal values for the dx_root hash_version field: */
805 782
@@ -1004,39 +981,39 @@ extern void ext4_inode_table_set(struct super_block *sb,
1004static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es) 981static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
1005{ 982{
1006 return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) | 983 return ((ext4_fsblk_t)le32_to_cpu(es->s_blocks_count_hi) << 32) |
1007 le32_to_cpu(es->s_blocks_count); 984 le32_to_cpu(es->s_blocks_count_lo);
1008} 985}
1009 986
1010static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es) 987static inline ext4_fsblk_t ext4_r_blocks_count(struct ext4_super_block *es)
1011{ 988{
1012 return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) | 989 return ((ext4_fsblk_t)le32_to_cpu(es->s_r_blocks_count_hi) << 32) |
1013 le32_to_cpu(es->s_r_blocks_count); 990 le32_to_cpu(es->s_r_blocks_count_lo);
1014} 991}
1015 992
1016static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es) 993static inline ext4_fsblk_t ext4_free_blocks_count(struct ext4_super_block *es)
1017{ 994{
1018 return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) | 995 return ((ext4_fsblk_t)le32_to_cpu(es->s_free_blocks_count_hi) << 32) |
1019 le32_to_cpu(es->s_free_blocks_count); 996 le32_to_cpu(es->s_free_blocks_count_lo);
1020} 997}
1021 998
1022static inline void ext4_blocks_count_set(struct ext4_super_block *es, 999static inline void ext4_blocks_count_set(struct ext4_super_block *es,
1023 ext4_fsblk_t blk) 1000 ext4_fsblk_t blk)
1024{ 1001{
1025 es->s_blocks_count = cpu_to_le32((u32)blk); 1002 es->s_blocks_count_lo = cpu_to_le32((u32)blk);
1026 es->s_blocks_count_hi = cpu_to_le32(blk >> 32); 1003 es->s_blocks_count_hi = cpu_to_le32(blk >> 32);
1027} 1004}
1028 1005
1029static inline void ext4_free_blocks_count_set(struct ext4_super_block *es, 1006static inline void ext4_free_blocks_count_set(struct ext4_super_block *es,
1030 ext4_fsblk_t blk) 1007 ext4_fsblk_t blk)
1031{ 1008{
1032 es->s_free_blocks_count = cpu_to_le32((u32)blk); 1009 es->s_free_blocks_count_lo = cpu_to_le32((u32)blk);
1033 es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32); 1010 es->s_free_blocks_count_hi = cpu_to_le32(blk >> 32);
1034} 1011}
1035 1012
1036static inline void ext4_r_blocks_count_set(struct ext4_super_block *es, 1013static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1037 ext4_fsblk_t blk) 1014 ext4_fsblk_t blk)
1038{ 1015{
1039 es->s_r_blocks_count = cpu_to_le32((u32)blk); 1016 es->s_r_blocks_count_lo = cpu_to_le32((u32)blk);
1040 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32); 1017 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
1041} 1018}
1042 1019
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index 81406f3655d4..d2045a26195d 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -74,7 +74,7 @@ struct ext4_extent {
74 __le32 ee_block; /* first logical block extent covers */ 74 __le32 ee_block; /* first logical block extent covers */
75 __le16 ee_len; /* number of blocks covered by extent */ 75 __le16 ee_len; /* number of blocks covered by extent */
76 __le16 ee_start_hi; /* high 16 bits of physical block */ 76 __le16 ee_start_hi; /* high 16 bits of physical block */
77 __le32 ee_start; /* low 32 bits of physical block */ 77 __le32 ee_start_lo; /* low 32 bits of physical block */
78}; 78};
79 79
80/* 80/*
@@ -83,7 +83,7 @@ struct ext4_extent {
83 */ 83 */
84struct ext4_extent_idx { 84struct ext4_extent_idx {
85 __le32 ei_block; /* index covers logical blocks from 'block' */ 85 __le32 ei_block; /* index covers logical blocks from 'block' */
86 __le32 ei_leaf; /* pointer to the physical block of the next * 86 __le32 ei_leaf_lo; /* pointer to the physical block of the next *
87 * level. leaf or next index could be there */ 87 * level. leaf or next index could be there */
88 __le16 ei_leaf_hi; /* high 16 bits of physical block */ 88 __le16 ei_leaf_hi; /* high 16 bits of physical block */
89 __u16 ei_unused; 89 __u16 ei_unused;
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index 1a511e9905aa..86ddfe2089f3 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -78,11 +78,6 @@ struct ext4_ext_cache {
78struct ext4_inode_info { 78struct ext4_inode_info {
79 __le32 i_data[15]; /* unconverted */ 79 __le32 i_data[15]; /* unconverted */
80 __u32 i_flags; 80 __u32 i_flags;
81#ifdef EXT4_FRAGMENTS
82 __u32 i_faddr;
83 __u8 i_frag_no;
84 __u8 i_frag_size;
85#endif
86 ext4_fsblk_t i_file_acl; 81 ext4_fsblk_t i_file_acl;
87 __u32 i_dir_acl; 82 __u32 i_dir_acl;
88 __u32 i_dtime; 83 __u32 i_dtime;
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index 0a8e47d47c91..b40e827cd495 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -28,11 +28,8 @@
28 * third extended-fs super-block data in memory 28 * third extended-fs super-block data in memory
29 */ 29 */
30struct ext4_sb_info { 30struct ext4_sb_info {
31 unsigned long s_frag_size; /* Size of a fragment in bytes */
32 unsigned long s_desc_size; /* Size of a group descriptor in bytes */ 31 unsigned long s_desc_size; /* Size of a group descriptor in bytes */
33 unsigned long s_frags_per_block;/* Number of fragments per block */
34 unsigned long s_inodes_per_block;/* Number of inodes per block */ 32 unsigned long s_inodes_per_block;/* Number of inodes per block */
35 unsigned long s_frags_per_group;/* Number of fragments in a group */
36 unsigned long s_blocks_per_group;/* Number of blocks in a group */ 33 unsigned long s_blocks_per_group;/* Number of blocks in a group */
37 unsigned long s_inodes_per_group;/* Number of inodes in a group */ 34 unsigned long s_inodes_per_group;/* Number of inodes in a group */
38 unsigned long s_itb_per_group; /* Number of inode table blocks per group */ 35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
diff --git a/include/linux/ext4_jbd2.h b/include/linux/ext4_jbd2.h
index d716e6392cf6..38c71d3c8dbf 100644
--- a/include/linux/ext4_jbd2.h
+++ b/include/linux/ext4_jbd2.h
@@ -12,8 +12,8 @@
12 * Ext4-specific journaling extensions. 12 * Ext4-specific journaling extensions.
13 */ 13 */
14 14
15#ifndef _LINUX_EXT4_JBD_H 15#ifndef _LINUX_EXT4_JBD2_H
16#define _LINUX_EXT4_JBD_H 16#define _LINUX_EXT4_JBD2_H
17 17
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/jbd2.h> 19#include <linux/jbd2.h>
@@ -228,4 +228,4 @@ static inline int ext4_should_writeback_data(struct inode *inode)
228 return 0; 228 return 0;
229} 229}
230 230
231#endif /* _LINUX_EXT4_JBD_H */ 231#endif /* _LINUX_EXT4_JBD2_H */
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 91b2e3b9251e..ddfa0372a3b7 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -146,6 +146,7 @@ struct sock;
146 146
147extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); 147extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);
148extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 148extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
149extern int sk_detach_filter(struct sock *sk);
149extern int sk_chk_filter(struct sock_filter *filter, int flen); 150extern int sk_chk_filter(struct sock_filter *filter, int flen);
150#endif /* __KERNEL__ */ 151#endif /* __KERNEL__ */
151 152
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index efded00ad08c..08934995c7ab 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -4,6 +4,7 @@
4#define FREEZER_H_INCLUDED 4#define FREEZER_H_INCLUDED
5 5
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/wait.h>
7 8
8#ifdef CONFIG_PM_SLEEP 9#ifdef CONFIG_PM_SLEEP
9/* 10/*
@@ -126,6 +127,36 @@ static inline void set_freezable(void)
126 current->flags &= ~PF_NOFREEZE; 127 current->flags &= ~PF_NOFREEZE;
127} 128}
128 129
130/*
131 * Freezer-friendly wrappers around wait_event_interruptible() and
132 * wait_event_interruptible_timeout(), originally defined in <linux/wait.h>
133 */
134
135#define wait_event_freezable(wq, condition) \
136({ \
137 int __retval; \
138 do { \
139 __retval = wait_event_interruptible(wq, \
140 (condition) || freezing(current)); \
141 if (__retval && !freezing(current)) \
142 break; \
143 else if (!(condition)) \
144 __retval = -ERESTARTSYS; \
145 } while (try_to_freeze()); \
146 __retval; \
147})
148
149
150#define wait_event_freezable_timeout(wq, condition, timeout) \
151({ \
152 long __retval = timeout; \
153 do { \
154 __retval = wait_event_interruptible_timeout(wq, \
155 (condition) || freezing(current), \
156 __retval); \
157 } while (try_to_freeze()); \
158 __retval; \
159})
129#else /* !CONFIG_PM_SLEEP */ 160#else /* !CONFIG_PM_SLEEP */
130static inline int frozen(struct task_struct *p) { return 0; } 161static inline int frozen(struct task_struct *p) { return 0; }
131static inline int freezing(struct task_struct *p) { return 0; } 162static inline int freezing(struct task_struct *p) { return 0; }
@@ -143,6 +174,13 @@ static inline void freezer_do_not_count(void) {}
143static inline void freezer_count(void) {} 174static inline void freezer_count(void) {}
144static inline int freezer_should_skip(struct task_struct *p) { return 0; } 175static inline int freezer_should_skip(struct task_struct *p) { return 0; }
145static inline void set_freezable(void) {} 176static inline void set_freezable(void) {}
177
178#define wait_event_freezable(wq, condition) \
179 wait_event_interruptible(wq, condition)
180
181#define wait_event_freezable_timeout(wq, condition, timeout) \
182 wait_event_interruptible_timeout(wq, condition, timeout)
183
146#endif /* !CONFIG_PM_SLEEP */ 184#endif /* !CONFIG_PM_SLEEP */
147 185
148#endif /* FREEZER_H_INCLUDED */ 186#endif /* FREEZER_H_INCLUDED */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e3fc5dbb2246..1bcce660cf03 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -123,6 +123,7 @@ extern int dir_notify_enable;
123#define MS_SLAVE (1<<19) /* change to slave */ 123#define MS_SLAVE (1<<19) /* change to slave */
124#define MS_SHARED (1<<20) /* change to shared */ 124#define MS_SHARED (1<<20) /* change to shared */
125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ 125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
126#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
126#define MS_ACTIVE (1<<30) 127#define MS_ACTIVE (1<<30)
127#define MS_NOUSER (1<<31) 128#define MS_NOUSER (1<<31)
128 129
@@ -330,6 +331,7 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
330#define ATTR_KILL_SGID 4096 331#define ATTR_KILL_SGID 4096
331#define ATTR_FILE 8192 332#define ATTR_FILE 8192
332#define ATTR_KILL_PRIV 16384 333#define ATTR_KILL_PRIV 16384
334#define ATTR_OPEN 32768 /* Truncating from open(O_TRUNC) */
333 335
334/* 336/*
335 * This is the Inode Attributes structure, used for notify_change(). It 337 * This is the Inode Attributes structure, used for notify_change(). It
@@ -1458,7 +1460,8 @@ void unnamed_dev_init(void);
1458 1460
1459extern int register_filesystem(struct file_system_type *); 1461extern int register_filesystem(struct file_system_type *);
1460extern int unregister_filesystem(struct file_system_type *); 1462extern int unregister_filesystem(struct file_system_type *);
1461extern struct vfsmount *kern_mount(struct file_system_type *); 1463extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1464#define kern_mount(type) kern_mount_data(type, NULL)
1462extern int may_umount_tree(struct vfsmount *); 1465extern int may_umount_tree(struct vfsmount *);
1463extern int may_umount(struct vfsmount *); 1466extern int may_umount(struct vfsmount *);
1464extern void umount_tree(struct vfsmount *, int, struct list_head *); 1467extern void umount_tree(struct vfsmount *, int, struct list_head *);
@@ -1533,7 +1536,7 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
1533 1536
1534extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, 1537extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1535 struct file *filp); 1538 struct file *filp);
1536extern long do_sys_open(int fdf, const char __user *filename, int flags, 1539extern long do_sys_open(int dfd, const char __user *filename, int flags,
1537 int mode); 1540 int mode);
1538extern struct file *filp_open(const char *, int, int); 1541extern struct file *filp_open(const char *, int, int);
1539extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1542extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
@@ -1921,6 +1924,8 @@ extern int vfs_fstat(unsigned int, struct kstat *);
1921 1924
1922extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long); 1925extern int vfs_ioctl(struct file *, unsigned int, unsigned int, unsigned long);
1923 1926
1927extern void get_filesystem(struct file_system_type *fs);
1928extern void put_filesystem(struct file_system_type *fs);
1924extern struct file_system_type *get_fs_type(const char *name); 1929extern struct file_system_type *get_fs_type(const char *name);
1925extern struct super_block *get_super(struct block_device *); 1930extern struct super_block *get_super(struct block_device *);
1926extern struct super_block *user_get_super(dev_t); 1931extern struct super_block *user_get_super(dev_t);
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 9fbe9d258e22..d0c437028c80 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -6,7 +6,17 @@
6 See the file COPYING. 6 See the file COPYING.
7*/ 7*/
8 8
9/* This file defines the kernel interface of FUSE */ 9/*
10 * This file defines the kernel interface of FUSE
11 *
12 * Protocol changelog:
13 *
14 * 7.9:
15 * - new fuse_getattr_in input argument of GETATTR
16 * - add lk_flags in fuse_lk_in
17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
18 * - add blksize field to fuse_attr
19 */
10 20
11#include <asm/types.h> 21#include <asm/types.h>
12#include <linux/major.h> 22#include <linux/major.h>
@@ -15,7 +25,7 @@
15#define FUSE_KERNEL_VERSION 7 25#define FUSE_KERNEL_VERSION 7
16 26
17/** Minor version number of this interface */ 27/** Minor version number of this interface */
18#define FUSE_KERNEL_MINOR_VERSION 8 28#define FUSE_KERNEL_MINOR_VERSION 9
19 29
20/** The node ID of the root inode */ 30/** The node ID of the root inode */
21#define FUSE_ROOT_ID 1 31#define FUSE_ROOT_ID 1
@@ -44,6 +54,8 @@ struct fuse_attr {
44 __u32 uid; 54 __u32 uid;
45 __u32 gid; 55 __u32 gid;
46 __u32 rdev; 56 __u32 rdev;
57 __u32 blksize;
58 __u32 padding;
47}; 59};
48 60
49struct fuse_kstatfs { 61struct fuse_kstatfs {
@@ -76,6 +88,9 @@ struct fuse_file_lock {
76#define FATTR_ATIME (1 << 4) 88#define FATTR_ATIME (1 << 4)
77#define FATTR_MTIME (1 << 5) 89#define FATTR_MTIME (1 << 5)
78#define FATTR_FH (1 << 6) 90#define FATTR_FH (1 << 6)
91#define FATTR_ATIME_NOW (1 << 7)
92#define FATTR_MTIME_NOW (1 << 8)
93#define FATTR_LOCKOWNER (1 << 9)
79 94
80/** 95/**
81 * Flags returned by the OPEN request 96 * Flags returned by the OPEN request
@@ -91,12 +106,38 @@ struct fuse_file_lock {
91 */ 106 */
92#define FUSE_ASYNC_READ (1 << 0) 107#define FUSE_ASYNC_READ (1 << 0)
93#define FUSE_POSIX_LOCKS (1 << 1) 108#define FUSE_POSIX_LOCKS (1 << 1)
109#define FUSE_FILE_OPS (1 << 2)
110#define FUSE_ATOMIC_O_TRUNC (1 << 3)
94 111
95/** 112/**
96 * Release flags 113 * Release flags
97 */ 114 */
98#define FUSE_RELEASE_FLUSH (1 << 0) 115#define FUSE_RELEASE_FLUSH (1 << 0)
99 116
117/**
118 * Getattr flags
119 */
120#define FUSE_GETATTR_FH (1 << 0)
121
122/**
123 * Lock flags
124 */
125#define FUSE_LK_FLOCK (1 << 0)
126
127/**
128 * WRITE flags
129 *
130 * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
131 * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
132 */
133#define FUSE_WRITE_CACHE (1 << 0)
134#define FUSE_WRITE_LOCKOWNER (1 << 1)
135
136/**
137 * Read flags
138 */
139#define FUSE_READ_LOCKOWNER (1 << 1)
140
100enum fuse_opcode { 141enum fuse_opcode {
101 FUSE_LOOKUP = 1, 142 FUSE_LOOKUP = 1,
102 FUSE_FORGET = 2, /* no reply */ 143 FUSE_FORGET = 2, /* no reply */
@@ -139,6 +180,8 @@ enum fuse_opcode {
139/* The read buffer is required to be at least 8k, but may be much larger */ 180/* The read buffer is required to be at least 8k, but may be much larger */
140#define FUSE_MIN_READ_BUFFER 8192 181#define FUSE_MIN_READ_BUFFER 8192
141 182
183#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
184
142struct fuse_entry_out { 185struct fuse_entry_out {
143 __u64 nodeid; /* Inode ID */ 186 __u64 nodeid; /* Inode ID */
144 __u64 generation; /* Inode generation: nodeid:gen must 187 __u64 generation; /* Inode generation: nodeid:gen must
@@ -154,6 +197,14 @@ struct fuse_forget_in {
154 __u64 nlookup; 197 __u64 nlookup;
155}; 198};
156 199
200struct fuse_getattr_in {
201 __u32 getattr_flags;
202 __u32 dummy;
203 __u64 fh;
204};
205
206#define FUSE_COMPAT_ATTR_OUT_SIZE 96
207
157struct fuse_attr_out { 208struct fuse_attr_out {
158 __u64 attr_valid; /* Cache timeout for the attributes */ 209 __u64 attr_valid; /* Cache timeout for the attributes */
159 __u32 attr_valid_nsec; 210 __u32 attr_valid_nsec;
@@ -184,7 +235,7 @@ struct fuse_setattr_in {
184 __u32 padding; 235 __u32 padding;
185 __u64 fh; 236 __u64 fh;
186 __u64 size; 237 __u64 size;
187 __u64 unused1; 238 __u64 lock_owner;
188 __u64 atime; 239 __u64 atime;
189 __u64 mtime; 240 __u64 mtime;
190 __u64 unused2; 241 __u64 unused2;
@@ -227,14 +278,18 @@ struct fuse_read_in {
227 __u64 fh; 278 __u64 fh;
228 __u64 offset; 279 __u64 offset;
229 __u32 size; 280 __u32 size;
230 __u32 padding; 281 __u32 read_flags;
282 __u64 lock_owner;
231}; 283};
232 284
285#define FUSE_COMPAT_WRITE_IN_SIZE 24
286
233struct fuse_write_in { 287struct fuse_write_in {
234 __u64 fh; 288 __u64 fh;
235 __u64 offset; 289 __u64 offset;
236 __u32 size; 290 __u32 size;
237 __u32 write_flags; 291 __u32 write_flags;
292 __u64 lock_owner;
238}; 293};
239 294
240struct fuse_write_out { 295struct fuse_write_out {
@@ -273,6 +328,8 @@ struct fuse_lk_in {
273 __u64 fh; 328 __u64 fh;
274 __u64 owner; 329 __u64 owner;
275 struct fuse_file_lock lk; 330 struct fuse_file_lock lk;
331 __u32 lk_flags;
332 __u32 padding;
276}; 333};
277 334
278struct fuse_lk_out { 335struct fuse_lk_out {
diff --git a/include/linux/hid.h b/include/linux/hid.h
index edb8024d744b..6e35b92b1d2c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -469,8 +469,8 @@ struct hid_device { /* device report descriptor */
469 /* handler for raw output data, used by hidraw */ 469 /* handler for raw output data, used by hidraw */
470 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 470 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
471#ifdef CONFIG_USB_HIDINPUT_POWERBOOK 471#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
472 unsigned long pb_pressed_fn[NBITS(KEY_MAX)]; 472 unsigned long pb_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
473 unsigned long pb_pressed_numlock[NBITS(KEY_MAX)]; 473 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];
474#endif 474#endif
475}; 475};
476 476
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 540799bc85f8..7a9398e19704 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -300,7 +300,7 @@ hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
300 300
301/* Precise sleep: */ 301/* Precise sleep: */
302extern long hrtimer_nanosleep(struct timespec *rqtp, 302extern long hrtimer_nanosleep(struct timespec *rqtp,
303 struct timespec __user *rmtp, 303 struct timespec *rmtp,
304 const enum hrtimer_mode mode, 304 const enum hrtimer_mode mode,
305 const clockid_t clockid); 305 const clockid_t clockid);
306extern long hrtimer_nanosleep_restart(struct restart_block *restart_block); 306extern long hrtimer_nanosleep_restart(struct restart_block *restart_block);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e39ee2fa2607..2e4b8dd03cfe 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -192,22 +192,20 @@ typedef unsigned char byte; /* used everywhere */
192struct hwif_s; 192struct hwif_s;
193typedef int (ide_ack_intr_t)(struct hwif_s *); 193typedef int (ide_ack_intr_t)(struct hwif_s *);
194 194
195#ifndef NO_DMA
196#define NO_DMA 255
197#endif
198
199/* 195/*
200 * hwif_chipset_t is used to keep track of the specific hardware 196 * hwif_chipset_t is used to keep track of the specific hardware
201 * chipset used by each IDE interface, if known. 197 * chipset used by each IDE interface, if known.
202 */ 198 */
203typedef enum { ide_unknown, ide_generic, ide_pci, 199enum { ide_unknown, ide_generic, ide_pci,
204 ide_cmd640, ide_dtc2278, ide_ali14xx, 200 ide_cmd640, ide_dtc2278, ide_ali14xx,
205 ide_qd65xx, ide_umc8672, ide_ht6560b, 201 ide_qd65xx, ide_umc8672, ide_ht6560b,
206 ide_rz1000, ide_trm290, 202 ide_rz1000, ide_trm290,
207 ide_cmd646, ide_cy82c693, ide_4drives, 203 ide_cmd646, ide_cy82c693, ide_4drives,
208 ide_pmac, ide_etrax100, ide_acorn, 204 ide_pmac, ide_etrax100, ide_acorn,
209 ide_au1xxx, ide_forced 205 ide_au1xxx, ide_forced
210} hwif_chipset_t; 206};
207
208typedef u8 hwif_chipset_t;
211 209
212/* 210/*
213 * Structure to hold all information about the location of this port 211 * Structure to hold all information about the location of this port
@@ -215,22 +213,16 @@ typedef enum { ide_unknown, ide_generic, ide_pci,
215typedef struct hw_regs_s { 213typedef struct hw_regs_s {
216 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */ 214 unsigned long io_ports[IDE_NR_PORTS]; /* task file registers */
217 int irq; /* our irq number */ 215 int irq; /* our irq number */
218 int dma; /* our dma entry */
219 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 216 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
220 hwif_chipset_t chipset; 217 hwif_chipset_t chipset;
221 struct device *dev; 218 struct device *dev;
222} hw_regs_t; 219} hw_regs_t;
223 220
224/* 221struct hwif_s * ide_find_port(unsigned long);
225 * Register new hardware with ide 222
226 */ 223int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int,
227int ide_register_hw(hw_regs_t *, int, struct hwif_s **); 224 struct hwif_s **);
228int ide_register_hw_with_fixup(hw_regs_t *, int, struct hwif_s **,
229 void (*)(struct hwif_s *));
230 225
231/*
232 * Set up hw_regs_t structure before calling ide_register_hw (optional)
233 */
234void ide_setup_ports( hw_regs_t *hw, 226void ide_setup_ports( hw_regs_t *hw,
235 unsigned long base, 227 unsigned long base,
236 int *offsets, 228 int *offsets,
@@ -268,11 +260,7 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
268# define ide_init_default_irq(base) (0) 260# define ide_init_default_irq(base) (0)
269#endif 261#endif
270 262
271/* 263#ifdef CONFIG_IDE_ARCH_OBSOLETE_INIT
272 * ide_init_hwif_ports() is OBSOLETE and will be removed in 2.7 series.
273 * New ports shouldn't define IDE_ARCH_OBSOLETE_INIT in <asm/ide.h>.
274 */
275#ifdef IDE_ARCH_OBSOLETE_INIT
276static inline void ide_init_hwif_ports(hw_regs_t *hw, 264static inline void ide_init_hwif_ports(hw_regs_t *hw,
277 unsigned long io_addr, 265 unsigned long io_addr,
278 unsigned long ctl_addr, 266 unsigned long ctl_addr,
@@ -302,7 +290,7 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
302 if (io_addr || ctl_addr) 290 if (io_addr || ctl_addr)
303 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__); 291 printk(KERN_WARNING "%s: must not be called\n", __FUNCTION__);
304} 292}
305#endif /* IDE_ARCH_OBSOLETE_INIT */ 293#endif /* CONFIG_IDE_ARCH_OBSOLETE_INIT */
306 294
307/* Currently only m68k, apus and m8xx need it */ 295/* Currently only m68k, apus and m8xx need it */
308#ifndef IDE_ARCH_ACK_INTR 296#ifndef IDE_ARCH_ACK_INTR
@@ -363,7 +351,6 @@ typedef union {
363 * ATA DATA Register Special. 351 * ATA DATA Register Special.
364 * ATA NSECTOR Count Register(). 352 * ATA NSECTOR Count Register().
365 * ATAPI Byte Count Register. 353 * ATAPI Byte Count Register.
366 * Channel index ordering pairs.
367 */ 354 */
368typedef union { 355typedef union {
369 unsigned all :16; 356 unsigned all :16;
@@ -378,7 +365,7 @@ typedef union {
378#error "Please fix <asm/byteorder.h>" 365#error "Please fix <asm/byteorder.h>"
379#endif 366#endif
380 } b; 367 } b;
381} ata_nsector_t, ata_data_t, atapi_bcount_t, ata_index_t; 368} ata_nsector_t, ata_data_t, atapi_bcount_t;
382 369
383/* 370/*
384 * ATA-IDE Select Register, aka Device-Head 371 * ATA-IDE Select Register, aka Device-Head
@@ -657,7 +644,7 @@ typedef struct ide_drive_s {
657 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx)) 644 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
658#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1) 645#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
659 646
660struct ide_pci_device_s; 647struct ide_port_info;
661 648
662typedef struct hwif_s { 649typedef struct hwif_s {
663 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */ 650 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
@@ -672,7 +659,6 @@ typedef struct hwif_s {
672 unsigned long sata_scr[SATA_NR_PORTS]; 659 unsigned long sata_scr[SATA_NR_PORTS];
673 unsigned long sata_misc[SATA_NR_PORTS]; 660 unsigned long sata_misc[SATA_NR_PORTS];
674 661
675 hw_regs_t hw; /* Hardware info */
676 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 662 ide_drive_t drives[MAX_DRIVES]; /* drive info */
677 663
678 u8 major; /* our major number */ 664 u8 major; /* our major number */
@@ -685,7 +671,6 @@ typedef struct hwif_s {
685 671
686 u8 pio_mask; 672 u8 pio_mask;
687 673
688 u8 atapi_dma; /* host supports atapi_dma */
689 u8 ultra_mask; 674 u8 ultra_mask;
690 u8 mwdma_mask; 675 u8 mwdma_mask;
691 u8 swdma_mask; 676 u8 swdma_mask;
@@ -695,7 +680,9 @@ typedef struct hwif_s {
695 hwif_chipset_t chipset; /* sub-module for tuning.. */ 680 hwif_chipset_t chipset; /* sub-module for tuning.. */
696 681
697 struct pci_dev *pci_dev; /* for pci chipsets */ 682 struct pci_dev *pci_dev; /* for pci chipsets */
698 struct ide_pci_device_s *cds; /* chipset device struct */ 683 const struct ide_port_info *cds; /* chipset device struct */
684
685 ide_ack_intr_t *ack_intr;
699 686
700 void (*rw_disk)(ide_drive_t *, struct request *); 687 void (*rw_disk)(ide_drive_t *, struct request *);
701 688
@@ -726,6 +713,8 @@ typedef struct hwif_s {
726 u8 (*mdma_filter)(ide_drive_t *); 713 u8 (*mdma_filter)(ide_drive_t *);
727 u8 (*udma_filter)(ide_drive_t *); 714 u8 (*udma_filter)(ide_drive_t *);
728 715
716 void (*fixup)(struct hwif_s *);
717
729 void (*ata_input_data)(ide_drive_t *, void *, u32); 718 void (*ata_input_data)(ide_drive_t *, void *, u32);
730 void (*ata_output_data)(ide_drive_t *, void *, u32); 719 void (*ata_output_data)(ide_drive_t *, void *, u32);
731 720
@@ -797,12 +786,9 @@ typedef struct hwif_s {
797 unsigned serialized : 1; /* serialized all channel operation */ 786 unsigned serialized : 1; /* serialized all channel operation */
798 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 787 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
799 unsigned reset : 1; /* reset after probe */ 788 unsigned reset : 1; /* reset after probe */
800 unsigned no_lba48 : 1; /* 1 = cannot do LBA48 */
801 unsigned no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */
802 unsigned auto_poll : 1; /* supports nop auto-poll */ 789 unsigned auto_poll : 1; /* supports nop auto-poll */
803 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 790 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
804 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */ 791 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
805 unsigned err_stops_fifo : 1; /* 1=data FIFO is cleared by an error */
806 unsigned mmio : 1; /* host uses MMIO */ 792 unsigned mmio : 1; /* host uses MMIO */
807 793
808 struct device gendev; 794 struct device gendev;
@@ -845,8 +831,6 @@ typedef struct hwgroup_s {
845 831
846 /* for pci chipsets */ 832 /* for pci chipsets */
847 struct pci_dev *pci_dev; 833 struct pci_dev *pci_dev;
848 /* chipset device struct */
849 struct ide_pci_device_s *cds;
850 834
851 /* current request */ 835 /* current request */
852 struct request *rq; 836 struct request *rq;
@@ -1034,36 +1018,16 @@ extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);
1034int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, 1018int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1035 int uptodate, int nr_sectors); 1019 int uptodate, int nr_sectors);
1036 1020
1037/*
1038 * This is used on exit from the driver to designate the next irq handler
1039 * and also to start the safety timer.
1040 */
1041extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 1021extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
1042 1022
1043/*
1044 * This is used on exit from the driver to designate the next irq handler
1045 * and start the safety time safely and atomically from the IRQ handler
1046 * with respect to the command issue (which it also does)
1047 */
1048extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); 1023extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *);
1049 1024
1050ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 1025ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
1051 1026
1052/*
1053 * ide_error() takes action based on the error returned by the controller.
1054 * The caller should return immediately after invoking this.
1055 *
1056 * (drive, msg, status)
1057 */
1058ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 1027ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
1059 1028
1060ide_startstop_t __ide_abort(ide_drive_t *, struct request *); 1029ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
1061 1030
1062/*
1063 * Abort a running command on the controller triggering the abort
1064 * from a host side, non error situation
1065 * (drive, msg)
1066 */
1067extern ide_startstop_t ide_abort(ide_drive_t *, const char *); 1031extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
1068 1032
1069extern void ide_fix_driveid(struct hd_driveid *); 1033extern void ide_fix_driveid(struct hd_driveid *);
@@ -1079,15 +1043,8 @@ extern void ide_fixstring(u8 *, const int, const int);
1079 1043
1080int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1044int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1081 1045
1082/*
1083 * Start a reset operation for an IDE interface.
1084 * The caller should return immediately after invoking this.
1085 */
1086extern ide_startstop_t ide_do_reset (ide_drive_t *); 1046extern ide_startstop_t ide_do_reset (ide_drive_t *);
1087 1047
1088/*
1089 * This function is intended to be used prior to invoking ide_do_drive_cmd().
1090 */
1091extern void ide_init_drive_cmd (struct request *rq); 1048extern void ide_init_drive_cmd (struct request *rq);
1092 1049
1093/* 1050/*
@@ -1102,13 +1059,6 @@ typedef enum {
1102 1059
1103extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t); 1060extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
1104 1061
1105/*
1106 * Clean up after success/failure of an explicit drive cmd.
1107 * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_CMD).
1108 * stat/err are used only when (HWGROUP(drive)->rq->cmd == IDE_DRIVE_TASK_MASK).
1109 *
1110 * (ide_drive_t *drive, u8 stat, u8 err)
1111 */
1112extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1062extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1113 1063
1114/* 1064/*
@@ -1181,10 +1131,6 @@ extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
1181 1131
1182extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); 1132extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
1183 1133
1184/*
1185 * ide_stall_queue() can be used by a drive to give excess bandwidth back
1186 * to the hwgroup by sleeping for timeout jiffies.
1187 */
1188extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); 1134extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1189 1135
1190extern int ide_spin_wait_hwgroup(ide_drive_t *); 1136extern int ide_spin_wait_hwgroup(ide_drive_t *);
@@ -1204,26 +1150,13 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1204#define ide_pci_register_driver(d) pci_register_driver(d) 1150#define ide_pci_register_driver(d) pci_register_driver(d)
1205#endif 1151#endif
1206 1152
1207void ide_pci_setup_ports(struct pci_dev *, struct ide_pci_device_s *, int, ata_index_t *); 1153void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *);
1208extern void ide_setup_pci_noise (struct pci_dev *dev, struct ide_pci_device_s *d); 1154void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1209 1155
1210extern void default_hwif_iops(ide_hwif_t *); 1156extern void default_hwif_iops(ide_hwif_t *);
1211extern void default_hwif_mmiops(ide_hwif_t *); 1157extern void default_hwif_mmiops(ide_hwif_t *);
1212extern void default_hwif_transport(ide_hwif_t *); 1158extern void default_hwif_transport(ide_hwif_t *);
1213 1159
1214#define ON_BOARD 1
1215#define NEVER_BOARD 0
1216
1217#ifdef CONFIG_BLK_DEV_OFFBOARD
1218# define OFF_BOARD ON_BOARD
1219#else /* CONFIG_BLK_DEV_OFFBOARD */
1220# define OFF_BOARD NEVER_BOARD
1221#endif /* CONFIG_BLK_DEV_OFFBOARD */
1222
1223#define NODMA 0
1224#define NOAUTODMA 1
1225#define AUTODMA 2
1226
1227typedef struct ide_pci_enablebit_s { 1160typedef struct ide_pci_enablebit_s {
1228 u8 reg; /* byte pci reg holding the enable-bit */ 1161 u8 reg; /* byte pci reg holding the enable-bit */
1229 u8 mask; /* mask to isolate the enable-bit */ 1162 u8 mask; /* mask to isolate the enable-bit */
@@ -1258,29 +1191,61 @@ enum {
1258 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), 1191 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1259 /* host uses VDMA */ 1192 /* host uses VDMA */
1260 IDE_HFLAG_VDMA = (1 << 11), 1193 IDE_HFLAG_VDMA = (1 << 11),
1194 /* ATAPI DMA is unsupported */
1195 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
1196 /* set if host is a "bootable" controller */
1197 IDE_HFLAG_BOOTABLE = (1 << 13),
1198 /* host doesn't support DMA */
1199 IDE_HFLAG_NO_DMA = (1 << 14),
1200 /* check if host is PCI IDE device before allowing DMA */
1201 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1202 /* host is CS5510/CS5520 */
1203 IDE_HFLAG_CS5520 = (1 << 16),
1204 /* no LBA48 */
1205 IDE_HFLAG_NO_LBA48 = (1 << 17),
1206 /* no LBA48 DMA */
1207 IDE_HFLAG_NO_LBA48_DMA = (1 << 18),
1208 /* data FIFO is cleared by an error */
1209 IDE_HFLAG_ERROR_STOPS_FIFO = (1 << 19),
1210 /* serialize ports */
1211 IDE_HFLAG_SERIALIZE = (1 << 20),
1212 /* use legacy IRQs */
1213 IDE_HFLAG_LEGACY_IRQS = (1 << 21),
1214 /* force use of legacy IRQs */
1215 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22),
1216 /* limit LBA48 requests to 256 sectors */
1217 IDE_HFLAG_RQSIZE_256 = (1 << 23),
1218 /* use 32-bit I/O ops */
1219 IDE_HFLAG_IO_32BIT = (1 << 24),
1220 /* unmask IRQs */
1221 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1261}; 1222};
1262 1223
1263typedef struct ide_pci_device_s { 1224#ifdef CONFIG_BLK_DEV_OFFBOARD
1225# define IDE_HFLAG_OFF_BOARD IDE_HFLAG_BOOTABLE
1226#else
1227# define IDE_HFLAG_OFF_BOARD 0
1228#endif
1229
1230struct ide_port_info {
1264 char *name; 1231 char *name;
1265 int (*init_setup)(struct pci_dev *, struct ide_pci_device_s *);
1266 void (*init_setup_dma)(struct pci_dev *, struct ide_pci_device_s *, ide_hwif_t *);
1267 unsigned int (*init_chipset)(struct pci_dev *, const char *); 1232 unsigned int (*init_chipset)(struct pci_dev *, const char *);
1268 void (*init_iops)(ide_hwif_t *); 1233 void (*init_iops)(ide_hwif_t *);
1269 void (*init_hwif)(ide_hwif_t *); 1234 void (*init_hwif)(ide_hwif_t *);
1270 void (*init_dma)(ide_hwif_t *, unsigned long); 1235 void (*init_dma)(ide_hwif_t *, unsigned long);
1271 void (*fixup)(ide_hwif_t *); 1236 void (*fixup)(ide_hwif_t *);
1272 u8 autodma;
1273 ide_pci_enablebit_t enablebits[2]; 1237 ide_pci_enablebit_t enablebits[2];
1274 u8 bootable; 1238 hwif_chipset_t chipset;
1275 unsigned int extra; 1239 unsigned int extra;
1276 struct ide_pci_device_s *next; 1240 u32 host_flags;
1277 u16 host_flags;
1278 u8 pio_mask; 1241 u8 pio_mask;
1242 u8 swdma_mask;
1243 u8 mwdma_mask;
1279 u8 udma_mask; 1244 u8 udma_mask;
1280} ide_pci_device_t; 1245};
1281 1246
1282extern int ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); 1247int ide_setup_pci_device(struct pci_dev *, const struct ide_port_info *);
1283extern int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, ide_pci_device_t *); 1248int ide_setup_pci_devices(struct pci_dev *, struct pci_dev *, const struct ide_port_info *);
1284 1249
1285void ide_map_sg(ide_drive_t *, struct request *); 1250void ide_map_sg(ide_drive_t *, struct request *);
1286void ide_init_sg_cmd(ide_drive_t *, struct request *); 1251void ide_init_sg_cmd(ide_drive_t *, struct request *);
@@ -1363,8 +1328,7 @@ void ide_unregister_region(struct gendisk *);
1363 1328
1364void ide_undecoded_slave(ide_hwif_t *); 1329void ide_undecoded_slave(ide_hwif_t *);
1365 1330
1366int probe_hwif_init_with_fixup(ide_hwif_t *, void (*)(ide_hwif_t *)); 1331int ide_device_add(u8 idx[4]);
1367extern int probe_hwif_init(ide_hwif_t *);
1368 1332
1369static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1333static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1370{ 1334{
@@ -1454,4 +1418,11 @@ static inline int hwif_to_node(ide_hwif_t *hwif)
1454 return dev ? pcibus_to_node(dev->bus) : -1; 1418 return dev ? pcibus_to_node(dev->bus) : -1;
1455} 1419}
1456 1420
1421static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1422{
1423 ide_hwif_t *hwif = HWIF(drive);
1424
1425 return &hwif->drives[(drive->dn ^ 1) & 1];
1426}
1427
1457#endif /* _IDE_H */ 1428#endif /* _IDE_H */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d4b2f1c76e12..cae35b6b9aec 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -67,9 +67,6 @@
67 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \ 67 .posix_timers = LIST_HEAD_INIT(sig.posix_timers), \
68 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \ 68 .cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), \
69 .rlim = INIT_RLIMITS, \ 69 .rlim = INIT_RLIMITS, \
70 .pgrp = 0, \
71 .tty_old_pgrp = NULL, \
72 { .__session = 0}, \
73} 70}
74 71
75extern struct nsproxy init_nsproxy; 72extern struct nsproxy init_nsproxy;
@@ -94,15 +91,18 @@ extern struct group_info init_groups;
94 91
95#define INIT_STRUCT_PID { \ 92#define INIT_STRUCT_PID { \
96 .count = ATOMIC_INIT(1), \ 93 .count = ATOMIC_INIT(1), \
97 .nr = 0, \
98 /* Don't put this struct pid in pid_hash */ \
99 .pid_chain = { .next = NULL, .pprev = NULL }, \
100 .tasks = { \ 94 .tasks = { \
101 { .first = &init_task.pids[PIDTYPE_PID].node }, \ 95 { .first = &init_task.pids[PIDTYPE_PID].node }, \
102 { .first = &init_task.pids[PIDTYPE_PGID].node }, \ 96 { .first = &init_task.pids[PIDTYPE_PGID].node }, \
103 { .first = &init_task.pids[PIDTYPE_SID].node }, \ 97 { .first = &init_task.pids[PIDTYPE_SID].node }, \
104 }, \ 98 }, \
105 .rcu = RCU_HEAD_INIT, \ 99 .rcu = RCU_HEAD_INIT, \
100 .level = 0, \
101 .numbers = { { \
102 .nr = 0, \
103 .ns = &init_pid_ns, \
104 .pid_chain = { .next = NULL, .pprev = NULL }, \
105 }, } \
106} 106}
107 107
108#define INIT_PID_LINK(type) \ 108#define INIT_PID_LINK(type) \
diff --git a/include/linux/input.h b/include/linux/input.h
index f30da6fc08e3..62268929856c 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -98,6 +98,7 @@ struct input_absinfo {
98#define EV_PWR 0x16 98#define EV_PWR 0x16
99#define EV_FF_STATUS 0x17 99#define EV_FF_STATUS 0x17
100#define EV_MAX 0x1f 100#define EV_MAX 0x1f
101#define EV_CNT (EV_MAX+1)
101 102
102/* 103/*
103 * Synchronization events. 104 * Synchronization events.
@@ -567,6 +568,7 @@ struct input_absinfo {
567/* We avoid low common keys in module aliases so they don't get huge. */ 568/* We avoid low common keys in module aliases so they don't get huge. */
568#define KEY_MIN_INTERESTING KEY_MUTE 569#define KEY_MIN_INTERESTING KEY_MUTE
569#define KEY_MAX 0x1ff 570#define KEY_MAX 0x1ff
571#define KEY_CNT (KEY_MAX+1)
570 572
571/* 573/*
572 * Relative axes 574 * Relative axes
@@ -583,6 +585,7 @@ struct input_absinfo {
583#define REL_WHEEL 0x08 585#define REL_WHEEL 0x08
584#define REL_MISC 0x09 586#define REL_MISC 0x09
585#define REL_MAX 0x0f 587#define REL_MAX 0x0f
588#define REL_CNT (REL_MAX+1)
586 589
587/* 590/*
588 * Absolute axes 591 * Absolute axes
@@ -615,6 +618,7 @@ struct input_absinfo {
615#define ABS_VOLUME 0x20 618#define ABS_VOLUME 0x20
616#define ABS_MISC 0x28 619#define ABS_MISC 0x28
617#define ABS_MAX 0x3f 620#define ABS_MAX 0x3f
621#define ABS_CNT (ABS_MAX+1)
618 622
619/* 623/*
620 * Switch events 624 * Switch events
@@ -625,6 +629,7 @@ struct input_absinfo {
625#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ 629#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
626#define SW_RADIO 0x03 /* set = radio enabled */ 630#define SW_RADIO 0x03 /* set = radio enabled */
627#define SW_MAX 0x0f 631#define SW_MAX 0x0f
632#define SW_CNT (SW_MAX+1)
628 633
629/* 634/*
630 * Misc events 635 * Misc events
@@ -636,6 +641,7 @@ struct input_absinfo {
636#define MSC_RAW 0x03 641#define MSC_RAW 0x03
637#define MSC_SCAN 0x04 642#define MSC_SCAN 0x04
638#define MSC_MAX 0x07 643#define MSC_MAX 0x07
644#define MSC_CNT (MSC_MAX+1)
639 645
640/* 646/*
641 * LEDs 647 * LEDs
@@ -653,6 +659,7 @@ struct input_absinfo {
653#define LED_MAIL 0x09 659#define LED_MAIL 0x09
654#define LED_CHARGING 0x0a 660#define LED_CHARGING 0x0a
655#define LED_MAX 0x0f 661#define LED_MAX 0x0f
662#define LED_CNT (LED_MAX+1)
656 663
657/* 664/*
658 * Autorepeat values 665 * Autorepeat values
@@ -670,6 +677,7 @@ struct input_absinfo {
670#define SND_BELL 0x01 677#define SND_BELL 0x01
671#define SND_TONE 0x02 678#define SND_TONE 0x02
672#define SND_MAX 0x07 679#define SND_MAX 0x07
680#define SND_CNT (SND_MAX+1)
673 681
674/* 682/*
675 * IDs. 683 * IDs.
@@ -920,6 +928,7 @@ struct ff_effect {
920#define FF_AUTOCENTER 0x61 928#define FF_AUTOCENTER 0x61
921 929
922#define FF_MAX 0x7f 930#define FF_MAX 0x7f
931#define FF_CNT (FF_MAX+1)
923 932
924#ifdef __KERNEL__ 933#ifdef __KERNEL__
925 934
@@ -932,10 +941,6 @@ struct ff_effect {
932#include <linux/timer.h> 941#include <linux/timer.h>
933#include <linux/mod_devicetable.h> 942#include <linux/mod_devicetable.h>
934 943
935#define NBITS(x) (((x)/BITS_PER_LONG)+1)
936#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
937#define LONG(x) ((x)/BITS_PER_LONG)
938
939/** 944/**
940 * struct input_dev - represents an input device 945 * struct input_dev - represents an input device
941 * @name: name of the device 946 * @name: name of the device
@@ -1005,28 +1010,30 @@ struct ff_effect {
1005 * @going_away: marks devices that are in a middle of unregistering and 1010 * @going_away: marks devices that are in a middle of unregistering and
1006 * causes input_open_device*() fail with -ENODEV. 1011 * causes input_open_device*() fail with -ENODEV.
1007 * @dev: driver model's view of this device 1012 * @dev: driver model's view of this device
1013 * @cdev: union for struct device pointer
1008 * @h_list: list of input handles associated with the device. When 1014 * @h_list: list of input handles associated with the device. When
1009 * accessing the list dev->mutex must be held 1015 * accessing the list dev->mutex must be held
1010 * @node: used to place the device onto input_dev_list 1016 * @node: used to place the device onto input_dev_list
1011 */ 1017 */
1012struct input_dev { 1018struct input_dev {
1013 1019 /* private: */
1014 void *private; /* do not use */ 1020 void *private; /* do not use */
1021 /* public: */
1015 1022
1016 const char *name; 1023 const char *name;
1017 const char *phys; 1024 const char *phys;
1018 const char *uniq; 1025 const char *uniq;
1019 struct input_id id; 1026 struct input_id id;
1020 1027
1021 unsigned long evbit[NBITS(EV_MAX)]; 1028 unsigned long evbit[BITS_TO_LONGS(EV_CNT)];
1022 unsigned long keybit[NBITS(KEY_MAX)]; 1029 unsigned long keybit[BITS_TO_LONGS(KEY_CNT)];
1023 unsigned long relbit[NBITS(REL_MAX)]; 1030 unsigned long relbit[BITS_TO_LONGS(REL_CNT)];
1024 unsigned long absbit[NBITS(ABS_MAX)]; 1031 unsigned long absbit[BITS_TO_LONGS(ABS_CNT)];
1025 unsigned long mscbit[NBITS(MSC_MAX)]; 1032 unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)];
1026 unsigned long ledbit[NBITS(LED_MAX)]; 1033 unsigned long ledbit[BITS_TO_LONGS(LED_CNT)];
1027 unsigned long sndbit[NBITS(SND_MAX)]; 1034 unsigned long sndbit[BITS_TO_LONGS(SND_CNT)];
1028 unsigned long ffbit[NBITS(FF_MAX)]; 1035 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
1029 unsigned long swbit[NBITS(SW_MAX)]; 1036 unsigned long swbit[BITS_TO_LONGS(SW_CNT)];
1030 1037
1031 unsigned int keycodemax; 1038 unsigned int keycodemax;
1032 unsigned int keycodesize; 1039 unsigned int keycodesize;
@@ -1044,10 +1051,10 @@ struct input_dev {
1044 int abs[ABS_MAX + 1]; 1051 int abs[ABS_MAX + 1];
1045 int rep[REP_MAX + 1]; 1052 int rep[REP_MAX + 1];
1046 1053
1047 unsigned long key[NBITS(KEY_MAX)]; 1054 unsigned long key[BITS_TO_LONGS(KEY_CNT)];
1048 unsigned long led[NBITS(LED_MAX)]; 1055 unsigned long led[BITS_TO_LONGS(LED_CNT)];
1049 unsigned long snd[NBITS(SND_MAX)]; 1056 unsigned long snd[BITS_TO_LONGS(SND_CNT)];
1050 unsigned long sw[NBITS(SW_MAX)]; 1057 unsigned long sw[BITS_TO_LONGS(SW_CNT)];
1051 1058
1052 int absmax[ABS_MAX + 1]; 1059 int absmax[ABS_MAX + 1];
1053 int absmin[ABS_MAX + 1]; 1060 int absmin[ABS_MAX + 1];
@@ -1291,7 +1298,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
1291 dev->absfuzz[axis] = fuzz; 1298 dev->absfuzz[axis] = fuzz;
1292 dev->absflat[axis] = flat; 1299 dev->absflat[axis] = flat;
1293 1300
1294 dev->absbit[LONG(axis)] |= BIT(axis); 1301 dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis);
1295} 1302}
1296 1303
1297extern struct class input_class; 1304extern struct class input_class;
@@ -1332,7 +1339,7 @@ struct ff_device {
1332 1339
1333 void *private; 1340 void *private;
1334 1341
1335 unsigned long ffbit[NBITS(FF_MAX)]; 1342 unsigned long ffbit[BITS_TO_LONGS(FF_CNT)];
1336 1343
1337 struct mutex mutex; 1344 struct mutex mutex;
1338 1345
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index ee111834091c..408696ea5189 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -89,6 +89,7 @@ struct kern_ipc_perm
89{ 89{
90 spinlock_t lock; 90 spinlock_t lock;
91 int deleted; 91 int deleted;
92 int id;
92 key_t key; 93 key_t key;
93 uid_t uid; 94 uid_t uid;
94 gid_t gid; 95 gid_t gid;
@@ -110,6 +111,8 @@ struct ipc_namespace {
110 int msg_ctlmax; 111 int msg_ctlmax;
111 int msg_ctlmnb; 112 int msg_ctlmnb;
112 int msg_ctlmni; 113 int msg_ctlmni;
114 atomic_t msg_bytes;
115 atomic_t msg_hdrs;
113 116
114 size_t shm_ctlmax; 117 size_t shm_ctlmax;
115 size_t shm_ctlall; 118 size_t shm_ctlall;
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 7a9db390c56a..c5bd28b69aec 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -365,6 +365,16 @@ int ipmi_request_supply_msgs(ipmi_user_t user,
365 int priority); 365 int priority);
366 366
367/* 367/*
368 * Poll the IPMI interface for the user. This causes the IPMI code to
369 * do an immediate check for information from the driver and handle
370 * anything that is immediately pending. This will not block in any
371 * way. This is useful if you need to implement polling from the user
372 * for things like modifying the watchdog timeout when a panic occurs
373 * or disabling the watchdog timer on a reboot.
374 */
375void ipmi_poll_interface(ipmi_user_t user);
376
377/*
368 * When commands come in to the SMS, the user can register to receive 378 * When commands come in to the SMS, the user can register to receive
369 * them. Only one user can be listening on a specific netfn/cmd/chan tuple 379 * them. Only one user can be listening on a specific netfn/cmd/chan tuple
370 * at a time, you will get an EBUSY error if the command is already 380 * at a time, you will get an EBUSY error if the command is already
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index c0633108d05d..56ae438ae510 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -118,7 +118,7 @@ struct ipmi_smi_handlers
118 /* Enable/disable firmware maintenance mode. Note that this 118 /* Enable/disable firmware maintenance mode. Note that this
119 is *not* the modes defined, this is simply an on/off 119 is *not* the modes defined, this is simply an on/off
120 setting. The message handler does the mode handling. Note 120 setting. The message handler does the mode handling. Note
121 that this is called from interupt context, so it cannot 121 that this is called from interrupt context, so it cannot
122 block. */ 122 block. */
123 void (*set_maintenance_mode)(void *send_info, int enable); 123 void (*set_maintenance_mode)(void *send_info, int enable);
124 124
@@ -148,26 +148,46 @@ struct ipmi_device_id {
148 148
149/* Take a pointer to a raw data buffer and a length and extract device 149/* Take a pointer to a raw data buffer and a length and extract device
150 id information from it. The first byte of data must point to the 150 id information from it. The first byte of data must point to the
151 byte from the get device id response after the completion code. 151 netfn << 2, the data should be of the format:
152 The caller is responsible for making sure the length is at least 152 netfn << 2, cmd, completion code, data
153 11 and the command completed without error. */ 153 as normally comes from a device interface. */
154static inline void ipmi_demangle_device_id(unsigned char *data, 154static inline int ipmi_demangle_device_id(const unsigned char *data,
155 unsigned int data_len, 155 unsigned int data_len,
156 struct ipmi_device_id *id) 156 struct ipmi_device_id *id)
157{ 157{
158 if (data_len < 9)
159 return -EINVAL;
160 if (data[0] != IPMI_NETFN_APP_RESPONSE << 2 ||
161 data[1] != IPMI_GET_DEVICE_ID_CMD)
162 /* Strange, didn't get the response we expected. */
163 return -EINVAL;
164 if (data[2] != 0)
165 /* That's odd, it shouldn't be able to fail. */
166 return -EINVAL;
167
168 data += 3;
169 data_len -= 3;
158 id->device_id = data[0]; 170 id->device_id = data[0];
159 id->device_revision = data[1]; 171 id->device_revision = data[1];
160 id->firmware_revision_1 = data[2]; 172 id->firmware_revision_1 = data[2];
161 id->firmware_revision_2 = data[3]; 173 id->firmware_revision_2 = data[3];
162 id->ipmi_version = data[4]; 174 id->ipmi_version = data[4];
163 id->additional_device_support = data[5]; 175 id->additional_device_support = data[5];
164 id->manufacturer_id = data[6] | (data[7] << 8) | (data[8] << 16); 176 if (data_len >= 6) {
165 id->product_id = data[9] | (data[10] << 8); 177 id->manufacturer_id = (data[6] | (data[7] << 8) |
178 (data[8] << 16));
179 id->product_id = data[9] | (data[10] << 8);
180 } else {
181 id->manufacturer_id = 0;
182 id->product_id = 0;
183 }
166 if (data_len >= 15) { 184 if (data_len >= 15) {
167 memcpy(id->aux_firmware_revision, data+11, 4); 185 memcpy(id->aux_firmware_revision, data+11, 4);
168 id->aux_firmware_revision_set = 1; 186 id->aux_firmware_revision_set = 1;
169 } else 187 } else
170 id->aux_firmware_revision_set = 0; 188 id->aux_firmware_revision_set = 0;
189
190 return 0;
171} 191}
172 192
173/* Add a low-level interface to the IPMI driver. Note that if the 193/* Add a low-level interface to the IPMI driver. Note that if the
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 72f522372924..16e7ed855a18 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -58,7 +58,7 @@
58 * CONFIG_JBD_DEBUG is on. 58 * CONFIG_JBD_DEBUG is on.
59 */ 59 */
60#define JBD_EXPENSIVE_CHECKING 60#define JBD_EXPENSIVE_CHECKING
61extern int journal_enable_debug; 61extern u8 journal_enable_debug;
62 62
63#define jbd_debug(n, f, a...) \ 63#define jbd_debug(n, f, a...) \
64 do { \ 64 do { \
@@ -72,14 +72,15 @@ extern int journal_enable_debug;
72#define jbd_debug(f, a...) /**/ 72#define jbd_debug(f, a...) /**/
73#endif 73#endif
74 74
75extern void * __jbd_kmalloc (const char *where, size_t size, gfp_t flags, int retry); 75static inline void *jbd_alloc(size_t size, gfp_t flags)
76extern void * jbd_slab_alloc(size_t size, gfp_t flags); 76{
77extern void jbd_slab_free(void *ptr, size_t size); 77 return (void *)__get_free_pages(flags, get_order(size));
78}
78 79
79#define jbd_kmalloc(size, flags) \ 80static inline void jbd_free(void *ptr, size_t size)
80 __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry) 81{
81#define jbd_rep_kmalloc(size, flags) \ 82 free_pages((unsigned long)ptr, get_order(size));
82 __jbd_kmalloc(__FUNCTION__, (size), (flags), 1) 83};
83 84
84#define JFS_MIN_JOURNAL_BLOCKS 1024 85#define JFS_MIN_JOURNAL_BLOCKS 1024
85 86
@@ -247,17 +248,7 @@ typedef struct journal_superblock_s
247#include <linux/fs.h> 248#include <linux/fs.h>
248#include <linux/sched.h> 249#include <linux/sched.h>
249 250
250#define JBD_ASSERTIONS 251#define J_ASSERT(assert) BUG_ON(!(assert))
251#ifdef JBD_ASSERTIONS
252#define J_ASSERT(assert) \
253do { \
254 if (!(assert)) { \
255 printk (KERN_EMERG \
256 "Assertion failure in %s() at %s:%d: \"%s\"\n", \
257 __FUNCTION__, __FILE__, __LINE__, # assert); \
258 BUG(); \
259 } \
260} while (0)
261 252
262#if defined(CONFIG_BUFFER_DEBUG) 253#if defined(CONFIG_BUFFER_DEBUG)
263void buffer_assertion_failure(struct buffer_head *bh); 254void buffer_assertion_failure(struct buffer_head *bh);
@@ -273,10 +264,6 @@ void buffer_assertion_failure(struct buffer_head *bh);
273#define J_ASSERT_JH(jh, expr) J_ASSERT(expr) 264#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
274#endif 265#endif
275 266
276#else
277#define J_ASSERT(assert) do { } while (0)
278#endif /* JBD_ASSERTIONS */
279
280#if defined(JBD_PARANOID_IOFAIL) 267#if defined(JBD_PARANOID_IOFAIL)
281#define J_EXPECT(expr, why...) J_ASSERT(expr) 268#define J_EXPECT(expr, why...) J_ASSERT(expr)
282#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr) 269#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 260d6d76c5f3..06ef11457051 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -13,8 +13,8 @@
13 * filesystem journaling support. 13 * filesystem journaling support.
14 */ 14 */
15 15
16#ifndef _LINUX_JBD_H 16#ifndef _LINUX_JBD2_H
17#define _LINUX_JBD_H 17#define _LINUX_JBD2_H
18 18
19/* Allow this file to be included directly into e2fsprogs */ 19/* Allow this file to be included directly into e2fsprogs */
20#ifndef __KERNEL__ 20#ifndef __KERNEL__
@@ -37,26 +37,26 @@
37#define journal_oom_retry 1 37#define journal_oom_retry 1
38 38
39/* 39/*
40 * Define JBD_PARANIOD_IOFAIL to cause a kernel BUG() if ext3 finds 40 * Define JBD2_PARANIOD_IOFAIL to cause a kernel BUG() if ext4 finds
41 * certain classes of error which can occur due to failed IOs. Under 41 * certain classes of error which can occur due to failed IOs. Under
42 * normal use we want ext3 to continue after such errors, because 42 * normal use we want ext4 to continue after such errors, because
43 * hardware _can_ fail, but for debugging purposes when running tests on 43 * hardware _can_ fail, but for debugging purposes when running tests on
44 * known-good hardware we may want to trap these errors. 44 * known-good hardware we may want to trap these errors.
45 */ 45 */
46#undef JBD_PARANOID_IOFAIL 46#undef JBD2_PARANOID_IOFAIL
47 47
48/* 48/*
49 * The default maximum commit age, in seconds. 49 * The default maximum commit age, in seconds.
50 */ 50 */
51#define JBD_DEFAULT_MAX_COMMIT_AGE 5 51#define JBD2_DEFAULT_MAX_COMMIT_AGE 5
52 52
53#ifdef CONFIG_JBD2_DEBUG 53#ifdef CONFIG_JBD2_DEBUG
54/* 54/*
55 * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal 55 * Define JBD2_EXPENSIVE_CHECKING to enable more expensive internal
56 * consistency checks. By default we don't do this unless 56 * consistency checks. By default we don't do this unless
57 * CONFIG_JBD2_DEBUG is on. 57 * CONFIG_JBD2_DEBUG is on.
58 */ 58 */
59#define JBD_EXPENSIVE_CHECKING 59#define JBD2_EXPENSIVE_CHECKING
60extern u8 jbd2_journal_enable_debug; 60extern u8 jbd2_journal_enable_debug;
61 61
62#define jbd_debug(n, f, a...) \ 62#define jbd_debug(n, f, a...) \
@@ -71,14 +71,15 @@ extern u8 jbd2_journal_enable_debug;
71#define jbd_debug(f, a...) /**/ 71#define jbd_debug(f, a...) /**/
72#endif 72#endif
73 73
74extern void * __jbd2_kmalloc (const char *where, size_t size, gfp_t flags, int retry); 74static inline void *jbd2_alloc(size_t size, gfp_t flags)
75extern void * jbd2_slab_alloc(size_t size, gfp_t flags); 75{
76extern void jbd2_slab_free(void *ptr, size_t size); 76 return (void *)__get_free_pages(flags, get_order(size));
77}
77 78
78#define jbd_kmalloc(size, flags) \ 79static inline void jbd2_free(void *ptr, size_t size)
79 __jbd2_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry) 80{
80#define jbd_rep_kmalloc(size, flags) \ 81 free_pages((unsigned long)ptr, get_order(size));
81 __jbd2_kmalloc(__FUNCTION__, (size), (flags), 1) 82};
82 83
83#define JBD2_MIN_JOURNAL_BLOCKS 1024 84#define JBD2_MIN_JOURNAL_BLOCKS 1024
84 85
@@ -162,8 +163,8 @@ typedef struct journal_block_tag_s
162 __be32 t_blocknr_high; /* most-significant high 32bits. */ 163 __be32 t_blocknr_high; /* most-significant high 32bits. */
163} journal_block_tag_t; 164} journal_block_tag_t;
164 165
165#define JBD_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high)) 166#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
166#define JBD_TAG_SIZE64 (sizeof(journal_block_tag_t)) 167#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
167 168
168/* 169/*
169 * The revoke descriptor: used on disk to describe a series of blocks to 170 * The revoke descriptor: used on disk to describe a series of blocks to
@@ -255,8 +256,8 @@ typedef struct journal_superblock_s
255#include <linux/fs.h> 256#include <linux/fs.h>
256#include <linux/sched.h> 257#include <linux/sched.h>
257 258
258#define JBD_ASSERTIONS 259#define JBD2_ASSERTIONS
259#ifdef JBD_ASSERTIONS 260#ifdef JBD2_ASSERTIONS
260#define J_ASSERT(assert) \ 261#define J_ASSERT(assert) \
261do { \ 262do { \
262 if (!(assert)) { \ 263 if (!(assert)) { \
@@ -283,9 +284,9 @@ void buffer_assertion_failure(struct buffer_head *bh);
283 284
284#else 285#else
285#define J_ASSERT(assert) do { } while (0) 286#define J_ASSERT(assert) do { } while (0)
286#endif /* JBD_ASSERTIONS */ 287#endif /* JBD2_ASSERTIONS */
287 288
288#if defined(JBD_PARANOID_IOFAIL) 289#if defined(JBD2_PARANOID_IOFAIL)
289#define J_EXPECT(expr, why...) J_ASSERT(expr) 290#define J_EXPECT(expr, why...) J_ASSERT(expr)
290#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr) 291#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
291#define J_EXPECT_JH(jh, expr, why...) J_ASSERT_JH(jh, expr) 292#define J_EXPECT_JH(jh, expr, why...) J_ASSERT_JH(jh, expr)
@@ -959,12 +960,12 @@ void jbd2_journal_put_journal_head(struct journal_head *jh);
959 */ 960 */
960extern struct kmem_cache *jbd2_handle_cache; 961extern struct kmem_cache *jbd2_handle_cache;
961 962
962static inline handle_t *jbd_alloc_handle(gfp_t gfp_flags) 963static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags)
963{ 964{
964 return kmem_cache_alloc(jbd2_handle_cache, gfp_flags); 965 return kmem_cache_alloc(jbd2_handle_cache, gfp_flags);
965} 966}
966 967
967static inline void jbd_free_handle(handle_t *handle) 968static inline void jbd2_free_handle(handle_t *handle)
968{ 969{
969 kmem_cache_free(jbd2_handle_cache, handle); 970 kmem_cache_free(jbd2_handle_cache, handle);
970} 971}
@@ -1103,4 +1104,4 @@ extern int jbd_blocks_per_page(struct inode *inode);
1103 1104
1104#endif /* __KERNEL__ */ 1105#endif /* __KERNEL__ */
1105 1106
1106#endif /* _LINUX_JBD_H */ 1107#endif /* _LINUX_JBD2_H */
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 12bf44f083f5..e8ffce898bf9 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -53,7 +53,9 @@ static inline int kstat_irqs(int irq)
53} 53}
54 54
55extern void account_user_time(struct task_struct *, cputime_t); 55extern void account_user_time(struct task_struct *, cputime_t);
56extern void account_user_time_scaled(struct task_struct *, cputime_t);
56extern void account_system_time(struct task_struct *, int, cputime_t); 57extern void account_system_time(struct task_struct *, int, cputime_t);
58extern void account_system_time_scaled(struct task_struct *, cputime_t);
57extern void account_steal_time(struct task_struct *, cputime_t); 59extern void account_steal_time(struct task_struct *, cputime_t);
58 60
59#endif /* _LINUX_KERNEL_STAT_H */ 61#endif /* _LINUX_KERNEL_STAT_H */
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index ad4b82ce84af..2d9c448d8c52 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -187,6 +187,8 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
187extern size_t vmcoreinfo_size; 187extern size_t vmcoreinfo_size;
188extern size_t vmcoreinfo_max_size; 188extern size_t vmcoreinfo_max_size;
189 189
190int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
191 unsigned long long *crash_size, unsigned long long *crash_base);
190 192
191#else /* !CONFIG_KEXEC */ 193#else /* !CONFIG_KEXEC */
192struct pt_regs; 194struct pt_regs;
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index 33b5c2e325b9..65c2d70853e9 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -23,10 +23,21 @@
23#define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */ 23#define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */
24 24
25#ifdef __KERNEL__ 25#ifdef __KERNEL__
26struct notifier_block;
26extern const int NR_TYPES; 27extern const int NR_TYPES;
27extern const int max_vals[]; 28extern const int max_vals[];
28extern unsigned short *key_maps[MAX_NR_KEYMAPS]; 29extern unsigned short *key_maps[MAX_NR_KEYMAPS];
29extern unsigned short plain_map[NR_KEYS]; 30extern unsigned short plain_map[NR_KEYS];
31
32struct keyboard_notifier_param {
33 struct vc_data *vc; /* VC on which the keyboard press was done */
34 int down; /* Pressure of the key? */
35 int shift; /* Current shift mask */
36 unsigned int value; /* keycode, unicode value or keysym */
37};
38
39extern int register_keyboard_notifier(struct notifier_block *nb);
40extern int unregister_keyboard_notifier(struct notifier_block *nb);
30#endif 41#endif
31 42
32#define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */ 43#define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 377e6d4d9be3..bc3b6fc7b98d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1037,18 +1037,6 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
1037/* 1037/*
1038 * qc helpers 1038 * qc helpers
1039 */ 1039 */
1040static inline int
1041ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
1042{
1043 if (sg == &qc->pad_sgent)
1044 return 1;
1045 if (qc->pad_len)
1046 return 0;
1047 if (qc->n_iter == qc->n_elem)
1048 return 1;
1049 return 0;
1050}
1051
1052static inline struct scatterlist * 1040static inline struct scatterlist *
1053ata_qc_first_sg(struct ata_queued_cmd *qc) 1041ata_qc_first_sg(struct ata_queued_cmd *qc)
1054{ 1042{
diff --git a/include/linux/list.h b/include/linux/list.h
index b0cf0135fe3e..75ce2cb4ff6e 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -478,8 +478,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
478 pos = n, n = pos->next) 478 pos = n, n = pos->next)
479 479
480/** 480/**
481 * list_for_each_prev_safe - iterate over a list backwards safe against removal 481 * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
482 of list entry
483 * @pos: the &struct list_head to use as a loop cursor. 482 * @pos: the &struct list_head to use as a loop cursor.
484 * @n: another &struct list_head to use as temporary storage 483 * @n: another &struct list_head to use as temporary storage
485 * @head: the head for your list. 484 * @head: the head for your list.
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index f6279f68a827..4c4d236ded18 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -276,6 +276,14 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
276 (lock)->dep_map.key, sub) 276 (lock)->dep_map.key, sub)
277 277
278/* 278/*
279 * To initialize a lockdep_map statically use this macro.
280 * Note that _name must not be NULL.
281 */
282#define STATIC_LOCKDEP_MAP_INIT(_name, _key) \
283 { .name = (_name), .key = (void *)(_key), }
284
285
286/*
279 * Acquire a lock. 287 * Acquire a lock.
280 * 288 *
281 * Values for "read": 289 * Values for "read":
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 722d4755060f..1fa0c2ce4dec 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -37,6 +37,7 @@
37 37
38#define SMB_SUPER_MAGIC 0x517B 38#define SMB_SUPER_MAGIC 0x517B
39#define USBDEVICE_SUPER_MAGIC 0x9fa2 39#define USBDEVICE_SUPER_MAGIC 0x9fa2
40#define CGROUP_SUPER_MAGIC 0x27e0eb
40 41
41#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA 42#define FUTEXFS_SUPER_MAGIC 0xBAD1DEA
42#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA 43#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA
diff --git a/include/linux/marker.h b/include/linux/marker.h
new file mode 100644
index 000000000000..5f36cf946bcb
--- /dev/null
+++ b/include/linux/marker.h
@@ -0,0 +1,129 @@
1#ifndef _LINUX_MARKER_H
2#define _LINUX_MARKER_H
3
4/*
5 * Code markup for dynamic and static tracing.
6 *
7 * See Documentation/marker.txt.
8 *
9 * (C) Copyright 2006 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
10 *
11 * This file is released under the GPLv2.
12 * See the file COPYING for more details.
13 */
14
15#include <linux/types.h>
16
17struct module;
18struct marker;
19
20/**
21 * marker_probe_func - Type of a marker probe function
22 * @mdata: pointer of type struct marker
23 * @private_data: caller site private data
24 * @fmt: format string
25 * @...: variable argument list
26 *
27 * Type of marker probe functions. They receive the mdata and need to parse the
28 * format string to recover the variable argument list.
29 */
30typedef void marker_probe_func(const struct marker *mdata,
31 void *private_data, const char *fmt, ...);
32
33struct marker {
34 const char *name; /* Marker name */
35 const char *format; /* Marker format string, describing the
36 * variable argument list.
37 */
38 char state; /* Marker state. */
39 marker_probe_func *call;/* Probe handler function pointer */
40 void *private; /* Private probe data */
41} __attribute__((aligned(8)));
42
43#ifdef CONFIG_MARKERS
44
45/*
46 * Note : the empty asm volatile with read constraint is used here instead of a
47 * "used" attribute to fix a gcc 4.1.x bug.
48 * Make sure the alignment of the structure in the __markers section will
49 * not add unwanted padding between the beginning of the section and the
50 * structure. Force alignment to the same alignment as the section start.
51 */
52#define __trace_mark(name, call_data, format, args...) \
53 do { \
54 static const char __mstrtab_name_##name[] \
55 __attribute__((section("__markers_strings"))) \
56 = #name; \
57 static const char __mstrtab_format_##name[] \
58 __attribute__((section("__markers_strings"))) \
59 = format; \
60 static struct marker __mark_##name \
61 __attribute__((section("__markers"), aligned(8))) = \
62 { __mstrtab_name_##name, __mstrtab_format_##name, \
63 0, __mark_empty_function, NULL }; \
64 __mark_check_format(format, ## args); \
65 if (unlikely(__mark_##name.state)) { \
66 preempt_disable(); \
67 (*__mark_##name.call) \
68 (&__mark_##name, call_data, \
69 format, ## args); \
70 preempt_enable(); \
71 } \
72 } while (0)
73
74extern void marker_update_probe_range(struct marker *begin,
75 struct marker *end, struct module *probe_module, int *refcount);
76#else /* !CONFIG_MARKERS */
77#define __trace_mark(name, call_data, format, args...) \
78 __mark_check_format(format, ## args)
79static inline void marker_update_probe_range(struct marker *begin,
80 struct marker *end, struct module *probe_module, int *refcount)
81{ }
82#endif /* CONFIG_MARKERS */
83
84/**
85 * trace_mark - Marker
86 * @name: marker name, not quoted.
87 * @format: format string
88 * @args...: variable argument list
89 *
90 * Places a marker.
91 */
92#define trace_mark(name, format, args...) \
93 __trace_mark(name, NULL, format, ## args)
94
95#define MARK_MAX_FORMAT_LEN 1024
96
97/**
98 * MARK_NOARGS - Format string for a marker with no argument.
99 */
100#define MARK_NOARGS " "
101
102/* To be used for string format validity checking with gcc */
103static inline void __printf(1, 2) __mark_check_format(const char *fmt, ...)
104{
105}
106
107extern marker_probe_func __mark_empty_function;
108
109/*
110 * Connect a probe to a marker.
111 * private data pointer must be a valid allocated memory address, or NULL.
112 */
113extern int marker_probe_register(const char *name, const char *format,
114 marker_probe_func *probe, void *private);
115
116/*
117 * Returns the private data given to marker_probe_register.
118 */
119extern void *marker_probe_unregister(const char *name);
120/*
121 * Unregister a marker by providing the registered private data.
122 */
123extern void *marker_probe_unregister_private_data(void *private);
124
125extern int marker_arm(const char *name);
126extern int marker_disarm(const char *name);
127extern void *marker_get_private_data(const char *name);
128
129#endif
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 38c04d61ee06..59c4865bc85f 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -148,14 +148,6 @@ extern void mpol_rebind_task(struct task_struct *tsk,
148 const nodemask_t *new); 148 const nodemask_t *new);
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150extern void mpol_fix_fork_child_flag(struct task_struct *p); 150extern void mpol_fix_fork_child_flag(struct task_struct *p);
151#define set_cpuset_being_rebound(x) (cpuset_being_rebound = (x))
152
153#ifdef CONFIG_CPUSETS
154#define current_cpuset_is_being_rebound() \
155 (cpuset_being_rebound == current->cpuset)
156#else
157#define current_cpuset_is_being_rebound() 0
158#endif
159 151
160extern struct mempolicy default_policy; 152extern struct mempolicy default_policy;
161extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 153extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
@@ -173,8 +165,6 @@ static inline void check_highest_zone(enum zone_type k)
173int do_migrate_pages(struct mm_struct *mm, 165int do_migrate_pages(struct mm_struct *mm,
174 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags); 166 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
175 167
176extern void *cpuset_being_rebound; /* Trigger mpol_copy vma rebind */
177
178#else 168#else
179 169
180struct mempolicy {}; 170struct mempolicy {};
@@ -248,8 +238,6 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)
248{ 238{
249} 239}
250 240
251#define set_cpuset_being_rebound(x) do {} while (0)
252
253static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 241static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
254 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol) 242 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol)
255{ 243{
diff --git a/include/linux/module.h b/include/linux/module.h
index 642f325e4917..2cbc0b87e329 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -15,6 +15,7 @@
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/marker.h>
18#include <asm/local.h> 19#include <asm/local.h>
19 20
20#include <asm/module.h> 21#include <asm/module.h>
@@ -354,6 +355,10 @@ struct module
354 /* The command line arguments (may be mangled). People like 355 /* The command line arguments (may be mangled). People like
355 keeping pointers to this stuff */ 356 keeping pointers to this stuff */
356 char *args; 357 char *args;
358#ifdef CONFIG_MARKERS
359 struct marker *markers;
360 unsigned int num_markers;
361#endif
357}; 362};
358#ifndef MODULE_ARCH_INIT 363#ifndef MODULE_ARCH_INIT
359#define MODULE_ARCH_INIT {} 364#define MODULE_ARCH_INIT {}
@@ -457,6 +462,8 @@ int unregister_module_notifier(struct notifier_block * nb);
457 462
458extern void print_modules(void); 463extern void print_modules(void);
459 464
465extern void module_update_markers(struct module *probe_module, int *refcount);
466
460#else /* !CONFIG_MODULES... */ 467#else /* !CONFIG_MODULES... */
461#define EXPORT_SYMBOL(sym) 468#define EXPORT_SYMBOL(sym)
462#define EXPORT_SYMBOL_GPL(sym) 469#define EXPORT_SYMBOL_GPL(sym)
@@ -556,6 +563,11 @@ static inline void print_modules(void)
556{ 563{
557} 564}
558 565
566static inline void module_update_markers(struct module *probe_module,
567 int *refcount)
568{
569}
570
559#endif /* CONFIG_MODULES */ 571#endif /* CONFIG_MODULES */
560 572
561struct device_driver; 573struct device_driver;
diff --git a/include/linux/msg.h b/include/linux/msg.h
index f1b60740d641..10a3d5a1abff 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -77,7 +77,6 @@ struct msg_msg {
77/* one msq_queue structure for each present queue on the system */ 77/* one msq_queue structure for each present queue on the system */
78struct msg_queue { 78struct msg_queue {
79 struct kern_ipc_perm q_perm; 79 struct kern_ipc_perm q_perm;
80 int q_id;
81 time_t q_stime; /* last msgsnd time */ 80 time_t q_stime; /* last msgsnd time */
82 time_t q_rtime; /* last msgrcv time */ 81 time_t q_rtime; /* last msgrcv time */
83 time_t q_ctime; /* last change time */ 82 time_t q_ctime; /* last change time */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 39dd83b183a9..6f85db3535e2 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -407,6 +407,24 @@ static inline void napi_enable(struct napi_struct *n)
407 clear_bit(NAPI_STATE_SCHED, &n->state); 407 clear_bit(NAPI_STATE_SCHED, &n->state);
408} 408}
409 409
410#ifdef CONFIG_SMP
411/**
412 * napi_synchronize - wait until NAPI is not running
413 * @n: napi context
414 *
415 * Wait until NAPI is done being scheduled on this context.
416 * Waits till any outstanding processing completes but
417 * does not disable future activations.
418 */
419static inline void napi_synchronize(const struct napi_struct *n)
420{
421 while (test_bit(NAPI_STATE_SCHED, &n->state))
422 msleep(1);
423}
424#else
425# define napi_synchronize(n) barrier()
426#endif
427
410/* 428/*
411 * The DEVICE structure. 429 * The DEVICE structure.
412 * Actually, this whole structure is a big mistake. It mixes I/O 430 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -827,7 +845,7 @@ static inline int dev_parse_header(const struct sk_buff *skb,
827{ 845{
828 const struct net_device *dev = skb->dev; 846 const struct net_device *dev = skb->dev;
829 847
830 if (!dev->header_ops->parse) 848 if (!dev->header_ops || !dev->header_ops->parse)
831 return 0; 849 return 0;
832 return dev->header_ops->parse(skb, haddr); 850 return dev->header_ops->parse(skb, haddr);
833} 851}
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index b157897e7792..dd5a4fd4cfd3 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -7,9 +7,6 @@
7 7
8#define XT_SCTP_VALID_FLAGS 0x07 8#define XT_SCTP_VALID_FLAGS 0x07
9 9
10#define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
11
12
13struct xt_sctp_flag_info { 10struct xt_sctp_flag_info {
14 u_int8_t chunktype; 11 u_int8_t chunktype;
15 u_int8_t flag; 12 u_int8_t flag;
@@ -59,21 +56,21 @@ struct xt_sctp_info {
59#define SCTP_CHUNKMAP_RESET(chunkmap) \ 56#define SCTP_CHUNKMAP_RESET(chunkmap) \
60 do { \ 57 do { \
61 int i; \ 58 int i; \
62 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 59 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
63 chunkmap[i] = 0; \ 60 chunkmap[i] = 0; \
64 } while (0) 61 } while (0)
65 62
66#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ 63#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
67 do { \ 64 do { \
68 int i; \ 65 int i; \
69 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 66 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
70 chunkmap[i] = ~0; \ 67 chunkmap[i] = ~0; \
71 } while (0) 68 } while (0)
72 69
73#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ 70#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
74 do { \ 71 do { \
75 int i; \ 72 int i; \
76 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \ 73 for (i = 0; i < ARRAY_SIZE(srcmap); i++) \
77 destmap[i] = srcmap[i]; \ 74 destmap[i] = srcmap[i]; \
78 } while (0) 75 } while (0)
79 76
@@ -81,7 +78,7 @@ struct xt_sctp_info {
81({ \ 78({ \
82 int i; \ 79 int i; \
83 int flag = 1; \ 80 int flag = 1; \
84 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \ 81 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
85 if (chunkmap[i]) { \ 82 if (chunkmap[i]) { \
86 flag = 0; \ 83 flag = 0; \
87 break; \ 84 break; \
@@ -94,7 +91,7 @@ struct xt_sctp_info {
94({ \ 91({ \
95 int i; \ 92 int i; \
96 int flag = 1; \ 93 int flag = 1; \
97 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \ 94 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
98 if (chunkmap[i] != ~0) { \ 95 if (chunkmap[i] != ~0) { \
99 flag = 0; \ 96 flag = 0; \
100 break; \ 97 break; \
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index c5164c257f71..e82a6ebc725d 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -160,6 +160,12 @@ struct nfs_inode {
160 /* Open contexts for shared mmap writes */ 160 /* Open contexts for shared mmap writes */
161 struct list_head open_files; 161 struct list_head open_files;
162 162
163 /* Number of in-flight sillydelete RPC calls */
164 atomic_t silly_count;
165 /* List of deferred sillydelete requests */
166 struct hlist_head silly_list;
167 wait_queue_head_t waitqueue;
168
163#ifdef CONFIG_NFS_V4 169#ifdef CONFIG_NFS_V4
164 struct nfs4_cached_acl *nfs4_acl; 170 struct nfs4_cached_acl *nfs4_acl;
165 /* NFSv4 state */ 171 /* NFSv4 state */
@@ -394,6 +400,8 @@ extern void nfs_release_automount_timer(void);
394 */ 400 */
395extern int nfs_async_unlink(struct inode *dir, struct dentry *dentry); 401extern int nfs_async_unlink(struct inode *dir, struct dentry *dentry);
396extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 402extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
403extern void nfs_block_sillyrename(struct dentry *dentry);
404extern void nfs_unblock_sillyrename(struct dentry *dentry);
397 405
398/* 406/*
399 * linux/fs/nfs/write.c 407 * linux/fs/nfs/write.c
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index fad7ff17e468..0c40cc0b4a36 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -231,5 +231,22 @@ static inline int notifier_to_errno(int ret)
231#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */ 231#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */
232#define PM_POST_SUSPEND 0x0004 /* Suspend finished */ 232#define PM_POST_SUSPEND 0x0004 /* Suspend finished */
233 233
234/* Console keyboard events.
235 * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
236 * KBD_KEYSYM. */
237#define KBD_KEYCODE 0x0001 /* Keyboard keycode, called before any other */
238#define KBD_UNBOUND_KEYCODE 0x0002 /* Keyboard keycode which is not bound to any other */
239#define KBD_UNICODE 0x0003 /* Keyboard unicode */
240#define KBD_KEYSYM 0x0004 /* Keyboard keysym */
241#define KBD_POST_KEYSYM 0x0005 /* Called after keyboard keysym interpretation */
242
243extern struct blocking_notifier_head reboot_notifier_list;
244
245/* Virtual Terminal events. */
246#define VT_ALLOCATE 0x0001 /* Console got allocated */
247#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */
248#define VT_WRITE 0x0003 /* A char got output */
249#define VT_UPDATE 0x0004 /* A bigger update occurred */
250
234#endif /* __KERNEL__ */ 251#endif /* __KERNEL__ */
235#endif /* _LINUX_NOTIFIER_H */ 252#endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index 033a648709b6..0e66b57631fc 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -32,8 +32,39 @@ struct nsproxy {
32}; 32};
33extern struct nsproxy init_nsproxy; 33extern struct nsproxy init_nsproxy;
34 34
35/*
36 * the namespaces access rules are:
37 *
38 * 1. only current task is allowed to change tsk->nsproxy pointer or
39 * any pointer on the nsproxy itself
40 *
41 * 2. when accessing (i.e. reading) current task's namespaces - no
42 * precautions should be taken - just dereference the pointers
43 *
44 * 3. the access to other task namespaces is performed like this
45 * rcu_read_lock();
46 * nsproxy = task_nsproxy(tsk);
47 * if (nsproxy != NULL) {
48 * / *
49 * * work with the namespaces here
50 * * e.g. get the reference on one of them
51 * * /
52 * } / *
53 * * NULL task_nsproxy() means that this task is
54 * * almost dead (zombie)
55 * * /
56 * rcu_read_unlock();
57 *
58 */
59
60static inline struct nsproxy *task_nsproxy(struct task_struct *tsk)
61{
62 return rcu_dereference(tsk->nsproxy);
63}
64
35int copy_namespaces(unsigned long flags, struct task_struct *tsk); 65int copy_namespaces(unsigned long flags, struct task_struct *tsk);
36void get_task_namespaces(struct task_struct *tsk); 66void exit_task_namespaces(struct task_struct *tsk);
67void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
37void free_nsproxy(struct nsproxy *ns); 68void free_nsproxy(struct nsproxy *ns);
38int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **, 69int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
39 struct fs_struct *); 70 struct fs_struct *);
@@ -45,14 +76,15 @@ static inline void put_nsproxy(struct nsproxy *ns)
45 } 76 }
46} 77}
47 78
48static inline void exit_task_namespaces(struct task_struct *p) 79static inline void get_nsproxy(struct nsproxy *ns)
49{ 80{
50 struct nsproxy *ns = p->nsproxy; 81 atomic_inc(&ns->count);
51 if (ns) {
52 task_lock(p);
53 p->nsproxy = NULL;
54 task_unlock(p);
55 put_nsproxy(ns);
56 }
57} 82}
83
84#ifdef CONFIG_CGROUP_NS
85int ns_cgroup_clone(struct task_struct *tsk);
86#else
87static inline int ns_cgroup_clone(struct task_struct *tsk) { return 0; }
88#endif
89
58#endif 90#endif
diff --git a/include/linux/of.h b/include/linux/of.h
index 6df80e985914..5c39b9270ff7 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -16,8 +16,8 @@
16 * 2 of the License, or (at your option) any later version. 16 * 2 of the License, or (at your option) any later version.
17 */ 17 */
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/bitops.h>
19 20
20#include <asm/bitops.h>
21#include <asm/prom.h> 21#include <asm/prom.h>
22 22
23/* flag descriptions */ 23/* flag descriptions */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 448f70b30a0c..a8efcfeea732 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -48,6 +48,10 @@ struct of_platform_driver
48#define to_of_platform_driver(drv) \ 48#define to_of_platform_driver(drv) \
49 container_of(drv,struct of_platform_driver, driver) 49 container_of(drv,struct of_platform_driver, driver)
50 50
51extern int of_register_driver(struct of_platform_driver *drv,
52 struct bus_type *bus);
53extern void of_unregister_driver(struct of_platform_driver *drv);
54
51#include <asm/of_platform.h> 55#include <asm/of_platform.h>
52 56
53extern struct of_device *of_find_device_by_node(struct device_node *np); 57extern struct of_device *of_find_device_by_node(struct device_node *np);
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 9cdd6943e01b..ec3f76598327 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -510,7 +510,6 @@ extern struct pardevice *parport_open (int devnum, const char *name,
510 int flags, void *handle); 510 int flags, void *handle);
511extern void parport_close (struct pardevice *dev); 511extern void parport_close (struct pardevice *dev);
512extern ssize_t parport_device_id (int devnum, char *buffer, size_t len); 512extern ssize_t parport_device_id (int devnum, char *buffer, size_t len);
513extern int parport_device_num (int parport, int mux, int daisy);
514extern void parport_daisy_deselect_all (struct parport *port); 513extern void parport_daisy_deselect_all (struct parport *port);
515extern int parport_daisy_select (struct parport *port, int daisy, int mode); 514extern int parport_daisy_select (struct parport *port, int daisy, int mode);
516 515
diff --git a/include/linux/phantom.h b/include/linux/phantom.h
index d3ebbfae6903..96f4048a6cc3 100644
--- a/include/linux/phantom.h
+++ b/include/linux/phantom.h
@@ -30,7 +30,11 @@ struct phm_regs {
30#define PHN_SET_REG _IOW (PH_IOC_MAGIC, 1, struct phm_reg *) 30#define PHN_SET_REG _IOW (PH_IOC_MAGIC, 1, struct phm_reg *)
31#define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *) 31#define PHN_GET_REGS _IOWR(PH_IOC_MAGIC, 2, struct phm_regs *)
32#define PHN_SET_REGS _IOW (PH_IOC_MAGIC, 3, struct phm_regs *) 32#define PHN_SET_REGS _IOW (PH_IOC_MAGIC, 3, struct phm_regs *)
33#define PH_IOC_MAXNR 3 33/* this ioctl tells the driver, that the caller is not OpenHaptics and might
34 * use improved registers update (no more phantom switchoffs when using
35 * libphantom) */
36#define PHN_NOT_OH _IO (PH_IOC_MAGIC, 4)
37#define PH_IOC_MAXNR 4
34 38
35#define PHN_CONTROL 0x6 /* control byte in iaddr space */ 39#define PHN_CONTROL 0x6 /* control byte in iaddr space */
36#define PHN_CTL_AMP 0x1 /* switch after torques change */ 40#define PHN_CTL_AMP 0x1 /* switch after torques change */
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 1e0e4e3423a6..e29a900a8499 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -40,15 +40,28 @@ enum pid_type
40 * processes. 40 * processes.
41 */ 41 */
42 42
43struct pid 43
44{ 44/*
45 atomic_t count; 45 * struct upid is used to get the id of the struct pid, as it is
46 * seen in particular namespace. Later the struct pid is found with
47 * find_pid_ns() using the int nr and struct pid_namespace *ns.
48 */
49
50struct upid {
46 /* Try to keep pid_chain in the same cacheline as nr for find_pid */ 51 /* Try to keep pid_chain in the same cacheline as nr for find_pid */
47 int nr; 52 int nr;
53 struct pid_namespace *ns;
48 struct hlist_node pid_chain; 54 struct hlist_node pid_chain;
55};
56
57struct pid
58{
59 atomic_t count;
49 /* lists of tasks that use this pid */ 60 /* lists of tasks that use this pid */
50 struct hlist_head tasks[PIDTYPE_MAX]; 61 struct hlist_head tasks[PIDTYPE_MAX];
51 struct rcu_head rcu; 62 struct rcu_head rcu;
63 int level;
64 struct upid numbers[1];
52}; 65};
53 66
54extern struct pid init_struct_pid; 67extern struct pid init_struct_pid;
@@ -83,26 +96,60 @@ extern void FASTCALL(detach_pid(struct task_struct *task, enum pid_type));
83extern void FASTCALL(transfer_pid(struct task_struct *old, 96extern void FASTCALL(transfer_pid(struct task_struct *old,
84 struct task_struct *new, enum pid_type)); 97 struct task_struct *new, enum pid_type));
85 98
99struct pid_namespace;
100extern struct pid_namespace init_pid_ns;
101
86/* 102/*
87 * look up a PID in the hash table. Must be called with the tasklist_lock 103 * look up a PID in the hash table. Must be called with the tasklist_lock
88 * or rcu_read_lock() held. 104 * or rcu_read_lock() held.
105 *
106 * find_pid_ns() finds the pid in the namespace specified
107 * find_pid() find the pid by its global id, i.e. in the init namespace
108 * find_vpid() finr the pid by its virtual id, i.e. in the current namespace
109 *
110 * see also find_task_by_pid() set in include/linux/sched.h
89 */ 111 */
90extern struct pid *FASTCALL(find_pid(int nr)); 112extern struct pid *FASTCALL(find_pid_ns(int nr, struct pid_namespace *ns));
113extern struct pid *find_vpid(int nr);
114extern struct pid *find_pid(int nr);
91 115
92/* 116/*
93 * Lookup a PID in the hash table, and return with it's count elevated. 117 * Lookup a PID in the hash table, and return with it's count elevated.
94 */ 118 */
95extern struct pid *find_get_pid(int nr); 119extern struct pid *find_get_pid(int nr);
96extern struct pid *find_ge_pid(int nr); 120extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
97 121
98extern struct pid *alloc_pid(void); 122extern struct pid *alloc_pid(struct pid_namespace *ns);
99extern void FASTCALL(free_pid(struct pid *pid)); 123extern void FASTCALL(free_pid(struct pid *pid));
124extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
125
126/*
127 * the helpers to get the pid's id seen from different namespaces
128 *
129 * pid_nr() : global id, i.e. the id seen from the init namespace;
130 * pid_vnr() : virtual id, i.e. the id seen from the namespace this pid
131 * belongs to. this only makes sence when called in the
132 * context of the task that belongs to the same namespace;
133 * pid_nr_ns() : id seen from the ns specified.
134 *
135 * see also task_xid_nr() etc in include/linux/sched.h
136 */
100 137
101static inline pid_t pid_nr(struct pid *pid) 138static inline pid_t pid_nr(struct pid *pid)
102{ 139{
103 pid_t nr = 0; 140 pid_t nr = 0;
104 if (pid) 141 if (pid)
105 nr = pid->nr; 142 nr = pid->numbers[0].nr;
143 return nr;
144}
145
146pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
147
148static inline pid_t pid_vnr(struct pid *pid)
149{
150 pid_t nr = 0;
151 if (pid)
152 nr = pid->numbers[pid->level].nr;
106 return nr; 153 return nr;
107} 154}
108 155
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index b9a17e08ff0f..0135c76c76c6 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -4,7 +4,6 @@
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/threads.h> 6#include <linux/threads.h>
7#include <linux/pid.h>
8#include <linux/nsproxy.h> 7#include <linux/nsproxy.h>
9#include <linux/kref.h> 8#include <linux/kref.h>
10 9
@@ -20,13 +19,21 @@ struct pid_namespace {
20 struct pidmap pidmap[PIDMAP_ENTRIES]; 19 struct pidmap pidmap[PIDMAP_ENTRIES];
21 int last_pid; 20 int last_pid;
22 struct task_struct *child_reaper; 21 struct task_struct *child_reaper;
22 struct kmem_cache *pid_cachep;
23 int level;
24 struct pid_namespace *parent;
25#ifdef CONFIG_PROC_FS
26 struct vfsmount *proc_mnt;
27#endif
23}; 28};
24 29
25extern struct pid_namespace init_pid_ns; 30extern struct pid_namespace init_pid_ns;
26 31
27static inline void get_pid_ns(struct pid_namespace *ns) 32static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
28{ 33{
29 kref_get(&ns->kref); 34 if (ns != &init_pid_ns)
35 kref_get(&ns->kref);
36 return ns;
30} 37}
31 38
32extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); 39extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
@@ -34,12 +41,19 @@ extern void free_pid_ns(struct kref *kref);
34 41
35static inline void put_pid_ns(struct pid_namespace *ns) 42static inline void put_pid_ns(struct pid_namespace *ns)
36{ 43{
37 kref_put(&ns->kref, free_pid_ns); 44 if (ns != &init_pid_ns)
45 kref_put(&ns->kref, free_pid_ns);
38} 46}
39 47
40static inline struct task_struct *child_reaper(struct task_struct *tsk) 48static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
41{ 49{
42 return init_pid_ns.child_reaper; 50 return tsk->nsproxy->pid_ns;
51}
52
53static inline struct task_struct *task_child_reaper(struct task_struct *tsk)
54{
55 BUG_ON(tsk != current);
56 return tsk->nsproxy->pid_ns->child_reaper;
43} 57}
44 58
45#endif /* _LINUX_PID_NS_H */ 59#endif /* _LINUX_PID_NS_H */
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 48b71badfb4c..09a309b7b5d2 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -104,104 +104,6 @@ extern void (*pm_idle)(void);
104extern void (*pm_power_off)(void); 104extern void (*pm_power_off)(void);
105extern void (*pm_power_off_prepare)(void); 105extern void (*pm_power_off_prepare)(void);
106 106
107typedef int __bitwise suspend_state_t;
108
109#define PM_SUSPEND_ON ((__force suspend_state_t) 0)
110#define PM_SUSPEND_STANDBY ((__force suspend_state_t) 1)
111#define PM_SUSPEND_MEM ((__force suspend_state_t) 3)
112#define PM_SUSPEND_MAX ((__force suspend_state_t) 4)
113
114/**
115 * struct pm_ops - Callbacks for managing platform dependent system sleep
116 * states.
117 *
118 * @valid: Callback to determine if given system sleep state is supported by
119 * the platform.
120 * Valid (ie. supported) states are advertised in /sys/power/state. Note
121 * that it still may be impossible to enter given system sleep state if the
122 * conditions aren't right.
123 * There is the %pm_valid_only_mem function available that can be assigned
124 * to this if the platform only supports mem sleep.
125 *
126 * @set_target: Tell the platform which system sleep state is going to be
127 * entered.
128 * @set_target() is executed right prior to suspending devices. The
129 * information conveyed to the platform code by @set_target() should be
130 * disregarded by the platform as soon as @finish() is executed and if
131 * @prepare() fails. If @set_target() fails (ie. returns nonzero),
132 * @prepare(), @enter() and @finish() will not be called by the PM core.
133 * This callback is optional. However, if it is implemented, the argument
134 * passed to @prepare(), @enter() and @finish() is meaningless and should
135 * be ignored.
136 *
137 * @prepare: Prepare the platform for entering the system sleep state indicated
138 * by @set_target() or represented by the argument if @set_target() is not
139 * implemented.
140 * @prepare() is called right after devices have been suspended (ie. the
141 * appropriate .suspend() method has been executed for each device) and
142 * before the nonboot CPUs are disabled (it is executed with IRQs enabled).
143 * This callback is optional. It returns 0 on success or a negative
144 * error code otherwise, in which case the system cannot enter the desired
145 * sleep state (@enter() and @finish() will not be called in that case).
146 *
147 * @enter: Enter the system sleep state indicated by @set_target() or
148 * represented by the argument if @set_target() is not implemented.
149 * This callback is mandatory. It returns 0 on success or a negative
150 * error code otherwise, in which case the system cannot enter the desired
151 * sleep state.
152 *
153 * @finish: Called when the system has just left a sleep state, right after
154 * the nonboot CPUs have been enabled and before devices are resumed (it is
155 * executed with IRQs enabled). If @set_target() is not implemented, the
156 * argument represents the sleep state being left.
157 * This callback is optional, but should be implemented by the platforms
158 * that implement @prepare(). If implemented, it is always called after
159 * @enter() (even if @enter() fails).
160 */
161struct pm_ops {
162 int (*valid)(suspend_state_t state);
163 int (*set_target)(suspend_state_t state);
164 int (*prepare)(suspend_state_t state);
165 int (*enter)(suspend_state_t state);
166 int (*finish)(suspend_state_t state);
167};
168
169#ifdef CONFIG_SUSPEND
170extern struct pm_ops *pm_ops;
171
172/**
173 * pm_set_ops - set platform dependent power management ops
174 * @pm_ops: The new power management operations to set.
175 */
176extern void pm_set_ops(struct pm_ops *pm_ops);
177extern int pm_valid_only_mem(suspend_state_t state);
178
179/**
180 * arch_suspend_disable_irqs - disable IRQs for suspend
181 *
182 * Disables IRQs (in the default case). This is a weak symbol in the common
183 * code and thus allows architectures to override it if more needs to be
184 * done. Not called for suspend to disk.
185 */
186extern void arch_suspend_disable_irqs(void);
187
188/**
189 * arch_suspend_enable_irqs - enable IRQs after suspend
190 *
191 * Enables IRQs (in the default case). This is a weak symbol in the common
192 * code and thus allows architectures to override it if more needs to be
193 * done. Not called for suspend to disk.
194 */
195extern void arch_suspend_enable_irqs(void);
196
197extern int pm_suspend(suspend_state_t state);
198#else /* !CONFIG_SUSPEND */
199#define suspend_valid_only_mem NULL
200
201static inline void pm_set_ops(struct pm_ops *pm_ops) {}
202static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
203#endif /* !CONFIG_SUSPEND */
204
205/* 107/*
206 * Device power management 108 * Device power management
207 */ 109 */
diff --git a/include/linux/poison.h b/include/linux/poison.h
index d93c300a3449..a9c31be7052c 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -36,7 +36,8 @@
36 */ 36 */
37 37
38/********** fs/jbd/journal.c **********/ 38/********** fs/jbd/journal.c **********/
39#define JBD_POISON_FREE 0x5b 39#define JBD_POISON_FREE 0x5b
40#define JBD2_POISON_FREE 0x5c
40 41
41/********** drivers/base/dmapool.c **********/ 42/********** drivers/base/dmapool.c **********/
42#define POOL_POISON_FREED 0xa7 /* !inuse */ 43#define POOL_POISON_FREED 0xa7 /* !inuse */
diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h
index 1adfe668d031..af7c36a5a521 100644
--- a/include/linux/prefetch.h
+++ b/include/linux/prefetch.h
@@ -34,17 +34,12 @@
34 34
35*/ 35*/
36 36
37/*
38 * These cannot be do{}while(0) macros. See the mental gymnastics in
39 * the loop macro.
40 */
41
42#ifndef ARCH_HAS_PREFETCH 37#ifndef ARCH_HAS_PREFETCH
43static inline void prefetch(const void *x) {;} 38#define prefetch(x) __builtin_prefetch(x)
44#endif 39#endif
45 40
46#ifndef ARCH_HAS_PREFETCHW 41#ifndef ARCH_HAS_PREFETCHW
47static inline void prefetchw(const void *x) {;} 42#define prefetchw(x) __builtin_prefetch(x,1)
48#endif 43#endif
49 44
50#ifndef ARCH_HAS_SPINLOCK_PREFETCH 45#ifndef ARCH_HAS_SPINLOCK_PREFETCH
diff --git a/include/linux/prio_heap.h b/include/linux/prio_heap.h
new file mode 100644
index 000000000000..08094350f26a
--- /dev/null
+++ b/include/linux/prio_heap.h
@@ -0,0 +1,58 @@
1#ifndef _LINUX_PRIO_HEAP_H
2#define _LINUX_PRIO_HEAP_H
3
4/*
5 * Simple insertion-only static-sized priority heap containing
6 * pointers, based on CLR, chapter 7
7 */
8
9#include <linux/gfp.h>
10
11/**
12 * struct ptr_heap - simple static-sized priority heap
13 * @ptrs - pointer to data area
14 * @max - max number of elements that can be stored in @ptrs
15 * @size - current number of valid elements in @ptrs (in the range 0..@size-1
16 * @gt: comparison operator, which should implement "greater than"
17 */
18struct ptr_heap {
19 void **ptrs;
20 int max;
21 int size;
22 int (*gt)(void *, void *);
23};
24
25/**
26 * heap_init - initialize an empty heap with a given memory size
27 * @heap: the heap structure to be initialized
28 * @size: amount of memory to use in bytes
29 * @gfp_mask: mask to pass to kmalloc()
30 * @gt: comparison operator, which should implement "greater than"
31 */
32extern int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask,
33 int (*gt)(void *, void *));
34
35/**
36 * heap_free - release a heap's storage
37 * @heap: the heap structure whose data should be released
38 */
39void heap_free(struct ptr_heap *heap);
40
41/**
42 * heap_insert - insert a value into the heap and return any overflowed value
43 * @heap: the heap to be operated on
44 * @p: the pointer to be inserted
45 *
46 * Attempts to insert the given value into the priority heap. If the
47 * heap is full prior to the insertion, then the resulting heap will
48 * consist of the smallest @max elements of the original heap and the
49 * new element; the greatest element will be removed from the heap and
50 * returned. Note that the returned element will be the new element
51 * (i.e. no change to the heap) if the new element is greater than all
52 * elements currently in the heap.
53 */
54extern void *heap_insert(struct ptr_heap *heap, void *p);
55
56
57
58#endif /* _LINUX_PRIO_HEAP_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 20741f668f7b..1ff461672060 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -125,7 +125,8 @@ extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
125extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); 125extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
126 126
127extern struct vfsmount *proc_mnt; 127extern struct vfsmount *proc_mnt;
128extern int proc_fill_super(struct super_block *,void *,int); 128struct pid_namespace;
129extern int proc_fill_super(struct super_block *);
129extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *); 130extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *);
130 131
131/* 132/*
@@ -142,6 +143,9 @@ extern const struct file_operations proc_kcore_operations;
142extern const struct file_operations proc_kmsg_operations; 143extern const struct file_operations proc_kmsg_operations;
143extern const struct file_operations ppc_htab_operations; 144extern const struct file_operations ppc_htab_operations;
144 145
146extern int pid_ns_prepare_proc(struct pid_namespace *ns);
147extern void pid_ns_release_proc(struct pid_namespace *ns);
148
145/* 149/*
146 * proc_tty.c 150 * proc_tty.c
147 */ 151 */
@@ -207,7 +211,9 @@ extern void proc_net_remove(struct net *net, const char *name);
207#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; }) 211#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; })
208static inline void proc_net_remove(struct net *net, const char *name) {} 212static inline void proc_net_remove(struct net *net, const char *name) {}
209 213
210static inline void proc_flush_task(struct task_struct *task) { } 214static inline void proc_flush_task(struct task_struct *task)
215{
216}
211 217
212static inline struct proc_dir_entry *create_proc_entry(const char *name, 218static inline struct proc_dir_entry *create_proc_entry(const char *name,
213 mode_t mode, struct proc_dir_entry *parent) { return NULL; } 219 mode_t mode, struct proc_dir_entry *parent) { return NULL; }
@@ -232,6 +238,15 @@ static inline void proc_tty_unregister_driver(struct tty_driver *driver) {};
232 238
233extern struct proc_dir_entry proc_root; 239extern struct proc_dir_entry proc_root;
234 240
241static inline int pid_ns_prepare_proc(struct pid_namespace *ns)
242{
243 return 0;
244}
245
246static inline void pid_ns_release_proc(struct pid_namespace *ns)
247{
248}
249
235#endif /* CONFIG_PROC_FS */ 250#endif /* CONFIG_PROC_FS */
236 251
237#if !defined(CONFIG_PROC_KCORE) 252#if !defined(CONFIG_PROC_KCORE)
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 8dcf237d3386..72bfccd3da22 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -85,7 +85,7 @@ void reiserfs_warning(struct super_block *s, const char *fmt, ...);
85if( !( cond ) ) \ 85if( !( cond ) ) \
86 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \ 86 reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
87 __FILE__ ":%i:%s: " format "\n", \ 87 __FILE__ ":%i:%s: " format "\n", \
88 in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args ) 88 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __FUNCTION__ , ##args )
89 89
90#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args) 90#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
91 91
@@ -283,6 +283,18 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
283 return sb->s_fs_info; 283 return sb->s_fs_info;
284} 284}
285 285
286/* Don't trust REISERFS_SB(sb)->s_bmap_nr, it's a u16
287 * which overflows on large file systems. */
288static inline u32 reiserfs_bmap_count(struct super_block *sb)
289{
290 return (SB_BLOCK_COUNT(sb) - 1) / (sb->s_blocksize * 8) + 1;
291}
292
293static inline int bmap_would_wrap(unsigned bmap_nr)
294{
295 return bmap_nr > ((1LL << 16) - 1);
296}
297
286/** this says about version of key of all items (but stat data) the 298/** this says about version of key of all items (but stat data) the
287 object consists of */ 299 object consists of */
288#define get_inode_item_key_version( inode ) \ 300#define get_inode_item_key_version( inode ) \
@@ -1734,8 +1746,8 @@ int journal_end_sync(struct reiserfs_transaction_handle *, struct super_block *,
1734int journal_mark_freed(struct reiserfs_transaction_handle *, 1746int journal_mark_freed(struct reiserfs_transaction_handle *,
1735 struct super_block *, b_blocknr_t blocknr); 1747 struct super_block *, b_blocknr_t blocknr);
1736int journal_transaction_should_end(struct reiserfs_transaction_handle *, int); 1748int journal_transaction_should_end(struct reiserfs_transaction_handle *, int);
1737int reiserfs_in_journal(struct super_block *p_s_sb, int bmap_nr, int bit_nr, 1749int reiserfs_in_journal(struct super_block *p_s_sb, unsigned int bmap_nr,
1738 int searchall, b_blocknr_t * next); 1750 int bit_nr, int searchall, b_blocknr_t *next);
1739int journal_begin(struct reiserfs_transaction_handle *, 1751int journal_begin(struct reiserfs_transaction_handle *,
1740 struct super_block *p_s_sb, unsigned long); 1752 struct super_block *p_s_sb, unsigned long);
1741int journal_join_abort(struct reiserfs_transaction_handle *, 1753int journal_join_abort(struct reiserfs_transaction_handle *,
@@ -1743,7 +1755,7 @@ int journal_join_abort(struct reiserfs_transaction_handle *,
1743void reiserfs_journal_abort(struct super_block *sb, int errno); 1755void reiserfs_journal_abort(struct super_block *sb, int errno);
1744void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...); 1756void reiserfs_abort(struct super_block *sb, int errno, const char *fmt, ...);
1745int reiserfs_allocate_list_bitmaps(struct super_block *s, 1757int reiserfs_allocate_list_bitmaps(struct super_block *s,
1746 struct reiserfs_list_bitmap *, int); 1758 struct reiserfs_list_bitmap *, unsigned int);
1747 1759
1748void add_save_link(struct reiserfs_transaction_handle *th, 1760void add_save_link(struct reiserfs_transaction_handle *th,
1749 struct inode *inode, int truncate); 1761 struct inode *inode, int truncate);
@@ -2041,7 +2053,7 @@ struct buffer_head *get_FEB(struct tree_balance *);
2041 * arguments, such as node, search path, transaction_handle, etc. */ 2053 * arguments, such as node, search path, transaction_handle, etc. */
2042struct __reiserfs_blocknr_hint { 2054struct __reiserfs_blocknr_hint {
2043 struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */ 2055 struct inode *inode; /* inode passed to allocator, if we allocate unf. nodes */
2044 long block; /* file offset, in blocks */ 2056 sector_t block; /* file offset, in blocks */
2045 struct in_core_key key; 2057 struct in_core_key key;
2046 struct treepath *path; /* search path, used by allocator to deternine search_start by 2058 struct treepath *path; /* search path, used by allocator to deternine search_start by
2047 * various ways */ 2059 * various ways */
@@ -2099,7 +2111,8 @@ static inline int reiserfs_new_form_blocknrs(struct tree_balance *tb,
2099static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle 2111static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle
2100 *th, struct inode *inode, 2112 *th, struct inode *inode,
2101 b_blocknr_t * new_blocknrs, 2113 b_blocknr_t * new_blocknrs,
2102 struct treepath *path, long block) 2114 struct treepath *path,
2115 sector_t block)
2103{ 2116{
2104 reiserfs_blocknr_hint_t hint = { 2117 reiserfs_blocknr_hint_t hint = {
2105 .th = th, 2118 .th = th,
@@ -2116,7 +2129,8 @@ static inline int reiserfs_new_unf_blocknrs(struct reiserfs_transaction_handle
2116static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle 2129static inline int reiserfs_new_unf_blocknrs2(struct reiserfs_transaction_handle
2117 *th, struct inode *inode, 2130 *th, struct inode *inode,
2118 b_blocknr_t * new_blocknrs, 2131 b_blocknr_t * new_blocknrs,
2119 struct treepath *path, long block) 2132 struct treepath *path,
2133 sector_t block)
2120{ 2134{
2121 reiserfs_blocknr_hint_t hint = { 2135 reiserfs_blocknr_hint_t hint = {
2122 .th = th, 2136 .th = th,
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index ff9e9234f8ba..10fa0c832018 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -265,9 +265,7 @@ enum journal_state_bits {
265typedef __u32(*hashf_t) (const signed char *, int); 265typedef __u32(*hashf_t) (const signed char *, int);
266 266
267struct reiserfs_bitmap_info { 267struct reiserfs_bitmap_info {
268 // FIXME: Won't work with block sizes > 8K 268 __u32 free_count;
269 __u16 first_zero_hint;
270 __u16 free_count;
271}; 269};
272 270
273struct proc_dir_entry; 271struct proc_dir_entry;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c204ab0d4df1..13df99fb2769 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -25,6 +25,7 @@
25#define CLONE_NEWUTS 0x04000000 /* New utsname group? */ 25#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
26#define CLONE_NEWIPC 0x08000000 /* New ipcs */ 26#define CLONE_NEWIPC 0x08000000 /* New ipcs */
27#define CLONE_NEWUSER 0x10000000 /* New user namespace */ 27#define CLONE_NEWUSER 0x10000000 /* New user namespace */
28#define CLONE_NEWPID 0x20000000 /* New pid namespace */
28#define CLONE_NEWNET 0x40000000 /* New network namespace */ 29#define CLONE_NEWNET 0x40000000 /* New network namespace */
29 30
30/* 31/*
@@ -428,7 +429,17 @@ struct signal_struct {
428 cputime_t it_prof_incr, it_virt_incr; 429 cputime_t it_prof_incr, it_virt_incr;
429 430
430 /* job control IDs */ 431 /* job control IDs */
431 pid_t pgrp; 432
433 /*
434 * pgrp and session fields are deprecated.
435 * use the task_session_Xnr and task_pgrp_Xnr routines below
436 */
437
438 union {
439 pid_t pgrp __deprecated;
440 pid_t __pgrp;
441 };
442
432 struct pid *tty_old_pgrp; 443 struct pid *tty_old_pgrp;
433 444
434 union { 445 union {
@@ -569,7 +580,7 @@ struct sched_info {
569 last_queued; /* when we were last queued to run */ 580 last_queued; /* when we were last queued to run */
570#ifdef CONFIG_SCHEDSTATS 581#ifdef CONFIG_SCHEDSTATS
571 /* BKL stats */ 582 /* BKL stats */
572 unsigned long bkl_count; 583 unsigned int bkl_count;
573#endif 584#endif
574}; 585};
575#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 586#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
@@ -705,37 +716,39 @@ struct sched_domain {
705 716
706#ifdef CONFIG_SCHEDSTATS 717#ifdef CONFIG_SCHEDSTATS
707 /* load_balance() stats */ 718 /* load_balance() stats */
708 unsigned long lb_count[CPU_MAX_IDLE_TYPES]; 719 unsigned int lb_count[CPU_MAX_IDLE_TYPES];
709 unsigned long lb_failed[CPU_MAX_IDLE_TYPES]; 720 unsigned int lb_failed[CPU_MAX_IDLE_TYPES];
710 unsigned long lb_balanced[CPU_MAX_IDLE_TYPES]; 721 unsigned int lb_balanced[CPU_MAX_IDLE_TYPES];
711 unsigned long lb_imbalance[CPU_MAX_IDLE_TYPES]; 722 unsigned int lb_imbalance[CPU_MAX_IDLE_TYPES];
712 unsigned long lb_gained[CPU_MAX_IDLE_TYPES]; 723 unsigned int lb_gained[CPU_MAX_IDLE_TYPES];
713 unsigned long lb_hot_gained[CPU_MAX_IDLE_TYPES]; 724 unsigned int lb_hot_gained[CPU_MAX_IDLE_TYPES];
714 unsigned long lb_nobusyg[CPU_MAX_IDLE_TYPES]; 725 unsigned int lb_nobusyg[CPU_MAX_IDLE_TYPES];
715 unsigned long lb_nobusyq[CPU_MAX_IDLE_TYPES]; 726 unsigned int lb_nobusyq[CPU_MAX_IDLE_TYPES];
716 727
717 /* Active load balancing */ 728 /* Active load balancing */
718 unsigned long alb_count; 729 unsigned int alb_count;
719 unsigned long alb_failed; 730 unsigned int alb_failed;
720 unsigned long alb_pushed; 731 unsigned int alb_pushed;
721 732
722 /* SD_BALANCE_EXEC stats */ 733 /* SD_BALANCE_EXEC stats */
723 unsigned long sbe_count; 734 unsigned int sbe_count;
724 unsigned long sbe_balanced; 735 unsigned int sbe_balanced;
725 unsigned long sbe_pushed; 736 unsigned int sbe_pushed;
726 737
727 /* SD_BALANCE_FORK stats */ 738 /* SD_BALANCE_FORK stats */
728 unsigned long sbf_count; 739 unsigned int sbf_count;
729 unsigned long sbf_balanced; 740 unsigned int sbf_balanced;
730 unsigned long sbf_pushed; 741 unsigned int sbf_pushed;
731 742
732 /* try_to_wake_up() stats */ 743 /* try_to_wake_up() stats */
733 unsigned long ttwu_wake_remote; 744 unsigned int ttwu_wake_remote;
734 unsigned long ttwu_move_affine; 745 unsigned int ttwu_move_affine;
735 unsigned long ttwu_move_balance; 746 unsigned int ttwu_move_balance;
736#endif 747#endif
737}; 748};
738 749
750extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new);
751
739#endif /* CONFIG_SMP */ 752#endif /* CONFIG_SMP */
740 753
741/* 754/*
@@ -756,8 +769,6 @@ static inline int above_background_load(void)
756} 769}
757 770
758struct io_context; /* See blkdev.h */ 771struct io_context; /* See blkdev.h */
759struct cpuset;
760
761#define NGROUPS_SMALL 32 772#define NGROUPS_SMALL 32
762#define NGROUPS_PER_BLOCK ((int)(PAGE_SIZE / sizeof(gid_t))) 773#define NGROUPS_PER_BLOCK ((int)(PAGE_SIZE / sizeof(gid_t)))
763struct group_info { 774struct group_info {
@@ -991,7 +1002,7 @@ struct task_struct {
991 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */ 1002 int __user *clear_child_tid; /* CLONE_CHILD_CLEARTID */
992 1003
993 unsigned int rt_priority; 1004 unsigned int rt_priority;
994 cputime_t utime, stime; 1005 cputime_t utime, stime, utimescaled, stimescaled;
995 cputime_t gtime; 1006 cputime_t gtime;
996 unsigned long nvcsw, nivcsw; /* context switch counts */ 1007 unsigned long nvcsw, nivcsw; /* context switch counts */
997 struct timespec start_time; /* monotonic time */ 1008 struct timespec start_time; /* monotonic time */
@@ -1110,13 +1121,6 @@ struct task_struct {
1110 1121
1111 unsigned long ptrace_message; 1122 unsigned long ptrace_message;
1112 siginfo_t *last_siginfo; /* For ptrace use. */ 1123 siginfo_t *last_siginfo; /* For ptrace use. */
1113/*
1114 * current io wait handle: wait queue entry to use for io waits
1115 * If this thread is processing aio, this points at the waitqueue
1116 * inside the currently handled kiocb. It may be NULL (i.e. default
1117 * to a stack based synchronous wait) if its doing sync IO.
1118 */
1119 wait_queue_t *io_wait;
1120#ifdef CONFIG_TASK_XACCT 1124#ifdef CONFIG_TASK_XACCT
1121/* i/o counters(bytes read/written, #syscalls */ 1125/* i/o counters(bytes read/written, #syscalls */
1122 u64 rchar, wchar, syscr, syscw; 1126 u64 rchar, wchar, syscr, syscw;
@@ -1132,11 +1136,16 @@ struct task_struct {
1132 short il_next; 1136 short il_next;
1133#endif 1137#endif
1134#ifdef CONFIG_CPUSETS 1138#ifdef CONFIG_CPUSETS
1135 struct cpuset *cpuset;
1136 nodemask_t mems_allowed; 1139 nodemask_t mems_allowed;
1137 int cpuset_mems_generation; 1140 int cpuset_mems_generation;
1138 int cpuset_mem_spread_rotor; 1141 int cpuset_mem_spread_rotor;
1139#endif 1142#endif
1143#ifdef CONFIG_CGROUPS
1144 /* Control Group info protected by css_set_lock */
1145 struct css_set *cgroups;
1146 /* cg_list protected by css_set_lock and tsk->alloc_lock */
1147 struct list_head cg_list;
1148#endif
1140#ifdef CONFIG_FUTEX 1149#ifdef CONFIG_FUTEX
1141 struct robust_list_head __user *robust_list; 1150 struct robust_list_head __user *robust_list;
1142#ifdef CONFIG_COMPAT 1151#ifdef CONFIG_COMPAT
@@ -1192,24 +1201,14 @@ static inline int rt_task(struct task_struct *p)
1192 return rt_prio(p->prio); 1201 return rt_prio(p->prio);
1193} 1202}
1194 1203
1195static inline pid_t process_group(struct task_struct *tsk) 1204static inline void set_task_session(struct task_struct *tsk, pid_t session)
1196{
1197 return tsk->signal->pgrp;
1198}
1199
1200static inline pid_t signal_session(struct signal_struct *sig)
1201{ 1205{
1202 return sig->__session; 1206 tsk->signal->__session = session;
1203} 1207}
1204 1208
1205static inline pid_t process_session(struct task_struct *tsk) 1209static inline void set_task_pgrp(struct task_struct *tsk, pid_t pgrp)
1206{ 1210{
1207 return signal_session(tsk->signal); 1211 tsk->signal->__pgrp = pgrp;
1208}
1209
1210static inline void set_signal_session(struct signal_struct *sig, pid_t session)
1211{
1212 sig->__session = session;
1213} 1212}
1214 1213
1215static inline struct pid *task_pid(struct task_struct *task) 1214static inline struct pid *task_pid(struct task_struct *task)
@@ -1232,6 +1231,88 @@ static inline struct pid *task_session(struct task_struct *task)
1232 return task->group_leader->pids[PIDTYPE_SID].pid; 1231 return task->group_leader->pids[PIDTYPE_SID].pid;
1233} 1232}
1234 1233
1234struct pid_namespace;
1235
1236/*
1237 * the helpers to get the task's different pids as they are seen
1238 * from various namespaces
1239 *
1240 * task_xid_nr() : global id, i.e. the id seen from the init namespace;
1241 * task_xid_vnr() : virtual id, i.e. the id seen from the namespace the task
1242 * belongs to. this only makes sence when called in the
1243 * context of the task that belongs to the same namespace;
1244 * task_xid_nr_ns() : id seen from the ns specified;
1245 *
1246 * set_task_vxid() : assigns a virtual id to a task;
1247 *
1248 * task_ppid_nr_ns() : the parent's id as seen from the namespace specified.
1249 * the result depends on the namespace and whether the
1250 * task in question is the namespace's init. e.g. for the
1251 * namespace's init this will return 0 when called from
1252 * the namespace of this init, or appropriate id otherwise.
1253 *
1254 *
1255 * see also pid_nr() etc in include/linux/pid.h
1256 */
1257
1258static inline pid_t task_pid_nr(struct task_struct *tsk)
1259{
1260 return tsk->pid;
1261}
1262
1263pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1264
1265static inline pid_t task_pid_vnr(struct task_struct *tsk)
1266{
1267 return pid_vnr(task_pid(tsk));
1268}
1269
1270
1271static inline pid_t task_tgid_nr(struct task_struct *tsk)
1272{
1273 return tsk->tgid;
1274}
1275
1276pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1277
1278static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1279{
1280 return pid_vnr(task_tgid(tsk));
1281}
1282
1283
1284static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1285{
1286 return tsk->signal->__pgrp;
1287}
1288
1289pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1290
1291static inline pid_t task_pgrp_vnr(struct task_struct *tsk)
1292{
1293 return pid_vnr(task_pgrp(tsk));
1294}
1295
1296
1297static inline pid_t task_session_nr(struct task_struct *tsk)
1298{
1299 return tsk->signal->__session;
1300}
1301
1302pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1303
1304static inline pid_t task_session_vnr(struct task_struct *tsk)
1305{
1306 return pid_vnr(task_session(tsk));
1307}
1308
1309
1310static inline pid_t task_ppid_nr_ns(struct task_struct *tsk,
1311 struct pid_namespace *ns)
1312{
1313 return pid_nr_ns(task_pid(rcu_dereference(tsk->real_parent)), ns);
1314}
1315
1235/** 1316/**
1236 * pid_alive - check that a task structure is not stale 1317 * pid_alive - check that a task structure is not stale
1237 * @p: Task structure to be checked. 1318 * @p: Task structure to be checked.
@@ -1246,16 +1327,22 @@ static inline int pid_alive(struct task_struct *p)
1246} 1327}
1247 1328
1248/** 1329/**
1249 * is_init - check if a task structure is init 1330 * is_global_init - check if a task structure is init
1250 * @tsk: Task structure to be checked. 1331 * @tsk: Task structure to be checked.
1251 * 1332 *
1252 * Check if a task structure is the first user space task the kernel created. 1333 * Check if a task structure is the first user space task the kernel created.
1253 */ 1334 */
1254static inline int is_init(struct task_struct *tsk) 1335static inline int is_global_init(struct task_struct *tsk)
1255{ 1336{
1256 return tsk->pid == 1; 1337 return tsk->pid == 1;
1257} 1338}
1258 1339
1340/*
1341 * is_container_init:
1342 * check whether in the task is init in its own pid namespace.
1343 */
1344extern int is_container_init(struct task_struct *tsk);
1345
1259extern struct pid *cad_pid; 1346extern struct pid *cad_pid;
1260 1347
1261extern void free_task(struct task_struct *tsk); 1348extern void free_task(struct task_struct *tsk);
@@ -1427,8 +1514,32 @@ extern struct task_struct init_task;
1427 1514
1428extern struct mm_struct init_mm; 1515extern struct mm_struct init_mm;
1429 1516
1430#define find_task_by_pid(nr) find_task_by_pid_type(PIDTYPE_PID, nr) 1517extern struct pid_namespace init_pid_ns;
1431extern struct task_struct *find_task_by_pid_type(int type, int pid); 1518
1519/*
1520 * find a task by one of its numerical ids
1521 *
1522 * find_task_by_pid_type_ns():
1523 * it is the most generic call - it finds a task by all id,
1524 * type and namespace specified
1525 * find_task_by_pid_ns():
1526 * finds a task by its pid in the specified namespace
1527 * find_task_by_vpid():
1528 * finds a task by its virtual pid
1529 * find_task_by_pid():
1530 * finds a task by its global pid
1531 *
1532 * see also find_pid() etc in include/linux/pid.h
1533 */
1534
1535extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
1536 struct pid_namespace *ns);
1537
1538extern struct task_struct *find_task_by_pid(pid_t nr);
1539extern struct task_struct *find_task_by_vpid(pid_t nr);
1540extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1541 struct pid_namespace *ns);
1542
1432extern void __set_special_pids(pid_t session, pid_t pgrp); 1543extern void __set_special_pids(pid_t session, pid_t pgrp);
1433 1544
1434/* per-UID process charging. */ 1545/* per-UID process charging. */
@@ -1615,6 +1726,12 @@ static inline int has_group_leader_pid(struct task_struct *p)
1615 return p->pid == p->tgid; 1726 return p->pid == p->tgid;
1616} 1727}
1617 1728
1729static inline
1730int same_thread_group(struct task_struct *p1, struct task_struct *p2)
1731{
1732 return p1->tgid == p2->tgid;
1733}
1734
1618static inline struct task_struct *next_thread(const struct task_struct *p) 1735static inline struct task_struct *next_thread(const struct task_struct *p)
1619{ 1736{
1620 return list_entry(rcu_dereference(p->thread_group.next), 1737 return list_entry(rcu_dereference(p->thread_group.next),
@@ -1632,7 +1749,8 @@ static inline int thread_group_empty(struct task_struct *p)
1632/* 1749/*
1633 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 1750 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
1634 * subscriptions and synchronises with wait4(). Also used in procfs. Also 1751 * subscriptions and synchronises with wait4(). Also used in procfs. Also
1635 * pins the final release of task.io_context. Also protects ->cpuset. 1752 * pins the final release of task.io_context. Also protects ->cpuset and
1753 * ->cgroup.subsys[].
1636 * 1754 *
1637 * Nests both inside and outside of read_lock(&tasklist_lock). 1755 * Nests both inside and outside of read_lock(&tasklist_lock).
1638 * It must not be nested with write_lock_irq(&tasklist_lock), 1756 * It must not be nested with write_lock_irq(&tasklist_lock),
diff --git a/include/linux/security.h b/include/linux/security.h
index 9b0b63c50f44..ac050830a873 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -34,6 +34,13 @@
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <net/flow.h> 35#include <net/flow.h>
36 36
37/*
38 * Bounding set
39 */
40extern kernel_cap_t cap_bset;
41
42extern unsigned securebits;
43
37struct ctl_table; 44struct ctl_table;
38 45
39/* 46/*
@@ -825,9 +832,11 @@ struct request_sock;
825 * incoming sk_buff @skb has been associated with a particular socket, @sk. 832 * incoming sk_buff @skb has been associated with a particular socket, @sk.
826 * @sk contains the sock (not socket) associated with the incoming sk_buff. 833 * @sk contains the sock (not socket) associated with the incoming sk_buff.
827 * @skb contains the incoming network data. 834 * @skb contains the incoming network data.
828 * @socket_getpeersec: 835 * @socket_getpeersec_stream:
829 * This hook allows the security module to provide peer socket security 836 * This hook allows the security module to provide peer socket security
830 * state to userspace via getsockopt SO_GETPEERSEC. 837 * state for unix or connected tcp sockets to userspace via getsockopt
838 * SO_GETPEERSEC. For tcp sockets this can be meaningful if the
839 * socket is associated with an ipsec SA.
831 * @sock is the local socket. 840 * @sock is the local socket.
832 * @optval userspace memory where the security state is to be copied. 841 * @optval userspace memory where the security state is to be copied.
833 * @optlen userspace int where the module should copy the actual length 842 * @optlen userspace int where the module should copy the actual length
@@ -836,6 +845,17 @@ struct request_sock;
836 * by the caller. 845 * by the caller.
837 * Return 0 if all is well, otherwise, typical getsockopt return 846 * Return 0 if all is well, otherwise, typical getsockopt return
838 * values. 847 * values.
848 * @socket_getpeersec_dgram:
849 * This hook allows the security module to provide peer socket security
850 * state for udp sockets on a per-packet basis to userspace via
851 * getsockopt SO_GETPEERSEC. The application must first have indicated
852 * the IP_PASSSEC option via getsockopt. It can then retrieve the
853 * security state returned by this hook for a packet via the SCM_SECURITY
854 * ancillary message type.
855 * @skb is the skbuff for the packet being queried
856 * @secdata is a pointer to a buffer in which to copy the security data
857 * @seclen is the maximum length for @secdata
858 * Return 0 on success, error on failure.
839 * @sk_alloc_security: 859 * @sk_alloc_security:
840 * Allocate and attach a security structure to the sk->sk_security field, 860 * Allocate and attach a security structure to the sk->sk_security field,
841 * which is used to copy security attributes between local stream sockets. 861 * which is used to copy security attributes between local stream sockets.
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 9aaffb0b1d81..c8eaad9e4b72 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -90,7 +90,6 @@ struct sem {
90/* One sem_array data structure for each set of semaphores in the system. */ 90/* One sem_array data structure for each set of semaphores in the system. */
91struct sem_array { 91struct sem_array {
92 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */ 92 struct kern_ipc_perm sem_perm; /* permissions .. see ipc.h */
93 int sem_id;
94 time_t sem_otime; /* last semop time */ 93 time_t sem_otime; /* last semop time */
95 time_t sem_ctime; /* last change time */ 94 time_t sem_ctime; /* last change time */
96 struct sem *sem_base; /* ptr to first semaphore in array */ 95 struct sem *sem_base; /* ptr to first semaphore in array */
diff --git a/include/linux/shm.h b/include/linux/shm.h
index bea65d9c93ef..eeaed921a1dc 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -79,7 +79,6 @@ struct shmid_kernel /* private to the kernel */
79{ 79{
80 struct kern_ipc_perm shm_perm; 80 struct kern_ipc_perm shm_perm;
81 struct file * shm_file; 81 struct file * shm_file;
82 int id;
83 unsigned long shm_nattch; 82 unsigned long shm_nattch;
84 unsigned long shm_segsz; 83 unsigned long shm_segsz;
85 time_t shm_atim; 84 time_t shm_atim;
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 388cace9751f..4360e0816956 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -1,5 +1,5 @@
1#ifndef _LINUX_SWSUSP_H 1#ifndef _LINUX_SUSPEND_H
2#define _LINUX_SWSUSP_H 2#define _LINUX_SUSPEND_H
3 3
4#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64) 4#if defined(CONFIG_X86) || defined(CONFIG_FRV) || defined(CONFIG_PPC32) || defined(CONFIG_PPC64)
5#include <asm/suspend.h> 5#include <asm/suspend.h>
@@ -9,6 +9,108 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/pm.h> 10#include <linux/pm.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <asm/errno.h>
13
14#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
15extern int pm_prepare_console(void);
16extern void pm_restore_console(void);
17#else
18static inline int pm_prepare_console(void) { return 0; }
19static inline void pm_restore_console(void) {}
20#endif
21
22typedef int __bitwise suspend_state_t;
23
24#define PM_SUSPEND_ON ((__force suspend_state_t) 0)
25#define PM_SUSPEND_STANDBY ((__force suspend_state_t) 1)
26#define PM_SUSPEND_MEM ((__force suspend_state_t) 3)
27#define PM_SUSPEND_MAX ((__force suspend_state_t) 4)
28
29/**
30 * struct platform_suspend_ops - Callbacks for managing platform dependent
31 * system sleep states.
32 *
33 * @valid: Callback to determine if given system sleep state is supported by
34 * the platform.
35 * Valid (ie. supported) states are advertised in /sys/power/state. Note
36 * that it still may be impossible to enter given system sleep state if the
37 * conditions aren't right.
38 * There is the %suspend_valid_only_mem function available that can be
39 * assigned to this if the platform only supports mem sleep.
40 *
41 * @set_target: Tell the platform which system sleep state is going to be
42 * entered.
43 * @set_target() is executed right prior to suspending devices. The
44 * information conveyed to the platform code by @set_target() should be
45 * disregarded by the platform as soon as @finish() is executed and if
46 * @prepare() fails. If @set_target() fails (ie. returns nonzero),
47 * @prepare(), @enter() and @finish() will not be called by the PM core.
48 * This callback is optional. However, if it is implemented, the argument
49 * passed to @enter() is meaningless and should be ignored.
50 *
51 * @prepare: Prepare the platform for entering the system sleep state indicated
52 * by @set_target().
53 * @prepare() is called right after devices have been suspended (ie. the
54 * appropriate .suspend() method has been executed for each device) and
55 * before the nonboot CPUs are disabled (it is executed with IRQs enabled).
56 * This callback is optional. It returns 0 on success or a negative
57 * error code otherwise, in which case the system cannot enter the desired
58 * sleep state (@enter() and @finish() will not be called in that case).
59 *
60 * @enter: Enter the system sleep state indicated by @set_target() or
61 * represented by the argument if @set_target() is not implemented.
62 * This callback is mandatory. It returns 0 on success or a negative
63 * error code otherwise, in which case the system cannot enter the desired
64 * sleep state.
65 *
66 * @finish: Called when the system has just left a sleep state, right after
67 * the nonboot CPUs have been enabled and before devices are resumed (it is
68 * executed with IRQs enabled).
69 * This callback is optional, but should be implemented by the platforms
70 * that implement @prepare(). If implemented, it is always called after
71 * @enter() (even if @enter() fails).
72 */
73struct platform_suspend_ops {
74 int (*valid)(suspend_state_t state);
75 int (*set_target)(suspend_state_t state);
76 int (*prepare)(void);
77 int (*enter)(suspend_state_t state);
78 void (*finish)(void);
79};
80
81#ifdef CONFIG_SUSPEND
82/**
83 * suspend_set_ops - set platform dependent suspend operations
84 * @ops: The new suspend operations to set.
85 */
86extern void suspend_set_ops(struct platform_suspend_ops *ops);
87extern int suspend_valid_only_mem(suspend_state_t state);
88
89/**
90 * arch_suspend_disable_irqs - disable IRQs for suspend
91 *
92 * Disables IRQs (in the default case). This is a weak symbol in the common
93 * code and thus allows architectures to override it if more needs to be
94 * done. Not called for suspend to disk.
95 */
96extern void arch_suspend_disable_irqs(void);
97
98/**
99 * arch_suspend_enable_irqs - enable IRQs after suspend
100 *
101 * Enables IRQs (in the default case). This is a weak symbol in the common
102 * code and thus allows architectures to override it if more needs to be
103 * done. Not called for suspend to disk.
104 */
105extern void arch_suspend_enable_irqs(void);
106
107extern int pm_suspend(suspend_state_t state);
108#else /* !CONFIG_SUSPEND */
109#define suspend_valid_only_mem NULL
110
111static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
112static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
113#endif /* !CONFIG_SUSPEND */
12 114
13/* struct pbe is used for creating lists of pages that should be restored 115/* struct pbe is used for creating lists of pages that should be restored
14 * atomically during the resume from disk, because the page frames they have 116 * atomically during the resume from disk, because the page frames they have
@@ -24,32 +126,57 @@ struct pbe {
24extern void drain_local_pages(void); 126extern void drain_local_pages(void);
25extern void mark_free_pages(struct zone *zone); 127extern void mark_free_pages(struct zone *zone);
26 128
27#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
28extern int pm_prepare_console(void);
29extern void pm_restore_console(void);
30#else
31static inline int pm_prepare_console(void) { return 0; }
32static inline void pm_restore_console(void) {}
33#endif
34
35/** 129/**
36 * struct hibernation_ops - hibernation platform support 130 * struct platform_hibernation_ops - hibernation platform support
37 * 131 *
38 * The methods in this structure allow a platform to override the default 132 * The methods in this structure allow a platform to override the default
39 * mechanism of shutting down the machine during a hibernation transition. 133 * mechanism of shutting down the machine during a hibernation transition.
40 * 134 *
41 * All three methods must be assigned. 135 * All three methods must be assigned.
42 * 136 *
43 * @prepare: prepare system for hibernation 137 * @start: Tell the platform driver that we're starting hibernation.
44 * @enter: shut down system after state has been saved to disk 138 * Called right after shrinking memory and before freezing devices.
45 * @finish: finish/clean up after state has been reloaded 139 *
46 * @pre_restore: prepare system for the restoration from a hibernation image 140 * @pre_snapshot: Prepare the platform for creating the hibernation image.
47 * @restore_cleanup: clean up after a failing image restoration 141 * Called right after devices have been frozen and before the nonboot
142 * CPUs are disabled (runs with IRQs on).
143 *
144 * @finish: Restore the previous state of the platform after the hibernation
145 * image has been created *or* put the platform into the normal operation
146 * mode after the hibernation (the same method is executed in both cases).
147 * Called right after the nonboot CPUs have been enabled and before
148 * thawing devices (runs with IRQs on).
149 *
150 * @prepare: Prepare the platform for entering the low power state.
151 * Called right after the hibernation image has been saved and before
152 * devices are prepared for entering the low power state.
153 *
154 * @enter: Put the system into the low power state after the hibernation image
155 * has been saved to disk.
156 * Called after the nonboot CPUs have been disabled and all of the low
157 * level devices have been shut down (runs with IRQs off).
158 *
159 * @leave: Perform the first stage of the cleanup after the system sleep state
160 * indicated by @set_target() has been left.
161 * Called right after the control has been passed from the boot kernel to
162 * the image kernel, before the nonboot CPUs are enabled and before devices
163 * are resumed. Executed with interrupts disabled.
164 *
165 * @pre_restore: Prepare system for the restoration from a hibernation image.
166 * Called right after devices have been frozen and before the nonboot
167 * CPUs are disabled (runs with IRQs on).
168 *
169 * @restore_cleanup: Clean up after a failing image restoration.
170 * Called right after the nonboot CPUs have been enabled and before
171 * thawing devices (runs with IRQs on).
48 */ 172 */
49struct hibernation_ops { 173struct platform_hibernation_ops {
174 int (*start)(void);
175 int (*pre_snapshot)(void);
176 void (*finish)(void);
50 int (*prepare)(void); 177 int (*prepare)(void);
51 int (*enter)(void); 178 int (*enter)(void);
52 void (*finish)(void); 179 void (*leave)(void);
53 int (*pre_restore)(void); 180 int (*pre_restore)(void);
54 void (*restore_cleanup)(void); 181 void (*restore_cleanup)(void);
55}; 182};
@@ -70,14 +197,14 @@ extern void swsusp_set_page_free(struct page *);
70extern void swsusp_unset_page_free(struct page *); 197extern void swsusp_unset_page_free(struct page *);
71extern unsigned long get_safe_page(gfp_t gfp_mask); 198extern unsigned long get_safe_page(gfp_t gfp_mask);
72 199
73extern void hibernation_set_ops(struct hibernation_ops *ops); 200extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
74extern int hibernate(void); 201extern int hibernate(void);
75#else /* CONFIG_HIBERNATION */ 202#else /* CONFIG_HIBERNATION */
76static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 203static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
77static inline void swsusp_set_page_free(struct page *p) {} 204static inline void swsusp_set_page_free(struct page *p) {}
78static inline void swsusp_unset_page_free(struct page *p) {} 205static inline void swsusp_unset_page_free(struct page *p) {}
79 206
80static inline void hibernation_set_ops(struct hibernation_ops *ops) {} 207static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
81static inline int hibernate(void) { return -ENOSYS; } 208static inline int hibernate(void) { return -ENOSYS; }
82#endif /* CONFIG_HIBERNATION */ 209#endif /* CONFIG_HIBERNATION */
83 210
@@ -130,4 +257,4 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
130} 257}
131#endif 258#endif
132 259
133#endif /* _LINUX_SWSUSP_H */ 260#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 483050c924c3..e99171f01b4c 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -238,6 +238,7 @@ enum
238 NET_LLC=18, 238 NET_LLC=18,
239 NET_NETFILTER=19, 239 NET_NETFILTER=19,
240 NET_DCCP=20, 240 NET_DCCP=20,
241 NET_IRDA=412,
241}; 242};
242 243
243/* /proc/sys/kernel/random */ 244/* /proc/sys/kernel/random */
@@ -795,6 +796,25 @@ enum {
795 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5, 796 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
796}; 797};
797 798
799/* proc/sys/net/irda */
800enum {
801 NET_IRDA_DISCOVERY=1,
802 NET_IRDA_DEVNAME=2,
803 NET_IRDA_DEBUG=3,
804 NET_IRDA_FAST_POLL=4,
805 NET_IRDA_DISCOVERY_SLOTS=5,
806 NET_IRDA_DISCOVERY_TIMEOUT=6,
807 NET_IRDA_SLOT_TIMEOUT=7,
808 NET_IRDA_MAX_BAUD_RATE=8,
809 NET_IRDA_MIN_TX_TURN_TIME=9,
810 NET_IRDA_MAX_TX_DATA_SIZE=10,
811 NET_IRDA_MAX_TX_WINDOW=11,
812 NET_IRDA_MAX_NOREPLY_TIME=12,
813 NET_IRDA_WARN_NOREPLY_TIME=13,
814 NET_IRDA_LAP_KEEPALIVE_TIME=14,
815};
816
817
798/* CTL_FS names: */ 818/* CTL_FS names: */
799enum 819enum
800{ 820{
@@ -937,41 +957,42 @@ extern int sysctl_perm(struct ctl_table *table, int op);
937 957
938typedef struct ctl_table ctl_table; 958typedef struct ctl_table ctl_table;
939 959
940typedef int ctl_handler (ctl_table *table, int __user *name, int nlen, 960typedef int ctl_handler (struct ctl_table *table, int __user *name, int nlen,
941 void __user *oldval, size_t __user *oldlenp, 961 void __user *oldval, size_t __user *oldlenp,
942 void __user *newval, size_t newlen); 962 void __user *newval, size_t newlen);
943 963
944typedef int proc_handler (ctl_table *ctl, int write, struct file * filp, 964typedef int proc_handler (struct ctl_table *ctl, int write, struct file * filp,
945 void __user *buffer, size_t *lenp, loff_t *ppos); 965 void __user *buffer, size_t *lenp, loff_t *ppos);
946 966
947extern int proc_dostring(ctl_table *, int, struct file *, 967extern int proc_dostring(struct ctl_table *, int, struct file *,
948 void __user *, size_t *, loff_t *); 968 void __user *, size_t *, loff_t *);
949extern int proc_dointvec(ctl_table *, int, struct file *, 969extern int proc_dointvec(struct ctl_table *, int, struct file *,
950 void __user *, size_t *, loff_t *); 970 void __user *, size_t *, loff_t *);
951extern int proc_dointvec_bset(ctl_table *, int, struct file *, 971extern int proc_dointvec_bset(struct ctl_table *, int, struct file *,
952 void __user *, size_t *, loff_t *); 972 void __user *, size_t *, loff_t *);
953extern int proc_dointvec_minmax(ctl_table *, int, struct file *, 973extern int proc_dointvec_minmax(struct ctl_table *, int, struct file *,
954 void __user *, size_t *, loff_t *); 974 void __user *, size_t *, loff_t *);
955extern int proc_dointvec_jiffies(ctl_table *, int, struct file *, 975extern int proc_dointvec_jiffies(struct ctl_table *, int, struct file *,
956 void __user *, size_t *, loff_t *); 976 void __user *, size_t *, loff_t *);
957extern int proc_dointvec_userhz_jiffies(ctl_table *, int, struct file *, 977extern int proc_dointvec_userhz_jiffies(struct ctl_table *, int, struct file *,
958 void __user *, size_t *, loff_t *); 978 void __user *, size_t *, loff_t *);
959extern int proc_dointvec_ms_jiffies(ctl_table *, int, struct file *, 979extern int proc_dointvec_ms_jiffies(struct ctl_table *, int, struct file *,
960 void __user *, size_t *, loff_t *); 980 void __user *, size_t *, loff_t *);
961extern int proc_doulongvec_minmax(ctl_table *, int, struct file *, 981extern int proc_doulongvec_minmax(struct ctl_table *, int, struct file *,
962 void __user *, size_t *, loff_t *); 982 void __user *, size_t *, loff_t *);
963extern int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int, 983extern int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int,
964 struct file *, void __user *, size_t *, loff_t *); 984 struct file *, void __user *, size_t *, loff_t *);
965 985
966extern int do_sysctl (int __user *name, int nlen, 986extern int do_sysctl (int __user *name, int nlen,
967 void __user *oldval, size_t __user *oldlenp, 987 void __user *oldval, size_t __user *oldlenp,
968 void __user *newval, size_t newlen); 988 void __user *newval, size_t newlen);
969 989
970extern int do_sysctl_strategy (ctl_table *table, 990extern int do_sysctl_strategy (struct ctl_table *table,
971 int __user *name, int nlen, 991 int __user *name, int nlen,
972 void __user *oldval, size_t __user *oldlenp, 992 void __user *oldval, size_t __user *oldlenp,
973 void __user *newval, size_t newlen); 993 void __user *newval, size_t newlen);
974 994
995extern ctl_handler sysctl_data;
975extern ctl_handler sysctl_string; 996extern ctl_handler sysctl_string;
976extern ctl_handler sysctl_intvec; 997extern ctl_handler sysctl_intvec;
977extern ctl_handler sysctl_jiffies; 998extern ctl_handler sysctl_jiffies;
@@ -980,7 +1001,7 @@ extern ctl_handler sysctl_ms_jiffies;
980 1001
981/* 1002/*
982 * Register a set of sysctl names by calling register_sysctl_table 1003 * Register a set of sysctl names by calling register_sysctl_table
983 * with an initialised array of ctl_table's. An entry with zero 1004 * with an initialised array of struct ctl_table's. An entry with zero
984 * ctl_name and NULL procname terminates the table. table->de will be 1005 * ctl_name and NULL procname terminates the table. table->de will be
985 * set up by the registration and need not be initialised in advance. 1006 * set up by the registration and need not be initialised in advance.
986 * 1007 *
@@ -1026,8 +1047,8 @@ struct ctl_table
1026 void *data; 1047 void *data;
1027 int maxlen; 1048 int maxlen;
1028 mode_t mode; 1049 mode_t mode;
1029 ctl_table *child; 1050 struct ctl_table *child;
1030 ctl_table *parent; /* Automatically set */ 1051 struct ctl_table *parent; /* Automatically set */
1031 proc_handler *proc_handler; /* Callback for text formatting */ 1052 proc_handler *proc_handler; /* Callback for text formatting */
1032 ctl_handler *strategy; /* Callback function for all r/w */ 1053 ctl_handler *strategy; /* Callback function for all r/w */
1033 void *extra1; 1054 void *extra1;
@@ -1035,18 +1056,19 @@ struct ctl_table
1035}; 1056};
1036 1057
1037/* struct ctl_table_header is used to maintain dynamic lists of 1058/* struct ctl_table_header is used to maintain dynamic lists of
1038 ctl_table trees. */ 1059 struct ctl_table trees. */
1039struct ctl_table_header 1060struct ctl_table_header
1040{ 1061{
1041 ctl_table *ctl_table; 1062 struct ctl_table *ctl_table;
1042 struct list_head ctl_entry; 1063 struct list_head ctl_entry;
1043 int used; 1064 int used;
1044 struct completion *unregistering; 1065 struct completion *unregistering;
1045}; 1066};
1046 1067
1047struct ctl_table_header * register_sysctl_table(ctl_table * table); 1068struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
1048 1069
1049void unregister_sysctl_table(struct ctl_table_header * table); 1070void unregister_sysctl_table(struct ctl_table_header * table);
1071int sysctl_check_table(struct ctl_table *table);
1050 1072
1051#else /* __KERNEL__ */ 1073#else /* __KERNEL__ */
1052 1074
diff --git a/include/linux/taskstats.h b/include/linux/taskstats.h
index dce1ed204972..5d69c0744fff 100644
--- a/include/linux/taskstats.h
+++ b/include/linux/taskstats.h
@@ -31,7 +31,7 @@
31 */ 31 */
32 32
33 33
34#define TASKSTATS_VERSION 5 34#define TASKSTATS_VERSION 6
35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN 35#define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
36 * in linux/sched.h */ 36 * in linux/sched.h */
37 37
@@ -152,6 +152,11 @@ struct taskstats {
152 152
153 __u64 nvcsw; /* voluntary_ctxt_switches */ 153 __u64 nvcsw; /* voluntary_ctxt_switches */
154 __u64 nivcsw; /* nonvoluntary_ctxt_switches */ 154 __u64 nivcsw; /* nonvoluntary_ctxt_switches */
155
156 /* time accounting for SMT machines */
157 __u64 ac_utimescaled; /* utime scaled on frequency etc */
158 __u64 ac_stimescaled; /* stime scaled on frequency etc */
159 __u64 cpu_scaled_run_real_total; /* scaled cpu_run_real_total */
155}; 160};
156 161
157 162
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 9a7252e089b9..f4a1395e05ff 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -40,6 +40,7 @@ enum tick_nohz_mode {
40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped 40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped
41 * @idle_entrytime: Time when the idle call was entered 41 * @idle_entrytime: Time when the idle call was entered
42 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 42 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
43 * @sleep_length: Duration of the current idle sleep
43 */ 44 */
44struct tick_sched { 45struct tick_sched {
45 struct hrtimer sched_timer; 46 struct hrtimer sched_timer;
@@ -52,6 +53,7 @@ struct tick_sched {
52 unsigned long idle_sleeps; 53 unsigned long idle_sleeps;
53 ktime_t idle_entrytime; 54 ktime_t idle_entrytime;
54 ktime_t idle_sleeptime; 55 ktime_t idle_sleeptime;
56 ktime_t sleep_length;
55 unsigned long last_jiffies; 57 unsigned long last_jiffies;
56 unsigned long next_jiffies; 58 unsigned long next_jiffies;
57 ktime_t idle_expires; 59 ktime_t idle_expires;
@@ -100,10 +102,17 @@ static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
100extern void tick_nohz_stop_sched_tick(void); 102extern void tick_nohz_stop_sched_tick(void);
101extern void tick_nohz_restart_sched_tick(void); 103extern void tick_nohz_restart_sched_tick(void);
102extern void tick_nohz_update_jiffies(void); 104extern void tick_nohz_update_jiffies(void);
105extern ktime_t tick_nohz_get_sleep_length(void);
103# else 106# else
104static inline void tick_nohz_stop_sched_tick(void) { } 107static inline void tick_nohz_stop_sched_tick(void) { }
105static inline void tick_nohz_restart_sched_tick(void) { } 108static inline void tick_nohz_restart_sched_tick(void) { }
106static inline void tick_nohz_update_jiffies(void) { } 109static inline void tick_nohz_update_jiffies(void) { }
110static inline ktime_t tick_nohz_get_sleep_length(void)
111{
112 ktime_t len = { .tv64 = NSEC_PER_SEC/HZ };
113
114 return len;
115}
107# endif /* !NO_HZ */ 116# endif /* !NO_HZ */
108 117
109#endif 118#endif
diff --git a/include/linux/types.h b/include/linux/types.h
index 0351bf2fac85..4f0dad21c917 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -3,12 +3,9 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#define BITS_TO_LONGS(bits) \
7 (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
8#define DECLARE_BITMAP(name,bits) \ 6#define DECLARE_BITMAP(name,bits) \
9 unsigned long name[BITS_TO_LONGS(bits)] 7 unsigned long name[BITS_TO_LONGS(bits)]
10 8
11#define BITS_PER_BYTE 8
12#endif 9#endif
13 10
14#include <linux/posix_types.h> 11#include <linux/posix_types.h>
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index a6c1e8eed226..15ddd4483b09 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -162,10 +162,6 @@ struct uinput_ff_erase {
162#define UI_FF_UPLOAD 1 162#define UI_FF_UPLOAD 1
163#define UI_FF_ERASE 2 163#define UI_FF_ERASE 2
164 164
165#ifndef NBITS
166#define NBITS(x) ((((x)-1)/(sizeof(long)*8))+1)
167#endif /* NBITS */
168
169#define UINPUT_MAX_NAME_SIZE 80 165#define UINPUT_MAX_NAME_SIZE 80
170struct uinput_user_dev { 166struct uinput_user_dev {
171 char name[UINPUT_MAX_NAME_SIZE]; 167 char name[UINPUT_MAX_NAME_SIZE];
diff --git a/include/linux/vt.h b/include/linux/vt.h
index ba806e8711be..02c1c0288770 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -1,6 +1,18 @@
1#ifndef _LINUX_VT_H 1#ifndef _LINUX_VT_H
2#define _LINUX_VT_H 2#define _LINUX_VT_H
3 3
4#ifdef __KERNEL__
5struct notifier_block;
6
7struct vt_notifier_param {
8 struct vc_data *vc; /* VC on which the update happened */
9 unsigned int c; /* Printed char */
10};
11
12extern int register_vt_notifier(struct notifier_block *nb);
13extern int unregister_vt_notifier(struct notifier_block *nb);
14#endif
15
4/* 16/*
5 * These constants are also useful for user-level apps (e.g., VC 17 * These constants are also useful for user-level apps (e.g., VC
6 * resizing). 18 * resizing).
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index ce6badc98f6d..7daafdc2514b 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -8,6 +8,7 @@
8#include <linux/timer.h> 8#include <linux/timer.h>
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/bitops.h> 10#include <linux/bitops.h>
11#include <linux/lockdep.h>
11#include <asm/atomic.h> 12#include <asm/atomic.h>
12 13
13struct workqueue_struct; 14struct workqueue_struct;
@@ -28,6 +29,9 @@ struct work_struct {
28#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK) 29#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
29 struct list_head entry; 30 struct list_head entry;
30 work_func_t func; 31 work_func_t func;
32#ifdef CONFIG_LOCKDEP
33 struct lockdep_map lockdep_map;
34#endif
31}; 35};
32 36
33#define WORK_DATA_INIT() ATOMIC_LONG_INIT(0) 37#define WORK_DATA_INIT() ATOMIC_LONG_INIT(0)
@@ -41,10 +45,23 @@ struct execute_work {
41 struct work_struct work; 45 struct work_struct work;
42}; 46};
43 47
48#ifdef CONFIG_LOCKDEP
49/*
50 * NB: because we have to copy the lockdep_map, setting _key
51 * here is required, otherwise it could get initialised to the
52 * copy of the lockdep_map!
53 */
54#define __WORK_INIT_LOCKDEP_MAP(n, k) \
55 .lockdep_map = STATIC_LOCKDEP_MAP_INIT(n, k),
56#else
57#define __WORK_INIT_LOCKDEP_MAP(n, k)
58#endif
59
44#define __WORK_INITIALIZER(n, f) { \ 60#define __WORK_INITIALIZER(n, f) { \
45 .data = WORK_DATA_INIT(), \ 61 .data = WORK_DATA_INIT(), \
46 .entry = { &(n).entry, &(n).entry }, \ 62 .entry = { &(n).entry, &(n).entry }, \
47 .func = (f), \ 63 .func = (f), \
64 __WORK_INIT_LOCKDEP_MAP(#n, &(n)) \
48 } 65 }
49 66
50#define __DELAYED_WORK_INITIALIZER(n, f) { \ 67#define __DELAYED_WORK_INITIALIZER(n, f) { \
@@ -76,12 +93,24 @@ struct execute_work {
76 * assignment of the work data initializer allows the compiler 93 * assignment of the work data initializer allows the compiler
77 * to generate better code. 94 * to generate better code.
78 */ 95 */
96#ifdef CONFIG_LOCKDEP
97#define INIT_WORK(_work, _func) \
98 do { \
99 static struct lock_class_key __key; \
100 \
101 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
102 lockdep_init_map(&(_work)->lockdep_map, #_work, &__key, 0);\
103 INIT_LIST_HEAD(&(_work)->entry); \
104 PREPARE_WORK((_work), (_func)); \
105 } while (0)
106#else
79#define INIT_WORK(_work, _func) \ 107#define INIT_WORK(_work, _func) \
80 do { \ 108 do { \
81 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \ 109 (_work)->data = (atomic_long_t) WORK_DATA_INIT(); \
82 INIT_LIST_HEAD(&(_work)->entry); \ 110 INIT_LIST_HEAD(&(_work)->entry); \
83 PREPARE_WORK((_work), (_func)); \ 111 PREPARE_WORK((_work), (_func)); \
84 } while (0) 112 } while (0)
113#endif
85 114
86#define INIT_DELAYED_WORK(_work, _func) \ 115#define INIT_DELAYED_WORK(_work, _func) \
87 do { \ 116 do { \
@@ -118,9 +147,23 @@ struct execute_work {
118 clear_bit(WORK_STRUCT_PENDING, work_data_bits(work)) 147 clear_bit(WORK_STRUCT_PENDING, work_data_bits(work))
119 148
120 149
121extern struct workqueue_struct *__create_workqueue(const char *name, 150extern struct workqueue_struct *
122 int singlethread, 151__create_workqueue_key(const char *name, int singlethread,
123 int freezeable); 152 int freezeable, struct lock_class_key *key);
153
154#ifdef CONFIG_LOCKDEP
155#define __create_workqueue(name, singlethread, freezeable) \
156({ \
157 static struct lock_class_key __key; \
158 \
159 __create_workqueue_key((name), (singlethread), \
160 (freezeable), &__key); \
161})
162#else
163#define __create_workqueue(name, singlethread, freezeable) \
164 __create_workqueue_key((name), (singlethread), (freezeable), NULL)
165#endif
166
124#define create_workqueue(name) __create_workqueue((name), 0, 0) 167#define create_workqueue(name) __create_workqueue((name), 0, 0)
125#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1) 168#define create_freezeable_workqueue(name) __create_workqueue((name), 1, 1)
126#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0) 169#define create_singlethread_workqueue(name) __create_workqueue((name), 1, 0)
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 686425a97b0f..625346c47ee2 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -44,7 +44,7 @@ extern unsigned int p9_debug_level;
44do { \ 44do { \
45 if ((p9_debug_level & level) == level) \ 45 if ((p9_debug_level & level) == level) \
46 printk(KERN_NOTICE "-- %s (%d): " \ 46 printk(KERN_NOTICE "-- %s (%d): " \
47 format , __FUNCTION__, current->pid , ## arg); \ 47 format , __FUNCTION__, task_pid_nr(current) , ## arg); \
48} while (0) 48} while (0)
49 49
50#define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR, \ 50#define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR, \
@@ -59,7 +59,7 @@ do { \
59#define P9_EPRINTK(level, format, arg...) \ 59#define P9_EPRINTK(level, format, arg...) \
60do { \ 60do { \
61 printk(level "9p: %s (%d): " \ 61 printk(level "9p: %s (%d): " \
62 format , __FUNCTION__, current->pid , ## arg); \ 62 format , __FUNCTION__, task_pid_nr(current), ## arg); \
63} while (0) 63} while (0)
64 64
65 65
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 911c2cd02941..954def408975 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -39,8 +39,13 @@ struct inet_frags {
39 struct inet_frags_ctl *ctl; 39 struct inet_frags_ctl *ctl;
40 40
41 unsigned int (*hashfn)(struct inet_frag_queue *); 41 unsigned int (*hashfn)(struct inet_frag_queue *);
42 void (*constructor)(struct inet_frag_queue *q,
43 void *arg);
42 void (*destructor)(struct inet_frag_queue *); 44 void (*destructor)(struct inet_frag_queue *);
43 void (*skb_free)(struct sk_buff *); 45 void (*skb_free)(struct sk_buff *);
46 int (*match)(struct inet_frag_queue *q,
47 void *arg);
48 void (*frag_expire)(unsigned long data);
44}; 49};
45 50
46void inet_frags_init(struct inet_frags *); 51void inet_frags_init(struct inet_frags *);
@@ -50,6 +55,8 @@ void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
50void inet_frag_destroy(struct inet_frag_queue *q, 55void inet_frag_destroy(struct inet_frag_queue *q,
51 struct inet_frags *f, int *work); 56 struct inet_frags *f, int *work);
52int inet_frag_evictor(struct inet_frags *f); 57int inet_frag_evictor(struct inet_frags *f);
58struct inet_frag_queue *inet_frag_find(struct inet_frags *f, void *key,
59 unsigned int hash);
53 60
54static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) 61static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
55{ 62{
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index cc796cbc1b26..ae328b680ff2 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -377,6 +377,17 @@ static inline int ipv6_prefix_equal(const struct in6_addr *a1,
377 prefixlen); 377 prefixlen);
378} 378}
379 379
380struct inet_frag_queue;
381
382struct ip6_create_arg {
383 __be32 id;
384 struct in6_addr *src;
385 struct in6_addr *dst;
386};
387
388void ip6_frag_init(struct inet_frag_queue *q, void *a);
389int ip6_frag_match(struct inet_frag_queue *q, void *a);
390
380static inline int ipv6_addr_any(const struct in6_addr *a) 391static inline int ipv6_addr_any(const struct in6_addr *a)
381{ 392{
382 return ((a->s6_addr32[0] | a->s6_addr32[1] | 393 return ((a->s6_addr32[0] | a->s6_addr32[1] |
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h
index cf80c1af5854..32c385dd9e06 100644
--- a/include/net/irda/irttp.h
+++ b/include/net/irda/irttp.h
@@ -56,7 +56,7 @@
56 56
57/* Receive queue sizes */ 57/* Receive queue sizes */
58/* Minimum of credit that the peer should hold. 58/* Minimum of credit that the peer should hold.
59 * If the peer has less credits than 9 frames, we will explicitely send 59 * If the peer has less credits than 9 frames, we will explicitly send
60 * him some credits (through irttp_give_credit() and a specific frame). 60 * him some credits (through irttp_give_credit() and a specific frame).
61 * Note that when we give credits it's likely that it won't be sent in 61 * Note that when we give credits it's likely that it won't be sent in
62 * this LAP window, but in the next one. So, we make sure that the peer 62 * this LAP window, but in the next one. So, we make sure that the peer
@@ -66,7 +66,7 @@
66/* This is the default maximum number of credits held by the peer, so the 66/* This is the default maximum number of credits held by the peer, so the
67 * default maximum number of frames he can send us before needing flow 67 * default maximum number of frames he can send us before needing flow
68 * control answer from us (this may be negociated differently at TSAP setup). 68 * control answer from us (this may be negociated differently at TSAP setup).
69 * We want to minimise the number of times we have to explicitely send some 69 * We want to minimise the number of times we have to explicitly send some
70 * credit to the peer, hoping we can piggyback it on the return data. In 70 * credit to the peer, hoping we can piggyback it on the return data. In
71 * particular, it doesn't make sense for us to send credit more than once 71 * particular, it doesn't make sense for us to send credit more than once
72 * per LAP window. 72 * per LAP window.
diff --git a/include/net/scm.h b/include/net/scm.h
index 423cb1d5ac25..06df126103ca 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -4,6 +4,8 @@
4#include <linux/limits.h> 4#include <linux/limits.h>
5#include <linux/net.h> 5#include <linux/net.h>
6#include <linux/security.h> 6#include <linux/security.h>
7#include <linux/pid.h>
8#include <linux/nsproxy.h>
7 9
8/* Well, we should have at least one descriptor open 10/* Well, we should have at least one descriptor open
9 * to accept passed FDs 8) 11 * to accept passed FDs 8)
@@ -54,7 +56,7 @@ static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
54 struct task_struct *p = current; 56 struct task_struct *p = current;
55 scm->creds.uid = p->uid; 57 scm->creds.uid = p->uid;
56 scm->creds.gid = p->gid; 58 scm->creds.gid = p->gid;
57 scm->creds.pid = p->tgid; 59 scm->creds.pid = task_tgid_vnr(p);
58 scm->fp = NULL; 60 scm->fp = NULL;
59 scm->seq = 0; 61 scm->seq = 0;
60 unix_get_peersec_dgram(sock, scm); 62 unix_get_peersec_dgram(sock, scm);
diff --git a/include/net/sock.h b/include/net/sock.h
index 453c79d0915b..43fc3fa50d62 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -905,16 +905,6 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
905} 905}
906 906
907/** 907/**
908 * sk_filter_rcu_free: Free a socket filter
909 * @rcu: rcu_head that contains the sk_filter to free
910 */
911static inline void sk_filter_rcu_free(struct rcu_head *rcu)
912{
913 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
914 kfree(fp);
915}
916
917/**
918 * sk_filter_release: Release a socket filter 908 * sk_filter_release: Release a socket filter
919 * @sk: socket 909 * @sk: socket
920 * @fp: filter to remove 910 * @fp: filter to remove
@@ -922,14 +912,18 @@ static inline void sk_filter_rcu_free(struct rcu_head *rcu)
922 * Remove a filter from a socket and release its resources. 912 * Remove a filter from a socket and release its resources.
923 */ 913 */
924 914
925static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) 915static inline void sk_filter_release(struct sk_filter *fp)
916{
917 if (atomic_dec_and_test(&fp->refcnt))
918 kfree(fp);
919}
920
921static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp)
926{ 922{
927 unsigned int size = sk_filter_len(fp); 923 unsigned int size = sk_filter_len(fp);
928 924
929 atomic_sub(size, &sk->sk_omem_alloc); 925 atomic_sub(size, &sk->sk_omem_alloc);
930 926 sk_filter_release(fp);
931 if (atomic_dec_and_test(&fp->refcnt))
932 call_rcu_bh(&fp->rcu, sk_filter_rcu_free);
933} 927}
934 928
935static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp) 929static inline void sk_filter_charge(struct sock *sk, struct sk_filter *fp)
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 0e844845f3f4..688f6f5d3285 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -186,7 +186,8 @@ struct xfrm_state
186 /* Reference to data common to all the instances of this 186 /* Reference to data common to all the instances of this
187 * transformer. */ 187 * transformer. */
188 struct xfrm_type *type; 188 struct xfrm_type *type;
189 struct xfrm_mode *mode; 189 struct xfrm_mode *inner_mode;
190 struct xfrm_mode *outer_mode;
190 191
191 /* Security context */ 192 /* Security context */
192 struct xfrm_sec_ctx *security; 193 struct xfrm_sec_ctx *security;
@@ -228,8 +229,6 @@ struct xfrm_type;
228struct xfrm_dst; 229struct xfrm_dst;
229struct xfrm_policy_afinfo { 230struct xfrm_policy_afinfo {
230 unsigned short family; 231 unsigned short family;
231 struct xfrm_type *type_map[IPPROTO_MAX];
232 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
233 struct dst_ops *dst_ops; 232 struct dst_ops *dst_ops;
234 void (*garbage_collect)(void); 233 void (*garbage_collect)(void);
235 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); 234 int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl);
@@ -255,7 +254,10 @@ extern void km_state_expired(struct xfrm_state *x, int hard, u32 pid);
255extern int __xfrm_state_delete(struct xfrm_state *x); 254extern int __xfrm_state_delete(struct xfrm_state *x);
256 255
257struct xfrm_state_afinfo { 256struct xfrm_state_afinfo {
258 unsigned short family; 257 unsigned int family;
258 struct module *owner;
259 struct xfrm_type *type_map[IPPROTO_MAX];
260 struct xfrm_mode *mode_map[XFRM_MODE_MAX];
259 int (*init_flags)(struct xfrm_state *x); 261 int (*init_flags)(struct xfrm_state *x);
260 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, 262 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
261 struct xfrm_tmpl *tmpl, 263 struct xfrm_tmpl *tmpl,
@@ -267,8 +269,6 @@ struct xfrm_state_afinfo {
267 269
268extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); 270extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo);
269extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo); 271extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
270extern struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family);
271extern void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
272 272
273extern void xfrm_state_delete_tunnel(struct xfrm_state *x); 273extern void xfrm_state_delete_tunnel(struct xfrm_state *x);
274 274
@@ -295,8 +295,6 @@ struct xfrm_type
295 295
296extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); 296extern int xfrm_register_type(struct xfrm_type *type, unsigned short family);
297extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); 297extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family);
298extern struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family);
299extern void xfrm_put_type(struct xfrm_type *type);
300 298
301struct xfrm_mode { 299struct xfrm_mode {
302 int (*input)(struct xfrm_state *x, struct sk_buff *skb); 300 int (*input)(struct xfrm_state *x, struct sk_buff *skb);
@@ -314,14 +312,19 @@ struct xfrm_mode {
314 */ 312 */
315 int (*output)(struct xfrm_state *x,struct sk_buff *skb); 313 int (*output)(struct xfrm_state *x,struct sk_buff *skb);
316 314
315 struct xfrm_state_afinfo *afinfo;
317 struct module *owner; 316 struct module *owner;
318 unsigned int encap; 317 unsigned int encap;
318 int flags;
319};
320
321/* Flags for xfrm_mode. */
322enum {
323 XFRM_MODE_FLAG_TUNNEL = 1,
319}; 324};
320 325
321extern int xfrm_register_mode(struct xfrm_mode *mode, int family); 326extern int xfrm_register_mode(struct xfrm_mode *mode, int family);
322extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); 327extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
323extern struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family);
324extern void xfrm_put_mode(struct xfrm_mode *mode);
325 328
326struct xfrm_tmpl 329struct xfrm_tmpl
327{ 330{
@@ -1046,11 +1049,19 @@ extern void xfrm_replay_notify(struct xfrm_state *x, int event);
1046extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 1049extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1047extern int xfrm_init_state(struct xfrm_state *x); 1050extern int xfrm_init_state(struct xfrm_state *x);
1048extern int xfrm_output(struct sk_buff *skb); 1051extern int xfrm_output(struct sk_buff *skb);
1052extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
1053 int encap_type);
1049extern int xfrm4_rcv(struct sk_buff *skb); 1054extern int xfrm4_rcv(struct sk_buff *skb);
1055
1056static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1057{
1058 return xfrm4_rcv_encap(skb, nexthdr, spi, 0);
1059}
1060
1050extern int xfrm4_output(struct sk_buff *skb); 1061extern int xfrm4_output(struct sk_buff *skb);
1051extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1062extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1052extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1063extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1053extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); 1064extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
1054extern int xfrm6_rcv(struct sk_buff *skb); 1065extern int xfrm6_rcv(struct sk_buff *skb);
1055extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1066extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1056 xfrm_address_t *saddr, u8 proto); 1067 xfrm_address_t *saddr, u8 proto);
diff --git a/include/video/sstfb.h b/include/video/sstfb.h
index baa163f770ab..b52f07381243 100644
--- a/include/video/sstfb.h
+++ b/include/video/sstfb.h
@@ -68,7 +68,6 @@
68# define print_var(X,Y...) 68# define print_var(X,Y...)
69#endif 69#endif
70 70
71#define BIT(x) (1ul<<(x))
72#define POW2(x) (1ul<<(x)) 71#define POW2(x) (1ul<<(x))
73 72
74/* 73/*
diff --git a/include/video/tdfx.h b/include/video/tdfx.h
index 05b63c2a5abc..7431d9681e57 100644
--- a/include/video/tdfx.h
+++ b/include/video/tdfx.h
@@ -79,8 +79,6 @@
79 79
80/* register bitfields (not all, only as needed) */ 80/* register bitfields (not all, only as needed) */
81 81
82#define BIT(x) (1UL << (x))
83
84/* COMMAND_2D reg. values */ 82/* COMMAND_2D reg. values */
85#define TDFX_ROP_COPY 0xcc /* src */ 83#define TDFX_ROP_COPY 0xcc /* src */
86#define TDFX_ROP_INVERT 0x55 /* NOT dst */ 84#define TDFX_ROP_INVERT 0x55 /* NOT dst */
diff --git a/init/Kconfig b/init/Kconfig
index a29a688c47d3..541382d539ad 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -270,9 +270,43 @@ config LOG_BUF_SHIFT
270 13 => 8 KB 270 13 => 8 KB
271 12 => 4 KB 271 12 => 4 KB
272 272
273config CGROUPS
274 bool "Control Group support"
275 help
276 This option will let you use process cgroup subsystems
277 such as Cpusets
278
279 Say N if unsure.
280
281config CGROUP_DEBUG
282 bool "Example debug cgroup subsystem"
283 depends on CGROUPS
284 help
285 This option enables a simple cgroup subsystem that
286 exports useful debugging information about the cgroups
287 framework
288
289 Say N if unsure
290
291config CGROUP_NS
292 bool "Namespace cgroup subsystem"
293 depends on CGROUPS
294 help
295 Provides a simple namespace cgroup subsystem to
296 provide hierarchical naming of sets of namespaces,
297 for instance virtual servers and checkpoint/restart
298 jobs.
299
300config CGROUP_CPUACCT
301 bool "Simple CPU accounting cgroup subsystem"
302 depends on CGROUPS
303 help
304 Provides a simple Resource Controller for monitoring the
305 total CPU consumed by the tasks in a cgroup
306
273config CPUSETS 307config CPUSETS
274 bool "Cpuset support" 308 bool "Cpuset support"
275 depends on SMP 309 depends on SMP && CGROUPS
276 help 310 help
277 This option will let you create and manage CPUSETs which 311 This option will let you create and manage CPUSETs which
278 allow dynamically partitioning a system into sets of CPUs and 312 allow dynamically partitioning a system into sets of CPUs and
@@ -300,6 +334,16 @@ config FAIR_USER_SCHED
300 This option will choose userid as the basis for grouping 334 This option will choose userid as the basis for grouping
301 tasks, thus providing equal CPU bandwidth to each user. 335 tasks, thus providing equal CPU bandwidth to each user.
302 336
337config FAIR_CGROUP_SCHED
338 bool "Control groups"
339 depends on CGROUPS
340 help
341 This option allows you to create arbitrary task groups
342 using the "cgroup" pseudo filesystem and control
343 the cpu bandwidth allocated to each such task group.
344 Refer to Documentation/cgroups.txt for more information
345 on "cgroup" pseudo filesystem.
346
303endchoice 347endchoice
304 348
305config SYSFS_DEPRECATED 349config SYSFS_DEPRECATED
@@ -322,6 +366,11 @@ config SYSFS_DEPRECATED
322 If you are using a distro that was released in 2006 or later, 366 If you are using a distro that was released in 2006 or later,
323 it should be safe to say N here. 367 it should be safe to say N here.
324 368
369config PROC_PID_CPUSET
370 bool "Include legacy /proc/<pid>/cpuset file"
371 depends on CPUSETS
372 default y
373
325config RELAY 374config RELAY
326 bool "Kernel->user space relay support (formerly relayfs)" 375 bool "Kernel->user space relay support (formerly relayfs)"
327 help 376 help
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index ed652f40f075..3ac5904d1b12 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -57,7 +57,7 @@ identify_ramdisk_image(int fd, int start_block)
57 unsigned char *buf; 57 unsigned char *buf;
58 58
59 buf = kmalloc(size, GFP_KERNEL); 59 buf = kmalloc(size, GFP_KERNEL);
60 if (buf == 0) 60 if (!buf)
61 return -1; 61 return -1;
62 62
63 minixsb = (struct minix_super_block *) buf; 63 minixsb = (struct minix_super_block *) buf;
@@ -407,12 +407,12 @@ static int __init crd_load(int in_fd, int out_fd)
407 crd_infd = in_fd; 407 crd_infd = in_fd;
408 crd_outfd = out_fd; 408 crd_outfd = out_fd;
409 inbuf = kmalloc(INBUFSIZ, GFP_KERNEL); 409 inbuf = kmalloc(INBUFSIZ, GFP_KERNEL);
410 if (inbuf == 0) { 410 if (!inbuf) {
411 printk(KERN_ERR "RAMDISK: Couldn't allocate gzip buffer\n"); 411 printk(KERN_ERR "RAMDISK: Couldn't allocate gzip buffer\n");
412 return -1; 412 return -1;
413 } 413 }
414 window = kmalloc(WSIZE, GFP_KERNEL); 414 window = kmalloc(WSIZE, GFP_KERNEL);
415 if (window == 0) { 415 if (!window) {
416 printk(KERN_ERR "RAMDISK: Couldn't allocate gzip window\n"); 416 printk(KERN_ERR "RAMDISK: Couldn't allocate gzip window\n");
417 kfree(inbuf); 417 kfree(inbuf);
418 return -1; 418 return -1;
diff --git a/init/main.c b/init/main.c
index 9def935ab13a..f605a969ea61 100644
--- a/init/main.c
+++ b/init/main.c
@@ -39,6 +39,7 @@
39#include <linux/writeback.h> 39#include <linux/writeback.h>
40#include <linux/cpu.h> 40#include <linux/cpu.h>
41#include <linux/cpuset.h> 41#include <linux/cpuset.h>
42#include <linux/cgroup.h>
42#include <linux/efi.h> 43#include <linux/efi.h>
43#include <linux/tick.h> 44#include <linux/tick.h>
44#include <linux/interrupt.h> 45#include <linux/interrupt.h>
@@ -69,15 +70,7 @@
69/* 70/*
70 * This is one of the first .c files built. Error out early if we have compiler 71 * This is one of the first .c files built. Error out early if we have compiler
71 * trouble. 72 * trouble.
72 *
73 * Versions of gcc older than that listed below may actually compile and link
74 * okay, but the end product can have subtle run time bugs. To avoid associated
75 * bogus bug reports, we flatly refuse to compile with a gcc that is known to be
76 * too old from the very beginning.
77 */ 73 */
78#if (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 2)
79#error Sorry, your GCC is too old. It builds incorrect kernels.
80#endif
81 74
82#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0 75#if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0
83#warning gcc-4.1.0 is known to miscompile the kernel. A different compiler version is recommended. 76#warning gcc-4.1.0 is known to miscompile the kernel. A different compiler version is recommended.
@@ -287,7 +280,7 @@ static int __init unknown_bootoption(char *param, char *val)
287 return 0; 280 return 0;
288 281
289 /* 282 /*
290 * Preemptive maintenance for "why didn't my mispelled command 283 * Preemptive maintenance for "why didn't my misspelled command
291 * line work?" 284 * line work?"
292 */ 285 */
293 if (strchr(param, '.') && (!val || strchr(param, '.') < val)) { 286 if (strchr(param, '.') && (!val || strchr(param, '.') < val)) {
@@ -523,6 +516,7 @@ asmlinkage void __init start_kernel(void)
523 */ 516 */
524 unwind_init(); 517 unwind_init();
525 lockdep_init(); 518 lockdep_init();
519 cgroup_init_early();
526 520
527 local_irq_disable(); 521 local_irq_disable();
528 early_boot_irqs_off(); 522 early_boot_irqs_off();
@@ -640,6 +634,7 @@ asmlinkage void __init start_kernel(void)
640#ifdef CONFIG_PROC_FS 634#ifdef CONFIG_PROC_FS
641 proc_root_init(); 635 proc_root_init();
642#endif 636#endif
637 cgroup_init();
643 cpuset_init(); 638 cpuset_init();
644 taskstats_init_early(); 639 taskstats_init_early();
645 delayacct_init(); 640 delayacct_init();
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 774843cff756..c0b26dc4617b 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -29,6 +29,8 @@
29#include <linux/audit.h> 29#include <linux/audit.h>
30#include <linux/signal.h> 30#include <linux/signal.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/nsproxy.h>
33#include <linux/pid.h>
32 34
33#include <net/sock.h> 35#include <net/sock.h>
34#include "util.h" 36#include "util.h"
@@ -44,12 +46,6 @@
44#define STATE_PENDING 1 46#define STATE_PENDING 1
45#define STATE_READY 2 47#define STATE_READY 2
46 48
47/* used by sysctl */
48#define FS_MQUEUE 1
49#define CTL_QUEUESMAX 2
50#define CTL_MSGMAX 3
51#define CTL_MSGSIZEMAX 4
52
53/* default values */ 49/* default values */
54#define DFLT_QUEUESMAX 256 /* max number of message queues */ 50#define DFLT_QUEUESMAX 256 /* max number of message queues */
55#define DFLT_MSGMAX 10 /* max number of messages in each queue */ 51#define DFLT_MSGMAX 10 /* max number of messages in each queue */
@@ -336,7 +332,8 @@ static ssize_t mqueue_read_file(struct file *filp, char __user *u_data,
336 (info->notify_owner && 332 (info->notify_owner &&
337 info->notify.sigev_notify == SIGEV_SIGNAL) ? 333 info->notify.sigev_notify == SIGEV_SIGNAL) ?
338 info->notify.sigev_signo : 0, 334 info->notify.sigev_signo : 0,
339 pid_nr(info->notify_owner)); 335 pid_nr_ns(info->notify_owner,
336 current->nsproxy->pid_ns));
340 spin_unlock(&info->lock); 337 spin_unlock(&info->lock);
341 buffer[sizeof(buffer)-1] = '\0'; 338 buffer[sizeof(buffer)-1] = '\0';
342 slen = strlen(buffer)+1; 339 slen = strlen(buffer)+1;
@@ -513,7 +510,7 @@ static void __do_notify(struct mqueue_inode_info *info)
513 sig_i.si_errno = 0; 510 sig_i.si_errno = 0;
514 sig_i.si_code = SI_MESGQ; 511 sig_i.si_code = SI_MESGQ;
515 sig_i.si_value = info->notify.sigev_value; 512 sig_i.si_value = info->notify.sigev_value;
516 sig_i.si_pid = current->tgid; 513 sig_i.si_pid = task_pid_vnr(current);
517 sig_i.si_uid = current->uid; 514 sig_i.si_uid = current->uid;
518 515
519 kill_pid_info(info->notify.sigev_signo, 516 kill_pid_info(info->notify.sigev_signo,
@@ -1196,7 +1193,6 @@ static int msg_maxsize_limit_max = INT_MAX;
1196 1193
1197static ctl_table mq_sysctls[] = { 1194static ctl_table mq_sysctls[] = {
1198 { 1195 {
1199 .ctl_name = CTL_QUEUESMAX,
1200 .procname = "queues_max", 1196 .procname = "queues_max",
1201 .data = &queues_max, 1197 .data = &queues_max,
1202 .maxlen = sizeof(int), 1198 .maxlen = sizeof(int),
@@ -1204,7 +1200,6 @@ static ctl_table mq_sysctls[] = {
1204 .proc_handler = &proc_dointvec, 1200 .proc_handler = &proc_dointvec,
1205 }, 1201 },
1206 { 1202 {
1207 .ctl_name = CTL_MSGMAX,
1208 .procname = "msg_max", 1203 .procname = "msg_max",
1209 .data = &msg_max, 1204 .data = &msg_max,
1210 .maxlen = sizeof(int), 1205 .maxlen = sizeof(int),
@@ -1214,7 +1209,6 @@ static ctl_table mq_sysctls[] = {
1214 .extra2 = &msg_max_limit_max, 1209 .extra2 = &msg_max_limit_max,
1215 }, 1210 },
1216 { 1211 {
1217 .ctl_name = CTL_MSGSIZEMAX,
1218 .procname = "msgsize_max", 1212 .procname = "msgsize_max",
1219 .data = &msgsize_max, 1213 .data = &msgsize_max,
1220 .maxlen = sizeof(int), 1214 .maxlen = sizeof(int),
@@ -1228,7 +1222,6 @@ static ctl_table mq_sysctls[] = {
1228 1222
1229static ctl_table mq_sysctl_dir[] = { 1223static ctl_table mq_sysctl_dir[] = {
1230 { 1224 {
1231 .ctl_name = FS_MQUEUE,
1232 .procname = "mqueue", 1225 .procname = "mqueue",
1233 .mode = 0555, 1226 .mode = 0555,
1234 .child = mq_sysctls, 1227 .child = mq_sysctls,
diff --git a/ipc/msg.c b/ipc/msg.c
index a03fcb522fff..fdf3db5731ce 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -34,7 +34,7 @@
34#include <linux/syscalls.h> 34#include <linux/syscalls.h>
35#include <linux/audit.h> 35#include <linux/audit.h>
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <linux/mutex.h> 37#include <linux/rwsem.h>
38#include <linux/nsproxy.h> 38#include <linux/nsproxy.h>
39 39
40#include <asm/current.h> 40#include <asm/current.h>
@@ -66,23 +66,15 @@ struct msg_sender {
66#define SEARCH_NOTEQUAL 3 66#define SEARCH_NOTEQUAL 3
67#define SEARCH_LESSEQUAL 4 67#define SEARCH_LESSEQUAL 4
68 68
69static atomic_t msg_bytes = ATOMIC_INIT(0);
70static atomic_t msg_hdrs = ATOMIC_INIT(0);
71
72static struct ipc_ids init_msg_ids; 69static struct ipc_ids init_msg_ids;
73 70
74#define msg_ids(ns) (*((ns)->ids[IPC_MSG_IDS])) 71#define msg_ids(ns) (*((ns)->ids[IPC_MSG_IDS]))
75 72
76#define msg_lock(ns, id) ((struct msg_queue*)ipc_lock(&msg_ids(ns), id))
77#define msg_unlock(msq) ipc_unlock(&(msq)->q_perm) 73#define msg_unlock(msq) ipc_unlock(&(msq)->q_perm)
78#define msg_rmid(ns, id) ((struct msg_queue*)ipc_rmid(&msg_ids(ns), id)) 74#define msg_buildid(id, seq) ipc_buildid(id, seq)
79#define msg_checkid(ns, msq, msgid) \ 75
80 ipc_checkid(&msg_ids(ns), &msq->q_perm, msgid) 76static void freeque(struct ipc_namespace *, struct msg_queue *);
81#define msg_buildid(ns, id, seq) \ 77static int newque(struct ipc_namespace *, struct ipc_params *);
82 ipc_buildid(&msg_ids(ns), id, seq)
83
84static void freeque (struct ipc_namespace *ns, struct msg_queue *msq, int id);
85static int newque (struct ipc_namespace *ns, key_t key, int msgflg);
86#ifdef CONFIG_PROC_FS 78#ifdef CONFIG_PROC_FS
87static int sysvipc_msg_proc_show(struct seq_file *s, void *it); 79static int sysvipc_msg_proc_show(struct seq_file *s, void *it);
88#endif 80#endif
@@ -93,7 +85,9 @@ static void __msg_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
93 ns->msg_ctlmax = MSGMAX; 85 ns->msg_ctlmax = MSGMAX;
94 ns->msg_ctlmnb = MSGMNB; 86 ns->msg_ctlmnb = MSGMNB;
95 ns->msg_ctlmni = MSGMNI; 87 ns->msg_ctlmni = MSGMNI;
96 ipc_init_ids(ids, ns->msg_ctlmni); 88 atomic_set(&ns->msg_bytes, 0);
89 atomic_set(&ns->msg_hdrs, 0);
90 ipc_init_ids(ids);
97} 91}
98 92
99int msg_init_ns(struct ipc_namespace *ns) 93int msg_init_ns(struct ipc_namespace *ns)
@@ -110,20 +104,25 @@ int msg_init_ns(struct ipc_namespace *ns)
110 104
111void msg_exit_ns(struct ipc_namespace *ns) 105void msg_exit_ns(struct ipc_namespace *ns)
112{ 106{
113 int i;
114 struct msg_queue *msq; 107 struct msg_queue *msq;
108 int next_id;
109 int total, in_use;
110
111 down_write(&msg_ids(ns).rw_mutex);
112
113 in_use = msg_ids(ns).in_use;
115 114
116 mutex_lock(&msg_ids(ns).mutex); 115 for (total = 0, next_id = 0; total < in_use; next_id++) {
117 for (i = 0; i <= msg_ids(ns).max_id; i++) { 116 msq = idr_find(&msg_ids(ns).ipcs_idr, next_id);
118 msq = msg_lock(ns, i);
119 if (msq == NULL) 117 if (msq == NULL)
120 continue; 118 continue;
121 119 ipc_lock_by_ptr(&msq->q_perm);
122 freeque(ns, msq, i); 120 freeque(ns, msq);
121 total++;
123 } 122 }
124 mutex_unlock(&msg_ids(ns).mutex);
125 123
126 ipc_fini_ids(ns->ids[IPC_MSG_IDS]); 124 up_write(&msg_ids(ns).rw_mutex);
125
127 kfree(ns->ids[IPC_MSG_IDS]); 126 kfree(ns->ids[IPC_MSG_IDS]);
128 ns->ids[IPC_MSG_IDS] = NULL; 127 ns->ids[IPC_MSG_IDS] = NULL;
129} 128}
@@ -136,10 +135,55 @@ void __init msg_init(void)
136 IPC_MSG_IDS, sysvipc_msg_proc_show); 135 IPC_MSG_IDS, sysvipc_msg_proc_show);
137} 136}
138 137
139static int newque (struct ipc_namespace *ns, key_t key, int msgflg) 138/*
139 * This routine is called in the paths where the rw_mutex is held to protect
140 * access to the idr tree.
141 */
142static inline struct msg_queue *msg_lock_check_down(struct ipc_namespace *ns,
143 int id)
144{
145 struct kern_ipc_perm *ipcp = ipc_lock_check_down(&msg_ids(ns), id);
146
147 return container_of(ipcp, struct msg_queue, q_perm);
148}
149
150/*
151 * msg_lock_(check_) routines are called in the paths where the rw_mutex
152 * is not held.
153 */
154static inline struct msg_queue *msg_lock(struct ipc_namespace *ns, int id)
155{
156 struct kern_ipc_perm *ipcp = ipc_lock(&msg_ids(ns), id);
157
158 return container_of(ipcp, struct msg_queue, q_perm);
159}
160
161static inline struct msg_queue *msg_lock_check(struct ipc_namespace *ns,
162 int id)
163{
164 struct kern_ipc_perm *ipcp = ipc_lock_check(&msg_ids(ns), id);
165
166 return container_of(ipcp, struct msg_queue, q_perm);
167}
168
169static inline void msg_rmid(struct ipc_namespace *ns, struct msg_queue *s)
170{
171 ipc_rmid(&msg_ids(ns), &s->q_perm);
172}
173
174/**
175 * newque - Create a new msg queue
176 * @ns: namespace
177 * @params: ptr to the structure that contains the key and msgflg
178 *
179 * Called with msg_ids.rw_mutex held (writer)
180 */
181static int newque(struct ipc_namespace *ns, struct ipc_params *params)
140{ 182{
141 struct msg_queue *msq; 183 struct msg_queue *msq;
142 int id, retval; 184 int id, retval;
185 key_t key = params->key;
186 int msgflg = params->flg;
143 187
144 msq = ipc_rcu_alloc(sizeof(*msq)); 188 msq = ipc_rcu_alloc(sizeof(*msq));
145 if (!msq) 189 if (!msq)
@@ -155,14 +199,17 @@ static int newque (struct ipc_namespace *ns, key_t key, int msgflg)
155 return retval; 199 return retval;
156 } 200 }
157 201
202 /*
203 * ipc_addid() locks msq
204 */
158 id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); 205 id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni);
159 if (id == -1) { 206 if (id < 0) {
160 security_msg_queue_free(msq); 207 security_msg_queue_free(msq);
161 ipc_rcu_putref(msq); 208 ipc_rcu_putref(msq);
162 return -ENOSPC; 209 return id;
163 } 210 }
164 211
165 msq->q_id = msg_buildid(ns, id, msq->q_perm.seq); 212 msq->q_perm.id = msg_buildid(id, msq->q_perm.seq);
166 msq->q_stime = msq->q_rtime = 0; 213 msq->q_stime = msq->q_rtime = 0;
167 msq->q_ctime = get_seconds(); 214 msq->q_ctime = get_seconds();
168 msq->q_cbytes = msq->q_qnum = 0; 215 msq->q_cbytes = msq->q_qnum = 0;
@@ -171,9 +218,10 @@ static int newque (struct ipc_namespace *ns, key_t key, int msgflg)
171 INIT_LIST_HEAD(&msq->q_messages); 218 INIT_LIST_HEAD(&msq->q_messages);
172 INIT_LIST_HEAD(&msq->q_receivers); 219 INIT_LIST_HEAD(&msq->q_receivers);
173 INIT_LIST_HEAD(&msq->q_senders); 220 INIT_LIST_HEAD(&msq->q_senders);
221
174 msg_unlock(msq); 222 msg_unlock(msq);
175 223
176 return msq->q_id; 224 return msq->q_perm.id;
177} 225}
178 226
179static inline void ss_add(struct msg_queue *msq, struct msg_sender *mss) 227static inline void ss_add(struct msg_queue *msq, struct msg_sender *mss)
@@ -224,19 +272,19 @@ static void expunge_all(struct msg_queue *msq, int res)
224 272
225/* 273/*
226 * freeque() wakes up waiters on the sender and receiver waiting queue, 274 * freeque() wakes up waiters on the sender and receiver waiting queue,
227 * removes the message queue from message queue ID 275 * removes the message queue from message queue ID IDR, and cleans up all the
228 * array, and cleans up all the messages associated with this queue. 276 * messages associated with this queue.
229 * 277 *
230 * msg_ids.mutex and the spinlock for this message queue is hold 278 * msg_ids.rw_mutex (writer) and the spinlock for this message queue are held
231 * before freeque() is called. msg_ids.mutex remains locked on exit. 279 * before freeque() is called. msg_ids.rw_mutex remains locked on exit.
232 */ 280 */
233static void freeque(struct ipc_namespace *ns, struct msg_queue *msq, int id) 281static void freeque(struct ipc_namespace *ns, struct msg_queue *msq)
234{ 282{
235 struct list_head *tmp; 283 struct list_head *tmp;
236 284
237 expunge_all(msq, -EIDRM); 285 expunge_all(msq, -EIDRM);
238 ss_wakeup(&msq->q_senders, 1); 286 ss_wakeup(&msq->q_senders, 1);
239 msq = msg_rmid(ns, id); 287 msg_rmid(ns, msq);
240 msg_unlock(msq); 288 msg_unlock(msq);
241 289
242 tmp = msq->q_messages.next; 290 tmp = msq->q_messages.next;
@@ -244,49 +292,40 @@ static void freeque(struct ipc_namespace *ns, struct msg_queue *msq, int id)
244 struct msg_msg *msg = list_entry(tmp, struct msg_msg, m_list); 292 struct msg_msg *msg = list_entry(tmp, struct msg_msg, m_list);
245 293
246 tmp = tmp->next; 294 tmp = tmp->next;
247 atomic_dec(&msg_hdrs); 295 atomic_dec(&ns->msg_hdrs);
248 free_msg(msg); 296 free_msg(msg);
249 } 297 }
250 atomic_sub(msq->q_cbytes, &msg_bytes); 298 atomic_sub(msq->q_cbytes, &ns->msg_bytes);
251 security_msg_queue_free(msq); 299 security_msg_queue_free(msq);
252 ipc_rcu_putref(msq); 300 ipc_rcu_putref(msq);
253} 301}
254 302
303/*
304 * Called with msg_ids.rw_mutex and ipcp locked.
305 */
306static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg)
307{
308 struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm);
309
310 return security_msg_queue_associate(msq, msgflg);
311}
312
255asmlinkage long sys_msgget(key_t key, int msgflg) 313asmlinkage long sys_msgget(key_t key, int msgflg)
256{ 314{
257 struct msg_queue *msq;
258 int id, ret = -EPERM;
259 struct ipc_namespace *ns; 315 struct ipc_namespace *ns;
316 struct ipc_ops msg_ops;
317 struct ipc_params msg_params;
260 318
261 ns = current->nsproxy->ipc_ns; 319 ns = current->nsproxy->ipc_ns;
262
263 mutex_lock(&msg_ids(ns).mutex);
264 if (key == IPC_PRIVATE)
265 ret = newque(ns, key, msgflg);
266 else if ((id = ipc_findkey(&msg_ids(ns), key)) == -1) { /* key not used */
267 if (!(msgflg & IPC_CREAT))
268 ret = -ENOENT;
269 else
270 ret = newque(ns, key, msgflg);
271 } else if (msgflg & IPC_CREAT && msgflg & IPC_EXCL) {
272 ret = -EEXIST;
273 } else {
274 msq = msg_lock(ns, id);
275 BUG_ON(msq == NULL);
276 if (ipcperms(&msq->q_perm, msgflg))
277 ret = -EACCES;
278 else {
279 int qid = msg_buildid(ns, id, msq->q_perm.seq);
280
281 ret = security_msg_queue_associate(msq, msgflg);
282 if (!ret)
283 ret = qid;
284 }
285 msg_unlock(msq);
286 }
287 mutex_unlock(&msg_ids(ns).mutex);
288 320
289 return ret; 321 msg_ops.getnew = newque;
322 msg_ops.associate = msg_security;
323 msg_ops.more_checks = NULL;
324
325 msg_params.key = key;
326 msg_params.flg = msgflg;
327
328 return ipcget(ns, &msg_ids(ns), &msg_ops, &msg_params);
290} 329}
291 330
292static inline unsigned long 331static inline unsigned long
@@ -420,23 +459,23 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
420 msginfo.msgmnb = ns->msg_ctlmnb; 459 msginfo.msgmnb = ns->msg_ctlmnb;
421 msginfo.msgssz = MSGSSZ; 460 msginfo.msgssz = MSGSSZ;
422 msginfo.msgseg = MSGSEG; 461 msginfo.msgseg = MSGSEG;
423 mutex_lock(&msg_ids(ns).mutex); 462 down_read(&msg_ids(ns).rw_mutex);
424 if (cmd == MSG_INFO) { 463 if (cmd == MSG_INFO) {
425 msginfo.msgpool = msg_ids(ns).in_use; 464 msginfo.msgpool = msg_ids(ns).in_use;
426 msginfo.msgmap = atomic_read(&msg_hdrs); 465 msginfo.msgmap = atomic_read(&ns->msg_hdrs);
427 msginfo.msgtql = atomic_read(&msg_bytes); 466 msginfo.msgtql = atomic_read(&ns->msg_bytes);
428 } else { 467 } else {
429 msginfo.msgmap = MSGMAP; 468 msginfo.msgmap = MSGMAP;
430 msginfo.msgpool = MSGPOOL; 469 msginfo.msgpool = MSGPOOL;
431 msginfo.msgtql = MSGTQL; 470 msginfo.msgtql = MSGTQL;
432 } 471 }
433 max_id = msg_ids(ns).max_id; 472 max_id = ipc_get_maxid(&msg_ids(ns));
434 mutex_unlock(&msg_ids(ns).mutex); 473 up_read(&msg_ids(ns).rw_mutex);
435 if (copy_to_user(buf, &msginfo, sizeof(struct msginfo))) 474 if (copy_to_user(buf, &msginfo, sizeof(struct msginfo)))
436 return -EFAULT; 475 return -EFAULT;
437 return (max_id < 0) ? 0 : max_id; 476 return (max_id < 0) ? 0 : max_id;
438 } 477 }
439 case MSG_STAT: 478 case MSG_STAT: /* msqid is an index rather than a msg queue id */
440 case IPC_STAT: 479 case IPC_STAT:
441 { 480 {
442 struct msqid64_ds tbuf; 481 struct msqid64_ds tbuf;
@@ -444,21 +483,16 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
444 483
445 if (!buf) 484 if (!buf)
446 return -EFAULT; 485 return -EFAULT;
447 if (cmd == MSG_STAT && msqid >= msg_ids(ns).entries->size)
448 return -EINVAL;
449
450 memset(&tbuf, 0, sizeof(tbuf));
451
452 msq = msg_lock(ns, msqid);
453 if (msq == NULL)
454 return -EINVAL;
455 486
456 if (cmd == MSG_STAT) { 487 if (cmd == MSG_STAT) {
457 success_return = msg_buildid(ns, msqid, msq->q_perm.seq); 488 msq = msg_lock(ns, msqid);
489 if (IS_ERR(msq))
490 return PTR_ERR(msq);
491 success_return = msq->q_perm.id;
458 } else { 492 } else {
459 err = -EIDRM; 493 msq = msg_lock_check(ns, msqid);
460 if (msg_checkid(ns, msq, msqid)) 494 if (IS_ERR(msq))
461 goto out_unlock; 495 return PTR_ERR(msq);
462 success_return = 0; 496 success_return = 0;
463 } 497 }
464 err = -EACCES; 498 err = -EACCES;
@@ -469,6 +503,8 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
469 if (err) 503 if (err)
470 goto out_unlock; 504 goto out_unlock;
471 505
506 memset(&tbuf, 0, sizeof(tbuf));
507
472 kernel_to_ipc64_perm(&msq->q_perm, &tbuf.msg_perm); 508 kernel_to_ipc64_perm(&msq->q_perm, &tbuf.msg_perm);
473 tbuf.msg_stime = msq->q_stime; 509 tbuf.msg_stime = msq->q_stime;
474 tbuf.msg_rtime = msq->q_rtime; 510 tbuf.msg_rtime = msq->q_rtime;
@@ -495,15 +531,13 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
495 return -EINVAL; 531 return -EINVAL;
496 } 532 }
497 533
498 mutex_lock(&msg_ids(ns).mutex); 534 down_write(&msg_ids(ns).rw_mutex);
499 msq = msg_lock(ns, msqid); 535 msq = msg_lock_check_down(ns, msqid);
500 err = -EINVAL; 536 if (IS_ERR(msq)) {
501 if (msq == NULL) 537 err = PTR_ERR(msq);
502 goto out_up; 538 goto out_up;
539 }
503 540
504 err = -EIDRM;
505 if (msg_checkid(ns, msq, msqid))
506 goto out_unlock_up;
507 ipcp = &msq->q_perm; 541 ipcp = &msq->q_perm;
508 542
509 err = audit_ipc_obj(ipcp); 543 err = audit_ipc_obj(ipcp);
@@ -552,12 +586,12 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
552 break; 586 break;
553 } 587 }
554 case IPC_RMID: 588 case IPC_RMID:
555 freeque(ns, msq, msqid); 589 freeque(ns, msq);
556 break; 590 break;
557 } 591 }
558 err = 0; 592 err = 0;
559out_up: 593out_up:
560 mutex_unlock(&msg_ids(ns).mutex); 594 up_write(&msg_ids(ns).rw_mutex);
561 return err; 595 return err;
562out_unlock_up: 596out_unlock_up:
563 msg_unlock(msq); 597 msg_unlock(msq);
@@ -611,7 +645,7 @@ static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg)
611 msr->r_msg = ERR_PTR(-E2BIG); 645 msr->r_msg = ERR_PTR(-E2BIG);
612 } else { 646 } else {
613 msr->r_msg = NULL; 647 msr->r_msg = NULL;
614 msq->q_lrpid = msr->r_tsk->pid; 648 msq->q_lrpid = task_pid_vnr(msr->r_tsk);
615 msq->q_rtime = get_seconds(); 649 msq->q_rtime = get_seconds();
616 wake_up_process(msr->r_tsk); 650 wake_up_process(msr->r_tsk);
617 smp_mb(); 651 smp_mb();
@@ -646,14 +680,11 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
646 msg->m_type = mtype; 680 msg->m_type = mtype;
647 msg->m_ts = msgsz; 681 msg->m_ts = msgsz;
648 682
649 msq = msg_lock(ns, msqid); 683 msq = msg_lock_check(ns, msqid);
650 err = -EINVAL; 684 if (IS_ERR(msq)) {
651 if (msq == NULL) 685 err = PTR_ERR(msq);
652 goto out_free; 686 goto out_free;
653 687 }
654 err= -EIDRM;
655 if (msg_checkid(ns, msq, msqid))
656 goto out_unlock_free;
657 688
658 for (;;) { 689 for (;;) {
659 struct msg_sender s; 690 struct msg_sender s;
@@ -695,7 +726,7 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
695 } 726 }
696 } 727 }
697 728
698 msq->q_lspid = current->tgid; 729 msq->q_lspid = task_tgid_vnr(current);
699 msq->q_stime = get_seconds(); 730 msq->q_stime = get_seconds();
700 731
701 if (!pipelined_send(msq, msg)) { 732 if (!pipelined_send(msq, msg)) {
@@ -703,8 +734,8 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
703 list_add_tail(&msg->m_list, &msq->q_messages); 734 list_add_tail(&msg->m_list, &msq->q_messages);
704 msq->q_cbytes += msgsz; 735 msq->q_cbytes += msgsz;
705 msq->q_qnum++; 736 msq->q_qnum++;
706 atomic_add(msgsz, &msg_bytes); 737 atomic_add(msgsz, &ns->msg_bytes);
707 atomic_inc(&msg_hdrs); 738 atomic_inc(&ns->msg_hdrs);
708 } 739 }
709 740
710 err = 0; 741 err = 0;
@@ -760,13 +791,9 @@ long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
760 mode = convert_mode(&msgtyp, msgflg); 791 mode = convert_mode(&msgtyp, msgflg);
761 ns = current->nsproxy->ipc_ns; 792 ns = current->nsproxy->ipc_ns;
762 793
763 msq = msg_lock(ns, msqid); 794 msq = msg_lock_check(ns, msqid);
764 if (msq == NULL) 795 if (IS_ERR(msq))
765 return -EINVAL; 796 return PTR_ERR(msq);
766
767 msg = ERR_PTR(-EIDRM);
768 if (msg_checkid(ns, msq, msqid))
769 goto out_unlock;
770 797
771 for (;;) { 798 for (;;) {
772 struct msg_receiver msr_d; 799 struct msg_receiver msr_d;
@@ -810,10 +837,10 @@ long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
810 list_del(&msg->m_list); 837 list_del(&msg->m_list);
811 msq->q_qnum--; 838 msq->q_qnum--;
812 msq->q_rtime = get_seconds(); 839 msq->q_rtime = get_seconds();
813 msq->q_lrpid = current->tgid; 840 msq->q_lrpid = task_tgid_vnr(current);
814 msq->q_cbytes -= msg->m_ts; 841 msq->q_cbytes -= msg->m_ts;
815 atomic_sub(msg->m_ts, &msg_bytes); 842 atomic_sub(msg->m_ts, &ns->msg_bytes);
816 atomic_dec(&msg_hdrs); 843 atomic_dec(&ns->msg_hdrs);
817 ss_wakeup(&msq->q_senders, 0); 844 ss_wakeup(&msq->q_senders, 0);
818 msg_unlock(msq); 845 msg_unlock(msq);
819 break; 846 break;
@@ -926,7 +953,7 @@ static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
926 return seq_printf(s, 953 return seq_printf(s,
927 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n", 954 "%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",
928 msq->q_perm.key, 955 msq->q_perm.key,
929 msq->q_id, 956 msq->q_perm.id,
930 msq->q_perm.mode, 957 msq->q_perm.mode,
931 msq->q_cbytes, 958 msq->q_cbytes,
932 msq->q_qnum, 959 msq->q_qnum,
diff --git a/ipc/sem.c b/ipc/sem.c
index b676fef6d208..35952c0bae46 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -80,7 +80,7 @@
80#include <linux/audit.h> 80#include <linux/audit.h>
81#include <linux/capability.h> 81#include <linux/capability.h>
82#include <linux/seq_file.h> 82#include <linux/seq_file.h>
83#include <linux/mutex.h> 83#include <linux/rwsem.h>
84#include <linux/nsproxy.h> 84#include <linux/nsproxy.h>
85 85
86#include <asm/uaccess.h> 86#include <asm/uaccess.h>
@@ -88,18 +88,14 @@
88 88
89#define sem_ids(ns) (*((ns)->ids[IPC_SEM_IDS])) 89#define sem_ids(ns) (*((ns)->ids[IPC_SEM_IDS]))
90 90
91#define sem_lock(ns, id) ((struct sem_array*)ipc_lock(&sem_ids(ns), id))
92#define sem_unlock(sma) ipc_unlock(&(sma)->sem_perm) 91#define sem_unlock(sma) ipc_unlock(&(sma)->sem_perm)
93#define sem_rmid(ns, id) ((struct sem_array*)ipc_rmid(&sem_ids(ns), id)) 92#define sem_checkid(sma, semid) ipc_checkid(&sma->sem_perm, semid)
94#define sem_checkid(ns, sma, semid) \ 93#define sem_buildid(id, seq) ipc_buildid(id, seq)
95 ipc_checkid(&sem_ids(ns),&sma->sem_perm,semid)
96#define sem_buildid(ns, id, seq) \
97 ipc_buildid(&sem_ids(ns), id, seq)
98 94
99static struct ipc_ids init_sem_ids; 95static struct ipc_ids init_sem_ids;
100 96
101static int newary(struct ipc_namespace *, key_t, int, int); 97static int newary(struct ipc_namespace *, struct ipc_params *);
102static void freeary(struct ipc_namespace *ns, struct sem_array *sma, int id); 98static void freeary(struct ipc_namespace *, struct sem_array *);
103#ifdef CONFIG_PROC_FS 99#ifdef CONFIG_PROC_FS
104static int sysvipc_sem_proc_show(struct seq_file *s, void *it); 100static int sysvipc_sem_proc_show(struct seq_file *s, void *it);
105#endif 101#endif
@@ -129,7 +125,7 @@ static void __sem_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
129 ns->sc_semopm = SEMOPM; 125 ns->sc_semopm = SEMOPM;
130 ns->sc_semmni = SEMMNI; 126 ns->sc_semmni = SEMMNI;
131 ns->used_sems = 0; 127 ns->used_sems = 0;
132 ipc_init_ids(ids, ns->sc_semmni); 128 ipc_init_ids(ids);
133} 129}
134 130
135int sem_init_ns(struct ipc_namespace *ns) 131int sem_init_ns(struct ipc_namespace *ns)
@@ -146,20 +142,24 @@ int sem_init_ns(struct ipc_namespace *ns)
146 142
147void sem_exit_ns(struct ipc_namespace *ns) 143void sem_exit_ns(struct ipc_namespace *ns)
148{ 144{
149 int i;
150 struct sem_array *sma; 145 struct sem_array *sma;
146 int next_id;
147 int total, in_use;
151 148
152 mutex_lock(&sem_ids(ns).mutex); 149 down_write(&sem_ids(ns).rw_mutex);
153 for (i = 0; i <= sem_ids(ns).max_id; i++) { 150
154 sma = sem_lock(ns, i); 151 in_use = sem_ids(ns).in_use;
152
153 for (total = 0, next_id = 0; total < in_use; next_id++) {
154 sma = idr_find(&sem_ids(ns).ipcs_idr, next_id);
155 if (sma == NULL) 155 if (sma == NULL)
156 continue; 156 continue;
157 157 ipc_lock_by_ptr(&sma->sem_perm);
158 freeary(ns, sma, i); 158 freeary(ns, sma);
159 total++;
159 } 160 }
160 mutex_unlock(&sem_ids(ns).mutex); 161 up_write(&sem_ids(ns).rw_mutex);
161 162
162 ipc_fini_ids(ns->ids[IPC_SEM_IDS]);
163 kfree(ns->ids[IPC_SEM_IDS]); 163 kfree(ns->ids[IPC_SEM_IDS]);
164 ns->ids[IPC_SEM_IDS] = NULL; 164 ns->ids[IPC_SEM_IDS] = NULL;
165} 165}
@@ -173,6 +173,42 @@ void __init sem_init (void)
173} 173}
174 174
175/* 175/*
176 * This routine is called in the paths where the rw_mutex is held to protect
177 * access to the idr tree.
178 */
179static inline struct sem_array *sem_lock_check_down(struct ipc_namespace *ns,
180 int id)
181{
182 struct kern_ipc_perm *ipcp = ipc_lock_check_down(&sem_ids(ns), id);
183
184 return container_of(ipcp, struct sem_array, sem_perm);
185}
186
187/*
188 * sem_lock_(check_) routines are called in the paths where the rw_mutex
189 * is not held.
190 */
191static inline struct sem_array *sem_lock(struct ipc_namespace *ns, int id)
192{
193 struct kern_ipc_perm *ipcp = ipc_lock(&sem_ids(ns), id);
194
195 return container_of(ipcp, struct sem_array, sem_perm);
196}
197
198static inline struct sem_array *sem_lock_check(struct ipc_namespace *ns,
199 int id)
200{
201 struct kern_ipc_perm *ipcp = ipc_lock_check(&sem_ids(ns), id);
202
203 return container_of(ipcp, struct sem_array, sem_perm);
204}
205
206static inline void sem_rmid(struct ipc_namespace *ns, struct sem_array *s)
207{
208 ipc_rmid(&sem_ids(ns), &s->sem_perm);
209}
210
211/*
176 * Lockless wakeup algorithm: 212 * Lockless wakeup algorithm:
177 * Without the check/retry algorithm a lockless wakeup is possible: 213 * Without the check/retry algorithm a lockless wakeup is possible:
178 * - queue.status is initialized to -EINTR before blocking. 214 * - queue.status is initialized to -EINTR before blocking.
@@ -206,12 +242,23 @@ void __init sem_init (void)
206 */ 242 */
207#define IN_WAKEUP 1 243#define IN_WAKEUP 1
208 244
209static int newary (struct ipc_namespace *ns, key_t key, int nsems, int semflg) 245/**
246 * newary - Create a new semaphore set
247 * @ns: namespace
248 * @params: ptr to the structure that contains key, semflg and nsems
249 *
250 * Called with sem_ids.rw_mutex held (as a writer)
251 */
252
253static int newary(struct ipc_namespace *ns, struct ipc_params *params)
210{ 254{
211 int id; 255 int id;
212 int retval; 256 int retval;
213 struct sem_array *sma; 257 struct sem_array *sma;
214 int size; 258 int size;
259 key_t key = params->key;
260 int nsems = params->u.nsems;
261 int semflg = params->flg;
215 262
216 if (!nsems) 263 if (!nsems)
217 return -EINVAL; 264 return -EINVAL;
@@ -236,14 +283,14 @@ static int newary (struct ipc_namespace *ns, key_t key, int nsems, int semflg)
236 } 283 }
237 284
238 id = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni); 285 id = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni);
239 if(id == -1) { 286 if (id < 0) {
240 security_sem_free(sma); 287 security_sem_free(sma);
241 ipc_rcu_putref(sma); 288 ipc_rcu_putref(sma);
242 return -ENOSPC; 289 return id;
243 } 290 }
244 ns->used_sems += nsems; 291 ns->used_sems += nsems;
245 292
246 sma->sem_id = sem_buildid(ns, id, sma->sem_perm.seq); 293 sma->sem_perm.id = sem_buildid(id, sma->sem_perm.seq);
247 sma->sem_base = (struct sem *) &sma[1]; 294 sma->sem_base = (struct sem *) &sma[1];
248 /* sma->sem_pending = NULL; */ 295 /* sma->sem_pending = NULL; */
249 sma->sem_pending_last = &sma->sem_pending; 296 sma->sem_pending_last = &sma->sem_pending;
@@ -252,48 +299,56 @@ static int newary (struct ipc_namespace *ns, key_t key, int nsems, int semflg)
252 sma->sem_ctime = get_seconds(); 299 sma->sem_ctime = get_seconds();
253 sem_unlock(sma); 300 sem_unlock(sma);
254 301
255 return sma->sem_id; 302 return sma->sem_perm.id;
303}
304
305
306/*
307 * Called with sem_ids.rw_mutex and ipcp locked.
308 */
309static inline int sem_security(struct kern_ipc_perm *ipcp, int semflg)
310{
311 struct sem_array *sma;
312
313 sma = container_of(ipcp, struct sem_array, sem_perm);
314 return security_sem_associate(sma, semflg);
256} 315}
257 316
258asmlinkage long sys_semget (key_t key, int nsems, int semflg) 317/*
318 * Called with sem_ids.rw_mutex and ipcp locked.
319 */
320static inline int sem_more_checks(struct kern_ipc_perm *ipcp,
321 struct ipc_params *params)
259{ 322{
260 int id, err = -EINVAL;
261 struct sem_array *sma; 323 struct sem_array *sma;
324
325 sma = container_of(ipcp, struct sem_array, sem_perm);
326 if (params->u.nsems > sma->sem_nsems)
327 return -EINVAL;
328
329 return 0;
330}
331
332asmlinkage long sys_semget(key_t key, int nsems, int semflg)
333{
262 struct ipc_namespace *ns; 334 struct ipc_namespace *ns;
335 struct ipc_ops sem_ops;
336 struct ipc_params sem_params;
263 337
264 ns = current->nsproxy->ipc_ns; 338 ns = current->nsproxy->ipc_ns;
265 339
266 if (nsems < 0 || nsems > ns->sc_semmsl) 340 if (nsems < 0 || nsems > ns->sc_semmsl)
267 return -EINVAL; 341 return -EINVAL;
268 mutex_lock(&sem_ids(ns).mutex);
269
270 if (key == IPC_PRIVATE) {
271 err = newary(ns, key, nsems, semflg);
272 } else if ((id = ipc_findkey(&sem_ids(ns), key)) == -1) { /* key not used */
273 if (!(semflg & IPC_CREAT))
274 err = -ENOENT;
275 else
276 err = newary(ns, key, nsems, semflg);
277 } else if (semflg & IPC_CREAT && semflg & IPC_EXCL) {
278 err = -EEXIST;
279 } else {
280 sma = sem_lock(ns, id);
281 BUG_ON(sma==NULL);
282 if (nsems > sma->sem_nsems)
283 err = -EINVAL;
284 else if (ipcperms(&sma->sem_perm, semflg))
285 err = -EACCES;
286 else {
287 int semid = sem_buildid(ns, id, sma->sem_perm.seq);
288 err = security_sem_associate(sma, semflg);
289 if (!err)
290 err = semid;
291 }
292 sem_unlock(sma);
293 }
294 342
295 mutex_unlock(&sem_ids(ns).mutex); 343 sem_ops.getnew = newary;
296 return err; 344 sem_ops.associate = sem_security;
345 sem_ops.more_checks = sem_more_checks;
346
347 sem_params.key = key;
348 sem_params.flg = semflg;
349 sem_params.u.nsems = nsems;
350
351 return ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params);
297} 352}
298 353
299/* Manage the doubly linked list sma->sem_pending as a FIFO: 354/* Manage the doubly linked list sma->sem_pending as a FIFO:
@@ -487,15 +542,14 @@ static int count_semzcnt (struct sem_array * sma, ushort semnum)
487 return semzcnt; 542 return semzcnt;
488} 543}
489 544
490/* Free a semaphore set. freeary() is called with sem_ids.mutex locked and 545/* Free a semaphore set. freeary() is called with sem_ids.rw_mutex locked
491 * the spinlock for this semaphore set hold. sem_ids.mutex remains locked 546 * as a writer and the spinlock for this semaphore set hold. sem_ids.rw_mutex
492 * on exit. 547 * remains locked on exit.
493 */ 548 */
494static void freeary (struct ipc_namespace *ns, struct sem_array *sma, int id) 549static void freeary(struct ipc_namespace *ns, struct sem_array *sma)
495{ 550{
496 struct sem_undo *un; 551 struct sem_undo *un;
497 struct sem_queue *q; 552 struct sem_queue *q;
498 int size;
499 553
500 /* Invalidate the existing undo structures for this semaphore set. 554 /* Invalidate the existing undo structures for this semaphore set.
501 * (They will be freed without any further action in exit_sem() 555 * (They will be freed without any further action in exit_sem()
@@ -518,12 +572,11 @@ static void freeary (struct ipc_namespace *ns, struct sem_array *sma, int id)
518 q = n; 572 q = n;
519 } 573 }
520 574
521 /* Remove the semaphore set from the ID array*/ 575 /* Remove the semaphore set from the IDR */
522 sma = sem_rmid(ns, id); 576 sem_rmid(ns, sma);
523 sem_unlock(sma); 577 sem_unlock(sma);
524 578
525 ns->used_sems -= sma->sem_nsems; 579 ns->used_sems -= sma->sem_nsems;
526 size = sizeof (*sma) + sma->sem_nsems * sizeof (struct sem);
527 security_sem_free(sma); 580 security_sem_free(sma);
528 ipc_rcu_putref(sma); 581 ipc_rcu_putref(sma);
529} 582}
@@ -576,7 +629,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, int semnum,
576 seminfo.semmnu = SEMMNU; 629 seminfo.semmnu = SEMMNU;
577 seminfo.semmap = SEMMAP; 630 seminfo.semmap = SEMMAP;
578 seminfo.semume = SEMUME; 631 seminfo.semume = SEMUME;
579 mutex_lock(&sem_ids(ns).mutex); 632 down_read(&sem_ids(ns).rw_mutex);
580 if (cmd == SEM_INFO) { 633 if (cmd == SEM_INFO) {
581 seminfo.semusz = sem_ids(ns).in_use; 634 seminfo.semusz = sem_ids(ns).in_use;
582 seminfo.semaem = ns->used_sems; 635 seminfo.semaem = ns->used_sems;
@@ -584,8 +637,8 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, int semnum,
584 seminfo.semusz = SEMUSZ; 637 seminfo.semusz = SEMUSZ;
585 seminfo.semaem = SEMAEM; 638 seminfo.semaem = SEMAEM;
586 } 639 }
587 max_id = sem_ids(ns).max_id; 640 max_id = ipc_get_maxid(&sem_ids(ns));
588 mutex_unlock(&sem_ids(ns).mutex); 641 up_read(&sem_ids(ns).rw_mutex);
589 if (copy_to_user (arg.__buf, &seminfo, sizeof(struct seminfo))) 642 if (copy_to_user (arg.__buf, &seminfo, sizeof(struct seminfo)))
590 return -EFAULT; 643 return -EFAULT;
591 return (max_id < 0) ? 0: max_id; 644 return (max_id < 0) ? 0: max_id;
@@ -595,14 +648,9 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, int semnum,
595 struct semid64_ds tbuf; 648 struct semid64_ds tbuf;
596 int id; 649 int id;
597 650
598 if(semid >= sem_ids(ns).entries->size)
599 return -EINVAL;
600
601 memset(&tbuf,0,sizeof(tbuf));
602
603 sma = sem_lock(ns, semid); 651 sma = sem_lock(ns, semid);
604 if(sma == NULL) 652 if (IS_ERR(sma))
605 return -EINVAL; 653 return PTR_ERR(sma);
606 654
607 err = -EACCES; 655 err = -EACCES;
608 if (ipcperms (&sma->sem_perm, S_IRUGO)) 656 if (ipcperms (&sma->sem_perm, S_IRUGO))
@@ -612,7 +660,9 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, int semnum,
612 if (err) 660 if (err)
613 goto out_unlock; 661 goto out_unlock;
614 662
615 id = sem_buildid(ns, semid, sma->sem_perm.seq); 663 id = sma->sem_perm.id;
664
665 memset(&tbuf, 0, sizeof(tbuf));
616 666
617 kernel_to_ipc64_perm(&sma->sem_perm, &tbuf.sem_perm); 667 kernel_to_ipc64_perm(&sma->sem_perm, &tbuf.sem_perm);
618 tbuf.sem_otime = sma->sem_otime; 668 tbuf.sem_otime = sma->sem_otime;
@@ -642,16 +692,12 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
642 ushort* sem_io = fast_sem_io; 692 ushort* sem_io = fast_sem_io;
643 int nsems; 693 int nsems;
644 694
645 sma = sem_lock(ns, semid); 695 sma = sem_lock_check(ns, semid);
646 if(sma==NULL) 696 if (IS_ERR(sma))
647 return -EINVAL; 697 return PTR_ERR(sma);
648 698
649 nsems = sma->sem_nsems; 699 nsems = sma->sem_nsems;
650 700
651 err=-EIDRM;
652 if (sem_checkid(ns,sma,semid))
653 goto out_unlock;
654
655 err = -EACCES; 701 err = -EACCES;
656 if (ipcperms (&sma->sem_perm, (cmd==SETVAL||cmd==SETALL)?S_IWUGO:S_IRUGO)) 702 if (ipcperms (&sma->sem_perm, (cmd==SETVAL||cmd==SETALL)?S_IWUGO:S_IRUGO))
657 goto out_unlock; 703 goto out_unlock;
@@ -795,7 +841,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,
795 for (un = sma->undo; un; un = un->id_next) 841 for (un = sma->undo; un; un = un->id_next)
796 un->semadj[semnum] = 0; 842 un->semadj[semnum] = 0;
797 curr->semval = val; 843 curr->semval = val;
798 curr->sempid = current->tgid; 844 curr->sempid = task_tgid_vnr(current);
799 sma->sem_ctime = get_seconds(); 845 sma->sem_ctime = get_seconds();
800 /* maybe some queued-up processes were waiting for this */ 846 /* maybe some queued-up processes were waiting for this */
801 update_queue(sma); 847 update_queue(sma);
@@ -863,14 +909,10 @@ static int semctl_down(struct ipc_namespace *ns, int semid, int semnum,
863 if(copy_semid_from_user (&setbuf, arg.buf, version)) 909 if(copy_semid_from_user (&setbuf, arg.buf, version))
864 return -EFAULT; 910 return -EFAULT;
865 } 911 }
866 sma = sem_lock(ns, semid); 912 sma = sem_lock_check_down(ns, semid);
867 if(sma==NULL) 913 if (IS_ERR(sma))
868 return -EINVAL; 914 return PTR_ERR(sma);
869 915
870 if (sem_checkid(ns,sma,semid)) {
871 err=-EIDRM;
872 goto out_unlock;
873 }
874 ipcp = &sma->sem_perm; 916 ipcp = &sma->sem_perm;
875 917
876 err = audit_ipc_obj(ipcp); 918 err = audit_ipc_obj(ipcp);
@@ -894,7 +936,7 @@ static int semctl_down(struct ipc_namespace *ns, int semid, int semnum,
894 936
895 switch(cmd){ 937 switch(cmd){
896 case IPC_RMID: 938 case IPC_RMID:
897 freeary(ns, sma, semid); 939 freeary(ns, sma);
898 err = 0; 940 err = 0;
899 break; 941 break;
900 case IPC_SET: 942 case IPC_SET:
@@ -948,45 +990,15 @@ asmlinkage long sys_semctl (int semid, int semnum, int cmd, union semun arg)
948 return err; 990 return err;
949 case IPC_RMID: 991 case IPC_RMID:
950 case IPC_SET: 992 case IPC_SET:
951 mutex_lock(&sem_ids(ns).mutex); 993 down_write(&sem_ids(ns).rw_mutex);
952 err = semctl_down(ns,semid,semnum,cmd,version,arg); 994 err = semctl_down(ns,semid,semnum,cmd,version,arg);
953 mutex_unlock(&sem_ids(ns).mutex); 995 up_write(&sem_ids(ns).rw_mutex);
954 return err; 996 return err;
955 default: 997 default:
956 return -EINVAL; 998 return -EINVAL;
957 } 999 }
958} 1000}
959 1001
960static inline void lock_semundo(void)
961{
962 struct sem_undo_list *undo_list;
963
964 undo_list = current->sysvsem.undo_list;
965 if (undo_list)
966 spin_lock(&undo_list->lock);
967}
968
969/* This code has an interaction with copy_semundo().
970 * Consider; two tasks are sharing the undo_list. task1
971 * acquires the undo_list lock in lock_semundo(). If task2 now
972 * exits before task1 releases the lock (by calling
973 * unlock_semundo()), then task1 will never call spin_unlock().
974 * This leave the sem_undo_list in a locked state. If task1 now creats task3
975 * and once again shares the sem_undo_list, the sem_undo_list will still be
976 * locked, and future SEM_UNDO operations will deadlock. This case is
977 * dealt with in copy_semundo() by having it reinitialize the spin lock when
978 * the refcnt goes from 1 to 2.
979 */
980static inline void unlock_semundo(void)
981{
982 struct sem_undo_list *undo_list;
983
984 undo_list = current->sysvsem.undo_list;
985 if (undo_list)
986 spin_unlock(&undo_list->lock);
987}
988
989
990/* If the task doesn't already have a undo_list, then allocate one 1002/* If the task doesn't already have a undo_list, then allocate one
991 * here. We guarantee there is only one thread using this undo list, 1003 * here. We guarantee there is only one thread using this undo list,
992 * and current is THE ONE 1004 * and current is THE ONE
@@ -1047,22 +1059,17 @@ static struct sem_undo *find_undo(struct ipc_namespace *ns, int semid)
1047 if (error) 1059 if (error)
1048 return ERR_PTR(error); 1060 return ERR_PTR(error);
1049 1061
1050 lock_semundo(); 1062 spin_lock(&ulp->lock);
1051 un = lookup_undo(ulp, semid); 1063 un = lookup_undo(ulp, semid);
1052 unlock_semundo(); 1064 spin_unlock(&ulp->lock);
1053 if (likely(un!=NULL)) 1065 if (likely(un!=NULL))
1054 goto out; 1066 goto out;
1055 1067
1056 /* no undo structure around - allocate one. */ 1068 /* no undo structure around - allocate one. */
1057 sma = sem_lock(ns, semid); 1069 sma = sem_lock_check(ns, semid);
1058 un = ERR_PTR(-EINVAL); 1070 if (IS_ERR(sma))
1059 if(sma==NULL) 1071 return ERR_PTR(PTR_ERR(sma));
1060 goto out; 1072
1061 un = ERR_PTR(-EIDRM);
1062 if (sem_checkid(ns,sma,semid)) {
1063 sem_unlock(sma);
1064 goto out;
1065 }
1066 nsems = sma->sem_nsems; 1073 nsems = sma->sem_nsems;
1067 ipc_rcu_getref(sma); 1074 ipc_rcu_getref(sma);
1068 sem_unlock(sma); 1075 sem_unlock(sma);
@@ -1077,10 +1084,10 @@ static struct sem_undo *find_undo(struct ipc_namespace *ns, int semid)
1077 new->semadj = (short *) &new[1]; 1084 new->semadj = (short *) &new[1];
1078 new->semid = semid; 1085 new->semid = semid;
1079 1086
1080 lock_semundo(); 1087 spin_lock(&ulp->lock);
1081 un = lookup_undo(ulp, semid); 1088 un = lookup_undo(ulp, semid);
1082 if (un) { 1089 if (un) {
1083 unlock_semundo(); 1090 spin_unlock(&ulp->lock);
1084 kfree(new); 1091 kfree(new);
1085 ipc_lock_by_ptr(&sma->sem_perm); 1092 ipc_lock_by_ptr(&sma->sem_perm);
1086 ipc_rcu_putref(sma); 1093 ipc_rcu_putref(sma);
@@ -1091,7 +1098,7 @@ static struct sem_undo *find_undo(struct ipc_namespace *ns, int semid)
1091 ipc_rcu_putref(sma); 1098 ipc_rcu_putref(sma);
1092 if (sma->sem_perm.deleted) { 1099 if (sma->sem_perm.deleted) {
1093 sem_unlock(sma); 1100 sem_unlock(sma);
1094 unlock_semundo(); 1101 spin_unlock(&ulp->lock);
1095 kfree(new); 1102 kfree(new);
1096 un = ERR_PTR(-EIDRM); 1103 un = ERR_PTR(-EIDRM);
1097 goto out; 1104 goto out;
@@ -1102,7 +1109,7 @@ static struct sem_undo *find_undo(struct ipc_namespace *ns, int semid)
1102 sma->undo = new; 1109 sma->undo = new;
1103 sem_unlock(sma); 1110 sem_unlock(sma);
1104 un = new; 1111 un = new;
1105 unlock_semundo(); 1112 spin_unlock(&ulp->lock);
1106out: 1113out:
1107 return un; 1114 return un;
1108} 1115}
@@ -1168,15 +1175,14 @@ retry_undos:
1168 } else 1175 } else
1169 un = NULL; 1176 un = NULL;
1170 1177
1171 sma = sem_lock(ns, semid); 1178 sma = sem_lock_check(ns, semid);
1172 error=-EINVAL; 1179 if (IS_ERR(sma)) {
1173 if(sma==NULL) 1180 error = PTR_ERR(sma);
1174 goto out_free; 1181 goto out_free;
1175 error = -EIDRM; 1182 }
1176 if (sem_checkid(ns,sma,semid)) 1183
1177 goto out_unlock_free;
1178 /* 1184 /*
1179 * semid identifies are not unique - find_undo may have 1185 * semid identifiers are not unique - find_undo may have
1180 * allocated an undo structure, it was invalidated by an RMID 1186 * allocated an undo structure, it was invalidated by an RMID
1181 * and now a new array with received the same id. Check and retry. 1187 * and now a new array with received the same id. Check and retry.
1182 */ 1188 */
@@ -1196,7 +1202,7 @@ retry_undos:
1196 if (error) 1202 if (error)
1197 goto out_unlock_free; 1203 goto out_unlock_free;
1198 1204
1199 error = try_atomic_semop (sma, sops, nsops, un, current->tgid); 1205 error = try_atomic_semop (sma, sops, nsops, un, task_tgid_vnr(current));
1200 if (error <= 0) { 1206 if (error <= 0) {
1201 if (alter && error == 0) 1207 if (alter && error == 0)
1202 update_queue (sma); 1208 update_queue (sma);
@@ -1211,7 +1217,7 @@ retry_undos:
1211 queue.sops = sops; 1217 queue.sops = sops;
1212 queue.nsops = nsops; 1218 queue.nsops = nsops;
1213 queue.undo = un; 1219 queue.undo = un;
1214 queue.pid = current->tgid; 1220 queue.pid = task_tgid_vnr(current);
1215 queue.id = semid; 1221 queue.id = semid;
1216 queue.alter = alter; 1222 queue.alter = alter;
1217 if (alter) 1223 if (alter)
@@ -1242,7 +1248,7 @@ retry_undos:
1242 } 1248 }
1243 1249
1244 sma = sem_lock(ns, semid); 1250 sma = sem_lock(ns, semid);
1245 if(sma==NULL) { 1251 if (IS_ERR(sma)) {
1246 BUG_ON(queue.prev != NULL); 1252 BUG_ON(queue.prev != NULL);
1247 error = -EIDRM; 1253 error = -EIDRM;
1248 goto out_free; 1254 goto out_free;
@@ -1279,10 +1285,6 @@ asmlinkage long sys_semop (int semid, struct sembuf __user *tsops, unsigned nsop
1279 1285
1280/* If CLONE_SYSVSEM is set, establish sharing of SEM_UNDO state between 1286/* If CLONE_SYSVSEM is set, establish sharing of SEM_UNDO state between
1281 * parent and child tasks. 1287 * parent and child tasks.
1282 *
1283 * See the notes above unlock_semundo() regarding the spin_lock_init()
1284 * in this code. Initialize the undo_list->lock here instead of get_undo_list()
1285 * because of the reasoning in the comment above unlock_semundo.
1286 */ 1288 */
1287 1289
1288int copy_semundo(unsigned long clone_flags, struct task_struct *tsk) 1290int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
@@ -1342,13 +1344,13 @@ void exit_sem(struct task_struct *tsk)
1342 if(semid == -1) 1344 if(semid == -1)
1343 continue; 1345 continue;
1344 sma = sem_lock(ns, semid); 1346 sma = sem_lock(ns, semid);
1345 if (sma == NULL) 1347 if (IS_ERR(sma))
1346 continue; 1348 continue;
1347 1349
1348 if (u->semid == -1) 1350 if (u->semid == -1)
1349 goto next_entry; 1351 goto next_entry;
1350 1352
1351 BUG_ON(sem_checkid(ns,sma,u->semid)); 1353 BUG_ON(sem_checkid(sma, u->semid));
1352 1354
1353 /* remove u from the sma->undo list */ 1355 /* remove u from the sma->undo list */
1354 for (unp = &sma->undo; (un = *unp); unp = &un->id_next) { 1356 for (unp = &sma->undo; (un = *unp); unp = &un->id_next) {
@@ -1382,7 +1384,7 @@ found:
1382 semaphore->semval = 0; 1384 semaphore->semval = 0;
1383 if (semaphore->semval > SEMVMX) 1385 if (semaphore->semval > SEMVMX)
1384 semaphore->semval = SEMVMX; 1386 semaphore->semval = SEMVMX;
1385 semaphore->sempid = current->tgid; 1387 semaphore->sempid = task_tgid_vnr(current);
1386 } 1388 }
1387 } 1389 }
1388 sma->sem_otime = get_seconds(); 1390 sma->sem_otime = get_seconds();
@@ -1402,7 +1404,7 @@ static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
1402 return seq_printf(s, 1404 return seq_printf(s,
1403 "%10d %10d %4o %10lu %5u %5u %5u %5u %10lu %10lu\n", 1405 "%10d %10d %4o %10lu %5u %5u %5u %5u %10lu %10lu\n",
1404 sma->sem_perm.key, 1406 sma->sem_perm.key,
1405 sma->sem_id, 1407 sma->sem_perm.id,
1406 sma->sem_perm.mode, 1408 sma->sem_perm.mode,
1407 sma->sem_nsems, 1409 sma->sem_nsems,
1408 sma->sem_perm.uid, 1410 sma->sem_perm.uid,
diff --git a/ipc/shm.c b/ipc/shm.c
index 5fc5cf50cf1b..3818fae625c5 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -35,7 +35,7 @@
35#include <linux/capability.h> 35#include <linux/capability.h>
36#include <linux/ptrace.h> 36#include <linux/ptrace.h>
37#include <linux/seq_file.h> 37#include <linux/seq_file.h>
38#include <linux/mutex.h> 38#include <linux/rwsem.h>
39#include <linux/nsproxy.h> 39#include <linux/nsproxy.h>
40#include <linux/mount.h> 40#include <linux/mount.h>
41 41
@@ -59,17 +59,11 @@ static struct ipc_ids init_shm_ids;
59 59
60#define shm_ids(ns) (*((ns)->ids[IPC_SHM_IDS])) 60#define shm_ids(ns) (*((ns)->ids[IPC_SHM_IDS]))
61 61
62#define shm_lock(ns, id) \
63 ((struct shmid_kernel*)ipc_lock(&shm_ids(ns),id))
64#define shm_unlock(shp) \ 62#define shm_unlock(shp) \
65 ipc_unlock(&(shp)->shm_perm) 63 ipc_unlock(&(shp)->shm_perm)
66#define shm_get(ns, id) \ 64#define shm_buildid(id, seq) ipc_buildid(id, seq)
67 ((struct shmid_kernel*)ipc_get(&shm_ids(ns),id))
68#define shm_buildid(ns, id, seq) \
69 ipc_buildid(&shm_ids(ns), id, seq)
70 65
71static int newseg (struct ipc_namespace *ns, key_t key, 66static int newseg(struct ipc_namespace *, struct ipc_params *);
72 int shmflg, size_t size);
73static void shm_open(struct vm_area_struct *vma); 67static void shm_open(struct vm_area_struct *vma);
74static void shm_close(struct vm_area_struct *vma); 68static void shm_close(struct vm_area_struct *vma);
75static void shm_destroy (struct ipc_namespace *ns, struct shmid_kernel *shp); 69static void shm_destroy (struct ipc_namespace *ns, struct shmid_kernel *shp);
@@ -84,9 +78,13 @@ static void __shm_init_ns(struct ipc_namespace *ns, struct ipc_ids *ids)
84 ns->shm_ctlall = SHMALL; 78 ns->shm_ctlall = SHMALL;
85 ns->shm_ctlmni = SHMMNI; 79 ns->shm_ctlmni = SHMMNI;
86 ns->shm_tot = 0; 80 ns->shm_tot = 0;
87 ipc_init_ids(ids, 1); 81 ipc_init_ids(ids);
88} 82}
89 83
84/*
85 * Called with shm_ids.rw_mutex (writer) and the shp structure locked.
86 * Only shm_ids.rw_mutex remains locked on exit.
87 */
90static void do_shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *shp) 88static void do_shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *shp)
91{ 89{
92 if (shp->shm_nattch){ 90 if (shp->shm_nattch){
@@ -112,20 +110,24 @@ int shm_init_ns(struct ipc_namespace *ns)
112 110
113void shm_exit_ns(struct ipc_namespace *ns) 111void shm_exit_ns(struct ipc_namespace *ns)
114{ 112{
115 int i;
116 struct shmid_kernel *shp; 113 struct shmid_kernel *shp;
114 int next_id;
115 int total, in_use;
116
117 down_write(&shm_ids(ns).rw_mutex);
117 118
118 mutex_lock(&shm_ids(ns).mutex); 119 in_use = shm_ids(ns).in_use;
119 for (i = 0; i <= shm_ids(ns).max_id; i++) { 120
120 shp = shm_lock(ns, i); 121 for (total = 0, next_id = 0; total < in_use; next_id++) {
122 shp = idr_find(&shm_ids(ns).ipcs_idr, next_id);
121 if (shp == NULL) 123 if (shp == NULL)
122 continue; 124 continue;
123 125 ipc_lock_by_ptr(&shp->shm_perm);
124 do_shm_rmid(ns, shp); 126 do_shm_rmid(ns, shp);
127 total++;
125 } 128 }
126 mutex_unlock(&shm_ids(ns).mutex); 129 up_write(&shm_ids(ns).rw_mutex);
127 130
128 ipc_fini_ids(ns->ids[IPC_SHM_IDS]);
129 kfree(ns->ids[IPC_SHM_IDS]); 131 kfree(ns->ids[IPC_SHM_IDS]);
130 ns->ids[IPC_SHM_IDS] = NULL; 132 ns->ids[IPC_SHM_IDS] = NULL;
131} 133}
@@ -138,17 +140,49 @@ void __init shm_init (void)
138 IPC_SHM_IDS, sysvipc_shm_proc_show); 140 IPC_SHM_IDS, sysvipc_shm_proc_show);
139} 141}
140 142
141static inline int shm_checkid(struct ipc_namespace *ns, 143/*
142 struct shmid_kernel *s, int id) 144 * shm_lock_(check_)down routines are called in the paths where the rw_mutex
145 * is held to protect access to the idr tree.
146 */
147static inline struct shmid_kernel *shm_lock_down(struct ipc_namespace *ns,
148 int id)
143{ 149{
144 if (ipc_checkid(&shm_ids(ns), &s->shm_perm, id)) 150 struct kern_ipc_perm *ipcp = ipc_lock_down(&shm_ids(ns), id);
145 return -EIDRM; 151
146 return 0; 152 return container_of(ipcp, struct shmid_kernel, shm_perm);
153}
154
155static inline struct shmid_kernel *shm_lock_check_down(
156 struct ipc_namespace *ns,
157 int id)
158{
159 struct kern_ipc_perm *ipcp = ipc_lock_check_down(&shm_ids(ns), id);
160
161 return container_of(ipcp, struct shmid_kernel, shm_perm);
162}
163
164/*
165 * shm_lock_(check_) routines are called in the paths where the rw_mutex
166 * is not held.
167 */
168static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
169{
170 struct kern_ipc_perm *ipcp = ipc_lock(&shm_ids(ns), id);
171
172 return container_of(ipcp, struct shmid_kernel, shm_perm);
173}
174
175static inline struct shmid_kernel *shm_lock_check(struct ipc_namespace *ns,
176 int id)
177{
178 struct kern_ipc_perm *ipcp = ipc_lock_check(&shm_ids(ns), id);
179
180 return container_of(ipcp, struct shmid_kernel, shm_perm);
147} 181}
148 182
149static inline struct shmid_kernel *shm_rmid(struct ipc_namespace *ns, int id) 183static inline void shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *s)
150{ 184{
151 return (struct shmid_kernel *)ipc_rmid(&shm_ids(ns), id); 185 ipc_rmid(&shm_ids(ns), &s->shm_perm);
152} 186}
153 187
154static inline int shm_addid(struct ipc_namespace *ns, struct shmid_kernel *shp) 188static inline int shm_addid(struct ipc_namespace *ns, struct shmid_kernel *shp)
@@ -166,9 +200,9 @@ static void shm_open(struct vm_area_struct *vma)
166 struct shmid_kernel *shp; 200 struct shmid_kernel *shp;
167 201
168 shp = shm_lock(sfd->ns, sfd->id); 202 shp = shm_lock(sfd->ns, sfd->id);
169 BUG_ON(!shp); 203 BUG_ON(IS_ERR(shp));
170 shp->shm_atim = get_seconds(); 204 shp->shm_atim = get_seconds();
171 shp->shm_lprid = current->tgid; 205 shp->shm_lprid = task_tgid_vnr(current);
172 shp->shm_nattch++; 206 shp->shm_nattch++;
173 shm_unlock(shp); 207 shm_unlock(shp);
174} 208}
@@ -176,15 +210,16 @@ static void shm_open(struct vm_area_struct *vma)
176/* 210/*
177 * shm_destroy - free the struct shmid_kernel 211 * shm_destroy - free the struct shmid_kernel
178 * 212 *
213 * @ns: namespace
179 * @shp: struct to free 214 * @shp: struct to free
180 * 215 *
181 * It has to be called with shp and shm_ids.mutex locked, 216 * It has to be called with shp and shm_ids.rw_mutex (writer) locked,
182 * but returns with shp unlocked and freed. 217 * but returns with shp unlocked and freed.
183 */ 218 */
184static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) 219static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
185{ 220{
186 ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT; 221 ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
187 shm_rmid(ns, shp->id); 222 shm_rmid(ns, shp);
188 shm_unlock(shp); 223 shm_unlock(shp);
189 if (!is_file_hugepages(shp->shm_file)) 224 if (!is_file_hugepages(shp->shm_file))
190 shmem_lock(shp->shm_file, 0, shp->mlock_user); 225 shmem_lock(shp->shm_file, 0, shp->mlock_user);
@@ -209,11 +244,11 @@ static void shm_close(struct vm_area_struct *vma)
209 struct shmid_kernel *shp; 244 struct shmid_kernel *shp;
210 struct ipc_namespace *ns = sfd->ns; 245 struct ipc_namespace *ns = sfd->ns;
211 246
212 mutex_lock(&shm_ids(ns).mutex); 247 down_write(&shm_ids(ns).rw_mutex);
213 /* remove from the list of attaches of the shm segment */ 248 /* remove from the list of attaches of the shm segment */
214 shp = shm_lock(ns, sfd->id); 249 shp = shm_lock_down(ns, sfd->id);
215 BUG_ON(!shp); 250 BUG_ON(IS_ERR(shp));
216 shp->shm_lprid = current->tgid; 251 shp->shm_lprid = task_tgid_vnr(current);
217 shp->shm_dtim = get_seconds(); 252 shp->shm_dtim = get_seconds();
218 shp->shm_nattch--; 253 shp->shm_nattch--;
219 if(shp->shm_nattch == 0 && 254 if(shp->shm_nattch == 0 &&
@@ -221,7 +256,7 @@ static void shm_close(struct vm_area_struct *vma)
221 shm_destroy(ns, shp); 256 shm_destroy(ns, shp);
222 else 257 else
223 shm_unlock(shp); 258 shm_unlock(shp);
224 mutex_unlock(&shm_ids(ns).mutex); 259 up_write(&shm_ids(ns).rw_mutex);
225} 260}
226 261
227static int shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) 262static int shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
@@ -337,8 +372,19 @@ static struct vm_operations_struct shm_vm_ops = {
337#endif 372#endif
338}; 373};
339 374
340static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size) 375/**
376 * newseg - Create a new shared memory segment
377 * @ns: namespace
378 * @params: ptr to the structure that contains key, size and shmflg
379 *
380 * Called with shm_ids.rw_mutex held as a writer.
381 */
382
383static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
341{ 384{
385 key_t key = params->key;
386 int shmflg = params->flg;
387 size_t size = params->u.size;
342 int error; 388 int error;
343 struct shmid_kernel *shp; 389 struct shmid_kernel *shp;
344 int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT; 390 int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
@@ -387,28 +433,30 @@ static int newseg (struct ipc_namespace *ns, key_t key, int shmflg, size_t size)
387 if (IS_ERR(file)) 433 if (IS_ERR(file))
388 goto no_file; 434 goto no_file;
389 435
390 error = -ENOSPC;
391 id = shm_addid(ns, shp); 436 id = shm_addid(ns, shp);
392 if(id == -1) 437 if (id < 0) {
438 error = id;
393 goto no_id; 439 goto no_id;
440 }
394 441
395 shp->shm_cprid = current->tgid; 442 shp->shm_cprid = task_tgid_vnr(current);
396 shp->shm_lprid = 0; 443 shp->shm_lprid = 0;
397 shp->shm_atim = shp->shm_dtim = 0; 444 shp->shm_atim = shp->shm_dtim = 0;
398 shp->shm_ctim = get_seconds(); 445 shp->shm_ctim = get_seconds();
399 shp->shm_segsz = size; 446 shp->shm_segsz = size;
400 shp->shm_nattch = 0; 447 shp->shm_nattch = 0;
401 shp->id = shm_buildid(ns, id, shp->shm_perm.seq); 448 shp->shm_perm.id = shm_buildid(id, shp->shm_perm.seq);
402 shp->shm_file = file; 449 shp->shm_file = file;
403 /* 450 /*
404 * shmid gets reported as "inode#" in /proc/pid/maps. 451 * shmid gets reported as "inode#" in /proc/pid/maps.
405 * proc-ps tools use this. Changing this will break them. 452 * proc-ps tools use this. Changing this will break them.
406 */ 453 */
407 file->f_dentry->d_inode->i_ino = shp->id; 454 file->f_dentry->d_inode->i_ino = shp->shm_perm.id;
408 455
409 ns->shm_tot += numpages; 456 ns->shm_tot += numpages;
457 error = shp->shm_perm.id;
410 shm_unlock(shp); 458 shm_unlock(shp);
411 return shp->id; 459 return error;
412 460
413no_id: 461no_id:
414 fput(file); 462 fput(file);
@@ -418,42 +466,49 @@ no_file:
418 return error; 466 return error;
419} 467}
420 468
421asmlinkage long sys_shmget (key_t key, size_t size, int shmflg) 469/*
470 * Called with shm_ids.rw_mutex and ipcp locked.
471 */
472static inline int shm_security(struct kern_ipc_perm *ipcp, int shmflg)
422{ 473{
423 struct shmid_kernel *shp; 474 struct shmid_kernel *shp;
424 int err, id = 0; 475
476 shp = container_of(ipcp, struct shmid_kernel, shm_perm);
477 return security_shm_associate(shp, shmflg);
478}
479
480/*
481 * Called with shm_ids.rw_mutex and ipcp locked.
482 */
483static inline int shm_more_checks(struct kern_ipc_perm *ipcp,
484 struct ipc_params *params)
485{
486 struct shmid_kernel *shp;
487
488 shp = container_of(ipcp, struct shmid_kernel, shm_perm);
489 if (shp->shm_segsz < params->u.size)
490 return -EINVAL;
491
492 return 0;
493}
494
495asmlinkage long sys_shmget (key_t key, size_t size, int shmflg)
496{
425 struct ipc_namespace *ns; 497 struct ipc_namespace *ns;
498 struct ipc_ops shm_ops;
499 struct ipc_params shm_params;
426 500
427 ns = current->nsproxy->ipc_ns; 501 ns = current->nsproxy->ipc_ns;
428 502
429 mutex_lock(&shm_ids(ns).mutex); 503 shm_ops.getnew = newseg;
430 if (key == IPC_PRIVATE) { 504 shm_ops.associate = shm_security;
431 err = newseg(ns, key, shmflg, size); 505 shm_ops.more_checks = shm_more_checks;
432 } else if ((id = ipc_findkey(&shm_ids(ns), key)) == -1) {
433 if (!(shmflg & IPC_CREAT))
434 err = -ENOENT;
435 else
436 err = newseg(ns, key, shmflg, size);
437 } else if ((shmflg & IPC_CREAT) && (shmflg & IPC_EXCL)) {
438 err = -EEXIST;
439 } else {
440 shp = shm_lock(ns, id);
441 BUG_ON(shp==NULL);
442 if (shp->shm_segsz < size)
443 err = -EINVAL;
444 else if (ipcperms(&shp->shm_perm, shmflg))
445 err = -EACCES;
446 else {
447 int shmid = shm_buildid(ns, id, shp->shm_perm.seq);
448 err = security_shm_associate(shp, shmflg);
449 if (!err)
450 err = shmid;
451 }
452 shm_unlock(shp);
453 }
454 mutex_unlock(&shm_ids(ns).mutex);
455 506
456 return err; 507 shm_params.key = key;
508 shm_params.flg = shmflg;
509 shm_params.u.size = size;
510
511 return ipcget(ns, &shm_ids(ns), &shm_ops, &shm_params);
457} 512}
458 513
459static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version) 514static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ds *in, int version)
@@ -547,20 +602,26 @@ static inline unsigned long copy_shminfo_to_user(void __user *buf, struct shminf
547 } 602 }
548} 603}
549 604
605/*
606 * Called with shm_ids.rw_mutex held as a reader
607 */
550static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss, 608static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss,
551 unsigned long *swp) 609 unsigned long *swp)
552{ 610{
553 int i; 611 int next_id;
612 int total, in_use;
554 613
555 *rss = 0; 614 *rss = 0;
556 *swp = 0; 615 *swp = 0;
557 616
558 for (i = 0; i <= shm_ids(ns).max_id; i++) { 617 in_use = shm_ids(ns).in_use;
618
619 for (total = 0, next_id = 0; total < in_use; next_id++) {
559 struct shmid_kernel *shp; 620 struct shmid_kernel *shp;
560 struct inode *inode; 621 struct inode *inode;
561 622
562 shp = shm_get(ns, i); 623 shp = idr_find(&shm_ids(ns).ipcs_idr, next_id);
563 if(!shp) 624 if (shp == NULL)
564 continue; 625 continue;
565 626
566 inode = shp->shm_file->f_path.dentry->d_inode; 627 inode = shp->shm_file->f_path.dentry->d_inode;
@@ -575,6 +636,8 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss,
575 *swp += info->swapped; 636 *swp += info->swapped;
576 spin_unlock(&info->lock); 637 spin_unlock(&info->lock);
577 } 638 }
639
640 total++;
578 } 641 }
579} 642}
580 643
@@ -610,8 +673,11 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
610 shminfo.shmmin = SHMMIN; 673 shminfo.shmmin = SHMMIN;
611 if(copy_shminfo_to_user (buf, &shminfo, version)) 674 if(copy_shminfo_to_user (buf, &shminfo, version))
612 return -EFAULT; 675 return -EFAULT;
613 /* reading a integer is always atomic */ 676
614 err= shm_ids(ns).max_id; 677 down_read(&shm_ids(ns).rw_mutex);
678 err = ipc_get_maxid(&shm_ids(ns));
679 up_read(&shm_ids(ns).rw_mutex);
680
615 if(err<0) 681 if(err<0)
616 err = 0; 682 err = 0;
617 goto out; 683 goto out;
@@ -625,14 +691,14 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
625 return err; 691 return err;
626 692
627 memset(&shm_info,0,sizeof(shm_info)); 693 memset(&shm_info,0,sizeof(shm_info));
628 mutex_lock(&shm_ids(ns).mutex); 694 down_read(&shm_ids(ns).rw_mutex);
629 shm_info.used_ids = shm_ids(ns).in_use; 695 shm_info.used_ids = shm_ids(ns).in_use;
630 shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp); 696 shm_get_stat (ns, &shm_info.shm_rss, &shm_info.shm_swp);
631 shm_info.shm_tot = ns->shm_tot; 697 shm_info.shm_tot = ns->shm_tot;
632 shm_info.swap_attempts = 0; 698 shm_info.swap_attempts = 0;
633 shm_info.swap_successes = 0; 699 shm_info.swap_successes = 0;
634 err = shm_ids(ns).max_id; 700 err = ipc_get_maxid(&shm_ids(ns));
635 mutex_unlock(&shm_ids(ns).mutex); 701 up_read(&shm_ids(ns).rw_mutex);
636 if(copy_to_user (buf, &shm_info, sizeof(shm_info))) { 702 if(copy_to_user (buf, &shm_info, sizeof(shm_info))) {
637 err = -EFAULT; 703 err = -EFAULT;
638 goto out; 704 goto out;
@@ -646,20 +712,25 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
646 { 712 {
647 struct shmid64_ds tbuf; 713 struct shmid64_ds tbuf;
648 int result; 714 int result;
649 memset(&tbuf, 0, sizeof(tbuf)); 715
650 shp = shm_lock(ns, shmid); 716 if (!buf) {
651 if(shp==NULL) { 717 err = -EFAULT;
652 err = -EINVAL;
653 goto out; 718 goto out;
654 } else if(cmd==SHM_STAT) { 719 }
655 err = -EINVAL; 720
656 if (shmid > shm_ids(ns).max_id) 721 if (cmd == SHM_STAT) {
657 goto out_unlock; 722 shp = shm_lock(ns, shmid);
658 result = shm_buildid(ns, shmid, shp->shm_perm.seq); 723 if (IS_ERR(shp)) {
724 err = PTR_ERR(shp);
725 goto out;
726 }
727 result = shp->shm_perm.id;
659 } else { 728 } else {
660 err = shm_checkid(ns, shp,shmid); 729 shp = shm_lock_check(ns, shmid);
661 if(err) 730 if (IS_ERR(shp)) {
662 goto out_unlock; 731 err = PTR_ERR(shp);
732 goto out;
733 }
663 result = 0; 734 result = 0;
664 } 735 }
665 err=-EACCES; 736 err=-EACCES;
@@ -668,6 +739,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
668 err = security_shm_shmctl(shp, cmd); 739 err = security_shm_shmctl(shp, cmd);
669 if (err) 740 if (err)
670 goto out_unlock; 741 goto out_unlock;
742 memset(&tbuf, 0, sizeof(tbuf));
671 kernel_to_ipc64_perm(&shp->shm_perm, &tbuf.shm_perm); 743 kernel_to_ipc64_perm(&shp->shm_perm, &tbuf.shm_perm);
672 tbuf.shm_segsz = shp->shm_segsz; 744 tbuf.shm_segsz = shp->shm_segsz;
673 tbuf.shm_atime = shp->shm_atim; 745 tbuf.shm_atime = shp->shm_atim;
@@ -686,14 +758,11 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
686 case SHM_LOCK: 758 case SHM_LOCK:
687 case SHM_UNLOCK: 759 case SHM_UNLOCK:
688 { 760 {
689 shp = shm_lock(ns, shmid); 761 shp = shm_lock_check(ns, shmid);
690 if(shp==NULL) { 762 if (IS_ERR(shp)) {
691 err = -EINVAL; 763 err = PTR_ERR(shp);
692 goto out; 764 goto out;
693 } 765 }
694 err = shm_checkid(ns, shp,shmid);
695 if(err)
696 goto out_unlock;
697 766
698 err = audit_ipc_obj(&(shp->shm_perm)); 767 err = audit_ipc_obj(&(shp->shm_perm));
699 if (err) 768 if (err)
@@ -742,14 +811,12 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
742 * Instead we set a destroyed flag, and then blow 811 * Instead we set a destroyed flag, and then blow
743 * the name away when the usage hits zero. 812 * the name away when the usage hits zero.
744 */ 813 */
745 mutex_lock(&shm_ids(ns).mutex); 814 down_write(&shm_ids(ns).rw_mutex);
746 shp = shm_lock(ns, shmid); 815 shp = shm_lock_check_down(ns, shmid);
747 err = -EINVAL; 816 if (IS_ERR(shp)) {
748 if (shp == NULL) 817 err = PTR_ERR(shp);
749 goto out_up; 818 goto out_up;
750 err = shm_checkid(ns, shp, shmid); 819 }
751 if(err)
752 goto out_unlock_up;
753 820
754 err = audit_ipc_obj(&(shp->shm_perm)); 821 err = audit_ipc_obj(&(shp->shm_perm));
755 if (err) 822 if (err)
@@ -767,24 +834,27 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
767 goto out_unlock_up; 834 goto out_unlock_up;
768 835
769 do_shm_rmid(ns, shp); 836 do_shm_rmid(ns, shp);
770 mutex_unlock(&shm_ids(ns).mutex); 837 up_write(&shm_ids(ns).rw_mutex);
771 goto out; 838 goto out;
772 } 839 }
773 840
774 case IPC_SET: 841 case IPC_SET:
775 { 842 {
843 if (!buf) {
844 err = -EFAULT;
845 goto out;
846 }
847
776 if (copy_shmid_from_user (&setbuf, buf, version)) { 848 if (copy_shmid_from_user (&setbuf, buf, version)) {
777 err = -EFAULT; 849 err = -EFAULT;
778 goto out; 850 goto out;
779 } 851 }
780 mutex_lock(&shm_ids(ns).mutex); 852 down_write(&shm_ids(ns).rw_mutex);
781 shp = shm_lock(ns, shmid); 853 shp = shm_lock_check_down(ns, shmid);
782 err=-EINVAL; 854 if (IS_ERR(shp)) {
783 if(shp==NULL) 855 err = PTR_ERR(shp);
784 goto out_up; 856 goto out_up;
785 err = shm_checkid(ns, shp,shmid); 857 }
786 if(err)
787 goto out_unlock_up;
788 err = audit_ipc_obj(&(shp->shm_perm)); 858 err = audit_ipc_obj(&(shp->shm_perm));
789 if (err) 859 if (err)
790 goto out_unlock_up; 860 goto out_unlock_up;
@@ -819,7 +889,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
819out_unlock_up: 889out_unlock_up:
820 shm_unlock(shp); 890 shm_unlock(shp);
821out_up: 891out_up:
822 mutex_unlock(&shm_ids(ns).mutex); 892 up_write(&shm_ids(ns).rw_mutex);
823 goto out; 893 goto out;
824out_unlock: 894out_unlock:
825 shm_unlock(shp); 895 shm_unlock(shp);
@@ -890,13 +960,11 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
890 * additional creator id... 960 * additional creator id...
891 */ 961 */
892 ns = current->nsproxy->ipc_ns; 962 ns = current->nsproxy->ipc_ns;
893 shp = shm_lock(ns, shmid); 963 shp = shm_lock_check(ns, shmid);
894 if(shp == NULL) 964 if (IS_ERR(shp)) {
965 err = PTR_ERR(shp);
895 goto out; 966 goto out;
896 967 }
897 err = shm_checkid(ns, shp,shmid);
898 if (err)
899 goto out_unlock;
900 968
901 err = -EACCES; 969 err = -EACCES;
902 if (ipcperms(&shp->shm_perm, acc_mode)) 970 if (ipcperms(&shp->shm_perm, acc_mode))
@@ -925,7 +993,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
925 993
926 file->private_data = sfd; 994 file->private_data = sfd;
927 file->f_mapping = shp->shm_file->f_mapping; 995 file->f_mapping = shp->shm_file->f_mapping;
928 sfd->id = shp->id; 996 sfd->id = shp->shm_perm.id;
929 sfd->ns = get_ipc_ns(ns); 997 sfd->ns = get_ipc_ns(ns);
930 sfd->file = shp->shm_file; 998 sfd->file = shp->shm_file;
931 sfd->vm_ops = NULL; 999 sfd->vm_ops = NULL;
@@ -955,16 +1023,16 @@ invalid:
955 fput(file); 1023 fput(file);
956 1024
957out_nattch: 1025out_nattch:
958 mutex_lock(&shm_ids(ns).mutex); 1026 down_write(&shm_ids(ns).rw_mutex);
959 shp = shm_lock(ns, shmid); 1027 shp = shm_lock_down(ns, shmid);
960 BUG_ON(!shp); 1028 BUG_ON(IS_ERR(shp));
961 shp->shm_nattch--; 1029 shp->shm_nattch--;
962 if(shp->shm_nattch == 0 && 1030 if(shp->shm_nattch == 0 &&
963 shp->shm_perm.mode & SHM_DEST) 1031 shp->shm_perm.mode & SHM_DEST)
964 shm_destroy(ns, shp); 1032 shm_destroy(ns, shp);
965 else 1033 else
966 shm_unlock(shp); 1034 shm_unlock(shp);
967 mutex_unlock(&shm_ids(ns).mutex); 1035 up_write(&shm_ids(ns).rw_mutex);
968 1036
969out: 1037out:
970 return err; 1038 return err;
@@ -1094,7 +1162,7 @@ static int sysvipc_shm_proc_show(struct seq_file *s, void *it)
1094 format = BIG_STRING; 1162 format = BIG_STRING;
1095 return seq_printf(s, format, 1163 return seq_printf(s, format,
1096 shp->shm_perm.key, 1164 shp->shm_perm.key,
1097 shp->id, 1165 shp->shm_perm.id,
1098 shp->shm_perm.mode, 1166 shp->shm_perm.mode,
1099 shp->shm_segsz, 1167 shp->shm_segsz,
1100 shp->shm_cprid, 1168 shp->shm_cprid,
diff --git a/ipc/util.c b/ipc/util.c
index 44e5135aee47..1aa0ebf71bac 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -32,6 +32,7 @@
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/audit.h> 33#include <linux/audit.h>
34#include <linux/nsproxy.h> 34#include <linux/nsproxy.h>
35#include <linux/rwsem.h>
35 36
36#include <asm/unistd.h> 37#include <asm/unistd.h>
37 38
@@ -129,23 +130,16 @@ __initcall(ipc_init);
129/** 130/**
130 * ipc_init_ids - initialise IPC identifiers 131 * ipc_init_ids - initialise IPC identifiers
131 * @ids: Identifier set 132 * @ids: Identifier set
132 * @size: Number of identifiers
133 * 133 *
134 * Given a size for the ipc identifier range (limited below IPCMNI) 134 * Set up the sequence range to use for the ipc identifier range (limited
135 * set up the sequence range to use then allocate and initialise the 135 * below IPCMNI) then initialise the ids idr.
136 * array itself.
137 */ 136 */
138 137
139void ipc_init_ids(struct ipc_ids* ids, int size) 138void ipc_init_ids(struct ipc_ids *ids)
140{ 139{
141 int i; 140 init_rwsem(&ids->rw_mutex);
142 141
143 mutex_init(&ids->mutex);
144
145 if(size > IPCMNI)
146 size = IPCMNI;
147 ids->in_use = 0; 142 ids->in_use = 0;
148 ids->max_id = -1;
149 ids->seq = 0; 143 ids->seq = 0;
150 { 144 {
151 int seq_limit = INT_MAX/SEQ_MULTIPLIER; 145 int seq_limit = INT_MAX/SEQ_MULTIPLIER;
@@ -155,17 +149,7 @@ void ipc_init_ids(struct ipc_ids* ids, int size)
155 ids->seq_max = seq_limit; 149 ids->seq_max = seq_limit;
156 } 150 }
157 151
158 ids->entries = ipc_rcu_alloc(sizeof(struct kern_ipc_perm *)*size + 152 idr_init(&ids->ipcs_idr);
159 sizeof(struct ipc_id_ary));
160
161 if(ids->entries == NULL) {
162 printk(KERN_ERR "ipc_init_ids() failed, ipc service disabled.\n");
163 size = 0;
164 ids->entries = &ids->nullentry;
165 }
166 ids->entries->size = size;
167 for(i=0;i<size;i++)
168 ids->entries->p[i] = NULL;
169} 153}
170 154
171#ifdef CONFIG_PROC_FS 155#ifdef CONFIG_PROC_FS
@@ -208,99 +192,96 @@ void __init ipc_init_proc_interface(const char *path, const char *header,
208 * @ids: Identifier set 192 * @ids: Identifier set
209 * @key: The key to find 193 * @key: The key to find
210 * 194 *
211 * Requires ipc_ids.mutex locked. 195 * Requires ipc_ids.rw_mutex locked.
212 * Returns the identifier if found or -1 if not. 196 * Returns the LOCKED pointer to the ipc structure if found or NULL
197 * if not.
198 * If key is found ipc points to the owning ipc structure
213 */ 199 */
214 200
215int ipc_findkey(struct ipc_ids* ids, key_t key) 201static struct kern_ipc_perm *ipc_findkey(struct ipc_ids *ids, key_t key)
216{ 202{
217 int id; 203 struct kern_ipc_perm *ipc;
218 struct kern_ipc_perm* p; 204 int next_id;
219 int max_id = ids->max_id; 205 int total;
220 206
221 /* 207 for (total = 0, next_id = 0; total < ids->in_use; next_id++) {
222 * rcu_dereference() is not needed here 208 ipc = idr_find(&ids->ipcs_idr, next_id);
223 * since ipc_ids.mutex is held 209
224 */ 210 if (ipc == NULL)
225 for (id = 0; id <= max_id; id++) { 211 continue;
226 p = ids->entries->p[id]; 212
227 if(p==NULL) 213 if (ipc->key != key) {
214 total++;
228 continue; 215 continue;
229 if (key == p->key) 216 }
230 return id; 217
218 ipc_lock_by_ptr(ipc);
219 return ipc;
231 } 220 }
232 return -1; 221
222 return NULL;
233} 223}
234 224
235/* 225/**
236 * Requires ipc_ids.mutex locked 226 * ipc_get_maxid - get the last assigned id
227 * @ids: IPC identifier set
228 *
229 * Called with ipc_ids.rw_mutex held.
237 */ 230 */
238static int grow_ary(struct ipc_ids* ids, int newsize)
239{
240 struct ipc_id_ary* new;
241 struct ipc_id_ary* old;
242 int i;
243 int size = ids->entries->size;
244
245 if(newsize > IPCMNI)
246 newsize = IPCMNI;
247 if(newsize <= size)
248 return newsize;
249
250 new = ipc_rcu_alloc(sizeof(struct kern_ipc_perm *)*newsize +
251 sizeof(struct ipc_id_ary));
252 if(new == NULL)
253 return size;
254 new->size = newsize;
255 memcpy(new->p, ids->entries->p, sizeof(struct kern_ipc_perm *)*size);
256 for(i=size;i<newsize;i++) {
257 new->p[i] = NULL;
258 }
259 old = ids->entries;
260 231
261 /* 232int ipc_get_maxid(struct ipc_ids *ids)
262 * Use rcu_assign_pointer() to make sure the memcpyed contents 233{
263 * of the new array are visible before the new array becomes visible. 234 struct kern_ipc_perm *ipc;
264 */ 235 int max_id = -1;
265 rcu_assign_pointer(ids->entries, new); 236 int total, id;
237
238 if (ids->in_use == 0)
239 return -1;
266 240
267 __ipc_fini_ids(ids, old); 241 if (ids->in_use == IPCMNI)
268 return newsize; 242 return IPCMNI - 1;
243
244 /* Look for the last assigned id */
245 total = 0;
246 for (id = 0; id < IPCMNI && total < ids->in_use; id++) {
247 ipc = idr_find(&ids->ipcs_idr, id);
248 if (ipc != NULL) {
249 max_id = id;
250 total++;
251 }
252 }
253 return max_id;
269} 254}
270 255
271/** 256/**
272 * ipc_addid - add an IPC identifier 257 * ipc_addid - add an IPC identifier
273 * @ids: IPC identifier set 258 * @ids: IPC identifier set
274 * @new: new IPC permission set 259 * @new: new IPC permission set
275 * @size: new size limit for the id array 260 * @size: limit for the number of used ids
276 * 261 *
277 * Add an entry 'new' to the IPC arrays. The permissions object is 262 * Add an entry 'new' to the IPC ids idr. The permissions object is
278 * initialised and the first free entry is set up and the id assigned 263 * initialised and the first free entry is set up and the id assigned
279 * is returned. The list is returned in a locked state on success. 264 * is returned. The 'new' entry is returned in a locked state on success.
280 * On failure the list is not locked and -1 is returned. 265 * On failure the entry is not locked and a negative err-code is returned.
281 * 266 *
282 * Called with ipc_ids.mutex held. 267 * Called with ipc_ids.rw_mutex held as a writer.
283 */ 268 */
284 269
285int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) 270int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size)
286{ 271{
287 int id; 272 int id, err;
288 273
289 size = grow_ary(ids,size); 274 if (size > IPCMNI)
275 size = IPCMNI;
276
277 if (ids->in_use >= size)
278 return -ENOSPC;
279
280 err = idr_get_new(&ids->ipcs_idr, new, &id);
281 if (err)
282 return err;
290 283
291 /*
292 * rcu_dereference()() is not needed here since
293 * ipc_ids.mutex is held
294 */
295 for (id = 0; id < size; id++) {
296 if(ids->entries->p[id] == NULL)
297 goto found;
298 }
299 return -1;
300found:
301 ids->in_use++; 284 ids->in_use++;
302 if (id > ids->max_id)
303 ids->max_id = id;
304 285
305 new->cuid = new->uid = current->euid; 286 new->cuid = new->uid = current->euid;
306 new->gid = new->cgid = current->egid; 287 new->gid = new->cgid = current->egid;
@@ -313,48 +294,153 @@ found:
313 new->deleted = 0; 294 new->deleted = 0;
314 rcu_read_lock(); 295 rcu_read_lock();
315 spin_lock(&new->lock); 296 spin_lock(&new->lock);
316 ids->entries->p[id] = new;
317 return id; 297 return id;
318} 298}
319 299
320/** 300/**
301 * ipcget_new - create a new ipc object
302 * @ns: namespace
303 * @ids: IPC identifer set
304 * @ops: the actual creation routine to call
305 * @params: its parameters
306 *
307 * This routine is called by sys_msgget, sys_semget() and sys_shmget()
308 * when the key is IPC_PRIVATE.
309 */
310int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids,
311 struct ipc_ops *ops, struct ipc_params *params)
312{
313 int err;
314retry:
315 err = idr_pre_get(&ids->ipcs_idr, GFP_KERNEL);
316
317 if (!err)
318 return -ENOMEM;
319
320 down_write(&ids->rw_mutex);
321 err = ops->getnew(ns, params);
322 up_write(&ids->rw_mutex);
323
324 if (err == -EAGAIN)
325 goto retry;
326
327 return err;
328}
329
330/**
331 * ipc_check_perms - check security and permissions for an IPC
332 * @ipcp: ipc permission set
333 * @ops: the actual security routine to call
334 * @params: its parameters
335 *
336 * This routine is called by sys_msgget(), sys_semget() and sys_shmget()
337 * when the key is not IPC_PRIVATE and that key already exists in the
338 * ids IDR.
339 *
340 * On success, the IPC id is returned.
341 *
342 * It is called with ipc_ids.rw_mutex and ipcp->lock held.
343 */
344static int ipc_check_perms(struct kern_ipc_perm *ipcp, struct ipc_ops *ops,
345 struct ipc_params *params)
346{
347 int err;
348
349 if (ipcperms(ipcp, params->flg))
350 err = -EACCES;
351 else {
352 err = ops->associate(ipcp, params->flg);
353 if (!err)
354 err = ipcp->id;
355 }
356
357 return err;
358}
359
360/**
361 * ipcget_public - get an ipc object or create a new one
362 * @ns: namespace
363 * @ids: IPC identifer set
364 * @ops: the actual creation routine to call
365 * @params: its parameters
366 *
367 * This routine is called by sys_msgget, sys_semget() and sys_shmget()
368 * when the key is not IPC_PRIVATE.
369 * It adds a new entry if the key is not found and does some permission
370 * / security checkings if the key is found.
371 *
372 * On success, the ipc id is returned.
373 */
374int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids,
375 struct ipc_ops *ops, struct ipc_params *params)
376{
377 struct kern_ipc_perm *ipcp;
378 int flg = params->flg;
379 int err;
380retry:
381 err = idr_pre_get(&ids->ipcs_idr, GFP_KERNEL);
382
383 /*
384 * Take the lock as a writer since we are potentially going to add
385 * a new entry + read locks are not "upgradable"
386 */
387 down_write(&ids->rw_mutex);
388 ipcp = ipc_findkey(ids, params->key);
389 if (ipcp == NULL) {
390 /* key not used */
391 if (!(flg & IPC_CREAT))
392 err = -ENOENT;
393 else if (!err)
394 err = -ENOMEM;
395 else
396 err = ops->getnew(ns, params);
397 } else {
398 /* ipc object has been locked by ipc_findkey() */
399
400 if (flg & IPC_CREAT && flg & IPC_EXCL)
401 err = -EEXIST;
402 else {
403 err = 0;
404 if (ops->more_checks)
405 err = ops->more_checks(ipcp, params);
406 if (!err)
407 /*
408 * ipc_check_perms returns the IPC id on
409 * success
410 */
411 err = ipc_check_perms(ipcp, ops, params);
412 }
413 ipc_unlock(ipcp);
414 }
415 up_write(&ids->rw_mutex);
416
417 if (err == -EAGAIN)
418 goto retry;
419
420 return err;
421}
422
423
424/**
321 * ipc_rmid - remove an IPC identifier 425 * ipc_rmid - remove an IPC identifier
322 * @ids: identifier set 426 * @ids: IPC identifier set
323 * @id: Identifier to remove 427 * @ipcp: ipc perm structure containing the identifier to remove
324 * 428 *
325 * The identifier must be valid, and in use. The kernel will panic if 429 * ipc_ids.rw_mutex (as a writer) and the spinlock for this ID are held
326 * fed an invalid identifier. The entry is removed and internal 430 * before this function is called, and remain locked on the exit.
327 * variables recomputed. The object associated with the identifier
328 * is returned.
329 * ipc_ids.mutex and the spinlock for this ID is hold before this function
330 * is called, and remain locked on the exit.
331 */ 431 */
332 432
333struct kern_ipc_perm* ipc_rmid(struct ipc_ids* ids, int id) 433void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
334{ 434{
335 struct kern_ipc_perm* p; 435 int lid = ipcid_to_idx(ipcp->id);
336 int lid = id % SEQ_MULTIPLIER; 436
337 BUG_ON(lid >= ids->entries->size); 437 idr_remove(&ids->ipcs_idr, lid);
338 438
339 /*
340 * do not need a rcu_dereference()() here to force ordering
341 * on Alpha, since the ipc_ids.mutex is held.
342 */
343 p = ids->entries->p[lid];
344 ids->entries->p[lid] = NULL;
345 BUG_ON(p==NULL);
346 ids->in_use--; 439 ids->in_use--;
347 440
348 if (lid == ids->max_id) { 441 ipcp->deleted = 1;
349 do { 442
350 lid--; 443 return;
351 if(lid == -1)
352 break;
353 } while (ids->entries->p[lid] == NULL);
354 ids->max_id = lid;
355 }
356 p->deleted = 1;
357 return p;
358} 444}
359 445
360/** 446/**
@@ -491,10 +577,12 @@ static void ipc_do_vfree(struct work_struct *work)
491 */ 577 */
492static void ipc_schedule_free(struct rcu_head *head) 578static void ipc_schedule_free(struct rcu_head *head)
493{ 579{
494 struct ipc_rcu_grace *grace = 580 struct ipc_rcu_grace *grace;
495 container_of(head, struct ipc_rcu_grace, rcu); 581 struct ipc_rcu_sched *sched;
496 struct ipc_rcu_sched *sched = 582
497 container_of(&(grace->data[0]), struct ipc_rcu_sched, data[0]); 583 grace = container_of(head, struct ipc_rcu_grace, rcu);
584 sched = container_of(&(grace->data[0]), struct ipc_rcu_sched,
585 data[0]);
498 586
499 INIT_WORK(&sched->work, ipc_do_vfree); 587 INIT_WORK(&sched->work, ipc_do_vfree);
500 schedule_work(&sched->work); 588 schedule_work(&sched->work);
@@ -583,7 +671,7 @@ void kernel_to_ipc64_perm (struct kern_ipc_perm *in, struct ipc64_perm *out)
583} 671}
584 672
585/** 673/**
586 * ipc64_perm_to_ipc_perm - convert old ipc permissions to new 674 * ipc64_perm_to_ipc_perm - convert new ipc permissions to old
587 * @in: new style IPC permissions 675 * @in: new style IPC permissions
588 * @out: old style IPC permissions 676 * @out: old style IPC permissions
589 * 677 *
@@ -602,44 +690,37 @@ void ipc64_perm_to_ipc_perm (struct ipc64_perm *in, struct ipc_perm *out)
602 out->seq = in->seq; 690 out->seq = in->seq;
603} 691}
604 692
605/* 693/**
606 * So far only shm_get_stat() calls ipc_get() via shm_get(), so ipc_get() 694 * ipc_lock - Lock an ipc structure without rw_mutex held
607 * is called with shm_ids.mutex locked. Since grow_ary() is also called with 695 * @ids: IPC identifier set
608 * shm_ids.mutex down(for Shared Memory), there is no need to add read 696 * @id: ipc id to look for
609 * barriers here to gurantee the writes in grow_ary() are seen in order 697 *
610 * here (for Alpha). 698 * Look for an id in the ipc ids idr and lock the associated ipc object.
611 * 699 *
612 * However ipc_get() itself does not necessary require ipc_ids.mutex down. So 700 * The ipc object is locked on exit.
613 * if in the future ipc_get() is used by other places without ipc_ids.mutex 701 *
614 * down, then ipc_get() needs read memery barriers as ipc_lock() does. 702 * This is the routine that should be called when the rw_mutex is not already
703 * held, i.e. idr tree not protected: it protects the idr tree in read mode
704 * during the idr_find().
615 */ 705 */
616struct kern_ipc_perm* ipc_get(struct ipc_ids* ids, int id)
617{
618 struct kern_ipc_perm* out;
619 int lid = id % SEQ_MULTIPLIER;
620 if(lid >= ids->entries->size)
621 return NULL;
622 out = ids->entries->p[lid];
623 return out;
624}
625 706
626struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id) 707struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
627{ 708{
628 struct kern_ipc_perm* out; 709 struct kern_ipc_perm *out;
629 int lid = id % SEQ_MULTIPLIER; 710 int lid = ipcid_to_idx(id);
630 struct ipc_id_ary* entries; 711
712 down_read(&ids->rw_mutex);
631 713
632 rcu_read_lock(); 714 rcu_read_lock();
633 entries = rcu_dereference(ids->entries); 715 out = idr_find(&ids->ipcs_idr, lid);
634 if(lid >= entries->size) { 716 if (out == NULL) {
635 rcu_read_unlock();
636 return NULL;
637 }
638 out = entries->p[lid];
639 if(out == NULL) {
640 rcu_read_unlock(); 717 rcu_read_unlock();
641 return NULL; 718 up_read(&ids->rw_mutex);
719 return ERR_PTR(-EINVAL);
642 } 720 }
721
722 up_read(&ids->rw_mutex);
723
643 spin_lock(&out->lock); 724 spin_lock(&out->lock);
644 725
645 /* ipc_rmid() may have already freed the ID while ipc_lock 726 /* ipc_rmid() may have already freed the ID while ipc_lock
@@ -648,33 +729,44 @@ struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id)
648 if (out->deleted) { 729 if (out->deleted) {
649 spin_unlock(&out->lock); 730 spin_unlock(&out->lock);
650 rcu_read_unlock(); 731 rcu_read_unlock();
651 return NULL; 732 return ERR_PTR(-EINVAL);
652 } 733 }
734
653 return out; 735 return out;
654} 736}
655 737
656void ipc_lock_by_ptr(struct kern_ipc_perm *perm) 738/**
657{ 739 * ipc_lock_down - Lock an ipc structure with rw_sem held
658 rcu_read_lock(); 740 * @ids: IPC identifier set
659 spin_lock(&perm->lock); 741 * @id: ipc id to look for
660} 742 *
743 * Look for an id in the ipc ids idr and lock the associated ipc object.
744 *
745 * The ipc object is locked on exit.
746 *
747 * This is the routine that should be called when the rw_mutex is already
748 * held, i.e. idr tree protected.
749 */
661 750
662void ipc_unlock(struct kern_ipc_perm* perm) 751struct kern_ipc_perm *ipc_lock_down(struct ipc_ids *ids, int id)
663{ 752{
664 spin_unlock(&perm->lock); 753 struct kern_ipc_perm *out;
665 rcu_read_unlock(); 754 int lid = ipcid_to_idx(id);
666}
667 755
668int ipc_buildid(struct ipc_ids* ids, int id, int seq) 756 rcu_read_lock();
669{ 757 out = idr_find(&ids->ipcs_idr, lid);
670 return SEQ_MULTIPLIER*seq + id; 758 if (out == NULL) {
671} 759 rcu_read_unlock();
760 return ERR_PTR(-EINVAL);
761 }
672 762
673int ipc_checkid(struct ipc_ids* ids, struct kern_ipc_perm* ipcp, int uid) 763 spin_lock(&out->lock);
674{ 764
675 if(uid/SEQ_MULTIPLIER != ipcp->seq) 765 /*
676 return 1; 766 * No need to verify that the structure is still valid since the
677 return 0; 767 * rw_mutex is held.
768 */
769 return out;
678} 770}
679 771
680#ifdef __ARCH_WANT_IPC_PARSE_VERSION 772#ifdef __ARCH_WANT_IPC_PARSE_VERSION
@@ -707,27 +799,30 @@ struct ipc_proc_iter {
707 struct ipc_proc_iface *iface; 799 struct ipc_proc_iface *iface;
708}; 800};
709 801
710static void *sysvipc_proc_next(struct seq_file *s, void *it, loff_t *pos) 802/*
803 * This routine locks the ipc structure found at least at position pos.
804 */
805struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
806 loff_t *new_pos)
711{ 807{
712 struct ipc_proc_iter *iter = s->private; 808 struct kern_ipc_perm *ipc;
713 struct ipc_proc_iface *iface = iter->iface; 809 int total, id;
714 struct kern_ipc_perm *ipc = it;
715 loff_t p;
716 struct ipc_ids *ids;
717 810
718 ids = iter->ns->ids[iface->ids]; 811 total = 0;
812 for (id = 0; id < pos && total < ids->in_use; id++) {
813 ipc = idr_find(&ids->ipcs_idr, id);
814 if (ipc != NULL)
815 total++;
816 }
719 817
720 /* If we had an ipc id locked before, unlock it */ 818 if (total >= ids->in_use)
721 if (ipc && ipc != SEQ_START_TOKEN) 819 return NULL;
722 ipc_unlock(ipc);
723 820
724 /* 821 for ( ; pos < IPCMNI; pos++) {
725 * p = *pos - 1 (because id 0 starts at position 1) 822 ipc = idr_find(&ids->ipcs_idr, pos);
726 * + 1 (because we increment the position by one) 823 if (ipc != NULL) {
727 */ 824 *new_pos = pos + 1;
728 for (p = *pos; p <= ids->max_id; p++) { 825 ipc_lock_by_ptr(ipc);
729 if ((ipc = ipc_lock(ids, p)) != NULL) {
730 *pos = p + 1;
731 return ipc; 826 return ipc;
732 } 827 }
733 } 828 }
@@ -736,16 +831,27 @@ static void *sysvipc_proc_next(struct seq_file *s, void *it, loff_t *pos)
736 return NULL; 831 return NULL;
737} 832}
738 833
834static void *sysvipc_proc_next(struct seq_file *s, void *it, loff_t *pos)
835{
836 struct ipc_proc_iter *iter = s->private;
837 struct ipc_proc_iface *iface = iter->iface;
838 struct kern_ipc_perm *ipc = it;
839
840 /* If we had an ipc id locked before, unlock it */
841 if (ipc && ipc != SEQ_START_TOKEN)
842 ipc_unlock(ipc);
843
844 return sysvipc_find_ipc(iter->ns->ids[iface->ids], *pos, pos);
845}
846
739/* 847/*
740 * File positions: pos 0 -> header, pos n -> ipc id + 1. 848 * File positions: pos 0 -> header, pos n -> ipc id = n - 1.
741 * SeqFile iterator: iterator value locked shp or SEQ_TOKEN_START. 849 * SeqFile iterator: iterator value locked ipc pointer or SEQ_TOKEN_START.
742 */ 850 */
743static void *sysvipc_proc_start(struct seq_file *s, loff_t *pos) 851static void *sysvipc_proc_start(struct seq_file *s, loff_t *pos)
744{ 852{
745 struct ipc_proc_iter *iter = s->private; 853 struct ipc_proc_iter *iter = s->private;
746 struct ipc_proc_iface *iface = iter->iface; 854 struct ipc_proc_iface *iface = iter->iface;
747 struct kern_ipc_perm *ipc;
748 loff_t p;
749 struct ipc_ids *ids; 855 struct ipc_ids *ids;
750 856
751 ids = iter->ns->ids[iface->ids]; 857 ids = iter->ns->ids[iface->ids];
@@ -754,7 +860,7 @@ static void *sysvipc_proc_start(struct seq_file *s, loff_t *pos)
754 * Take the lock - this will be released by the corresponding 860 * Take the lock - this will be released by the corresponding
755 * call to stop(). 861 * call to stop().
756 */ 862 */
757 mutex_lock(&ids->mutex); 863 down_read(&ids->rw_mutex);
758 864
759 /* pos < 0 is invalid */ 865 /* pos < 0 is invalid */
760 if (*pos < 0) 866 if (*pos < 0)
@@ -765,13 +871,7 @@ static void *sysvipc_proc_start(struct seq_file *s, loff_t *pos)
765 return SEQ_START_TOKEN; 871 return SEQ_START_TOKEN;
766 872
767 /* Find the (pos-1)th ipc */ 873 /* Find the (pos-1)th ipc */
768 for (p = *pos - 1; p <= ids->max_id; p++) { 874 return sysvipc_find_ipc(ids, *pos - 1, pos);
769 if ((ipc = ipc_lock(ids, p)) != NULL) {
770 *pos = p + 1;
771 return ipc;
772 }
773 }
774 return NULL;
775} 875}
776 876
777static void sysvipc_proc_stop(struct seq_file *s, void *it) 877static void sysvipc_proc_stop(struct seq_file *s, void *it)
@@ -781,13 +881,13 @@ static void sysvipc_proc_stop(struct seq_file *s, void *it)
781 struct ipc_proc_iface *iface = iter->iface; 881 struct ipc_proc_iface *iface = iter->iface;
782 struct ipc_ids *ids; 882 struct ipc_ids *ids;
783 883
784 /* If we had a locked segment, release it */ 884 /* If we had a locked structure, release it */
785 if (ipc && ipc != SEQ_START_TOKEN) 885 if (ipc && ipc != SEQ_START_TOKEN)
786 ipc_unlock(ipc); 886 ipc_unlock(ipc);
787 887
788 ids = iter->ns->ids[iface->ids]; 888 ids = iter->ns->ids[iface->ids];
789 /* Release the lock we took in start() */ 889 /* Release the lock we took in start() */
790 mutex_unlock(&ids->mutex); 890 up_read(&ids->rw_mutex);
791} 891}
792 892
793static int sysvipc_proc_show(struct seq_file *s, void *it) 893static int sysvipc_proc_show(struct seq_file *s, void *it)
diff --git a/ipc/util.h b/ipc/util.h
index 333e891bcaca..9ffea40457ce 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -10,6 +10,9 @@
10#ifndef _IPC_UTIL_H 10#ifndef _IPC_UTIL_H
11#define _IPC_UTIL_H 11#define _IPC_UTIL_H
12 12
13#include <linux/idr.h>
14#include <linux/err.h>
15
13#define USHRT_MAX 0xffff 16#define USHRT_MAX 0xffff
14#define SEQ_MULTIPLIER (IPCMNI) 17#define SEQ_MULTIPLIER (IPCMNI)
15 18
@@ -25,24 +28,46 @@ void sem_exit_ns(struct ipc_namespace *ns);
25void msg_exit_ns(struct ipc_namespace *ns); 28void msg_exit_ns(struct ipc_namespace *ns);
26void shm_exit_ns(struct ipc_namespace *ns); 29void shm_exit_ns(struct ipc_namespace *ns);
27 30
28struct ipc_id_ary {
29 int size;
30 struct kern_ipc_perm *p[0];
31};
32
33struct ipc_ids { 31struct ipc_ids {
34 int in_use; 32 int in_use;
35 int max_id;
36 unsigned short seq; 33 unsigned short seq;
37 unsigned short seq_max; 34 unsigned short seq_max;
38 struct mutex mutex; 35 struct rw_semaphore rw_mutex;
39 struct ipc_id_ary nullentry; 36 struct idr ipcs_idr;
40 struct ipc_id_ary* entries; 37};
38
39/*
40 * Structure that holds the parameters needed by the ipc operations
41 * (see after)
42 */
43struct ipc_params {
44 key_t key;
45 int flg;
46 union {
47 size_t size; /* for shared memories */
48 int nsems; /* for semaphores */
49 } u; /* holds the getnew() specific param */
50};
51
52/*
53 * Structure that holds some ipc operations. This structure is used to unify
54 * the calls to sys_msgget(), sys_semget(), sys_shmget()
55 * . routine to call to create a new ipc object. Can be one of newque,
56 * newary, newseg
57 * . routine to call to check permissions for a new ipc object.
58 * Can be one of security_msg_associate, security_sem_associate,
59 * security_shm_associate
60 * . routine to call for an extra check if needed
61 */
62struct ipc_ops {
63 int (*getnew) (struct ipc_namespace *, struct ipc_params *);
64 int (*associate) (struct kern_ipc_perm *, int);
65 int (*more_checks) (struct kern_ipc_perm *, struct ipc_params *);
41}; 66};
42 67
43struct seq_file; 68struct seq_file;
44 69
45void ipc_init_ids(struct ipc_ids *ids, int size); 70void ipc_init_ids(struct ipc_ids *);
46#ifdef CONFIG_PROC_FS 71#ifdef CONFIG_PROC_FS
47void __init ipc_init_proc_interface(const char *path, const char *header, 72void __init ipc_init_proc_interface(const char *path, const char *header,
48 int ids, int (*show)(struct seq_file *, void *)); 73 int ids, int (*show)(struct seq_file *, void *));
@@ -54,14 +79,19 @@ void __init ipc_init_proc_interface(const char *path, const char *header,
54#define IPC_MSG_IDS 1 79#define IPC_MSG_IDS 1
55#define IPC_SHM_IDS 2 80#define IPC_SHM_IDS 2
56 81
57/* must be called with ids->mutex acquired.*/ 82#define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER)
58int ipc_findkey(struct ipc_ids* ids, key_t key); 83
59int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size); 84/* must be called with ids->rw_mutex acquired for writing */
85int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int);
86
87/* must be called with ids->rw_mutex acquired for reading */
88int ipc_get_maxid(struct ipc_ids *);
60 89
61/* must be called with both locks acquired. */ 90/* must be called with both locks acquired. */
62struct kern_ipc_perm* ipc_rmid(struct ipc_ids* ids, int id); 91void ipc_rmid(struct ipc_ids *, struct kern_ipc_perm *);
63 92
64int ipcperms (struct kern_ipc_perm *ipcp, short flg); 93/* must be called with ipcp locked */
94int ipcperms(struct kern_ipc_perm *ipcp, short flg);
65 95
66/* for rare, potentially huge allocations. 96/* for rare, potentially huge allocations.
67 * both function can sleep 97 * both function can sleep
@@ -79,24 +109,12 @@ void* ipc_rcu_alloc(int size);
79void ipc_rcu_getref(void *ptr); 109void ipc_rcu_getref(void *ptr);
80void ipc_rcu_putref(void *ptr); 110void ipc_rcu_putref(void *ptr);
81 111
82static inline void __ipc_fini_ids(struct ipc_ids *ids, 112/*
83 struct ipc_id_ary *entries) 113 * ipc_lock_down: called with rw_mutex held
84{ 114 * ipc_lock: called without that lock held
85 if (entries != &ids->nullentry) 115 */
86 ipc_rcu_putref(entries); 116struct kern_ipc_perm *ipc_lock_down(struct ipc_ids *, int);
87} 117struct kern_ipc_perm *ipc_lock(struct ipc_ids *, int);
88
89static inline void ipc_fini_ids(struct ipc_ids *ids)
90{
91 __ipc_fini_ids(ids, ids->entries);
92}
93
94struct kern_ipc_perm* ipc_get(struct ipc_ids* ids, int id);
95struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id);
96void ipc_lock_by_ptr(struct kern_ipc_perm *ipcp);
97void ipc_unlock(struct kern_ipc_perm* perm);
98int ipc_buildid(struct ipc_ids* ids, int id, int seq);
99int ipc_checkid(struct ipc_ids* ids, struct kern_ipc_perm* ipcp, int uid);
100 118
101void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out); 119void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out);
102void ipc64_perm_to_ipc_perm(struct ipc64_perm *in, struct ipc_perm *out); 120void ipc64_perm_to_ipc_perm(struct ipc64_perm *in, struct ipc_perm *out);
@@ -111,5 +129,89 @@ int ipc_parse_version (int *cmd);
111extern void free_msg(struct msg_msg *msg); 129extern void free_msg(struct msg_msg *msg);
112extern struct msg_msg *load_msg(const void __user *src, int len); 130extern struct msg_msg *load_msg(const void __user *src, int len);
113extern int store_msg(void __user *dest, struct msg_msg *msg, int len); 131extern int store_msg(void __user *dest, struct msg_msg *msg, int len);
132extern int ipcget_new(struct ipc_namespace *, struct ipc_ids *,
133 struct ipc_ops *, struct ipc_params *);
134extern int ipcget_public(struct ipc_namespace *, struct ipc_ids *,
135 struct ipc_ops *, struct ipc_params *);
136
137static inline int ipc_buildid(int id, int seq)
138{
139 return SEQ_MULTIPLIER * seq + id;
140}
141
142/*
143 * Must be called with ipcp locked
144 */
145static inline int ipc_checkid(struct kern_ipc_perm *ipcp, int uid)
146{
147 if (uid / SEQ_MULTIPLIER != ipcp->seq)
148 return 1;
149 return 0;
150}
151
152static inline void ipc_lock_by_ptr(struct kern_ipc_perm *perm)
153{
154 rcu_read_lock();
155 spin_lock(&perm->lock);
156}
157
158static inline void ipc_unlock(struct kern_ipc_perm *perm)
159{
160 spin_unlock(&perm->lock);
161 rcu_read_unlock();
162}
163
164static inline struct kern_ipc_perm *ipc_lock_check_down(struct ipc_ids *ids,
165 int id)
166{
167 struct kern_ipc_perm *out;
168
169 out = ipc_lock_down(ids, id);
170 if (IS_ERR(out))
171 return out;
172
173 if (ipc_checkid(out, id)) {
174 ipc_unlock(out);
175 return ERR_PTR(-EIDRM);
176 }
177
178 return out;
179}
180
181static inline struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids,
182 int id)
183{
184 struct kern_ipc_perm *out;
185
186 out = ipc_lock(ids, id);
187 if (IS_ERR(out))
188 return out;
189
190 if (ipc_checkid(out, id)) {
191 ipc_unlock(out);
192 return ERR_PTR(-EIDRM);
193 }
194
195 return out;
196}
197
198/**
199 * ipcget - Common sys_*get() code
200 * @ns : namsepace
201 * @ids : IPC identifier set
202 * @ops : operations to be called on ipc object creation, permission checks
203 * and further checks
204 * @params : the parameters needed by the previous operations.
205 *
206 * Common routine called by sys_msgget(), sys_semget() and sys_shmget().
207 */
208static inline int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids,
209 struct ipc_ops *ops, struct ipc_params *params)
210{
211 if (params->key == IPC_PRIVATE)
212 return ipcget_new(ns, ids, ops, params);
213 else
214 return ipcget_public(ns, ids, ops, params);
215}
114 216
115#endif 217#endif
diff --git a/kernel/Kconfig.instrumentation b/kernel/Kconfig.instrumentation
new file mode 100644
index 000000000000..f5f2c769d95e
--- /dev/null
+++ b/kernel/Kconfig.instrumentation
@@ -0,0 +1,49 @@
1menuconfig INSTRUMENTATION
2 bool "Instrumentation Support"
3 default y
4 ---help---
5 Say Y here to get to see options related to performance measurement,
6 system-wide debugging, and testing. This option alone does not add any
7 kernel code.
8
9 If you say N, all options in this submenu will be skipped and
10 disabled. If you're trying to debug the kernel itself, go see the
11 Kernel Hacking menu.
12
13if INSTRUMENTATION
14
15config PROFILING
16 bool "Profiling support (EXPERIMENTAL)"
17 help
18 Say Y here to enable the extended profiling support mechanisms used
19 by profilers such as OProfile.
20
21config OPROFILE
22 tristate "OProfile system profiling (EXPERIMENTAL)"
23 depends on PROFILING
24 depends on ALPHA || ARM || BLACKFIN || X86_32 || IA64 || M32R || MIPS || PARISC || PPC || S390 || SUPERH || SPARC || X86_64
25 help
26 OProfile is a profiling system capable of profiling the
27 whole system, include the kernel, kernel modules, libraries,
28 and applications.
29
30 If unsure, say N.
31
32config KPROBES
33 bool "Kprobes"
34 depends on KALLSYMS && MODULES
35 depends on X86_32 || IA64 || PPC || S390 || SPARC64 || X86_64 || AVR32
36 help
37 Kprobes allows you to trap at almost any kernel address and
38 execute a callback function. register_kprobe() establishes
39 a probepoint and specifies the callback. Kprobes is useful
40 for kernel debugging, non-intrusive instrumentation and testing.
41 If in doubt, say "N".
42
43config MARKERS
44 bool "Activate markers"
45 help
46 Place an empty function call at each marker site. Can be
47 dynamically changed for a probe function.
48
49endif # INSTRUMENTATION
diff --git a/kernel/Makefile b/kernel/Makefile
index 2a999836ca18..79f017e09fbd 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -8,9 +8,10 @@ obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
8 signal.o sys.o kmod.o workqueue.o pid.o \ 8 signal.o sys.o kmod.o workqueue.o pid.o \
9 rcupdate.o extable.o params.o posix-timers.o \ 9 rcupdate.o extable.o params.o posix-timers.o \
10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ 10 kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \
11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o die_notifier.o \ 11 hrtimer.o rwsem.o latency.o nsproxy.o srcu.o \
12 utsname.o 12 utsname.o notifier.o
13 13
14obj-$(CONFIG_SYSCTL) += sysctl_check.o
14obj-$(CONFIG_STACKTRACE) += stacktrace.o 15obj-$(CONFIG_STACKTRACE) += stacktrace.o
15obj-y += time/ 16obj-y += time/
16obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o 17obj-$(CONFIG_DEBUG_MUTEXES) += mutex-debug.o
@@ -36,7 +37,11 @@ obj-$(CONFIG_PM) += power/
36obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o 37obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
37obj-$(CONFIG_KEXEC) += kexec.o 38obj-$(CONFIG_KEXEC) += kexec.o
38obj-$(CONFIG_COMPAT) += compat.o 39obj-$(CONFIG_COMPAT) += compat.o
40obj-$(CONFIG_CGROUPS) += cgroup.o
41obj-$(CONFIG_CGROUP_DEBUG) += cgroup_debug.o
39obj-$(CONFIG_CPUSETS) += cpuset.o 42obj-$(CONFIG_CPUSETS) += cpuset.o
43obj-$(CONFIG_CGROUP_CPUACCT) += cpu_acct.o
44obj-$(CONFIG_CGROUP_NS) += ns_cgroup.o
40obj-$(CONFIG_IKCONFIG) += configs.o 45obj-$(CONFIG_IKCONFIG) += configs.o
41obj-$(CONFIG_STOP_MACHINE) += stop_machine.o 46obj-$(CONFIG_STOP_MACHINE) += stop_machine.o
42obj-$(CONFIG_AUDIT) += audit.o auditfilter.o 47obj-$(CONFIG_AUDIT) += audit.o auditfilter.o
@@ -51,6 +56,7 @@ obj-$(CONFIG_RELAY) += relay.o
51obj-$(CONFIG_SYSCTL) += utsname_sysctl.o 56obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
52obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o 57obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
53obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o 58obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
59obj-$(CONFIG_MARKERS) += marker.o
54 60
55ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) 61ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
56# According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is 62# According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
diff --git a/kernel/acct.c b/kernel/acct.c
index 24f0f8b2ba72..fce53d8df8a7 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -329,16 +329,16 @@ static comp_t encode_comp_t(unsigned long value)
329 } 329 }
330 330
331 /* 331 /*
332 * If we need to round up, do it (and handle overflow correctly). 332 * If we need to round up, do it (and handle overflow correctly).
333 */ 333 */
334 if (rnd && (++value > MAXFRACT)) { 334 if (rnd && (++value > MAXFRACT)) {
335 value >>= EXPSIZE; 335 value >>= EXPSIZE;
336 exp++; 336 exp++;
337 } 337 }
338 338
339 /* 339 /*
340 * Clean it up and polish it off. 340 * Clean it up and polish it off.
341 */ 341 */
342 exp <<= MANTSIZE; /* Shift the exponent into place */ 342 exp <<= MANTSIZE; /* Shift the exponent into place */
343 exp += value; /* and add on the mantissa. */ 343 exp += value; /* and add on the mantissa. */
344 return exp; 344 return exp;
@@ -361,30 +361,30 @@ static comp_t encode_comp_t(unsigned long value)
361 361
362static comp2_t encode_comp2_t(u64 value) 362static comp2_t encode_comp2_t(u64 value)
363{ 363{
364 int exp, rnd; 364 int exp, rnd;
365 365
366 exp = (value > (MAXFRACT2>>1)); 366 exp = (value > (MAXFRACT2>>1));
367 rnd = 0; 367 rnd = 0;
368 while (value > MAXFRACT2) { 368 while (value > MAXFRACT2) {
369 rnd = value & 1; 369 rnd = value & 1;
370 value >>= 1; 370 value >>= 1;
371 exp++; 371 exp++;
372 } 372 }
373 373
374 /* 374 /*
375 * If we need to round up, do it (and handle overflow correctly). 375 * If we need to round up, do it (and handle overflow correctly).
376 */ 376 */
377 if (rnd && (++value > MAXFRACT2)) { 377 if (rnd && (++value > MAXFRACT2)) {
378 value >>= 1; 378 value >>= 1;
379 exp++; 379 exp++;
380 } 380 }
381 381
382 if (exp > MAXEXP2) { 382 if (exp > MAXEXP2) {
383 /* Overflow. Return largest representable number instead. */ 383 /* Overflow. Return largest representable number instead. */
384 return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1; 384 return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1;
385 } else { 385 } else {
386 return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1)); 386 return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1));
387 } 387 }
388} 388}
389#endif 389#endif
390 390
@@ -501,14 +501,14 @@ static void do_acct_process(struct file *file)
501 ac.ac_swaps = encode_comp_t(0); 501 ac.ac_swaps = encode_comp_t(0);
502 502
503 /* 503 /*
504 * Kernel segment override to datasegment and write it 504 * Kernel segment override to datasegment and write it
505 * to the accounting file. 505 * to the accounting file.
506 */ 506 */
507 fs = get_fs(); 507 fs = get_fs();
508 set_fs(KERNEL_DS); 508 set_fs(KERNEL_DS);
509 /* 509 /*
510 * Accounting records are not subject to resource limits. 510 * Accounting records are not subject to resource limits.
511 */ 511 */
512 flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; 512 flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
513 current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; 513 current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
514 file->f_op->write(file, (char *)&ac, 514 file->f_op->write(file, (char *)&ac,
diff --git a/kernel/audit.c b/kernel/audit.c
index 2924251a6547..6977ea57a7e2 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -664,11 +664,11 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
664 if (sid) { 664 if (sid) {
665 if (selinux_sid_to_string( 665 if (selinux_sid_to_string(
666 sid, &ctx, &len)) { 666 sid, &ctx, &len)) {
667 audit_log_format(ab, 667 audit_log_format(ab,
668 " ssid=%u", sid); 668 " ssid=%u", sid);
669 /* Maybe call audit_panic? */ 669 /* Maybe call audit_panic? */
670 } else 670 } else
671 audit_log_format(ab, 671 audit_log_format(ab,
672 " subj=%s", ctx); 672 " subj=%s", ctx);
673 kfree(ctx); 673 kfree(ctx);
674 } 674 }
@@ -769,7 +769,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
769 sig_data->pid = audit_sig_pid; 769 sig_data->pid = audit_sig_pid;
770 memcpy(sig_data->ctx, ctx, len); 770 memcpy(sig_data->ctx, ctx, len);
771 kfree(ctx); 771 kfree(ctx);
772 audit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_SIGNAL_INFO, 772 audit_send_reply(NETLINK_CB(skb).pid, seq, AUDIT_SIGNAL_INFO,
773 0, 0, sig_data, sizeof(*sig_data) + len); 773 0, 0, sig_data, sizeof(*sig_data) + len);
774 kfree(sig_data); 774 kfree(sig_data);
775 break; 775 break;
@@ -1005,7 +1005,7 @@ unsigned int audit_serial(void)
1005 return ret; 1005 return ret;
1006} 1006}
1007 1007
1008static inline void audit_get_stamp(struct audit_context *ctx, 1008static inline void audit_get_stamp(struct audit_context *ctx,
1009 struct timespec *t, unsigned int *serial) 1009 struct timespec *t, unsigned int *serial)
1010{ 1010{
1011 if (ctx) 1011 if (ctx)
@@ -1056,7 +1056,7 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,
1056 if (gfp_mask & __GFP_WAIT) 1056 if (gfp_mask & __GFP_WAIT)
1057 reserve = 0; 1057 reserve = 0;
1058 else 1058 else
1059 reserve = 5; /* Allow atomic callers to go up to five 1059 reserve = 5; /* Allow atomic callers to go up to five
1060 entries over the normal backlog limit */ 1060 entries over the normal backlog limit */
1061 1061
1062 while (audit_backlog_limit 1062 while (audit_backlog_limit
@@ -1319,7 +1319,7 @@ void audit_log_d_path(struct audit_buffer *ab, const char *prefix,
1319 if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */ 1319 if (IS_ERR(p)) { /* Should never happen since we send PATH_MAX */
1320 /* FIXME: can we save some information here? */ 1320 /* FIXME: can we save some information here? */
1321 audit_log_format(ab, "<too long>"); 1321 audit_log_format(ab, "<too long>");
1322 } else 1322 } else
1323 audit_log_untrustedstring(ab, p); 1323 audit_log_untrustedstring(ab, p);
1324 kfree(path); 1324 kfree(path);
1325} 1325}
@@ -1365,7 +1365,7 @@ void audit_log_end(struct audit_buffer *ab)
1365 * audit_log_vformat, and audit_log_end. It may be called 1365 * audit_log_vformat, and audit_log_end. It may be called
1366 * in any context. 1366 * in any context.
1367 */ 1367 */
1368void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type, 1368void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
1369 const char *fmt, ...) 1369 const char *fmt, ...)
1370{ 1370{
1371 struct audit_buffer *ab; 1371 struct audit_buffer *ab;
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 359645cff5b2..df66a21fb360 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1498,7 +1498,7 @@ int audit_receive_filter(int type, int pid, int uid, int seq, void *data,
1498 * auditctl to read from it... which isn't ever going to 1498 * auditctl to read from it... which isn't ever going to
1499 * happen if we're actually running in the context of auditctl 1499 * happen if we're actually running in the context of auditctl
1500 * trying to _send_ the stuff */ 1500 * trying to _send_ the stuff */
1501 1501
1502 dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL); 1502 dest = kmalloc(sizeof(struct audit_netlink_list), GFP_KERNEL);
1503 if (!dest) 1503 if (!dest)
1504 return -ENOMEM; 1504 return -ENOMEM;
@@ -1678,7 +1678,7 @@ int audit_filter_type(int type)
1678{ 1678{
1679 struct audit_entry *e; 1679 struct audit_entry *e;
1680 int result = 0; 1680 int result = 0;
1681 1681
1682 rcu_read_lock(); 1682 rcu_read_lock();
1683 if (list_empty(&audit_filter_list[AUDIT_FILTER_TYPE])) 1683 if (list_empty(&audit_filter_list[AUDIT_FILTER_TYPE]))
1684 goto unlock_and_return; 1684 goto unlock_and_return;
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 938e60a61882..e19b5a33aede 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -320,7 +320,7 @@ static int audit_filter_rules(struct task_struct *tsk,
320 result = audit_comparator(tsk->personality, f->op, f->val); 320 result = audit_comparator(tsk->personality, f->op, f->val);
321 break; 321 break;
322 case AUDIT_ARCH: 322 case AUDIT_ARCH:
323 if (ctx) 323 if (ctx)
324 result = audit_comparator(ctx->arch, f->op, f->val); 324 result = audit_comparator(ctx->arch, f->op, f->val);
325 break; 325 break;
326 326
@@ -898,7 +898,7 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
898 if (context->personality != PER_LINUX) 898 if (context->personality != PER_LINUX)
899 audit_log_format(ab, " per=%lx", context->personality); 899 audit_log_format(ab, " per=%lx", context->personality);
900 if (context->return_valid) 900 if (context->return_valid)
901 audit_log_format(ab, " success=%s exit=%ld", 901 audit_log_format(ab, " success=%s exit=%ld",
902 (context->return_valid==AUDITSC_SUCCESS)?"yes":"no", 902 (context->return_valid==AUDITSC_SUCCESS)?"yes":"no",
903 context->return_code); 903 context->return_code);
904 904
@@ -1135,8 +1135,8 @@ void audit_free(struct task_struct *tsk)
1135 return; 1135 return;
1136 1136
1137 /* Check for system calls that do not go through the exit 1137 /* Check for system calls that do not go through the exit
1138 * function (e.g., exit_group), then free context block. 1138 * function (e.g., exit_group), then free context block.
1139 * We use GFP_ATOMIC here because we might be doing this 1139 * We use GFP_ATOMIC here because we might be doing this
1140 * in the context of the idle thread */ 1140 * in the context of the idle thread */
1141 /* that can happen only if we are called from do_exit() */ 1141 /* that can happen only if we are called from do_exit() */
1142 if (context->in_syscall && context->auditable) 1142 if (context->in_syscall && context->auditable)
@@ -1316,7 +1316,7 @@ void __audit_getname(const char *name)
1316 context->pwdmnt = mntget(current->fs->pwdmnt); 1316 context->pwdmnt = mntget(current->fs->pwdmnt);
1317 read_unlock(&current->fs->lock); 1317 read_unlock(&current->fs->lock);
1318 } 1318 }
1319 1319
1320} 1320}
1321 1321
1322/* audit_putname - intercept a putname request 1322/* audit_putname - intercept a putname request
diff --git a/kernel/capability.c b/kernel/capability.c
index 4e350a36ed6a..efbd9cdce132 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -3,20 +3,18 @@
3 * 3 *
4 * Copyright (C) 1997 Andrew Main <zefram@fysh.org> 4 * Copyright (C) 1997 Andrew Main <zefram@fysh.org>
5 * 5 *
6 * Integrated into 2.1.97+, Andrew G. Morgan <morgan@transmeta.com> 6 * Integrated into 2.1.97+, Andrew G. Morgan <morgan@kernel.org>
7 * 30 May 2002: Cleanup, Robert M. Love <rml@tech9.net> 7 * 30 May 2002: Cleanup, Robert M. Love <rml@tech9.net>
8 */ 8 */
9 9
10#include <linux/capability.h> 10#include <linux/capability.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/security.h> 13#include <linux/security.h>
14#include <linux/syscalls.h> 14#include <linux/syscalls.h>
15#include <linux/pid_namespace.h>
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16 17
17unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */
18kernel_cap_t cap_bset = CAP_INIT_EFF_SET;
19
20/* 18/*
21 * This lock protects task->cap_* for all tasks including current. 19 * This lock protects task->cap_* for all tasks including current.
22 * Locking rule: acquire this prior to tasklist_lock. 20 * Locking rule: acquire this prior to tasklist_lock.
@@ -40,49 +38,49 @@ static DEFINE_SPINLOCK(task_capability_lock);
40 */ 38 */
41asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr) 39asmlinkage long sys_capget(cap_user_header_t header, cap_user_data_t dataptr)
42{ 40{
43 int ret = 0; 41 int ret = 0;
44 pid_t pid; 42 pid_t pid;
45 __u32 version; 43 __u32 version;
46 struct task_struct *target; 44 struct task_struct *target;
47 struct __user_cap_data_struct data; 45 struct __user_cap_data_struct data;
48 46
49 if (get_user(version, &header->version)) 47 if (get_user(version, &header->version))
50 return -EFAULT; 48 return -EFAULT;
51 49
52 if (version != _LINUX_CAPABILITY_VERSION) { 50 if (version != _LINUX_CAPABILITY_VERSION) {
53 if (put_user(_LINUX_CAPABILITY_VERSION, &header->version)) 51 if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))
54 return -EFAULT; 52 return -EFAULT;
55 return -EINVAL; 53 return -EINVAL;
56 } 54 }
57 55
58 if (get_user(pid, &header->pid)) 56 if (get_user(pid, &header->pid))
59 return -EFAULT; 57 return -EFAULT;
60 58
61 if (pid < 0) 59 if (pid < 0)
62 return -EINVAL; 60 return -EINVAL;
63 61
64 spin_lock(&task_capability_lock); 62 spin_lock(&task_capability_lock);
65 read_lock(&tasklist_lock); 63 read_lock(&tasklist_lock);
66 64
67 if (pid && pid != current->pid) { 65 if (pid && pid != task_pid_vnr(current)) {
68 target = find_task_by_pid(pid); 66 target = find_task_by_vpid(pid);
69 if (!target) { 67 if (!target) {
70 ret = -ESRCH; 68 ret = -ESRCH;
71 goto out; 69 goto out;
72 } 70 }
73 } else 71 } else
74 target = current; 72 target = current;
75 73
76 ret = security_capget(target, &data.effective, &data.inheritable, &data.permitted); 74 ret = security_capget(target, &data.effective, &data.inheritable, &data.permitted);
77 75
78out: 76out:
79 read_unlock(&tasklist_lock); 77 read_unlock(&tasklist_lock);
80 spin_unlock(&task_capability_lock); 78 spin_unlock(&task_capability_lock);
81 79
82 if (!ret && copy_to_user(dataptr, &data, sizeof data)) 80 if (!ret && copy_to_user(dataptr, &data, sizeof data))
83 return -EFAULT; 81 return -EFAULT;
84 82
85 return ret; 83 return ret;
86} 84}
87 85
88/* 86/*
@@ -98,7 +96,7 @@ static inline int cap_set_pg(int pgrp_nr, kernel_cap_t *effective,
98 int found = 0; 96 int found = 0;
99 struct pid *pgrp; 97 struct pid *pgrp;
100 98
101 pgrp = find_pid(pgrp_nr); 99 pgrp = find_vpid(pgrp_nr);
102 do_each_pid_task(pgrp, PIDTYPE_PGID, g) { 100 do_each_pid_task(pgrp, PIDTYPE_PGID, g) {
103 target = g; 101 target = g;
104 while_each_thread(g, target) { 102 while_each_thread(g, target) {
@@ -115,7 +113,7 @@ static inline int cap_set_pg(int pgrp_nr, kernel_cap_t *effective,
115 } while_each_pid_task(pgrp, PIDTYPE_PGID, g); 113 } while_each_pid_task(pgrp, PIDTYPE_PGID, g);
116 114
117 if (!found) 115 if (!found)
118 ret = 0; 116 ret = 0;
119 return ret; 117 return ret;
120} 118}
121 119
@@ -132,7 +130,7 @@ static inline int cap_set_all(kernel_cap_t *effective,
132 int found = 0; 130 int found = 0;
133 131
134 do_each_thread(g, target) { 132 do_each_thread(g, target) {
135 if (target == current || is_init(target)) 133 if (target == current || is_container_init(target->group_leader))
136 continue; 134 continue;
137 found = 1; 135 found = 1;
138 if (security_capset_check(target, effective, inheritable, 136 if (security_capset_check(target, effective, inheritable,
@@ -169,68 +167,68 @@ static inline int cap_set_all(kernel_cap_t *effective,
169 */ 167 */
170asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data) 168asmlinkage long sys_capset(cap_user_header_t header, const cap_user_data_t data)
171{ 169{
172 kernel_cap_t inheritable, permitted, effective; 170 kernel_cap_t inheritable, permitted, effective;
173 __u32 version; 171 __u32 version;
174 struct task_struct *target; 172 struct task_struct *target;
175 int ret; 173 int ret;
176 pid_t pid; 174 pid_t pid;
177 175
178 if (get_user(version, &header->version)) 176 if (get_user(version, &header->version))
179 return -EFAULT; 177 return -EFAULT;
180 178
181 if (version != _LINUX_CAPABILITY_VERSION) { 179 if (version != _LINUX_CAPABILITY_VERSION) {
182 if (put_user(_LINUX_CAPABILITY_VERSION, &header->version)) 180 if (put_user(_LINUX_CAPABILITY_VERSION, &header->version))
183 return -EFAULT; 181 return -EFAULT;
184 return -EINVAL; 182 return -EINVAL;
185 } 183 }
186 184
187 if (get_user(pid, &header->pid)) 185 if (get_user(pid, &header->pid))
188 return -EFAULT; 186 return -EFAULT;
189 187
190 if (pid && pid != current->pid && !capable(CAP_SETPCAP)) 188 if (pid && pid != task_pid_vnr(current) && !capable(CAP_SETPCAP))
191 return -EPERM; 189 return -EPERM;
192 190
193 if (copy_from_user(&effective, &data->effective, sizeof(effective)) || 191 if (copy_from_user(&effective, &data->effective, sizeof(effective)) ||
194 copy_from_user(&inheritable, &data->inheritable, sizeof(inheritable)) || 192 copy_from_user(&inheritable, &data->inheritable, sizeof(inheritable)) ||
195 copy_from_user(&permitted, &data->permitted, sizeof(permitted))) 193 copy_from_user(&permitted, &data->permitted, sizeof(permitted)))
196 return -EFAULT; 194 return -EFAULT;
197 195
198 spin_lock(&task_capability_lock); 196 spin_lock(&task_capability_lock);
199 read_lock(&tasklist_lock); 197 read_lock(&tasklist_lock);
200 198
201 if (pid > 0 && pid != current->pid) { 199 if (pid > 0 && pid != task_pid_vnr(current)) {
202 target = find_task_by_pid(pid); 200 target = find_task_by_vpid(pid);
203 if (!target) { 201 if (!target) {
204 ret = -ESRCH; 202 ret = -ESRCH;
205 goto out; 203 goto out;
206 } 204 }
207 } else 205 } else
208 target = current; 206 target = current;
209 207
210 ret = 0; 208 ret = 0;
211 209
212 /* having verified that the proposed changes are legal, 210 /* having verified that the proposed changes are legal,
213 we now put them into effect. */ 211 we now put them into effect. */
214 if (pid < 0) { 212 if (pid < 0) {
215 if (pid == -1) /* all procs other than current and init */ 213 if (pid == -1) /* all procs other than current and init */
216 ret = cap_set_all(&effective, &inheritable, &permitted); 214 ret = cap_set_all(&effective, &inheritable, &permitted);
217 215
218 else /* all procs in process group */ 216 else /* all procs in process group */
219 ret = cap_set_pg(-pid, &effective, &inheritable, 217 ret = cap_set_pg(-pid, &effective, &inheritable,
220 &permitted); 218 &permitted);
221 } else { 219 } else {
222 ret = security_capset_check(target, &effective, &inheritable, 220 ret = security_capset_check(target, &effective, &inheritable,
223 &permitted); 221 &permitted);
224 if (!ret) 222 if (!ret)
225 security_capset_set(target, &effective, &inheritable, 223 security_capset_set(target, &effective, &inheritable,
226 &permitted); 224 &permitted);
227 } 225 }
228 226
229out: 227out:
230 read_unlock(&tasklist_lock); 228 read_unlock(&tasklist_lock);
231 spin_unlock(&task_capability_lock); 229 spin_unlock(&task_capability_lock);
232 230
233 return ret; 231 return ret;
234} 232}
235 233
236int __capable(struct task_struct *t, int cap) 234int __capable(struct task_struct *t, int cap)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
new file mode 100644
index 000000000000..5987dccdb2a0
--- /dev/null
+++ b/kernel/cgroup.c
@@ -0,0 +1,2805 @@
1/*
2 * kernel/cgroup.c
3 *
4 * Generic process-grouping system.
5 *
6 * Based originally on the cpuset system, extracted by Paul Menage
7 * Copyright (C) 2006 Google, Inc
8 *
9 * Copyright notices from the original cpuset code:
10 * --------------------------------------------------
11 * Copyright (C) 2003 BULL SA.
12 * Copyright (C) 2004-2006 Silicon Graphics, Inc.
13 *
14 * Portions derived from Patrick Mochel's sysfs code.
15 * sysfs is Copyright (c) 2001-3 Patrick Mochel
16 *
17 * 2003-10-10 Written by Simon Derr.
18 * 2003-10-22 Updates by Stephen Hemminger.
19 * 2004 May-July Rework by Paul Jackson.
20 * ---------------------------------------------------
21 *
22 * This file is subject to the terms and conditions of the GNU General Public
23 * License. See the file COPYING in the main directory of the Linux
24 * distribution for more details.
25 */
26
27#include <linux/cgroup.h>
28#include <linux/errno.h>
29#include <linux/fs.h>
30#include <linux/kernel.h>
31#include <linux/list.h>
32#include <linux/mm.h>
33#include <linux/mutex.h>
34#include <linux/mount.h>
35#include <linux/pagemap.h>
36#include <linux/proc_fs.h>
37#include <linux/rcupdate.h>
38#include <linux/sched.h>
39#include <linux/backing-dev.h>
40#include <linux/seq_file.h>
41#include <linux/slab.h>
42#include <linux/magic.h>
43#include <linux/spinlock.h>
44#include <linux/string.h>
45#include <linux/sort.h>
46#include <linux/kmod.h>
47#include <linux/delayacct.h>
48#include <linux/cgroupstats.h>
49
50#include <asm/atomic.h>
51
52static DEFINE_MUTEX(cgroup_mutex);
53
54/* Generate an array of cgroup subsystem pointers */
55#define SUBSYS(_x) &_x ## _subsys,
56
57static struct cgroup_subsys *subsys[] = {
58#include <linux/cgroup_subsys.h>
59};
60
61/*
62 * A cgroupfs_root represents the root of a cgroup hierarchy,
63 * and may be associated with a superblock to form an active
64 * hierarchy
65 */
66struct cgroupfs_root {
67 struct super_block *sb;
68
69 /*
70 * The bitmask of subsystems intended to be attached to this
71 * hierarchy
72 */
73 unsigned long subsys_bits;
74
75 /* The bitmask of subsystems currently attached to this hierarchy */
76 unsigned long actual_subsys_bits;
77
78 /* A list running through the attached subsystems */
79 struct list_head subsys_list;
80
81 /* The root cgroup for this hierarchy */
82 struct cgroup top_cgroup;
83
84 /* Tracks how many cgroups are currently defined in hierarchy.*/
85 int number_of_cgroups;
86
87 /* A list running through the mounted hierarchies */
88 struct list_head root_list;
89
90 /* Hierarchy-specific flags */
91 unsigned long flags;
92
93 /* The path to use for release notifications. No locking
94 * between setting and use - so if userspace updates this
95 * while child cgroups exist, you could miss a
96 * notification. We ensure that it's always a valid
97 * NUL-terminated string */
98 char release_agent_path[PATH_MAX];
99};
100
101
102/*
103 * The "rootnode" hierarchy is the "dummy hierarchy", reserved for the
104 * subsystems that are otherwise unattached - it never has more than a
105 * single cgroup, and all tasks are part of that cgroup.
106 */
107static struct cgroupfs_root rootnode;
108
109/* The list of hierarchy roots */
110
111static LIST_HEAD(roots);
112static int root_count;
113
114/* dummytop is a shorthand for the dummy hierarchy's top cgroup */
115#define dummytop (&rootnode.top_cgroup)
116
117/* This flag indicates whether tasks in the fork and exit paths should
118 * take callback_mutex and check for fork/exit handlers to call. This
119 * avoids us having to do extra work in the fork/exit path if none of the
120 * subsystems need to be called.
121 */
122static int need_forkexit_callback;
123
124/* bits in struct cgroup flags field */
125enum {
126 /* Control Group is dead */
127 CGRP_REMOVED,
128 /* Control Group has previously had a child cgroup or a task,
129 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
130 CGRP_RELEASABLE,
131 /* Control Group requires release notifications to userspace */
132 CGRP_NOTIFY_ON_RELEASE,
133};
134
135/* convenient tests for these bits */
136inline int cgroup_is_removed(const struct cgroup *cgrp)
137{
138 return test_bit(CGRP_REMOVED, &cgrp->flags);
139}
140
141/* bits in struct cgroupfs_root flags field */
142enum {
143 ROOT_NOPREFIX, /* mounted subsystems have no named prefix */
144};
145
146inline int cgroup_is_releasable(const struct cgroup *cgrp)
147{
148 const int bits =
149 (1 << CGRP_RELEASABLE) |
150 (1 << CGRP_NOTIFY_ON_RELEASE);
151 return (cgrp->flags & bits) == bits;
152}
153
154inline int notify_on_release(const struct cgroup *cgrp)
155{
156 return test_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
157}
158
159/*
160 * for_each_subsys() allows you to iterate on each subsystem attached to
161 * an active hierarchy
162 */
163#define for_each_subsys(_root, _ss) \
164list_for_each_entry(_ss, &_root->subsys_list, sibling)
165
166/* for_each_root() allows you to iterate across the active hierarchies */
167#define for_each_root(_root) \
168list_for_each_entry(_root, &roots, root_list)
169
170/* the list of cgroups eligible for automatic release. Protected by
171 * release_list_lock */
172static LIST_HEAD(release_list);
173static DEFINE_SPINLOCK(release_list_lock);
174static void cgroup_release_agent(struct work_struct *work);
175static DECLARE_WORK(release_agent_work, cgroup_release_agent);
176static void check_for_release(struct cgroup *cgrp);
177
178/* Link structure for associating css_set objects with cgroups */
179struct cg_cgroup_link {
180 /*
181 * List running through cg_cgroup_links associated with a
182 * cgroup, anchored on cgroup->css_sets
183 */
184 struct list_head cgrp_link_list;
185 /*
186 * List running through cg_cgroup_links pointing at a
187 * single css_set object, anchored on css_set->cg_links
188 */
189 struct list_head cg_link_list;
190 struct css_set *cg;
191};
192
193/* The default css_set - used by init and its children prior to any
194 * hierarchies being mounted. It contains a pointer to the root state
195 * for each subsystem. Also used to anchor the list of css_sets. Not
196 * reference-counted, to improve performance when child cgroups
197 * haven't been created.
198 */
199
200static struct css_set init_css_set;
201static struct cg_cgroup_link init_css_set_link;
202
203/* css_set_lock protects the list of css_set objects, and the
204 * chain of tasks off each css_set. Nests outside task->alloc_lock
205 * due to cgroup_iter_start() */
206static DEFINE_RWLOCK(css_set_lock);
207static int css_set_count;
208
209/* We don't maintain the lists running through each css_set to its
210 * task until after the first call to cgroup_iter_start(). This
211 * reduces the fork()/exit() overhead for people who have cgroups
212 * compiled into their kernel but not actually in use */
213static int use_task_css_set_links;
214
215/* When we create or destroy a css_set, the operation simply
216 * takes/releases a reference count on all the cgroups referenced
217 * by subsystems in this css_set. This can end up multiple-counting
218 * some cgroups, but that's OK - the ref-count is just a
219 * busy/not-busy indicator; ensuring that we only count each cgroup
220 * once would require taking a global lock to ensure that no
221 * subsystems moved between hierarchies while we were doing so.
222 *
223 * Possible TODO: decide at boot time based on the number of
224 * registered subsystems and the number of CPUs or NUMA nodes whether
225 * it's better for performance to ref-count every subsystem, or to
226 * take a global lock and only add one ref count to each hierarchy.
227 */
228
229/*
230 * unlink a css_set from the list and free it
231 */
232static void unlink_css_set(struct css_set *cg)
233{
234 write_lock(&css_set_lock);
235 list_del(&cg->list);
236 css_set_count--;
237 while (!list_empty(&cg->cg_links)) {
238 struct cg_cgroup_link *link;
239 link = list_entry(cg->cg_links.next,
240 struct cg_cgroup_link, cg_link_list);
241 list_del(&link->cg_link_list);
242 list_del(&link->cgrp_link_list);
243 kfree(link);
244 }
245 write_unlock(&css_set_lock);
246}
247
248static void __release_css_set(struct kref *k, int taskexit)
249{
250 int i;
251 struct css_set *cg = container_of(k, struct css_set, ref);
252
253 unlink_css_set(cg);
254
255 rcu_read_lock();
256 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
257 struct cgroup *cgrp = cg->subsys[i]->cgroup;
258 if (atomic_dec_and_test(&cgrp->count) &&
259 notify_on_release(cgrp)) {
260 if (taskexit)
261 set_bit(CGRP_RELEASABLE, &cgrp->flags);
262 check_for_release(cgrp);
263 }
264 }
265 rcu_read_unlock();
266 kfree(cg);
267}
268
269static void release_css_set(struct kref *k)
270{
271 __release_css_set(k, 0);
272}
273
274static void release_css_set_taskexit(struct kref *k)
275{
276 __release_css_set(k, 1);
277}
278
279/*
280 * refcounted get/put for css_set objects
281 */
282static inline void get_css_set(struct css_set *cg)
283{
284 kref_get(&cg->ref);
285}
286
287static inline void put_css_set(struct css_set *cg)
288{
289 kref_put(&cg->ref, release_css_set);
290}
291
292static inline void put_css_set_taskexit(struct css_set *cg)
293{
294 kref_put(&cg->ref, release_css_set_taskexit);
295}
296
297/*
298 * find_existing_css_set() is a helper for
299 * find_css_set(), and checks to see whether an existing
300 * css_set is suitable. This currently walks a linked-list for
301 * simplicity; a later patch will use a hash table for better
302 * performance
303 *
304 * oldcg: the cgroup group that we're using before the cgroup
305 * transition
306 *
307 * cgrp: the cgroup that we're moving into
308 *
309 * template: location in which to build the desired set of subsystem
310 * state objects for the new cgroup group
311 */
312
313static struct css_set *find_existing_css_set(
314 struct css_set *oldcg,
315 struct cgroup *cgrp,
316 struct cgroup_subsys_state *template[])
317{
318 int i;
319 struct cgroupfs_root *root = cgrp->root;
320 struct list_head *l = &init_css_set.list;
321
322 /* Built the set of subsystem state objects that we want to
323 * see in the new css_set */
324 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
325 if (root->subsys_bits & (1ull << i)) {
326 /* Subsystem is in this hierarchy. So we want
327 * the subsystem state from the new
328 * cgroup */
329 template[i] = cgrp->subsys[i];
330 } else {
331 /* Subsystem is not in this hierarchy, so we
332 * don't want to change the subsystem state */
333 template[i] = oldcg->subsys[i];
334 }
335 }
336
337 /* Look through existing cgroup groups to find one to reuse */
338 do {
339 struct css_set *cg =
340 list_entry(l, struct css_set, list);
341
342 if (!memcmp(template, cg->subsys, sizeof(cg->subsys))) {
343 /* All subsystems matched */
344 return cg;
345 }
346 /* Try the next cgroup group */
347 l = l->next;
348 } while (l != &init_css_set.list);
349
350 /* No existing cgroup group matched */
351 return NULL;
352}
353
354/*
355 * allocate_cg_links() allocates "count" cg_cgroup_link structures
356 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on
357 * success or a negative error
358 */
359
360static int allocate_cg_links(int count, struct list_head *tmp)
361{
362 struct cg_cgroup_link *link;
363 int i;
364 INIT_LIST_HEAD(tmp);
365 for (i = 0; i < count; i++) {
366 link = kmalloc(sizeof(*link), GFP_KERNEL);
367 if (!link) {
368 while (!list_empty(tmp)) {
369 link = list_entry(tmp->next,
370 struct cg_cgroup_link,
371 cgrp_link_list);
372 list_del(&link->cgrp_link_list);
373 kfree(link);
374 }
375 return -ENOMEM;
376 }
377 list_add(&link->cgrp_link_list, tmp);
378 }
379 return 0;
380}
381
382static void free_cg_links(struct list_head *tmp)
383{
384 while (!list_empty(tmp)) {
385 struct cg_cgroup_link *link;
386 link = list_entry(tmp->next,
387 struct cg_cgroup_link,
388 cgrp_link_list);
389 list_del(&link->cgrp_link_list);
390 kfree(link);
391 }
392}
393
394/*
395 * find_css_set() takes an existing cgroup group and a
396 * cgroup object, and returns a css_set object that's
397 * equivalent to the old group, but with the given cgroup
398 * substituted into the appropriate hierarchy. Must be called with
399 * cgroup_mutex held
400 */
401
402static struct css_set *find_css_set(
403 struct css_set *oldcg, struct cgroup *cgrp)
404{
405 struct css_set *res;
406 struct cgroup_subsys_state *template[CGROUP_SUBSYS_COUNT];
407 int i;
408
409 struct list_head tmp_cg_links;
410 struct cg_cgroup_link *link;
411
412 /* First see if we already have a cgroup group that matches
413 * the desired set */
414 write_lock(&css_set_lock);
415 res = find_existing_css_set(oldcg, cgrp, template);
416 if (res)
417 get_css_set(res);
418 write_unlock(&css_set_lock);
419
420 if (res)
421 return res;
422
423 res = kmalloc(sizeof(*res), GFP_KERNEL);
424 if (!res)
425 return NULL;
426
427 /* Allocate all the cg_cgroup_link objects that we'll need */
428 if (allocate_cg_links(root_count, &tmp_cg_links) < 0) {
429 kfree(res);
430 return NULL;
431 }
432
433 kref_init(&res->ref);
434 INIT_LIST_HEAD(&res->cg_links);
435 INIT_LIST_HEAD(&res->tasks);
436
437 /* Copy the set of subsystem state objects generated in
438 * find_existing_css_set() */
439 memcpy(res->subsys, template, sizeof(res->subsys));
440
441 write_lock(&css_set_lock);
442 /* Add reference counts and links from the new css_set. */
443 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
444 struct cgroup *cgrp = res->subsys[i]->cgroup;
445 struct cgroup_subsys *ss = subsys[i];
446 atomic_inc(&cgrp->count);
447 /*
448 * We want to add a link once per cgroup, so we
449 * only do it for the first subsystem in each
450 * hierarchy
451 */
452 if (ss->root->subsys_list.next == &ss->sibling) {
453 BUG_ON(list_empty(&tmp_cg_links));
454 link = list_entry(tmp_cg_links.next,
455 struct cg_cgroup_link,
456 cgrp_link_list);
457 list_del(&link->cgrp_link_list);
458 list_add(&link->cgrp_link_list, &cgrp->css_sets);
459 link->cg = res;
460 list_add(&link->cg_link_list, &res->cg_links);
461 }
462 }
463 if (list_empty(&rootnode.subsys_list)) {
464 link = list_entry(tmp_cg_links.next,
465 struct cg_cgroup_link,
466 cgrp_link_list);
467 list_del(&link->cgrp_link_list);
468 list_add(&link->cgrp_link_list, &dummytop->css_sets);
469 link->cg = res;
470 list_add(&link->cg_link_list, &res->cg_links);
471 }
472
473 BUG_ON(!list_empty(&tmp_cg_links));
474
475 /* Link this cgroup group into the list */
476 list_add(&res->list, &init_css_set.list);
477 css_set_count++;
478 INIT_LIST_HEAD(&res->tasks);
479 write_unlock(&css_set_lock);
480
481 return res;
482}
483
484/*
485 * There is one global cgroup mutex. We also require taking
486 * task_lock() when dereferencing a task's cgroup subsys pointers.
487 * See "The task_lock() exception", at the end of this comment.
488 *
489 * A task must hold cgroup_mutex to modify cgroups.
490 *
491 * Any task can increment and decrement the count field without lock.
492 * So in general, code holding cgroup_mutex can't rely on the count
493 * field not changing. However, if the count goes to zero, then only
494 * attach_task() can increment it again. Because a count of zero
495 * means that no tasks are currently attached, therefore there is no
496 * way a task attached to that cgroup can fork (the other way to
497 * increment the count). So code holding cgroup_mutex can safely
498 * assume that if the count is zero, it will stay zero. Similarly, if
499 * a task holds cgroup_mutex on a cgroup with zero count, it
500 * knows that the cgroup won't be removed, as cgroup_rmdir()
501 * needs that mutex.
502 *
503 * The cgroup_common_file_write handler for operations that modify
504 * the cgroup hierarchy holds cgroup_mutex across the entire operation,
505 * single threading all such cgroup modifications across the system.
506 *
507 * The fork and exit callbacks cgroup_fork() and cgroup_exit(), don't
508 * (usually) take cgroup_mutex. These are the two most performance
509 * critical pieces of code here. The exception occurs on cgroup_exit(),
510 * when a task in a notify_on_release cgroup exits. Then cgroup_mutex
511 * is taken, and if the cgroup count is zero, a usermode call made
512 * to /sbin/cgroup_release_agent with the name of the cgroup (path
513 * relative to the root of cgroup file system) as the argument.
514 *
515 * A cgroup can only be deleted if both its 'count' of using tasks
516 * is zero, and its list of 'children' cgroups is empty. Since all
517 * tasks in the system use _some_ cgroup, and since there is always at
518 * least one task in the system (init, pid == 1), therefore, top_cgroup
519 * always has either children cgroups and/or using tasks. So we don't
520 * need a special hack to ensure that top_cgroup cannot be deleted.
521 *
522 * The task_lock() exception
523 *
524 * The need for this exception arises from the action of
525 * attach_task(), which overwrites one tasks cgroup pointer with
526 * another. It does so using cgroup_mutexe, however there are
527 * several performance critical places that need to reference
528 * task->cgroup without the expense of grabbing a system global
529 * mutex. Therefore except as noted below, when dereferencing or, as
530 * in attach_task(), modifying a task'ss cgroup pointer we use
531 * task_lock(), which acts on a spinlock (task->alloc_lock) already in
532 * the task_struct routinely used for such matters.
533 *
534 * P.S. One more locking exception. RCU is used to guard the
535 * update of a tasks cgroup pointer by attach_task()
536 */
537
538/**
539 * cgroup_lock - lock out any changes to cgroup structures
540 *
541 */
542
543void cgroup_lock(void)
544{
545 mutex_lock(&cgroup_mutex);
546}
547
548/**
549 * cgroup_unlock - release lock on cgroup changes
550 *
551 * Undo the lock taken in a previous cgroup_lock() call.
552 */
553
554void cgroup_unlock(void)
555{
556 mutex_unlock(&cgroup_mutex);
557}
558
559/*
560 * A couple of forward declarations required, due to cyclic reference loop:
561 * cgroup_mkdir -> cgroup_create -> cgroup_populate_dir ->
562 * cgroup_add_file -> cgroup_create_file -> cgroup_dir_inode_operations
563 * -> cgroup_mkdir.
564 */
565
566static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode);
567static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry);
568static int cgroup_populate_dir(struct cgroup *cgrp);
569static struct inode_operations cgroup_dir_inode_operations;
570static struct file_operations proc_cgroupstats_operations;
571
572static struct backing_dev_info cgroup_backing_dev_info = {
573 .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
574};
575
576static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb)
577{
578 struct inode *inode = new_inode(sb);
579
580 if (inode) {
581 inode->i_mode = mode;
582 inode->i_uid = current->fsuid;
583 inode->i_gid = current->fsgid;
584 inode->i_blocks = 0;
585 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
586 inode->i_mapping->backing_dev_info = &cgroup_backing_dev_info;
587 }
588 return inode;
589}
590
591static void cgroup_diput(struct dentry *dentry, struct inode *inode)
592{
593 /* is dentry a directory ? if so, kfree() associated cgroup */
594 if (S_ISDIR(inode->i_mode)) {
595 struct cgroup *cgrp = dentry->d_fsdata;
596 BUG_ON(!(cgroup_is_removed(cgrp)));
597 /* It's possible for external users to be holding css
598 * reference counts on a cgroup; css_put() needs to
599 * be able to access the cgroup after decrementing
600 * the reference count in order to know if it needs to
601 * queue the cgroup to be handled by the release
602 * agent */
603 synchronize_rcu();
604 kfree(cgrp);
605 }
606 iput(inode);
607}
608
609static void remove_dir(struct dentry *d)
610{
611 struct dentry *parent = dget(d->d_parent);
612
613 d_delete(d);
614 simple_rmdir(parent->d_inode, d);
615 dput(parent);
616}
617
618static void cgroup_clear_directory(struct dentry *dentry)
619{
620 struct list_head *node;
621
622 BUG_ON(!mutex_is_locked(&dentry->d_inode->i_mutex));
623 spin_lock(&dcache_lock);
624 node = dentry->d_subdirs.next;
625 while (node != &dentry->d_subdirs) {
626 struct dentry *d = list_entry(node, struct dentry, d_u.d_child);
627 list_del_init(node);
628 if (d->d_inode) {
629 /* This should never be called on a cgroup
630 * directory with child cgroups */
631 BUG_ON(d->d_inode->i_mode & S_IFDIR);
632 d = dget_locked(d);
633 spin_unlock(&dcache_lock);
634 d_delete(d);
635 simple_unlink(dentry->d_inode, d);
636 dput(d);
637 spin_lock(&dcache_lock);
638 }
639 node = dentry->d_subdirs.next;
640 }
641 spin_unlock(&dcache_lock);
642}
643
644/*
645 * NOTE : the dentry must have been dget()'ed
646 */
647static void cgroup_d_remove_dir(struct dentry *dentry)
648{
649 cgroup_clear_directory(dentry);
650
651 spin_lock(&dcache_lock);
652 list_del_init(&dentry->d_u.d_child);
653 spin_unlock(&dcache_lock);
654 remove_dir(dentry);
655}
656
657static int rebind_subsystems(struct cgroupfs_root *root,
658 unsigned long final_bits)
659{
660 unsigned long added_bits, removed_bits;
661 struct cgroup *cgrp = &root->top_cgroup;
662 int i;
663
664 removed_bits = root->actual_subsys_bits & ~final_bits;
665 added_bits = final_bits & ~root->actual_subsys_bits;
666 /* Check that any added subsystems are currently free */
667 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
668 unsigned long long bit = 1ull << i;
669 struct cgroup_subsys *ss = subsys[i];
670 if (!(bit & added_bits))
671 continue;
672 if (ss->root != &rootnode) {
673 /* Subsystem isn't free */
674 return -EBUSY;
675 }
676 }
677
678 /* Currently we don't handle adding/removing subsystems when
679 * any child cgroups exist. This is theoretically supportable
680 * but involves complex error handling, so it's being left until
681 * later */
682 if (!list_empty(&cgrp->children))
683 return -EBUSY;
684
685 /* Process each subsystem */
686 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
687 struct cgroup_subsys *ss = subsys[i];
688 unsigned long bit = 1UL << i;
689 if (bit & added_bits) {
690 /* We're binding this subsystem to this hierarchy */
691 BUG_ON(cgrp->subsys[i]);
692 BUG_ON(!dummytop->subsys[i]);
693 BUG_ON(dummytop->subsys[i]->cgroup != dummytop);
694 cgrp->subsys[i] = dummytop->subsys[i];
695 cgrp->subsys[i]->cgroup = cgrp;
696 list_add(&ss->sibling, &root->subsys_list);
697 rcu_assign_pointer(ss->root, root);
698 if (ss->bind)
699 ss->bind(ss, cgrp);
700
701 } else if (bit & removed_bits) {
702 /* We're removing this subsystem */
703 BUG_ON(cgrp->subsys[i] != dummytop->subsys[i]);
704 BUG_ON(cgrp->subsys[i]->cgroup != cgrp);
705 if (ss->bind)
706 ss->bind(ss, dummytop);
707 dummytop->subsys[i]->cgroup = dummytop;
708 cgrp->subsys[i] = NULL;
709 rcu_assign_pointer(subsys[i]->root, &rootnode);
710 list_del(&ss->sibling);
711 } else if (bit & final_bits) {
712 /* Subsystem state should already exist */
713 BUG_ON(!cgrp->subsys[i]);
714 } else {
715 /* Subsystem state shouldn't exist */
716 BUG_ON(cgrp->subsys[i]);
717 }
718 }
719 root->subsys_bits = root->actual_subsys_bits = final_bits;
720 synchronize_rcu();
721
722 return 0;
723}
724
725static int cgroup_show_options(struct seq_file *seq, struct vfsmount *vfs)
726{
727 struct cgroupfs_root *root = vfs->mnt_sb->s_fs_info;
728 struct cgroup_subsys *ss;
729
730 mutex_lock(&cgroup_mutex);
731 for_each_subsys(root, ss)
732 seq_printf(seq, ",%s", ss->name);
733 if (test_bit(ROOT_NOPREFIX, &root->flags))
734 seq_puts(seq, ",noprefix");
735 if (strlen(root->release_agent_path))
736 seq_printf(seq, ",release_agent=%s", root->release_agent_path);
737 mutex_unlock(&cgroup_mutex);
738 return 0;
739}
740
741struct cgroup_sb_opts {
742 unsigned long subsys_bits;
743 unsigned long flags;
744 char *release_agent;
745};
746
747/* Convert a hierarchy specifier into a bitmask of subsystems and
748 * flags. */
749static int parse_cgroupfs_options(char *data,
750 struct cgroup_sb_opts *opts)
751{
752 char *token, *o = data ?: "all";
753
754 opts->subsys_bits = 0;
755 opts->flags = 0;
756 opts->release_agent = NULL;
757
758 while ((token = strsep(&o, ",")) != NULL) {
759 if (!*token)
760 return -EINVAL;
761 if (!strcmp(token, "all")) {
762 opts->subsys_bits = (1 << CGROUP_SUBSYS_COUNT) - 1;
763 } else if (!strcmp(token, "noprefix")) {
764 set_bit(ROOT_NOPREFIX, &opts->flags);
765 } else if (!strncmp(token, "release_agent=", 14)) {
766 /* Specifying two release agents is forbidden */
767 if (opts->release_agent)
768 return -EINVAL;
769 opts->release_agent = kzalloc(PATH_MAX, GFP_KERNEL);
770 if (!opts->release_agent)
771 return -ENOMEM;
772 strncpy(opts->release_agent, token + 14, PATH_MAX - 1);
773 opts->release_agent[PATH_MAX - 1] = 0;
774 } else {
775 struct cgroup_subsys *ss;
776 int i;
777 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
778 ss = subsys[i];
779 if (!strcmp(token, ss->name)) {
780 set_bit(i, &opts->subsys_bits);
781 break;
782 }
783 }
784 if (i == CGROUP_SUBSYS_COUNT)
785 return -ENOENT;
786 }
787 }
788
789 /* We can't have an empty hierarchy */
790 if (!opts->subsys_bits)
791 return -EINVAL;
792
793 return 0;
794}
795
796static int cgroup_remount(struct super_block *sb, int *flags, char *data)
797{
798 int ret = 0;
799 struct cgroupfs_root *root = sb->s_fs_info;
800 struct cgroup *cgrp = &root->top_cgroup;
801 struct cgroup_sb_opts opts;
802
803 mutex_lock(&cgrp->dentry->d_inode->i_mutex);
804 mutex_lock(&cgroup_mutex);
805
806 /* See what subsystems are wanted */
807 ret = parse_cgroupfs_options(data, &opts);
808 if (ret)
809 goto out_unlock;
810
811 /* Don't allow flags to change at remount */
812 if (opts.flags != root->flags) {
813 ret = -EINVAL;
814 goto out_unlock;
815 }
816
817 ret = rebind_subsystems(root, opts.subsys_bits);
818
819 /* (re)populate subsystem files */
820 if (!ret)
821 cgroup_populate_dir(cgrp);
822
823 if (opts.release_agent)
824 strcpy(root->release_agent_path, opts.release_agent);
825 out_unlock:
826 if (opts.release_agent)
827 kfree(opts.release_agent);
828 mutex_unlock(&cgroup_mutex);
829 mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
830 return ret;
831}
832
833static struct super_operations cgroup_ops = {
834 .statfs = simple_statfs,
835 .drop_inode = generic_delete_inode,
836 .show_options = cgroup_show_options,
837 .remount_fs = cgroup_remount,
838};
839
840static void init_cgroup_root(struct cgroupfs_root *root)
841{
842 struct cgroup *cgrp = &root->top_cgroup;
843 INIT_LIST_HEAD(&root->subsys_list);
844 INIT_LIST_HEAD(&root->root_list);
845 root->number_of_cgroups = 1;
846 cgrp->root = root;
847 cgrp->top_cgroup = cgrp;
848 INIT_LIST_HEAD(&cgrp->sibling);
849 INIT_LIST_HEAD(&cgrp->children);
850 INIT_LIST_HEAD(&cgrp->css_sets);
851 INIT_LIST_HEAD(&cgrp->release_list);
852}
853
854static int cgroup_test_super(struct super_block *sb, void *data)
855{
856 struct cgroupfs_root *new = data;
857 struct cgroupfs_root *root = sb->s_fs_info;
858
859 /* First check subsystems */
860 if (new->subsys_bits != root->subsys_bits)
861 return 0;
862
863 /* Next check flags */
864 if (new->flags != root->flags)
865 return 0;
866
867 return 1;
868}
869
870static int cgroup_set_super(struct super_block *sb, void *data)
871{
872 int ret;
873 struct cgroupfs_root *root = data;
874
875 ret = set_anon_super(sb, NULL);
876 if (ret)
877 return ret;
878
879 sb->s_fs_info = root;
880 root->sb = sb;
881
882 sb->s_blocksize = PAGE_CACHE_SIZE;
883 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
884 sb->s_magic = CGROUP_SUPER_MAGIC;
885 sb->s_op = &cgroup_ops;
886
887 return 0;
888}
889
890static int cgroup_get_rootdir(struct super_block *sb)
891{
892 struct inode *inode =
893 cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb);
894 struct dentry *dentry;
895
896 if (!inode)
897 return -ENOMEM;
898
899 inode->i_op = &simple_dir_inode_operations;
900 inode->i_fop = &simple_dir_operations;
901 inode->i_op = &cgroup_dir_inode_operations;
902 /* directories start off with i_nlink == 2 (for "." entry) */
903 inc_nlink(inode);
904 dentry = d_alloc_root(inode);
905 if (!dentry) {
906 iput(inode);
907 return -ENOMEM;
908 }
909 sb->s_root = dentry;
910 return 0;
911}
912
913static int cgroup_get_sb(struct file_system_type *fs_type,
914 int flags, const char *unused_dev_name,
915 void *data, struct vfsmount *mnt)
916{
917 struct cgroup_sb_opts opts;
918 int ret = 0;
919 struct super_block *sb;
920 struct cgroupfs_root *root;
921 struct list_head tmp_cg_links, *l;
922 INIT_LIST_HEAD(&tmp_cg_links);
923
924 /* First find the desired set of subsystems */
925 ret = parse_cgroupfs_options(data, &opts);
926 if (ret) {
927 if (opts.release_agent)
928 kfree(opts.release_agent);
929 return ret;
930 }
931
932 root = kzalloc(sizeof(*root), GFP_KERNEL);
933 if (!root)
934 return -ENOMEM;
935
936 init_cgroup_root(root);
937 root->subsys_bits = opts.subsys_bits;
938 root->flags = opts.flags;
939 if (opts.release_agent) {
940 strcpy(root->release_agent_path, opts.release_agent);
941 kfree(opts.release_agent);
942 }
943
944 sb = sget(fs_type, cgroup_test_super, cgroup_set_super, root);
945
946 if (IS_ERR(sb)) {
947 kfree(root);
948 return PTR_ERR(sb);
949 }
950
951 if (sb->s_fs_info != root) {
952 /* Reusing an existing superblock */
953 BUG_ON(sb->s_root == NULL);
954 kfree(root);
955 root = NULL;
956 } else {
957 /* New superblock */
958 struct cgroup *cgrp = &root->top_cgroup;
959 struct inode *inode;
960
961 BUG_ON(sb->s_root != NULL);
962
963 ret = cgroup_get_rootdir(sb);
964 if (ret)
965 goto drop_new_super;
966 inode = sb->s_root->d_inode;
967
968 mutex_lock(&inode->i_mutex);
969 mutex_lock(&cgroup_mutex);
970
971 /*
972 * We're accessing css_set_count without locking
973 * css_set_lock here, but that's OK - it can only be
974 * increased by someone holding cgroup_lock, and
975 * that's us. The worst that can happen is that we
976 * have some link structures left over
977 */
978 ret = allocate_cg_links(css_set_count, &tmp_cg_links);
979 if (ret) {
980 mutex_unlock(&cgroup_mutex);
981 mutex_unlock(&inode->i_mutex);
982 goto drop_new_super;
983 }
984
985 ret = rebind_subsystems(root, root->subsys_bits);
986 if (ret == -EBUSY) {
987 mutex_unlock(&cgroup_mutex);
988 mutex_unlock(&inode->i_mutex);
989 goto drop_new_super;
990 }
991
992 /* EBUSY should be the only error here */
993 BUG_ON(ret);
994
995 list_add(&root->root_list, &roots);
996 root_count++;
997
998 sb->s_root->d_fsdata = &root->top_cgroup;
999 root->top_cgroup.dentry = sb->s_root;
1000
1001 /* Link the top cgroup in this hierarchy into all
1002 * the css_set objects */
1003 write_lock(&css_set_lock);
1004 l = &init_css_set.list;
1005 do {
1006 struct css_set *cg;
1007 struct cg_cgroup_link *link;
1008 cg = list_entry(l, struct css_set, list);
1009 BUG_ON(list_empty(&tmp_cg_links));
1010 link = list_entry(tmp_cg_links.next,
1011 struct cg_cgroup_link,
1012 cgrp_link_list);
1013 list_del(&link->cgrp_link_list);
1014 link->cg = cg;
1015 list_add(&link->cgrp_link_list,
1016 &root->top_cgroup.css_sets);
1017 list_add(&link->cg_link_list, &cg->cg_links);
1018 l = l->next;
1019 } while (l != &init_css_set.list);
1020 write_unlock(&css_set_lock);
1021
1022 free_cg_links(&tmp_cg_links);
1023
1024 BUG_ON(!list_empty(&cgrp->sibling));
1025 BUG_ON(!list_empty(&cgrp->children));
1026 BUG_ON(root->number_of_cgroups != 1);
1027
1028 cgroup_populate_dir(cgrp);
1029 mutex_unlock(&inode->i_mutex);
1030 mutex_unlock(&cgroup_mutex);
1031 }
1032
1033 return simple_set_mnt(mnt, sb);
1034
1035 drop_new_super:
1036 up_write(&sb->s_umount);
1037 deactivate_super(sb);
1038 free_cg_links(&tmp_cg_links);
1039 return ret;
1040}
1041
1042static void cgroup_kill_sb(struct super_block *sb) {
1043 struct cgroupfs_root *root = sb->s_fs_info;
1044 struct cgroup *cgrp = &root->top_cgroup;
1045 int ret;
1046
1047 BUG_ON(!root);
1048
1049 BUG_ON(root->number_of_cgroups != 1);
1050 BUG_ON(!list_empty(&cgrp->children));
1051 BUG_ON(!list_empty(&cgrp->sibling));
1052
1053 mutex_lock(&cgroup_mutex);
1054
1055 /* Rebind all subsystems back to the default hierarchy */
1056 ret = rebind_subsystems(root, 0);
1057 /* Shouldn't be able to fail ... */
1058 BUG_ON(ret);
1059
1060 /*
1061 * Release all the links from css_sets to this hierarchy's
1062 * root cgroup
1063 */
1064 write_lock(&css_set_lock);
1065 while (!list_empty(&cgrp->css_sets)) {
1066 struct cg_cgroup_link *link;
1067 link = list_entry(cgrp->css_sets.next,
1068 struct cg_cgroup_link, cgrp_link_list);
1069 list_del(&link->cg_link_list);
1070 list_del(&link->cgrp_link_list);
1071 kfree(link);
1072 }
1073 write_unlock(&css_set_lock);
1074
1075 if (!list_empty(&root->root_list)) {
1076 list_del(&root->root_list);
1077 root_count--;
1078 }
1079 mutex_unlock(&cgroup_mutex);
1080
1081 kfree(root);
1082 kill_litter_super(sb);
1083}
1084
1085static struct file_system_type cgroup_fs_type = {
1086 .name = "cgroup",
1087 .get_sb = cgroup_get_sb,
1088 .kill_sb = cgroup_kill_sb,
1089};
1090
1091static inline struct cgroup *__d_cgrp(struct dentry *dentry)
1092{
1093 return dentry->d_fsdata;
1094}
1095
1096static inline struct cftype *__d_cft(struct dentry *dentry)
1097{
1098 return dentry->d_fsdata;
1099}
1100
1101/*
1102 * Called with cgroup_mutex held. Writes path of cgroup into buf.
1103 * Returns 0 on success, -errno on error.
1104 */
1105int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
1106{
1107 char *start;
1108
1109 if (cgrp == dummytop) {
1110 /*
1111 * Inactive subsystems have no dentry for their root
1112 * cgroup
1113 */
1114 strcpy(buf, "/");
1115 return 0;
1116 }
1117
1118 start = buf + buflen;
1119
1120 *--start = '\0';
1121 for (;;) {
1122 int len = cgrp->dentry->d_name.len;
1123 if ((start -= len) < buf)
1124 return -ENAMETOOLONG;
1125 memcpy(start, cgrp->dentry->d_name.name, len);
1126 cgrp = cgrp->parent;
1127 if (!cgrp)
1128 break;
1129 if (!cgrp->parent)
1130 continue;
1131 if (--start < buf)
1132 return -ENAMETOOLONG;
1133 *start = '/';
1134 }
1135 memmove(buf, start, buf + buflen - start);
1136 return 0;
1137}
1138
1139/*
1140 * Return the first subsystem attached to a cgroup's hierarchy, and
1141 * its subsystem id.
1142 */
1143
1144static void get_first_subsys(const struct cgroup *cgrp,
1145 struct cgroup_subsys_state **css, int *subsys_id)
1146{
1147 const struct cgroupfs_root *root = cgrp->root;
1148 const struct cgroup_subsys *test_ss;
1149 BUG_ON(list_empty(&root->subsys_list));
1150 test_ss = list_entry(root->subsys_list.next,
1151 struct cgroup_subsys, sibling);
1152 if (css) {
1153 *css = cgrp->subsys[test_ss->subsys_id];
1154 BUG_ON(!*css);
1155 }
1156 if (subsys_id)
1157 *subsys_id = test_ss->subsys_id;
1158}
1159
1160/*
1161 * Attach task 'tsk' to cgroup 'cgrp'
1162 *
1163 * Call holding cgroup_mutex. May take task_lock of
1164 * the task 'pid' during call.
1165 */
1166static int attach_task(struct cgroup *cgrp, struct task_struct *tsk)
1167{
1168 int retval = 0;
1169 struct cgroup_subsys *ss;
1170 struct cgroup *oldcgrp;
1171 struct css_set *cg = tsk->cgroups;
1172 struct css_set *newcg;
1173 struct cgroupfs_root *root = cgrp->root;
1174 int subsys_id;
1175
1176 get_first_subsys(cgrp, NULL, &subsys_id);
1177
1178 /* Nothing to do if the task is already in that cgroup */
1179 oldcgrp = task_cgroup(tsk, subsys_id);
1180 if (cgrp == oldcgrp)
1181 return 0;
1182
1183 for_each_subsys(root, ss) {
1184 if (ss->can_attach) {
1185 retval = ss->can_attach(ss, cgrp, tsk);
1186 if (retval) {
1187 return retval;
1188 }
1189 }
1190 }
1191
1192 /*
1193 * Locate or allocate a new css_set for this task,
1194 * based on its final set of cgroups
1195 */
1196 newcg = find_css_set(cg, cgrp);
1197 if (!newcg) {
1198 return -ENOMEM;
1199 }
1200
1201 task_lock(tsk);
1202 if (tsk->flags & PF_EXITING) {
1203 task_unlock(tsk);
1204 put_css_set(newcg);
1205 return -ESRCH;
1206 }
1207 rcu_assign_pointer(tsk->cgroups, newcg);
1208 task_unlock(tsk);
1209
1210 /* Update the css_set linked lists if we're using them */
1211 write_lock(&css_set_lock);
1212 if (!list_empty(&tsk->cg_list)) {
1213 list_del(&tsk->cg_list);
1214 list_add(&tsk->cg_list, &newcg->tasks);
1215 }
1216 write_unlock(&css_set_lock);
1217
1218 for_each_subsys(root, ss) {
1219 if (ss->attach) {
1220 ss->attach(ss, cgrp, oldcgrp, tsk);
1221 }
1222 }
1223 set_bit(CGRP_RELEASABLE, &oldcgrp->flags);
1224 synchronize_rcu();
1225 put_css_set(cg);
1226 return 0;
1227}
1228
1229/*
1230 * Attach task with pid 'pid' to cgroup 'cgrp'. Call with
1231 * cgroup_mutex, may take task_lock of task
1232 */
1233static int attach_task_by_pid(struct cgroup *cgrp, char *pidbuf)
1234{
1235 pid_t pid;
1236 struct task_struct *tsk;
1237 int ret;
1238
1239 if (sscanf(pidbuf, "%d", &pid) != 1)
1240 return -EIO;
1241
1242 if (pid) {
1243 rcu_read_lock();
1244 tsk = find_task_by_pid(pid);
1245 if (!tsk || tsk->flags & PF_EXITING) {
1246 rcu_read_unlock();
1247 return -ESRCH;
1248 }
1249 get_task_struct(tsk);
1250 rcu_read_unlock();
1251
1252 if ((current->euid) && (current->euid != tsk->uid)
1253 && (current->euid != tsk->suid)) {
1254 put_task_struct(tsk);
1255 return -EACCES;
1256 }
1257 } else {
1258 tsk = current;
1259 get_task_struct(tsk);
1260 }
1261
1262 ret = attach_task(cgrp, tsk);
1263 put_task_struct(tsk);
1264 return ret;
1265}
1266
1267/* The various types of files and directories in a cgroup file system */
1268
1269enum cgroup_filetype {
1270 FILE_ROOT,
1271 FILE_DIR,
1272 FILE_TASKLIST,
1273 FILE_NOTIFY_ON_RELEASE,
1274 FILE_RELEASABLE,
1275 FILE_RELEASE_AGENT,
1276};
1277
1278static ssize_t cgroup_write_uint(struct cgroup *cgrp, struct cftype *cft,
1279 struct file *file,
1280 const char __user *userbuf,
1281 size_t nbytes, loff_t *unused_ppos)
1282{
1283 char buffer[64];
1284 int retval = 0;
1285 u64 val;
1286 char *end;
1287
1288 if (!nbytes)
1289 return -EINVAL;
1290 if (nbytes >= sizeof(buffer))
1291 return -E2BIG;
1292 if (copy_from_user(buffer, userbuf, nbytes))
1293 return -EFAULT;
1294
1295 buffer[nbytes] = 0; /* nul-terminate */
1296
1297 /* strip newline if necessary */
1298 if (nbytes && (buffer[nbytes-1] == '\n'))
1299 buffer[nbytes-1] = 0;
1300 val = simple_strtoull(buffer, &end, 0);
1301 if (*end)
1302 return -EINVAL;
1303
1304 /* Pass to subsystem */
1305 retval = cft->write_uint(cgrp, cft, val);
1306 if (!retval)
1307 retval = nbytes;
1308 return retval;
1309}
1310
1311static ssize_t cgroup_common_file_write(struct cgroup *cgrp,
1312 struct cftype *cft,
1313 struct file *file,
1314 const char __user *userbuf,
1315 size_t nbytes, loff_t *unused_ppos)
1316{
1317 enum cgroup_filetype type = cft->private;
1318 char *buffer;
1319 int retval = 0;
1320
1321 if (nbytes >= PATH_MAX)
1322 return -E2BIG;
1323
1324 /* +1 for nul-terminator */
1325 buffer = kmalloc(nbytes + 1, GFP_KERNEL);
1326 if (buffer == NULL)
1327 return -ENOMEM;
1328
1329 if (copy_from_user(buffer, userbuf, nbytes)) {
1330 retval = -EFAULT;
1331 goto out1;
1332 }
1333 buffer[nbytes] = 0; /* nul-terminate */
1334
1335 mutex_lock(&cgroup_mutex);
1336
1337 if (cgroup_is_removed(cgrp)) {
1338 retval = -ENODEV;
1339 goto out2;
1340 }
1341
1342 switch (type) {
1343 case FILE_TASKLIST:
1344 retval = attach_task_by_pid(cgrp, buffer);
1345 break;
1346 case FILE_NOTIFY_ON_RELEASE:
1347 clear_bit(CGRP_RELEASABLE, &cgrp->flags);
1348 if (simple_strtoul(buffer, NULL, 10) != 0)
1349 set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
1350 else
1351 clear_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
1352 break;
1353 case FILE_RELEASE_AGENT:
1354 {
1355 struct cgroupfs_root *root = cgrp->root;
1356 /* Strip trailing newline */
1357 if (nbytes && (buffer[nbytes-1] == '\n')) {
1358 buffer[nbytes-1] = 0;
1359 }
1360 if (nbytes < sizeof(root->release_agent_path)) {
1361 /* We never write anything other than '\0'
1362 * into the last char of release_agent_path,
1363 * so it always remains a NUL-terminated
1364 * string */
1365 strncpy(root->release_agent_path, buffer, nbytes);
1366 root->release_agent_path[nbytes] = 0;
1367 } else {
1368 retval = -ENOSPC;
1369 }
1370 break;
1371 }
1372 default:
1373 retval = -EINVAL;
1374 goto out2;
1375 }
1376
1377 if (retval == 0)
1378 retval = nbytes;
1379out2:
1380 mutex_unlock(&cgroup_mutex);
1381out1:
1382 kfree(buffer);
1383 return retval;
1384}
1385
1386static ssize_t cgroup_file_write(struct file *file, const char __user *buf,
1387 size_t nbytes, loff_t *ppos)
1388{
1389 struct cftype *cft = __d_cft(file->f_dentry);
1390 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
1391
1392 if (!cft)
1393 return -ENODEV;
1394 if (cft->write)
1395 return cft->write(cgrp, cft, file, buf, nbytes, ppos);
1396 if (cft->write_uint)
1397 return cgroup_write_uint(cgrp, cft, file, buf, nbytes, ppos);
1398 return -EINVAL;
1399}
1400
1401static ssize_t cgroup_read_uint(struct cgroup *cgrp, struct cftype *cft,
1402 struct file *file,
1403 char __user *buf, size_t nbytes,
1404 loff_t *ppos)
1405{
1406 char tmp[64];
1407 u64 val = cft->read_uint(cgrp, cft);
1408 int len = sprintf(tmp, "%llu\n", (unsigned long long) val);
1409
1410 return simple_read_from_buffer(buf, nbytes, ppos, tmp, len);
1411}
1412
1413static ssize_t cgroup_common_file_read(struct cgroup *cgrp,
1414 struct cftype *cft,
1415 struct file *file,
1416 char __user *buf,
1417 size_t nbytes, loff_t *ppos)
1418{
1419 enum cgroup_filetype type = cft->private;
1420 char *page;
1421 ssize_t retval = 0;
1422 char *s;
1423
1424 if (!(page = (char *)__get_free_page(GFP_KERNEL)))
1425 return -ENOMEM;
1426
1427 s = page;
1428
1429 switch (type) {
1430 case FILE_RELEASE_AGENT:
1431 {
1432 struct cgroupfs_root *root;
1433 size_t n;
1434 mutex_lock(&cgroup_mutex);
1435 root = cgrp->root;
1436 n = strnlen(root->release_agent_path,
1437 sizeof(root->release_agent_path));
1438 n = min(n, (size_t) PAGE_SIZE);
1439 strncpy(s, root->release_agent_path, n);
1440 mutex_unlock(&cgroup_mutex);
1441 s += n;
1442 break;
1443 }
1444 default:
1445 retval = -EINVAL;
1446 goto out;
1447 }
1448 *s++ = '\n';
1449
1450 retval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page);
1451out:
1452 free_page((unsigned long)page);
1453 return retval;
1454}
1455
1456static ssize_t cgroup_file_read(struct file *file, char __user *buf,
1457 size_t nbytes, loff_t *ppos)
1458{
1459 struct cftype *cft = __d_cft(file->f_dentry);
1460 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
1461
1462 if (!cft)
1463 return -ENODEV;
1464
1465 if (cft->read)
1466 return cft->read(cgrp, cft, file, buf, nbytes, ppos);
1467 if (cft->read_uint)
1468 return cgroup_read_uint(cgrp, cft, file, buf, nbytes, ppos);
1469 return -EINVAL;
1470}
1471
1472static int cgroup_file_open(struct inode *inode, struct file *file)
1473{
1474 int err;
1475 struct cftype *cft;
1476
1477 err = generic_file_open(inode, file);
1478 if (err)
1479 return err;
1480
1481 cft = __d_cft(file->f_dentry);
1482 if (!cft)
1483 return -ENODEV;
1484 if (cft->open)
1485 err = cft->open(inode, file);
1486 else
1487 err = 0;
1488
1489 return err;
1490}
1491
1492static int cgroup_file_release(struct inode *inode, struct file *file)
1493{
1494 struct cftype *cft = __d_cft(file->f_dentry);
1495 if (cft->release)
1496 return cft->release(inode, file);
1497 return 0;
1498}
1499
1500/*
1501 * cgroup_rename - Only allow simple rename of directories in place.
1502 */
1503static int cgroup_rename(struct inode *old_dir, struct dentry *old_dentry,
1504 struct inode *new_dir, struct dentry *new_dentry)
1505{
1506 if (!S_ISDIR(old_dentry->d_inode->i_mode))
1507 return -ENOTDIR;
1508 if (new_dentry->d_inode)
1509 return -EEXIST;
1510 if (old_dir != new_dir)
1511 return -EIO;
1512 return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
1513}
1514
1515static struct file_operations cgroup_file_operations = {
1516 .read = cgroup_file_read,
1517 .write = cgroup_file_write,
1518 .llseek = generic_file_llseek,
1519 .open = cgroup_file_open,
1520 .release = cgroup_file_release,
1521};
1522
1523static struct inode_operations cgroup_dir_inode_operations = {
1524 .lookup = simple_lookup,
1525 .mkdir = cgroup_mkdir,
1526 .rmdir = cgroup_rmdir,
1527 .rename = cgroup_rename,
1528};
1529
1530static int cgroup_create_file(struct dentry *dentry, int mode,
1531 struct super_block *sb)
1532{
1533 static struct dentry_operations cgroup_dops = {
1534 .d_iput = cgroup_diput,
1535 };
1536
1537 struct inode *inode;
1538
1539 if (!dentry)
1540 return -ENOENT;
1541 if (dentry->d_inode)
1542 return -EEXIST;
1543
1544 inode = cgroup_new_inode(mode, sb);
1545 if (!inode)
1546 return -ENOMEM;
1547
1548 if (S_ISDIR(mode)) {
1549 inode->i_op = &cgroup_dir_inode_operations;
1550 inode->i_fop = &simple_dir_operations;
1551
1552 /* start off with i_nlink == 2 (for "." entry) */
1553 inc_nlink(inode);
1554
1555 /* start with the directory inode held, so that we can
1556 * populate it without racing with another mkdir */
1557 mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD);
1558 } else if (S_ISREG(mode)) {
1559 inode->i_size = 0;
1560 inode->i_fop = &cgroup_file_operations;
1561 }
1562 dentry->d_op = &cgroup_dops;
1563 d_instantiate(dentry, inode);
1564 dget(dentry); /* Extra count - pin the dentry in core */
1565 return 0;
1566}
1567
1568/*
1569 * cgroup_create_dir - create a directory for an object.
1570 * cgrp: the cgroup we create the directory for.
1571 * It must have a valid ->parent field
1572 * And we are going to fill its ->dentry field.
1573 * dentry: dentry of the new cgroup
1574 * mode: mode to set on new directory.
1575 */
1576static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
1577 int mode)
1578{
1579 struct dentry *parent;
1580 int error = 0;
1581
1582 parent = cgrp->parent->dentry;
1583 error = cgroup_create_file(dentry, S_IFDIR | mode, cgrp->root->sb);
1584 if (!error) {
1585 dentry->d_fsdata = cgrp;
1586 inc_nlink(parent->d_inode);
1587 cgrp->dentry = dentry;
1588 dget(dentry);
1589 }
1590 dput(dentry);
1591
1592 return error;
1593}
1594
1595int cgroup_add_file(struct cgroup *cgrp,
1596 struct cgroup_subsys *subsys,
1597 const struct cftype *cft)
1598{
1599 struct dentry *dir = cgrp->dentry;
1600 struct dentry *dentry;
1601 int error;
1602
1603 char name[MAX_CGROUP_TYPE_NAMELEN + MAX_CFTYPE_NAME + 2] = { 0 };
1604 if (subsys && !test_bit(ROOT_NOPREFIX, &cgrp->root->flags)) {
1605 strcpy(name, subsys->name);
1606 strcat(name, ".");
1607 }
1608 strcat(name, cft->name);
1609 BUG_ON(!mutex_is_locked(&dir->d_inode->i_mutex));
1610 dentry = lookup_one_len(name, dir, strlen(name));
1611 if (!IS_ERR(dentry)) {
1612 error = cgroup_create_file(dentry, 0644 | S_IFREG,
1613 cgrp->root->sb);
1614 if (!error)
1615 dentry->d_fsdata = (void *)cft;
1616 dput(dentry);
1617 } else
1618 error = PTR_ERR(dentry);
1619 return error;
1620}
1621
1622int cgroup_add_files(struct cgroup *cgrp,
1623 struct cgroup_subsys *subsys,
1624 const struct cftype cft[],
1625 int count)
1626{
1627 int i, err;
1628 for (i = 0; i < count; i++) {
1629 err = cgroup_add_file(cgrp, subsys, &cft[i]);
1630 if (err)
1631 return err;
1632 }
1633 return 0;
1634}
1635
1636/* Count the number of tasks in a cgroup. */
1637
1638int cgroup_task_count(const struct cgroup *cgrp)
1639{
1640 int count = 0;
1641 struct list_head *l;
1642
1643 read_lock(&css_set_lock);
1644 l = cgrp->css_sets.next;
1645 while (l != &cgrp->css_sets) {
1646 struct cg_cgroup_link *link =
1647 list_entry(l, struct cg_cgroup_link, cgrp_link_list);
1648 count += atomic_read(&link->cg->ref.refcount);
1649 l = l->next;
1650 }
1651 read_unlock(&css_set_lock);
1652 return count;
1653}
1654
1655/*
1656 * Advance a list_head iterator. The iterator should be positioned at
1657 * the start of a css_set
1658 */
1659static void cgroup_advance_iter(struct cgroup *cgrp,
1660 struct cgroup_iter *it)
1661{
1662 struct list_head *l = it->cg_link;
1663 struct cg_cgroup_link *link;
1664 struct css_set *cg;
1665
1666 /* Advance to the next non-empty css_set */
1667 do {
1668 l = l->next;
1669 if (l == &cgrp->css_sets) {
1670 it->cg_link = NULL;
1671 return;
1672 }
1673 link = list_entry(l, struct cg_cgroup_link, cgrp_link_list);
1674 cg = link->cg;
1675 } while (list_empty(&cg->tasks));
1676 it->cg_link = l;
1677 it->task = cg->tasks.next;
1678}
1679
1680void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it)
1681{
1682 /*
1683 * The first time anyone tries to iterate across a cgroup,
1684 * we need to enable the list linking each css_set to its
1685 * tasks, and fix up all existing tasks.
1686 */
1687 if (!use_task_css_set_links) {
1688 struct task_struct *p, *g;
1689 write_lock(&css_set_lock);
1690 use_task_css_set_links = 1;
1691 do_each_thread(g, p) {
1692 task_lock(p);
1693 if (list_empty(&p->cg_list))
1694 list_add(&p->cg_list, &p->cgroups->tasks);
1695 task_unlock(p);
1696 } while_each_thread(g, p);
1697 write_unlock(&css_set_lock);
1698 }
1699 read_lock(&css_set_lock);
1700 it->cg_link = &cgrp->css_sets;
1701 cgroup_advance_iter(cgrp, it);
1702}
1703
1704struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
1705 struct cgroup_iter *it)
1706{
1707 struct task_struct *res;
1708 struct list_head *l = it->task;
1709
1710 /* If the iterator cg is NULL, we have no tasks */
1711 if (!it->cg_link)
1712 return NULL;
1713 res = list_entry(l, struct task_struct, cg_list);
1714 /* Advance iterator to find next entry */
1715 l = l->next;
1716 if (l == &res->cgroups->tasks) {
1717 /* We reached the end of this task list - move on to
1718 * the next cg_cgroup_link */
1719 cgroup_advance_iter(cgrp, it);
1720 } else {
1721 it->task = l;
1722 }
1723 return res;
1724}
1725
1726void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it)
1727{
1728 read_unlock(&css_set_lock);
1729}
1730
1731/*
1732 * Stuff for reading the 'tasks' file.
1733 *
1734 * Reading this file can return large amounts of data if a cgroup has
1735 * *lots* of attached tasks. So it may need several calls to read(),
1736 * but we cannot guarantee that the information we produce is correct
1737 * unless we produce it entirely atomically.
1738 *
1739 * Upon tasks file open(), a struct ctr_struct is allocated, that
1740 * will have a pointer to an array (also allocated here). The struct
1741 * ctr_struct * is stored in file->private_data. Its resources will
1742 * be freed by release() when the file is closed. The array is used
1743 * to sprintf the PIDs and then used by read().
1744 */
1745struct ctr_struct {
1746 char *buf;
1747 int bufsz;
1748};
1749
1750/*
1751 * Load into 'pidarray' up to 'npids' of the tasks using cgroup
1752 * 'cgrp'. Return actual number of pids loaded. No need to
1753 * task_lock(p) when reading out p->cgroup, since we're in an RCU
1754 * read section, so the css_set can't go away, and is
1755 * immutable after creation.
1756 */
1757static int pid_array_load(pid_t *pidarray, int npids, struct cgroup *cgrp)
1758{
1759 int n = 0;
1760 struct cgroup_iter it;
1761 struct task_struct *tsk;
1762 cgroup_iter_start(cgrp, &it);
1763 while ((tsk = cgroup_iter_next(cgrp, &it))) {
1764 if (unlikely(n == npids))
1765 break;
1766 pidarray[n++] = task_pid_nr(tsk);
1767 }
1768 cgroup_iter_end(cgrp, &it);
1769 return n;
1770}
1771
1772/**
1773 * Build and fill cgroupstats so that taskstats can export it to user
1774 * space.
1775 *
1776 * @stats: cgroupstats to fill information into
1777 * @dentry: A dentry entry belonging to the cgroup for which stats have
1778 * been requested.
1779 */
1780int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry)
1781{
1782 int ret = -EINVAL;
1783 struct cgroup *cgrp;
1784 struct cgroup_iter it;
1785 struct task_struct *tsk;
1786 /*
1787 * Validate dentry by checking the superblock operations
1788 */
1789 if (dentry->d_sb->s_op != &cgroup_ops)
1790 goto err;
1791
1792 ret = 0;
1793 cgrp = dentry->d_fsdata;
1794 rcu_read_lock();
1795
1796 cgroup_iter_start(cgrp, &it);
1797 while ((tsk = cgroup_iter_next(cgrp, &it))) {
1798 switch (tsk->state) {
1799 case TASK_RUNNING:
1800 stats->nr_running++;
1801 break;
1802 case TASK_INTERRUPTIBLE:
1803 stats->nr_sleeping++;
1804 break;
1805 case TASK_UNINTERRUPTIBLE:
1806 stats->nr_uninterruptible++;
1807 break;
1808 case TASK_STOPPED:
1809 stats->nr_stopped++;
1810 break;
1811 default:
1812 if (delayacct_is_task_waiting_on_io(tsk))
1813 stats->nr_io_wait++;
1814 break;
1815 }
1816 }
1817 cgroup_iter_end(cgrp, &it);
1818
1819 rcu_read_unlock();
1820err:
1821 return ret;
1822}
1823
1824static int cmppid(const void *a, const void *b)
1825{
1826 return *(pid_t *)a - *(pid_t *)b;
1827}
1828
1829/*
1830 * Convert array 'a' of 'npids' pid_t's to a string of newline separated
1831 * decimal pids in 'buf'. Don't write more than 'sz' chars, but return
1832 * count 'cnt' of how many chars would be written if buf were large enough.
1833 */
1834static int pid_array_to_buf(char *buf, int sz, pid_t *a, int npids)
1835{
1836 int cnt = 0;
1837 int i;
1838
1839 for (i = 0; i < npids; i++)
1840 cnt += snprintf(buf + cnt, max(sz - cnt, 0), "%d\n", a[i]);
1841 return cnt;
1842}
1843
1844/*
1845 * Handle an open on 'tasks' file. Prepare a buffer listing the
1846 * process id's of tasks currently attached to the cgroup being opened.
1847 *
1848 * Does not require any specific cgroup mutexes, and does not take any.
1849 */
1850static int cgroup_tasks_open(struct inode *unused, struct file *file)
1851{
1852 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
1853 struct ctr_struct *ctr;
1854 pid_t *pidarray;
1855 int npids;
1856 char c;
1857
1858 if (!(file->f_mode & FMODE_READ))
1859 return 0;
1860
1861 ctr = kmalloc(sizeof(*ctr), GFP_KERNEL);
1862 if (!ctr)
1863 goto err0;
1864
1865 /*
1866 * If cgroup gets more users after we read count, we won't have
1867 * enough space - tough. This race is indistinguishable to the
1868 * caller from the case that the additional cgroup users didn't
1869 * show up until sometime later on.
1870 */
1871 npids = cgroup_task_count(cgrp);
1872 if (npids) {
1873 pidarray = kmalloc(npids * sizeof(pid_t), GFP_KERNEL);
1874 if (!pidarray)
1875 goto err1;
1876
1877 npids = pid_array_load(pidarray, npids, cgrp);
1878 sort(pidarray, npids, sizeof(pid_t), cmppid, NULL);
1879
1880 /* Call pid_array_to_buf() twice, first just to get bufsz */
1881 ctr->bufsz = pid_array_to_buf(&c, sizeof(c), pidarray, npids) + 1;
1882 ctr->buf = kmalloc(ctr->bufsz, GFP_KERNEL);
1883 if (!ctr->buf)
1884 goto err2;
1885 ctr->bufsz = pid_array_to_buf(ctr->buf, ctr->bufsz, pidarray, npids);
1886
1887 kfree(pidarray);
1888 } else {
1889 ctr->buf = 0;
1890 ctr->bufsz = 0;
1891 }
1892 file->private_data = ctr;
1893 return 0;
1894
1895err2:
1896 kfree(pidarray);
1897err1:
1898 kfree(ctr);
1899err0:
1900 return -ENOMEM;
1901}
1902
1903static ssize_t cgroup_tasks_read(struct cgroup *cgrp,
1904 struct cftype *cft,
1905 struct file *file, char __user *buf,
1906 size_t nbytes, loff_t *ppos)
1907{
1908 struct ctr_struct *ctr = file->private_data;
1909
1910 return simple_read_from_buffer(buf, nbytes, ppos, ctr->buf, ctr->bufsz);
1911}
1912
1913static int cgroup_tasks_release(struct inode *unused_inode,
1914 struct file *file)
1915{
1916 struct ctr_struct *ctr;
1917
1918 if (file->f_mode & FMODE_READ) {
1919 ctr = file->private_data;
1920 kfree(ctr->buf);
1921 kfree(ctr);
1922 }
1923 return 0;
1924}
1925
1926static u64 cgroup_read_notify_on_release(struct cgroup *cgrp,
1927 struct cftype *cft)
1928{
1929 return notify_on_release(cgrp);
1930}
1931
1932static u64 cgroup_read_releasable(struct cgroup *cgrp, struct cftype *cft)
1933{
1934 return test_bit(CGRP_RELEASABLE, &cgrp->flags);
1935}
1936
1937/*
1938 * for the common functions, 'private' gives the type of file
1939 */
1940static struct cftype files[] = {
1941 {
1942 .name = "tasks",
1943 .open = cgroup_tasks_open,
1944 .read = cgroup_tasks_read,
1945 .write = cgroup_common_file_write,
1946 .release = cgroup_tasks_release,
1947 .private = FILE_TASKLIST,
1948 },
1949
1950 {
1951 .name = "notify_on_release",
1952 .read_uint = cgroup_read_notify_on_release,
1953 .write = cgroup_common_file_write,
1954 .private = FILE_NOTIFY_ON_RELEASE,
1955 },
1956
1957 {
1958 .name = "releasable",
1959 .read_uint = cgroup_read_releasable,
1960 .private = FILE_RELEASABLE,
1961 }
1962};
1963
1964static struct cftype cft_release_agent = {
1965 .name = "release_agent",
1966 .read = cgroup_common_file_read,
1967 .write = cgroup_common_file_write,
1968 .private = FILE_RELEASE_AGENT,
1969};
1970
1971static int cgroup_populate_dir(struct cgroup *cgrp)
1972{
1973 int err;
1974 struct cgroup_subsys *ss;
1975
1976 /* First clear out any existing files */
1977 cgroup_clear_directory(cgrp->dentry);
1978
1979 err = cgroup_add_files(cgrp, NULL, files, ARRAY_SIZE(files));
1980 if (err < 0)
1981 return err;
1982
1983 if (cgrp == cgrp->top_cgroup) {
1984 if ((err = cgroup_add_file(cgrp, NULL, &cft_release_agent)) < 0)
1985 return err;
1986 }
1987
1988 for_each_subsys(cgrp->root, ss) {
1989 if (ss->populate && (err = ss->populate(ss, cgrp)) < 0)
1990 return err;
1991 }
1992
1993 return 0;
1994}
1995
1996static void init_cgroup_css(struct cgroup_subsys_state *css,
1997 struct cgroup_subsys *ss,
1998 struct cgroup *cgrp)
1999{
2000 css->cgroup = cgrp;
2001 atomic_set(&css->refcnt, 0);
2002 css->flags = 0;
2003 if (cgrp == dummytop)
2004 set_bit(CSS_ROOT, &css->flags);
2005 BUG_ON(cgrp->subsys[ss->subsys_id]);
2006 cgrp->subsys[ss->subsys_id] = css;
2007}
2008
2009/*
2010 * cgroup_create - create a cgroup
2011 * parent: cgroup that will be parent of the new cgroup.
2012 * name: name of the new cgroup. Will be strcpy'ed.
2013 * mode: mode to set on new inode
2014 *
2015 * Must be called with the mutex on the parent inode held
2016 */
2017
2018static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
2019 int mode)
2020{
2021 struct cgroup *cgrp;
2022 struct cgroupfs_root *root = parent->root;
2023 int err = 0;
2024 struct cgroup_subsys *ss;
2025 struct super_block *sb = root->sb;
2026
2027 cgrp = kzalloc(sizeof(*cgrp), GFP_KERNEL);
2028 if (!cgrp)
2029 return -ENOMEM;
2030
2031 /* Grab a reference on the superblock so the hierarchy doesn't
2032 * get deleted on unmount if there are child cgroups. This
2033 * can be done outside cgroup_mutex, since the sb can't
2034 * disappear while someone has an open control file on the
2035 * fs */
2036 atomic_inc(&sb->s_active);
2037
2038 mutex_lock(&cgroup_mutex);
2039
2040 cgrp->flags = 0;
2041 INIT_LIST_HEAD(&cgrp->sibling);
2042 INIT_LIST_HEAD(&cgrp->children);
2043 INIT_LIST_HEAD(&cgrp->css_sets);
2044 INIT_LIST_HEAD(&cgrp->release_list);
2045
2046 cgrp->parent = parent;
2047 cgrp->root = parent->root;
2048 cgrp->top_cgroup = parent->top_cgroup;
2049
2050 for_each_subsys(root, ss) {
2051 struct cgroup_subsys_state *css = ss->create(ss, cgrp);
2052 if (IS_ERR(css)) {
2053 err = PTR_ERR(css);
2054 goto err_destroy;
2055 }
2056 init_cgroup_css(css, ss, cgrp);
2057 }
2058
2059 list_add(&cgrp->sibling, &cgrp->parent->children);
2060 root->number_of_cgroups++;
2061
2062 err = cgroup_create_dir(cgrp, dentry, mode);
2063 if (err < 0)
2064 goto err_remove;
2065
2066 /* The cgroup directory was pre-locked for us */
2067 BUG_ON(!mutex_is_locked(&cgrp->dentry->d_inode->i_mutex));
2068
2069 err = cgroup_populate_dir(cgrp);
2070 /* If err < 0, we have a half-filled directory - oh well ;) */
2071
2072 mutex_unlock(&cgroup_mutex);
2073 mutex_unlock(&cgrp->dentry->d_inode->i_mutex);
2074
2075 return 0;
2076
2077 err_remove:
2078
2079 list_del(&cgrp->sibling);
2080 root->number_of_cgroups--;
2081
2082 err_destroy:
2083
2084 for_each_subsys(root, ss) {
2085 if (cgrp->subsys[ss->subsys_id])
2086 ss->destroy(ss, cgrp);
2087 }
2088
2089 mutex_unlock(&cgroup_mutex);
2090
2091 /* Release the reference count that we took on the superblock */
2092 deactivate_super(sb);
2093
2094 kfree(cgrp);
2095 return err;
2096}
2097
2098static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2099{
2100 struct cgroup *c_parent = dentry->d_parent->d_fsdata;
2101
2102 /* the vfs holds inode->i_mutex already */
2103 return cgroup_create(c_parent, dentry, mode | S_IFDIR);
2104}
2105
2106static inline int cgroup_has_css_refs(struct cgroup *cgrp)
2107{
2108 /* Check the reference count on each subsystem. Since we
2109 * already established that there are no tasks in the
2110 * cgroup, if the css refcount is also 0, then there should
2111 * be no outstanding references, so the subsystem is safe to
2112 * destroy. We scan across all subsystems rather than using
2113 * the per-hierarchy linked list of mounted subsystems since
2114 * we can be called via check_for_release() with no
2115 * synchronization other than RCU, and the subsystem linked
2116 * list isn't RCU-safe */
2117 int i;
2118 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
2119 struct cgroup_subsys *ss = subsys[i];
2120 struct cgroup_subsys_state *css;
2121 /* Skip subsystems not in this hierarchy */
2122 if (ss->root != cgrp->root)
2123 continue;
2124 css = cgrp->subsys[ss->subsys_id];
2125 /* When called from check_for_release() it's possible
2126 * that by this point the cgroup has been removed
2127 * and the css deleted. But a false-positive doesn't
2128 * matter, since it can only happen if the cgroup
2129 * has been deleted and hence no longer needs the
2130 * release agent to be called anyway. */
2131 if (css && atomic_read(&css->refcnt)) {
2132 return 1;
2133 }
2134 }
2135 return 0;
2136}
2137
2138static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
2139{
2140 struct cgroup *cgrp = dentry->d_fsdata;
2141 struct dentry *d;
2142 struct cgroup *parent;
2143 struct cgroup_subsys *ss;
2144 struct super_block *sb;
2145 struct cgroupfs_root *root;
2146
2147 /* the vfs holds both inode->i_mutex already */
2148
2149 mutex_lock(&cgroup_mutex);
2150 if (atomic_read(&cgrp->count) != 0) {
2151 mutex_unlock(&cgroup_mutex);
2152 return -EBUSY;
2153 }
2154 if (!list_empty(&cgrp->children)) {
2155 mutex_unlock(&cgroup_mutex);
2156 return -EBUSY;
2157 }
2158
2159 parent = cgrp->parent;
2160 root = cgrp->root;
2161 sb = root->sb;
2162
2163 if (cgroup_has_css_refs(cgrp)) {
2164 mutex_unlock(&cgroup_mutex);
2165 return -EBUSY;
2166 }
2167
2168 for_each_subsys(root, ss) {
2169 if (cgrp->subsys[ss->subsys_id])
2170 ss->destroy(ss, cgrp);
2171 }
2172
2173 spin_lock(&release_list_lock);
2174 set_bit(CGRP_REMOVED, &cgrp->flags);
2175 if (!list_empty(&cgrp->release_list))
2176 list_del(&cgrp->release_list);
2177 spin_unlock(&release_list_lock);
2178 /* delete my sibling from parent->children */
2179 list_del(&cgrp->sibling);
2180 spin_lock(&cgrp->dentry->d_lock);
2181 d = dget(cgrp->dentry);
2182 cgrp->dentry = NULL;
2183 spin_unlock(&d->d_lock);
2184
2185 cgroup_d_remove_dir(d);
2186 dput(d);
2187 root->number_of_cgroups--;
2188
2189 set_bit(CGRP_RELEASABLE, &parent->flags);
2190 check_for_release(parent);
2191
2192 mutex_unlock(&cgroup_mutex);
2193 /* Drop the active superblock reference that we took when we
2194 * created the cgroup */
2195 deactivate_super(sb);
2196 return 0;
2197}
2198
2199static void cgroup_init_subsys(struct cgroup_subsys *ss)
2200{
2201 struct cgroup_subsys_state *css;
2202 struct list_head *l;
2203 printk(KERN_ERR "Initializing cgroup subsys %s\n", ss->name);
2204
2205 /* Create the top cgroup state for this subsystem */
2206 ss->root = &rootnode;
2207 css = ss->create(ss, dummytop);
2208 /* We don't handle early failures gracefully */
2209 BUG_ON(IS_ERR(css));
2210 init_cgroup_css(css, ss, dummytop);
2211
2212 /* Update all cgroup groups to contain a subsys
2213 * pointer to this state - since the subsystem is
2214 * newly registered, all tasks and hence all cgroup
2215 * groups are in the subsystem's top cgroup. */
2216 write_lock(&css_set_lock);
2217 l = &init_css_set.list;
2218 do {
2219 struct css_set *cg =
2220 list_entry(l, struct css_set, list);
2221 cg->subsys[ss->subsys_id] = dummytop->subsys[ss->subsys_id];
2222 l = l->next;
2223 } while (l != &init_css_set.list);
2224 write_unlock(&css_set_lock);
2225
2226 /* If this subsystem requested that it be notified with fork
2227 * events, we should send it one now for every process in the
2228 * system */
2229 if (ss->fork) {
2230 struct task_struct *g, *p;
2231
2232 read_lock(&tasklist_lock);
2233 do_each_thread(g, p) {
2234 ss->fork(ss, p);
2235 } while_each_thread(g, p);
2236 read_unlock(&tasklist_lock);
2237 }
2238
2239 need_forkexit_callback |= ss->fork || ss->exit;
2240
2241 ss->active = 1;
2242}
2243
2244/**
2245 * cgroup_init_early - initialize cgroups at system boot, and
2246 * initialize any subsystems that request early init.
2247 */
2248int __init cgroup_init_early(void)
2249{
2250 int i;
2251 kref_init(&init_css_set.ref);
2252 kref_get(&init_css_set.ref);
2253 INIT_LIST_HEAD(&init_css_set.list);
2254 INIT_LIST_HEAD(&init_css_set.cg_links);
2255 INIT_LIST_HEAD(&init_css_set.tasks);
2256 css_set_count = 1;
2257 init_cgroup_root(&rootnode);
2258 list_add(&rootnode.root_list, &roots);
2259 root_count = 1;
2260 init_task.cgroups = &init_css_set;
2261
2262 init_css_set_link.cg = &init_css_set;
2263 list_add(&init_css_set_link.cgrp_link_list,
2264 &rootnode.top_cgroup.css_sets);
2265 list_add(&init_css_set_link.cg_link_list,
2266 &init_css_set.cg_links);
2267
2268 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
2269 struct cgroup_subsys *ss = subsys[i];
2270
2271 BUG_ON(!ss->name);
2272 BUG_ON(strlen(ss->name) > MAX_CGROUP_TYPE_NAMELEN);
2273 BUG_ON(!ss->create);
2274 BUG_ON(!ss->destroy);
2275 if (ss->subsys_id != i) {
2276 printk(KERN_ERR "Subsys %s id == %d\n",
2277 ss->name, ss->subsys_id);
2278 BUG();
2279 }
2280
2281 if (ss->early_init)
2282 cgroup_init_subsys(ss);
2283 }
2284 return 0;
2285}
2286
2287/**
2288 * cgroup_init - register cgroup filesystem and /proc file, and
2289 * initialize any subsystems that didn't request early init.
2290 */
2291int __init cgroup_init(void)
2292{
2293 int err;
2294 int i;
2295 struct proc_dir_entry *entry;
2296
2297 err = bdi_init(&cgroup_backing_dev_info);
2298 if (err)
2299 return err;
2300
2301 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
2302 struct cgroup_subsys *ss = subsys[i];
2303 if (!ss->early_init)
2304 cgroup_init_subsys(ss);
2305 }
2306
2307 err = register_filesystem(&cgroup_fs_type);
2308 if (err < 0)
2309 goto out;
2310
2311 entry = create_proc_entry("cgroups", 0, NULL);
2312 if (entry)
2313 entry->proc_fops = &proc_cgroupstats_operations;
2314
2315out:
2316 if (err)
2317 bdi_destroy(&cgroup_backing_dev_info);
2318
2319 return err;
2320}
2321
2322/*
2323 * proc_cgroup_show()
2324 * - Print task's cgroup paths into seq_file, one line for each hierarchy
2325 * - Used for /proc/<pid>/cgroup.
2326 * - No need to task_lock(tsk) on this tsk->cgroup reference, as it
2327 * doesn't really matter if tsk->cgroup changes after we read it,
2328 * and we take cgroup_mutex, keeping attach_task() from changing it
2329 * anyway. No need to check that tsk->cgroup != NULL, thanks to
2330 * the_top_cgroup_hack in cgroup_exit(), which sets an exiting tasks
2331 * cgroup to top_cgroup.
2332 */
2333
2334/* TODO: Use a proper seq_file iterator */
2335static int proc_cgroup_show(struct seq_file *m, void *v)
2336{
2337 struct pid *pid;
2338 struct task_struct *tsk;
2339 char *buf;
2340 int retval;
2341 struct cgroupfs_root *root;
2342
2343 retval = -ENOMEM;
2344 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
2345 if (!buf)
2346 goto out;
2347
2348 retval = -ESRCH;
2349 pid = m->private;
2350 tsk = get_pid_task(pid, PIDTYPE_PID);
2351 if (!tsk)
2352 goto out_free;
2353
2354 retval = 0;
2355
2356 mutex_lock(&cgroup_mutex);
2357
2358 for_each_root(root) {
2359 struct cgroup_subsys *ss;
2360 struct cgroup *cgrp;
2361 int subsys_id;
2362 int count = 0;
2363
2364 /* Skip this hierarchy if it has no active subsystems */
2365 if (!root->actual_subsys_bits)
2366 continue;
2367 for_each_subsys(root, ss)
2368 seq_printf(m, "%s%s", count++ ? "," : "", ss->name);
2369 seq_putc(m, ':');
2370 get_first_subsys(&root->top_cgroup, NULL, &subsys_id);
2371 cgrp = task_cgroup(tsk, subsys_id);
2372 retval = cgroup_path(cgrp, buf, PAGE_SIZE);
2373 if (retval < 0)
2374 goto out_unlock;
2375 seq_puts(m, buf);
2376 seq_putc(m, '\n');
2377 }
2378
2379out_unlock:
2380 mutex_unlock(&cgroup_mutex);
2381 put_task_struct(tsk);
2382out_free:
2383 kfree(buf);
2384out:
2385 return retval;
2386}
2387
2388static int cgroup_open(struct inode *inode, struct file *file)
2389{
2390 struct pid *pid = PROC_I(inode)->pid;
2391 return single_open(file, proc_cgroup_show, pid);
2392}
2393
2394struct file_operations proc_cgroup_operations = {
2395 .open = cgroup_open,
2396 .read = seq_read,
2397 .llseek = seq_lseek,
2398 .release = single_release,
2399};
2400
2401/* Display information about each subsystem and each hierarchy */
2402static int proc_cgroupstats_show(struct seq_file *m, void *v)
2403{
2404 int i;
2405 struct cgroupfs_root *root;
2406
2407 seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\n");
2408 mutex_lock(&cgroup_mutex);
2409 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
2410 struct cgroup_subsys *ss = subsys[i];
2411 seq_printf(m, "%s\t%lu\t%d\n",
2412 ss->name, ss->root->subsys_bits,
2413 ss->root->number_of_cgroups);
2414 }
2415 mutex_unlock(&cgroup_mutex);
2416 return 0;
2417}
2418
2419static int cgroupstats_open(struct inode *inode, struct file *file)
2420{
2421 return single_open(file, proc_cgroupstats_show, 0);
2422}
2423
2424static struct file_operations proc_cgroupstats_operations = {
2425 .open = cgroupstats_open,
2426 .read = seq_read,
2427 .llseek = seq_lseek,
2428 .release = single_release,
2429};
2430
2431/**
2432 * cgroup_fork - attach newly forked task to its parents cgroup.
2433 * @tsk: pointer to task_struct of forking parent process.
2434 *
2435 * Description: A task inherits its parent's cgroup at fork().
2436 *
2437 * A pointer to the shared css_set was automatically copied in
2438 * fork.c by dup_task_struct(). However, we ignore that copy, since
2439 * it was not made under the protection of RCU or cgroup_mutex, so
2440 * might no longer be a valid cgroup pointer. attach_task() might
2441 * have already changed current->cgroups, allowing the previously
2442 * referenced cgroup group to be removed and freed.
2443 *
2444 * At the point that cgroup_fork() is called, 'current' is the parent
2445 * task, and the passed argument 'child' points to the child task.
2446 */
2447void cgroup_fork(struct task_struct *child)
2448{
2449 task_lock(current);
2450 child->cgroups = current->cgroups;
2451 get_css_set(child->cgroups);
2452 task_unlock(current);
2453 INIT_LIST_HEAD(&child->cg_list);
2454}
2455
2456/**
2457 * cgroup_fork_callbacks - called on a new task very soon before
2458 * adding it to the tasklist. No need to take any locks since no-one
2459 * can be operating on this task
2460 */
2461void cgroup_fork_callbacks(struct task_struct *child)
2462{
2463 if (need_forkexit_callback) {
2464 int i;
2465 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
2466 struct cgroup_subsys *ss = subsys[i];
2467 if (ss->fork)
2468 ss->fork(ss, child);
2469 }
2470 }
2471}
2472
2473/**
2474 * cgroup_post_fork - called on a new task after adding it to the
2475 * task list. Adds the task to the list running through its css_set
2476 * if necessary. Has to be after the task is visible on the task list
2477 * in case we race with the first call to cgroup_iter_start() - to
2478 * guarantee that the new task ends up on its list. */
2479void cgroup_post_fork(struct task_struct *child)
2480{
2481 if (use_task_css_set_links) {
2482 write_lock(&css_set_lock);
2483 if (list_empty(&child->cg_list))
2484 list_add(&child->cg_list, &child->cgroups->tasks);
2485 write_unlock(&css_set_lock);
2486 }
2487}
2488/**
2489 * cgroup_exit - detach cgroup from exiting task
2490 * @tsk: pointer to task_struct of exiting process
2491 *
2492 * Description: Detach cgroup from @tsk and release it.
2493 *
2494 * Note that cgroups marked notify_on_release force every task in
2495 * them to take the global cgroup_mutex mutex when exiting.
2496 * This could impact scaling on very large systems. Be reluctant to
2497 * use notify_on_release cgroups where very high task exit scaling
2498 * is required on large systems.
2499 *
2500 * the_top_cgroup_hack:
2501 *
2502 * Set the exiting tasks cgroup to the root cgroup (top_cgroup).
2503 *
2504 * We call cgroup_exit() while the task is still competent to
2505 * handle notify_on_release(), then leave the task attached to the
2506 * root cgroup in each hierarchy for the remainder of its exit.
2507 *
2508 * To do this properly, we would increment the reference count on
2509 * top_cgroup, and near the very end of the kernel/exit.c do_exit()
2510 * code we would add a second cgroup function call, to drop that
2511 * reference. This would just create an unnecessary hot spot on
2512 * the top_cgroup reference count, to no avail.
2513 *
2514 * Normally, holding a reference to a cgroup without bumping its
2515 * count is unsafe. The cgroup could go away, or someone could
2516 * attach us to a different cgroup, decrementing the count on
2517 * the first cgroup that we never incremented. But in this case,
2518 * top_cgroup isn't going away, and either task has PF_EXITING set,
2519 * which wards off any attach_task() attempts, or task is a failed
2520 * fork, never visible to attach_task.
2521 *
2522 */
2523void cgroup_exit(struct task_struct *tsk, int run_callbacks)
2524{
2525 int i;
2526 struct css_set *cg;
2527
2528 if (run_callbacks && need_forkexit_callback) {
2529 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
2530 struct cgroup_subsys *ss = subsys[i];
2531 if (ss->exit)
2532 ss->exit(ss, tsk);
2533 }
2534 }
2535
2536 /*
2537 * Unlink from the css_set task list if necessary.
2538 * Optimistically check cg_list before taking
2539 * css_set_lock
2540 */
2541 if (!list_empty(&tsk->cg_list)) {
2542 write_lock(&css_set_lock);
2543 if (!list_empty(&tsk->cg_list))
2544 list_del(&tsk->cg_list);
2545 write_unlock(&css_set_lock);
2546 }
2547
2548 /* Reassign the task to the init_css_set. */
2549 task_lock(tsk);
2550 cg = tsk->cgroups;
2551 tsk->cgroups = &init_css_set;
2552 task_unlock(tsk);
2553 if (cg)
2554 put_css_set_taskexit(cg);
2555}
2556
2557/**
2558 * cgroup_clone - duplicate the current cgroup in the hierarchy
2559 * that the given subsystem is attached to, and move this task into
2560 * the new child
2561 */
2562int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2563{
2564 struct dentry *dentry;
2565 int ret = 0;
2566 char nodename[MAX_CGROUP_TYPE_NAMELEN];
2567 struct cgroup *parent, *child;
2568 struct inode *inode;
2569 struct css_set *cg;
2570 struct cgroupfs_root *root;
2571 struct cgroup_subsys *ss;
2572
2573 /* We shouldn't be called by an unregistered subsystem */
2574 BUG_ON(!subsys->active);
2575
2576 /* First figure out what hierarchy and cgroup we're dealing
2577 * with, and pin them so we can drop cgroup_mutex */
2578 mutex_lock(&cgroup_mutex);
2579 again:
2580 root = subsys->root;
2581 if (root == &rootnode) {
2582 printk(KERN_INFO
2583 "Not cloning cgroup for unused subsystem %s\n",
2584 subsys->name);
2585 mutex_unlock(&cgroup_mutex);
2586 return 0;
2587 }
2588 cg = tsk->cgroups;
2589 parent = task_cgroup(tsk, subsys->subsys_id);
2590
2591 snprintf(nodename, MAX_CGROUP_TYPE_NAMELEN, "node_%d", tsk->pid);
2592
2593 /* Pin the hierarchy */
2594 atomic_inc(&parent->root->sb->s_active);
2595
2596 /* Keep the cgroup alive */
2597 get_css_set(cg);
2598 mutex_unlock(&cgroup_mutex);
2599
2600 /* Now do the VFS work to create a cgroup */
2601 inode = parent->dentry->d_inode;
2602
2603 /* Hold the parent directory mutex across this operation to
2604 * stop anyone else deleting the new cgroup */
2605 mutex_lock(&inode->i_mutex);
2606 dentry = lookup_one_len(nodename, parent->dentry, strlen(nodename));
2607 if (IS_ERR(dentry)) {
2608 printk(KERN_INFO
2609 "Couldn't allocate dentry for %s: %ld\n", nodename,
2610 PTR_ERR(dentry));
2611 ret = PTR_ERR(dentry);
2612 goto out_release;
2613 }
2614
2615 /* Create the cgroup directory, which also creates the cgroup */
2616 ret = vfs_mkdir(inode, dentry, S_IFDIR | 0755);
2617 child = __d_cgrp(dentry);
2618 dput(dentry);
2619 if (ret) {
2620 printk(KERN_INFO
2621 "Failed to create cgroup %s: %d\n", nodename,
2622 ret);
2623 goto out_release;
2624 }
2625
2626 if (!child) {
2627 printk(KERN_INFO
2628 "Couldn't find new cgroup %s\n", nodename);
2629 ret = -ENOMEM;
2630 goto out_release;
2631 }
2632
2633 /* The cgroup now exists. Retake cgroup_mutex and check
2634 * that we're still in the same state that we thought we
2635 * were. */
2636 mutex_lock(&cgroup_mutex);
2637 if ((root != subsys->root) ||
2638 (parent != task_cgroup(tsk, subsys->subsys_id))) {
2639 /* Aargh, we raced ... */
2640 mutex_unlock(&inode->i_mutex);
2641 put_css_set(cg);
2642
2643 deactivate_super(parent->root->sb);
2644 /* The cgroup is still accessible in the VFS, but
2645 * we're not going to try to rmdir() it at this
2646 * point. */
2647 printk(KERN_INFO
2648 "Race in cgroup_clone() - leaking cgroup %s\n",
2649 nodename);
2650 goto again;
2651 }
2652
2653 /* do any required auto-setup */
2654 for_each_subsys(root, ss) {
2655 if (ss->post_clone)
2656 ss->post_clone(ss, child);
2657 }
2658
2659 /* All seems fine. Finish by moving the task into the new cgroup */
2660 ret = attach_task(child, tsk);
2661 mutex_unlock(&cgroup_mutex);
2662
2663 out_release:
2664 mutex_unlock(&inode->i_mutex);
2665
2666 mutex_lock(&cgroup_mutex);
2667 put_css_set(cg);
2668 mutex_unlock(&cgroup_mutex);
2669 deactivate_super(parent->root->sb);
2670 return ret;
2671}
2672
2673/*
2674 * See if "cgrp" is a descendant of the current task's cgroup in
2675 * the appropriate hierarchy
2676 *
2677 * If we are sending in dummytop, then presumably we are creating
2678 * the top cgroup in the subsystem.
2679 *
2680 * Called only by the ns (nsproxy) cgroup.
2681 */
2682int cgroup_is_descendant(const struct cgroup *cgrp)
2683{
2684 int ret;
2685 struct cgroup *target;
2686 int subsys_id;
2687
2688 if (cgrp == dummytop)
2689 return 1;
2690
2691 get_first_subsys(cgrp, NULL, &subsys_id);
2692 target = task_cgroup(current, subsys_id);
2693 while (cgrp != target && cgrp!= cgrp->top_cgroup)
2694 cgrp = cgrp->parent;
2695 ret = (cgrp == target);
2696 return ret;
2697}
2698
2699static void check_for_release(struct cgroup *cgrp)
2700{
2701 /* All of these checks rely on RCU to keep the cgroup
2702 * structure alive */
2703 if (cgroup_is_releasable(cgrp) && !atomic_read(&cgrp->count)
2704 && list_empty(&cgrp->children) && !cgroup_has_css_refs(cgrp)) {
2705 /* Control Group is currently removeable. If it's not
2706 * already queued for a userspace notification, queue
2707 * it now */
2708 int need_schedule_work = 0;
2709 spin_lock(&release_list_lock);
2710 if (!cgroup_is_removed(cgrp) &&
2711 list_empty(&cgrp->release_list)) {
2712 list_add(&cgrp->release_list, &release_list);
2713 need_schedule_work = 1;
2714 }
2715 spin_unlock(&release_list_lock);
2716 if (need_schedule_work)
2717 schedule_work(&release_agent_work);
2718 }
2719}
2720
2721void __css_put(struct cgroup_subsys_state *css)
2722{
2723 struct cgroup *cgrp = css->cgroup;
2724 rcu_read_lock();
2725 if (atomic_dec_and_test(&css->refcnt) && notify_on_release(cgrp)) {
2726 set_bit(CGRP_RELEASABLE, &cgrp->flags);
2727 check_for_release(cgrp);
2728 }
2729 rcu_read_unlock();
2730}
2731
2732/*
2733 * Notify userspace when a cgroup is released, by running the
2734 * configured release agent with the name of the cgroup (path
2735 * relative to the root of cgroup file system) as the argument.
2736 *
2737 * Most likely, this user command will try to rmdir this cgroup.
2738 *
2739 * This races with the possibility that some other task will be
2740 * attached to this cgroup before it is removed, or that some other
2741 * user task will 'mkdir' a child cgroup of this cgroup. That's ok.
2742 * The presumed 'rmdir' will fail quietly if this cgroup is no longer
2743 * unused, and this cgroup will be reprieved from its death sentence,
2744 * to continue to serve a useful existence. Next time it's released,
2745 * we will get notified again, if it still has 'notify_on_release' set.
2746 *
2747 * The final arg to call_usermodehelper() is UMH_WAIT_EXEC, which
2748 * means only wait until the task is successfully execve()'d. The
2749 * separate release agent task is forked by call_usermodehelper(),
2750 * then control in this thread returns here, without waiting for the
2751 * release agent task. We don't bother to wait because the caller of
2752 * this routine has no use for the exit status of the release agent
2753 * task, so no sense holding our caller up for that.
2754 *
2755 */
2756
2757static void cgroup_release_agent(struct work_struct *work)
2758{
2759 BUG_ON(work != &release_agent_work);
2760 mutex_lock(&cgroup_mutex);
2761 spin_lock(&release_list_lock);
2762 while (!list_empty(&release_list)) {
2763 char *argv[3], *envp[3];
2764 int i;
2765 char *pathbuf;
2766 struct cgroup *cgrp = list_entry(release_list.next,
2767 struct cgroup,
2768 release_list);
2769 list_del_init(&cgrp->release_list);
2770 spin_unlock(&release_list_lock);
2771 pathbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
2772 if (!pathbuf) {
2773 spin_lock(&release_list_lock);
2774 continue;
2775 }
2776
2777 if (cgroup_path(cgrp, pathbuf, PAGE_SIZE) < 0) {
2778 kfree(pathbuf);
2779 spin_lock(&release_list_lock);
2780 continue;
2781 }
2782
2783 i = 0;
2784 argv[i++] = cgrp->root->release_agent_path;
2785 argv[i++] = (char *)pathbuf;
2786 argv[i] = NULL;
2787
2788 i = 0;
2789 /* minimal command environment */
2790 envp[i++] = "HOME=/";
2791 envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
2792 envp[i] = NULL;
2793
2794 /* Drop the lock while we invoke the usermode helper,
2795 * since the exec could involve hitting disk and hence
2796 * be a slow process */
2797 mutex_unlock(&cgroup_mutex);
2798 call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
2799 kfree(pathbuf);
2800 mutex_lock(&cgroup_mutex);
2801 spin_lock(&release_list_lock);
2802 }
2803 spin_unlock(&release_list_lock);
2804 mutex_unlock(&cgroup_mutex);
2805}
diff --git a/kernel/cgroup_debug.c b/kernel/cgroup_debug.c
new file mode 100644
index 000000000000..37301e877cb0
--- /dev/null
+++ b/kernel/cgroup_debug.c
@@ -0,0 +1,97 @@
1/*
2 * kernel/ccontainer_debug.c - Example cgroup subsystem that
3 * exposes debug info
4 *
5 * Copyright (C) Google Inc, 2007
6 *
7 * Developed by Paul Menage (menage@google.com)
8 *
9 */
10
11#include <linux/cgroup.h>
12#include <linux/fs.h>
13#include <linux/slab.h>
14#include <linux/rcupdate.h>
15
16#include <asm/atomic.h>
17
18static struct cgroup_subsys_state *debug_create(struct cgroup_subsys *ss,
19 struct cgroup *cont)
20{
21 struct cgroup_subsys_state *css = kzalloc(sizeof(*css), GFP_KERNEL);
22
23 if (!css)
24 return ERR_PTR(-ENOMEM);
25
26 return css;
27}
28
29static void debug_destroy(struct cgroup_subsys *ss, struct cgroup *cont)
30{
31 kfree(cont->subsys[debug_subsys_id]);
32}
33
34static u64 cgroup_refcount_read(struct cgroup *cont, struct cftype *cft)
35{
36 return atomic_read(&cont->count);
37}
38
39static u64 taskcount_read(struct cgroup *cont, struct cftype *cft)
40{
41 u64 count;
42
43 cgroup_lock();
44 count = cgroup_task_count(cont);
45 cgroup_unlock();
46 return count;
47}
48
49static u64 current_css_set_read(struct cgroup *cont, struct cftype *cft)
50{
51 return (u64)(long)current->cgroups;
52}
53
54static u64 current_css_set_refcount_read(struct cgroup *cont,
55 struct cftype *cft)
56{
57 u64 count;
58
59 rcu_read_lock();
60 count = atomic_read(&current->cgroups->ref.refcount);
61 rcu_read_unlock();
62 return count;
63}
64
65static struct cftype files[] = {
66 {
67 .name = "cgroup_refcount",
68 .read_uint = cgroup_refcount_read,
69 },
70 {
71 .name = "taskcount",
72 .read_uint = taskcount_read,
73 },
74
75 {
76 .name = "current_css_set",
77 .read_uint = current_css_set_read,
78 },
79
80 {
81 .name = "current_css_set_refcount",
82 .read_uint = current_css_set_refcount_read,
83 },
84};
85
86static int debug_populate(struct cgroup_subsys *ss, struct cgroup *cont)
87{
88 return cgroup_add_files(cont, ss, files, ARRAY_SIZE(files));
89}
90
91struct cgroup_subsys debug_subsys = {
92 .name = "debug",
93 .create = debug_create,
94 .destroy = debug_destroy,
95 .populate = debug_populate,
96 .subsys_id = debug_subsys_id,
97};
diff --git a/kernel/compat.c b/kernel/compat.c
index 3bae3742c2aa..42a1ed4b61b1 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -40,62 +40,27 @@ int put_compat_timespec(const struct timespec *ts, struct compat_timespec __user
40 __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; 40 __put_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
41} 41}
42 42
43static long compat_nanosleep_restart(struct restart_block *restart)
44{
45 unsigned long expire = restart->arg0, now = jiffies;
46 struct compat_timespec __user *rmtp;
47
48 /* Did it expire while we handled signals? */
49 if (!time_after(expire, now))
50 return 0;
51
52 expire = schedule_timeout_interruptible(expire - now);
53 if (expire == 0)
54 return 0;
55
56 rmtp = (struct compat_timespec __user *)restart->arg1;
57 if (rmtp) {
58 struct compat_timespec ct;
59 struct timespec t;
60
61 jiffies_to_timespec(expire, &t);
62 ct.tv_sec = t.tv_sec;
63 ct.tv_nsec = t.tv_nsec;
64 if (copy_to_user(rmtp, &ct, sizeof(ct)))
65 return -EFAULT;
66 }
67 /* The 'restart' block is already filled in */
68 return -ERESTART_RESTARTBLOCK;
69}
70
71asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, 43asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
72 struct compat_timespec __user *rmtp) 44 struct compat_timespec __user *rmtp)
73{ 45{
74 struct timespec t; 46 struct timespec tu, rmt;
75 struct restart_block *restart; 47 long ret;
76 unsigned long expire;
77 48
78 if (get_compat_timespec(&t, rqtp)) 49 if (get_compat_timespec(&tu, rqtp))
79 return -EFAULT; 50 return -EFAULT;
80 51
81 if ((t.tv_nsec >= 1000000000L) || (t.tv_nsec < 0) || (t.tv_sec < 0)) 52 if (!timespec_valid(&tu))
82 return -EINVAL; 53 return -EINVAL;
83 54
84 expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec); 55 ret = hrtimer_nanosleep(&tu, rmtp ? &rmt : NULL, HRTIMER_MODE_REL,
85 expire = schedule_timeout_interruptible(expire); 56 CLOCK_MONOTONIC);
86 if (expire == 0)
87 return 0;
88 57
89 if (rmtp) { 58 if (ret && rmtp) {
90 jiffies_to_timespec(expire, &t); 59 if (put_compat_timespec(&rmt, rmtp))
91 if (put_compat_timespec(&t, rmtp))
92 return -EFAULT; 60 return -EFAULT;
93 } 61 }
94 restart = &current_thread_info()->restart_block; 62
95 restart->fn = compat_nanosleep_restart; 63 return ret;
96 restart->arg0 = jiffies + expire;
97 restart->arg1 = (unsigned long) rmtp;
98 return -ERESTART_RESTARTBLOCK;
99} 64}
100 65
101static inline long get_compat_itimerval(struct itimerval *o, 66static inline long get_compat_itimerval(struct itimerval *o,
@@ -247,8 +212,8 @@ asmlinkage long compat_sys_setrlimit(unsigned int resource,
247 int ret; 212 int ret;
248 mm_segment_t old_fs = get_fs (); 213 mm_segment_t old_fs = get_fs ();
249 214
250 if (resource >= RLIM_NLIMITS) 215 if (resource >= RLIM_NLIMITS)
251 return -EINVAL; 216 return -EINVAL;
252 217
253 if (!access_ok(VERIFY_READ, rlim, sizeof(*rlim)) || 218 if (!access_ok(VERIFY_READ, rlim, sizeof(*rlim)) ||
254 __get_user(r.rlim_cur, &rlim->rlim_cur) || 219 __get_user(r.rlim_cur, &rlim->rlim_cur) ||
@@ -477,21 +442,21 @@ asmlinkage long compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
477 442
478int get_compat_itimerspec(struct itimerspec *dst, 443int get_compat_itimerspec(struct itimerspec *dst,
479 const struct compat_itimerspec __user *src) 444 const struct compat_itimerspec __user *src)
480{ 445{
481 if (get_compat_timespec(&dst->it_interval, &src->it_interval) || 446 if (get_compat_timespec(&dst->it_interval, &src->it_interval) ||
482 get_compat_timespec(&dst->it_value, &src->it_value)) 447 get_compat_timespec(&dst->it_value, &src->it_value))
483 return -EFAULT; 448 return -EFAULT;
484 return 0; 449 return 0;
485} 450}
486 451
487int put_compat_itimerspec(struct compat_itimerspec __user *dst, 452int put_compat_itimerspec(struct compat_itimerspec __user *dst,
488 const struct itimerspec *src) 453 const struct itimerspec *src)
489{ 454{
490 if (put_compat_timespec(&src->it_interval, &dst->it_interval) || 455 if (put_compat_timespec(&src->it_interval, &dst->it_interval) ||
491 put_compat_timespec(&src->it_value, &dst->it_value)) 456 put_compat_timespec(&src->it_value, &dst->it_value))
492 return -EFAULT; 457 return -EFAULT;
493 return 0; 458 return 0;
494} 459}
495 460
496long compat_sys_timer_create(clockid_t which_clock, 461long compat_sys_timer_create(clockid_t which_clock,
497 struct compat_sigevent __user *timer_event_spec, 462 struct compat_sigevent __user *timer_event_spec,
@@ -512,9 +477,9 @@ long compat_sys_timer_create(clockid_t which_clock,
512} 477}
513 478
514long compat_sys_timer_settime(timer_t timer_id, int flags, 479long compat_sys_timer_settime(timer_t timer_id, int flags,
515 struct compat_itimerspec __user *new, 480 struct compat_itimerspec __user *new,
516 struct compat_itimerspec __user *old) 481 struct compat_itimerspec __user *old)
517{ 482{
518 long err; 483 long err;
519 mm_segment_t oldfs; 484 mm_segment_t oldfs;
520 struct itimerspec newts, oldts; 485 struct itimerspec newts, oldts;
@@ -522,58 +487,58 @@ long compat_sys_timer_settime(timer_t timer_id, int flags,
522 if (!new) 487 if (!new)
523 return -EINVAL; 488 return -EINVAL;
524 if (get_compat_itimerspec(&newts, new)) 489 if (get_compat_itimerspec(&newts, new))
525 return -EFAULT; 490 return -EFAULT;
526 oldfs = get_fs(); 491 oldfs = get_fs();
527 set_fs(KERNEL_DS); 492 set_fs(KERNEL_DS);
528 err = sys_timer_settime(timer_id, flags, 493 err = sys_timer_settime(timer_id, flags,
529 (struct itimerspec __user *) &newts, 494 (struct itimerspec __user *) &newts,
530 (struct itimerspec __user *) &oldts); 495 (struct itimerspec __user *) &oldts);
531 set_fs(oldfs); 496 set_fs(oldfs);
532 if (!err && old && put_compat_itimerspec(old, &oldts)) 497 if (!err && old && put_compat_itimerspec(old, &oldts))
533 return -EFAULT; 498 return -EFAULT;
534 return err; 499 return err;
535} 500}
536 501
537long compat_sys_timer_gettime(timer_t timer_id, 502long compat_sys_timer_gettime(timer_t timer_id,
538 struct compat_itimerspec __user *setting) 503 struct compat_itimerspec __user *setting)
539{ 504{
540 long err; 505 long err;
541 mm_segment_t oldfs; 506 mm_segment_t oldfs;
542 struct itimerspec ts; 507 struct itimerspec ts;
543 508
544 oldfs = get_fs(); 509 oldfs = get_fs();
545 set_fs(KERNEL_DS); 510 set_fs(KERNEL_DS);
546 err = sys_timer_gettime(timer_id, 511 err = sys_timer_gettime(timer_id,
547 (struct itimerspec __user *) &ts); 512 (struct itimerspec __user *) &ts);
548 set_fs(oldfs); 513 set_fs(oldfs);
549 if (!err && put_compat_itimerspec(setting, &ts)) 514 if (!err && put_compat_itimerspec(setting, &ts))
550 return -EFAULT; 515 return -EFAULT;
551 return err; 516 return err;
552} 517}
553 518
554long compat_sys_clock_settime(clockid_t which_clock, 519long compat_sys_clock_settime(clockid_t which_clock,
555 struct compat_timespec __user *tp) 520 struct compat_timespec __user *tp)
556{ 521{
557 long err; 522 long err;
558 mm_segment_t oldfs; 523 mm_segment_t oldfs;
559 struct timespec ts; 524 struct timespec ts;
560 525
561 if (get_compat_timespec(&ts, tp)) 526 if (get_compat_timespec(&ts, tp))
562 return -EFAULT; 527 return -EFAULT;
563 oldfs = get_fs(); 528 oldfs = get_fs();
564 set_fs(KERNEL_DS); 529 set_fs(KERNEL_DS);
565 err = sys_clock_settime(which_clock, 530 err = sys_clock_settime(which_clock,
566 (struct timespec __user *) &ts); 531 (struct timespec __user *) &ts);
567 set_fs(oldfs); 532 set_fs(oldfs);
568 return err; 533 return err;
569} 534}
570 535
571long compat_sys_clock_gettime(clockid_t which_clock, 536long compat_sys_clock_gettime(clockid_t which_clock,
572 struct compat_timespec __user *tp) 537 struct compat_timespec __user *tp)
573{ 538{
574 long err; 539 long err;
575 mm_segment_t oldfs; 540 mm_segment_t oldfs;
576 struct timespec ts; 541 struct timespec ts;
577 542
578 oldfs = get_fs(); 543 oldfs = get_fs();
579 set_fs(KERNEL_DS); 544 set_fs(KERNEL_DS);
@@ -581,16 +546,16 @@ long compat_sys_clock_gettime(clockid_t which_clock,
581 (struct timespec __user *) &ts); 546 (struct timespec __user *) &ts);
582 set_fs(oldfs); 547 set_fs(oldfs);
583 if (!err && put_compat_timespec(&ts, tp)) 548 if (!err && put_compat_timespec(&ts, tp))
584 return -EFAULT; 549 return -EFAULT;
585 return err; 550 return err;
586} 551}
587 552
588long compat_sys_clock_getres(clockid_t which_clock, 553long compat_sys_clock_getres(clockid_t which_clock,
589 struct compat_timespec __user *tp) 554 struct compat_timespec __user *tp)
590{ 555{
591 long err; 556 long err;
592 mm_segment_t oldfs; 557 mm_segment_t oldfs;
593 struct timespec ts; 558 struct timespec ts;
594 559
595 oldfs = get_fs(); 560 oldfs = get_fs();
596 set_fs(KERNEL_DS); 561 set_fs(KERNEL_DS);
@@ -598,9 +563,9 @@ long compat_sys_clock_getres(clockid_t which_clock,
598 (struct timespec __user *) &ts); 563 (struct timespec __user *) &ts);
599 set_fs(oldfs); 564 set_fs(oldfs);
600 if (!err && tp && put_compat_timespec(&ts, tp)) 565 if (!err && tp && put_compat_timespec(&ts, tp))
601 return -EFAULT; 566 return -EFAULT;
602 return err; 567 return err;
603} 568}
604 569
605static long compat_clock_nanosleep_restart(struct restart_block *restart) 570static long compat_clock_nanosleep_restart(struct restart_block *restart)
606{ 571{
@@ -632,10 +597,10 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
632{ 597{
633 long err; 598 long err;
634 mm_segment_t oldfs; 599 mm_segment_t oldfs;
635 struct timespec in, out; 600 struct timespec in, out;
636 struct restart_block *restart; 601 struct restart_block *restart;
637 602
638 if (get_compat_timespec(&in, rqtp)) 603 if (get_compat_timespec(&in, rqtp))
639 return -EFAULT; 604 return -EFAULT;
640 605
641 oldfs = get_fs(); 606 oldfs = get_fs();
@@ -654,8 +619,8 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
654 restart->fn = compat_clock_nanosleep_restart; 619 restart->fn = compat_clock_nanosleep_restart;
655 restart->arg1 = (unsigned long) rmtp; 620 restart->arg1 = (unsigned long) rmtp;
656 } 621 }
657 return err; 622 return err;
658} 623}
659 624
660/* 625/*
661 * We currently only need the following fields from the sigevent 626 * We currently only need the following fields from the sigevent
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 38033db8d8ec..6b3a0c15144f 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -98,7 +98,8 @@ static inline void check_for_tasks(int cpu)
98 !cputime_eq(p->stime, cputime_zero))) 98 !cputime_eq(p->stime, cputime_zero)))
99 printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\ 99 printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\
100 (state = %ld, flags = %x) \n", 100 (state = %ld, flags = %x) \n",
101 p->comm, p->pid, cpu, p->state, p->flags); 101 p->comm, task_pid_nr(p), cpu,
102 p->state, p->flags);
102 } 103 }
103 write_unlock_irq(&tasklist_lock); 104 write_unlock_irq(&tasklist_lock);
104} 105}
@@ -150,6 +151,7 @@ static int _cpu_down(unsigned int cpu, int tasks_frozen)
150 err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod, 151 err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,
151 hcpu, -1, &nr_calls); 152 hcpu, -1, &nr_calls);
152 if (err == NOTIFY_BAD) { 153 if (err == NOTIFY_BAD) {
154 nr_calls--;
153 __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod, 155 __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
154 hcpu, nr_calls, NULL); 156 hcpu, nr_calls, NULL);
155 printk("%s: attempt to take down CPU %u failed\n", 157 printk("%s: attempt to take down CPU %u failed\n",
@@ -233,6 +235,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
233 ret = __raw_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE | mod, hcpu, 235 ret = __raw_notifier_call_chain(&cpu_chain, CPU_UP_PREPARE | mod, hcpu,
234 -1, &nr_calls); 236 -1, &nr_calls);
235 if (ret == NOTIFY_BAD) { 237 if (ret == NOTIFY_BAD) {
238 nr_calls--;
236 printk("%s: attempt to bring up CPU %u failed\n", 239 printk("%s: attempt to bring up CPU %u failed\n",
237 __FUNCTION__, cpu); 240 __FUNCTION__, cpu);
238 ret = -EINVAL; 241 ret = -EINVAL;
@@ -262,6 +265,15 @@ out_notify:
262int __cpuinit cpu_up(unsigned int cpu) 265int __cpuinit cpu_up(unsigned int cpu)
263{ 266{
264 int err = 0; 267 int err = 0;
268 if (!cpu_isset(cpu, cpu_possible_map)) {
269 printk(KERN_ERR "can't online cpu %d because it is not "
270 "configured as may-hotadd at boot time\n", cpu);
271#if defined(CONFIG_IA64) || defined(CONFIG_X86_64) || defined(CONFIG_S390)
272 printk(KERN_ERR "please check additional_cpus= boot "
273 "parameter\n");
274#endif
275 return -EINVAL;
276 }
265 277
266 mutex_lock(&cpu_add_remove_lock); 278 mutex_lock(&cpu_add_remove_lock);
267 if (cpu_hotplug_disabled) 279 if (cpu_hotplug_disabled)
diff --git a/kernel/cpu_acct.c b/kernel/cpu_acct.c
new file mode 100644
index 000000000000..731e47e7f164
--- /dev/null
+++ b/kernel/cpu_acct.c
@@ -0,0 +1,186 @@
1/*
2 * kernel/cpu_acct.c - CPU accounting cgroup subsystem
3 *
4 * Copyright (C) Google Inc, 2006
5 *
6 * Developed by Paul Menage (menage@google.com) and Balbir Singh
7 * (balbir@in.ibm.com)
8 *
9 */
10
11/*
12 * Example cgroup subsystem for reporting total CPU usage of tasks in a
13 * cgroup, along with percentage load over a time interval
14 */
15
16#include <linux/module.h>
17#include <linux/cgroup.h>
18#include <linux/fs.h>
19#include <linux/rcupdate.h>
20
21#include <asm/div64.h>
22
23struct cpuacct {
24 struct cgroup_subsys_state css;
25 spinlock_t lock;
26 /* total time used by this class */
27 cputime64_t time;
28
29 /* time when next load calculation occurs */
30 u64 next_interval_check;
31
32 /* time used in current period */
33 cputime64_t current_interval_time;
34
35 /* time used in last period */
36 cputime64_t last_interval_time;
37};
38
39struct cgroup_subsys cpuacct_subsys;
40
41static inline struct cpuacct *cgroup_ca(struct cgroup *cont)
42{
43 return container_of(cgroup_subsys_state(cont, cpuacct_subsys_id),
44 struct cpuacct, css);
45}
46
47static inline struct cpuacct *task_ca(struct task_struct *task)
48{
49 return container_of(task_subsys_state(task, cpuacct_subsys_id),
50 struct cpuacct, css);
51}
52
53#define INTERVAL (HZ * 10)
54
55static inline u64 next_interval_boundary(u64 now)
56{
57 /* calculate the next interval boundary beyond the
58 * current time */
59 do_div(now, INTERVAL);
60 return (now + 1) * INTERVAL;
61}
62
63static struct cgroup_subsys_state *cpuacct_create(
64 struct cgroup_subsys *ss, struct cgroup *cont)
65{
66 struct cpuacct *ca = kzalloc(sizeof(*ca), GFP_KERNEL);
67
68 if (!ca)
69 return ERR_PTR(-ENOMEM);
70 spin_lock_init(&ca->lock);
71 ca->next_interval_check = next_interval_boundary(get_jiffies_64());
72 return &ca->css;
73}
74
75static void cpuacct_destroy(struct cgroup_subsys *ss,
76 struct cgroup *cont)
77{
78 kfree(cgroup_ca(cont));
79}
80
81/* Lazily update the load calculation if necessary. Called with ca locked */
82static void cpuusage_update(struct cpuacct *ca)
83{
84 u64 now = get_jiffies_64();
85
86 /* If we're not due for an update, return */
87 if (ca->next_interval_check > now)
88 return;
89
90 if (ca->next_interval_check <= (now - INTERVAL)) {
91 /* If it's been more than an interval since the last
92 * check, then catch up - the last interval must have
93 * been zero load */
94 ca->last_interval_time = 0;
95 ca->next_interval_check = next_interval_boundary(now);
96 } else {
97 /* If a steal takes the last interval time negative,
98 * then we just ignore it */
99 if ((s64)ca->current_interval_time > 0)
100 ca->last_interval_time = ca->current_interval_time;
101 else
102 ca->last_interval_time = 0;
103 ca->next_interval_check += INTERVAL;
104 }
105 ca->current_interval_time = 0;
106}
107
108static u64 cpuusage_read(struct cgroup *cont, struct cftype *cft)
109{
110 struct cpuacct *ca = cgroup_ca(cont);
111 u64 time;
112
113 spin_lock_irq(&ca->lock);
114 cpuusage_update(ca);
115 time = cputime64_to_jiffies64(ca->time);
116 spin_unlock_irq(&ca->lock);
117
118 /* Convert 64-bit jiffies to seconds */
119 time *= 1000;
120 do_div(time, HZ);
121 return time;
122}
123
124static u64 load_read(struct cgroup *cont, struct cftype *cft)
125{
126 struct cpuacct *ca = cgroup_ca(cont);
127 u64 time;
128
129 /* Find the time used in the previous interval */
130 spin_lock_irq(&ca->lock);
131 cpuusage_update(ca);
132 time = cputime64_to_jiffies64(ca->last_interval_time);
133 spin_unlock_irq(&ca->lock);
134
135 /* Convert time to a percentage, to give the load in the
136 * previous period */
137 time *= 100;
138 do_div(time, INTERVAL);
139
140 return time;
141}
142
143static struct cftype files[] = {
144 {
145 .name = "usage",
146 .read_uint = cpuusage_read,
147 },
148 {
149 .name = "load",
150 .read_uint = load_read,
151 }
152};
153
154static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cont)
155{
156 return cgroup_add_files(cont, ss, files, ARRAY_SIZE(files));
157}
158
159void cpuacct_charge(struct task_struct *task, cputime_t cputime)
160{
161
162 struct cpuacct *ca;
163 unsigned long flags;
164
165 if (!cpuacct_subsys.active)
166 return;
167 rcu_read_lock();
168 ca = task_ca(task);
169 if (ca) {
170 spin_lock_irqsave(&ca->lock, flags);
171 cpuusage_update(ca);
172 ca->time = cputime64_add(ca->time, cputime);
173 ca->current_interval_time =
174 cputime64_add(ca->current_interval_time, cputime);
175 spin_unlock_irqrestore(&ca->lock, flags);
176 }
177 rcu_read_unlock();
178}
179
180struct cgroup_subsys cpuacct_subsys = {
181 .name = "cpuacct",
182 .create = cpuacct_create,
183 .destroy = cpuacct_destroy,
184 .populate = cpuacct_populate,
185 .subsys_id = cpuacct_subsys_id,
186};
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 2eb2e50db0d6..50f5dc463688 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -4,7 +4,8 @@
4 * Processor and Memory placement constraints for sets of tasks. 4 * Processor and Memory placement constraints for sets of tasks.
5 * 5 *
6 * Copyright (C) 2003 BULL SA. 6 * Copyright (C) 2003 BULL SA.
7 * Copyright (C) 2004-2006 Silicon Graphics, Inc. 7 * Copyright (C) 2004-2007 Silicon Graphics, Inc.
8 * Copyright (C) 2006 Google, Inc
8 * 9 *
9 * Portions derived from Patrick Mochel's sysfs code. 10 * Portions derived from Patrick Mochel's sysfs code.
10 * sysfs is Copyright (c) 2001-3 Patrick Mochel 11 * sysfs is Copyright (c) 2001-3 Patrick Mochel
@@ -12,6 +13,7 @@
12 * 2003-10-10 Written by Simon Derr. 13 * 2003-10-10 Written by Simon Derr.
13 * 2003-10-22 Updates by Stephen Hemminger. 14 * 2003-10-22 Updates by Stephen Hemminger.
14 * 2004 May-July Rework by Paul Jackson. 15 * 2004 May-July Rework by Paul Jackson.
16 * 2006 Rework by Paul Menage to use generic cgroups
15 * 17 *
16 * This file is subject to the terms and conditions of the GNU General Public 18 * This file is subject to the terms and conditions of the GNU General Public
17 * License. See the file COPYING in the main directory of the Linux 19 * License. See the file COPYING in the main directory of the Linux
@@ -36,6 +38,7 @@
36#include <linux/mount.h> 38#include <linux/mount.h>
37#include <linux/namei.h> 39#include <linux/namei.h>
38#include <linux/pagemap.h> 40#include <linux/pagemap.h>
41#include <linux/prio_heap.h>
39#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
40#include <linux/rcupdate.h> 43#include <linux/rcupdate.h>
41#include <linux/sched.h> 44#include <linux/sched.h>
@@ -52,8 +55,7 @@
52#include <asm/uaccess.h> 55#include <asm/uaccess.h>
53#include <asm/atomic.h> 56#include <asm/atomic.h>
54#include <linux/mutex.h> 57#include <linux/mutex.h>
55 58#include <linux/kfifo.h>
56#define CPUSET_SUPER_MAGIC 0x27e0eb
57 59
58/* 60/*
59 * Tracks how many cpusets are currently defined in system. 61 * Tracks how many cpusets are currently defined in system.
@@ -62,6 +64,10 @@
62 */ 64 */
63int number_of_cpusets __read_mostly; 65int number_of_cpusets __read_mostly;
64 66
67/* Retrieve the cpuset from a cgroup */
68struct cgroup_subsys cpuset_subsys;
69struct cpuset;
70
65/* See "Frequency meter" comments, below. */ 71/* See "Frequency meter" comments, below. */
66 72
67struct fmeter { 73struct fmeter {
@@ -72,24 +78,13 @@ struct fmeter {
72}; 78};
73 79
74struct cpuset { 80struct cpuset {
81 struct cgroup_subsys_state css;
82
75 unsigned long flags; /* "unsigned long" so bitops work */ 83 unsigned long flags; /* "unsigned long" so bitops work */
76 cpumask_t cpus_allowed; /* CPUs allowed to tasks in cpuset */ 84 cpumask_t cpus_allowed; /* CPUs allowed to tasks in cpuset */
77 nodemask_t mems_allowed; /* Memory Nodes allowed to tasks */ 85 nodemask_t mems_allowed; /* Memory Nodes allowed to tasks */
78 86
79 /*
80 * Count is atomic so can incr (fork) or decr (exit) without a lock.
81 */
82 atomic_t count; /* count tasks using this cpuset */
83
84 /*
85 * We link our 'sibling' struct into our parents 'children'.
86 * Our children link their 'sibling' into our 'children'.
87 */
88 struct list_head sibling; /* my parents children */
89 struct list_head children; /* my children */
90
91 struct cpuset *parent; /* my parent */ 87 struct cpuset *parent; /* my parent */
92 struct dentry *dentry; /* cpuset fs entry */
93 88
94 /* 89 /*
95 * Copy of global cpuset_mems_generation as of the most 90 * Copy of global cpuset_mems_generation as of the most
@@ -98,15 +93,32 @@ struct cpuset {
98 int mems_generation; 93 int mems_generation;
99 94
100 struct fmeter fmeter; /* memory_pressure filter */ 95 struct fmeter fmeter; /* memory_pressure filter */
96
97 /* partition number for rebuild_sched_domains() */
98 int pn;
101}; 99};
102 100
101/* Retrieve the cpuset for a cgroup */
102static inline struct cpuset *cgroup_cs(struct cgroup *cont)
103{
104 return container_of(cgroup_subsys_state(cont, cpuset_subsys_id),
105 struct cpuset, css);
106}
107
108/* Retrieve the cpuset for a task */
109static inline struct cpuset *task_cs(struct task_struct *task)
110{
111 return container_of(task_subsys_state(task, cpuset_subsys_id),
112 struct cpuset, css);
113}
114
115
103/* bits in struct cpuset flags field */ 116/* bits in struct cpuset flags field */
104typedef enum { 117typedef enum {
105 CS_CPU_EXCLUSIVE, 118 CS_CPU_EXCLUSIVE,
106 CS_MEM_EXCLUSIVE, 119 CS_MEM_EXCLUSIVE,
107 CS_MEMORY_MIGRATE, 120 CS_MEMORY_MIGRATE,
108 CS_REMOVED, 121 CS_SCHED_LOAD_BALANCE,
109 CS_NOTIFY_ON_RELEASE,
110 CS_SPREAD_PAGE, 122 CS_SPREAD_PAGE,
111 CS_SPREAD_SLAB, 123 CS_SPREAD_SLAB,
112} cpuset_flagbits_t; 124} cpuset_flagbits_t;
@@ -122,14 +134,9 @@ static inline int is_mem_exclusive(const struct cpuset *cs)
122 return test_bit(CS_MEM_EXCLUSIVE, &cs->flags); 134 return test_bit(CS_MEM_EXCLUSIVE, &cs->flags);
123} 135}
124 136
125static inline int is_removed(const struct cpuset *cs) 137static inline int is_sched_load_balance(const struct cpuset *cs)
126{ 138{
127 return test_bit(CS_REMOVED, &cs->flags); 139 return test_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
128}
129
130static inline int notify_on_release(const struct cpuset *cs)
131{
132 return test_bit(CS_NOTIFY_ON_RELEASE, &cs->flags);
133} 140}
134 141
135static inline int is_memory_migrate(const struct cpuset *cs) 142static inline int is_memory_migrate(const struct cpuset *cs)
@@ -172,14 +179,8 @@ static struct cpuset top_cpuset = {
172 .flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)), 179 .flags = ((1 << CS_CPU_EXCLUSIVE) | (1 << CS_MEM_EXCLUSIVE)),
173 .cpus_allowed = CPU_MASK_ALL, 180 .cpus_allowed = CPU_MASK_ALL,
174 .mems_allowed = NODE_MASK_ALL, 181 .mems_allowed = NODE_MASK_ALL,
175 .count = ATOMIC_INIT(0),
176 .sibling = LIST_HEAD_INIT(top_cpuset.sibling),
177 .children = LIST_HEAD_INIT(top_cpuset.children),
178}; 182};
179 183
180static struct vfsmount *cpuset_mount;
181static struct super_block *cpuset_sb;
182
183/* 184/*
184 * We have two global cpuset mutexes below. They can nest. 185 * We have two global cpuset mutexes below. They can nest.
185 * It is ok to first take manage_mutex, then nest callback_mutex. We also 186 * It is ok to first take manage_mutex, then nest callback_mutex. We also
@@ -263,297 +264,33 @@ static struct super_block *cpuset_sb;
263 * the routine cpuset_update_task_memory_state(). 264 * the routine cpuset_update_task_memory_state().
264 */ 265 */
265 266
266static DEFINE_MUTEX(manage_mutex);
267static DEFINE_MUTEX(callback_mutex); 267static DEFINE_MUTEX(callback_mutex);
268 268
269/* 269/* This is ugly, but preserves the userspace API for existing cpuset
270 * A couple of forward declarations required, due to cyclic reference loop: 270 * users. If someone tries to mount the "cpuset" filesystem, we
271 * cpuset_mkdir -> cpuset_create -> cpuset_populate_dir -> cpuset_add_file 271 * silently switch it to mount "cgroup" instead */
272 * -> cpuset_create_file -> cpuset_dir_inode_operations -> cpuset_mkdir.
273 */
274
275static int cpuset_mkdir(struct inode *dir, struct dentry *dentry, int mode);
276static int cpuset_rmdir(struct inode *unused_dir, struct dentry *dentry);
277
278static struct backing_dev_info cpuset_backing_dev_info = {
279 .ra_pages = 0, /* No readahead */
280 .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
281};
282
283static struct inode *cpuset_new_inode(mode_t mode)
284{
285 struct inode *inode = new_inode(cpuset_sb);
286
287 if (inode) {
288 inode->i_mode = mode;
289 inode->i_uid = current->fsuid;
290 inode->i_gid = current->fsgid;
291 inode->i_blocks = 0;
292 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
293 inode->i_mapping->backing_dev_info = &cpuset_backing_dev_info;
294 }
295 return inode;
296}
297
298static void cpuset_diput(struct dentry *dentry, struct inode *inode)
299{
300 /* is dentry a directory ? if so, kfree() associated cpuset */
301 if (S_ISDIR(inode->i_mode)) {
302 struct cpuset *cs = dentry->d_fsdata;
303 BUG_ON(!(is_removed(cs)));
304 kfree(cs);
305 }
306 iput(inode);
307}
308
309static struct dentry_operations cpuset_dops = {
310 .d_iput = cpuset_diput,
311};
312
313static struct dentry *cpuset_get_dentry(struct dentry *parent, const char *name)
314{
315 struct dentry *d = lookup_one_len(name, parent, strlen(name));
316 if (!IS_ERR(d))
317 d->d_op = &cpuset_dops;
318 return d;
319}
320
321static void remove_dir(struct dentry *d)
322{
323 struct dentry *parent = dget(d->d_parent);
324
325 d_delete(d);
326 simple_rmdir(parent->d_inode, d);
327 dput(parent);
328}
329
330/*
331 * NOTE : the dentry must have been dget()'ed
332 */
333static void cpuset_d_remove_dir(struct dentry *dentry)
334{
335 struct list_head *node;
336
337 spin_lock(&dcache_lock);
338 node = dentry->d_subdirs.next;
339 while (node != &dentry->d_subdirs) {
340 struct dentry *d = list_entry(node, struct dentry, d_u.d_child);
341 list_del_init(node);
342 if (d->d_inode) {
343 d = dget_locked(d);
344 spin_unlock(&dcache_lock);
345 d_delete(d);
346 simple_unlink(dentry->d_inode, d);
347 dput(d);
348 spin_lock(&dcache_lock);
349 }
350 node = dentry->d_subdirs.next;
351 }
352 list_del_init(&dentry->d_u.d_child);
353 spin_unlock(&dcache_lock);
354 remove_dir(dentry);
355}
356
357static struct super_operations cpuset_ops = {
358 .statfs = simple_statfs,
359 .drop_inode = generic_delete_inode,
360};
361
362static int cpuset_fill_super(struct super_block *sb, void *unused_data,
363 int unused_silent)
364{
365 struct inode *inode;
366 struct dentry *root;
367
368 sb->s_blocksize = PAGE_CACHE_SIZE;
369 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
370 sb->s_magic = CPUSET_SUPER_MAGIC;
371 sb->s_op = &cpuset_ops;
372 cpuset_sb = sb;
373
374 inode = cpuset_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR);
375 if (inode) {
376 inode->i_op = &simple_dir_inode_operations;
377 inode->i_fop = &simple_dir_operations;
378 /* directories start off with i_nlink == 2 (for "." entry) */
379 inc_nlink(inode);
380 } else {
381 return -ENOMEM;
382 }
383
384 root = d_alloc_root(inode);
385 if (!root) {
386 iput(inode);
387 return -ENOMEM;
388 }
389 sb->s_root = root;
390 return 0;
391}
392
393static int cpuset_get_sb(struct file_system_type *fs_type, 272static int cpuset_get_sb(struct file_system_type *fs_type,
394 int flags, const char *unused_dev_name, 273 int flags, const char *unused_dev_name,
395 void *data, struct vfsmount *mnt) 274 void *data, struct vfsmount *mnt)
396{ 275{
397 return get_sb_single(fs_type, flags, data, cpuset_fill_super, mnt); 276 struct file_system_type *cgroup_fs = get_fs_type("cgroup");
277 int ret = -ENODEV;
278 if (cgroup_fs) {
279 char mountopts[] =
280 "cpuset,noprefix,"
281 "release_agent=/sbin/cpuset_release_agent";
282 ret = cgroup_fs->get_sb(cgroup_fs, flags,
283 unused_dev_name, mountopts, mnt);
284 put_filesystem(cgroup_fs);
285 }
286 return ret;
398} 287}
399 288
400static struct file_system_type cpuset_fs_type = { 289static struct file_system_type cpuset_fs_type = {
401 .name = "cpuset", 290 .name = "cpuset",
402 .get_sb = cpuset_get_sb, 291 .get_sb = cpuset_get_sb,
403 .kill_sb = kill_litter_super,
404}; 292};
405 293
406/* struct cftype:
407 *
408 * The files in the cpuset filesystem mostly have a very simple read/write
409 * handling, some common function will take care of it. Nevertheless some cases
410 * (read tasks) are special and therefore I define this structure for every
411 * kind of file.
412 *
413 *
414 * When reading/writing to a file:
415 * - the cpuset to use in file->f_path.dentry->d_parent->d_fsdata
416 * - the 'cftype' of the file is file->f_path.dentry->d_fsdata
417 */
418
419struct cftype {
420 char *name;
421 int private;
422 int (*open) (struct inode *inode, struct file *file);
423 ssize_t (*read) (struct file *file, char __user *buf, size_t nbytes,
424 loff_t *ppos);
425 int (*write) (struct file *file, const char __user *buf, size_t nbytes,
426 loff_t *ppos);
427 int (*release) (struct inode *inode, struct file *file);
428};
429
430static inline struct cpuset *__d_cs(struct dentry *dentry)
431{
432 return dentry->d_fsdata;
433}
434
435static inline struct cftype *__d_cft(struct dentry *dentry)
436{
437 return dentry->d_fsdata;
438}
439
440/*
441 * Call with manage_mutex held. Writes path of cpuset into buf.
442 * Returns 0 on success, -errno on error.
443 */
444
445static int cpuset_path(const struct cpuset *cs, char *buf, int buflen)
446{
447 char *start;
448
449 start = buf + buflen;
450
451 *--start = '\0';
452 for (;;) {
453 int len = cs->dentry->d_name.len;
454 if ((start -= len) < buf)
455 return -ENAMETOOLONG;
456 memcpy(start, cs->dentry->d_name.name, len);
457 cs = cs->parent;
458 if (!cs)
459 break;
460 if (!cs->parent)
461 continue;
462 if (--start < buf)
463 return -ENAMETOOLONG;
464 *start = '/';
465 }
466 memmove(buf, start, buf + buflen - start);
467 return 0;
468}
469
470/*
471 * Notify userspace when a cpuset is released, by running
472 * /sbin/cpuset_release_agent with the name of the cpuset (path
473 * relative to the root of cpuset file system) as the argument.
474 *
475 * Most likely, this user command will try to rmdir this cpuset.
476 *
477 * This races with the possibility that some other task will be
478 * attached to this cpuset before it is removed, or that some other
479 * user task will 'mkdir' a child cpuset of this cpuset. That's ok.
480 * The presumed 'rmdir' will fail quietly if this cpuset is no longer
481 * unused, and this cpuset will be reprieved from its death sentence,
482 * to continue to serve a useful existence. Next time it's released,
483 * we will get notified again, if it still has 'notify_on_release' set.
484 *
485 * The final arg to call_usermodehelper() is 0, which means don't
486 * wait. The separate /sbin/cpuset_release_agent task is forked by
487 * call_usermodehelper(), then control in this thread returns here,
488 * without waiting for the release agent task. We don't bother to
489 * wait because the caller of this routine has no use for the exit
490 * status of the /sbin/cpuset_release_agent task, so no sense holding
491 * our caller up for that.
492 *
493 * When we had only one cpuset mutex, we had to call this
494 * without holding it, to avoid deadlock when call_usermodehelper()
495 * allocated memory. With two locks, we could now call this while
496 * holding manage_mutex, but we still don't, so as to minimize
497 * the time manage_mutex is held.
498 */
499
500static void cpuset_release_agent(const char *pathbuf)
501{
502 char *argv[3], *envp[3];
503 int i;
504
505 if (!pathbuf)
506 return;
507
508 i = 0;
509 argv[i++] = "/sbin/cpuset_release_agent";
510 argv[i++] = (char *)pathbuf;
511 argv[i] = NULL;
512
513 i = 0;
514 /* minimal command environment */
515 envp[i++] = "HOME=/";
516 envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
517 envp[i] = NULL;
518
519 call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
520 kfree(pathbuf);
521}
522
523/*
524 * Either cs->count of using tasks transitioned to zero, or the
525 * cs->children list of child cpusets just became empty. If this
526 * cs is notify_on_release() and now both the user count is zero and
527 * the list of children is empty, prepare cpuset path in a kmalloc'd
528 * buffer, to be returned via ppathbuf, so that the caller can invoke
529 * cpuset_release_agent() with it later on, once manage_mutex is dropped.
530 * Call here with manage_mutex held.
531 *
532 * This check_for_release() routine is responsible for kmalloc'ing
533 * pathbuf. The above cpuset_release_agent() is responsible for
534 * kfree'ing pathbuf. The caller of these routines is responsible
535 * for providing a pathbuf pointer, initialized to NULL, then
536 * calling check_for_release() with manage_mutex held and the address
537 * of the pathbuf pointer, then dropping manage_mutex, then calling
538 * cpuset_release_agent() with pathbuf, as set by check_for_release().
539 */
540
541static void check_for_release(struct cpuset *cs, char **ppathbuf)
542{
543 if (notify_on_release(cs) && atomic_read(&cs->count) == 0 &&
544 list_empty(&cs->children)) {
545 char *buf;
546
547 buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
548 if (!buf)
549 return;
550 if (cpuset_path(cs, buf, PAGE_SIZE) < 0)
551 kfree(buf);
552 else
553 *ppathbuf = buf;
554 }
555}
556
557/* 294/*
558 * Return in *pmask the portion of a cpusets's cpus_allowed that 295 * Return in *pmask the portion of a cpusets's cpus_allowed that
559 * are online. If none are online, walk up the cpuset hierarchy 296 * are online. If none are online, walk up the cpuset hierarchy
@@ -653,20 +390,19 @@ void cpuset_update_task_memory_state(void)
653 struct task_struct *tsk = current; 390 struct task_struct *tsk = current;
654 struct cpuset *cs; 391 struct cpuset *cs;
655 392
656 if (tsk->cpuset == &top_cpuset) { 393 if (task_cs(tsk) == &top_cpuset) {
657 /* Don't need rcu for top_cpuset. It's never freed. */ 394 /* Don't need rcu for top_cpuset. It's never freed. */
658 my_cpusets_mem_gen = top_cpuset.mems_generation; 395 my_cpusets_mem_gen = top_cpuset.mems_generation;
659 } else { 396 } else {
660 rcu_read_lock(); 397 rcu_read_lock();
661 cs = rcu_dereference(tsk->cpuset); 398 my_cpusets_mem_gen = task_cs(current)->mems_generation;
662 my_cpusets_mem_gen = cs->mems_generation;
663 rcu_read_unlock(); 399 rcu_read_unlock();
664 } 400 }
665 401
666 if (my_cpusets_mem_gen != tsk->cpuset_mems_generation) { 402 if (my_cpusets_mem_gen != tsk->cpuset_mems_generation) {
667 mutex_lock(&callback_mutex); 403 mutex_lock(&callback_mutex);
668 task_lock(tsk); 404 task_lock(tsk);
669 cs = tsk->cpuset; /* Maybe changed when task not locked */ 405 cs = task_cs(tsk); /* Maybe changed when task not locked */
670 guarantee_online_mems(cs, &tsk->mems_allowed); 406 guarantee_online_mems(cs, &tsk->mems_allowed);
671 tsk->cpuset_mems_generation = cs->mems_generation; 407 tsk->cpuset_mems_generation = cs->mems_generation;
672 if (is_spread_page(cs)) 408 if (is_spread_page(cs))
@@ -721,11 +457,12 @@ static int is_cpuset_subset(const struct cpuset *p, const struct cpuset *q)
721 457
722static int validate_change(const struct cpuset *cur, const struct cpuset *trial) 458static int validate_change(const struct cpuset *cur, const struct cpuset *trial)
723{ 459{
460 struct cgroup *cont;
724 struct cpuset *c, *par; 461 struct cpuset *c, *par;
725 462
726 /* Each of our child cpusets must be a subset of us */ 463 /* Each of our child cpusets must be a subset of us */
727 list_for_each_entry(c, &cur->children, sibling) { 464 list_for_each_entry(cont, &cur->css.cgroup->children, sibling) {
728 if (!is_cpuset_subset(c, trial)) 465 if (!is_cpuset_subset(cgroup_cs(cont), trial))
729 return -EBUSY; 466 return -EBUSY;
730 } 467 }
731 468
@@ -740,7 +477,8 @@ static int validate_change(const struct cpuset *cur, const struct cpuset *trial)
740 return -EACCES; 477 return -EACCES;
741 478
742 /* If either I or some sibling (!= me) is exclusive, we can't overlap */ 479 /* If either I or some sibling (!= me) is exclusive, we can't overlap */
743 list_for_each_entry(c, &par->children, sibling) { 480 list_for_each_entry(cont, &par->css.cgroup->children, sibling) {
481 c = cgroup_cs(cont);
744 if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) && 482 if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) &&
745 c != cur && 483 c != cur &&
746 cpus_intersects(trial->cpus_allowed, c->cpus_allowed)) 484 cpus_intersects(trial->cpus_allowed, c->cpus_allowed))
@@ -751,17 +489,265 @@ static int validate_change(const struct cpuset *cur, const struct cpuset *trial)
751 return -EINVAL; 489 return -EINVAL;
752 } 490 }
753 491
492 /* Cpusets with tasks can't have empty cpus_allowed or mems_allowed */
493 if (cgroup_task_count(cur->css.cgroup)) {
494 if (cpus_empty(trial->cpus_allowed) ||
495 nodes_empty(trial->mems_allowed)) {
496 return -ENOSPC;
497 }
498 }
499
754 return 0; 500 return 0;
755} 501}
756 502
757/* 503/*
504 * Helper routine for rebuild_sched_domains().
505 * Do cpusets a, b have overlapping cpus_allowed masks?
506 */
507
508static int cpusets_overlap(struct cpuset *a, struct cpuset *b)
509{
510 return cpus_intersects(a->cpus_allowed, b->cpus_allowed);
511}
512
513/*
514 * rebuild_sched_domains()
515 *
516 * If the flag 'sched_load_balance' of any cpuset with non-empty
517 * 'cpus' changes, or if the 'cpus' allowed changes in any cpuset
518 * which has that flag enabled, or if any cpuset with a non-empty
519 * 'cpus' is removed, then call this routine to rebuild the
520 * scheduler's dynamic sched domains.
521 *
522 * This routine builds a partial partition of the systems CPUs
523 * (the set of non-overlappping cpumask_t's in the array 'part'
524 * below), and passes that partial partition to the kernel/sched.c
525 * partition_sched_domains() routine, which will rebuild the
526 * schedulers load balancing domains (sched domains) as specified
527 * by that partial partition. A 'partial partition' is a set of
528 * non-overlapping subsets whose union is a subset of that set.
529 *
530 * See "What is sched_load_balance" in Documentation/cpusets.txt
531 * for a background explanation of this.
532 *
533 * Does not return errors, on the theory that the callers of this
534 * routine would rather not worry about failures to rebuild sched
535 * domains when operating in the severe memory shortage situations
536 * that could cause allocation failures below.
537 *
538 * Call with cgroup_mutex held. May take callback_mutex during
539 * call due to the kfifo_alloc() and kmalloc() calls. May nest
540 * a call to the lock_cpu_hotplug()/unlock_cpu_hotplug() pair.
541 * Must not be called holding callback_mutex, because we must not
542 * call lock_cpu_hotplug() while holding callback_mutex. Elsewhere
543 * the kernel nests callback_mutex inside lock_cpu_hotplug() calls.
544 * So the reverse nesting would risk an ABBA deadlock.
545 *
546 * The three key local variables below are:
547 * q - a kfifo queue of cpuset pointers, used to implement a
548 * top-down scan of all cpusets. This scan loads a pointer
549 * to each cpuset marked is_sched_load_balance into the
550 * array 'csa'. For our purposes, rebuilding the schedulers
551 * sched domains, we can ignore !is_sched_load_balance cpusets.
552 * csa - (for CpuSet Array) Array of pointers to all the cpusets
553 * that need to be load balanced, for convenient iterative
554 * access by the subsequent code that finds the best partition,
555 * i.e the set of domains (subsets) of CPUs such that the
556 * cpus_allowed of every cpuset marked is_sched_load_balance
557 * is a subset of one of these domains, while there are as
558 * many such domains as possible, each as small as possible.
559 * doms - Conversion of 'csa' to an array of cpumasks, for passing to
560 * the kernel/sched.c routine partition_sched_domains() in a
561 * convenient format, that can be easily compared to the prior
562 * value to determine what partition elements (sched domains)
563 * were changed (added or removed.)
564 *
565 * Finding the best partition (set of domains):
566 * The triple nested loops below over i, j, k scan over the
567 * load balanced cpusets (using the array of cpuset pointers in
568 * csa[]) looking for pairs of cpusets that have overlapping
569 * cpus_allowed, but which don't have the same 'pn' partition
570 * number and gives them in the same partition number. It keeps
571 * looping on the 'restart' label until it can no longer find
572 * any such pairs.
573 *
574 * The union of the cpus_allowed masks from the set of
575 * all cpusets having the same 'pn' value then form the one
576 * element of the partition (one sched domain) to be passed to
577 * partition_sched_domains().
578 */
579
580static void rebuild_sched_domains(void)
581{
582 struct kfifo *q; /* queue of cpusets to be scanned */
583 struct cpuset *cp; /* scans q */
584 struct cpuset **csa; /* array of all cpuset ptrs */
585 int csn; /* how many cpuset ptrs in csa so far */
586 int i, j, k; /* indices for partition finding loops */
587 cpumask_t *doms; /* resulting partition; i.e. sched domains */
588 int ndoms; /* number of sched domains in result */
589 int nslot; /* next empty doms[] cpumask_t slot */
590
591 q = NULL;
592 csa = NULL;
593 doms = NULL;
594
595 /* Special case for the 99% of systems with one, full, sched domain */
596 if (is_sched_load_balance(&top_cpuset)) {
597 ndoms = 1;
598 doms = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
599 if (!doms)
600 goto rebuild;
601 *doms = top_cpuset.cpus_allowed;
602 goto rebuild;
603 }
604
605 q = kfifo_alloc(number_of_cpusets * sizeof(cp), GFP_KERNEL, NULL);
606 if (IS_ERR(q))
607 goto done;
608 csa = kmalloc(number_of_cpusets * sizeof(cp), GFP_KERNEL);
609 if (!csa)
610 goto done;
611 csn = 0;
612
613 cp = &top_cpuset;
614 __kfifo_put(q, (void *)&cp, sizeof(cp));
615 while (__kfifo_get(q, (void *)&cp, sizeof(cp))) {
616 struct cgroup *cont;
617 struct cpuset *child; /* scans child cpusets of cp */
618 if (is_sched_load_balance(cp))
619 csa[csn++] = cp;
620 list_for_each_entry(cont, &cp->css.cgroup->children, sibling) {
621 child = cgroup_cs(cont);
622 __kfifo_put(q, (void *)&child, sizeof(cp));
623 }
624 }
625
626 for (i = 0; i < csn; i++)
627 csa[i]->pn = i;
628 ndoms = csn;
629
630restart:
631 /* Find the best partition (set of sched domains) */
632 for (i = 0; i < csn; i++) {
633 struct cpuset *a = csa[i];
634 int apn = a->pn;
635
636 for (j = 0; j < csn; j++) {
637 struct cpuset *b = csa[j];
638 int bpn = b->pn;
639
640 if (apn != bpn && cpusets_overlap(a, b)) {
641 for (k = 0; k < csn; k++) {
642 struct cpuset *c = csa[k];
643
644 if (c->pn == bpn)
645 c->pn = apn;
646 }
647 ndoms--; /* one less element */
648 goto restart;
649 }
650 }
651 }
652
653 /* Convert <csn, csa> to <ndoms, doms> */
654 doms = kmalloc(ndoms * sizeof(cpumask_t), GFP_KERNEL);
655 if (!doms)
656 goto rebuild;
657
658 for (nslot = 0, i = 0; i < csn; i++) {
659 struct cpuset *a = csa[i];
660 int apn = a->pn;
661
662 if (apn >= 0) {
663 cpumask_t *dp = doms + nslot;
664
665 if (nslot == ndoms) {
666 static int warnings = 10;
667 if (warnings) {
668 printk(KERN_WARNING
669 "rebuild_sched_domains confused:"
670 " nslot %d, ndoms %d, csn %d, i %d,"
671 " apn %d\n",
672 nslot, ndoms, csn, i, apn);
673 warnings--;
674 }
675 continue;
676 }
677
678 cpus_clear(*dp);
679 for (j = i; j < csn; j++) {
680 struct cpuset *b = csa[j];
681
682 if (apn == b->pn) {
683 cpus_or(*dp, *dp, b->cpus_allowed);
684 b->pn = -1;
685 }
686 }
687 nslot++;
688 }
689 }
690 BUG_ON(nslot != ndoms);
691
692rebuild:
693 /* Have scheduler rebuild sched domains */
694 lock_cpu_hotplug();
695 partition_sched_domains(ndoms, doms);
696 unlock_cpu_hotplug();
697
698done:
699 if (q && !IS_ERR(q))
700 kfifo_free(q);
701 kfree(csa);
702 /* Don't kfree(doms) -- partition_sched_domains() does that. */
703}
704
705static inline int started_after_time(struct task_struct *t1,
706 struct timespec *time,
707 struct task_struct *t2)
708{
709 int start_diff = timespec_compare(&t1->start_time, time);
710 if (start_diff > 0) {
711 return 1;
712 } else if (start_diff < 0) {
713 return 0;
714 } else {
715 /*
716 * Arbitrarily, if two processes started at the same
717 * time, we'll say that the lower pointer value
718 * started first. Note that t2 may have exited by now
719 * so this may not be a valid pointer any longer, but
720 * that's fine - it still serves to distinguish
721 * between two tasks started (effectively)
722 * simultaneously.
723 */
724 return t1 > t2;
725 }
726}
727
728static inline int started_after(void *p1, void *p2)
729{
730 struct task_struct *t1 = p1;
731 struct task_struct *t2 = p2;
732 return started_after_time(t1, &t2->start_time, t2);
733}
734
735/*
758 * Call with manage_mutex held. May take callback_mutex during call. 736 * Call with manage_mutex held. May take callback_mutex during call.
759 */ 737 */
760 738
761static int update_cpumask(struct cpuset *cs, char *buf) 739static int update_cpumask(struct cpuset *cs, char *buf)
762{ 740{
763 struct cpuset trialcs; 741 struct cpuset trialcs;
764 int retval; 742 int retval, i;
743 int is_load_balanced;
744 struct cgroup_iter it;
745 struct cgroup *cgrp = cs->css.cgroup;
746 struct task_struct *p, *dropped;
747 /* Never dereference latest_task, since it's not refcounted */
748 struct task_struct *latest_task = NULL;
749 struct ptr_heap heap;
750 struct timespec latest_time = { 0, 0 };
765 751
766 /* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */ 752 /* top_cpuset.cpus_allowed tracks cpu_online_map; it's read-only */
767 if (cs == &top_cpuset) 753 if (cs == &top_cpuset)
@@ -770,11 +756,13 @@ static int update_cpumask(struct cpuset *cs, char *buf)
770 trialcs = *cs; 756 trialcs = *cs;
771 757
772 /* 758 /*
773 * We allow a cpuset's cpus_allowed to be empty; if it has attached 759 * An empty cpus_allowed is ok iff there are no tasks in the cpuset.
774 * tasks, we'll catch it later when we validate the change and return 760 * Since cpulist_parse() fails on an empty mask, we special case
775 * -ENOSPC. 761 * that parsing. The validate_change() call ensures that cpusets
762 * with tasks have cpus.
776 */ 763 */
777 if (!buf[0] || (buf[0] == '\n' && !buf[1])) { 764 buf = strstrip(buf);
765 if (!*buf) {
778 cpus_clear(trialcs.cpus_allowed); 766 cpus_clear(trialcs.cpus_allowed);
779 } else { 767 } else {
780 retval = cpulist_parse(buf, trialcs.cpus_allowed); 768 retval = cpulist_parse(buf, trialcs.cpus_allowed);
@@ -782,15 +770,79 @@ static int update_cpumask(struct cpuset *cs, char *buf)
782 return retval; 770 return retval;
783 } 771 }
784 cpus_and(trialcs.cpus_allowed, trialcs.cpus_allowed, cpu_online_map); 772 cpus_and(trialcs.cpus_allowed, trialcs.cpus_allowed, cpu_online_map);
785 /* cpus_allowed cannot be empty for a cpuset with attached tasks. */
786 if (atomic_read(&cs->count) && cpus_empty(trialcs.cpus_allowed))
787 return -ENOSPC;
788 retval = validate_change(cs, &trialcs); 773 retval = validate_change(cs, &trialcs);
789 if (retval < 0) 774 if (retval < 0)
790 return retval; 775 return retval;
776
777 /* Nothing to do if the cpus didn't change */
778 if (cpus_equal(cs->cpus_allowed, trialcs.cpus_allowed))
779 return 0;
780 retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, &started_after);
781 if (retval)
782 return retval;
783
784 is_load_balanced = is_sched_load_balance(&trialcs);
785
791 mutex_lock(&callback_mutex); 786 mutex_lock(&callback_mutex);
792 cs->cpus_allowed = trialcs.cpus_allowed; 787 cs->cpus_allowed = trialcs.cpus_allowed;
793 mutex_unlock(&callback_mutex); 788 mutex_unlock(&callback_mutex);
789
790 again:
791 /*
792 * Scan tasks in the cpuset, and update the cpumasks of any
793 * that need an update. Since we can't call set_cpus_allowed()
794 * while holding tasklist_lock, gather tasks to be processed
795 * in a heap structure. If the statically-sized heap fills up,
796 * overflow tasks that started later, and in future iterations
797 * only consider tasks that started after the latest task in
798 * the previous pass. This guarantees forward progress and
799 * that we don't miss any tasks
800 */
801 heap.size = 0;
802 cgroup_iter_start(cgrp, &it);
803 while ((p = cgroup_iter_next(cgrp, &it))) {
804 /* Only affect tasks that don't have the right cpus_allowed */
805 if (cpus_equal(p->cpus_allowed, cs->cpus_allowed))
806 continue;
807 /*
808 * Only process tasks that started after the last task
809 * we processed
810 */
811 if (!started_after_time(p, &latest_time, latest_task))
812 continue;
813 dropped = heap_insert(&heap, p);
814 if (dropped == NULL) {
815 get_task_struct(p);
816 } else if (dropped != p) {
817 get_task_struct(p);
818 put_task_struct(dropped);
819 }
820 }
821 cgroup_iter_end(cgrp, &it);
822 if (heap.size) {
823 for (i = 0; i < heap.size; i++) {
824 struct task_struct *p = heap.ptrs[i];
825 if (i == 0) {
826 latest_time = p->start_time;
827 latest_task = p;
828 }
829 set_cpus_allowed(p, cs->cpus_allowed);
830 put_task_struct(p);
831 }
832 /*
833 * If we had to process any tasks at all, scan again
834 * in case some of them were in the middle of forking
835 * children that didn't notice the new cpumask
836 * restriction. Not the most efficient way to do it,
837 * but it avoids having to take callback_mutex in the
838 * fork path
839 */
840 goto again;
841 }
842 heap_free(&heap);
843 if (is_load_balanced)
844 rebuild_sched_domains();
845
794 return 0; 846 return 0;
795} 847}
796 848
@@ -839,7 +891,7 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from,
839 do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL); 891 do_migrate_pages(mm, from, to, MPOL_MF_MOVE_ALL);
840 892
841 mutex_lock(&callback_mutex); 893 mutex_lock(&callback_mutex);
842 guarantee_online_mems(tsk->cpuset, &tsk->mems_allowed); 894 guarantee_online_mems(task_cs(tsk),&tsk->mems_allowed);
843 mutex_unlock(&callback_mutex); 895 mutex_unlock(&callback_mutex);
844} 896}
845 897
@@ -857,16 +909,19 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from,
857 * their mempolicies to the cpusets new mems_allowed. 909 * their mempolicies to the cpusets new mems_allowed.
858 */ 910 */
859 911
912static void *cpuset_being_rebound;
913
860static int update_nodemask(struct cpuset *cs, char *buf) 914static int update_nodemask(struct cpuset *cs, char *buf)
861{ 915{
862 struct cpuset trialcs; 916 struct cpuset trialcs;
863 nodemask_t oldmem; 917 nodemask_t oldmem;
864 struct task_struct *g, *p; 918 struct task_struct *p;
865 struct mm_struct **mmarray; 919 struct mm_struct **mmarray;
866 int i, n, ntasks; 920 int i, n, ntasks;
867 int migrate; 921 int migrate;
868 int fudge; 922 int fudge;
869 int retval; 923 int retval;
924 struct cgroup_iter it;
870 925
871 /* 926 /*
872 * top_cpuset.mems_allowed tracks node_stats[N_HIGH_MEMORY]; 927 * top_cpuset.mems_allowed tracks node_stats[N_HIGH_MEMORY];
@@ -878,29 +933,19 @@ static int update_nodemask(struct cpuset *cs, char *buf)
878 trialcs = *cs; 933 trialcs = *cs;
879 934
880 /* 935 /*
881 * We allow a cpuset's mems_allowed to be empty; if it has attached 936 * An empty mems_allowed is ok iff there are no tasks in the cpuset.
882 * tasks, we'll catch it later when we validate the change and return 937 * Since nodelist_parse() fails on an empty mask, we special case
883 * -ENOSPC. 938 * that parsing. The validate_change() call ensures that cpusets
939 * with tasks have memory.
884 */ 940 */
885 if (!buf[0] || (buf[0] == '\n' && !buf[1])) { 941 buf = strstrip(buf);
942 if (!*buf) {
886 nodes_clear(trialcs.mems_allowed); 943 nodes_clear(trialcs.mems_allowed);
887 } else { 944 } else {
888 retval = nodelist_parse(buf, trialcs.mems_allowed); 945 retval = nodelist_parse(buf, trialcs.mems_allowed);
889 if (retval < 0) 946 if (retval < 0)
890 goto done; 947 goto done;
891 if (!nodes_intersects(trialcs.mems_allowed,
892 node_states[N_HIGH_MEMORY])) {
893 /*
894 * error if only memoryless nodes specified.
895 */
896 retval = -ENOSPC;
897 goto done;
898 }
899 } 948 }
900 /*
901 * Exclude memoryless nodes. We know that trialcs.mems_allowed
902 * contains at least one node with memory.
903 */
904 nodes_and(trialcs.mems_allowed, trialcs.mems_allowed, 949 nodes_and(trialcs.mems_allowed, trialcs.mems_allowed,
905 node_states[N_HIGH_MEMORY]); 950 node_states[N_HIGH_MEMORY]);
906 oldmem = cs->mems_allowed; 951 oldmem = cs->mems_allowed;
@@ -908,11 +953,6 @@ static int update_nodemask(struct cpuset *cs, char *buf)
908 retval = 0; /* Too easy - nothing to do */ 953 retval = 0; /* Too easy - nothing to do */
909 goto done; 954 goto done;
910 } 955 }
911 /* mems_allowed cannot be empty for a cpuset with attached tasks. */
912 if (atomic_read(&cs->count) && nodes_empty(trialcs.mems_allowed)) {
913 retval = -ENOSPC;
914 goto done;
915 }
916 retval = validate_change(cs, &trialcs); 956 retval = validate_change(cs, &trialcs);
917 if (retval < 0) 957 if (retval < 0)
918 goto done; 958 goto done;
@@ -922,7 +962,7 @@ static int update_nodemask(struct cpuset *cs, char *buf)
922 cs->mems_generation = cpuset_mems_generation++; 962 cs->mems_generation = cpuset_mems_generation++;
923 mutex_unlock(&callback_mutex); 963 mutex_unlock(&callback_mutex);
924 964
925 set_cpuset_being_rebound(cs); /* causes mpol_copy() rebind */ 965 cpuset_being_rebound = cs; /* causes mpol_copy() rebind */
926 966
927 fudge = 10; /* spare mmarray[] slots */ 967 fudge = 10; /* spare mmarray[] slots */
928 fudge += cpus_weight(cs->cpus_allowed); /* imagine one fork-bomb/cpu */ 968 fudge += cpus_weight(cs->cpus_allowed); /* imagine one fork-bomb/cpu */
@@ -936,13 +976,13 @@ static int update_nodemask(struct cpuset *cs, char *buf)
936 * enough mmarray[] w/o using GFP_ATOMIC. 976 * enough mmarray[] w/o using GFP_ATOMIC.
937 */ 977 */
938 while (1) { 978 while (1) {
939 ntasks = atomic_read(&cs->count); /* guess */ 979 ntasks = cgroup_task_count(cs->css.cgroup); /* guess */
940 ntasks += fudge; 980 ntasks += fudge;
941 mmarray = kmalloc(ntasks * sizeof(*mmarray), GFP_KERNEL); 981 mmarray = kmalloc(ntasks * sizeof(*mmarray), GFP_KERNEL);
942 if (!mmarray) 982 if (!mmarray)
943 goto done; 983 goto done;
944 read_lock(&tasklist_lock); /* block fork */ 984 read_lock(&tasklist_lock); /* block fork */
945 if (atomic_read(&cs->count) <= ntasks) 985 if (cgroup_task_count(cs->css.cgroup) <= ntasks)
946 break; /* got enough */ 986 break; /* got enough */
947 read_unlock(&tasklist_lock); /* try again */ 987 read_unlock(&tasklist_lock); /* try again */
948 kfree(mmarray); 988 kfree(mmarray);
@@ -951,21 +991,21 @@ static int update_nodemask(struct cpuset *cs, char *buf)
951 n = 0; 991 n = 0;
952 992
953 /* Load up mmarray[] with mm reference for each task in cpuset. */ 993 /* Load up mmarray[] with mm reference for each task in cpuset. */
954 do_each_thread(g, p) { 994 cgroup_iter_start(cs->css.cgroup, &it);
995 while ((p = cgroup_iter_next(cs->css.cgroup, &it))) {
955 struct mm_struct *mm; 996 struct mm_struct *mm;
956 997
957 if (n >= ntasks) { 998 if (n >= ntasks) {
958 printk(KERN_WARNING 999 printk(KERN_WARNING
959 "Cpuset mempolicy rebind incomplete.\n"); 1000 "Cpuset mempolicy rebind incomplete.\n");
960 continue; 1001 break;
961 } 1002 }
962 if (p->cpuset != cs)
963 continue;
964 mm = get_task_mm(p); 1003 mm = get_task_mm(p);
965 if (!mm) 1004 if (!mm)
966 continue; 1005 continue;
967 mmarray[n++] = mm; 1006 mmarray[n++] = mm;
968 } while_each_thread(g, p); 1007 }
1008 cgroup_iter_end(cs->css.cgroup, &it);
969 read_unlock(&tasklist_lock); 1009 read_unlock(&tasklist_lock);
970 1010
971 /* 1011 /*
@@ -993,12 +1033,17 @@ static int update_nodemask(struct cpuset *cs, char *buf)
993 1033
994 /* We're done rebinding vma's to this cpusets new mems_allowed. */ 1034 /* We're done rebinding vma's to this cpusets new mems_allowed. */
995 kfree(mmarray); 1035 kfree(mmarray);
996 set_cpuset_being_rebound(NULL); 1036 cpuset_being_rebound = NULL;
997 retval = 0; 1037 retval = 0;
998done: 1038done:
999 return retval; 1039 return retval;
1000} 1040}
1001 1041
1042int current_cpuset_is_being_rebound(void)
1043{
1044 return task_cs(current) == cpuset_being_rebound;
1045}
1046
1002/* 1047/*
1003 * Call with manage_mutex held. 1048 * Call with manage_mutex held.
1004 */ 1049 */
@@ -1015,6 +1060,7 @@ static int update_memory_pressure_enabled(struct cpuset *cs, char *buf)
1015/* 1060/*
1016 * update_flag - read a 0 or a 1 in a file and update associated flag 1061 * update_flag - read a 0 or a 1 in a file and update associated flag
1017 * bit: the bit to update (CS_CPU_EXCLUSIVE, CS_MEM_EXCLUSIVE, 1062 * bit: the bit to update (CS_CPU_EXCLUSIVE, CS_MEM_EXCLUSIVE,
1063 * CS_SCHED_LOAD_BALANCE,
1018 * CS_NOTIFY_ON_RELEASE, CS_MEMORY_MIGRATE, 1064 * CS_NOTIFY_ON_RELEASE, CS_MEMORY_MIGRATE,
1019 * CS_SPREAD_PAGE, CS_SPREAD_SLAB) 1065 * CS_SPREAD_PAGE, CS_SPREAD_SLAB)
1020 * cs: the cpuset to update 1066 * cs: the cpuset to update
@@ -1028,6 +1074,7 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, char *buf)
1028 int turning_on; 1074 int turning_on;
1029 struct cpuset trialcs; 1075 struct cpuset trialcs;
1030 int err; 1076 int err;
1077 int cpus_nonempty, balance_flag_changed;
1031 1078
1032 turning_on = (simple_strtoul(buf, NULL, 10) != 0); 1079 turning_on = (simple_strtoul(buf, NULL, 10) != 0);
1033 1080
@@ -1040,10 +1087,18 @@ static int update_flag(cpuset_flagbits_t bit, struct cpuset *cs, char *buf)
1040 err = validate_change(cs, &trialcs); 1087 err = validate_change(cs, &trialcs);
1041 if (err < 0) 1088 if (err < 0)
1042 return err; 1089 return err;
1090
1091 cpus_nonempty = !cpus_empty(trialcs.cpus_allowed);
1092 balance_flag_changed = (is_sched_load_balance(cs) !=
1093 is_sched_load_balance(&trialcs));
1094
1043 mutex_lock(&callback_mutex); 1095 mutex_lock(&callback_mutex);
1044 cs->flags = trialcs.flags; 1096 cs->flags = trialcs.flags;
1045 mutex_unlock(&callback_mutex); 1097 mutex_unlock(&callback_mutex);
1046 1098
1099 if (cpus_nonempty && balance_flag_changed)
1100 rebuild_sched_domains();
1101
1047 return 0; 1102 return 0;
1048} 1103}
1049 1104
@@ -1145,85 +1200,34 @@ static int fmeter_getrate(struct fmeter *fmp)
1145 return val; 1200 return val;
1146} 1201}
1147 1202
1148/* 1203static int cpuset_can_attach(struct cgroup_subsys *ss,
1149 * Attack task specified by pid in 'pidbuf' to cpuset 'cs', possibly 1204 struct cgroup *cont, struct task_struct *tsk)
1150 * writing the path of the old cpuset in 'ppathbuf' if it needs to be
1151 * notified on release.
1152 *
1153 * Call holding manage_mutex. May take callback_mutex and task_lock of
1154 * the task 'pid' during call.
1155 */
1156
1157static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf)
1158{ 1205{
1159 pid_t pid; 1206 struct cpuset *cs = cgroup_cs(cont);
1160 struct task_struct *tsk;
1161 struct cpuset *oldcs;
1162 cpumask_t cpus;
1163 nodemask_t from, to;
1164 struct mm_struct *mm;
1165 int retval;
1166 1207
1167 if (sscanf(pidbuf, "%d", &pid) != 1)
1168 return -EIO;
1169 if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed)) 1208 if (cpus_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))
1170 return -ENOSPC; 1209 return -ENOSPC;
1171 1210
1172 if (pid) { 1211 return security_task_setscheduler(tsk, 0, NULL);
1173 read_lock(&tasklist_lock); 1212}
1174
1175 tsk = find_task_by_pid(pid);
1176 if (!tsk || tsk->flags & PF_EXITING) {
1177 read_unlock(&tasklist_lock);
1178 return -ESRCH;
1179 }
1180
1181 get_task_struct(tsk);
1182 read_unlock(&tasklist_lock);
1183
1184 if ((current->euid) && (current->euid != tsk->uid)
1185 && (current->euid != tsk->suid)) {
1186 put_task_struct(tsk);
1187 return -EACCES;
1188 }
1189 } else {
1190 tsk = current;
1191 get_task_struct(tsk);
1192 }
1193 1213
1194 retval = security_task_setscheduler(tsk, 0, NULL); 1214static void cpuset_attach(struct cgroup_subsys *ss,
1195 if (retval) { 1215 struct cgroup *cont, struct cgroup *oldcont,
1196 put_task_struct(tsk); 1216 struct task_struct *tsk)
1197 return retval; 1217{
1198 } 1218 cpumask_t cpus;
1219 nodemask_t from, to;
1220 struct mm_struct *mm;
1221 struct cpuset *cs = cgroup_cs(cont);
1222 struct cpuset *oldcs = cgroup_cs(oldcont);
1199 1223
1200 mutex_lock(&callback_mutex); 1224 mutex_lock(&callback_mutex);
1201
1202 task_lock(tsk);
1203 oldcs = tsk->cpuset;
1204 /*
1205 * After getting 'oldcs' cpuset ptr, be sure still not exiting.
1206 * If 'oldcs' might be the top_cpuset due to the_top_cpuset_hack
1207 * then fail this attach_task(), to avoid breaking top_cpuset.count.
1208 */
1209 if (tsk->flags & PF_EXITING) {
1210 task_unlock(tsk);
1211 mutex_unlock(&callback_mutex);
1212 put_task_struct(tsk);
1213 return -ESRCH;
1214 }
1215 atomic_inc(&cs->count);
1216 rcu_assign_pointer(tsk->cpuset, cs);
1217 task_unlock(tsk);
1218
1219 guarantee_online_cpus(cs, &cpus); 1225 guarantee_online_cpus(cs, &cpus);
1220 set_cpus_allowed(tsk, cpus); 1226 set_cpus_allowed(tsk, cpus);
1227 mutex_unlock(&callback_mutex);
1221 1228
1222 from = oldcs->mems_allowed; 1229 from = oldcs->mems_allowed;
1223 to = cs->mems_allowed; 1230 to = cs->mems_allowed;
1224
1225 mutex_unlock(&callback_mutex);
1226
1227 mm = get_task_mm(tsk); 1231 mm = get_task_mm(tsk);
1228 if (mm) { 1232 if (mm) {
1229 mpol_rebind_mm(mm, &to); 1233 mpol_rebind_mm(mm, &to);
@@ -1232,44 +1236,36 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf)
1232 mmput(mm); 1236 mmput(mm);
1233 } 1237 }
1234 1238
1235 put_task_struct(tsk);
1236 synchronize_rcu();
1237 if (atomic_dec_and_test(&oldcs->count))
1238 check_for_release(oldcs, ppathbuf);
1239 return 0;
1240} 1239}
1241 1240
1242/* The various types of files and directories in a cpuset file system */ 1241/* The various types of files and directories in a cpuset file system */
1243 1242
1244typedef enum { 1243typedef enum {
1245 FILE_ROOT,
1246 FILE_DIR,
1247 FILE_MEMORY_MIGRATE, 1244 FILE_MEMORY_MIGRATE,
1248 FILE_CPULIST, 1245 FILE_CPULIST,
1249 FILE_MEMLIST, 1246 FILE_MEMLIST,
1250 FILE_CPU_EXCLUSIVE, 1247 FILE_CPU_EXCLUSIVE,
1251 FILE_MEM_EXCLUSIVE, 1248 FILE_MEM_EXCLUSIVE,
1252 FILE_NOTIFY_ON_RELEASE, 1249 FILE_SCHED_LOAD_BALANCE,
1253 FILE_MEMORY_PRESSURE_ENABLED, 1250 FILE_MEMORY_PRESSURE_ENABLED,
1254 FILE_MEMORY_PRESSURE, 1251 FILE_MEMORY_PRESSURE,
1255 FILE_SPREAD_PAGE, 1252 FILE_SPREAD_PAGE,
1256 FILE_SPREAD_SLAB, 1253 FILE_SPREAD_SLAB,
1257 FILE_TASKLIST,
1258} cpuset_filetype_t; 1254} cpuset_filetype_t;
1259 1255
1260static ssize_t cpuset_common_file_write(struct file *file, 1256static ssize_t cpuset_common_file_write(struct cgroup *cont,
1257 struct cftype *cft,
1258 struct file *file,
1261 const char __user *userbuf, 1259 const char __user *userbuf,
1262 size_t nbytes, loff_t *unused_ppos) 1260 size_t nbytes, loff_t *unused_ppos)
1263{ 1261{
1264 struct cpuset *cs = __d_cs(file->f_path.dentry->d_parent); 1262 struct cpuset *cs = cgroup_cs(cont);
1265 struct cftype *cft = __d_cft(file->f_path.dentry);
1266 cpuset_filetype_t type = cft->private; 1263 cpuset_filetype_t type = cft->private;
1267 char *buffer; 1264 char *buffer;
1268 char *pathbuf = NULL;
1269 int retval = 0; 1265 int retval = 0;
1270 1266
1271 /* Crude upper limit on largest legitimate cpulist user might write. */ 1267 /* Crude upper limit on largest legitimate cpulist user might write. */
1272 if (nbytes > 100 + 6 * max(NR_CPUS, MAX_NUMNODES)) 1268 if (nbytes > 100U + 6 * max(NR_CPUS, MAX_NUMNODES))
1273 return -E2BIG; 1269 return -E2BIG;
1274 1270
1275 /* +1 for nul-terminator */ 1271 /* +1 for nul-terminator */
@@ -1282,9 +1278,9 @@ static ssize_t cpuset_common_file_write(struct file *file,
1282 } 1278 }
1283 buffer[nbytes] = 0; /* nul-terminate */ 1279 buffer[nbytes] = 0; /* nul-terminate */
1284 1280
1285 mutex_lock(&manage_mutex); 1281 cgroup_lock();
1286 1282
1287 if (is_removed(cs)) { 1283 if (cgroup_is_removed(cont)) {
1288 retval = -ENODEV; 1284 retval = -ENODEV;
1289 goto out2; 1285 goto out2;
1290 } 1286 }
@@ -1302,8 +1298,8 @@ static ssize_t cpuset_common_file_write(struct file *file,
1302 case FILE_MEM_EXCLUSIVE: 1298 case FILE_MEM_EXCLUSIVE:
1303 retval = update_flag(CS_MEM_EXCLUSIVE, cs, buffer); 1299 retval = update_flag(CS_MEM_EXCLUSIVE, cs, buffer);
1304 break; 1300 break;
1305 case FILE_NOTIFY_ON_RELEASE: 1301 case FILE_SCHED_LOAD_BALANCE:
1306 retval = update_flag(CS_NOTIFY_ON_RELEASE, cs, buffer); 1302 retval = update_flag(CS_SCHED_LOAD_BALANCE, cs, buffer);
1307 break; 1303 break;
1308 case FILE_MEMORY_MIGRATE: 1304 case FILE_MEMORY_MIGRATE:
1309 retval = update_flag(CS_MEMORY_MIGRATE, cs, buffer); 1305 retval = update_flag(CS_MEMORY_MIGRATE, cs, buffer);
@@ -1322,9 +1318,6 @@ static ssize_t cpuset_common_file_write(struct file *file,
1322 retval = update_flag(CS_SPREAD_SLAB, cs, buffer); 1318 retval = update_flag(CS_SPREAD_SLAB, cs, buffer);
1323 cs->mems_generation = cpuset_mems_generation++; 1319 cs->mems_generation = cpuset_mems_generation++;
1324 break; 1320 break;
1325 case FILE_TASKLIST:
1326 retval = attach_task(cs, buffer, &pathbuf);
1327 break;
1328 default: 1321 default:
1329 retval = -EINVAL; 1322 retval = -EINVAL;
1330 goto out2; 1323 goto out2;
@@ -1333,30 +1326,12 @@ static ssize_t cpuset_common_file_write(struct file *file,
1333 if (retval == 0) 1326 if (retval == 0)
1334 retval = nbytes; 1327 retval = nbytes;
1335out2: 1328out2:
1336 mutex_unlock(&manage_mutex); 1329 cgroup_unlock();
1337 cpuset_release_agent(pathbuf);
1338out1: 1330out1:
1339 kfree(buffer); 1331 kfree(buffer);
1340 return retval; 1332 return retval;
1341} 1333}
1342 1334
1343static ssize_t cpuset_file_write(struct file *file, const char __user *buf,
1344 size_t nbytes, loff_t *ppos)
1345{
1346 ssize_t retval = 0;
1347 struct cftype *cft = __d_cft(file->f_path.dentry);
1348 if (!cft)
1349 return -ENODEV;
1350
1351 /* special function ? */
1352 if (cft->write)
1353 retval = cft->write(file, buf, nbytes, ppos);
1354 else
1355 retval = cpuset_common_file_write(file, buf, nbytes, ppos);
1356
1357 return retval;
1358}
1359
1360/* 1335/*
1361 * These ascii lists should be read in a single call, by using a user 1336 * These ascii lists should be read in a single call, by using a user
1362 * buffer large enough to hold the entire map. If read in smaller 1337 * buffer large enough to hold the entire map. If read in smaller
@@ -1391,11 +1366,13 @@ static int cpuset_sprintf_memlist(char *page, struct cpuset *cs)
1391 return nodelist_scnprintf(page, PAGE_SIZE, mask); 1366 return nodelist_scnprintf(page, PAGE_SIZE, mask);
1392} 1367}
1393 1368
1394static ssize_t cpuset_common_file_read(struct file *file, char __user *buf, 1369static ssize_t cpuset_common_file_read(struct cgroup *cont,
1395 size_t nbytes, loff_t *ppos) 1370 struct cftype *cft,
1371 struct file *file,
1372 char __user *buf,
1373 size_t nbytes, loff_t *ppos)
1396{ 1374{
1397 struct cftype *cft = __d_cft(file->f_path.dentry); 1375 struct cpuset *cs = cgroup_cs(cont);
1398 struct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);
1399 cpuset_filetype_t type = cft->private; 1376 cpuset_filetype_t type = cft->private;
1400 char *page; 1377 char *page;
1401 ssize_t retval = 0; 1378 ssize_t retval = 0;
@@ -1419,8 +1396,8 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
1419 case FILE_MEM_EXCLUSIVE: 1396 case FILE_MEM_EXCLUSIVE:
1420 *s++ = is_mem_exclusive(cs) ? '1' : '0'; 1397 *s++ = is_mem_exclusive(cs) ? '1' : '0';
1421 break; 1398 break;
1422 case FILE_NOTIFY_ON_RELEASE: 1399 case FILE_SCHED_LOAD_BALANCE:
1423 *s++ = notify_on_release(cs) ? '1' : '0'; 1400 *s++ = is_sched_load_balance(cs) ? '1' : '0';
1424 break; 1401 break;
1425 case FILE_MEMORY_MIGRATE: 1402 case FILE_MEMORY_MIGRATE:
1426 *s++ = is_memory_migrate(cs) ? '1' : '0'; 1403 *s++ = is_memory_migrate(cs) ? '1' : '0';
@@ -1449,390 +1426,150 @@ out:
1449 return retval; 1426 return retval;
1450} 1427}
1451 1428
1452static ssize_t cpuset_file_read(struct file *file, char __user *buf, size_t nbytes,
1453 loff_t *ppos)
1454{
1455 ssize_t retval = 0;
1456 struct cftype *cft = __d_cft(file->f_path.dentry);
1457 if (!cft)
1458 return -ENODEV;
1459
1460 /* special function ? */
1461 if (cft->read)
1462 retval = cft->read(file, buf, nbytes, ppos);
1463 else
1464 retval = cpuset_common_file_read(file, buf, nbytes, ppos);
1465
1466 return retval;
1467}
1468 1429
1469static int cpuset_file_open(struct inode *inode, struct file *file)
1470{
1471 int err;
1472 struct cftype *cft;
1473 1430
1474 err = generic_file_open(inode, file);
1475 if (err)
1476 return err;
1477 1431
1478 cft = __d_cft(file->f_path.dentry);
1479 if (!cft)
1480 return -ENODEV;
1481 if (cft->open)
1482 err = cft->open(inode, file);
1483 else
1484 err = 0;
1485
1486 return err;
1487}
1488
1489static int cpuset_file_release(struct inode *inode, struct file *file)
1490{
1491 struct cftype *cft = __d_cft(file->f_path.dentry);
1492 if (cft->release)
1493 return cft->release(inode, file);
1494 return 0;
1495}
1496
1497/*
1498 * cpuset_rename - Only allow simple rename of directories in place.
1499 */
1500static int cpuset_rename(struct inode *old_dir, struct dentry *old_dentry,
1501 struct inode *new_dir, struct dentry *new_dentry)
1502{
1503 if (!S_ISDIR(old_dentry->d_inode->i_mode))
1504 return -ENOTDIR;
1505 if (new_dentry->d_inode)
1506 return -EEXIST;
1507 if (old_dir != new_dir)
1508 return -EIO;
1509 return simple_rename(old_dir, old_dentry, new_dir, new_dentry);
1510}
1511
1512static const struct file_operations cpuset_file_operations = {
1513 .read = cpuset_file_read,
1514 .write = cpuset_file_write,
1515 .llseek = generic_file_llseek,
1516 .open = cpuset_file_open,
1517 .release = cpuset_file_release,
1518};
1519
1520static const struct inode_operations cpuset_dir_inode_operations = {
1521 .lookup = simple_lookup,
1522 .mkdir = cpuset_mkdir,
1523 .rmdir = cpuset_rmdir,
1524 .rename = cpuset_rename,
1525};
1526
1527static int cpuset_create_file(struct dentry *dentry, int mode)
1528{
1529 struct inode *inode;
1530
1531 if (!dentry)
1532 return -ENOENT;
1533 if (dentry->d_inode)
1534 return -EEXIST;
1535
1536 inode = cpuset_new_inode(mode);
1537 if (!inode)
1538 return -ENOMEM;
1539
1540 if (S_ISDIR(mode)) {
1541 inode->i_op = &cpuset_dir_inode_operations;
1542 inode->i_fop = &simple_dir_operations;
1543
1544 /* start off with i_nlink == 2 (for "." entry) */
1545 inc_nlink(inode);
1546 } else if (S_ISREG(mode)) {
1547 inode->i_size = 0;
1548 inode->i_fop = &cpuset_file_operations;
1549 }
1550
1551 d_instantiate(dentry, inode);
1552 dget(dentry); /* Extra count - pin the dentry in core */
1553 return 0;
1554}
1555
1556/*
1557 * cpuset_create_dir - create a directory for an object.
1558 * cs: the cpuset we create the directory for.
1559 * It must have a valid ->parent field
1560 * And we are going to fill its ->dentry field.
1561 * name: The name to give to the cpuset directory. Will be copied.
1562 * mode: mode to set on new directory.
1563 */
1564
1565static int cpuset_create_dir(struct cpuset *cs, const char *name, int mode)
1566{
1567 struct dentry *dentry = NULL;
1568 struct dentry *parent;
1569 int error = 0;
1570
1571 parent = cs->parent->dentry;
1572 dentry = cpuset_get_dentry(parent, name);
1573 if (IS_ERR(dentry))
1574 return PTR_ERR(dentry);
1575 error = cpuset_create_file(dentry, S_IFDIR | mode);
1576 if (!error) {
1577 dentry->d_fsdata = cs;
1578 inc_nlink(parent->d_inode);
1579 cs->dentry = dentry;
1580 }
1581 dput(dentry);
1582
1583 return error;
1584}
1585
1586static int cpuset_add_file(struct dentry *dir, const struct cftype *cft)
1587{
1588 struct dentry *dentry;
1589 int error;
1590
1591 mutex_lock(&dir->d_inode->i_mutex);
1592 dentry = cpuset_get_dentry(dir, cft->name);
1593 if (!IS_ERR(dentry)) {
1594 error = cpuset_create_file(dentry, 0644 | S_IFREG);
1595 if (!error)
1596 dentry->d_fsdata = (void *)cft;
1597 dput(dentry);
1598 } else
1599 error = PTR_ERR(dentry);
1600 mutex_unlock(&dir->d_inode->i_mutex);
1601 return error;
1602}
1603
1604/*
1605 * Stuff for reading the 'tasks' file.
1606 *
1607 * Reading this file can return large amounts of data if a cpuset has
1608 * *lots* of attached tasks. So it may need several calls to read(),
1609 * but we cannot guarantee that the information we produce is correct
1610 * unless we produce it entirely atomically.
1611 *
1612 * Upon tasks file open(), a struct ctr_struct is allocated, that
1613 * will have a pointer to an array (also allocated here). The struct
1614 * ctr_struct * is stored in file->private_data. Its resources will
1615 * be freed by release() when the file is closed. The array is used
1616 * to sprintf the PIDs and then used by read().
1617 */
1618
1619/* cpusets_tasks_read array */
1620
1621struct ctr_struct {
1622 char *buf;
1623 int bufsz;
1624};
1625
1626/*
1627 * Load into 'pidarray' up to 'npids' of the tasks using cpuset 'cs'.
1628 * Return actual number of pids loaded. No need to task_lock(p)
1629 * when reading out p->cpuset, as we don't really care if it changes
1630 * on the next cycle, and we are not going to try to dereference it.
1631 */
1632static int pid_array_load(pid_t *pidarray, int npids, struct cpuset *cs)
1633{
1634 int n = 0;
1635 struct task_struct *g, *p;
1636
1637 read_lock(&tasklist_lock);
1638
1639 do_each_thread(g, p) {
1640 if (p->cpuset == cs) {
1641 if (unlikely(n == npids))
1642 goto array_full;
1643 pidarray[n++] = p->pid;
1644 }
1645 } while_each_thread(g, p);
1646
1647array_full:
1648 read_unlock(&tasklist_lock);
1649 return n;
1650}
1651
1652static int cmppid(const void *a, const void *b)
1653{
1654 return *(pid_t *)a - *(pid_t *)b;
1655}
1656
1657/*
1658 * Convert array 'a' of 'npids' pid_t's to a string of newline separated
1659 * decimal pids in 'buf'. Don't write more than 'sz' chars, but return
1660 * count 'cnt' of how many chars would be written if buf were large enough.
1661 */
1662static int pid_array_to_buf(char *buf, int sz, pid_t *a, int npids)
1663{
1664 int cnt = 0;
1665 int i;
1666
1667 for (i = 0; i < npids; i++)
1668 cnt += snprintf(buf + cnt, max(sz - cnt, 0), "%d\n", a[i]);
1669 return cnt;
1670}
1671
1672/*
1673 * Handle an open on 'tasks' file. Prepare a buffer listing the
1674 * process id's of tasks currently attached to the cpuset being opened.
1675 *
1676 * Does not require any specific cpuset mutexes, and does not take any.
1677 */
1678static int cpuset_tasks_open(struct inode *unused, struct file *file)
1679{
1680 struct cpuset *cs = __d_cs(file->f_path.dentry->d_parent);
1681 struct ctr_struct *ctr;
1682 pid_t *pidarray;
1683 int npids;
1684 char c;
1685
1686 if (!(file->f_mode & FMODE_READ))
1687 return 0;
1688
1689 ctr = kmalloc(sizeof(*ctr), GFP_KERNEL);
1690 if (!ctr)
1691 goto err0;
1692
1693 /*
1694 * If cpuset gets more users after we read count, we won't have
1695 * enough space - tough. This race is indistinguishable to the
1696 * caller from the case that the additional cpuset users didn't
1697 * show up until sometime later on.
1698 */
1699 npids = atomic_read(&cs->count);
1700 pidarray = kmalloc(npids * sizeof(pid_t), GFP_KERNEL);
1701 if (!pidarray)
1702 goto err1;
1703
1704 npids = pid_array_load(pidarray, npids, cs);
1705 sort(pidarray, npids, sizeof(pid_t), cmppid, NULL);
1706
1707 /* Call pid_array_to_buf() twice, first just to get bufsz */
1708 ctr->bufsz = pid_array_to_buf(&c, sizeof(c), pidarray, npids) + 1;
1709 ctr->buf = kmalloc(ctr->bufsz, GFP_KERNEL);
1710 if (!ctr->buf)
1711 goto err2;
1712 ctr->bufsz = pid_array_to_buf(ctr->buf, ctr->bufsz, pidarray, npids);
1713
1714 kfree(pidarray);
1715 file->private_data = ctr;
1716 return 0;
1717
1718err2:
1719 kfree(pidarray);
1720err1:
1721 kfree(ctr);
1722err0:
1723 return -ENOMEM;
1724}
1725
1726static ssize_t cpuset_tasks_read(struct file *file, char __user *buf,
1727 size_t nbytes, loff_t *ppos)
1728{
1729 struct ctr_struct *ctr = file->private_data;
1730
1731 return simple_read_from_buffer(buf, nbytes, ppos, ctr->buf, ctr->bufsz);
1732}
1733
1734static int cpuset_tasks_release(struct inode *unused_inode, struct file *file)
1735{
1736 struct ctr_struct *ctr;
1737
1738 if (file->f_mode & FMODE_READ) {
1739 ctr = file->private_data;
1740 kfree(ctr->buf);
1741 kfree(ctr);
1742 }
1743 return 0;
1744}
1745 1432
1746/* 1433/*
1747 * for the common functions, 'private' gives the type of file 1434 * for the common functions, 'private' gives the type of file
1748 */ 1435 */
1749 1436
1750static struct cftype cft_tasks = {
1751 .name = "tasks",
1752 .open = cpuset_tasks_open,
1753 .read = cpuset_tasks_read,
1754 .release = cpuset_tasks_release,
1755 .private = FILE_TASKLIST,
1756};
1757
1758static struct cftype cft_cpus = { 1437static struct cftype cft_cpus = {
1759 .name = "cpus", 1438 .name = "cpus",
1439 .read = cpuset_common_file_read,
1440 .write = cpuset_common_file_write,
1760 .private = FILE_CPULIST, 1441 .private = FILE_CPULIST,
1761}; 1442};
1762 1443
1763static struct cftype cft_mems = { 1444static struct cftype cft_mems = {
1764 .name = "mems", 1445 .name = "mems",
1446 .read = cpuset_common_file_read,
1447 .write = cpuset_common_file_write,
1765 .private = FILE_MEMLIST, 1448 .private = FILE_MEMLIST,
1766}; 1449};
1767 1450
1768static struct cftype cft_cpu_exclusive = { 1451static struct cftype cft_cpu_exclusive = {
1769 .name = "cpu_exclusive", 1452 .name = "cpu_exclusive",
1453 .read = cpuset_common_file_read,
1454 .write = cpuset_common_file_write,
1770 .private = FILE_CPU_EXCLUSIVE, 1455 .private = FILE_CPU_EXCLUSIVE,
1771}; 1456};
1772 1457
1773static struct cftype cft_mem_exclusive = { 1458static struct cftype cft_mem_exclusive = {
1774 .name = "mem_exclusive", 1459 .name = "mem_exclusive",
1460 .read = cpuset_common_file_read,
1461 .write = cpuset_common_file_write,
1775 .private = FILE_MEM_EXCLUSIVE, 1462 .private = FILE_MEM_EXCLUSIVE,
1776}; 1463};
1777 1464
1778static struct cftype cft_notify_on_release = { 1465static struct cftype cft_sched_load_balance = {
1779 .name = "notify_on_release", 1466 .name = "sched_load_balance",
1780 .private = FILE_NOTIFY_ON_RELEASE, 1467 .read = cpuset_common_file_read,
1468 .write = cpuset_common_file_write,
1469 .private = FILE_SCHED_LOAD_BALANCE,
1781}; 1470};
1782 1471
1783static struct cftype cft_memory_migrate = { 1472static struct cftype cft_memory_migrate = {
1784 .name = "memory_migrate", 1473 .name = "memory_migrate",
1474 .read = cpuset_common_file_read,
1475 .write = cpuset_common_file_write,
1785 .private = FILE_MEMORY_MIGRATE, 1476 .private = FILE_MEMORY_MIGRATE,
1786}; 1477};
1787 1478
1788static struct cftype cft_memory_pressure_enabled = { 1479static struct cftype cft_memory_pressure_enabled = {
1789 .name = "memory_pressure_enabled", 1480 .name = "memory_pressure_enabled",
1481 .read = cpuset_common_file_read,
1482 .write = cpuset_common_file_write,
1790 .private = FILE_MEMORY_PRESSURE_ENABLED, 1483 .private = FILE_MEMORY_PRESSURE_ENABLED,
1791}; 1484};
1792 1485
1793static struct cftype cft_memory_pressure = { 1486static struct cftype cft_memory_pressure = {
1794 .name = "memory_pressure", 1487 .name = "memory_pressure",
1488 .read = cpuset_common_file_read,
1489 .write = cpuset_common_file_write,
1795 .private = FILE_MEMORY_PRESSURE, 1490 .private = FILE_MEMORY_PRESSURE,
1796}; 1491};
1797 1492
1798static struct cftype cft_spread_page = { 1493static struct cftype cft_spread_page = {
1799 .name = "memory_spread_page", 1494 .name = "memory_spread_page",
1495 .read = cpuset_common_file_read,
1496 .write = cpuset_common_file_write,
1800 .private = FILE_SPREAD_PAGE, 1497 .private = FILE_SPREAD_PAGE,
1801}; 1498};
1802 1499
1803static struct cftype cft_spread_slab = { 1500static struct cftype cft_spread_slab = {
1804 .name = "memory_spread_slab", 1501 .name = "memory_spread_slab",
1502 .read = cpuset_common_file_read,
1503 .write = cpuset_common_file_write,
1805 .private = FILE_SPREAD_SLAB, 1504 .private = FILE_SPREAD_SLAB,
1806}; 1505};
1807 1506
1808static int cpuset_populate_dir(struct dentry *cs_dentry) 1507static int cpuset_populate(struct cgroup_subsys *ss, struct cgroup *cont)
1809{ 1508{
1810 int err; 1509 int err;
1811 1510
1812 if ((err = cpuset_add_file(cs_dentry, &cft_cpus)) < 0) 1511 if ((err = cgroup_add_file(cont, ss, &cft_cpus)) < 0)
1813 return err;
1814 if ((err = cpuset_add_file(cs_dentry, &cft_mems)) < 0)
1815 return err; 1512 return err;
1816 if ((err = cpuset_add_file(cs_dentry, &cft_cpu_exclusive)) < 0) 1513 if ((err = cgroup_add_file(cont, ss, &cft_mems)) < 0)
1817 return err; 1514 return err;
1818 if ((err = cpuset_add_file(cs_dentry, &cft_mem_exclusive)) < 0) 1515 if ((err = cgroup_add_file(cont, ss, &cft_cpu_exclusive)) < 0)
1819 return err; 1516 return err;
1820 if ((err = cpuset_add_file(cs_dentry, &cft_notify_on_release)) < 0) 1517 if ((err = cgroup_add_file(cont, ss, &cft_mem_exclusive)) < 0)
1821 return err; 1518 return err;
1822 if ((err = cpuset_add_file(cs_dentry, &cft_memory_migrate)) < 0) 1519 if ((err = cgroup_add_file(cont, ss, &cft_memory_migrate)) < 0)
1823 return err; 1520 return err;
1824 if ((err = cpuset_add_file(cs_dentry, &cft_memory_pressure)) < 0) 1521 if ((err = cgroup_add_file(cont, ss, &cft_sched_load_balance)) < 0)
1825 return err; 1522 return err;
1826 if ((err = cpuset_add_file(cs_dentry, &cft_spread_page)) < 0) 1523 if ((err = cgroup_add_file(cont, ss, &cft_memory_pressure)) < 0)
1827 return err; 1524 return err;
1828 if ((err = cpuset_add_file(cs_dentry, &cft_spread_slab)) < 0) 1525 if ((err = cgroup_add_file(cont, ss, &cft_spread_page)) < 0)
1829 return err; 1526 return err;
1830 if ((err = cpuset_add_file(cs_dentry, &cft_tasks)) < 0) 1527 if ((err = cgroup_add_file(cont, ss, &cft_spread_slab)) < 0)
1831 return err; 1528 return err;
1529 /* memory_pressure_enabled is in root cpuset only */
1530 if (err == 0 && !cont->parent)
1531 err = cgroup_add_file(cont, ss,
1532 &cft_memory_pressure_enabled);
1832 return 0; 1533 return 0;
1833} 1534}
1834 1535
1835/* 1536/*
1537 * post_clone() is called at the end of cgroup_clone().
1538 * 'cgroup' was just created automatically as a result of
1539 * a cgroup_clone(), and the current task is about to
1540 * be moved into 'cgroup'.
1541 *
1542 * Currently we refuse to set up the cgroup - thereby
1543 * refusing the task to be entered, and as a result refusing
1544 * the sys_unshare() or clone() which initiated it - if any
1545 * sibling cpusets have exclusive cpus or mem.
1546 *
1547 * If this becomes a problem for some users who wish to
1548 * allow that scenario, then cpuset_post_clone() could be
1549 * changed to grant parent->cpus_allowed-sibling_cpus_exclusive
1550 * (and likewise for mems) to the new cgroup.
1551 */
1552static void cpuset_post_clone(struct cgroup_subsys *ss,
1553 struct cgroup *cgroup)
1554{
1555 struct cgroup *parent, *child;
1556 struct cpuset *cs, *parent_cs;
1557
1558 parent = cgroup->parent;
1559 list_for_each_entry(child, &parent->children, sibling) {
1560 cs = cgroup_cs(child);
1561 if (is_mem_exclusive(cs) || is_cpu_exclusive(cs))
1562 return;
1563 }
1564 cs = cgroup_cs(cgroup);
1565 parent_cs = cgroup_cs(parent);
1566
1567 cs->mems_allowed = parent_cs->mems_allowed;
1568 cs->cpus_allowed = parent_cs->cpus_allowed;
1569 return;
1570}
1571
1572/*
1836 * cpuset_create - create a cpuset 1573 * cpuset_create - create a cpuset
1837 * parent: cpuset that will be parent of the new cpuset. 1574 * parent: cpuset that will be parent of the new cpuset.
1838 * name: name of the new cpuset. Will be strcpy'ed. 1575 * name: name of the new cpuset. Will be strcpy'ed.
@@ -1841,106 +1578,77 @@ static int cpuset_populate_dir(struct dentry *cs_dentry)
1841 * Must be called with the mutex on the parent inode held 1578 * Must be called with the mutex on the parent inode held
1842 */ 1579 */
1843 1580
1844static long cpuset_create(struct cpuset *parent, const char *name, int mode) 1581static struct cgroup_subsys_state *cpuset_create(
1582 struct cgroup_subsys *ss,
1583 struct cgroup *cont)
1845{ 1584{
1846 struct cpuset *cs; 1585 struct cpuset *cs;
1847 int err; 1586 struct cpuset *parent;
1848 1587
1588 if (!cont->parent) {
1589 /* This is early initialization for the top cgroup */
1590 top_cpuset.mems_generation = cpuset_mems_generation++;
1591 return &top_cpuset.css;
1592 }
1593 parent = cgroup_cs(cont->parent);
1849 cs = kmalloc(sizeof(*cs), GFP_KERNEL); 1594 cs = kmalloc(sizeof(*cs), GFP_KERNEL);
1850 if (!cs) 1595 if (!cs)
1851 return -ENOMEM; 1596 return ERR_PTR(-ENOMEM);
1852 1597
1853 mutex_lock(&manage_mutex);
1854 cpuset_update_task_memory_state(); 1598 cpuset_update_task_memory_state();
1855 cs->flags = 0; 1599 cs->flags = 0;
1856 if (notify_on_release(parent))
1857 set_bit(CS_NOTIFY_ON_RELEASE, &cs->flags);
1858 if (is_spread_page(parent)) 1600 if (is_spread_page(parent))
1859 set_bit(CS_SPREAD_PAGE, &cs->flags); 1601 set_bit(CS_SPREAD_PAGE, &cs->flags);
1860 if (is_spread_slab(parent)) 1602 if (is_spread_slab(parent))
1861 set_bit(CS_SPREAD_SLAB, &cs->flags); 1603 set_bit(CS_SPREAD_SLAB, &cs->flags);
1604 set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
1862 cs->cpus_allowed = CPU_MASK_NONE; 1605 cs->cpus_allowed = CPU_MASK_NONE;
1863 cs->mems_allowed = NODE_MASK_NONE; 1606 cs->mems_allowed = NODE_MASK_NONE;
1864 atomic_set(&cs->count, 0);
1865 INIT_LIST_HEAD(&cs->sibling);
1866 INIT_LIST_HEAD(&cs->children);
1867 cs->mems_generation = cpuset_mems_generation++; 1607 cs->mems_generation = cpuset_mems_generation++;
1868 fmeter_init(&cs->fmeter); 1608 fmeter_init(&cs->fmeter);
1869 1609
1870 cs->parent = parent; 1610 cs->parent = parent;
1871
1872 mutex_lock(&callback_mutex);
1873 list_add(&cs->sibling, &cs->parent->children);
1874 number_of_cpusets++; 1611 number_of_cpusets++;
1875 mutex_unlock(&callback_mutex); 1612 return &cs->css ;
1876
1877 err = cpuset_create_dir(cs, name, mode);
1878 if (err < 0)
1879 goto err;
1880
1881 /*
1882 * Release manage_mutex before cpuset_populate_dir() because it
1883 * will down() this new directory's i_mutex and if we race with
1884 * another mkdir, we might deadlock.
1885 */
1886 mutex_unlock(&manage_mutex);
1887
1888 err = cpuset_populate_dir(cs->dentry);
1889 /* If err < 0, we have a half-filled directory - oh well ;) */
1890 return 0;
1891err:
1892 list_del(&cs->sibling);
1893 mutex_unlock(&manage_mutex);
1894 kfree(cs);
1895 return err;
1896} 1613}
1897 1614
1898static int cpuset_mkdir(struct inode *dir, struct dentry *dentry, int mode) 1615/*
1899{ 1616 * Locking note on the strange update_flag() call below:
1900 struct cpuset *c_parent = dentry->d_parent->d_fsdata; 1617 *
1901 1618 * If the cpuset being removed has its flag 'sched_load_balance'
1902 /* the vfs holds inode->i_mutex already */ 1619 * enabled, then simulate turning sched_load_balance off, which
1903 return cpuset_create(c_parent, dentry->d_name.name, mode | S_IFDIR); 1620 * will call rebuild_sched_domains(). The lock_cpu_hotplug()
1904} 1621 * call in rebuild_sched_domains() must not be made while holding
1622 * callback_mutex. Elsewhere the kernel nests callback_mutex inside
1623 * lock_cpu_hotplug() calls. So the reverse nesting would risk an
1624 * ABBA deadlock.
1625 */
1905 1626
1906static int cpuset_rmdir(struct inode *unused_dir, struct dentry *dentry) 1627static void cpuset_destroy(struct cgroup_subsys *ss, struct cgroup *cont)
1907{ 1628{
1908 struct cpuset *cs = dentry->d_fsdata; 1629 struct cpuset *cs = cgroup_cs(cont);
1909 struct dentry *d;
1910 struct cpuset *parent;
1911 char *pathbuf = NULL;
1912 1630
1913 /* the vfs holds both inode->i_mutex already */
1914
1915 mutex_lock(&manage_mutex);
1916 cpuset_update_task_memory_state(); 1631 cpuset_update_task_memory_state();
1917 if (atomic_read(&cs->count) > 0) { 1632
1918 mutex_unlock(&manage_mutex); 1633 if (is_sched_load_balance(cs))
1919 return -EBUSY; 1634 update_flag(CS_SCHED_LOAD_BALANCE, cs, "0");
1920 } 1635
1921 if (!list_empty(&cs->children)) {
1922 mutex_unlock(&manage_mutex);
1923 return -EBUSY;
1924 }
1925 parent = cs->parent;
1926 mutex_lock(&callback_mutex);
1927 set_bit(CS_REMOVED, &cs->flags);
1928 list_del(&cs->sibling); /* delete my sibling from parent->children */
1929 spin_lock(&cs->dentry->d_lock);
1930 d = dget(cs->dentry);
1931 cs->dentry = NULL;
1932 spin_unlock(&d->d_lock);
1933 cpuset_d_remove_dir(d);
1934 dput(d);
1935 number_of_cpusets--; 1636 number_of_cpusets--;
1936 mutex_unlock(&callback_mutex); 1637 kfree(cs);
1937 if (list_empty(&parent->children))
1938 check_for_release(parent, &pathbuf);
1939 mutex_unlock(&manage_mutex);
1940 cpuset_release_agent(pathbuf);
1941 return 0;
1942} 1638}
1943 1639
1640struct cgroup_subsys cpuset_subsys = {
1641 .name = "cpuset",
1642 .create = cpuset_create,
1643 .destroy = cpuset_destroy,
1644 .can_attach = cpuset_can_attach,
1645 .attach = cpuset_attach,
1646 .populate = cpuset_populate,
1647 .post_clone = cpuset_post_clone,
1648 .subsys_id = cpuset_subsys_id,
1649 .early_init = 1,
1650};
1651
1944/* 1652/*
1945 * cpuset_init_early - just enough so that the calls to 1653 * cpuset_init_early - just enough so that the calls to
1946 * cpuset_update_task_memory_state() in early init code 1654 * cpuset_update_task_memory_state() in early init code
@@ -1949,13 +1657,11 @@ static int cpuset_rmdir(struct inode *unused_dir, struct dentry *dentry)
1949 1657
1950int __init cpuset_init_early(void) 1658int __init cpuset_init_early(void)
1951{ 1659{
1952 struct task_struct *tsk = current; 1660 top_cpuset.mems_generation = cpuset_mems_generation++;
1953
1954 tsk->cpuset = &top_cpuset;
1955 tsk->cpuset->mems_generation = cpuset_mems_generation++;
1956 return 0; 1661 return 0;
1957} 1662}
1958 1663
1664
1959/** 1665/**
1960 * cpuset_init - initialize cpusets at system boot 1666 * cpuset_init - initialize cpusets at system boot
1961 * 1667 *
@@ -1964,39 +1670,21 @@ int __init cpuset_init_early(void)
1964 1670
1965int __init cpuset_init(void) 1671int __init cpuset_init(void)
1966{ 1672{
1967 struct dentry *root; 1673 int err = 0;
1968 int err;
1969 1674
1970 top_cpuset.cpus_allowed = CPU_MASK_ALL; 1675 top_cpuset.cpus_allowed = CPU_MASK_ALL;
1971 top_cpuset.mems_allowed = NODE_MASK_ALL; 1676 top_cpuset.mems_allowed = NODE_MASK_ALL;
1972 1677
1973 fmeter_init(&top_cpuset.fmeter); 1678 fmeter_init(&top_cpuset.fmeter);
1974 top_cpuset.mems_generation = cpuset_mems_generation++; 1679 top_cpuset.mems_generation = cpuset_mems_generation++;
1975 1680 set_bit(CS_SCHED_LOAD_BALANCE, &top_cpuset.flags);
1976 init_task.cpuset = &top_cpuset;
1977 1681
1978 err = register_filesystem(&cpuset_fs_type); 1682 err = register_filesystem(&cpuset_fs_type);
1979 if (err < 0) 1683 if (err < 0)
1980 goto out; 1684 return err;
1981 cpuset_mount = kern_mount(&cpuset_fs_type); 1685
1982 if (IS_ERR(cpuset_mount)) {
1983 printk(KERN_ERR "cpuset: could not mount!\n");
1984 err = PTR_ERR(cpuset_mount);
1985 cpuset_mount = NULL;
1986 goto out;
1987 }
1988 root = cpuset_mount->mnt_sb->s_root;
1989 root->d_fsdata = &top_cpuset;
1990 inc_nlink(root->d_inode);
1991 top_cpuset.dentry = root;
1992 root->d_inode->i_op = &cpuset_dir_inode_operations;
1993 number_of_cpusets = 1; 1686 number_of_cpusets = 1;
1994 err = cpuset_populate_dir(root); 1687 return 0;
1995 /* memory_pressure_enabled is in root cpuset only */
1996 if (err == 0)
1997 err = cpuset_add_file(root, &cft_memory_pressure_enabled);
1998out:
1999 return err;
2000} 1688}
2001 1689
2002/* 1690/*
@@ -2022,10 +1710,12 @@ out:
2022 1710
2023static void guarantee_online_cpus_mems_in_subtree(const struct cpuset *cur) 1711static void guarantee_online_cpus_mems_in_subtree(const struct cpuset *cur)
2024{ 1712{
1713 struct cgroup *cont;
2025 struct cpuset *c; 1714 struct cpuset *c;
2026 1715
2027 /* Each of our child cpusets mems must be online */ 1716 /* Each of our child cpusets mems must be online */
2028 list_for_each_entry(c, &cur->children, sibling) { 1717 list_for_each_entry(cont, &cur->css.cgroup->children, sibling) {
1718 c = cgroup_cs(cont);
2029 guarantee_online_cpus_mems_in_subtree(c); 1719 guarantee_online_cpus_mems_in_subtree(c);
2030 if (!cpus_empty(c->cpus_allowed)) 1720 if (!cpus_empty(c->cpus_allowed))
2031 guarantee_online_cpus(c, &c->cpus_allowed); 1721 guarantee_online_cpus(c, &c->cpus_allowed);
@@ -2053,7 +1743,7 @@ static void guarantee_online_cpus_mems_in_subtree(const struct cpuset *cur)
2053 1743
2054static void common_cpu_mem_hotplug_unplug(void) 1744static void common_cpu_mem_hotplug_unplug(void)
2055{ 1745{
2056 mutex_lock(&manage_mutex); 1746 cgroup_lock();
2057 mutex_lock(&callback_mutex); 1747 mutex_lock(&callback_mutex);
2058 1748
2059 guarantee_online_cpus_mems_in_subtree(&top_cpuset); 1749 guarantee_online_cpus_mems_in_subtree(&top_cpuset);
@@ -2061,7 +1751,7 @@ static void common_cpu_mem_hotplug_unplug(void)
2061 top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY]; 1751 top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
2062 1752
2063 mutex_unlock(&callback_mutex); 1753 mutex_unlock(&callback_mutex);
2064 mutex_unlock(&manage_mutex); 1754 cgroup_unlock();
2065} 1755}
2066 1756
2067/* 1757/*
@@ -2074,8 +1764,8 @@ static void common_cpu_mem_hotplug_unplug(void)
2074 * cpu_online_map on each CPU hotplug (cpuhp) event. 1764 * cpu_online_map on each CPU hotplug (cpuhp) event.
2075 */ 1765 */
2076 1766
2077static int cpuset_handle_cpuhp(struct notifier_block *nb, 1767static int cpuset_handle_cpuhp(struct notifier_block *unused_nb,
2078 unsigned long phase, void *cpu) 1768 unsigned long phase, void *unused_cpu)
2079{ 1769{
2080 if (phase == CPU_DYING || phase == CPU_DYING_FROZEN) 1770 if (phase == CPU_DYING || phase == CPU_DYING_FROZEN)
2081 return NOTIFY_DONE; 1771 return NOTIFY_DONE;
@@ -2113,109 +1803,7 @@ void __init cpuset_init_smp(void)
2113} 1803}
2114 1804
2115/** 1805/**
2116 * cpuset_fork - attach newly forked task to its parents cpuset.
2117 * @tsk: pointer to task_struct of forking parent process.
2118 *
2119 * Description: A task inherits its parent's cpuset at fork().
2120 *
2121 * A pointer to the shared cpuset was automatically copied in fork.c
2122 * by dup_task_struct(). However, we ignore that copy, since it was
2123 * not made under the protection of task_lock(), so might no longer be
2124 * a valid cpuset pointer. attach_task() might have already changed
2125 * current->cpuset, allowing the previously referenced cpuset to
2126 * be removed and freed. Instead, we task_lock(current) and copy
2127 * its present value of current->cpuset for our freshly forked child.
2128 *
2129 * At the point that cpuset_fork() is called, 'current' is the parent
2130 * task, and the passed argument 'child' points to the child task.
2131 **/
2132
2133void cpuset_fork(struct task_struct *child)
2134{
2135 task_lock(current);
2136 child->cpuset = current->cpuset;
2137 atomic_inc(&child->cpuset->count);
2138 task_unlock(current);
2139}
2140
2141/**
2142 * cpuset_exit - detach cpuset from exiting task
2143 * @tsk: pointer to task_struct of exiting process
2144 *
2145 * Description: Detach cpuset from @tsk and release it.
2146 *
2147 * Note that cpusets marked notify_on_release force every task in
2148 * them to take the global manage_mutex mutex when exiting.
2149 * This could impact scaling on very large systems. Be reluctant to
2150 * use notify_on_release cpusets where very high task exit scaling
2151 * is required on large systems.
2152 *
2153 * Don't even think about derefencing 'cs' after the cpuset use count
2154 * goes to zero, except inside a critical section guarded by manage_mutex
2155 * or callback_mutex. Otherwise a zero cpuset use count is a license to
2156 * any other task to nuke the cpuset immediately, via cpuset_rmdir().
2157 *
2158 * This routine has to take manage_mutex, not callback_mutex, because
2159 * it is holding that mutex while calling check_for_release(),
2160 * which calls kmalloc(), so can't be called holding callback_mutex().
2161 *
2162 * the_top_cpuset_hack:
2163 *
2164 * Set the exiting tasks cpuset to the root cpuset (top_cpuset).
2165 *
2166 * Don't leave a task unable to allocate memory, as that is an
2167 * accident waiting to happen should someone add a callout in
2168 * do_exit() after the cpuset_exit() call that might allocate.
2169 * If a task tries to allocate memory with an invalid cpuset,
2170 * it will oops in cpuset_update_task_memory_state().
2171 *
2172 * We call cpuset_exit() while the task is still competent to
2173 * handle notify_on_release(), then leave the task attached to
2174 * the root cpuset (top_cpuset) for the remainder of its exit.
2175 *
2176 * To do this properly, we would increment the reference count on
2177 * top_cpuset, and near the very end of the kernel/exit.c do_exit()
2178 * code we would add a second cpuset function call, to drop that
2179 * reference. This would just create an unnecessary hot spot on
2180 * the top_cpuset reference count, to no avail.
2181 *
2182 * Normally, holding a reference to a cpuset without bumping its
2183 * count is unsafe. The cpuset could go away, or someone could
2184 * attach us to a different cpuset, decrementing the count on
2185 * the first cpuset that we never incremented. But in this case,
2186 * top_cpuset isn't going away, and either task has PF_EXITING set,
2187 * which wards off any attach_task() attempts, or task is a failed
2188 * fork, never visible to attach_task.
2189 *
2190 * Another way to do this would be to set the cpuset pointer
2191 * to NULL here, and check in cpuset_update_task_memory_state()
2192 * for a NULL pointer. This hack avoids that NULL check, for no
2193 * cost (other than this way too long comment ;).
2194 **/
2195
2196void cpuset_exit(struct task_struct *tsk)
2197{
2198 struct cpuset *cs;
2199
2200 task_lock(current);
2201 cs = tsk->cpuset;
2202 tsk->cpuset = &top_cpuset; /* the_top_cpuset_hack - see above */
2203 task_unlock(current);
2204
2205 if (notify_on_release(cs)) {
2206 char *pathbuf = NULL;
2207 1806
2208 mutex_lock(&manage_mutex);
2209 if (atomic_dec_and_test(&cs->count))
2210 check_for_release(cs, &pathbuf);
2211 mutex_unlock(&manage_mutex);
2212 cpuset_release_agent(pathbuf);
2213 } else {
2214 atomic_dec(&cs->count);
2215 }
2216}
2217
2218/**
2219 * cpuset_cpus_allowed - return cpus_allowed mask from a tasks cpuset. 1807 * cpuset_cpus_allowed - return cpus_allowed mask from a tasks cpuset.
2220 * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed. 1808 * @tsk: pointer to task_struct from which to obtain cpuset->cpus_allowed.
2221 * 1809 *
@@ -2230,10 +1818,23 @@ cpumask_t cpuset_cpus_allowed(struct task_struct *tsk)
2230 cpumask_t mask; 1818 cpumask_t mask;
2231 1819
2232 mutex_lock(&callback_mutex); 1820 mutex_lock(&callback_mutex);
1821 mask = cpuset_cpus_allowed_locked(tsk);
1822 mutex_unlock(&callback_mutex);
1823
1824 return mask;
1825}
1826
1827/**
1828 * cpuset_cpus_allowed_locked - return cpus_allowed mask from a tasks cpuset.
1829 * Must be called with callback_mutex held.
1830 **/
1831cpumask_t cpuset_cpus_allowed_locked(struct task_struct *tsk)
1832{
1833 cpumask_t mask;
1834
2233 task_lock(tsk); 1835 task_lock(tsk);
2234 guarantee_online_cpus(tsk->cpuset, &mask); 1836 guarantee_online_cpus(task_cs(tsk), &mask);
2235 task_unlock(tsk); 1837 task_unlock(tsk);
2236 mutex_unlock(&callback_mutex);
2237 1838
2238 return mask; 1839 return mask;
2239} 1840}
@@ -2259,7 +1860,7 @@ nodemask_t cpuset_mems_allowed(struct task_struct *tsk)
2259 1860
2260 mutex_lock(&callback_mutex); 1861 mutex_lock(&callback_mutex);
2261 task_lock(tsk); 1862 task_lock(tsk);
2262 guarantee_online_mems(tsk->cpuset, &mask); 1863 guarantee_online_mems(task_cs(tsk), &mask);
2263 task_unlock(tsk); 1864 task_unlock(tsk);
2264 mutex_unlock(&callback_mutex); 1865 mutex_unlock(&callback_mutex);
2265 1866
@@ -2390,7 +1991,7 @@ int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask)
2390 mutex_lock(&callback_mutex); 1991 mutex_lock(&callback_mutex);
2391 1992
2392 task_lock(current); 1993 task_lock(current);
2393 cs = nearest_exclusive_ancestor(current->cpuset); 1994 cs = nearest_exclusive_ancestor(task_cs(current));
2394 task_unlock(current); 1995 task_unlock(current);
2395 1996
2396 allowed = node_isset(node, cs->mems_allowed); 1997 allowed = node_isset(node, cs->mems_allowed);
@@ -2431,12 +2032,12 @@ int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask)
2431 node = zone_to_nid(z); 2032 node = zone_to_nid(z);
2432 if (node_isset(node, current->mems_allowed)) 2033 if (node_isset(node, current->mems_allowed))
2433 return 1; 2034 return 1;
2434 /* 2035 /*
2435 * Allow tasks that have access to memory reserves because they have 2036 * Allow tasks that have access to memory reserves because they have
2436 * been OOM killed to get memory anywhere. 2037 * been OOM killed to get memory anywhere.
2437 */ 2038 */
2438 if (unlikely(test_thread_flag(TIF_MEMDIE))) 2039 if (unlikely(test_thread_flag(TIF_MEMDIE)))
2439 return 1; 2040 return 1;
2440 return 0; 2041 return 0;
2441} 2042}
2442 2043
@@ -2550,14 +2151,12 @@ int cpuset_memory_pressure_enabled __read_mostly;
2550 2151
2551void __cpuset_memory_pressure_bump(void) 2152void __cpuset_memory_pressure_bump(void)
2552{ 2153{
2553 struct cpuset *cs;
2554
2555 task_lock(current); 2154 task_lock(current);
2556 cs = current->cpuset; 2155 fmeter_markevent(&task_cs(current)->fmeter);
2557 fmeter_markevent(&cs->fmeter);
2558 task_unlock(current); 2156 task_unlock(current);
2559} 2157}
2560 2158
2159#ifdef CONFIG_PROC_PID_CPUSET
2561/* 2160/*
2562 * proc_cpuset_show() 2161 * proc_cpuset_show()
2563 * - Print tasks cpuset path into seq_file. 2162 * - Print tasks cpuset path into seq_file.
@@ -2569,11 +2168,12 @@ void __cpuset_memory_pressure_bump(void)
2569 * the_top_cpuset_hack in cpuset_exit(), which sets an exiting tasks 2168 * the_top_cpuset_hack in cpuset_exit(), which sets an exiting tasks
2570 * cpuset to top_cpuset. 2169 * cpuset to top_cpuset.
2571 */ 2170 */
2572static int proc_cpuset_show(struct seq_file *m, void *v) 2171static int proc_cpuset_show(struct seq_file *m, void *unused_v)
2573{ 2172{
2574 struct pid *pid; 2173 struct pid *pid;
2575 struct task_struct *tsk; 2174 struct task_struct *tsk;
2576 char *buf; 2175 char *buf;
2176 struct cgroup_subsys_state *css;
2577 int retval; 2177 int retval;
2578 2178
2579 retval = -ENOMEM; 2179 retval = -ENOMEM;
@@ -2588,15 +2188,15 @@ static int proc_cpuset_show(struct seq_file *m, void *v)
2588 goto out_free; 2188 goto out_free;
2589 2189
2590 retval = -EINVAL; 2190 retval = -EINVAL;
2591 mutex_lock(&manage_mutex); 2191 cgroup_lock();
2592 2192 css = task_subsys_state(tsk, cpuset_subsys_id);
2593 retval = cpuset_path(tsk->cpuset, buf, PAGE_SIZE); 2193 retval = cgroup_path(css->cgroup, buf, PAGE_SIZE);
2594 if (retval < 0) 2194 if (retval < 0)
2595 goto out_unlock; 2195 goto out_unlock;
2596 seq_puts(m, buf); 2196 seq_puts(m, buf);
2597 seq_putc(m, '\n'); 2197 seq_putc(m, '\n');
2598out_unlock: 2198out_unlock:
2599 mutex_unlock(&manage_mutex); 2199 cgroup_unlock();
2600 put_task_struct(tsk); 2200 put_task_struct(tsk);
2601out_free: 2201out_free:
2602 kfree(buf); 2202 kfree(buf);
@@ -2616,6 +2216,7 @@ const struct file_operations proc_cpuset_operations = {
2616 .llseek = seq_lseek, 2216 .llseek = seq_lseek,
2617 .release = single_release, 2217 .release = single_release,
2618}; 2218};
2219#endif /* CONFIG_PROC_PID_CPUSET */
2619 2220
2620/* Display task cpus_allowed, mems_allowed in /proc/<pid>/status file. */ 2221/* Display task cpus_allowed, mems_allowed in /proc/<pid>/status file. */
2621char *cpuset_task_status_allowed(struct task_struct *task, char *buffer) 2222char *cpuset_task_status_allowed(struct task_struct *task, char *buffer)
diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index 09e9574eeb26..10e43fd8b721 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -115,6 +115,12 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk)
115 tmp += timespec_to_ns(&ts); 115 tmp += timespec_to_ns(&ts);
116 d->cpu_run_real_total = (tmp < (s64)d->cpu_run_real_total) ? 0 : tmp; 116 d->cpu_run_real_total = (tmp < (s64)d->cpu_run_real_total) ? 0 : tmp;
117 117
118 tmp = (s64)d->cpu_scaled_run_real_total;
119 cputime_to_timespec(tsk->utimescaled + tsk->stimescaled, &ts);
120 tmp += timespec_to_ns(&ts);
121 d->cpu_scaled_run_real_total =
122 (tmp < (s64)d->cpu_scaled_run_real_total) ? 0 : tmp;
123
118 /* 124 /*
119 * No locking available for sched_info (and too expensive to add one) 125 * No locking available for sched_info (and too expensive to add one)
120 * Mitigate by taking snapshot of values 126 * Mitigate by taking snapshot of values
diff --git a/kernel/die_notifier.c b/kernel/die_notifier.c
deleted file mode 100644
index 0d98827887a7..000000000000
--- a/kernel/die_notifier.c
+++ /dev/null
@@ -1,38 +0,0 @@
1
2#include <linux/module.h>
3#include <linux/notifier.h>
4#include <linux/vmalloc.h>
5#include <linux/kdebug.h>
6
7
8static ATOMIC_NOTIFIER_HEAD(die_chain);
9
10int notify_die(enum die_val val, const char *str,
11 struct pt_regs *regs, long err, int trap, int sig)
12{
13 struct die_args args = {
14 .regs = regs,
15 .str = str,
16 .err = err,
17 .trapnr = trap,
18 .signr = sig,
19
20 };
21
22 return atomic_notifier_call_chain(&die_chain, val, &args);
23}
24
25int register_die_notifier(struct notifier_block *nb)
26{
27 vmalloc_sync_all();
28 return atomic_notifier_chain_register(&die_chain, nb);
29}
30EXPORT_SYMBOL_GPL(register_die_notifier);
31
32int unregister_die_notifier(struct notifier_block *nb)
33{
34 return atomic_notifier_chain_unregister(&die_chain, nb);
35}
36EXPORT_SYMBOL_GPL(unregister_die_notifier);
37
38
diff --git a/kernel/dma.c b/kernel/dma.c
index 937b13ca33ba..6a82bb716dac 100644
--- a/kernel/dma.c
+++ b/kernel/dma.c
@@ -20,7 +20,7 @@
20#include <asm/dma.h> 20#include <asm/dma.h>
21#include <asm/system.h> 21#include <asm/system.h>
22 22
23 23
24 24
25/* A note on resource allocation: 25/* A note on resource allocation:
26 * 26 *
@@ -95,7 +95,7 @@ void free_dma(unsigned int dmanr)
95 if (xchg(&dma_chan_busy[dmanr].lock, 0) == 0) { 95 if (xchg(&dma_chan_busy[dmanr].lock, 0) == 0) {
96 printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr); 96 printk(KERN_WARNING "Trying to free free DMA%d\n", dmanr);
97 return; 97 return;
98 } 98 }
99 99
100} /* free_dma */ 100} /* free_dma */
101 101
@@ -121,8 +121,8 @@ static int proc_dma_show(struct seq_file *m, void *v)
121 121
122 for (i = 0 ; i < MAX_DMA_CHANNELS ; i++) { 122 for (i = 0 ; i < MAX_DMA_CHANNELS ; i++) {
123 if (dma_chan_busy[i].lock) { 123 if (dma_chan_busy[i].lock) {
124 seq_printf(m, "%2d: %s\n", i, 124 seq_printf(m, "%2d: %s\n", i,
125 dma_chan_busy[i].device_id); 125 dma_chan_busy[i].device_id);
126 } 126 }
127 } 127 }
128 return 0; 128 return 0;
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 3c2eaea66b1e..a9e6bad9f706 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -57,7 +57,7 @@ lookup_exec_domain(u_long personality)
57{ 57{
58 struct exec_domain * ep; 58 struct exec_domain * ep;
59 u_long pers = personality(personality); 59 u_long pers = personality(personality);
60 60
61 read_lock(&exec_domains_lock); 61 read_lock(&exec_domains_lock);
62 for (ep = exec_domains; ep; ep = ep->next) { 62 for (ep = exec_domains; ep; ep = ep->next) {
63 if (pers >= ep->pers_low && pers <= ep->pers_high) 63 if (pers >= ep->pers_low && pers <= ep->pers_high)
diff --git a/kernel/exit.c b/kernel/exit.c
index 2c704c86edb3..f1aec27f1df0 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -31,7 +31,7 @@
31#include <linux/taskstats_kern.h> 31#include <linux/taskstats_kern.h>
32#include <linux/delayacct.h> 32#include <linux/delayacct.h>
33#include <linux/freezer.h> 33#include <linux/freezer.h>
34#include <linux/cpuset.h> 34#include <linux/cgroup.h>
35#include <linux/syscalls.h> 35#include <linux/syscalls.h>
36#include <linux/signal.h> 36#include <linux/signal.h>
37#include <linux/posix-timers.h> 37#include <linux/posix-timers.h>
@@ -148,6 +148,7 @@ void release_task(struct task_struct * p)
148 int zap_leader; 148 int zap_leader;
149repeat: 149repeat:
150 atomic_dec(&p->user->processes); 150 atomic_dec(&p->user->processes);
151 proc_flush_task(p);
151 write_lock_irq(&tasklist_lock); 152 write_lock_irq(&tasklist_lock);
152 ptrace_unlink(p); 153 ptrace_unlink(p);
153 BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children)); 154 BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children));
@@ -175,7 +176,6 @@ repeat:
175 } 176 }
176 177
177 write_unlock_irq(&tasklist_lock); 178 write_unlock_irq(&tasklist_lock);
178 proc_flush_task(p);
179 release_thread(p); 179 release_thread(p);
180 call_rcu(&p->rcu, delayed_put_task_struct); 180 call_rcu(&p->rcu, delayed_put_task_struct);
181 181
@@ -221,7 +221,7 @@ static int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct *ignor
221 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 221 do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
222 if (p == ignored_task 222 if (p == ignored_task
223 || p->exit_state 223 || p->exit_state
224 || is_init(p->real_parent)) 224 || is_global_init(p->real_parent))
225 continue; 225 continue;
226 if (task_pgrp(p->real_parent) != pgrp && 226 if (task_pgrp(p->real_parent) != pgrp &&
227 task_session(p->real_parent) == task_session(p)) { 227 task_session(p->real_parent) == task_session(p)) {
@@ -299,14 +299,14 @@ void __set_special_pids(pid_t session, pid_t pgrp)
299{ 299{
300 struct task_struct *curr = current->group_leader; 300 struct task_struct *curr = current->group_leader;
301 301
302 if (process_session(curr) != session) { 302 if (task_session_nr(curr) != session) {
303 detach_pid(curr, PIDTYPE_SID); 303 detach_pid(curr, PIDTYPE_SID);
304 set_signal_session(curr->signal, session); 304 set_task_session(curr, session);
305 attach_pid(curr, PIDTYPE_SID, find_pid(session)); 305 attach_pid(curr, PIDTYPE_SID, find_pid(session));
306 } 306 }
307 if (process_group(curr) != pgrp) { 307 if (task_pgrp_nr(curr) != pgrp) {
308 detach_pid(curr, PIDTYPE_PGID); 308 detach_pid(curr, PIDTYPE_PGID);
309 curr->signal->pgrp = pgrp; 309 set_task_pgrp(curr, pgrp);
310 attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp)); 310 attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp));
311 } 311 }
312} 312}
@@ -400,11 +400,12 @@ void daemonize(const char *name, ...)
400 current->fs = fs; 400 current->fs = fs;
401 atomic_inc(&fs->count); 401 atomic_inc(&fs->count);
402 402
403 exit_task_namespaces(current); 403 if (current->nsproxy != init_task.nsproxy) {
404 current->nsproxy = init_task.nsproxy; 404 get_nsproxy(init_task.nsproxy);
405 get_task_namespaces(current); 405 switch_task_namespaces(current, init_task.nsproxy);
406 }
406 407
407 exit_files(current); 408 exit_files(current);
408 current->files = init_task.files; 409 current->files = init_task.files;
409 atomic_inc(&current->files->count); 410 atomic_inc(&current->files->count);
410 411
@@ -492,7 +493,7 @@ void reset_files_struct(struct task_struct *tsk, struct files_struct *files)
492} 493}
493EXPORT_SYMBOL(reset_files_struct); 494EXPORT_SYMBOL(reset_files_struct);
494 495
495static inline void __exit_files(struct task_struct *tsk) 496static void __exit_files(struct task_struct *tsk)
496{ 497{
497 struct files_struct * files = tsk->files; 498 struct files_struct * files = tsk->files;
498 499
@@ -509,7 +510,7 @@ void exit_files(struct task_struct *tsk)
509 __exit_files(tsk); 510 __exit_files(tsk);
510} 511}
511 512
512static inline void __put_fs_struct(struct fs_struct *fs) 513static void __put_fs_struct(struct fs_struct *fs)
513{ 514{
514 /* No need to hold fs->lock if we are killing it */ 515 /* No need to hold fs->lock if we are killing it */
515 if (atomic_dec_and_test(&fs->count)) { 516 if (atomic_dec_and_test(&fs->count)) {
@@ -530,7 +531,7 @@ void put_fs_struct(struct fs_struct *fs)
530 __put_fs_struct(fs); 531 __put_fs_struct(fs);
531} 532}
532 533
533static inline void __exit_fs(struct task_struct *tsk) 534static void __exit_fs(struct task_struct *tsk)
534{ 535{
535 struct fs_struct * fs = tsk->fs; 536 struct fs_struct * fs = tsk->fs;
536 537
@@ -665,19 +666,22 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced)
665 * the child reaper process (ie "init") in our pid 666 * the child reaper process (ie "init") in our pid
666 * space. 667 * space.
667 */ 668 */
668static void 669static void forget_original_parent(struct task_struct *father)
669forget_original_parent(struct task_struct *father, struct list_head *to_release)
670{ 670{
671 struct task_struct *p, *reaper = father; 671 struct task_struct *p, *n, *reaper = father;
672 struct list_head *_p, *_n; 672 struct list_head ptrace_dead;
673
674 INIT_LIST_HEAD(&ptrace_dead);
675
676 write_lock_irq(&tasklist_lock);
673 677
674 do { 678 do {
675 reaper = next_thread(reaper); 679 reaper = next_thread(reaper);
676 if (reaper == father) { 680 if (reaper == father) {
677 reaper = child_reaper(father); 681 reaper = task_child_reaper(father);
678 break; 682 break;
679 } 683 }
680 } while (reaper->exit_state); 684 } while (reaper->flags & PF_EXITING);
681 685
682 /* 686 /*
683 * There are only two places where our children can be: 687 * There are only two places where our children can be:
@@ -687,9 +691,8 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
687 * 691 *
688 * Search them and reparent children. 692 * Search them and reparent children.
689 */ 693 */
690 list_for_each_safe(_p, _n, &father->children) { 694 list_for_each_entry_safe(p, n, &father->children, sibling) {
691 int ptrace; 695 int ptrace;
692 p = list_entry(_p, struct task_struct, sibling);
693 696
694 ptrace = p->ptrace; 697 ptrace = p->ptrace;
695 698
@@ -715,13 +718,23 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release)
715 * while it was being traced by us, to be able to see it in wait4. 718 * while it was being traced by us, to be able to see it in wait4.
716 */ 719 */
717 if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1)) 720 if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1))
718 list_add(&p->ptrace_list, to_release); 721 list_add(&p->ptrace_list, &ptrace_dead);
719 } 722 }
720 list_for_each_safe(_p, _n, &father->ptrace_children) { 723
721 p = list_entry(_p, struct task_struct, ptrace_list); 724 list_for_each_entry_safe(p, n, &father->ptrace_children, ptrace_list) {
722 p->real_parent = reaper; 725 p->real_parent = reaper;
723 reparent_thread(p, father, 1); 726 reparent_thread(p, father, 1);
724 } 727 }
728
729 write_unlock_irq(&tasklist_lock);
730 BUG_ON(!list_empty(&father->children));
731 BUG_ON(!list_empty(&father->ptrace_children));
732
733 list_for_each_entry_safe(p, n, &ptrace_dead, ptrace_list) {
734 list_del_init(&p->ptrace_list);
735 release_task(p);
736 }
737
725} 738}
726 739
727/* 740/*
@@ -732,7 +745,6 @@ static void exit_notify(struct task_struct *tsk)
732{ 745{
733 int state; 746 int state;
734 struct task_struct *t; 747 struct task_struct *t;
735 struct list_head ptrace_dead, *_p, *_n;
736 struct pid *pgrp; 748 struct pid *pgrp;
737 749
738 if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT) 750 if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT)
@@ -753,8 +765,6 @@ static void exit_notify(struct task_struct *tsk)
753 spin_unlock_irq(&tsk->sighand->siglock); 765 spin_unlock_irq(&tsk->sighand->siglock);
754 } 766 }
755 767
756 write_lock_irq(&tasklist_lock);
757
758 /* 768 /*
759 * This does two things: 769 * This does two things:
760 * 770 *
@@ -763,12 +773,10 @@ static void exit_notify(struct task_struct *tsk)
763 * as a result of our exiting, and if they have any stopped 773 * as a result of our exiting, and if they have any stopped
764 * jobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2) 774 * jobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2)
765 */ 775 */
776 forget_original_parent(tsk);
777 exit_task_namespaces(tsk);
766 778
767 INIT_LIST_HEAD(&ptrace_dead); 779 write_lock_irq(&tasklist_lock);
768 forget_original_parent(tsk, &ptrace_dead);
769 BUG_ON(!list_empty(&tsk->children));
770 BUG_ON(!list_empty(&tsk->ptrace_children));
771
772 /* 780 /*
773 * Check to see if any process groups have become orphaned 781 * Check to see if any process groups have become orphaned
774 * as a result of our exiting, and if they have any stopped 782 * as a result of our exiting, and if they have any stopped
@@ -792,7 +800,7 @@ static void exit_notify(struct task_struct *tsk)
792 /* Let father know we died 800 /* Let father know we died
793 * 801 *
794 * Thread signals are configurable, but you aren't going to use 802 * Thread signals are configurable, but you aren't going to use
795 * that to send signals to arbitary processes. 803 * that to send signals to arbitary processes.
796 * That stops right now. 804 * That stops right now.
797 * 805 *
798 * If the parent exec id doesn't match the exec id we saved 806 * If the parent exec id doesn't match the exec id we saved
@@ -833,12 +841,6 @@ static void exit_notify(struct task_struct *tsk)
833 841
834 write_unlock_irq(&tasklist_lock); 842 write_unlock_irq(&tasklist_lock);
835 843
836 list_for_each_safe(_p, _n, &ptrace_dead) {
837 list_del_init(_p);
838 t = list_entry(_p, struct task_struct, ptrace_list);
839 release_task(t);
840 }
841
842 /* If the process is dead, release it - nobody will wait for it */ 844 /* If the process is dead, release it - nobody will wait for it */
843 if (state == EXIT_DEAD) 845 if (state == EXIT_DEAD)
844 release_task(tsk); 846 release_task(tsk);
@@ -874,10 +876,35 @@ static inline void check_stack_usage(void) {}
874 876
875static inline void exit_child_reaper(struct task_struct *tsk) 877static inline void exit_child_reaper(struct task_struct *tsk)
876{ 878{
877 if (likely(tsk->group_leader != child_reaper(tsk))) 879 if (likely(tsk->group_leader != task_child_reaper(tsk)))
878 return; 880 return;
879 881
880 panic("Attempted to kill init!"); 882 if (tsk->nsproxy->pid_ns == &init_pid_ns)
883 panic("Attempted to kill init!");
884
885 /*
886 * @tsk is the last thread in the 'cgroup-init' and is exiting.
887 * Terminate all remaining processes in the namespace and reap them
888 * before exiting @tsk.
889 *
890 * Note that @tsk (last thread of cgroup-init) may not necessarily
891 * be the child-reaper (i.e main thread of cgroup-init) of the
892 * namespace i.e the child_reaper may have already exited.
893 *
894 * Even after a child_reaper exits, we let it inherit orphaned children,
895 * because, pid_ns->child_reaper remains valid as long as there is
896 * at least one living sub-thread in the cgroup init.
897
898 * This living sub-thread of the cgroup-init will be notified when
899 * a child inherited by the 'child-reaper' exits (do_notify_parent()
900 * uses __group_send_sig_info()). Further, when reaping child processes,
901 * do_wait() iterates over children of all living sub threads.
902
903 * i.e even though 'child_reaper' thread is listed as the parent of the
904 * orphaned children, any living sub-thread in the cgroup-init can
905 * perform the role of the child_reaper.
906 */
907 zap_pid_ns_processes(tsk->nsproxy->pid_ns);
881} 908}
882 909
883fastcall NORET_TYPE void do_exit(long code) 910fastcall NORET_TYPE void do_exit(long code)
@@ -932,7 +959,7 @@ fastcall NORET_TYPE void do_exit(long code)
932 959
933 if (unlikely(in_atomic())) 960 if (unlikely(in_atomic()))
934 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", 961 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
935 current->comm, current->pid, 962 current->comm, task_pid_nr(current),
936 preempt_count()); 963 preempt_count());
937 964
938 acct_update_integrals(tsk); 965 acct_update_integrals(tsk);
@@ -972,7 +999,7 @@ fastcall NORET_TYPE void do_exit(long code)
972 __exit_fs(tsk); 999 __exit_fs(tsk);
973 check_stack_usage(); 1000 check_stack_usage();
974 exit_thread(); 1001 exit_thread();
975 cpuset_exit(tsk); 1002 cgroup_exit(tsk, 1);
976 exit_keys(tsk); 1003 exit_keys(tsk);
977 1004
978 if (group_dead && tsk->signal->leader) 1005 if (group_dead && tsk->signal->leader)
@@ -983,7 +1010,6 @@ fastcall NORET_TYPE void do_exit(long code)
983 module_put(tsk->binfmt->module); 1010 module_put(tsk->binfmt->module);
984 1011
985 proc_exit_connector(tsk); 1012 proc_exit_connector(tsk);
986 exit_task_namespaces(tsk);
987 exit_notify(tsk); 1013 exit_notify(tsk);
988#ifdef CONFIG_NUMA 1014#ifdef CONFIG_NUMA
989 mpol_free(tsk->mempolicy); 1015 mpol_free(tsk->mempolicy);
@@ -1086,15 +1112,17 @@ asmlinkage void sys_exit_group(int error_code)
1086static int eligible_child(pid_t pid, int options, struct task_struct *p) 1112static int eligible_child(pid_t pid, int options, struct task_struct *p)
1087{ 1113{
1088 int err; 1114 int err;
1115 struct pid_namespace *ns;
1089 1116
1117 ns = current->nsproxy->pid_ns;
1090 if (pid > 0) { 1118 if (pid > 0) {
1091 if (p->pid != pid) 1119 if (task_pid_nr_ns(p, ns) != pid)
1092 return 0; 1120 return 0;
1093 } else if (!pid) { 1121 } else if (!pid) {
1094 if (process_group(p) != process_group(current)) 1122 if (task_pgrp_nr_ns(p, ns) != task_pgrp_vnr(current))
1095 return 0; 1123 return 0;
1096 } else if (pid != -1) { 1124 } else if (pid != -1) {
1097 if (process_group(p) != -pid) 1125 if (task_pgrp_nr_ns(p, ns) != -pid)
1098 return 0; 1126 return 0;
1099 } 1127 }
1100 1128
@@ -1164,9 +1192,12 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
1164{ 1192{
1165 unsigned long state; 1193 unsigned long state;
1166 int retval, status, traced; 1194 int retval, status, traced;
1195 struct pid_namespace *ns;
1196
1197 ns = current->nsproxy->pid_ns;
1167 1198
1168 if (unlikely(noreap)) { 1199 if (unlikely(noreap)) {
1169 pid_t pid = p->pid; 1200 pid_t pid = task_pid_nr_ns(p, ns);
1170 uid_t uid = p->uid; 1201 uid_t uid = p->uid;
1171 int exit_code = p->exit_code; 1202 int exit_code = p->exit_code;
1172 int why, status; 1203 int why, status;
@@ -1285,11 +1316,11 @@ static int wait_task_zombie(struct task_struct *p, int noreap,
1285 retval = put_user(status, &infop->si_status); 1316 retval = put_user(status, &infop->si_status);
1286 } 1317 }
1287 if (!retval && infop) 1318 if (!retval && infop)
1288 retval = put_user(p->pid, &infop->si_pid); 1319 retval = put_user(task_pid_nr_ns(p, ns), &infop->si_pid);
1289 if (!retval && infop) 1320 if (!retval && infop)
1290 retval = put_user(p->uid, &infop->si_uid); 1321 retval = put_user(p->uid, &infop->si_uid);
1291 if (!retval) 1322 if (!retval)
1292 retval = p->pid; 1323 retval = task_pid_nr_ns(p, ns);
1293 1324
1294 if (traced) { 1325 if (traced) {
1295 write_lock_irq(&tasklist_lock); 1326 write_lock_irq(&tasklist_lock);
@@ -1326,6 +1357,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1326 int __user *stat_addr, struct rusage __user *ru) 1357 int __user *stat_addr, struct rusage __user *ru)
1327{ 1358{
1328 int retval, exit_code; 1359 int retval, exit_code;
1360 struct pid_namespace *ns;
1329 1361
1330 if (!p->exit_code) 1362 if (!p->exit_code)
1331 return 0; 1363 return 0;
@@ -1344,11 +1376,12 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader,
1344 * keep holding onto the tasklist_lock while we call getrusage and 1376 * keep holding onto the tasklist_lock while we call getrusage and
1345 * possibly take page faults for user memory. 1377 * possibly take page faults for user memory.
1346 */ 1378 */
1379 ns = current->nsproxy->pid_ns;
1347 get_task_struct(p); 1380 get_task_struct(p);
1348 read_unlock(&tasklist_lock); 1381 read_unlock(&tasklist_lock);
1349 1382
1350 if (unlikely(noreap)) { 1383 if (unlikely(noreap)) {
1351 pid_t pid = p->pid; 1384 pid_t pid = task_pid_nr_ns(p, ns);
1352 uid_t uid = p->uid; 1385 uid_t uid = p->uid;
1353 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; 1386 int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED;
1354 1387
@@ -1419,11 +1452,11 @@ bail_ref:
1419 if (!retval && infop) 1452 if (!retval && infop)
1420 retval = put_user(exit_code, &infop->si_status); 1453 retval = put_user(exit_code, &infop->si_status);
1421 if (!retval && infop) 1454 if (!retval && infop)
1422 retval = put_user(p->pid, &infop->si_pid); 1455 retval = put_user(task_pid_nr_ns(p, ns), &infop->si_pid);
1423 if (!retval && infop) 1456 if (!retval && infop)
1424 retval = put_user(p->uid, &infop->si_uid); 1457 retval = put_user(p->uid, &infop->si_uid);
1425 if (!retval) 1458 if (!retval)
1426 retval = p->pid; 1459 retval = task_pid_nr_ns(p, ns);
1427 put_task_struct(p); 1460 put_task_struct(p);
1428 1461
1429 BUG_ON(!retval); 1462 BUG_ON(!retval);
@@ -1443,6 +1476,7 @@ static int wait_task_continued(struct task_struct *p, int noreap,
1443 int retval; 1476 int retval;
1444 pid_t pid; 1477 pid_t pid;
1445 uid_t uid; 1478 uid_t uid;
1479 struct pid_namespace *ns;
1446 1480
1447 if (!(p->signal->flags & SIGNAL_STOP_CONTINUED)) 1481 if (!(p->signal->flags & SIGNAL_STOP_CONTINUED))
1448 return 0; 1482 return 0;
@@ -1457,7 +1491,8 @@ static int wait_task_continued(struct task_struct *p, int noreap,
1457 p->signal->flags &= ~SIGNAL_STOP_CONTINUED; 1491 p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
1458 spin_unlock_irq(&p->sighand->siglock); 1492 spin_unlock_irq(&p->sighand->siglock);
1459 1493
1460 pid = p->pid; 1494 ns = current->nsproxy->pid_ns;
1495 pid = task_pid_nr_ns(p, ns);
1461 uid = p->uid; 1496 uid = p->uid;
1462 get_task_struct(p); 1497 get_task_struct(p);
1463 read_unlock(&tasklist_lock); 1498 read_unlock(&tasklist_lock);
@@ -1468,7 +1503,7 @@ static int wait_task_continued(struct task_struct *p, int noreap,
1468 if (!retval && stat_addr) 1503 if (!retval && stat_addr)
1469 retval = put_user(0xffff, stat_addr); 1504 retval = put_user(0xffff, stat_addr);
1470 if (!retval) 1505 if (!retval)
1471 retval = p->pid; 1506 retval = task_pid_nr_ns(p, ns);
1472 } else { 1507 } else {
1473 retval = wait_noreap_copyout(p, pid, uid, 1508 retval = wait_noreap_copyout(p, pid, uid,
1474 CLD_CONTINUED, SIGCONT, 1509 CLD_CONTINUED, SIGCONT,
@@ -1517,12 +1552,9 @@ repeat:
1517 tsk = current; 1552 tsk = current;
1518 do { 1553 do {
1519 struct task_struct *p; 1554 struct task_struct *p;
1520 struct list_head *_p;
1521 int ret; 1555 int ret;
1522 1556
1523 list_for_each(_p,&tsk->children) { 1557 list_for_each_entry(p, &tsk->children, sibling) {
1524 p = list_entry(_p, struct task_struct, sibling);
1525
1526 ret = eligible_child(pid, options, p); 1558 ret = eligible_child(pid, options, p);
1527 if (!ret) 1559 if (!ret)
1528 continue; 1560 continue;
@@ -1604,9 +1636,8 @@ check_continued:
1604 } 1636 }
1605 } 1637 }
1606 if (!flag) { 1638 if (!flag) {
1607 list_for_each(_p, &tsk->ptrace_children) { 1639 list_for_each_entry(p, &tsk->ptrace_children,
1608 p = list_entry(_p, struct task_struct, 1640 ptrace_list) {
1609 ptrace_list);
1610 if (!eligible_child(pid, options, p)) 1641 if (!eligible_child(pid, options, p))
1611 continue; 1642 continue;
1612 flag = 1; 1643 flag = 1;
diff --git a/kernel/fork.c b/kernel/fork.c
index 490495a39c7e..ddafdfac9456 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -29,7 +29,7 @@
29#include <linux/nsproxy.h> 29#include <linux/nsproxy.h>
30#include <linux/capability.h> 30#include <linux/capability.h>
31#include <linux/cpu.h> 31#include <linux/cpu.h>
32#include <linux/cpuset.h> 32#include <linux/cgroup.h>
33#include <linux/security.h> 33#include <linux/security.h>
34#include <linux/swap.h> 34#include <linux/swap.h>
35#include <linux/syscalls.h> 35#include <linux/syscalls.h>
@@ -50,6 +50,7 @@
50#include <linux/taskstats_kern.h> 50#include <linux/taskstats_kern.h>
51#include <linux/random.h> 51#include <linux/random.h>
52#include <linux/tty.h> 52#include <linux/tty.h>
53#include <linux/proc_fs.h>
53 54
54#include <asm/pgtable.h> 55#include <asm/pgtable.h>
55#include <asm/pgalloc.h> 56#include <asm/pgalloc.h>
@@ -116,7 +117,7 @@ EXPORT_SYMBOL(free_task);
116 117
117void __put_task_struct(struct task_struct *tsk) 118void __put_task_struct(struct task_struct *tsk)
118{ 119{
119 WARN_ON(!(tsk->exit_state & (EXIT_DEAD | EXIT_ZOMBIE))); 120 WARN_ON(!tsk->exit_state);
120 WARN_ON(atomic_read(&tsk->usage)); 121 WARN_ON(atomic_read(&tsk->usage));
121 WARN_ON(tsk == current); 122 WARN_ON(tsk == current);
122 123
@@ -205,7 +206,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
205} 206}
206 207
207#ifdef CONFIG_MMU 208#ifdef CONFIG_MMU
208static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) 209static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
209{ 210{
210 struct vm_area_struct *mpnt, *tmp, **pprev; 211 struct vm_area_struct *mpnt, *tmp, **pprev;
211 struct rb_node **rb_link, *rb_parent; 212 struct rb_node **rb_link, *rb_parent;
@@ -268,7 +269,7 @@ static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
268 get_file(file); 269 get_file(file);
269 if (tmp->vm_flags & VM_DENYWRITE) 270 if (tmp->vm_flags & VM_DENYWRITE)
270 atomic_dec(&inode->i_writecount); 271 atomic_dec(&inode->i_writecount);
271 272
272 /* insert tmp into the share list, just after mpnt */ 273 /* insert tmp into the share list, just after mpnt */
273 spin_lock(&file->f_mapping->i_mmap_lock); 274 spin_lock(&file->f_mapping->i_mmap_lock);
274 tmp->vm_truncate_count = mpnt->vm_truncate_count; 275 tmp->vm_truncate_count = mpnt->vm_truncate_count;
@@ -331,7 +332,7 @@ static inline void mm_free_pgd(struct mm_struct * mm)
331#define mm_free_pgd(mm) 332#define mm_free_pgd(mm)
332#endif /* CONFIG_MMU */ 333#endif /* CONFIG_MMU */
333 334
334 __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock); 335__cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
335 336
336#define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL)) 337#define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL))
337#define free_mm(mm) (kmem_cache_free(mm_cachep, (mm))) 338#define free_mm(mm) (kmem_cache_free(mm_cachep, (mm)))
@@ -583,7 +584,7 @@ fail_nomem:
583 return retval; 584 return retval;
584} 585}
585 586
586static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) 587static struct fs_struct *__copy_fs_struct(struct fs_struct *old)
587{ 588{
588 struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL); 589 struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL);
589 /* We don't need to lock fs - think why ;-) */ 590 /* We don't need to lock fs - think why ;-) */
@@ -615,7 +616,7 @@ struct fs_struct *copy_fs_struct(struct fs_struct *old)
615 616
616EXPORT_SYMBOL_GPL(copy_fs_struct); 617EXPORT_SYMBOL_GPL(copy_fs_struct);
617 618
618static inline int copy_fs(unsigned long clone_flags, struct task_struct * tsk) 619static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
619{ 620{
620 if (clone_flags & CLONE_FS) { 621 if (clone_flags & CLONE_FS) {
621 atomic_inc(&current->fs->count); 622 atomic_inc(&current->fs->count);
@@ -738,8 +739,8 @@ static struct files_struct *dup_fd(struct files_struct *oldf, int *errorp)
738 /* compute the remainder to be cleared */ 739 /* compute the remainder to be cleared */
739 size = (new_fdt->max_fds - open_files) * sizeof(struct file *); 740 size = (new_fdt->max_fds - open_files) * sizeof(struct file *);
740 741
741 /* This is long word aligned thus could use a optimized version */ 742 /* This is long word aligned thus could use a optimized version */
742 memset(new_fds, 0, size); 743 memset(new_fds, 0, size);
743 744
744 if (new_fdt->max_fds > open_files) { 745 if (new_fdt->max_fds > open_files) {
745 int left = (new_fdt->max_fds-open_files)/8; 746 int left = (new_fdt->max_fds-open_files)/8;
@@ -818,7 +819,7 @@ int unshare_files(void)
818 819
819EXPORT_SYMBOL(unshare_files); 820EXPORT_SYMBOL(unshare_files);
820 821
821static inline int copy_sighand(unsigned long clone_flags, struct task_struct * tsk) 822static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk)
822{ 823{
823 struct sighand_struct *sig; 824 struct sighand_struct *sig;
824 825
@@ -841,7 +842,7 @@ void __cleanup_sighand(struct sighand_struct *sighand)
841 kmem_cache_free(sighand_cachep, sighand); 842 kmem_cache_free(sighand_cachep, sighand);
842} 843}
843 844
844static inline int copy_signal(unsigned long clone_flags, struct task_struct * tsk) 845static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
845{ 846{
846 struct signal_struct *sig; 847 struct signal_struct *sig;
847 int ret; 848 int ret;
@@ -923,7 +924,7 @@ void __cleanup_signal(struct signal_struct *sig)
923 kmem_cache_free(signal_cachep, sig); 924 kmem_cache_free(signal_cachep, sig);
924} 925}
925 926
926static inline void cleanup_signal(struct task_struct *tsk) 927static void cleanup_signal(struct task_struct *tsk)
927{ 928{
928 struct signal_struct *sig = tsk->signal; 929 struct signal_struct *sig = tsk->signal;
929 930
@@ -933,7 +934,7 @@ static inline void cleanup_signal(struct task_struct *tsk)
933 __cleanup_signal(sig); 934 __cleanup_signal(sig);
934} 935}
935 936
936static inline void copy_flags(unsigned long clone_flags, struct task_struct *p) 937static void copy_flags(unsigned long clone_flags, struct task_struct *p)
937{ 938{
938 unsigned long new_flags = p->flags; 939 unsigned long new_flags = p->flags;
939 940
@@ -942,16 +943,17 @@ static inline void copy_flags(unsigned long clone_flags, struct task_struct *p)
942 if (!(clone_flags & CLONE_PTRACE)) 943 if (!(clone_flags & CLONE_PTRACE))
943 p->ptrace = 0; 944 p->ptrace = 0;
944 p->flags = new_flags; 945 p->flags = new_flags;
946 clear_freeze_flag(p);
945} 947}
946 948
947asmlinkage long sys_set_tid_address(int __user *tidptr) 949asmlinkage long sys_set_tid_address(int __user *tidptr)
948{ 950{
949 current->clear_child_tid = tidptr; 951 current->clear_child_tid = tidptr;
950 952
951 return current->pid; 953 return task_pid_vnr(current);
952} 954}
953 955
954static inline void rt_mutex_init_task(struct task_struct *p) 956static void rt_mutex_init_task(struct task_struct *p)
955{ 957{
956 spin_lock_init(&p->pi_lock); 958 spin_lock_init(&p->pi_lock);
957#ifdef CONFIG_RT_MUTEXES 959#ifdef CONFIG_RT_MUTEXES
@@ -972,12 +974,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
972 unsigned long stack_start, 974 unsigned long stack_start,
973 struct pt_regs *regs, 975 struct pt_regs *regs,
974 unsigned long stack_size, 976 unsigned long stack_size,
975 int __user *parent_tidptr,
976 int __user *child_tidptr, 977 int __user *child_tidptr,
977 struct pid *pid) 978 struct pid *pid)
978{ 979{
979 int retval; 980 int retval;
980 struct task_struct *p = NULL; 981 struct task_struct *p;
982 int cgroup_callbacks_done = 0;
981 983
982 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS)) 984 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
983 return ERR_PTR(-EINVAL); 985 return ERR_PTR(-EINVAL);
@@ -1041,12 +1043,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1041 p->did_exec = 0; 1043 p->did_exec = 0;
1042 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ 1044 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */
1043 copy_flags(clone_flags, p); 1045 copy_flags(clone_flags, p);
1044 p->pid = pid_nr(pid);
1045 retval = -EFAULT;
1046 if (clone_flags & CLONE_PARENT_SETTID)
1047 if (put_user(p->pid, parent_tidptr))
1048 goto bad_fork_cleanup_delays_binfmt;
1049
1050 INIT_LIST_HEAD(&p->children); 1046 INIT_LIST_HEAD(&p->children);
1051 INIT_LIST_HEAD(&p->sibling); 1047 INIT_LIST_HEAD(&p->sibling);
1052 p->vfork_done = NULL; 1048 p->vfork_done = NULL;
@@ -1058,6 +1054,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1058 p->utime = cputime_zero; 1054 p->utime = cputime_zero;
1059 p->stime = cputime_zero; 1055 p->stime = cputime_zero;
1060 p->gtime = cputime_zero; 1056 p->gtime = cputime_zero;
1057 p->utimescaled = cputime_zero;
1058 p->stimescaled = cputime_zero;
1061 1059
1062#ifdef CONFIG_TASK_XACCT 1060#ifdef CONFIG_TASK_XACCT
1063 p->rchar = 0; /* I/O counter: bytes read */ 1061 p->rchar = 0; /* I/O counter: bytes read */
@@ -1068,12 +1066,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1068 task_io_accounting_init(p); 1066 task_io_accounting_init(p);
1069 acct_clear_integrals(p); 1067 acct_clear_integrals(p);
1070 1068
1071 p->it_virt_expires = cputime_zero; 1069 p->it_virt_expires = cputime_zero;
1072 p->it_prof_expires = cputime_zero; 1070 p->it_prof_expires = cputime_zero;
1073 p->it_sched_expires = 0; 1071 p->it_sched_expires = 0;
1074 INIT_LIST_HEAD(&p->cpu_timers[0]); 1072 INIT_LIST_HEAD(&p->cpu_timers[0]);
1075 INIT_LIST_HEAD(&p->cpu_timers[1]); 1073 INIT_LIST_HEAD(&p->cpu_timers[1]);
1076 INIT_LIST_HEAD(&p->cpu_timers[2]); 1074 INIT_LIST_HEAD(&p->cpu_timers[2]);
1077 1075
1078 p->lock_depth = -1; /* -1 = no lock */ 1076 p->lock_depth = -1; /* -1 = no lock */
1079 do_posix_clock_monotonic_gettime(&p->start_time); 1077 do_posix_clock_monotonic_gettime(&p->start_time);
@@ -1083,15 +1081,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1083 p->security = NULL; 1081 p->security = NULL;
1084#endif 1082#endif
1085 p->io_context = NULL; 1083 p->io_context = NULL;
1086 p->io_wait = NULL;
1087 p->audit_context = NULL; 1084 p->audit_context = NULL;
1088 cpuset_fork(p); 1085 cgroup_fork(p);
1089#ifdef CONFIG_NUMA 1086#ifdef CONFIG_NUMA
1090 p->mempolicy = mpol_copy(p->mempolicy); 1087 p->mempolicy = mpol_copy(p->mempolicy);
1091 if (IS_ERR(p->mempolicy)) { 1088 if (IS_ERR(p->mempolicy)) {
1092 retval = PTR_ERR(p->mempolicy); 1089 retval = PTR_ERR(p->mempolicy);
1093 p->mempolicy = NULL; 1090 p->mempolicy = NULL;
1094 goto bad_fork_cleanup_cpuset; 1091 goto bad_fork_cleanup_cgroup;
1095 } 1092 }
1096 mpol_fix_fork_child_flag(p); 1093 mpol_fix_fork_child_flag(p);
1097#endif 1094#endif
@@ -1124,10 +1121,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1124 p->blocked_on = NULL; /* not blocked yet */ 1121 p->blocked_on = NULL; /* not blocked yet */
1125#endif 1122#endif
1126 1123
1127 p->tgid = p->pid;
1128 if (clone_flags & CLONE_THREAD)
1129 p->tgid = current->tgid;
1130
1131 if ((retval = security_task_alloc(p))) 1124 if ((retval = security_task_alloc(p)))
1132 goto bad_fork_cleanup_policy; 1125 goto bad_fork_cleanup_policy;
1133 if ((retval = audit_alloc(p))) 1126 if ((retval = audit_alloc(p)))
@@ -1153,6 +1146,24 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1153 if (retval) 1146 if (retval)
1154 goto bad_fork_cleanup_namespaces; 1147 goto bad_fork_cleanup_namespaces;
1155 1148
1149 if (pid != &init_struct_pid) {
1150 retval = -ENOMEM;
1151 pid = alloc_pid(task_active_pid_ns(p));
1152 if (!pid)
1153 goto bad_fork_cleanup_namespaces;
1154
1155 if (clone_flags & CLONE_NEWPID) {
1156 retval = pid_ns_prepare_proc(task_active_pid_ns(p));
1157 if (retval < 0)
1158 goto bad_fork_free_pid;
1159 }
1160 }
1161
1162 p->pid = pid_nr(pid);
1163 p->tgid = p->pid;
1164 if (clone_flags & CLONE_THREAD)
1165 p->tgid = current->tgid;
1166
1156 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL; 1167 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
1157 /* 1168 /*
1158 * Clear TID on mm_release()? 1169 * Clear TID on mm_release()?
@@ -1202,6 +1213,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1202 /* Perform scheduler related setup. Assign this task to a CPU. */ 1213 /* Perform scheduler related setup. Assign this task to a CPU. */
1203 sched_fork(p, clone_flags); 1214 sched_fork(p, clone_flags);
1204 1215
1216 /* Now that the task is set up, run cgroup callbacks if
1217 * necessary. We need to run them before the task is visible
1218 * on the tasklist. */
1219 cgroup_fork_callbacks(p);
1220 cgroup_callbacks_done = 1;
1221
1205 /* Need tasklist lock for parent etc handling! */ 1222 /* Need tasklist lock for parent etc handling! */
1206 write_lock_irq(&tasklist_lock); 1223 write_lock_irq(&tasklist_lock);
1207 1224
@@ -1239,12 +1256,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1239 * A fatal signal pending means that current will exit, so the new 1256 * A fatal signal pending means that current will exit, so the new
1240 * thread can't slip out of an OOM kill (or normal SIGKILL). 1257 * thread can't slip out of an OOM kill (or normal SIGKILL).
1241 */ 1258 */
1242 recalc_sigpending(); 1259 recalc_sigpending();
1243 if (signal_pending(current)) { 1260 if (signal_pending(current)) {
1244 spin_unlock(&current->sighand->siglock); 1261 spin_unlock(&current->sighand->siglock);
1245 write_unlock_irq(&tasklist_lock); 1262 write_unlock_irq(&tasklist_lock);
1246 retval = -ERESTARTNOINTR; 1263 retval = -ERESTARTNOINTR;
1247 goto bad_fork_cleanup_namespaces; 1264 goto bad_fork_free_pid;
1248 } 1265 }
1249 1266
1250 if (clone_flags & CLONE_THREAD) { 1267 if (clone_flags & CLONE_THREAD) {
@@ -1273,11 +1290,22 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1273 __ptrace_link(p, current->parent); 1290 __ptrace_link(p, current->parent);
1274 1291
1275 if (thread_group_leader(p)) { 1292 if (thread_group_leader(p)) {
1276 p->signal->tty = current->signal->tty; 1293 if (clone_flags & CLONE_NEWPID) {
1277 p->signal->pgrp = process_group(current); 1294 p->nsproxy->pid_ns->child_reaper = p;
1278 set_signal_session(p->signal, process_session(current)); 1295 p->signal->tty = NULL;
1279 attach_pid(p, PIDTYPE_PGID, task_pgrp(current)); 1296 set_task_pgrp(p, p->pid);
1280 attach_pid(p, PIDTYPE_SID, task_session(current)); 1297 set_task_session(p, p->pid);
1298 attach_pid(p, PIDTYPE_PGID, pid);
1299 attach_pid(p, PIDTYPE_SID, pid);
1300 } else {
1301 p->signal->tty = current->signal->tty;
1302 set_task_pgrp(p, task_pgrp_nr(current));
1303 set_task_session(p, task_session_nr(current));
1304 attach_pid(p, PIDTYPE_PGID,
1305 task_pgrp(current));
1306 attach_pid(p, PIDTYPE_SID,
1307 task_session(current));
1308 }
1281 1309
1282 list_add_tail_rcu(&p->tasks, &init_task.tasks); 1310 list_add_tail_rcu(&p->tasks, &init_task.tasks);
1283 __get_cpu_var(process_counts)++; 1311 __get_cpu_var(process_counts)++;
@@ -1290,8 +1318,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1290 spin_unlock(&current->sighand->siglock); 1318 spin_unlock(&current->sighand->siglock);
1291 write_unlock_irq(&tasklist_lock); 1319 write_unlock_irq(&tasklist_lock);
1292 proc_fork_connector(p); 1320 proc_fork_connector(p);
1321 cgroup_post_fork(p);
1293 return p; 1322 return p;
1294 1323
1324bad_fork_free_pid:
1325 if (pid != &init_struct_pid)
1326 free_pid(pid);
1295bad_fork_cleanup_namespaces: 1327bad_fork_cleanup_namespaces:
1296 exit_task_namespaces(p); 1328 exit_task_namespaces(p);
1297bad_fork_cleanup_keys: 1329bad_fork_cleanup_keys:
@@ -1316,10 +1348,9 @@ bad_fork_cleanup_security:
1316bad_fork_cleanup_policy: 1348bad_fork_cleanup_policy:
1317#ifdef CONFIG_NUMA 1349#ifdef CONFIG_NUMA
1318 mpol_free(p->mempolicy); 1350 mpol_free(p->mempolicy);
1319bad_fork_cleanup_cpuset: 1351bad_fork_cleanup_cgroup:
1320#endif 1352#endif
1321 cpuset_exit(p); 1353 cgroup_exit(p, cgroup_callbacks_done);
1322bad_fork_cleanup_delays_binfmt:
1323 delayacct_tsk_free(p); 1354 delayacct_tsk_free(p);
1324 if (p->binfmt) 1355 if (p->binfmt)
1325 module_put(p->binfmt->module); 1356 module_put(p->binfmt->module);
@@ -1346,7 +1377,7 @@ struct task_struct * __cpuinit fork_idle(int cpu)
1346 struct task_struct *task; 1377 struct task_struct *task;
1347 struct pt_regs regs; 1378 struct pt_regs regs;
1348 1379
1349 task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL, 1380 task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL,
1350 &init_struct_pid); 1381 &init_struct_pid);
1351 if (!IS_ERR(task)) 1382 if (!IS_ERR(task))
1352 init_idle(task, cpu); 1383 init_idle(task, cpu);
@@ -1354,7 +1385,7 @@ struct task_struct * __cpuinit fork_idle(int cpu)
1354 return task; 1385 return task;
1355} 1386}
1356 1387
1357static inline int fork_traceflag (unsigned clone_flags) 1388static int fork_traceflag(unsigned clone_flags)
1358{ 1389{
1359 if (clone_flags & CLONE_UNTRACED) 1390 if (clone_flags & CLONE_UNTRACED)
1360 return 0; 1391 return 0;
@@ -1385,19 +1416,16 @@ long do_fork(unsigned long clone_flags,
1385{ 1416{
1386 struct task_struct *p; 1417 struct task_struct *p;
1387 int trace = 0; 1418 int trace = 0;
1388 struct pid *pid = alloc_pid();
1389 long nr; 1419 long nr;
1390 1420
1391 if (!pid)
1392 return -EAGAIN;
1393 nr = pid->nr;
1394 if (unlikely(current->ptrace)) { 1421 if (unlikely(current->ptrace)) {
1395 trace = fork_traceflag (clone_flags); 1422 trace = fork_traceflag (clone_flags);
1396 if (trace) 1423 if (trace)
1397 clone_flags |= CLONE_PTRACE; 1424 clone_flags |= CLONE_PTRACE;
1398 } 1425 }
1399 1426
1400 p = copy_process(clone_flags, stack_start, regs, stack_size, parent_tidptr, child_tidptr, pid); 1427 p = copy_process(clone_flags, stack_start, regs, stack_size,
1428 child_tidptr, NULL);
1401 /* 1429 /*
1402 * Do this prior waking up the new thread - the thread pointer 1430 * Do this prior waking up the new thread - the thread pointer
1403 * might get invalid after that point, if the thread exits quickly. 1431 * might get invalid after that point, if the thread exits quickly.
@@ -1405,6 +1433,17 @@ long do_fork(unsigned long clone_flags,
1405 if (!IS_ERR(p)) { 1433 if (!IS_ERR(p)) {
1406 struct completion vfork; 1434 struct completion vfork;
1407 1435
1436 /*
1437 * this is enough to call pid_nr_ns here, but this if
1438 * improves optimisation of regular fork()
1439 */
1440 nr = (clone_flags & CLONE_NEWPID) ?
1441 task_pid_nr_ns(p, current->nsproxy->pid_ns) :
1442 task_pid_vnr(p);
1443
1444 if (clone_flags & CLONE_PARENT_SETTID)
1445 put_user(nr, parent_tidptr);
1446
1408 if (clone_flags & CLONE_VFORK) { 1447 if (clone_flags & CLONE_VFORK) {
1409 p->vfork_done = &vfork; 1448 p->vfork_done = &vfork;
1410 init_completion(&vfork); 1449 init_completion(&vfork);
@@ -1438,7 +1477,6 @@ long do_fork(unsigned long clone_flags,
1438 } 1477 }
1439 } 1478 }
1440 } else { 1479 } else {
1441 free_pid(pid);
1442 nr = PTR_ERR(p); 1480 nr = PTR_ERR(p);
1443 } 1481 }
1444 return nr; 1482 return nr;
@@ -1483,7 +1521,7 @@ void __init proc_caches_init(void)
1483 * Check constraints on flags passed to the unshare system call and 1521 * Check constraints on flags passed to the unshare system call and
1484 * force unsharing of additional process context as appropriate. 1522 * force unsharing of additional process context as appropriate.
1485 */ 1523 */
1486static inline void check_unshare_flags(unsigned long *flags_ptr) 1524static void check_unshare_flags(unsigned long *flags_ptr)
1487{ 1525{
1488 /* 1526 /*
1489 * If unsharing a thread from a thread group, must also 1527 * If unsharing a thread from a thread group, must also
@@ -1615,7 +1653,7 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1615 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL; 1653 struct mm_struct *mm, *new_mm = NULL, *active_mm = NULL;
1616 struct files_struct *fd, *new_fd = NULL; 1654 struct files_struct *fd, *new_fd = NULL;
1617 struct sem_undo_list *new_ulist = NULL; 1655 struct sem_undo_list *new_ulist = NULL;
1618 struct nsproxy *new_nsproxy = NULL, *old_nsproxy = NULL; 1656 struct nsproxy *new_nsproxy = NULL;
1619 1657
1620 check_unshare_flags(&unshare_flags); 1658 check_unshare_flags(&unshare_flags);
1621 1659
@@ -1645,14 +1683,13 @@ asmlinkage long sys_unshare(unsigned long unshare_flags)
1645 1683
1646 if (new_fs || new_mm || new_fd || new_ulist || new_nsproxy) { 1684 if (new_fs || new_mm || new_fd || new_ulist || new_nsproxy) {
1647 1685
1648 task_lock(current);
1649
1650 if (new_nsproxy) { 1686 if (new_nsproxy) {
1651 old_nsproxy = current->nsproxy; 1687 switch_task_namespaces(current, new_nsproxy);
1652 current->nsproxy = new_nsproxy; 1688 new_nsproxy = NULL;
1653 new_nsproxy = old_nsproxy;
1654 } 1689 }
1655 1690
1691 task_lock(current);
1692
1656 if (new_fs) { 1693 if (new_fs) {
1657 fs = current->fs; 1694 fs = current->fs;
1658 current->fs = new_fs; 1695 current->fs = new_fs;
diff --git a/kernel/futex.c b/kernel/futex.c
index d725676d84f3..32710451dc20 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -53,6 +53,9 @@
53#include <linux/signal.h> 53#include <linux/signal.h>
54#include <linux/module.h> 54#include <linux/module.h>
55#include <linux/magic.h> 55#include <linux/magic.h>
56#include <linux/pid.h>
57#include <linux/nsproxy.h>
58
56#include <asm/futex.h> 59#include <asm/futex.h>
57 60
58#include "rtmutex_common.h" 61#include "rtmutex_common.h"
@@ -293,7 +296,7 @@ EXPORT_SYMBOL_GPL(get_futex_key_refs);
293 */ 296 */
294void drop_futex_key_refs(union futex_key *key) 297void drop_futex_key_refs(union futex_key *key)
295{ 298{
296 if (key->both.ptr == 0) 299 if (!key->both.ptr)
297 return; 300 return;
298 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) { 301 switch (key->both.offset & (FUT_OFF_INODE|FUT_OFF_MMSHARED)) {
299 case FUT_OFF_INODE: 302 case FUT_OFF_INODE:
@@ -443,8 +446,7 @@ static struct task_struct * futex_find_get_task(pid_t pid)
443 struct task_struct *p; 446 struct task_struct *p;
444 447
445 rcu_read_lock(); 448 rcu_read_lock();
446 p = find_task_by_pid(pid); 449 p = find_task_by_vpid(pid);
447
448 if (!p || ((current->euid != p->euid) && (current->euid != p->uid))) 450 if (!p || ((current->euid != p->euid) && (current->euid != p->uid)))
449 p = ERR_PTR(-ESRCH); 451 p = ERR_PTR(-ESRCH);
450 else 452 else
@@ -653,7 +655,7 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
653 if (!(uval & FUTEX_OWNER_DIED)) { 655 if (!(uval & FUTEX_OWNER_DIED)) {
654 int ret = 0; 656 int ret = 0;
655 657
656 newval = FUTEX_WAITERS | new_owner->pid; 658 newval = FUTEX_WAITERS | task_pid_vnr(new_owner);
657 659
658 curval = cmpxchg_futex_value_locked(uaddr, uval, newval); 660 curval = cmpxchg_futex_value_locked(uaddr, uval, newval);
659 661
@@ -1046,7 +1048,7 @@ static int unqueue_me(struct futex_q *q)
1046 retry: 1048 retry:
1047 lock_ptr = q->lock_ptr; 1049 lock_ptr = q->lock_ptr;
1048 barrier(); 1050 barrier();
1049 if (lock_ptr != 0) { 1051 if (lock_ptr != NULL) {
1050 spin_lock(lock_ptr); 1052 spin_lock(lock_ptr);
1051 /* 1053 /*
1052 * q->lock_ptr can change between reading it and 1054 * q->lock_ptr can change between reading it and
@@ -1106,7 +1108,7 @@ static void unqueue_me_pi(struct futex_q *q)
1106static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q, 1108static int fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
1107 struct task_struct *curr) 1109 struct task_struct *curr)
1108{ 1110{
1109 u32 newtid = curr->pid | FUTEX_WAITERS; 1111 u32 newtid = task_pid_vnr(curr) | FUTEX_WAITERS;
1110 struct futex_pi_state *pi_state = q->pi_state; 1112 struct futex_pi_state *pi_state = q->pi_state;
1111 u32 uval, curval, newval; 1113 u32 uval, curval, newval;
1112 int ret; 1114 int ret;
@@ -1368,7 +1370,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1368 * (by doing a 0 -> TID atomic cmpxchg), while holding all 1370 * (by doing a 0 -> TID atomic cmpxchg), while holding all
1369 * the locks. It will most likely not succeed. 1371 * the locks. It will most likely not succeed.
1370 */ 1372 */
1371 newval = current->pid; 1373 newval = task_pid_vnr(current);
1372 1374
1373 curval = cmpxchg_futex_value_locked(uaddr, 0, newval); 1375 curval = cmpxchg_futex_value_locked(uaddr, 0, newval);
1374 1376
@@ -1379,7 +1381,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1379 * Detect deadlocks. In case of REQUEUE_PI this is a valid 1381 * Detect deadlocks. In case of REQUEUE_PI this is a valid
1380 * situation and we return success to user space. 1382 * situation and we return success to user space.
1381 */ 1383 */
1382 if (unlikely((curval & FUTEX_TID_MASK) == current->pid)) { 1384 if (unlikely((curval & FUTEX_TID_MASK) == task_pid_vnr(current))) {
1383 ret = -EDEADLK; 1385 ret = -EDEADLK;
1384 goto out_unlock_release_sem; 1386 goto out_unlock_release_sem;
1385 } 1387 }
@@ -1408,7 +1410,7 @@ static int futex_lock_pi(u32 __user *uaddr, struct rw_semaphore *fshared,
1408 */ 1410 */
1409 if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) { 1411 if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
1410 /* Keep the OWNER_DIED bit */ 1412 /* Keep the OWNER_DIED bit */
1411 newval = (curval & ~FUTEX_TID_MASK) | current->pid; 1413 newval = (curval & ~FUTEX_TID_MASK) | task_pid_vnr(current);
1412 ownerdied = 0; 1414 ownerdied = 0;
1413 lock_taken = 1; 1415 lock_taken = 1;
1414 } 1416 }
@@ -1587,7 +1589,7 @@ retry:
1587 /* 1589 /*
1588 * We release only a lock we actually own: 1590 * We release only a lock we actually own:
1589 */ 1591 */
1590 if ((uval & FUTEX_TID_MASK) != current->pid) 1592 if ((uval & FUTEX_TID_MASK) != task_pid_vnr(current))
1591 return -EPERM; 1593 return -EPERM;
1592 /* 1594 /*
1593 * First take all the futex related locks: 1595 * First take all the futex related locks:
@@ -1608,7 +1610,7 @@ retry_unlocked:
1608 * anyone else up: 1610 * anyone else up:
1609 */ 1611 */
1610 if (!(uval & FUTEX_OWNER_DIED)) 1612 if (!(uval & FUTEX_OWNER_DIED))
1611 uval = cmpxchg_futex_value_locked(uaddr, current->pid, 0); 1613 uval = cmpxchg_futex_value_locked(uaddr, task_pid_vnr(current), 0);
1612 1614
1613 1615
1614 if (unlikely(uval == -EFAULT)) 1616 if (unlikely(uval == -EFAULT))
@@ -1617,7 +1619,7 @@ retry_unlocked:
1617 * Rare case: we managed to release the lock atomically, 1619 * Rare case: we managed to release the lock atomically,
1618 * no need to wake anyone else up: 1620 * no need to wake anyone else up:
1619 */ 1621 */
1620 if (unlikely(uval == current->pid)) 1622 if (unlikely(uval == task_pid_vnr(current)))
1621 goto out_unlock; 1623 goto out_unlock;
1622 1624
1623 /* 1625 /*
@@ -1854,7 +1856,7 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
1854 1856
1855 ret = -ESRCH; 1857 ret = -ESRCH;
1856 rcu_read_lock(); 1858 rcu_read_lock();
1857 p = find_task_by_pid(pid); 1859 p = find_task_by_vpid(pid);
1858 if (!p) 1860 if (!p)
1859 goto err_unlock; 1861 goto err_unlock;
1860 ret = -EPERM; 1862 ret = -EPERM;
@@ -1887,7 +1889,7 @@ retry:
1887 if (get_user(uval, uaddr)) 1889 if (get_user(uval, uaddr))
1888 return -1; 1890 return -1;
1889 1891
1890 if ((uval & FUTEX_TID_MASK) == curr->pid) { 1892 if ((uval & FUTEX_TID_MASK) == task_pid_vnr(curr)) {
1891 /* 1893 /*
1892 * Ok, this dying thread is truly holding a futex 1894 * Ok, this dying thread is truly holding a futex
1893 * of interest. Set the OWNER_DIED bit atomically 1895 * of interest. Set the OWNER_DIED bit atomically
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 2c2e2954b713..00b572666cc7 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/linkage.h> 9#include <linux/linkage.h>
10#include <linux/compat.h> 10#include <linux/compat.h>
11#include <linux/nsproxy.h>
11#include <linux/futex.h> 12#include <linux/futex.h>
12 13
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
@@ -124,7 +125,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
124 125
125 ret = -ESRCH; 126 ret = -ESRCH;
126 read_lock(&tasklist_lock); 127 read_lock(&tasklist_lock);
127 p = find_task_by_pid(pid); 128 p = find_task_by_vpid(pid);
128 if (!p) 129 if (!p)
129 goto err_unlock; 130 goto err_unlock;
130 ret = -EPERM; 131 ret = -EPERM;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index dc8a4451d79b..b6d2ff7e37ee 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -412,7 +412,7 @@ static int hrtimer_reprogram(struct hrtimer *timer,
412 /* 412 /*
413 * When the callback is running, we do not reprogram the clock event 413 * When the callback is running, we do not reprogram the clock event
414 * device. The timer callback is either running on a different CPU or 414 * device. The timer callback is either running on a different CPU or
415 * the callback is executed in the hrtimer_interupt context. The 415 * the callback is executed in the hrtimer_interrupt context. The
416 * reprogramming is handled either by the softirq, which called the 416 * reprogramming is handled either by the softirq, which called the
417 * callback or at the end of the hrtimer_interrupt. 417 * callback or at the end of the hrtimer_interrupt.
418 */ 418 */
@@ -638,7 +638,7 @@ void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer, void *addr)
638#endif 638#endif
639 639
640/* 640/*
641 * Counterpart to lock_timer_base above: 641 * Counterpart to lock_hrtimer_base above:
642 */ 642 */
643static inline 643static inline
644void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) 644void unlock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
@@ -1286,8 +1286,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
1286long __sched hrtimer_nanosleep_restart(struct restart_block *restart) 1286long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
1287{ 1287{
1288 struct hrtimer_sleeper t; 1288 struct hrtimer_sleeper t;
1289 struct timespec __user *rmtp; 1289 struct timespec *rmtp;
1290 struct timespec tu;
1291 ktime_t time; 1290 ktime_t time;
1292 1291
1293 restart->fn = do_no_restart_syscall; 1292 restart->fn = do_no_restart_syscall;
@@ -1298,14 +1297,12 @@ long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
1298 if (do_nanosleep(&t, HRTIMER_MODE_ABS)) 1297 if (do_nanosleep(&t, HRTIMER_MODE_ABS))
1299 return 0; 1298 return 0;
1300 1299
1301 rmtp = (struct timespec __user *) restart->arg1; 1300 rmtp = (struct timespec *)restart->arg1;
1302 if (rmtp) { 1301 if (rmtp) {
1303 time = ktime_sub(t.timer.expires, t.timer.base->get_time()); 1302 time = ktime_sub(t.timer.expires, t.timer.base->get_time());
1304 if (time.tv64 <= 0) 1303 if (time.tv64 <= 0)
1305 return 0; 1304 return 0;
1306 tu = ktime_to_timespec(time); 1305 *rmtp = ktime_to_timespec(time);
1307 if (copy_to_user(rmtp, &tu, sizeof(tu)))
1308 return -EFAULT;
1309 } 1306 }
1310 1307
1311 restart->fn = hrtimer_nanosleep_restart; 1308 restart->fn = hrtimer_nanosleep_restart;
@@ -1314,12 +1311,11 @@ long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
1314 return -ERESTART_RESTARTBLOCK; 1311 return -ERESTART_RESTARTBLOCK;
1315} 1312}
1316 1313
1317long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, 1314long hrtimer_nanosleep(struct timespec *rqtp, struct timespec *rmtp,
1318 const enum hrtimer_mode mode, const clockid_t clockid) 1315 const enum hrtimer_mode mode, const clockid_t clockid)
1319{ 1316{
1320 struct restart_block *restart; 1317 struct restart_block *restart;
1321 struct hrtimer_sleeper t; 1318 struct hrtimer_sleeper t;
1322 struct timespec tu;
1323 ktime_t rem; 1319 ktime_t rem;
1324 1320
1325 hrtimer_init(&t.timer, clockid, mode); 1321 hrtimer_init(&t.timer, clockid, mode);
@@ -1335,9 +1331,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
1335 rem = ktime_sub(t.timer.expires, t.timer.base->get_time()); 1331 rem = ktime_sub(t.timer.expires, t.timer.base->get_time());
1336 if (rem.tv64 <= 0) 1332 if (rem.tv64 <= 0)
1337 return 0; 1333 return 0;
1338 tu = ktime_to_timespec(rem); 1334 *rmtp = ktime_to_timespec(rem);
1339 if (copy_to_user(rmtp, &tu, sizeof(tu)))
1340 return -EFAULT;
1341 } 1335 }
1342 1336
1343 restart = &current_thread_info()->restart_block; 1337 restart = &current_thread_info()->restart_block;
@@ -1353,7 +1347,8 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
1353asmlinkage long 1347asmlinkage long
1354sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp) 1348sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
1355{ 1349{
1356 struct timespec tu; 1350 struct timespec tu, rmt;
1351 int ret;
1357 1352
1358 if (copy_from_user(&tu, rqtp, sizeof(tu))) 1353 if (copy_from_user(&tu, rqtp, sizeof(tu)))
1359 return -EFAULT; 1354 return -EFAULT;
@@ -1361,7 +1356,15 @@ sys_nanosleep(struct timespec __user *rqtp, struct timespec __user *rmtp)
1361 if (!timespec_valid(&tu)) 1356 if (!timespec_valid(&tu))
1362 return -EINVAL; 1357 return -EINVAL;
1363 1358
1364 return hrtimer_nanosleep(&tu, rmtp, HRTIMER_MODE_REL, CLOCK_MONOTONIC); 1359 ret = hrtimer_nanosleep(&tu, rmtp ? &rmt : NULL, HRTIMER_MODE_REL,
1360 CLOCK_MONOTONIC);
1361
1362 if (ret && rmtp) {
1363 if (copy_to_user(rmtp, &rmt, sizeof(*rmtp)))
1364 return -EFAULT;
1365 }
1366
1367 return ret;
1365} 1368}
1366 1369
1367/* 1370/*
diff --git a/kernel/itimer.c b/kernel/itimer.c
index 3205e8e114fa..2fab344dbf56 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -130,7 +130,7 @@ asmlinkage long sys_getitimer(int which, struct itimerval __user *value)
130enum hrtimer_restart it_real_fn(struct hrtimer *timer) 130enum hrtimer_restart it_real_fn(struct hrtimer *timer)
131{ 131{
132 struct signal_struct *sig = 132 struct signal_struct *sig =
133 container_of(timer, struct signal_struct, real_timer); 133 container_of(timer, struct signal_struct, real_timer);
134 134
135 send_group_sig_info(SIGALRM, SEND_SIG_PRIV, sig->tsk); 135 send_group_sig_info(SIGALRM, SEND_SIG_PRIV, sig->tsk);
136 136
@@ -291,6 +291,6 @@ asmlinkage long sys_setitimer(int which,
291 return error; 291 return error;
292 292
293 if (copy_to_user(ovalue, &get_buffer, sizeof(get_buffer))) 293 if (copy_to_user(ovalue, &get_buffer, sizeof(get_buffer)))
294 return -EFAULT; 294 return -EFAULT;
295 return 0; 295 return 0;
296} 296}
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 7885269b0da2..aa74a1ef2da8 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -51,7 +51,7 @@ struct resource crashk_res = {
51 51
52int kexec_should_crash(struct task_struct *p) 52int kexec_should_crash(struct task_struct *p)
53{ 53{
54 if (in_interrupt() || !p->pid || is_init(p) || panic_on_oops) 54 if (in_interrupt() || !p->pid || is_global_init(p) || panic_on_oops)
55 return 1; 55 return 1;
56 return 0; 56 return 0;
57} 57}
@@ -785,7 +785,7 @@ static int kimage_load_normal_segment(struct kimage *image,
785 size_t uchunk, mchunk; 785 size_t uchunk, mchunk;
786 786
787 page = kimage_alloc_page(image, GFP_HIGHUSER, maddr); 787 page = kimage_alloc_page(image, GFP_HIGHUSER, maddr);
788 if (page == 0) { 788 if (!page) {
789 result = -ENOMEM; 789 result = -ENOMEM;
790 goto out; 790 goto out;
791 } 791 }
@@ -844,7 +844,7 @@ static int kimage_load_crash_segment(struct kimage *image,
844 size_t uchunk, mchunk; 844 size_t uchunk, mchunk;
845 845
846 page = pfn_to_page(maddr >> PAGE_SHIFT); 846 page = pfn_to_page(maddr >> PAGE_SHIFT);
847 if (page == 0) { 847 if (!page) {
848 result = -ENOMEM; 848 result = -ENOMEM;
849 goto out; 849 goto out;
850 } 850 }
@@ -1146,6 +1146,172 @@ static int __init crash_notes_memory_init(void)
1146} 1146}
1147module_init(crash_notes_memory_init) 1147module_init(crash_notes_memory_init)
1148 1148
1149
1150/*
1151 * parsing the "crashkernel" commandline
1152 *
1153 * this code is intended to be called from architecture specific code
1154 */
1155
1156
1157/*
1158 * This function parses command lines in the format
1159 *
1160 * crashkernel=ramsize-range:size[,...][@offset]
1161 *
1162 * The function returns 0 on success and -EINVAL on failure.
1163 */
1164static int __init parse_crashkernel_mem(char *cmdline,
1165 unsigned long long system_ram,
1166 unsigned long long *crash_size,
1167 unsigned long long *crash_base)
1168{
1169 char *cur = cmdline, *tmp;
1170
1171 /* for each entry of the comma-separated list */
1172 do {
1173 unsigned long long start, end = ULLONG_MAX, size;
1174
1175 /* get the start of the range */
1176 start = memparse(cur, &tmp);
1177 if (cur == tmp) {
1178 pr_warning("crashkernel: Memory value expected\n");
1179 return -EINVAL;
1180 }
1181 cur = tmp;
1182 if (*cur != '-') {
1183 pr_warning("crashkernel: '-' expected\n");
1184 return -EINVAL;
1185 }
1186 cur++;
1187
1188 /* if no ':' is here, than we read the end */
1189 if (*cur != ':') {
1190 end = memparse(cur, &tmp);
1191 if (cur == tmp) {
1192 pr_warning("crashkernel: Memory "
1193 "value expected\n");
1194 return -EINVAL;
1195 }
1196 cur = tmp;
1197 if (end <= start) {
1198 pr_warning("crashkernel: end <= start\n");
1199 return -EINVAL;
1200 }
1201 }
1202
1203 if (*cur != ':') {
1204 pr_warning("crashkernel: ':' expected\n");
1205 return -EINVAL;
1206 }
1207 cur++;
1208
1209 size = memparse(cur, &tmp);
1210 if (cur == tmp) {
1211 pr_warning("Memory value expected\n");
1212 return -EINVAL;
1213 }
1214 cur = tmp;
1215 if (size >= system_ram) {
1216 pr_warning("crashkernel: invalid size\n");
1217 return -EINVAL;
1218 }
1219
1220 /* match ? */
1221 if (system_ram >= start && system_ram <= end) {
1222 *crash_size = size;
1223 break;
1224 }
1225 } while (*cur++ == ',');
1226
1227 if (*crash_size > 0) {
1228 while (*cur != ' ' && *cur != '@')
1229 cur++;
1230 if (*cur == '@') {
1231 cur++;
1232 *crash_base = memparse(cur, &tmp);
1233 if (cur == tmp) {
1234 pr_warning("Memory value expected "
1235 "after '@'\n");
1236 return -EINVAL;
1237 }
1238 }
1239 }
1240
1241 return 0;
1242}
1243
1244/*
1245 * That function parses "simple" (old) crashkernel command lines like
1246 *
1247 * crashkernel=size[@offset]
1248 *
1249 * It returns 0 on success and -EINVAL on failure.
1250 */
1251static int __init parse_crashkernel_simple(char *cmdline,
1252 unsigned long long *crash_size,
1253 unsigned long long *crash_base)
1254{
1255 char *cur = cmdline;
1256
1257 *crash_size = memparse(cmdline, &cur);
1258 if (cmdline == cur) {
1259 pr_warning("crashkernel: memory value expected\n");
1260 return -EINVAL;
1261 }
1262
1263 if (*cur == '@')
1264 *crash_base = memparse(cur+1, &cur);
1265
1266 return 0;
1267}
1268
1269/*
1270 * That function is the entry point for command line parsing and should be
1271 * called from the arch-specific code.
1272 */
1273int __init parse_crashkernel(char *cmdline,
1274 unsigned long long system_ram,
1275 unsigned long long *crash_size,
1276 unsigned long long *crash_base)
1277{
1278 char *p = cmdline, *ck_cmdline = NULL;
1279 char *first_colon, *first_space;
1280
1281 BUG_ON(!crash_size || !crash_base);
1282 *crash_size = 0;
1283 *crash_base = 0;
1284
1285 /* find crashkernel and use the last one if there are more */
1286 p = strstr(p, "crashkernel=");
1287 while (p) {
1288 ck_cmdline = p;
1289 p = strstr(p+1, "crashkernel=");
1290 }
1291
1292 if (!ck_cmdline)
1293 return -EINVAL;
1294
1295 ck_cmdline += 12; /* strlen("crashkernel=") */
1296
1297 /*
1298 * if the commandline contains a ':', then that's the extended
1299 * syntax -- if not, it must be the classic syntax
1300 */
1301 first_colon = strchr(ck_cmdline, ':');
1302 first_space = strchr(ck_cmdline, ' ');
1303 if (first_colon && (!first_space || first_colon < first_space))
1304 return parse_crashkernel_mem(ck_cmdline, system_ram,
1305 crash_size, crash_base);
1306 else
1307 return parse_crashkernel_simple(ck_cmdline, crash_size,
1308 crash_base);
1309
1310 return 0;
1311}
1312
1313
1314
1149void crash_save_vmcoreinfo(void) 1315void crash_save_vmcoreinfo(void)
1150{ 1316{
1151 u32 *buf; 1317 u32 *buf;
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index a6f1ee9c92d9..55fe0c7cd95f 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -511,11 +511,11 @@ static void lockdep_print_held_locks(struct task_struct *curr)
511 int i, depth = curr->lockdep_depth; 511 int i, depth = curr->lockdep_depth;
512 512
513 if (!depth) { 513 if (!depth) {
514 printk("no locks held by %s/%d.\n", curr->comm, curr->pid); 514 printk("no locks held by %s/%d.\n", curr->comm, task_pid_nr(curr));
515 return; 515 return;
516 } 516 }
517 printk("%d lock%s held by %s/%d:\n", 517 printk("%d lock%s held by %s/%d:\n",
518 depth, depth > 1 ? "s" : "", curr->comm, curr->pid); 518 depth, depth > 1 ? "s" : "", curr->comm, task_pid_nr(curr));
519 519
520 for (i = 0; i < depth; i++) { 520 for (i = 0; i < depth; i++) {
521 printk(" #%d: ", i); 521 printk(" #%d: ", i);
@@ -904,7 +904,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth)
904 print_kernel_version(); 904 print_kernel_version();
905 printk( "-------------------------------------------------------\n"); 905 printk( "-------------------------------------------------------\n");
906 printk("%s/%d is trying to acquire lock:\n", 906 printk("%s/%d is trying to acquire lock:\n",
907 curr->comm, curr->pid); 907 curr->comm, task_pid_nr(curr));
908 print_lock(check_source); 908 print_lock(check_source);
909 printk("\nbut task is already holding lock:\n"); 909 printk("\nbut task is already holding lock:\n");
910 print_lock(check_target); 910 print_lock(check_target);
@@ -1085,7 +1085,7 @@ print_bad_irq_dependency(struct task_struct *curr,
1085 print_kernel_version(); 1085 print_kernel_version();
1086 printk( "------------------------------------------------------\n"); 1086 printk( "------------------------------------------------------\n");
1087 printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n", 1087 printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n",
1088 curr->comm, curr->pid, 1088 curr->comm, task_pid_nr(curr),
1089 curr->hardirq_context, hardirq_count() >> HARDIRQ_SHIFT, 1089 curr->hardirq_context, hardirq_count() >> HARDIRQ_SHIFT,
1090 curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT, 1090 curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT,
1091 curr->hardirqs_enabled, 1091 curr->hardirqs_enabled,
@@ -1237,7 +1237,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
1237 print_kernel_version(); 1237 print_kernel_version();
1238 printk( "---------------------------------------------\n"); 1238 printk( "---------------------------------------------\n");
1239 printk("%s/%d is trying to acquire lock:\n", 1239 printk("%s/%d is trying to acquire lock:\n",
1240 curr->comm, curr->pid); 1240 curr->comm, task_pid_nr(curr));
1241 print_lock(next); 1241 print_lock(next);
1242 printk("\nbut task is already holding lock:\n"); 1242 printk("\nbut task is already holding lock:\n");
1243 print_lock(prev); 1243 print_lock(prev);
@@ -1521,7 +1521,7 @@ cache_hit:
1521} 1521}
1522 1522
1523static int validate_chain(struct task_struct *curr, struct lockdep_map *lock, 1523static int validate_chain(struct task_struct *curr, struct lockdep_map *lock,
1524 struct held_lock *hlock, int chain_head, u64 chain_key) 1524 struct held_lock *hlock, int chain_head, u64 chain_key)
1525{ 1525{
1526 /* 1526 /*
1527 * Trylock needs to maintain the stack of held locks, but it 1527 * Trylock needs to maintain the stack of held locks, but it
@@ -1641,7 +1641,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
1641 usage_str[prev_bit], usage_str[new_bit]); 1641 usage_str[prev_bit], usage_str[new_bit]);
1642 1642
1643 printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n", 1643 printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n",
1644 curr->comm, curr->pid, 1644 curr->comm, task_pid_nr(curr),
1645 trace_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT, 1645 trace_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT,
1646 trace_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT, 1646 trace_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT,
1647 trace_hardirqs_enabled(curr), 1647 trace_hardirqs_enabled(curr),
@@ -1694,7 +1694,7 @@ print_irq_inversion_bug(struct task_struct *curr, struct lock_class *other,
1694 print_kernel_version(); 1694 print_kernel_version();
1695 printk( "---------------------------------------------------------\n"); 1695 printk( "---------------------------------------------------------\n");
1696 printk("%s/%d just changed the state of lock:\n", 1696 printk("%s/%d just changed the state of lock:\n",
1697 curr->comm, curr->pid); 1697 curr->comm, task_pid_nr(curr));
1698 print_lock(this); 1698 print_lock(this);
1699 if (forwards) 1699 if (forwards)
1700 printk("but this lock took another, %s-irq-unsafe lock in the past:\n", irqclass); 1700 printk("but this lock took another, %s-irq-unsafe lock in the past:\n", irqclass);
@@ -2487,7 +2487,7 @@ print_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
2487 printk( "[ BUG: bad unlock balance detected! ]\n"); 2487 printk( "[ BUG: bad unlock balance detected! ]\n");
2488 printk( "-------------------------------------\n"); 2488 printk( "-------------------------------------\n");
2489 printk("%s/%d is trying to release lock (", 2489 printk("%s/%d is trying to release lock (",
2490 curr->comm, curr->pid); 2490 curr->comm, task_pid_nr(curr));
2491 print_lockdep_cache(lock); 2491 print_lockdep_cache(lock);
2492 printk(") at:\n"); 2492 printk(") at:\n");
2493 print_ip_sym(ip); 2493 print_ip_sym(ip);
@@ -2737,7 +2737,7 @@ print_lock_contention_bug(struct task_struct *curr, struct lockdep_map *lock,
2737 printk( "[ BUG: bad contention detected! ]\n"); 2737 printk( "[ BUG: bad contention detected! ]\n");
2738 printk( "---------------------------------\n"); 2738 printk( "---------------------------------\n");
2739 printk("%s/%d is trying to contend lock (", 2739 printk("%s/%d is trying to contend lock (",
2740 curr->comm, curr->pid); 2740 curr->comm, task_pid_nr(curr));
2741 print_lockdep_cache(lock); 2741 print_lockdep_cache(lock);
2742 printk(") at:\n"); 2742 printk(") at:\n");
2743 print_ip_sym(ip); 2743 print_ip_sym(ip);
@@ -3072,7 +3072,7 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from,
3072 printk( "[ BUG: held lock freed! ]\n"); 3072 printk( "[ BUG: held lock freed! ]\n");
3073 printk( "-------------------------\n"); 3073 printk( "-------------------------\n");
3074 printk("%s/%d is freeing memory %p-%p, with a lock still held there!\n", 3074 printk("%s/%d is freeing memory %p-%p, with a lock still held there!\n",
3075 curr->comm, curr->pid, mem_from, mem_to-1); 3075 curr->comm, task_pid_nr(curr), mem_from, mem_to-1);
3076 print_lock(hlock); 3076 print_lock(hlock);
3077 lockdep_print_held_locks(curr); 3077 lockdep_print_held_locks(curr);
3078 3078
@@ -3125,7 +3125,7 @@ static void print_held_locks_bug(struct task_struct *curr)
3125 printk( "[ BUG: lock held at task exit time! ]\n"); 3125 printk( "[ BUG: lock held at task exit time! ]\n");
3126 printk( "-------------------------------------\n"); 3126 printk( "-------------------------------------\n");
3127 printk("%s/%d is exiting with locks still held!\n", 3127 printk("%s/%d is exiting with locks still held!\n",
3128 curr->comm, curr->pid); 3128 curr->comm, task_pid_nr(curr));
3129 lockdep_print_held_locks(curr); 3129 lockdep_print_held_locks(curr);
3130 3130
3131 printk("\nstack backtrace:\n"); 3131 printk("\nstack backtrace:\n");
diff --git a/kernel/marker.c b/kernel/marker.c
new file mode 100644
index 000000000000..ccb48d9a3657
--- /dev/null
+++ b/kernel/marker.c
@@ -0,0 +1,525 @@
1/*
2 * Copyright (C) 2007 Mathieu Desnoyers
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18#include <linux/module.h>
19#include <linux/mutex.h>
20#include <linux/types.h>
21#include <linux/jhash.h>
22#include <linux/list.h>
23#include <linux/rcupdate.h>
24#include <linux/marker.h>
25#include <linux/err.h>
26
27extern struct marker __start___markers[];
28extern struct marker __stop___markers[];
29
30/*
31 * module_mutex nests inside markers_mutex. Markers mutex protects the builtin
32 * and module markers, the hash table and deferred_sync.
33 */
34static DEFINE_MUTEX(markers_mutex);
35
36/*
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.
48 * Protected by module_mutex.
49 */
50#define MARKER_HASH_BITS 6
51#define MARKER_TABLE_SIZE (1 << MARKER_HASH_BITS)
52
53struct marker_entry {
54 struct hlist_node hlist;
55 char *format;
56 marker_probe_func *probe;
57 void *private;
58 int refcount; /* Number of times armed. 0 if disarmed. */
59 char name[0]; /* Contains name'\0'format'\0' */
60};
61
62static struct hlist_head marker_table[MARKER_TABLE_SIZE];
63
64/**
65 * __mark_empty_function - Empty probe callback
66 * @mdata: pointer of type const struct marker
67 * @fmt: format string
68 * @...: variable argument list
69 *
70 * Empty callback provided as a probe to the markers. By providing this to a
71 * disabled marker, we make sure the execution flow is always valid even
72 * though the function pointer change and the marker enabling are two distinct
73 * operations that modifies the execution flow of preemptible code.
74 */
75void __mark_empty_function(const struct marker *mdata, void *private,
76 const char *fmt, ...)
77{
78}
79EXPORT_SYMBOL_GPL(__mark_empty_function);
80
81/*
82 * Get marker if the marker is present in the marker hash table.
83 * Must be called with markers_mutex held.
84 * Returns NULL if not present.
85 */
86static struct marker_entry *get_marker(const char *name)
87{
88 struct hlist_head *head;
89 struct hlist_node *node;
90 struct marker_entry *e;
91 u32 hash = jhash(name, strlen(name), 0);
92
93 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
94 hlist_for_each_entry(e, node, head, hlist) {
95 if (!strcmp(name, e->name))
96 return e;
97 }
98 return NULL;
99}
100
101/*
102 * Add the marker to the marker hash table. Must be called with markers_mutex
103 * held.
104 */
105static int add_marker(const char *name, const char *format,
106 marker_probe_func *probe, void *private)
107{
108 struct hlist_head *head;
109 struct hlist_node *node;
110 struct marker_entry *e;
111 size_t name_len = strlen(name) + 1;
112 size_t format_len = 0;
113 u32 hash = jhash(name, name_len-1, 0);
114
115 if (format)
116 format_len = strlen(format) + 1;
117 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
118 hlist_for_each_entry(e, node, head, hlist) {
119 if (!strcmp(name, e->name)) {
120 printk(KERN_NOTICE
121 "Marker %s busy, probe %p already installed\n",
122 name, e->probe);
123 return -EBUSY; /* Already there */
124 }
125 }
126 /*
127 * Using kmalloc here to allocate a variable length element. Could
128 * cause some memory fragmentation if overused.
129 */
130 e = kmalloc(sizeof(struct marker_entry) + name_len + format_len,
131 GFP_KERNEL);
132 if (!e)
133 return -ENOMEM;
134 memcpy(&e->name[0], name, name_len);
135 if (format) {
136 e->format = &e->name[name_len];
137 memcpy(e->format, format, format_len);
138 trace_mark(core_marker_format, "name %s format %s",
139 e->name, e->format);
140 } else
141 e->format = NULL;
142 e->probe = probe;
143 e->private = private;
144 e->refcount = 0;
145 hlist_add_head(&e->hlist, head);
146 return 0;
147}
148
149/*
150 * Remove the marker from the marker hash table. Must be called with mutex_lock
151 * held.
152 */
153static void *remove_marker(const char *name)
154{
155 struct hlist_head *head;
156 struct hlist_node *node;
157 struct marker_entry *e;
158 int found = 0;
159 size_t len = strlen(name) + 1;
160 void *private = NULL;
161 u32 hash = jhash(name, len-1, 0);
162
163 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
164 hlist_for_each_entry(e, node, head, hlist) {
165 if (!strcmp(name, e->name)) {
166 found = 1;
167 break;
168 }
169 }
170 if (found) {
171 private = e->private;
172 hlist_del(&e->hlist);
173 kfree(e);
174 }
175 return private;
176}
177
178/*
179 * Set the mark_entry format to the format found in the element.
180 */
181static int marker_set_format(struct marker_entry **entry, const char *format)
182{
183 struct marker_entry *e;
184 size_t name_len = strlen((*entry)->name) + 1;
185 size_t format_len = strlen(format) + 1;
186
187 e = kmalloc(sizeof(struct marker_entry) + name_len + format_len,
188 GFP_KERNEL);
189 if (!e)
190 return -ENOMEM;
191 memcpy(&e->name[0], (*entry)->name, name_len);
192 e->format = &e->name[name_len];
193 memcpy(e->format, format, format_len);
194 e->probe = (*entry)->probe;
195 e->private = (*entry)->private;
196 e->refcount = (*entry)->refcount;
197 hlist_add_before(&e->hlist, &(*entry)->hlist);
198 hlist_del(&(*entry)->hlist);
199 kfree(*entry);
200 *entry = e;
201 trace_mark(core_marker_format, "name %s format %s",
202 e->name, e->format);
203 return 0;
204}
205
206/*
207 * Sets the probe callback corresponding to one marker.
208 */
209static int set_marker(struct marker_entry **entry, struct marker *elem)
210{
211 int ret;
212 WARN_ON(strcmp((*entry)->name, elem->name) != 0);
213
214 if ((*entry)->format) {
215 if (strcmp((*entry)->format, elem->format) != 0) {
216 printk(KERN_NOTICE
217 "Format mismatch for probe %s "
218 "(%s), marker (%s)\n",
219 (*entry)->name,
220 (*entry)->format,
221 elem->format);
222 return -EPERM;
223 }
224 } else {
225 ret = marker_set_format(entry, elem->format);
226 if (ret)
227 return ret;
228 }
229 elem->call = (*entry)->probe;
230 elem->private = (*entry)->private;
231 elem->state = 1;
232 return 0;
233}
234
235/*
236 * Disable a marker and its probe callback.
237 * Note: only after a synchronize_sched() issued after setting elem->call to the
238 * empty function insures that the original callback is not used anymore. This
239 * insured by preemption disabling around the call site.
240 */
241static void disable_marker(struct marker *elem)
242{
243 elem->state = 0;
244 elem->call = __mark_empty_function;
245 /*
246 * 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
248 * until the next initialization anyway.
249 */
250}
251
252/**
253 * marker_update_probe_range - Update a probe range
254 * @begin: beginning of the range
255 * @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 *
259 * Updates the probe callback corresponding to a range of markers.
260 * Must be called with markers_mutex held.
261 */
262void marker_update_probe_range(struct marker *begin,
263 struct marker *end, struct module *probe_module,
264 int *refcount)
265{
266 struct marker *iter;
267 struct marker_entry *mark_entry;
268
269 for (iter = begin; iter < end; iter++) {
270 mark_entry = get_marker(iter->name);
271 if (mark_entry && mark_entry->refcount) {
272 set_marker(&mark_entry, iter);
273 /*
274 * ignore error, continue
275 */
276 if (probe_module)
277 if (probe_module ==
278 __module_text_address((unsigned long)mark_entry->probe))
279 (*refcount)++;
280 } else {
281 disable_marker(iter);
282 }
283 }
284}
285
286/*
287 * Update probes, removing the faulty probes.
288 * Issues a synchronize_sched() when no reference to the module passed
289 * as parameter is found in the probes so the probe module can be
290 * safely unloaded from now on.
291 */
292static void marker_update_probes(struct module *probe_module)
293{
294 int refcount = 0;
295
296 mutex_lock(&markers_mutex);
297 /* Core kernel markers */
298 marker_update_probe_range(__start___markers,
299 __stop___markers, probe_module, &refcount);
300 /* Markers in modules. */
301 module_update_markers(probe_module, &refcount);
302 if (probe_module && refcount == 0) {
303 synchronize_sched();
304 deferred_sync = 0;
305 }
306 mutex_unlock(&markers_mutex);
307}
308
309/**
310 * marker_probe_register - Connect a probe to a marker
311 * @name: marker name
312 * @format: format string
313 * @probe: probe handler
314 * @private: probe private data
315 *
316 * private data must be a valid allocated memory address, or NULL.
317 * Returns 0 if ok, error value on error.
318 */
319int marker_probe_register(const char *name, const char *format,
320 marker_probe_func *probe, void *private)
321{
322 struct marker_entry *entry;
323 int ret = 0, need_update = 0;
324
325 mutex_lock(&markers_mutex);
326 entry = get_marker(name);
327 if (entry && entry->refcount) {
328 ret = -EBUSY;
329 goto end;
330 }
331 if (deferred_sync) {
332 synchronize_sched();
333 deferred_sync = 0;
334 }
335 ret = add_marker(name, format, probe, private);
336 if (ret)
337 goto end;
338 need_update = 1;
339end:
340 mutex_unlock(&markers_mutex);
341 if (need_update)
342 marker_update_probes(NULL);
343 return ret;
344}
345EXPORT_SYMBOL_GPL(marker_probe_register);
346
347/**
348 * marker_probe_unregister - Disconnect a probe from a marker
349 * @name: marker name
350 *
351 * Returns the private data given to marker_probe_register, or an ERR_PTR().
352 */
353void *marker_probe_unregister(const char *name)
354{
355 struct module *probe_module;
356 struct marker_entry *entry;
357 void *private;
358 int need_update = 0;
359
360 mutex_lock(&markers_mutex);
361 entry = get_marker(name);
362 if (!entry) {
363 private = ERR_PTR(-ENOENT);
364 goto end;
365 }
366 entry->refcount = 0;
367 /* In what module is the probe handler ? */
368 probe_module = __module_text_address((unsigned long)entry->probe);
369 private = remove_marker(name);
370 deferred_sync = 1;
371 need_update = 1;
372end:
373 mutex_unlock(&markers_mutex);
374 if (need_update)
375 marker_update_probes(probe_module);
376 return private;
377}
378EXPORT_SYMBOL_GPL(marker_probe_unregister);
379
380/**
381 * marker_probe_unregister_private_data - Disconnect a probe from a marker
382 * @private: probe private data
383 *
384 * Unregister a marker by providing the registered private data.
385 * Returns the private data given to marker_probe_register, or an ERR_PTR().
386 */
387void *marker_probe_unregister_private_data(void *private)
388{
389 struct module *probe_module;
390 struct hlist_head *head;
391 struct hlist_node *node;
392 struct marker_entry *entry;
393 int found = 0;
394 unsigned int i;
395 int need_update = 0;
396
397 mutex_lock(&markers_mutex);
398 for (i = 0; i < MARKER_TABLE_SIZE; i++) {
399 head = &marker_table[i];
400 hlist_for_each_entry(entry, node, head, hlist) {
401 if (entry->private == private) {
402 found = 1;
403 goto iter_end;
404 }
405 }
406 }
407iter_end:
408 if (!found) {
409 private = ERR_PTR(-ENOENT);
410 goto end;
411 }
412 entry->refcount = 0;
413 /* In what module is the probe handler ? */
414 probe_module = __module_text_address((unsigned long)entry->probe);
415 private = remove_marker(entry->name);
416 deferred_sync = 1;
417 need_update = 1;
418end:
419 mutex_unlock(&markers_mutex);
420 if (need_update)
421 marker_update_probes(probe_module);
422 return private;
423}
424EXPORT_SYMBOL_GPL(marker_probe_unregister_private_data);
425
426/**
427 * marker_arm - Arm a marker
428 * @name: marker name
429 *
430 * Activate a marker. It keeps a reference count of the number of
431 * arming/disarming done.
432 * Returns 0 if ok, error value on error.
433 */
434int marker_arm(const char *name)
435{
436 struct marker_entry *entry;
437 int ret = 0, need_update = 0;
438
439 mutex_lock(&markers_mutex);
440 entry = get_marker(name);
441 if (!entry) {
442 ret = -ENOENT;
443 goto end;
444 }
445 /*
446 * Only need to update probes when refcount passes from 0 to 1.
447 */
448 if (entry->refcount++)
449 goto end;
450 need_update = 1;
451end:
452 mutex_unlock(&markers_mutex);
453 if (need_update)
454 marker_update_probes(NULL);
455 return ret;
456}
457EXPORT_SYMBOL_GPL(marker_arm);
458
459/**
460 * marker_disarm - Disarm a marker
461 * @name: marker name
462 *
463 * Disarm a marker. It keeps a reference count of the number of arming/disarming
464 * done.
465 * Returns 0 if ok, error value on error.
466 */
467int marker_disarm(const char *name)
468{
469 struct marker_entry *entry;
470 int ret = 0, need_update = 0;
471
472 mutex_lock(&markers_mutex);
473 entry = get_marker(name);
474 if (!entry) {
475 ret = -ENOENT;
476 goto end;
477 }
478 /*
479 * Only permit decrement refcount if higher than 0.
480 * Do probe update only on 1 -> 0 transition.
481 */
482 if (entry->refcount) {
483 if (--entry->refcount)
484 goto end;
485 } else {
486 ret = -EPERM;
487 goto end;
488 }
489 need_update = 1;
490end:
491 mutex_unlock(&markers_mutex);
492 if (need_update)
493 marker_update_probes(NULL);
494 return ret;
495}
496EXPORT_SYMBOL_GPL(marker_disarm);
497
498/**
499 * marker_get_private_data - Get a marker's probe private data
500 * @name: marker name
501 *
502 * Returns the private data pointer, or an ERR_PTR.
503 * The private data pointer should _only_ be dereferenced if the caller is the
504 * owner of the data, or its content could vanish. This is mostly used to
505 * confirm that a caller is the owner of a registered probe.
506 */
507void *marker_get_private_data(const char *name)
508{
509 struct hlist_head *head;
510 struct hlist_node *node;
511 struct marker_entry *e;
512 size_t name_len = strlen(name) + 1;
513 u32 hash = jhash(name, name_len-1, 0);
514 int found = 0;
515
516 head = &marker_table[hash & ((1 << MARKER_HASH_BITS)-1)];
517 hlist_for_each_entry(e, node, head, hlist) {
518 if (!strcmp(name, e->name)) {
519 found = 1;
520 return e->private;
521 }
522 }
523 return ERR_PTR(-ENOENT);
524}
525EXPORT_SYMBOL_GPL(marker_get_private_data);
diff --git a/kernel/module.c b/kernel/module.c
index a389b423c279..3202c9950073 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -105,7 +105,7 @@ void __module_put_and_exit(struct module *mod, long code)
105 do_exit(code); 105 do_exit(code);
106} 106}
107EXPORT_SYMBOL(__module_put_and_exit); 107EXPORT_SYMBOL(__module_put_and_exit);
108 108
109/* Find a module section: 0 means not found. */ 109/* Find a module section: 0 means not found. */
110static unsigned int find_sec(Elf_Ehdr *hdr, 110static unsigned int find_sec(Elf_Ehdr *hdr,
111 Elf_Shdr *sechdrs, 111 Elf_Shdr *sechdrs,
@@ -179,7 +179,7 @@ static unsigned long __find_symbol(const char *name,
179 struct module *mod; 179 struct module *mod;
180 const struct kernel_symbol *ks; 180 const struct kernel_symbol *ks;
181 181
182 /* Core kernel first. */ 182 /* Core kernel first. */
183 *owner = NULL; 183 *owner = NULL;
184 ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab); 184 ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab);
185 if (ks) { 185 if (ks) {
@@ -231,7 +231,7 @@ static unsigned long __find_symbol(const char *name,
231 return ks->value; 231 return ks->value;
232 } 232 }
233 233
234 /* Now try modules. */ 234 /* Now try modules. */
235 list_for_each_entry(mod, &modules, list) { 235 list_for_each_entry(mod, &modules, list) {
236 *owner = mod; 236 *owner = mod;
237 ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms); 237 ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms);
@@ -285,7 +285,7 @@ static unsigned long __find_symbol(const char *name,
285 } 285 }
286 } 286 }
287 DEBUGP("Failed to find symbol %s\n", name); 287 DEBUGP("Failed to find symbol %s\n", name);
288 return 0; 288 return 0;
289} 289}
290 290
291/* Search for module by name: must hold module_mutex. */ 291/* Search for module by name: must hold module_mutex. */
@@ -441,7 +441,7 @@ static int percpu_modinit(void)
441 } 441 }
442 442
443 return 0; 443 return 0;
444} 444}
445__initcall(percpu_modinit); 445__initcall(percpu_modinit);
446#else /* ... !CONFIG_SMP */ 446#else /* ... !CONFIG_SMP */
447static inline void *percpu_modalloc(unsigned long size, unsigned long align, 447static inline void *percpu_modalloc(unsigned long size, unsigned long align,
@@ -483,8 +483,8 @@ static int modinfo_##field##_exists(struct module *mod) \
483} \ 483} \
484static void free_modinfo_##field(struct module *mod) \ 484static void free_modinfo_##field(struct module *mod) \
485{ \ 485{ \
486 kfree(mod->field); \ 486 kfree(mod->field); \
487 mod->field = NULL; \ 487 mod->field = NULL; \
488} \ 488} \
489static struct module_attribute modinfo_##field = { \ 489static struct module_attribute modinfo_##field = { \
490 .attr = { .name = __stringify(field), .mode = 0444 }, \ 490 .attr = { .name = __stringify(field), .mode = 0444 }, \
@@ -990,7 +990,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
990 struct module_sect_attrs *sect_attrs; 990 struct module_sect_attrs *sect_attrs;
991 struct module_sect_attr *sattr; 991 struct module_sect_attr *sattr;
992 struct attribute **gattr; 992 struct attribute **gattr;
993 993
994 /* Count loaded sections and allocate structures */ 994 /* Count loaded sections and allocate structures */
995 for (i = 0; i < nsect; i++) 995 for (i = 0; i < nsect; i++)
996 if (sechdrs[i].sh_flags & SHF_ALLOC) 996 if (sechdrs[i].sh_flags & SHF_ALLOC)
@@ -1348,14 +1348,14 @@ static int verify_export_symbols(struct module *mod)
1348 const unsigned long *crc; 1348 const unsigned long *crc;
1349 1349
1350 for (i = 0; i < mod->num_syms; i++) 1350 for (i = 0; i < mod->num_syms; i++)
1351 if (__find_symbol(mod->syms[i].name, &owner, &crc, 1)) { 1351 if (__find_symbol(mod->syms[i].name, &owner, &crc, 1)) {
1352 name = mod->syms[i].name; 1352 name = mod->syms[i].name;
1353 ret = -ENOEXEC; 1353 ret = -ENOEXEC;
1354 goto dup; 1354 goto dup;
1355 } 1355 }
1356 1356
1357 for (i = 0; i < mod->num_gpl_syms; i++) 1357 for (i = 0; i < mod->num_gpl_syms; i++)
1358 if (__find_symbol(mod->gpl_syms[i].name, &owner, &crc, 1)) { 1358 if (__find_symbol(mod->gpl_syms[i].name, &owner, &crc, 1)) {
1359 name = mod->gpl_syms[i].name; 1359 name = mod->gpl_syms[i].name;
1360 ret = -ENOEXEC; 1360 ret = -ENOEXEC;
1361 goto dup; 1361 goto dup;
@@ -1673,6 +1673,8 @@ static struct module *load_module(void __user *umod,
1673 unsigned int unusedcrcindex; 1673 unsigned int unusedcrcindex;
1674 unsigned int unusedgplindex; 1674 unsigned int unusedgplindex;
1675 unsigned int unusedgplcrcindex; 1675 unsigned int unusedgplcrcindex;
1676 unsigned int markersindex;
1677 unsigned int markersstringsindex;
1676 struct module *mod; 1678 struct module *mod;
1677 long err = 0; 1679 long err = 0;
1678 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */ 1680 void *percpu = NULL, *ptr = NULL; /* Stops spurious gcc warning */
@@ -1929,7 +1931,7 @@ static struct module *load_module(void __user *umod,
1929 mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr; 1931 mod->unused_crcs = (void *)sechdrs[unusedgplcrcindex].sh_addr;
1930 1932
1931#ifdef CONFIG_MODVERSIONS 1933#ifdef CONFIG_MODVERSIONS
1932 if ((mod->num_syms && !crcindex) || 1934 if ((mod->num_syms && !crcindex) ||
1933 (mod->num_gpl_syms && !gplcrcindex) || 1935 (mod->num_gpl_syms && !gplcrcindex) ||
1934 (mod->num_gpl_future_syms && !gplfuturecrcindex) || 1936 (mod->num_gpl_future_syms && !gplfuturecrcindex) ||
1935 (mod->num_unused_syms && !unusedcrcindex) || 1937 (mod->num_unused_syms && !unusedcrcindex) ||
@@ -1939,6 +1941,9 @@ static struct module *load_module(void __user *umod,
1939 add_taint_module(mod, TAINT_FORCED_MODULE); 1941 add_taint_module(mod, TAINT_FORCED_MODULE);
1940 } 1942 }
1941#endif 1943#endif
1944 markersindex = find_sec(hdr, sechdrs, secstrings, "__markers");
1945 markersstringsindex = find_sec(hdr, sechdrs, secstrings,
1946 "__markers_strings");
1942 1947
1943 /* Now do relocations. */ 1948 /* Now do relocations. */
1944 for (i = 1; i < hdr->e_shnum; i++) { 1949 for (i = 1; i < hdr->e_shnum; i++) {
@@ -1961,6 +1966,11 @@ static struct module *load_module(void __user *umod,
1961 if (err < 0) 1966 if (err < 0)
1962 goto cleanup; 1967 goto cleanup;
1963 } 1968 }
1969#ifdef CONFIG_MARKERS
1970 mod->markers = (void *)sechdrs[markersindex].sh_addr;
1971 mod->num_markers =
1972 sechdrs[markersindex].sh_size / sizeof(*mod->markers);
1973#endif
1964 1974
1965 /* Find duplicate symbols */ 1975 /* Find duplicate symbols */
1966 err = verify_export_symbols(mod); 1976 err = verify_export_symbols(mod);
@@ -1979,6 +1989,11 @@ static struct module *load_module(void __user *umod,
1979 1989
1980 add_kallsyms(mod, sechdrs, symindex, strindex, secstrings); 1990 add_kallsyms(mod, sechdrs, symindex, strindex, secstrings);
1981 1991
1992#ifdef CONFIG_MARKERS
1993 if (!mod->taints)
1994 marker_update_probe_range(mod->markers,
1995 mod->markers + mod->num_markers, NULL, NULL);
1996#endif
1982 err = module_finalize(hdr, sechdrs, mod); 1997 err = module_finalize(hdr, sechdrs, mod);
1983 if (err < 0) 1998 if (err < 0)
1984 goto cleanup; 1999 goto cleanup;
@@ -2016,7 +2031,7 @@ static struct module *load_module(void __user *umod,
2016 if (err < 0) 2031 if (err < 0)
2017 goto arch_cleanup; 2032 goto arch_cleanup;
2018 2033
2019 err = mod_sysfs_setup(mod, 2034 err = mod_sysfs_setup(mod,
2020 (struct kernel_param *) 2035 (struct kernel_param *)
2021 sechdrs[setupindex].sh_addr, 2036 sechdrs[setupindex].sh_addr,
2022 sechdrs[setupindex].sh_size 2037 sechdrs[setupindex].sh_size
@@ -2028,8 +2043,8 @@ static struct module *load_module(void __user *umod,
2028 2043
2029 /* Size of section 0 is 0, so this works well if no unwind info. */ 2044 /* Size of section 0 is 0, so this works well if no unwind info. */
2030 mod->unwind_info = unwind_add_table(mod, 2045 mod->unwind_info = unwind_add_table(mod,
2031 (void *)sechdrs[unwindex].sh_addr, 2046 (void *)sechdrs[unwindex].sh_addr,
2032 sechdrs[unwindex].sh_size); 2047 sechdrs[unwindex].sh_size);
2033 2048
2034 /* Get rid of temporary copy */ 2049 /* Get rid of temporary copy */
2035 vfree(hdr); 2050 vfree(hdr);
@@ -2146,7 +2161,7 @@ static inline int within(unsigned long addr, void *start, unsigned long size)
2146 */ 2161 */
2147static inline int is_arm_mapping_symbol(const char *str) 2162static inline int is_arm_mapping_symbol(const char *str)
2148{ 2163{
2149 return str[0] == '$' && strchr("atd", str[1]) 2164 return str[0] == '$' && strchr("atd", str[1])
2150 && (str[2] == '\0' || str[2] == '.'); 2165 && (str[2] == '\0' || str[2] == '.');
2151} 2166}
2152 2167
@@ -2161,11 +2176,11 @@ static const char *get_ksymbol(struct module *mod,
2161 /* At worse, next value is at end of module */ 2176 /* At worse, next value is at end of module */
2162 if (within(addr, mod->module_init, mod->init_size)) 2177 if (within(addr, mod->module_init, mod->init_size))
2163 nextval = (unsigned long)mod->module_init+mod->init_text_size; 2178 nextval = (unsigned long)mod->module_init+mod->init_text_size;
2164 else 2179 else
2165 nextval = (unsigned long)mod->module_core+mod->core_text_size; 2180 nextval = (unsigned long)mod->module_core+mod->core_text_size;
2166 2181
2167 /* Scan for closest preceeding symbol, and next symbol. (ELF 2182 /* Scan for closest preceeding symbol, and next symbol. (ELF
2168 starts real symbols at 1). */ 2183 starts real symbols at 1). */
2169 for (i = 1; i < mod->num_symtab; i++) { 2184 for (i = 1; i < mod->num_symtab; i++) {
2170 if (mod->symtab[i].st_shndx == SHN_UNDEF) 2185 if (mod->symtab[i].st_shndx == SHN_UNDEF)
2171 continue; 2186 continue;
@@ -2407,7 +2422,7 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
2407 list_for_each_entry(mod, &modules, list) { 2422 list_for_each_entry(mod, &modules, list) {
2408 if (mod->num_exentries == 0) 2423 if (mod->num_exentries == 0)
2409 continue; 2424 continue;
2410 2425
2411 e = search_extable(mod->extable, 2426 e = search_extable(mod->extable,
2412 mod->extable + mod->num_exentries - 1, 2427 mod->extable + mod->num_exentries - 1,
2413 addr); 2428 addr);
@@ -2417,7 +2432,7 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
2417 preempt_enable(); 2432 preempt_enable();
2418 2433
2419 /* Now, if we found one, we are running inside it now, hence 2434 /* Now, if we found one, we are running inside it now, hence
2420 we cannot unload the module, hence no refcnt needed. */ 2435 we cannot unload the module, hence no refcnt needed. */
2421 return e; 2436 return e;
2422} 2437}
2423 2438
@@ -2570,3 +2585,18 @@ EXPORT_SYMBOL(module_remove_driver);
2570void struct_module(struct module *mod) { return; } 2585void struct_module(struct module *mod) { return; }
2571EXPORT_SYMBOL(struct_module); 2586EXPORT_SYMBOL(struct_module);
2572#endif 2587#endif
2588
2589#ifdef CONFIG_MARKERS
2590void module_update_markers(struct module *probe_module, int *refcount)
2591{
2592 struct module *mod;
2593
2594 mutex_lock(&module_mutex);
2595 list_for_each_entry(mod, &modules, list)
2596 if (!mod->taints)
2597 marker_update_probe_range(mod->markers,
2598 mod->markers + mod->num_markers,
2599 probe_module, refcount);
2600 mutex_unlock(&module_mutex);
2601}
2602#endif
diff --git a/kernel/notifier.c b/kernel/notifier.c
new file mode 100644
index 000000000000..4253f472f060
--- /dev/null
+++ b/kernel/notifier.c
@@ -0,0 +1,539 @@
1#include <linux/kdebug.h>
2#include <linux/kprobes.h>
3#include <linux/module.h>
4#include <linux/notifier.h>
5#include <linux/rcupdate.h>
6#include <linux/vmalloc.h>
7
8/*
9 * Notifier list for kernel code which wants to be called
10 * at shutdown. This is used to stop any idling DMA operations
11 * and the like.
12 */
13BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
14
15/*
16 * Notifier chain core routines. The exported routines below
17 * are layered on top of these, with appropriate locking added.
18 */
19
20static int notifier_chain_register(struct notifier_block **nl,
21 struct notifier_block *n)
22{
23 while ((*nl) != NULL) {
24 if (n->priority > (*nl)->priority)
25 break;
26 nl = &((*nl)->next);
27 }
28 n->next = *nl;
29 rcu_assign_pointer(*nl, n);
30 return 0;
31}
32
33static int notifier_chain_unregister(struct notifier_block **nl,
34 struct notifier_block *n)
35{
36 while ((*nl) != NULL) {
37 if ((*nl) == n) {
38 rcu_assign_pointer(*nl, n->next);
39 return 0;
40 }
41 nl = &((*nl)->next);
42 }
43 return -ENOENT;
44}
45
46/**
47 * notifier_call_chain - Informs the registered notifiers about an event.
48 * @nl: Pointer to head of the blocking notifier chain
49 * @val: Value passed unmodified to notifier function
50 * @v: Pointer passed unmodified to notifier function
51 * @nr_to_call: Number of notifier functions to be called. Don't care
52 * value of this parameter is -1.
53 * @nr_calls: Records the number of notifications sent. Don't care
54 * value of this field is NULL.
55 * @returns: notifier_call_chain returns the value returned by the
56 * last notifier function called.
57 */
58static int __kprobes notifier_call_chain(struct notifier_block **nl,
59 unsigned long val, void *v,
60 int nr_to_call, int *nr_calls)
61{
62 int ret = NOTIFY_DONE;
63 struct notifier_block *nb, *next_nb;
64
65 nb = rcu_dereference(*nl);
66
67 while (nb && nr_to_call) {
68 next_nb = rcu_dereference(nb->next);
69 ret = nb->notifier_call(nb, val, v);
70
71 if (nr_calls)
72 (*nr_calls)++;
73
74 if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)
75 break;
76 nb = next_nb;
77 nr_to_call--;
78 }
79 return ret;
80}
81
82/*
83 * Atomic notifier chain routines. Registration and unregistration
84 * use a spinlock, and call_chain is synchronized by RCU (no locks).
85 */
86
87/**
88 * atomic_notifier_chain_register - Add notifier to an atomic notifier chain
89 * @nh: Pointer to head of the atomic notifier chain
90 * @n: New entry in notifier chain
91 *
92 * Adds a notifier to an atomic notifier chain.
93 *
94 * Currently always returns zero.
95 */
96int atomic_notifier_chain_register(struct atomic_notifier_head *nh,
97 struct notifier_block *n)
98{
99 unsigned long flags;
100 int ret;
101
102 spin_lock_irqsave(&nh->lock, flags);
103 ret = notifier_chain_register(&nh->head, n);
104 spin_unlock_irqrestore(&nh->lock, flags);
105 return ret;
106}
107EXPORT_SYMBOL_GPL(atomic_notifier_chain_register);
108
109/**
110 * atomic_notifier_chain_unregister - Remove notifier from an atomic notifier chain
111 * @nh: Pointer to head of the atomic notifier chain
112 * @n: Entry to remove from notifier chain
113 *
114 * Removes a notifier from an atomic notifier chain.
115 *
116 * Returns zero on success or %-ENOENT on failure.
117 */
118int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
119 struct notifier_block *n)
120{
121 unsigned long flags;
122 int ret;
123
124 spin_lock_irqsave(&nh->lock, flags);
125 ret = notifier_chain_unregister(&nh->head, n);
126 spin_unlock_irqrestore(&nh->lock, flags);
127 synchronize_rcu();
128 return ret;
129}
130EXPORT_SYMBOL_GPL(atomic_notifier_chain_unregister);
131
132/**
133 * __atomic_notifier_call_chain - Call functions in an atomic notifier chain
134 * @nh: Pointer to head of the atomic notifier chain
135 * @val: Value passed unmodified to notifier function
136 * @v: Pointer passed unmodified to notifier function
137 * @nr_to_call: See the comment for notifier_call_chain.
138 * @nr_calls: See the comment for notifier_call_chain.
139 *
140 * Calls each function in a notifier chain in turn. The functions
141 * run in an atomic context, so they must not block.
142 * This routine uses RCU to synchronize with changes to the chain.
143 *
144 * If the return value of the notifier can be and'ed
145 * with %NOTIFY_STOP_MASK then atomic_notifier_call_chain()
146 * will return immediately, with the return value of
147 * the notifier function which halted execution.
148 * Otherwise the return value is the return value
149 * of the last notifier function called.
150 */
151int __kprobes __atomic_notifier_call_chain(struct atomic_notifier_head *nh,
152 unsigned long val, void *v,
153 int nr_to_call, int *nr_calls)
154{
155 int ret;
156
157 rcu_read_lock();
158 ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
159 rcu_read_unlock();
160 return ret;
161}
162EXPORT_SYMBOL_GPL(__atomic_notifier_call_chain);
163
164int __kprobes atomic_notifier_call_chain(struct atomic_notifier_head *nh,
165 unsigned long val, void *v)
166{
167 return __atomic_notifier_call_chain(nh, val, v, -1, NULL);
168}
169EXPORT_SYMBOL_GPL(atomic_notifier_call_chain);
170
171/*
172 * Blocking notifier chain routines. All access to the chain is
173 * synchronized by an rwsem.
174 */
175
176/**
177 * blocking_notifier_chain_register - Add notifier to a blocking notifier chain
178 * @nh: Pointer to head of the blocking notifier chain
179 * @n: New entry in notifier chain
180 *
181 * Adds a notifier to a blocking notifier chain.
182 * Must be called in process context.
183 *
184 * Currently always returns zero.
185 */
186int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
187 struct notifier_block *n)
188{
189 int ret;
190
191 /*
192 * This code gets used during boot-up, when task switching is
193 * not yet working and interrupts must remain disabled. At
194 * such times we must not call down_write().
195 */
196 if (unlikely(system_state == SYSTEM_BOOTING))
197 return notifier_chain_register(&nh->head, n);
198
199 down_write(&nh->rwsem);
200 ret = notifier_chain_register(&nh->head, n);
201 up_write(&nh->rwsem);
202 return ret;
203}
204EXPORT_SYMBOL_GPL(blocking_notifier_chain_register);
205
206/**
207 * blocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain
208 * @nh: Pointer to head of the blocking notifier chain
209 * @n: Entry to remove from notifier chain
210 *
211 * Removes a notifier from a blocking notifier chain.
212 * Must be called from process context.
213 *
214 * Returns zero on success or %-ENOENT on failure.
215 */
216int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
217 struct notifier_block *n)
218{
219 int ret;
220
221 /*
222 * This code gets used during boot-up, when task switching is
223 * not yet working and interrupts must remain disabled. At
224 * such times we must not call down_write().
225 */
226 if (unlikely(system_state == SYSTEM_BOOTING))
227 return notifier_chain_unregister(&nh->head, n);
228
229 down_write(&nh->rwsem);
230 ret = notifier_chain_unregister(&nh->head, n);
231 up_write(&nh->rwsem);
232 return ret;
233}
234EXPORT_SYMBOL_GPL(blocking_notifier_chain_unregister);
235
236/**
237 * __blocking_notifier_call_chain - Call functions in a blocking notifier chain
238 * @nh: Pointer to head of the blocking notifier chain
239 * @val: Value passed unmodified to notifier function
240 * @v: Pointer passed unmodified to notifier function
241 * @nr_to_call: See comment for notifier_call_chain.
242 * @nr_calls: See comment for notifier_call_chain.
243 *
244 * Calls each function in a notifier chain in turn. The functions
245 * run in a process context, so they are allowed to block.
246 *
247 * If the return value of the notifier can be and'ed
248 * with %NOTIFY_STOP_MASK then blocking_notifier_call_chain()
249 * will return immediately, with the return value of
250 * the notifier function which halted execution.
251 * Otherwise the return value is the return value
252 * of the last notifier function called.
253 */
254int __blocking_notifier_call_chain(struct blocking_notifier_head *nh,
255 unsigned long val, void *v,
256 int nr_to_call, int *nr_calls)
257{
258 int ret = NOTIFY_DONE;
259
260 /*
261 * We check the head outside the lock, but if this access is
262 * racy then it does not matter what the result of the test
263 * is, we re-check the list after having taken the lock anyway:
264 */
265 if (rcu_dereference(nh->head)) {
266 down_read(&nh->rwsem);
267 ret = notifier_call_chain(&nh->head, val, v, nr_to_call,
268 nr_calls);
269 up_read(&nh->rwsem);
270 }
271 return ret;
272}
273EXPORT_SYMBOL_GPL(__blocking_notifier_call_chain);
274
275int blocking_notifier_call_chain(struct blocking_notifier_head *nh,
276 unsigned long val, void *v)
277{
278 return __blocking_notifier_call_chain(nh, val, v, -1, NULL);
279}
280EXPORT_SYMBOL_GPL(blocking_notifier_call_chain);
281
282/*
283 * Raw notifier chain routines. There is no protection;
284 * the caller must provide it. Use at your own risk!
285 */
286
287/**
288 * raw_notifier_chain_register - Add notifier to a raw notifier chain
289 * @nh: Pointer to head of the raw notifier chain
290 * @n: New entry in notifier chain
291 *
292 * Adds a notifier to a raw notifier chain.
293 * All locking must be provided by the caller.
294 *
295 * Currently always returns zero.
296 */
297int raw_notifier_chain_register(struct raw_notifier_head *nh,
298 struct notifier_block *n)
299{
300 return notifier_chain_register(&nh->head, n);
301}
302EXPORT_SYMBOL_GPL(raw_notifier_chain_register);
303
304/**
305 * raw_notifier_chain_unregister - Remove notifier from a raw notifier chain
306 * @nh: Pointer to head of the raw notifier chain
307 * @n: Entry to remove from notifier chain
308 *
309 * Removes a notifier from a raw notifier chain.
310 * All locking must be provided by the caller.
311 *
312 * Returns zero on success or %-ENOENT on failure.
313 */
314int raw_notifier_chain_unregister(struct raw_notifier_head *nh,
315 struct notifier_block *n)
316{
317 return notifier_chain_unregister(&nh->head, n);
318}
319EXPORT_SYMBOL_GPL(raw_notifier_chain_unregister);
320
321/**
322 * __raw_notifier_call_chain - Call functions in a raw notifier chain
323 * @nh: Pointer to head of the raw notifier chain
324 * @val: Value passed unmodified to notifier function
325 * @v: Pointer passed unmodified to notifier function
326 * @nr_to_call: See comment for notifier_call_chain.
327 * @nr_calls: See comment for notifier_call_chain
328 *
329 * Calls each function in a notifier chain in turn. The functions
330 * run in an undefined context.
331 * All locking must be provided by the caller.
332 *
333 * If the return value of the notifier can be and'ed
334 * with %NOTIFY_STOP_MASK then raw_notifier_call_chain()
335 * will return immediately, with the return value of
336 * the notifier function which halted execution.
337 * Otherwise the return value is the return value
338 * of the last notifier function called.
339 */
340int __raw_notifier_call_chain(struct raw_notifier_head *nh,
341 unsigned long val, void *v,
342 int nr_to_call, int *nr_calls)
343{
344 return notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
345}
346EXPORT_SYMBOL_GPL(__raw_notifier_call_chain);
347
348int raw_notifier_call_chain(struct raw_notifier_head *nh,
349 unsigned long val, void *v)
350{
351 return __raw_notifier_call_chain(nh, val, v, -1, NULL);
352}
353EXPORT_SYMBOL_GPL(raw_notifier_call_chain);
354
355/*
356 * SRCU notifier chain routines. Registration and unregistration
357 * use a mutex, and call_chain is synchronized by SRCU (no locks).
358 */
359
360/**
361 * srcu_notifier_chain_register - Add notifier to an SRCU notifier chain
362 * @nh: Pointer to head of the SRCU notifier chain
363 * @n: New entry in notifier chain
364 *
365 * Adds a notifier to an SRCU notifier chain.
366 * Must be called in process context.
367 *
368 * Currently always returns zero.
369 */
370int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
371 struct notifier_block *n)
372{
373 int ret;
374
375 /*
376 * This code gets used during boot-up, when task switching is
377 * not yet working and interrupts must remain disabled. At
378 * such times we must not call mutex_lock().
379 */
380 if (unlikely(system_state == SYSTEM_BOOTING))
381 return notifier_chain_register(&nh->head, n);
382
383 mutex_lock(&nh->mutex);
384 ret = notifier_chain_register(&nh->head, n);
385 mutex_unlock(&nh->mutex);
386 return ret;
387}
388EXPORT_SYMBOL_GPL(srcu_notifier_chain_register);
389
390/**
391 * srcu_notifier_chain_unregister - Remove notifier from an SRCU notifier chain
392 * @nh: Pointer to head of the SRCU notifier chain
393 * @n: Entry to remove from notifier chain
394 *
395 * Removes a notifier from an SRCU notifier chain.
396 * Must be called from process context.
397 *
398 * Returns zero on success or %-ENOENT on failure.
399 */
400int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh,
401 struct notifier_block *n)
402{
403 int ret;
404
405 /*
406 * This code gets used during boot-up, when task switching is
407 * not yet working and interrupts must remain disabled. At
408 * such times we must not call mutex_lock().
409 */
410 if (unlikely(system_state == SYSTEM_BOOTING))
411 return notifier_chain_unregister(&nh->head, n);
412
413 mutex_lock(&nh->mutex);
414 ret = notifier_chain_unregister(&nh->head, n);
415 mutex_unlock(&nh->mutex);
416 synchronize_srcu(&nh->srcu);
417 return ret;
418}
419EXPORT_SYMBOL_GPL(srcu_notifier_chain_unregister);
420
421/**
422 * __srcu_notifier_call_chain - Call functions in an SRCU notifier chain
423 * @nh: Pointer to head of the SRCU notifier chain
424 * @val: Value passed unmodified to notifier function
425 * @v: Pointer passed unmodified to notifier function
426 * @nr_to_call: See comment for notifier_call_chain.
427 * @nr_calls: See comment for notifier_call_chain
428 *
429 * Calls each function in a notifier chain in turn. The functions
430 * run in a process context, so they are allowed to block.
431 *
432 * If the return value of the notifier can be and'ed
433 * with %NOTIFY_STOP_MASK then srcu_notifier_call_chain()
434 * will return immediately, with the return value of
435 * the notifier function which halted execution.
436 * Otherwise the return value is the return value
437 * of the last notifier function called.
438 */
439int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
440 unsigned long val, void *v,
441 int nr_to_call, int *nr_calls)
442{
443 int ret;
444 int idx;
445
446 idx = srcu_read_lock(&nh->srcu);
447 ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
448 srcu_read_unlock(&nh->srcu, idx);
449 return ret;
450}
451EXPORT_SYMBOL_GPL(__srcu_notifier_call_chain);
452
453int srcu_notifier_call_chain(struct srcu_notifier_head *nh,
454 unsigned long val, void *v)
455{
456 return __srcu_notifier_call_chain(nh, val, v, -1, NULL);
457}
458EXPORT_SYMBOL_GPL(srcu_notifier_call_chain);
459
460/**
461 * srcu_init_notifier_head - Initialize an SRCU notifier head
462 * @nh: Pointer to head of the srcu notifier chain
463 *
464 * Unlike other sorts of notifier heads, SRCU notifier heads require
465 * dynamic initialization. Be sure to call this routine before
466 * calling any of the other SRCU notifier routines for this head.
467 *
468 * If an SRCU notifier head is deallocated, it must first be cleaned
469 * up by calling srcu_cleanup_notifier_head(). Otherwise the head's
470 * per-cpu data (used by the SRCU mechanism) will leak.
471 */
472void srcu_init_notifier_head(struct srcu_notifier_head *nh)
473{
474 mutex_init(&nh->mutex);
475 if (init_srcu_struct(&nh->srcu) < 0)
476 BUG();
477 nh->head = NULL;
478}
479EXPORT_SYMBOL_GPL(srcu_init_notifier_head);
480
481/**
482 * register_reboot_notifier - Register function to be called at reboot time
483 * @nb: Info about notifier function to be called
484 *
485 * Registers a function with the list of functions
486 * to be called at reboot time.
487 *
488 * Currently always returns zero, as blocking_notifier_chain_register()
489 * always returns zero.
490 */
491int register_reboot_notifier(struct notifier_block *nb)
492{
493 return blocking_notifier_chain_register(&reboot_notifier_list, nb);
494}
495EXPORT_SYMBOL(register_reboot_notifier);
496
497/**
498 * unregister_reboot_notifier - Unregister previously registered reboot notifier
499 * @nb: Hook to be unregistered
500 *
501 * Unregisters a previously registered reboot
502 * notifier function.
503 *
504 * Returns zero on success, or %-ENOENT on failure.
505 */
506int unregister_reboot_notifier(struct notifier_block *nb)
507{
508 return blocking_notifier_chain_unregister(&reboot_notifier_list, nb);
509}
510EXPORT_SYMBOL(unregister_reboot_notifier);
511
512static ATOMIC_NOTIFIER_HEAD(die_chain);
513
514int notify_die(enum die_val val, const char *str,
515 struct pt_regs *regs, long err, int trap, int sig)
516{
517 struct die_args args = {
518 .regs = regs,
519 .str = str,
520 .err = err,
521 .trapnr = trap,
522 .signr = sig,
523
524 };
525 return atomic_notifier_call_chain(&die_chain, val, &args);
526}
527
528int register_die_notifier(struct notifier_block *nb)
529{
530 vmalloc_sync_all();
531 return atomic_notifier_chain_register(&die_chain, nb);
532}
533EXPORT_SYMBOL_GPL(register_die_notifier);
534
535int unregister_die_notifier(struct notifier_block *nb)
536{
537 return atomic_notifier_chain_unregister(&die_chain, nb);
538}
539EXPORT_SYMBOL_GPL(unregister_die_notifier);
diff --git a/kernel/ns_cgroup.c b/kernel/ns_cgroup.c
new file mode 100644
index 000000000000..aead4d69f62b
--- /dev/null
+++ b/kernel/ns_cgroup.c
@@ -0,0 +1,100 @@
1/*
2 * ns_cgroup.c - namespace cgroup subsystem
3 *
4 * Copyright 2006, 2007 IBM Corp
5 */
6
7#include <linux/module.h>
8#include <linux/cgroup.h>
9#include <linux/fs.h>
10
11struct ns_cgroup {
12 struct cgroup_subsys_state css;
13 spinlock_t lock;
14};
15
16struct cgroup_subsys ns_subsys;
17
18static inline struct ns_cgroup *cgroup_to_ns(
19 struct cgroup *cgroup)
20{
21 return container_of(cgroup_subsys_state(cgroup, ns_subsys_id),
22 struct ns_cgroup, css);
23}
24
25int ns_cgroup_clone(struct task_struct *task)
26{
27 return cgroup_clone(task, &ns_subsys);
28}
29
30/*
31 * Rules:
32 * 1. you can only enter a cgroup which is a child of your current
33 * cgroup
34 * 2. you can only place another process into a cgroup if
35 * a. you have CAP_SYS_ADMIN
36 * b. your cgroup is an ancestor of task's destination cgroup
37 * (hence either you are in the same cgroup as task, or in an
38 * ancestor cgroup thereof)
39 */
40static int ns_can_attach(struct cgroup_subsys *ss,
41 struct cgroup *new_cgroup, struct task_struct *task)
42{
43 struct cgroup *orig;
44
45 if (current != task) {
46 if (!capable(CAP_SYS_ADMIN))
47 return -EPERM;
48
49 if (!cgroup_is_descendant(new_cgroup))
50 return -EPERM;
51 }
52
53 if (atomic_read(&new_cgroup->count) != 0)
54 return -EPERM;
55
56 orig = task_cgroup(task, ns_subsys_id);
57 if (orig && orig != new_cgroup->parent)
58 return -EPERM;
59
60 return 0;
61}
62
63/*
64 * Rules: you can only create a cgroup if
65 * 1. you are capable(CAP_SYS_ADMIN)
66 * 2. the target cgroup is a descendant of your own cgroup
67 */
68static struct cgroup_subsys_state *ns_create(struct cgroup_subsys *ss,
69 struct cgroup *cgroup)
70{
71 struct ns_cgroup *ns_cgroup;
72
73 if (!capable(CAP_SYS_ADMIN))
74 return ERR_PTR(-EPERM);
75 if (!cgroup_is_descendant(cgroup))
76 return ERR_PTR(-EPERM);
77
78 ns_cgroup = kzalloc(sizeof(*ns_cgroup), GFP_KERNEL);
79 if (!ns_cgroup)
80 return ERR_PTR(-ENOMEM);
81 spin_lock_init(&ns_cgroup->lock);
82 return &ns_cgroup->css;
83}
84
85static void ns_destroy(struct cgroup_subsys *ss,
86 struct cgroup *cgroup)
87{
88 struct ns_cgroup *ns_cgroup;
89
90 ns_cgroup = cgroup_to_ns(cgroup);
91 kfree(ns_cgroup);
92}
93
94struct cgroup_subsys ns_subsys = {
95 .name = "ns",
96 .can_attach = ns_can_attach,
97 .create = ns_create,
98 .destroy = ns_destroy,
99 .subsys_id = ns_subsys_id,
100};
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 049e7c0ac566..79f871bc0ef4 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -26,19 +26,6 @@ static struct kmem_cache *nsproxy_cachep;
26 26
27struct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy); 27struct nsproxy init_nsproxy = INIT_NSPROXY(init_nsproxy);
28 28
29static inline void get_nsproxy(struct nsproxy *ns)
30{
31 atomic_inc(&ns->count);
32}
33
34void get_task_namespaces(struct task_struct *tsk)
35{
36 struct nsproxy *ns = tsk->nsproxy;
37 if (ns) {
38 get_nsproxy(ns);
39 }
40}
41
42/* 29/*
43 * creates a copy of "orig" with refcount 1. 30 * creates a copy of "orig" with refcount 1.
44 */ 31 */
@@ -87,7 +74,7 @@ static struct nsproxy *create_new_namespaces(unsigned long flags,
87 goto out_ipc; 74 goto out_ipc;
88 } 75 }
89 76
90 new_nsp->pid_ns = copy_pid_ns(flags, tsk->nsproxy->pid_ns); 77 new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk));
91 if (IS_ERR(new_nsp->pid_ns)) { 78 if (IS_ERR(new_nsp->pid_ns)) {
92 err = PTR_ERR(new_nsp->pid_ns); 79 err = PTR_ERR(new_nsp->pid_ns);
93 goto out_pid; 80 goto out_pid;
@@ -142,7 +129,8 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
142 129
143 get_nsproxy(old_ns); 130 get_nsproxy(old_ns);
144 131
145 if (!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER | CLONE_NEWNET))) 132 if (!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
133 CLONE_NEWUSER | CLONE_NEWPID | CLONE_NEWNET)))
146 return 0; 134 return 0;
147 135
148 if (!capable(CAP_SYS_ADMIN)) { 136 if (!capable(CAP_SYS_ADMIN)) {
@@ -156,7 +144,14 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
156 goto out; 144 goto out;
157 } 145 }
158 146
147 err = ns_cgroup_clone(tsk);
148 if (err) {
149 put_nsproxy(new_ns);
150 goto out;
151 }
152
159 tsk->nsproxy = new_ns; 153 tsk->nsproxy = new_ns;
154
160out: 155out:
161 put_nsproxy(old_ns); 156 put_nsproxy(old_ns);
162 return err; 157 return err;
@@ -196,11 +191,46 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags,
196 191
197 *new_nsp = create_new_namespaces(unshare_flags, current, 192 *new_nsp = create_new_namespaces(unshare_flags, current,
198 new_fs ? new_fs : current->fs); 193 new_fs ? new_fs : current->fs);
199 if (IS_ERR(*new_nsp)) 194 if (IS_ERR(*new_nsp)) {
200 err = PTR_ERR(*new_nsp); 195 err = PTR_ERR(*new_nsp);
196 goto out;
197 }
198
199 err = ns_cgroup_clone(current);
200 if (err)
201 put_nsproxy(*new_nsp);
202
203out:
201 return err; 204 return err;
202} 205}
203 206
207void switch_task_namespaces(struct task_struct *p, struct nsproxy *new)
208{
209 struct nsproxy *ns;
210
211 might_sleep();
212
213 ns = p->nsproxy;
214
215 rcu_assign_pointer(p->nsproxy, new);
216
217 if (ns && atomic_dec_and_test(&ns->count)) {
218 /*
219 * wait for others to get what they want from this nsproxy.
220 *
221 * cannot release this nsproxy via the call_rcu() since
222 * put_mnt_ns() will want to sleep
223 */
224 synchronize_rcu();
225 free_nsproxy(ns);
226 }
227}
228
229void exit_task_namespaces(struct task_struct *p)
230{
231 switch_task_namespaces(p, NULL);
232}
233
204static int __init nsproxy_cache_init(void) 234static int __init nsproxy_cache_init(void)
205{ 235{
206 nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC); 236 nsproxy_cachep = KMEM_CACHE(nsproxy, SLAB_PANIC);
diff --git a/kernel/panic.c b/kernel/panic.c
index f64f4c1ac11f..6f6e03e91595 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -56,14 +56,14 @@ EXPORT_SYMBOL(panic_blink);
56 * 56 *
57 * This function never returns. 57 * This function never returns.
58 */ 58 */
59 59
60NORET_TYPE void panic(const char * fmt, ...) 60NORET_TYPE void panic(const char * fmt, ...)
61{ 61{
62 long i; 62 long i;
63 static char buf[1024]; 63 static char buf[1024];
64 va_list args; 64 va_list args;
65#if defined(CONFIG_S390) 65#if defined(CONFIG_S390)
66 unsigned long caller = (unsigned long) __builtin_return_address(0); 66 unsigned long caller = (unsigned long) __builtin_return_address(0);
67#endif 67#endif
68 68
69 /* 69 /*
@@ -128,7 +128,7 @@ NORET_TYPE void panic(const char * fmt, ...)
128 } 128 }
129#endif 129#endif
130#if defined(CONFIG_S390) 130#if defined(CONFIG_S390)
131 disabled_wait(caller); 131 disabled_wait(caller);
132#endif 132#endif
133 local_irq_enable(); 133 local_irq_enable();
134 for (i = 0;;) { 134 for (i = 0;;) {
@@ -148,13 +148,13 @@ EXPORT_SYMBOL(panic);
148 * 'F' - Module has been forcibly loaded. 148 * 'F' - Module has been forcibly loaded.
149 * 'S' - SMP with CPUs not designed for SMP. 149 * 'S' - SMP with CPUs not designed for SMP.
150 * 'R' - User forced a module unload. 150 * 'R' - User forced a module unload.
151 * 'M' - Machine had a machine check experience. 151 * 'M' - System experienced a machine check exception.
152 * 'B' - System has hit bad_page. 152 * 'B' - System has hit bad_page.
153 * 'U' - Userspace-defined naughtiness. 153 * 'U' - Userspace-defined naughtiness.
154 * 154 *
155 * The string is overwritten by the next call to print_taint(). 155 * The string is overwritten by the next call to print_taint().
156 */ 156 */
157 157
158const char *print_tainted(void) 158const char *print_tainted(void)
159{ 159{
160 static char buf[20]; 160 static char buf[20];
@@ -164,7 +164,7 @@ const char *print_tainted(void)
164 tainted & TAINT_FORCED_MODULE ? 'F' : ' ', 164 tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
165 tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', 165 tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
166 tainted & TAINT_FORCED_RMMOD ? 'R' : ' ', 166 tainted & TAINT_FORCED_RMMOD ? 'R' : ' ',
167 tainted & TAINT_MACHINE_CHECK ? 'M' : ' ', 167 tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
168 tainted & TAINT_BAD_PAGE ? 'B' : ' ', 168 tainted & TAINT_BAD_PAGE ? 'B' : ' ',
169 tainted & TAINT_USER ? 'U' : ' ', 169 tainted & TAINT_USER ? 'U' : ' ',
170 tainted & TAINT_DIE ? 'D' : ' '); 170 tainted & TAINT_DIE ? 'D' : ' ');
diff --git a/kernel/params.c b/kernel/params.c
index 1d6aca288cdc..16f269e9ddc9 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -592,11 +592,17 @@ static void __init param_sysfs_builtin(void)
592 592
593 for (i=0; i < __stop___param - __start___param; i++) { 593 for (i=0; i < __stop___param - __start___param; i++) {
594 char *dot; 594 char *dot;
595 size_t kplen;
595 596
596 kp = &__start___param[i]; 597 kp = &__start___param[i];
598 kplen = strlen(kp->name);
597 599
598 /* We do not handle args without periods. */ 600 /* We do not handle args without periods. */
599 dot = memchr(kp->name, '.', MAX_KBUILD_MODNAME); 601 if (kplen > MAX_KBUILD_MODNAME) {
602 DEBUGP("kernel parameter name is too long: %s\n", kp->name);
603 continue;
604 }
605 dot = memchr(kp->name, '.', kplen);
600 if (!dot) { 606 if (!dot) {
601 DEBUGP("couldn't find period in %s\n", kp->name); 607 DEBUGP("couldn't find period in %s\n", kp->name);
602 continue; 608 continue;
diff --git a/kernel/pid.c b/kernel/pid.c
index c6e3f9ffff87..d1db36b94674 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -18,6 +18,12 @@
18 * allocation scenario when all but one out of 1 million PIDs possible are 18 * allocation scenario when all but one out of 1 million PIDs possible are
19 * allocated already: the scanning of 32 list entries and at most PAGE_SIZE 19 * allocated already: the scanning of 32 list entries and at most PAGE_SIZE
20 * bytes. The typical fastpath is a single successful setbit. Freeing is O(1). 20 * bytes. The typical fastpath is a single successful setbit. Freeing is O(1).
21 *
22 * Pid namespaces:
23 * (C) 2007 Pavel Emelyanov <xemul@openvz.org>, OpenVZ, SWsoft Inc.
24 * (C) 2007 Sukadev Bhattiprolu <sukadev@us.ibm.com>, IBM
25 * Many thanks to Oleg Nesterov for comments and help
26 *
21 */ 27 */
22 28
23#include <linux/mm.h> 29#include <linux/mm.h>
@@ -28,12 +34,14 @@
28#include <linux/hash.h> 34#include <linux/hash.h>
29#include <linux/pid_namespace.h> 35#include <linux/pid_namespace.h>
30#include <linux/init_task.h> 36#include <linux/init_task.h>
37#include <linux/syscalls.h>
31 38
32#define pid_hashfn(nr) hash_long((unsigned long)nr, pidhash_shift) 39#define pid_hashfn(nr, ns) \
40 hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift)
33static struct hlist_head *pid_hash; 41static struct hlist_head *pid_hash;
34static int pidhash_shift; 42static int pidhash_shift;
35static struct kmem_cache *pid_cachep;
36struct pid init_struct_pid = INIT_STRUCT_PID; 43struct pid init_struct_pid = INIT_STRUCT_PID;
44static struct kmem_cache *pid_ns_cachep;
37 45
38int pid_max = PID_MAX_DEFAULT; 46int pid_max = PID_MAX_DEFAULT;
39 47
@@ -68,8 +76,25 @@ struct pid_namespace init_pid_ns = {
68 [ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL } 76 [ 0 ... PIDMAP_ENTRIES-1] = { ATOMIC_INIT(BITS_PER_PAGE), NULL }
69 }, 77 },
70 .last_pid = 0, 78 .last_pid = 0,
71 .child_reaper = &init_task 79 .level = 0,
80 .child_reaper = &init_task,
72}; 81};
82EXPORT_SYMBOL_GPL(init_pid_ns);
83
84int is_container_init(struct task_struct *tsk)
85{
86 int ret = 0;
87 struct pid *pid;
88
89 rcu_read_lock();
90 pid = task_pid(tsk);
91 if (pid != NULL && pid->numbers[pid->level].nr == 1)
92 ret = 1;
93 rcu_read_unlock();
94
95 return ret;
96}
97EXPORT_SYMBOL(is_container_init);
73 98
74/* 99/*
75 * Note: disable interrupts while the pidmap_lock is held as an 100 * Note: disable interrupts while the pidmap_lock is held as an
@@ -176,11 +201,17 @@ static int next_pidmap(struct pid_namespace *pid_ns, int last)
176 201
177fastcall void put_pid(struct pid *pid) 202fastcall void put_pid(struct pid *pid)
178{ 203{
204 struct pid_namespace *ns;
205
179 if (!pid) 206 if (!pid)
180 return; 207 return;
208
209 ns = pid->numbers[pid->level].ns;
181 if ((atomic_read(&pid->count) == 1) || 210 if ((atomic_read(&pid->count) == 1) ||
182 atomic_dec_and_test(&pid->count)) 211 atomic_dec_and_test(&pid->count)) {
183 kmem_cache_free(pid_cachep, pid); 212 kmem_cache_free(ns->pid_cachep, pid);
213 put_pid_ns(ns);
214 }
184} 215}
185EXPORT_SYMBOL_GPL(put_pid); 216EXPORT_SYMBOL_GPL(put_pid);
186 217
@@ -193,60 +224,94 @@ static void delayed_put_pid(struct rcu_head *rhp)
193fastcall void free_pid(struct pid *pid) 224fastcall void free_pid(struct pid *pid)
194{ 225{
195 /* We can be called with write_lock_irq(&tasklist_lock) held */ 226 /* We can be called with write_lock_irq(&tasklist_lock) held */
227 int i;
196 unsigned long flags; 228 unsigned long flags;
197 229
198 spin_lock_irqsave(&pidmap_lock, flags); 230 spin_lock_irqsave(&pidmap_lock, flags);
199 hlist_del_rcu(&pid->pid_chain); 231 for (i = 0; i <= pid->level; i++)
232 hlist_del_rcu(&pid->numbers[i].pid_chain);
200 spin_unlock_irqrestore(&pidmap_lock, flags); 233 spin_unlock_irqrestore(&pidmap_lock, flags);
201 234
202 free_pidmap(&init_pid_ns, pid->nr); 235 for (i = 0; i <= pid->level; i++)
236 free_pidmap(pid->numbers[i].ns, pid->numbers[i].nr);
237
203 call_rcu(&pid->rcu, delayed_put_pid); 238 call_rcu(&pid->rcu, delayed_put_pid);
204} 239}
205 240
206struct pid *alloc_pid(void) 241struct pid *alloc_pid(struct pid_namespace *ns)
207{ 242{
208 struct pid *pid; 243 struct pid *pid;
209 enum pid_type type; 244 enum pid_type type;
210 int nr = -1; 245 int i, nr;
246 struct pid_namespace *tmp;
247 struct upid *upid;
211 248
212 pid = kmem_cache_alloc(pid_cachep, GFP_KERNEL); 249 pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
213 if (!pid) 250 if (!pid)
214 goto out; 251 goto out;
215 252
216 nr = alloc_pidmap(current->nsproxy->pid_ns); 253 tmp = ns;
217 if (nr < 0) 254 for (i = ns->level; i >= 0; i--) {
218 goto out_free; 255 nr = alloc_pidmap(tmp);
256 if (nr < 0)
257 goto out_free;
258
259 pid->numbers[i].nr = nr;
260 pid->numbers[i].ns = tmp;
261 tmp = tmp->parent;
262 }
219 263
264 get_pid_ns(ns);
265 pid->level = ns->level;
220 atomic_set(&pid->count, 1); 266 atomic_set(&pid->count, 1);
221 pid->nr = nr;
222 for (type = 0; type < PIDTYPE_MAX; ++type) 267 for (type = 0; type < PIDTYPE_MAX; ++type)
223 INIT_HLIST_HEAD(&pid->tasks[type]); 268 INIT_HLIST_HEAD(&pid->tasks[type]);
224 269
225 spin_lock_irq(&pidmap_lock); 270 spin_lock_irq(&pidmap_lock);
226 hlist_add_head_rcu(&pid->pid_chain, &pid_hash[pid_hashfn(pid->nr)]); 271 for (i = ns->level; i >= 0; i--) {
272 upid = &pid->numbers[i];
273 hlist_add_head_rcu(&upid->pid_chain,
274 &pid_hash[pid_hashfn(upid->nr, upid->ns)]);
275 }
227 spin_unlock_irq(&pidmap_lock); 276 spin_unlock_irq(&pidmap_lock);
228 277
229out: 278out:
230 return pid; 279 return pid;
231 280
232out_free: 281out_free:
233 kmem_cache_free(pid_cachep, pid); 282 for (i++; i <= ns->level; i++)
283 free_pidmap(pid->numbers[i].ns, pid->numbers[i].nr);
284
285 kmem_cache_free(ns->pid_cachep, pid);
234 pid = NULL; 286 pid = NULL;
235 goto out; 287 goto out;
236} 288}
237 289
238struct pid * fastcall find_pid(int nr) 290struct pid * fastcall find_pid_ns(int nr, struct pid_namespace *ns)
239{ 291{
240 struct hlist_node *elem; 292 struct hlist_node *elem;
241 struct pid *pid; 293 struct upid *pnr;
294
295 hlist_for_each_entry_rcu(pnr, elem,
296 &pid_hash[pid_hashfn(nr, ns)], pid_chain)
297 if (pnr->nr == nr && pnr->ns == ns)
298 return container_of(pnr, struct pid,
299 numbers[ns->level]);
242 300
243 hlist_for_each_entry_rcu(pid, elem,
244 &pid_hash[pid_hashfn(nr)], pid_chain) {
245 if (pid->nr == nr)
246 return pid;
247 }
248 return NULL; 301 return NULL;
249} 302}
303EXPORT_SYMBOL_GPL(find_pid_ns);
304
305struct pid *find_vpid(int nr)
306{
307 return find_pid_ns(nr, current->nsproxy->pid_ns);
308}
309EXPORT_SYMBOL_GPL(find_vpid);
310
311struct pid *find_pid(int nr)
312{
313 return find_pid_ns(nr, &init_pid_ns);
314}
250EXPORT_SYMBOL_GPL(find_pid); 315EXPORT_SYMBOL_GPL(find_pid);
251 316
252/* 317/*
@@ -307,12 +372,32 @@ struct task_struct * fastcall pid_task(struct pid *pid, enum pid_type type)
307/* 372/*
308 * Must be called under rcu_read_lock() or with tasklist_lock read-held. 373 * Must be called under rcu_read_lock() or with tasklist_lock read-held.
309 */ 374 */
310struct task_struct *find_task_by_pid_type(int type, int nr) 375struct task_struct *find_task_by_pid_type_ns(int type, int nr,
376 struct pid_namespace *ns)
311{ 377{
312 return pid_task(find_pid(nr), type); 378 return pid_task(find_pid_ns(nr, ns), type);
313} 379}
314 380
315EXPORT_SYMBOL(find_task_by_pid_type); 381EXPORT_SYMBOL(find_task_by_pid_type_ns);
382
383struct task_struct *find_task_by_pid(pid_t nr)
384{
385 return find_task_by_pid_type_ns(PIDTYPE_PID, nr, &init_pid_ns);
386}
387EXPORT_SYMBOL(find_task_by_pid);
388
389struct task_struct *find_task_by_vpid(pid_t vnr)
390{
391 return find_task_by_pid_type_ns(PIDTYPE_PID, vnr,
392 current->nsproxy->pid_ns);
393}
394EXPORT_SYMBOL(find_task_by_vpid);
395
396struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
397{
398 return find_task_by_pid_type_ns(PIDTYPE_PID, nr, ns);
399}
400EXPORT_SYMBOL(find_task_by_pid_ns);
316 401
317struct pid *get_task_pid(struct task_struct *task, enum pid_type type) 402struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
318{ 403{
@@ -339,45 +424,239 @@ struct pid *find_get_pid(pid_t nr)
339 struct pid *pid; 424 struct pid *pid;
340 425
341 rcu_read_lock(); 426 rcu_read_lock();
342 pid = get_pid(find_pid(nr)); 427 pid = get_pid(find_vpid(nr));
343 rcu_read_unlock(); 428 rcu_read_unlock();
344 429
345 return pid; 430 return pid;
346} 431}
347 432
433pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
434{
435 struct upid *upid;
436 pid_t nr = 0;
437
438 if (pid && ns->level <= pid->level) {
439 upid = &pid->numbers[ns->level];
440 if (upid->ns == ns)
441 nr = upid->nr;
442 }
443 return nr;
444}
445
446pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
447{
448 return pid_nr_ns(task_pid(tsk), ns);
449}
450EXPORT_SYMBOL(task_pid_nr_ns);
451
452pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
453{
454 return pid_nr_ns(task_tgid(tsk), ns);
455}
456EXPORT_SYMBOL(task_tgid_nr_ns);
457
458pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
459{
460 return pid_nr_ns(task_pgrp(tsk), ns);
461}
462EXPORT_SYMBOL(task_pgrp_nr_ns);
463
464pid_t task_session_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
465{
466 return pid_nr_ns(task_session(tsk), ns);
467}
468EXPORT_SYMBOL(task_session_nr_ns);
469
348/* 470/*
349 * Used by proc to find the first pid that is greater then or equal to nr. 471 * Used by proc to find the first pid that is greater then or equal to nr.
350 * 472 *
351 * If there is a pid at nr this function is exactly the same as find_pid. 473 * If there is a pid at nr this function is exactly the same as find_pid.
352 */ 474 */
353struct pid *find_ge_pid(int nr) 475struct pid *find_ge_pid(int nr, struct pid_namespace *ns)
354{ 476{
355 struct pid *pid; 477 struct pid *pid;
356 478
357 do { 479 do {
358 pid = find_pid(nr); 480 pid = find_pid_ns(nr, ns);
359 if (pid) 481 if (pid)
360 break; 482 break;
361 nr = next_pidmap(current->nsproxy->pid_ns, nr); 483 nr = next_pidmap(ns, nr);
362 } while (nr > 0); 484 } while (nr > 0);
363 485
364 return pid; 486 return pid;
365} 487}
366EXPORT_SYMBOL_GPL(find_get_pid); 488EXPORT_SYMBOL_GPL(find_get_pid);
367 489
490struct pid_cache {
491 int nr_ids;
492 char name[16];
493 struct kmem_cache *cachep;
494 struct list_head list;
495};
496
497static LIST_HEAD(pid_caches_lh);
498static DEFINE_MUTEX(pid_caches_mutex);
499
500/*
501 * creates the kmem cache to allocate pids from.
502 * @nr_ids: the number of numerical ids this pid will have to carry
503 */
504
505static struct kmem_cache *create_pid_cachep(int nr_ids)
506{
507 struct pid_cache *pcache;
508 struct kmem_cache *cachep;
509
510 mutex_lock(&pid_caches_mutex);
511 list_for_each_entry (pcache, &pid_caches_lh, list)
512 if (pcache->nr_ids == nr_ids)
513 goto out;
514
515 pcache = kmalloc(sizeof(struct pid_cache), GFP_KERNEL);
516 if (pcache == NULL)
517 goto err_alloc;
518
519 snprintf(pcache->name, sizeof(pcache->name), "pid_%d", nr_ids);
520 cachep = kmem_cache_create(pcache->name,
521 sizeof(struct pid) + (nr_ids - 1) * sizeof(struct upid),
522 0, SLAB_HWCACHE_ALIGN, NULL);
523 if (cachep == NULL)
524 goto err_cachep;
525
526 pcache->nr_ids = nr_ids;
527 pcache->cachep = cachep;
528 list_add(&pcache->list, &pid_caches_lh);
529out:
530 mutex_unlock(&pid_caches_mutex);
531 return pcache->cachep;
532
533err_cachep:
534 kfree(pcache);
535err_alloc:
536 mutex_unlock(&pid_caches_mutex);
537 return NULL;
538}
539
540static struct pid_namespace *create_pid_namespace(int level)
541{
542 struct pid_namespace *ns;
543 int i;
544
545 ns = kmem_cache_alloc(pid_ns_cachep, GFP_KERNEL);
546 if (ns == NULL)
547 goto out;
548
549 ns->pidmap[0].page = kzalloc(PAGE_SIZE, GFP_KERNEL);
550 if (!ns->pidmap[0].page)
551 goto out_free;
552
553 ns->pid_cachep = create_pid_cachep(level + 1);
554 if (ns->pid_cachep == NULL)
555 goto out_free_map;
556
557 kref_init(&ns->kref);
558 ns->last_pid = 0;
559 ns->child_reaper = NULL;
560 ns->level = level;
561
562 set_bit(0, ns->pidmap[0].page);
563 atomic_set(&ns->pidmap[0].nr_free, BITS_PER_PAGE - 1);
564
565 for (i = 1; i < PIDMAP_ENTRIES; i++) {
566 ns->pidmap[i].page = 0;
567 atomic_set(&ns->pidmap[i].nr_free, BITS_PER_PAGE);
568 }
569
570 return ns;
571
572out_free_map:
573 kfree(ns->pidmap[0].page);
574out_free:
575 kmem_cache_free(pid_ns_cachep, ns);
576out:
577 return ERR_PTR(-ENOMEM);
578}
579
580static void destroy_pid_namespace(struct pid_namespace *ns)
581{
582 int i;
583
584 for (i = 0; i < PIDMAP_ENTRIES; i++)
585 kfree(ns->pidmap[i].page);
586 kmem_cache_free(pid_ns_cachep, ns);
587}
588
368struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old_ns) 589struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *old_ns)
369{ 590{
591 struct pid_namespace *new_ns;
592
370 BUG_ON(!old_ns); 593 BUG_ON(!old_ns);
371 get_pid_ns(old_ns); 594 new_ns = get_pid_ns(old_ns);
372 return old_ns; 595 if (!(flags & CLONE_NEWPID))
596 goto out;
597
598 new_ns = ERR_PTR(-EINVAL);
599 if (flags & CLONE_THREAD)
600 goto out_put;
601
602 new_ns = create_pid_namespace(old_ns->level + 1);
603 if (!IS_ERR(new_ns))
604 new_ns->parent = get_pid_ns(old_ns);
605
606out_put:
607 put_pid_ns(old_ns);
608out:
609 return new_ns;
373} 610}
374 611
375void free_pid_ns(struct kref *kref) 612void free_pid_ns(struct kref *kref)
376{ 613{
377 struct pid_namespace *ns; 614 struct pid_namespace *ns, *parent;
378 615
379 ns = container_of(kref, struct pid_namespace, kref); 616 ns = container_of(kref, struct pid_namespace, kref);
380 kfree(ns); 617
618 parent = ns->parent;
619 destroy_pid_namespace(ns);
620
621 if (parent != NULL)
622 put_pid_ns(parent);
623}
624
625void zap_pid_ns_processes(struct pid_namespace *pid_ns)
626{
627 int nr;
628 int rc;
629
630 /*
631 * The last thread in the cgroup-init thread group is terminating.
632 * Find remaining pid_ts in the namespace, signal and wait for them
633 * to exit.
634 *
635 * Note: This signals each threads in the namespace - even those that
636 * belong to the same thread group, To avoid this, we would have
637 * to walk the entire tasklist looking a processes in this
638 * namespace, but that could be unnecessarily expensive if the
639 * pid namespace has just a few processes. Or we need to
640 * maintain a tasklist for each pid namespace.
641 *
642 */
643 read_lock(&tasklist_lock);
644 nr = next_pidmap(pid_ns, 1);
645 while (nr > 0) {
646 kill_proc_info(SIGKILL, SEND_SIG_PRIV, nr);
647 nr = next_pidmap(pid_ns, nr);
648 }
649 read_unlock(&tasklist_lock);
650
651 do {
652 clear_thread_flag(TIF_SIGPENDING);
653 rc = sys_wait4(-1, NULL, __WALL, NULL);
654 } while (rc != -ECHILD);
655
656
657 /* Child reaper for the pid namespace is going away */
658 pid_ns->child_reaper = NULL;
659 return;
381} 660}
382 661
383/* 662/*
@@ -412,5 +691,9 @@ void __init pidmap_init(void)
412 set_bit(0, init_pid_ns.pidmap[0].page); 691 set_bit(0, init_pid_ns.pidmap[0].page);
413 atomic_dec(&init_pid_ns.pidmap[0].nr_free); 692 atomic_dec(&init_pid_ns.pidmap[0].nr_free);
414 693
415 pid_cachep = KMEM_CACHE(pid, SLAB_PANIC); 694 init_pid_ns.pid_cachep = create_pid_cachep(1);
695 if (init_pid_ns.pid_cachep == NULL)
696 panic("Can't create pid_1 cachep\n");
697
698 pid_ns_cachep = KMEM_CACHE(pid_namespace, SLAB_PANIC);
416} 699}
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index b53c8fcd9d82..68c96376e84a 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -21,8 +21,8 @@ static int check_clock(const clockid_t which_clock)
21 21
22 read_lock(&tasklist_lock); 22 read_lock(&tasklist_lock);
23 p = find_task_by_pid(pid); 23 p = find_task_by_pid(pid);
24 if (!p || (CPUCLOCK_PERTHREAD(which_clock) ? 24 if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ?
25 p->tgid != current->tgid : p->tgid != pid)) { 25 same_thread_group(p, current) : thread_group_leader(p))) {
26 error = -EINVAL; 26 error = -EINVAL;
27 } 27 }
28 read_unlock(&tasklist_lock); 28 read_unlock(&tasklist_lock);
@@ -308,13 +308,13 @@ int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp)
308 p = find_task_by_pid(pid); 308 p = find_task_by_pid(pid);
309 if (p) { 309 if (p) {
310 if (CPUCLOCK_PERTHREAD(which_clock)) { 310 if (CPUCLOCK_PERTHREAD(which_clock)) {
311 if (p->tgid == current->tgid) { 311 if (same_thread_group(p, current)) {
312 error = cpu_clock_sample(which_clock, 312 error = cpu_clock_sample(which_clock,
313 p, &rtn); 313 p, &rtn);
314 } 314 }
315 } else { 315 } else {
316 read_lock(&tasklist_lock); 316 read_lock(&tasklist_lock);
317 if (p->tgid == pid && p->signal) { 317 if (thread_group_leader(p) && p->signal) {
318 error = 318 error =
319 cpu_clock_sample_group(which_clock, 319 cpu_clock_sample_group(which_clock,
320 p, &rtn); 320 p, &rtn);
@@ -355,7 +355,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
355 p = current; 355 p = current;
356 } else { 356 } else {
357 p = find_task_by_pid(pid); 357 p = find_task_by_pid(pid);
358 if (p && p->tgid != current->tgid) 358 if (p && !same_thread_group(p, current))
359 p = NULL; 359 p = NULL;
360 } 360 }
361 } else { 361 } else {
@@ -363,7 +363,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
363 p = current->group_leader; 363 p = current->group_leader;
364 } else { 364 } else {
365 p = find_task_by_pid(pid); 365 p = find_task_by_pid(pid);
366 if (p && p->tgid != pid) 366 if (p && !thread_group_leader(p))
367 p = NULL; 367 p = NULL;
368 } 368 }
369 } 369 }
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index d71ed09fe1dd..35b4bbfc78ff 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -404,7 +404,7 @@ static struct task_struct * good_sigevent(sigevent_t * event)
404 404
405 if ((event->sigev_notify & SIGEV_THREAD_ID ) && 405 if ((event->sigev_notify & SIGEV_THREAD_ID ) &&
406 (!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) || 406 (!(rtn = find_task_by_pid(event->sigev_notify_thread_id)) ||
407 rtn->tgid != current->tgid || 407 !same_thread_group(rtn, current) ||
408 (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL)) 408 (event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL))
409 return NULL; 409 return NULL;
410 410
@@ -608,7 +608,7 @@ static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags)
608 spin_lock(&timr->it_lock); 608 spin_lock(&timr->it_lock);
609 609
610 if ((timr->it_id != timer_id) || !(timr->it_process) || 610 if ((timr->it_id != timer_id) || !(timr->it_process) ||
611 timr->it_process->tgid != current->tgid) { 611 !same_thread_group(timr->it_process, current)) {
612 spin_unlock(&timr->it_lock); 612 spin_unlock(&timr->it_lock);
613 spin_unlock_irqrestore(&idr_lock, *flags); 613 spin_unlock_irqrestore(&idr_lock, *flags);
614 timr = NULL; 614 timr = NULL;
@@ -981,9 +981,20 @@ sys_clock_getres(const clockid_t which_clock, struct timespec __user *tp)
981static int common_nsleep(const clockid_t which_clock, int flags, 981static int common_nsleep(const clockid_t which_clock, int flags,
982 struct timespec *tsave, struct timespec __user *rmtp) 982 struct timespec *tsave, struct timespec __user *rmtp)
983{ 983{
984 return hrtimer_nanosleep(tsave, rmtp, flags & TIMER_ABSTIME ? 984 struct timespec rmt;
985 HRTIMER_MODE_ABS : HRTIMER_MODE_REL, 985 int ret;
986 which_clock); 986
987 ret = hrtimer_nanosleep(tsave, rmtp ? &rmt : NULL,
988 flags & TIMER_ABSTIME ?
989 HRTIMER_MODE_ABS : HRTIMER_MODE_REL,
990 which_clock);
991
992 if (ret && rmtp) {
993 if (copy_to_user(rmtp, &rmt, sizeof(*rmtp)))
994 return -EFAULT;
995 }
996
997 return ret;
987} 998}
988 999
989asmlinkage long 1000asmlinkage long
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 14b0e10dc95c..8e186c678149 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -44,17 +44,6 @@ config PM_VERBOSE
44 ---help--- 44 ---help---
45 This option enables verbose messages from the Power Management code. 45 This option enables verbose messages from the Power Management code.
46 46
47config DISABLE_CONSOLE_SUSPEND
48 bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
49 depends on PM_DEBUG && PM_SLEEP
50 default n
51 ---help---
52 This option turns off the console suspend mechanism that prevents
53 debug messages from reaching the console during the suspend/resume
54 operations. This may be helpful when debugging device drivers'
55 suspend/resume routines, but may itself lead to problems, for example
56 if netconsole is used.
57
58config PM_TRACE 47config PM_TRACE
59 bool "Suspend/resume event tracing" 48 bool "Suspend/resume event tracing"
60 depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL 49 depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index eb72255b5c86..8b15f777010a 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -45,17 +45,18 @@ enum {
45 45
46static int hibernation_mode = HIBERNATION_SHUTDOWN; 46static int hibernation_mode = HIBERNATION_SHUTDOWN;
47 47
48static struct hibernation_ops *hibernation_ops; 48static struct platform_hibernation_ops *hibernation_ops;
49 49
50/** 50/**
51 * hibernation_set_ops - set the global hibernate operations 51 * hibernation_set_ops - set the global hibernate operations
52 * @ops: the hibernation operations to use in subsequent hibernation transitions 52 * @ops: the hibernation operations to use in subsequent hibernation transitions
53 */ 53 */
54 54
55void hibernation_set_ops(struct hibernation_ops *ops) 55void hibernation_set_ops(struct platform_hibernation_ops *ops)
56{ 56{
57 if (ops && !(ops->prepare && ops->enter && ops->finish 57 if (ops && !(ops->start && ops->pre_snapshot && ops->finish
58 && ops->pre_restore && ops->restore_cleanup)) { 58 && ops->prepare && ops->enter && ops->pre_restore
59 && ops->restore_cleanup)) {
59 WARN_ON(1); 60 WARN_ON(1);
60 return; 61 return;
61 } 62 }
@@ -69,16 +70,37 @@ void hibernation_set_ops(struct hibernation_ops *ops)
69 mutex_unlock(&pm_mutex); 70 mutex_unlock(&pm_mutex);
70} 71}
71 72
73/**
74 * platform_start - tell the platform driver that we're starting
75 * hibernation
76 */
77
78static int platform_start(int platform_mode)
79{
80 return (platform_mode && hibernation_ops) ?
81 hibernation_ops->start() : 0;
82}
72 83
73/** 84/**
74 * platform_prepare - prepare the machine for hibernation using the 85 * platform_pre_snapshot - prepare the machine for hibernation using the
75 * platform driver if so configured and return an error code if it fails 86 * platform driver if so configured and return an error code if it fails
76 */ 87 */
77 88
78static int platform_prepare(int platform_mode) 89static int platform_pre_snapshot(int platform_mode)
79{ 90{
80 return (platform_mode && hibernation_ops) ? 91 return (platform_mode && hibernation_ops) ?
81 hibernation_ops->prepare() : 0; 92 hibernation_ops->pre_snapshot() : 0;
93}
94
95/**
96 * platform_leave - prepare the machine for switching to the normal mode
97 * of operation using the platform driver (called with interrupts disabled)
98 */
99
100static void platform_leave(int platform_mode)
101{
102 if (platform_mode && hibernation_ops)
103 hibernation_ops->leave();
82} 104}
83 105
84/** 106/**
@@ -118,6 +140,51 @@ static void platform_restore_cleanup(int platform_mode)
118} 140}
119 141
120/** 142/**
143 * create_image - freeze devices that need to be frozen with interrupts
144 * off, create the hibernation image and thaw those devices. Control
145 * reappears in this routine after a restore.
146 */
147
148int create_image(int platform_mode)
149{
150 int error;
151
152 error = arch_prepare_suspend();
153 if (error)
154 return error;
155
156 local_irq_disable();
157 /* At this point, device_suspend() has been called, but *not*
158 * device_power_down(). We *must* call device_power_down() now.
159 * Otherwise, drivers for some devices (e.g. interrupt controllers)
160 * become desynchronized with the actual state of the hardware
161 * at resume time, and evil weirdness ensues.
162 */
163 error = device_power_down(PMSG_FREEZE);
164 if (error) {
165 printk(KERN_ERR "Some devices failed to power down, "
166 KERN_ERR "aborting suspend\n");
167 goto Enable_irqs;
168 }
169
170 save_processor_state();
171 error = swsusp_arch_suspend();
172 if (error)
173 printk(KERN_ERR "Error %d while creating the image\n", error);
174 /* Restore control flow magically appears here */
175 restore_processor_state();
176 if (!in_suspend)
177 platform_leave(platform_mode);
178 /* NOTE: device_power_up() is just a resume() for devices
179 * that suspended with irqs off ... no overall powerup.
180 */
181 device_power_up();
182 Enable_irqs:
183 local_irq_enable();
184 return error;
185}
186
187/**
121 * hibernation_snapshot - quiesce devices and create the hibernation 188 * hibernation_snapshot - quiesce devices and create the hibernation
122 * snapshot image. 189 * snapshot image.
123 * @platform_mode - if set, use the platform driver, if available, to 190 * @platform_mode - if set, use the platform driver, if available, to
@@ -135,12 +202,16 @@ int hibernation_snapshot(int platform_mode)
135 if (error) 202 if (error)
136 return error; 203 return error;
137 204
205 error = platform_start(platform_mode);
206 if (error)
207 return error;
208
138 suspend_console(); 209 suspend_console();
139 error = device_suspend(PMSG_FREEZE); 210 error = device_suspend(PMSG_FREEZE);
140 if (error) 211 if (error)
141 goto Resume_console; 212 goto Resume_console;
142 213
143 error = platform_prepare(platform_mode); 214 error = platform_pre_snapshot(platform_mode);
144 if (error) 215 if (error)
145 goto Resume_devices; 216 goto Resume_devices;
146 217
@@ -148,7 +219,7 @@ int hibernation_snapshot(int platform_mode)
148 if (!error) { 219 if (!error) {
149 if (hibernation_mode != HIBERNATION_TEST) { 220 if (hibernation_mode != HIBERNATION_TEST) {
150 in_suspend = 1; 221 in_suspend = 1;
151 error = swsusp_suspend(); 222 error = create_image(platform_mode);
152 /* Control returns here after successful restore */ 223 /* Control returns here after successful restore */
153 } else { 224 } else {
154 printk("swsusp debug: Waiting for 5 seconds.\n"); 225 printk("swsusp debug: Waiting for 5 seconds.\n");
@@ -207,21 +278,50 @@ int hibernation_platform_enter(void)
207{ 278{
208 int error; 279 int error;
209 280
210 if (hibernation_ops) { 281 if (!hibernation_ops)
211 kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); 282 return -ENOSYS;
212 /* 283
213 * We have cancelled the power transition by running 284 /*
214 * hibernation_ops->finish() before saving the image, so we 285 * We have cancelled the power transition by running
215 * should let the firmware know that we're going to enter the 286 * hibernation_ops->finish() before saving the image, so we should let
216 * sleep state after all 287 * the firmware know that we're going to enter the sleep state after all
217 */ 288 */
218 error = hibernation_ops->prepare(); 289 error = hibernation_ops->start();
219 sysdev_shutdown(); 290 if (error)
220 if (!error) 291 return error;
221 error = hibernation_ops->enter(); 292
222 } else { 293 suspend_console();
223 error = -ENOSYS; 294 error = device_suspend(PMSG_SUSPEND);
295 if (error)
296 goto Resume_console;
297
298 error = hibernation_ops->prepare();
299 if (error)
300 goto Resume_devices;
301
302 error = disable_nonboot_cpus();
303 if (error)
304 goto Finish;
305
306 local_irq_disable();
307 error = device_power_down(PMSG_SUSPEND);
308 if (!error) {
309 hibernation_ops->enter();
310 /* We should never get here */
311 while (1);
224 } 312 }
313 local_irq_enable();
314
315 /*
316 * We don't need to reenable the nonboot CPUs or resume consoles, since
317 * the system is going to be halted anyway.
318 */
319 Finish:
320 hibernation_ops->finish();
321 Resume_devices:
322 device_resume();
323 Resume_console:
324 resume_console();
225 return error; 325 return error;
226} 326}
227 327
@@ -238,14 +338,14 @@ static void power_down(void)
238 case HIBERNATION_TEST: 338 case HIBERNATION_TEST:
239 case HIBERNATION_TESTPROC: 339 case HIBERNATION_TESTPROC:
240 break; 340 break;
241 case HIBERNATION_SHUTDOWN:
242 kernel_power_off();
243 break;
244 case HIBERNATION_REBOOT: 341 case HIBERNATION_REBOOT:
245 kernel_restart(NULL); 342 kernel_restart(NULL);
246 break; 343 break;
247 case HIBERNATION_PLATFORM: 344 case HIBERNATION_PLATFORM:
248 hibernation_platform_enter(); 345 hibernation_platform_enter();
346 case HIBERNATION_SHUTDOWN:
347 kernel_power_off();
348 break;
249 } 349 }
250 kernel_halt(); 350 kernel_halt();
251 /* 351 /*
@@ -298,6 +398,10 @@ int hibernate(void)
298 if (error) 398 if (error)
299 goto Exit; 399 goto Exit;
300 400
401 printk("Syncing filesystems ... ");
402 sys_sync();
403 printk("done.\n");
404
301 error = prepare_processes(); 405 error = prepare_processes();
302 if (error) 406 if (error)
303 goto Finish; 407 goto Finish;
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 350b485b3b60..3cdf95b1dc92 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -20,6 +20,7 @@
20#include <linux/resume-trace.h> 20#include <linux/resume-trace.h>
21#include <linux/freezer.h> 21#include <linux/freezer.h>
22#include <linux/vmstat.h> 22#include <linux/vmstat.h>
23#include <linux/syscalls.h>
23 24
24#include "power.h" 25#include "power.h"
25 26
@@ -32,39 +33,32 @@ DEFINE_MUTEX(pm_mutex);
32/* This is just an arbitrary number */ 33/* This is just an arbitrary number */
33#define FREE_PAGE_NUMBER (100) 34#define FREE_PAGE_NUMBER (100)
34 35
35struct pm_ops *pm_ops; 36static struct platform_suspend_ops *suspend_ops;
36 37
37/** 38/**
38 * pm_set_ops - Set the global power method table. 39 * suspend_set_ops - Set the global suspend method table.
39 * @ops: Pointer to ops structure. 40 * @ops: Pointer to ops structure.
40 */ 41 */
41 42
42void pm_set_ops(struct pm_ops * ops) 43void suspend_set_ops(struct platform_suspend_ops *ops)
43{ 44{
44 mutex_lock(&pm_mutex); 45 mutex_lock(&pm_mutex);
45 pm_ops = ops; 46 suspend_ops = ops;
46 mutex_unlock(&pm_mutex); 47 mutex_unlock(&pm_mutex);
47} 48}
48 49
49/** 50/**
50 * pm_valid_only_mem - generic memory-only valid callback 51 * suspend_valid_only_mem - generic memory-only valid callback
51 * 52 *
52 * pm_ops drivers that implement mem suspend only and only need 53 * Platform drivers that implement mem suspend only and only need
53 * to check for that in their .valid callback can use this instead 54 * to check for that in their .valid callback can use this instead
54 * of rolling their own .valid callback. 55 * of rolling their own .valid callback.
55 */ 56 */
56int pm_valid_only_mem(suspend_state_t state) 57int suspend_valid_only_mem(suspend_state_t state)
57{ 58{
58 return state == PM_SUSPEND_MEM; 59 return state == PM_SUSPEND_MEM;
59} 60}
60 61
61
62static inline void pm_finish(suspend_state_t state)
63{
64 if (pm_ops->finish)
65 pm_ops->finish(state);
66}
67
68/** 62/**
69 * suspend_prepare - Do prep work before entering low-power state. 63 * suspend_prepare - Do prep work before entering low-power state.
70 * 64 *
@@ -76,7 +70,7 @@ static int suspend_prepare(void)
76 int error; 70 int error;
77 unsigned int free_pages; 71 unsigned int free_pages;
78 72
79 if (!pm_ops || !pm_ops->enter) 73 if (!suspend_ops || !suspend_ops->enter)
80 return -EPERM; 74 return -EPERM;
81 75
82 error = pm_notifier_call_chain(PM_SUSPEND_PREPARE); 76 error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
@@ -128,7 +122,7 @@ void __attribute__ ((weak)) arch_suspend_enable_irqs(void)
128 * 122 *
129 * This function should be called after devices have been suspended. 123 * This function should be called after devices have been suspended.
130 */ 124 */
131int suspend_enter(suspend_state_t state) 125static int suspend_enter(suspend_state_t state)
132{ 126{
133 int error = 0; 127 int error = 0;
134 128
@@ -139,7 +133,7 @@ int suspend_enter(suspend_state_t state)
139 printk(KERN_ERR "Some devices failed to power down\n"); 133 printk(KERN_ERR "Some devices failed to power down\n");
140 goto Done; 134 goto Done;
141 } 135 }
142 error = pm_ops->enter(state); 136 error = suspend_ops->enter(state);
143 device_power_up(); 137 device_power_up();
144 Done: 138 Done:
145 arch_suspend_enable_irqs(); 139 arch_suspend_enable_irqs();
@@ -156,11 +150,11 @@ int suspend_devices_and_enter(suspend_state_t state)
156{ 150{
157 int error; 151 int error;
158 152
159 if (!pm_ops) 153 if (!suspend_ops)
160 return -ENOSYS; 154 return -ENOSYS;
161 155
162 if (pm_ops->set_target) { 156 if (suspend_ops->set_target) {
163 error = pm_ops->set_target(state); 157 error = suspend_ops->set_target(state);
164 if (error) 158 if (error)
165 return error; 159 return error;
166 } 160 }
@@ -170,8 +164,8 @@ int suspend_devices_and_enter(suspend_state_t state)
170 printk(KERN_ERR "Some devices failed to suspend\n"); 164 printk(KERN_ERR "Some devices failed to suspend\n");
171 goto Resume_console; 165 goto Resume_console;
172 } 166 }
173 if (pm_ops->prepare) { 167 if (suspend_ops->prepare) {
174 error = pm_ops->prepare(state); 168 error = suspend_ops->prepare();
175 if (error) 169 if (error)
176 goto Resume_devices; 170 goto Resume_devices;
177 } 171 }
@@ -180,7 +174,8 @@ int suspend_devices_and_enter(suspend_state_t state)
180 suspend_enter(state); 174 suspend_enter(state);
181 175
182 enable_nonboot_cpus(); 176 enable_nonboot_cpus();
183 pm_finish(state); 177 if (suspend_ops->finish)
178 suspend_ops->finish();
184 Resume_devices: 179 Resume_devices:
185 device_resume(); 180 device_resume();
186 Resume_console: 181 Resume_console:
@@ -214,7 +209,7 @@ static inline int valid_state(suspend_state_t state)
214 /* All states need lowlevel support and need to be valid 209 /* All states need lowlevel support and need to be valid
215 * to the lowlevel implementation, no valid callback 210 * to the lowlevel implementation, no valid callback
216 * implies that none are valid. */ 211 * implies that none are valid. */
217 if (!pm_ops || !pm_ops->valid || !pm_ops->valid(state)) 212 if (!suspend_ops || !suspend_ops->valid || !suspend_ops->valid(state))
218 return 0; 213 return 0;
219 return 1; 214 return 1;
220} 215}
@@ -236,9 +231,14 @@ static int enter_state(suspend_state_t state)
236 231
237 if (!valid_state(state)) 232 if (!valid_state(state))
238 return -ENODEV; 233 return -ENODEV;
234
239 if (!mutex_trylock(&pm_mutex)) 235 if (!mutex_trylock(&pm_mutex))
240 return -EBUSY; 236 return -EBUSY;
241 237
238 printk("Syncing filesystems ... ");
239 sys_sync();
240 printk("done.\n");
241
242 pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); 242 pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
243 if ((error = suspend_prepare())) 243 if ((error = suspend_prepare()))
244 goto Unlock; 244 goto Unlock;
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 95fbf2dd3fe3..195dc4611764 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -11,14 +11,32 @@ struct swsusp_info {
11 unsigned long size; 11 unsigned long size;
12} __attribute__((aligned(PAGE_SIZE))); 12} __attribute__((aligned(PAGE_SIZE)));
13 13
14#ifdef CONFIG_HIBERNATION
15#ifdef CONFIG_ARCH_HIBERNATION_HEADER
16/* Maximum size of architecture specific data in a hibernation header */
17#define MAX_ARCH_HEADER_SIZE (sizeof(struct new_utsname) + 4)
14 18
19extern int arch_hibernation_header_save(void *addr, unsigned int max_size);
20extern int arch_hibernation_header_restore(void *addr);
21
22static inline int init_header_complete(struct swsusp_info *info)
23{
24 return arch_hibernation_header_save(info, MAX_ARCH_HEADER_SIZE);
25}
26
27static inline char *check_image_kernel(struct swsusp_info *info)
28{
29 return arch_hibernation_header_restore(info) ?
30 "architecture specific data" : NULL;
31}
32#endif /* CONFIG_ARCH_HIBERNATION_HEADER */
15 33
16#ifdef CONFIG_HIBERNATION
17/* 34/*
18 * Keep some memory free so that I/O operations can succeed without paging 35 * Keep some memory free so that I/O operations can succeed without paging
19 * [Might this be more than 4 MB?] 36 * [Might this be more than 4 MB?]
20 */ 37 */
21#define PAGES_FOR_IO ((4096 * 1024) >> PAGE_SHIFT) 38#define PAGES_FOR_IO ((4096 * 1024) >> PAGE_SHIFT)
39
22/* 40/*
23 * Keep 1 MB of memory free so that device drivers can allocate some pages in 41 * Keep 1 MB of memory free so that device drivers can allocate some pages in
24 * their .suspend() routines without breaking the suspend to disk. 42 * their .suspend() routines without breaking the suspend to disk.
@@ -165,7 +183,6 @@ extern int swsusp_swap_in_use(void);
165extern int swsusp_check(void); 183extern int swsusp_check(void);
166extern int swsusp_shrink_memory(void); 184extern int swsusp_shrink_memory(void);
167extern void swsusp_free(void); 185extern void swsusp_free(void);
168extern int swsusp_suspend(void);
169extern int swsusp_resume(void); 186extern int swsusp_resume(void);
170extern int swsusp_read(unsigned int *flags_p); 187extern int swsusp_read(unsigned int *flags_p);
171extern int swsusp_write(unsigned int flags); 188extern int swsusp_write(unsigned int flags);
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 3434940a3df1..6533923e711b 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -75,21 +75,79 @@ void refrigerator(void)
75 __set_current_state(save); 75 __set_current_state(save);
76} 76}
77 77
78static void freeze_task(struct task_struct *p) 78static void fake_signal_wake_up(struct task_struct *p, int resume)
79{ 79{
80 unsigned long flags; 80 unsigned long flags;
81 81
82 if (!freezing(p)) { 82 spin_lock_irqsave(&p->sighand->siglock, flags);
83 signal_wake_up(p, resume);
84 spin_unlock_irqrestore(&p->sighand->siglock, flags);
85}
86
87static void send_fake_signal(struct task_struct *p)
88{
89 if (p->state == TASK_STOPPED)
90 force_sig_specific(SIGSTOP, p);
91 fake_signal_wake_up(p, p->state == TASK_STOPPED);
92}
93
94static int has_mm(struct task_struct *p)
95{
96 return (p->mm && !(p->flags & PF_BORROWED_MM));
97}
98
99/**
100 * freeze_task - send a freeze request to given task
101 * @p: task to send the request to
102 * @with_mm_only: if set, the request will only be sent if the task has its
103 * own mm
104 * Return value: 0, if @with_mm_only is set and the task has no mm of its
105 * own or the task is frozen, 1, otherwise
106 *
107 * The freeze request is sent by seting the tasks's TIF_FREEZE flag and
108 * either sending a fake signal to it or waking it up, depending on whether
109 * or not it has its own mm (ie. it is a user land task). If @with_mm_only
110 * is set and the task has no mm of its own (ie. it is a kernel thread),
111 * its TIF_FREEZE flag should not be set.
112 *
113 * The task_lock() is necessary to prevent races with exit_mm() or
114 * use_mm()/unuse_mm() from occuring.
115 */
116static int freeze_task(struct task_struct *p, int with_mm_only)
117{
118 int ret = 1;
119
120 task_lock(p);
121 if (freezing(p)) {
122 if (has_mm(p)) {
123 if (!signal_pending(p))
124 fake_signal_wake_up(p, 0);
125 } else {
126 if (with_mm_only)
127 ret = 0;
128 else
129 wake_up_state(p, TASK_INTERRUPTIBLE);
130 }
131 } else {
83 rmb(); 132 rmb();
84 if (!frozen(p)) { 133 if (frozen(p)) {
85 set_freeze_flag(p); 134 ret = 0;
86 if (p->state == TASK_STOPPED) 135 } else {
87 force_sig_specific(SIGSTOP, p); 136 if (has_mm(p)) {
88 spin_lock_irqsave(&p->sighand->siglock, flags); 137 set_freeze_flag(p);
89 signal_wake_up(p, p->state == TASK_STOPPED); 138 send_fake_signal(p);
90 spin_unlock_irqrestore(&p->sighand->siglock, flags); 139 } else {
140 if (with_mm_only) {
141 ret = 0;
142 } else {
143 set_freeze_flag(p);
144 wake_up_state(p, TASK_INTERRUPTIBLE);
145 }
146 }
91 } 147 }
92 } 148 }
149 task_unlock(p);
150 return ret;
93} 151}
94 152
95static void cancel_freezing(struct task_struct *p) 153static void cancel_freezing(struct task_struct *p)
@@ -110,6 +168,11 @@ static int try_to_freeze_tasks(int freeze_user_space)
110 struct task_struct *g, *p; 168 struct task_struct *g, *p;
111 unsigned long end_time; 169 unsigned long end_time;
112 unsigned int todo; 170 unsigned int todo;
171 struct timeval start, end;
172 s64 elapsed_csecs64;
173 unsigned int elapsed_csecs;
174
175 do_gettimeofday(&start);
113 176
114 end_time = jiffies + TIMEOUT; 177 end_time = jiffies + TIMEOUT;
115 do { 178 do {
@@ -119,31 +182,14 @@ static int try_to_freeze_tasks(int freeze_user_space)
119 if (frozen(p) || !freezeable(p)) 182 if (frozen(p) || !freezeable(p))
120 continue; 183 continue;
121 184
122 if (freeze_user_space) { 185 if (p->state == TASK_TRACED && frozen(p->parent)) {
123 if (p->state == TASK_TRACED && 186 cancel_freezing(p);
124 frozen(p->parent)) { 187 continue;
125 cancel_freezing(p);
126 continue;
127 }
128 /*
129 * Kernel threads should not have TIF_FREEZE set
130 * at this point, so we must ensure that either
131 * p->mm is not NULL *and* PF_BORROWED_MM is
132 * unset, or TIF_FRREZE is left unset.
133 * The task_lock() is necessary to prevent races
134 * with exit_mm() or use_mm()/unuse_mm() from
135 * occuring.
136 */
137 task_lock(p);
138 if (!p->mm || (p->flags & PF_BORROWED_MM)) {
139 task_unlock(p);
140 continue;
141 }
142 freeze_task(p);
143 task_unlock(p);
144 } else {
145 freeze_task(p);
146 } 188 }
189
190 if (!freeze_task(p, freeze_user_space))
191 continue;
192
147 if (!freezer_should_skip(p)) 193 if (!freezer_should_skip(p))
148 todo++; 194 todo++;
149 } while_each_thread(g, p); 195 } while_each_thread(g, p);
@@ -153,6 +199,11 @@ static int try_to_freeze_tasks(int freeze_user_space)
153 break; 199 break;
154 } while (todo); 200 } while (todo);
155 201
202 do_gettimeofday(&end);
203 elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
204 do_div(elapsed_csecs64, NSEC_PER_SEC / 100);
205 elapsed_csecs = elapsed_csecs64;
206
156 if (todo) { 207 if (todo) {
157 /* This does not unfreeze processes that are already frozen 208 /* This does not unfreeze processes that are already frozen
158 * (we have slightly ugly calling convention in that respect, 209 * (we have slightly ugly calling convention in that respect,
@@ -160,10 +211,9 @@ static int try_to_freeze_tasks(int freeze_user_space)
160 * but it cleans up leftover PF_FREEZE requests. 211 * but it cleans up leftover PF_FREEZE requests.
161 */ 212 */
162 printk("\n"); 213 printk("\n");
163 printk(KERN_ERR "Freezing of %s timed out after %d seconds " 214 printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
164 "(%d tasks refusing to freeze):\n", 215 "(%d tasks refusing to freeze):\n",
165 freeze_user_space ? "user space " : "tasks ", 216 elapsed_csecs / 100, elapsed_csecs % 100, todo);
166 TIMEOUT / HZ, todo);
167 show_state(); 217 show_state();
168 read_lock(&tasklist_lock); 218 read_lock(&tasklist_lock);
169 do_each_thread(g, p) { 219 do_each_thread(g, p) {
@@ -174,6 +224,9 @@ static int try_to_freeze_tasks(int freeze_user_space)
174 task_unlock(p); 224 task_unlock(p);
175 } while_each_thread(g, p); 225 } while_each_thread(g, p);
176 read_unlock(&tasklist_lock); 226 read_unlock(&tasklist_lock);
227 } else {
228 printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
229 elapsed_csecs % 100);
177 } 230 }
178 231
179 return todo ? -EBUSY : 0; 232 return todo ? -EBUSY : 0;
@@ -186,19 +239,21 @@ int freeze_processes(void)
186{ 239{
187 int error; 240 int error;
188 241
189 printk("Stopping tasks ... "); 242 printk("Freezing user space processes ... ");
190 error = try_to_freeze_tasks(FREEZER_USER_SPACE); 243 error = try_to_freeze_tasks(FREEZER_USER_SPACE);
191 if (error) 244 if (error)
192 return error; 245 goto Exit;
246 printk("done.\n");
193 247
194 sys_sync(); 248 printk("Freezing remaining freezable tasks ... ");
195 error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS); 249 error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
196 if (error) 250 if (error)
197 return error; 251 goto Exit;
198 252 printk("done.");
199 printk("done.\n"); 253 Exit:
200 BUG_ON(in_atomic()); 254 BUG_ON(in_atomic());
201 return 0; 255 printk("\n");
256 return error;
202} 257}
203 258
204static void thaw_tasks(int thaw_user_space) 259static void thaw_tasks(int thaw_user_space)
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index a686590d88c1..78039b477d2b 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1005,11 +1005,12 @@ copy_data_pages(struct memory_bitmap *copy_bm, struct memory_bitmap *orig_bm)
1005 } 1005 }
1006 memory_bm_position_reset(orig_bm); 1006 memory_bm_position_reset(orig_bm);
1007 memory_bm_position_reset(copy_bm); 1007 memory_bm_position_reset(copy_bm);
1008 do { 1008 for(;;) {
1009 pfn = memory_bm_next_pfn(orig_bm); 1009 pfn = memory_bm_next_pfn(orig_bm);
1010 if (likely(pfn != BM_END_OF_MAP)) 1010 if (unlikely(pfn == BM_END_OF_MAP))
1011 copy_data_page(memory_bm_next_pfn(copy_bm), pfn); 1011 break;
1012 } while (pfn != BM_END_OF_MAP); 1012 copy_data_page(memory_bm_next_pfn(copy_bm), pfn);
1013 }
1013} 1014}
1014 1015
1015/* Total number of image pages */ 1016/* Total number of image pages */
@@ -1239,17 +1240,39 @@ asmlinkage int swsusp_save(void)
1239 return 0; 1240 return 0;
1240} 1241}
1241 1242
1242static void init_header(struct swsusp_info *info) 1243#ifndef CONFIG_ARCH_HIBERNATION_HEADER
1244static int init_header_complete(struct swsusp_info *info)
1243{ 1245{
1244 memset(info, 0, sizeof(struct swsusp_info)); 1246 memcpy(&info->uts, init_utsname(), sizeof(struct new_utsname));
1245 info->version_code = LINUX_VERSION_CODE; 1247 info->version_code = LINUX_VERSION_CODE;
1248 return 0;
1249}
1250
1251static char *check_image_kernel(struct swsusp_info *info)
1252{
1253 if (info->version_code != LINUX_VERSION_CODE)
1254 return "kernel version";
1255 if (strcmp(info->uts.sysname,init_utsname()->sysname))
1256 return "system type";
1257 if (strcmp(info->uts.release,init_utsname()->release))
1258 return "kernel release";
1259 if (strcmp(info->uts.version,init_utsname()->version))
1260 return "version";
1261 if (strcmp(info->uts.machine,init_utsname()->machine))
1262 return "machine";
1263 return NULL;
1264}
1265#endif /* CONFIG_ARCH_HIBERNATION_HEADER */
1266
1267static int init_header(struct swsusp_info *info)
1268{
1269 memset(info, 0, sizeof(struct swsusp_info));
1246 info->num_physpages = num_physpages; 1270 info->num_physpages = num_physpages;
1247 memcpy(&info->uts, init_utsname(), sizeof(struct new_utsname));
1248 info->cpus = num_online_cpus();
1249 info->image_pages = nr_copy_pages; 1271 info->image_pages = nr_copy_pages;
1250 info->pages = nr_copy_pages + nr_meta_pages + 1; 1272 info->pages = nr_copy_pages + nr_meta_pages + 1;
1251 info->size = info->pages; 1273 info->size = info->pages;
1252 info->size <<= PAGE_SHIFT; 1274 info->size <<= PAGE_SHIFT;
1275 return init_header_complete(info);
1253} 1276}
1254 1277
1255/** 1278/**
@@ -1303,7 +1326,11 @@ int snapshot_read_next(struct snapshot_handle *handle, size_t count)
1303 return -ENOMEM; 1326 return -ENOMEM;
1304 } 1327 }
1305 if (!handle->offset) { 1328 if (!handle->offset) {
1306 init_header((struct swsusp_info *)buffer); 1329 int error;
1330
1331 error = init_header((struct swsusp_info *)buffer);
1332 if (error)
1333 return error;
1307 handle->buffer = buffer; 1334 handle->buffer = buffer;
1308 memory_bm_position_reset(&orig_bm); 1335 memory_bm_position_reset(&orig_bm);
1309 memory_bm_position_reset(&copy_bm); 1336 memory_bm_position_reset(&copy_bm);
@@ -1394,22 +1421,13 @@ duplicate_memory_bitmap(struct memory_bitmap *dst, struct memory_bitmap *src)
1394 } 1421 }
1395} 1422}
1396 1423
1397static inline int check_header(struct swsusp_info *info) 1424static int check_header(struct swsusp_info *info)
1398{ 1425{
1399 char *reason = NULL; 1426 char *reason;
1400 1427
1401 if (info->version_code != LINUX_VERSION_CODE) 1428 reason = check_image_kernel(info);
1402 reason = "kernel version"; 1429 if (!reason && info->num_physpages != num_physpages)
1403 if (info->num_physpages != num_physpages)
1404 reason = "memory size"; 1430 reason = "memory size";
1405 if (strcmp(info->uts.sysname,init_utsname()->sysname))
1406 reason = "system type";
1407 if (strcmp(info->uts.release,init_utsname()->release))
1408 reason = "kernel release";
1409 if (strcmp(info->uts.version,init_utsname()->version))
1410 reason = "version";
1411 if (strcmp(info->uts.machine,init_utsname()->machine))
1412 reason = "machine";
1413 if (reason) { 1431 if (reason) {
1414 printk(KERN_ERR "swsusp: Resume mismatch: %s\n", reason); 1432 printk(KERN_ERR "swsusp: Resume mismatch: %s\n", reason);
1415 return -EPERM; 1433 return -EPERM;
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 5da304c8f1f6..e1722d3155f1 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -270,39 +270,6 @@ int swsusp_shrink_memory(void)
270 return 0; 270 return 0;
271} 271}
272 272
273int swsusp_suspend(void)
274{
275 int error;
276
277 if ((error = arch_prepare_suspend()))
278 return error;
279
280 local_irq_disable();
281 /* At this point, device_suspend() has been called, but *not*
282 * device_power_down(). We *must* device_power_down() now.
283 * Otherwise, drivers for some devices (e.g. interrupt controllers)
284 * become desynchronized with the actual state of the hardware
285 * at resume time, and evil weirdness ensues.
286 */
287 if ((error = device_power_down(PMSG_FREEZE))) {
288 printk(KERN_ERR "Some devices failed to power down, aborting suspend\n");
289 goto Enable_irqs;
290 }
291
292 save_processor_state();
293 if ((error = swsusp_arch_suspend()))
294 printk(KERN_ERR "Error %d suspending\n", error);
295 /* Restore control flow magically appears here */
296 restore_processor_state();
297 /* NOTE: device_power_up() is just a resume() for devices
298 * that suspended with irqs off ... no overall powerup.
299 */
300 device_power_up();
301 Enable_irqs:
302 local_irq_enable();
303 return error;
304}
305
306int swsusp_resume(void) 273int swsusp_resume(void)
307{ 274{
308 int error; 275 int error;
diff --git a/kernel/power/user.c b/kernel/power/user.c
index bd0723a7df3f..5bd321bcbb75 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -153,6 +153,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
153 mutex_lock(&pm_mutex); 153 mutex_lock(&pm_mutex);
154 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); 154 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
155 if (!error) { 155 if (!error) {
156 printk("Syncing filesystems ... ");
157 sys_sync();
158 printk("done.\n");
159
156 error = freeze_processes(); 160 error = freeze_processes();
157 if (error) 161 if (error)
158 thaw_processes(); 162 thaw_processes();
diff --git a/kernel/printk.c b/kernel/printk.c
index 52493474f0ab..a30fe33de395 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -862,7 +862,16 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha
862 return -1; 862 return -1;
863} 863}
864 864
865#ifndef CONFIG_DISABLE_CONSOLE_SUSPEND 865int console_suspend_enabled = 1;
866EXPORT_SYMBOL(console_suspend_enabled);
867
868static int __init console_suspend_disable(char *str)
869{
870 console_suspend_enabled = 0;
871 return 1;
872}
873__setup("no_console_suspend", console_suspend_disable);
874
866/** 875/**
867 * suspend_console - suspend the console subsystem 876 * suspend_console - suspend the console subsystem
868 * 877 *
@@ -870,6 +879,8 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha
870 */ 879 */
871void suspend_console(void) 880void suspend_console(void)
872{ 881{
882 if (!console_suspend_enabled)
883 return;
873 printk("Suspending console(s)\n"); 884 printk("Suspending console(s)\n");
874 acquire_console_sem(); 885 acquire_console_sem();
875 console_suspended = 1; 886 console_suspended = 1;
@@ -877,10 +888,11 @@ void suspend_console(void)
877 888
878void resume_console(void) 889void resume_console(void)
879{ 890{
891 if (!console_suspend_enabled)
892 return;
880 console_suspended = 0; 893 console_suspended = 0;
881 release_console_sem(); 894 release_console_sem();
882} 895}
883#endif /* CONFIG_DISABLE_CONSOLE_SUSPEND */
884 896
885/** 897/**
886 * acquire_console_sem - lock the console system for exclusive use. 898 * acquire_console_sem - lock the console system for exclusive use.
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index a73ebd3b9d4c..7c76f2ffaeaa 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -19,6 +19,7 @@
19#include <linux/security.h> 19#include <linux/security.h>
20#include <linux/signal.h> 20#include <linux/signal.h>
21#include <linux/audit.h> 21#include <linux/audit.h>
22#include <linux/pid_namespace.h>
22 23
23#include <asm/pgtable.h> 24#include <asm/pgtable.h>
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
@@ -168,7 +169,7 @@ int ptrace_attach(struct task_struct *task)
168 retval = -EPERM; 169 retval = -EPERM;
169 if (task->pid <= 1) 170 if (task->pid <= 1)
170 goto out; 171 goto out;
171 if (task->tgid == current->tgid) 172 if (same_thread_group(task, current))
172 goto out; 173 goto out;
173 174
174repeat: 175repeat:
@@ -443,7 +444,7 @@ struct task_struct *ptrace_get_task_struct(pid_t pid)
443 return ERR_PTR(-EPERM); 444 return ERR_PTR(-EPERM);
444 445
445 read_lock(&tasklist_lock); 446 read_lock(&tasklist_lock);
446 child = find_task_by_pid(pid); 447 child = find_task_by_vpid(pid);
447 if (child) 448 if (child)
448 get_task_struct(child); 449 get_task_struct(child);
449 450
diff --git a/kernel/relay.c b/kernel/relay.c
index ad855017bc59..61134eb7a0c8 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -370,7 +370,7 @@ void relay_reset(struct rchan *chan)
370 if (!chan) 370 if (!chan)
371 return; 371 return;
372 372
373 if (chan->is_global && chan->buf[0]) { 373 if (chan->is_global && chan->buf[0]) {
374 __relay_reset(chan->buf[0], 0); 374 __relay_reset(chan->buf[0], 0);
375 return; 375 return;
376 } 376 }
@@ -850,13 +850,13 @@ static int relay_file_read_avail(struct rchan_buf *buf, size_t read_pos)
850 buf->subbufs_consumed = consumed; 850 buf->subbufs_consumed = consumed;
851 buf->bytes_consumed = 0; 851 buf->bytes_consumed = 0;
852 } 852 }
853 853
854 produced = (produced % n_subbufs) * subbuf_size + buf->offset; 854 produced = (produced % n_subbufs) * subbuf_size + buf->offset;
855 consumed = (consumed % n_subbufs) * subbuf_size + buf->bytes_consumed; 855 consumed = (consumed % n_subbufs) * subbuf_size + buf->bytes_consumed;
856 856
857 if (consumed > produced) 857 if (consumed > produced)
858 produced += n_subbufs * subbuf_size; 858 produced += n_subbufs * subbuf_size;
859 859
860 if (consumed == produced) 860 if (consumed == produced)
861 return 0; 861 return 0;
862 862
diff --git a/kernel/rtmutex-debug.c b/kernel/rtmutex-debug.c
index 6b0703db152d..56d73cb8826d 100644
--- a/kernel/rtmutex-debug.c
+++ b/kernel/rtmutex-debug.c
@@ -87,7 +87,7 @@ static int rt_trace_on = 1;
87static void printk_task(struct task_struct *p) 87static void printk_task(struct task_struct *p)
88{ 88{
89 if (p) 89 if (p)
90 printk("%16s:%5d [%p, %3d]", p->comm, p->pid, p, p->prio); 90 printk("%16s:%5d [%p, %3d]", p->comm, task_pid_nr(p), p, p->prio);
91 else 91 else
92 printk("<none>"); 92 printk("<none>");
93} 93}
@@ -152,22 +152,25 @@ void debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)
152 printk( "[ BUG: circular locking deadlock detected! ]\n"); 152 printk( "[ BUG: circular locking deadlock detected! ]\n");
153 printk( "--------------------------------------------\n"); 153 printk( "--------------------------------------------\n");
154 printk("%s/%d is deadlocking current task %s/%d\n\n", 154 printk("%s/%d is deadlocking current task %s/%d\n\n",
155 task->comm, task->pid, current->comm, current->pid); 155 task->comm, task_pid_nr(task),
156 current->comm, task_pid_nr(current));
156 157
157 printk("\n1) %s/%d is trying to acquire this lock:\n", 158 printk("\n1) %s/%d is trying to acquire this lock:\n",
158 current->comm, current->pid); 159 current->comm, task_pid_nr(current));
159 printk_lock(waiter->lock, 1); 160 printk_lock(waiter->lock, 1);
160 161
161 printk("\n2) %s/%d is blocked on this lock:\n", task->comm, task->pid); 162 printk("\n2) %s/%d is blocked on this lock:\n",
163 task->comm, task_pid_nr(task));
162 printk_lock(waiter->deadlock_lock, 1); 164 printk_lock(waiter->deadlock_lock, 1);
163 165
164 debug_show_held_locks(current); 166 debug_show_held_locks(current);
165 debug_show_held_locks(task); 167 debug_show_held_locks(task);
166 168
167 printk("\n%s/%d's [blocked] stackdump:\n\n", task->comm, task->pid); 169 printk("\n%s/%d's [blocked] stackdump:\n\n",
170 task->comm, task_pid_nr(task));
168 show_stack(task, NULL); 171 show_stack(task, NULL);
169 printk("\n%s/%d's [current] stackdump:\n\n", 172 printk("\n%s/%d's [current] stackdump:\n\n",
170 current->comm, current->pid); 173 current->comm, task_pid_nr(current));
171 dump_stack(); 174 dump_stack();
172 debug_show_all_locks(); 175 debug_show_all_locks();
173 176
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
index 8cd9bd2cdb34..0deef71ff8d2 100644
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -185,7 +185,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
185 prev_max = max_lock_depth; 185 prev_max = max_lock_depth;
186 printk(KERN_WARNING "Maximum lock depth %d reached " 186 printk(KERN_WARNING "Maximum lock depth %d reached "
187 "task: %s (%d)\n", max_lock_depth, 187 "task: %s (%d)\n", max_lock_depth,
188 top_task->comm, top_task->pid); 188 top_task->comm, task_pid_nr(top_task));
189 } 189 }
190 put_task_struct(task); 190 put_task_struct(task);
191 191
diff --git a/kernel/sched.c b/kernel/sched.c
index 92721d1534b8..7581e331b139 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -44,6 +44,7 @@
44#include <linux/vmalloc.h> 44#include <linux/vmalloc.h>
45#include <linux/blkdev.h> 45#include <linux/blkdev.h>
46#include <linux/delay.h> 46#include <linux/delay.h>
47#include <linux/pid_namespace.h>
47#include <linux/smp.h> 48#include <linux/smp.h>
48#include <linux/threads.h> 49#include <linux/threads.h>
49#include <linux/timer.h> 50#include <linux/timer.h>
@@ -51,6 +52,7 @@
51#include <linux/cpu.h> 52#include <linux/cpu.h>
52#include <linux/cpuset.h> 53#include <linux/cpuset.h>
53#include <linux/percpu.h> 54#include <linux/percpu.h>
55#include <linux/cpu_acct.h>
54#include <linux/kthread.h> 56#include <linux/kthread.h>
55#include <linux/seq_file.h> 57#include <linux/seq_file.h>
56#include <linux/sysctl.h> 58#include <linux/sysctl.h>
@@ -153,10 +155,15 @@ struct rt_prio_array {
153 155
154#ifdef CONFIG_FAIR_GROUP_SCHED 156#ifdef CONFIG_FAIR_GROUP_SCHED
155 157
158#include <linux/cgroup.h>
159
156struct cfs_rq; 160struct cfs_rq;
157 161
158/* task group related information */ 162/* task group related information */
159struct task_group { 163struct task_group {
164#ifdef CONFIG_FAIR_CGROUP_SCHED
165 struct cgroup_subsys_state css;
166#endif
160 /* schedulable entities of this group on each cpu */ 167 /* schedulable entities of this group on each cpu */
161 struct sched_entity **se; 168 struct sched_entity **se;
162 /* runqueue "owned" by this group on each cpu */ 169 /* runqueue "owned" by this group on each cpu */
@@ -197,6 +204,9 @@ static inline struct task_group *task_group(struct task_struct *p)
197 204
198#ifdef CONFIG_FAIR_USER_SCHED 205#ifdef CONFIG_FAIR_USER_SCHED
199 tg = p->user->tg; 206 tg = p->user->tg;
207#elif defined(CONFIG_FAIR_CGROUP_SCHED)
208 tg = container_of(task_subsys_state(p, cpu_cgroup_subsys_id),
209 struct task_group, css);
200#else 210#else
201 tg = &init_task_group; 211 tg = &init_task_group;
202#endif 212#endif
@@ -266,7 +276,8 @@ struct rt_rq {
266 * acquire operations must be ordered by ascending &runqueue. 276 * acquire operations must be ordered by ascending &runqueue.
267 */ 277 */
268struct rq { 278struct rq {
269 spinlock_t lock; /* runqueue lock */ 279 /* runqueue lock: */
280 spinlock_t lock;
270 281
271 /* 282 /*
272 * nr_running and cpu_load should be in the same cacheline because 283 * nr_running and cpu_load should be in the same cacheline because
@@ -279,13 +290,15 @@ struct rq {
279#ifdef CONFIG_NO_HZ 290#ifdef CONFIG_NO_HZ
280 unsigned char in_nohz_recently; 291 unsigned char in_nohz_recently;
281#endif 292#endif
282 struct load_weight load; /* capture load from *all* tasks on this cpu */ 293 /* capture load from *all* tasks on this cpu: */
294 struct load_weight load;
283 unsigned long nr_load_updates; 295 unsigned long nr_load_updates;
284 u64 nr_switches; 296 u64 nr_switches;
285 297
286 struct cfs_rq cfs; 298 struct cfs_rq cfs;
287#ifdef CONFIG_FAIR_GROUP_SCHED 299#ifdef CONFIG_FAIR_GROUP_SCHED
288 struct list_head leaf_cfs_rq_list; /* list of leaf cfs_rq on this cpu */ 300 /* list of leaf cfs_rq on this cpu: */
301 struct list_head leaf_cfs_rq_list;
289#endif 302#endif
290 struct rt_rq rt; 303 struct rt_rq rt;
291 304
@@ -317,7 +330,8 @@ struct rq {
317 /* For active balancing */ 330 /* For active balancing */
318 int active_balance; 331 int active_balance;
319 int push_cpu; 332 int push_cpu;
320 int cpu; /* cpu of this runqueue */ 333 /* cpu of this runqueue: */
334 int cpu;
321 335
322 struct task_struct *migration_thread; 336 struct task_struct *migration_thread;
323 struct list_head migration_queue; 337 struct list_head migration_queue;
@@ -328,22 +342,22 @@ struct rq {
328 struct sched_info rq_sched_info; 342 struct sched_info rq_sched_info;
329 343
330 /* sys_sched_yield() stats */ 344 /* sys_sched_yield() stats */
331 unsigned long yld_exp_empty; 345 unsigned int yld_exp_empty;
332 unsigned long yld_act_empty; 346 unsigned int yld_act_empty;
333 unsigned long yld_both_empty; 347 unsigned int yld_both_empty;
334 unsigned long yld_count; 348 unsigned int yld_count;
335 349
336 /* schedule() stats */ 350 /* schedule() stats */
337 unsigned long sched_switch; 351 unsigned int sched_switch;
338 unsigned long sched_count; 352 unsigned int sched_count;
339 unsigned long sched_goidle; 353 unsigned int sched_goidle;
340 354
341 /* try_to_wake_up() stats */ 355 /* try_to_wake_up() stats */
342 unsigned long ttwu_count; 356 unsigned int ttwu_count;
343 unsigned long ttwu_local; 357 unsigned int ttwu_local;
344 358
345 /* BKL stats */ 359 /* BKL stats */
346 unsigned long bkl_count; 360 unsigned int bkl_count;
347#endif 361#endif
348 struct lock_class_key rq_lock_key; 362 struct lock_class_key rq_lock_key;
349}; 363};
@@ -449,12 +463,12 @@ enum {
449}; 463};
450 464
451const_debug unsigned int sysctl_sched_features = 465const_debug unsigned int sysctl_sched_features =
452 SCHED_FEAT_NEW_FAIR_SLEEPERS *1 | 466 SCHED_FEAT_NEW_FAIR_SLEEPERS * 1 |
453 SCHED_FEAT_START_DEBIT *1 | 467 SCHED_FEAT_START_DEBIT * 1 |
454 SCHED_FEAT_TREE_AVG *0 | 468 SCHED_FEAT_TREE_AVG * 0 |
455 SCHED_FEAT_APPROX_AVG *0 | 469 SCHED_FEAT_APPROX_AVG * 0 |
456 SCHED_FEAT_WAKEUP_PREEMPT *1 | 470 SCHED_FEAT_WAKEUP_PREEMPT * 1 |
457 SCHED_FEAT_PREEMPT_RESTRICT *1; 471 SCHED_FEAT_PREEMPT_RESTRICT * 1;
458 472
459#define sched_feat(x) (sysctl_sched_features & SCHED_FEAT_##x) 473#define sched_feat(x) (sysctl_sched_features & SCHED_FEAT_##x)
460 474
@@ -1871,7 +1885,7 @@ asmlinkage void schedule_tail(struct task_struct *prev)
1871 preempt_enable(); 1885 preempt_enable();
1872#endif 1886#endif
1873 if (current->set_child_tid) 1887 if (current->set_child_tid)
1874 put_user(current->pid, current->set_child_tid); 1888 put_user(task_pid_vnr(current), current->set_child_tid);
1875} 1889}
1876 1890
1877/* 1891/*
@@ -3296,16 +3310,19 @@ unsigned long long task_sched_runtime(struct task_struct *p)
3296/* 3310/*
3297 * Account user cpu time to a process. 3311 * Account user cpu time to a process.
3298 * @p: the process that the cpu time gets accounted to 3312 * @p: the process that the cpu time gets accounted to
3299 * @hardirq_offset: the offset to subtract from hardirq_count()
3300 * @cputime: the cpu time spent in user space since the last update 3313 * @cputime: the cpu time spent in user space since the last update
3301 */ 3314 */
3302void account_user_time(struct task_struct *p, cputime_t cputime) 3315void account_user_time(struct task_struct *p, cputime_t cputime)
3303{ 3316{
3304 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat; 3317 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
3305 cputime64_t tmp; 3318 cputime64_t tmp;
3319 struct rq *rq = this_rq();
3306 3320
3307 p->utime = cputime_add(p->utime, cputime); 3321 p->utime = cputime_add(p->utime, cputime);
3308 3322
3323 if (p != rq->idle)
3324 cpuacct_charge(p, cputime);
3325
3309 /* Add user time to cpustat. */ 3326 /* Add user time to cpustat. */
3310 tmp = cputime_to_cputime64(cputime); 3327 tmp = cputime_to_cputime64(cputime);
3311 if (TASK_NICE(p) > 0) 3328 if (TASK_NICE(p) > 0)
@@ -3334,6 +3351,16 @@ void account_guest_time(struct task_struct *p, cputime_t cputime)
3334} 3351}
3335 3352
3336/* 3353/*
3354 * Account scaled user cpu time to a process.
3355 * @p: the process that the cpu time gets accounted to
3356 * @cputime: the cpu time spent in user space since the last update
3357 */
3358void account_user_time_scaled(struct task_struct *p, cputime_t cputime)
3359{
3360 p->utimescaled = cputime_add(p->utimescaled, cputime);
3361}
3362
3363/*
3337 * Account system cpu time to a process. 3364 * Account system cpu time to a process.
3338 * @p: the process that the cpu time gets accounted to 3365 * @p: the process that the cpu time gets accounted to
3339 * @hardirq_offset: the offset to subtract from hardirq_count() 3366 * @hardirq_offset: the offset to subtract from hardirq_count()
@@ -3360,9 +3387,10 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
3360 cpustat->irq = cputime64_add(cpustat->irq, tmp); 3387 cpustat->irq = cputime64_add(cpustat->irq, tmp);
3361 else if (softirq_count()) 3388 else if (softirq_count())
3362 cpustat->softirq = cputime64_add(cpustat->softirq, tmp); 3389 cpustat->softirq = cputime64_add(cpustat->softirq, tmp);
3363 else if (p != rq->idle) 3390 else if (p != rq->idle) {
3364 cpustat->system = cputime64_add(cpustat->system, tmp); 3391 cpustat->system = cputime64_add(cpustat->system, tmp);
3365 else if (atomic_read(&rq->nr_iowait) > 0) 3392 cpuacct_charge(p, cputime);
3393 } else if (atomic_read(&rq->nr_iowait) > 0)
3366 cpustat->iowait = cputime64_add(cpustat->iowait, tmp); 3394 cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
3367 else 3395 else
3368 cpustat->idle = cputime64_add(cpustat->idle, tmp); 3396 cpustat->idle = cputime64_add(cpustat->idle, tmp);
@@ -3371,6 +3399,17 @@ void account_system_time(struct task_struct *p, int hardirq_offset,
3371} 3399}
3372 3400
3373/* 3401/*
3402 * Account scaled system cpu time to a process.
3403 * @p: the process that the cpu time gets accounted to
3404 * @hardirq_offset: the offset to subtract from hardirq_count()
3405 * @cputime: the cpu time spent in kernel space since the last update
3406 */
3407void account_system_time_scaled(struct task_struct *p, cputime_t cputime)
3408{
3409 p->stimescaled = cputime_add(p->stimescaled, cputime);
3410}
3411
3412/*
3374 * Account for involuntary wait time. 3413 * Account for involuntary wait time.
3375 * @p: the process from which the cpu time has been stolen 3414 * @p: the process from which the cpu time has been stolen
3376 * @steal: the cpu time spent in involuntary wait 3415 * @steal: the cpu time spent in involuntary wait
@@ -3387,8 +3426,10 @@ void account_steal_time(struct task_struct *p, cputime_t steal)
3387 cpustat->iowait = cputime64_add(cpustat->iowait, tmp); 3426 cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
3388 else 3427 else
3389 cpustat->idle = cputime64_add(cpustat->idle, tmp); 3428 cpustat->idle = cputime64_add(cpustat->idle, tmp);
3390 } else 3429 } else {
3391 cpustat->steal = cputime64_add(cpustat->steal, tmp); 3430 cpustat->steal = cputime64_add(cpustat->steal, tmp);
3431 cpuacct_charge(p, -tmp);
3432 }
3392} 3433}
3393 3434
3394/* 3435/*
@@ -3468,7 +3509,7 @@ EXPORT_SYMBOL(sub_preempt_count);
3468static noinline void __schedule_bug(struct task_struct *prev) 3509static noinline void __schedule_bug(struct task_struct *prev)
3469{ 3510{
3470 printk(KERN_ERR "BUG: scheduling while atomic: %s/0x%08x/%d\n", 3511 printk(KERN_ERR "BUG: scheduling while atomic: %s/0x%08x/%d\n",
3471 prev->comm, preempt_count(), prev->pid); 3512 prev->comm, preempt_count(), task_pid_nr(prev));
3472 debug_show_held_locks(prev); 3513 debug_show_held_locks(prev);
3473 if (irqs_disabled()) 3514 if (irqs_disabled())
3474 print_irqtrace_events(prev); 3515 print_irqtrace_events(prev);
@@ -3859,7 +3900,10 @@ EXPORT_SYMBOL(wait_for_completion_timeout);
3859 3900
3860int __sched wait_for_completion_interruptible(struct completion *x) 3901int __sched wait_for_completion_interruptible(struct completion *x)
3861{ 3902{
3862 return wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_INTERRUPTIBLE); 3903 long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_INTERRUPTIBLE);
3904 if (t == -ERESTARTSYS)
3905 return t;
3906 return 0;
3863} 3907}
3864EXPORT_SYMBOL(wait_for_completion_interruptible); 3908EXPORT_SYMBOL(wait_for_completion_interruptible);
3865 3909
@@ -4131,7 +4175,7 @@ struct task_struct *idle_task(int cpu)
4131 */ 4175 */
4132static struct task_struct *find_process_by_pid(pid_t pid) 4176static struct task_struct *find_process_by_pid(pid_t pid)
4133{ 4177{
4134 return pid ? find_task_by_pid(pid) : current; 4178 return pid ? find_task_by_vpid(pid) : current;
4135} 4179}
4136 4180
4137/* Actually do priority change: must hold rq lock. */ 4181/* Actually do priority change: must hold rq lock. */
@@ -4434,8 +4478,21 @@ long sched_setaffinity(pid_t pid, cpumask_t new_mask)
4434 4478
4435 cpus_allowed = cpuset_cpus_allowed(p); 4479 cpus_allowed = cpuset_cpus_allowed(p);
4436 cpus_and(new_mask, new_mask, cpus_allowed); 4480 cpus_and(new_mask, new_mask, cpus_allowed);
4481 again:
4437 retval = set_cpus_allowed(p, new_mask); 4482 retval = set_cpus_allowed(p, new_mask);
4438 4483
4484 if (!retval) {
4485 cpus_allowed = cpuset_cpus_allowed(p);
4486 if (!cpus_subset(new_mask, cpus_allowed)) {
4487 /*
4488 * We must have raced with a concurrent cpuset
4489 * update. Just reset the cpus_allowed to the
4490 * cpuset's cpus_allowed
4491 */
4492 new_mask = cpus_allowed;
4493 goto again;
4494 }
4495 }
4439out_unlock: 4496out_unlock:
4440 put_task_struct(p); 4497 put_task_struct(p);
4441 mutex_unlock(&sched_hotcpu_mutex); 4498 mutex_unlock(&sched_hotcpu_mutex);
@@ -4794,18 +4851,18 @@ static void show_task(struct task_struct *p)
4794 unsigned state; 4851 unsigned state;
4795 4852
4796 state = p->state ? __ffs(p->state) + 1 : 0; 4853 state = p->state ? __ffs(p->state) + 1 : 0;
4797 printk("%-13.13s %c", p->comm, 4854 printk(KERN_INFO "%-13.13s %c", p->comm,
4798 state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?'); 4855 state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
4799#if BITS_PER_LONG == 32 4856#if BITS_PER_LONG == 32
4800 if (state == TASK_RUNNING) 4857 if (state == TASK_RUNNING)
4801 printk(" running "); 4858 printk(KERN_CONT " running ");
4802 else 4859 else
4803 printk(" %08lx ", thread_saved_pc(p)); 4860 printk(KERN_CONT " %08lx ", thread_saved_pc(p));
4804#else 4861#else
4805 if (state == TASK_RUNNING) 4862 if (state == TASK_RUNNING)
4806 printk(" running task "); 4863 printk(KERN_CONT " running task ");
4807 else 4864 else
4808 printk(" %016lx ", thread_saved_pc(p)); 4865 printk(KERN_CONT " %016lx ", thread_saved_pc(p));
4809#endif 4866#endif
4810#ifdef CONFIG_DEBUG_STACK_USAGE 4867#ifdef CONFIG_DEBUG_STACK_USAGE
4811 { 4868 {
@@ -4815,7 +4872,8 @@ static void show_task(struct task_struct *p)
4815 free = (unsigned long)n - (unsigned long)end_of_stack(p); 4872 free = (unsigned long)n - (unsigned long)end_of_stack(p);
4816 } 4873 }
4817#endif 4874#endif
4818 printk("%5lu %5d %6d\n", free, p->pid, p->parent->pid); 4875 printk(KERN_CONT "%5lu %5d %6d\n", free,
4876 task_pid_nr(p), task_pid_nr(p->parent));
4819 4877
4820 if (state != TASK_RUNNING) 4878 if (state != TASK_RUNNING)
4821 show_stack(p, NULL); 4879 show_stack(p, NULL);
@@ -5087,7 +5145,7 @@ static int __migrate_task_irq(struct task_struct *p, int src_cpu, int dest_cpu)
5087} 5145}
5088 5146
5089/* 5147/*
5090 * Figure out where task on dead CPU should go, use force if neccessary. 5148 * Figure out where task on dead CPU should go, use force if necessary.
5091 * NOTE: interrupts should be disabled by the caller 5149 * NOTE: interrupts should be disabled by the caller
5092 */ 5150 */
5093static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) 5151static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
@@ -5109,8 +5167,16 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
5109 5167
5110 /* No more Mr. Nice Guy. */ 5168 /* No more Mr. Nice Guy. */
5111 if (dest_cpu == NR_CPUS) { 5169 if (dest_cpu == NR_CPUS) {
5170 cpumask_t cpus_allowed = cpuset_cpus_allowed_locked(p);
5171 /*
5172 * Try to stay on the same cpuset, where the
5173 * current cpuset may be a subset of all cpus.
5174 * The cpuset_cpus_allowed_locked() variant of
5175 * cpuset_cpus_allowed() will not block. It must be
5176 * called within calls to cpuset_lock/cpuset_unlock.
5177 */
5112 rq = task_rq_lock(p, &flags); 5178 rq = task_rq_lock(p, &flags);
5113 cpus_setall(p->cpus_allowed); 5179 p->cpus_allowed = cpus_allowed;
5114 dest_cpu = any_online_cpu(p->cpus_allowed); 5180 dest_cpu = any_online_cpu(p->cpus_allowed);
5115 task_rq_unlock(rq, &flags); 5181 task_rq_unlock(rq, &flags);
5116 5182
@@ -5122,7 +5188,7 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
5122 if (p->mm && printk_ratelimit()) 5188 if (p->mm && printk_ratelimit())
5123 printk(KERN_INFO "process %d (%s) no " 5189 printk(KERN_INFO "process %d (%s) no "
5124 "longer affine to cpu%d\n", 5190 "longer affine to cpu%d\n",
5125 p->pid, p->comm, dead_cpu); 5191 task_pid_nr(p), p->comm, dead_cpu);
5126 } 5192 }
5127 } while (!__migrate_task_irq(p, dead_cpu, dest_cpu)); 5193 } while (!__migrate_task_irq(p, dead_cpu, dest_cpu));
5128} 5194}
@@ -5229,7 +5295,7 @@ static void migrate_dead(unsigned int dead_cpu, struct task_struct *p)
5229 struct rq *rq = cpu_rq(dead_cpu); 5295 struct rq *rq = cpu_rq(dead_cpu);
5230 5296
5231 /* Must be exiting, otherwise would be on tasklist. */ 5297 /* Must be exiting, otherwise would be on tasklist. */
5232 BUG_ON(p->exit_state != EXIT_ZOMBIE && p->exit_state != EXIT_DEAD); 5298 BUG_ON(!p->exit_state);
5233 5299
5234 /* Cannot have done final schedule yet: would have vanished. */ 5300 /* Cannot have done final schedule yet: would have vanished. */
5235 BUG_ON(p->state == TASK_DEAD); 5301 BUG_ON(p->state == TASK_DEAD);
@@ -5364,7 +5430,7 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)
5364 return table; 5430 return table;
5365} 5431}
5366 5432
5367static ctl_table *sd_alloc_ctl_cpu_table(int cpu) 5433static ctl_table * sd_alloc_ctl_cpu_table(int cpu)
5368{ 5434{
5369 struct ctl_table *entry, *table; 5435 struct ctl_table *entry, *table;
5370 struct sched_domain *sd; 5436 struct sched_domain *sd;
@@ -5458,7 +5524,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
5458 5524
5459 case CPU_ONLINE: 5525 case CPU_ONLINE:
5460 case CPU_ONLINE_FROZEN: 5526 case CPU_ONLINE_FROZEN:
5461 /* Strictly unneccessary, as first user will wake it. */ 5527 /* Strictly unnecessary, as first user will wake it. */
5462 wake_up_process(cpu_rq(cpu)->migration_thread); 5528 wake_up_process(cpu_rq(cpu)->migration_thread);
5463 break; 5529 break;
5464 5530
@@ -5476,6 +5542,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
5476 5542
5477 case CPU_DEAD: 5543 case CPU_DEAD:
5478 case CPU_DEAD_FROZEN: 5544 case CPU_DEAD_FROZEN:
5545 cpuset_lock(); /* around calls to cpuset_cpus_allowed_lock() */
5479 migrate_live_tasks(cpu); 5546 migrate_live_tasks(cpu);
5480 rq = cpu_rq(cpu); 5547 rq = cpu_rq(cpu);
5481 kthread_stop(rq->migration_thread); 5548 kthread_stop(rq->migration_thread);
@@ -5489,6 +5556,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
5489 rq->idle->sched_class = &idle_sched_class; 5556 rq->idle->sched_class = &idle_sched_class;
5490 migrate_dead_tasks(cpu); 5557 migrate_dead_tasks(cpu);
5491 spin_unlock_irq(&rq->lock); 5558 spin_unlock_irq(&rq->lock);
5559 cpuset_unlock();
5492 migrate_nr_uninterruptible(rq); 5560 migrate_nr_uninterruptible(rq);
5493 BUG_ON(rq->nr_running != 0); 5561 BUG_ON(rq->nr_running != 0);
5494 5562
@@ -5598,20 +5666,20 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu)
5598 } 5666 }
5599 5667
5600 if (!group->__cpu_power) { 5668 if (!group->__cpu_power) {
5601 printk("\n"); 5669 printk(KERN_CONT "\n");
5602 printk(KERN_ERR "ERROR: domain->cpu_power not " 5670 printk(KERN_ERR "ERROR: domain->cpu_power not "
5603 "set\n"); 5671 "set\n");
5604 break; 5672 break;
5605 } 5673 }
5606 5674
5607 if (!cpus_weight(group->cpumask)) { 5675 if (!cpus_weight(group->cpumask)) {
5608 printk("\n"); 5676 printk(KERN_CONT "\n");
5609 printk(KERN_ERR "ERROR: empty group\n"); 5677 printk(KERN_ERR "ERROR: empty group\n");
5610 break; 5678 break;
5611 } 5679 }
5612 5680
5613 if (cpus_intersects(groupmask, group->cpumask)) { 5681 if (cpus_intersects(groupmask, group->cpumask)) {
5614 printk("\n"); 5682 printk(KERN_CONT "\n");
5615 printk(KERN_ERR "ERROR: repeated CPUs\n"); 5683 printk(KERN_ERR "ERROR: repeated CPUs\n");
5616 break; 5684 break;
5617 } 5685 }
@@ -5619,11 +5687,11 @@ static void sched_domain_debug(struct sched_domain *sd, int cpu)
5619 cpus_or(groupmask, groupmask, group->cpumask); 5687 cpus_or(groupmask, groupmask, group->cpumask);
5620 5688
5621 cpumask_scnprintf(str, NR_CPUS, group->cpumask); 5689 cpumask_scnprintf(str, NR_CPUS, group->cpumask);
5622 printk(" %s", str); 5690 printk(KERN_CONT " %s", str);
5623 5691
5624 group = group->next; 5692 group = group->next;
5625 } while (group != sd->groups); 5693 } while (group != sd->groups);
5626 printk("\n"); 5694 printk(KERN_CONT "\n");
5627 5695
5628 if (!cpus_equal(sd->span, groupmask)) 5696 if (!cpus_equal(sd->span, groupmask))
5629 printk(KERN_ERR "ERROR: groups don't span " 5697 printk(KERN_ERR "ERROR: groups don't span "
@@ -6339,26 +6407,31 @@ error:
6339 return -ENOMEM; 6407 return -ENOMEM;
6340#endif 6408#endif
6341} 6409}
6410
6411static cpumask_t *doms_cur; /* current sched domains */
6412static int ndoms_cur; /* number of sched domains in 'doms_cur' */
6413
6414/*
6415 * Special case: If a kmalloc of a doms_cur partition (array of
6416 * cpumask_t) fails, then fallback to a single sched domain,
6417 * as determined by the single cpumask_t fallback_doms.
6418 */
6419static cpumask_t fallback_doms;
6420
6342/* 6421/*
6343 * Set up scheduler domains and groups. Callers must hold the hotplug lock. 6422 * Set up scheduler domains and groups. Callers must hold the hotplug lock.
6423 * For now this just excludes isolated cpus, but could be used to
6424 * exclude other special cases in the future.
6344 */ 6425 */
6345static int arch_init_sched_domains(const cpumask_t *cpu_map) 6426static int arch_init_sched_domains(const cpumask_t *cpu_map)
6346{ 6427{
6347 cpumask_t cpu_default_map; 6428 ndoms_cur = 1;
6348 int err; 6429 doms_cur = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
6349 6430 if (!doms_cur)
6350 /* 6431 doms_cur = &fallback_doms;
6351 * Setup mask for cpus without special case scheduling requirements. 6432 cpus_andnot(*doms_cur, *cpu_map, cpu_isolated_map);
6352 * For now this just excludes isolated cpus, but could be used to
6353 * exclude other special cases in the future.
6354 */
6355 cpus_andnot(cpu_default_map, *cpu_map, cpu_isolated_map);
6356
6357 err = build_sched_domains(&cpu_default_map);
6358
6359 register_sched_domain_sysctl(); 6433 register_sched_domain_sysctl();
6360 6434 return build_sched_domains(doms_cur);
6361 return err;
6362} 6435}
6363 6436
6364static void arch_destroy_sched_domains(const cpumask_t *cpu_map) 6437static void arch_destroy_sched_domains(const cpumask_t *cpu_map)
@@ -6382,6 +6455,68 @@ static void detach_destroy_domains(const cpumask_t *cpu_map)
6382 arch_destroy_sched_domains(cpu_map); 6455 arch_destroy_sched_domains(cpu_map);
6383} 6456}
6384 6457
6458/*
6459 * Partition sched domains as specified by the 'ndoms_new'
6460 * cpumasks in the array doms_new[] of cpumasks. This compares
6461 * doms_new[] to the current sched domain partitioning, doms_cur[].
6462 * It destroys each deleted domain and builds each new domain.
6463 *
6464 * 'doms_new' is an array of cpumask_t's of length 'ndoms_new'.
6465 * The masks don't intersect (don't overlap.) We should setup one
6466 * sched domain for each mask. CPUs not in any of the cpumasks will
6467 * not be load balanced. If the same cpumask appears both in the
6468 * current 'doms_cur' domains and in the new 'doms_new', we can leave
6469 * it as it is.
6470 *
6471 * The passed in 'doms_new' should be kmalloc'd. This routine takes
6472 * ownership of it and will kfree it when done with it. If the caller
6473 * failed the kmalloc call, then it can pass in doms_new == NULL,
6474 * and partition_sched_domains() will fallback to the single partition
6475 * 'fallback_doms'.
6476 *
6477 * Call with hotplug lock held
6478 */
6479void partition_sched_domains(int ndoms_new, cpumask_t *doms_new)
6480{
6481 int i, j;
6482
6483 if (doms_new == NULL) {
6484 ndoms_new = 1;
6485 doms_new = &fallback_doms;
6486 cpus_andnot(doms_new[0], cpu_online_map, cpu_isolated_map);
6487 }
6488
6489 /* Destroy deleted domains */
6490 for (i = 0; i < ndoms_cur; i++) {
6491 for (j = 0; j < ndoms_new; j++) {
6492 if (cpus_equal(doms_cur[i], doms_new[j]))
6493 goto match1;
6494 }
6495 /* no match - a current sched domain not in new doms_new[] */
6496 detach_destroy_domains(doms_cur + i);
6497match1:
6498 ;
6499 }
6500
6501 /* Build new domains */
6502 for (i = 0; i < ndoms_new; i++) {
6503 for (j = 0; j < ndoms_cur; j++) {
6504 if (cpus_equal(doms_new[i], doms_cur[j]))
6505 goto match2;
6506 }
6507 /* no match - add a new doms_new */
6508 build_sched_domains(doms_new + i);
6509match2:
6510 ;
6511 }
6512
6513 /* Remember the new sched domains */
6514 if (doms_cur != &fallback_doms)
6515 kfree(doms_cur);
6516 doms_cur = doms_new;
6517 ndoms_cur = ndoms_new;
6518}
6519
6385#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) 6520#if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
6386static int arch_reinit_sched_domains(void) 6521static int arch_reinit_sched_domains(void)
6387{ 6522{
@@ -6963,3 +7098,116 @@ unsigned long sched_group_shares(struct task_group *tg)
6963} 7098}
6964 7099
6965#endif /* CONFIG_FAIR_GROUP_SCHED */ 7100#endif /* CONFIG_FAIR_GROUP_SCHED */
7101
7102#ifdef CONFIG_FAIR_CGROUP_SCHED
7103
7104/* return corresponding task_group object of a cgroup */
7105static inline struct task_group *cgroup_tg(struct cgroup *cont)
7106{
7107 return container_of(cgroup_subsys_state(cont, cpu_cgroup_subsys_id),
7108 struct task_group, css);
7109}
7110
7111static struct cgroup_subsys_state *
7112cpu_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
7113{
7114 struct task_group *tg;
7115
7116 if (!cont->parent) {
7117 /* This is early initialization for the top cgroup */
7118 init_task_group.css.cgroup = cont;
7119 return &init_task_group.css;
7120 }
7121
7122 /* we support only 1-level deep hierarchical scheduler atm */
7123 if (cont->parent->parent)
7124 return ERR_PTR(-EINVAL);
7125
7126 tg = sched_create_group();
7127 if (IS_ERR(tg))
7128 return ERR_PTR(-ENOMEM);
7129
7130 /* Bind the cgroup to task_group object we just created */
7131 tg->css.cgroup = cont;
7132
7133 return &tg->css;
7134}
7135
7136static void cpu_cgroup_destroy(struct cgroup_subsys *ss,
7137 struct cgroup *cont)
7138{
7139 struct task_group *tg = cgroup_tg(cont);
7140
7141 sched_destroy_group(tg);
7142}
7143
7144static int cpu_cgroup_can_attach(struct cgroup_subsys *ss,
7145 struct cgroup *cont, struct task_struct *tsk)
7146{
7147 /* We don't support RT-tasks being in separate groups */
7148 if (tsk->sched_class != &fair_sched_class)
7149 return -EINVAL;
7150
7151 return 0;
7152}
7153
7154static void
7155cpu_cgroup_attach(struct cgroup_subsys *ss, struct cgroup *cont,
7156 struct cgroup *old_cont, struct task_struct *tsk)
7157{
7158 sched_move_task(tsk);
7159}
7160
7161static ssize_t cpu_shares_write(struct cgroup *cont, struct cftype *cftype,
7162 struct file *file, const char __user *userbuf,
7163 size_t nbytes, loff_t *ppos)
7164{
7165 unsigned long shareval;
7166 struct task_group *tg = cgroup_tg(cont);
7167 char buffer[2*sizeof(unsigned long) + 1];
7168 int rc;
7169
7170 if (nbytes > 2*sizeof(unsigned long)) /* safety check */
7171 return -E2BIG;
7172
7173 if (copy_from_user(buffer, userbuf, nbytes))
7174 return -EFAULT;
7175
7176 buffer[nbytes] = 0; /* nul-terminate */
7177 shareval = simple_strtoul(buffer, NULL, 10);
7178
7179 rc = sched_group_set_shares(tg, shareval);
7180
7181 return (rc < 0 ? rc : nbytes);
7182}
7183
7184static u64 cpu_shares_read_uint(struct cgroup *cont, struct cftype *cft)
7185{
7186 struct task_group *tg = cgroup_tg(cont);
7187
7188 return (u64) tg->shares;
7189}
7190
7191static struct cftype cpu_shares = {
7192 .name = "shares",
7193 .read_uint = cpu_shares_read_uint,
7194 .write = cpu_shares_write,
7195};
7196
7197static int cpu_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont)
7198{
7199 return cgroup_add_file(cont, ss, &cpu_shares);
7200}
7201
7202struct cgroup_subsys cpu_cgroup_subsys = {
7203 .name = "cpu",
7204 .create = cpu_cgroup_create,
7205 .destroy = cpu_cgroup_destroy,
7206 .can_attach = cpu_cgroup_can_attach,
7207 .attach = cpu_cgroup_attach,
7208 .populate = cpu_cgroup_populate,
7209 .subsys_id = cpu_cgroup_subsys_id,
7210 .early_init = 1,
7211};
7212
7213#endif /* CONFIG_FAIR_CGROUP_SCHED */
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index a5e517ec07c3..e6fb392e5164 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -137,7 +137,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
137 SEQ_printf(m, " .%-30s: %ld\n", "nr_running", cfs_rq->nr_running); 137 SEQ_printf(m, " .%-30s: %ld\n", "nr_running", cfs_rq->nr_running);
138 SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight); 138 SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight);
139#ifdef CONFIG_SCHEDSTATS 139#ifdef CONFIG_SCHEDSTATS
140 SEQ_printf(m, " .%-30s: %ld\n", "bkl_count", 140 SEQ_printf(m, " .%-30s: %d\n", "bkl_count",
141 rq->bkl_count); 141 rq->bkl_count);
142#endif 142#endif
143 SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over", 143 SEQ_printf(m, " .%-30s: %ld\n", "nr_spread_over",
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 1c084842c3e7..ef1a7df80ea2 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -21,7 +21,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
21 21
22 /* runqueue-specific stats */ 22 /* runqueue-specific stats */
23 seq_printf(seq, 23 seq_printf(seq,
24 "cpu%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %llu %llu %lu", 24 "cpu%d %u %u %u %u %u %u %u %u %u %llu %llu %lu",
25 cpu, rq->yld_both_empty, 25 cpu, rq->yld_both_empty,
26 rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count, 26 rq->yld_act_empty, rq->yld_exp_empty, rq->yld_count,
27 rq->sched_switch, rq->sched_count, rq->sched_goidle, 27 rq->sched_switch, rq->sched_count, rq->sched_goidle,
@@ -42,8 +42,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
42 seq_printf(seq, "domain%d %s", dcount++, mask_str); 42 seq_printf(seq, "domain%d %s", dcount++, mask_str);
43 for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES; 43 for (itype = CPU_IDLE; itype < CPU_MAX_IDLE_TYPES;
44 itype++) { 44 itype++) {
45 seq_printf(seq, " %lu %lu %lu %lu %lu %lu %lu " 45 seq_printf(seq, " %u %u %u %u %u %u %u %u",
46 "%lu",
47 sd->lb_count[itype], 46 sd->lb_count[itype],
48 sd->lb_balanced[itype], 47 sd->lb_balanced[itype],
49 sd->lb_failed[itype], 48 sd->lb_failed[itype],
@@ -53,8 +52,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
53 sd->lb_nobusyq[itype], 52 sd->lb_nobusyq[itype],
54 sd->lb_nobusyg[itype]); 53 sd->lb_nobusyg[itype]);
55 } 54 }
56 seq_printf(seq, " %lu %lu %lu %lu %lu %lu %lu %lu %lu" 55 seq_printf(seq, " %u %u %u %u %u %u %u %u %u %u %u %u\n",
57 " %lu %lu %lu\n",
58 sd->alb_count, sd->alb_failed, sd->alb_pushed, 56 sd->alb_count, sd->alb_failed, sd->alb_pushed,
59 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed, 57 sd->sbe_count, sd->sbe_balanced, sd->sbe_pushed,
60 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed, 58 sd->sbf_count, sd->sbf_balanced, sd->sbf_pushed,
diff --git a/kernel/signal.c b/kernel/signal.c
index 2124ffadcfde..12006308c7eb 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -99,7 +99,6 @@ static inline int has_pending_signals(sigset_t *signal, sigset_t *blocked)
99static int recalc_sigpending_tsk(struct task_struct *t) 99static int recalc_sigpending_tsk(struct task_struct *t)
100{ 100{
101 if (t->signal->group_stop_count > 0 || 101 if (t->signal->group_stop_count > 0 ||
102 (freezing(t)) ||
103 PENDING(&t->pending, &t->blocked) || 102 PENDING(&t->pending, &t->blocked) ||
104 PENDING(&t->signal->shared_pending, &t->blocked)) { 103 PENDING(&t->signal->shared_pending, &t->blocked)) {
105 set_tsk_thread_flag(t, TIF_SIGPENDING); 104 set_tsk_thread_flag(t, TIF_SIGPENDING);
@@ -257,7 +256,7 @@ flush_signal_handlers(struct task_struct *t, int force_default)
257 256
258int unhandled_signal(struct task_struct *tsk, int sig) 257int unhandled_signal(struct task_struct *tsk, int sig)
259{ 258{
260 if (is_init(tsk)) 259 if (is_global_init(tsk))
261 return 1; 260 return 1;
262 if (tsk->ptrace & PT_PTRACED) 261 if (tsk->ptrace & PT_PTRACED)
263 return 0; 262 return 0;
@@ -537,7 +536,7 @@ static int check_kill_permission(int sig, struct siginfo *info,
537 return error; 536 return error;
538 error = -EPERM; 537 error = -EPERM;
539 if (((sig != SIGCONT) || 538 if (((sig != SIGCONT) ||
540 (process_session(current) != process_session(t))) 539 (task_session_nr(current) != task_session_nr(t)))
541 && (current->euid ^ t->suid) && (current->euid ^ t->uid) 540 && (current->euid ^ t->suid) && (current->euid ^ t->uid)
542 && (current->uid ^ t->suid) && (current->uid ^ t->uid) 541 && (current->uid ^ t->suid) && (current->uid ^ t->uid)
543 && !capable(CAP_KILL)) 542 && !capable(CAP_KILL))
@@ -695,7 +694,7 @@ static int send_signal(int sig, struct siginfo *info, struct task_struct *t,
695 q->info.si_signo = sig; 694 q->info.si_signo = sig;
696 q->info.si_errno = 0; 695 q->info.si_errno = 0;
697 q->info.si_code = SI_USER; 696 q->info.si_code = SI_USER;
698 q->info.si_pid = current->pid; 697 q->info.si_pid = task_pid_vnr(current);
699 q->info.si_uid = current->uid; 698 q->info.si_uid = current->uid;
700 break; 699 break;
701 case (unsigned long) SEND_SIG_PRIV: 700 case (unsigned long) SEND_SIG_PRIV:
@@ -731,7 +730,7 @@ int print_fatal_signals;
731static void print_fatal_signal(struct pt_regs *regs, int signr) 730static void print_fatal_signal(struct pt_regs *regs, int signr)
732{ 731{
733 printk("%s/%d: potentially unexpected fatal signal %d.\n", 732 printk("%s/%d: potentially unexpected fatal signal %d.\n",
734 current->comm, current->pid, signr); 733 current->comm, task_pid_nr(current), signr);
735 734
736#ifdef __i386__ 735#ifdef __i386__
737 printk("code at %08lx: ", regs->eip); 736 printk("code at %08lx: ", regs->eip);
@@ -1090,7 +1089,7 @@ kill_proc_info(int sig, struct siginfo *info, pid_t pid)
1090{ 1089{
1091 int error; 1090 int error;
1092 rcu_read_lock(); 1091 rcu_read_lock();
1093 error = kill_pid_info(sig, info, find_pid(pid)); 1092 error = kill_pid_info(sig, info, find_vpid(pid));
1094 rcu_read_unlock(); 1093 rcu_read_unlock();
1095 return error; 1094 return error;
1096} 1095}
@@ -1151,7 +1150,7 @@ static int kill_something_info(int sig, struct siginfo *info, int pid)
1151 1150
1152 read_lock(&tasklist_lock); 1151 read_lock(&tasklist_lock);
1153 for_each_process(p) { 1152 for_each_process(p) {
1154 if (p->pid > 1 && p->tgid != current->tgid) { 1153 if (p->pid > 1 && !same_thread_group(p, current)) {
1155 int err = group_send_sig_info(sig, info, p); 1154 int err = group_send_sig_info(sig, info, p);
1156 ++count; 1155 ++count;
1157 if (err != -EPERM) 1156 if (err != -EPERM)
@@ -1161,9 +1160,9 @@ static int kill_something_info(int sig, struct siginfo *info, int pid)
1161 read_unlock(&tasklist_lock); 1160 read_unlock(&tasklist_lock);
1162 ret = count ? retval : -ESRCH; 1161 ret = count ? retval : -ESRCH;
1163 } else if (pid < 0) { 1162 } else if (pid < 0) {
1164 ret = kill_pgrp_info(sig, info, find_pid(-pid)); 1163 ret = kill_pgrp_info(sig, info, find_vpid(-pid));
1165 } else { 1164 } else {
1166 ret = kill_pid_info(sig, info, find_pid(pid)); 1165 ret = kill_pid_info(sig, info, find_vpid(pid));
1167 } 1166 }
1168 rcu_read_unlock(); 1167 rcu_read_unlock();
1169 return ret; 1168 return ret;
@@ -1267,7 +1266,12 @@ EXPORT_SYMBOL(kill_pid);
1267int 1266int
1268kill_proc(pid_t pid, int sig, int priv) 1267kill_proc(pid_t pid, int sig, int priv)
1269{ 1268{
1270 return kill_proc_info(sig, __si_special(priv), pid); 1269 int ret;
1270
1271 rcu_read_lock();
1272 ret = kill_pid_info(sig, __si_special(priv), find_pid(pid));
1273 rcu_read_unlock();
1274 return ret;
1271} 1275}
1272 1276
1273/* 1277/*
@@ -1444,7 +1448,22 @@ void do_notify_parent(struct task_struct *tsk, int sig)
1444 1448
1445 info.si_signo = sig; 1449 info.si_signo = sig;
1446 info.si_errno = 0; 1450 info.si_errno = 0;
1447 info.si_pid = tsk->pid; 1451 /*
1452 * we are under tasklist_lock here so our parent is tied to
1453 * us and cannot exit and release its namespace.
1454 *
1455 * the only it can is to switch its nsproxy with sys_unshare,
1456 * bu uncharing pid namespaces is not allowed, so we'll always
1457 * see relevant namespace
1458 *
1459 * write_lock() currently calls preempt_disable() which is the
1460 * same as rcu_read_lock(), but according to Oleg, this is not
1461 * correct to rely on this
1462 */
1463 rcu_read_lock();
1464 info.si_pid = task_pid_nr_ns(tsk, tsk->parent->nsproxy->pid_ns);
1465 rcu_read_unlock();
1466
1448 info.si_uid = tsk->uid; 1467 info.si_uid = tsk->uid;
1449 1468
1450 /* FIXME: find out whether or not this is supposed to be c*time. */ 1469 /* FIXME: find out whether or not this is supposed to be c*time. */
@@ -1509,7 +1528,13 @@ static void do_notify_parent_cldstop(struct task_struct *tsk, int why)
1509 1528
1510 info.si_signo = SIGCHLD; 1529 info.si_signo = SIGCHLD;
1511 info.si_errno = 0; 1530 info.si_errno = 0;
1512 info.si_pid = tsk->pid; 1531 /*
1532 * see comment in do_notify_parent() abot the following 3 lines
1533 */
1534 rcu_read_lock();
1535 info.si_pid = task_pid_nr_ns(tsk, tsk->parent->nsproxy->pid_ns);
1536 rcu_read_unlock();
1537
1513 info.si_uid = tsk->uid; 1538 info.si_uid = tsk->uid;
1514 1539
1515 /* FIXME: find out whether or not this is supposed to be c*time. */ 1540 /* FIXME: find out whether or not this is supposed to be c*time. */
@@ -1635,7 +1660,7 @@ void ptrace_notify(int exit_code)
1635 memset(&info, 0, sizeof info); 1660 memset(&info, 0, sizeof info);
1636 info.si_signo = SIGTRAP; 1661 info.si_signo = SIGTRAP;
1637 info.si_code = exit_code; 1662 info.si_code = exit_code;
1638 info.si_pid = current->pid; 1663 info.si_pid = task_pid_vnr(current);
1639 info.si_uid = current->uid; 1664 info.si_uid = current->uid;
1640 1665
1641 /* Let the debugger run. */ 1666 /* Let the debugger run. */
@@ -1805,7 +1830,7 @@ relock:
1805 info->si_signo = signr; 1830 info->si_signo = signr;
1806 info->si_errno = 0; 1831 info->si_errno = 0;
1807 info->si_code = SI_USER; 1832 info->si_code = SI_USER;
1808 info->si_pid = current->parent->pid; 1833 info->si_pid = task_pid_vnr(current->parent);
1809 info->si_uid = current->parent->uid; 1834 info->si_uid = current->parent->uid;
1810 } 1835 }
1811 1836
@@ -1836,11 +1861,9 @@ relock:
1836 continue; 1861 continue;
1837 1862
1838 /* 1863 /*
1839 * Init of a pid space gets no signals it doesn't want from 1864 * Global init gets no signals it doesn't want.
1840 * within that pid space. It can of course get signals from
1841 * its parent pid space.
1842 */ 1865 */
1843 if (current == child_reaper(current)) 1866 if (is_global_init(current))
1844 continue; 1867 continue;
1845 1868
1846 if (sig_kernel_stop(signr)) { 1869 if (sig_kernel_stop(signr)) {
@@ -2194,7 +2217,7 @@ sys_kill(int pid, int sig)
2194 info.si_signo = sig; 2217 info.si_signo = sig;
2195 info.si_errno = 0; 2218 info.si_errno = 0;
2196 info.si_code = SI_USER; 2219 info.si_code = SI_USER;
2197 info.si_pid = current->tgid; 2220 info.si_pid = task_tgid_vnr(current);
2198 info.si_uid = current->uid; 2221 info.si_uid = current->uid;
2199 2222
2200 return kill_something_info(sig, &info, pid); 2223 return kill_something_info(sig, &info, pid);
@@ -2210,12 +2233,12 @@ static int do_tkill(int tgid, int pid, int sig)
2210 info.si_signo = sig; 2233 info.si_signo = sig;
2211 info.si_errno = 0; 2234 info.si_errno = 0;
2212 info.si_code = SI_TKILL; 2235 info.si_code = SI_TKILL;
2213 info.si_pid = current->tgid; 2236 info.si_pid = task_tgid_vnr(current);
2214 info.si_uid = current->uid; 2237 info.si_uid = current->uid;
2215 2238
2216 read_lock(&tasklist_lock); 2239 read_lock(&tasklist_lock);
2217 p = find_task_by_pid(pid); 2240 p = find_task_by_vpid(pid);
2218 if (p && (tgid <= 0 || p->tgid == tgid)) { 2241 if (p && (tgid <= 0 || task_tgid_vnr(p) == tgid)) {
2219 error = check_kill_permission(sig, &info, p); 2242 error = check_kill_permission(sig, &info, p);
2220 /* 2243 /*
2221 * The null signal is a permissions and process existence 2244 * The null signal is a permissions and process existence
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index edeeef3a6a32..11df812263c8 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -113,7 +113,7 @@ void softlockup_tick(void)
113 spin_lock(&print_lock); 113 spin_lock(&print_lock);
114 printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n", 114 printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n",
115 this_cpu, now - touch_timestamp, 115 this_cpu, now - touch_timestamp,
116 current->comm, current->pid); 116 current->comm, task_pid_nr(current));
117 if (regs) 117 if (regs)
118 show_regs(regs); 118 show_regs(regs);
119 else 119 else
diff --git a/kernel/sys.c b/kernel/sys.c
index 8ae2e636eb1b..304b5410d746 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -105,538 +105,6 @@ EXPORT_SYMBOL(cad_pid);
105 */ 105 */
106 106
107void (*pm_power_off_prepare)(void); 107void (*pm_power_off_prepare)(void);
108EXPORT_SYMBOL(pm_power_off_prepare);
109
110/*
111 * Notifier list for kernel code which wants to be called
112 * at shutdown. This is used to stop any idling DMA operations
113 * and the like.
114 */
115
116static BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
117
118/*
119 * Notifier chain core routines. The exported routines below
120 * are layered on top of these, with appropriate locking added.
121 */
122
123static int notifier_chain_register(struct notifier_block **nl,
124 struct notifier_block *n)
125{
126 while ((*nl) != NULL) {
127 if (n->priority > (*nl)->priority)
128 break;
129 nl = &((*nl)->next);
130 }
131 n->next = *nl;
132 rcu_assign_pointer(*nl, n);
133 return 0;
134}
135
136static int notifier_chain_unregister(struct notifier_block **nl,
137 struct notifier_block *n)
138{
139 while ((*nl) != NULL) {
140 if ((*nl) == n) {
141 rcu_assign_pointer(*nl, n->next);
142 return 0;
143 }
144 nl = &((*nl)->next);
145 }
146 return -ENOENT;
147}
148
149/**
150 * notifier_call_chain - Informs the registered notifiers about an event.
151 * @nl: Pointer to head of the blocking notifier chain
152 * @val: Value passed unmodified to notifier function
153 * @v: Pointer passed unmodified to notifier function
154 * @nr_to_call: Number of notifier functions to be called. Don't care
155 * value of this parameter is -1.
156 * @nr_calls: Records the number of notifications sent. Don't care
157 * value of this field is NULL.
158 * @returns: notifier_call_chain returns the value returned by the
159 * last notifier function called.
160 */
161
162static int __kprobes notifier_call_chain(struct notifier_block **nl,
163 unsigned long val, void *v,
164 int nr_to_call, int *nr_calls)
165{
166 int ret = NOTIFY_DONE;
167 struct notifier_block *nb, *next_nb;
168
169 nb = rcu_dereference(*nl);
170
171 while (nb && nr_to_call) {
172 next_nb = rcu_dereference(nb->next);
173 ret = nb->notifier_call(nb, val, v);
174
175 if (nr_calls)
176 (*nr_calls)++;
177
178 if ((ret & NOTIFY_STOP_MASK) == NOTIFY_STOP_MASK)
179 break;
180 nb = next_nb;
181 nr_to_call--;
182 }
183 return ret;
184}
185
186/*
187 * Atomic notifier chain routines. Registration and unregistration
188 * use a spinlock, and call_chain is synchronized by RCU (no locks).
189 */
190
191/**
192 * atomic_notifier_chain_register - Add notifier to an atomic notifier chain
193 * @nh: Pointer to head of the atomic notifier chain
194 * @n: New entry in notifier chain
195 *
196 * Adds a notifier to an atomic notifier chain.
197 *
198 * Currently always returns zero.
199 */
200
201int atomic_notifier_chain_register(struct atomic_notifier_head *nh,
202 struct notifier_block *n)
203{
204 unsigned long flags;
205 int ret;
206
207 spin_lock_irqsave(&nh->lock, flags);
208 ret = notifier_chain_register(&nh->head, n);
209 spin_unlock_irqrestore(&nh->lock, flags);
210 return ret;
211}
212
213EXPORT_SYMBOL_GPL(atomic_notifier_chain_register);
214
215/**
216 * atomic_notifier_chain_unregister - Remove notifier from an atomic notifier chain
217 * @nh: Pointer to head of the atomic notifier chain
218 * @n: Entry to remove from notifier chain
219 *
220 * Removes a notifier from an atomic notifier chain.
221 *
222 * Returns zero on success or %-ENOENT on failure.
223 */
224int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
225 struct notifier_block *n)
226{
227 unsigned long flags;
228 int ret;
229
230 spin_lock_irqsave(&nh->lock, flags);
231 ret = notifier_chain_unregister(&nh->head, n);
232 spin_unlock_irqrestore(&nh->lock, flags);
233 synchronize_rcu();
234 return ret;
235}
236
237EXPORT_SYMBOL_GPL(atomic_notifier_chain_unregister);
238
239/**
240 * __atomic_notifier_call_chain - Call functions in an atomic notifier chain
241 * @nh: Pointer to head of the atomic notifier chain
242 * @val: Value passed unmodified to notifier function
243 * @v: Pointer passed unmodified to notifier function
244 * @nr_to_call: See the comment for notifier_call_chain.
245 * @nr_calls: See the comment for notifier_call_chain.
246 *
247 * Calls each function in a notifier chain in turn. The functions
248 * run in an atomic context, so they must not block.
249 * This routine uses RCU to synchronize with changes to the chain.
250 *
251 * If the return value of the notifier can be and'ed
252 * with %NOTIFY_STOP_MASK then atomic_notifier_call_chain()
253 * will return immediately, with the return value of
254 * the notifier function which halted execution.
255 * Otherwise the return value is the return value
256 * of the last notifier function called.
257 */
258
259int __kprobes __atomic_notifier_call_chain(struct atomic_notifier_head *nh,
260 unsigned long val, void *v,
261 int nr_to_call, int *nr_calls)
262{
263 int ret;
264
265 rcu_read_lock();
266 ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
267 rcu_read_unlock();
268 return ret;
269}
270
271EXPORT_SYMBOL_GPL(__atomic_notifier_call_chain);
272
273int __kprobes atomic_notifier_call_chain(struct atomic_notifier_head *nh,
274 unsigned long val, void *v)
275{
276 return __atomic_notifier_call_chain(nh, val, v, -1, NULL);
277}
278
279EXPORT_SYMBOL_GPL(atomic_notifier_call_chain);
280/*
281 * Blocking notifier chain routines. All access to the chain is
282 * synchronized by an rwsem.
283 */
284
285/**
286 * blocking_notifier_chain_register - Add notifier to a blocking notifier chain
287 * @nh: Pointer to head of the blocking notifier chain
288 * @n: New entry in notifier chain
289 *
290 * Adds a notifier to a blocking notifier chain.
291 * Must be called in process context.
292 *
293 * Currently always returns zero.
294 */
295
296int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
297 struct notifier_block *n)
298{
299 int ret;
300
301 /*
302 * This code gets used during boot-up, when task switching is
303 * not yet working and interrupts must remain disabled. At
304 * such times we must not call down_write().
305 */
306 if (unlikely(system_state == SYSTEM_BOOTING))
307 return notifier_chain_register(&nh->head, n);
308
309 down_write(&nh->rwsem);
310 ret = notifier_chain_register(&nh->head, n);
311 up_write(&nh->rwsem);
312 return ret;
313}
314
315EXPORT_SYMBOL_GPL(blocking_notifier_chain_register);
316
317/**
318 * blocking_notifier_chain_unregister - Remove notifier from a blocking notifier chain
319 * @nh: Pointer to head of the blocking notifier chain
320 * @n: Entry to remove from notifier chain
321 *
322 * Removes a notifier from a blocking notifier chain.
323 * Must be called from process context.
324 *
325 * Returns zero on success or %-ENOENT on failure.
326 */
327int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh,
328 struct notifier_block *n)
329{
330 int ret;
331
332 /*
333 * This code gets used during boot-up, when task switching is
334 * not yet working and interrupts must remain disabled. At
335 * such times we must not call down_write().
336 */
337 if (unlikely(system_state == SYSTEM_BOOTING))
338 return notifier_chain_unregister(&nh->head, n);
339
340 down_write(&nh->rwsem);
341 ret = notifier_chain_unregister(&nh->head, n);
342 up_write(&nh->rwsem);
343 return ret;
344}
345
346EXPORT_SYMBOL_GPL(blocking_notifier_chain_unregister);
347
348/**
349 * __blocking_notifier_call_chain - Call functions in a blocking notifier chain
350 * @nh: Pointer to head of the blocking notifier chain
351 * @val: Value passed unmodified to notifier function
352 * @v: Pointer passed unmodified to notifier function
353 * @nr_to_call: See comment for notifier_call_chain.
354 * @nr_calls: See comment for notifier_call_chain.
355 *
356 * Calls each function in a notifier chain in turn. The functions
357 * run in a process context, so they are allowed to block.
358 *
359 * If the return value of the notifier can be and'ed
360 * with %NOTIFY_STOP_MASK then blocking_notifier_call_chain()
361 * will return immediately, with the return value of
362 * the notifier function which halted execution.
363 * Otherwise the return value is the return value
364 * of the last notifier function called.
365 */
366
367int __blocking_notifier_call_chain(struct blocking_notifier_head *nh,
368 unsigned long val, void *v,
369 int nr_to_call, int *nr_calls)
370{
371 int ret = NOTIFY_DONE;
372
373 /*
374 * We check the head outside the lock, but if this access is
375 * racy then it does not matter what the result of the test
376 * is, we re-check the list after having taken the lock anyway:
377 */
378 if (rcu_dereference(nh->head)) {
379 down_read(&nh->rwsem);
380 ret = notifier_call_chain(&nh->head, val, v, nr_to_call,
381 nr_calls);
382 up_read(&nh->rwsem);
383 }
384 return ret;
385}
386EXPORT_SYMBOL_GPL(__blocking_notifier_call_chain);
387
388int blocking_notifier_call_chain(struct blocking_notifier_head *nh,
389 unsigned long val, void *v)
390{
391 return __blocking_notifier_call_chain(nh, val, v, -1, NULL);
392}
393EXPORT_SYMBOL_GPL(blocking_notifier_call_chain);
394
395/*
396 * Raw notifier chain routines. There is no protection;
397 * the caller must provide it. Use at your own risk!
398 */
399
400/**
401 * raw_notifier_chain_register - Add notifier to a raw notifier chain
402 * @nh: Pointer to head of the raw notifier chain
403 * @n: New entry in notifier chain
404 *
405 * Adds a notifier to a raw notifier chain.
406 * All locking must be provided by the caller.
407 *
408 * Currently always returns zero.
409 */
410
411int raw_notifier_chain_register(struct raw_notifier_head *nh,
412 struct notifier_block *n)
413{
414 return notifier_chain_register(&nh->head, n);
415}
416
417EXPORT_SYMBOL_GPL(raw_notifier_chain_register);
418
419/**
420 * raw_notifier_chain_unregister - Remove notifier from a raw notifier chain
421 * @nh: Pointer to head of the raw notifier chain
422 * @n: Entry to remove from notifier chain
423 *
424 * Removes a notifier from a raw notifier chain.
425 * All locking must be provided by the caller.
426 *
427 * Returns zero on success or %-ENOENT on failure.
428 */
429int raw_notifier_chain_unregister(struct raw_notifier_head *nh,
430 struct notifier_block *n)
431{
432 return notifier_chain_unregister(&nh->head, n);
433}
434
435EXPORT_SYMBOL_GPL(raw_notifier_chain_unregister);
436
437/**
438 * __raw_notifier_call_chain - Call functions in a raw notifier chain
439 * @nh: Pointer to head of the raw notifier chain
440 * @val: Value passed unmodified to notifier function
441 * @v: Pointer passed unmodified to notifier function
442 * @nr_to_call: See comment for notifier_call_chain.
443 * @nr_calls: See comment for notifier_call_chain
444 *
445 * Calls each function in a notifier chain in turn. The functions
446 * run in an undefined context.
447 * All locking must be provided by the caller.
448 *
449 * If the return value of the notifier can be and'ed
450 * with %NOTIFY_STOP_MASK then raw_notifier_call_chain()
451 * will return immediately, with the return value of
452 * the notifier function which halted execution.
453 * Otherwise the return value is the return value
454 * of the last notifier function called.
455 */
456
457int __raw_notifier_call_chain(struct raw_notifier_head *nh,
458 unsigned long val, void *v,
459 int nr_to_call, int *nr_calls)
460{
461 return notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
462}
463
464EXPORT_SYMBOL_GPL(__raw_notifier_call_chain);
465
466int raw_notifier_call_chain(struct raw_notifier_head *nh,
467 unsigned long val, void *v)
468{
469 return __raw_notifier_call_chain(nh, val, v, -1, NULL);
470}
471
472EXPORT_SYMBOL_GPL(raw_notifier_call_chain);
473
474/*
475 * SRCU notifier chain routines. Registration and unregistration
476 * use a mutex, and call_chain is synchronized by SRCU (no locks).
477 */
478
479/**
480 * srcu_notifier_chain_register - Add notifier to an SRCU notifier chain
481 * @nh: Pointer to head of the SRCU notifier chain
482 * @n: New entry in notifier chain
483 *
484 * Adds a notifier to an SRCU notifier chain.
485 * Must be called in process context.
486 *
487 * Currently always returns zero.
488 */
489
490int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
491 struct notifier_block *n)
492{
493 int ret;
494
495 /*
496 * This code gets used during boot-up, when task switching is
497 * not yet working and interrupts must remain disabled. At
498 * such times we must not call mutex_lock().
499 */
500 if (unlikely(system_state == SYSTEM_BOOTING))
501 return notifier_chain_register(&nh->head, n);
502
503 mutex_lock(&nh->mutex);
504 ret = notifier_chain_register(&nh->head, n);
505 mutex_unlock(&nh->mutex);
506 return ret;
507}
508
509EXPORT_SYMBOL_GPL(srcu_notifier_chain_register);
510
511/**
512 * srcu_notifier_chain_unregister - Remove notifier from an SRCU notifier chain
513 * @nh: Pointer to head of the SRCU notifier chain
514 * @n: Entry to remove from notifier chain
515 *
516 * Removes a notifier from an SRCU notifier chain.
517 * Must be called from process context.
518 *
519 * Returns zero on success or %-ENOENT on failure.
520 */
521int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh,
522 struct notifier_block *n)
523{
524 int ret;
525
526 /*
527 * This code gets used during boot-up, when task switching is
528 * not yet working and interrupts must remain disabled. At
529 * such times we must not call mutex_lock().
530 */
531 if (unlikely(system_state == SYSTEM_BOOTING))
532 return notifier_chain_unregister(&nh->head, n);
533
534 mutex_lock(&nh->mutex);
535 ret = notifier_chain_unregister(&nh->head, n);
536 mutex_unlock(&nh->mutex);
537 synchronize_srcu(&nh->srcu);
538 return ret;
539}
540
541EXPORT_SYMBOL_GPL(srcu_notifier_chain_unregister);
542
543/**
544 * __srcu_notifier_call_chain - Call functions in an SRCU notifier chain
545 * @nh: Pointer to head of the SRCU notifier chain
546 * @val: Value passed unmodified to notifier function
547 * @v: Pointer passed unmodified to notifier function
548 * @nr_to_call: See comment for notifier_call_chain.
549 * @nr_calls: See comment for notifier_call_chain
550 *
551 * Calls each function in a notifier chain in turn. The functions
552 * run in a process context, so they are allowed to block.
553 *
554 * If the return value of the notifier can be and'ed
555 * with %NOTIFY_STOP_MASK then srcu_notifier_call_chain()
556 * will return immediately, with the return value of
557 * the notifier function which halted execution.
558 * Otherwise the return value is the return value
559 * of the last notifier function called.
560 */
561
562int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
563 unsigned long val, void *v,
564 int nr_to_call, int *nr_calls)
565{
566 int ret;
567 int idx;
568
569 idx = srcu_read_lock(&nh->srcu);
570 ret = notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
571 srcu_read_unlock(&nh->srcu, idx);
572 return ret;
573}
574EXPORT_SYMBOL_GPL(__srcu_notifier_call_chain);
575
576int srcu_notifier_call_chain(struct srcu_notifier_head *nh,
577 unsigned long val, void *v)
578{
579 return __srcu_notifier_call_chain(nh, val, v, -1, NULL);
580}
581EXPORT_SYMBOL_GPL(srcu_notifier_call_chain);
582
583/**
584 * srcu_init_notifier_head - Initialize an SRCU notifier head
585 * @nh: Pointer to head of the srcu notifier chain
586 *
587 * Unlike other sorts of notifier heads, SRCU notifier heads require
588 * dynamic initialization. Be sure to call this routine before
589 * calling any of the other SRCU notifier routines for this head.
590 *
591 * If an SRCU notifier head is deallocated, it must first be cleaned
592 * up by calling srcu_cleanup_notifier_head(). Otherwise the head's
593 * per-cpu data (used by the SRCU mechanism) will leak.
594 */
595
596void srcu_init_notifier_head(struct srcu_notifier_head *nh)
597{
598 mutex_init(&nh->mutex);
599 if (init_srcu_struct(&nh->srcu) < 0)
600 BUG();
601 nh->head = NULL;
602}
603
604EXPORT_SYMBOL_GPL(srcu_init_notifier_head);
605
606/**
607 * register_reboot_notifier - Register function to be called at reboot time
608 * @nb: Info about notifier function to be called
609 *
610 * Registers a function with the list of functions
611 * to be called at reboot time.
612 *
613 * Currently always returns zero, as blocking_notifier_chain_register()
614 * always returns zero.
615 */
616
617int register_reboot_notifier(struct notifier_block * nb)
618{
619 return blocking_notifier_chain_register(&reboot_notifier_list, nb);
620}
621
622EXPORT_SYMBOL(register_reboot_notifier);
623
624/**
625 * unregister_reboot_notifier - Unregister previously registered reboot notifier
626 * @nb: Hook to be unregistered
627 *
628 * Unregisters a previously registered reboot
629 * notifier function.
630 *
631 * Returns zero on success, or %-ENOENT on failure.
632 */
633
634int unregister_reboot_notifier(struct notifier_block * nb)
635{
636 return blocking_notifier_chain_unregister(&reboot_notifier_list, nb);
637}
638
639EXPORT_SYMBOL(unregister_reboot_notifier);
640 108
641static int set_one_prio(struct task_struct *p, int niceval, int error) 109static int set_one_prio(struct task_struct *p, int niceval, int error)
642{ 110{
@@ -684,7 +152,7 @@ asmlinkage long sys_setpriority(int which, int who, int niceval)
684 switch (which) { 152 switch (which) {
685 case PRIO_PROCESS: 153 case PRIO_PROCESS:
686 if (who) 154 if (who)
687 p = find_task_by_pid(who); 155 p = find_task_by_vpid(who);
688 else 156 else
689 p = current; 157 p = current;
690 if (p) 158 if (p)
@@ -692,7 +160,7 @@ asmlinkage long sys_setpriority(int which, int who, int niceval)
692 break; 160 break;
693 case PRIO_PGRP: 161 case PRIO_PGRP:
694 if (who) 162 if (who)
695 pgrp = find_pid(who); 163 pgrp = find_vpid(who);
696 else 164 else
697 pgrp = task_pgrp(current); 165 pgrp = task_pgrp(current);
698 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 166 do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
@@ -741,7 +209,7 @@ asmlinkage long sys_getpriority(int which, int who)
741 switch (which) { 209 switch (which) {
742 case PRIO_PROCESS: 210 case PRIO_PROCESS:
743 if (who) 211 if (who)
744 p = find_task_by_pid(who); 212 p = find_task_by_vpid(who);
745 else 213 else
746 p = current; 214 p = current;
747 if (p) { 215 if (p) {
@@ -752,7 +220,7 @@ asmlinkage long sys_getpriority(int which, int who)
752 break; 220 break;
753 case PRIO_PGRP: 221 case PRIO_PGRP:
754 if (who) 222 if (who)
755 pgrp = find_pid(who); 223 pgrp = find_vpid(who);
756 else 224 else
757 pgrp = task_pgrp(current); 225 pgrp = task_pgrp(current);
758 do_each_pid_task(pgrp, PIDTYPE_PGID, p) { 226 do_each_pid_task(pgrp, PIDTYPE_PGID, p) {
@@ -1449,9 +917,10 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
1449 struct task_struct *p; 917 struct task_struct *p;
1450 struct task_struct *group_leader = current->group_leader; 918 struct task_struct *group_leader = current->group_leader;
1451 int err = -EINVAL; 919 int err = -EINVAL;
920 struct pid_namespace *ns;
1452 921
1453 if (!pid) 922 if (!pid)
1454 pid = group_leader->pid; 923 pid = task_pid_vnr(group_leader);
1455 if (!pgid) 924 if (!pgid)
1456 pgid = pid; 925 pgid = pid;
1457 if (pgid < 0) 926 if (pgid < 0)
@@ -1460,10 +929,12 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
1460 /* From this point forward we keep holding onto the tasklist lock 929 /* From this point forward we keep holding onto the tasklist lock
1461 * so that our parent does not change from under us. -DaveM 930 * so that our parent does not change from under us. -DaveM
1462 */ 931 */
932 ns = current->nsproxy->pid_ns;
933
1463 write_lock_irq(&tasklist_lock); 934 write_lock_irq(&tasklist_lock);
1464 935
1465 err = -ESRCH; 936 err = -ESRCH;
1466 p = find_task_by_pid(pid); 937 p = find_task_by_pid_ns(pid, ns);
1467 if (!p) 938 if (!p)
1468 goto out; 939 goto out;
1469 940
@@ -1489,9 +960,9 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
1489 goto out; 960 goto out;
1490 961
1491 if (pgid != pid) { 962 if (pgid != pid) {
1492 struct task_struct *g = 963 struct task_struct *g;
1493 find_task_by_pid_type(PIDTYPE_PGID, pgid);
1494 964
965 g = find_task_by_pid_type_ns(PIDTYPE_PGID, pgid, ns);
1495 if (!g || task_session(g) != task_session(group_leader)) 966 if (!g || task_session(g) != task_session(group_leader))
1496 goto out; 967 goto out;
1497 } 968 }
@@ -1500,10 +971,13 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
1500 if (err) 971 if (err)
1501 goto out; 972 goto out;
1502 973
1503 if (process_group(p) != pgid) { 974 if (task_pgrp_nr_ns(p, ns) != pgid) {
975 struct pid *pid;
976
1504 detach_pid(p, PIDTYPE_PGID); 977 detach_pid(p, PIDTYPE_PGID);
1505 p->signal->pgrp = pgid; 978 pid = find_vpid(pgid);
1506 attach_pid(p, PIDTYPE_PGID, find_pid(pgid)); 979 attach_pid(p, PIDTYPE_PGID, pid);
980 set_task_pgrp(p, pid_nr(pid));
1507 } 981 }
1508 982
1509 err = 0; 983 err = 0;
@@ -1516,19 +990,21 @@ out:
1516asmlinkage long sys_getpgid(pid_t pid) 990asmlinkage long sys_getpgid(pid_t pid)
1517{ 991{
1518 if (!pid) 992 if (!pid)
1519 return process_group(current); 993 return task_pgrp_vnr(current);
1520 else { 994 else {
1521 int retval; 995 int retval;
1522 struct task_struct *p; 996 struct task_struct *p;
997 struct pid_namespace *ns;
1523 998
1524 read_lock(&tasklist_lock); 999 ns = current->nsproxy->pid_ns;
1525 p = find_task_by_pid(pid);
1526 1000
1001 read_lock(&tasklist_lock);
1002 p = find_task_by_pid_ns(pid, ns);
1527 retval = -ESRCH; 1003 retval = -ESRCH;
1528 if (p) { 1004 if (p) {
1529 retval = security_task_getpgid(p); 1005 retval = security_task_getpgid(p);
1530 if (!retval) 1006 if (!retval)
1531 retval = process_group(p); 1007 retval = task_pgrp_nr_ns(p, ns);
1532 } 1008 }
1533 read_unlock(&tasklist_lock); 1009 read_unlock(&tasklist_lock);
1534 return retval; 1010 return retval;
@@ -1540,7 +1016,7 @@ asmlinkage long sys_getpgid(pid_t pid)
1540asmlinkage long sys_getpgrp(void) 1016asmlinkage long sys_getpgrp(void)
1541{ 1017{
1542 /* SMP - assuming writes are word atomic this is fine */ 1018 /* SMP - assuming writes are word atomic this is fine */
1543 return process_group(current); 1019 return task_pgrp_vnr(current);
1544} 1020}
1545 1021
1546#endif 1022#endif
@@ -1548,19 +1024,21 @@ asmlinkage long sys_getpgrp(void)
1548asmlinkage long sys_getsid(pid_t pid) 1024asmlinkage long sys_getsid(pid_t pid)
1549{ 1025{
1550 if (!pid) 1026 if (!pid)
1551 return process_session(current); 1027 return task_session_vnr(current);
1552 else { 1028 else {
1553 int retval; 1029 int retval;
1554 struct task_struct *p; 1030 struct task_struct *p;
1031 struct pid_namespace *ns;
1555 1032
1556 read_lock(&tasklist_lock); 1033 ns = current->nsproxy->pid_ns;
1557 p = find_task_by_pid(pid);
1558 1034
1035 read_lock(&tasklist_lock);
1036 p = find_task_by_pid_ns(pid, ns);
1559 retval = -ESRCH; 1037 retval = -ESRCH;
1560 if (p) { 1038 if (p) {
1561 retval = security_task_getsid(p); 1039 retval = security_task_getsid(p);
1562 if (!retval) 1040 if (!retval)
1563 retval = process_session(p); 1041 retval = task_session_nr_ns(p, ns);
1564 } 1042 }
1565 read_unlock(&tasklist_lock); 1043 read_unlock(&tasklist_lock);
1566 return retval; 1044 return retval;
@@ -1587,7 +1065,8 @@ asmlinkage long sys_setsid(void)
1587 * session id and so the check will always fail and make it so 1065 * session id and so the check will always fail and make it so
1588 * init cannot successfully call setsid. 1066 * init cannot successfully call setsid.
1589 */ 1067 */
1590 if (session > 1 && find_task_by_pid_type(PIDTYPE_PGID, session)) 1068 if (session > 1 && find_task_by_pid_type_ns(PIDTYPE_PGID,
1069 session, &init_pid_ns))
1591 goto out; 1070 goto out;
1592 1071
1593 group_leader->signal->leader = 1; 1072 group_leader->signal->leader = 1;
@@ -1597,7 +1076,7 @@ asmlinkage long sys_setsid(void)
1597 group_leader->signal->tty = NULL; 1076 group_leader->signal->tty = NULL;
1598 spin_unlock(&group_leader->sighand->siglock); 1077 spin_unlock(&group_leader->sighand->siglock);
1599 1078
1600 err = process_group(group_leader); 1079 err = task_pgrp_vnr(group_leader);
1601out: 1080out:
1602 write_unlock_irq(&tasklist_lock); 1081 write_unlock_irq(&tasklist_lock);
1603 return err; 1082 return err;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index dde3d53e8adc..3b4efbe26445 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -24,7 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/sysctl.h> 25#include <linux/sysctl.h>
26#include <linux/proc_fs.h> 26#include <linux/proc_fs.h>
27#include <linux/capability.h> 27#include <linux/security.h>
28#include <linux/ctype.h> 28#include <linux/ctype.h>
29#include <linux/utsname.h> 29#include <linux/utsname.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
@@ -55,6 +55,8 @@
55#include <asm/stacktrace.h> 55#include <asm/stacktrace.h>
56#endif 56#endif
57 57
58static int deprecated_sysctl_warning(struct __sysctl_args *args);
59
58#if defined(CONFIG_SYSCTL) 60#if defined(CONFIG_SYSCTL)
59 61
60/* External variables not in a header file. */ 62/* External variables not in a header file. */
@@ -142,32 +144,29 @@ extern int max_lock_depth;
142 144
143#ifdef CONFIG_SYSCTL_SYSCALL 145#ifdef CONFIG_SYSCTL_SYSCALL
144static int parse_table(int __user *, int, void __user *, size_t __user *, 146static int parse_table(int __user *, int, void __user *, size_t __user *,
145 void __user *, size_t, ctl_table *); 147 void __user *, size_t, struct ctl_table *);
146#endif 148#endif
147 149
148 150
149#ifdef CONFIG_PROC_SYSCTL 151#ifdef CONFIG_PROC_SYSCTL
150static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, 152static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
151 void __user *buffer, size_t *lenp, loff_t *ppos); 153 void __user *buffer, size_t *lenp, loff_t *ppos);
152static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp, 154static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp,
153 void __user *buffer, size_t *lenp, loff_t *ppos); 155 void __user *buffer, size_t *lenp, loff_t *ppos);
154#endif 156#endif
155 157
156static ctl_table root_table[]; 158static struct ctl_table root_table[];
157static struct ctl_table_header root_table_header = 159static struct ctl_table_header root_table_header =
158 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) }; 160 { root_table, LIST_HEAD_INIT(root_table_header.ctl_entry) };
159 161
160static ctl_table kern_table[]; 162static struct ctl_table kern_table[];
161static ctl_table vm_table[]; 163static struct ctl_table vm_table[];
162static ctl_table fs_table[]; 164static struct ctl_table fs_table[];
163static ctl_table debug_table[]; 165static struct ctl_table debug_table[];
164static ctl_table dev_table[]; 166static struct ctl_table dev_table[];
165extern ctl_table random_table[]; 167extern struct ctl_table random_table[];
166#ifdef CONFIG_UNIX98_PTYS
167extern ctl_table pty_table[];
168#endif
169#ifdef CONFIG_INOTIFY_USER 168#ifdef CONFIG_INOTIFY_USER
170extern ctl_table inotify_table[]; 169extern struct ctl_table inotify_table[];
171#endif 170#endif
172 171
173#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT 172#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
@@ -179,7 +178,7 @@ extern int lock_stat;
179 178
180/* The default sysctl tables: */ 179/* The default sysctl tables: */
181 180
182static ctl_table root_table[] = { 181static struct ctl_table root_table[] = {
183 { 182 {
184 .ctl_name = CTL_KERN, 183 .ctl_name = CTL_KERN,
185 .procname = "kernel", 184 .procname = "kernel",
@@ -232,7 +231,7 @@ static unsigned long min_wakeup_granularity_ns; /* 0 usecs */
232static unsigned long max_wakeup_granularity_ns = 1000000000; /* 1 second */ 231static unsigned long max_wakeup_granularity_ns = 1000000000; /* 1 second */
233#endif 232#endif
234 233
235static ctl_table kern_table[] = { 234static struct ctl_table kern_table[] = {
236#ifdef CONFIG_SCHED_DEBUG 235#ifdef CONFIG_SCHED_DEBUG
237 { 236 {
238 .ctl_name = CTL_UNNUMBERED, 237 .ctl_name = CTL_UNNUMBERED,
@@ -365,7 +364,6 @@ static ctl_table kern_table[] = {
365 }, 364 },
366#ifdef CONFIG_PROC_SYSCTL 365#ifdef CONFIG_PROC_SYSCTL
367 { 366 {
368 .ctl_name = KERN_TAINTED,
369 .procname = "tainted", 367 .procname = "tainted",
370 .data = &tainted, 368 .data = &tainted,
371 .maxlen = sizeof(int), 369 .maxlen = sizeof(int),
@@ -373,14 +371,15 @@ static ctl_table kern_table[] = {
373 .proc_handler = &proc_dointvec_taint, 371 .proc_handler = &proc_dointvec_taint,
374 }, 372 },
375#endif 373#endif
374#ifdef CONFIG_SECURITY_CAPABILITIES
376 { 375 {
377 .ctl_name = KERN_CAP_BSET,
378 .procname = "cap-bound", 376 .procname = "cap-bound",
379 .data = &cap_bset, 377 .data = &cap_bset,
380 .maxlen = sizeof(kernel_cap_t), 378 .maxlen = sizeof(kernel_cap_t),
381 .mode = 0600, 379 .mode = 0600,
382 .proc_handler = &proc_dointvec_bset, 380 .proc_handler = &proc_dointvec_bset,
383 }, 381 },
382#endif /* def CONFIG_SECURITY_CAPABILITIES */
384#ifdef CONFIG_BLK_DEV_INITRD 383#ifdef CONFIG_BLK_DEV_INITRD
385 { 384 {
386 .ctl_name = KERN_REALROOTDEV, 385 .ctl_name = KERN_REALROOTDEV,
@@ -514,7 +513,6 @@ static ctl_table kern_table[] = {
514#endif 513#endif
515#ifdef CONFIG_PROC_SYSCTL 514#ifdef CONFIG_PROC_SYSCTL
516 { 515 {
517 .ctl_name = KERN_CADPID,
518 .procname = "cad_pid", 516 .procname = "cad_pid",
519 .data = NULL, 517 .data = NULL,
520 .maxlen = sizeof (int), 518 .maxlen = sizeof (int),
@@ -536,14 +534,6 @@ static ctl_table kern_table[] = {
536 .mode = 0555, 534 .mode = 0555,
537 .child = random_table, 535 .child = random_table,
538 }, 536 },
539#ifdef CONFIG_UNIX98_PTYS
540 {
541 .ctl_name = KERN_PTY,
542 .procname = "pty",
543 .mode = 0555,
544 .child = pty_table,
545 },
546#endif
547 { 537 {
548 .ctl_name = KERN_OVERFLOWUID, 538 .ctl_name = KERN_OVERFLOWUID,
549 .procname = "overflowuid", 539 .procname = "overflowuid",
@@ -650,7 +640,6 @@ static ctl_table kern_table[] = {
650 .proc_handler = &proc_dointvec, 640 .proc_handler = &proc_dointvec,
651 }, 641 },
652 { 642 {
653 .ctl_name = KERN_NMI_WATCHDOG,
654 .procname = "nmi_watchdog", 643 .procname = "nmi_watchdog",
655 .data = &nmi_watchdog_enabled, 644 .data = &nmi_watchdog_enabled,
656 .maxlen = sizeof (int), 645 .maxlen = sizeof (int),
@@ -706,7 +695,6 @@ static ctl_table kern_table[] = {
706#endif 695#endif
707#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86) 696#if defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
708 { 697 {
709 .ctl_name = KERN_ACPI_VIDEO_FLAGS,
710 .procname = "acpi_video_flags", 698 .procname = "acpi_video_flags",
711 .data = &acpi_realmode_flags, 699 .data = &acpi_realmode_flags,
712 .maxlen = sizeof (unsigned long), 700 .maxlen = sizeof (unsigned long),
@@ -783,7 +771,7 @@ static ctl_table kern_table[] = {
783 { .ctl_name = 0 } 771 { .ctl_name = 0 }
784}; 772};
785 773
786static ctl_table vm_table[] = { 774static struct ctl_table vm_table[] = {
787 { 775 {
788 .ctl_name = VM_OVERCOMMIT_MEMORY, 776 .ctl_name = VM_OVERCOMMIT_MEMORY,
789 .procname = "overcommit_memory", 777 .procname = "overcommit_memory",
@@ -847,7 +835,6 @@ static ctl_table vm_table[] = {
847 .extra2 = &one_hundred, 835 .extra2 = &one_hundred,
848 }, 836 },
849 { 837 {
850 .ctl_name = VM_DIRTY_WB_CS,
851 .procname = "dirty_writeback_centisecs", 838 .procname = "dirty_writeback_centisecs",
852 .data = &dirty_writeback_interval, 839 .data = &dirty_writeback_interval,
853 .maxlen = sizeof(dirty_writeback_interval), 840 .maxlen = sizeof(dirty_writeback_interval),
@@ -855,7 +842,6 @@ static ctl_table vm_table[] = {
855 .proc_handler = &dirty_writeback_centisecs_handler, 842 .proc_handler = &dirty_writeback_centisecs_handler,
856 }, 843 },
857 { 844 {
858 .ctl_name = VM_DIRTY_EXPIRE_CS,
859 .procname = "dirty_expire_centisecs", 845 .procname = "dirty_expire_centisecs",
860 .data = &dirty_expire_interval, 846 .data = &dirty_expire_interval,
861 .maxlen = sizeof(dirty_expire_interval), 847 .maxlen = sizeof(dirty_expire_interval),
@@ -883,7 +869,6 @@ static ctl_table vm_table[] = {
883 }, 869 },
884#ifdef CONFIG_HUGETLB_PAGE 870#ifdef CONFIG_HUGETLB_PAGE
885 { 871 {
886 .ctl_name = VM_HUGETLB_PAGES,
887 .procname = "nr_hugepages", 872 .procname = "nr_hugepages",
888 .data = &max_huge_pages, 873 .data = &max_huge_pages,
889 .maxlen = sizeof(unsigned long), 874 .maxlen = sizeof(unsigned long),
@@ -1093,12 +1078,12 @@ static ctl_table vm_table[] = {
1093}; 1078};
1094 1079
1095#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE) 1080#if defined(CONFIG_BINFMT_MISC) || defined(CONFIG_BINFMT_MISC_MODULE)
1096static ctl_table binfmt_misc_table[] = { 1081static struct ctl_table binfmt_misc_table[] = {
1097 { .ctl_name = 0 } 1082 { .ctl_name = 0 }
1098}; 1083};
1099#endif 1084#endif
1100 1085
1101static ctl_table fs_table[] = { 1086static struct ctl_table fs_table[] = {
1102 { 1087 {
1103 .ctl_name = FS_NRINODE, 1088 .ctl_name = FS_NRINODE,
1104 .procname = "inode-nr", 1089 .procname = "inode-nr",
@@ -1116,7 +1101,6 @@ static ctl_table fs_table[] = {
1116 .proc_handler = &proc_dointvec, 1101 .proc_handler = &proc_dointvec,
1117 }, 1102 },
1118 { 1103 {
1119 .ctl_name = FS_NRFILE,
1120 .procname = "file-nr", 1104 .procname = "file-nr",
1121 .data = &files_stat, 1105 .data = &files_stat,
1122 .maxlen = 3*sizeof(int), 1106 .maxlen = 3*sizeof(int),
@@ -1192,7 +1176,6 @@ static ctl_table fs_table[] = {
1192 .extra2 = &two, 1176 .extra2 = &two,
1193 }, 1177 },
1194 { 1178 {
1195 .ctl_name = FS_AIO_NR,
1196 .procname = "aio-nr", 1179 .procname = "aio-nr",
1197 .data = &aio_nr, 1180 .data = &aio_nr,
1198 .maxlen = sizeof(aio_nr), 1181 .maxlen = sizeof(aio_nr),
@@ -1200,7 +1183,6 @@ static ctl_table fs_table[] = {
1200 .proc_handler = &proc_doulongvec_minmax, 1183 .proc_handler = &proc_doulongvec_minmax,
1201 }, 1184 },
1202 { 1185 {
1203 .ctl_name = FS_AIO_MAX_NR,
1204 .procname = "aio-max-nr", 1186 .procname = "aio-max-nr",
1205 .data = &aio_max_nr, 1187 .data = &aio_max_nr,
1206 .maxlen = sizeof(aio_max_nr), 1188 .maxlen = sizeof(aio_max_nr),
@@ -1239,7 +1221,7 @@ static ctl_table fs_table[] = {
1239 { .ctl_name = 0 } 1221 { .ctl_name = 0 }
1240}; 1222};
1241 1223
1242static ctl_table debug_table[] = { 1224static struct ctl_table debug_table[] = {
1243#if defined(CONFIG_X86) || defined(CONFIG_PPC) 1225#if defined(CONFIG_X86) || defined(CONFIG_PPC)
1244 { 1226 {
1245 .ctl_name = CTL_UNNUMBERED, 1227 .ctl_name = CTL_UNNUMBERED,
@@ -1253,7 +1235,7 @@ static ctl_table debug_table[] = {
1253 { .ctl_name = 0 } 1235 { .ctl_name = 0 }
1254}; 1236};
1255 1237
1256static ctl_table dev_table[] = { 1238static struct ctl_table dev_table[] = {
1257 { .ctl_name = 0 } 1239 { .ctl_name = 0 }
1258}; 1240};
1259 1241
@@ -1369,10 +1351,15 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1369 if (copy_from_user(&tmp, args, sizeof(tmp))) 1351 if (copy_from_user(&tmp, args, sizeof(tmp)))
1370 return -EFAULT; 1352 return -EFAULT;
1371 1353
1354 error = deprecated_sysctl_warning(&tmp);
1355 if (error)
1356 goto out;
1357
1372 lock_kernel(); 1358 lock_kernel();
1373 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp, 1359 error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
1374 tmp.newval, tmp.newlen); 1360 tmp.newval, tmp.newlen);
1375 unlock_kernel(); 1361 unlock_kernel();
1362out:
1376 return error; 1363 return error;
1377} 1364}
1378#endif /* CONFIG_SYSCTL_SYSCALL */ 1365#endif /* CONFIG_SYSCTL_SYSCALL */
@@ -1393,7 +1380,7 @@ static int test_perm(int mode, int op)
1393 return -EACCES; 1380 return -EACCES;
1394} 1381}
1395 1382
1396int sysctl_perm(ctl_table *table, int op) 1383int sysctl_perm(struct ctl_table *table, int op)
1397{ 1384{
1398 int error; 1385 int error;
1399 error = security_sysctl(table, op); 1386 error = security_sysctl(table, op);
@@ -1406,7 +1393,7 @@ int sysctl_perm(ctl_table *table, int op)
1406static int parse_table(int __user *name, int nlen, 1393static int parse_table(int __user *name, int nlen,
1407 void __user *oldval, size_t __user *oldlenp, 1394 void __user *oldval, size_t __user *oldlenp,
1408 void __user *newval, size_t newlen, 1395 void __user *newval, size_t newlen,
1409 ctl_table *table) 1396 struct ctl_table *table)
1410{ 1397{
1411 int n; 1398 int n;
1412repeat: 1399repeat:
@@ -1437,13 +1424,12 @@ repeat:
1437} 1424}
1438 1425
1439/* Perform the actual read/write of a sysctl table entry. */ 1426/* Perform the actual read/write of a sysctl table entry. */
1440int do_sysctl_strategy (ctl_table *table, 1427int do_sysctl_strategy (struct ctl_table *table,
1441 int __user *name, int nlen, 1428 int __user *name, int nlen,
1442 void __user *oldval, size_t __user *oldlenp, 1429 void __user *oldval, size_t __user *oldlenp,
1443 void __user *newval, size_t newlen) 1430 void __user *newval, size_t newlen)
1444{ 1431{
1445 int op = 0, rc; 1432 int op = 0, rc;
1446 size_t len;
1447 1433
1448 if (oldval) 1434 if (oldval)
1449 op |= 004; 1435 op |= 004;
@@ -1464,25 +1450,10 @@ int do_sysctl_strategy (ctl_table *table,
1464 /* If there is no strategy routine, or if the strategy returns 1450 /* If there is no strategy routine, or if the strategy returns
1465 * zero, proceed with automatic r/w */ 1451 * zero, proceed with automatic r/w */
1466 if (table->data && table->maxlen) { 1452 if (table->data && table->maxlen) {
1467 if (oldval && oldlenp) { 1453 rc = sysctl_data(table, name, nlen, oldval, oldlenp,
1468 if (get_user(len, oldlenp)) 1454 newval, newlen);
1469 return -EFAULT; 1455 if (rc < 0)
1470 if (len) { 1456 return rc;
1471 if (len > table->maxlen)
1472 len = table->maxlen;
1473 if(copy_to_user(oldval, table->data, len))
1474 return -EFAULT;
1475 if(put_user(len, oldlenp))
1476 return -EFAULT;
1477 }
1478 }
1479 if (newval && newlen) {
1480 len = newlen;
1481 if (len > table->maxlen)
1482 len = table->maxlen;
1483 if(copy_from_user(table->data, newval, len))
1484 return -EFAULT;
1485 }
1486 } 1457 }
1487 return 0; 1458 return 0;
1488} 1459}
@@ -1499,7 +1470,9 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
1499 1470
1500static __init int sysctl_init(void) 1471static __init int sysctl_init(void)
1501{ 1472{
1473 int err;
1502 sysctl_set_parent(NULL, root_table); 1474 sysctl_set_parent(NULL, root_table);
1475 err = sysctl_check_table(root_table);
1503 return 0; 1476 return 0;
1504} 1477}
1505 1478
@@ -1512,7 +1485,7 @@ core_initcall(sysctl_init);
1512 * Register a sysctl table hierarchy. @table should be a filled in ctl_table 1485 * Register a sysctl table hierarchy. @table should be a filled in ctl_table
1513 * array. An entry with a ctl_name of 0 terminates the table. 1486 * array. An entry with a ctl_name of 0 terminates the table.
1514 * 1487 *
1515 * The members of the &ctl_table structure are used as follows: 1488 * The members of the &struct ctl_table structure are used as follows:
1516 * 1489 *
1517 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number 1490 * ctl_name - This is the numeric sysctl value used by sysctl(2). The number
1518 * must be unique within that level of sysctl 1491 * must be unique within that level of sysctl
@@ -1573,7 +1546,7 @@ core_initcall(sysctl_init);
1573 * This routine returns %NULL on a failure to register, and a pointer 1546 * This routine returns %NULL on a failure to register, and a pointer
1574 * to the table header on success. 1547 * to the table header on success.
1575 */ 1548 */
1576struct ctl_table_header *register_sysctl_table(ctl_table * table) 1549struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1577{ 1550{
1578 struct ctl_table_header *tmp; 1551 struct ctl_table_header *tmp;
1579 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL); 1552 tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
@@ -1584,6 +1557,10 @@ struct ctl_table_header *register_sysctl_table(ctl_table * table)
1584 tmp->used = 0; 1557 tmp->used = 0;
1585 tmp->unregistering = NULL; 1558 tmp->unregistering = NULL;
1586 sysctl_set_parent(NULL, table); 1559 sysctl_set_parent(NULL, table);
1560 if (sysctl_check_table(tmp->ctl_table)) {
1561 kfree(tmp);
1562 return NULL;
1563 }
1587 spin_lock(&sysctl_lock); 1564 spin_lock(&sysctl_lock);
1588 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry); 1565 list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
1589 spin_unlock(&sysctl_lock); 1566 spin_unlock(&sysctl_lock);
@@ -1607,7 +1584,7 @@ void unregister_sysctl_table(struct ctl_table_header * header)
1607} 1584}
1608 1585
1609#else /* !CONFIG_SYSCTL */ 1586#else /* !CONFIG_SYSCTL */
1610struct ctl_table_header *register_sysctl_table(ctl_table * table) 1587struct ctl_table_header *register_sysctl_table(struct ctl_table * table)
1611{ 1588{
1612 return NULL; 1589 return NULL;
1613} 1590}
@@ -1700,7 +1677,7 @@ static int _proc_do_string(void* data, int maxlen, int write,
1700 * 1677 *
1701 * Returns 0 on success. 1678 * Returns 0 on success.
1702 */ 1679 */
1703int proc_dostring(ctl_table *table, int write, struct file *filp, 1680int proc_dostring(struct ctl_table *table, int write, struct file *filp,
1704 void __user *buffer, size_t *lenp, loff_t *ppos) 1681 void __user *buffer, size_t *lenp, loff_t *ppos)
1705{ 1682{
1706 return _proc_do_string(table->data, table->maxlen, write, filp, 1683 return _proc_do_string(table->data, table->maxlen, write, filp,
@@ -1727,7 +1704,7 @@ static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
1727 return 0; 1704 return 0;
1728} 1705}
1729 1706
1730static int __do_proc_dointvec(void *tbl_data, ctl_table *table, 1707static int __do_proc_dointvec(void *tbl_data, struct ctl_table *table,
1731 int write, struct file *filp, void __user *buffer, 1708 int write, struct file *filp, void __user *buffer,
1732 size_t *lenp, loff_t *ppos, 1709 size_t *lenp, loff_t *ppos,
1733 int (*conv)(int *negp, unsigned long *lvalp, int *valp, 1710 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
@@ -1837,7 +1814,7 @@ static int __do_proc_dointvec(void *tbl_data, ctl_table *table,
1837#undef TMPBUFLEN 1814#undef TMPBUFLEN
1838} 1815}
1839 1816
1840static int do_proc_dointvec(ctl_table *table, int write, struct file *filp, 1817static int do_proc_dointvec(struct ctl_table *table, int write, struct file *filp,
1841 void __user *buffer, size_t *lenp, loff_t *ppos, 1818 void __user *buffer, size_t *lenp, loff_t *ppos,
1842 int (*conv)(int *negp, unsigned long *lvalp, int *valp, 1819 int (*conv)(int *negp, unsigned long *lvalp, int *valp,
1843 int write, void *data), 1820 int write, void *data),
@@ -1861,7 +1838,7 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
1861 * 1838 *
1862 * Returns 0 on success. 1839 * Returns 0 on success.
1863 */ 1840 */
1864int proc_dointvec(ctl_table *table, int write, struct file *filp, 1841int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
1865 void __user *buffer, size_t *lenp, loff_t *ppos) 1842 void __user *buffer, size_t *lenp, loff_t *ppos)
1866{ 1843{
1867 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 1844 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
@@ -1897,11 +1874,12 @@ static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
1897 return 0; 1874 return 0;
1898} 1875}
1899 1876
1877#ifdef CONFIG_SECURITY_CAPABILITIES
1900/* 1878/*
1901 * init may raise the set. 1879 * init may raise the set.
1902 */ 1880 */
1903 1881
1904int proc_dointvec_bset(ctl_table *table, int write, struct file *filp, 1882int proc_dointvec_bset(struct ctl_table *table, int write, struct file *filp,
1905 void __user *buffer, size_t *lenp, loff_t *ppos) 1883 void __user *buffer, size_t *lenp, loff_t *ppos)
1906{ 1884{
1907 int op; 1885 int op;
@@ -1910,15 +1888,16 @@ int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
1910 return -EPERM; 1888 return -EPERM;
1911 } 1889 }
1912 1890
1913 op = is_init(current) ? OP_SET : OP_AND; 1891 op = is_global_init(current) ? OP_SET : OP_AND;
1914 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 1892 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
1915 do_proc_dointvec_bset_conv,&op); 1893 do_proc_dointvec_bset_conv,&op);
1916} 1894}
1895#endif /* def CONFIG_SECURITY_CAPABILITIES */
1917 1896
1918/* 1897/*
1919 * Taint values can only be increased 1898 * Taint values can only be increased
1920 */ 1899 */
1921static int proc_dointvec_taint(ctl_table *table, int write, struct file *filp, 1900static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp,
1922 void __user *buffer, size_t *lenp, loff_t *ppos) 1901 void __user *buffer, size_t *lenp, loff_t *ppos)
1923{ 1902{
1924 int op; 1903 int op;
@@ -1977,7 +1956,7 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
1977 * 1956 *
1978 * Returns 0 on success. 1957 * Returns 0 on success.
1979 */ 1958 */
1980int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp, 1959int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
1981 void __user *buffer, size_t *lenp, loff_t *ppos) 1960 void __user *buffer, size_t *lenp, loff_t *ppos)
1982{ 1961{
1983 struct do_proc_dointvec_minmax_conv_param param = { 1962 struct do_proc_dointvec_minmax_conv_param param = {
@@ -1988,7 +1967,7 @@ int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
1988 do_proc_dointvec_minmax_conv, &param); 1967 do_proc_dointvec_minmax_conv, &param);
1989} 1968}
1990 1969
1991static int __do_proc_doulongvec_minmax(void *data, ctl_table *table, int write, 1970static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int write,
1992 struct file *filp, 1971 struct file *filp,
1993 void __user *buffer, 1972 void __user *buffer,
1994 size_t *lenp, loff_t *ppos, 1973 size_t *lenp, loff_t *ppos,
@@ -2093,7 +2072,7 @@ static int __do_proc_doulongvec_minmax(void *data, ctl_table *table, int write,
2093#undef TMPBUFLEN 2072#undef TMPBUFLEN
2094} 2073}
2095 2074
2096static int do_proc_doulongvec_minmax(ctl_table *table, int write, 2075static int do_proc_doulongvec_minmax(struct ctl_table *table, int write,
2097 struct file *filp, 2076 struct file *filp,
2098 void __user *buffer, 2077 void __user *buffer,
2099 size_t *lenp, loff_t *ppos, 2078 size_t *lenp, loff_t *ppos,
@@ -2121,7 +2100,7 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write,
2121 * 2100 *
2122 * Returns 0 on success. 2101 * Returns 0 on success.
2123 */ 2102 */
2124int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp, 2103int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2125 void __user *buffer, size_t *lenp, loff_t *ppos) 2104 void __user *buffer, size_t *lenp, loff_t *ppos)
2126{ 2105{
2127 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l); 2106 return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
@@ -2145,7 +2124,7 @@ int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
2145 * 2124 *
2146 * Returns 0 on success. 2125 * Returns 0 on success.
2147 */ 2126 */
2148int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write, 2127int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2149 struct file *filp, 2128 struct file *filp,
2150 void __user *buffer, 2129 void __user *buffer,
2151 size_t *lenp, loff_t *ppos) 2130 size_t *lenp, loff_t *ppos)
@@ -2238,7 +2217,7 @@ static int do_proc_dointvec_ms_jiffies_conv(int *negp, unsigned long *lvalp,
2238 * 2217 *
2239 * Returns 0 on success. 2218 * Returns 0 on success.
2240 */ 2219 */
2241int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp, 2220int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2242 void __user *buffer, size_t *lenp, loff_t *ppos) 2221 void __user *buffer, size_t *lenp, loff_t *ppos)
2243{ 2222{
2244 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2223 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
@@ -2261,7 +2240,7 @@ int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
2261 * 2240 *
2262 * Returns 0 on success. 2241 * Returns 0 on success.
2263 */ 2242 */
2264int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp, 2243int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2265 void __user *buffer, size_t *lenp, loff_t *ppos) 2244 void __user *buffer, size_t *lenp, loff_t *ppos)
2266{ 2245{
2267 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2246 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
@@ -2285,21 +2264,21 @@ int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
2285 * 2264 *
2286 * Returns 0 on success. 2265 * Returns 0 on success.
2287 */ 2266 */
2288int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp, 2267int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2289 void __user *buffer, size_t *lenp, loff_t *ppos) 2268 void __user *buffer, size_t *lenp, loff_t *ppos)
2290{ 2269{
2291 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos, 2270 return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
2292 do_proc_dointvec_ms_jiffies_conv, NULL); 2271 do_proc_dointvec_ms_jiffies_conv, NULL);
2293} 2272}
2294 2273
2295static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp, 2274static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
2296 void __user *buffer, size_t *lenp, loff_t *ppos) 2275 void __user *buffer, size_t *lenp, loff_t *ppos)
2297{ 2276{
2298 struct pid *new_pid; 2277 struct pid *new_pid;
2299 pid_t tmp; 2278 pid_t tmp;
2300 int r; 2279 int r;
2301 2280
2302 tmp = pid_nr(cad_pid); 2281 tmp = pid_nr_ns(cad_pid, current->nsproxy->pid_ns);
2303 2282
2304 r = __do_proc_dointvec(&tmp, table, write, filp, buffer, 2283 r = __do_proc_dointvec(&tmp, table, write, filp, buffer,
2305 lenp, ppos, NULL, NULL); 2284 lenp, ppos, NULL, NULL);
@@ -2316,55 +2295,55 @@ static int proc_do_cad_pid(ctl_table *table, int write, struct file *filp,
2316 2295
2317#else /* CONFIG_PROC_FS */ 2296#else /* CONFIG_PROC_FS */
2318 2297
2319int proc_dostring(ctl_table *table, int write, struct file *filp, 2298int proc_dostring(struct ctl_table *table, int write, struct file *filp,
2320 void __user *buffer, size_t *lenp, loff_t *ppos) 2299 void __user *buffer, size_t *lenp, loff_t *ppos)
2321{ 2300{
2322 return -ENOSYS; 2301 return -ENOSYS;
2323} 2302}
2324 2303
2325int proc_dointvec(ctl_table *table, int write, struct file *filp, 2304int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2326 void __user *buffer, size_t *lenp, loff_t *ppos) 2305 void __user *buffer, size_t *lenp, loff_t *ppos)
2327{ 2306{
2328 return -ENOSYS; 2307 return -ENOSYS;
2329} 2308}
2330 2309
2331int proc_dointvec_bset(ctl_table *table, int write, struct file *filp, 2310int proc_dointvec_bset(struct ctl_table *table, int write, struct file *filp,
2332 void __user *buffer, size_t *lenp, loff_t *ppos) 2311 void __user *buffer, size_t *lenp, loff_t *ppos)
2333{ 2312{
2334 return -ENOSYS; 2313 return -ENOSYS;
2335} 2314}
2336 2315
2337int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp, 2316int proc_dointvec_minmax(struct ctl_table *table, int write, struct file *filp,
2338 void __user *buffer, size_t *lenp, loff_t *ppos) 2317 void __user *buffer, size_t *lenp, loff_t *ppos)
2339{ 2318{
2340 return -ENOSYS; 2319 return -ENOSYS;
2341} 2320}
2342 2321
2343int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp, 2322int proc_dointvec_jiffies(struct ctl_table *table, int write, struct file *filp,
2344 void __user *buffer, size_t *lenp, loff_t *ppos) 2323 void __user *buffer, size_t *lenp, loff_t *ppos)
2345{ 2324{
2346 return -ENOSYS; 2325 return -ENOSYS;
2347} 2326}
2348 2327
2349int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp, 2328int proc_dointvec_userhz_jiffies(struct ctl_table *table, int write, struct file *filp,
2350 void __user *buffer, size_t *lenp, loff_t *ppos) 2329 void __user *buffer, size_t *lenp, loff_t *ppos)
2351{ 2330{
2352 return -ENOSYS; 2331 return -ENOSYS;
2353} 2332}
2354 2333
2355int proc_dointvec_ms_jiffies(ctl_table *table, int write, struct file *filp, 2334int proc_dointvec_ms_jiffies(struct ctl_table *table, int write, struct file *filp,
2356 void __user *buffer, size_t *lenp, loff_t *ppos) 2335 void __user *buffer, size_t *lenp, loff_t *ppos)
2357{ 2336{
2358 return -ENOSYS; 2337 return -ENOSYS;
2359} 2338}
2360 2339
2361int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp, 2340int proc_doulongvec_minmax(struct ctl_table *table, int write, struct file *filp,
2362 void __user *buffer, size_t *lenp, loff_t *ppos) 2341 void __user *buffer, size_t *lenp, loff_t *ppos)
2363{ 2342{
2364 return -ENOSYS; 2343 return -ENOSYS;
2365} 2344}
2366 2345
2367int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write, 2346int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2368 struct file *filp, 2347 struct file *filp,
2369 void __user *buffer, 2348 void __user *buffer,
2370 size_t *lenp, loff_t *ppos) 2349 size_t *lenp, loff_t *ppos)
@@ -2381,8 +2360,42 @@ int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
2381 * General sysctl support routines 2360 * General sysctl support routines
2382 */ 2361 */
2383 2362
2363/* The generic sysctl data routine (used if no strategy routine supplied) */
2364int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2365 void __user *oldval, size_t __user *oldlenp,
2366 void __user *newval, size_t newlen)
2367{
2368 size_t len;
2369
2370 /* Get out of I don't have a variable */
2371 if (!table->data || !table->maxlen)
2372 return -ENOTDIR;
2373
2374 if (oldval && oldlenp) {
2375 if (get_user(len, oldlenp))
2376 return -EFAULT;
2377 if (len) {
2378 if (len > table->maxlen)
2379 len = table->maxlen;
2380 if (copy_to_user(oldval, table->data, len))
2381 return -EFAULT;
2382 if (put_user(len, oldlenp))
2383 return -EFAULT;
2384 }
2385 }
2386
2387 if (newval && newlen) {
2388 if (newlen > table->maxlen)
2389 newlen = table->maxlen;
2390
2391 if (copy_from_user(table->data, newval, newlen))
2392 return -EFAULT;
2393 }
2394 return 1;
2395}
2396
2384/* The generic string strategy routine: */ 2397/* The generic string strategy routine: */
2385int sysctl_string(ctl_table *table, int __user *name, int nlen, 2398int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2386 void __user *oldval, size_t __user *oldlenp, 2399 void __user *oldval, size_t __user *oldlenp,
2387 void __user *newval, size_t newlen) 2400 void __user *newval, size_t newlen)
2388{ 2401{
@@ -2428,7 +2441,7 @@ int sysctl_string(ctl_table *table, int __user *name, int nlen,
2428 * are between the minimum and maximum values given in the arrays 2441 * are between the minimum and maximum values given in the arrays
2429 * table->extra1 and table->extra2, respectively. 2442 * table->extra1 and table->extra2, respectively.
2430 */ 2443 */
2431int sysctl_intvec(ctl_table *table, int __user *name, int nlen, 2444int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2432 void __user *oldval, size_t __user *oldlenp, 2445 void __user *oldval, size_t __user *oldlenp,
2433 void __user *newval, size_t newlen) 2446 void __user *newval, size_t newlen)
2434{ 2447{
@@ -2464,7 +2477,7 @@ int sysctl_intvec(ctl_table *table, int __user *name, int nlen,
2464} 2477}
2465 2478
2466/* Strategy function to convert jiffies to seconds */ 2479/* Strategy function to convert jiffies to seconds */
2467int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, 2480int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2468 void __user *oldval, size_t __user *oldlenp, 2481 void __user *oldval, size_t __user *oldlenp,
2469 void __user *newval, size_t newlen) 2482 void __user *newval, size_t newlen)
2470{ 2483{
@@ -2498,7 +2511,7 @@ int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
2498} 2511}
2499 2512
2500/* Strategy function to convert jiffies to seconds */ 2513/* Strategy function to convert jiffies to seconds */
2501int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, 2514int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2502 void __user *oldval, size_t __user *oldlenp, 2515 void __user *oldval, size_t __user *oldlenp,
2503 void __user *newval, size_t newlen) 2516 void __user *newval, size_t newlen)
2504{ 2517{
@@ -2538,59 +2551,50 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2538 2551
2539asmlinkage long sys_sysctl(struct __sysctl_args __user *args) 2552asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2540{ 2553{
2541 static int msg_count;
2542 struct __sysctl_args tmp; 2554 struct __sysctl_args tmp;
2543 int name[CTL_MAXNAME]; 2555 int error;
2544 int i;
2545 2556
2546 /* Read in the sysctl name for better debug message logging */
2547 if (copy_from_user(&tmp, args, sizeof(tmp))) 2557 if (copy_from_user(&tmp, args, sizeof(tmp)))
2548 return -EFAULT; 2558 return -EFAULT;
2549 if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME)
2550 return -ENOTDIR;
2551 for (i = 0; i < tmp.nlen; i++)
2552 if (get_user(name[i], tmp.name + i))
2553 return -EFAULT;
2554 2559
2555 /* Ignore accesses to kernel.version */ 2560 error = deprecated_sysctl_warning(&tmp);
2556 if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
2557 goto out;
2558 2561
2559 if (msg_count < 5) { 2562 /* If no error reading the parameters then just -ENOSYS ... */
2560 msg_count++; 2563 if (!error)
2561 printk(KERN_INFO 2564 error = -ENOSYS;
2562 "warning: process `%s' used the removed sysctl " 2565
2563 "system call with ", current->comm); 2566 return error;
2564 for (i = 0; i < tmp.nlen; i++) 2567}
2565 printk("%d.", name[i]); 2568
2566 printk("\n"); 2569int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2567 } 2570 void __user *oldval, size_t __user *oldlenp,
2568out: 2571 void __user *newval, size_t newlen)
2572{
2569 return -ENOSYS; 2573 return -ENOSYS;
2570} 2574}
2571 2575
2572int sysctl_string(ctl_table *table, int __user *name, int nlen, 2576int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2573 void __user *oldval, size_t __user *oldlenp, 2577 void __user *oldval, size_t __user *oldlenp,
2574 void __user *newval, size_t newlen) 2578 void __user *newval, size_t newlen)
2575{ 2579{
2576 return -ENOSYS; 2580 return -ENOSYS;
2577} 2581}
2578 2582
2579int sysctl_intvec(ctl_table *table, int __user *name, int nlen, 2583int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2580 void __user *oldval, size_t __user *oldlenp, 2584 void __user *oldval, size_t __user *oldlenp,
2581 void __user *newval, size_t newlen) 2585 void __user *newval, size_t newlen)
2582{ 2586{
2583 return -ENOSYS; 2587 return -ENOSYS;
2584} 2588}
2585 2589
2586int sysctl_jiffies(ctl_table *table, int __user *name, int nlen, 2590int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2587 void __user *oldval, size_t __user *oldlenp, 2591 void __user *oldval, size_t __user *oldlenp,
2588 void __user *newval, size_t newlen) 2592 void __user *newval, size_t newlen)
2589{ 2593{
2590 return -ENOSYS; 2594 return -ENOSYS;
2591} 2595}
2592 2596
2593int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, 2597int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen,
2594 void __user *oldval, size_t __user *oldlenp, 2598 void __user *oldval, size_t __user *oldlenp,
2595 void __user *newval, size_t newlen) 2599 void __user *newval, size_t newlen)
2596{ 2600{
@@ -2599,6 +2603,33 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen,
2599 2603
2600#endif /* CONFIG_SYSCTL_SYSCALL */ 2604#endif /* CONFIG_SYSCTL_SYSCALL */
2601 2605
2606static int deprecated_sysctl_warning(struct __sysctl_args *args)
2607{
2608 static int msg_count;
2609 int name[CTL_MAXNAME];
2610 int i;
2611
2612 /* Read in the sysctl name for better debug message logging */
2613 for (i = 0; i < args->nlen; i++)
2614 if (get_user(name[i], args->name + i))
2615 return -EFAULT;
2616
2617 /* Ignore accesses to kernel.version */
2618 if ((args->nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION))
2619 return 0;
2620
2621 if (msg_count < 5) {
2622 msg_count++;
2623 printk(KERN_INFO
2624 "warning: process `%s' used the deprecated sysctl "
2625 "system call with ", current->comm);
2626 for (i = 0; i < args->nlen; i++)
2627 printk("%d.", name[i]);
2628 printk("\n");
2629 }
2630 return 0;
2631}
2632
2602/* 2633/*
2603 * No sense putting this after each symbol definition, twice, 2634 * No sense putting this after each symbol definition, twice,
2604 * exception granted :-) 2635 * exception granted :-)
@@ -2616,4 +2647,5 @@ EXPORT_SYMBOL(sysctl_intvec);
2616EXPORT_SYMBOL(sysctl_jiffies); 2647EXPORT_SYMBOL(sysctl_jiffies);
2617EXPORT_SYMBOL(sysctl_ms_jiffies); 2648EXPORT_SYMBOL(sysctl_ms_jiffies);
2618EXPORT_SYMBOL(sysctl_string); 2649EXPORT_SYMBOL(sysctl_string);
2650EXPORT_SYMBOL(sysctl_data);
2619EXPORT_SYMBOL(unregister_sysctl_table); 2651EXPORT_SYMBOL(unregister_sysctl_table);
diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
new file mode 100644
index 000000000000..3c9ef5a7d575
--- /dev/null
+++ b/kernel/sysctl_check.c
@@ -0,0 +1,1588 @@
1#include <linux/stat.h>
2#include <linux/sysctl.h>
3#include "../arch/s390/appldata/appldata.h"
4#include "../fs/xfs/linux-2.6/xfs_sysctl.h"
5#include <linux/sunrpc/debug.h>
6#include <linux/string.h>
7#include <net/ip_vs.h>
8
9struct trans_ctl_table {
10 int ctl_name;
11 const char *procname;
12 struct trans_ctl_table *child;
13};
14
15static struct trans_ctl_table trans_random_table[] = {
16 { RANDOM_POOLSIZE, "poolsize" },
17 { RANDOM_ENTROPY_COUNT, "entropy_avail" },
18 { RANDOM_READ_THRESH, "read_wakeup_threshold" },
19 { RANDOM_WRITE_THRESH, "write_wakeup_threshold" },
20 { RANDOM_BOOT_ID, "boot_id" },
21 { RANDOM_UUID, "uuid" },
22 {}
23};
24
25static struct trans_ctl_table trans_pty_table[] = {
26 { PTY_MAX, "max" },
27 { PTY_NR, "nr" },
28 {}
29};
30
31static struct trans_ctl_table trans_kern_table[] = {
32 { KERN_OSTYPE, "ostype" },
33 { KERN_OSRELEASE, "osrelease" },
34 /* KERN_OSREV not used */
35 { KERN_VERSION, "version" },
36 /* KERN_SECUREMASK not used */
37 /* KERN_PROF not used */
38 { KERN_NODENAME, "hostname" },
39 { KERN_DOMAINNAME, "domainname" },
40
41#ifdef CONFIG_SECURITY_CAPABILITIES
42 { KERN_CAP_BSET, "cap-bound" },
43#endif /* def CONFIG_SECURITY_CAPABILITIES */
44
45 { KERN_PANIC, "panic" },
46 { KERN_REALROOTDEV, "real-root-dev" },
47
48 { KERN_SPARC_REBOOT, "reboot-cmd" },
49 { KERN_CTLALTDEL, "ctrl-alt-del" },
50 { KERN_PRINTK, "printk" },
51
52 /* KERN_NAMETRANS not used */
53 /* KERN_PPC_HTABRECLAIM not used */
54 /* KERN_PPC_ZEROPAGED not used */
55 { KERN_PPC_POWERSAVE_NAP, "powersave-nap" },
56
57 { KERN_MODPROBE, "modprobe" },
58 { KERN_SG_BIG_BUFF, "sg-big-buff" },
59 { KERN_ACCT, "acct" },
60 { KERN_PPC_L2CR, "l2cr" },
61
62 /* KERN_RTSIGNR not used */
63 /* KERN_RTSIGMAX not used */
64
65 { KERN_SHMMAX, "shmmax" },
66 { KERN_MSGMAX, "msgmax" },
67 { KERN_MSGMNB, "msgmnb" },
68 /* KERN_MSGPOOL not used*/
69 { KERN_SYSRQ, "sysrq" },
70 { KERN_MAX_THREADS, "threads-max" },
71 { KERN_RANDOM, "random", trans_random_table },
72 { KERN_SHMALL, "shmall" },
73 { KERN_MSGMNI, "msgmni" },
74 { KERN_SEM, "sem" },
75 { KERN_SPARC_STOP_A, "stop-a" },
76 { KERN_SHMMNI, "shmmni" },
77
78 { KERN_OVERFLOWUID, "overflowuid" },
79 { KERN_OVERFLOWGID, "overflowgid" },
80
81 { KERN_HOTPLUG, "hotplug", },
82 { KERN_IEEE_EMULATION_WARNINGS, "ieee_emulation_warnings" },
83
84 { KERN_S390_USER_DEBUG_LOGGING, "userprocess_debug" },
85 { KERN_CORE_USES_PID, "core_uses_pid" },
86 { KERN_TAINTED, "tainted" },
87 { KERN_CADPID, "cad_pid" },
88 { KERN_PIDMAX, "pid_max" },
89 { KERN_CORE_PATTERN, "core_pattern" },
90 { KERN_PANIC_ON_OOPS, "panic_on_oops" },
91 { KERN_HPPA_PWRSW, "soft-power" },
92 { KERN_HPPA_UNALIGNED, "unaligned-trap" },
93
94 { KERN_PRINTK_RATELIMIT, "printk_ratelimit" },
95 { KERN_PRINTK_RATELIMIT_BURST, "printk_ratelimit_burst" },
96
97 { KERN_PTY, "pty", trans_pty_table },
98 { KERN_NGROUPS_MAX, "ngroups_max" },
99 { KERN_SPARC_SCONS_PWROFF, "scons_poweroff" },
100 { KERN_HZ_TIMER, "hz_timer" },
101 { KERN_UNKNOWN_NMI_PANIC, "unknown_nmi_panic" },
102 { KERN_BOOTLOADER_TYPE, "bootloader_type" },
103 { KERN_RANDOMIZE, "randomize_va_space" },
104
105 { KERN_SPIN_RETRY, "spin_retry" },
106 { KERN_ACPI_VIDEO_FLAGS, "acpi_video_flags" },
107 { KERN_IA64_UNALIGNED, "ignore-unaligned-usertrap" },
108 { KERN_COMPAT_LOG, "compat-log" },
109 { KERN_MAX_LOCK_DEPTH, "max_lock_depth" },
110 { KERN_NMI_WATCHDOG, "nmi_watchdog" },
111 { KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" },
112 {}
113};
114
115static struct trans_ctl_table trans_vm_table[] = {
116 { VM_OVERCOMMIT_MEMORY, "overcommit_memory" },
117 { VM_PAGE_CLUSTER, "page-cluster" },
118 { VM_DIRTY_BACKGROUND, "dirty_background_ratio" },
119 { VM_DIRTY_RATIO, "dirty_ratio" },
120 { VM_DIRTY_WB_CS, "dirty_writeback_centisecs" },
121 { VM_DIRTY_EXPIRE_CS, "dirty_expire_centisecs" },
122 { VM_NR_PDFLUSH_THREADS, "nr_pdflush_threads" },
123 { VM_OVERCOMMIT_RATIO, "overcommit_ratio" },
124 /* VM_PAGEBUF unused */
125 { VM_HUGETLB_PAGES, "nr_hugepages" },
126 { VM_SWAPPINESS, "swappiness" },
127 { VM_LOWMEM_RESERVE_RATIO, "lowmem_reserve_ratio" },
128 { VM_MIN_FREE_KBYTES, "min_free_kbytes" },
129 { VM_MAX_MAP_COUNT, "max_map_count" },
130 { VM_LAPTOP_MODE, "laptop_mode" },
131 { VM_BLOCK_DUMP, "block_dump" },
132 { VM_HUGETLB_GROUP, "hugetlb_shm_group" },
133 { VM_VFS_CACHE_PRESSURE, "vfs_cache_pressure" },
134 { VM_LEGACY_VA_LAYOUT, "legacy_va_layout" },
135 /* VM_SWAP_TOKEN_TIMEOUT unused */
136 { VM_DROP_PAGECACHE, "drop_caches" },
137 { VM_PERCPU_PAGELIST_FRACTION, "percpu_pagelist_fraction" },
138 { VM_ZONE_RECLAIM_MODE, "zone_reclaim_mode" },
139 { VM_MIN_UNMAPPED, "min_unmapped_ratio" },
140 { VM_PANIC_ON_OOM, "panic_on_oom" },
141 { VM_VDSO_ENABLED, "vdso_enabled" },
142 { VM_MIN_SLAB, "min_slab_ratio" },
143 { VM_CMM_PAGES, "cmm_pages" },
144 { VM_CMM_TIMED_PAGES, "cmm_timed_pages" },
145 { VM_CMM_TIMEOUT, "cmm_timeout" },
146
147 {}
148};
149
150static struct trans_ctl_table trans_net_core_table[] = {
151 { NET_CORE_WMEM_MAX, "wmem_max" },
152 { NET_CORE_RMEM_MAX, "rmem_max" },
153 { NET_CORE_WMEM_DEFAULT, "wmem_default" },
154 { NET_CORE_RMEM_DEFAULT, "rmem_default" },
155 /* NET_CORE_DESTROY_DELAY unused */
156 { NET_CORE_MAX_BACKLOG, "netdev_max_backlog" },
157 /* NET_CORE_FASTROUTE unused */
158 { NET_CORE_MSG_COST, "message_cost" },
159 { NET_CORE_MSG_BURST, "message_burst" },
160 { NET_CORE_OPTMEM_MAX, "optmem_max" },
161 /* NET_CORE_HOT_LIST_LENGTH unused */
162 /* NET_CORE_DIVERT_VERSION unused */
163 /* NET_CORE_NO_CONG_THRESH unused */
164 /* NET_CORE_NO_CONG unused */
165 /* NET_CORE_LO_CONG unused */
166 /* NET_CORE_MOD_CONG unused */
167 { NET_CORE_DEV_WEIGHT, "dev_weight" },
168 { NET_CORE_SOMAXCONN, "somaxconn" },
169 { NET_CORE_BUDGET, "netdev_budget" },
170 { NET_CORE_AEVENT_ETIME, "xfrm_aevent_etime" },
171 { NET_CORE_AEVENT_RSEQTH, "xfrm_aevent_rseqth" },
172 { NET_CORE_WARNINGS, "warnings" },
173 {},
174};
175
176static struct trans_ctl_table trans_net_unix_table[] = {
177 /* NET_UNIX_DESTROY_DELAY unused */
178 /* NET_UNIX_DELETE_DELAY unused */
179 { NET_UNIX_MAX_DGRAM_QLEN, "max_dgram_qlen" },
180 {}
181};
182
183static struct trans_ctl_table trans_net_ipv4_route_table[] = {
184 { NET_IPV4_ROUTE_FLUSH, "flush" },
185 { NET_IPV4_ROUTE_MIN_DELAY, "min_delay" },
186 { NET_IPV4_ROUTE_MAX_DELAY, "max_delay" },
187 { NET_IPV4_ROUTE_GC_THRESH, "gc_thresh" },
188 { NET_IPV4_ROUTE_MAX_SIZE, "max_size" },
189 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "gc_min_interval" },
190 { NET_IPV4_ROUTE_GC_TIMEOUT, "gc_timeout" },
191 { NET_IPV4_ROUTE_GC_INTERVAL, "gc_interval" },
192 { NET_IPV4_ROUTE_REDIRECT_LOAD, "redirect_load" },
193 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "redirect_number" },
194 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "redirect_silence" },
195 { NET_IPV4_ROUTE_ERROR_COST, "error_cost" },
196 { NET_IPV4_ROUTE_ERROR_BURST, "error_burst" },
197 { NET_IPV4_ROUTE_GC_ELASTICITY, "gc_elasticity" },
198 { NET_IPV4_ROUTE_MTU_EXPIRES, "mtu_expires" },
199 { NET_IPV4_ROUTE_MIN_PMTU, "min_pmtu" },
200 { NET_IPV4_ROUTE_MIN_ADVMSS, "min_adv_mss" },
201 { NET_IPV4_ROUTE_SECRET_INTERVAL, "secret_interval" },
202 { NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS, "gc_min_interval_ms" },
203 {}
204};
205
206static struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
207 { NET_IPV4_CONF_FORWARDING, "forwarding" },
208 { NET_IPV4_CONF_MC_FORWARDING, "mc_forwarding" },
209
210 { NET_IPV4_CONF_PROXY_ARP, "proxy_arp" },
211 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "accept_redirects" },
212 { NET_IPV4_CONF_SECURE_REDIRECTS, "secure_redirects" },
213 { NET_IPV4_CONF_SEND_REDIRECTS, "send_redirects" },
214 { NET_IPV4_CONF_SHARED_MEDIA, "shared_media" },
215 { NET_IPV4_CONF_RP_FILTER, "rp_filter" },
216 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "accept_source_route" },
217 { NET_IPV4_CONF_BOOTP_RELAY, "bootp_relay" },
218 { NET_IPV4_CONF_LOG_MARTIANS, "log_martians" },
219 { NET_IPV4_CONF_TAG, "tag" },
220 { NET_IPV4_CONF_ARPFILTER, "arp_filter" },
221 { NET_IPV4_CONF_MEDIUM_ID, "medium_id" },
222 { NET_IPV4_CONF_NOXFRM, "disable_xfrm" },
223 { NET_IPV4_CONF_NOPOLICY, "disable_policy" },
224 { NET_IPV4_CONF_FORCE_IGMP_VERSION, "force_igmp_version" },
225
226 { NET_IPV4_CONF_ARP_ANNOUNCE, "arp_announce" },
227 { NET_IPV4_CONF_ARP_IGNORE, "arp_ignore" },
228 { NET_IPV4_CONF_PROMOTE_SECONDARIES, "promote_secondaries" },
229 { NET_IPV4_CONF_ARP_ACCEPT, "arp_accept" },
230 {}
231};
232
233static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
234 { NET_PROTO_CONF_ALL, "all", trans_net_ipv4_conf_vars_table },
235 { NET_PROTO_CONF_DEFAULT, "default", trans_net_ipv4_conf_vars_table },
236 { 0, NULL, trans_net_ipv4_conf_vars_table },
237 {}
238};
239
240
241static struct trans_ctl_table trans_net_ipv4_vs_table[] = {
242 { NET_IPV4_VS_AMEMTHRESH, "amemthresh" },
243 { NET_IPV4_VS_DEBUG_LEVEL, "debug_level" },
244 { NET_IPV4_VS_AMDROPRATE, "am_droprate" },
245 { NET_IPV4_VS_DROP_ENTRY, "drop_entry" },
246 { NET_IPV4_VS_DROP_PACKET, "drop_packet" },
247 { NET_IPV4_VS_SECURE_TCP, "secure_tcp" },
248 { NET_IPV4_VS_TO_ES, "timeout_established" },
249 { NET_IPV4_VS_TO_SS, "timeout_synsent" },
250 { NET_IPV4_VS_TO_SR, "timeout_synrecv" },
251 { NET_IPV4_VS_TO_FW, "timeout_finwait" },
252 { NET_IPV4_VS_TO_TW, "timeout_timewait" },
253 { NET_IPV4_VS_TO_CL, "timeout_close" },
254 { NET_IPV4_VS_TO_CW, "timeout_closewait" },
255 { NET_IPV4_VS_TO_LA, "timeout_lastack" },
256 { NET_IPV4_VS_TO_LI, "timeout_listen" },
257 { NET_IPV4_VS_TO_SA, "timeout_synack" },
258 { NET_IPV4_VS_TO_UDP, "timeout_udp" },
259 { NET_IPV4_VS_TO_ICMP, "timeout_icmp" },
260 { NET_IPV4_VS_CACHE_BYPASS, "cache_bypass" },
261 { NET_IPV4_VS_EXPIRE_NODEST_CONN, "expire_nodest_conn" },
262 { NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE, "expire_quiescent_template" },
263 { NET_IPV4_VS_SYNC_THRESHOLD, "sync_threshold" },
264 { NET_IPV4_VS_NAT_ICMP_SEND, "nat_icmp_send" },
265 { NET_IPV4_VS_LBLC_EXPIRE, "lblc_expiration" },
266 { NET_IPV4_VS_LBLCR_EXPIRE, "lblcr_expiration" },
267 {}
268};
269
270static struct trans_ctl_table trans_net_neigh_vars_table[] = {
271 { NET_NEIGH_MCAST_SOLICIT, "mcast_solicit" },
272 { NET_NEIGH_UCAST_SOLICIT, "ucast_solicit" },
273 { NET_NEIGH_APP_SOLICIT, "app_solicit" },
274 { NET_NEIGH_RETRANS_TIME, "retrans_time" },
275 { NET_NEIGH_REACHABLE_TIME, "base_reachable_time" },
276 { NET_NEIGH_DELAY_PROBE_TIME, "delay_first_probe_time" },
277 { NET_NEIGH_GC_STALE_TIME, "gc_stale_time" },
278 { NET_NEIGH_UNRES_QLEN, "unres_qlen" },
279 { NET_NEIGH_PROXY_QLEN, "proxy_qlen" },
280 { NET_NEIGH_ANYCAST_DELAY, "anycast_delay" },
281 { NET_NEIGH_PROXY_DELAY, "proxy_delay" },
282 { NET_NEIGH_LOCKTIME, "locktime" },
283 { NET_NEIGH_GC_INTERVAL, "gc_interval" },
284 { NET_NEIGH_GC_THRESH1, "gc_thresh1" },
285 { NET_NEIGH_GC_THRESH2, "gc_thresh2" },
286 { NET_NEIGH_GC_THRESH3, "gc_thresh3" },
287 { NET_NEIGH_RETRANS_TIME_MS, "retrans_time_ms" },
288 { NET_NEIGH_REACHABLE_TIME_MS, "base_reachable_time_ms" },
289 {}
290};
291
292static struct trans_ctl_table trans_net_neigh_table[] = {
293 { NET_PROTO_CONF_DEFAULT, "default", trans_net_neigh_vars_table },
294 { 0, NULL, trans_net_neigh_vars_table },
295 {}
296};
297
298static struct trans_ctl_table trans_net_ipv4_netfilter_table[] = {
299 { NET_IPV4_NF_CONNTRACK_MAX, "ip_conntrack_max" },
300
301 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, "ip_conntrack_tcp_timeout_syn_sent" },
302 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV, "ip_conntrack_tcp_timeout_syn_recv" },
303 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED, "ip_conntrack_tcp_timeout_established" },
304 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT, "ip_conntrack_tcp_timeout_fin_wait" },
305 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT, "ip_conntrack_tcp_timeout_close_wait" },
306 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK, "ip_conntrack_tcp_timeout_last_ack" },
307 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT, "ip_conntrack_tcp_timeout_time_wait" },
308 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE, "ip_conntrack_tcp_timeout_close" },
309
310 { NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT, "ip_conntrack_udp_timeout" },
311 { NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM, "ip_conntrack_udp_timeout_stream" },
312 { NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT, "ip_conntrack_icmp_timeout" },
313 { NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT, "ip_conntrack_generic_timeout" },
314
315 { NET_IPV4_NF_CONNTRACK_BUCKETS, "ip_conntrack_buckets" },
316 { NET_IPV4_NF_CONNTRACK_LOG_INVALID, "ip_conntrack_log_invalid" },
317 { NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS, "ip_conntrack_tcp_timeout_max_retrans" },
318 { NET_IPV4_NF_CONNTRACK_TCP_LOOSE, "ip_conntrack_tcp_loose" },
319 { NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL, "ip_conntrack_tcp_be_liberal" },
320 { NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS, "ip_conntrack_tcp_max_retrans" },
321
322 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED, "ip_conntrack_sctp_timeout_closed" },
323 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT, "ip_conntrack_sctp_timeout_cookie_wait" },
324 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED, "ip_conntrack_sctp_timeout_cookie_echoed" },
325 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED, "ip_conntrack_sctp_timeout_established" },
326 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT, "ip_conntrack_sctp_timeout_shutdown_sent" },
327 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD, "ip_conntrack_sctp_timeout_shutdown_recd" },
328 { NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT, "ip_conntrack_sctp_timeout_shutdown_ack_sent" },
329
330 { NET_IPV4_NF_CONNTRACK_COUNT, "ip_conntrack_count" },
331 { NET_IPV4_NF_CONNTRACK_CHECKSUM, "ip_conntrack_checksum" },
332 {}
333};
334
335static struct trans_ctl_table trans_net_ipv4_table[] = {
336 { NET_IPV4_FORWARD, "ip_forward" },
337 { NET_IPV4_DYNADDR, "ip_dynaddr" },
338
339 { NET_IPV4_CONF, "conf", trans_net_ipv4_conf_table },
340 { NET_IPV4_NEIGH, "neigh", trans_net_neigh_table },
341 { NET_IPV4_ROUTE, "route", trans_net_ipv4_route_table },
342 /* NET_IPV4_FIB_HASH unused */
343 { NET_IPV4_NETFILTER, "netfilter", trans_net_ipv4_netfilter_table },
344 { NET_IPV4_VS, "vs", trans_net_ipv4_vs_table },
345
346 { NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps" },
347 { NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling" },
348 { NET_IPV4_TCP_SACK, "tcp_sack" },
349 { NET_IPV4_TCP_RETRANS_COLLAPSE, "tcp_retrans_collapse" },
350 { NET_IPV4_DEFAULT_TTL, "ip_default_ttl" },
351 /* NET_IPV4_AUTOCONFIG unused */
352 { NET_IPV4_NO_PMTU_DISC, "ip_no_pmtu_disc" },
353 { NET_IPV4_TCP_SYN_RETRIES, "tcp_syn_retries" },
354 { NET_IPV4_IPFRAG_HIGH_THRESH, "ipfrag_high_thresh" },
355 { NET_IPV4_IPFRAG_LOW_THRESH, "ipfrag_low_thresh" },
356 { NET_IPV4_IPFRAG_TIME, "ipfrag_time" },
357 /* NET_IPV4_TCP_MAX_KA_PROBES unused */
358 { NET_IPV4_TCP_KEEPALIVE_TIME, "tcp_keepalive_time" },
359 { NET_IPV4_TCP_KEEPALIVE_PROBES, "tcp_keepalive_probes" },
360 { NET_IPV4_TCP_RETRIES1, "tcp_retries1" },
361 { NET_IPV4_TCP_RETRIES2, "tcp_retries2" },
362 { NET_IPV4_TCP_FIN_TIMEOUT, "tcp_fin_timeout" },
363 /* NET_IPV4_IP_MASQ_DEBUG unused */
364 { NET_TCP_SYNCOOKIES, "tcp_syncookies" },
365 { NET_TCP_STDURG, "tcp_stdurg" },
366 { NET_TCP_RFC1337, "tcp_rfc1337" },
367 /* NET_TCP_SYN_TAILDROP unused */
368 { NET_TCP_MAX_SYN_BACKLOG, "tcp_max_syn_backlog" },
369 { NET_IPV4_LOCAL_PORT_RANGE, "ip_local_port_range" },
370 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "icmp_echo_ignore_all" },
371 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "icmp_echo_ignore_broadcasts" },
372 /* NET_IPV4_ICMP_SOURCEQUENCH_RATE unused */
373 /* NET_IPV4_ICMP_DESTUNREACH_RATE unused */
374 /* NET_IPV4_ICMP_TIMEEXCEED_RATE unused */
375 /* NET_IPV4_ICMP_PARAMPROB_RATE unused */
376 /* NET_IPV4_ICMP_ECHOREPLY_RATE unused */
377 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "icmp_ignore_bogus_error_responses" },
378 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "igmp_max_memberships" },
379 { NET_TCP_TW_RECYCLE, "tcp_tw_recycle" },
380 /* NET_IPV4_ALWAYS_DEFRAG unused */
381 { NET_IPV4_TCP_KEEPALIVE_INTVL, "tcp_keepalive_intvl" },
382 { NET_IPV4_INET_PEER_THRESHOLD, "inet_peer_threshold" },
383 { NET_IPV4_INET_PEER_MINTTL, "inet_peer_minttl" },
384 { NET_IPV4_INET_PEER_MAXTTL, "inet_peer_maxttl" },
385 { NET_IPV4_INET_PEER_GC_MINTIME, "inet_peer_gc_mintime" },
386 { NET_IPV4_INET_PEER_GC_MAXTIME, "inet_peer_gc_maxtime" },
387 { NET_TCP_ORPHAN_RETRIES, "tcp_orphan_retries" },
388 { NET_TCP_ABORT_ON_OVERFLOW, "tcp_abort_on_overflow" },
389 { NET_TCP_SYNACK_RETRIES, "tcp_synack_retries" },
390 { NET_TCP_MAX_ORPHANS, "tcp_max_orphans" },
391 { NET_TCP_MAX_TW_BUCKETS, "tcp_max_tw_buckets" },
392 { NET_TCP_FACK, "tcp_fack" },
393 { NET_TCP_REORDERING, "tcp_reordering" },
394 { NET_TCP_ECN, "tcp_ecn" },
395 { NET_TCP_DSACK, "tcp_dsack" },
396 { NET_TCP_MEM, "tcp_mem" },
397 { NET_TCP_WMEM, "tcp_wmem" },
398 { NET_TCP_RMEM, "tcp_rmem" },
399 { NET_TCP_APP_WIN, "tcp_app_win" },
400 { NET_TCP_ADV_WIN_SCALE, "tcp_adv_win_scale" },
401 { NET_IPV4_NONLOCAL_BIND, "ip_nonlocal_bind" },
402 { NET_IPV4_ICMP_RATELIMIT, "icmp_ratelimit" },
403 { NET_IPV4_ICMP_RATEMASK, "icmp_ratemask" },
404 { NET_TCP_TW_REUSE, "tcp_tw_reuse" },
405 { NET_TCP_FRTO, "tcp_frto" },
406 { NET_TCP_LOW_LATENCY, "tcp_low_latency" },
407 { NET_IPV4_IPFRAG_SECRET_INTERVAL, "ipfrag_secret_interval" },
408 { NET_IPV4_IGMP_MAX_MSF, "igmp_max_msf" },
409 { NET_TCP_NO_METRICS_SAVE, "tcp_no_metrics_save" },
410 /* NET_TCP_DEFAULT_WIN_SCALE unused */
411 { NET_TCP_MODERATE_RCVBUF, "tcp_moderate_rcvbuf" },
412 { NET_TCP_TSO_WIN_DIVISOR, "tcp_tso_win_divisor" },
413 /* NET_TCP_BIC_BETA unused */
414 { NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR, "icmp_errors_use_inbound_ifaddr" },
415 { NET_TCP_CONG_CONTROL, "tcp_congestion_control" },
416 { NET_TCP_ABC, "tcp_abc" },
417 { NET_IPV4_IPFRAG_MAX_DIST, "ipfrag_max_dist" },
418 { NET_TCP_MTU_PROBING, "tcp_mtu_probing" },
419 { NET_TCP_BASE_MSS, "tcp_base_mss" },
420 { NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS, "tcp_workaround_signed_windows" },
421 { NET_TCP_DMA_COPYBREAK, "tcp_dma_copybreak" },
422 { NET_TCP_SLOW_START_AFTER_IDLE, "tcp_slow_start_after_idle" },
423 { NET_CIPSOV4_CACHE_ENABLE, "cipso_cache_enable" },
424 { NET_CIPSOV4_CACHE_BUCKET_SIZE, "cipso_cache_bucket_size" },
425 { NET_CIPSOV4_RBM_OPTFMT, "cipso_rbm_optfmt" },
426 { NET_CIPSOV4_RBM_STRICTVALID, "cipso_rbm_strictvalid" },
427 { NET_TCP_AVAIL_CONG_CONTROL, "tcp_available_congestion_control" },
428 { NET_TCP_ALLOWED_CONG_CONTROL, "tcp_allowed_congestion_control" },
429 { NET_TCP_MAX_SSTHRESH, "tcp_max_ssthresh" },
430 { NET_TCP_FRTO_RESPONSE, "tcp_frto_response" },
431 { 2088 /* NET_IPQ_QMAX */, "ip_queue_maxlen" },
432 {}
433};
434
435static struct trans_ctl_table trans_net_ipx_table[] = {
436 { NET_IPX_PPROP_BROADCASTING, "ipx_pprop_broadcasting" },
437 /* NET_IPX_FORWARDING unused */
438 {}
439};
440
441static struct trans_ctl_table trans_net_atalk_table[] = {
442 { NET_ATALK_AARP_EXPIRY_TIME, "aarp-expiry-time" },
443 { NET_ATALK_AARP_TICK_TIME, "aarp-tick-time" },
444 { NET_ATALK_AARP_RETRANSMIT_LIMIT, "aarp-retransmit-limit" },
445 { NET_ATALK_AARP_RESOLVE_TIME, "aarp-resolve-time" },
446 {},
447};
448
449static struct trans_ctl_table trans_net_netrom_table[] = {
450 { NET_NETROM_DEFAULT_PATH_QUALITY, "default_path_quality" },
451 { NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER, "obsolescence_count_initialiser" },
452 { NET_NETROM_NETWORK_TTL_INITIALISER, "network_ttl_initialiser" },
453 { NET_NETROM_TRANSPORT_TIMEOUT, "transport_timeout" },
454 { NET_NETROM_TRANSPORT_MAXIMUM_TRIES, "transport_maximum_tries" },
455 { NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY, "transport_acknowledge_delay" },
456 { NET_NETROM_TRANSPORT_BUSY_DELAY, "transport_busy_delay" },
457 { NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE, "transport_requested_window_size" },
458 { NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT, "transport_no_activity_timeout" },
459 { NET_NETROM_ROUTING_CONTROL, "routing_control" },
460 { NET_NETROM_LINK_FAILS_COUNT, "link_fails_count" },
461 { NET_NETROM_RESET, "reset" },
462 {}
463};
464
465static struct trans_ctl_table trans_net_ax25_table[] = {
466 { NET_AX25_IP_DEFAULT_MODE, "ip_default_mode" },
467 { NET_AX25_DEFAULT_MODE, "ax25_default_mode" },
468 { NET_AX25_BACKOFF_TYPE, "backoff_type" },
469 { NET_AX25_CONNECT_MODE, "connect_mode" },
470 { NET_AX25_STANDARD_WINDOW, "standard_window_size" },
471 { NET_AX25_EXTENDED_WINDOW, "extended_window_size" },
472 { NET_AX25_T1_TIMEOUT, "t1_timeout" },
473 { NET_AX25_T2_TIMEOUT, "t2_timeout" },
474 { NET_AX25_T3_TIMEOUT, "t3_timeout" },
475 { NET_AX25_IDLE_TIMEOUT, "idle_timeout" },
476 { NET_AX25_N2, "maximum_retry_count" },
477 { NET_AX25_PACLEN, "maximum_packet_length" },
478 { NET_AX25_PROTOCOL, "protocol" },
479 { NET_AX25_DAMA_SLAVE_TIMEOUT, "dama_slave_timeout" },
480 {}
481};
482
483static struct trans_ctl_table trans_net_bridge_table[] = {
484 { NET_BRIDGE_NF_CALL_ARPTABLES, "bridge-nf-call-arptables" },
485 { NET_BRIDGE_NF_CALL_IPTABLES, "bridge-nf-call-iptables" },
486 { NET_BRIDGE_NF_CALL_IP6TABLES, "bridge-nf-call-ip6tables" },
487 { NET_BRIDGE_NF_FILTER_VLAN_TAGGED, "bridge-nf-filter-vlan-tagged" },
488 { NET_BRIDGE_NF_FILTER_PPPOE_TAGGED, "bridge-nf-filter-pppoe-tagged" },
489 {}
490};
491
492static struct trans_ctl_table trans_net_rose_table[] = {
493 { NET_ROSE_RESTART_REQUEST_TIMEOUT, "restart_request_timeout" },
494 { NET_ROSE_CALL_REQUEST_TIMEOUT, "call_request_timeout" },
495 { NET_ROSE_RESET_REQUEST_TIMEOUT, "reset_request_timeout" },
496 { NET_ROSE_CLEAR_REQUEST_TIMEOUT, "clear_request_timeout" },
497 { NET_ROSE_ACK_HOLD_BACK_TIMEOUT, "acknowledge_hold_back_timeout" },
498 { NET_ROSE_ROUTING_CONTROL, "routing_control" },
499 { NET_ROSE_LINK_FAIL_TIMEOUT, "link_fail_timeout" },
500 { NET_ROSE_MAX_VCS, "maximum_virtual_circuits" },
501 { NET_ROSE_WINDOW_SIZE, "window_size" },
502 { NET_ROSE_NO_ACTIVITY_TIMEOUT, "no_activity_timeout" },
503 {}
504};
505
506static struct trans_ctl_table trans_net_ipv6_conf_var_table[] = {
507 { NET_IPV6_FORWARDING, "forwarding" },
508 { NET_IPV6_HOP_LIMIT, "hop_limit" },
509 { NET_IPV6_MTU, "mtu" },
510 { NET_IPV6_ACCEPT_RA, "accept_ra" },
511 { NET_IPV6_ACCEPT_REDIRECTS, "accept_redirects" },
512 { NET_IPV6_AUTOCONF, "autoconf" },
513 { NET_IPV6_DAD_TRANSMITS, "dad_transmits" },
514 { NET_IPV6_RTR_SOLICITS, "router_solicitations" },
515 { NET_IPV6_RTR_SOLICIT_INTERVAL, "router_solicitation_interval" },
516 { NET_IPV6_RTR_SOLICIT_DELAY, "router_solicitation_delay" },
517 { NET_IPV6_USE_TEMPADDR, "use_tempaddr" },
518 { NET_IPV6_TEMP_VALID_LFT, "temp_valid_lft" },
519 { NET_IPV6_TEMP_PREFERED_LFT, "temp_prefered_lft" },
520 { NET_IPV6_REGEN_MAX_RETRY, "regen_max_retry" },
521 { NET_IPV6_MAX_DESYNC_FACTOR, "max_desync_factor" },
522 { NET_IPV6_MAX_ADDRESSES, "max_addresses" },
523 { NET_IPV6_FORCE_MLD_VERSION, "force_mld_version" },
524 { NET_IPV6_ACCEPT_RA_DEFRTR, "accept_ra_defrtr" },
525 { NET_IPV6_ACCEPT_RA_PINFO, "accept_ra_pinfo" },
526 { NET_IPV6_ACCEPT_RA_RTR_PREF, "accept_ra_rtr_pref" },
527 { NET_IPV6_RTR_PROBE_INTERVAL, "router_probe_interval" },
528 { NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN, "accept_ra_rt_info_max_plen" },
529 { NET_IPV6_PROXY_NDP, "proxy_ndp" },
530 { NET_IPV6_ACCEPT_SOURCE_ROUTE, "accept_source_route" },
531 {}
532};
533
534static struct trans_ctl_table trans_net_ipv6_conf_table[] = {
535 { NET_PROTO_CONF_ALL, "all", trans_net_ipv6_conf_var_table },
536 { NET_PROTO_CONF_DEFAULT, "default", trans_net_ipv6_conf_var_table },
537 { 0, NULL, trans_net_ipv6_conf_var_table },
538 {}
539};
540
541static struct trans_ctl_table trans_net_ipv6_route_table[] = {
542 { NET_IPV6_ROUTE_FLUSH, "flush" },
543 { NET_IPV6_ROUTE_GC_THRESH, "gc_thresh" },
544 { NET_IPV6_ROUTE_MAX_SIZE, "max_size" },
545 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "gc_min_interval" },
546 { NET_IPV6_ROUTE_GC_TIMEOUT, "gc_timeout" },
547 { NET_IPV6_ROUTE_GC_INTERVAL, "gc_interval" },
548 { NET_IPV6_ROUTE_GC_ELASTICITY, "gc_elasticity" },
549 { NET_IPV6_ROUTE_MTU_EXPIRES, "mtu_expires" },
550 { NET_IPV6_ROUTE_MIN_ADVMSS, "min_adv_mss" },
551 { NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, "gc_min_interval_ms" },
552 {}
553};
554
555static struct trans_ctl_table trans_net_ipv6_icmp_table[] = {
556 { NET_IPV6_ICMP_RATELIMIT, "ratelimit" },
557 {}
558};
559
560static struct trans_ctl_table trans_net_ipv6_table[] = {
561 { NET_IPV6_CONF, "conf", trans_net_ipv6_conf_table },
562 { NET_IPV6_NEIGH, "neigh", trans_net_neigh_table },
563 { NET_IPV6_ROUTE, "route", trans_net_ipv6_route_table },
564 { NET_IPV6_ICMP, "icmp", trans_net_ipv6_icmp_table },
565 { NET_IPV6_BINDV6ONLY, "bindv6only" },
566 { NET_IPV6_IP6FRAG_HIGH_THRESH, "ip6frag_high_thresh" },
567 { NET_IPV6_IP6FRAG_LOW_THRESH, "ip6frag_low_thresh" },
568 { NET_IPV6_IP6FRAG_TIME, "ip6frag_time" },
569 { NET_IPV6_IP6FRAG_SECRET_INTERVAL, "ip6frag_secret_interval" },
570 { NET_IPV6_MLD_MAX_MSF, "mld_max_msf" },
571 { 2088 /* IPQ_QMAX */, "ip6_queue_maxlen" },
572 {}
573};
574
575static struct trans_ctl_table trans_net_x25_table[] = {
576 { NET_X25_RESTART_REQUEST_TIMEOUT, "restart_request_timeout" },
577 { NET_X25_CALL_REQUEST_TIMEOUT, "call_request_timeout" },
578 { NET_X25_RESET_REQUEST_TIMEOUT, "reset_request_timeout" },
579 { NET_X25_CLEAR_REQUEST_TIMEOUT, "clear_request_timeout" },
580 { NET_X25_ACK_HOLD_BACK_TIMEOUT, "acknowledgement_hold_back_timeout" },
581 { NET_X25_FORWARD, "x25_forward" },
582 {}
583};
584
585static struct trans_ctl_table trans_net_tr_table[] = {
586 { NET_TR_RIF_TIMEOUT, "rif_timeout" },
587 {}
588};
589
590
591static struct trans_ctl_table trans_net_decnet_conf_vars[] = {
592 { NET_DECNET_CONF_DEV_FORWARDING, "forwarding" },
593 { NET_DECNET_CONF_DEV_PRIORITY, "priority" },
594 { NET_DECNET_CONF_DEV_T2, "t2" },
595 { NET_DECNET_CONF_DEV_T3, "t3" },
596 {}
597};
598
599static struct trans_ctl_table trans_net_decnet_conf[] = {
600 { 0, NULL, trans_net_decnet_conf_vars },
601 {}
602};
603
604static struct trans_ctl_table trans_net_decnet_table[] = {
605 { NET_DECNET_CONF, "conf", trans_net_decnet_conf },
606 { NET_DECNET_NODE_ADDRESS, "node_address" },
607 { NET_DECNET_NODE_NAME, "node_name" },
608 { NET_DECNET_DEFAULT_DEVICE, "default_device" },
609 { NET_DECNET_TIME_WAIT, "time_wait" },
610 { NET_DECNET_DN_COUNT, "dn_count" },
611 { NET_DECNET_DI_COUNT, "di_count" },
612 { NET_DECNET_DR_COUNT, "dr_count" },
613 { NET_DECNET_DST_GC_INTERVAL, "dst_gc_interval" },
614 { NET_DECNET_NO_FC_MAX_CWND, "no_fc_max_cwnd" },
615 { NET_DECNET_MEM, "decnet_mem" },
616 { NET_DECNET_RMEM, "decnet_rmem" },
617 { NET_DECNET_WMEM, "decnet_wmem" },
618 { NET_DECNET_DEBUG_LEVEL, "debug" },
619 {}
620};
621
622static struct trans_ctl_table trans_net_sctp_table[] = {
623 { NET_SCTP_RTO_INITIAL, "rto_initial" },
624 { NET_SCTP_RTO_MIN, "rto_min" },
625 { NET_SCTP_RTO_MAX, "rto_max" },
626 { NET_SCTP_RTO_ALPHA, "rto_alpha_exp_divisor" },
627 { NET_SCTP_RTO_BETA, "rto_beta_exp_divisor" },
628 { NET_SCTP_VALID_COOKIE_LIFE, "valid_cookie_life" },
629 { NET_SCTP_ASSOCIATION_MAX_RETRANS, "association_max_retrans" },
630 { NET_SCTP_PATH_MAX_RETRANS, "path_max_retrans" },
631 { NET_SCTP_MAX_INIT_RETRANSMITS, "max_init_retransmits" },
632 { NET_SCTP_HB_INTERVAL, "hb_interval" },
633 { NET_SCTP_PRESERVE_ENABLE, "cookie_preserve_enable" },
634 { NET_SCTP_MAX_BURST, "max_burst" },
635 { NET_SCTP_ADDIP_ENABLE, "addip_enable" },
636 { NET_SCTP_PRSCTP_ENABLE, "prsctp_enable" },
637 { NET_SCTP_SNDBUF_POLICY, "sndbuf_policy" },
638 { NET_SCTP_SACK_TIMEOUT, "sack_timeout" },
639 { NET_SCTP_RCVBUF_POLICY, "rcvbuf_policy" },
640 {}
641};
642
643static struct trans_ctl_table trans_net_llc_llc2_timeout_table[] = {
644 { NET_LLC2_ACK_TIMEOUT, "ack" },
645 { NET_LLC2_P_TIMEOUT, "p" },
646 { NET_LLC2_REJ_TIMEOUT, "rej" },
647 { NET_LLC2_BUSY_TIMEOUT, "busy" },
648 {}
649};
650
651static struct trans_ctl_table trans_net_llc_station_table[] = {
652 { NET_LLC_STATION_ACK_TIMEOUT, "ack_timeout" },
653 {}
654};
655
656static struct trans_ctl_table trans_net_llc_llc2_table[] = {
657 { NET_LLC2, "timeout", trans_net_llc_llc2_timeout_table },
658 {}
659};
660
661static struct trans_ctl_table trans_net_llc_table[] = {
662 { NET_LLC2, "llc2", trans_net_llc_llc2_table },
663 { NET_LLC_STATION, "station", trans_net_llc_station_table },
664 {}
665};
666
667static struct trans_ctl_table trans_net_netfilter_table[] = {
668 { NET_NF_CONNTRACK_MAX, "nf_conntrack_max" },
669 { NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT, "nf_conntrack_tcp_timeout_syn_sent" },
670 { NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV, "nf_conntrack_tcp_timeout_syn_recv" },
671 { NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED, "nf_conntrack_tcp_timeout_established" },
672 { NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT, "nf_conntrack_tcp_timeout_fin_wait" },
673 { NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT, "nf_conntrack_tcp_timeout_close_wait" },
674 { NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK, "nf_conntrack_tcp_timeout_last_ack" },
675 { NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT, "nf_conntrack_tcp_timeout_time_wait" },
676 { NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE, "nf_conntrack_tcp_timeout_close" },
677 { NET_NF_CONNTRACK_UDP_TIMEOUT, "nf_conntrack_udp_timeout" },
678 { NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM, "nf_conntrack_udp_timeout_stream" },
679 { NET_NF_CONNTRACK_ICMP_TIMEOUT, "nf_conntrack_icmp_timeout" },
680 { NET_NF_CONNTRACK_GENERIC_TIMEOUT, "nf_conntrack_generic_timeout" },
681 { NET_NF_CONNTRACK_BUCKETS, "nf_conntrack_buckets" },
682 { NET_NF_CONNTRACK_LOG_INVALID, "nf_conntrack_log_invalid" },
683 { NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS, "nf_conntrack_tcp_timeout_max_retrans" },
684 { NET_NF_CONNTRACK_TCP_LOOSE, "nf_conntrack_tcp_loose" },
685 { NET_NF_CONNTRACK_TCP_BE_LIBERAL, "nf_conntrack_tcp_be_liberal" },
686 { NET_NF_CONNTRACK_TCP_MAX_RETRANS, "nf_conntrack_tcp_max_retrans" },
687 { NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED, "nf_conntrack_sctp_timeout_closed" },
688 { NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT, "nf_conntrack_sctp_timeout_cookie_wait" },
689 { NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED, "nf_conntrack_sctp_timeout_cookie_echoed" },
690 { NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED, "nf_conntrack_sctp_timeout_established" },
691 { NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT, "nf_conntrack_sctp_timeout_shutdown_sent" },
692 { NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD, "nf_conntrack_sctp_timeout_shutdown_recd" },
693 { NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT, "nf_conntrack_sctp_timeout_shutdown_ack_sent" },
694 { NET_NF_CONNTRACK_COUNT, "nf_conntrack_count" },
695 { NET_NF_CONNTRACK_ICMPV6_TIMEOUT, "nf_conntrack_icmpv6_timeout" },
696 { NET_NF_CONNTRACK_FRAG6_TIMEOUT, "nf_conntrack_frag6_timeout" },
697 { NET_NF_CONNTRACK_FRAG6_LOW_THRESH, "nf_conntrack_frag6_low_thresh" },
698 { NET_NF_CONNTRACK_FRAG6_HIGH_THRESH, "nf_conntrack_frag6_high_thresh" },
699 { NET_NF_CONNTRACK_CHECKSUM, "nf_conntrack_checksum" },
700
701 {}
702};
703
704static struct trans_ctl_table trans_net_dccp_table[] = {
705 { NET_DCCP_DEFAULT, "default" },
706 {}
707};
708
709static struct trans_ctl_table trans_net_irda_table[] = {
710 { NET_IRDA_DISCOVERY, "discovery" },
711 { NET_IRDA_DEVNAME, "devname" },
712 { NET_IRDA_DEBUG, "debug" },
713 { NET_IRDA_FAST_POLL, "fast_poll_increase" },
714 { NET_IRDA_DISCOVERY_SLOTS, "discovery_slots" },
715 { NET_IRDA_DISCOVERY_TIMEOUT, "discovery_timeout" },
716 { NET_IRDA_SLOT_TIMEOUT, "slot_timeout" },
717 { NET_IRDA_MAX_BAUD_RATE, "max_baud_rate" },
718 { NET_IRDA_MIN_TX_TURN_TIME, "min_tx_turn_time" },
719 { NET_IRDA_MAX_TX_DATA_SIZE, "max_tx_data_size" },
720 { NET_IRDA_MAX_TX_WINDOW, "max_tx_window" },
721 { NET_IRDA_MAX_NOREPLY_TIME, "max_noreply_time" },
722 { NET_IRDA_WARN_NOREPLY_TIME, "warn_noreply_time" },
723 { NET_IRDA_LAP_KEEPALIVE_TIME, "lap_keepalive_time" },
724 {}
725};
726
727static struct trans_ctl_table trans_net_table[] = {
728 { NET_CORE, "core", trans_net_core_table },
729 /* NET_ETHER not used */
730 /* NET_802 not used */
731 { NET_UNIX, "unix", trans_net_unix_table },
732 { NET_IPV4, "ipv4", trans_net_ipv4_table },
733 { NET_IPX, "ipx", trans_net_ipx_table },
734 { NET_ATALK, "atalk", trans_net_atalk_table },
735 { NET_NETROM, "netrom", trans_net_netrom_table },
736 { NET_AX25, "ax25", trans_net_ax25_table },
737 { NET_BRIDGE, "bridge", trans_net_bridge_table },
738 { NET_ROSE, "rose", trans_net_rose_table },
739 { NET_IPV6, "ipv6", trans_net_ipv6_table },
740 { NET_X25, "x25", trans_net_x25_table },
741 { NET_TR, "tr", trans_net_tr_table },
742 { NET_DECNET, "decnet", trans_net_decnet_table },
743 /* NET_ECONET not used */
744 { NET_SCTP, "sctp", trans_net_sctp_table },
745 { NET_LLC, "llc", trans_net_llc_table },
746 { NET_NETFILTER, "netfilter", trans_net_netfilter_table },
747 { NET_DCCP, "dccp", trans_net_dccp_table },
748 { NET_IRDA, "irda", trans_net_irda_table },
749 { 2089, "nf_conntrack_max" },
750 {}
751};
752
753static struct trans_ctl_table trans_fs_quota_table[] = {
754 { FS_DQ_LOOKUPS, "lookups" },
755 { FS_DQ_DROPS, "drops" },
756 { FS_DQ_READS, "reads" },
757 { FS_DQ_WRITES, "writes" },
758 { FS_DQ_CACHE_HITS, "cache_hits" },
759 { FS_DQ_ALLOCATED, "allocated_dquots" },
760 { FS_DQ_FREE, "free_dquots" },
761 { FS_DQ_SYNCS, "syncs" },
762 { FS_DQ_WARNINGS, "warnings" },
763 {}
764};
765
766static struct trans_ctl_table trans_fs_xfs_table[] = {
767 { XFS_RESTRICT_CHOWN, "restrict_chown" },
768 { XFS_SGID_INHERIT, "irix_sgid_inherit" },
769 { XFS_SYMLINK_MODE, "irix_symlink_mode" },
770 { XFS_PANIC_MASK, "panic_mask" },
771
772 { XFS_ERRLEVEL, "error_level" },
773 { XFS_SYNCD_TIMER, "xfssyncd_centisecs" },
774 { XFS_INHERIT_SYNC, "inherit_sync" },
775 { XFS_INHERIT_NODUMP, "inherit_nodump" },
776 { XFS_INHERIT_NOATIME, "inherit_noatime" },
777 { XFS_BUF_TIMER, "xfsbufd_centisecs" },
778 { XFS_BUF_AGE, "age_buffer_centisecs" },
779 { XFS_INHERIT_NOSYM, "inherit_nosymlinks" },
780 { XFS_ROTORSTEP, "rotorstep" },
781 { XFS_INHERIT_NODFRG, "inherit_nodefrag" },
782 { XFS_FILESTREAM_TIMER, "filestream_centisecs" },
783 { XFS_STATS_CLEAR, "stats_clear" },
784 {}
785};
786
787static struct trans_ctl_table trans_fs_ocfs2_nm_table[] = {
788 { 1, "hb_ctl_path" },
789 {}
790};
791
792static struct trans_ctl_table trans_fs_ocfs2_table[] = {
793 { 1, "nm", trans_fs_ocfs2_nm_table },
794 {}
795};
796
797static struct trans_ctl_table trans_inotify_table[] = {
798 { INOTIFY_MAX_USER_INSTANCES, "max_user_instances" },
799 { INOTIFY_MAX_USER_WATCHES, "max_user_watches" },
800 { INOTIFY_MAX_QUEUED_EVENTS, "max_queued_events" },
801 {}
802};
803
804static struct trans_ctl_table trans_fs_table[] = {
805 { FS_NRINODE, "inode-nr" },
806 { FS_STATINODE, "inode-state" },
807 /* FS_MAXINODE unused */
808 /* FS_NRDQUOT unused */
809 /* FS_MAXDQUOT unused */
810 { FS_NRFILE, "file-nr" },
811 { FS_MAXFILE, "file-max" },
812 { FS_DENTRY, "dentry-state" },
813 /* FS_NRSUPER unused */
814 /* FS_MAXUPSER unused */
815 { FS_OVERFLOWUID, "overflowuid" },
816 { FS_OVERFLOWGID, "overflowgid" },
817 { FS_LEASES, "leases-enable" },
818 { FS_DIR_NOTIFY, "dir-notify-enable" },
819 { FS_LEASE_TIME, "lease-break-time" },
820 { FS_DQSTATS, "quota", trans_fs_quota_table },
821 { FS_XFS, "xfs", trans_fs_xfs_table },
822 { FS_AIO_NR, "aio-nr" },
823 { FS_AIO_MAX_NR, "aio-max-nr" },
824 { FS_INOTIFY, "inotify", trans_inotify_table },
825 { FS_OCFS2, "ocfs2", trans_fs_ocfs2_table },
826 { KERN_SETUID_DUMPABLE, "suid_dumpable" },
827 {}
828};
829
830static struct trans_ctl_table trans_debug_table[] = {
831 {}
832};
833
834static struct trans_ctl_table trans_cdrom_table[] = {
835 { DEV_CDROM_INFO, "info" },
836 { DEV_CDROM_AUTOCLOSE, "autoclose" },
837 { DEV_CDROM_AUTOEJECT, "autoeject" },
838 { DEV_CDROM_DEBUG, "debug" },
839 { DEV_CDROM_LOCK, "lock" },
840 { DEV_CDROM_CHECK_MEDIA, "check_media" },
841 {}
842};
843
844static struct trans_ctl_table trans_ipmi_table[] = {
845 { DEV_IPMI_POWEROFF_POWERCYCLE, "poweroff_powercycle" },
846 {}
847};
848
849static struct trans_ctl_table trans_mac_hid_files[] = {
850 /* DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES unused */
851 /* DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES unused */
852 { DEV_MAC_HID_MOUSE_BUTTON_EMULATION, "mouse_button_emulation" },
853 { DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE, "mouse_button2_keycode" },
854 { DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE, "mouse_button3_keycode" },
855 /* DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES unused */
856 {}
857};
858
859static struct trans_ctl_table trans_raid_table[] = {
860 { DEV_RAID_SPEED_LIMIT_MIN, "speed_limit_min" },
861 { DEV_RAID_SPEED_LIMIT_MAX, "speed_limit_max" },
862 {}
863};
864
865static struct trans_ctl_table trans_scsi_table[] = {
866 { DEV_SCSI_LOGGING_LEVEL, "logging_level" },
867 {}
868};
869
870static struct trans_ctl_table trans_parport_default_table[] = {
871 { DEV_PARPORT_DEFAULT_TIMESLICE, "timeslice" },
872 { DEV_PARPORT_DEFAULT_SPINTIME, "spintime" },
873 {}
874};
875
876static struct trans_ctl_table trans_parport_device_table[] = {
877 { DEV_PARPORT_DEVICE_TIMESLICE, "timeslice" },
878 {}
879};
880
881static struct trans_ctl_table trans_parport_devices_table[] = {
882 { DEV_PARPORT_DEVICES_ACTIVE, "active" },
883 { 0, NULL, trans_parport_device_table },
884 {}
885};
886
887static struct trans_ctl_table trans_parport_parport_table[] = {
888 { DEV_PARPORT_SPINTIME, "spintime" },
889 { DEV_PARPORT_BASE_ADDR, "base-addr" },
890 { DEV_PARPORT_IRQ, "irq" },
891 { DEV_PARPORT_DMA, "dma" },
892 { DEV_PARPORT_MODES, "modes" },
893 { DEV_PARPORT_DEVICES, "devices", trans_parport_devices_table },
894 { DEV_PARPORT_AUTOPROBE, "autoprobe" },
895 { DEV_PARPORT_AUTOPROBE + 1, "autoprobe0" },
896 { DEV_PARPORT_AUTOPROBE + 2, "autoprobe1" },
897 { DEV_PARPORT_AUTOPROBE + 3, "autoprobe2" },
898 { DEV_PARPORT_AUTOPROBE + 4, "autoprobe3" },
899 {}
900};
901static struct trans_ctl_table trans_parport_table[] = {
902 { DEV_PARPORT_DEFAULT, "default", trans_parport_default_table },
903 { 0, NULL, trans_parport_parport_table },
904 {}
905};
906
907static struct trans_ctl_table trans_dev_table[] = {
908 { DEV_CDROM, "cdrom", trans_cdrom_table },
909 /* DEV_HWMON unused */
910 { DEV_PARPORT, "parport", trans_parport_table },
911 { DEV_RAID, "raid", trans_raid_table },
912 { DEV_MAC_HID, "mac_hid", trans_mac_hid_files },
913 { DEV_SCSI, "scsi", trans_scsi_table },
914 { DEV_IPMI, "ipmi", trans_ipmi_table },
915 {}
916};
917
918static struct trans_ctl_table trans_bus_isa_table[] = {
919 { BUS_ISA_MEM_BASE, "membase" },
920 { BUS_ISA_PORT_BASE, "portbase" },
921 { BUS_ISA_PORT_SHIFT, "portshift" },
922 {}
923};
924
925static struct trans_ctl_table trans_bus_table[] = {
926 { CTL_BUS_ISA, "isa", trans_bus_isa_table },
927 {}
928};
929
930static struct trans_ctl_table trans_arlan_conf_table0[] = {
931 { 1, "spreadingCode" },
932 { 2, "channelNumber" },
933 { 3, "scramblingDisable" },
934 { 4, "txAttenuation" },
935 { 5, "systemId" },
936 { 6, "maxDatagramSize" },
937 { 7, "maxFrameSize" },
938 { 8, "maxRetries" },
939 { 9, "receiveMode" },
940 { 10, "priority" },
941 { 11, "rootOrRepeater" },
942 { 12, "SID" },
943 { 13, "registrationMode" },
944 { 14, "registrationFill" },
945 { 15, "localTalkAddress" },
946 { 16, "codeFormat" },
947 { 17, "numChannels" },
948 { 18, "channel1" },
949 { 19, "channel2" },
950 { 20, "channel3" },
951 { 21, "channel4" },
952 { 22, "txClear" },
953 { 23, "txRetries" },
954 { 24, "txRouting" },
955 { 25, "txScrambled" },
956 { 26, "rxParameter" },
957 { 27, "txTimeoutMs" },
958 { 28, "waitCardTimeout" },
959 { 29, "channelSet" },
960 { 30, "name" },
961 { 31, "waitTime" },
962 { 32, "lParameter" },
963 { 33, "_15" },
964 { 34, "headerSize" },
965 { 36, "tx_delay_ms" },
966 { 37, "retries" },
967 { 38, "ReTransmitPacketMaxSize" },
968 { 39, "waitReTransmitPacketMaxSize" },
969 { 40, "fastReTransCount" },
970 { 41, "driverRetransmissions" },
971 { 42, "txAckTimeoutMs" },
972 { 43, "registrationInterrupts" },
973 { 44, "hardwareType" },
974 { 45, "radioType" },
975 { 46, "writeEEPROM" },
976 { 47, "writeRadioType" },
977 { 48, "entry_exit_debug" },
978 { 49, "debug" },
979 { 50, "in_speed" },
980 { 51, "out_speed" },
981 { 52, "in_speed10" },
982 { 53, "out_speed10" },
983 { 54, "in_speed_max" },
984 { 55, "out_speed_max" },
985 { 56, "measure_rate" },
986 { 57, "pre_Command_Wait" },
987 { 58, "rx_tweak1" },
988 { 59, "rx_tweak2" },
989 { 60, "tx_queue_len" },
990
991 { 150, "arlan0-txRing" },
992 { 151, "arlan0-rxRing" },
993 { 152, "arlan0-18" },
994 { 153, "arlan0-ring" },
995 { 154, "arlan0-shm-cpy" },
996 { 155, "config0" },
997 { 156, "reset0" },
998 {}
999};
1000
1001static struct trans_ctl_table trans_arlan_conf_table1[] = {
1002 { 1, "spreadingCode" },
1003 { 2, "channelNumber" },
1004 { 3, "scramblingDisable" },
1005 { 4, "txAttenuation" },
1006 { 5, "systemId" },
1007 { 6, "maxDatagramSize" },
1008 { 7, "maxFrameSize" },
1009 { 8, "maxRetries" },
1010 { 9, "receiveMode" },
1011 { 10, "priority" },
1012 { 11, "rootOrRepeater" },
1013 { 12, "SID" },
1014 { 13, "registrationMode" },
1015 { 14, "registrationFill" },
1016 { 15, "localTalkAddress" },
1017 { 16, "codeFormat" },
1018 { 17, "numChannels" },
1019 { 18, "channel1" },
1020 { 19, "channel2" },
1021 { 20, "channel3" },
1022 { 21, "channel4" },
1023 { 22, "txClear" },
1024 { 23, "txRetries" },
1025 { 24, "txRouting" },
1026 { 25, "txScrambled" },
1027 { 26, "rxParameter" },
1028 { 27, "txTimeoutMs" },
1029 { 28, "waitCardTimeout" },
1030 { 29, "channelSet" },
1031 { 30, "name" },
1032 { 31, "waitTime" },
1033 { 32, "lParameter" },
1034 { 33, "_15" },
1035 { 34, "headerSize" },
1036 { 36, "tx_delay_ms" },
1037 { 37, "retries" },
1038 { 38, "ReTransmitPacketMaxSize" },
1039 { 39, "waitReTransmitPacketMaxSize" },
1040 { 40, "fastReTransCount" },
1041 { 41, "driverRetransmissions" },
1042 { 42, "txAckTimeoutMs" },
1043 { 43, "registrationInterrupts" },
1044 { 44, "hardwareType" },
1045 { 45, "radioType" },
1046 { 46, "writeEEPROM" },
1047 { 47, "writeRadioType" },
1048 { 48, "entry_exit_debug" },
1049 { 49, "debug" },
1050 { 50, "in_speed" },
1051 { 51, "out_speed" },
1052 { 52, "in_speed10" },
1053 { 53, "out_speed10" },
1054 { 54, "in_speed_max" },
1055 { 55, "out_speed_max" },
1056 { 56, "measure_rate" },
1057 { 57, "pre_Command_Wait" },
1058 { 58, "rx_tweak1" },
1059 { 59, "rx_tweak2" },
1060 { 60, "tx_queue_len" },
1061
1062 { 150, "arlan1-txRing" },
1063 { 151, "arlan1-rxRing" },
1064 { 152, "arlan1-18" },
1065 { 153, "arlan1-ring" },
1066 { 154, "arlan1-shm-cpy" },
1067 { 155, "config1" },
1068 { 156, "reset1" },
1069 {}
1070};
1071
1072static struct trans_ctl_table trans_arlan_conf_table2[] = {
1073 { 1, "spreadingCode" },
1074 { 2, "channelNumber" },
1075 { 3, "scramblingDisable" },
1076 { 4, "txAttenuation" },
1077 { 5, "systemId" },
1078 { 6, "maxDatagramSize" },
1079 { 7, "maxFrameSize" },
1080 { 8, "maxRetries" },
1081 { 9, "receiveMode" },
1082 { 10, "priority" },
1083 { 11, "rootOrRepeater" },
1084 { 12, "SID" },
1085 { 13, "registrationMode" },
1086 { 14, "registrationFill" },
1087 { 15, "localTalkAddress" },
1088 { 16, "codeFormat" },
1089 { 17, "numChannels" },
1090 { 18, "channel1" },
1091 { 19, "channel2" },
1092 { 20, "channel3" },
1093 { 21, "channel4" },
1094 { 22, "txClear" },
1095 { 23, "txRetries" },
1096 { 24, "txRouting" },
1097 { 25, "txScrambled" },
1098 { 26, "rxParameter" },
1099 { 27, "txTimeoutMs" },
1100 { 28, "waitCardTimeout" },
1101 { 29, "channelSet" },
1102 { 30, "name" },
1103 { 31, "waitTime" },
1104 { 32, "lParameter" },
1105 { 33, "_15" },
1106 { 34, "headerSize" },
1107 { 36, "tx_delay_ms" },
1108 { 37, "retries" },
1109 { 38, "ReTransmitPacketMaxSize" },
1110 { 39, "waitReTransmitPacketMaxSize" },
1111 { 40, "fastReTransCount" },
1112 { 41, "driverRetransmissions" },
1113 { 42, "txAckTimeoutMs" },
1114 { 43, "registrationInterrupts" },
1115 { 44, "hardwareType" },
1116 { 45, "radioType" },
1117 { 46, "writeEEPROM" },
1118 { 47, "writeRadioType" },
1119 { 48, "entry_exit_debug" },
1120 { 49, "debug" },
1121 { 50, "in_speed" },
1122 { 51, "out_speed" },
1123 { 52, "in_speed10" },
1124 { 53, "out_speed10" },
1125 { 54, "in_speed_max" },
1126 { 55, "out_speed_max" },
1127 { 56, "measure_rate" },
1128 { 57, "pre_Command_Wait" },
1129 { 58, "rx_tweak1" },
1130 { 59, "rx_tweak2" },
1131 { 60, "tx_queue_len" },
1132
1133 { 150, "arlan2-txRing" },
1134 { 151, "arlan2-rxRing" },
1135 { 152, "arlan2-18" },
1136 { 153, "arlan2-ring" },
1137 { 154, "arlan2-shm-cpy" },
1138 { 155, "config2" },
1139 { 156, "reset2" },
1140 {}
1141};
1142
1143static struct trans_ctl_table trans_arlan_conf_table3[] = {
1144 { 1, "spreadingCode" },
1145 { 2, "channelNumber" },
1146 { 3, "scramblingDisable" },
1147 { 4, "txAttenuation" },
1148 { 5, "systemId" },
1149 { 6, "maxDatagramSize" },
1150 { 7, "maxFrameSize" },
1151 { 8, "maxRetries" },
1152 { 9, "receiveMode" },
1153 { 10, "priority" },
1154 { 11, "rootOrRepeater" },
1155 { 12, "SID" },
1156 { 13, "registrationMode" },
1157 { 14, "registrationFill" },
1158 { 15, "localTalkAddress" },
1159 { 16, "codeFormat" },
1160 { 17, "numChannels" },
1161 { 18, "channel1" },
1162 { 19, "channel2" },
1163 { 20, "channel3" },
1164 { 21, "channel4" },
1165 { 22, "txClear" },
1166 { 23, "txRetries" },
1167 { 24, "txRouting" },
1168 { 25, "txScrambled" },
1169 { 26, "rxParameter" },
1170 { 27, "txTimeoutMs" },
1171 { 28, "waitCardTimeout" },
1172 { 29, "channelSet" },
1173 { 30, "name" },
1174 { 31, "waitTime" },
1175 { 32, "lParameter" },
1176 { 33, "_15" },
1177 { 34, "headerSize" },
1178 { 36, "tx_delay_ms" },
1179 { 37, "retries" },
1180 { 38, "ReTransmitPacketMaxSize" },
1181 { 39, "waitReTransmitPacketMaxSize" },
1182 { 40, "fastReTransCount" },
1183 { 41, "driverRetransmissions" },
1184 { 42, "txAckTimeoutMs" },
1185 { 43, "registrationInterrupts" },
1186 { 44, "hardwareType" },
1187 { 45, "radioType" },
1188 { 46, "writeEEPROM" },
1189 { 47, "writeRadioType" },
1190 { 48, "entry_exit_debug" },
1191 { 49, "debug" },
1192 { 50, "in_speed" },
1193 { 51, "out_speed" },
1194 { 52, "in_speed10" },
1195 { 53, "out_speed10" },
1196 { 54, "in_speed_max" },
1197 { 55, "out_speed_max" },
1198 { 56, "measure_rate" },
1199 { 57, "pre_Command_Wait" },
1200 { 58, "rx_tweak1" },
1201 { 59, "rx_tweak2" },
1202 { 60, "tx_queue_len" },
1203
1204 { 150, "arlan3-txRing" },
1205 { 151, "arlan3-rxRing" },
1206 { 152, "arlan3-18" },
1207 { 153, "arlan3-ring" },
1208 { 154, "arlan3-shm-cpy" },
1209 { 155, "config3" },
1210 { 156, "reset3" },
1211 {}
1212};
1213
1214static struct trans_ctl_table trans_arlan_table[] = {
1215 { 1, "arlan0", trans_arlan_conf_table0 },
1216 { 2, "arlan1", trans_arlan_conf_table1 },
1217 { 3, "arlan2", trans_arlan_conf_table2 },
1218 { 4, "arlan3", trans_arlan_conf_table3 },
1219 {}
1220};
1221
1222static struct trans_ctl_table trans_appldata_table[] = {
1223 { CTL_APPLDATA_TIMER, "timer" },
1224 { CTL_APPLDATA_INTERVAL, "interval" },
1225 { CTL_APPLDATA_OS, "os" },
1226 { CTL_APPLDATA_NET_SUM, "net_sum" },
1227 { CTL_APPLDATA_MEM, "mem" },
1228 {}
1229
1230};
1231
1232static struct trans_ctl_table trans_s390dbf_table[] = {
1233 { 5678 /* CTL_S390DBF_STOPPABLE */, "debug_stoppable" },
1234 { 5679 /* CTL_S390DBF_ACTIVE */, "debug_active" },
1235 {}
1236};
1237
1238static struct trans_ctl_table trans_sunrpc_table[] = {
1239 { CTL_RPCDEBUG, "rpc_debug" },
1240 { CTL_NFSDEBUG, "nfs_debug" },
1241 { CTL_NFSDDEBUG, "nfsd_debug" },
1242 { CTL_NLMDEBUG, "nlm_debug" },
1243 { CTL_SLOTTABLE_UDP, "udp_slot_table_entries" },
1244 { CTL_SLOTTABLE_TCP, "tcp_slot_table_entries" },
1245 { CTL_MIN_RESVPORT, "min_resvport" },
1246 { CTL_MAX_RESVPORT, "max_resvport" },
1247 {}
1248};
1249
1250static struct trans_ctl_table trans_pm_table[] = {
1251 { 1 /* CTL_PM_SUSPEND */, "suspend" },
1252 { 2 /* CTL_PM_CMODE */, "cmode" },
1253 { 3 /* CTL_PM_P0 */, "p0" },
1254 { 4 /* CTL_PM_CM */, "cm" },
1255 {}
1256};
1257
1258static struct trans_ctl_table trans_frv_table[] = {
1259 { 1, "cache-mode" },
1260 { 2, "pin-cxnr" },
1261 {}
1262};
1263
1264static struct trans_ctl_table trans_root_table[] = {
1265 { CTL_KERN, "kernel", trans_kern_table },
1266 { CTL_VM, "vm", trans_vm_table },
1267 { CTL_NET, "net", trans_net_table },
1268 /* CTL_PROC not used */
1269 { CTL_FS, "fs", trans_fs_table },
1270 { CTL_DEBUG, "debug", trans_debug_table },
1271 { CTL_DEV, "dev", trans_dev_table },
1272 { CTL_BUS, "bus", trans_bus_table },
1273 { CTL_ABI, "abi" },
1274 /* CTL_CPU not used */
1275 { CTL_ARLAN, "arlan", trans_arlan_table },
1276 { CTL_APPLDATA, "appldata", trans_appldata_table },
1277 { CTL_S390DBF, "s390dbf", trans_s390dbf_table },
1278 { CTL_SUNRPC, "sunrpc", trans_sunrpc_table },
1279 { CTL_PM, "pm", trans_pm_table },
1280 { CTL_FRV, "frv", trans_frv_table },
1281 {}
1282};
1283
1284
1285
1286
1287static int sysctl_depth(struct ctl_table *table)
1288{
1289 struct ctl_table *tmp;
1290 int depth;
1291
1292 depth = 0;
1293 for (tmp = table; tmp->parent; tmp = tmp->parent)
1294 depth++;
1295
1296 return depth;
1297}
1298
1299static struct ctl_table *sysctl_parent(struct ctl_table *table, int n)
1300{
1301 int i;
1302
1303 for (i = 0; table && i < n; i++)
1304 table = table->parent;
1305
1306 return table;
1307}
1308
1309static struct trans_ctl_table *sysctl_binary_lookup(struct ctl_table *table)
1310{
1311 struct ctl_table *test;
1312 struct trans_ctl_table *ref;
1313 int depth, cur_depth;
1314
1315 depth = sysctl_depth(table);
1316
1317 cur_depth = depth;
1318 ref = trans_root_table;
1319repeat:
1320 test = sysctl_parent(table, cur_depth);
1321 for (; ref->ctl_name || ref->procname || ref->child; ref++) {
1322 int match = 0;
1323
1324 if (cur_depth && !ref->child)
1325 continue;
1326
1327 if (test->procname && ref->procname &&
1328 (strcmp(test->procname, ref->procname) == 0))
1329 match++;
1330
1331 if (test->ctl_name && ref->ctl_name &&
1332 (test->ctl_name == ref->ctl_name))
1333 match++;
1334
1335 if (!ref->ctl_name && !ref->procname)
1336 match++;
1337
1338 if (match) {
1339 if (cur_depth != 0) {
1340 cur_depth--;
1341 ref = ref->child;
1342 goto repeat;
1343 }
1344 goto out;
1345 }
1346 }
1347 ref = NULL;
1348out:
1349 return ref;
1350}
1351
1352static void sysctl_print_path(struct ctl_table *table)
1353{
1354 struct ctl_table *tmp;
1355 int depth, i;
1356 depth = sysctl_depth(table);
1357 if (table->procname) {
1358 for (i = depth; i >= 0; i--) {
1359 tmp = sysctl_parent(table, i);
1360 printk("/%s", tmp->procname?tmp->procname:"");
1361 }
1362 }
1363 printk(" ");
1364 if (table->ctl_name) {
1365 for (i = depth; i >= 0; i--) {
1366 tmp = sysctl_parent(table, i);
1367 printk(".%d", tmp->ctl_name);
1368 }
1369 }
1370}
1371
1372static void sysctl_repair_table(struct ctl_table *table)
1373{
1374 /* Don't complain about the classic default
1375 * sysctl strategy routine. Maybe later we
1376 * can get the tables fixed and complain about
1377 * this.
1378 */
1379 if (table->ctl_name && table->procname &&
1380 (table->proc_handler == proc_dointvec) &&
1381 (!table->strategy)) {
1382 table->strategy = sysctl_data;
1383 }
1384}
1385
1386static struct ctl_table *sysctl_check_lookup(struct ctl_table *table)
1387{
1388 struct ctl_table_header *head;
1389 struct ctl_table *ref, *test;
1390 int depth, cur_depth;
1391
1392 depth = sysctl_depth(table);
1393
1394 for (head = sysctl_head_next(NULL); head;
1395 head = sysctl_head_next(head)) {
1396 cur_depth = depth;
1397 ref = head->ctl_table;
1398repeat:
1399 test = sysctl_parent(table, cur_depth);
1400 for (; ref->ctl_name || ref->procname; ref++) {
1401 int match = 0;
1402 if (cur_depth && !ref->child)
1403 continue;
1404
1405 if (test->procname && ref->procname &&
1406 (strcmp(test->procname, ref->procname) == 0))
1407 match++;
1408
1409 if (test->ctl_name && ref->ctl_name &&
1410 (test->ctl_name == ref->ctl_name))
1411 match++;
1412
1413 if (match) {
1414 if (cur_depth != 0) {
1415 cur_depth--;
1416 ref = ref->child;
1417 goto repeat;
1418 }
1419 goto out;
1420 }
1421 }
1422 }
1423 ref = NULL;
1424out:
1425 sysctl_head_finish(head);
1426 return ref;
1427}
1428
1429static void set_fail(const char **fail, struct ctl_table *table, const char *str)
1430{
1431 if (*fail) {
1432 printk(KERN_ERR "sysctl table check failed: ");
1433 sysctl_print_path(table);
1434 printk(" %s\n", *fail);
1435 }
1436 *fail = str;
1437}
1438
1439static int sysctl_check_dir(struct ctl_table *table)
1440{
1441 struct ctl_table *ref;
1442 int error;
1443
1444 error = 0;
1445 ref = sysctl_check_lookup(table);
1446 if (ref) {
1447 int match = 0;
1448 if ((!table->procname && !ref->procname) ||
1449 (table->procname && ref->procname &&
1450 (strcmp(table->procname, ref->procname) == 0)))
1451 match++;
1452
1453 if ((!table->ctl_name && !ref->ctl_name) ||
1454 (table->ctl_name && ref->ctl_name &&
1455 (table->ctl_name == ref->ctl_name)))
1456 match++;
1457
1458 if (match != 2) {
1459 printk(KERN_ERR "%s: failed: ", __func__);
1460 sysctl_print_path(table);
1461 printk(" ref: ");
1462 sysctl_print_path(ref);
1463 printk("\n");
1464 error = -EINVAL;
1465 }
1466 }
1467 return error;
1468}
1469
1470static void sysctl_check_leaf(struct ctl_table *table, const char **fail)
1471{
1472 struct ctl_table *ref;
1473
1474 ref = sysctl_check_lookup(table);
1475 if (ref && (ref != table))
1476 set_fail(fail, table, "Sysctl already exists");
1477}
1478
1479static void sysctl_check_bin_path(struct ctl_table *table, const char **fail)
1480{
1481 struct trans_ctl_table *ref;
1482
1483 ref = sysctl_binary_lookup(table);
1484 if (table->ctl_name && !ref)
1485 set_fail(fail, table, "Unknown sysctl binary path");
1486 if (ref) {
1487 if (ref->procname &&
1488 (!table->procname ||
1489 (strcmp(table->procname, ref->procname) != 0)))
1490 set_fail(fail, table, "procname does not match binary path procname");
1491
1492 if (ref->ctl_name && table->ctl_name &&
1493 (table->ctl_name != ref->ctl_name))
1494 set_fail(fail, table, "ctl_name does not match binary path ctl_name");
1495 }
1496}
1497
1498int sysctl_check_table(struct ctl_table *table)
1499{
1500 int error = 0;
1501 for (; table->ctl_name || table->procname; table++) {
1502 const char *fail = NULL;
1503
1504 sysctl_repair_table(table);
1505 if (table->parent) {
1506 if (table->procname && !table->parent->procname)
1507 set_fail(&fail, table, "Parent without procname");
1508 if (table->ctl_name && !table->parent->ctl_name)
1509 set_fail(&fail, table, "Parent without ctl_name");
1510 }
1511 if (!table->procname)
1512 set_fail(&fail, table, "No procname");
1513 if (table->child) {
1514 if (table->data)
1515 set_fail(&fail, table, "Directory with data?");
1516 if (table->maxlen)
1517 set_fail(&fail, table, "Directory with maxlen?");
1518 if ((table->mode & (S_IRUGO|S_IXUGO)) != table->mode)
1519 set_fail(&fail, table, "Writable sysctl directory");
1520 if (table->proc_handler)
1521 set_fail(&fail, table, "Directory with proc_handler");
1522 if (table->strategy)
1523 set_fail(&fail, table, "Directory with strategy");
1524 if (table->extra1)
1525 set_fail(&fail, table, "Directory with extra1");
1526 if (table->extra2)
1527 set_fail(&fail, table, "Directory with extra2");
1528 if (sysctl_check_dir(table))
1529 set_fail(&fail, table, "Inconsistent directory names");
1530 } else {
1531 if ((table->strategy == sysctl_data) ||
1532 (table->strategy == sysctl_string) ||
1533 (table->strategy == sysctl_intvec) ||
1534 (table->strategy == sysctl_jiffies) ||
1535 (table->strategy == sysctl_ms_jiffies) ||
1536 (table->proc_handler == proc_dostring) ||
1537 (table->proc_handler == proc_dointvec) ||
1538#ifdef CONFIG_SECURITY_CAPABILITIES
1539 (table->proc_handler == proc_dointvec_bset) ||
1540#endif /* def CONFIG_SECURITY_CAPABILITIES */
1541 (table->proc_handler == proc_dointvec_minmax) ||
1542 (table->proc_handler == proc_dointvec_jiffies) ||
1543 (table->proc_handler == proc_dointvec_userhz_jiffies) ||
1544 (table->proc_handler == proc_dointvec_ms_jiffies) ||
1545 (table->proc_handler == proc_doulongvec_minmax) ||
1546 (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) {
1547 if (!table->data)
1548 set_fail(&fail, table, "No data");
1549 if (!table->maxlen)
1550 set_fail(&fail, table, "No maxlen");
1551 }
1552 if ((table->proc_handler == proc_doulongvec_minmax) ||
1553 (table->proc_handler == proc_doulongvec_ms_jiffies_minmax)) {
1554 if (table->maxlen > sizeof (unsigned long)) {
1555 if (!table->extra1)
1556 set_fail(&fail, table, "No min");
1557 if (!table->extra2)
1558 set_fail(&fail, table, "No max");
1559 }
1560 }
1561#ifdef CONFIG_SYSCTL_SYSCALL
1562 if (table->ctl_name && !table->strategy)
1563 set_fail(&fail, table, "Missing strategy");
1564#endif
1565#if 0
1566 if (!table->ctl_name && table->strategy)
1567 set_fail(&fail, table, "Strategy without ctl_name");
1568#endif
1569#ifdef CONFIG_PROC_FS
1570 if (table->procname && !table->proc_handler)
1571 set_fail(&fail, table, "No proc_handler");
1572#endif
1573#if 0
1574 if (!table->procname && table->proc_handler)
1575 set_fail(&fail, table, "proc_handler without procname");
1576#endif
1577 sysctl_check_leaf(table, &fail);
1578 }
1579 sysctl_check_bin_path(table, &fail);
1580 if (fail) {
1581 set_fail(&fail, table, NULL);
1582 error = -EINVAL;
1583 }
1584 if (table->child)
1585 error |= sysctl_check_table(table->child);
1586 }
1587 return error;
1588}
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 7d4d7f9c1bb2..354e74bc17c1 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -22,6 +22,10 @@
22#include <linux/delayacct.h> 22#include <linux/delayacct.h>
23#include <linux/cpumask.h> 23#include <linux/cpumask.h>
24#include <linux/percpu.h> 24#include <linux/percpu.h>
25#include <linux/cgroupstats.h>
26#include <linux/cgroup.h>
27#include <linux/fs.h>
28#include <linux/file.h>
25#include <net/genetlink.h> 29#include <net/genetlink.h>
26#include <asm/atomic.h> 30#include <asm/atomic.h>
27 31
@@ -49,6 +53,11 @@ __read_mostly = {
49 [TASKSTATS_CMD_ATTR_REGISTER_CPUMASK] = { .type = NLA_STRING }, 53 [TASKSTATS_CMD_ATTR_REGISTER_CPUMASK] = { .type = NLA_STRING },
50 [TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK] = { .type = NLA_STRING },}; 54 [TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK] = { .type = NLA_STRING },};
51 55
56static struct nla_policy
57cgroupstats_cmd_get_policy[CGROUPSTATS_CMD_ATTR_MAX+1] __read_mostly = {
58 [CGROUPSTATS_CMD_ATTR_FD] = { .type = NLA_U32 },
59};
60
52struct listener { 61struct listener {
53 struct list_head list; 62 struct list_head list;
54 pid_t pid; 63 pid_t pid;
@@ -254,7 +263,7 @@ out:
254 263
255 stats->version = TASKSTATS_VERSION; 264 stats->version = TASKSTATS_VERSION;
256 /* 265 /*
257 * Accounting subsytems can also add calls here to modify 266 * Accounting subsystems can also add calls here to modify
258 * fields of taskstats. 267 * fields of taskstats.
259 */ 268 */
260 return rc; 269 return rc;
@@ -372,6 +381,51 @@ err:
372 return NULL; 381 return NULL;
373} 382}
374 383
384static int cgroupstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
385{
386 int rc = 0;
387 struct sk_buff *rep_skb;
388 struct cgroupstats *stats;
389 struct nlattr *na;
390 size_t size;
391 u32 fd;
392 struct file *file;
393 int fput_needed;
394
395 na = info->attrs[CGROUPSTATS_CMD_ATTR_FD];
396 if (!na)
397 return -EINVAL;
398
399 fd = nla_get_u32(info->attrs[CGROUPSTATS_CMD_ATTR_FD]);
400 file = fget_light(fd, &fput_needed);
401 if (file) {
402 size = nla_total_size(sizeof(struct cgroupstats));
403
404 rc = prepare_reply(info, CGROUPSTATS_CMD_NEW, &rep_skb,
405 size);
406 if (rc < 0)
407 goto err;
408
409 na = nla_reserve(rep_skb, CGROUPSTATS_TYPE_CGROUP_STATS,
410 sizeof(struct cgroupstats));
411 stats = nla_data(na);
412 memset(stats, 0, sizeof(*stats));
413
414 rc = cgroupstats_build(stats, file->f_dentry);
415 if (rc < 0)
416 goto err;
417
418 fput_light(file, fput_needed);
419 return send_reply(rep_skb, info->snd_pid);
420 }
421
422err:
423 if (file)
424 fput_light(file, fput_needed);
425 nlmsg_free(rep_skb);
426 return rc;
427}
428
375static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info) 429static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info)
376{ 430{
377 int rc = 0; 431 int rc = 0;
@@ -522,6 +576,12 @@ static struct genl_ops taskstats_ops = {
522 .policy = taskstats_cmd_get_policy, 576 .policy = taskstats_cmd_get_policy,
523}; 577};
524 578
579static struct genl_ops cgroupstats_ops = {
580 .cmd = CGROUPSTATS_CMD_GET,
581 .doit = cgroupstats_user_cmd,
582 .policy = cgroupstats_cmd_get_policy,
583};
584
525/* Needed early in initialization */ 585/* Needed early in initialization */
526void __init taskstats_init_early(void) 586void __init taskstats_init_early(void)
527{ 587{
@@ -546,8 +606,15 @@ static int __init taskstats_init(void)
546 if (rc < 0) 606 if (rc < 0)
547 goto err; 607 goto err;
548 608
609 rc = genl_register_ops(&family, &cgroupstats_ops);
610 if (rc < 0)
611 goto err_cgroup_ops;
612
549 family_registered = 1; 613 family_registered = 1;
614 printk("registered taskstats version %d\n", TASKSTATS_GENL_VERSION);
550 return 0; 615 return 0;
616err_cgroup_ops:
617 genl_unregister_ops(&family, &taskstats_ops);
551err: 618err:
552 genl_unregister_family(&family); 619 genl_unregister_family(&family);
553 return rc; 620 return rc;
diff --git a/kernel/time.c b/kernel/time.c
index 2d5b6a682138..09d3c45c4da7 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -9,9 +9,9 @@
9 */ 9 */
10/* 10/*
11 * Modification history kernel/time.c 11 * Modification history kernel/time.c
12 * 12 *
13 * 1993-09-02 Philip Gladstone 13 * 1993-09-02 Philip Gladstone
14 * Created file with time related functions from sched.c and adjtimex() 14 * Created file with time related functions from sched.c and adjtimex()
15 * 1993-10-08 Torsten Duwe 15 * 1993-10-08 Torsten Duwe
16 * adjtime interface update and CMOS clock write code 16 * adjtime interface update and CMOS clock write code
17 * 1995-08-13 Torsten Duwe 17 * 1995-08-13 Torsten Duwe
@@ -30,6 +30,7 @@
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/capability.h> 32#include <linux/capability.h>
33#include <linux/clocksource.h>
33#include <linux/errno.h> 34#include <linux/errno.h>
34#include <linux/syscalls.h> 35#include <linux/syscalls.h>
35#include <linux/security.h> 36#include <linux/security.h>
@@ -38,7 +39,7 @@
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
39#include <asm/unistd.h> 40#include <asm/unistd.h>
40 41
41/* 42/*
42 * The timezone where the local system is located. Used as a default by some 43 * The timezone where the local system is located. Used as a default by some
43 * programs who obtain this value by using gettimeofday. 44 * programs who obtain this value by using gettimeofday.
44 */ 45 */
@@ -71,7 +72,7 @@ asmlinkage long sys_time(time_t __user * tloc)
71 * why not move it into the appropriate arch directory (for those 72 * why not move it into the appropriate arch directory (for those
72 * architectures that need it). 73 * architectures that need it).
73 */ 74 */
74 75
75asmlinkage long sys_stime(time_t __user *tptr) 76asmlinkage long sys_stime(time_t __user *tptr)
76{ 77{
77 struct timespec tv; 78 struct timespec tv;
@@ -110,10 +111,10 @@ asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __us
110/* 111/*
111 * Adjust the time obtained from the CMOS to be UTC time instead of 112 * Adjust the time obtained from the CMOS to be UTC time instead of
112 * local time. 113 * local time.
113 * 114 *
114 * This is ugly, but preferable to the alternatives. Otherwise we 115 * This is ugly, but preferable to the alternatives. Otherwise we
115 * would either need to write a program to do it in /etc/rc (and risk 116 * would either need to write a program to do it in /etc/rc (and risk
116 * confusion if the program gets run more than once; it would also be 117 * confusion if the program gets run more than once; it would also be
117 * hard to make the program warp the clock precisely n hours) or 118 * hard to make the program warp the clock precisely n hours) or
118 * compile in the timezone information into the kernel. Bad, bad.... 119 * compile in the timezone information into the kernel. Bad, bad....
119 * 120 *
@@ -158,6 +159,7 @@ int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
158 if (tz) { 159 if (tz) {
159 /* SMP safe, global irq locking makes it work. */ 160 /* SMP safe, global irq locking makes it work. */
160 sys_tz = *tz; 161 sys_tz = *tz;
162 update_vsyscall_tz();
161 if (firsttime) { 163 if (firsttime) {
162 firsttime = 0; 164 firsttime = 0;
163 if (!tv) 165 if (!tv)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 51b6a6a6158c..c8a9d13874df 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -207,15 +207,12 @@ static inline void clocksource_resume_watchdog(void) { }
207 */ 207 */
208void clocksource_resume(void) 208void clocksource_resume(void)
209{ 209{
210 struct list_head *tmp; 210 struct clocksource *cs;
211 unsigned long flags; 211 unsigned long flags;
212 212
213 spin_lock_irqsave(&clocksource_lock, flags); 213 spin_lock_irqsave(&clocksource_lock, flags);
214 214
215 list_for_each(tmp, &clocksource_list) { 215 list_for_each_entry(cs, &clocksource_list, list) {
216 struct clocksource *cs;
217
218 cs = list_entry(tmp, struct clocksource, list);
219 if (cs->resume) 216 if (cs->resume)
220 cs->resume(); 217 cs->resume();
221 } 218 }
@@ -369,7 +366,6 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
369 const char *buf, size_t count) 366 const char *buf, size_t count)
370{ 367{
371 struct clocksource *ovr = NULL; 368 struct clocksource *ovr = NULL;
372 struct list_head *tmp;
373 size_t ret = count; 369 size_t ret = count;
374 int len; 370 int len;
375 371
@@ -389,12 +385,11 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
389 385
390 len = strlen(override_name); 386 len = strlen(override_name);
391 if (len) { 387 if (len) {
388 struct clocksource *cs;
389
392 ovr = clocksource_override; 390 ovr = clocksource_override;
393 /* try to select it: */ 391 /* try to select it: */
394 list_for_each(tmp, &clocksource_list) { 392 list_for_each_entry(cs, &clocksource_list, list) {
395 struct clocksource *cs;
396
397 cs = list_entry(tmp, struct clocksource, list);
398 if (strlen(cs->name) == len && 393 if (strlen(cs->name) == len &&
399 !strcmp(cs->name, override_name)) 394 !strcmp(cs->name, override_name))
400 ovr = cs; 395 ovr = cs;
@@ -422,14 +417,11 @@ static ssize_t sysfs_override_clocksource(struct sys_device *dev,
422static ssize_t 417static ssize_t
423sysfs_show_available_clocksources(struct sys_device *dev, char *buf) 418sysfs_show_available_clocksources(struct sys_device *dev, char *buf)
424{ 419{
425 struct list_head *tmp; 420 struct clocksource *src;
426 char *curr = buf; 421 char *curr = buf;
427 422
428 spin_lock_irq(&clocksource_lock); 423 spin_lock_irq(&clocksource_lock);
429 list_for_each(tmp, &clocksource_list) { 424 list_for_each_entry(src, &clocksource_list, list) {
430 struct clocksource *src;
431
432 src = list_entry(tmp, struct clocksource, list);
433 curr += sprintf(curr, "%s ", src->name); 425 curr += sprintf(curr, "%s ", src->name);
434 } 426 }
435 spin_unlock_irq(&clocksource_lock); 427 spin_unlock_irq(&clocksource_lock);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index ce89ffb474d0..10a1347597fd 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -153,6 +153,7 @@ void tick_nohz_stop_sched_tick(void)
153 unsigned long seq, last_jiffies, next_jiffies, delta_jiffies, flags; 153 unsigned long seq, last_jiffies, next_jiffies, delta_jiffies, flags;
154 struct tick_sched *ts; 154 struct tick_sched *ts;
155 ktime_t last_update, expires, now, delta; 155 ktime_t last_update, expires, now, delta;
156 struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;
156 int cpu; 157 int cpu;
157 158
158 local_irq_save(flags); 159 local_irq_save(flags);
@@ -302,11 +303,26 @@ void tick_nohz_stop_sched_tick(void)
302out: 303out:
303 ts->next_jiffies = next_jiffies; 304 ts->next_jiffies = next_jiffies;
304 ts->last_jiffies = last_jiffies; 305 ts->last_jiffies = last_jiffies;
306 ts->sleep_length = ktime_sub(dev->next_event, now);
305end: 307end:
306 local_irq_restore(flags); 308 local_irq_restore(flags);
307} 309}
308 310
309/** 311/**
312 * tick_nohz_get_sleep_length - return the length of the current sleep
313 *
314 * Called from power state control code with interrupts disabled
315 */
316ktime_t tick_nohz_get_sleep_length(void)
317{
318 struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
319
320 return ts->sleep_length;
321}
322
323EXPORT_SYMBOL_GPL(tick_nohz_get_sleep_length);
324
325/**
310 * nohz_restart_sched_tick - restart the idle tick from the idle task 326 * nohz_restart_sched_tick - restart the idle tick from the idle task
311 * 327 *
312 * Restart the idle tick when the CPU is woken up from idle 328 * Restart the idle tick when the CPU is woken up from idle
diff --git a/kernel/timer.c b/kernel/timer.c
index 6ce1952eea7d..fb4e67d5dd60 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -26,6 +26,7 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/swap.h> 28#include <linux/swap.h>
29#include <linux/pid_namespace.h>
29#include <linux/notifier.h> 30#include <linux/notifier.h>
30#include <linux/thread_info.h> 31#include <linux/thread_info.h>
31#include <linux/time.h> 32#include <linux/time.h>
@@ -817,7 +818,7 @@ unsigned long next_timer_interrupt(void)
817#endif 818#endif
818 819
819/* 820/*
820 * Called from the timer interrupt handler to charge one tick to the current 821 * Called from the timer interrupt handler to charge one tick to the current
821 * process. user_tick is 1 if the tick is user time, 0 for system. 822 * process. user_tick is 1 if the tick is user time, 0 for system.
822 */ 823 */
823void update_process_times(int user_tick) 824void update_process_times(int user_tick)
@@ -826,10 +827,13 @@ void update_process_times(int user_tick)
826 int cpu = smp_processor_id(); 827 int cpu = smp_processor_id();
827 828
828 /* Note: this timer irq context must be accounted for as well. */ 829 /* Note: this timer irq context must be accounted for as well. */
829 if (user_tick) 830 if (user_tick) {
830 account_user_time(p, jiffies_to_cputime(1)); 831 account_user_time(p, jiffies_to_cputime(1));
831 else 832 account_user_time_scaled(p, jiffies_to_cputime(1));
833 } else {
832 account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1)); 834 account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
835 account_system_time_scaled(p, jiffies_to_cputime(1));
836 }
833 run_local_timers(); 837 run_local_timers();
834 if (rcu_pending(cpu)) 838 if (rcu_pending(cpu))
835 rcu_check_callbacks(cpu, user_tick); 839 rcu_check_callbacks(cpu, user_tick);
@@ -953,7 +957,7 @@ asmlinkage unsigned long sys_alarm(unsigned int seconds)
953 */ 957 */
954asmlinkage long sys_getpid(void) 958asmlinkage long sys_getpid(void)
955{ 959{
956 return current->tgid; 960 return task_tgid_vnr(current);
957} 961}
958 962
959/* 963/*
@@ -967,7 +971,7 @@ asmlinkage long sys_getppid(void)
967 int pid; 971 int pid;
968 972
969 rcu_read_lock(); 973 rcu_read_lock();
970 pid = rcu_dereference(current->real_parent)->tgid; 974 pid = task_ppid_nr_ns(current, current->nsproxy->pid_ns);
971 rcu_read_unlock(); 975 rcu_read_unlock();
972 976
973 return pid; 977 return pid;
@@ -1099,7 +1103,7 @@ EXPORT_SYMBOL(schedule_timeout_uninterruptible);
1099/* Thread ID - the internal kernel "pid" */ 1103/* Thread ID - the internal kernel "pid" */
1100asmlinkage long sys_gettid(void) 1104asmlinkage long sys_gettid(void)
1101{ 1105{
1102 return current->pid; 1106 return task_pid_vnr(current);
1103} 1107}
1104 1108
1105/** 1109/**
diff --git a/kernel/tsacct.c b/kernel/tsacct.c
index c122131a122f..4ab1b584961b 100644
--- a/kernel/tsacct.c
+++ b/kernel/tsacct.c
@@ -62,6 +62,10 @@ void bacct_add_tsk(struct taskstats *stats, struct task_struct *tsk)
62 rcu_read_unlock(); 62 rcu_read_unlock();
63 stats->ac_utime = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC; 63 stats->ac_utime = cputime_to_msecs(tsk->utime) * USEC_PER_MSEC;
64 stats->ac_stime = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC; 64 stats->ac_stime = cputime_to_msecs(tsk->stime) * USEC_PER_MSEC;
65 stats->ac_utimescaled =
66 cputime_to_msecs(tsk->utimescaled) * USEC_PER_MSEC;
67 stats->ac_stimescaled =
68 cputime_to_msecs(tsk->stimescaled) * USEC_PER_MSEC;
65 stats->ac_minflt = tsk->min_flt; 69 stats->ac_minflt = tsk->min_flt;
66 stats->ac_majflt = tsk->maj_flt; 70 stats->ac_majflt = tsk->maj_flt;
67 71
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index e080d1d744cc..52d5e7c9a8e6 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -32,6 +32,7 @@
32#include <linux/freezer.h> 32#include <linux/freezer.h>
33#include <linux/kallsyms.h> 33#include <linux/kallsyms.h>
34#include <linux/debug_locks.h> 34#include <linux/debug_locks.h>
35#include <linux/lockdep.h>
35 36
36/* 37/*
37 * The per-CPU workqueue (if single thread, we always use the first 38 * The per-CPU workqueue (if single thread, we always use the first
@@ -61,6 +62,9 @@ struct workqueue_struct {
61 const char *name; 62 const char *name;
62 int singlethread; 63 int singlethread;
63 int freezeable; /* Freeze threads during suspend */ 64 int freezeable; /* Freeze threads during suspend */
65#ifdef CONFIG_LOCKDEP
66 struct lockdep_map lockdep_map;
67#endif
64}; 68};
65 69
66/* All the per-cpu workqueues on the system, for hotplug cpu to add/remove 70/* All the per-cpu workqueues on the system, for hotplug cpu to add/remove
@@ -250,6 +254,17 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq)
250 struct work_struct *work = list_entry(cwq->worklist.next, 254 struct work_struct *work = list_entry(cwq->worklist.next,
251 struct work_struct, entry); 255 struct work_struct, entry);
252 work_func_t f = work->func; 256 work_func_t f = work->func;
257#ifdef CONFIG_LOCKDEP
258 /*
259 * It is permissible to free the struct work_struct
260 * from inside the function that is called from it,
261 * this we need to take into account for lockdep too.
262 * To avoid bogus "held lock freed" warnings as well
263 * as problems when looking into work->lockdep_map,
264 * make a copy and use that here.
265 */
266 struct lockdep_map lockdep_map = work->lockdep_map;
267#endif
253 268
254 cwq->current_work = work; 269 cwq->current_work = work;
255 list_del_init(cwq->worklist.next); 270 list_del_init(cwq->worklist.next);
@@ -257,13 +272,17 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq)
257 272
258 BUG_ON(get_wq_data(work) != cwq); 273 BUG_ON(get_wq_data(work) != cwq);
259 work_clear_pending(work); 274 work_clear_pending(work);
275 lock_acquire(&cwq->wq->lockdep_map, 0, 0, 0, 2, _THIS_IP_);
276 lock_acquire(&lockdep_map, 0, 0, 0, 2, _THIS_IP_);
260 f(work); 277 f(work);
278 lock_release(&lockdep_map, 1, _THIS_IP_);
279 lock_release(&cwq->wq->lockdep_map, 1, _THIS_IP_);
261 280
262 if (unlikely(in_atomic() || lockdep_depth(current) > 0)) { 281 if (unlikely(in_atomic() || lockdep_depth(current) > 0)) {
263 printk(KERN_ERR "BUG: workqueue leaked lock or atomic: " 282 printk(KERN_ERR "BUG: workqueue leaked lock or atomic: "
264 "%s/0x%08x/%d\n", 283 "%s/0x%08x/%d\n",
265 current->comm, preempt_count(), 284 current->comm, preempt_count(),
266 current->pid); 285 task_pid_nr(current));
267 printk(KERN_ERR " last function: "); 286 printk(KERN_ERR " last function: ");
268 print_symbol("%s\n", (unsigned long)f); 287 print_symbol("%s\n", (unsigned long)f);
269 debug_show_held_locks(current); 288 debug_show_held_locks(current);
@@ -376,6 +395,8 @@ void fastcall flush_workqueue(struct workqueue_struct *wq)
376 int cpu; 395 int cpu;
377 396
378 might_sleep(); 397 might_sleep();
398 lock_acquire(&wq->lockdep_map, 0, 0, 0, 2, _THIS_IP_);
399 lock_release(&wq->lockdep_map, 1, _THIS_IP_);
379 for_each_cpu_mask(cpu, *cpu_map) 400 for_each_cpu_mask(cpu, *cpu_map)
380 flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu)); 401 flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu));
381} 402}
@@ -446,6 +467,9 @@ static void wait_on_work(struct work_struct *work)
446 467
447 might_sleep(); 468 might_sleep();
448 469
470 lock_acquire(&work->lockdep_map, 0, 0, 0, 2, _THIS_IP_);
471 lock_release(&work->lockdep_map, 1, _THIS_IP_);
472
449 cwq = get_wq_data(work); 473 cwq = get_wq_data(work);
450 if (!cwq) 474 if (!cwq)
451 return; 475 return;
@@ -695,8 +719,10 @@ static void start_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
695 } 719 }
696} 720}
697 721
698struct workqueue_struct *__create_workqueue(const char *name, 722struct workqueue_struct *__create_workqueue_key(const char *name,
699 int singlethread, int freezeable) 723 int singlethread,
724 int freezeable,
725 struct lock_class_key *key)
700{ 726{
701 struct workqueue_struct *wq; 727 struct workqueue_struct *wq;
702 struct cpu_workqueue_struct *cwq; 728 struct cpu_workqueue_struct *cwq;
@@ -713,6 +739,7 @@ struct workqueue_struct *__create_workqueue(const char *name,
713 } 739 }
714 740
715 wq->name = name; 741 wq->name = name;
742 lockdep_init_map(&wq->lockdep_map, name, key, 0);
716 wq->singlethread = singlethread; 743 wq->singlethread = singlethread;
717 wq->freezeable = freezeable; 744 wq->freezeable = freezeable;
718 INIT_LIST_HEAD(&wq->list); 745 INIT_LIST_HEAD(&wq->list);
@@ -741,7 +768,7 @@ struct workqueue_struct *__create_workqueue(const char *name,
741 } 768 }
742 return wq; 769 return wq;
743} 770}
744EXPORT_SYMBOL_GPL(__create_workqueue); 771EXPORT_SYMBOL_GPL(__create_workqueue_key);
745 772
746static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu) 773static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
747{ 774{
@@ -752,6 +779,9 @@ static void cleanup_workqueue_thread(struct cpu_workqueue_struct *cwq, int cpu)
752 if (cwq->thread == NULL) 779 if (cwq->thread == NULL)
753 return; 780 return;
754 781
782 lock_acquire(&cwq->wq->lockdep_map, 0, 0, 0, 2, _THIS_IP_);
783 lock_release(&cwq->wq->lockdep_map, 1, _THIS_IP_);
784
755 flush_cpu_workqueue(cwq); 785 flush_cpu_workqueue(cwq);
756 /* 786 /*
757 * If the caller is CPU_DEAD and cwq->worklist was not empty, 787 * If the caller is CPU_DEAD and cwq->worklist was not empty,
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 7d16e6433302..c567f219191d 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -498,3 +498,5 @@ config FAULT_INJECTION_STACKTRACE_FILTER
498 select FRAME_POINTER 498 select FRAME_POINTER
499 help 499 help
500 Provide stacktrace filter for fault-injection capabilities 500 Provide stacktrace filter for fault-injection capabilities
501
502source "samples/Kconfig"
diff --git a/lib/Makefile b/lib/Makefile
index c5f215d509d3..3a0983b77412 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -6,7 +6,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
6 rbtree.o radix-tree.o dump_stack.o \ 6 rbtree.o radix-tree.o dump_stack.o \
7 idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \ 7 idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \
8 sha1.o irq_regs.o reciprocal_div.o argv_split.o \ 8 sha1.o irq_regs.o reciprocal_div.o argv_split.o \
9 proportions.o 9 proportions.o prio_heap.o
10 10
11lib-$(CONFIG_MMU) += ioremap.o 11lib-$(CONFIG_MMU) += ioremap.o
12lib-$(CONFIG_SMP) += cpumask.o 12lib-$(CONFIG_SMP) += cpumask.o
diff --git a/lib/argv_split.c b/lib/argv_split.c
index fad6ce4f7b57..5205a8dae5bc 100644
--- a/lib/argv_split.c
+++ b/lib/argv_split.c
@@ -4,7 +4,8 @@
4 4
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/ctype.h> 6#include <linux/ctype.h>
7#include <linux/bug.h> 7#include <linux/slab.h>
8#include <linux/module.h>
8 9
9static const char *skip_sep(const char *cp) 10static const char *skip_sep(const char *cp)
10{ 11{
diff --git a/lib/crc32.c b/lib/crc32.c
index bfc33314c720..d2c2f257bedd 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -49,7 +49,7 @@ MODULE_LICENSE("GPL");
49 * @p: pointer to buffer over which CRC is run 49 * @p: pointer to buffer over which CRC is run
50 * @len: length of buffer @p 50 * @len: length of buffer @p
51 */ 51 */
52u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len); 52u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len);
53 53
54#if CRC_LE_BITS == 1 54#if CRC_LE_BITS == 1
55/* 55/*
@@ -57,7 +57,7 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len);
57 * simplified by inlining the table in ?: form. 57 * simplified by inlining the table in ?: form.
58 */ 58 */
59 59
60u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len) 60u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
61{ 61{
62 int i; 62 int i;
63 while (len--) { 63 while (len--) {
@@ -69,7 +69,7 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
69} 69}
70#else /* Table-based approach */ 70#else /* Table-based approach */
71 71
72u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len) 72u32 __pure crc32_le(u32 crc, unsigned char const *p, size_t len)
73{ 73{
74# if CRC_LE_BITS == 8 74# if CRC_LE_BITS == 8
75 const u32 *b =(u32 *)p; 75 const u32 *b =(u32 *)p;
@@ -145,7 +145,7 @@ u32 __attribute_pure__ crc32_le(u32 crc, unsigned char const *p, size_t len)
145 * @p: pointer to buffer over which CRC is run 145 * @p: pointer to buffer over which CRC is run
146 * @len: length of buffer @p 146 * @len: length of buffer @p
147 */ 147 */
148u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len); 148u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len);
149 149
150#if CRC_BE_BITS == 1 150#if CRC_BE_BITS == 1
151/* 151/*
@@ -153,7 +153,7 @@ u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len);
153 * simplified by inlining the table in ?: form. 153 * simplified by inlining the table in ?: form.
154 */ 154 */
155 155
156u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len) 156u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
157{ 157{
158 int i; 158 int i;
159 while (len--) { 159 while (len--) {
@@ -167,7 +167,7 @@ u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len)
167} 167}
168 168
169#else /* Table-based approach */ 169#else /* Table-based approach */
170u32 __attribute_pure__ crc32_be(u32 crc, unsigned char const *p, size_t len) 170u32 __pure crc32_be(u32 crc, unsigned char const *p, size_t len)
171{ 171{
172# if CRC_BE_BITS == 8 172# if CRC_BE_BITS == 8
173 const u32 *b =(u32 *)p; 173 const u32 *b =(u32 *)p;
diff --git a/lib/hweight.c b/lib/hweight.c
index 360556a7803d..389424ecb129 100644
--- a/lib/hweight.c
+++ b/lib/hweight.c
@@ -1,6 +1,6 @@
1#include <linux/module.h> 1#include <linux/module.h>
2#include <linux/bitops.h>
2#include <asm/types.h> 3#include <asm/types.h>
3#include <asm/bitops.h>
4 4
5/** 5/**
6 * hweightN - returns the hamming weight of a N-bit word 6 * hweightN - returns the hamming weight of a N-bit word
diff --git a/lib/kernel_lock.c b/lib/kernel_lock.c
index e0fdfddb406e..f73e2f8c308f 100644
--- a/lib/kernel_lock.c
+++ b/lib/kernel_lock.c
@@ -2,7 +2,7 @@
2 * lib/kernel_lock.c 2 * lib/kernel_lock.c
3 * 3 *
4 * This is the traditional BKL - big kernel lock. Largely 4 * This is the traditional BKL - big kernel lock. Largely
5 * relegated to obsolescense, but used by various less 5 * relegated to obsolescence, but used by various less
6 * important (or lazy) subsystems. 6 * important (or lazy) subsystems.
7 */ 7 */
8#include <linux/smp_lock.h> 8#include <linux/smp_lock.h>
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 2e4eae5b0824..5886147252d0 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -126,7 +126,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
126 else 126 else
127 subsystem = kobject_name(&kset->kobj); 127 subsystem = kobject_name(&kset->kobj);
128 if (!subsystem) { 128 if (!subsystem) {
129 pr_debug("unset subsytem caused the event to drop!\n"); 129 pr_debug("unset subsystem caused the event to drop!\n");
130 return 0; 130 return 0;
131 } 131 }
132 132
diff --git a/lib/libcrc32c.c b/lib/libcrc32c.c
index 60f46803af3f..802f11f0bf5b 100644
--- a/lib/libcrc32c.c
+++ b/lib/libcrc32c.c
@@ -66,7 +66,7 @@ EXPORT_SYMBOL(crc32c_le);
66 * loop below with crc32 and vary the POLY if we don't find value in terms 66 * loop below with crc32 and vary the POLY if we don't find value in terms
67 * of space and maintainability in keeping the two modules separate. 67 * of space and maintainability in keeping the two modules separate.
68 */ 68 */
69u32 __attribute_pure__ 69u32 __pure
70crc32c_le(u32 crc, unsigned char const *p, size_t len) 70crc32c_le(u32 crc, unsigned char const *p, size_t len)
71{ 71{
72 int i; 72 int i;
@@ -160,7 +160,7 @@ static const u32 crc32c_table[256] = {
160 * crc using table. 160 * crc using table.
161 */ 161 */
162 162
163u32 __attribute_pure__ 163u32 __pure
164crc32c_le(u32 seed, unsigned char const *data, size_t length) 164crc32c_le(u32 seed, unsigned char const *data, size_t length)
165{ 165{
166 u32 crc = __cpu_to_le32(seed); 166 u32 crc = __cpu_to_le32(seed);
@@ -177,7 +177,7 @@ crc32c_le(u32 seed, unsigned char const *data, size_t length)
177EXPORT_SYMBOL(crc32c_be); 177EXPORT_SYMBOL(crc32c_be);
178 178
179#if CRC_BE_BITS == 1 179#if CRC_BE_BITS == 1
180u32 __attribute_pure__ 180u32 __pure
181crc32c_be(u32 crc, unsigned char const *p, size_t len) 181crc32c_be(u32 crc, unsigned char const *p, size_t len)
182{ 182{
183 int i; 183 int i;
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index 9659eabffc31..393a0e915c23 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -124,12 +124,13 @@ static int __cpuinit percpu_counter_hotcpu_callback(struct notifier_block *nb,
124 mutex_lock(&percpu_counters_lock); 124 mutex_lock(&percpu_counters_lock);
125 list_for_each_entry(fbc, &percpu_counters, list) { 125 list_for_each_entry(fbc, &percpu_counters, list) {
126 s32 *pcount; 126 s32 *pcount;
127 unsigned long flags;
127 128
128 spin_lock(&fbc->lock); 129 spin_lock_irqsave(&fbc->lock, flags);
129 pcount = per_cpu_ptr(fbc->counters, cpu); 130 pcount = per_cpu_ptr(fbc->counters, cpu);
130 fbc->count += *pcount; 131 fbc->count += *pcount;
131 *pcount = 0; 132 *pcount = 0;
132 spin_unlock(&fbc->lock); 133 spin_unlock_irqrestore(&fbc->lock, flags);
133 } 134 }
134 mutex_unlock(&percpu_counters_lock); 135 mutex_unlock(&percpu_counters_lock);
135 return NOTIFY_OK; 136 return NOTIFY_OK;
diff --git a/lib/prio_heap.c b/lib/prio_heap.c
new file mode 100644
index 000000000000..471944a54e23
--- /dev/null
+++ b/lib/prio_heap.c
@@ -0,0 +1,70 @@
1/*
2 * Simple insertion-only static-sized priority heap containing
3 * pointers, based on CLR, chapter 7
4 */
5
6#include <linux/slab.h>
7#include <linux/prio_heap.h>
8
9int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask,
10 int (*gt)(void *, void *))
11{
12 heap->ptrs = kmalloc(size, gfp_mask);
13 if (!heap->ptrs)
14 return -ENOMEM;
15 heap->size = 0;
16 heap->max = size / sizeof(void *);
17 heap->gt = gt;
18 return 0;
19}
20
21void heap_free(struct ptr_heap *heap)
22{
23 kfree(heap->ptrs);
24}
25
26void *heap_insert(struct ptr_heap *heap, void *p)
27{
28 void *res;
29 void **ptrs = heap->ptrs;
30 int pos;
31
32 if (heap->size < heap->max) {
33 /* Heap insertion */
34 int pos = heap->size++;
35 while (pos > 0 && heap->gt(p, ptrs[(pos-1)/2])) {
36 ptrs[pos] = ptrs[(pos-1)/2];
37 pos = (pos-1)/2;
38 }
39 ptrs[pos] = p;
40 return NULL;
41 }
42
43 /* The heap is full, so something will have to be dropped */
44
45 /* If the new pointer is greater than the current max, drop it */
46 if (heap->gt(p, ptrs[0]))
47 return p;
48
49 /* Replace the current max and heapify */
50 res = ptrs[0];
51 ptrs[0] = p;
52 pos = 0;
53
54 while (1) {
55 int left = 2 * pos + 1;
56 int right = 2 * pos + 2;
57 int largest = pos;
58 if (left < heap->size && heap->gt(ptrs[left], p))
59 largest = left;
60 if (right < heap->size && heap->gt(ptrs[right], ptrs[largest]))
61 largest = right;
62 if (largest == pos)
63 break;
64 /* Push p down the heap one level and bump one up */
65 ptrs[pos] = ptrs[largest];
66 ptrs[largest] = p;
67 pos = largest;
68 }
69 return res;
70}
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c
index 479fd462eaa9..9c4b0256490b 100644
--- a/lib/spinlock_debug.c
+++ b/lib/spinlock_debug.c
@@ -60,12 +60,12 @@ static void spin_bug(spinlock_t *lock, const char *msg)
60 owner = lock->owner; 60 owner = lock->owner;
61 printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n", 61 printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
62 msg, raw_smp_processor_id(), 62 msg, raw_smp_processor_id(),
63 current->comm, current->pid); 63 current->comm, task_pid_nr(current));
64 printk(KERN_EMERG " lock: %p, .magic: %08x, .owner: %s/%d, " 64 printk(KERN_EMERG " lock: %p, .magic: %08x, .owner: %s/%d, "
65 ".owner_cpu: %d\n", 65 ".owner_cpu: %d\n",
66 lock, lock->magic, 66 lock, lock->magic,
67 owner ? owner->comm : "<none>", 67 owner ? owner->comm : "<none>",
68 owner ? owner->pid : -1, 68 owner ? task_pid_nr(owner) : -1,
69 lock->owner_cpu); 69 lock->owner_cpu);
70 dump_stack(); 70 dump_stack();
71} 71}
@@ -116,7 +116,7 @@ static void __spin_lock_debug(spinlock_t *lock)
116 printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, " 116 printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
117 "%s/%d, %p\n", 117 "%s/%d, %p\n",
118 raw_smp_processor_id(), current->comm, 118 raw_smp_processor_id(), current->comm,
119 current->pid, lock); 119 task_pid_nr(current), lock);
120 dump_stack(); 120 dump_stack();
121#ifdef CONFIG_SMP 121#ifdef CONFIG_SMP
122 trigger_all_cpu_backtrace(); 122 trigger_all_cpu_backtrace();
@@ -161,7 +161,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
161 161
162 printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n", 162 printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n",
163 msg, raw_smp_processor_id(), current->comm, 163 msg, raw_smp_processor_id(), current->comm,
164 current->pid, lock); 164 task_pid_nr(current), lock);
165 dump_stack(); 165 dump_stack();
166} 166}
167 167
diff --git a/mm/Kconfig b/mm/Kconfig
index b1f03b0eb7f1..c070ec0c15bf 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -37,7 +37,7 @@ config DISCONTIGMEM_MANUAL
37 in their physical address spaces, and this option provides 37 in their physical address spaces, and this option provides
38 more efficient handling of these holes. However, the vast 38 more efficient handling of these holes. However, the vast
39 majority of hardware has quite flat address spaces, and 39 majority of hardware has quite flat address spaces, and
40 can have degraded performance from extra overhead that 40 can have degraded performance from the extra overhead that
41 this option imposes. 41 this option imposes.
42 42
43 Many NUMA configurations will have this as the only option. 43 Many NUMA configurations will have this as the only option.
diff --git a/mm/filemap.c b/mm/filemap.c
index 79f24a969cb4..5209e47b7fe3 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -25,6 +25,7 @@
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/hash.h> 26#include <linux/hash.h>
27#include <linux/writeback.h> 27#include <linux/writeback.h>
28#include <linux/backing-dev.h>
28#include <linux/pagevec.h> 29#include <linux/pagevec.h>
29#include <linux/blkdev.h> 30#include <linux/blkdev.h>
30#include <linux/security.h> 31#include <linux/security.h>
@@ -840,7 +841,7 @@ static void shrink_readahead_size_eio(struct file *filp,
840/** 841/**
841 * do_generic_mapping_read - generic file read routine 842 * do_generic_mapping_read - generic file read routine
842 * @mapping: address_space to be read 843 * @mapping: address_space to be read
843 * @_ra: file's readahead state 844 * @ra: file's readahead state
844 * @filp: the file to read 845 * @filp: the file to read
845 * @ppos: current file position 846 * @ppos: current file position
846 * @desc: read_descriptor 847 * @desc: read_descriptor
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ae2959bb59cb..8b809ecefa39 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1017,10 +1017,10 @@ static long region_chg(struct list_head *head, long f, long t)
1017 1017
1018 /* If we are below the current region then a new region is required. 1018 /* If we are below the current region then a new region is required.
1019 * Subtle, allocate a new region at the position but make it zero 1019 * Subtle, allocate a new region at the position but make it zero
1020 * size such that we can guarentee to record the reservation. */ 1020 * size such that we can guarantee to record the reservation. */
1021 if (&rg->link == head || t < rg->from) { 1021 if (&rg->link == head || t < rg->from) {
1022 nrg = kmalloc(sizeof(*nrg), GFP_KERNEL); 1022 nrg = kmalloc(sizeof(*nrg), GFP_KERNEL);
1023 if (nrg == 0) 1023 if (!nrg)
1024 return -ENOMEM; 1024 return -ENOMEM;
1025 nrg->from = f; 1025 nrg->from = f;
1026 nrg->to = f; 1026 nrg->to = f;
diff --git a/mm/memory.c b/mm/memory.c
index bd16dcaeefb8..eefd5b68bc42 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -259,9 +259,6 @@ void free_pgd_range(struct mmu_gather **tlb,
259 continue; 259 continue;
260 free_pud_range(*tlb, pgd, addr, next, floor, ceiling); 260 free_pud_range(*tlb, pgd, addr, next, floor, ceiling);
261 } while (pgd++, addr = next, addr != end); 261 } while (pgd++, addr = next, addr != end);
262
263 if (!(*tlb)->fullmm)
264 flush_tlb_pgtables((*tlb)->mm, start, end);
265} 262}
266 263
267void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *vma, 264void free_pgtables(struct mmu_gather **tlb, struct vm_area_struct *vma,
@@ -2716,7 +2713,7 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
2716 return 0; 2713 return 0;
2717 2714
2718 down_read(&mm->mmap_sem); 2715 down_read(&mm->mmap_sem);
2719 /* ignore errors, just check how much was sucessfully transfered */ 2716 /* ignore errors, just check how much was successfully transferred */
2720 while (len) { 2717 while (len) {
2721 int bytes, ret, offset; 2718 int bytes, ret, offset;
2722 void *maddr; 2719 void *maddr;
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 091b9c6c2529..1833879f8438 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -121,7 +121,7 @@ int __add_pages(struct zone *zone, unsigned long phys_start_pfn,
121 err = __add_section(zone, i << PFN_SECTION_SHIFT); 121 err = __add_section(zone, i << PFN_SECTION_SHIFT);
122 122
123 /* 123 /*
124 * EEXIST is finally dealed with by ioresource collision 124 * EEXIST is finally dealt with by ioresource collision
125 * check. see add_memory() => register_memory_resource() 125 * check. see add_memory() => register_memory_resource()
126 * Warning will be printed if there is collision. 126 * Warning will be printed if there is collision.
127 */ 127 */
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 568152ae6caf..c1592a94582f 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -78,6 +78,7 @@
78#include <linux/slab.h> 78#include <linux/slab.h>
79#include <linux/string.h> 79#include <linux/string.h>
80#include <linux/module.h> 80#include <linux/module.h>
81#include <linux/nsproxy.h>
81#include <linux/interrupt.h> 82#include <linux/interrupt.h>
82#include <linux/init.h> 83#include <linux/init.h>
83#include <linux/compat.h> 84#include <linux/compat.h>
@@ -940,7 +941,7 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
940 941
941 /* Find the mm_struct */ 942 /* Find the mm_struct */
942 read_lock(&tasklist_lock); 943 read_lock(&tasklist_lock);
943 task = pid ? find_task_by_pid(pid) : current; 944 task = pid ? find_task_by_vpid(pid) : current;
944 if (!task) { 945 if (!task) {
945 read_unlock(&tasklist_lock); 946 read_unlock(&tasklist_lock);
946 return -ESRCH; 947 return -ESRCH;
@@ -1388,7 +1389,6 @@ EXPORT_SYMBOL(alloc_pages_current);
1388 * keeps mempolicies cpuset relative after its cpuset moves. See 1389 * keeps mempolicies cpuset relative after its cpuset moves. See
1389 * further kernel/cpuset.c update_nodemask(). 1390 * further kernel/cpuset.c update_nodemask().
1390 */ 1391 */
1391void *cpuset_being_rebound;
1392 1392
1393/* Slow path of a mempolicy copy */ 1393/* Slow path of a mempolicy copy */
1394struct mempolicy *__mpol_copy(struct mempolicy *old) 1394struct mempolicy *__mpol_copy(struct mempolicy *old)
@@ -2019,4 +2019,3 @@ out:
2019 m->version = (vma != priv->tail_vma) ? vma->vm_start : 0; 2019 m->version = (vma != priv->tail_vma) ? vma->vm_start : 0;
2020 return 0; 2020 return 0;
2021} 2021}
2022
diff --git a/mm/mempool.c b/mm/mempool.c
index 02d5ec3feabc..a46eb1b4bb66 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -299,7 +299,7 @@ EXPORT_SYMBOL(mempool_free_slab);
299 299
300/* 300/*
301 * A commonly used alloc and free fn that kmalloc/kfrees the amount of memory 301 * A commonly used alloc and free fn that kmalloc/kfrees the amount of memory
302 * specfied by pool_data 302 * specified by pool_data
303 */ 303 */
304void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data) 304void *mempool_kmalloc(gfp_t gfp_mask, void *pool_data)
305{ 305{
diff --git a/mm/migrate.c b/mm/migrate.c
index 06d0877a66ef..6a207e8d17ea 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -19,6 +19,7 @@
19#include <linux/pagemap.h> 19#include <linux/pagemap.h>
20#include <linux/buffer_head.h> 20#include <linux/buffer_head.h>
21#include <linux/mm_inline.h> 21#include <linux/mm_inline.h>
22#include <linux/nsproxy.h>
22#include <linux/pagevec.h> 23#include <linux/pagevec.h>
23#include <linux/rmap.h> 24#include <linux/rmap.h>
24#include <linux/topology.h> 25#include <linux/topology.h>
@@ -705,7 +706,7 @@ move_newpage:
705 * The function returns after 10 attempts or if no pages 706 * The function returns after 10 attempts or if no pages
706 * are movable anymore because to has become empty 707 * are movable anymore because to has become empty
707 * or no retryable pages exist anymore. All pages will be 708 * or no retryable pages exist anymore. All pages will be
708 * retruned to the LRU or freed. 709 * returned to the LRU or freed.
709 * 710 *
710 * Return: Number of pages not migrated or error code. 711 * Return: Number of pages not migrated or error code.
711 */ 712 */
@@ -924,7 +925,7 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
924 925
925 /* Find the mm_struct */ 926 /* Find the mm_struct */
926 read_lock(&tasklist_lock); 927 read_lock(&tasklist_lock);
927 task = pid ? find_task_by_pid(pid) : current; 928 task = pid ? find_task_by_vpid(pid) : current;
928 if (!task) { 929 if (!task) {
929 read_unlock(&tasklist_lock); 930 read_unlock(&tasklist_lock);
930 return -ESRCH; 931 return -ESRCH;
diff --git a/mm/mmap.c b/mm/mmap.c
index 4275e81e25ba..7a30c4988231 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1048,8 +1048,7 @@ int vma_wants_writenotify(struct vm_area_struct *vma)
1048 1048
1049 /* The open routine did something to the protections already? */ 1049 /* The open routine did something to the protections already? */
1050 if (pgprot_val(vma->vm_page_prot) != 1050 if (pgprot_val(vma->vm_page_prot) !=
1051 pgprot_val(protection_map[vm_flags & 1051 pgprot_val(vm_get_page_prot(vm_flags)))
1052 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
1053 return 0; 1052 return 0;
1054 1053
1055 /* Specialty mapping? */ 1054 /* Specialty mapping? */
@@ -1130,8 +1129,7 @@ munmap_back:
1130 vma->vm_start = addr; 1129 vma->vm_start = addr;
1131 vma->vm_end = addr + len; 1130 vma->vm_end = addr + len;
1132 vma->vm_flags = vm_flags; 1131 vma->vm_flags = vm_flags;
1133 vma->vm_page_prot = protection_map[vm_flags & 1132 vma->vm_page_prot = vm_get_page_prot(vm_flags);
1134 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
1135 vma->vm_pgoff = pgoff; 1133 vma->vm_pgoff = pgoff;
1136 1134
1137 if (file) { 1135 if (file) {
@@ -2002,8 +2000,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
2002 vma->vm_end = addr + len; 2000 vma->vm_end = addr + len;
2003 vma->vm_pgoff = pgoff; 2001 vma->vm_pgoff = pgoff;
2004 vma->vm_flags = flags; 2002 vma->vm_flags = flags;
2005 vma->vm_page_prot = protection_map[flags & 2003 vma->vm_page_prot = vm_get_page_prot(flags);
2006 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
2007 vma_link(mm, vma, prev, rb_link, rb_parent); 2004 vma_link(mm, vma, prev, rb_link, rb_parent);
2008out: 2005out:
2009 mm->total_vm += len >> PAGE_SHIFT; 2006 mm->total_vm += len >> PAGE_SHIFT;
@@ -2209,7 +2206,7 @@ int install_special_mapping(struct mm_struct *mm,
2209 vma->vm_end = addr + len; 2206 vma->vm_end = addr + len;
2210 2207
2211 vma->vm_flags = vm_flags | mm->def_flags; 2208 vma->vm_flags = vm_flags | mm->def_flags;
2212 vma->vm_page_prot = protection_map[vma->vm_flags & 7]; 2209 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
2213 2210
2214 vma->vm_ops = &special_mapping_vmops; 2211 vma->vm_ops = &special_mapping_vmops;
2215 vma->vm_private_data = pages; 2212 vma->vm_private_data = pages;
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 1d4d69790e59..55227845abbe 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -192,11 +192,9 @@ success:
192 * held in write mode. 192 * held in write mode.
193 */ 193 */
194 vma->vm_flags = newflags; 194 vma->vm_flags = newflags;
195 vma->vm_page_prot = protection_map[newflags & 195 vma->vm_page_prot = vm_get_page_prot(newflags);
196 (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)];
197 if (vma_wants_writenotify(vma)) { 196 if (vma_wants_writenotify(vma)) {
198 vma->vm_page_prot = protection_map[newflags & 197 vma->vm_page_prot = vm_get_page_prot(newflags);
199 (VM_READ|VM_WRITE|VM_EXEC)];
200 dirty_accountable = 1; 198 dirty_accountable = 1;
201 } 199 }
202 200
diff --git a/mm/mremap.c b/mm/mremap.c
index 8ea5c2412c6e..08e3c7f2bd15 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -291,7 +291,7 @@ unsigned long do_mremap(unsigned long addr,
291 if ((addr <= new_addr) && (addr+old_len) > new_addr) 291 if ((addr <= new_addr) && (addr+old_len) > new_addr)
292 goto out; 292 goto out;
293 293
294 ret = security_file_mmap(0, 0, 0, 0, new_addr, 1); 294 ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
295 if (ret) 295 if (ret)
296 goto out; 296 goto out;
297 297
@@ -399,7 +399,7 @@ unsigned long do_mremap(unsigned long addr,
399 goto out; 399 goto out;
400 } 400 }
401 401
402 ret = security_file_mmap(0, 0, 0, 0, new_addr, 1); 402 ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
403 if (ret) 403 if (ret)
404 goto out; 404 goto out;
405 } 405 }
diff --git a/mm/nommu.c b/mm/nommu.c
index 42fb84e9e815..8f09333f78e1 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -175,7 +175,8 @@ EXPORT_SYMBOL(vfree);
175void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot) 175void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
176{ 176{
177 /* 177 /*
178 * kmalloc doesn't like __GFP_HIGHMEM for some reason 178 * You can't specify __GFP_HIGHMEM with kmalloc() since kmalloc()
179 * returns only a logical address.
179 */ 180 */
180 return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM); 181 return kmalloc(size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM);
181} 182}
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index a64decb5b13f..91a081a82f55 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -212,7 +212,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
212 if (!p->mm) 212 if (!p->mm)
213 continue; 213 continue;
214 /* skip the init task */ 214 /* skip the init task */
215 if (is_init(p)) 215 if (is_global_init(p))
216 continue; 216 continue;
217 217
218 /* 218 /*
@@ -265,7 +265,7 @@ static struct task_struct *select_bad_process(unsigned long *ppoints)
265 */ 265 */
266static void __oom_kill_task(struct task_struct *p, int verbose) 266static void __oom_kill_task(struct task_struct *p, int verbose)
267{ 267{
268 if (is_init(p)) { 268 if (is_global_init(p)) {
269 WARN_ON(1); 269 WARN_ON(1);
270 printk(KERN_WARNING "tried to kill init!\n"); 270 printk(KERN_WARNING "tried to kill init!\n");
271 return; 271 return;
@@ -278,7 +278,8 @@ static void __oom_kill_task(struct task_struct *p, int verbose)
278 } 278 }
279 279
280 if (verbose) 280 if (verbose)
281 printk(KERN_ERR "Killed process %d (%s)\n", p->pid, p->comm); 281 printk(KERN_ERR "Killed process %d (%s)\n",
282 task_pid_nr(p), p->comm);
282 283
283 /* 284 /*
284 * We give our sacrificial lamb high priority and access to 285 * We give our sacrificial lamb high priority and access to
@@ -326,7 +327,7 @@ static int oom_kill_task(struct task_struct *p)
326 * to memory reserves though, otherwise we might deplete all memory. 327 * to memory reserves though, otherwise we might deplete all memory.
327 */ 328 */
328 do_each_thread(g, q) { 329 do_each_thread(g, q) {
329 if (q->mm == mm && q->tgid != p->tgid) 330 if (q->mm == mm && !same_thread_group(q, p))
330 force_sig(SIGKILL, q); 331 force_sig(SIGKILL, q);
331 } while_each_thread(g, q); 332 } while_each_thread(g, q);
332 333
@@ -337,7 +338,6 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
337 unsigned long points, const char *message) 338 unsigned long points, const char *message)
338{ 339{
339 struct task_struct *c; 340 struct task_struct *c;
340 struct list_head *tsk;
341 341
342 if (printk_ratelimit()) { 342 if (printk_ratelimit()) {
343 printk(KERN_WARNING "%s invoked oom-killer: " 343 printk(KERN_WARNING "%s invoked oom-killer: "
@@ -357,11 +357,10 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
357 } 357 }
358 358
359 printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n", 359 printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n",
360 message, p->pid, p->comm, points); 360 message, task_pid_nr(p), p->comm, points);
361 361
362 /* Try to kill a child first */ 362 /* Try to kill a child first */
363 list_for_each(tsk, &p->children) { 363 list_for_each_entry(c, &p->children, sibling) {
364 c = list_entry(tsk, struct task_struct, sibling);
365 if (c->mm == p->mm) 364 if (c->mm == p->mm)
366 continue; 365 continue;
367 if (!oom_kill_task(c)) 366 if (!oom_kill_task(c))
@@ -497,7 +496,7 @@ retry:
497 panic("Out of memory and no killable processes...\n"); 496 panic("Out of memory and no killable processes...\n");
498 } 497 }
499 498
500 if (oom_kill_process(p, points, gfp_mask, order, 499 if (oom_kill_process(p, gfp_mask, order, points,
501 "Out of memory")) 500 "Out of memory"))
502 goto retry; 501 goto retry;
503 502
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 7845462064f4..838a5e31394c 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -989,7 +989,7 @@ int __set_page_dirty_no_writeback(struct page *page)
989 * mapping is pinned by the vma's ->vm_file reference. 989 * mapping is pinned by the vma's ->vm_file reference.
990 * 990 *
991 * We take care to handle the case where the page was truncated from the 991 * We take care to handle the case where the page was truncated from the
992 * mapping by re-checking page_mapping() insode tree_lock. 992 * mapping by re-checking page_mapping() inside tree_lock.
993 */ 993 */
994int __set_page_dirty_nobuffers(struct page *page) 994int __set_page_dirty_nobuffers(struct page *page)
995{ 995{
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 43f757fcf30f..da69d833e067 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -123,7 +123,7 @@ static unsigned long __meminitdata dma_reserve;
123 123
124#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 124#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
125 /* 125 /*
126 * MAX_ACTIVE_REGIONS determines the maxmimum number of distinct 126 * MAX_ACTIVE_REGIONS determines the maximum number of distinct
127 * ranges of memory (RAM) that may be registered with add_active_range(). 127 * ranges of memory (RAM) that may be registered with add_active_range().
128 * Ranges passed to add_active_range() will be merged if possible 128 * Ranges passed to add_active_range() will be merged if possible
129 * so the number of times add_active_range() can be called is 129 * so the number of times add_active_range() can be called is
@@ -1260,7 +1260,7 @@ int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
1260 * skip over zones that are not allowed by the cpuset, or that have 1260 * skip over zones that are not allowed by the cpuset, or that have
1261 * been recently (in last second) found to be nearly full. See further 1261 * been recently (in last second) found to be nearly full. See further
1262 * comments in mmzone.h. Reduces cache footprint of zonelist scans 1262 * comments in mmzone.h. Reduces cache footprint of zonelist scans
1263 * that have to skip over alot of full or unallowed zones. 1263 * that have to skip over a lot of full or unallowed zones.
1264 * 1264 *
1265 * If the zonelist cache is present in the passed in zonelist, then 1265 * If the zonelist cache is present in the passed in zonelist, then
1266 * returns a pointer to the allowed node mask (either the current 1266 * returns a pointer to the allowed node mask (either the current
@@ -2358,7 +2358,7 @@ void build_all_zonelists(void)
2358 __build_all_zonelists(NULL); 2358 __build_all_zonelists(NULL);
2359 cpuset_init_current_mems_allowed(); 2359 cpuset_init_current_mems_allowed();
2360 } else { 2360 } else {
2361 /* we have to stop all cpus to guaranntee there is no user 2361 /* we have to stop all cpus to guarantee there is no user
2362 of zonelist */ 2362 of zonelist */
2363 stop_machine_run(__build_all_zonelists, NULL, NR_CPUS); 2363 stop_machine_run(__build_all_zonelists, NULL, NR_CPUS);
2364 /* cpuset refresh routine should be here */ 2364 /* cpuset refresh routine should be here */
@@ -2864,7 +2864,7 @@ static int __meminit first_active_region_index_in_nid(int nid)
2864 2864
2865/* 2865/*
2866 * Basic iterator support. Return the next active range of PFNs for a node 2866 * Basic iterator support. Return the next active range of PFNs for a node
2867 * Note: nid == MAX_NUMNODES returns next region regardles of node 2867 * Note: nid == MAX_NUMNODES returns next region regardless of node
2868 */ 2868 */
2869static int __meminit next_active_region_index_in_nid(int index, int nid) 2869static int __meminit next_active_region_index_in_nid(int index, int nid)
2870{ 2870{
diff --git a/mm/prio_tree.c b/mm/prio_tree.c
index b4e76c25f953..603ae98d9694 100644
--- a/mm/prio_tree.c
+++ b/mm/prio_tree.c
@@ -34,7 +34,7 @@
34 * Radix priority search tree for address_space->i_mmap 34 * Radix priority search tree for address_space->i_mmap
35 * 35 *
36 * For each vma that map a unique set of file pages i.e., unique [radix_index, 36 * For each vma that map a unique set of file pages i.e., unique [radix_index,
37 * heap_index] value, we have a corresponing priority search tree node. If 37 * heap_index] value, we have a corresponding priority search tree node. If
38 * multiple vmas have identical [radix_index, heap_index] value, then one of 38 * multiple vmas have identical [radix_index, heap_index] value, then one of
39 * them is used as a tree node and others are stored in a vm_set list. The tree 39 * them is used as a tree node and others are stored in a vm_set list. The tree
40 * node points to the first vma (head) of the list using vm_set.head. 40 * node points to the first vma (head) of the list using vm_set.head.
diff --git a/mm/slab.c b/mm/slab.c
index 3ce9bc024d67..cfa6be4e378e 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -26,7 +26,7 @@
26 * initialized objects. 26 * initialized objects.
27 * 27 *
28 * This means, that your constructor is used only for newly allocated 28 * This means, that your constructor is used only for newly allocated
29 * slabs and you must pass objects with the same intializations to 29 * slabs and you must pass objects with the same initializations to
30 * kmem_cache_free. 30 * kmem_cache_free.
31 * 31 *
32 * Each cache can only support one memory type (GFP_DMA, GFP_HIGHMEM, 32 * Each cache can only support one memory type (GFP_DMA, GFP_HIGHMEM,
@@ -1156,105 +1156,187 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
1156} 1156}
1157#endif 1157#endif
1158 1158
1159static int __cpuinit cpuup_callback(struct notifier_block *nfb, 1159static void __cpuinit cpuup_canceled(long cpu)
1160 unsigned long action, void *hcpu) 1160{
1161 struct kmem_cache *cachep;
1162 struct kmem_list3 *l3 = NULL;
1163 int node = cpu_to_node(cpu);
1164
1165 list_for_each_entry(cachep, &cache_chain, next) {
1166 struct array_cache *nc;
1167 struct array_cache *shared;
1168 struct array_cache **alien;
1169 cpumask_t mask;
1170
1171 mask = node_to_cpumask(node);
1172 /* cpu is dead; no one can alloc from it. */
1173 nc = cachep->array[cpu];
1174 cachep->array[cpu] = NULL;
1175 l3 = cachep->nodelists[node];
1176
1177 if (!l3)
1178 goto free_array_cache;
1179
1180 spin_lock_irq(&l3->list_lock);
1181
1182 /* Free limit for this kmem_list3 */
1183 l3->free_limit -= cachep->batchcount;
1184 if (nc)
1185 free_block(cachep, nc->entry, nc->avail, node);
1186
1187 if (!cpus_empty(mask)) {
1188 spin_unlock_irq(&l3->list_lock);
1189 goto free_array_cache;
1190 }
1191
1192 shared = l3->shared;
1193 if (shared) {
1194 free_block(cachep, shared->entry,
1195 shared->avail, node);
1196 l3->shared = NULL;
1197 }
1198
1199 alien = l3->alien;
1200 l3->alien = NULL;
1201
1202 spin_unlock_irq(&l3->list_lock);
1203
1204 kfree(shared);
1205 if (alien) {
1206 drain_alien_cache(cachep, alien);
1207 free_alien_cache(alien);
1208 }
1209free_array_cache:
1210 kfree(nc);
1211 }
1212 /*
1213 * In the previous loop, all the objects were freed to
1214 * the respective cache's slabs, now we can go ahead and
1215 * shrink each nodelist to its limit.
1216 */
1217 list_for_each_entry(cachep, &cache_chain, next) {
1218 l3 = cachep->nodelists[node];
1219 if (!l3)
1220 continue;
1221 drain_freelist(cachep, l3, l3->free_objects);
1222 }
1223}
1224
1225static int __cpuinit cpuup_prepare(long cpu)
1161{ 1226{
1162 long cpu = (long)hcpu;
1163 struct kmem_cache *cachep; 1227 struct kmem_cache *cachep;
1164 struct kmem_list3 *l3 = NULL; 1228 struct kmem_list3 *l3 = NULL;
1165 int node = cpu_to_node(cpu); 1229 int node = cpu_to_node(cpu);
1166 const int memsize = sizeof(struct kmem_list3); 1230 const int memsize = sizeof(struct kmem_list3);
1167 1231
1168 switch (action) { 1232 /*
1169 case CPU_LOCK_ACQUIRE: 1233 * We need to do this right in the beginning since
1170 mutex_lock(&cache_chain_mutex); 1234 * alloc_arraycache's are going to use this list.
1171 break; 1235 * kmalloc_node allows us to add the slab to the right
1172 case CPU_UP_PREPARE: 1236 * kmem_list3 and not this cpu's kmem_list3
1173 case CPU_UP_PREPARE_FROZEN: 1237 */
1238
1239 list_for_each_entry(cachep, &cache_chain, next) {
1174 /* 1240 /*
1175 * We need to do this right in the beginning since 1241 * Set up the size64 kmemlist for cpu before we can
1176 * alloc_arraycache's are going to use this list. 1242 * begin anything. Make sure some other cpu on this
1177 * kmalloc_node allows us to add the slab to the right 1243 * node has not already allocated this
1178 * kmem_list3 and not this cpu's kmem_list3
1179 */ 1244 */
1245 if (!cachep->nodelists[node]) {
1246 l3 = kmalloc_node(memsize, GFP_KERNEL, node);
1247 if (!l3)
1248 goto bad;
1249 kmem_list3_init(l3);
1250 l3->next_reap = jiffies + REAPTIMEOUT_LIST3 +
1251 ((unsigned long)cachep) % REAPTIMEOUT_LIST3;
1180 1252
1181 list_for_each_entry(cachep, &cache_chain, next) {
1182 /* 1253 /*
1183 * Set up the size64 kmemlist for cpu before we can 1254 * The l3s don't come and go as CPUs come and
1184 * begin anything. Make sure some other cpu on this 1255 * go. cache_chain_mutex is sufficient
1185 * node has not already allocated this 1256 * protection here.
1186 */ 1257 */
1187 if (!cachep->nodelists[node]) { 1258 cachep->nodelists[node] = l3;
1188 l3 = kmalloc_node(memsize, GFP_KERNEL, node);
1189 if (!l3)
1190 goto bad;
1191 kmem_list3_init(l3);
1192 l3->next_reap = jiffies + REAPTIMEOUT_LIST3 +
1193 ((unsigned long)cachep) % REAPTIMEOUT_LIST3;
1194
1195 /*
1196 * The l3s don't come and go as CPUs come and
1197 * go. cache_chain_mutex is sufficient
1198 * protection here.
1199 */
1200 cachep->nodelists[node] = l3;
1201 }
1202
1203 spin_lock_irq(&cachep->nodelists[node]->list_lock);
1204 cachep->nodelists[node]->free_limit =
1205 (1 + nr_cpus_node(node)) *
1206 cachep->batchcount + cachep->num;
1207 spin_unlock_irq(&cachep->nodelists[node]->list_lock);
1208 } 1259 }
1209 1260
1210 /* 1261 spin_lock_irq(&cachep->nodelists[node]->list_lock);
1211 * Now we can go ahead with allocating the shared arrays and 1262 cachep->nodelists[node]->free_limit =
1212 * array caches 1263 (1 + nr_cpus_node(node)) *
1213 */ 1264 cachep->batchcount + cachep->num;
1214 list_for_each_entry(cachep, &cache_chain, next) { 1265 spin_unlock_irq(&cachep->nodelists[node]->list_lock);
1215 struct array_cache *nc; 1266 }
1216 struct array_cache *shared = NULL; 1267
1217 struct array_cache **alien = NULL; 1268 /*
1218 1269 * Now we can go ahead with allocating the shared arrays and
1219 nc = alloc_arraycache(node, cachep->limit, 1270 * array caches
1220 cachep->batchcount); 1271 */
1221 if (!nc) 1272 list_for_each_entry(cachep, &cache_chain, next) {
1273 struct array_cache *nc;
1274 struct array_cache *shared = NULL;
1275 struct array_cache **alien = NULL;
1276
1277 nc = alloc_arraycache(node, cachep->limit,
1278 cachep->batchcount);
1279 if (!nc)
1280 goto bad;
1281 if (cachep->shared) {
1282 shared = alloc_arraycache(node,
1283 cachep->shared * cachep->batchcount,
1284 0xbaadf00d);
1285 if (!shared) {
1286 kfree(nc);
1222 goto bad; 1287 goto bad;
1223 if (cachep->shared) {
1224 shared = alloc_arraycache(node,
1225 cachep->shared * cachep->batchcount,
1226 0xbaadf00d);
1227 if (!shared)
1228 goto bad;
1229 } 1288 }
1230 if (use_alien_caches) { 1289 }
1231 alien = alloc_alien_cache(node, cachep->limit); 1290 if (use_alien_caches) {
1232 if (!alien) 1291 alien = alloc_alien_cache(node, cachep->limit);
1233 goto bad; 1292 if (!alien) {
1234 } 1293 kfree(shared);
1235 cachep->array[cpu] = nc; 1294 kfree(nc);
1236 l3 = cachep->nodelists[node]; 1295 goto bad;
1237 BUG_ON(!l3);
1238
1239 spin_lock_irq(&l3->list_lock);
1240 if (!l3->shared) {
1241 /*
1242 * We are serialised from CPU_DEAD or
1243 * CPU_UP_CANCELLED by the cpucontrol lock
1244 */
1245 l3->shared = shared;
1246 shared = NULL;
1247 } 1296 }
1297 }
1298 cachep->array[cpu] = nc;
1299 l3 = cachep->nodelists[node];
1300 BUG_ON(!l3);
1301
1302 spin_lock_irq(&l3->list_lock);
1303 if (!l3->shared) {
1304 /*
1305 * We are serialised from CPU_DEAD or
1306 * CPU_UP_CANCELLED by the cpucontrol lock
1307 */
1308 l3->shared = shared;
1309 shared = NULL;
1310 }
1248#ifdef CONFIG_NUMA 1311#ifdef CONFIG_NUMA
1249 if (!l3->alien) { 1312 if (!l3->alien) {
1250 l3->alien = alien; 1313 l3->alien = alien;
1251 alien = NULL; 1314 alien = NULL;
1252 }
1253#endif
1254 spin_unlock_irq(&l3->list_lock);
1255 kfree(shared);
1256 free_alien_cache(alien);
1257 } 1315 }
1316#endif
1317 spin_unlock_irq(&l3->list_lock);
1318 kfree(shared);
1319 free_alien_cache(alien);
1320 }
1321 return 0;
1322bad:
1323 cpuup_canceled(cpu);
1324 return -ENOMEM;
1325}
1326
1327static int __cpuinit cpuup_callback(struct notifier_block *nfb,
1328 unsigned long action, void *hcpu)
1329{
1330 long cpu = (long)hcpu;
1331 int err = 0;
1332
1333 switch (action) {
1334 case CPU_LOCK_ACQUIRE:
1335 mutex_lock(&cache_chain_mutex);
1336 break;
1337 case CPU_UP_PREPARE:
1338 case CPU_UP_PREPARE_FROZEN:
1339 err = cpuup_prepare(cpu);
1258 break; 1340 break;
1259 case CPU_ONLINE: 1341 case CPU_ONLINE:
1260 case CPU_ONLINE_FROZEN: 1342 case CPU_ONLINE_FROZEN:
@@ -1287,76 +1369,17 @@ static int __cpuinit cpuup_callback(struct notifier_block *nfb,
1287 * structure is usually allocated from kmem_cache_create() and 1369 * structure is usually allocated from kmem_cache_create() and
1288 * gets destroyed at kmem_cache_destroy(). 1370 * gets destroyed at kmem_cache_destroy().
1289 */ 1371 */
1290 /* fall thru */ 1372 /* fall through */
1291#endif 1373#endif
1292 case CPU_UP_CANCELED: 1374 case CPU_UP_CANCELED:
1293 case CPU_UP_CANCELED_FROZEN: 1375 case CPU_UP_CANCELED_FROZEN:
1294 list_for_each_entry(cachep, &cache_chain, next) { 1376 cpuup_canceled(cpu);
1295 struct array_cache *nc;
1296 struct array_cache *shared;
1297 struct array_cache **alien;
1298 cpumask_t mask;
1299
1300 mask = node_to_cpumask(node);
1301 /* cpu is dead; no one can alloc from it. */
1302 nc = cachep->array[cpu];
1303 cachep->array[cpu] = NULL;
1304 l3 = cachep->nodelists[node];
1305
1306 if (!l3)
1307 goto free_array_cache;
1308
1309 spin_lock_irq(&l3->list_lock);
1310
1311 /* Free limit for this kmem_list3 */
1312 l3->free_limit -= cachep->batchcount;
1313 if (nc)
1314 free_block(cachep, nc->entry, nc->avail, node);
1315
1316 if (!cpus_empty(mask)) {
1317 spin_unlock_irq(&l3->list_lock);
1318 goto free_array_cache;
1319 }
1320
1321 shared = l3->shared;
1322 if (shared) {
1323 free_block(cachep, shared->entry,
1324 shared->avail, node);
1325 l3->shared = NULL;
1326 }
1327
1328 alien = l3->alien;
1329 l3->alien = NULL;
1330
1331 spin_unlock_irq(&l3->list_lock);
1332
1333 kfree(shared);
1334 if (alien) {
1335 drain_alien_cache(cachep, alien);
1336 free_alien_cache(alien);
1337 }
1338free_array_cache:
1339 kfree(nc);
1340 }
1341 /*
1342 * In the previous loop, all the objects were freed to
1343 * the respective cache's slabs, now we can go ahead and
1344 * shrink each nodelist to its limit.
1345 */
1346 list_for_each_entry(cachep, &cache_chain, next) {
1347 l3 = cachep->nodelists[node];
1348 if (!l3)
1349 continue;
1350 drain_freelist(cachep, l3, l3->free_objects);
1351 }
1352 break; 1377 break;
1353 case CPU_LOCK_RELEASE: 1378 case CPU_LOCK_RELEASE:
1354 mutex_unlock(&cache_chain_mutex); 1379 mutex_unlock(&cache_chain_mutex);
1355 break; 1380 break;
1356 } 1381 }
1357 return NOTIFY_OK; 1382 return err ? NOTIFY_BAD : NOTIFY_OK;
1358bad:
1359 return NOTIFY_BAD;
1360} 1383}
1361 1384
1362static struct notifier_block __cpuinitdata cpucache_notifier = { 1385static struct notifier_block __cpuinitdata cpucache_notifier = {
@@ -3783,7 +3806,7 @@ const char *kmem_cache_name(struct kmem_cache *cachep)
3783EXPORT_SYMBOL_GPL(kmem_cache_name); 3806EXPORT_SYMBOL_GPL(kmem_cache_name);
3784 3807
3785/* 3808/*
3786 * This initializes kmem_list3 or resizes varioius caches for all nodes. 3809 * This initializes kmem_list3 or resizes various caches for all nodes.
3787 */ 3810 */
3788static int alloc_kmemlist(struct kmem_cache *cachep) 3811static int alloc_kmemlist(struct kmem_cache *cachep)
3789{ 3812{
diff --git a/mm/swap.c b/mm/swap.c
index a65eff8a517a..9ac88323d237 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -5,7 +5,7 @@
5 */ 5 */
6 6
7/* 7/*
8 * This file contains the default values for the opereation of the 8 * This file contains the default values for the operation of the
9 * Linux VM subsystem. Fine-tuning documentation can be found in 9 * Linux VM subsystem. Fine-tuning documentation can be found in
10 * Documentation/sysctl/vm.txt. 10 * Documentation/sysctl/vm.txt.
11 * Started 18.12.91 11 * Started 18.12.91
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 2e01af365848..af77e171e339 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -247,7 +247,7 @@ struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
247EXPORT_SYMBOL_GPL(__get_vm_area); 247EXPORT_SYMBOL_GPL(__get_vm_area);
248 248
249/** 249/**
250 * get_vm_area - reserve a contingous kernel virtual area 250 * get_vm_area - reserve a contiguous kernel virtual area
251 * @size: size of the area 251 * @size: size of the area
252 * @flags: %VM_IOREMAP for I/O mappings or VM_ALLOC 252 * @flags: %VM_IOREMAP for I/O mappings or VM_ALLOC
253 * 253 *
@@ -303,7 +303,7 @@ found:
303} 303}
304 304
305/** 305/**
306 * remove_vm_area - find and remove a contingous kernel virtual area 306 * remove_vm_area - find and remove a continuous kernel virtual area
307 * @addr: base address 307 * @addr: base address
308 * 308 *
309 * Search for the kernel VM area starting at @addr, and remove it. 309 * Search for the kernel VM area starting at @addr, and remove it.
@@ -364,7 +364,7 @@ static void __vunmap(void *addr, int deallocate_pages)
364 * vfree - release memory allocated by vmalloc() 364 * vfree - release memory allocated by vmalloc()
365 * @addr: memory base address 365 * @addr: memory base address
366 * 366 *
367 * Free the virtually contiguous memory area starting at @addr, as 367 * Free the virtually continuous memory area starting at @addr, as
368 * obtained from vmalloc(), vmalloc_32() or __vmalloc(). If @addr is 368 * obtained from vmalloc(), vmalloc_32() or __vmalloc(). If @addr is
369 * NULL, no operation is performed. 369 * NULL, no operation is performed.
370 * 370 *
diff --git a/mm/vmscan.c b/mm/vmscan.c
index e1471385d001..e5a9597e3bbc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(unregister_shrinker);
141 * percentages of the lru and ageable caches. This should balance the seeks 141 * percentages of the lru and ageable caches. This should balance the seeks
142 * generated by these structures. 142 * generated by these structures.
143 * 143 *
144 * If the vm encounted mapped pages on the LRU it increase the pressure on 144 * If the vm encountered mapped pages on the LRU it increase the pressure on
145 * slab to avoid swapping. 145 * slab to avoid swapping.
146 * 146 *
147 * We do weird things to avoid (scanned*seeks*entries) overflowing 32 bits. 147 * We do weird things to avoid (scanned*seeks*entries) overflowing 32 bits.
@@ -1282,7 +1282,7 @@ out:
1282 */ 1282 */
1283 if (priority < 0) 1283 if (priority < 0)
1284 priority = 0; 1284 priority = 0;
1285 for (i = 0; zones[i] != 0; i++) { 1285 for (i = 0; zones[i] != NULL; i++) {
1286 struct zone *zone = zones[i]; 1286 struct zone *zone = zones[i];
1287 1287
1288 if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) 1288 if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL))
diff --git a/net/9p/Kconfig b/net/9p/Kconfig
index eecbf12f6393..71bc110aebf8 100644
--- a/net/9p/Kconfig
+++ b/net/9p/Kconfig
@@ -27,5 +27,5 @@ config NET_9P_DEBUG
27 bool "Debug information" 27 bool "Debug information"
28 depends on NET_9P 28 depends on NET_9P
29 help 29 help
30 Say Y if you want the 9P subsistem to log debug information. 30 Say Y if you want the 9P subsystem to log debug information.
31 31
diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index c742d37bfb97..ba6428f204f9 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -24,16 +24,6 @@ Author: Marcell GAL, 2000, XDSL Ltd, Hungary
24 24
25#include "common.h" 25#include "common.h"
26 26
27/*
28 * Define this to use a version of the code which interacts with the higher
29 * layers in a more intellegent way, by always reserving enough space for
30 * our header at the begining of the packet. However, there may still be
31 * some problems with programs like tcpdump. In 2.5 we'll sort out what
32 * we need to do to get this perfect. For now we just will copy the packet
33 * if we need space for the header
34 */
35/* #define FASTER_VERSION */
36
37#ifdef SKB_DEBUG 27#ifdef SKB_DEBUG
38static void skb_debug(const struct sk_buff *skb) 28static void skb_debug(const struct sk_buff *skb)
39{ 29{
@@ -69,9 +59,7 @@ struct br2684_vcc {
69#ifdef CONFIG_ATM_BR2684_IPFILTER 59#ifdef CONFIG_ATM_BR2684_IPFILTER
70 struct br2684_filter filter; 60 struct br2684_filter filter;
71#endif /* CONFIG_ATM_BR2684_IPFILTER */ 61#endif /* CONFIG_ATM_BR2684_IPFILTER */
72#ifndef FASTER_VERSION
73 unsigned copies_needed, copies_failed; 62 unsigned copies_needed, copies_failed;
74#endif /* FASTER_VERSION */
75}; 63};
76 64
77struct br2684_dev { 65struct br2684_dev {
@@ -147,13 +135,6 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
147 struct br2684_vcc *brvcc) 135 struct br2684_vcc *brvcc)
148{ 136{
149 struct atm_vcc *atmvcc; 137 struct atm_vcc *atmvcc;
150#ifdef FASTER_VERSION
151 if (brvcc->encaps == e_llc)
152 memcpy(skb_push(skb, 8), llc_oui_pid_pad, 8);
153 /* last 2 bytes of llc_oui_pid_pad are managed by header routines;
154 yes, you got it: 8 + 2 = sizeof(llc_oui_pid_pad)
155 */
156#else
157 int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2; 138 int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
158 if (skb_headroom(skb) < minheadroom) { 139 if (skb_headroom(skb) < minheadroom) {
159 struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom); 140 struct sk_buff *skb2 = skb_realloc_headroom(skb, minheadroom);
@@ -170,7 +151,6 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
170 skb_copy_to_linear_data(skb, llc_oui_pid_pad, 10); 151 skb_copy_to_linear_data(skb, llc_oui_pid_pad, 10);
171 else 152 else
172 memset(skb->data, 0, 2); 153 memset(skb->data, 0, 2);
173#endif /* FASTER_VERSION */
174 skb_debug(skb); 154 skb_debug(skb);
175 155
176 ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc; 156 ATM_SKB(skb)->vcc = atmvcc = brvcc->atmvcc;
@@ -237,87 +217,6 @@ static struct net_device_stats *br2684_get_stats(struct net_device *dev)
237 return &BRPRIV(dev)->stats; 217 return &BRPRIV(dev)->stats;
238} 218}
239 219
240#ifdef FASTER_VERSION
241/*
242 * These mirror eth_header and eth_header_cache. They are not usually
243 * exported for use in modules, so we grab them from net_device
244 * after ether_setup() is done with it. Bit of a hack.
245 */
246static int (*my_eth_header)(struct sk_buff *, struct net_device *,
247 unsigned short, void *, void *, unsigned);
248static int (*my_eth_header_cache)(struct neighbour *, struct hh_cache *);
249
250static int
251br2684_header(struct sk_buff *skb, struct net_device *dev,
252 unsigned short type, void *daddr, void *saddr, unsigned len)
253{
254 u16 *pad_before_eth;
255 int t = my_eth_header(skb, dev, type, daddr, saddr, len);
256 if (t > 0) {
257 pad_before_eth = (u16 *) skb_push(skb, 2);
258 *pad_before_eth = 0;
259 return dev->hard_header_len; /* or return 16; ? */
260 } else
261 return t;
262}
263
264static int
265br2684_header_cache(struct neighbour *neigh, struct hh_cache *hh)
266{
267/* hh_data is 16 bytes long. if encaps is ether-llc we need 24, so
268xmit will add the additional header part in that case */
269 u16 *pad_before_eth = (u16 *)(hh->hh_data);
270 int t = my_eth_header_cache(neigh, hh);
271 DPRINTK("br2684_header_cache, neigh=%p, hh_cache=%p\n", neigh, hh);
272 if (t < 0)
273 return t;
274 else {
275 *pad_before_eth = 0;
276 hh->hh_len = PADLEN + ETH_HLEN;
277 }
278 return 0;
279}
280
281/*
282 * This is similar to eth_type_trans, which cannot be used because of
283 * our dev->hard_header_len
284 */
285static inline __be16 br_type_trans(struct sk_buff *skb, struct net_device *dev)
286{
287 struct ethhdr *eth;
288 unsigned char *rawp;
289 eth = eth_hdr(skb);
290
291 if (is_multicast_ether_addr(eth->h_dest)) {
292 if (!compare_ether_addr(eth->h_dest, dev->broadcast))
293 skb->pkt_type = PACKET_BROADCAST;
294 else
295 skb->pkt_type = PACKET_MULTICAST;
296 }
297
298 else if (compare_ether_addr(eth->h_dest, dev->dev_addr))
299 skb->pkt_type = PACKET_OTHERHOST;
300
301 if (ntohs(eth->h_proto) >= 1536)
302 return eth->h_proto;
303
304 rawp = skb->data;
305
306 /*
307 * This is a magic hack to spot IPX packets. Older Novell breaks
308 * the protocol design and runs IPX over 802.3 without an 802.2 LLC
309 * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
310 * won't work for fault tolerant netware but does for the rest.
311 */
312 if (*(unsigned short *) rawp == 0xFFFF)
313 return htons(ETH_P_802_3);
314
315 /*
316 * Real 802.2 LLC
317 */
318 return htons(ETH_P_802_2);
319}
320#endif /* FASTER_VERSION */
321 220
322/* 221/*
323 * We remember when the MAC gets set, so we don't override it later with 222 * We remember when the MAC gets set, so we don't override it later with
@@ -448,17 +347,8 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
448 return; 347 return;
449 } 348 }
450 349
451#ifdef FASTER_VERSION
452 /* FIXME: tcpdump shows that pointer to mac header is 2 bytes earlier,
453 than should be. What else should I set? */
454 skb_pull(skb, plen);
455 skb_set_mac_header(skb, -ETH_HLEN);
456 skb->pkt_type = PACKET_HOST;
457 skb->protocol = br_type_trans(skb, net_dev);
458#else
459 skb_pull(skb, plen - ETH_HLEN); 350 skb_pull(skb, plen - ETH_HLEN);
460 skb->protocol = eth_type_trans(skb, net_dev); 351 skb->protocol = eth_type_trans(skb, net_dev);
461#endif /* FASTER_VERSION */
462#ifdef CONFIG_ATM_BR2684_IPFILTER 352#ifdef CONFIG_ATM_BR2684_IPFILTER
463 if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) { 353 if (unlikely(packet_fails_filter(skb->protocol, brvcc, skb))) {
464 brdev->stats.rx_dropped++; 354 brdev->stats.rx_dropped++;
@@ -584,13 +474,6 @@ static void br2684_setup(struct net_device *netdev)
584 ether_setup(netdev); 474 ether_setup(netdev);
585 brdev->net_dev = netdev; 475 brdev->net_dev = netdev;
586 476
587#ifdef FASTER_VERSION
588 my_eth_header = netdev->hard_header;
589 netdev->hard_header = br2684_header;
590 my_eth_header_cache = netdev->hard_header_cache;
591 netdev->hard_header_cache = br2684_header_cache;
592 netdev->hard_header_len = sizeof(llc_oui_pid_pad) + ETH_HLEN; /* 10 + 14 */
593#endif
594 my_eth_mac_addr = netdev->set_mac_address; 477 my_eth_mac_addr = netdev->set_mac_address;
595 netdev->set_mac_address = br2684_mac_addr; 478 netdev->set_mac_address = br2684_mac_addr;
596 netdev->hard_start_xmit = br2684_start_xmit; 479 netdev->hard_start_xmit = br2684_start_xmit;
@@ -719,16 +602,12 @@ static int br2684_seq_show(struct seq_file *seq, void *v)
719 602
720 list_for_each_entry(brvcc, &brdev->brvccs, brvccs) { 603 list_for_each_entry(brvcc, &brdev->brvccs, brvccs) {
721 seq_printf(seq, " vcc %d.%d.%d: encaps=%s" 604 seq_printf(seq, " vcc %d.%d.%d: encaps=%s"
722#ifndef FASTER_VERSION
723 ", failed copies %u/%u" 605 ", failed copies %u/%u"
724#endif /* FASTER_VERSION */
725 "\n", brvcc->atmvcc->dev->number, 606 "\n", brvcc->atmvcc->dev->number,
726 brvcc->atmvcc->vpi, brvcc->atmvcc->vci, 607 brvcc->atmvcc->vpi, brvcc->atmvcc->vci,
727 (brvcc->encaps == e_llc) ? "LLC" : "VC" 608 (brvcc->encaps == e_llc) ? "LLC" : "VC"
728#ifndef FASTER_VERSION
729 , brvcc->copies_failed 609 , brvcc->copies_failed
730 , brvcc->copies_needed 610 , brvcc->copies_needed
731#endif /* FASTER_VERSION */
732 ); 611 );
733#ifdef CONFIG_ATM_BR2684_IPFILTER 612#ifdef CONFIG_ATM_BR2684_IPFILTER
734#define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte] 613#define b1(var, byte) ((u8 *) &brvcc->filter.var)[byte]
diff --git a/net/ax25/ax25_ds_in.c b/net/ax25/ax25_ds_in.c
index e37d217a986a..8273b1200eee 100644
--- a/net/ax25/ax25_ds_in.c
+++ b/net/ax25/ax25_ds_in.c
@@ -75,7 +75,7 @@ static int ax25_ds_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int framet
75 } 75 }
76 ax25_dama_on(ax25); 76 ax25_dama_on(ax25);
77 77
78 /* according to DK4EG´s spec we are required to 78 /* according to DK4EG's spec we are required to
79 * send a RR RESPONSE FINAL NR=0. 79 * send a RR RESPONSE FINAL NR=0.
80 */ 80 */
81 81
diff --git a/net/ax25/ax25_ds_subr.c b/net/ax25/ax25_ds_subr.c
index a49773ff2b92..b5e59787be2f 100644
--- a/net/ax25/ax25_ds_subr.c
+++ b/net/ax25/ax25_ds_subr.c
@@ -41,7 +41,7 @@ void ax25_ds_enquiry_response(ax25_cb *ax25)
41 ax25_cb *ax25o; 41 ax25_cb *ax25o;
42 struct hlist_node *node; 42 struct hlist_node *node;
43 43
44 /* Please note that neither DK4EG´s nor DG2FEF´s 44 /* Please note that neither DK4EG's nor DG2FEF's
45 * DAMA spec mention the following behaviour as seen 45 * DAMA spec mention the following behaviour as seen
46 * with TheFirmware: 46 * with TheFirmware:
47 * 47 *
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c
index 1f78c3e336d8..347e935faaf0 100644
--- a/net/bluetooth/bnep/core.c
+++ b/net/bluetooth/bnep/core.c
@@ -2,7 +2,7 @@
2 BNEP implementation for Linux Bluetooth stack (BlueZ). 2 BNEP implementation for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2001-2002 Inventel Systemes 3 Copyright (C) 2001-2002 Inventel Systemes
4 Written 2001-2002 by 4 Written 2001-2002 by
5 Clément Moreau <clement.moreau@inventel.fr> 5 Clément Moreau <clement.moreau@inventel.fr>
6 David Libault <david.libault@inventel.fr> 6 David Libault <david.libault@inventel.fr>
7 7
8 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 8 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
diff --git a/net/bluetooth/bnep/netdev.c b/net/bluetooth/bnep/netdev.c
index 9092816f58de..95e3837e4312 100644
--- a/net/bluetooth/bnep/netdev.c
+++ b/net/bluetooth/bnep/netdev.c
@@ -2,7 +2,7 @@
2 BNEP implementation for Linux Bluetooth stack (BlueZ). 2 BNEP implementation for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2001-2002 Inventel Systemes 3 Copyright (C) 2001-2002 Inventel Systemes
4 Written 2001-2002 by 4 Written 2001-2002 by
5 Clément Moreau <clement.moreau@inventel.fr> 5 Clément Moreau <clement.moreau@inventel.fr>
6 David Libault <david.libault@inventel.fr> 6 David Libault <david.libault@inventel.fr>
7 7
8 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 8 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com>
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index ff5784b440d7..66c736953cfe 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -656,11 +656,13 @@ static inline int hidp_setup_input(struct hidp_session *session, struct hidp_con
656 } 656 }
657 657
658 if (req->subclass & 0x80) { 658 if (req->subclass & 0x80) {
659 input->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); 659 input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
660 input->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); 660 input->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
661 input->relbit[0] = BIT(REL_X) | BIT(REL_Y); 661 BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
662 input->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_SIDE) | BIT(BTN_EXTRA); 662 input->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y);
663 input->relbit[0] |= BIT(REL_WHEEL); 663 input->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_SIDE) |
664 BIT_MASK(BTN_EXTRA);
665 input->relbit[0] |= BIT_MASK(REL_WHEEL);
664 } 666 }
665 667
666 input->dev.parent = hidp_get_device(session); 668 input->dev.parent = hidp_get_device(session);
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index d5a09eaef915..817169e718c1 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -871,7 +871,7 @@ static int translate_table(char *name, struct ebt_table_info *newinfo)
871 return -EINVAL; 871 return -EINVAL;
872 } 872 }
873 873
874 /* we now know the following (along with E=mc²): 874 /* we now know the following (along with E=mc²):
875 - the nr of entries in each chain is right 875 - the nr of entries in each chain is right
876 - the size of the allocated space is right 876 - the size of the allocated space is right
877 - all valid hooks have a corresponding chain 877 - all valid hooks have a corresponding chain
diff --git a/net/core/filter.c b/net/core/filter.c
index bd903aaf7aa7..e0a06942c025 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -387,6 +387,25 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
387} 387}
388 388
389/** 389/**
390 * sk_filter_rcu_release: Release a socket filter by rcu_head
391 * @rcu: rcu_head that contains the sk_filter to free
392 */
393static void sk_filter_rcu_release(struct rcu_head *rcu)
394{
395 struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu);
396
397 sk_filter_release(fp);
398}
399
400static void sk_filter_delayed_uncharge(struct sock *sk, struct sk_filter *fp)
401{
402 unsigned int size = sk_filter_len(fp);
403
404 atomic_sub(size, &sk->sk_omem_alloc);
405 call_rcu_bh(&fp->rcu, sk_filter_rcu_release);
406}
407
408/**
390 * sk_attach_filter - attach a socket filter 409 * sk_attach_filter - attach a socket filter
391 * @fprog: the filter program 410 * @fprog: the filter program
392 * @sk: the socket to use 411 * @sk: the socket to use
@@ -398,7 +417,7 @@ int sk_chk_filter(struct sock_filter *filter, int flen)
398 */ 417 */
399int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) 418int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
400{ 419{
401 struct sk_filter *fp; 420 struct sk_filter *fp, *old_fp;
402 unsigned int fsize = sizeof(struct sock_filter) * fprog->len; 421 unsigned int fsize = sizeof(struct sock_filter) * fprog->len;
403 int err; 422 int err;
404 423
@@ -418,19 +437,35 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
418 fp->len = fprog->len; 437 fp->len = fprog->len;
419 438
420 err = sk_chk_filter(fp->insns, fp->len); 439 err = sk_chk_filter(fp->insns, fp->len);
421 if (!err) { 440 if (err) {
422 struct sk_filter *old_fp; 441 sk_filter_uncharge(sk, fp);
423 442 return err;
424 rcu_read_lock_bh();
425 old_fp = rcu_dereference(sk->sk_filter);
426 rcu_assign_pointer(sk->sk_filter, fp);
427 rcu_read_unlock_bh();
428 fp = old_fp;
429 } 443 }
430 444
431 if (fp) 445 rcu_read_lock_bh();
432 sk_filter_release(sk, fp); 446 old_fp = rcu_dereference(sk->sk_filter);
433 return err; 447 rcu_assign_pointer(sk->sk_filter, fp);
448 rcu_read_unlock_bh();
449
450 if (old_fp)
451 sk_filter_delayed_uncharge(sk, old_fp);
452 return 0;
453}
454
455int sk_detach_filter(struct sock *sk)
456{
457 int ret = -ENOENT;
458 struct sk_filter *filter;
459
460 rcu_read_lock_bh();
461 filter = rcu_dereference(sk->sk_filter);
462 if (filter) {
463 rcu_assign_pointer(sk->sk_filter, NULL);
464 sk_filter_delayed_uncharge(sk, filter);
465 ret = 0;
466 }
467 rcu_read_unlock_bh();
468 return ret;
434} 469}
435 470
436EXPORT_SYMBOL(sk_chk_filter); 471EXPORT_SYMBOL(sk_chk_filter);
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 590a767b029c..daadbcc4e8dd 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -15,7 +15,7 @@
15 15
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/system.h> 17#include <asm/system.h>
18#include <asm/bitops.h> 18#include <linux/bitops.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index cd3af59b38a1..67ba9914e52e 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2496,7 +2496,6 @@ static struct neigh_sysctl_table {
2496 .proc_handler = &proc_dointvec, 2496 .proc_handler = &proc_dointvec,
2497 }, 2497 },
2498 { 2498 {
2499 .ctl_name = NET_NEIGH_RETRANS_TIME,
2500 .procname = "retrans_time", 2499 .procname = "retrans_time",
2501 .maxlen = sizeof(int), 2500 .maxlen = sizeof(int),
2502 .mode = 0644, 2501 .mode = 0644,
@@ -2541,27 +2540,40 @@ static struct neigh_sysctl_table {
2541 .proc_handler = &proc_dointvec, 2540 .proc_handler = &proc_dointvec,
2542 }, 2541 },
2543 { 2542 {
2544 .ctl_name = NET_NEIGH_ANYCAST_DELAY,
2545 .procname = "anycast_delay", 2543 .procname = "anycast_delay",
2546 .maxlen = sizeof(int), 2544 .maxlen = sizeof(int),
2547 .mode = 0644, 2545 .mode = 0644,
2548 .proc_handler = &proc_dointvec_userhz_jiffies, 2546 .proc_handler = &proc_dointvec_userhz_jiffies,
2549 }, 2547 },
2550 { 2548 {
2551 .ctl_name = NET_NEIGH_PROXY_DELAY,
2552 .procname = "proxy_delay", 2549 .procname = "proxy_delay",
2553 .maxlen = sizeof(int), 2550 .maxlen = sizeof(int),
2554 .mode = 0644, 2551 .mode = 0644,
2555 .proc_handler = &proc_dointvec_userhz_jiffies, 2552 .proc_handler = &proc_dointvec_userhz_jiffies,
2556 }, 2553 },
2557 { 2554 {
2558 .ctl_name = NET_NEIGH_LOCKTIME,
2559 .procname = "locktime", 2555 .procname = "locktime",
2560 .maxlen = sizeof(int), 2556 .maxlen = sizeof(int),
2561 .mode = 0644, 2557 .mode = 0644,
2562 .proc_handler = &proc_dointvec_userhz_jiffies, 2558 .proc_handler = &proc_dointvec_userhz_jiffies,
2563 }, 2559 },
2564 { 2560 {
2561 .ctl_name = NET_NEIGH_RETRANS_TIME_MS,
2562 .procname = "retrans_time_ms",
2563 .maxlen = sizeof(int),
2564 .mode = 0644,
2565 .proc_handler = &proc_dointvec_ms_jiffies,
2566 .strategy = &sysctl_ms_jiffies,
2567 },
2568 {
2569 .ctl_name = NET_NEIGH_REACHABLE_TIME_MS,
2570 .procname = "base_reachable_time_ms",
2571 .maxlen = sizeof(int),
2572 .mode = 0644,
2573 .proc_handler = &proc_dointvec_ms_jiffies,
2574 .strategy = &sysctl_ms_jiffies,
2575 },
2576 {
2565 .ctl_name = NET_NEIGH_GC_INTERVAL, 2577 .ctl_name = NET_NEIGH_GC_INTERVAL,
2566 .procname = "gc_interval", 2578 .procname = "gc_interval",
2567 .maxlen = sizeof(int), 2579 .maxlen = sizeof(int),
@@ -2590,22 +2602,7 @@ static struct neigh_sysctl_table {
2590 .mode = 0644, 2602 .mode = 0644,
2591 .proc_handler = &proc_dointvec, 2603 .proc_handler = &proc_dointvec,
2592 }, 2604 },
2593 { 2605 {}
2594 .ctl_name = NET_NEIGH_RETRANS_TIME_MS,
2595 .procname = "retrans_time_ms",
2596 .maxlen = sizeof(int),
2597 .mode = 0644,
2598 .proc_handler = &proc_dointvec_ms_jiffies,
2599 .strategy = &sysctl_ms_jiffies,
2600 },
2601 {
2602 .ctl_name = NET_NEIGH_REACHABLE_TIME_MS,
2603 .procname = "base_reachable_time_ms",
2604 .maxlen = sizeof(int),
2605 .mode = 0644,
2606 .proc_handler = &proc_dointvec_ms_jiffies,
2607 .strategy = &sysctl_ms_jiffies,
2608 },
2609 }, 2606 },
2610 .neigh_dev = { 2607 .neigh_dev = {
2611 { 2608 {
@@ -2658,42 +2655,48 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2658 t->neigh_vars[9].data = &p->anycast_delay; 2655 t->neigh_vars[9].data = &p->anycast_delay;
2659 t->neigh_vars[10].data = &p->proxy_delay; 2656 t->neigh_vars[10].data = &p->proxy_delay;
2660 t->neigh_vars[11].data = &p->locktime; 2657 t->neigh_vars[11].data = &p->locktime;
2658 t->neigh_vars[12].data = &p->retrans_time;
2659 t->neigh_vars[13].data = &p->base_reachable_time;
2661 2660
2662 if (dev) { 2661 if (dev) {
2663 dev_name_source = dev->name; 2662 dev_name_source = dev->name;
2664 t->neigh_dev[0].ctl_name = dev->ifindex; 2663 t->neigh_dev[0].ctl_name = dev->ifindex;
2665 t->neigh_vars[12].procname = NULL; 2664 /* Terminate the table early */
2666 t->neigh_vars[13].procname = NULL; 2665 memset(&t->neigh_vars[14], 0, sizeof(t->neigh_vars[14]));
2667 t->neigh_vars[14].procname = NULL;
2668 t->neigh_vars[15].procname = NULL;
2669 } else { 2666 } else {
2670 dev_name_source = t->neigh_dev[0].procname; 2667 dev_name_source = t->neigh_dev[0].procname;
2671 t->neigh_vars[12].data = (int *)(p + 1); 2668 t->neigh_vars[14].data = (int *)(p + 1);
2672 t->neigh_vars[13].data = (int *)(p + 1) + 1; 2669 t->neigh_vars[15].data = (int *)(p + 1) + 1;
2673 t->neigh_vars[14].data = (int *)(p + 1) + 2; 2670 t->neigh_vars[16].data = (int *)(p + 1) + 2;
2674 t->neigh_vars[15].data = (int *)(p + 1) + 3; 2671 t->neigh_vars[17].data = (int *)(p + 1) + 3;
2675 } 2672 }
2676 2673
2677 t->neigh_vars[16].data = &p->retrans_time;
2678 t->neigh_vars[17].data = &p->base_reachable_time;
2679 2674
2680 if (handler || strategy) { 2675 if (handler || strategy) {
2681 /* RetransTime */ 2676 /* RetransTime */
2682 t->neigh_vars[3].proc_handler = handler; 2677 t->neigh_vars[3].proc_handler = handler;
2683 t->neigh_vars[3].strategy = strategy; 2678 t->neigh_vars[3].strategy = strategy;
2684 t->neigh_vars[3].extra1 = dev; 2679 t->neigh_vars[3].extra1 = dev;
2680 if (!strategy)
2681 t->neigh_vars[3].ctl_name = CTL_UNNUMBERED;
2685 /* ReachableTime */ 2682 /* ReachableTime */
2686 t->neigh_vars[4].proc_handler = handler; 2683 t->neigh_vars[4].proc_handler = handler;
2687 t->neigh_vars[4].strategy = strategy; 2684 t->neigh_vars[4].strategy = strategy;
2688 t->neigh_vars[4].extra1 = dev; 2685 t->neigh_vars[4].extra1 = dev;
2686 if (!strategy)
2687 t->neigh_vars[4].ctl_name = CTL_UNNUMBERED;
2689 /* RetransTime (in milliseconds)*/ 2688 /* RetransTime (in milliseconds)*/
2690 t->neigh_vars[16].proc_handler = handler; 2689 t->neigh_vars[12].proc_handler = handler;
2691 t->neigh_vars[16].strategy = strategy; 2690 t->neigh_vars[12].strategy = strategy;
2692 t->neigh_vars[16].extra1 = dev; 2691 t->neigh_vars[12].extra1 = dev;
2692 if (!strategy)
2693 t->neigh_vars[12].ctl_name = CTL_UNNUMBERED;
2693 /* ReachableTime (in milliseconds) */ 2694 /* ReachableTime (in milliseconds) */
2694 t->neigh_vars[17].proc_handler = handler; 2695 t->neigh_vars[13].proc_handler = handler;
2695 t->neigh_vars[17].strategy = strategy; 2696 t->neigh_vars[13].strategy = strategy;
2696 t->neigh_vars[17].extra1 = dev; 2697 t->neigh_vars[13].extra1 = dev;
2698 if (!strategy)
2699 t->neigh_vars[13].ctl_name = CTL_UNNUMBERED;
2697 } 2700 }
2698 2701
2699 dev_name = kstrdup(dev_name_source, GFP_KERNEL); 2702 dev_name = kstrdup(dev_name_source, GFP_KERNEL);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 2100c734b102..c4719edb55c0 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 * Ben Greear <greearb@candelatech.com> 8 * Ben Greear <greearb@candelatech.com>
9 * Jens Låås <jens.laas@data.slu.se> 9 * Jens Låås <jens.laas@data.slu.se>
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
@@ -161,7 +161,7 @@
161#endif 161#endif
162#include <asm/byteorder.h> 162#include <asm/byteorder.h>
163#include <linux/rcupdate.h> 163#include <linux/rcupdate.h>
164#include <asm/bitops.h> 164#include <linux/bitops.h>
165#include <asm/io.h> 165#include <asm/io.h>
166#include <asm/dma.h> 166#include <asm/dma.h>
167#include <asm/uaccess.h> 167#include <asm/uaccess.h>
@@ -2454,7 +2454,7 @@ static int pktgen_output_ipsec(struct sk_buff *skb, struct pktgen_dev *pkt_dev)
2454 spin_lock(&x->lock); 2454 spin_lock(&x->lock);
2455 iph = ip_hdr(skb); 2455 iph = ip_hdr(skb);
2456 2456
2457 err = x->mode->output(x, skb); 2457 err = x->outer_mode->output(x, skb);
2458 if (err) 2458 if (err)
2459 goto error; 2459 goto error;
2460 err = x->type->output(x, skb); 2460 err = x->type->output(x, skb);
@@ -3514,7 +3514,7 @@ static int pktgen_thread_worker(void *arg)
3514 3514
3515 init_waitqueue_head(&t->queue); 3515 init_waitqueue_head(&t->queue);
3516 3516
3517 pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, current->pid); 3517 pr_debug("pktgen: starting pktgen/%d: pid=%d\n", cpu, task_pid_nr(current));
3518 3518
3519 set_current_state(TASK_INTERRUPTIBLE); 3519 set_current_state(TASK_INTERRUPTIBLE);
3520 3520
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1072d16696c3..4a2640d38261 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -744,10 +744,10 @@ static struct net *get_net_ns_by_pid(pid_t pid)
744 rcu_read_lock(); 744 rcu_read_lock();
745 tsk = find_task_by_pid(pid); 745 tsk = find_task_by_pid(pid);
746 if (tsk) { 746 if (tsk) {
747 task_lock(tsk); 747 struct nsproxy *nsproxy;
748 if (tsk->nsproxy) 748 nsproxy = task_nsproxy(tsk);
749 net = get_net(tsk->nsproxy->net_ns); 749 if (nsproxy)
750 task_unlock(tsk); 750 net = get_net(nsproxy->net_ns);
751 } 751 }
752 rcu_read_unlock(); 752 rcu_read_unlock();
753 return net; 753 return net;
diff --git a/net/core/scm.c b/net/core/scm.c
index 530bee8d9ed9..100ba6d9d478 100644
--- a/net/core/scm.c
+++ b/net/core/scm.c
@@ -24,6 +24,8 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/netdevice.h> 25#include <linux/netdevice.h>
26#include <linux/security.h> 26#include <linux/security.h>
27#include <linux/pid.h>
28#include <linux/nsproxy.h>
27 29
28#include <asm/system.h> 30#include <asm/system.h>
29#include <asm/uaccess.h> 31#include <asm/uaccess.h>
@@ -42,7 +44,7 @@
42 44
43static __inline__ int scm_check_creds(struct ucred *creds) 45static __inline__ int scm_check_creds(struct ucred *creds)
44{ 46{
45 if ((creds->pid == current->tgid || capable(CAP_SYS_ADMIN)) && 47 if ((creds->pid == task_tgid_vnr(current) || capable(CAP_SYS_ADMIN)) &&
46 ((creds->uid == current->uid || creds->uid == current->euid || 48 ((creds->uid == current->uid || creds->uid == current->euid ||
47 creds->uid == current->suid) || capable(CAP_SETUID)) && 49 creds->uid == current->suid) || capable(CAP_SETUID)) &&
48 ((creds->gid == current->gid || creds->gid == current->egid || 50 ((creds->gid == current->gid || creds->gid == current->egid ||
diff --git a/net/core/sock.c b/net/core/sock.c
index d45ecdccc6a1..febbcbcf8022 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -232,7 +232,7 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
232 warned++; 232 warned++;
233 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) " 233 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) "
234 "tries to set negative timeout\n", 234 "tries to set negative timeout\n",
235 current->comm, current->pid); 235 current->comm, task_pid_nr(current));
236 return 0; 236 return 0;
237 } 237 }
238 *timeo_p = MAX_SCHEDULE_TIMEOUT; 238 *timeo_p = MAX_SCHEDULE_TIMEOUT;
@@ -428,7 +428,6 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
428 char __user *optval, int optlen) 428 char __user *optval, int optlen)
429{ 429{
430 struct sock *sk=sock->sk; 430 struct sock *sk=sock->sk;
431 struct sk_filter *filter;
432 int val; 431 int val;
433 int valbool; 432 int valbool;
434 struct linger ling; 433 struct linger ling;
@@ -652,16 +651,7 @@ set_rcvbuf:
652 break; 651 break;
653 652
654 case SO_DETACH_FILTER: 653 case SO_DETACH_FILTER:
655 rcu_read_lock_bh(); 654 ret = sk_detach_filter(sk);
656 filter = rcu_dereference(sk->sk_filter);
657 if (filter) {
658 rcu_assign_pointer(sk->sk_filter, NULL);
659 sk_filter_release(sk, filter);
660 rcu_read_unlock_bh();
661 break;
662 }
663 rcu_read_unlock_bh();
664 ret = -ENONET;
665 break; 655 break;
666 656
667 case SO_PASSSEC: 657 case SO_PASSSEC:
@@ -925,7 +915,7 @@ void sk_free(struct sock *sk)
925 915
926 filter = rcu_dereference(sk->sk_filter); 916 filter = rcu_dereference(sk->sk_filter);
927 if (filter) { 917 if (filter) {
928 sk_filter_release(sk, filter); 918 sk_filter_uncharge(sk, filter);
929 rcu_assign_pointer(sk->sk_filter, NULL); 919 rcu_assign_pointer(sk->sk_filter, NULL);
930 } 920 }
931 921
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 19d7e1dbd87e..3560a2a875a0 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -19,6 +19,9 @@
19#include "ccid.h" 19#include "ccid.h"
20#include "dccp.h" 20#include "dccp.h"
21 21
22/* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
23int sysctl_dccp_sync_ratelimit __read_mostly = HZ / 8;
24
22static void dccp_fin(struct sock *sk, struct sk_buff *skb) 25static void dccp_fin(struct sock *sk, struct sk_buff *skb)
23{ 26{
24 sk->sk_shutdown |= RCV_SHUTDOWN; 27 sk->sk_shutdown |= RCV_SHUTDOWN;
diff --git a/net/dccp/sysctl.c b/net/dccp/sysctl.c
index 9364b2fb4dbd..c62c05039f69 100644
--- a/net/dccp/sysctl.c
+++ b/net/dccp/sysctl.c
@@ -18,9 +18,6 @@
18#error This file should not be compiled without CONFIG_SYSCTL defined 18#error This file should not be compiled without CONFIG_SYSCTL defined
19#endif 19#endif
20 20
21/* rate-limit for syncs in reply to sequence-invalid packets; RFC 4340, 7.5.4 */
22int sysctl_dccp_sync_ratelimit __read_mostly = HZ / 8;
23
24static struct ctl_table dccp_default_table[] = { 21static struct ctl_table dccp_default_table[] = {
25 { 22 {
26 .procname = "seq_window", 23 .procname = "seq_window",
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index 6cc54eeca3ed..72e6ab66834f 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -586,7 +586,7 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr)
586 if (stype & IEEE80211_STYPE_QOS_DATA) { 586 if (stype & IEEE80211_STYPE_QOS_DATA) {
587 const struct ieee80211_hdr_3addrqos *qoshdr = 587 const struct ieee80211_hdr_3addrqos *qoshdr =
588 (struct ieee80211_hdr_3addrqos *)skb->data; 588 (struct ieee80211_hdr_3addrqos *)skb->data;
589 hdr[12] = qoshdr->qos_ctl & cpu_to_le16(IEEE80211_QCTL_TID); 589 hdr[12] = le16_to_cpu(qoshdr->qos_ctl) & IEEE80211_QCTL_TID;
590 } else 590 } else
591 hdr[12] = 0; /* priority */ 591 hdr[12] = 0; /* priority */
592 592
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c
index 9b58dd67acb6..d309e8f19992 100644
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -409,7 +409,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
409 (*crypt)->priv); 409 (*crypt)->priv);
410 sec.flags |= (1 << key); 410 sec.flags |= (1 << key);
411 /* This ensures a key will be activated if no key is 411 /* This ensures a key will be activated if no key is
412 * explicitely set */ 412 * explicitly set */
413 if (key == sec.active_key) 413 if (key == sec.active_key)
414 sec.flags |= SEC_ACTIVE_KEY; 414 sec.flags |= SEC_ACTIVE_KEY;
415 415
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index d894f616c3d6..9f9fd2c6f6e2 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -560,7 +560,7 @@ config TCP_CONG_ILLINOIS
560 depends on EXPERIMENTAL 560 depends on EXPERIMENTAL
561 default n 561 default n
562 ---help--- 562 ---help---
563 TCP-Illinois is a sender-side modificatio of TCP Reno for 563 TCP-Illinois is a sender-side modification of TCP Reno for
564 high speed long delay links. It uses round-trip-time to 564 high speed long delay links. It uses round-trip-time to
565 adjust the alpha and beta parameters to achieve a higher average 565 adjust the alpha and beta parameters to achieve a higher average
566 throughput and maintain fairness. 566 throughput and maintain fairness.
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 81a8285d6d6a..8d8c2915e064 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -54,7 +54,7 @@
54 54
55#include <asm/uaccess.h> 55#include <asm/uaccess.h>
56#include <asm/system.h> 56#include <asm/system.h>
57#include <asm/bitops.h> 57#include <linux/bitops.h>
58#include <linux/types.h> 58#include <linux/types.h>
59#include <linux/kernel.h> 59#include <linux/kernel.h>
60#include <linux/mm.h> 60#include <linux/mm.h>
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 3cef12835c4b..8fb6ca23700a 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -93,7 +93,7 @@ int inet_csk_get_port(struct inet_hashinfo *hashinfo,
93 int remaining, rover, low, high; 93 int remaining, rover, low, high;
94 94
95 inet_get_local_port_range(&low, &high); 95 inet_get_local_port_range(&low, &high);
96 remaining = high - low; 96 remaining = (high - low) + 1;
97 rover = net_random() % remaining + low; 97 rover = net_random() % remaining + low;
98 98
99 do { 99 do {
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 484cf512858f..e15e04fc6661 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -136,7 +136,9 @@ void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f,
136 *work -= f->qsize; 136 *work -= f->qsize;
137 atomic_sub(f->qsize, &f->mem); 137 atomic_sub(f->qsize, &f->mem);
138 138
139 f->destructor(q); 139 if (f->destructor)
140 f->destructor(q);
141 kfree(q);
140 142
141} 143}
142EXPORT_SYMBOL(inet_frag_destroy); 144EXPORT_SYMBOL(inet_frag_destroy);
@@ -172,3 +174,88 @@ int inet_frag_evictor(struct inet_frags *f)
172 return evicted; 174 return evicted;
173} 175}
174EXPORT_SYMBOL(inet_frag_evictor); 176EXPORT_SYMBOL(inet_frag_evictor);
177
178static struct inet_frag_queue *inet_frag_intern(struct inet_frag_queue *qp_in,
179 struct inet_frags *f, unsigned int hash, void *arg)
180{
181 struct inet_frag_queue *qp;
182#ifdef CONFIG_SMP
183 struct hlist_node *n;
184#endif
185
186 write_lock(&f->lock);
187#ifdef CONFIG_SMP
188 /* With SMP race we have to recheck hash table, because
189 * such entry could be created on other cpu, while we
190 * promoted read lock to write lock.
191 */
192 hlist_for_each_entry(qp, n, &f->hash[hash], list) {
193 if (f->match(qp, arg)) {
194 atomic_inc(&qp->refcnt);
195 write_unlock(&f->lock);
196 qp_in->last_in |= COMPLETE;
197 inet_frag_put(qp_in, f);
198 return qp;
199 }
200 }
201#endif
202 qp = qp_in;
203 if (!mod_timer(&qp->timer, jiffies + f->ctl->timeout))
204 atomic_inc(&qp->refcnt);
205
206 atomic_inc(&qp->refcnt);
207 hlist_add_head(&qp->list, &f->hash[hash]);
208 list_add_tail(&qp->lru_list, &f->lru_list);
209 f->nqueues++;
210 write_unlock(&f->lock);
211 return qp;
212}
213
214static struct inet_frag_queue *inet_frag_alloc(struct inet_frags *f, void *arg)
215{
216 struct inet_frag_queue *q;
217
218 q = kzalloc(f->qsize, GFP_ATOMIC);
219 if (q == NULL)
220 return NULL;
221
222 f->constructor(q, arg);
223 atomic_add(f->qsize, &f->mem);
224 setup_timer(&q->timer, f->frag_expire, (unsigned long)q);
225 spin_lock_init(&q->lock);
226 atomic_set(&q->refcnt, 1);
227
228 return q;
229}
230
231static struct inet_frag_queue *inet_frag_create(struct inet_frags *f,
232 void *arg, unsigned int hash)
233{
234 struct inet_frag_queue *q;
235
236 q = inet_frag_alloc(f, arg);
237 if (q == NULL)
238 return NULL;
239
240 return inet_frag_intern(q, f, hash, arg);
241}
242
243struct inet_frag_queue *inet_frag_find(struct inet_frags *f, void *key,
244 unsigned int hash)
245{
246 struct inet_frag_queue *q;
247 struct hlist_node *n;
248
249 read_lock(&f->lock);
250 hlist_for_each_entry(q, n, &f->hash[hash], list) {
251 if (f->match(q, key)) {
252 atomic_inc(&q->refcnt);
253 read_unlock(&f->lock);
254 return q;
255 }
256 }
257 read_unlock(&f->lock);
258
259 return inet_frag_create(f, key, hash);
260}
261EXPORT_SYMBOL(inet_frag_find);
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index fac6398e4367..16eecc7046a3 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -286,7 +286,7 @@ int inet_hash_connect(struct inet_timewait_death_row *death_row,
286 struct inet_timewait_sock *tw = NULL; 286 struct inet_timewait_sock *tw = NULL;
287 287
288 inet_get_local_port_range(&low, &high); 288 inet_get_local_port_range(&low, &high);
289 remaining = high - low; 289 remaining = (high - low) + 1;
290 290
291 local_bh_disable(); 291 local_bh_disable();
292 for (i = 1; i <= remaining; i++) { 292 for (i = 1; i <= remaining; i++) {
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 443b3f89192f..2143bf30597a 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -108,6 +108,11 @@ int ip_frag_mem(void)
108static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, 108static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
109 struct net_device *dev); 109 struct net_device *dev);
110 110
111struct ip4_create_arg {
112 struct iphdr *iph;
113 u32 user;
114};
115
111static unsigned int ipqhashfn(__be16 id, __be32 saddr, __be32 daddr, u8 prot) 116static unsigned int ipqhashfn(__be16 id, __be32 saddr, __be32 daddr, u8 prot)
112{ 117{
113 return jhash_3words((__force u32)id << 16 | prot, 118 return jhash_3words((__force u32)id << 16 | prot,
@@ -123,6 +128,19 @@ static unsigned int ip4_hashfn(struct inet_frag_queue *q)
123 return ipqhashfn(ipq->id, ipq->saddr, ipq->daddr, ipq->protocol); 128 return ipqhashfn(ipq->id, ipq->saddr, ipq->daddr, ipq->protocol);
124} 129}
125 130
131static int ip4_frag_match(struct inet_frag_queue *q, void *a)
132{
133 struct ipq *qp;
134 struct ip4_create_arg *arg = a;
135
136 qp = container_of(q, struct ipq, q);
137 return (qp->id == arg->iph->id &&
138 qp->saddr == arg->iph->saddr &&
139 qp->daddr == arg->iph->daddr &&
140 qp->protocol == arg->iph->protocol &&
141 qp->user == arg->user);
142}
143
126/* Memory Tracking Functions. */ 144/* Memory Tracking Functions. */
127static __inline__ void frag_kfree_skb(struct sk_buff *skb, int *work) 145static __inline__ void frag_kfree_skb(struct sk_buff *skb, int *work)
128{ 146{
@@ -132,6 +150,20 @@ static __inline__ void frag_kfree_skb(struct sk_buff *skb, int *work)
132 kfree_skb(skb); 150 kfree_skb(skb);
133} 151}
134 152
153static void ip4_frag_init(struct inet_frag_queue *q, void *a)
154{
155 struct ipq *qp = container_of(q, struct ipq, q);
156 struct ip4_create_arg *arg = a;
157
158 qp->protocol = arg->iph->protocol;
159 qp->id = arg->iph->id;
160 qp->saddr = arg->iph->saddr;
161 qp->daddr = arg->iph->daddr;
162 qp->user = arg->user;
163 qp->peer = sysctl_ipfrag_max_dist ?
164 inet_getpeer(arg->iph->saddr, 1) : NULL;
165}
166
135static __inline__ void ip4_frag_free(struct inet_frag_queue *q) 167static __inline__ void ip4_frag_free(struct inet_frag_queue *q)
136{ 168{
137 struct ipq *qp; 169 struct ipq *qp;
@@ -139,17 +171,6 @@ static __inline__ void ip4_frag_free(struct inet_frag_queue *q)
139 qp = container_of(q, struct ipq, q); 171 qp = container_of(q, struct ipq, q);
140 if (qp->peer) 172 if (qp->peer)
141 inet_putpeer(qp->peer); 173 inet_putpeer(qp->peer);
142 kfree(qp);
143}
144
145static __inline__ struct ipq *frag_alloc_queue(void)
146{
147 struct ipq *qp = kzalloc(sizeof(struct ipq), GFP_ATOMIC);
148
149 if (!qp)
150 return NULL;
151 atomic_add(sizeof(struct ipq), &ip4_frags.mem);
152 return qp;
153} 174}
154 175
155 176
@@ -185,7 +206,9 @@ static void ip_evictor(void)
185 */ 206 */
186static void ip_expire(unsigned long arg) 207static void ip_expire(unsigned long arg)
187{ 208{
188 struct ipq *qp = (struct ipq *) arg; 209 struct ipq *qp;
210
211 qp = container_of((struct inet_frag_queue *) arg, struct ipq, q);
189 212
190 spin_lock(&qp->q.lock); 213 spin_lock(&qp->q.lock);
191 214
@@ -210,112 +233,30 @@ out:
210 ipq_put(qp); 233 ipq_put(qp);
211} 234}
212 235
213/* Creation primitives. */ 236/* Find the correct entry in the "incomplete datagrams" queue for
214 237 * this IP datagram, and create new one, if nothing is found.
215static struct ipq *ip_frag_intern(struct ipq *qp_in) 238 */
239static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
216{ 240{
217 struct ipq *qp; 241 struct inet_frag_queue *q;
218#ifdef CONFIG_SMP 242 struct ip4_create_arg arg;
219 struct hlist_node *n;
220#endif
221 unsigned int hash; 243 unsigned int hash;
222 244
223 write_lock(&ip4_frags.lock); 245 arg.iph = iph;
224 hash = ipqhashfn(qp_in->id, qp_in->saddr, qp_in->daddr, 246 arg.user = user;
225 qp_in->protocol); 247 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol);
226#ifdef CONFIG_SMP
227 /* With SMP race we have to recheck hash table, because
228 * such entry could be created on other cpu, while we
229 * promoted read lock to write lock.
230 */
231 hlist_for_each_entry(qp, n, &ip4_frags.hash[hash], q.list) {
232 if (qp->id == qp_in->id &&
233 qp->saddr == qp_in->saddr &&
234 qp->daddr == qp_in->daddr &&
235 qp->protocol == qp_in->protocol &&
236 qp->user == qp_in->user) {
237 atomic_inc(&qp->q.refcnt);
238 write_unlock(&ip4_frags.lock);
239 qp_in->q.last_in |= COMPLETE;
240 ipq_put(qp_in);
241 return qp;
242 }
243 }
244#endif
245 qp = qp_in;
246
247 if (!mod_timer(&qp->q.timer, jiffies + ip4_frags_ctl.timeout))
248 atomic_inc(&qp->q.refcnt);
249 248
250 atomic_inc(&qp->q.refcnt); 249 q = inet_frag_find(&ip4_frags, &arg, hash);
251 hlist_add_head(&qp->q.list, &ip4_frags.hash[hash]); 250 if (q == NULL)
252 INIT_LIST_HEAD(&qp->q.lru_list);
253 list_add_tail(&qp->q.lru_list, &ip4_frags.lru_list);
254 ip4_frags.nqueues++;
255 write_unlock(&ip4_frags.lock);
256 return qp;
257}
258
259/* Add an entry to the 'ipq' queue for a newly received IP datagram. */
260static struct ipq *ip_frag_create(struct iphdr *iph, u32 user)
261{
262 struct ipq *qp;
263
264 if ((qp = frag_alloc_queue()) == NULL)
265 goto out_nomem; 251 goto out_nomem;
266 252
267 qp->protocol = iph->protocol; 253 return container_of(q, struct ipq, q);
268 qp->id = iph->id;
269 qp->saddr = iph->saddr;
270 qp->daddr = iph->daddr;
271 qp->user = user;
272 qp->peer = sysctl_ipfrag_max_dist ? inet_getpeer(iph->saddr, 1) : NULL;
273
274 /* Initialize a timer for this entry. */
275 init_timer(&qp->q.timer);
276 qp->q.timer.data = (unsigned long) qp; /* pointer to queue */
277 qp->q.timer.function = ip_expire; /* expire function */
278 spin_lock_init(&qp->q.lock);
279 atomic_set(&qp->q.refcnt, 1);
280
281 return ip_frag_intern(qp);
282 254
283out_nomem: 255out_nomem:
284 LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n"); 256 LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n");
285 return NULL; 257 return NULL;
286} 258}
287 259
288/* Find the correct entry in the "incomplete datagrams" queue for
289 * this IP datagram, and create new one, if nothing is found.
290 */
291static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
292{
293 __be16 id = iph->id;
294 __be32 saddr = iph->saddr;
295 __be32 daddr = iph->daddr;
296 __u8 protocol = iph->protocol;
297 unsigned int hash;
298 struct ipq *qp;
299 struct hlist_node *n;
300
301 read_lock(&ip4_frags.lock);
302 hash = ipqhashfn(id, saddr, daddr, protocol);
303 hlist_for_each_entry(qp, n, &ip4_frags.hash[hash], q.list) {
304 if (qp->id == id &&
305 qp->saddr == saddr &&
306 qp->daddr == daddr &&
307 qp->protocol == protocol &&
308 qp->user == user) {
309 atomic_inc(&qp->q.refcnt);
310 read_unlock(&ip4_frags.lock);
311 return qp;
312 }
313 }
314 read_unlock(&ip4_frags.lock);
315
316 return ip_frag_create(iph, user);
317}
318
319/* Is the fragment too far ahead to be part of ipq? */ 260/* Is the fragment too far ahead to be part of ipq? */
320static inline int ip_frag_too_far(struct ipq *qp) 261static inline int ip_frag_too_far(struct ipq *qp)
321{ 262{
@@ -545,7 +486,6 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
545 if (prev) { 486 if (prev) {
546 head = prev->next; 487 head = prev->next;
547 fp = skb_clone(head, GFP_ATOMIC); 488 fp = skb_clone(head, GFP_ATOMIC);
548
549 if (!fp) 489 if (!fp)
550 goto out_nomem; 490 goto out_nomem;
551 491
@@ -571,7 +511,6 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
571 goto out_oversize; 511 goto out_oversize;
572 512
573 /* Head of list must not be cloned. */ 513 /* Head of list must not be cloned. */
574 err = -ENOMEM;
575 if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC)) 514 if (skb_cloned(head) && pskb_expand_head(head, 0, 0, GFP_ATOMIC))
576 goto out_nomem; 515 goto out_nomem;
577 516
@@ -627,6 +566,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
627out_nomem: 566out_nomem:
628 LIMIT_NETDEBUG(KERN_ERR "IP: queue_glue: no memory for gluing " 567 LIMIT_NETDEBUG(KERN_ERR "IP: queue_glue: no memory for gluing "
629 "queue %p\n", qp); 568 "queue %p\n", qp);
569 err = -ENOMEM;
630 goto out_fail; 570 goto out_fail;
631out_oversize: 571out_oversize:
632 if (net_ratelimit()) 572 if (net_ratelimit())
@@ -671,9 +611,12 @@ void __init ipfrag_init(void)
671{ 611{
672 ip4_frags.ctl = &ip4_frags_ctl; 612 ip4_frags.ctl = &ip4_frags_ctl;
673 ip4_frags.hashfn = ip4_hashfn; 613 ip4_frags.hashfn = ip4_hashfn;
614 ip4_frags.constructor = ip4_frag_init;
674 ip4_frags.destructor = ip4_frag_free; 615 ip4_frags.destructor = ip4_frag_free;
675 ip4_frags.skb_free = NULL; 616 ip4_frags.skb_free = NULL;
676 ip4_frags.qsize = sizeof(struct ipq); 617 ip4_frags.qsize = sizeof(struct ipq);
618 ip4_frags.match = ip4_frag_match;
619 ip4_frags.frag_expire = ip_expire;
677 inet_frags_init(&ip4_frags); 620 inet_frags_init(&ip4_frags);
678} 621}
679 622
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
index 1960747f354c..c99f2a33fb9e 100644
--- a/net/ipv4/ipvs/ip_vs_sync.c
+++ b/net/ipv4/ipvs/ip_vs_sync.c
@@ -794,7 +794,7 @@ static int sync_thread(void *startup)
794 794
795 add_wait_queue(&sync_wait, &wait); 795 add_wait_queue(&sync_wait, &wait);
796 796
797 set_sync_pid(state, current->pid); 797 set_sync_pid(state, task_pid_nr(current));
798 complete(tinfo->startup); 798 complete(tinfo->startup);
799 799
800 /* 800 /*
@@ -877,7 +877,7 @@ int start_sync_thread(int state, char *mcast_ifn, __u8 syncid)
877 if (!tinfo) 877 if (!tinfo)
878 return -ENOMEM; 878 return -ENOMEM;
879 879
880 IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid); 880 IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, task_pid_nr(current));
881 IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %Zd bytes\n", 881 IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %Zd bytes\n",
882 sizeof(struct ip_vs_sync_conn)); 882 sizeof(struct ip_vs_sync_conn));
883 883
@@ -917,7 +917,7 @@ int stop_sync_thread(int state)
917 (state == IP_VS_STATE_BACKUP && !sync_backup_pid)) 917 (state == IP_VS_STATE_BACKUP && !sync_backup_pid))
918 return -ESRCH; 918 return -ESRCH;
919 919
920 IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid); 920 IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, task_pid_nr(current));
921 IP_VS_INFO("stopping sync thread %d ...\n", 921 IP_VS_INFO("stopping sync thread %d ...\n",
922 (state == IP_VS_STATE_MASTER) ? 922 (state == IP_VS_STATE_MASTER) ?
923 sync_master_pid : sync_backup_pid); 923 sync_master_pid : sync_backup_pid);
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
index 11fedc73049c..adcbaf6d4299 100644
--- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
+++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c
@@ -281,7 +281,6 @@ static int icmp_nlattr_to_tuple(struct nlattr *tb[],
281static struct ctl_table_header *icmp_sysctl_header; 281static struct ctl_table_header *icmp_sysctl_header;
282static struct ctl_table icmp_sysctl_table[] = { 282static struct ctl_table icmp_sysctl_table[] = {
283 { 283 {
284 .ctl_name = NET_NF_CONNTRACK_ICMP_TIMEOUT,
285 .procname = "nf_conntrack_icmp_timeout", 284 .procname = "nf_conntrack_icmp_timeout",
286 .data = &nf_ct_icmp_timeout, 285 .data = &nf_ct_icmp_timeout,
287 .maxlen = sizeof(unsigned int), 286 .maxlen = sizeof(unsigned int),
@@ -295,7 +294,6 @@ static struct ctl_table icmp_sysctl_table[] = {
295#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT 294#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
296static struct ctl_table icmp_compat_sysctl_table[] = { 295static struct ctl_table icmp_compat_sysctl_table[] = {
297 { 296 {
298 .ctl_name = NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT,
299 .procname = "ip_conntrack_icmp_timeout", 297 .procname = "ip_conntrack_icmp_timeout",
300 .data = &nf_ct_icmp_timeout, 298 .data = &nf_ct_icmp_timeout,
301 .maxlen = sizeof(unsigned int), 299 .maxlen = sizeof(unsigned int),
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index c98ef16effd2..ffddd2b45352 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -122,7 +122,7 @@ static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp,
122 ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos); 122 ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos);
123 123
124 if (write && ret == 0) { 124 if (write && ret == 0) {
125 if (range[1] <= range[0]) 125 if (range[1] < range[0])
126 ret = -EINVAL; 126 ret = -EINVAL;
127 else 127 else
128 set_local_port_range(range); 128 set_local_port_range(range);
@@ -150,7 +150,7 @@ static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,
150 150
151 ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen); 151 ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen);
152 if (ret == 0 && newval && newlen) { 152 if (ret == 0 && newval && newlen) {
153 if (range[1] <= range[0]) 153 if (range[1] < range[0])
154 ret = -EINVAL; 154 ret = -EINVAL;
155 else 155 else
156 set_local_port_range(range); 156 set_local_port_range(range);
@@ -740,7 +740,6 @@ ctl_table ipv4_table[] = {
740 .strategy = &sysctl_jiffies 740 .strategy = &sysctl_jiffies
741 }, 741 },
742 { 742 {
743 .ctl_name = NET_IPV4_IPFRAG_MAX_DIST,
744 .procname = "ipfrag_max_dist", 743 .procname = "ipfrag_max_dist",
745 .data = &sysctl_ipfrag_max_dist, 744 .data = &sysctl_ipfrag_max_dist,
746 .maxlen = sizeof(int), 745 .maxlen = sizeof(int),
@@ -865,7 +864,6 @@ ctl_table ipv4_table[] = {
865 }, 864 },
866#endif /* CONFIG_NETLABEL */ 865#endif /* CONFIG_NETLABEL */
867 { 866 {
868 .ctl_name = NET_TCP_AVAIL_CONG_CONTROL,
869 .procname = "tcp_available_congestion_control", 867 .procname = "tcp_available_congestion_control",
870 .maxlen = TCP_CA_BUF_MAX, 868 .maxlen = TCP_CA_BUF_MAX,
871 .mode = 0444, 869 .mode = 0444,
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 4f322003835d..2e6ad6dbba6c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1334,7 +1334,7 @@ do_prequeue:
1334 if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) { 1334 if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) {
1335 if (net_ratelimit()) 1335 if (net_ratelimit())
1336 printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n", 1336 printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n",
1337 current->comm, current->pid); 1337 current->comm, task_pid_nr(current));
1338 peek_seq = tp->copied_seq; 1338 peek_seq = tp->copied_seq;
1339 } 1339 }
1340 continue; 1340 continue;
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0f00966b1784..9288220b73a8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1121,7 +1121,7 @@ static int tcp_mark_lost_retrans(struct sock *sk, u32 received_upto)
1121 struct sk_buff *skb; 1121 struct sk_buff *skb;
1122 int flag = 0; 1122 int flag = 0;
1123 int cnt = 0; 1123 int cnt = 0;
1124 u32 new_low_seq = 0; 1124 u32 new_low_seq = tp->snd_nxt;
1125 1125
1126 tcp_for_write_queue(skb, sk) { 1126 tcp_for_write_queue(skb, sk) {
1127 u32 ack_seq = TCP_SKB_CB(skb)->ack_seq; 1127 u32 ack_seq = TCP_SKB_CB(skb)->ack_seq;
@@ -1153,7 +1153,7 @@ static int tcp_mark_lost_retrans(struct sock *sk, u32 received_upto)
1153 NET_INC_STATS_BH(LINUX_MIB_TCPLOSTRETRANSMIT); 1153 NET_INC_STATS_BH(LINUX_MIB_TCPLOSTRETRANSMIT);
1154 } 1154 }
1155 } else { 1155 } else {
1156 if (!new_low_seq || before(ack_seq, new_low_seq)) 1156 if (before(ack_seq, new_low_seq))
1157 new_low_seq = ack_seq; 1157 new_low_seq = ack_seq;
1158 cnt += tcp_skb_pcount(skb); 1158 cnt += tcp_skb_pcount(skb);
1159 } 1159 }
@@ -1242,7 +1242,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
1242 int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; 1242 int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3;
1243 int reord = tp->packets_out; 1243 int reord = tp->packets_out;
1244 int prior_fackets; 1244 int prior_fackets;
1245 u32 highest_sack_end_seq = 0; 1245 u32 highest_sack_end_seq = tp->lost_retrans_low;
1246 int flag = 0; 1246 int flag = 0;
1247 int found_dup_sack = 0; 1247 int found_dup_sack = 0;
1248 int cached_fack_count; 1248 int cached_fack_count;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index cb9fc58efb2f..35d2b0e9e10b 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -147,13 +147,14 @@ int __udp_lib_get_port(struct sock *sk, unsigned short snum,
147 write_lock_bh(&udp_hash_lock); 147 write_lock_bh(&udp_hash_lock);
148 148
149 if (!snum) { 149 if (!snum) {
150 int i, low, high; 150 int i, low, high, remaining;
151 unsigned rover, best, best_size_so_far; 151 unsigned rover, best, best_size_so_far;
152 152
153 inet_get_local_port_range(&low, &high); 153 inet_get_local_port_range(&low, &high);
154 remaining = (high - low) + 1;
154 155
155 best_size_so_far = UINT_MAX; 156 best_size_so_far = UINT_MAX;
156 best = rover = net_random() % (high - low) + low; 157 best = rover = net_random() % remaining + low;
157 158
158 /* 1st pass: look for empty (or shortest) hash chain */ 159 /* 1st pass: look for empty (or shortest) hash chain */
159 for (i = 0; i < UDP_HTABLE_SIZE; i++) { 160 for (i = 0; i < UDP_HTABLE_SIZE; i++) {
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index e9bbfde19ac3..5e95c8a07efb 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -16,19 +16,6 @@
16#include <net/ip.h> 16#include <net/ip.h>
17#include <net/xfrm.h> 17#include <net/xfrm.h>
18 18
19static int xfrm4_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq)
20{
21 switch (nexthdr) {
22 case IPPROTO_IPIP:
23 case IPPROTO_IPV6:
24 *spi = ip_hdr(skb)->saddr;
25 *seq = 0;
26 return 0;
27 }
28
29 return xfrm_parse_spi(skb, nexthdr, spi, seq);
30}
31
32#ifdef CONFIG_NETFILTER 19#ifdef CONFIG_NETFILTER
33static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb) 20static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb)
34{ 21{
@@ -46,28 +33,29 @@ drop:
46} 33}
47#endif 34#endif
48 35
49static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type) 36int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
37 int encap_type)
50{ 38{
51 __be32 spi, seq; 39 int err;
40 __be32 seq;
52 struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH]; 41 struct xfrm_state *xfrm_vec[XFRM_MAX_DEPTH];
53 struct xfrm_state *x; 42 struct xfrm_state *x;
54 int xfrm_nr = 0; 43 int xfrm_nr = 0;
55 int decaps = 0; 44 int decaps = 0;
56 int err = xfrm4_parse_spi(skb, ip_hdr(skb)->protocol, &spi, &seq);
57 unsigned int nhoff = offsetof(struct iphdr, protocol); 45 unsigned int nhoff = offsetof(struct iphdr, protocol);
58 46
59 if (err != 0) 47 seq = 0;
48 if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0)
60 goto drop; 49 goto drop;
61 50
62 do { 51 do {
63 const struct iphdr *iph = ip_hdr(skb); 52 const struct iphdr *iph = ip_hdr(skb);
64 int nexthdr;
65 53
66 if (xfrm_nr == XFRM_MAX_DEPTH) 54 if (xfrm_nr == XFRM_MAX_DEPTH)
67 goto drop; 55 goto drop;
68 56
69 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, 57 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi,
70 iph->protocol != IPPROTO_IPV6 ? iph->protocol : IPPROTO_IPIP, AF_INET); 58 nexthdr, AF_INET);
71 if (x == NULL) 59 if (x == NULL)
72 goto drop; 60 goto drop;
73 61
@@ -103,15 +91,15 @@ static int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
103 91
104 xfrm_vec[xfrm_nr++] = x; 92 xfrm_vec[xfrm_nr++] = x;
105 93
106 if (x->mode->input(x, skb)) 94 if (x->outer_mode->input(x, skb))
107 goto drop; 95 goto drop;
108 96
109 if (x->props.mode == XFRM_MODE_TUNNEL) { 97 if (x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL) {
110 decaps = 1; 98 decaps = 1;
111 break; 99 break;
112 } 100 }
113 101
114 err = xfrm_parse_spi(skb, ip_hdr(skb)->protocol, &spi, &seq); 102 err = xfrm_parse_spi(skb, nexthdr, &spi, &seq);
115 if (err < 0) 103 if (err < 0)
116 goto drop; 104 goto drop;
117 } while (!err); 105 } while (!err);
@@ -165,6 +153,7 @@ drop:
165 kfree_skb(skb); 153 kfree_skb(skb);
166 return 0; 154 return 0;
167} 155}
156EXPORT_SYMBOL(xfrm4_rcv_encap);
168 157
169/* If it's a keepalive packet, then just eat it. 158/* If it's a keepalive packet, then just eat it.
170 * If it's an encapsulated packet, then pass it to the 159 * If it's an encapsulated packet, then pass it to the
@@ -252,11 +241,8 @@ int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
252 __skb_pull(skb, len); 241 __skb_pull(skb, len);
253 skb_reset_transport_header(skb); 242 skb_reset_transport_header(skb);
254 243
255 /* modify the protocol (it's ESP!) */
256 iph->protocol = IPPROTO_ESP;
257
258 /* process ESP */ 244 /* process ESP */
259 ret = xfrm4_rcv_encap(skb, encap_type); 245 ret = xfrm4_rcv_encap(skb, IPPROTO_ESP, 0, encap_type);
260 return ret; 246 return ret;
261 247
262drop: 248drop:
@@ -266,7 +252,7 @@ drop:
266 252
267int xfrm4_rcv(struct sk_buff *skb) 253int xfrm4_rcv(struct sk_buff *skb)
268{ 254{
269 return xfrm4_rcv_encap(skb, 0); 255 return xfrm4_rcv_spi(skb, ip_hdr(skb)->protocol, 0);
270} 256}
271 257
272EXPORT_SYMBOL(xfrm4_rcv); 258EXPORT_SYMBOL(xfrm4_rcv);
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index 73d2338bec55..e42e122414be 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -114,6 +114,7 @@ static struct xfrm_mode xfrm4_beet_mode = {
114 .output = xfrm4_beet_output, 114 .output = xfrm4_beet_output,
115 .owner = THIS_MODULE, 115 .owner = THIS_MODULE,
116 .encap = XFRM_MODE_BEET, 116 .encap = XFRM_MODE_BEET,
117 .flags = XFRM_MODE_FLAG_TUNNEL,
117}; 118};
118 119
119static int __init xfrm4_beet_init(void) 120static int __init xfrm4_beet_init(void)
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index 1ae9d32276f0..e4deecba6dd2 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -139,6 +139,7 @@ static struct xfrm_mode xfrm4_tunnel_mode = {
139 .output = xfrm4_tunnel_output, 139 .output = xfrm4_tunnel_output,
140 .owner = THIS_MODULE, 140 .owner = THIS_MODULE,
141 .encap = XFRM_MODE_TUNNEL, 141 .encap = XFRM_MODE_TUNNEL,
142 .flags = XFRM_MODE_FLAG_TUNNEL,
142}; 143};
143 144
144static int __init xfrm4_tunnel_init(void) 145static int __init xfrm4_tunnel_init(void)
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index a4edd666318b..c4a7156962bd 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -47,7 +47,7 @@ static inline int xfrm4_output_one(struct sk_buff *skb)
47 struct iphdr *iph; 47 struct iphdr *iph;
48 int err; 48 int err;
49 49
50 if (x->props.mode == XFRM_MODE_TUNNEL) { 50 if (x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL) {
51 err = xfrm4_tunnel_check_size(skb); 51 err = xfrm4_tunnel_check_size(skb);
52 if (err) 52 if (err)
53 goto error_nolock; 53 goto error_nolock;
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 329825ca68fe..cc86fb110dd8 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -117,7 +117,7 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
117 header_len += xfrm[i]->props.header_len; 117 header_len += xfrm[i]->props.header_len;
118 trailer_len += xfrm[i]->props.trailer_len; 118 trailer_len += xfrm[i]->props.trailer_len;
119 119
120 if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL) { 120 if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) {
121 unsigned short encap_family = xfrm[i]->props.family; 121 unsigned short encap_family = xfrm[i]->props.family;
122 switch (encap_family) { 122 switch (encap_family) {
123 case AF_INET: 123 case AF_INET:
@@ -151,7 +151,6 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
151 i = 0; 151 i = 0;
152 for (; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) { 152 for (; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {
153 struct xfrm_dst *x = (struct xfrm_dst*)dst_prev; 153 struct xfrm_dst *x = (struct xfrm_dst*)dst_prev;
154 struct xfrm_state_afinfo *afinfo;
155 x->u.rt.fl = *fl; 154 x->u.rt.fl = *fl;
156 155
157 dst_prev->xfrm = xfrm[i++]; 156 dst_prev->xfrm = xfrm[i++];
@@ -169,27 +168,17 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
169 /* Copy neighbout for reachability confirmation */ 168 /* Copy neighbout for reachability confirmation */
170 dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour); 169 dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour);
171 dst_prev->input = rt->u.dst.input; 170 dst_prev->input = rt->u.dst.input;
172 /* XXX: When IPv6 module can be unloaded, we should manage reference 171 dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output;
173 * to xfrm6_output in afinfo->output. Miyazawa 172 if (rt0->peer)
174 * */ 173 atomic_inc(&rt0->peer->refcnt);
175 afinfo = xfrm_state_get_afinfo(dst_prev->xfrm->props.family); 174 x->u.rt.peer = rt0->peer;
176 if (!afinfo) {
177 dst = *dst_p;
178 err = -EAFNOSUPPORT;
179 goto error;
180 }
181 dst_prev->output = afinfo->output;
182 xfrm_state_put_afinfo(afinfo);
183 if (dst_prev->xfrm->props.family == AF_INET && rt->peer)
184 atomic_inc(&rt->peer->refcnt);
185 x->u.rt.peer = rt->peer;
186 /* Sheit... I remember I did this right. Apparently, 175 /* Sheit... I remember I did this right. Apparently,
187 * it was magically lost, so this code needs audit */ 176 * it was magically lost, so this code needs audit */
188 x->u.rt.rt_flags = rt0->rt_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL); 177 x->u.rt.rt_flags = rt0->rt_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL);
189 x->u.rt.rt_type = rt->rt_type; 178 x->u.rt.rt_type = rt0->rt_type;
190 x->u.rt.rt_src = rt0->rt_src; 179 x->u.rt.rt_src = rt0->rt_src;
191 x->u.rt.rt_dst = rt0->rt_dst; 180 x->u.rt.rt_dst = rt0->rt_dst;
192 x->u.rt.rt_gateway = rt->rt_gateway; 181 x->u.rt.rt_gateway = rt0->rt_gateway;
193 x->u.rt.rt_spec_dst = rt0->rt_spec_dst; 182 x->u.rt.rt_spec_dst = rt0->rt_spec_dst;
194 x->u.rt.idev = rt0->idev; 183 x->u.rt.idev = rt0->idev;
195 in_dev_hold(rt0->idev); 184 in_dev_hold(rt0->idev);
@@ -291,7 +280,7 @@ static void xfrm4_dst_destroy(struct dst_entry *dst)
291 280
292 if (likely(xdst->u.rt.idev)) 281 if (likely(xdst->u.rt.idev))
293 in_dev_put(xdst->u.rt.idev); 282 in_dev_put(xdst->u.rt.idev);
294 if (dst->xfrm && dst->xfrm->props.family == AF_INET && likely(xdst->u.rt.peer)) 283 if (likely(xdst->u.rt.peer))
295 inet_putpeer(xdst->u.rt.peer); 284 inet_putpeer(xdst->u.rt.peer);
296 xfrm_dst_destroy(xdst); 285 xfrm_dst_destroy(xdst);
297} 286}
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c
index 93e2c061cdda..13d54a1c3337 100644
--- a/net/ipv4/xfrm4_state.c
+++ b/net/ipv4/xfrm4_state.c
@@ -49,6 +49,7 @@ __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
49 49
50static struct xfrm_state_afinfo xfrm4_state_afinfo = { 50static struct xfrm_state_afinfo xfrm4_state_afinfo = {
51 .family = AF_INET, 51 .family = AF_INET,
52 .owner = THIS_MODULE,
52 .init_flags = xfrm4_init_flags, 53 .init_flags = xfrm4_init_flags,
53 .init_tempsel = __xfrm4_init_tempsel, 54 .init_tempsel = __xfrm4_init_tempsel,
54 .output = xfrm4_output, 55 .output = xfrm4_output,
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index 1312417608e2..326845195620 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ b/net/ipv4/xfrm4_tunnel.c
@@ -18,7 +18,7 @@ static int ipip_output(struct xfrm_state *x, struct sk_buff *skb)
18 18
19static int ipip_xfrm_rcv(struct xfrm_state *x, struct sk_buff *skb) 19static int ipip_xfrm_rcv(struct xfrm_state *x, struct sk_buff *skb)
20{ 20{
21 return IPPROTO_IP; 21 return ip_hdr(skb)->protocol;
22} 22}
23 23
24static int ipip_init_state(struct xfrm_state *x) 24static int ipip_init_state(struct xfrm_state *x)
@@ -48,20 +48,25 @@ static struct xfrm_type ipip_type = {
48 .output = ipip_output 48 .output = ipip_output
49}; 49};
50 50
51static int xfrm_tunnel_rcv(struct sk_buff *skb)
52{
53 return xfrm4_rcv_spi(skb, IPPROTO_IP, ip_hdr(skb)->saddr);
54}
55
51static int xfrm_tunnel_err(struct sk_buff *skb, u32 info) 56static int xfrm_tunnel_err(struct sk_buff *skb, u32 info)
52{ 57{
53 return -ENOENT; 58 return -ENOENT;
54} 59}
55 60
56static struct xfrm_tunnel xfrm_tunnel_handler = { 61static struct xfrm_tunnel xfrm_tunnel_handler = {
57 .handler = xfrm4_rcv, 62 .handler = xfrm_tunnel_rcv,
58 .err_handler = xfrm_tunnel_err, 63 .err_handler = xfrm_tunnel_err,
59 .priority = 2, 64 .priority = 2,
60}; 65};
61 66
62#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 67#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
63static struct xfrm_tunnel xfrm64_tunnel_handler = { 68static struct xfrm_tunnel xfrm64_tunnel_handler = {
64 .handler = xfrm4_rcv, 69 .handler = xfrm_tunnel_rcv,
65 .err_handler = xfrm_tunnel_err, 70 .err_handler = xfrm_tunnel_err,
66 .priority = 2, 71 .priority = 2,
67}; 72};
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 52d10d213217..348bd8d06112 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -255,11 +255,6 @@ static void addrconf_mod_timer(struct inet6_ifaddr *ifp,
255 255
256static int snmp6_alloc_dev(struct inet6_dev *idev) 256static int snmp6_alloc_dev(struct inet6_dev *idev)
257{ 257{
258 int err = -ENOMEM;
259
260 if (!idev || !idev->dev)
261 return -EINVAL;
262
263 if (snmp_mib_init((void **)idev->stats.ipv6, 258 if (snmp_mib_init((void **)idev->stats.ipv6,
264 sizeof(struct ipstats_mib), 259 sizeof(struct ipstats_mib),
265 __alignof__(struct ipstats_mib)) < 0) 260 __alignof__(struct ipstats_mib)) < 0)
@@ -280,15 +275,14 @@ err_icmpmsg:
280err_icmp: 275err_icmp:
281 snmp_mib_free((void **)idev->stats.ipv6); 276 snmp_mib_free((void **)idev->stats.ipv6);
282err_ip: 277err_ip:
283 return err; 278 return -ENOMEM;
284} 279}
285 280
286static int snmp6_free_dev(struct inet6_dev *idev) 281static void snmp6_free_dev(struct inet6_dev *idev)
287{ 282{
288 snmp_mib_free((void **)idev->stats.icmpv6msg); 283 snmp_mib_free((void **)idev->stats.icmpv6msg);
289 snmp_mib_free((void **)idev->stats.icmpv6); 284 snmp_mib_free((void **)idev->stats.icmpv6);
290 snmp_mib_free((void **)idev->stats.ipv6); 285 snmp_mib_free((void **)idev->stats.ipv6);
291 return 0;
292} 286}
293 287
294/* Nobody refers to this device, we may destroy it. */ 288/* Nobody refers to this device, we may destroy it. */
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index bc929381fa46..1b1caf3aa1c1 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -747,6 +747,7 @@ static void cleanup_ipv6_mibs(void)
747{ 747{
748 snmp_mib_free((void **)ipv6_statistics); 748 snmp_mib_free((void **)ipv6_statistics);
749 snmp_mib_free((void **)icmpv6_statistics); 749 snmp_mib_free((void **)icmpv6_statistics);
750 snmp_mib_free((void **)icmpv6msg_statistics);
750 snmp_mib_free((void **)udp_stats_in6); 751 snmp_mib_free((void **)udp_stats_in6);
751 snmp_mib_free((void **)udplite_stats_in6); 752 snmp_mib_free((void **)udplite_stats_in6);
752} 753}
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index f9f689162692..67cd06613a25 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -344,6 +344,8 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
344 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) 344 pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
345 goto out; 345 goto out;
346 346
347 skb->ip_summed = CHECKSUM_NONE;
348
347 hdr_len = skb->data - skb_network_header(skb); 349 hdr_len = skb->data - skb_network_header(skb);
348 ah = (struct ip_auth_hdr *)skb->data; 350 ah = (struct ip_auth_hdr *)skb->data;
349 ahp = x->data; 351 ahp = x->data;
@@ -475,8 +477,15 @@ static int ah6_init_state(struct xfrm_state *x)
475 477
476 x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) + 478 x->props.header_len = XFRM_ALIGN8(sizeof(struct ip_auth_hdr) +
477 ahp->icv_trunc_len); 479 ahp->icv_trunc_len);
478 if (x->props.mode == XFRM_MODE_TUNNEL) 480 switch (x->props.mode) {
481 case XFRM_MODE_BEET:
482 case XFRM_MODE_TRANSPORT:
483 break;
484 case XFRM_MODE_TUNNEL:
479 x->props.header_len += sizeof(struct ipv6hdr); 485 x->props.header_len += sizeof(struct ipv6hdr);
486 default:
487 goto error;
488 }
480 x->data = ahp; 489 x->data = ahp;
481 490
482 return 0; 491 return 0;
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 9eb928598351..b0715432e454 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -354,8 +354,15 @@ static int esp6_init_state(struct xfrm_state *x)
354 (x->ealg->alg_key_len + 7) / 8)) 354 (x->ealg->alg_key_len + 7) / 8))
355 goto error; 355 goto error;
356 x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen; 356 x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen;
357 if (x->props.mode == XFRM_MODE_TUNNEL) 357 switch (x->props.mode) {
358 case XFRM_MODE_BEET:
359 case XFRM_MODE_TRANSPORT:
360 break;
361 case XFRM_MODE_TUNNEL:
358 x->props.header_len += sizeof(struct ipv6hdr); 362 x->props.header_len += sizeof(struct ipv6hdr);
363 default:
364 goto error;
365 }
359 x->data = esp; 366 x->data = esp;
360 return 0; 367 return 0;
361 368
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index 1c2c27655435..d6f1026f1943 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -261,7 +261,7 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row,
261 struct inet_timewait_sock *tw = NULL; 261 struct inet_timewait_sock *tw = NULL;
262 262
263 inet_get_local_port_range(&low, &high); 263 inet_get_local_port_range(&low, &high);
264 remaining = high - low; 264 remaining = (high - low) + 1;
265 265
266 local_bh_disable(); 266 local_bh_disable();
267 for (i = 1; i <= remaining; i++) { 267 for (i = 1; i <= remaining; i++) {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 217d60f9fc80..b12cc22e7745 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -154,8 +154,10 @@ static void ip6_fl_gc(unsigned long dummy)
154 write_unlock(&ip6_fl_lock); 154 write_unlock(&ip6_fl_lock);
155} 155}
156 156
157static int fl_intern(struct ip6_flowlabel *fl, __be32 label) 157static struct ip6_flowlabel *fl_intern(struct ip6_flowlabel *fl, __be32 label)
158{ 158{
159 struct ip6_flowlabel *lfl;
160
159 fl->label = label & IPV6_FLOWLABEL_MASK; 161 fl->label = label & IPV6_FLOWLABEL_MASK;
160 162
161 write_lock_bh(&ip6_fl_lock); 163 write_lock_bh(&ip6_fl_lock);
@@ -163,12 +165,26 @@ static int fl_intern(struct ip6_flowlabel *fl, __be32 label)
163 for (;;) { 165 for (;;) {
164 fl->label = htonl(net_random())&IPV6_FLOWLABEL_MASK; 166 fl->label = htonl(net_random())&IPV6_FLOWLABEL_MASK;
165 if (fl->label) { 167 if (fl->label) {
166 struct ip6_flowlabel *lfl;
167 lfl = __fl_lookup(fl->label); 168 lfl = __fl_lookup(fl->label);
168 if (lfl == NULL) 169 if (lfl == NULL)
169 break; 170 break;
170 } 171 }
171 } 172 }
173 } else {
174 /*
175 * we dropper the ip6_fl_lock, so this entry could reappear
176 * and we need to recheck with it.
177 *
178 * OTOH no need to search the active socket first, like it is
179 * done in ipv6_flowlabel_opt - sock is locked, so new entry
180 * with the same label can only appear on another sock
181 */
182 lfl = __fl_lookup(fl->label);
183 if (lfl != NULL) {
184 atomic_inc(&lfl->users);
185 write_unlock_bh(&ip6_fl_lock);
186 return lfl;
187 }
172 } 188 }
173 189
174 fl->lastuse = jiffies; 190 fl->lastuse = jiffies;
@@ -176,7 +192,7 @@ static int fl_intern(struct ip6_flowlabel *fl, __be32 label)
176 fl_ht[FL_HASH(fl->label)] = fl; 192 fl_ht[FL_HASH(fl->label)] = fl;
177 atomic_inc(&fl_size); 193 atomic_inc(&fl_size);
178 write_unlock_bh(&ip6_fl_lock); 194 write_unlock_bh(&ip6_fl_lock);
179 return 0; 195 return NULL;
180} 196}
181 197
182 198
@@ -190,14 +206,17 @@ struct ip6_flowlabel * fl6_sock_lookup(struct sock *sk, __be32 label)
190 206
191 label &= IPV6_FLOWLABEL_MASK; 207 label &= IPV6_FLOWLABEL_MASK;
192 208
209 read_lock_bh(&ip6_sk_fl_lock);
193 for (sfl=np->ipv6_fl_list; sfl; sfl = sfl->next) { 210 for (sfl=np->ipv6_fl_list; sfl; sfl = sfl->next) {
194 struct ip6_flowlabel *fl = sfl->fl; 211 struct ip6_flowlabel *fl = sfl->fl;
195 if (fl->label == label) { 212 if (fl->label == label) {
196 fl->lastuse = jiffies; 213 fl->lastuse = jiffies;
197 atomic_inc(&fl->users); 214 atomic_inc(&fl->users);
215 read_unlock_bh(&ip6_sk_fl_lock);
198 return fl; 216 return fl;
199 } 217 }
200 } 218 }
219 read_unlock_bh(&ip6_sk_fl_lock);
201 return NULL; 220 return NULL;
202} 221}
203 222
@@ -409,6 +428,16 @@ static int ipv6_opt_cmp(struct ipv6_txoptions *o1, struct ipv6_txoptions *o2)
409 return 0; 428 return 0;
410} 429}
411 430
431static inline void fl_link(struct ipv6_pinfo *np, struct ipv6_fl_socklist *sfl,
432 struct ip6_flowlabel *fl)
433{
434 write_lock_bh(&ip6_sk_fl_lock);
435 sfl->fl = fl;
436 sfl->next = np->ipv6_fl_list;
437 np->ipv6_fl_list = sfl;
438 write_unlock_bh(&ip6_sk_fl_lock);
439}
440
412int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) 441int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
413{ 442{
414 int err; 443 int err;
@@ -416,7 +445,8 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
416 struct in6_flowlabel_req freq; 445 struct in6_flowlabel_req freq;
417 struct ipv6_fl_socklist *sfl1=NULL; 446 struct ipv6_fl_socklist *sfl1=NULL;
418 struct ipv6_fl_socklist *sfl, **sflp; 447 struct ipv6_fl_socklist *sfl, **sflp;
419 struct ip6_flowlabel *fl; 448 struct ip6_flowlabel *fl, *fl1 = NULL;
449
420 450
421 if (optlen < sizeof(freq)) 451 if (optlen < sizeof(freq))
422 return -EINVAL; 452 return -EINVAL;
@@ -472,8 +502,6 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
472 sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL); 502 sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL);
473 503
474 if (freq.flr_label) { 504 if (freq.flr_label) {
475 struct ip6_flowlabel *fl1 = NULL;
476
477 err = -EEXIST; 505 err = -EEXIST;
478 read_lock_bh(&ip6_sk_fl_lock); 506 read_lock_bh(&ip6_sk_fl_lock);
479 for (sfl = np->ipv6_fl_list; sfl; sfl = sfl->next) { 507 for (sfl = np->ipv6_fl_list; sfl; sfl = sfl->next) {
@@ -492,6 +520,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
492 if (fl1 == NULL) 520 if (fl1 == NULL)
493 fl1 = fl_lookup(freq.flr_label); 521 fl1 = fl_lookup(freq.flr_label);
494 if (fl1) { 522 if (fl1) {
523recheck:
495 err = -EEXIST; 524 err = -EEXIST;
496 if (freq.flr_flags&IPV6_FL_F_EXCL) 525 if (freq.flr_flags&IPV6_FL_F_EXCL)
497 goto release; 526 goto release;
@@ -513,11 +542,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
513 fl1->linger = fl->linger; 542 fl1->linger = fl->linger;
514 if ((long)(fl->expires - fl1->expires) > 0) 543 if ((long)(fl->expires - fl1->expires) > 0)
515 fl1->expires = fl->expires; 544 fl1->expires = fl->expires;
516 write_lock_bh(&ip6_sk_fl_lock); 545 fl_link(np, sfl1, fl1);
517 sfl1->fl = fl1;
518 sfl1->next = np->ipv6_fl_list;
519 np->ipv6_fl_list = sfl1;
520 write_unlock_bh(&ip6_sk_fl_lock);
521 fl_free(fl); 546 fl_free(fl);
522 return 0; 547 return 0;
523 548
@@ -534,9 +559,9 @@ release:
534 if (sfl1 == NULL || (err = mem_check(sk)) != 0) 559 if (sfl1 == NULL || (err = mem_check(sk)) != 0)
535 goto done; 560 goto done;
536 561
537 err = fl_intern(fl, freq.flr_label); 562 fl1 = fl_intern(fl, freq.flr_label);
538 if (err) 563 if (fl1 != NULL)
539 goto done; 564 goto recheck;
540 565
541 if (!freq.flr_label) { 566 if (!freq.flr_label) {
542 if (copy_to_user(&((struct in6_flowlabel_req __user *) optval)->flr_label, 567 if (copy_to_user(&((struct in6_flowlabel_req __user *) optval)->flr_label,
@@ -545,9 +570,7 @@ release:
545 } 570 }
546 } 571 }
547 572
548 sfl1->fl = fl; 573 fl_link(np, sfl1, fl);
549 sfl1->next = np->ipv6_fl_list;
550 np->ipv6_fl_list = sfl1;
551 return 0; 574 return 0;
552 575
553 default: 576 default:
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 28fc8edfdc3a..80ef2a1d39fd 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -411,8 +411,15 @@ static int ipcomp6_init_state(struct xfrm_state *x)
411 goto out; 411 goto out;
412 412
413 x->props.header_len = 0; 413 x->props.header_len = 0;
414 if (x->props.mode == XFRM_MODE_TUNNEL) 414 switch (x->props.mode) {
415 case XFRM_MODE_BEET:
416 case XFRM_MODE_TRANSPORT:
417 break;
418 case XFRM_MODE_TUNNEL:
415 x->props.header_len += sizeof(struct ipv6hdr); 419 x->props.header_len += sizeof(struct ipv6hdr);
420 default:
421 goto error;
422 }
416 423
417 mutex_lock(&ipcomp6_resource_mutex); 424 mutex_lock(&ipcomp6_resource_mutex);
418 if (!ipcomp6_alloc_scratches()) 425 if (!ipcomp6_alloc_scratches())
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 6cc33dc83d1c..20cfc90d5597 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1658,30 +1658,26 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
1658 struct inet6_dev *idev; 1658 struct inet6_dev *idev;
1659 int ret; 1659 int ret;
1660 1660
1661 if (ctl->ctl_name == NET_NEIGH_RETRANS_TIME || 1661 if ((strcmp(ctl->procname, "retrans_time") == 0) ||
1662 ctl->ctl_name == NET_NEIGH_REACHABLE_TIME) 1662 (strcmp(ctl->procname, "base_reachable_time") == 0))
1663 ndisc_warn_deprecated_sysctl(ctl, "syscall", dev ? dev->name : "default"); 1663 ndisc_warn_deprecated_sysctl(ctl, "syscall", dev ? dev->name : "default");
1664 1664
1665 switch (ctl->ctl_name) { 1665 if (strcmp(ctl->procname, "retrans_time") == 0)
1666 case NET_NEIGH_RETRANS_TIME:
1667 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 1666 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
1668 break; 1667
1669 case NET_NEIGH_REACHABLE_TIME: 1668 else if (strcmp(ctl->procname, "base_reachable_time") == 0)
1670 ret = proc_dointvec_jiffies(ctl, write, 1669 ret = proc_dointvec_jiffies(ctl, write,
1671 filp, buffer, lenp, ppos); 1670 filp, buffer, lenp, ppos);
1672 break; 1671
1673 case NET_NEIGH_RETRANS_TIME_MS: 1672 else if ((strcmp(ctl->procname, "retrans_time_ms") == 0) ||
1674 case NET_NEIGH_REACHABLE_TIME_MS: 1673 (strcmp(ctl->procname, "base_reacable_time_ms") == 0))
1675 ret = proc_dointvec_ms_jiffies(ctl, write, 1674 ret = proc_dointvec_ms_jiffies(ctl, write,
1676 filp, buffer, lenp, ppos); 1675 filp, buffer, lenp, ppos);
1677 break; 1676 else
1678 default:
1679 ret = -1; 1677 ret = -1;
1680 }
1681 1678
1682 if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) { 1679 if (write && ret == 0 && dev && (idev = in6_dev_get(dev)) != NULL) {
1683 if (ctl->ctl_name == NET_NEIGH_REACHABLE_TIME || 1680 if (ctl->data == &idev->nd_parms->base_reachable_time)
1684 ctl->ctl_name == NET_NEIGH_REACHABLE_TIME_MS)
1685 idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time); 1681 idev->nd_parms->reachable_time = neigh_rand_reach_time(idev->nd_parms->base_reachable_time);
1686 idev->tstamp = jiffies; 1682 idev->tstamp = jiffies;
1687 inet6_ifinfo_notify(RTM_NEWLINK, idev); 1683 inet6_ifinfo_notify(RTM_NEWLINK, idev);
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 0e40948f4fc6..ad74bab05047 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -306,7 +306,6 @@ static struct nf_hook_ops ipv6_conntrack_ops[] = {
306#ifdef CONFIG_SYSCTL 306#ifdef CONFIG_SYSCTL
307static ctl_table nf_ct_ipv6_sysctl_table[] = { 307static ctl_table nf_ct_ipv6_sysctl_table[] = {
308 { 308 {
309 .ctl_name = NET_NF_CONNTRACK_FRAG6_TIMEOUT,
310 .procname = "nf_conntrack_frag6_timeout", 309 .procname = "nf_conntrack_frag6_timeout",
311 .data = &nf_frags_ctl.timeout, 310 .data = &nf_frags_ctl.timeout,
312 .maxlen = sizeof(unsigned int), 311 .maxlen = sizeof(unsigned int),
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index fbdc66920de4..fd9123f3dc04 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -260,7 +260,6 @@ static int icmpv6_nlattr_to_tuple(struct nlattr *tb[],
260static struct ctl_table_header *icmpv6_sysctl_header; 260static struct ctl_table_header *icmpv6_sysctl_header;
261static struct ctl_table icmpv6_sysctl_table[] = { 261static struct ctl_table icmpv6_sysctl_table[] = {
262 { 262 {
263 .ctl_name = NET_NF_CONNTRACK_ICMPV6_TIMEOUT,
264 .procname = "nf_conntrack_icmpv6_timeout", 263 .procname = "nf_conntrack_icmpv6_timeout",
265 .data = &nf_ct_icmpv6_timeout, 264 .data = &nf_ct_icmpv6_timeout,
266 .maxlen = sizeof(unsigned int), 265 .maxlen = sizeof(unsigned int),
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 726fafd41961..e170c67c47a5 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -130,22 +130,6 @@ static inline void frag_kfree_skb(struct sk_buff *skb, unsigned int *work)
130 kfree_skb(skb); 130 kfree_skb(skb);
131} 131}
132 132
133static void nf_frag_free(struct inet_frag_queue *q)
134{
135 kfree(container_of(q, struct nf_ct_frag6_queue, q));
136}
137
138static inline struct nf_ct_frag6_queue *frag_alloc_queue(void)
139{
140 struct nf_ct_frag6_queue *fq;
141
142 fq = kzalloc(sizeof(struct nf_ct_frag6_queue), GFP_ATOMIC);
143 if (fq == NULL)
144 return NULL;
145 atomic_add(sizeof(struct nf_ct_frag6_queue), &nf_frags.mem);
146 return fq;
147}
148
149/* Destruction primitives. */ 133/* Destruction primitives. */
150 134
151static __inline__ void fq_put(struct nf_ct_frag6_queue *fq) 135static __inline__ void fq_put(struct nf_ct_frag6_queue *fq)
@@ -168,7 +152,10 @@ static void nf_ct_frag6_evictor(void)
168 152
169static void nf_ct_frag6_expire(unsigned long data) 153static void nf_ct_frag6_expire(unsigned long data)
170{ 154{
171 struct nf_ct_frag6_queue *fq = (struct nf_ct_frag6_queue *) data; 155 struct nf_ct_frag6_queue *fq;
156
157 fq = container_of((struct inet_frag_queue *)data,
158 struct nf_ct_frag6_queue, q);
172 159
173 spin_lock(&fq->q.lock); 160 spin_lock(&fq->q.lock);
174 161
@@ -184,89 +171,29 @@ out:
184 171
185/* Creation primitives. */ 172/* Creation primitives. */
186 173
187static struct nf_ct_frag6_queue *nf_ct_frag6_intern(unsigned int hash, 174static __inline__ struct nf_ct_frag6_queue *
188 struct nf_ct_frag6_queue *fq_in) 175fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
189{ 176{
190 struct nf_ct_frag6_queue *fq; 177 struct inet_frag_queue *q;
191#ifdef CONFIG_SMP 178 struct ip6_create_arg arg;
192 struct hlist_node *n; 179 unsigned int hash;
193#endif
194
195 write_lock(&nf_frags.lock);
196#ifdef CONFIG_SMP
197 hlist_for_each_entry(fq, n, &nf_frags.hash[hash], q.list) {
198 if (fq->id == fq_in->id &&
199 ipv6_addr_equal(&fq_in->saddr, &fq->saddr) &&
200 ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) {
201 atomic_inc(&fq->q.refcnt);
202 write_unlock(&nf_frags.lock);
203 fq_in->q.last_in |= COMPLETE;
204 fq_put(fq_in);
205 return fq;
206 }
207 }
208#endif
209 fq = fq_in;
210
211 if (!mod_timer(&fq->q.timer, jiffies + nf_frags_ctl.timeout))
212 atomic_inc(&fq->q.refcnt);
213
214 atomic_inc(&fq->q.refcnt);
215 hlist_add_head(&fq->q.list, &nf_frags.hash[hash]);
216 INIT_LIST_HEAD(&fq->q.lru_list);
217 list_add_tail(&fq->q.lru_list, &nf_frags.lru_list);
218 nf_frags.nqueues++;
219 write_unlock(&nf_frags.lock);
220 return fq;
221}
222 180
181 arg.id = id;
182 arg.src = src;
183 arg.dst = dst;
184 hash = ip6qhashfn(id, src, dst);
223 185
224static struct nf_ct_frag6_queue * 186 q = inet_frag_find(&nf_frags, &arg, hash);
225nf_ct_frag6_create(unsigned int hash, __be32 id, struct in6_addr *src, struct in6_addr *dst) 187 if (q == NULL)
226{
227 struct nf_ct_frag6_queue *fq;
228
229 if ((fq = frag_alloc_queue()) == NULL) {
230 pr_debug("Can't alloc new queue\n");
231 goto oom; 188 goto oom;
232 }
233
234 fq->id = id;
235 ipv6_addr_copy(&fq->saddr, src);
236 ipv6_addr_copy(&fq->daddr, dst);
237
238 setup_timer(&fq->q.timer, nf_ct_frag6_expire, (unsigned long)fq);
239 spin_lock_init(&fq->q.lock);
240 atomic_set(&fq->q.refcnt, 1);
241 189
242 return nf_ct_frag6_intern(hash, fq); 190 return container_of(q, struct nf_ct_frag6_queue, q);
243 191
244oom: 192oom:
193 pr_debug("Can't alloc new queue\n");
245 return NULL; 194 return NULL;
246} 195}
247 196
248static __inline__ struct nf_ct_frag6_queue *
249fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
250{
251 struct nf_ct_frag6_queue *fq;
252 struct hlist_node *n;
253 unsigned int hash = ip6qhashfn(id, src, dst);
254
255 read_lock(&nf_frags.lock);
256 hlist_for_each_entry(fq, n, &nf_frags.hash[hash], q.list) {
257 if (fq->id == id &&
258 ipv6_addr_equal(src, &fq->saddr) &&
259 ipv6_addr_equal(dst, &fq->daddr)) {
260 atomic_inc(&fq->q.refcnt);
261 read_unlock(&nf_frags.lock);
262 return fq;
263 }
264 }
265 read_unlock(&nf_frags.lock);
266
267 return nf_ct_frag6_create(hash, id, src, dst);
268}
269
270 197
271static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, 198static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
272 struct frag_hdr *fhdr, int nhoff) 199 struct frag_hdr *fhdr, int nhoff)
@@ -749,9 +676,12 @@ int nf_ct_frag6_init(void)
749{ 676{
750 nf_frags.ctl = &nf_frags_ctl; 677 nf_frags.ctl = &nf_frags_ctl;
751 nf_frags.hashfn = nf_hashfn; 678 nf_frags.hashfn = nf_hashfn;
752 nf_frags.destructor = nf_frag_free; 679 nf_frags.constructor = ip6_frag_init;
680 nf_frags.destructor = NULL;
753 nf_frags.skb_free = nf_skb_free; 681 nf_frags.skb_free = nf_skb_free;
754 nf_frags.qsize = sizeof(struct nf_ct_frag6_queue); 682 nf_frags.qsize = sizeof(struct nf_ct_frag6_queue);
683 nf_frags.match = ip6_frag_match;
684 nf_frags.frag_expire = nf_ct_frag6_expire;
755 inet_frags_init(&nf_frags); 685 inet_frags_init(&nf_frags);
756 686
757 return 0; 687 return 0;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 6ad19cfc2025..76c88a93b9b5 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -143,6 +143,18 @@ static unsigned int ip6_hashfn(struct inet_frag_queue *q)
143 return ip6qhashfn(fq->id, &fq->saddr, &fq->daddr); 143 return ip6qhashfn(fq->id, &fq->saddr, &fq->daddr);
144} 144}
145 145
146int ip6_frag_match(struct inet_frag_queue *q, void *a)
147{
148 struct frag_queue *fq;
149 struct ip6_create_arg *arg = a;
150
151 fq = container_of(q, struct frag_queue, q);
152 return (fq->id == arg->id &&
153 ipv6_addr_equal(&fq->saddr, arg->src) &&
154 ipv6_addr_equal(&fq->daddr, arg->dst));
155}
156EXPORT_SYMBOL(ip6_frag_match);
157
146/* Memory Tracking Functions. */ 158/* Memory Tracking Functions. */
147static inline void frag_kfree_skb(struct sk_buff *skb, int *work) 159static inline void frag_kfree_skb(struct sk_buff *skb, int *work)
148{ 160{
@@ -152,20 +164,16 @@ static inline void frag_kfree_skb(struct sk_buff *skb, int *work)
152 kfree_skb(skb); 164 kfree_skb(skb);
153} 165}
154 166
155static void ip6_frag_free(struct inet_frag_queue *fq) 167void ip6_frag_init(struct inet_frag_queue *q, void *a)
156{ 168{
157 kfree(container_of(fq, struct frag_queue, q)); 169 struct frag_queue *fq = container_of(q, struct frag_queue, q);
158} 170 struct ip6_create_arg *arg = a;
159
160static inline struct frag_queue *frag_alloc_queue(void)
161{
162 struct frag_queue *fq = kzalloc(sizeof(struct frag_queue), GFP_ATOMIC);
163 171
164 if(!fq) 172 fq->id = arg->id;
165 return NULL; 173 ipv6_addr_copy(&fq->saddr, arg->src);
166 atomic_add(sizeof(struct frag_queue), &ip6_frags.mem); 174 ipv6_addr_copy(&fq->daddr, arg->dst);
167 return fq;
168} 175}
176EXPORT_SYMBOL(ip6_frag_init);
169 177
170/* Destruction primitives. */ 178/* Destruction primitives. */
171 179
@@ -193,9 +201,11 @@ static void ip6_evictor(struct inet6_dev *idev)
193 201
194static void ip6_frag_expire(unsigned long data) 202static void ip6_frag_expire(unsigned long data)
195{ 203{
196 struct frag_queue *fq = (struct frag_queue *) data; 204 struct frag_queue *fq;
197 struct net_device *dev = NULL; 205 struct net_device *dev = NULL;
198 206
207 fq = container_of((struct inet_frag_queue *)data, struct frag_queue, q);
208
199 spin_lock(&fq->q.lock); 209 spin_lock(&fq->q.lock);
200 210
201 if (fq->q.last_in & COMPLETE) 211 if (fq->q.last_in & COMPLETE)
@@ -230,98 +240,30 @@ out:
230 fq_put(fq); 240 fq_put(fq);
231} 241}
232 242
233/* Creation primitives. */ 243static __inline__ struct frag_queue *
234 244fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst,
235 245 struct inet6_dev *idev)
236static struct frag_queue *ip6_frag_intern(struct frag_queue *fq_in)
237{ 246{
238 struct frag_queue *fq; 247 struct inet_frag_queue *q;
248 struct ip6_create_arg arg;
239 unsigned int hash; 249 unsigned int hash;
240#ifdef CONFIG_SMP
241 struct hlist_node *n;
242#endif
243 250
244 write_lock(&ip6_frags.lock); 251 arg.id = id;
245 hash = ip6qhashfn(fq_in->id, &fq_in->saddr, &fq_in->daddr); 252 arg.src = src;
246#ifdef CONFIG_SMP 253 arg.dst = dst;
247 hlist_for_each_entry(fq, n, &ip6_frags.hash[hash], q.list) { 254 hash = ip6qhashfn(id, src, dst);
248 if (fq->id == fq_in->id &&
249 ipv6_addr_equal(&fq_in->saddr, &fq->saddr) &&
250 ipv6_addr_equal(&fq_in->daddr, &fq->daddr)) {
251 atomic_inc(&fq->q.refcnt);
252 write_unlock(&ip6_frags.lock);
253 fq_in->q.last_in |= COMPLETE;
254 fq_put(fq_in);
255 return fq;
256 }
257 }
258#endif
259 fq = fq_in;
260
261 if (!mod_timer(&fq->q.timer, jiffies + ip6_frags_ctl.timeout))
262 atomic_inc(&fq->q.refcnt);
263
264 atomic_inc(&fq->q.refcnt);
265 hlist_add_head(&fq->q.list, &ip6_frags.hash[hash]);
266 INIT_LIST_HEAD(&fq->q.lru_list);
267 list_add_tail(&fq->q.lru_list, &ip6_frags.lru_list);
268 ip6_frags.nqueues++;
269 write_unlock(&ip6_frags.lock);
270 return fq;
271}
272
273
274static struct frag_queue *
275ip6_frag_create(__be32 id, struct in6_addr *src, struct in6_addr *dst,
276 struct inet6_dev *idev)
277{
278 struct frag_queue *fq;
279 255
280 if ((fq = frag_alloc_queue()) == NULL) 256 q = inet_frag_find(&ip6_frags, &arg, hash);
257 if (q == NULL)
281 goto oom; 258 goto oom;
282 259
283 fq->id = id; 260 return container_of(q, struct frag_queue, q);
284 ipv6_addr_copy(&fq->saddr, src);
285 ipv6_addr_copy(&fq->daddr, dst);
286
287 init_timer(&fq->q.timer);
288 fq->q.timer.function = ip6_frag_expire;
289 fq->q.timer.data = (long) fq;
290 spin_lock_init(&fq->q.lock);
291 atomic_set(&fq->q.refcnt, 1);
292
293 return ip6_frag_intern(fq);
294 261
295oom: 262oom:
296 IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS); 263 IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS);
297 return NULL; 264 return NULL;
298} 265}
299 266
300static __inline__ struct frag_queue *
301fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst,
302 struct inet6_dev *idev)
303{
304 struct frag_queue *fq;
305 struct hlist_node *n;
306 unsigned int hash;
307
308 read_lock(&ip6_frags.lock);
309 hash = ip6qhashfn(id, src, dst);
310 hlist_for_each_entry(fq, n, &ip6_frags.hash[hash], q.list) {
311 if (fq->id == id &&
312 ipv6_addr_equal(src, &fq->saddr) &&
313 ipv6_addr_equal(dst, &fq->daddr)) {
314 atomic_inc(&fq->q.refcnt);
315 read_unlock(&ip6_frags.lock);
316 return fq;
317 }
318 }
319 read_unlock(&ip6_frags.lock);
320
321 return ip6_frag_create(id, src, dst, idev);
322}
323
324
325static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb, 267static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
326 struct frag_hdr *fhdr, int nhoff) 268 struct frag_hdr *fhdr, int nhoff)
327{ 269{
@@ -697,8 +639,11 @@ void __init ipv6_frag_init(void)
697 639
698 ip6_frags.ctl = &ip6_frags_ctl; 640 ip6_frags.ctl = &ip6_frags_ctl;
699 ip6_frags.hashfn = ip6_hashfn; 641 ip6_frags.hashfn = ip6_hashfn;
700 ip6_frags.destructor = ip6_frag_free; 642 ip6_frags.constructor = ip6_frag_init;
643 ip6_frags.destructor = NULL;
701 ip6_frags.skb_free = NULL; 644 ip6_frags.skb_free = NULL;
702 ip6_frags.qsize = sizeof(struct frag_queue); 645 ip6_frags.qsize = sizeof(struct frag_queue);
646 ip6_frags.match = ip6_frag_match;
647 ip6_frags.frag_expire = ip6_frag_expire;
703 inet_frags_init(&ip6_frags); 648 inet_frags_init(&ip6_frags);
704} 649}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index cce9941c11c6..95f8e4a62f68 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2397,7 +2397,6 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
2397 2397
2398ctl_table ipv6_route_table[] = { 2398ctl_table ipv6_route_table[] = {
2399 { 2399 {
2400 .ctl_name = NET_IPV6_ROUTE_FLUSH,
2401 .procname = "flush", 2400 .procname = "flush",
2402 .data = &flush_delay, 2401 .data = &flush_delay,
2403 .maxlen = sizeof(int), 2402 .maxlen = sizeof(int),
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index 02f69e544f6f..515783707e86 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -16,7 +16,7 @@
16#include <net/ipv6.h> 16#include <net/ipv6.h>
17#include <net/xfrm.h> 17#include <net/xfrm.h>
18 18
19int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi) 19int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
20{ 20{
21 int err; 21 int err;
22 __be32 seq; 22 __be32 seq;
@@ -24,11 +24,9 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
24 struct xfrm_state *x; 24 struct xfrm_state *x;
25 int xfrm_nr = 0; 25 int xfrm_nr = 0;
26 int decaps = 0; 26 int decaps = 0;
27 int nexthdr;
28 unsigned int nhoff; 27 unsigned int nhoff;
29 28
30 nhoff = IP6CB(skb)->nhoff; 29 nhoff = IP6CB(skb)->nhoff;
31 nexthdr = skb_network_header(skb)[nhoff];
32 30
33 seq = 0; 31 seq = 0;
34 if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0) 32 if (!spi && (err = xfrm_parse_spi(skb, nexthdr, &spi, &seq)) != 0)
@@ -41,7 +39,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
41 goto drop; 39 goto drop;
42 40
43 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi, 41 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, spi,
44 nexthdr != IPPROTO_IPIP ? nexthdr : IPPROTO_IPV6, AF_INET6); 42 nexthdr, AF_INET6);
45 if (x == NULL) 43 if (x == NULL)
46 goto drop; 44 goto drop;
47 spin_lock(&x->lock); 45 spin_lock(&x->lock);
@@ -70,10 +68,10 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
70 68
71 xfrm_vec[xfrm_nr++] = x; 69 xfrm_vec[xfrm_nr++] = x;
72 70
73 if (x->mode->input(x, skb)) 71 if (x->outer_mode->input(x, skb))
74 goto drop; 72 goto drop;
75 73
76 if (x->props.mode == XFRM_MODE_TUNNEL) { /* XXX */ 74 if (x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL) {
77 decaps = 1; 75 decaps = 1;
78 break; 76 break;
79 } 77 }
@@ -99,7 +97,6 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
99 memcpy(skb->sp->xvec + skb->sp->len, xfrm_vec, 97 memcpy(skb->sp->xvec + skb->sp->len, xfrm_vec,
100 xfrm_nr * sizeof(xfrm_vec[0])); 98 xfrm_nr * sizeof(xfrm_vec[0]));
101 skb->sp->len += xfrm_nr; 99 skb->sp->len += xfrm_nr;
102 skb->ip_summed = CHECKSUM_NONE;
103 100
104 nf_reset(skb); 101 nf_reset(skb);
105 102
@@ -135,7 +132,8 @@ EXPORT_SYMBOL(xfrm6_rcv_spi);
135 132
136int xfrm6_rcv(struct sk_buff *skb) 133int xfrm6_rcv(struct sk_buff *skb)
137{ 134{
138 return xfrm6_rcv_spi(skb, 0); 135 return xfrm6_rcv_spi(skb, skb_network_header(skb)[IP6CB(skb)->nhoff],
136 0);
139} 137}
140 138
141EXPORT_SYMBOL(xfrm6_rcv); 139EXPORT_SYMBOL(xfrm6_rcv);
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index 13bb1e856764..2bfb4f05c14c 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -79,6 +79,7 @@ static struct xfrm_mode xfrm6_beet_mode = {
79 .output = xfrm6_beet_output, 79 .output = xfrm6_beet_output,
80 .owner = THIS_MODULE, 80 .owner = THIS_MODULE,
81 .encap = XFRM_MODE_BEET, 81 .encap = XFRM_MODE_BEET,
82 .flags = XFRM_MODE_FLAG_TUNNEL,
82}; 83};
83 84
84static int __init xfrm6_beet_init(void) 85static int __init xfrm6_beet_init(void)
diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c
index 957ae36b6695..a7bc8c62317a 100644
--- a/net/ipv6/xfrm6_mode_ro.c
+++ b/net/ipv6/xfrm6_mode_ro.c
@@ -58,16 +58,7 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
58 return 0; 58 return 0;
59} 59}
60 60
61/*
62 * Do nothing about routing optimization header unlike IPsec.
63 */
64static int xfrm6_ro_input(struct xfrm_state *x, struct sk_buff *skb)
65{
66 return 0;
67}
68
69static struct xfrm_mode xfrm6_ro_mode = { 61static struct xfrm_mode xfrm6_ro_mode = {
70 .input = xfrm6_ro_input,
71 .output = xfrm6_ro_output, 62 .output = xfrm6_ro_output,
72 .owner = THIS_MODULE, 63 .owner = THIS_MODULE,
73 .encap = XFRM_MODE_ROUTEOPTIMIZATION, 64 .encap = XFRM_MODE_ROUTEOPTIMIZATION,
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index ea2283879112..fd84e2217274 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -118,6 +118,7 @@ static struct xfrm_mode xfrm6_tunnel_mode = {
118 .output = xfrm6_tunnel_output, 118 .output = xfrm6_tunnel_output,
119 .owner = THIS_MODULE, 119 .owner = THIS_MODULE,
120 .encap = XFRM_MODE_TUNNEL, 120 .encap = XFRM_MODE_TUNNEL,
121 .flags = XFRM_MODE_FLAG_TUNNEL,
121}; 122};
122 123
123static int __init xfrm6_tunnel_init(void) 124static int __init xfrm6_tunnel_init(void)
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index a5a32c17249d..656976760ad4 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -50,7 +50,7 @@ static inline int xfrm6_output_one(struct sk_buff *skb)
50 struct ipv6hdr *iph; 50 struct ipv6hdr *iph;
51 int err; 51 int err;
52 52
53 if (x->props.mode == XFRM_MODE_TUNNEL) { 53 if (x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL) {
54 err = xfrm6_tunnel_check_size(skb); 54 err = xfrm6_tunnel_check_size(skb);
55 if (err) 55 if (err)
56 goto error_nolock; 56 goto error_nolock;
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 15aa4c58c315..82e27b80d07d 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -178,8 +178,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
178 __xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]); 178 __xfrm6_bundle_len_inc(&header_len, &nfheader_len, xfrm[i]);
179 trailer_len += xfrm[i]->props.trailer_len; 179 trailer_len += xfrm[i]->props.trailer_len;
180 180
181 if (xfrm[i]->props.mode == XFRM_MODE_TUNNEL || 181 if (xfrm[i]->props.mode != XFRM_MODE_TRANSPORT) {
182 xfrm[i]->props.mode == XFRM_MODE_ROUTEOPTIMIZATION) {
183 unsigned short encap_family = xfrm[i]->props.family; 182 unsigned short encap_family = xfrm[i]->props.family;
184 switch(encap_family) { 183 switch(encap_family) {
185 case AF_INET: 184 case AF_INET:
@@ -215,7 +214,6 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
215 i = 0; 214 i = 0;
216 for (; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) { 215 for (; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {
217 struct xfrm_dst *x = (struct xfrm_dst*)dst_prev; 216 struct xfrm_dst *x = (struct xfrm_dst*)dst_prev;
218 struct xfrm_state_afinfo *afinfo;
219 217
220 dst_prev->xfrm = xfrm[i++]; 218 dst_prev->xfrm = xfrm[i++];
221 dst_prev->dev = rt->u.dst.dev; 219 dst_prev->dev = rt->u.dst.dev;
@@ -232,18 +230,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
232 /* Copy neighbour for reachability confirmation */ 230 /* Copy neighbour for reachability confirmation */
233 dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour); 231 dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour);
234 dst_prev->input = rt->u.dst.input; 232 dst_prev->input = rt->u.dst.input;
235 /* XXX: When IPv4 is implemented as module and can be unloaded, 233 dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output;
236 * we should manage reference to xfrm4_output in afinfo->output.
237 * Miyazawa
238 */
239 afinfo = xfrm_state_get_afinfo(dst_prev->xfrm->props.family);
240 if (!afinfo) {
241 dst = *dst_p;
242 goto error;
243 }
244
245 dst_prev->output = afinfo->output;
246 xfrm_state_put_afinfo(afinfo);
247 /* Sheit... I remember I did this right. Apparently, 234 /* Sheit... I remember I did this right. Apparently,
248 * it was magically lost, so this code needs audit */ 235 * it was magically lost, so this code needs audit */
249 x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL); 236 x->u.rt6.rt6i_flags = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL);
diff --git a/net/ipv6/xfrm6_state.c b/net/ipv6/xfrm6_state.c
index cdadb4847469..b392bee396f1 100644
--- a/net/ipv6/xfrm6_state.c
+++ b/net/ipv6/xfrm6_state.c
@@ -93,7 +93,8 @@ __xfrm6_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n)
93 /* Rule 4: select IPsec tunnel */ 93 /* Rule 4: select IPsec tunnel */
94 for (i = 0; i < n; i++) { 94 for (i = 0; i < n; i++) {
95 if (src[i] && 95 if (src[i] &&
96 src[i]->props.mode == XFRM_MODE_TUNNEL) { 96 (src[i]->props.mode == XFRM_MODE_TUNNEL ||
97 src[i]->props.mode == XFRM_MODE_BEET)) {
97 dst[j++] = src[i]; 98 dst[j++] = src[i];
98 src[i] = NULL; 99 src[i] = NULL;
99 } 100 }
@@ -146,7 +147,8 @@ __xfrm6_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n)
146 /* Rule 3: select IPsec tunnel */ 147 /* Rule 3: select IPsec tunnel */
147 for (i = 0; i < n; i++) { 148 for (i = 0; i < n; i++) {
148 if (src[i] && 149 if (src[i] &&
149 src[i]->mode == XFRM_MODE_TUNNEL) { 150 (src[i]->mode == XFRM_MODE_TUNNEL ||
151 src[i]->mode == XFRM_MODE_BEET)) {
150 dst[j++] = src[i]; 152 dst[j++] = src[i];
151 src[i] = NULL; 153 src[i] = NULL;
152 } 154 }
@@ -168,6 +170,7 @@ __xfrm6_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n)
168 170
169static struct xfrm_state_afinfo xfrm6_state_afinfo = { 171static struct xfrm_state_afinfo xfrm6_state_afinfo = {
170 .family = AF_INET6, 172 .family = AF_INET6,
173 .owner = THIS_MODULE,
171 .init_tempsel = __xfrm6_init_tempsel, 174 .init_tempsel = __xfrm6_init_tempsel,
172 .tmpl_sort = __xfrm6_tmpl_sort, 175 .tmpl_sort = __xfrm6_tmpl_sort,
173 .state_sort = __xfrm6_state_sort, 176 .state_sort = __xfrm6_state_sort,
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
index 3f8a3abde67e..fae90ff31087 100644
--- a/net/ipv6/xfrm6_tunnel.c
+++ b/net/ipv6/xfrm6_tunnel.c
@@ -248,7 +248,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
248 248
249static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) 249static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
250{ 250{
251 return 0; 251 return skb_network_header(skb)[IP6CB(skb)->nhoff];
252} 252}
253 253
254static int xfrm6_tunnel_rcv(struct sk_buff *skb) 254static int xfrm6_tunnel_rcv(struct sk_buff *skb)
@@ -257,7 +257,7 @@ static int xfrm6_tunnel_rcv(struct sk_buff *skb)
257 __be32 spi; 257 __be32 spi;
258 258
259 spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr); 259 spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr);
260 return xfrm6_rcv_spi(skb, spi) > 0 ? : 0; 260 return xfrm6_rcv_spi(skb, IPPROTO_IPV6, spi) > 0 ? : 0;
261} 261}
262 262
263static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 263static int xfrm6_tunnel_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
diff --git a/net/irda/discovery.c b/net/irda/discovery.c
index af0cea721d2a..80c33f408e3f 100644
--- a/net/irda/discovery.c
+++ b/net/irda/discovery.c
@@ -202,7 +202,7 @@ void irlmp_expire_discoveries(hashbin_t *log, __u32 saddr, int force)
202 /* Drop the spinlock before calling the higher layers, as 202 /* Drop the spinlock before calling the higher layers, as
203 * we can't guarantee they won't call us back and create a 203 * we can't guarantee they won't call us back and create a
204 * deadlock. We will work on our own private data, so we 204 * deadlock. We will work on our own private data, so we
205 * don't care to be interupted. - Jean II */ 205 * don't care to be interrupted. - Jean II */
206 spin_unlock_irqrestore(&log->hb_spinlock, flags); 206 spin_unlock_irqrestore(&log->hb_spinlock, flags);
207 207
208 if(buffer == NULL) 208 if(buffer == NULL)
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c
index 824309dabfe9..b5a13882c927 100644
--- a/net/irda/ircomm/ircomm_tty_attach.c
+++ b/net/irda/ircomm/ircomm_tty_attach.c
@@ -381,18 +381,9 @@ static void ircomm_tty_discovery_indication(discinfo_t *discovery,
381 info.daddr = discovery->daddr; 381 info.daddr = discovery->daddr;
382 info.saddr = discovery->saddr; 382 info.saddr = discovery->saddr;
383 383
384 /* FIXME. We have a locking problem on the hashbin here. 384 self = (struct ircomm_tty_cb *) priv;
385 * We probably need to use hashbin_find_next(), but we first 385 ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
386 * need to ensure that "line" is unique. - Jean II */ 386 NULL, &info);
387 self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty);
388 while (self != NULL) {
389 IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
390
391 ircomm_tty_do_event(self, IRCOMM_TTY_DISCOVERY_INDICATION,
392 NULL, &info);
393
394 self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
395 }
396} 387}
397 388
398/* 389/*
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index ee3889fa49ab..dc5e34a01620 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/iriap_event.c b/net/irda/iriap_event.c
index 99b18dc7a0b7..8fb9d7277ca8 100644
--- a/net/irda/iriap_event.c
+++ b/net/irda/iriap_event.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/irias_object.c b/net/irda/irias_object.c
index cf302457097b..cbcf04380f3a 100644
--- a/net/irda/irias_object.c
+++ b/net/irda/irias_object.c
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/net/irda/irlan/irlan_client.c b/net/irda/irlan/irlan_client.c
index 87039c2fb6a2..fff52d57a200 100644
--- a/net/irda/irlan/irlan_client.c
+++ b/net/irda/irlan/irlan_client.c
@@ -20,7 +20,7 @@
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsø admit liability nor 23 * Neither Dag Brattli nor University of Tromsø admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
diff --git a/net/irda/irlan/irlan_client_event.c b/net/irda/irlan/irlan_client_event.c
index 843ab6fbb394..6afcee59e906 100644
--- a/net/irda/irlan/irlan_client_event.c
+++ b/net/irda/irlan/irlan_client_event.c
@@ -17,7 +17,7 @@
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsø admit liability nor 20 * Neither Dag Brattli nor University of Tromsø admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index f5778ef3ccc7..a4b56e25a917 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -17,7 +17,7 @@
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsø admit liability nor 20 * Neither Dag Brattli nor University of Tromsø admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index 340f04a36b02..7f9c8542e5fc 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -19,7 +19,7 @@
19 * published by the Free Software Foundation; either version 2 of 19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version. 20 * the License, or (at your option) any later version.
21 * 21 *
22 * Neither Dag Brattli nor University of Tromsø admit liability nor 22 * Neither Dag Brattli nor University of Tromsø admit liability nor
23 * provide warranty for any of this software. This material is 23 * provide warranty for any of this software. This material is
24 * provided "AS-IS" and at no charge. 24 * provided "AS-IS" and at no charge.
25 * 25 *
diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c
index 623e0fd16c19..a9750a801388 100644
--- a/net/irda/irlan/irlan_event.c
+++ b/net/irda/irlan/irlan_event.c
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/net/irda/irlan/irlan_filter.c b/net/irda/irlan/irlan_filter.c
index e6346b88f934..4384be9a6888 100644
--- a/net/irda/irlan/irlan_filter.c
+++ b/net/irda/irlan/irlan_filter.c
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/net/irda/irlan/irlan_provider.c b/net/irda/irlan/irlan_provider.c
index aac66434e473..13db942812e4 100644
--- a/net/irda/irlan/irlan_provider.c
+++ b/net/irda/irlan/irlan_provider.c
@@ -20,7 +20,7 @@
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsø admit liability nor 23 * Neither Dag Brattli nor University of Tromsø admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
diff --git a/net/irda/irlan/irlan_provider_event.c b/net/irda/irlan/irlan_provider_event.c
index ef401bd6ea00..10ece5a47522 100644
--- a/net/irda/irlan/irlan_provider_event.c
+++ b/net/irda/irlan/irlan_provider_event.c
@@ -16,7 +16,7 @@
16 * published by the Free Software Foundation; either version 2 of 16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version. 17 * the License, or (at your option) any later version.
18 * 18 *
19 * Neither Dag Brattli nor University of Tromsø admit liability nor 19 * Neither Dag Brattli nor University of Tromsø admit liability nor
20 * provide warranty for any of this software. This material is 20 * provide warranty for any of this software. This material is
21 * provided "AS-IS" and at no charge. 21 * provided "AS-IS" and at no charge.
22 * 22 *
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c
index a8b8873aa263..4c33bf5c8354 100644
--- a/net/irda/irlap_event.c
+++ b/net/irda/irlap_event.c
@@ -19,7 +19,7 @@
19 * published by the Free Software Foundation; either version 2 of 19 * published by the Free Software Foundation; either version 2 of
20 * the License, or (at your option) any later version. 20 * the License, or (at your option) any later version.
21 * 21 *
22 * Neither Dag Brattli nor University of Tromsø admit liability nor 22 * Neither Dag Brattli nor University of Tromsø admit liability nor
23 * provide warranty for any of this software. This material is 23 * provide warranty for any of this software. This material is
24 * provided "AS-IS" and at no charge. 24 * provided "AS-IS" and at no charge.
25 * 25 *
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 77ac27e81161..4f3764546b2f 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index 7db92ced2c02..cedff8068fbc 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/irlmp_event.c b/net/irda/irlmp_event.c
index 65ffa981510a..1bba87e78609 100644
--- a/net/irda/irlmp_event.c
+++ b/net/irda/irlmp_event.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/irlmp_frame.c b/net/irda/irlmp_frame.c
index 559302d3fe66..0a79d9aeb08c 100644
--- a/net/irda/irlmp_frame.c
+++ b/net/irda/irlmp_frame.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/irmod.c b/net/irda/irmod.c
index 8ba703da2797..01554b996b9b 100644
--- a/net/irda/irmod.c
+++ b/net/irda/irmod.c
@@ -17,7 +17,7 @@
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsø admit liability nor 20 * Neither Dag Brattli nor University of Tromsø admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c
index d058b467f9e4..40c28efaed95 100644
--- a/net/irda/irqueue.c
+++ b/net/irda/irqueue.c
@@ -28,7 +28,7 @@
28 * published by the Free Software Foundation; either version 2 of 28 * published by the Free Software Foundation; either version 2 of
29 * the License, or (at your option) any later version. 29 * the License, or (at your option) any later version.
30 * 30 *
31 * Neither Dag Brattli nor University of Tromsø admit liability nor 31 * Neither Dag Brattli nor University of Tromsø admit liability nor
32 * provide warranty for any of this software. This material is 32 * provide warranty for any of this software. This material is
33 * provided "AS-IS" and at no charge. 33 * provided "AS-IS" and at no charge.
34 * 34 *
diff --git a/net/irda/irsysctl.c b/net/irda/irsysctl.c
index 957e04feb0f7..565cbf0421cd 100644
--- a/net/irda/irsysctl.c
+++ b/net/irda/irsysctl.c
@@ -17,7 +17,7 @@
17 * published by the Free Software Foundation; either version 2 of 17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version. 18 * the License, or (at your option) any later version.
19 * 19 *
20 * Neither Dag Brattli nor University of Tromsø admit liability nor 20 * Neither Dag Brattli nor University of Tromsø admit liability nor
21 * provide warranty for any of this software. This material is 21 * provide warranty for any of this software. This material is
22 * provided "AS-IS" and at no charge. 22 * provided "AS-IS" and at no charge.
23 * 23 *
@@ -31,12 +31,6 @@
31#include <net/irda/irda.h> /* irda_debug */ 31#include <net/irda/irda.h> /* irda_debug */
32#include <net/irda/irias_object.h> 32#include <net/irda/irias_object.h>
33 33
34#define NET_IRDA 412 /* Random number */
35enum { DISCOVERY=1, DEVNAME, DEBUG, FAST_POLL, DISCOVERY_SLOTS,
36 DISCOVERY_TIMEOUT, SLOT_TIMEOUT, MAX_BAUD_RATE, MIN_TX_TURN_TIME,
37 MAX_TX_DATA_SIZE, MAX_TX_WINDOW, MAX_NOREPLY_TIME, WARN_NOREPLY_TIME,
38 LAP_KEEPALIVE_TIME };
39
40extern int sysctl_discovery; 34extern int sysctl_discovery;
41extern int sysctl_discovery_slots; 35extern int sysctl_discovery_slots;
42extern int sysctl_discovery_timeout; 36extern int sysctl_discovery_timeout;
@@ -94,7 +88,7 @@ static int do_devname(ctl_table *table, int write, struct file *filp,
94/* One file */ 88/* One file */
95static ctl_table irda_table[] = { 89static ctl_table irda_table[] = {
96 { 90 {
97 .ctl_name = DISCOVERY, 91 .ctl_name = NET_IRDA_DISCOVERY,
98 .procname = "discovery", 92 .procname = "discovery",
99 .data = &sysctl_discovery, 93 .data = &sysctl_discovery,
100 .maxlen = sizeof(int), 94 .maxlen = sizeof(int),
@@ -102,7 +96,7 @@ static ctl_table irda_table[] = {
102 .proc_handler = &proc_dointvec 96 .proc_handler = &proc_dointvec
103 }, 97 },
104 { 98 {
105 .ctl_name = DEVNAME, 99 .ctl_name = NET_IRDA_DEVNAME,
106 .procname = "devname", 100 .procname = "devname",
107 .data = sysctl_devname, 101 .data = sysctl_devname,
108 .maxlen = 65, 102 .maxlen = 65,
@@ -112,7 +106,7 @@ static ctl_table irda_table[] = {
112 }, 106 },
113#ifdef CONFIG_IRDA_DEBUG 107#ifdef CONFIG_IRDA_DEBUG
114 { 108 {
115 .ctl_name = DEBUG, 109 .ctl_name = NET_IRDA_DEBUG,
116 .procname = "debug", 110 .procname = "debug",
117 .data = &irda_debug, 111 .data = &irda_debug,
118 .maxlen = sizeof(int), 112 .maxlen = sizeof(int),
@@ -122,7 +116,7 @@ static ctl_table irda_table[] = {
122#endif 116#endif
123#ifdef CONFIG_IRDA_FAST_RR 117#ifdef CONFIG_IRDA_FAST_RR
124 { 118 {
125 .ctl_name = FAST_POLL, 119 .ctl_name = NET_IRDA_FAST_POLL,
126 .procname = "fast_poll_increase", 120 .procname = "fast_poll_increase",
127 .data = &sysctl_fast_poll_increase, 121 .data = &sysctl_fast_poll_increase,
128 .maxlen = sizeof(int), 122 .maxlen = sizeof(int),
@@ -131,7 +125,7 @@ static ctl_table irda_table[] = {
131 }, 125 },
132#endif 126#endif
133 { 127 {
134 .ctl_name = DISCOVERY_SLOTS, 128 .ctl_name = NET_IRDA_DISCOVERY_SLOTS,
135 .procname = "discovery_slots", 129 .procname = "discovery_slots",
136 .data = &sysctl_discovery_slots, 130 .data = &sysctl_discovery_slots,
137 .maxlen = sizeof(int), 131 .maxlen = sizeof(int),
@@ -142,7 +136,7 @@ static ctl_table irda_table[] = {
142 .extra2 = &max_discovery_slots 136 .extra2 = &max_discovery_slots
143 }, 137 },
144 { 138 {
145 .ctl_name = DISCOVERY_TIMEOUT, 139 .ctl_name = NET_IRDA_DISCOVERY_TIMEOUT,
146 .procname = "discovery_timeout", 140 .procname = "discovery_timeout",
147 .data = &sysctl_discovery_timeout, 141 .data = &sysctl_discovery_timeout,
148 .maxlen = sizeof(int), 142 .maxlen = sizeof(int),
@@ -150,7 +144,7 @@ static ctl_table irda_table[] = {
150 .proc_handler = &proc_dointvec 144 .proc_handler = &proc_dointvec
151 }, 145 },
152 { 146 {
153 .ctl_name = SLOT_TIMEOUT, 147 .ctl_name = NET_IRDA_SLOT_TIMEOUT,
154 .procname = "slot_timeout", 148 .procname = "slot_timeout",
155 .data = &sysctl_slot_timeout, 149 .data = &sysctl_slot_timeout,
156 .maxlen = sizeof(int), 150 .maxlen = sizeof(int),
@@ -161,7 +155,7 @@ static ctl_table irda_table[] = {
161 .extra2 = &max_slot_timeout 155 .extra2 = &max_slot_timeout
162 }, 156 },
163 { 157 {
164 .ctl_name = MAX_BAUD_RATE, 158 .ctl_name = NET_IRDA_MAX_BAUD_RATE,
165 .procname = "max_baud_rate", 159 .procname = "max_baud_rate",
166 .data = &sysctl_max_baud_rate, 160 .data = &sysctl_max_baud_rate,
167 .maxlen = sizeof(int), 161 .maxlen = sizeof(int),
@@ -172,7 +166,7 @@ static ctl_table irda_table[] = {
172 .extra2 = &max_max_baud_rate 166 .extra2 = &max_max_baud_rate
173 }, 167 },
174 { 168 {
175 .ctl_name = MIN_TX_TURN_TIME, 169 .ctl_name = NET_IRDA_MIN_TX_TURN_TIME,
176 .procname = "min_tx_turn_time", 170 .procname = "min_tx_turn_time",
177 .data = &sysctl_min_tx_turn_time, 171 .data = &sysctl_min_tx_turn_time,
178 .maxlen = sizeof(int), 172 .maxlen = sizeof(int),
@@ -183,7 +177,7 @@ static ctl_table irda_table[] = {
183 .extra2 = &max_min_tx_turn_time 177 .extra2 = &max_min_tx_turn_time
184 }, 178 },
185 { 179 {
186 .ctl_name = MAX_TX_DATA_SIZE, 180 .ctl_name = NET_IRDA_MAX_TX_DATA_SIZE,
187 .procname = "max_tx_data_size", 181 .procname = "max_tx_data_size",
188 .data = &sysctl_max_tx_data_size, 182 .data = &sysctl_max_tx_data_size,
189 .maxlen = sizeof(int), 183 .maxlen = sizeof(int),
@@ -194,7 +188,7 @@ static ctl_table irda_table[] = {
194 .extra2 = &max_max_tx_data_size 188 .extra2 = &max_max_tx_data_size
195 }, 189 },
196 { 190 {
197 .ctl_name = MAX_TX_WINDOW, 191 .ctl_name = NET_IRDA_MAX_TX_WINDOW,
198 .procname = "max_tx_window", 192 .procname = "max_tx_window",
199 .data = &sysctl_max_tx_window, 193 .data = &sysctl_max_tx_window,
200 .maxlen = sizeof(int), 194 .maxlen = sizeof(int),
@@ -205,7 +199,7 @@ static ctl_table irda_table[] = {
205 .extra2 = &max_max_tx_window 199 .extra2 = &max_max_tx_window
206 }, 200 },
207 { 201 {
208 .ctl_name = MAX_NOREPLY_TIME, 202 .ctl_name = NET_IRDA_MAX_NOREPLY_TIME,
209 .procname = "max_noreply_time", 203 .procname = "max_noreply_time",
210 .data = &sysctl_max_noreply_time, 204 .data = &sysctl_max_noreply_time,
211 .maxlen = sizeof(int), 205 .maxlen = sizeof(int),
@@ -216,7 +210,7 @@ static ctl_table irda_table[] = {
216 .extra2 = &max_max_noreply_time 210 .extra2 = &max_max_noreply_time
217 }, 211 },
218 { 212 {
219 .ctl_name = WARN_NOREPLY_TIME, 213 .ctl_name = NET_IRDA_WARN_NOREPLY_TIME,
220 .procname = "warn_noreply_time", 214 .procname = "warn_noreply_time",
221 .data = &sysctl_warn_noreply_time, 215 .data = &sysctl_warn_noreply_time,
222 .maxlen = sizeof(int), 216 .maxlen = sizeof(int),
@@ -227,7 +221,7 @@ static ctl_table irda_table[] = {
227 .extra2 = &max_warn_noreply_time 221 .extra2 = &max_warn_noreply_time
228 }, 222 },
229 { 223 {
230 .ctl_name = LAP_KEEPALIVE_TIME, 224 .ctl_name = NET_IRDA_LAP_KEEPALIVE_TIME,
231 .procname = "lap_keepalive_time", 225 .procname = "lap_keepalive_time",
232 .data = &sysctl_lap_keepalive_time, 226 .data = &sysctl_lap_keepalive_time,
233 .maxlen = sizeof(int), 227 .maxlen = sizeof(int),
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 1311976c9dfe..97db158c9274 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/timer.c b/net/irda/timer.c
index d3a6ee8cc4a2..d730099080a2 100644
--- a/net/irda/timer.c
+++ b/net/irda/timer.c
@@ -18,7 +18,7 @@
18 * published by the Free Software Foundation; either version 2 of 18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version. 19 * the License, or (at your option) any later version.
20 * 20 *
21 * Neither Dag Brattli nor University of Tromsø admit liability nor 21 * Neither Dag Brattli nor University of Tromsø admit liability nor
22 * provide warranty for any of this software. This material is 22 * provide warranty for any of this software. This material is
23 * provided "AS-IS" and at no charge. 23 * provided "AS-IS" and at no charge.
24 * 24 *
diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c
index a7a7f191f1a8..e71286768a48 100644
--- a/net/irda/wrapper.c
+++ b/net/irda/wrapper.c
@@ -20,7 +20,7 @@
20 * published by the Free Software Foundation; either version 2 of 20 * published by the Free Software Foundation; either version 2 of
21 * the License, or (at your option) any later version. 21 * the License, or (at your option) any later version.
22 * 22 *
23 * Neither Dag Brattli nor University of Tromsø admit liability nor 23 * Neither Dag Brattli nor University of Tromsø admit liability nor
24 * provide warranty for any of this software. This material is 24 * provide warranty for any of this software. This material is
25 * provided "AS-IS" and at no charge. 25 * provided "AS-IS" and at no charge.
26 * 26 *
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 983058d432dc..a2f5a6ea3895 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -389,7 +389,7 @@ static void iucv_block_cpu(void *data)
389 * iucv_declare_cpu 389 * iucv_declare_cpu
390 * @data: unused 390 * @data: unused
391 * 391 *
392 * Declare a interupt buffer on this cpu. 392 * Declare a interrupt buffer on this cpu.
393 */ 393 */
394static void iucv_declare_cpu(void *data) 394static void iucv_declare_cpu(void *data)
395{ 395{
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 49eacba824df..46cf962f7f88 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -762,7 +762,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
762 if (net_ratelimit()) 762 if (net_ratelimit())
763 printk(KERN_DEBUG "LLC(%s:%d): Application " 763 printk(KERN_DEBUG "LLC(%s:%d): Application "
764 "bug, race in MSG_PEEK.\n", 764 "bug, race in MSG_PEEK.\n",
765 current->comm, current->pid); 765 current->comm, task_pid_nr(current));
766 peek_seq = llc->copied_seq; 766 peek_seq = llc->copied_seq;
767 } 767 }
768 continue; 768 continue;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d34a9deca67a..4b4ed2a5803c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -37,8 +37,6 @@
37 37
38struct ieee80211_local; 38struct ieee80211_local;
39 39
40#define BIT(x) (1 << (x))
41
42#define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3) 40#define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)
43 41
44/* Maximum number of broadcast/multicast frames to buffer when some of the 42/* Maximum number of broadcast/multicast frames to buffer when some of the
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index f0224c2311d2..6caa3ec2cff7 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -306,9 +306,12 @@ int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq)
306 ((chan->chan == channel) || (chan->freq == freq))) { 306 ((chan->chan == channel) || (chan->freq == freq))) {
307 local->oper_channel = chan; 307 local->oper_channel = chan;
308 local->oper_hw_mode = mode; 308 local->oper_hw_mode = mode;
309 set++; 309 set = 1;
310 break;
310 } 311 }
311 } 312 }
313 if (set)
314 break;
312 } 315 }
313 316
314 if (set) { 317 if (set) {
@@ -508,10 +511,11 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
508 511
509static int ieee80211_ioctl_siwscan(struct net_device *dev, 512static int ieee80211_ioctl_siwscan(struct net_device *dev,
510 struct iw_request_info *info, 513 struct iw_request_info *info,
511 struct iw_point *data, char *extra) 514 union iwreq_data *wrqu, char *extra)
512{ 515{
513 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 516 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
514 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 517 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
518 struct iw_scan_req *req = NULL;
515 u8 *ssid = NULL; 519 u8 *ssid = NULL;
516 size_t ssid_len = 0; 520 size_t ssid_len = 0;
517 521
@@ -536,6 +540,14 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
536 return -EOPNOTSUPP; 540 return -EOPNOTSUPP;
537 } 541 }
538 542
543 /* if SSID was specified explicitly then use that */
544 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
545 wrqu->data.flags & IW_SCAN_THIS_ESSID) {
546 req = (struct iw_scan_req *)extra;
547 ssid = req->essid;
548 ssid_len = req->essid_len;
549 }
550
539 return ieee80211_sta_req_scan(dev, ssid, ssid_len); 551 return ieee80211_sta_req_scan(dev, ssid, ssid_len);
540} 552}
541 553
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 1641e8fe44b7..f7ffeec3913f 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14/* TODO: 14/* TODO:
15 * BSS table: use <BSSID,SSID> as the key to support multi-SSID APs
16 * order BSS list by RSSI(?) ("quality of AP") 15 * order BSS list by RSSI(?) ("quality of AP")
17 * scan result table filtering (by capability (privacy, IBSS/BSS, WPA/RSN IE, 16 * scan result table filtering (by capability (privacy, IBSS/BSS, WPA/RSN IE,
18 * SSID) 17 * SSID)
@@ -61,7 +60,8 @@
61static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst, 60static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
62 u8 *ssid, size_t ssid_len); 61 u8 *ssid, size_t ssid_len);
63static struct ieee80211_sta_bss * 62static struct ieee80211_sta_bss *
64ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid); 63ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel,
64 u8 *ssid, u8 ssid_len);
65static void ieee80211_rx_bss_put(struct net_device *dev, 65static void ieee80211_rx_bss_put(struct net_device *dev,
66 struct ieee80211_sta_bss *bss); 66 struct ieee80211_sta_bss *bss);
67static int ieee80211_sta_find_ibss(struct net_device *dev, 67static int ieee80211_sta_find_ibss(struct net_device *dev,
@@ -108,14 +108,11 @@ struct ieee802_11_elems {
108 u8 wmm_param_len; 108 u8 wmm_param_len;
109}; 109};
110 110
111enum ParseRes { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 }; 111static void ieee802_11_parse_elems(u8 *start, size_t len,
112 112 struct ieee802_11_elems *elems)
113static enum ParseRes ieee802_11_parse_elems(u8 *start, size_t len,
114 struct ieee802_11_elems *elems)
115{ 113{
116 size_t left = len; 114 size_t left = len;
117 u8 *pos = start; 115 u8 *pos = start;
118 int unknown = 0;
119 116
120 memset(elems, 0, sizeof(*elems)); 117 memset(elems, 0, sizeof(*elems));
121 118
@@ -126,15 +123,8 @@ static enum ParseRes ieee802_11_parse_elems(u8 *start, size_t len,
126 elen = *pos++; 123 elen = *pos++;
127 left -= 2; 124 left -= 2;
128 125
129 if (elen > left) { 126 if (elen > left)
130#if 0 127 return;
131 if (net_ratelimit())
132 printk(KERN_DEBUG "IEEE 802.11 element parse "
133 "failed (id=%d elen=%d left=%d)\n",
134 id, elen, left);
135#endif
136 return ParseFailed;
137 }
138 128
139 switch (id) { 129 switch (id) {
140 case WLAN_EID_SSID: 130 case WLAN_EID_SSID:
@@ -201,28 +191,15 @@ static enum ParseRes ieee802_11_parse_elems(u8 *start, size_t len,
201 elems->ext_supp_rates_len = elen; 191 elems->ext_supp_rates_len = elen;
202 break; 192 break;
203 default: 193 default:
204#if 0
205 printk(KERN_DEBUG "IEEE 802.11 element parse ignored "
206 "unknown element (id=%d elen=%d)\n",
207 id, elen);
208#endif
209 unknown++;
210 break; 194 break;
211 } 195 }
212 196
213 left -= elen; 197 left -= elen;
214 pos += elen; 198 pos += elen;
215 } 199 }
216
217 /* Do not trigger error if left == 1 as Apple Airport base stations
218 * send AssocResps that are one spurious byte too long. */
219
220 return unknown ? ParseUnknown : ParseOK;
221} 200}
222 201
223 202
224
225
226static int ecw2cw(int ecw) 203static int ecw2cw(int ecw)
227{ 204{
228 int cw = 1; 205 int cw = 1;
@@ -427,7 +404,9 @@ static void ieee80211_set_associated(struct net_device *dev,
427 if (sdata->type != IEEE80211_IF_TYPE_STA) 404 if (sdata->type != IEEE80211_IF_TYPE_STA)
428 return; 405 return;
429 406
430 bss = ieee80211_rx_bss_get(dev, ifsta->bssid); 407 bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
408 local->hw.conf.channel,
409 ifsta->ssid, ifsta->ssid_len);
431 if (bss) { 410 if (bss) {
432 if (bss->has_erp_value) 411 if (bss->has_erp_value)
433 ieee80211_handle_erp_ie(dev, bss->erp_value); 412 ieee80211_handle_erp_ie(dev, bss->erp_value);
@@ -574,7 +553,8 @@ static void ieee80211_send_assoc(struct net_device *dev,
574 capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME | 553 capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME |
575 WLAN_CAPABILITY_SHORT_PREAMBLE; 554 WLAN_CAPABILITY_SHORT_PREAMBLE;
576 } 555 }
577 bss = ieee80211_rx_bss_get(dev, ifsta->bssid); 556 bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,
557 ifsta->ssid, ifsta->ssid_len);
578 if (bss) { 558 if (bss) {
579 if (bss->capability & WLAN_CAPABILITY_PRIVACY) 559 if (bss->capability & WLAN_CAPABILITY_PRIVACY)
580 capab |= WLAN_CAPABILITY_PRIVACY; 560 capab |= WLAN_CAPABILITY_PRIVACY;
@@ -722,6 +702,7 @@ static void ieee80211_send_disassoc(struct net_device *dev,
722static int ieee80211_privacy_mismatch(struct net_device *dev, 702static int ieee80211_privacy_mismatch(struct net_device *dev,
723 struct ieee80211_if_sta *ifsta) 703 struct ieee80211_if_sta *ifsta)
724{ 704{
705 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
725 struct ieee80211_sta_bss *bss; 706 struct ieee80211_sta_bss *bss;
726 int res = 0; 707 int res = 0;
727 708
@@ -729,7 +710,8 @@ static int ieee80211_privacy_mismatch(struct net_device *dev,
729 ifsta->key_management_enabled) 710 ifsta->key_management_enabled)
730 return 0; 711 return 0;
731 712
732 bss = ieee80211_rx_bss_get(dev, ifsta->bssid); 713 bss = ieee80211_rx_bss_get(dev, ifsta->bssid, local->hw.conf.channel,
714 ifsta->ssid, ifsta->ssid_len);
733 if (!bss) 715 if (!bss)
734 return 0; 716 return 0;
735 717
@@ -926,12 +908,7 @@ static void ieee80211_auth_challenge(struct net_device *dev,
926 908
927 printk(KERN_DEBUG "%s: replying to auth challenge\n", dev->name); 909 printk(KERN_DEBUG "%s: replying to auth challenge\n", dev->name);
928 pos = mgmt->u.auth.variable; 910 pos = mgmt->u.auth.variable;
929 if (ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems) 911 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
930 == ParseFailed) {
931 printk(KERN_DEBUG "%s: failed to parse Auth(challenge)\n",
932 dev->name);
933 return;
934 }
935 if (!elems.challenge) { 912 if (!elems.challenge) {
936 printk(KERN_DEBUG "%s: no challenge IE in shared key auth " 913 printk(KERN_DEBUG "%s: no challenge IE in shared key auth "
937 "frame\n", dev->name); 914 "frame\n", dev->name);
@@ -1203,15 +1180,11 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
1203 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); 1180 capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info);
1204 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 1181 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
1205 aid = le16_to_cpu(mgmt->u.assoc_resp.aid); 1182 aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
1206 if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14)))
1207 printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not "
1208 "set\n", dev->name, aid);
1209 aid &= ~(BIT(15) | BIT(14));
1210 1183
1211 printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x " 1184 printk(KERN_DEBUG "%s: RX %sssocResp from %s (capab=0x%x "
1212 "status=%d aid=%d)\n", 1185 "status=%d aid=%d)\n",
1213 dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa), 1186 dev->name, reassoc ? "Rea" : "A", print_mac(mac, mgmt->sa),
1214 capab_info, status_code, aid); 1187 capab_info, status_code, aid & ~(BIT(15) | BIT(14)));
1215 1188
1216 if (status_code != WLAN_STATUS_SUCCESS) { 1189 if (status_code != WLAN_STATUS_SUCCESS) {
1217 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", 1190 printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
@@ -1223,13 +1196,13 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
1223 return; 1196 return;
1224 } 1197 }
1225 1198
1199 if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14)))
1200 printk(KERN_DEBUG "%s: invalid aid value %d; bits 15:14 not "
1201 "set\n", dev->name, aid);
1202 aid &= ~(BIT(15) | BIT(14));
1203
1226 pos = mgmt->u.assoc_resp.variable; 1204 pos = mgmt->u.assoc_resp.variable;
1227 if (ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems) 1205 ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
1228 == ParseFailed) {
1229 printk(KERN_DEBUG "%s: failed to parse AssocResp\n",
1230 dev->name);
1231 return;
1232 }
1233 1206
1234 if (!elems.supp_rates) { 1207 if (!elems.supp_rates) {
1235 printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", 1208 printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n",
@@ -1241,7 +1214,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
1241 * update our stored copy */ 1214 * update our stored copy */
1242 if (elems.erp_info && elems.erp_info_len >= 1) { 1215 if (elems.erp_info && elems.erp_info_len >= 1) {
1243 struct ieee80211_sta_bss *bss 1216 struct ieee80211_sta_bss *bss
1244 = ieee80211_rx_bss_get(dev, ifsta->bssid); 1217 = ieee80211_rx_bss_get(dev, ifsta->bssid,
1218 local->hw.conf.channel,
1219 ifsta->ssid, ifsta->ssid_len);
1245 if (bss) { 1220 if (bss) {
1246 bss->erp_value = elems.erp_info[0]; 1221 bss->erp_value = elems.erp_info[0];
1247 bss->has_erp_value = 1; 1222 bss->has_erp_value = 1;
@@ -1271,7 +1246,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct net_device *dev,
1271 " AP\n", dev->name); 1246 " AP\n", dev->name);
1272 return; 1247 return;
1273 } 1248 }
1274 bss = ieee80211_rx_bss_get(dev, ifsta->bssid); 1249 bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
1250 local->hw.conf.channel,
1251 ifsta->ssid, ifsta->ssid_len);
1275 if (bss) { 1252 if (bss) {
1276 sta->last_rssi = bss->rssi; 1253 sta->last_rssi = bss->rssi;
1277 sta->last_signal = bss->signal; 1254 sta->last_signal = bss->signal;
@@ -1347,7 +1324,8 @@ static void __ieee80211_rx_bss_hash_del(struct net_device *dev,
1347 1324
1348 1325
1349static struct ieee80211_sta_bss * 1326static struct ieee80211_sta_bss *
1350ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid) 1327ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid, int channel,
1328 u8 *ssid, u8 ssid_len)
1351{ 1329{
1352 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1330 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1353 struct ieee80211_sta_bss *bss; 1331 struct ieee80211_sta_bss *bss;
@@ -1358,6 +1336,11 @@ ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid)
1358 atomic_inc(&bss->users); 1336 atomic_inc(&bss->users);
1359 atomic_inc(&bss->users); 1337 atomic_inc(&bss->users);
1360 memcpy(bss->bssid, bssid, ETH_ALEN); 1338 memcpy(bss->bssid, bssid, ETH_ALEN);
1339 bss->channel = channel;
1340 if (ssid && ssid_len <= IEEE80211_MAX_SSID_LEN) {
1341 memcpy(bss->ssid, ssid, ssid_len);
1342 bss->ssid_len = ssid_len;
1343 }
1361 1344
1362 spin_lock_bh(&local->sta_bss_lock); 1345 spin_lock_bh(&local->sta_bss_lock);
1363 /* TODO: order by RSSI? */ 1346 /* TODO: order by RSSI? */
@@ -1369,7 +1352,8 @@ ieee80211_rx_bss_add(struct net_device *dev, u8 *bssid)
1369 1352
1370 1353
1371static struct ieee80211_sta_bss * 1354static struct ieee80211_sta_bss *
1372ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid) 1355ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel,
1356 u8 *ssid, u8 ssid_len)
1373{ 1357{
1374 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1358 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1375 struct ieee80211_sta_bss *bss; 1359 struct ieee80211_sta_bss *bss;
@@ -1377,7 +1361,10 @@ ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid)
1377 spin_lock_bh(&local->sta_bss_lock); 1361 spin_lock_bh(&local->sta_bss_lock);
1378 bss = local->sta_bss_hash[STA_HASH(bssid)]; 1362 bss = local->sta_bss_hash[STA_HASH(bssid)];
1379 while (bss) { 1363 while (bss) {
1380 if (memcmp(bss->bssid, bssid, ETH_ALEN) == 0) { 1364 if (!memcmp(bss->bssid, bssid, ETH_ALEN) &&
1365 bss->channel == channel &&
1366 bss->ssid_len == ssid_len &&
1367 (ssid_len == 0 || !memcmp(bss->ssid, ssid, ssid_len))) {
1381 atomic_inc(&bss->users); 1368 atomic_inc(&bss->users);
1382 break; 1369 break;
1383 } 1370 }
@@ -1439,7 +1426,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
1439 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1426 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1440 struct ieee802_11_elems elems; 1427 struct ieee802_11_elems elems;
1441 size_t baselen; 1428 size_t baselen;
1442 int channel, invalid = 0, clen; 1429 int channel, clen;
1443 struct ieee80211_sta_bss *bss; 1430 struct ieee80211_sta_bss *bss;
1444 struct sta_info *sta; 1431 struct sta_info *sta;
1445 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1432 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1485,9 +1472,7 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
1485#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 1472#endif /* CONFIG_MAC80211_IBSS_DEBUG */
1486 } 1473 }
1487 1474
1488 if (ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, 1475 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
1489 &elems) == ParseFailed)
1490 invalid = 1;
1491 1476
1492 if (sdata->type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates && 1477 if (sdata->type == IEEE80211_IF_TYPE_IBSS && elems.supp_rates &&
1493 memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 && 1478 memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0 &&
@@ -1545,9 +1530,11 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
1545 else 1530 else
1546 channel = rx_status->channel; 1531 channel = rx_status->channel;
1547 1532
1548 bss = ieee80211_rx_bss_get(dev, mgmt->bssid); 1533 bss = ieee80211_rx_bss_get(dev, mgmt->bssid, channel,
1534 elems.ssid, elems.ssid_len);
1549 if (!bss) { 1535 if (!bss) {
1550 bss = ieee80211_rx_bss_add(dev, mgmt->bssid); 1536 bss = ieee80211_rx_bss_add(dev, mgmt->bssid, channel,
1537 elems.ssid, elems.ssid_len);
1551 if (!bss) 1538 if (!bss)
1552 return; 1539 return;
1553 } else { 1540 } else {
@@ -1573,10 +1560,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
1573 1560
1574 bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int); 1561 bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int);
1575 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info); 1562 bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info);
1576 if (elems.ssid && elems.ssid_len <= IEEE80211_MAX_SSID_LEN) {
1577 memcpy(bss->ssid, elems.ssid, elems.ssid_len);
1578 bss->ssid_len = elems.ssid_len;
1579 }
1580 1563
1581 bss->supp_rates_len = 0; 1564 bss->supp_rates_len = 0;
1582 if (elems.supp_rates) { 1565 if (elems.supp_rates) {
@@ -1647,7 +1630,6 @@ static void ieee80211_rx_bss_info(struct net_device *dev,
1647 1630
1648 1631
1649 bss->hw_mode = rx_status->phymode; 1632 bss->hw_mode = rx_status->phymode;
1650 bss->channel = channel;
1651 bss->freq = rx_status->freq; 1633 bss->freq = rx_status->freq;
1652 if (channel != rx_status->channel && 1634 if (channel != rx_status->channel &&
1653 (bss->hw_mode == MODE_IEEE80211G || 1635 (bss->hw_mode == MODE_IEEE80211G ||
@@ -1707,9 +1689,7 @@ static void ieee80211_rx_mgmt_beacon(struct net_device *dev,
1707 if (baselen > len) 1689 if (baselen > len)
1708 return; 1690 return;
1709 1691
1710 if (ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, 1692 ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems);
1711 &elems) == ParseFailed)
1712 return;
1713 1693
1714 if (elems.erp_info && elems.erp_info_len >= 1) 1694 if (elems.erp_info && elems.erp_info_len >= 1)
1715 ieee80211_handle_erp_ie(dev, elems.erp_info[0]); 1695 ieee80211_handle_erp_ie(dev, elems.erp_info[0]);
@@ -2375,7 +2355,7 @@ static int ieee80211_sta_create_ibss(struct net_device *dev,
2375{ 2355{
2376 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 2356 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2377 struct ieee80211_sta_bss *bss; 2357 struct ieee80211_sta_bss *bss;
2378 struct ieee80211_sub_if_data *sdata; 2358 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2379 struct ieee80211_hw_mode *mode; 2359 struct ieee80211_hw_mode *mode;
2380 u8 bssid[ETH_ALEN], *pos; 2360 u8 bssid[ETH_ALEN], *pos;
2381 int i; 2361 int i;
@@ -2398,18 +2378,17 @@ static int ieee80211_sta_create_ibss(struct net_device *dev,
2398 printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n", 2378 printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %s\n",
2399 dev->name, print_mac(mac, bssid)); 2379 dev->name, print_mac(mac, bssid));
2400 2380
2401 bss = ieee80211_rx_bss_add(dev, bssid); 2381 bss = ieee80211_rx_bss_add(dev, bssid, local->hw.conf.channel,
2382 sdata->u.sta.ssid, sdata->u.sta.ssid_len);
2402 if (!bss) 2383 if (!bss)
2403 return -ENOMEM; 2384 return -ENOMEM;
2404 2385
2405 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2406 mode = local->oper_hw_mode; 2386 mode = local->oper_hw_mode;
2407 2387
2408 if (local->hw.conf.beacon_int == 0) 2388 if (local->hw.conf.beacon_int == 0)
2409 local->hw.conf.beacon_int = 100; 2389 local->hw.conf.beacon_int = 100;
2410 bss->beacon_int = local->hw.conf.beacon_int; 2390 bss->beacon_int = local->hw.conf.beacon_int;
2411 bss->hw_mode = local->hw.conf.phymode; 2391 bss->hw_mode = local->hw.conf.phymode;
2412 bss->channel = local->hw.conf.channel;
2413 bss->freq = local->hw.conf.freq; 2392 bss->freq = local->hw.conf.freq;
2414 bss->last_update = jiffies; 2393 bss->last_update = jiffies;
2415 bss->capability = WLAN_CAPABILITY_IBSS; 2394 bss->capability = WLAN_CAPABILITY_IBSS;
@@ -2469,7 +2448,8 @@ static int ieee80211_sta_find_ibss(struct net_device *dev,
2469 "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid)); 2448 "%s\n", print_mac(mac, bssid), print_mac(mac2, ifsta->bssid));
2470#endif /* CONFIG_MAC80211_IBSS_DEBUG */ 2449#endif /* CONFIG_MAC80211_IBSS_DEBUG */
2471 if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 && 2450 if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0 &&
2472 (bss = ieee80211_rx_bss_get(dev, bssid))) { 2451 (bss = ieee80211_rx_bss_get(dev, bssid, local->hw.conf.channel,
2452 ifsta->ssid, ifsta->ssid_len))) {
2473 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s" 2453 printk(KERN_DEBUG "%s: Selected IBSS BSSID %s"
2474 " based on configured SSID\n", 2454 " based on configured SSID\n",
2475 dev->name, print_mac(mac, bssid)); 2455 dev->name, print_mac(mac, bssid));
diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c
index d8b501878d9f..13f819179642 100644
--- a/net/netfilter/nf_conntrack_proto_generic.c
+++ b/net/netfilter/nf_conntrack_proto_generic.c
@@ -70,7 +70,6 @@ static int new(struct nf_conn *conntrack, const struct sk_buff *skb,
70static struct ctl_table_header *generic_sysctl_header; 70static struct ctl_table_header *generic_sysctl_header;
71static struct ctl_table generic_sysctl_table[] = { 71static struct ctl_table generic_sysctl_table[] = {
72 { 72 {
73 .ctl_name = NET_NF_CONNTRACK_GENERIC_TIMEOUT,
74 .procname = "nf_conntrack_generic_timeout", 73 .procname = "nf_conntrack_generic_timeout",
75 .data = &nf_ct_generic_timeout, 74 .data = &nf_ct_generic_timeout,
76 .maxlen = sizeof(unsigned int), 75 .maxlen = sizeof(unsigned int),
@@ -84,7 +83,6 @@ static struct ctl_table generic_sysctl_table[] = {
84#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT 83#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
85static struct ctl_table generic_compat_sysctl_table[] = { 84static struct ctl_table generic_compat_sysctl_table[] = {
86 { 85 {
87 .ctl_name = NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT,
88 .procname = "ip_conntrack_generic_timeout", 86 .procname = "ip_conntrack_generic_timeout",
89 .data = &nf_ct_generic_timeout, 87 .data = &nf_ct_generic_timeout,
90 .maxlen = sizeof(unsigned int), 88 .maxlen = sizeof(unsigned int),
diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
index 04192acc7c40..cb0467510592 100644
--- a/net/netfilter/nf_conntrack_proto_sctp.c
+++ b/net/netfilter/nf_conntrack_proto_sctp.c
@@ -476,7 +476,6 @@ static unsigned int sctp_sysctl_table_users;
476static struct ctl_table_header *sctp_sysctl_header; 476static struct ctl_table_header *sctp_sysctl_header;
477static struct ctl_table sctp_sysctl_table[] = { 477static struct ctl_table sctp_sysctl_table[] = {
478 { 478 {
479 .ctl_name = NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED,
480 .procname = "nf_conntrack_sctp_timeout_closed", 479 .procname = "nf_conntrack_sctp_timeout_closed",
481 .data = &nf_ct_sctp_timeout_closed, 480 .data = &nf_ct_sctp_timeout_closed,
482 .maxlen = sizeof(unsigned int), 481 .maxlen = sizeof(unsigned int),
@@ -484,7 +483,6 @@ static struct ctl_table sctp_sysctl_table[] = {
484 .proc_handler = &proc_dointvec_jiffies, 483 .proc_handler = &proc_dointvec_jiffies,
485 }, 484 },
486 { 485 {
487 .ctl_name = NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT,
488 .procname = "nf_conntrack_sctp_timeout_cookie_wait", 486 .procname = "nf_conntrack_sctp_timeout_cookie_wait",
489 .data = &nf_ct_sctp_timeout_cookie_wait, 487 .data = &nf_ct_sctp_timeout_cookie_wait,
490 .maxlen = sizeof(unsigned int), 488 .maxlen = sizeof(unsigned int),
@@ -492,7 +490,6 @@ static struct ctl_table sctp_sysctl_table[] = {
492 .proc_handler = &proc_dointvec_jiffies, 490 .proc_handler = &proc_dointvec_jiffies,
493 }, 491 },
494 { 492 {
495 .ctl_name = NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED,
496 .procname = "nf_conntrack_sctp_timeout_cookie_echoed", 493 .procname = "nf_conntrack_sctp_timeout_cookie_echoed",
497 .data = &nf_ct_sctp_timeout_cookie_echoed, 494 .data = &nf_ct_sctp_timeout_cookie_echoed,
498 .maxlen = sizeof(unsigned int), 495 .maxlen = sizeof(unsigned int),
@@ -500,7 +497,6 @@ static struct ctl_table sctp_sysctl_table[] = {
500 .proc_handler = &proc_dointvec_jiffies, 497 .proc_handler = &proc_dointvec_jiffies,
501 }, 498 },
502 { 499 {
503 .ctl_name = NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED,
504 .procname = "nf_conntrack_sctp_timeout_established", 500 .procname = "nf_conntrack_sctp_timeout_established",
505 .data = &nf_ct_sctp_timeout_established, 501 .data = &nf_ct_sctp_timeout_established,
506 .maxlen = sizeof(unsigned int), 502 .maxlen = sizeof(unsigned int),
@@ -508,7 +504,6 @@ static struct ctl_table sctp_sysctl_table[] = {
508 .proc_handler = &proc_dointvec_jiffies, 504 .proc_handler = &proc_dointvec_jiffies,
509 }, 505 },
510 { 506 {
511 .ctl_name = NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT,
512 .procname = "nf_conntrack_sctp_timeout_shutdown_sent", 507 .procname = "nf_conntrack_sctp_timeout_shutdown_sent",
513 .data = &nf_ct_sctp_timeout_shutdown_sent, 508 .data = &nf_ct_sctp_timeout_shutdown_sent,
514 .maxlen = sizeof(unsigned int), 509 .maxlen = sizeof(unsigned int),
@@ -516,7 +511,6 @@ static struct ctl_table sctp_sysctl_table[] = {
516 .proc_handler = &proc_dointvec_jiffies, 511 .proc_handler = &proc_dointvec_jiffies,
517 }, 512 },
518 { 513 {
519 .ctl_name = NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD,
520 .procname = "nf_conntrack_sctp_timeout_shutdown_recd", 514 .procname = "nf_conntrack_sctp_timeout_shutdown_recd",
521 .data = &nf_ct_sctp_timeout_shutdown_recd, 515 .data = &nf_ct_sctp_timeout_shutdown_recd,
522 .maxlen = sizeof(unsigned int), 516 .maxlen = sizeof(unsigned int),
@@ -524,7 +518,6 @@ static struct ctl_table sctp_sysctl_table[] = {
524 .proc_handler = &proc_dointvec_jiffies, 518 .proc_handler = &proc_dointvec_jiffies,
525 }, 519 },
526 { 520 {
527 .ctl_name = NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT,
528 .procname = "nf_conntrack_sctp_timeout_shutdown_ack_sent", 521 .procname = "nf_conntrack_sctp_timeout_shutdown_ack_sent",
529 .data = &nf_ct_sctp_timeout_shutdown_ack_sent, 522 .data = &nf_ct_sctp_timeout_shutdown_ack_sent,
530 .maxlen = sizeof(unsigned int), 523 .maxlen = sizeof(unsigned int),
@@ -539,7 +532,6 @@ static struct ctl_table sctp_sysctl_table[] = {
539#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT 532#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
540static struct ctl_table sctp_compat_sysctl_table[] = { 533static struct ctl_table sctp_compat_sysctl_table[] = {
541 { 534 {
542 .ctl_name = NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED,
543 .procname = "ip_conntrack_sctp_timeout_closed", 535 .procname = "ip_conntrack_sctp_timeout_closed",
544 .data = &nf_ct_sctp_timeout_closed, 536 .data = &nf_ct_sctp_timeout_closed,
545 .maxlen = sizeof(unsigned int), 537 .maxlen = sizeof(unsigned int),
@@ -547,7 +539,6 @@ static struct ctl_table sctp_compat_sysctl_table[] = {
547 .proc_handler = &proc_dointvec_jiffies, 539 .proc_handler = &proc_dointvec_jiffies,
548 }, 540 },
549 { 541 {
550 .ctl_name = NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT,
551 .procname = "ip_conntrack_sctp_timeout_cookie_wait", 542 .procname = "ip_conntrack_sctp_timeout_cookie_wait",
552 .data = &nf_ct_sctp_timeout_cookie_wait, 543 .data = &nf_ct_sctp_timeout_cookie_wait,
553 .maxlen = sizeof(unsigned int), 544 .maxlen = sizeof(unsigned int),
@@ -555,7 +546,6 @@ static struct ctl_table sctp_compat_sysctl_table[] = {
555 .proc_handler = &proc_dointvec_jiffies, 546 .proc_handler = &proc_dointvec_jiffies,
556 }, 547 },
557 { 548 {
558 .ctl_name = NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED,
559 .procname = "ip_conntrack_sctp_timeout_cookie_echoed", 549 .procname = "ip_conntrack_sctp_timeout_cookie_echoed",
560 .data = &nf_ct_sctp_timeout_cookie_echoed, 550 .data = &nf_ct_sctp_timeout_cookie_echoed,
561 .maxlen = sizeof(unsigned int), 551 .maxlen = sizeof(unsigned int),
@@ -563,7 +553,6 @@ static struct ctl_table sctp_compat_sysctl_table[] = {
563 .proc_handler = &proc_dointvec_jiffies, 553 .proc_handler = &proc_dointvec_jiffies,
564 }, 554 },
565 { 555 {
566 .ctl_name = NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED,
567 .procname = "ip_conntrack_sctp_timeout_established", 556 .procname = "ip_conntrack_sctp_timeout_established",
568 .data = &nf_ct_sctp_timeout_established, 557 .data = &nf_ct_sctp_timeout_established,
569 .maxlen = sizeof(unsigned int), 558 .maxlen = sizeof(unsigned int),
@@ -571,7 +560,6 @@ static struct ctl_table sctp_compat_sysctl_table[] = {
571 .proc_handler = &proc_dointvec_jiffies, 560 .proc_handler = &proc_dointvec_jiffies,
572 }, 561 },
573 { 562 {
574 .ctl_name = NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT,
575 .procname = "ip_conntrack_sctp_timeout_shutdown_sent", 563 .procname = "ip_conntrack_sctp_timeout_shutdown_sent",
576 .data = &nf_ct_sctp_timeout_shutdown_sent, 564 .data = &nf_ct_sctp_timeout_shutdown_sent,
577 .maxlen = sizeof(unsigned int), 565 .maxlen = sizeof(unsigned int),
@@ -579,7 +567,6 @@ static struct ctl_table sctp_compat_sysctl_table[] = {
579 .proc_handler = &proc_dointvec_jiffies, 567 .proc_handler = &proc_dointvec_jiffies,
580 }, 568 },
581 { 569 {
582 .ctl_name = NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD,
583 .procname = "ip_conntrack_sctp_timeout_shutdown_recd", 570 .procname = "ip_conntrack_sctp_timeout_shutdown_recd",
584 .data = &nf_ct_sctp_timeout_shutdown_recd, 571 .data = &nf_ct_sctp_timeout_shutdown_recd,
585 .maxlen = sizeof(unsigned int), 572 .maxlen = sizeof(unsigned int),
@@ -587,7 +574,6 @@ static struct ctl_table sctp_compat_sysctl_table[] = {
587 .proc_handler = &proc_dointvec_jiffies, 574 .proc_handler = &proc_dointvec_jiffies,
588 }, 575 },
589 { 576 {
590 .ctl_name = NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT,
591 .procname = "ip_conntrack_sctp_timeout_shutdown_ack_sent", 577 .procname = "ip_conntrack_sctp_timeout_shutdown_ack_sent",
592 .data = &nf_ct_sctp_timeout_shutdown_ack_sent, 578 .data = &nf_ct_sctp_timeout_shutdown_ack_sent,
593 .maxlen = sizeof(unsigned int), 579 .maxlen = sizeof(unsigned int),
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index c7075345971b..7a3f64c1aca6 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -834,10 +834,12 @@ static int tcp_packet(struct nf_conn *conntrack,
834 case TCP_CONNTRACK_SYN_SENT: 834 case TCP_CONNTRACK_SYN_SENT:
835 if (old_state < TCP_CONNTRACK_TIME_WAIT) 835 if (old_state < TCP_CONNTRACK_TIME_WAIT)
836 break; 836 break;
837 if (conntrack->proto.tcp.seen[!dir].flags & 837 if ((conntrack->proto.tcp.seen[!dir].flags &
838 IP_CT_TCP_FLAG_CLOSE_INIT) { 838 IP_CT_TCP_FLAG_CLOSE_INIT)
839 /* Attempt to reopen a closed connection. 839 || (conntrack->proto.tcp.last_dir == dir
840 * Delete this connection and look up again. */ 840 && conntrack->proto.tcp.last_index == TCP_RST_SET)) {
841 /* Attempt to reopen a closed/aborted connection.
842 * Delete this connection and look up again. */
841 write_unlock_bh(&tcp_lock); 843 write_unlock_bh(&tcp_lock);
842 if (del_timer(&conntrack->timeout)) 844 if (del_timer(&conntrack->timeout))
843 conntrack->timeout.function((unsigned long) 845 conntrack->timeout.function((unsigned long)
@@ -925,6 +927,7 @@ static int tcp_packet(struct nf_conn *conntrack,
925 in_window: 927 in_window:
926 /* From now on we have got in-window packets */ 928 /* From now on we have got in-window packets */
927 conntrack->proto.tcp.last_index = index; 929 conntrack->proto.tcp.last_index = index;
930 conntrack->proto.tcp.last_dir = dir;
928 931
929 pr_debug("tcp_conntracks: "); 932 pr_debug("tcp_conntracks: ");
930 NF_CT_DUMP_TUPLE(tuple); 933 NF_CT_DUMP_TUPLE(tuple);
@@ -1162,7 +1165,6 @@ static unsigned int tcp_sysctl_table_users;
1162static struct ctl_table_header *tcp_sysctl_header; 1165static struct ctl_table_header *tcp_sysctl_header;
1163static struct ctl_table tcp_sysctl_table[] = { 1166static struct ctl_table tcp_sysctl_table[] = {
1164 { 1167 {
1165 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,
1166 .procname = "nf_conntrack_tcp_timeout_syn_sent", 1168 .procname = "nf_conntrack_tcp_timeout_syn_sent",
1167 .data = &nf_ct_tcp_timeout_syn_sent, 1169 .data = &nf_ct_tcp_timeout_syn_sent,
1168 .maxlen = sizeof(unsigned int), 1170 .maxlen = sizeof(unsigned int),
@@ -1170,7 +1172,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1170 .proc_handler = &proc_dointvec_jiffies, 1172 .proc_handler = &proc_dointvec_jiffies,
1171 }, 1173 },
1172 { 1174 {
1173 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV,
1174 .procname = "nf_conntrack_tcp_timeout_syn_recv", 1175 .procname = "nf_conntrack_tcp_timeout_syn_recv",
1175 .data = &nf_ct_tcp_timeout_syn_recv, 1176 .data = &nf_ct_tcp_timeout_syn_recv,
1176 .maxlen = sizeof(unsigned int), 1177 .maxlen = sizeof(unsigned int),
@@ -1178,7 +1179,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1178 .proc_handler = &proc_dointvec_jiffies, 1179 .proc_handler = &proc_dointvec_jiffies,
1179 }, 1180 },
1180 { 1181 {
1181 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED,
1182 .procname = "nf_conntrack_tcp_timeout_established", 1182 .procname = "nf_conntrack_tcp_timeout_established",
1183 .data = &nf_ct_tcp_timeout_established, 1183 .data = &nf_ct_tcp_timeout_established,
1184 .maxlen = sizeof(unsigned int), 1184 .maxlen = sizeof(unsigned int),
@@ -1186,7 +1186,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1186 .proc_handler = &proc_dointvec_jiffies, 1186 .proc_handler = &proc_dointvec_jiffies,
1187 }, 1187 },
1188 { 1188 {
1189 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT,
1190 .procname = "nf_conntrack_tcp_timeout_fin_wait", 1189 .procname = "nf_conntrack_tcp_timeout_fin_wait",
1191 .data = &nf_ct_tcp_timeout_fin_wait, 1190 .data = &nf_ct_tcp_timeout_fin_wait,
1192 .maxlen = sizeof(unsigned int), 1191 .maxlen = sizeof(unsigned int),
@@ -1194,7 +1193,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1194 .proc_handler = &proc_dointvec_jiffies, 1193 .proc_handler = &proc_dointvec_jiffies,
1195 }, 1194 },
1196 { 1195 {
1197 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT,
1198 .procname = "nf_conntrack_tcp_timeout_close_wait", 1196 .procname = "nf_conntrack_tcp_timeout_close_wait",
1199 .data = &nf_ct_tcp_timeout_close_wait, 1197 .data = &nf_ct_tcp_timeout_close_wait,
1200 .maxlen = sizeof(unsigned int), 1198 .maxlen = sizeof(unsigned int),
@@ -1202,7 +1200,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1202 .proc_handler = &proc_dointvec_jiffies, 1200 .proc_handler = &proc_dointvec_jiffies,
1203 }, 1201 },
1204 { 1202 {
1205 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK,
1206 .procname = "nf_conntrack_tcp_timeout_last_ack", 1203 .procname = "nf_conntrack_tcp_timeout_last_ack",
1207 .data = &nf_ct_tcp_timeout_last_ack, 1204 .data = &nf_ct_tcp_timeout_last_ack,
1208 .maxlen = sizeof(unsigned int), 1205 .maxlen = sizeof(unsigned int),
@@ -1210,7 +1207,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1210 .proc_handler = &proc_dointvec_jiffies, 1207 .proc_handler = &proc_dointvec_jiffies,
1211 }, 1208 },
1212 { 1209 {
1213 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT,
1214 .procname = "nf_conntrack_tcp_timeout_time_wait", 1210 .procname = "nf_conntrack_tcp_timeout_time_wait",
1215 .data = &nf_ct_tcp_timeout_time_wait, 1211 .data = &nf_ct_tcp_timeout_time_wait,
1216 .maxlen = sizeof(unsigned int), 1212 .maxlen = sizeof(unsigned int),
@@ -1218,7 +1214,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1218 .proc_handler = &proc_dointvec_jiffies, 1214 .proc_handler = &proc_dointvec_jiffies,
1219 }, 1215 },
1220 { 1216 {
1221 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE,
1222 .procname = "nf_conntrack_tcp_timeout_close", 1217 .procname = "nf_conntrack_tcp_timeout_close",
1223 .data = &nf_ct_tcp_timeout_close, 1218 .data = &nf_ct_tcp_timeout_close,
1224 .maxlen = sizeof(unsigned int), 1219 .maxlen = sizeof(unsigned int),
@@ -1226,7 +1221,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1226 .proc_handler = &proc_dointvec_jiffies, 1221 .proc_handler = &proc_dointvec_jiffies,
1227 }, 1222 },
1228 { 1223 {
1229 .ctl_name = NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS,
1230 .procname = "nf_conntrack_tcp_timeout_max_retrans", 1224 .procname = "nf_conntrack_tcp_timeout_max_retrans",
1231 .data = &nf_ct_tcp_timeout_max_retrans, 1225 .data = &nf_ct_tcp_timeout_max_retrans,
1232 .maxlen = sizeof(unsigned int), 1226 .maxlen = sizeof(unsigned int),
@@ -1265,7 +1259,6 @@ static struct ctl_table tcp_sysctl_table[] = {
1265#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT 1259#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
1266static struct ctl_table tcp_compat_sysctl_table[] = { 1260static struct ctl_table tcp_compat_sysctl_table[] = {
1267 { 1261 {
1268 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT,
1269 .procname = "ip_conntrack_tcp_timeout_syn_sent", 1262 .procname = "ip_conntrack_tcp_timeout_syn_sent",
1270 .data = &nf_ct_tcp_timeout_syn_sent, 1263 .data = &nf_ct_tcp_timeout_syn_sent,
1271 .maxlen = sizeof(unsigned int), 1264 .maxlen = sizeof(unsigned int),
@@ -1273,7 +1266,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1273 .proc_handler = &proc_dointvec_jiffies, 1266 .proc_handler = &proc_dointvec_jiffies,
1274 }, 1267 },
1275 { 1268 {
1276 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV,
1277 .procname = "ip_conntrack_tcp_timeout_syn_recv", 1269 .procname = "ip_conntrack_tcp_timeout_syn_recv",
1278 .data = &nf_ct_tcp_timeout_syn_recv, 1270 .data = &nf_ct_tcp_timeout_syn_recv,
1279 .maxlen = sizeof(unsigned int), 1271 .maxlen = sizeof(unsigned int),
@@ -1281,7 +1273,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1281 .proc_handler = &proc_dointvec_jiffies, 1273 .proc_handler = &proc_dointvec_jiffies,
1282 }, 1274 },
1283 { 1275 {
1284 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED,
1285 .procname = "ip_conntrack_tcp_timeout_established", 1276 .procname = "ip_conntrack_tcp_timeout_established",
1286 .data = &nf_ct_tcp_timeout_established, 1277 .data = &nf_ct_tcp_timeout_established,
1287 .maxlen = sizeof(unsigned int), 1278 .maxlen = sizeof(unsigned int),
@@ -1289,7 +1280,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1289 .proc_handler = &proc_dointvec_jiffies, 1280 .proc_handler = &proc_dointvec_jiffies,
1290 }, 1281 },
1291 { 1282 {
1292 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT,
1293 .procname = "ip_conntrack_tcp_timeout_fin_wait", 1283 .procname = "ip_conntrack_tcp_timeout_fin_wait",
1294 .data = &nf_ct_tcp_timeout_fin_wait, 1284 .data = &nf_ct_tcp_timeout_fin_wait,
1295 .maxlen = sizeof(unsigned int), 1285 .maxlen = sizeof(unsigned int),
@@ -1297,7 +1287,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1297 .proc_handler = &proc_dointvec_jiffies, 1287 .proc_handler = &proc_dointvec_jiffies,
1298 }, 1288 },
1299 { 1289 {
1300 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT,
1301 .procname = "ip_conntrack_tcp_timeout_close_wait", 1290 .procname = "ip_conntrack_tcp_timeout_close_wait",
1302 .data = &nf_ct_tcp_timeout_close_wait, 1291 .data = &nf_ct_tcp_timeout_close_wait,
1303 .maxlen = sizeof(unsigned int), 1292 .maxlen = sizeof(unsigned int),
@@ -1305,7 +1294,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1305 .proc_handler = &proc_dointvec_jiffies, 1294 .proc_handler = &proc_dointvec_jiffies,
1306 }, 1295 },
1307 { 1296 {
1308 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK,
1309 .procname = "ip_conntrack_tcp_timeout_last_ack", 1297 .procname = "ip_conntrack_tcp_timeout_last_ack",
1310 .data = &nf_ct_tcp_timeout_last_ack, 1298 .data = &nf_ct_tcp_timeout_last_ack,
1311 .maxlen = sizeof(unsigned int), 1299 .maxlen = sizeof(unsigned int),
@@ -1313,7 +1301,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1313 .proc_handler = &proc_dointvec_jiffies, 1301 .proc_handler = &proc_dointvec_jiffies,
1314 }, 1302 },
1315 { 1303 {
1316 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT,
1317 .procname = "ip_conntrack_tcp_timeout_time_wait", 1304 .procname = "ip_conntrack_tcp_timeout_time_wait",
1318 .data = &nf_ct_tcp_timeout_time_wait, 1305 .data = &nf_ct_tcp_timeout_time_wait,
1319 .maxlen = sizeof(unsigned int), 1306 .maxlen = sizeof(unsigned int),
@@ -1321,7 +1308,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1321 .proc_handler = &proc_dointvec_jiffies, 1308 .proc_handler = &proc_dointvec_jiffies,
1322 }, 1309 },
1323 { 1310 {
1324 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE,
1325 .procname = "ip_conntrack_tcp_timeout_close", 1311 .procname = "ip_conntrack_tcp_timeout_close",
1326 .data = &nf_ct_tcp_timeout_close, 1312 .data = &nf_ct_tcp_timeout_close,
1327 .maxlen = sizeof(unsigned int), 1313 .maxlen = sizeof(unsigned int),
@@ -1329,7 +1315,6 @@ static struct ctl_table tcp_compat_sysctl_table[] = {
1329 .proc_handler = &proc_dointvec_jiffies, 1315 .proc_handler = &proc_dointvec_jiffies,
1330 }, 1316 },
1331 { 1317 {
1332 .ctl_name = NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS,
1333 .procname = "ip_conntrack_tcp_timeout_max_retrans", 1318 .procname = "ip_conntrack_tcp_timeout_max_retrans",
1334 .data = &nf_ct_tcp_timeout_max_retrans, 1319 .data = &nf_ct_tcp_timeout_max_retrans,
1335 .maxlen = sizeof(unsigned int), 1320 .maxlen = sizeof(unsigned int),
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c
index ba80e1a1ea17..b3e7ecb080e6 100644
--- a/net/netfilter/nf_conntrack_proto_udp.c
+++ b/net/netfilter/nf_conntrack_proto_udp.c
@@ -146,7 +146,6 @@ static unsigned int udp_sysctl_table_users;
146static struct ctl_table_header *udp_sysctl_header; 146static struct ctl_table_header *udp_sysctl_header;
147static struct ctl_table udp_sysctl_table[] = { 147static struct ctl_table udp_sysctl_table[] = {
148 { 148 {
149 .ctl_name = NET_NF_CONNTRACK_UDP_TIMEOUT,
150 .procname = "nf_conntrack_udp_timeout", 149 .procname = "nf_conntrack_udp_timeout",
151 .data = &nf_ct_udp_timeout, 150 .data = &nf_ct_udp_timeout,
152 .maxlen = sizeof(unsigned int), 151 .maxlen = sizeof(unsigned int),
@@ -154,7 +153,6 @@ static struct ctl_table udp_sysctl_table[] = {
154 .proc_handler = &proc_dointvec_jiffies, 153 .proc_handler = &proc_dointvec_jiffies,
155 }, 154 },
156 { 155 {
157 .ctl_name = NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM,
158 .procname = "nf_conntrack_udp_timeout_stream", 156 .procname = "nf_conntrack_udp_timeout_stream",
159 .data = &nf_ct_udp_timeout_stream, 157 .data = &nf_ct_udp_timeout_stream,
160 .maxlen = sizeof(unsigned int), 158 .maxlen = sizeof(unsigned int),
@@ -168,7 +166,6 @@ static struct ctl_table udp_sysctl_table[] = {
168#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT 166#ifdef CONFIG_NF_CONNTRACK_PROC_COMPAT
169static struct ctl_table udp_compat_sysctl_table[] = { 167static struct ctl_table udp_compat_sysctl_table[] = {
170 { 168 {
171 .ctl_name = NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT,
172 .procname = "ip_conntrack_udp_timeout", 169 .procname = "ip_conntrack_udp_timeout",
173 .data = &nf_ct_udp_timeout, 170 .data = &nf_ct_udp_timeout,
174 .maxlen = sizeof(unsigned int), 171 .maxlen = sizeof(unsigned int),
@@ -176,7 +173,6 @@ static struct ctl_table udp_compat_sysctl_table[] = {
176 .proc_handler = &proc_dointvec_jiffies, 173 .proc_handler = &proc_dointvec_jiffies,
177 }, 174 },
178 { 175 {
179 .ctl_name = NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM,
180 .procname = "ip_conntrack_udp_timeout_stream", 176 .procname = "ip_conntrack_udp_timeout_stream",
181 .data = &nf_ct_udp_timeout_stream, 177 .data = &nf_ct_udp_timeout_stream,
182 .maxlen = sizeof(unsigned int), 178 .maxlen = sizeof(unsigned int),
diff --git a/net/netfilter/xt_CONNMARK.c b/net/netfilter/xt_CONNMARK.c
index 8cc324b159e9..856793e8db7a 100644
--- a/net/netfilter/xt_CONNMARK.c
+++ b/net/netfilter/xt_CONNMARK.c
@@ -23,7 +23,7 @@
23#include <linux/ip.h> 23#include <linux/ip.h>
24#include <net/checksum.h> 24#include <net/checksum.h>
25 25
26MODULE_AUTHOR("Henrik Nordstrom <hno@marasytems.com>"); 26MODULE_AUTHOR("Henrik Nordstrom <hno@marasystems.com>");
27MODULE_DESCRIPTION("IP tables CONNMARK matching module"); 27MODULE_DESCRIPTION("IP tables CONNMARK matching module");
28MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
29MODULE_ALIAS("ipt_CONNMARK"); 29MODULE_ALIAS("ipt_CONNMARK");
diff --git a/net/netfilter/xt_connbytes.c b/net/netfilter/xt_connbytes.c
index af79423bc8e8..9ec50139b9a1 100644
--- a/net/netfilter/xt_connbytes.c
+++ b/net/netfilter/xt_connbytes.c
@@ -2,13 +2,13 @@
2 * GPL (C) 2002 Martin Devera (devik@cdi.cz). 2 * GPL (C) 2002 Martin Devera (devik@cdi.cz).
3 */ 3 */
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/bitops.h>
5#include <linux/skbuff.h> 6#include <linux/skbuff.h>
6#include <linux/netfilter/x_tables.h> 7#include <linux/netfilter/x_tables.h>
7#include <linux/netfilter/xt_connbytes.h> 8#include <linux/netfilter/xt_connbytes.h>
8#include <net/netfilter/nf_conntrack.h> 9#include <net/netfilter/nf_conntrack.h>
9 10
10#include <asm/div64.h> 11#include <asm/div64.h>
11#include <asm/bitops.h>
12 12
13MODULE_LICENSE("GPL"); 13MODULE_LICENSE("GPL");
14MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>"); 14MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
diff --git a/net/netfilter/xt_connmark.c b/net/netfilter/xt_connmark.c
index 1071fc54d6d3..9f67920af41f 100644
--- a/net/netfilter/xt_connmark.c
+++ b/net/netfilter/xt_connmark.c
@@ -25,7 +25,7 @@
25#include <linux/netfilter/x_tables.h> 25#include <linux/netfilter/x_tables.h>
26#include <linux/netfilter/xt_connmark.h> 26#include <linux/netfilter/xt_connmark.h>
27 27
28MODULE_AUTHOR("Henrik Nordstrom <hno@marasytems.com>"); 28MODULE_AUTHOR("Henrik Nordstrom <hno@marasystems.com>");
29MODULE_DESCRIPTION("IP tables connmark match module"); 29MODULE_DESCRIPTION("IP tables connmark match module");
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
31MODULE_ALIAS("ipt_connmark"); 31MODULE_ALIAS("ipt_connmark");
diff --git a/net/netfilter/xt_limit.c b/net/netfilter/xt_limit.c
index 4fcca797150f..f263a77e57b7 100644
--- a/net/netfilter/xt_limit.c
+++ b/net/netfilter/xt_limit.c
@@ -1,5 +1,5 @@
1/* (C) 1999 Jérôme de Vivie <devivie@info.enserb.u-bordeaux.fr> 1/* (C) 1999 Jérôme de Vivie <devivie@info.enserb.u-bordeaux.fr>
2 * (C) 1999 Hervé Eychenne <eychenne@info.enserb.u-bordeaux.fr> 2 * (C) 1999 Hervé Eychenne <eychenne@info.enserb.u-bordeaux.fr>
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
diff --git a/net/netfilter/xt_sctp.c b/net/netfilter/xt_sctp.c
index f907770fd4e9..3358273a47b7 100644
--- a/net/netfilter/xt_sctp.c
+++ b/net/netfilter/xt_sctp.c
@@ -42,21 +42,21 @@ match_flags(const struct xt_sctp_flag_info *flag_info,
42static inline bool 42static inline bool
43match_packet(const struct sk_buff *skb, 43match_packet(const struct sk_buff *skb,
44 unsigned int offset, 44 unsigned int offset,
45 const u_int32_t *chunkmap, 45 const struct xt_sctp_info *info,
46 int chunk_match_type,
47 const struct xt_sctp_flag_info *flag_info,
48 const int flag_count,
49 bool *hotdrop) 46 bool *hotdrop)
50{ 47{
51 u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)]; 48 u_int32_t chunkmapcopy[256 / sizeof (u_int32_t)];
52 sctp_chunkhdr_t _sch, *sch; 49 sctp_chunkhdr_t _sch, *sch;
50 int chunk_match_type = info->chunk_match_type;
51 const struct xt_sctp_flag_info *flag_info = info->flag_info;
52 int flag_count = info->flag_count;
53 53
54#ifdef DEBUG_SCTP 54#ifdef DEBUG_SCTP
55 int i = 0; 55 int i = 0;
56#endif 56#endif
57 57
58 if (chunk_match_type == SCTP_CHUNK_MATCH_ALL) 58 if (chunk_match_type == SCTP_CHUNK_MATCH_ALL)
59 SCTP_CHUNKMAP_COPY(chunkmapcopy, chunkmap); 59 SCTP_CHUNKMAP_COPY(chunkmapcopy, info->chunkmap);
60 60
61 do { 61 do {
62 sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch); 62 sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch);
@@ -73,7 +73,7 @@ match_packet(const struct sk_buff *skb,
73 73
74 duprintf("skb->len: %d\toffset: %d\n", skb->len, offset); 74 duprintf("skb->len: %d\toffset: %d\n", skb->len, offset);
75 75
76 if (SCTP_CHUNKMAP_IS_SET(chunkmap, sch->type)) { 76 if (SCTP_CHUNKMAP_IS_SET(info->chunkmap, sch->type)) {
77 switch (chunk_match_type) { 77 switch (chunk_match_type) {
78 case SCTP_CHUNK_MATCH_ANY: 78 case SCTP_CHUNK_MATCH_ANY:
79 if (match_flags(flag_info, flag_count, 79 if (match_flags(flag_info, flag_count,
@@ -104,7 +104,7 @@ match_packet(const struct sk_buff *skb,
104 104
105 switch (chunk_match_type) { 105 switch (chunk_match_type) {
106 case SCTP_CHUNK_MATCH_ALL: 106 case SCTP_CHUNK_MATCH_ALL:
107 return SCTP_CHUNKMAP_IS_CLEAR(chunkmap); 107 return SCTP_CHUNKMAP_IS_CLEAR(info->chunkmap);
108 case SCTP_CHUNK_MATCH_ANY: 108 case SCTP_CHUNK_MATCH_ANY:
109 return false; 109 return false;
110 case SCTP_CHUNK_MATCH_ONLY: 110 case SCTP_CHUNK_MATCH_ONLY:
@@ -148,9 +148,7 @@ match(const struct sk_buff *skb,
148 && ntohs(sh->dest) <= info->dpts[1], 148 && ntohs(sh->dest) <= info->dpts[1],
149 XT_SCTP_DEST_PORTS, info->flags, info->invflags) 149 XT_SCTP_DEST_PORTS, info->flags, info->invflags)
150 && SCCHECK(match_packet(skb, protoff + sizeof (sctp_sctphdr_t), 150 && SCCHECK(match_packet(skb, protoff + sizeof (sctp_sctphdr_t),
151 info->chunkmap, info->chunk_match_type, 151 info, hotdrop),
152 info->flag_info, info->flag_count,
153 hotdrop),
154 XT_SCTP_CHUNK_TYPES, info->flags, info->invflags); 152 XT_SCTP_CHUNK_TYPES, info->flags, info->invflags);
155} 153}
156 154
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index e11000a8e950..d0936506b731 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1623,11 +1623,6 @@ static struct vm_operations_struct packet_mmap_ops = {
1623 .close =packet_mm_close, 1623 .close =packet_mm_close,
1624}; 1624};
1625 1625
1626static inline struct page *pg_vec_endpage(char *one_pg_vec, unsigned int order)
1627{
1628 return virt_to_page(one_pg_vec + (PAGE_SIZE << order) - 1);
1629}
1630
1631static void free_pg_vec(char **pg_vec, unsigned int order, unsigned int len) 1626static void free_pg_vec(char **pg_vec, unsigned int order, unsigned int len)
1632{ 1627{
1633 int i; 1628 int i;
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index eaabf087c59b..d1e9d68f8ba0 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -146,18 +146,18 @@ static void rfkill_disconnect(struct input_handle *handle)
146static const struct input_device_id rfkill_ids[] = { 146static const struct input_device_id rfkill_ids[] = {
147 { 147 {
148 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, 148 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
149 .evbit = { BIT(EV_KEY) }, 149 .evbit = { BIT_MASK(EV_KEY) },
150 .keybit = { [LONG(KEY_WLAN)] = BIT(KEY_WLAN) }, 150 .keybit = { [BIT_WORD(KEY_WLAN)] = BIT_MASK(KEY_WLAN) },
151 }, 151 },
152 { 152 {
153 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, 153 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
154 .evbit = { BIT(EV_KEY) }, 154 .evbit = { BIT_MASK(EV_KEY) },
155 .keybit = { [LONG(KEY_BLUETOOTH)] = BIT(KEY_BLUETOOTH) }, 155 .keybit = { [BIT_WORD(KEY_BLUETOOTH)] = BIT_MASK(KEY_BLUETOOTH) },
156 }, 156 },
157 { 157 {
158 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT, 158 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
159 .evbit = { BIT(EV_KEY) }, 159 .evbit = { BIT_MASK(EV_KEY) },
160 .keybit = { [LONG(KEY_UWB)] = BIT(KEY_UWB) }, 160 .keybit = { [BIT_WORD(KEY_UWB)] = BIT_MASK(KEY_UWB) },
161 }, 161 },
162 { } 162 { }
163}; 163};
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 92435a882fac..9c15c4888d12 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -2,9 +2,7 @@
2# Traffic control configuration. 2# Traffic control configuration.
3# 3#
4 4
5menu "QoS and/or fair queueing" 5menuconfig NET_SCHED
6
7config NET_SCHED
8 bool "QoS and/or fair queueing" 6 bool "QoS and/or fair queueing"
9 select NET_SCH_FIFO 7 select NET_SCH_FIFO
10 ---help--- 8 ---help---
@@ -41,9 +39,6 @@ config NET_SCHED
41 The available schedulers are listed in the following questions; you 39 The available schedulers are listed in the following questions; you
42 can say Y to as many as you like. If unsure, say N now. 40 can say Y to as many as you like. If unsure, say N now.
43 41
44config NET_SCH_FIFO
45 bool
46
47if NET_SCHED 42if NET_SCHED
48 43
49comment "Queueing/Scheduling" 44comment "Queueing/Scheduling"
@@ -500,4 +495,5 @@ config NET_CLS_IND
500 495
501endif # NET_SCHED 496endif # NET_SCHED
502 497
503endmenu 498config NET_SCH_FIFO
499 bool
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index e9989610712c..ceda8890ab0e 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -55,7 +55,7 @@
55 * ppp0..9. 55 * ppp0..9.
56 * 56 *
57 * NOTE: Certain meta values depend on other subsystems and are 57 * NOTE: Certain meta values depend on other subsystems and are
58 * only available if that subsytem is enabled in the kernel. 58 * only available if that subsystem is enabled in the kernel.
59 */ 59 */
60 60
61#include <linux/module.h> 61#include <linux/module.h>
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 95ae11956f35..fa1a6f45dc41 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -249,10 +249,11 @@ static void dev_watchdog_down(struct net_device *dev)
249 */ 249 */
250void netif_carrier_on(struct net_device *dev) 250void netif_carrier_on(struct net_device *dev)
251{ 251{
252 if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) 252 if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) {
253 linkwatch_fire_event(dev); 253 linkwatch_fire_event(dev);
254 if (netif_running(dev)) 254 if (netif_running(dev))
255 __netdev_watchdog_up(dev); 255 __netdev_watchdog_up(dev);
256 }
256} 257}
257 258
258/** 259/**
@@ -555,6 +556,7 @@ void dev_deactivate(struct net_device *dev)
555{ 556{
556 struct Qdisc *qdisc; 557 struct Qdisc *qdisc;
557 struct sk_buff *skb; 558 struct sk_buff *skb;
559 int running;
558 560
559 spin_lock_bh(&dev->queue_lock); 561 spin_lock_bh(&dev->queue_lock);
560 qdisc = dev->qdisc; 562 qdisc = dev->qdisc;
@@ -570,12 +572,31 @@ void dev_deactivate(struct net_device *dev)
570 572
571 dev_watchdog_down(dev); 573 dev_watchdog_down(dev);
572 574
573 /* Wait for outstanding dev_queue_xmit calls. */ 575 /* Wait for outstanding qdisc-less dev_queue_xmit calls. */
574 synchronize_rcu(); 576 synchronize_rcu();
575 577
576 /* Wait for outstanding qdisc_run calls. */ 578 /* Wait for outstanding qdisc_run calls. */
577 while (test_bit(__LINK_STATE_QDISC_RUNNING, &dev->state)) 579 do {
578 yield(); 580 while (test_bit(__LINK_STATE_QDISC_RUNNING, &dev->state))
581 yield();
582
583 /*
584 * Double-check inside queue lock to ensure that all effects
585 * of the queue run are visible when we return.
586 */
587 spin_lock_bh(&dev->queue_lock);
588 running = test_bit(__LINK_STATE_QDISC_RUNNING, &dev->state);
589 spin_unlock_bh(&dev->queue_lock);
590
591 /*
592 * The running flag should never be set at this point because
593 * we've already set dev->qdisc to noop_qdisc *inside* the same
594 * pair of spin locks. That is, if any qdisc_run starts after
595 * our initial test it should see the noop_qdisc and then
596 * clear the RUNNING bit before dropping the queue lock. So
597 * if it is set here then we've found a bug.
598 */
599 } while (WARN_ON_ONCE(running));
579} 600}
580 601
581void dev_init_scheduler(struct net_device *dev) 602void dev_init_scheduler(struct net_device *dev)
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 3c773c53e12e..c98873f39aec 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -847,7 +847,7 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, cons
847 task->tk_start = jiffies; 847 task->tk_start = jiffies;
848 848
849 dprintk("RPC: new task initialized, procpid %u\n", 849 dprintk("RPC: new task initialized, procpid %u\n",
850 current->pid); 850 task_pid_nr(current));
851} 851}
852 852
853static struct rpc_task * 853static struct rpc_task *
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
index 738db32a287d..864b541bbf51 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -114,7 +114,6 @@ done:
114 114
115static ctl_table debug_table[] = { 115static ctl_table debug_table[] = {
116 { 116 {
117 .ctl_name = CTL_RPCDEBUG,
118 .procname = "rpc_debug", 117 .procname = "rpc_debug",
119 .data = &rpc_debug, 118 .data = &rpc_debug,
120 .maxlen = sizeof(int), 119 .maxlen = sizeof(int),
@@ -122,7 +121,6 @@ static ctl_table debug_table[] = {
122 .proc_handler = &proc_dodebug 121 .proc_handler = &proc_dodebug
123 }, 122 },
124 { 123 {
125 .ctl_name = CTL_NFSDEBUG,
126 .procname = "nfs_debug", 124 .procname = "nfs_debug",
127 .data = &nfs_debug, 125 .data = &nfs_debug,
128 .maxlen = sizeof(int), 126 .maxlen = sizeof(int),
@@ -130,7 +128,6 @@ static ctl_table debug_table[] = {
130 .proc_handler = &proc_dodebug 128 .proc_handler = &proc_dodebug
131 }, 129 },
132 { 130 {
133 .ctl_name = CTL_NFSDDEBUG,
134 .procname = "nfsd_debug", 131 .procname = "nfsd_debug",
135 .data = &nfsd_debug, 132 .data = &nfsd_debug,
136 .maxlen = sizeof(int), 133 .maxlen = sizeof(int),
@@ -138,7 +135,6 @@ static ctl_table debug_table[] = {
138 .proc_handler = &proc_dodebug 135 .proc_handler = &proc_dodebug
139 }, 136 },
140 { 137 {
141 .ctl_name = CTL_NLMDEBUG,
142 .procname = "nlm_debug", 138 .procname = "nlm_debug",
143 .data = &nlm_debug, 139 .data = &nlm_debug,
144 .maxlen = sizeof(int), 140 .maxlen = sizeof(int),
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 6996cba5aa96..9163ec526c2a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -483,7 +483,7 @@ static int unix_listen(struct socket *sock, int backlog)
483 sk->sk_max_ack_backlog = backlog; 483 sk->sk_max_ack_backlog = backlog;
484 sk->sk_state = TCP_LISTEN; 484 sk->sk_state = TCP_LISTEN;
485 /* set credentials so connect can copy them */ 485 /* set credentials so connect can copy them */
486 sk->sk_peercred.pid = current->tgid; 486 sk->sk_peercred.pid = task_tgid_vnr(current);
487 sk->sk_peercred.uid = current->euid; 487 sk->sk_peercred.uid = current->euid;
488 sk->sk_peercred.gid = current->egid; 488 sk->sk_peercred.gid = current->egid;
489 err = 0; 489 err = 0;
@@ -1133,7 +1133,7 @@ restart:
1133 unix_peer(newsk) = sk; 1133 unix_peer(newsk) = sk;
1134 newsk->sk_state = TCP_ESTABLISHED; 1134 newsk->sk_state = TCP_ESTABLISHED;
1135 newsk->sk_type = sk->sk_type; 1135 newsk->sk_type = sk->sk_type;
1136 newsk->sk_peercred.pid = current->tgid; 1136 newsk->sk_peercred.pid = task_tgid_vnr(current);
1137 newsk->sk_peercred.uid = current->euid; 1137 newsk->sk_peercred.uid = current->euid;
1138 newsk->sk_peercred.gid = current->egid; 1138 newsk->sk_peercred.gid = current->egid;
1139 newu = unix_sk(newsk); 1139 newu = unix_sk(newsk);
@@ -1194,7 +1194,7 @@ static int unix_socketpair(struct socket *socka, struct socket *sockb)
1194 sock_hold(skb); 1194 sock_hold(skb);
1195 unix_peer(ska)=skb; 1195 unix_peer(ska)=skb;
1196 unix_peer(skb)=ska; 1196 unix_peer(skb)=ska;
1197 ska->sk_peercred.pid = skb->sk_peercred.pid = current->tgid; 1197 ska->sk_peercred.pid = skb->sk_peercred.pid = task_tgid_vnr(current);
1198 ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid; 1198 ska->sk_peercred.uid = skb->sk_peercred.uid = current->euid;
1199 ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid; 1199 ska->sk_peercred.gid = skb->sk_peercred.gid = current->egid;
1200 1200
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 113f44429982..cb97fda1b6df 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -49,13 +49,16 @@ EXPORT_SYMBOL(secpath_dup);
49int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq) 49int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq)
50{ 50{
51 int offset, offset_seq; 51 int offset, offset_seq;
52 int hlen;
52 53
53 switch (nexthdr) { 54 switch (nexthdr) {
54 case IPPROTO_AH: 55 case IPPROTO_AH:
56 hlen = sizeof(struct ip_auth_hdr);
55 offset = offsetof(struct ip_auth_hdr, spi); 57 offset = offsetof(struct ip_auth_hdr, spi);
56 offset_seq = offsetof(struct ip_auth_hdr, seq_no); 58 offset_seq = offsetof(struct ip_auth_hdr, seq_no);
57 break; 59 break;
58 case IPPROTO_ESP: 60 case IPPROTO_ESP:
61 hlen = sizeof(struct ip_esp_hdr);
59 offset = offsetof(struct ip_esp_hdr, spi); 62 offset = offsetof(struct ip_esp_hdr, spi);
60 offset_seq = offsetof(struct ip_esp_hdr, seq_no); 63 offset_seq = offsetof(struct ip_esp_hdr, seq_no);
61 break; 64 break;
@@ -69,7 +72,7 @@ int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq)
69 return 1; 72 return 1;
70 } 73 }
71 74
72 if (!pskb_may_pull(skb, 16)) 75 if (!pskb_may_pull(skb, hlen))
73 return -EINVAL; 76 return -EINVAL;
74 77
75 *spi = *(__be32*)(skb_transport_header(skb) + offset); 78 *spi = *(__be32*)(skb_transport_header(skb) + offset);
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 0eb3377602e9..f4bfd6c45651 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -63,7 +63,7 @@ int xfrm_output(struct sk_buff *skb)
63 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); 63 xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
64 } 64 }
65 65
66 err = x->mode->output(x, skb); 66 err = x->outer_mode->output(x, skb);
67 if (err) 67 if (err)
68 goto error; 68 goto error;
69 69
@@ -82,7 +82,7 @@ int xfrm_output(struct sk_buff *skb)
82 } 82 }
83 dst = skb->dst; 83 dst = skb->dst;
84 x = dst->xfrm; 84 x = dst->xfrm;
85 } while (x && (x->props.mode != XFRM_MODE_TUNNEL)); 85 } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL));
86 86
87 err = 0; 87 err = 0;
88 88
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index af27c193697c..b702bd8a3893 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -49,8 +49,6 @@ static DEFINE_SPINLOCK(xfrm_policy_gc_lock);
49 49
50static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family); 50static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family);
51static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo); 51static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo);
52static struct xfrm_policy_afinfo *xfrm_policy_lock_afinfo(unsigned int family);
53static void xfrm_policy_unlock_afinfo(struct xfrm_policy_afinfo *afinfo);
54 52
55static inline int 53static inline int
56__xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl) 54__xfrm4_selector_match(struct xfrm_selector *sel, struct flowi *fl)
@@ -86,72 +84,6 @@ int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl,
86 return 0; 84 return 0;
87} 85}
88 86
89int xfrm_register_type(struct xfrm_type *type, unsigned short family)
90{
91 struct xfrm_policy_afinfo *afinfo = xfrm_policy_lock_afinfo(family);
92 struct xfrm_type **typemap;
93 int err = 0;
94
95 if (unlikely(afinfo == NULL))
96 return -EAFNOSUPPORT;
97 typemap = afinfo->type_map;
98
99 if (likely(typemap[type->proto] == NULL))
100 typemap[type->proto] = type;
101 else
102 err = -EEXIST;
103 xfrm_policy_unlock_afinfo(afinfo);
104 return err;
105}
106EXPORT_SYMBOL(xfrm_register_type);
107
108int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
109{
110 struct xfrm_policy_afinfo *afinfo = xfrm_policy_lock_afinfo(family);
111 struct xfrm_type **typemap;
112 int err = 0;
113
114 if (unlikely(afinfo == NULL))
115 return -EAFNOSUPPORT;
116 typemap = afinfo->type_map;
117
118 if (unlikely(typemap[type->proto] != type))
119 err = -ENOENT;
120 else
121 typemap[type->proto] = NULL;
122 xfrm_policy_unlock_afinfo(afinfo);
123 return err;
124}
125EXPORT_SYMBOL(xfrm_unregister_type);
126
127struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family)
128{
129 struct xfrm_policy_afinfo *afinfo;
130 struct xfrm_type **typemap;
131 struct xfrm_type *type;
132 int modload_attempted = 0;
133
134retry:
135 afinfo = xfrm_policy_get_afinfo(family);
136 if (unlikely(afinfo == NULL))
137 return NULL;
138 typemap = afinfo->type_map;
139
140 type = typemap[proto];
141 if (unlikely(type && !try_module_get(type->owner)))
142 type = NULL;
143 if (!type && !modload_attempted) {
144 xfrm_policy_put_afinfo(afinfo);
145 request_module("xfrm-type-%d-%d",
146 (int) family, (int) proto);
147 modload_attempted = 1;
148 goto retry;
149 }
150
151 xfrm_policy_put_afinfo(afinfo);
152 return type;
153}
154
155int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, 87int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl,
156 unsigned short family) 88 unsigned short family)
157{ 89{
@@ -170,94 +102,6 @@ int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl,
170} 102}
171EXPORT_SYMBOL(xfrm_dst_lookup); 103EXPORT_SYMBOL(xfrm_dst_lookup);
172 104
173void xfrm_put_type(struct xfrm_type *type)
174{
175 module_put(type->owner);
176}
177
178int xfrm_register_mode(struct xfrm_mode *mode, int family)
179{
180 struct xfrm_policy_afinfo *afinfo;
181 struct xfrm_mode **modemap;
182 int err;
183
184 if (unlikely(mode->encap >= XFRM_MODE_MAX))
185 return -EINVAL;
186
187 afinfo = xfrm_policy_lock_afinfo(family);
188 if (unlikely(afinfo == NULL))
189 return -EAFNOSUPPORT;
190
191 err = -EEXIST;
192 modemap = afinfo->mode_map;
193 if (likely(modemap[mode->encap] == NULL)) {
194 modemap[mode->encap] = mode;
195 err = 0;
196 }
197
198 xfrm_policy_unlock_afinfo(afinfo);
199 return err;
200}
201EXPORT_SYMBOL(xfrm_register_mode);
202
203int xfrm_unregister_mode(struct xfrm_mode *mode, int family)
204{
205 struct xfrm_policy_afinfo *afinfo;
206 struct xfrm_mode **modemap;
207 int err;
208
209 if (unlikely(mode->encap >= XFRM_MODE_MAX))
210 return -EINVAL;
211
212 afinfo = xfrm_policy_lock_afinfo(family);
213 if (unlikely(afinfo == NULL))
214 return -EAFNOSUPPORT;
215
216 err = -ENOENT;
217 modemap = afinfo->mode_map;
218 if (likely(modemap[mode->encap] == mode)) {
219 modemap[mode->encap] = NULL;
220 err = 0;
221 }
222
223 xfrm_policy_unlock_afinfo(afinfo);
224 return err;
225}
226EXPORT_SYMBOL(xfrm_unregister_mode);
227
228struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family)
229{
230 struct xfrm_policy_afinfo *afinfo;
231 struct xfrm_mode *mode;
232 int modload_attempted = 0;
233
234 if (unlikely(encap >= XFRM_MODE_MAX))
235 return NULL;
236
237retry:
238 afinfo = xfrm_policy_get_afinfo(family);
239 if (unlikely(afinfo == NULL))
240 return NULL;
241
242 mode = afinfo->mode_map[encap];
243 if (unlikely(mode && !try_module_get(mode->owner)))
244 mode = NULL;
245 if (!mode && !modload_attempted) {
246 xfrm_policy_put_afinfo(afinfo);
247 request_module("xfrm-mode-%d-%d", family, encap);
248 modload_attempted = 1;
249 goto retry;
250 }
251
252 xfrm_policy_put_afinfo(afinfo);
253 return mode;
254}
255
256void xfrm_put_mode(struct xfrm_mode *mode)
257{
258 module_put(mode->owner);
259}
260
261static inline unsigned long make_jiffies(long secs) 105static inline unsigned long make_jiffies(long secs)
262{ 106{
263 if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ) 107 if (secs >= (MAX_SCHEDULE_TIMEOUT-1)/HZ)
@@ -2096,7 +1940,8 @@ int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *first,
2096 if (xdst->genid != dst->xfrm->genid) 1940 if (xdst->genid != dst->xfrm->genid)
2097 return 0; 1941 return 0;
2098 1942
2099 if (strict && fl && dst->xfrm->props.mode != XFRM_MODE_TUNNEL && 1943 if (strict && fl &&
1944 !(dst->xfrm->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL) &&
2100 !xfrm_state_addr_flow_check(dst->xfrm, fl, family)) 1945 !xfrm_state_addr_flow_check(dst->xfrm, fl, family))
2101 return 0; 1946 return 0;
2102 1947
@@ -2213,23 +2058,6 @@ static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo)
2213 read_unlock(&xfrm_policy_afinfo_lock); 2058 read_unlock(&xfrm_policy_afinfo_lock);
2214} 2059}
2215 2060
2216static struct xfrm_policy_afinfo *xfrm_policy_lock_afinfo(unsigned int family)
2217{
2218 struct xfrm_policy_afinfo *afinfo;
2219 if (unlikely(family >= NPROTO))
2220 return NULL;
2221 write_lock_bh(&xfrm_policy_afinfo_lock);
2222 afinfo = xfrm_policy_afinfo[family];
2223 if (unlikely(!afinfo))
2224 write_unlock_bh(&xfrm_policy_afinfo_lock);
2225 return afinfo;
2226}
2227
2228static void xfrm_policy_unlock_afinfo(struct xfrm_policy_afinfo *afinfo)
2229{
2230 write_unlock_bh(&xfrm_policy_afinfo_lock);
2231}
2232
2233static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) 2061static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
2234{ 2062{
2235 struct net_device *dev = ptr; 2063 struct net_device *dev = ptr;
@@ -2464,7 +2292,8 @@ static int xfrm_policy_migrate(struct xfrm_policy *pol,
2464 if (!migrate_tmpl_match(mp, &pol->xfrm_vec[i])) 2292 if (!migrate_tmpl_match(mp, &pol->xfrm_vec[i]))
2465 continue; 2293 continue;
2466 n++; 2294 n++;
2467 if (pol->xfrm_vec[i].mode != XFRM_MODE_TUNNEL) 2295 if (pol->xfrm_vec[i].mode != XFRM_MODE_TUNNEL &&
2296 pol->xfrm_vec[i].mode != XFRM_MODE_BEET)
2468 continue; 2297 continue;
2469 /* update endpoints */ 2298 /* update endpoints */
2470 memcpy(&pol->xfrm_vec[i].id.daddr, &mp->new_daddr, 2299 memcpy(&pol->xfrm_vec[i].id.daddr, &mp->new_daddr,
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 344f0a6abec5..224b44e31a07 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -57,6 +57,9 @@ static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024;
57static unsigned int xfrm_state_num; 57static unsigned int xfrm_state_num;
58static unsigned int xfrm_state_genid; 58static unsigned int xfrm_state_genid;
59 59
60static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
61static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
62
60static inline unsigned int xfrm_dst_hash(xfrm_address_t *daddr, 63static inline unsigned int xfrm_dst_hash(xfrm_address_t *daddr,
61 xfrm_address_t *saddr, 64 xfrm_address_t *saddr,
62 u32 reqid, 65 u32 reqid,
@@ -187,6 +190,184 @@ int __xfrm_state_delete(struct xfrm_state *x);
187int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 190int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol);
188void km_state_expired(struct xfrm_state *x, int hard, u32 pid); 191void km_state_expired(struct xfrm_state *x, int hard, u32 pid);
189 192
193static struct xfrm_state_afinfo *xfrm_state_lock_afinfo(unsigned int family)
194{
195 struct xfrm_state_afinfo *afinfo;
196 if (unlikely(family >= NPROTO))
197 return NULL;
198 write_lock_bh(&xfrm_state_afinfo_lock);
199 afinfo = xfrm_state_afinfo[family];
200 if (unlikely(!afinfo))
201 write_unlock_bh(&xfrm_state_afinfo_lock);
202 return afinfo;
203}
204
205static void xfrm_state_unlock_afinfo(struct xfrm_state_afinfo *afinfo)
206{
207 write_unlock_bh(&xfrm_state_afinfo_lock);
208}
209
210int xfrm_register_type(struct xfrm_type *type, unsigned short family)
211{
212 struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
213 struct xfrm_type **typemap;
214 int err = 0;
215
216 if (unlikely(afinfo == NULL))
217 return -EAFNOSUPPORT;
218 typemap = afinfo->type_map;
219
220 if (likely(typemap[type->proto] == NULL))
221 typemap[type->proto] = type;
222 else
223 err = -EEXIST;
224 xfrm_state_unlock_afinfo(afinfo);
225 return err;
226}
227EXPORT_SYMBOL(xfrm_register_type);
228
229int xfrm_unregister_type(struct xfrm_type *type, unsigned short family)
230{
231 struct xfrm_state_afinfo *afinfo = xfrm_state_lock_afinfo(family);
232 struct xfrm_type **typemap;
233 int err = 0;
234
235 if (unlikely(afinfo == NULL))
236 return -EAFNOSUPPORT;
237 typemap = afinfo->type_map;
238
239 if (unlikely(typemap[type->proto] != type))
240 err = -ENOENT;
241 else
242 typemap[type->proto] = NULL;
243 xfrm_state_unlock_afinfo(afinfo);
244 return err;
245}
246EXPORT_SYMBOL(xfrm_unregister_type);
247
248static struct xfrm_type *xfrm_get_type(u8 proto, unsigned short family)
249{
250 struct xfrm_state_afinfo *afinfo;
251 struct xfrm_type **typemap;
252 struct xfrm_type *type;
253 int modload_attempted = 0;
254
255retry:
256 afinfo = xfrm_state_get_afinfo(family);
257 if (unlikely(afinfo == NULL))
258 return NULL;
259 typemap = afinfo->type_map;
260
261 type = typemap[proto];
262 if (unlikely(type && !try_module_get(type->owner)))
263 type = NULL;
264 if (!type && !modload_attempted) {
265 xfrm_state_put_afinfo(afinfo);
266 request_module("xfrm-type-%d-%d", family, proto);
267 modload_attempted = 1;
268 goto retry;
269 }
270
271 xfrm_state_put_afinfo(afinfo);
272 return type;
273}
274
275static void xfrm_put_type(struct xfrm_type *type)
276{
277 module_put(type->owner);
278}
279
280int xfrm_register_mode(struct xfrm_mode *mode, int family)
281{
282 struct xfrm_state_afinfo *afinfo;
283 struct xfrm_mode **modemap;
284 int err;
285
286 if (unlikely(mode->encap >= XFRM_MODE_MAX))
287 return -EINVAL;
288
289 afinfo = xfrm_state_lock_afinfo(family);
290 if (unlikely(afinfo == NULL))
291 return -EAFNOSUPPORT;
292
293 err = -EEXIST;
294 modemap = afinfo->mode_map;
295 if (modemap[mode->encap])
296 goto out;
297
298 err = -ENOENT;
299 if (!try_module_get(afinfo->owner))
300 goto out;
301
302 mode->afinfo = afinfo;
303 modemap[mode->encap] = mode;
304 err = 0;
305
306out:
307 xfrm_state_unlock_afinfo(afinfo);
308 return err;
309}
310EXPORT_SYMBOL(xfrm_register_mode);
311
312int xfrm_unregister_mode(struct xfrm_mode *mode, int family)
313{
314 struct xfrm_state_afinfo *afinfo;
315 struct xfrm_mode **modemap;
316 int err;
317
318 if (unlikely(mode->encap >= XFRM_MODE_MAX))
319 return -EINVAL;
320
321 afinfo = xfrm_state_lock_afinfo(family);
322 if (unlikely(afinfo == NULL))
323 return -EAFNOSUPPORT;
324
325 err = -ENOENT;
326 modemap = afinfo->mode_map;
327 if (likely(modemap[mode->encap] == mode)) {
328 modemap[mode->encap] = NULL;
329 module_put(mode->afinfo->owner);
330 err = 0;
331 }
332
333 xfrm_state_unlock_afinfo(afinfo);
334 return err;
335}
336EXPORT_SYMBOL(xfrm_unregister_mode);
337
338static struct xfrm_mode *xfrm_get_mode(unsigned int encap, int family)
339{
340 struct xfrm_state_afinfo *afinfo;
341 struct xfrm_mode *mode;
342 int modload_attempted = 0;
343
344 if (unlikely(encap >= XFRM_MODE_MAX))
345 return NULL;
346
347retry:
348 afinfo = xfrm_state_get_afinfo(family);
349 if (unlikely(afinfo == NULL))
350 return NULL;
351
352 mode = afinfo->mode_map[encap];
353 if (unlikely(mode && !try_module_get(mode->owner)))
354 mode = NULL;
355 if (!mode && !modload_attempted) {
356 xfrm_state_put_afinfo(afinfo);
357 request_module("xfrm-mode-%d-%d", family, encap);
358 modload_attempted = 1;
359 goto retry;
360 }
361
362 xfrm_state_put_afinfo(afinfo);
363 return mode;
364}
365
366static void xfrm_put_mode(struct xfrm_mode *mode)
367{
368 module_put(mode->owner);
369}
370
190static void xfrm_state_gc_destroy(struct xfrm_state *x) 371static void xfrm_state_gc_destroy(struct xfrm_state *x)
191{ 372{
192 del_timer_sync(&x->timer); 373 del_timer_sync(&x->timer);
@@ -196,8 +377,10 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x)
196 kfree(x->calg); 377 kfree(x->calg);
197 kfree(x->encap); 378 kfree(x->encap);
198 kfree(x->coaddr); 379 kfree(x->coaddr);
199 if (x->mode) 380 if (x->inner_mode)
200 xfrm_put_mode(x->mode); 381 xfrm_put_mode(x->inner_mode);
382 if (x->outer_mode)
383 xfrm_put_mode(x->outer_mode);
201 if (x->type) { 384 if (x->type) {
202 x->type->destructor(x); 385 x->type->destructor(x);
203 xfrm_put_type(x->type); 386 xfrm_put_type(x->type);
@@ -1699,7 +1882,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo)
1699} 1882}
1700EXPORT_SYMBOL(xfrm_state_unregister_afinfo); 1883EXPORT_SYMBOL(xfrm_state_unregister_afinfo);
1701 1884
1702struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family) 1885static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family)
1703{ 1886{
1704 struct xfrm_state_afinfo *afinfo; 1887 struct xfrm_state_afinfo *afinfo;
1705 if (unlikely(family >= NPROTO)) 1888 if (unlikely(family >= NPROTO))
@@ -1711,14 +1894,11 @@ struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned short family)
1711 return afinfo; 1894 return afinfo;
1712} 1895}
1713 1896
1714void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo) 1897static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo)
1715{ 1898{
1716 read_unlock(&xfrm_state_afinfo_lock); 1899 read_unlock(&xfrm_state_afinfo_lock);
1717} 1900}
1718 1901
1719EXPORT_SYMBOL(xfrm_state_get_afinfo);
1720EXPORT_SYMBOL(xfrm_state_put_afinfo);
1721
1722/* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */ 1902/* Temporarily located here until net/xfrm/xfrm_tunnel.c is created */
1723void xfrm_state_delete_tunnel(struct xfrm_state *x) 1903void xfrm_state_delete_tunnel(struct xfrm_state *x)
1724{ 1904{
@@ -1769,6 +1949,14 @@ int xfrm_init_state(struct xfrm_state *x)
1769 goto error; 1949 goto error;
1770 1950
1771 err = -EPROTONOSUPPORT; 1951 err = -EPROTONOSUPPORT;
1952 x->inner_mode = xfrm_get_mode(x->props.mode, x->sel.family);
1953 if (x->inner_mode == NULL)
1954 goto error;
1955
1956 if (!(x->inner_mode->flags & XFRM_MODE_FLAG_TUNNEL) &&
1957 family != x->sel.family)
1958 goto error;
1959
1772 x->type = xfrm_get_type(x->id.proto, family); 1960 x->type = xfrm_get_type(x->id.proto, family);
1773 if (x->type == NULL) 1961 if (x->type == NULL)
1774 goto error; 1962 goto error;
@@ -1777,8 +1965,8 @@ int xfrm_init_state(struct xfrm_state *x)
1777 if (err) 1965 if (err)
1778 goto error; 1966 goto error;
1779 1967
1780 x->mode = xfrm_get_mode(x->props.mode, family); 1968 x->outer_mode = xfrm_get_mode(x->props.mode, family);
1781 if (x->mode == NULL) 1969 if (x->outer_mode == NULL)
1782 goto error; 1970 goto error;
1783 1971
1784 x->km.state = XFRM_STATE_VALID; 1972 x->km.state = XFRM_STATE_VALID;
diff --git a/samples/Kconfig b/samples/Kconfig
new file mode 100644
index 000000000000..57bb2236952c
--- /dev/null
+++ b/samples/Kconfig
@@ -0,0 +1,16 @@
1# samples/Kconfig
2
3menuconfig SAMPLES
4 bool "Sample kernel code"
5 help
6 You can build and test sample kernel code here.
7
8if SAMPLES
9
10config SAMPLE_MARKERS
11 tristate "Build markers examples -- loadable modules only"
12 depends on MARKERS && m
13 help
14 This build markers example modules.
15
16endif # SAMPLES
diff --git a/samples/Makefile b/samples/Makefile
new file mode 100644
index 000000000000..5a4f0b6bcbed
--- /dev/null
+++ b/samples/Makefile
@@ -0,0 +1,3 @@
1# Makefile for Linux samples code
2
3obj-$(CONFIG_SAMPLES) += markers/
diff --git a/samples/markers/Makefile b/samples/markers/Makefile
new file mode 100644
index 000000000000..6d7231265f0f
--- /dev/null
+++ b/samples/markers/Makefile
@@ -0,0 +1,4 @@
1# builds the kprobes example kernel modules;
2# then to use one (as root): insmod <module_name.ko>
3
4obj-$(CONFIG_SAMPLE_MARKERS) += probe-example.o marker-example.o
diff --git a/samples/markers/marker-example.c b/samples/markers/marker-example.c
new file mode 100644
index 000000000000..e787c6d16dd7
--- /dev/null
+++ b/samples/markers/marker-example.c
@@ -0,0 +1,54 @@
1/* marker-example.c
2 *
3 * Executes a marker when /proc/marker-example is opened.
4 *
5 * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
6 *
7 * This file is released under the GPLv2.
8 * See the file COPYING for more details.
9 */
10
11#include <linux/module.h>
12#include <linux/marker.h>
13#include <linux/sched.h>
14#include <linux/proc_fs.h>
15
16struct proc_dir_entry *pentry_example;
17
18static int my_open(struct inode *inode, struct file *file)
19{
20 int i;
21
22 trace_mark(subsystem_event, "%d %s", 123, "example string");
23 for (i = 0; i < 10; i++)
24 trace_mark(subsystem_eventb, MARK_NOARGS);
25 return -EPERM;
26}
27
28static struct file_operations mark_ops = {
29 .open = my_open,
30};
31
32static int example_init(void)
33{
34 printk(KERN_ALERT "example init\n");
35 pentry_example = create_proc_entry("marker-example", 0444, NULL);
36 if (pentry_example)
37 pentry_example->proc_fops = &mark_ops;
38 else
39 return -EPERM;
40 return 0;
41}
42
43static void example_exit(void)
44{
45 printk(KERN_ALERT "example exit\n");
46 remove_proc_entry("marker-example", NULL);
47}
48
49module_init(example_init)
50module_exit(example_exit)
51
52MODULE_LICENSE("GPL");
53MODULE_AUTHOR("Mathieu Desnoyers");
54MODULE_DESCRIPTION("Marker example");
diff --git a/samples/markers/probe-example.c b/samples/markers/probe-example.c
new file mode 100644
index 000000000000..238b2e384fc8
--- /dev/null
+++ b/samples/markers/probe-example.c
@@ -0,0 +1,98 @@
1/* probe-example.c
2 *
3 * Connects two functions to marker call sites.
4 *
5 * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
6 *
7 * This file is released under the GPLv2.
8 * See the file COPYING for more details.
9 */
10
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/module.h>
14#include <linux/marker.h>
15#include <asm/atomic.h>
16
17struct probe_data {
18 const char *name;
19 const char *format;
20 marker_probe_func *probe_func;
21};
22
23void probe_subsystem_event(const struct marker *mdata, void *private,
24 const char *format, ...)
25{
26 va_list ap;
27 /* Declare args */
28 unsigned int value;
29 const char *mystr;
30
31 /* Assign args */
32 va_start(ap, format);
33 value = va_arg(ap, typeof(value));
34 mystr = va_arg(ap, typeof(mystr));
35
36 /* Call printk */
37 printk(KERN_DEBUG "Value %u, string %s\n", value, mystr);
38
39 /* or count, check rights, serialize data in a buffer */
40
41 va_end(ap);
42}
43
44atomic_t eventb_count = ATOMIC_INIT(0);
45
46void probe_subsystem_eventb(const struct marker *mdata, void *private,
47 const char *format, ...)
48{
49 /* Increment counter */
50 atomic_inc(&eventb_count);
51}
52
53static struct probe_data probe_array[] =
54{
55 { .name = "subsystem_event",
56 .format = "%d %s",
57 .probe_func = probe_subsystem_event },
58 { .name = "subsystem_eventb",
59 .format = MARK_NOARGS,
60 .probe_func = probe_subsystem_eventb },
61};
62
63static int __init probe_init(void)
64{
65 int result;
66 int i;
67
68 for (i = 0; i < ARRAY_SIZE(probe_array); i++) {
69 result = marker_probe_register(probe_array[i].name,
70 probe_array[i].format,
71 probe_array[i].probe_func, &probe_array[i]);
72 if (result)
73 printk(KERN_INFO "Unable to register probe %s\n",
74 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 }
80 return 0;
81}
82
83static void __exit probe_fini(void)
84{
85 int i;
86
87 for (i = 0; i < ARRAY_SIZE(probe_array); i++)
88 marker_probe_unregister(probe_array[i].name);
89 printk(KERN_INFO "Number of event b : %u\n",
90 atomic_read(&eventb_count));
91}
92
93module_init(probe_init);
94module_exit(probe_fini);
95
96MODULE_LICENSE("GPL");
97MODULE_AUTHOR("Mathieu Desnoyers");
98MODULE_DESCRIPTION("SUBSYSTEM Probe");
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index de7bb284c611..b96ea8d6a5ed 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -56,6 +56,17 @@ endef
56# gcc support functions 56# gcc support functions
57# See documentation in Documentation/kbuild/makefiles.txt 57# See documentation in Documentation/kbuild/makefiles.txt
58 58
59# cc-cross-prefix
60# Usage: CROSS_COMPILE := $(call cc-cross-prefix, m68k-linux-gnu- m68k-linux-)
61# Return first prefix where a prefix$(CC) is found in PATH.
62# If no $(CC) found in PATH with listed prefixes return nothing
63cc-cross-prefix = \
64 $(word 1, $(foreach c,$(1), \
65 $(shell set -e; \
66 if (which $(strip $(c))$(CC)) > /dev/null 2>&1 ; then \
67 echo $(c); \
68 fi)))
69
59# output directory for tests below 70# output directory for tests below
60TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) 71TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
61 72
diff --git a/scripts/basic/docproc.c b/scripts/basic/docproc.c
index e5c6ac7bde9b..0e4bd5459df4 100644
--- a/scripts/basic/docproc.c
+++ b/scripts/basic/docproc.c
@@ -66,12 +66,15 @@ FILELINE * entity_system;
66#define FUNCTION "-function" 66#define FUNCTION "-function"
67#define NOFUNCTION "-nofunction" 67#define NOFUNCTION "-nofunction"
68 68
69char *srctree;
70
69void usage (void) 71void usage (void)
70{ 72{
71 fprintf(stderr, "Usage: docproc {doc|depend} file\n"); 73 fprintf(stderr, "Usage: docproc {doc|depend} file\n");
72 fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n"); 74 fprintf(stderr, "Input is read from file.tmpl. Output is sent to stdout\n");
73 fprintf(stderr, "doc: frontend when generating kernel documentation\n"); 75 fprintf(stderr, "doc: frontend when generating kernel documentation\n");
74 fprintf(stderr, "depend: generate list of files referenced within file\n"); 76 fprintf(stderr, "depend: generate list of files referenced within file\n");
77 fprintf(stderr, "Environment variable SRCTREE: absolute path to kernel source tree.\n");
75} 78}
76 79
77/* 80/*
@@ -90,7 +93,7 @@ void exec_kernel_doc(char **svec)
90 exit(1); 93 exit(1);
91 case 0: 94 case 0:
92 memset(real_filename, 0, sizeof(real_filename)); 95 memset(real_filename, 0, sizeof(real_filename));
93 strncat(real_filename, getenv("SRCTREE"), PATH_MAX); 96 strncat(real_filename, srctree, PATH_MAX);
94 strncat(real_filename, KERNELDOCPATH KERNELDOC, 97 strncat(real_filename, KERNELDOCPATH KERNELDOC,
95 PATH_MAX - strlen(real_filename)); 98 PATH_MAX - strlen(real_filename));
96 execvp(real_filename, svec); 99 execvp(real_filename, svec);
@@ -171,7 +174,7 @@ void find_export_symbols(char * filename)
171 if (filename_exist(filename) == NULL) { 174 if (filename_exist(filename) == NULL) {
172 char real_filename[PATH_MAX + 1]; 175 char real_filename[PATH_MAX + 1];
173 memset(real_filename, 0, sizeof(real_filename)); 176 memset(real_filename, 0, sizeof(real_filename));
174 strncat(real_filename, getenv("SRCTREE"), PATH_MAX); 177 strncat(real_filename, srctree, PATH_MAX);
175 strncat(real_filename, filename, 178 strncat(real_filename, filename,
176 PATH_MAX - strlen(real_filename)); 179 PATH_MAX - strlen(real_filename));
177 sym = add_new_file(filename); 180 sym = add_new_file(filename);
@@ -338,6 +341,10 @@ void parse_file(FILE *infile)
338int main(int argc, char *argv[]) 341int main(int argc, char *argv[])
339{ 342{
340 FILE * infile; 343 FILE * infile;
344
345 srctree = getenv("SRCTREE");
346 if (!srctree)
347 srctree = getcwd(NULL, 0);
341 if (argc != 3) { 348 if (argc != 3) {
342 usage(); 349 usage();
343 exit(1); 350 exit(1);
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 59ad83caa210..cbb42580a81d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -9,7 +9,7 @@ use strict;
9my $P = $0; 9my $P = $0;
10$P =~ s@.*/@@g; 10$P =~ s@.*/@@g;
11 11
12my $V = '0.10'; 12my $V = '0.11';
13 13
14use Getopt::Long qw(:config no_auto_abbrev); 14use Getopt::Long qw(:config no_auto_abbrev);
15 15
@@ -18,12 +18,21 @@ my $tree = 1;
18my $chk_signoff = 1; 18my $chk_signoff = 1;
19my $chk_patch = 1; 19my $chk_patch = 1;
20my $tst_type = 0; 20my $tst_type = 0;
21my $emacs = 0;
22my $file = 0;
23my $check = 0;
24my $root;
21GetOptions( 25GetOptions(
22 'q|quiet' => \$quiet, 26 'q|quiet+' => \$quiet,
23 'tree!' => \$tree, 27 'tree!' => \$tree,
24 'signoff!' => \$chk_signoff, 28 'signoff!' => \$chk_signoff,
25 'patch!' => \$chk_patch, 29 'patch!' => \$chk_patch,
26 'test-type!' => \$tst_type, 30 'test-type!' => \$tst_type,
31 'emacs!' => \$emacs,
32 'file!' => \$file,
33 'subjective!' => \$check,
34 'strict!' => \$check,
35 'root=s' => \$root,
27) or exit; 36) or exit;
28 37
29my $exit = 0; 38my $exit = 0;
@@ -33,19 +42,110 @@ if ($#ARGV < 0) {
33 print "version: $V\n"; 42 print "version: $V\n";
34 print "options: -q => quiet\n"; 43 print "options: -q => quiet\n";
35 print " --no-tree => run without a kernel tree\n"; 44 print " --no-tree => run without a kernel tree\n";
45 print " --emacs => emacs compile window format\n";
46 print " --file => check a source file\n";
47 print " --strict => enable more subjective tests\n";
48 print " --root => path to the kernel tree root\n";
36 exit(1); 49 exit(1);
37} 50}
38 51
39if ($tree && !top_of_kernel_tree()) { 52if ($tree) {
40 print "Must be run from the top-level dir. of a kernel tree\n"; 53 if (defined $root) {
41 exit(2); 54 if (!top_of_kernel_tree($root)) {
55 die "$P: $root: --root does not point at a valid tree\n";
56 }
57 } else {
58 if (top_of_kernel_tree('.')) {
59 $root = '.';
60 } elsif ($0 =~ m@(.*)/scripts/[^/]*$@ &&
61 top_of_kernel_tree($1)) {
62 $root = $1;
63 }
64 }
65
66 if (!defined $root) {
67 print "Must be run from the top-level dir. of a kernel tree\n";
68 exit(2);
69 }
42} 70}
43 71
72my $emitted_corrupt = 0;
73
74our $Ident = qr{[A-Za-z_][A-Za-z\d_]*};
75our $Storage = qr{extern|static|asmlinkage};
76our $Sparse = qr{
77 __user|
78 __kernel|
79 __force|
80 __iomem|
81 __must_check|
82 __init_refok|
83 __kprobes|
84 fastcall
85 }x;
86our $Attribute = qr{
87 const|
88 __read_mostly|
89 __kprobes|
90 __(?:mem|cpu|dev|)(?:initdata|init)
91 }x;
92our $Inline = qr{inline|__always_inline|noinline};
93our $NonptrType = qr{
94 \b
95 (?:const\s+)?
96 (?:unsigned\s+)?
97 (?:
98 void|
99 char|
100 short|
101 int|
102 long|
103 unsigned|
104 float|
105 double|
106 bool|
107 long\s+int|
108 long\s+long|
109 long\s+long\s+int|
110 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
111 struct\s+$Ident|
112 union\s+$Ident|
113 enum\s+$Ident|
114 ${Ident}_t|
115 ${Ident}_handler|
116 ${Ident}_handler_fn
117 )
118 (?:\s+$Sparse)*
119 \b
120 }x;
121
122our $Type = qr{
123 \b$NonptrType\b
124 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
125 (?:\s+$Sparse|\s+$Attribute)*
126 }x;
127our $Declare = qr{(?:$Storage\s+)?$Type};
128our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
129our $Lval = qr{$Ident(?:$Member)*};
130
131our $Constant = qr{(?:[0-9]+|0x[0-9a-fA-F]+)[UL]*};
132our $Assignment = qr{(?:\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=)};
133our $Operators = qr{
134 <=|>=|==|!=|
135 =>|->|<<|>>|<|>|!|~|
136 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/
137 }x;
138
139our $Bare = '';
140
141$chk_signoff = 0 if ($file);
142
44my @dep_includes = (); 143my @dep_includes = ();
45my @dep_functions = (); 144my @dep_functions = ();
46my $removal = 'Documentation/feature-removal-schedule.txt'; 145my $removal = "Documentation/feature-removal-schedule.txt";
47if ($tree && -f $removal) { 146if ($tree && -f "$root/$removal") {
48 open(REMOVE, "<$removal") || die "$P: $removal: open failed - $!\n"; 147 open(REMOVE, "<$root/$removal") ||
148 die "$P: $removal: open failed - $!\n";
49 while (<REMOVE>) { 149 while (<REMOVE>) {
50 if (/^Check:\s+(.*\S)/) { 150 if (/^Check:\s+(.*\S)/) {
51 for my $entry (split(/[, ]+/, $1)) { 151 for my $entry (split(/[, ]+/, $1)) {
@@ -61,28 +161,42 @@ if ($tree && -f $removal) {
61} 161}
62 162
63my @rawlines = (); 163my @rawlines = ();
64while (<>) { 164for my $filename (@ARGV) {
65 chomp; 165 if ($file) {
66 push(@rawlines, $_); 166 open(FILE, "diff -u /dev/null $filename|") ||
67 if (eof(ARGV)) { 167 die "$P: $filename: diff failed - $!\n";
68 if (!process($ARGV, @rawlines)) { 168 } else {
69 $exit = 1; 169 open(FILE, "<$filename") ||
70 } 170 die "$P: $filename: open failed - $!\n";
71 @rawlines = ();
72 } 171 }
172 while (<FILE>) {
173 chomp;
174 push(@rawlines, $_);
175 }
176 close(FILE);
177 if (!process($filename, @rawlines)) {
178 $exit = 1;
179 }
180 @rawlines = ();
73} 181}
74 182
75exit($exit); 183exit($exit);
76 184
77sub top_of_kernel_tree { 185sub top_of_kernel_tree {
78 if ((-f "COPYING") && (-f "CREDITS") && (-f "Kbuild") && 186 my ($root) = @_;
79 (-f "MAINTAINERS") && (-f "Makefile") && (-f "README") && 187
80 (-d "Documentation") && (-d "arch") && (-d "include") && 188 my @tree_check = (
81 (-d "drivers") && (-d "fs") && (-d "init") && (-d "ipc") && 189 "COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile",
82 (-d "kernel") && (-d "lib") && (-d "scripts")) { 190 "README", "Documentation", "arch", "include", "drivers",
83 return 1; 191 "fs", "init", "ipc", "kernel", "lib", "scripts",
192 );
193
194 foreach my $check (@tree_check) {
195 if (! -e $root . '/' . $check) {
196 return 0;
197 }
84 } 198 }
85 return 0; 199 return 1;
86} 200}
87 201
88sub expand_tabs { 202sub expand_tabs {
@@ -105,6 +219,20 @@ sub expand_tabs {
105 219
106 return $res; 220 return $res;
107} 221}
222sub copy_spacing {
223 my ($str) = @_;
224
225 my $res = '';
226 for my $c (split(//, $str)) {
227 if ($c eq "\t") {
228 $res .= $c;
229 } else {
230 $res .= ' ';
231 }
232 }
233
234 return $res;
235}
108 236
109sub line_stats { 237sub line_stats {
110 my ($line) = @_; 238 my ($line) = @_;
@@ -260,47 +388,138 @@ sub ctx_has_comment {
260 return ($cmt ne ''); 388 return ($cmt ne '');
261} 389}
262 390
263sub ctx_expr_before { 391sub cat_vet {
264 my ($line) = @_; 392 my ($vet) = @_;
265 393 my ($res, $coded);
266 ##print "CHECK<$line>\n";
267
268 my $pos = length($line) - 1;
269 my $count = 0;
270 my $c;
271 394
272 for (; $pos >= 0; $pos--) { 395 $res = '';
273 $c = substr($line, $pos, 1); 396 while ($vet =~ /([^[:cntrl:]]*)([[:cntrl:]]|$)/g) {
274 ##print "CHECK: c<$c> count<$count>\n"; 397 $res .= $1;
275 if ($c eq ')') { 398 if ($2 ne '') {
276 $count++; 399 $coded = sprintf("^%c", unpack('C', $2) + 64);
277 } elsif ($c eq '(') { 400 $res .= $coded;
278 last if (--$count == 0);
279 } 401 }
280 } 402 }
403 $res =~ s/$/\$/;
281 404
282 ##print "CHECK: result<" . substr($line, 0, $pos) . ">\n"; 405 return $res;
283
284 return substr($line, 0, $pos);
285} 406}
286 407
287sub cat_vet { 408sub annotate_values {
288 my ($vet) = @_; 409 my ($stream, $type) = @_;
289 my ($res, $coded);
290 410
291 $res = ''; 411 my $res;
292 while ($vet =~ /([^[:cntrl:]]*)([[:cntrl:]])/g) { 412 my $cur = $stream;
293 $coded = sprintf("^%c", unpack('C', $2) + 64); 413
294 $res .= $1 . $coded; 414 my $debug = 0;
415
416 print "$stream\n" if ($debug);
417
418 ##my $type = 'N';
419 my $pos = 0;
420 my $preprocessor = 0;
421 my $paren = 0;
422 my @paren_type;
423
424 # Include any user defined types we may have found as we went.
425 my $type_match = "(?:$Type$Bare)";
426
427 while (length($cur)) {
428 print " <$type> " if ($debug);
429 if ($cur =~ /^(\s+)/o) {
430 print "WS($1)\n" if ($debug);
431 if ($1 =~ /\n/ && $preprocessor) {
432 $preprocessor = 0;
433 $type = 'N';
434 }
435
436 } elsif ($cur =~ /^($type_match)/) {
437 print "DECLARE($1)\n" if ($debug);
438 $type = 'T';
439
440 } elsif ($cur =~ /^(#\s*define\s*$Ident)(\(?)/o) {
441 print "DEFINE($1)\n" if ($debug);
442 $preprocessor = 1;
443 $paren_type[$paren] = 'N';
444
445 } elsif ($cur =~ /^(#\s*(?:ifdef|ifndef|if|else|endif))/o) {
446 print "PRE($1)\n" if ($debug);
447 $preprocessor = 1;
448 $type = 'N';
449
450 } elsif ($cur =~ /^(\\\n)/o) {
451 print "PRECONT($1)\n" if ($debug);
452
453 } elsif ($cur =~ /^(sizeof)\s*(\()?/o) {
454 print "SIZEOF($1)\n" if ($debug);
455 if (defined $2) {
456 $paren_type[$paren] = 'V';
457 }
458 $type = 'N';
459
460 } elsif ($cur =~ /^(if|while|typeof)\b/o) {
461 print "COND($1)\n" if ($debug);
462 $paren_type[$paren] = 'N';
463 $type = 'N';
464
465 } elsif ($cur =~/^(return|case|else)/o) {
466 print "KEYWORD($1)\n" if ($debug);
467 $type = 'N';
468
469 } elsif ($cur =~ /^(\()/o) {
470 print "PAREN('$1')\n" if ($debug);
471 $paren++;
472 $type = 'N';
473
474 } elsif ($cur =~ /^(\))/o) {
475 $paren-- if ($paren > 0);
476 if (defined $paren_type[$paren]) {
477 $type = $paren_type[$paren];
478 undef $paren_type[$paren];
479 print "PAREN('$1') -> $type\n" if ($debug);
480 } else {
481 print "PAREN('$1')\n" if ($debug);
482 }
483
484 } elsif ($cur =~ /^($Ident)\(/o) {
485 print "FUNC($1)\n" if ($debug);
486 $paren_type[$paren] = 'V';
487
488 } elsif ($cur =~ /^($Ident|$Constant)/o) {
489 print "IDENT($1)\n" if ($debug);
490 $type = 'V';
491
492 } elsif ($cur =~ /^($Assignment)/o) {
493 print "ASSIGN($1)\n" if ($debug);
494 $type = 'N';
495
496 } elsif ($cur =~ /^(;|{|}|\?|:|\[)/o) {
497 print "END($1)\n" if ($debug);
498 $type = 'N';
499
500 } elsif ($cur =~ /^($Operators)/o) {
501 print "OP($1)\n" if ($debug);
502 if ($1 ne '++' && $1 ne '--') {
503 $type = 'N';
504 }
505
506 } elsif ($cur =~ /(^.)/o) {
507 print "C($1)\n" if ($debug);
508 }
509 if (defined $1) {
510 $cur = substr($cur, length($1));
511 $res .= $type x length($1);
512 }
295 } 513 }
296 $res =~ s/$/\$/;
297 514
298 return $res; 515 return $res;
299} 516}
300 517
518my $prefix = '';
519
301my @report = (); 520my @report = ();
302sub report { 521sub report {
303 push(@report, $_[0]); 522 push(@report, $prefix . $_[0]);
304} 523}
305sub report_dump { 524sub report_dump {
306 @report; 525 @report;
@@ -308,14 +527,19 @@ sub report_dump {
308sub ERROR { 527sub ERROR {
309 report("ERROR: $_[0]\n"); 528 report("ERROR: $_[0]\n");
310 our $clean = 0; 529 our $clean = 0;
530 our $cnt_error++;
311} 531}
312sub WARN { 532sub WARN {
313 report("WARNING: $_[0]\n"); 533 report("WARNING: $_[0]\n");
314 our $clean = 0; 534 our $clean = 0;
535 our $cnt_warn++;
315} 536}
316sub CHK { 537sub CHK {
317 report("CHECK: $_[0]\n"); 538 if ($check) {
318 our $clean = 0; 539 report("CHECK: $_[0]\n");
540 our $clean = 0;
541 our $cnt_chk++;
542 }
319} 543}
320 544
321sub process { 545sub process {
@@ -335,6 +559,11 @@ sub process {
335 my $signoff = 0; 559 my $signoff = 0;
336 my $is_patch = 0; 560 my $is_patch = 0;
337 561
562 our $cnt_lines = 0;
563 our $cnt_error = 0;
564 our $cnt_warn = 0;
565 our $cnt_chk = 0;
566
338 # Trace the real file/line as we go. 567 # Trace the real file/line as we go.
339 my $realfile = ''; 568 my $realfile = '';
340 my $realline = 0; 569 my $realline = 0;
@@ -343,62 +572,10 @@ sub process {
343 my $in_comment = 0; 572 my $in_comment = 0;
344 my $first_line = 0; 573 my $first_line = 0;
345 574
346 my $Ident = qr{[A-Za-z\d_]+}; 575 my $prev_values = 'N';
347 my $Storage = qr{extern|static|asmlinkage};
348 my $Sparse = qr{
349 __user|
350 __kernel|
351 __force|
352 __iomem|
353 __must_check|
354 __init_refok|
355 fastcall
356 }x;
357 my $Inline = qr{inline|__always_inline|noinline};
358 my $NonptrType = qr{
359 \b
360 (?:const\s+)?
361 (?:unsigned\s+)?
362 (?:
363 void|
364 char|
365 short|
366 int|
367 long|
368 unsigned|
369 float|
370 double|
371 bool|
372 long\s+int|
373 long\s+long|
374 long\s+long\s+int|
375 u8|u16|u32|u64|
376 s8|s16|s32|s64|
377 struct\s+$Ident|
378 union\s+$Ident|
379 enum\s+$Ident|
380 ${Ident}_t
381 )
382 (?:\s+$Sparse)*
383 \b
384 }x;
385 my $Type = qr{
386 \b$NonptrType\b
387 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
388 (?:\s+$Sparse)*
389 }x;
390 my $Declare = qr{(?:$Storage\s+)?$Type};
391 my $Attribute = qr{
392 const|
393 __read_mostly|
394 __(?:mem|cpu|dev|)(?:initdata|init)
395 }x;
396 my $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
397 my $Lval = qr{$Ident(?:$Member)*};
398 576
399 # Possible bare types. 577 # Possible bare types.
400 my @bare = (); 578 my @bare = ();
401 my $Bare = $NonptrType;
402 579
403 # Pre-scan the patch looking for any __setup documentation. 580 # Pre-scan the patch looking for any __setup documentation.
404 my @setup_docs = (); 581 my @setup_docs = ();
@@ -417,11 +594,14 @@ sub process {
417 } 594 }
418 } 595 }
419 596
597 $prefix = '';
598
420 foreach my $line (@lines) { 599 foreach my $line (@lines) {
421 $linenr++; 600 $linenr++;
422 601
423 my $rawline = $line; 602 my $rawline = $line;
424 603
604
425#extract the filename as it passes 605#extract the filename as it passes
426 if ($line=~/^\+\+\+\s+(\S+)/) { 606 if ($line=~/^\+\+\+\s+(\S+)/) {
427 $realfile=$1; 607 $realfile=$1;
@@ -430,7 +610,7 @@ sub process {
430 next; 610 next;
431 } 611 }
432#extract the line range in the file after the patch is applied 612#extract the line range in the file after the patch is applied
433 if ($line=~/^\@\@ -\d+,\d+ \+(\d+)(,(\d+))? \@\@/) { 613 if ($line=~/^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
434 $is_patch = 1; 614 $is_patch = 1;
435 $first_line = $linenr + 1; 615 $first_line = $linenr + 1;
436 $in_comment = 0; 616 $in_comment = 0;
@@ -440,6 +620,7 @@ sub process {
440 } else { 620 } else {
441 $realcnt=1+1; 621 $realcnt=1+1;
442 } 622 }
623 $prev_values = 'N';
443 next; 624 next;
444 } 625 }
445 626
@@ -473,18 +654,24 @@ sub process {
473 # Track the previous line. 654 # Track the previous line.
474 ($prevline, $stashline) = ($stashline, $line); 655 ($prevline, $stashline) = ($stashline, $line);
475 ($previndent, $stashindent) = ($stashindent, $indent); 656 ($previndent, $stashindent) = ($stashindent, $indent);
657
476 } elsif ($realcnt == 1) { 658 } elsif ($realcnt == 1) {
477 $realcnt--; 659 $realcnt--;
478 } 660 }
479 661
480#make up the handle for any error we report on this line 662#make up the handle for any error we report on this line
481 $here = "#$linenr: "; 663 $here = "#$linenr: " if (!$file);
664 $here = "#$realline: " if ($file);
482 $here .= "FILE: $realfile:$realline:" if ($realcnt != 0); 665 $here .= "FILE: $realfile:$realline:" if ($realcnt != 0);
483 666
484 my $hereline = "$here\n$line\n"; 667 my $hereline = "$here\n$line\n";
485 my $herecurr = "$here\n$line\n"; 668 my $herecurr = "$here\n$line\n";
486 my $hereprev = "$here\n$prevline\n$line\n"; 669 my $hereprev = "$here\n$prevline\n$line\n";
487 670
671 $prefix = "$filename:$realline: " if ($emacs && $file);
672 $prefix = "$filename:$linenr: " if ($emacs && !$file);
673 $cnt_lines++ if ($realcnt != 0);
674
488#check the patch for a signoff: 675#check the patch for a signoff:
489 if ($line =~ /^\s*signed-off-by:/i) { 676 if ($line =~ /^\s*signed-off-by:/i) {
490 # This is a signoff, if ugly, so do not double report. 677 # This is a signoff, if ugly, so do not double report.
@@ -502,7 +689,7 @@ sub process {
502# Check for wrappage within a valid hunk of the file 689# Check for wrappage within a valid hunk of the file
503 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |$)}) { 690 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |$)}) {
504 ERROR("patch seems to be corrupt (line wrapped?)\n" . 691 ERROR("patch seems to be corrupt (line wrapped?)\n" .
505 $herecurr); 692 $herecurr) if (!$emitted_corrupt++);
506 } 693 }
507 694
508# UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php 695# UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
@@ -568,8 +755,12 @@ sub process {
568 $line !~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?$Type\b/ && 755 $line !~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?$Type\b/ &&
569 $line !~ /$Ident:\s*$/ && 756 $line !~ /$Ident:\s*$/ &&
570 $line !~ /^.\s*$Ident\s*\(/ && 757 $line !~ /^.\s*$Ident\s*\(/ &&
758 # definitions in global scope can only start with types
571 ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?($Ident)\b/ || 759 ($line =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?($Ident)\b/ ||
572 $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/)) { 760 # declarations always start with types
761 $line =~ /^.\s*(?:$Storage\s+)?($Ident)\b\s*\**\s*$Ident\s*(?:;|=)/) ||
762 # any (foo ... *) is a pointer cast, and foo is a type
763 $line =~ /\(($Ident)(?:\s+$Sparse)*\s*\*+\s*\)/) {
573 my $possible = $1; 764 my $possible = $1;
574 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ && 765 if ($possible !~ /^(?:$Storage|$Type|DEFINE_\S+)$/ &&
575 $possible ne 'goto' && $possible ne 'return' && 766 $possible ne 'goto' && $possible ne 'return' &&
@@ -579,7 +770,7 @@ sub process {
579 #print "POSSIBLE<$possible>\n"; 770 #print "POSSIBLE<$possible>\n";
580 push(@bare, $possible); 771 push(@bare, $possible);
581 my $bare = join("|", @bare); 772 my $bare = join("|", @bare);
582 $Bare = qr{ 773 $Bare = '|' . qr{
583 \b(?:$bare)\b 774 \b(?:$bare)\b
584 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)? 775 (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
585 (?:\s+$Sparse)* 776 (?:\s+$Sparse)*
@@ -641,6 +832,14 @@ sub process {
641 } 832 }
642 } 833 }
643 834
835 # Track the 'values' across context and added lines.
836 my $opline = $line; $opline =~ s/^./ /;
837 my $curr_values = annotate_values($opline . "\n", $prev_values);
838 $curr_values = $prev_values . $curr_values;
839 #warn "--> $opline\n";
840 #warn "--> $curr_values ($prev_values)\n";
841 $prev_values = substr($curr_values, -1);
842
644#ignore lines not being added 843#ignore lines not being added
645 if ($line=~/^[^\+]/) {next;} 844 if ($line=~/^[^\+]/) {next;}
646 845
@@ -678,6 +877,7 @@ sub process {
678 } 877 }
679 # Remove C99 comments. 878 # Remove C99 comments.
680 $line =~ s@//.*@@; 879 $line =~ s@//.*@@;
880 $opline =~ s@//.*@@;
681 881
682#EXPORT_SYMBOL should immediately follow its function closing }. 882#EXPORT_SYMBOL should immediately follow its function closing }.
683 if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) || 883 if (($line =~ /EXPORT_SYMBOL.*\((.*)\)/) ||
@@ -766,18 +966,13 @@ sub process {
766 } 966 }
767 967
768# check for spaces between functions and their parentheses. 968# check for spaces between functions and their parentheses.
769 if ($line =~ /($Ident)\s+\(/ && 969 while ($line =~ /($Ident)\s+\(/g) {
770 $1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/ && 970 if ($1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright|case)$/ &&
771 $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) { 971 $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) {
772 WARN("no space between function name and open parenthesis '('\n" . $herecurr); 972 WARN("no space between function name and open parenthesis '('\n" . $herecurr);
973 }
773 } 974 }
774# Check operator spacing. 975# Check operator spacing.
775 # Note we expand the line with the leading + as the real
776 # line will be displayed with the leading + and the tabs
777 # will therefore also expand that way.
778 my $opline = $line;
779 $opline = expand_tabs($opline);
780 $opline =~ s/^./ /;
781 if (!($line=~/\#\s*include/)) { 976 if (!($line=~/\#\s*include/)) {
782 my $ops = qr{ 977 my $ops = qr{
783 <<=|>>=|<=|>=|==|!=| 978 <<=|>>=|<=|>=|==|!=|
@@ -787,6 +982,9 @@ sub process {
787 }x; 982 }x;
788 my @elements = split(/($ops|;)/, $opline); 983 my @elements = split(/($ops|;)/, $opline);
789 my $off = 0; 984 my $off = 0;
985
986 my $blank = copy_spacing($opline);
987
790 for (my $n = 0; $n < $#elements; $n += 2) { 988 for (my $n = 0; $n < $#elements; $n += 2) {
791 $off += length($elements[$n]); 989 $off += length($elements[$n]);
792 990
@@ -822,62 +1020,24 @@ sub process {
822 1020
823 my $at = "(ctx:$ctx)"; 1021 my $at = "(ctx:$ctx)";
824 1022
825 my $ptr = (" " x $off) . "^"; 1023 my $ptr = substr($blank, 0, $off) . "^";
826 my $hereptr = "$hereline$ptr\n"; 1024 my $hereptr = "$hereline$ptr\n";
827 1025
828 # Classify operators into binary, unary, or 1026 # Classify operators into binary, unary, or
829 # definitions (* only) where they have more 1027 # definitions (* only) where they have more
830 # than one mode. 1028 # than one mode.
831 my $unary_ctx = $prevline . $ca; 1029 my $op_type = substr($curr_values, $off + 1, 1);
832 $unary_ctx =~ s/^./ /; 1030 my $op_left = substr($curr_values, $off, 1);
833 my $is_unary = 0; 1031 my $is_unary;
834 my $Unary = qr{ 1032 if ($op_type eq 'T') {
835 (?: 1033 $is_unary = 2;
836 ^|;|,|$ops|\(|\?|:| 1034 } elsif ($op_left eq 'V') {
837 \(\s*$Type\s*\)| 1035 $is_unary = 0;
838 $Type| 1036 } else {
839 return|case|else| 1037 $is_unary = 1;
840 \{|\}|
841 \[|
842 ^.\#\s*define\s+$Ident\s*(?:\([^\)]*\))?|
843 ^.\#\s*else|
844 ^.\#\s*endif|
845 ^.\#\s*(?:if|ifndef|ifdef)\b.*
846 )\s*(?:|\\)\s*$
847 }x;
848 my $UnaryFalse = qr{
849 sizeof\s*\(\s*$Type\s*\)\s*$
850 }x;
851 my $UnaryDefine = qr{
852 (?:$Type|$Bare)\s*|
853 (?:$Type|$Bare).*,\s*\**
854 }x;
855 if ($op eq '-' || $op eq '&' || $op eq '*') {
856 # An operator is binary if the left hand
857 # side is a value. Pick out the known
858 # non-values.
859 if ($unary_ctx =~ /$Unary$/s &&
860 $unary_ctx !~ /$UnaryFalse$/s) {
861 $is_unary = 1;
862
863 # Special handling for ')' check if this
864 # brace represents a conditional, if so
865 # we are unary.
866 } elsif ($unary_ctx =~ /\)\s*$/) {
867 my $before = ctx_expr_before($unary_ctx);
868 if ($before =~ /(?:for|if|while)\s*$/) {
869 $is_unary = 1;
870 }
871 }
872
873 # Check for type definition for of '*'.
874 if ($op eq '*' && $unary_ctx =~ /$UnaryDefine$/) {
875 $is_unary = 2;
876 }
877 } 1038 }
878
879 #if ($op eq '-' || $op eq '&' || $op eq '*') { 1039 #if ($op eq '-' || $op eq '&' || $op eq '*') {
880 # print "UNARY: <$is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n"; 1040 # print "UNARY: <$op_left$op_type $is_unary $a:$op:$c> <$ca:$op:$cc> <$unary_ctx>\n";
881 #} 1041 #}
882 1042
883 # ; should have either the end of line or a space or \ after it 1043 # ; should have either the end of line or a space or \ after it
@@ -952,7 +1112,7 @@ sub process {
952 1112
953# check for multiple assignments 1113# check for multiple assignments
954 if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) { 1114 if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
955 WARN("multiple assignments should be avoided\n" . $herecurr); 1115 CHK("multiple assignments should be avoided\n" . $herecurr);
956 } 1116 }
957 1117
958## # check for multiple declarations, allowing for a function declaration 1118## # check for multiple declarations, allowing for a function declaration
@@ -1012,7 +1172,7 @@ sub process {
1012 } 1172 }
1013 1173
1014# Check for illegal assignment in if conditional. 1174# Check for illegal assignment in if conditional.
1015 if ($line=~/\bif\s*\(.*[^<>!=]=[^=].*\)/) { 1175 if ($line=~/\bif\s*\(.*[^<>!=]=[^=]/) {
1016 #next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/); 1176 #next if ($line=~/\".*\Q$op\E.*\"/ or $line=~/\'\Q$op\E\'/);
1017 ERROR("do not use assignment in if condition\n" . $herecurr); 1177 ERROR("do not use assignment in if condition\n" . $herecurr);
1018 } 1178 }
@@ -1038,8 +1198,8 @@ sub process {
1038 1198
1039#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) 1199#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
1040 if ($tree && $rawline =~ m{^.\#\s*include\s*\<asm\/(.*)\.h\>}) { 1200 if ($tree && $rawline =~ m{^.\#\s*include\s*\<asm\/(.*)\.h\>}) {
1041 my $checkfile = "include/linux/$1.h"; 1201 my $checkfile = "$root/include/linux/$1.h";
1042 if (-f $checkfile) { 1202 if (-f $checkfile && $1 ne 'irq.h') {
1043 CHK("Use #include <linux/$1.h> instead of <asm/$1.h>\n" . 1203 CHK("Use #include <linux/$1.h> instead of <asm/$1.h>\n" .
1044 $herecurr); 1204 $herecurr);
1045 } 1205 }
@@ -1151,7 +1311,8 @@ sub process {
1151 } 1311 }
1152 1312
1153# no volatiles please 1313# no volatiles please
1154 if ($line =~ /\bvolatile\b/ && $line !~ /\basm\s+volatile\b/) { 1314 my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
1315 if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
1155 WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr); 1316 WARN("Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
1156 } 1317 }
1157 1318
@@ -1240,6 +1401,11 @@ sub process {
1240 1401
1241 if ($clean == 0 && ($chk_patch || $is_patch)) { 1402 if ($clean == 0 && ($chk_patch || $is_patch)) {
1242 print report_dump(); 1403 print report_dump();
1404 if ($quiet < 2) {
1405 print "total: $cnt_error errors, $cnt_warn warnings, " .
1406 (($check)? "$cnt_chk checks, " : "") .
1407 "$cnt_lines lines checked\n";
1408 }
1243 } 1409 }
1244 if ($clean == 1 && $quiet == 0) { 1410 if ($clean == 1 && $quiet == 0) {
1245 print "Your patch has no obvious style problems and is ready for submission.\n" 1411 print "Your patch has no obvious style problems and is ready for submission.\n"
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl
index c3b42f99df3b..d716b76098bb 100755
--- a/scripts/checkstack.pl
+++ b/scripts/checkstack.pl
@@ -16,7 +16,7 @@
16# PARISC port by Kyle McMartin <kyle@parisc-linux.org> 16# PARISC port by Kyle McMartin <kyle@parisc-linux.org>
17# 17#
18# Usage: 18# Usage:
19# objdump -d vmlinux | stackcheck.pl [arch] 19# objdump -d vmlinux | scripts/checkstack.pl [arch]
20# 20#
21# TODO : Port to all architectures (one regex per arch) 21# TODO : Port to all architectures (one regex per arch)
22 22
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index bb08069b04af..83c5e76414ce 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -84,7 +84,7 @@ help:
84# lxdialog stuff 84# lxdialog stuff
85check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh 85check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
86 86
87# Use reursively expanded variables so we do not call gcc unless 87# Use recursively expanded variables so we do not call gcc unless
88# we really need to do so. (Do not call gcc as part of make mrproper) 88# we really need to do so. (Do not call gcc as part of make mrproper)
89HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) 89HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
90HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 90HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 7bfa181d6ed6..f9d0d91a3fe4 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -235,23 +235,16 @@ void menu_finalize(struct menu *parent)
235 sym = parent->sym; 235 sym = parent->sym;
236 if (parent->list) { 236 if (parent->list) {
237 if (sym && sym_is_choice(sym)) { 237 if (sym && sym_is_choice(sym)) {
238 /* find out choice type */ 238 /* find the first choice value and find out choice type */
239 enum symbol_type type = S_UNKNOWN;
240
241 for (menu = parent->list; menu; menu = menu->next) { 239 for (menu = parent->list; menu; menu = menu->next) {
242 if (menu->sym && menu->sym->type != S_UNKNOWN) { 240 if (menu->sym) {
243 if (type == S_UNKNOWN) 241 current_entry = parent;
244 type = menu->sym->type; 242 menu_set_type(menu->sym->type);
245 if (type != S_BOOLEAN) 243 current_entry = menu;
246 break; 244 menu_set_type(sym->type);
247 if (menu->sym->type == S_TRISTATE) { 245 break;
248 type = S_TRISTATE;
249 break;
250 }
251 } 246 }
252 } 247 }
253 current_entry = parent;
254 menu_set_type(type);
255 parentdep = expr_alloc_symbol(sym); 248 parentdep = expr_alloc_symbol(sym);
256 } else if (parent->prompt) 249 } else if (parent->prompt)
257 parentdep = parent->prompt->visible.expr; 250 parentdep = parent->prompt->visible.expr;
@@ -260,16 +253,7 @@ void menu_finalize(struct menu *parent)
260 253
261 for (menu = parent->list; menu; menu = menu->next) { 254 for (menu = parent->list; menu; menu = menu->next) {
262 basedep = expr_transform(menu->dep); 255 basedep = expr_transform(menu->dep);
263 dep = parentdep; 256 basedep = expr_alloc_and(expr_copy(parentdep), basedep);
264 if (sym && sym_is_choice(sym) && menu->sym) {
265 enum symbol_type type = menu->sym->type;
266
267 if (type == S_UNKNOWN)
268 type = sym->type;
269 if (type != S_TRISTATE)
270 dep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
271 }
272 basedep = expr_alloc_and(expr_copy(dep), basedep);
273 basedep = expr_eliminate_dups(basedep); 257 basedep = expr_eliminate_dups(basedep);
274 menu->dep = basedep; 258 menu->dep = basedep;
275 if (menu->sym) 259 if (menu->sym)
@@ -342,8 +326,7 @@ void menu_finalize(struct menu *parent)
342 "values not supported"); 326 "values not supported");
343 } 327 }
344 current_entry = menu; 328 current_entry = menu;
345 if (menu->sym->type == S_UNKNOWN) 329 menu_set_type(sym->type);
346 menu_set_type(sym->type);
347 menu_add_symbol(P_CHOICE, sym, NULL); 330 menu_add_symbol(P_CHOICE, sym, NULL);
348 prop = sym_get_choice_prop(sym); 331 prop = sym_get_choice_prop(sym);
349 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr) 332 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index e4eeb59a8c24..b9bb32dfd628 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1274,8 +1274,12 @@ ConfigMainWindow::ConfigMainWindow(void)
1274 QMenuBar* menu; 1274 QMenuBar* menu;
1275 bool ok; 1275 bool ok;
1276 int x, y, width, height; 1276 int x, y, width, height;
1277 char title[256];
1277 1278
1278 QWidget *d = configApp->desktop(); 1279 QWidget *d = configApp->desktop();
1280 snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"),
1281 getenv("KERNELVERSION"));
1282 setCaption(title);
1279 1283
1280 width = configSettings->readNumEntry("/window width", d->width() - 64); 1284 width = configSettings->readNumEntry("/window width", d->width() - 64);
1281 height = configSettings->readNumEntry("/window height", d->height() - 64); 1285 height = configSettings->readNumEntry("/window height", d->height() - 64);
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2ef9a193fcae..93ac52adb498 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -268,6 +268,9 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
268 "was in %s%s\n", mod->name, name, 268 "was in %s%s\n", mod->name, name,
269 s->module->name, 269 s->module->name,
270 is_vmlinux(s->module->name) ?"":".ko"); 270 is_vmlinux(s->module->name) ?"":".ko");
271 } else {
272 /* In case Modules.symvers was out of date */
273 s->module = mod;
271 } 274 }
272 } 275 }
273 s->preloaded = 0; 276 s->preloaded = 0;
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 6edb29f2b4a6..0f657b5f3bc8 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -83,6 +83,7 @@ Maintainer: $name
83Standards-Version: 3.6.1 83Standards-Version: 3.6.1
84 84
85Package: $packagename 85Package: $packagename
86Provides: kernel-image-$version, linux-image-$version
86Architecture: any 87Architecture: any
87Description: User Mode Linux kernel, version $version 88Description: User Mode Linux kernel, version $version
88 User-mode Linux is a port of the Linux kernel to its own system call 89 User-mode Linux is a port of the Linux kernel to its own system call
@@ -104,6 +105,7 @@ Maintainer: $name
104Standards-Version: 3.6.1 105Standards-Version: 3.6.1
105 106
106Package: $packagename 107Package: $packagename
108Provides: kernel-image-$version, linux-image-$version
107Architecture: any 109Architecture: any
108Description: Linux kernel, version $version 110Description: Linux kernel, version $version
109 This package contains the Linux kernel, modules and corresponding other 111 This package contains the Linux kernel, modules and corresponding other
diff --git a/security/commoncap.c b/security/commoncap.c
index 778cb0cfc5d8..43f902750a1b 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -23,6 +23,26 @@
23#include <linux/xattr.h> 23#include <linux/xattr.h>
24#include <linux/hugetlb.h> 24#include <linux/hugetlb.h>
25#include <linux/mount.h> 25#include <linux/mount.h>
26#include <linux/sched.h>
27
28#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
29/*
30 * Because of the reduced scope of CAP_SETPCAP when filesystem
31 * capabilities are in effect, it is safe to allow this capability to
32 * be available in the default configuration.
33 */
34# define CAP_INIT_BSET CAP_FULL_SET
35#else /* ie. ndef CONFIG_SECURITY_FILE_CAPABILITIES */
36# define CAP_INIT_BSET CAP_INIT_EFF_SET
37#endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */
38
39kernel_cap_t cap_bset = CAP_INIT_BSET; /* systemwide capability bound */
40EXPORT_SYMBOL(cap_bset);
41
42/* Global security state */
43
44unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */
45EXPORT_SYMBOL(securebits);
26 46
27int cap_netlink_send(struct sock *sk, struct sk_buff *skb) 47int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
28{ 48{
@@ -73,14 +93,44 @@ int cap_capget (struct task_struct *target, kernel_cap_t *effective,
73 return 0; 93 return 0;
74} 94}
75 95
96#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
97
98static inline int cap_block_setpcap(struct task_struct *target)
99{
100 /*
101 * No support for remote process capability manipulation with
102 * filesystem capability support.
103 */
104 return (target != current);
105}
106
107static inline int cap_inh_is_capped(void)
108{
109 /*
110 * return 1 if changes to the inheritable set are limited
111 * to the old permitted set.
112 */
113 return !cap_capable(current, CAP_SETPCAP);
114}
115
116#else /* ie., ndef CONFIG_SECURITY_FILE_CAPABILITIES */
117
118static inline int cap_block_setpcap(struct task_struct *t) { return 0; }
119static inline int cap_inh_is_capped(void) { return 1; }
120
121#endif /* def CONFIG_SECURITY_FILE_CAPABILITIES */
122
76int cap_capset_check (struct task_struct *target, kernel_cap_t *effective, 123int cap_capset_check (struct task_struct *target, kernel_cap_t *effective,
77 kernel_cap_t *inheritable, kernel_cap_t *permitted) 124 kernel_cap_t *inheritable, kernel_cap_t *permitted)
78{ 125{
79 /* Derived from kernel/capability.c:sys_capset. */ 126 if (cap_block_setpcap(target)) {
80 /* verify restrictions on target's new Inheritable set */ 127 return -EPERM;
81 if (!cap_issubset (*inheritable, 128 }
82 cap_combine (target->cap_inheritable, 129 if (cap_inh_is_capped()
83 current->cap_permitted))) { 130 && !cap_issubset(*inheritable,
131 cap_combine(target->cap_inheritable,
132 current->cap_permitted))) {
133 /* incapable of using this inheritable set */
84 return -EPERM; 134 return -EPERM;
85 } 135 }
86 136
@@ -285,7 +335,7 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
285 /* For init, we want to retain the capabilities set 335 /* For init, we want to retain the capabilities set
286 * in the init_task struct. Thus we skip the usual 336 * in the init_task struct. Thus we skip the usual
287 * capability rules */ 337 * capability rules */
288 if (!is_init(current)) { 338 if (!is_global_init(current)) {
289 current->cap_permitted = new_permitted; 339 current->cap_permitted = new_permitted;
290 current->cap_effective = bprm->cap_effective ? 340 current->cap_effective = bprm->cap_effective ?
291 new_permitted : 0; 341 new_permitted : 0;
diff --git a/security/dummy.c b/security/dummy.c
index bc43d4c7383e..6d895ade73de 100644
--- a/security/dummy.c
+++ b/security/dummy.c
@@ -37,15 +37,13 @@ static int dummy_capget (struct task_struct *target, kernel_cap_t * effective,
37 kernel_cap_t * inheritable, kernel_cap_t * permitted) 37 kernel_cap_t * inheritable, kernel_cap_t * permitted)
38{ 38{
39 *effective = *inheritable = *permitted = 0; 39 *effective = *inheritable = *permitted = 0;
40 if (!issecure(SECURE_NOROOT)) { 40 if (target->euid == 0) {
41 if (target->euid == 0) { 41 *permitted |= (~0 & ~CAP_FS_MASK);
42 *permitted |= (~0 & ~CAP_FS_MASK); 42 *effective |= (~0 & ~CAP_TO_MASK(CAP_SETPCAP) & ~CAP_FS_MASK);
43 *effective |= (~0 & ~CAP_TO_MASK(CAP_SETPCAP) & ~CAP_FS_MASK); 43 }
44 } 44 if (target->fsuid == 0) {
45 if (target->fsuid == 0) { 45 *permitted |= CAP_FS_MASK;
46 *permitted |= CAP_FS_MASK; 46 *effective |= CAP_FS_MASK;
47 *effective |= CAP_FS_MASK;
48 }
49 } 47 }
50 return 0; 48 return 0;
51} 49}
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index cb008d9f0a82..36a191e7004e 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -448,7 +448,7 @@ int selinux_xfrm_postroute_last(u32 isec_sid, struct sk_buff *skb,
448 if (dst) { 448 if (dst) {
449 struct dst_entry *dst_test; 449 struct dst_entry *dst_test;
450 450
451 for (dst_test = dst; dst_test != 0; 451 for (dst_test = dst; dst_test != NULL;
452 dst_test = dst_test->child) { 452 dst_test = dst_test->child) {
453 struct xfrm_state *x = dst_test->xfrm; 453 struct xfrm_state *x = dst_test->xfrm;
454 454
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index b9eca9f3dd25..3b73ba7d03e8 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -209,7 +209,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
209 void *ptr; 209 void *ptr;
210 210
211 if (!aacirun->substream || !aacirun->start) { 211 if (!aacirun->substream || !aacirun->start) {
212 dev_warn(&aaci->dev->dev, "RX interrupt???"); 212 dev_warn(&aaci->dev->dev, "RX interrupt???\n");
213 writel(0, aacirun->base + AACI_IE); 213 writel(0, aacirun->base + AACI_IE);
214 return; 214 return;
215 } 215 }
@@ -263,7 +263,7 @@ static void aaci_fifo_irq(struct aaci *aaci, int channel, u32 mask)
263 void *ptr; 263 void *ptr;
264 264
265 if (!aacirun->substream || !aacirun->start) { 265 if (!aacirun->substream || !aacirun->start) {
266 dev_warn(&aaci->dev->dev, "TX interrupt???"); 266 dev_warn(&aaci->dev->dev, "TX interrupt???\n");
267 writel(0, aacirun->base + AACI_IE); 267 writel(0, aacirun->base + AACI_IE);
268 return; 268 return;
269 } 269 }
diff --git a/sound/core/seq/seq_midi_emul.c b/sound/core/seq/seq_midi_emul.c
index d7c4fb86b9eb..17b3e6f13ca3 100644
--- a/sound/core/seq/seq_midi_emul.c
+++ b/sound/core/seq/seq_midi_emul.c
@@ -71,7 +71,7 @@ static void reset_all_channels(struct snd_midi_channel_set *chset);
71 * such as GM, GS and XG. 71 * such as GM, GS and XG.
72 * There modes that this module will run in are: 72 * There modes that this module will run in are:
73 * Generic MIDI - no interpretation at all, it will just save current values 73 * Generic MIDI - no interpretation at all, it will just save current values
74 * of controlers etc. 74 * of controllers etc.
75 * GM - You can use all gm_ prefixed elements of chan. Controls, RPN, NRPN, 75 * GM - You can use all gm_ prefixed elements of chan. Controls, RPN, NRPN,
76 * SysEx will be interpreded as defined in General Midi. 76 * SysEx will be interpreded as defined in General Midi.
77 * GS - You can use all gs_ prefixed elements of chan. Codes for GS will be 77 * GS - You can use all gs_ prefixed elements of chan. Codes for GS will be
@@ -176,7 +176,7 @@ snd_midi_process_event(struct snd_midi_op *ops,
176 ev->data.control.value); 176 ev->data.control.value);
177 break; 177 break;
178 case SNDRV_SEQ_EVENT_NONREGPARAM: 178 case SNDRV_SEQ_EVENT_NONREGPARAM:
179 /* Break it back into its controler values */ 179 /* Break it back into its controller values */
180 chan->param_type = SNDRV_MIDI_PARAM_TYPE_NONREGISTERED; 180 chan->param_type = SNDRV_MIDI_PARAM_TYPE_NONREGISTERED;
181 chan->control[MIDI_CTL_MSB_DATA_ENTRY] 181 chan->control[MIDI_CTL_MSB_DATA_ENTRY]
182 = (ev->data.control.value >> 7) & 0x7f; 182 = (ev->data.control.value >> 7) & 0x7f;
@@ -189,7 +189,7 @@ snd_midi_process_event(struct snd_midi_op *ops,
189 nrpn(ops, drv, chan, chanset); 189 nrpn(ops, drv, chan, chanset);
190 break; 190 break;
191 case SNDRV_SEQ_EVENT_REGPARAM: 191 case SNDRV_SEQ_EVENT_REGPARAM:
192 /* Break it back into its controler values */ 192 /* Break it back into its controller values */
193 chan->param_type = SNDRV_MIDI_PARAM_TYPE_REGISTERED; 193 chan->param_type = SNDRV_MIDI_PARAM_TYPE_REGISTERED;
194 chan->control[MIDI_CTL_MSB_DATA_ENTRY] 194 chan->control[MIDI_CTL_MSB_DATA_ENTRY]
195 = (ev->data.control.value >> 7) & 0x7f; 195 = (ev->data.control.value >> 7) & 0x7f;
@@ -267,7 +267,7 @@ note_off(struct snd_midi_op *ops, void *drv, struct snd_midi_channel *chan,
267} 267}
268 268
269/* 269/*
270 * Do all driver independent operations for this controler and pass 270 * Do all driver independent operations for this controller and pass
271 * events that need to take place immediately to the driver. 271 * events that need to take place immediately to the driver.
272 */ 272 */
273static void 273static void
diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c
index 1b6f227af370..3557b6e20eb5 100644
--- a/sound/drivers/opl3/opl3_midi.c
+++ b/sound/drivers/opl3/opl3_midi.c
@@ -808,7 +808,7 @@ static void snd_opl3_pitch_ctrl(struct snd_opl3 *opl3, struct snd_midi_channel *
808} 808}
809 809
810/* 810/*
811 * Deal with a controler type event. This includes all types of 811 * Deal with a controller type event. This includes all types of
812 * control events, not just the midi controllers 812 * control events, not just the midi controllers
813 */ 813 */
814void snd_opl3_control(void *p, int type, struct snd_midi_channel *chan) 814void snd_opl3_control(void *p, int type, struct snd_midi_channel *chan)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 4a7367a8ff9d..c1af28fd4a1f 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -623,7 +623,7 @@ static int snd_es18xx_capture_prepare(struct snd_pcm_substream *substream)
623 (snd_pcm_format_width(runtime->format) == 16 ? 0x04 : 0x00) | 623 (snd_pcm_format_width(runtime->format) == 16 ? 0x04 : 0x00) |
624 (snd_pcm_format_unsigned(runtime->format) ? 0x00 : 0x20)); 624 (snd_pcm_format_unsigned(runtime->format) ? 0x00 : 0x20));
625 625
626 /* Set DMA controler */ 626 /* Set DMA controller */
627 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); 627 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
628 628
629 return 0; 629 return 0;
@@ -689,7 +689,7 @@ static int snd_es18xx_playback2_prepare(struct snd_es18xx *chip,
689 (snd_pcm_format_width(runtime->format) == 16 ? 0x04 : 0x00) | 689 (snd_pcm_format_width(runtime->format) == 16 ? 0x04 : 0x00) |
690 (snd_pcm_format_unsigned(runtime->format) ? 0x00 : 0x20)); 690 (snd_pcm_format_unsigned(runtime->format) ? 0x00 : 0x20));
691 691
692 /* Set DMA controler */ 692 /* Set DMA controller */
693 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); 693 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
694 694
695 return 0; 695 return 0;
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index 8a61a1191861..24460a558bf7 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -498,8 +498,8 @@ snd_au1000_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
498 int i; 498 int i;
499 499
500 spin_lock(&au1000->ac97_lock); 500 spin_lock(&au1000->ac97_lock);
501/* would rather use the interupt than this polling but it works and I can't 501/* would rather use the interrupt than this polling but it works and I can't
502get the interupt driven case to work efficiently */ 502get the interrupt driven case to work efficiently */
503 for (i = 0; i < 0x5000; i++) 503 for (i = 0; i < 0x5000; i++)
504 if (!(au1000->ac97_ioport->status & AC97C_CP)) 504 if (!(au1000->ac97_ioport->status & AC97C_CP))
505 break; 505 break;
@@ -535,8 +535,8 @@ snd_au1000_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short
535 int i; 535 int i;
536 536
537 spin_lock(&au1000->ac97_lock); 537 spin_lock(&au1000->ac97_lock);
538/* would rather use the interupt than this polling but it works and I can't 538/* would rather use the interrupt than this polling but it works and I can't
539get the interupt driven case to work efficiently */ 539get the interrupt driven case to work efficiently */
540 for (i = 0; i < 0x5000; i++) 540 for (i = 0; i < 0x5000; i++)
541 if (!(au1000->ac97_ioport->status & AC97C_CP)) 541 if (!(au1000->ac97_ioport->status & AC97C_CP))
542 break; 542 break;
diff --git a/sound/oss/Makefile b/sound/oss/Makefile
index 1200670017bd..f883c4b676ab 100644
--- a/sound/oss/Makefile
+++ b/sound/oss/Makefile
@@ -36,7 +36,6 @@ obj-$(CONFIG_SOUND_MSNDCLAS) += msnd.o msnd_classic.o
36obj-$(CONFIG_SOUND_MSNDPIN) += msnd.o msnd_pinnacle.o 36obj-$(CONFIG_SOUND_MSNDPIN) += msnd.o msnd_pinnacle.o
37obj-$(CONFIG_SOUND_VWSND) += vwsnd.o 37obj-$(CONFIG_SOUND_VWSND) += vwsnd.o
38obj-$(CONFIG_SOUND_ICH) += i810_audio.o ac97_codec.o 38obj-$(CONFIG_SOUND_ICH) += i810_audio.o ac97_codec.o
39obj-$(CONFIG_SOUND_ES1371) += es1371.o ac97_codec.o
40obj-$(CONFIG_SOUND_AU1550_AC97) += au1550_ac97.o ac97_codec.o 39obj-$(CONFIG_SOUND_AU1550_AC97) += au1550_ac97.o ac97_codec.o
41obj-$(CONFIG_SOUND_TRIDENT) += trident.o ac97_codec.o 40obj-$(CONFIG_SOUND_TRIDENT) += trident.o ac97_codec.o
42obj-$(CONFIG_SOUND_BCM_CS4297A) += swarm_cs4297a.o 41obj-$(CONFIG_SOUND_BCM_CS4297A) += swarm_cs4297a.o
diff --git a/sound/oss/dmasound/Makefile b/sound/oss/dmasound/Makefile
index 4611636b1a81..3c1531652d11 100644
--- a/sound/oss/dmasound/Makefile
+++ b/sound/oss/dmasound/Makefile
@@ -2,12 +2,6 @@
2# Makefile for the DMA sound driver 2# Makefile for the DMA sound driver
3# 3#
4 4
5dmasound_pmac-y += dmasound_awacs.o \
6 trans_16.o dac3550a.o tas_common.o \
7 tas3001c.o tas3001c_tables.o \
8 tas3004.o tas3004_tables.o
9
10obj-$(CONFIG_DMASOUND_ATARI) += dmasound_core.o dmasound_atari.o 5obj-$(CONFIG_DMASOUND_ATARI) += dmasound_core.o dmasound_atari.o
11obj-$(CONFIG_DMASOUND_PMAC) += dmasound_core.o dmasound_pmac.o
12obj-$(CONFIG_DMASOUND_PAULA) += dmasound_core.o dmasound_paula.o 6obj-$(CONFIG_DMASOUND_PAULA) += dmasound_core.o dmasound_paula.o
13obj-$(CONFIG_DMASOUND_Q40) += dmasound_core.o dmasound_q40.o 7obj-$(CONFIG_DMASOUND_Q40) += dmasound_core.o dmasound_q40.o
diff --git a/sound/oss/dmasound/awacs_defs.h b/sound/oss/dmasound/awacs_defs.h
deleted file mode 100644
index 2194f46b046c..000000000000
--- a/sound/oss/dmasound/awacs_defs.h
+++ /dev/null
@@ -1,251 +0,0 @@
1/*********************************************************/
2/* This file was written by someone, somewhere, sometime */
3/* And is released into the Public Domain */
4/*********************************************************/
5
6#ifndef _AWACS_DEFS_H_
7#define _AWACS_DEFS_H_
8
9/*******************************/
10/* AWACs Audio Register Layout */
11/*******************************/
12
13struct awacs_regs {
14 unsigned control; /* Audio control register */
15 unsigned pad0[3];
16 unsigned codec_ctrl; /* Codec control register */
17 unsigned pad1[3];
18 unsigned codec_stat; /* Codec status register */
19 unsigned pad2[3];
20 unsigned clip_count; /* Clipping count register */
21 unsigned pad3[3];
22 unsigned byteswap; /* Data is little-endian if 1 */
23};
24
25/*******************/
26/* Audio Bit Masks */
27/*******************/
28
29/* Audio Control Reg Bit Masks */
30/* ----- ------- --- --- ----- */
31#define MASK_ISFSEL (0xf) /* Input SubFrame Select */
32#define MASK_OSFSEL (0xf << 4) /* Output SubFrame Select */
33#define MASK_RATE (0x7 << 8) /* Sound Rate */
34#define MASK_CNTLERR (0x1 << 11) /* Error */
35#define MASK_PORTCHG (0x1 << 12) /* Port Change */
36#define MASK_IEE (0x1 << 13) /* Enable Interrupt on Error */
37#define MASK_IEPC (0x1 << 14) /* Enable Interrupt on Port Change */
38#define MASK_SSFSEL (0x3 << 15) /* Status SubFrame Select */
39
40/* Audio Codec Control Reg Bit Masks */
41/* ----- ----- ------- --- --- ----- */
42#define MASK_NEWECMD (0x1 << 24) /* Lock: don't write to reg when 1 */
43#define MASK_EMODESEL (0x3 << 22) /* Send info out on which frame? */
44#define MASK_EXMODEADDR (0x3ff << 12) /* Extended Mode Address -- 10 bits */
45#define MASK_EXMODEDATA (0xfff) /* Extended Mode Data -- 12 bits */
46
47/* Audio Codec Control Address Values / Masks */
48/* ----- ----- ------- ------- ------ - ----- */
49#define MASK_ADDR0 (0x0 << 12) /* Expanded Data Mode Address 0 */
50#define MASK_ADDR_MUX MASK_ADDR0 /* Mux Control */
51#define MASK_ADDR_GAIN MASK_ADDR0
52
53#define MASK_ADDR1 (0x1 << 12) /* Expanded Data Mode Address 1 */
54#define MASK_ADDR_MUTE MASK_ADDR1
55#define MASK_ADDR_RATE MASK_ADDR1
56
57#define MASK_ADDR2 (0x2 << 12) /* Expanded Data Mode Address 2 */
58#define MASK_ADDR_VOLA MASK_ADDR2 /* Volume Control A -- Headphones */
59#define MASK_ADDR_VOLHD MASK_ADDR2
60
61#define MASK_ADDR4 (0x4 << 12) /* Expanded Data Mode Address 4 */
62#define MASK_ADDR_VOLC MASK_ADDR4 /* Volume Control C -- Speaker */
63#define MASK_ADDR_VOLSPK MASK_ADDR4
64
65/* additional registers of screamer */
66#define MASK_ADDR5 (0x5 << 12) /* Expanded Data Mode Address 5 */
67#define MASK_ADDR6 (0x6 << 12) /* Expanded Data Mode Address 6 */
68#define MASK_ADDR7 (0x7 << 12) /* Expanded Data Mode Address 7 */
69
70/* Address 0 Bit Masks & Macros */
71/* ------- - --- ----- - ------ */
72#define MASK_GAINRIGHT (0xf) /* Gain Right Mask */
73#define MASK_GAINLEFT (0xf << 4) /* Gain Left Mask */
74#define MASK_GAINLINE (0x1 << 8) /* Disable Mic preamp */
75#define MASK_GAINMIC (0x0 << 8) /* Enable Mic preamp */
76
77#define MASK_MUX_CD (0x1 << 9) /* Select CD in MUX */
78#define MASK_MUX_MIC (0x1 << 10) /* Select Mic in MUX */
79#define MASK_MUX_AUDIN (0x1 << 11) /* Select Audio In in MUX */
80#define MASK_MUX_LINE MASK_MUX_AUDIN
81
82#define GAINRIGHT(x) ((x) & MASK_GAINRIGHT)
83#define GAINLEFT(x) (((x) << 4) & MASK_GAINLEFT)
84
85#define DEF_CD_GAIN 0x00bb
86#define DEF_MIC_GAIN 0x00cc
87
88/* Address 1 Bit Masks */
89/* ------- - --- ----- */
90#define MASK_ADDR1RES1 (0x3) /* Reserved */
91#define MASK_RECALIBRATE (0x1 << 2) /* Recalibrate */
92#define MASK_SAMPLERATE (0x7 << 3) /* Sample Rate: */
93#define MASK_LOOPTHRU (0x1 << 6) /* Loopthrough Enable */
94#define MASK_CMUTE (0x1 << 7) /* Output C (Speaker) Mute when 1 */
95#define MASK_SPKMUTE MASK_CMUTE
96#define MASK_ADDR1RES2 (0x1 << 8) /* Reserved */
97#define MASK_AMUTE (0x1 << 9) /* Output A (Headphone) Mute when 1 */
98#define MASK_HDMUTE MASK_AMUTE
99#define MASK_PAROUT0 (0x1 << 10) /* Parallel Output 0 */
100#define MASK_PAROUT1 (0x2 << 10) /* Parallel Output 1 */
101
102#define MASK_MIC_BOOST (0x4) /* screamer mic boost */
103
104#define SAMPLERATE_48000 (0x0 << 3) /* 48 or 44.1 kHz */
105#define SAMPLERATE_32000 (0x1 << 3) /* 32 or 29.4 kHz */
106#define SAMPLERATE_24000 (0x2 << 3) /* 24 or 22.05 kHz */
107#define SAMPLERATE_19200 (0x3 << 3) /* 19.2 or 17.64 kHz */
108#define SAMPLERATE_16000 (0x4 << 3) /* 16 or 14.7 kHz */
109#define SAMPLERATE_12000 (0x5 << 3) /* 12 or 11.025 kHz */
110#define SAMPLERATE_9600 (0x6 << 3) /* 9.6 or 8.82 kHz */
111#define SAMPLERATE_8000 (0x7 << 3) /* 8 or 7.35 kHz */
112
113/* Address 2 & 4 Bit Masks & Macros */
114/* ------- - - - --- ----- - ------ */
115#define MASK_OUTVOLRIGHT (0xf) /* Output Right Volume */
116#define MASK_ADDR2RES1 (0x2 << 4) /* Reserved */
117#define MASK_ADDR4RES1 MASK_ADDR2RES1
118#define MASK_OUTVOLLEFT (0xf << 6) /* Output Left Volume */
119#define MASK_ADDR2RES2 (0x2 << 10) /* Reserved */
120#define MASK_ADDR4RES2 MASK_ADDR2RES2
121
122#define VOLRIGHT(x) (((~(x)) & MASK_OUTVOLRIGHT))
123#define VOLLEFT(x) (((~(x)) << 6) & MASK_OUTVOLLEFT)
124
125/* Audio Codec Status Reg Bit Masks */
126/* ----- ----- ------ --- --- ----- */
127#define MASK_EXTEND (0x1 << 23) /* Extend */
128#define MASK_VALID (0x1 << 22) /* Valid Data? */
129#define MASK_OFLEFT (0x1 << 21) /* Overflow Left */
130#define MASK_OFRIGHT (0x1 << 20) /* Overflow Right */
131#define MASK_ERRCODE (0xf << 16) /* Error Code */
132#define MASK_REVISION (0xf << 12) /* Revision Number */
133#define MASK_MFGID (0xf << 8) /* Mfg. ID */
134#define MASK_CODSTATRES (0xf << 4) /* bits 4 - 7 reserved */
135#define MASK_INPPORT (0xf) /* Input Port */
136#define MASK_HDPCONN 8 /* headphone plugged in */
137
138/* Clipping Count Reg Bit Masks */
139/* -------- ----- --- --- ----- */
140#define MASK_CLIPLEFT (0xff << 7) /* Clipping Count, Left Channel */
141#define MASK_CLIPRIGHT (0xff) /* Clipping Count, Right Channel */
142
143/* DBDMA ChannelStatus Bit Masks */
144/* ----- ------------- --- ----- */
145#define MASK_CSERR (0x1 << 7) /* Error */
146#define MASK_EOI (0x1 << 6) /* End of Input -- only for Input Channel */
147#define MASK_CSUNUSED (0x1f << 1) /* bits 1-5 not used */
148#define MASK_WAIT (0x1) /* Wait */
149
150/* Various Rates */
151/* ------- ----- */
152#define RATE_48000 (0x0 << 8) /* 48 kHz */
153#define RATE_44100 (0x0 << 8) /* 44.1 kHz */
154#define RATE_32000 (0x1 << 8) /* 32 kHz */
155#define RATE_29400 (0x1 << 8) /* 29.4 kHz */
156#define RATE_24000 (0x2 << 8) /* 24 kHz */
157#define RATE_22050 (0x2 << 8) /* 22.05 kHz */
158#define RATE_19200 (0x3 << 8) /* 19.2 kHz */
159#define RATE_17640 (0x3 << 8) /* 17.64 kHz */
160#define RATE_16000 (0x4 << 8) /* 16 kHz */
161#define RATE_14700 (0x4 << 8) /* 14.7 kHz */
162#define RATE_12000 (0x5 << 8) /* 12 kHz */
163#define RATE_11025 (0x5 << 8) /* 11.025 kHz */
164#define RATE_9600 (0x6 << 8) /* 9.6 kHz */
165#define RATE_8820 (0x6 << 8) /* 8.82 kHz */
166#define RATE_8000 (0x7 << 8) /* 8 kHz */
167#define RATE_7350 (0x7 << 8) /* 7.35 kHz */
168
169#define RATE_LOW 1 /* HIGH = 48kHz, etc; LOW = 44.1kHz, etc. */
170
171/*******************/
172/* Burgundy values */
173/*******************/
174
175#define MASK_ADDR_BURGUNDY_INPSEL21 (0x11 << 12)
176#define MASK_ADDR_BURGUNDY_INPSEL3 (0x12 << 12)
177
178#define MASK_ADDR_BURGUNDY_GAINCH1 (0x13 << 12)
179#define MASK_ADDR_BURGUNDY_GAINCH2 (0x14 << 12)
180#define MASK_ADDR_BURGUNDY_GAINCH3 (0x15 << 12)
181#define MASK_ADDR_BURGUNDY_GAINCH4 (0x16 << 12)
182
183#define MASK_ADDR_BURGUNDY_VOLCH1 (0x20 << 12)
184#define MASK_ADDR_BURGUNDY_VOLCH2 (0x21 << 12)
185#define MASK_ADDR_BURGUNDY_VOLCH3 (0x22 << 12)
186#define MASK_ADDR_BURGUNDY_VOLCH4 (0x23 << 12)
187
188#define MASK_ADDR_BURGUNDY_OUTPUTSELECTS (0x2B << 12)
189#define MASK_ADDR_BURGUNDY_OUTPUTENABLES (0x2F << 12)
190
191#define MASK_ADDR_BURGUNDY_MASTER_VOLUME (0x30 << 12)
192
193#define MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES (0x60 << 12)
194
195#define MASK_ADDR_BURGUNDY_ATTENSPEAKER (0x62 << 12)
196#define MASK_ADDR_BURGUNDY_ATTENLINEOUT (0x63 << 12)
197#define MASK_ADDR_BURGUNDY_ATTENHP (0x64 << 12)
198
199#define MASK_ADDR_BURGUNDY_VOLCD (MASK_ADDR_BURGUNDY_VOLCH1)
200#define MASK_ADDR_BURGUNDY_VOLLINE (MASK_ADDR_BURGUNDY_VOLCH2)
201#define MASK_ADDR_BURGUNDY_VOLMIC (MASK_ADDR_BURGUNDY_VOLCH3)
202#define MASK_ADDR_BURGUNDY_VOLMODEM (MASK_ADDR_BURGUNDY_VOLCH4)
203
204#define MASK_ADDR_BURGUNDY_GAINCD (MASK_ADDR_BURGUNDY_GAINCH1)
205#define MASK_ADDR_BURGUNDY_GAINLINE (MASK_ADDR_BURGUNDY_GAINCH2)
206#define MASK_ADDR_BURGUNDY_GAINMIC (MASK_ADDR_BURGUNDY_GAINCH3)
207#define MASK_ADDR_BURGUNDY_GAINMODEM (MASK_ADDR_BURGUNDY_VOLCH4)
208
209
210/* These are all default values for the burgundy */
211#define DEF_BURGUNDY_INPSEL21 (0xAA)
212#define DEF_BURGUNDY_INPSEL3 (0x0A)
213
214#define DEF_BURGUNDY_GAINCD (0x33)
215#define DEF_BURGUNDY_GAINLINE (0x44)
216#define DEF_BURGUNDY_GAINMIC (0x44)
217#define DEF_BURGUNDY_GAINMODEM (0x06)
218
219/* Remember: lowest volume here is 0x9b */
220#define DEF_BURGUNDY_VOLCD (0xCCCCCCCC)
221#define DEF_BURGUNDY_VOLLINE (0x00000000)
222#define DEF_BURGUNDY_VOLMIC (0x00000000)
223#define DEF_BURGUNDY_VOLMODEM (0xCCCCCCCC)
224
225#define DEF_BURGUNDY_OUTPUTSELECTS (0x010f010f)
226#define DEF_BURGUNDY_OUTPUTENABLES (0x0A)
227
228#define DEF_BURGUNDY_MASTER_VOLUME (0xFFFFFFFF)
229
230#define DEF_BURGUNDY_MORE_OUTPUTENABLES (0x7E)
231
232#define DEF_BURGUNDY_ATTENSPEAKER (0x44)
233#define DEF_BURGUNDY_ATTENLINEOUT (0xCC)
234#define DEF_BURGUNDY_ATTENHP (0xCC)
235
236/*********************/
237/* i2s layout values */
238/*********************/
239
240#define I2S_REG_INT_CTL 0x00
241#define I2S_REG_SERIAL_FORMAT 0x10
242#define I2S_REG_CODEC_MSG_OUT 0x20
243#define I2S_REG_CODEC_MSG_IN 0x30
244#define I2S_REG_FRAME_COUNT 0x40
245#define I2S_REG_FRAME_MATCH 0x50
246#define I2S_REG_DATAWORD_SIZES 0x60
247#define I2S_REG_PEAKLEVEL_SEL 0x70
248#define I2S_REG_PEAKLEVEL_IN0 0x80
249#define I2S_REG_PEAKLEVEL_IN1 0x90
250
251#endif /* _AWACS_DEFS_H_ */
diff --git a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c
deleted file mode 100644
index 0f0d03a55dab..000000000000
--- a/sound/oss/dmasound/dac3550a.c
+++ /dev/null
@@ -1,209 +0,0 @@
1/*
2 * Driver for the i2c/i2s based DAC3550a sound chip used
3 * on some Apple iBooks. Also known as "DACA".
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive
7 * for more details.
8 */
9
10#include <linux/module.h>
11#include <linux/slab.h>
12#include <linux/delay.h>
13#include <linux/proc_fs.h>
14#include <linux/ioport.h>
15#include <linux/sysctl.h>
16#include <linux/types.h>
17#include <linux/i2c.h>
18#include <linux/init.h>
19#include <asm/uaccess.h>
20#include <asm/errno.h>
21#include <asm/io.h>
22
23#include "dmasound.h"
24
25/* FYI: This code was derived from the tas3001c.c Texas/Tumbler mixer
26 * control code, as well as info derived from the AppleDACAAudio driver
27 * from Darwin CVS (main thing I derived being register numbers and
28 * values, as well as when to make the calls). */
29
30#define I2C_DRIVERID_DACA (0xFDCB)
31
32#define DACA_VERSION "0.1"
33#define DACA_DATE "20010930"
34
35static int cur_left_vol;
36static int cur_right_vol;
37static struct i2c_client *daca_client;
38
39static int daca_attach_adapter(struct i2c_adapter *adapter);
40static int daca_detect_client(struct i2c_adapter *adapter, int address);
41static int daca_detach_client(struct i2c_client *client);
42
43struct i2c_driver daca_driver = {
44 .driver = {
45 .name = "DAC3550A driver V " DACA_VERSION,
46 },
47 .id = I2C_DRIVERID_DACA,
48 .attach_adapter = daca_attach_adapter,
49 .detach_client = daca_detach_client,
50};
51
52#define VOL_MAX ((1<<20) - 1)
53
54void daca_get_volume(uint * left_vol, uint *right_vol)
55{
56 *left_vol = cur_left_vol >> 5;
57 *right_vol = cur_right_vol >> 5;
58}
59
60int daca_set_volume(uint left_vol, uint right_vol)
61{
62 unsigned short voldata;
63
64 if (!daca_client)
65 return -1;
66
67 /* Derived from experience, not from any specific values */
68 left_vol <<= 5;
69 right_vol <<= 5;
70
71 if (left_vol > VOL_MAX)
72 left_vol = VOL_MAX;
73 if (right_vol > VOL_MAX)
74 right_vol = VOL_MAX;
75
76 voldata = ((left_vol >> 14) & 0x3f) << 8;
77 voldata |= (right_vol >> 14) & 0x3f;
78
79 if (i2c_smbus_write_word_data(daca_client, 2, voldata) < 0) {
80 printk("daca: failed to set volume \n");
81 return -1;
82 }
83
84 cur_left_vol = left_vol;
85 cur_right_vol = right_vol;
86
87 return 0;
88}
89
90int daca_leave_sleep(void)
91{
92 if (!daca_client)
93 return -1;
94
95 /* Do a short sleep, just to make sure I2C bus is awake and paying
96 * attention to us
97 */
98 msleep(20);
99 /* Write the sample rate reg the value it needs */
100 i2c_smbus_write_byte_data(daca_client, 1, 8);
101 daca_set_volume(cur_left_vol >> 5, cur_right_vol >> 5);
102 /* Another short delay, just to make sure the other I2C bus writes
103 * have taken...
104 */
105 msleep(20);
106 /* Write the global config reg - invert right power amp,
107 * DAC on, use 5-volt mode */
108 i2c_smbus_write_byte_data(daca_client, 3, 0x45);
109
110 return 0;
111}
112
113int daca_enter_sleep(void)
114{
115 if (!daca_client)
116 return -1;
117
118 i2c_smbus_write_byte_data(daca_client, 1, 8);
119 daca_set_volume(cur_left_vol >> 5, cur_right_vol >> 5);
120
121 /* Write the global config reg - invert right power amp,
122 * DAC on, enter low-power mode, use 5-volt mode
123 */
124 i2c_smbus_write_byte_data(daca_client, 3, 0x65);
125
126 return 0;
127}
128
129static int daca_attach_adapter(struct i2c_adapter *adapter)
130{
131 if (!strncmp(adapter->name, "mac-io", 6))
132 daca_detect_client(adapter, 0x4d);
133 return 0;
134}
135
136static int daca_init_client(struct i2c_client * new_client)
137{
138 /*
139 * Probe is not working with the current i2c-keywest
140 * driver. We try to use addr 0x4d on each adapters
141 * instead, by setting the format register.
142 *
143 * FIXME: I'm sure that can be obtained from the
144 * device-tree. --BenH.
145 */
146
147 /* Write the global config reg - invert right power amp,
148 * DAC on, use 5-volt mode
149 */
150 if (i2c_smbus_write_byte_data(new_client, 3, 0x45))
151 return -1;
152
153 i2c_smbus_write_byte_data(new_client, 1, 8);
154 daca_client = new_client;
155 daca_set_volume(15000, 15000);
156
157 return 0;
158}
159
160static int daca_detect_client(struct i2c_adapter *adapter, int address)
161{
162 const char *client_name = "DAC 3550A Digital Equalizer";
163 struct i2c_client *new_client;
164 int rc = -ENODEV;
165
166 new_client = kzalloc(sizeof(*new_client), GFP_KERNEL);
167 if (!new_client)
168 return -ENOMEM;
169
170 new_client->addr = address;
171 new_client->adapter = adapter;
172 new_client->driver = &daca_driver;
173 new_client->flags = 0;
174 strcpy(new_client->name, client_name);
175
176 if (daca_init_client(new_client))
177 goto bail;
178
179 /* Tell the i2c layer a new client has arrived */
180 if (i2c_attach_client(new_client))
181 goto bail;
182
183 return 0;
184 bail:
185 kfree(new_client);
186 return rc;
187}
188
189
190static int daca_detach_client(struct i2c_client *client)
191{
192 if (client == daca_client)
193 daca_client = NULL;
194
195 i2c_detach_client(client);
196 kfree(client);
197 return 0;
198}
199
200void daca_cleanup(void)
201{
202 i2c_del_driver(&daca_driver);
203}
204
205int daca_init(void)
206{
207 printk("dac3550a driver version %s (%s)\n",DACA_VERSION,DACA_DATE);
208 return i2c_add_driver(&daca_driver);
209}
diff --git a/sound/oss/dmasound/dmasound.h b/sound/oss/dmasound/dmasound.h
index 25dd5a318eb4..d978b0096564 100644
--- a/sound/oss/dmasound/dmasound.h
+++ b/sound/oss/dmasound/dmasound.h
@@ -59,7 +59,6 @@ static inline int ioctl_return(int __user *addr, int value)
59 */ 59 */
60 60
61#undef HAS_8BIT_TABLES 61#undef HAS_8BIT_TABLES
62#undef HAS_RECORD
63 62
64#if defined(CONFIG_DMASOUND_ATARI) || defined(CONFIG_DMASOUND_ATARI_MODULE) ||\ 63#if defined(CONFIG_DMASOUND_ATARI) || defined(CONFIG_DMASOUND_ATARI_MODULE) ||\
65 defined(CONFIG_DMASOUND_PAULA) || defined(CONFIG_DMASOUND_PAULA_MODULE) ||\ 64 defined(CONFIG_DMASOUND_PAULA) || defined(CONFIG_DMASOUND_PAULA_MODULE) ||\
@@ -83,10 +82,6 @@ static inline int ioctl_return(int __user *addr, int value)
83#define DEFAULT_N_BUFFERS 4 82#define DEFAULT_N_BUFFERS 4
84#define DEFAULT_BUFF_SIZE (1<<15) 83#define DEFAULT_BUFF_SIZE (1<<15)
85 84
86#if defined(CONFIG_DMASOUND_PMAC) || defined(CONFIG_DMASOUND_PMAC_MODULE)
87#define HAS_RECORD
88#endif
89
90 /* 85 /*
91 * Initialization 86 * Initialization
92 */ 87 */
@@ -168,9 +163,6 @@ struct sound_settings {
168 SETTINGS soft; /* software settings */ 163 SETTINGS soft; /* software settings */
169 SETTINGS dsp; /* /dev/dsp default settings */ 164 SETTINGS dsp; /* /dev/dsp default settings */
170 TRANS *trans_write; /* supported translations */ 165 TRANS *trans_write; /* supported translations */
171#ifdef HAS_RECORD
172 TRANS *trans_read; /* supported translations */
173#endif
174 int volume_left; /* volume (range is machine dependent) */ 166 int volume_left; /* volume (range is machine dependent) */
175 int volume_right; 167 int volume_right;
176 int bass; /* tone (range is machine dependent) */ 168 int bass; /* tone (range is machine dependent) */
@@ -253,11 +245,6 @@ struct sound_queue {
253extern struct sound_queue dmasound_write_sq; 245extern struct sound_queue dmasound_write_sq;
254#define write_sq dmasound_write_sq 246#define write_sq dmasound_write_sq
255 247
256#ifdef HAS_RECORD
257extern struct sound_queue dmasound_read_sq;
258#define read_sq dmasound_read_sq
259#endif
260
261extern int dmasound_catchRadius; 248extern int dmasound_catchRadius;
262#define catchRadius dmasound_catchRadius 249#define catchRadius dmasound_catchRadius
263 250
diff --git a/sound/oss/dmasound/dmasound_awacs.c b/sound/oss/dmasound/dmasound_awacs.c
deleted file mode 100644
index 8f6388004f44..000000000000
--- a/sound/oss/dmasound/dmasound_awacs.c
+++ /dev/null
@@ -1,3215 +0,0 @@
1/*
2 * linux/sound/oss/dmasound/dmasound_awacs.c
3 *
4 * PowerMac `AWACS' and `Burgundy' DMA Sound Driver
5 * with some limited support for DACA & Tumbler
6 *
7 * See linux/sound/oss/dmasound/dmasound_core.c for copyright and
8 * history prior to 2001/01/26.
9 *
10 * 26/01/2001 ed 0.1 Iain Sandoe
11 * - added version info.
12 * - moved dbdma command buffer allocation to PMacXXXSqSetup()
13 * - fixed up beep dbdma cmd buffers
14 *
15 * 08/02/2001 [0.2]
16 * - make SNDCTL_DSP_GETFMTS return the correct info for the h/w
17 * - move soft format translations to a separate file
18 * - [0.3] make SNDCTL_DSP_GETCAPS return correct info.
19 * - [0.4] more informative machine name strings.
20 * - [0.5]
21 * - record changes.
22 * - made the default_hard/soft entries.
23 * 04/04/2001 [0.6]
24 * - minor correction to bit assignments in awacs_defs.h
25 * - incorporate mixer changes from 2.2.x back-port.
26 * - take out passthru as a rec input (it isn't).
27 * - make Input Gain slider work the 'right way up'.
28 * - try to make the mixer sliders more logical - so now the
29 * input selectors are just two-state (>50% == ON) and the
30 * Input Gain slider handles the rest of the gain issues.
31 * - try to pick slider representations that most closely match
32 * the actual use - e.g. IGain for input gain...
33 * - first stab at over/under-run detection.
34 * - minor cosmetic changes to IRQ identification.
35 * - fix bug where rates > max would be reported as supported.
36 * - first stab at over/under-run detection.
37 * - make use of i2c for mixer settings conditional on perch
38 * rather than cuda (some machines without perch have cuda).
39 * - fix bug where TX stops when dbdma status comes up "DEAD"
40 * so far only reported on PowerComputing clones ... but.
41 * - put in AWACS/Screamer register write timeouts.
42 * - part way to partitioning the init() stuff
43 * - first pass at 'tumbler' stuff (not support - just an attempt
44 * to allow the driver to load on new G4s).
45 * 01/02/2002 [0.7] - BenH
46 * - all sort of minor bits went in since the latest update, I
47 * bumped the version number for that reason
48 *
49 * 07/26/2002 [0.8] - BenH
50 * - More minor bits since last changelog (I should be more careful
51 * with those)
52 * - Support for snapper & better tumbler integration by Toby Sargeant
53 * - Headphone detect for scremer by Julien Blache
54 * - More tumbler fixed by Andreas Schwab
55 * 11/29/2003 [0.8.1] - Renzo Davoli (King Enzo)
56 * - Support for Snapper line in
57 * - snapper input resampling (for rates < 44100)
58 * - software line gain control
59 */
60
61/* GENERAL FIXME/TODO: check that the assumptions about what is written to
62 mac-io is valid for DACA & Tumbler.
63
64 This driver is in bad need of a rewrite. The dbdma code has to be split,
65 some proper device-tree parsing code has to be written, etc...
66*/
67
68#include <linux/types.h>
69#include <linux/module.h>
70#include <linux/slab.h>
71#include <linux/init.h>
72#include <linux/delay.h>
73#include <linux/soundcard.h>
74#include <linux/adb.h>
75#include <linux/nvram.h>
76#include <linux/tty.h>
77#include <linux/vt_kern.h>
78#include <linux/spinlock.h>
79#include <linux/kmod.h>
80#include <linux/interrupt.h>
81#include <linux/input.h>
82#include <linux/mutex.h>
83#ifdef CONFIG_ADB_CUDA
84#include <linux/cuda.h>
85#endif
86#ifdef CONFIG_ADB_PMU
87#include <linux/pmu.h>
88#endif
89
90#include <asm/uaccess.h>
91#include <asm/prom.h>
92#include <asm/machdep.h>
93#include <asm/io.h>
94#include <asm/dbdma.h>
95#include <asm/pmac_feature.h>
96#include <asm/irq.h>
97#include <asm/nvram.h>
98
99#include "awacs_defs.h"
100#include "dmasound.h"
101#include "tas3001c.h"
102#include "tas3004.h"
103#include "tas_common.h"
104
105#define DMASOUND_AWACS_REVISION 0
106#define DMASOUND_AWACS_EDITION 7
107
108#define AWACS_SNAPPER 110 /* fake revision # for snapper */
109#define AWACS_BURGUNDY 100 /* fake revision # for burgundy */
110#define AWACS_TUMBLER 90 /* fake revision # for tumbler */
111#define AWACS_DACA 80 /* fake revision # for daca (ibook) */
112#define AWACS_AWACS 2 /* holding revision for AWACS */
113#define AWACS_SCREAMER 3 /* holding revision for Screamer */
114/*
115 * Interrupt numbers and addresses, & info obtained from the device tree.
116 */
117static int awacs_irq, awacs_tx_irq, awacs_rx_irq;
118static volatile struct awacs_regs __iomem *awacs;
119static volatile u32 __iomem *i2s;
120static volatile struct dbdma_regs __iomem *awacs_txdma, *awacs_rxdma;
121static int awacs_rate_index;
122static int awacs_subframe;
123static struct device_node* awacs_node;
124static struct device_node* i2s_node;
125static struct resource awacs_rsrc[3];
126
127static char awacs_name[64];
128static int awacs_revision;
129static int awacs_sleeping;
130static DEFINE_MUTEX(dmasound_mutex);
131
132static int sound_device_id; /* exists after iMac revA */
133static int hw_can_byteswap = 1 ; /* most pmac sound h/w can */
134
135/* model info */
136/* To be replaced with better interaction with pmac_feature.c */
137static int is_pbook_3X00;
138static int is_pbook_g3;
139
140/* expansion info */
141static int has_perch;
142static int has_ziva;
143
144/* for earlier powerbooks which need fiddling with mac-io to enable
145 * cd etc.
146*/
147static unsigned char __iomem *latch_base;
148static unsigned char __iomem *macio_base;
149
150/*
151 * Space for the DBDMA command blocks.
152 */
153static void *awacs_tx_cmd_space;
154static volatile struct dbdma_cmd *awacs_tx_cmds;
155static int number_of_tx_cmd_buffers;
156
157static void *awacs_rx_cmd_space;
158static volatile struct dbdma_cmd *awacs_rx_cmds;
159static int number_of_rx_cmd_buffers;
160
161/*
162 * Cached values of AWACS registers (we can't read them).
163 * Except on the burgundy (and screamer). XXX
164 */
165
166int awacs_reg[8];
167int awacs_reg1_save;
168
169/* tracking values for the mixer contents
170*/
171
172static int spk_vol;
173static int line_vol;
174static int passthru_vol;
175
176static int ip_gain; /* mic preamp settings */
177static int rec_lev = 0x4545 ; /* default CD gain 69 % */
178static int mic_lev;
179static int cd_lev = 0x6363 ; /* 99 % */
180static int line_lev;
181
182static int hdp_connected;
183
184/*
185 * Stuff for outputting a beep. The values range from -327 to +327
186 * so we can multiply by an amplitude in the range 0..100 to get a
187 * signed short value to put in the output buffer.
188 */
189static short beep_wform[256] = {
190 0, 40, 79, 117, 153, 187, 218, 245,
191 269, 288, 304, 316, 323, 327, 327, 324,
192 318, 310, 299, 288, 275, 262, 249, 236,
193 224, 213, 204, 196, 190, 186, 183, 182,
194 182, 183, 186, 189, 192, 196, 200, 203,
195 206, 208, 209, 209, 209, 207, 204, 201,
196 197, 193, 188, 183, 179, 174, 170, 166,
197 163, 161, 160, 159, 159, 160, 161, 162,
198 164, 166, 168, 169, 171, 171, 171, 170,
199 169, 167, 163, 159, 155, 150, 144, 139,
200 133, 128, 122, 117, 113, 110, 107, 105,
201 103, 103, 103, 103, 104, 104, 105, 105,
202 105, 103, 101, 97, 92, 86, 78, 68,
203 58, 45, 32, 18, 3, -11, -26, -41,
204 -55, -68, -79, -88, -95, -100, -102, -102,
205 -99, -93, -85, -75, -62, -48, -33, -16,
206 0, 16, 33, 48, 62, 75, 85, 93,
207 99, 102, 102, 100, 95, 88, 79, 68,
208 55, 41, 26, 11, -3, -18, -32, -45,
209 -58, -68, -78, -86, -92, -97, -101, -103,
210 -105, -105, -105, -104, -104, -103, -103, -103,
211 -103, -105, -107, -110, -113, -117, -122, -128,
212 -133, -139, -144, -150, -155, -159, -163, -167,
213 -169, -170, -171, -171, -171, -169, -168, -166,
214 -164, -162, -161, -160, -159, -159, -160, -161,
215 -163, -166, -170, -174, -179, -183, -188, -193,
216 -197, -201, -204, -207, -209, -209, -209, -208,
217 -206, -203, -200, -196, -192, -189, -186, -183,
218 -182, -182, -183, -186, -190, -196, -204, -213,
219 -224, -236, -249, -262, -275, -288, -299, -310,
220 -318, -324, -327, -327, -323, -316, -304, -288,
221 -269, -245, -218, -187, -153, -117, -79, -40,
222};
223
224/* beep support */
225#define BEEP_SRATE 22050 /* 22050 Hz sample rate */
226#define BEEP_BUFLEN 512
227#define BEEP_VOLUME 15 /* 0 - 100 */
228
229static int beep_vol = BEEP_VOLUME;
230static int beep_playing;
231static int awacs_beep_state;
232static short *beep_buf;
233static void *beep_dbdma_cmd_space;
234static volatile struct dbdma_cmd *beep_dbdma_cmd;
235
236/* Burgundy functions */
237static void awacs_burgundy_wcw(unsigned addr,unsigned newval);
238static unsigned awacs_burgundy_rcw(unsigned addr);
239static void awacs_burgundy_write_volume(unsigned address, int volume);
240static int awacs_burgundy_read_volume(unsigned address);
241static void awacs_burgundy_write_mvolume(unsigned address, int volume);
242static int awacs_burgundy_read_mvolume(unsigned address);
243
244/* we will allocate a single 'emergency' dbdma cmd block to use if the
245 tx status comes up "DEAD". This happens on some PowerComputing Pmac
246 clones, either owing to a bug in dbdma or some interaction between
247 IDE and sound. However, this measure would deal with DEAD status if
248 if appeared elsewhere.
249
250 for the sake of memory efficiency we'll allocate this cmd as part of
251 the beep cmd stuff.
252*/
253
254static volatile struct dbdma_cmd *emergency_dbdma_cmd;
255
256#ifdef CONFIG_PM
257/*
258 * Stuff for restoring after a sleep.
259 */
260static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when);
261struct pmu_sleep_notifier awacs_sleep_notifier = {
262 awacs_sleep_notify, SLEEP_LEVEL_SOUND,
263};
264#endif /* CONFIG_PM */
265
266/* for (soft) sample rate translations */
267int expand_bal; /* Balance factor for expanding (not volume!) */
268int expand_read_bal; /* Balance factor for expanding reads (not volume!) */
269
270/*** Low level stuff *********************************************************/
271
272static void *PMacAlloc(unsigned int size, gfp_t flags);
273static void PMacFree(void *ptr, unsigned int size);
274static int PMacIrqInit(void);
275#ifdef MODULE
276static void PMacIrqCleanup(void);
277#endif
278static void PMacSilence(void);
279static void PMacInit(void);
280static int PMacSetFormat(int format);
281static int PMacSetVolume(int volume);
282static void PMacPlay(void);
283static void PMacRecord(void);
284static irqreturn_t pmac_awacs_tx_intr(int irq, void *devid);
285static irqreturn_t pmac_awacs_rx_intr(int irq, void *devid);
286static irqreturn_t pmac_awacs_intr(int irq, void *devid);
287static void awacs_write(int val);
288static int awacs_get_volume(int reg, int lshift);
289static int awacs_volume_setter(int volume, int n, int mute, int lshift);
290
291
292/*** Mid level stuff **********************************************************/
293
294static int PMacMixerIoctl(u_int cmd, u_long arg);
295static int PMacWriteSqSetup(void);
296static int PMacReadSqSetup(void);
297static void PMacAbortRead(void);
298
299extern TRANS transAwacsNormal ;
300extern TRANS transAwacsExpand ;
301extern TRANS transAwacsNormalRead ;
302extern TRANS transAwacsExpandRead ;
303
304extern int daca_init(void);
305extern void daca_cleanup(void);
306extern int daca_set_volume(uint left_vol, uint right_vol);
307extern void daca_get_volume(uint * left_vol, uint *right_vol);
308extern int daca_enter_sleep(void);
309extern int daca_leave_sleep(void);
310
311#define TRY_LOCK() \
312 if ((rc = mutex_lock_interruptible(&dmasound_mutex)) != 0) \
313 return rc;
314#define LOCK() mutex_lock(&dmasound_mutex);
315
316#define UNLOCK() mutex_unlock(&dmasound_mutex);
317
318/* We use different versions that the ones provided in dmasound.h
319 *
320 * FIXME: Use different names ;)
321 */
322#undef IOCTL_IN
323#undef IOCTL_OUT
324
325#define IOCTL_IN(arg, ret) \
326 rc = get_user(ret, (int __user *)(arg)); \
327 if (rc) break;
328#define IOCTL_OUT(arg, ret) \
329 ioctl_return2((int __user *)(arg), ret)
330
331static inline int ioctl_return2(int __user *addr, int value)
332{
333 return value < 0 ? value : put_user(value, addr);
334}
335
336
337/*** AE - TUMBLER / SNAPPER START ************************************************/
338
339
340int gpio_audio_reset, gpio_audio_reset_pol;
341int gpio_amp_mute, gpio_amp_mute_pol;
342int gpio_headphone_mute, gpio_headphone_mute_pol;
343int gpio_headphone_detect, gpio_headphone_detect_pol;
344int gpio_headphone_irq;
345
346int
347setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol)
348{
349 struct device_node *gpiop;
350 struct device_node *np;
351 const u32* pp;
352 int ret = -ENODEV;
353
354 gpiop = of_find_node_by_name(NULL, "gpio");
355 if (!gpiop)
356 goto done;
357
358 np = of_get_next_child(gpiop, NULL);
359 while(np != 0) {
360 if (name) {
361 const char *property =
362 of_get_property(np,"audio-gpio",NULL);
363 if (property != 0 && strcmp(property,name) == 0)
364 break;
365 } else if (compatible && of_device_is_compatible(np, compatible))
366 break;
367 np = of_get_next_child(gpiop, np);
368 }
369 if (!np)
370 goto done;
371 pp = of_get_property(np, "AAPL,address", NULL);
372 if (!pp)
373 goto done;
374 *gpio_addr = (*pp) & 0x0000ffff;
375 pp = of_get_property(np, "audio-gpio-active-state", NULL);
376 if (pp)
377 *gpio_pol = *pp;
378 else
379 *gpio_pol = 1;
380 ret = irq_of_parse_and_map(np, 0);
381done:
382 of_node_put(np);
383 of_node_put(gpiop);
384 return ret;
385}
386
387static inline void
388write_audio_gpio(int gpio_addr, int data)
389{
390 if (!gpio_addr)
391 return;
392 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, gpio_addr, data ? 0x05 : 0x04);
393}
394
395static inline int
396read_audio_gpio(int gpio_addr)
397{
398 if (!gpio_addr)
399 return 0;
400 return ((pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, gpio_addr, 0) & 0x02) !=0);
401}
402
403/*
404 * Headphone interrupt via GPIO (Tumbler, Snapper, DACA)
405 */
406static irqreturn_t
407headphone_intr(int irq, void *devid)
408{
409 unsigned long flags;
410
411 spin_lock_irqsave(&dmasound.lock, flags);
412 if (read_audio_gpio(gpio_headphone_detect) == gpio_headphone_detect_pol) {
413 printk(KERN_INFO "Audio jack plugged, muting speakers.\n");
414 write_audio_gpio(gpio_headphone_mute, !gpio_headphone_mute_pol);
415 write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
416 tas_output_device_change(sound_device_id,TAS_OUTPUT_HEADPHONES,0);
417 } else {
418 printk(KERN_INFO "Audio jack unplugged, enabling speakers.\n");
419 write_audio_gpio(gpio_amp_mute, !gpio_amp_mute_pol);
420 write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
421 tas_output_device_change(sound_device_id,TAS_OUTPUT_INTERNAL_SPKR,0);
422 }
423 spin_unlock_irqrestore(&dmasound.lock, flags);
424 return IRQ_HANDLED;
425}
426
427
428/* Initialize tumbler */
429
430static int
431tas_dmasound_init(void)
432{
433 setup_audio_gpio(
434 "audio-hw-reset",
435 NULL,
436 &gpio_audio_reset,
437 &gpio_audio_reset_pol);
438 setup_audio_gpio(
439 "amp-mute",
440 NULL,
441 &gpio_amp_mute,
442 &gpio_amp_mute_pol);
443 setup_audio_gpio("headphone-mute",
444 NULL,
445 &gpio_headphone_mute,
446 &gpio_headphone_mute_pol);
447 gpio_headphone_irq = setup_audio_gpio(
448 "headphone-detect",
449 NULL,
450 &gpio_headphone_detect,
451 &gpio_headphone_detect_pol);
452 /* Fix some broken OF entries in desktop machines */
453 if (!gpio_headphone_irq)
454 gpio_headphone_irq = setup_audio_gpio(
455 NULL,
456 "keywest-gpio15",
457 &gpio_headphone_detect,
458 &gpio_headphone_detect_pol);
459
460 write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
461 msleep(100);
462 write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
463 msleep(100);
464 if (gpio_headphone_irq) {
465 if (request_irq(gpio_headphone_irq,headphone_intr,0,"Headphone detect",NULL) < 0) {
466 printk(KERN_ERR "tumbler: Can't request headphone interrupt\n");
467 gpio_headphone_irq = 0;
468 } else {
469 u8 val;
470 /* Activate headphone status interrupts */
471 val = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, gpio_headphone_detect, 0);
472 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, gpio_headphone_detect, val | 0x80);
473 /* Trigger it */
474 headphone_intr(0, NULL);
475 }
476 }
477 if (!gpio_headphone_irq) {
478 /* Some machine enter this case ? */
479 printk(KERN_WARNING "tumbler: Headphone detect IRQ not found, enabling all outputs !\n");
480 write_audio_gpio(gpio_amp_mute, !gpio_amp_mute_pol);
481 write_audio_gpio(gpio_headphone_mute, !gpio_headphone_mute_pol);
482 }
483 return 0;
484}
485
486
487static int
488tas_dmasound_cleanup(void)
489{
490 if (gpio_headphone_irq)
491 free_irq(gpio_headphone_irq, NULL);
492 return 0;
493}
494
495/* We don't support 48k yet */
496static int tas_freqs[1] = { 44100 } ;
497static int tas_freqs_ok[1] = { 1 } ;
498
499/* don't know what to do really - just have to leave it where
500 * OF left things
501*/
502
503static int
504tas_set_frame_rate(void)
505{
506 if (i2s) {
507 out_le32(i2s + (I2S_REG_SERIAL_FORMAT >> 2), 0x41190000);
508 out_le32(i2s + (I2S_REG_DATAWORD_SIZES >> 2), 0x02000200);
509 }
510 dmasound.hard.speed = 44100 ;
511 awacs_rate_index = 0 ;
512 return 44100 ;
513}
514
515static int
516tas_mixer_ioctl(u_int cmd, u_long arg)
517{
518 int __user *argp = (int __user *)arg;
519 int data;
520 int rc;
521
522 rc=tas_device_ioctl(cmd, arg);
523 if (rc != -EINVAL) {
524 return rc;
525 }
526
527 if ((cmd & ~0xff) == MIXER_WRITE(0) &&
528 tas_supported_mixers() & (1<<(cmd & 0xff))) {
529 rc = get_user(data, argp);
530 if (rc<0) return rc;
531 tas_set_mixer_level(cmd & 0xff, data);
532 tas_get_mixer_level(cmd & 0xff, &data);
533 return ioctl_return2(argp, data);
534 }
535 if ((cmd & ~0xff) == MIXER_READ(0) &&
536 tas_supported_mixers() & (1<<(cmd & 0xff))) {
537 tas_get_mixer_level(cmd & 0xff, &data);
538 return ioctl_return2(argp, data);
539 }
540
541 switch(cmd) {
542 case SOUND_MIXER_READ_DEVMASK:
543 data = tas_supported_mixers() | SOUND_MASK_SPEAKER;
544 rc = IOCTL_OUT(arg, data);
545 break;
546 case SOUND_MIXER_READ_STEREODEVS:
547 data = tas_stereo_mixers();
548 rc = IOCTL_OUT(arg, data);
549 break;
550 case SOUND_MIXER_READ_CAPS:
551 rc = IOCTL_OUT(arg, 0);
552 break;
553 case SOUND_MIXER_READ_RECMASK:
554 // XXX FIXME: find a way to check what is really available */
555 data = SOUND_MASK_LINE | SOUND_MASK_MIC;
556 rc = IOCTL_OUT(arg, data);
557 break;
558 case SOUND_MIXER_READ_RECSRC:
559 if (awacs_reg[0] & MASK_MUX_AUDIN)
560 data |= SOUND_MASK_LINE;
561 if (awacs_reg[0] & MASK_MUX_MIC)
562 data |= SOUND_MASK_MIC;
563 rc = IOCTL_OUT(arg, data);
564 break;
565 case SOUND_MIXER_WRITE_RECSRC:
566 IOCTL_IN(arg, data);
567 data =0;
568 rc = IOCTL_OUT(arg, data);
569 break;
570 case SOUND_MIXER_WRITE_SPEAKER: /* really bell volume */
571 IOCTL_IN(arg, data);
572 beep_vol = data & 0xff;
573 /* fall through */
574 case SOUND_MIXER_READ_SPEAKER:
575 rc = IOCTL_OUT(arg, (beep_vol<<8) | beep_vol);
576 break;
577 case SOUND_MIXER_OUTMASK:
578 case SOUND_MIXER_OUTSRC:
579 default:
580 rc = -EINVAL;
581 }
582
583 return rc;
584}
585
586static void __init
587tas_init_frame_rates(const unsigned int *prop, unsigned int l)
588{
589 int i ;
590 if (prop) {
591 for (i=0; i<1; i++)
592 tas_freqs_ok[i] = 0;
593 for (l /= sizeof(int); l > 0; --l) {
594 unsigned int r = *prop++;
595 /* Apple 'Fixed' format */
596 if (r >= 0x10000)
597 r >>= 16;
598 for (i = 0; i < 1; ++i) {
599 if (r == tas_freqs[i]) {
600 tas_freqs_ok[i] = 1;
601 break;
602 }
603 }
604 }
605 }
606 /* else we assume that all the rates are available */
607}
608
609
610/*** AE - TUMBLER / SNAPPER END ************************************************/
611
612
613
614/*** Low level stuff *********************************************************/
615
616/*
617 * PCI PowerMac, with AWACS, Screamer, Burgundy, DACA or Tumbler and DBDMA.
618 */
619static void *PMacAlloc(unsigned int size, gfp_t flags)
620{
621 return kmalloc(size, flags);
622}
623
624static void PMacFree(void *ptr, unsigned int size)
625{
626 kfree(ptr);
627}
628
629static int __init PMacIrqInit(void)
630{
631 if (awacs)
632 if (request_irq(awacs_irq, pmac_awacs_intr, 0, "Built-in Sound misc", NULL))
633 return 0;
634 if (request_irq(awacs_tx_irq, pmac_awacs_tx_intr, 0, "Built-in Sound out", NULL)
635 || request_irq(awacs_rx_irq, pmac_awacs_rx_intr, 0, "Built-in Sound in", NULL))
636 return 0;
637 return 1;
638}
639
640#ifdef MODULE
641static void PMacIrqCleanup(void)
642{
643 /* turn off input & output dma */
644 DBDMA_DO_STOP(awacs_txdma);
645 DBDMA_DO_STOP(awacs_rxdma);
646
647 if (awacs)
648 /* disable interrupts from awacs interface */
649 out_le32(&awacs->control, in_le32(&awacs->control) & 0xfff);
650
651 /* Switch off the sound clock */
652 pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, awacs_node, 0, 0);
653 /* Make sure proper bits are set on pismo & tipb */
654 if ((machine_is_compatible("PowerBook3,1") ||
655 machine_is_compatible("PowerBook3,2")) && awacs) {
656 awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1;
657 awacs_write(MASK_ADDR1 | awacs_reg[1]);
658 msleep(200);
659 }
660 if (awacs)
661 free_irq(awacs_irq, NULL);
662 free_irq(awacs_tx_irq, NULL);
663 free_irq(awacs_rx_irq, NULL);
664
665 if (awacs)
666 iounmap(awacs);
667 if (i2s)
668 iounmap(i2s);
669 iounmap(awacs_txdma);
670 iounmap(awacs_rxdma);
671
672 release_mem_region(awacs_rsrc[0].start,
673 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
674 release_mem_region(awacs_rsrc[1].start,
675 awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
676 release_mem_region(awacs_rsrc[2].start,
677 awacs_rsrc[2].end - awacs_rsrc[2].start + 1);
678
679 kfree(awacs_tx_cmd_space);
680 kfree(awacs_rx_cmd_space);
681 kfree(beep_dbdma_cmd_space);
682 kfree(beep_buf);
683#ifdef CONFIG_PM
684 pmu_unregister_sleep_notifier(&awacs_sleep_notifier);
685#endif
686}
687#endif /* MODULE */
688
689static void PMacSilence(void)
690{
691 /* turn off output dma */
692 DBDMA_DO_STOP(awacs_txdma);
693}
694
695/* don't know what to do really - just have to leave it where
696 * OF left things
697*/
698
699static int daca_set_frame_rate(void)
700{
701 if (i2s) {
702 out_le32(i2s + (I2S_REG_SERIAL_FORMAT >> 2), 0x41190000);
703 out_le32(i2s + (I2S_REG_DATAWORD_SIZES >> 2), 0x02000200);
704 }
705 dmasound.hard.speed = 44100 ;
706 awacs_rate_index = 0 ;
707 return 44100 ;
708}
709
710static int awacs_freqs[8] = {
711 44100, 29400, 22050, 17640, 14700, 11025, 8820, 7350
712};
713static int awacs_freqs_ok[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };
714
715static int
716awacs_set_frame_rate(int desired, int catch_r)
717{
718 int tolerance, i = 8 ;
719 /*
720 * If we have a sample rate which is within catchRadius percent
721 * of the requested value, we don't have to expand the samples.
722 * Otherwise choose the next higher rate.
723 * N.B.: burgundy awacs only works at 44100 Hz.
724 */
725 do {
726 tolerance = catch_r * awacs_freqs[--i] / 100;
727 if (awacs_freqs_ok[i]
728 && dmasound.soft.speed <= awacs_freqs[i] + tolerance)
729 break;
730 } while (i > 0);
731 dmasound.hard.speed = awacs_freqs[i];
732 awacs_rate_index = i;
733
734 out_le32(&awacs->control, MASK_IEPC | (i << 8) | 0x11 );
735 awacs_reg[1] = (awacs_reg[1] & ~MASK_SAMPLERATE) | (i << 3);
736 awacs_write(awacs_reg[1] | MASK_ADDR1);
737 return dmasound.hard.speed;
738}
739
740static int
741burgundy_set_frame_rate(void)
742{
743 awacs_rate_index = 0 ;
744 awacs_reg[1] = (awacs_reg[1] & ~MASK_SAMPLERATE) ;
745 /* XXX disable error interrupt on burgundy for now */
746 out_le32(&awacs->control, MASK_IEPC | 0 | 0x11 | MASK_IEE);
747 return 44100 ;
748}
749
750static int
751set_frame_rate(int desired, int catch_r)
752{
753 switch (awacs_revision) {
754 case AWACS_BURGUNDY:
755 dmasound.hard.speed = burgundy_set_frame_rate();
756 break ;
757 case AWACS_TUMBLER:
758 case AWACS_SNAPPER:
759 dmasound.hard.speed = tas_set_frame_rate();
760 break ;
761 case AWACS_DACA:
762 dmasound.hard.speed =
763 daca_set_frame_rate();
764 break ;
765 default:
766 dmasound.hard.speed = awacs_set_frame_rate(desired,
767 catch_r);
768 break ;
769 }
770 return dmasound.hard.speed ;
771}
772
773static void
774awacs_recalibrate(void)
775{
776 /* Sorry for the horrible delays... I hope to get that improved
777 * by making the whole PM process asynchronous in a future version
778 */
779 msleep(750);
780 awacs_reg[1] |= MASK_CMUTE | MASK_AMUTE;
781 awacs_write(awacs_reg[1] | MASK_RECALIBRATE | MASK_ADDR1);
782 msleep(1000);
783 awacs_write(awacs_reg[1] | MASK_ADDR1);
784}
785
786static void PMacInit(void)
787{
788 int tolerance;
789
790 switch (dmasound.soft.format) {
791 case AFMT_S16_LE:
792 case AFMT_U16_LE:
793 if (hw_can_byteswap)
794 dmasound.hard.format = AFMT_S16_LE;
795 else
796 dmasound.hard.format = AFMT_S16_BE;
797 break;
798 default:
799 dmasound.hard.format = AFMT_S16_BE;
800 break;
801 }
802 dmasound.hard.stereo = 1;
803 dmasound.hard.size = 16;
804
805 /* set dmasound.hard.speed - on the basis of what we want (soft)
806 * and the tolerance we'll allow.
807 */
808 set_frame_rate(dmasound.soft.speed, catchRadius) ;
809
810 tolerance = (catchRadius * dmasound.hard.speed) / 100;
811 if (dmasound.soft.speed >= dmasound.hard.speed - tolerance) {
812 dmasound.trans_write = &transAwacsNormal;
813 dmasound.trans_read = &transAwacsNormalRead;
814 } else {
815 dmasound.trans_write = &transAwacsExpand;
816 dmasound.trans_read = &transAwacsExpandRead;
817 }
818
819 if (awacs) {
820 if (hw_can_byteswap && (dmasound.hard.format == AFMT_S16_LE))
821 out_le32(&awacs->byteswap, BS_VAL);
822 else
823 out_le32(&awacs->byteswap, 0);
824 }
825
826 expand_bal = -dmasound.soft.speed;
827 expand_read_bal = -dmasound.soft.speed;
828}
829
830static int PMacSetFormat(int format)
831{
832 int size;
833 int req_format = format;
834
835 switch (format) {
836 case AFMT_QUERY:
837 return dmasound.soft.format;
838 case AFMT_MU_LAW:
839 case AFMT_A_LAW:
840 case AFMT_U8:
841 case AFMT_S8:
842 size = 8;
843 break;
844 case AFMT_S16_LE:
845 if(!hw_can_byteswap)
846 format = AFMT_S16_BE;
847 case AFMT_S16_BE:
848 size = 16;
849 break;
850 case AFMT_U16_LE:
851 if(!hw_can_byteswap)
852 format = AFMT_U16_BE;
853 case AFMT_U16_BE:
854 size = 16;
855 break;
856 default: /* :-) */
857 printk(KERN_ERR "dmasound: unknown format 0x%x, using AFMT_U8\n",
858 format);
859 size = 8;
860 format = AFMT_U8;
861 }
862
863 if (req_format == format) {
864 dmasound.soft.format = format;
865 dmasound.soft.size = size;
866 if (dmasound.minDev == SND_DEV_DSP) {
867 dmasound.dsp.format = format;
868 dmasound.dsp.size = size;
869 }
870 }
871
872 return format;
873}
874
875#define AWACS_VOLUME_TO_MASK(x) (15 - ((((x) - 1) * 15) / 99))
876#define AWACS_MASK_TO_VOLUME(y) (100 - ((y) * 99 / 15))
877
878static int awacs_get_volume(int reg, int lshift)
879{
880 int volume;
881
882 volume = AWACS_MASK_TO_VOLUME((reg >> lshift) & 0xf);
883 volume |= AWACS_MASK_TO_VOLUME(reg & 0xf) << 8;
884 return volume;
885}
886
887static int awacs_volume_setter(int volume, int n, int mute, int lshift)
888{
889 int r1, rn;
890
891 if (mute && volume == 0) {
892 r1 = awacs_reg[1] | mute;
893 } else {
894 r1 = awacs_reg[1] & ~mute;
895 rn = awacs_reg[n] & ~(0xf | (0xf << lshift));
896 rn |= ((AWACS_VOLUME_TO_MASK(volume & 0xff) & 0xf) << lshift);
897 rn |= AWACS_VOLUME_TO_MASK((volume >> 8) & 0xff) & 0xf;
898 awacs_reg[n] = rn;
899 awacs_write((n << 12) | rn);
900 volume = awacs_get_volume(rn, lshift);
901 }
902 if (r1 != awacs_reg[1]) {
903 awacs_reg[1] = r1;
904 awacs_write(r1 | MASK_ADDR1);
905 }
906 return volume;
907}
908
909static int PMacSetVolume(int volume)
910{
911 printk(KERN_WARNING "Bogus call to PMacSetVolume !\n");
912 return 0;
913}
914
915static void awacs_setup_for_beep(int speed)
916{
917 out_le32(&awacs->control,
918 (in_le32(&awacs->control) & ~0x1f00)
919 | ((speed > 0 ? speed : awacs_rate_index) << 8));
920
921 if (hw_can_byteswap && (dmasound.hard.format == AFMT_S16_LE) && speed == -1)
922 out_le32(&awacs->byteswap, BS_VAL);
923 else
924 out_le32(&awacs->byteswap, 0);
925}
926
927/* CHECK: how much of this *really* needs IRQs masked? */
928static void __PMacPlay(void)
929{
930 volatile struct dbdma_cmd *cp;
931 int next_frg, count;
932
933 count = 300 ; /* > two cycles at the lowest sample rate */
934
935 /* what we want to send next */
936 next_frg = (write_sq.front + write_sq.active) % write_sq.max_count;
937
938 if (awacs_beep_state) {
939 /* sound takes precedence over beeps */
940 /* stop the dma channel */
941 out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
942 while ( (in_le32(&awacs_txdma->status) & RUN) && count--)
943 udelay(1);
944 if (awacs)
945 awacs_setup_for_beep(-1);
946 out_le32(&awacs_txdma->cmdptr,
947 virt_to_bus(&(awacs_tx_cmds[next_frg])));
948
949 beep_playing = 0;
950 awacs_beep_state = 0;
951 }
952 /* this won't allow more than two frags to be in the output queue at
953 once. (or one, if the max frags is 2 - because count can't exceed
954 2 in that case)
955 */
956 while (write_sq.active < 2 && write_sq.active < write_sq.count) {
957 count = (write_sq.count == write_sq.active + 1) ?
958 write_sq.rear_size:write_sq.block_size ;
959 if (count < write_sq.block_size) {
960 if (!write_sq.syncing) /* last block not yet filled,*/
961 break; /* and we're not syncing or POST-ed */
962 else {
963 /* pretend the block is full to force a new
964 block to be started on the next write */
965 write_sq.rear_size = write_sq.block_size ;
966 write_sq.syncing &= ~2 ; /* clear POST */
967 }
968 }
969 cp = &awacs_tx_cmds[next_frg];
970 st_le16(&cp->req_count, count);
971 st_le16(&cp->xfer_status, 0);
972 st_le16(&cp->command, OUTPUT_MORE + INTR_ALWAYS);
973 /* put a STOP at the end of the queue - but only if we have
974 space for it. This means that, if we under-run and we only
975 have two fragments, we might re-play sound from an existing
976 queued frag. I guess the solution to that is not to set two
977 frags if you are likely to under-run...
978 */
979 if (write_sq.count < write_sq.max_count) {
980 if (++next_frg >= write_sq.max_count)
981 next_frg = 0 ; /* wrap */
982 /* if we get here then we've underrun so we will stop*/
983 st_le16(&awacs_tx_cmds[next_frg].command, DBDMA_STOP);
984 }
985 /* set the dbdma controller going, if it is not already */
986 if (write_sq.active == 0)
987 out_le32(&awacs_txdma->cmdptr, virt_to_bus(cp));
988 (void)in_le32(&awacs_txdma->status);
989 out_le32(&awacs_txdma->control, ((RUN|WAKE) << 16) + (RUN|WAKE));
990 ++write_sq.active;
991 }
992}
993
994static void PMacPlay(void)
995{
996 LOCK();
997 if (!awacs_sleeping) {
998 unsigned long flags;
999
1000 spin_lock_irqsave(&dmasound.lock, flags);
1001 __PMacPlay();
1002 spin_unlock_irqrestore(&dmasound.lock, flags);
1003 }
1004 UNLOCK();
1005}
1006
1007static void PMacRecord(void)
1008{
1009 unsigned long flags;
1010
1011 if (read_sq.active)
1012 return;
1013
1014 spin_lock_irqsave(&dmasound.lock, flags);
1015
1016 /* This is all we have to do......Just start it up.
1017 */
1018 out_le32(&awacs_rxdma->control, ((RUN|WAKE) << 16) + (RUN|WAKE));
1019 read_sq.active = 1;
1020
1021 spin_unlock_irqrestore(&dmasound.lock, flags);
1022}
1023
1024/* if the TX status comes up "DEAD" - reported on some Power Computing machines
1025 we need to re-start the dbdma - but from a different physical start address
1026 and with a different transfer length. It would get very messy to do this
1027 with the normal dbdma_cmd blocks - we would have to re-write the buffer start
1028 addresses each time. So, we will keep a single dbdma_cmd block which can be
1029 fiddled with.
1030 When DEAD status is first reported the content of the faulted dbdma block is
1031 copied into the emergency buffer and we note that the buffer is in use.
1032 we then bump the start physical address by the amount that was successfully
1033 output before it died.
1034 On any subsequent DEAD result we just do the bump-ups (we know that we are
1035 already using the emergency dbdma_cmd).
1036 CHECK: this just tries to "do it". It is possible that we should abandon
1037 xfers when the number of residual bytes gets below a certain value - I can
1038 see that this might cause a loop-forever if too small a transfer causes
1039 DEAD status. However this is a TODO for now - we'll see what gets reported.
1040 When we get a successful transfer result with the emergency buffer we just
1041 pretend that it completed using the original dmdma_cmd and carry on. The
1042 'next_cmd' field will already point back to the original loop of blocks.
1043*/
1044
1045static irqreturn_t
1046pmac_awacs_tx_intr(int irq, void *devid)
1047{
1048 int i = write_sq.front;
1049 int stat;
1050 int i_nowrap = write_sq.front;
1051 volatile struct dbdma_cmd *cp;
1052 /* != 0 when we are dealing with a DEAD xfer */
1053 static int emergency_in_use;
1054
1055 spin_lock(&dmasound.lock);
1056 while (write_sq.active > 0) { /* we expect to have done something*/
1057 if (emergency_in_use) /* we are dealing with DEAD xfer */
1058 cp = emergency_dbdma_cmd ;
1059 else
1060 cp = &awacs_tx_cmds[i];
1061 stat = ld_le16(&cp->xfer_status);
1062 if (stat & DEAD) {
1063 unsigned short req, res ;
1064 unsigned int phy ;
1065#ifdef DEBUG_DMASOUND
1066printk("dmasound_pmac: tx-irq: xfer died - patching it up...\n") ;
1067#endif
1068 /* to clear DEAD status we must first clear RUN
1069 set it to quiescent to be on the safe side */
1070 (void)in_le32(&awacs_txdma->status);
1071 out_le32(&awacs_txdma->control,
1072 (RUN|PAUSE|FLUSH|WAKE) << 16);
1073 write_sq.died++ ;
1074 if (!emergency_in_use) { /* new problem */
1075 memcpy((void *)emergency_dbdma_cmd, (void *)cp,
1076 sizeof(struct dbdma_cmd));
1077 emergency_in_use = 1;
1078 cp = emergency_dbdma_cmd;
1079 }
1080 /* now bump the values to reflect the amount
1081 we haven't yet shifted */
1082 req = ld_le16(&cp->req_count);
1083 res = ld_le16(&cp->res_count);
1084 phy = ld_le32(&cp->phy_addr);
1085 phy += (req - res);
1086 st_le16(&cp->req_count, res);
1087 st_le16(&cp->res_count, 0);
1088 st_le16(&cp->xfer_status, 0);
1089 st_le32(&cp->phy_addr, phy);
1090 st_le32(&cp->cmd_dep, virt_to_bus(&awacs_tx_cmds[(i+1)%write_sq.max_count]));
1091 st_le16(&cp->command, OUTPUT_MORE | BR_ALWAYS | INTR_ALWAYS);
1092
1093 /* point at our patched up command block */
1094 out_le32(&awacs_txdma->cmdptr, virt_to_bus(cp));
1095 /* we must re-start the controller */
1096 (void)in_le32(&awacs_txdma->status);
1097 /* should complete clearing the DEAD status */
1098 out_le32(&awacs_txdma->control,
1099 ((RUN|WAKE) << 16) + (RUN|WAKE));
1100 break; /* this block is still going */
1101 }
1102 if ((stat & ACTIVE) == 0)
1103 break; /* this frame is still going */
1104 if (emergency_in_use)
1105 emergency_in_use = 0 ; /* done that */
1106 --write_sq.count;
1107 --write_sq.active;
1108 i_nowrap++;
1109 if (++i >= write_sq.max_count)
1110 i = 0;
1111 }
1112
1113 /* if we stopped and we were not sync-ing - then we under-ran */
1114 if( write_sq.syncing == 0 ){
1115 stat = in_le32(&awacs_txdma->status) ;
1116 /* we hit the dbdma_stop */
1117 if( (stat & ACTIVE) == 0 ) write_sq.xruns++ ;
1118 }
1119
1120 /* if we used some data up then wake the writer to supply some more*/
1121 if (i_nowrap != write_sq.front)
1122 WAKE_UP(write_sq.action_queue);
1123 write_sq.front = i;
1124
1125 /* but make sure we funnel what we've already got */\
1126 if (!awacs_sleeping)
1127 __PMacPlay();
1128
1129 /* make the wake-on-empty conditional on syncing */
1130 if (!write_sq.active && (write_sq.syncing & 1))
1131 WAKE_UP(write_sq.sync_queue); /* any time we're empty */
1132 spin_unlock(&dmasound.lock);
1133 return IRQ_HANDLED;
1134}
1135
1136
1137static irqreturn_t
1138pmac_awacs_rx_intr(int irq, void *devid)
1139{
1140 int stat ;
1141 /* For some reason on my PowerBook G3, I get one interrupt
1142 * when the interrupt vector is installed (like something is
1143 * pending). This happens before the dbdma is initialized by
1144 * us, so I just check the command pointer and if it is zero,
1145 * just blow it off.
1146 */
1147 if (in_le32(&awacs_rxdma->cmdptr) == 0)
1148 return IRQ_HANDLED;
1149
1150 /* We also want to blow 'em off when shutting down.
1151 */
1152 if (read_sq.active == 0)
1153 return IRQ_HANDLED;
1154
1155 spin_lock(&dmasound.lock);
1156 /* Check multiple buffers in case we were held off from
1157 * interrupt processing for a long time. Geeze, I really hope
1158 * this doesn't happen.
1159 */
1160 while ((stat=awacs_rx_cmds[read_sq.rear].xfer_status)) {
1161
1162 /* if we got a "DEAD" status then just log it for now.
1163 and try to restart dma.
1164 TODO: figure out how best to fix it up
1165 */
1166 if (stat & DEAD){
1167#ifdef DEBUG_DMASOUND
1168printk("dmasound_pmac: rx-irq: DIED - attempting resurection\n");
1169#endif
1170 /* to clear DEAD status we must first clear RUN
1171 set it to quiescent to be on the safe side */
1172 (void)in_le32(&awacs_txdma->status);
1173 out_le32(&awacs_txdma->control,
1174 (RUN|PAUSE|FLUSH|WAKE) << 16);
1175 awacs_rx_cmds[read_sq.rear].xfer_status = 0;
1176 awacs_rx_cmds[read_sq.rear].res_count = 0;
1177 read_sq.died++ ;
1178 (void)in_le32(&awacs_txdma->status);
1179 /* re-start the same block */
1180 out_le32(&awacs_rxdma->cmdptr,
1181 virt_to_bus(&awacs_rx_cmds[read_sq.rear]));
1182 /* we must re-start the controller */
1183 (void)in_le32(&awacs_rxdma->status);
1184 /* should complete clearing the DEAD status */
1185 out_le32(&awacs_rxdma->control,
1186 ((RUN|WAKE) << 16) + (RUN|WAKE));
1187 spin_unlock(&dmasound.lock);
1188 return IRQ_HANDLED; /* try this block again */
1189 }
1190 /* Clear status and move on to next buffer.
1191 */
1192 awacs_rx_cmds[read_sq.rear].xfer_status = 0;
1193 read_sq.rear++;
1194
1195 /* Wrap the buffer ring.
1196 */
1197 if (read_sq.rear >= read_sq.max_active)
1198 read_sq.rear = 0;
1199
1200 /* If we have caught up to the front buffer, bump it.
1201 * This will cause weird (but not fatal) results if the
1202 * read loop is currently using this buffer. The user is
1203 * behind in this case anyway, so weird things are going
1204 * to happen.
1205 */
1206 if (read_sq.rear == read_sq.front) {
1207 read_sq.front++;
1208 read_sq.xruns++ ; /* we overan */
1209 if (read_sq.front >= read_sq.max_active)
1210 read_sq.front = 0;
1211 }
1212 }
1213
1214 WAKE_UP(read_sq.action_queue);
1215 spin_unlock(&dmasound.lock);
1216 return IRQ_HANDLED;
1217}
1218
1219
1220static irqreturn_t
1221pmac_awacs_intr(int irq, void *devid)
1222{
1223 int ctrl;
1224 int status;
1225 int r1;
1226
1227 spin_lock(&dmasound.lock);
1228 ctrl = in_le32(&awacs->control);
1229 status = in_le32(&awacs->codec_stat);
1230
1231 if (ctrl & MASK_PORTCHG) {
1232 /* tested on Screamer, should work on others too */
1233 if (awacs_revision == AWACS_SCREAMER) {
1234 if (((status & MASK_HDPCONN) >> 3) && (hdp_connected == 0)) {
1235 hdp_connected = 1;
1236
1237 r1 = awacs_reg[1] | MASK_SPKMUTE;
1238 awacs_reg[1] = r1;
1239 awacs_write(r1 | MASK_ADDR_MUTE);
1240 } else if (((status & MASK_HDPCONN) >> 3 == 0) && (hdp_connected == 1)) {
1241 hdp_connected = 0;
1242
1243 r1 = awacs_reg[1] & ~MASK_SPKMUTE;
1244 awacs_reg[1] = r1;
1245 awacs_write(r1 | MASK_ADDR_MUTE);
1246 }
1247 }
1248 }
1249 if (ctrl & MASK_CNTLERR) {
1250 int err = (in_le32(&awacs->codec_stat) & MASK_ERRCODE) >> 16;
1251 /* CHECK: we just swallow burgundy errors at the moment..*/
1252 if (err != 0 && awacs_revision != AWACS_BURGUNDY)
1253 printk(KERN_ERR "dmasound_pmac: error %x\n", err);
1254 }
1255 /* Writing 1s to the CNTLERR and PORTCHG bits clears them... */
1256 out_le32(&awacs->control, ctrl);
1257 spin_unlock(&dmasound.lock);
1258 return IRQ_HANDLED;
1259}
1260
1261static void
1262awacs_write(int val)
1263{
1264 int count = 300 ;
1265 if (awacs_revision >= AWACS_DACA || !awacs)
1266 return ;
1267
1268 while ((in_le32(&awacs->codec_ctrl) & MASK_NEWECMD) && count--)
1269 udelay(1) ; /* timeout is > 2 samples at lowest rate */
1270 out_le32(&awacs->codec_ctrl, val | (awacs_subframe << 22));
1271 (void)in_le32(&awacs->byteswap);
1272}
1273
1274/* this is called when the beep timer expires... it will be called even
1275 if the beep has been overidden by other sound output.
1276*/
1277static void awacs_nosound(unsigned long xx)
1278{
1279 unsigned long flags;
1280 int count = 600 ; /* > four samples at lowest rate */
1281
1282 spin_lock_irqsave(&dmasound.lock, flags);
1283 if (beep_playing) {
1284 st_le16(&beep_dbdma_cmd->command, DBDMA_STOP);
1285 out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
1286 while ((in_le32(&awacs_txdma->status) & RUN) && count--)
1287 udelay(1);
1288 if (awacs)
1289 awacs_setup_for_beep(-1);
1290 beep_playing = 0;
1291 }
1292 spin_unlock_irqrestore(&dmasound.lock, flags);
1293}
1294
1295/*
1296 * We generate the beep with a single dbdma command that loops a buffer
1297 * forever - without generating interrupts.
1298 *
1299 * So, to stop it you have to stop dma output as per awacs_nosound.
1300 */
1301static int awacs_beep_event(struct input_dev *dev, unsigned int type,
1302 unsigned int code, int hz)
1303{
1304 unsigned long flags;
1305 int beep_speed = 0;
1306 int srate;
1307 int period, ncycles, nsamples;
1308 int i, j, f;
1309 short *p;
1310 static int beep_hz_cache;
1311 static int beep_nsamples_cache;
1312 static int beep_volume_cache;
1313
1314 if (type != EV_SND)
1315 return -1;
1316 switch (code) {
1317 case SND_BELL:
1318 if (hz)
1319 hz = 1000;
1320 break;
1321 case SND_TONE:
1322 break;
1323 default:
1324 return -1;
1325 }
1326
1327 if (beep_buf == NULL)
1328 return -1;
1329
1330 /* quick-hack fix for DACA, Burgundy & Tumbler */
1331
1332 if (awacs_revision >= AWACS_DACA){
1333 srate = 44100 ;
1334 } else {
1335 for (i = 0; i < 8 && awacs_freqs[i] >= BEEP_SRATE; ++i)
1336 if (awacs_freqs_ok[i])
1337 beep_speed = i;
1338 srate = awacs_freqs[beep_speed];
1339 }
1340
1341 if (hz <= srate / BEEP_BUFLEN || hz > srate / 2) {
1342 /* cancel beep currently playing */
1343 awacs_nosound(0);
1344 return 0;
1345 }
1346
1347 spin_lock_irqsave(&dmasound.lock, flags);
1348 if (beep_playing || write_sq.active || beep_buf == NULL) {
1349 spin_unlock_irqrestore(&dmasound.lock, flags);
1350 return -1; /* too hard, sorry :-( */
1351 }
1352 beep_playing = 1;
1353 st_le16(&beep_dbdma_cmd->command, OUTPUT_MORE + BR_ALWAYS);
1354 spin_unlock_irqrestore(&dmasound.lock, flags);
1355
1356 if (hz == beep_hz_cache && beep_vol == beep_volume_cache) {
1357 nsamples = beep_nsamples_cache;
1358 } else {
1359 period = srate * 256 / hz; /* fixed point */
1360 ncycles = BEEP_BUFLEN * 256 / period;
1361 nsamples = (period * ncycles) >> 8;
1362 f = ncycles * 65536 / nsamples;
1363 j = 0;
1364 p = beep_buf;
1365 for (i = 0; i < nsamples; ++i, p += 2) {
1366 p[0] = p[1] = beep_wform[j >> 8] * beep_vol;
1367 j = (j + f) & 0xffff;
1368 }
1369 beep_hz_cache = hz;
1370 beep_volume_cache = beep_vol;
1371 beep_nsamples_cache = nsamples;
1372 }
1373
1374 st_le16(&beep_dbdma_cmd->req_count, nsamples*4);
1375 st_le16(&beep_dbdma_cmd->xfer_status, 0);
1376 st_le32(&beep_dbdma_cmd->cmd_dep, virt_to_bus(beep_dbdma_cmd));
1377 st_le32(&beep_dbdma_cmd->phy_addr, virt_to_bus(beep_buf));
1378 awacs_beep_state = 1;
1379
1380 spin_lock_irqsave(&dmasound.lock, flags);
1381 if (beep_playing) { /* i.e. haven't been terminated already */
1382 int count = 300 ;
1383 out_le32(&awacs_txdma->control, (RUN|WAKE|FLUSH|PAUSE) << 16);
1384 while ((in_le32(&awacs_txdma->status) & RUN) && count--)
1385 udelay(1); /* timeout > 2 samples at lowest rate*/
1386 if (awacs)
1387 awacs_setup_for_beep(beep_speed);
1388 out_le32(&awacs_txdma->cmdptr, virt_to_bus(beep_dbdma_cmd));
1389 (void)in_le32(&awacs_txdma->status);
1390 out_le32(&awacs_txdma->control, RUN | (RUN << 16));
1391 }
1392 spin_unlock_irqrestore(&dmasound.lock, flags);
1393
1394 return 0;
1395}
1396
1397/* used in init and for wake-up */
1398
1399static void
1400load_awacs(void)
1401{
1402 awacs_write(awacs_reg[0] + MASK_ADDR0);
1403 awacs_write(awacs_reg[1] + MASK_ADDR1);
1404 awacs_write(awacs_reg[2] + MASK_ADDR2);
1405 awacs_write(awacs_reg[4] + MASK_ADDR4);
1406
1407 if (awacs_revision == AWACS_SCREAMER) {
1408 awacs_write(awacs_reg[5] + MASK_ADDR5);
1409 msleep(100);
1410 awacs_write(awacs_reg[6] + MASK_ADDR6);
1411 msleep(2);
1412 awacs_write(awacs_reg[1] + MASK_ADDR1);
1413 awacs_write(awacs_reg[7] + MASK_ADDR7);
1414 }
1415 if (awacs) {
1416 if (hw_can_byteswap && (dmasound.hard.format == AFMT_S16_LE))
1417 out_le32(&awacs->byteswap, BS_VAL);
1418 else
1419 out_le32(&awacs->byteswap, 0);
1420 }
1421}
1422
1423#ifdef CONFIG_PM
1424/*
1425 * Save state when going to sleep, restore it afterwards.
1426 */
1427/* FIXME: sort out disabling/re-enabling of read stuff as well */
1428static void awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
1429{
1430 unsigned long flags;
1431
1432 switch (when) {
1433 case PBOOK_SLEEP_NOW:
1434 LOCK();
1435 awacs_sleeping = 1;
1436 /* Tell the rest of the driver we are now going to sleep */
1437 mb();
1438 if (awacs_revision == AWACS_SCREAMER ||
1439 awacs_revision == AWACS_AWACS) {
1440 awacs_reg1_save = awacs_reg[1];
1441 awacs_reg[1] |= MASK_AMUTE | MASK_CMUTE;
1442 awacs_write(MASK_ADDR1 | awacs_reg[1]);
1443 }
1444
1445 PMacSilence();
1446 /* stop rx - if going - a bit of a daft user... but */
1447 out_le32(&awacs_rxdma->control, (RUN|WAKE|FLUSH << 16));
1448 /* deny interrupts */
1449 if (awacs)
1450 disable_irq(awacs_irq);
1451 disable_irq(awacs_tx_irq);
1452 disable_irq(awacs_rx_irq);
1453 /* Chip specific sleep code */
1454 switch (awacs_revision) {
1455 case AWACS_TUMBLER:
1456 case AWACS_SNAPPER:
1457 write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
1458 write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
1459 tas_enter_sleep();
1460 write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
1461 break ;
1462 case AWACS_DACA:
1463 daca_enter_sleep();
1464 break ;
1465 case AWACS_BURGUNDY:
1466 break ;
1467 case AWACS_SCREAMER:
1468 case AWACS_AWACS:
1469 default:
1470 out_le32(&awacs->control, 0x11) ;
1471 break ;
1472 }
1473 /* Disable sound clock */
1474 pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, awacs_node, 0, 0);
1475 /* According to Darwin, we do that after turning off the sound
1476 * chip clock. All this will have to be cleaned up once we properly
1477 * parse the OF sound-objects
1478 */
1479 if ((machine_is_compatible("PowerBook3,1") ||
1480 machine_is_compatible("PowerBook3,2")) && awacs) {
1481 awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1;
1482 awacs_write(MASK_ADDR1 | awacs_reg[1]);
1483 msleep(200);
1484 }
1485 break;
1486 case PBOOK_WAKE:
1487 /* Enable sound clock */
1488 pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, awacs_node, 0, 1);
1489 if ((machine_is_compatible("PowerBook3,1") ||
1490 machine_is_compatible("PowerBook3,2")) && awacs) {
1491 msleep(100);
1492 awacs_reg[1] &= ~(MASK_PAROUT0 | MASK_PAROUT1);
1493 awacs_write(MASK_ADDR1 | awacs_reg[1]);
1494 msleep(300);
1495 } else
1496 msleep(1000);
1497 /* restore settings */
1498 switch (awacs_revision) {
1499 case AWACS_TUMBLER:
1500 case AWACS_SNAPPER:
1501 write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
1502 write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
1503 write_audio_gpio(gpio_audio_reset, gpio_audio_reset_pol);
1504 msleep(100);
1505 write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
1506 msleep(150);
1507 tas_leave_sleep(); /* Stub for now */
1508 headphone_intr(0, NULL);
1509 break;
1510 case AWACS_DACA:
1511 msleep(10); /* Check this !!! */
1512 daca_leave_sleep();
1513 break ; /* dont know how yet */
1514 case AWACS_BURGUNDY:
1515 break ;
1516 case AWACS_SCREAMER:
1517 case AWACS_AWACS:
1518 default:
1519 load_awacs() ;
1520 break ;
1521 }
1522 /* Recalibrate chip */
1523 if (awacs_revision == AWACS_SCREAMER && awacs)
1524 awacs_recalibrate();
1525 /* Make sure dma is stopped */
1526 PMacSilence();
1527 if (awacs)
1528 enable_irq(awacs_irq);
1529 enable_irq(awacs_tx_irq);
1530 enable_irq(awacs_rx_irq);
1531 if (awacs) {
1532 /* OK, allow ints back again */
1533 out_le32(&awacs->control, MASK_IEPC
1534 | (awacs_rate_index << 8) | 0x11
1535 | (awacs_revision < AWACS_DACA ? MASK_IEE: 0));
1536 }
1537 if (macio_base && is_pbook_g3) {
1538 /* FIXME: should restore the setup we had...*/
1539 out_8(macio_base + 0x37, 3);
1540 } else if (is_pbook_3X00) {
1541 in_8(latch_base + 0x190);
1542 }
1543 /* Remove mute */
1544 if (awacs_revision == AWACS_SCREAMER ||
1545 awacs_revision == AWACS_AWACS) {
1546 awacs_reg[1] = awacs_reg1_save;
1547 awacs_write(MASK_ADDR1 | awacs_reg[1]);
1548 }
1549 awacs_sleeping = 0;
1550 /* Resume pending sounds. */
1551 /* we don't try to restart input... */
1552 spin_lock_irqsave(&dmasound.lock, flags);
1553 __PMacPlay();
1554 spin_unlock_irqrestore(&dmasound.lock, flags);
1555 UNLOCK();
1556 }
1557}
1558#endif /* CONFIG_PM */
1559
1560
1561/* All the burgundy functions: */
1562
1563/* Waits for busy flag to clear */
1564static inline void
1565awacs_burgundy_busy_wait(void)
1566{
1567 int count = 50; /* > 2 samples at 44k1 */
1568 while ((in_le32(&awacs->codec_ctrl) & MASK_NEWECMD) && count--)
1569 udelay(1) ;
1570}
1571
1572static inline void
1573awacs_burgundy_extend_wait(void)
1574{
1575 int count = 50 ; /* > 2 samples at 44k1 */
1576 while ((!(in_le32(&awacs->codec_stat) & MASK_EXTEND)) && count--)
1577 udelay(1) ;
1578 count = 50;
1579 while ((in_le32(&awacs->codec_stat) & MASK_EXTEND) && count--)
1580 udelay(1);
1581}
1582
1583static void
1584awacs_burgundy_wcw(unsigned addr, unsigned val)
1585{
1586 out_le32(&awacs->codec_ctrl, addr + 0x200c00 + (val & 0xff));
1587 awacs_burgundy_busy_wait();
1588 out_le32(&awacs->codec_ctrl, addr + 0x200d00 +((val>>8) & 0xff));
1589 awacs_burgundy_busy_wait();
1590 out_le32(&awacs->codec_ctrl, addr + 0x200e00 +((val>>16) & 0xff));
1591 awacs_burgundy_busy_wait();
1592 out_le32(&awacs->codec_ctrl, addr + 0x200f00 +((val>>24) & 0xff));
1593 awacs_burgundy_busy_wait();
1594}
1595
1596static unsigned
1597awacs_burgundy_rcw(unsigned addr)
1598{
1599 unsigned val = 0;
1600 unsigned long flags;
1601
1602 /* should have timeouts here */
1603 spin_lock_irqsave(&dmasound.lock, flags);
1604
1605 out_le32(&awacs->codec_ctrl, addr + 0x100000);
1606 awacs_burgundy_busy_wait();
1607 awacs_burgundy_extend_wait();
1608 val += (in_le32(&awacs->codec_stat) >> 4) & 0xff;
1609
1610 out_le32(&awacs->codec_ctrl, addr + 0x100100);
1611 awacs_burgundy_busy_wait();
1612 awacs_burgundy_extend_wait();
1613 val += ((in_le32(&awacs->codec_stat)>>4) & 0xff) <<8;
1614
1615 out_le32(&awacs->codec_ctrl, addr + 0x100200);
1616 awacs_burgundy_busy_wait();
1617 awacs_burgundy_extend_wait();
1618 val += ((in_le32(&awacs->codec_stat)>>4) & 0xff) <<16;
1619
1620 out_le32(&awacs->codec_ctrl, addr + 0x100300);
1621 awacs_burgundy_busy_wait();
1622 awacs_burgundy_extend_wait();
1623 val += ((in_le32(&awacs->codec_stat)>>4) & 0xff) <<24;
1624
1625 spin_unlock_irqrestore(&dmasound.lock, flags);
1626
1627 return val;
1628}
1629
1630
1631static void
1632awacs_burgundy_wcb(unsigned addr, unsigned val)
1633{
1634 out_le32(&awacs->codec_ctrl, addr + 0x300000 + (val & 0xff));
1635 awacs_burgundy_busy_wait();
1636}
1637
1638static unsigned
1639awacs_burgundy_rcb(unsigned addr)
1640{
1641 unsigned val = 0;
1642 unsigned long flags;
1643
1644 /* should have timeouts here */
1645 spin_lock_irqsave(&dmasound.lock, flags);
1646
1647 out_le32(&awacs->codec_ctrl, addr + 0x100000);
1648 awacs_burgundy_busy_wait();
1649 awacs_burgundy_extend_wait();
1650 val += (in_le32(&awacs->codec_stat) >> 4) & 0xff;
1651
1652 spin_unlock_irqrestore(&dmasound.lock, flags);
1653
1654 return val;
1655}
1656
1657static int
1658awacs_burgundy_check(void)
1659{
1660 /* Checks to see the chip is alive and kicking */
1661 int error = in_le32(&awacs->codec_ctrl) & MASK_ERRCODE;
1662
1663 return error == 0xf0000;
1664}
1665
1666static int
1667awacs_burgundy_init(void)
1668{
1669 if (awacs_burgundy_check()) {
1670 printk(KERN_WARNING "dmasound_pmac: burgundy not working :-(\n");
1671 return 1;
1672 }
1673
1674 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_OUTPUTENABLES,
1675 DEF_BURGUNDY_OUTPUTENABLES);
1676 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
1677 DEF_BURGUNDY_MORE_OUTPUTENABLES);
1678 awacs_burgundy_wcw(MASK_ADDR_BURGUNDY_OUTPUTSELECTS,
1679 DEF_BURGUNDY_OUTPUTSELECTS);
1680
1681 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_INPSEL21,
1682 DEF_BURGUNDY_INPSEL21);
1683 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_INPSEL3,
1684 DEF_BURGUNDY_INPSEL3);
1685 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_GAINCD,
1686 DEF_BURGUNDY_GAINCD);
1687 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_GAINLINE,
1688 DEF_BURGUNDY_GAINLINE);
1689 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_GAINMIC,
1690 DEF_BURGUNDY_GAINMIC);
1691 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_GAINMODEM,
1692 DEF_BURGUNDY_GAINMODEM);
1693
1694 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_ATTENSPEAKER,
1695 DEF_BURGUNDY_ATTENSPEAKER);
1696 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_ATTENLINEOUT,
1697 DEF_BURGUNDY_ATTENLINEOUT);
1698 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_ATTENHP,
1699 DEF_BURGUNDY_ATTENHP);
1700
1701 awacs_burgundy_wcw(MASK_ADDR_BURGUNDY_MASTER_VOLUME,
1702 DEF_BURGUNDY_MASTER_VOLUME);
1703 awacs_burgundy_wcw(MASK_ADDR_BURGUNDY_VOLCD,
1704 DEF_BURGUNDY_VOLCD);
1705 awacs_burgundy_wcw(MASK_ADDR_BURGUNDY_VOLLINE,
1706 DEF_BURGUNDY_VOLLINE);
1707 awacs_burgundy_wcw(MASK_ADDR_BURGUNDY_VOLMIC,
1708 DEF_BURGUNDY_VOLMIC);
1709 return 0;
1710}
1711
1712static void
1713awacs_burgundy_write_volume(unsigned address, int volume)
1714{
1715 int hardvolume,lvolume,rvolume;
1716
1717 lvolume = (volume & 0xff) ? (volume & 0xff) + 155 : 0;
1718 rvolume = ((volume >>8)&0xff) ? ((volume >> 8)&0xff ) + 155 : 0;
1719
1720 hardvolume = lvolume + (rvolume << 16);
1721
1722 awacs_burgundy_wcw(address, hardvolume);
1723}
1724
1725static int
1726awacs_burgundy_read_volume(unsigned address)
1727{
1728 int softvolume,wvolume;
1729
1730 wvolume = awacs_burgundy_rcw(address);
1731
1732 softvolume = (wvolume & 0xff) - 155;
1733 softvolume += (((wvolume >> 16) & 0xff) - 155)<<8;
1734
1735 return softvolume > 0 ? softvolume : 0;
1736}
1737
1738static int
1739awacs_burgundy_read_mvolume(unsigned address)
1740{
1741 int lvolume,rvolume,wvolume;
1742
1743 wvolume = awacs_burgundy_rcw(address);
1744
1745 wvolume &= 0xffff;
1746
1747 rvolume = (wvolume & 0xff) - 155;
1748 lvolume = ((wvolume & 0xff00)>>8) - 155;
1749
1750 return lvolume + (rvolume << 8);
1751}
1752
1753static void
1754awacs_burgundy_write_mvolume(unsigned address, int volume)
1755{
1756 int lvolume,rvolume,hardvolume;
1757
1758 lvolume = (volume &0xff) ? (volume & 0xff) + 155 :0;
1759 rvolume = ((volume >>8) & 0xff) ? (volume >> 8) + 155 :0;
1760
1761 hardvolume = lvolume + (rvolume << 8);
1762 hardvolume += (hardvolume << 16);
1763
1764 awacs_burgundy_wcw(address, hardvolume);
1765}
1766
1767/* End burgundy functions */
1768
1769/* Set up output volumes on machines with the 'perch/whisper' extension card.
1770 * this has an SGS i2c chip (7433) which is accessed using the cuda.
1771 *
1772 * TODO: split this out and make use of the other parts of the SGS chip to
1773 * do Bass, Treble etc.
1774 */
1775
1776static void
1777awacs_enable_amp(int spkr_vol)
1778{
1779#ifdef CONFIG_ADB_CUDA
1780 struct adb_request req;
1781
1782 if (sys_ctrler != SYS_CTRLER_CUDA)
1783 return;
1784
1785 /* turn on headphones */
1786 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC,
1787 0x8a, 4, 0);
1788 while (!req.complete) cuda_poll();
1789 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC,
1790 0x8a, 6, 0);
1791 while (!req.complete) cuda_poll();
1792
1793 /* turn on speaker */
1794 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC,
1795 0x8a, 3, (100 - (spkr_vol & 0xff)) * 32 / 100);
1796 while (!req.complete) cuda_poll();
1797 cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_GET_SET_IIC,
1798 0x8a, 5, (100 - ((spkr_vol >> 8) & 0xff)) * 32 / 100);
1799 while (!req.complete) cuda_poll();
1800
1801 cuda_request(&req, NULL, 5, CUDA_PACKET,
1802 CUDA_GET_SET_IIC, 0x8a, 1, 0x29);
1803 while (!req.complete) cuda_poll();
1804#endif /* CONFIG_ADB_CUDA */
1805}
1806
1807
1808/*** Mid level stuff *********************************************************/
1809
1810
1811/*
1812 * /dev/mixer abstraction
1813 */
1814
1815static void do_line_lev(int data)
1816{
1817 line_lev = data ;
1818 awacs_reg[0] &= ~MASK_MUX_AUDIN;
1819 if ((data & 0xff) >= 50)
1820 awacs_reg[0] |= MASK_MUX_AUDIN;
1821 awacs_write(MASK_ADDR0 | awacs_reg[0]);
1822}
1823
1824static void do_ip_gain(int data)
1825{
1826 ip_gain = data ;
1827 data &= 0xff;
1828 awacs_reg[0] &= ~MASK_GAINLINE;
1829 if (awacs_revision == AWACS_SCREAMER) {
1830 awacs_reg[6] &= ~MASK_MIC_BOOST ;
1831 if (data >= 33) {
1832 awacs_reg[0] |= MASK_GAINLINE;
1833 if( data >= 66)
1834 awacs_reg[6] |= MASK_MIC_BOOST ;
1835 }
1836 awacs_write(MASK_ADDR6 | awacs_reg[6]) ;
1837 } else {
1838 if (data >= 50)
1839 awacs_reg[0] |= MASK_GAINLINE;
1840 }
1841 awacs_write(MASK_ADDR0 | awacs_reg[0]);
1842}
1843
1844static void do_mic_lev(int data)
1845{
1846 mic_lev = data ;
1847 data &= 0xff;
1848 awacs_reg[0] &= ~MASK_MUX_MIC;
1849 if (data >= 50)
1850 awacs_reg[0] |= MASK_MUX_MIC;
1851 awacs_write(MASK_ADDR0 | awacs_reg[0]);
1852}
1853
1854static void do_cd_lev(int data)
1855{
1856 cd_lev = data ;
1857 awacs_reg[0] &= ~MASK_MUX_CD;
1858 if ((data & 0xff) >= 50)
1859 awacs_reg[0] |= MASK_MUX_CD;
1860 awacs_write(MASK_ADDR0 | awacs_reg[0]);
1861}
1862
1863static void do_rec_lev(int data)
1864{
1865 int left, right ;
1866 rec_lev = data ;
1867 /* need to fudge this to use the volume setter routine */
1868 left = 100 - (data & 0xff) ; if( left < 0 ) left = 0 ;
1869 right = 100 - ((data >> 8) & 0xff) ; if( right < 0 ) right = 0 ;
1870 left |= (right << 8 );
1871 left = awacs_volume_setter(left, 0, 0, 4);
1872}
1873
1874static void do_passthru_vol(int data)
1875{
1876 passthru_vol = data ;
1877 awacs_reg[1] &= ~MASK_LOOPTHRU;
1878 if (awacs_revision == AWACS_SCREAMER) {
1879 if( data ) { /* switch it on for non-zero */
1880 awacs_reg[1] |= MASK_LOOPTHRU;
1881 awacs_write(MASK_ADDR1 | awacs_reg[1]);
1882 }
1883 data = awacs_volume_setter(data, 5, 0, 6) ;
1884 } else {
1885 if ((data & 0xff) >= 50)
1886 awacs_reg[1] |= MASK_LOOPTHRU;
1887 awacs_write(MASK_ADDR1 | awacs_reg[1]);
1888 data = (awacs_reg[1] & MASK_LOOPTHRU)? 100: 0;
1889 }
1890}
1891
1892static int awacs_mixer_ioctl(u_int cmd, u_long arg)
1893{
1894 int data;
1895 int rc;
1896
1897 switch (cmd) {
1898 case SOUND_MIXER_READ_CAPS:
1899 /* say we will allow multiple inputs? prob. wrong
1900 so I'm switching it to single */
1901 return IOCTL_OUT(arg, 1);
1902 case SOUND_MIXER_READ_DEVMASK:
1903 data = SOUND_MASK_VOLUME | SOUND_MASK_SPEAKER
1904 | SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD
1905 | SOUND_MASK_IGAIN | SOUND_MASK_RECLEV
1906 | SOUND_MASK_ALTPCM
1907 | SOUND_MASK_MONITOR;
1908 rc = IOCTL_OUT(arg, data);
1909 break;
1910 case SOUND_MIXER_READ_RECMASK:
1911 data = SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD;
1912 rc = IOCTL_OUT(arg, data);
1913 break;
1914 case SOUND_MIXER_READ_RECSRC:
1915 data = 0;
1916 if (awacs_reg[0] & MASK_MUX_AUDIN)
1917 data |= SOUND_MASK_LINE;
1918 if (awacs_reg[0] & MASK_MUX_MIC)
1919 data |= SOUND_MASK_MIC;
1920 if (awacs_reg[0] & MASK_MUX_CD)
1921 data |= SOUND_MASK_CD;
1922 rc = IOCTL_OUT(arg, data);
1923 break;
1924 case SOUND_MIXER_WRITE_RECSRC:
1925 IOCTL_IN(arg, data);
1926 data &= (SOUND_MASK_LINE | SOUND_MASK_MIC | SOUND_MASK_CD);
1927 awacs_reg[0] &= ~(MASK_MUX_CD | MASK_MUX_MIC
1928 | MASK_MUX_AUDIN);
1929 if (data & SOUND_MASK_LINE)
1930 awacs_reg[0] |= MASK_MUX_AUDIN;
1931 if (data & SOUND_MASK_MIC)
1932 awacs_reg[0] |= MASK_MUX_MIC;
1933 if (data & SOUND_MASK_CD)
1934 awacs_reg[0] |= MASK_MUX_CD;
1935 awacs_write(awacs_reg[0] | MASK_ADDR0);
1936 rc = IOCTL_OUT(arg, data);
1937 break;
1938 case SOUND_MIXER_READ_STEREODEVS:
1939 data = SOUND_MASK_VOLUME | SOUND_MASK_SPEAKER| SOUND_MASK_RECLEV ;
1940 if (awacs_revision == AWACS_SCREAMER)
1941 data |= SOUND_MASK_MONITOR ;
1942 rc = IOCTL_OUT(arg, data);
1943 break;
1944 case SOUND_MIXER_WRITE_VOLUME:
1945 IOCTL_IN(arg, data);
1946 line_vol = data ;
1947 awacs_volume_setter(data, 2, 0, 6);
1948 /* fall through */
1949 case SOUND_MIXER_READ_VOLUME:
1950 rc = IOCTL_OUT(arg, line_vol);
1951 break;
1952 case SOUND_MIXER_WRITE_SPEAKER:
1953 IOCTL_IN(arg, data);
1954 spk_vol = data ;
1955 if (has_perch)
1956 awacs_enable_amp(data);
1957 else
1958 (void)awacs_volume_setter(data, 4, MASK_CMUTE, 6);
1959 /* fall though */
1960 case SOUND_MIXER_READ_SPEAKER:
1961 rc = IOCTL_OUT(arg, spk_vol);
1962 break;
1963 case SOUND_MIXER_WRITE_ALTPCM: /* really bell volume */
1964 IOCTL_IN(arg, data);
1965 beep_vol = data & 0xff;
1966 /* fall through */
1967 case SOUND_MIXER_READ_ALTPCM:
1968 rc = IOCTL_OUT(arg, beep_vol);
1969 break;
1970 case SOUND_MIXER_WRITE_LINE:
1971 IOCTL_IN(arg, data);
1972 do_line_lev(data) ;
1973 /* fall through */
1974 case SOUND_MIXER_READ_LINE:
1975 rc = IOCTL_OUT(arg, line_lev);
1976 break;
1977 case SOUND_MIXER_WRITE_IGAIN:
1978 IOCTL_IN(arg, data);
1979 do_ip_gain(data) ;
1980 /* fall through */
1981 case SOUND_MIXER_READ_IGAIN:
1982 rc = IOCTL_OUT(arg, ip_gain);
1983 break;
1984 case SOUND_MIXER_WRITE_MIC:
1985 IOCTL_IN(arg, data);
1986 do_mic_lev(data);
1987 /* fall through */
1988 case SOUND_MIXER_READ_MIC:
1989 rc = IOCTL_OUT(arg, mic_lev);
1990 break;
1991 case SOUND_MIXER_WRITE_CD:
1992 IOCTL_IN(arg, data);
1993 do_cd_lev(data);
1994 /* fall through */
1995 case SOUND_MIXER_READ_CD:
1996 rc = IOCTL_OUT(arg, cd_lev);
1997 break;
1998 case SOUND_MIXER_WRITE_RECLEV:
1999 IOCTL_IN(arg, data);
2000 do_rec_lev(data) ;
2001 /* fall through */
2002 case SOUND_MIXER_READ_RECLEV:
2003 rc = IOCTL_OUT(arg, rec_lev);
2004 break;
2005 case MIXER_WRITE(SOUND_MIXER_MONITOR):
2006 IOCTL_IN(arg, data);
2007 do_passthru_vol(data) ;
2008 /* fall through */
2009 case MIXER_READ(SOUND_MIXER_MONITOR):
2010 rc = IOCTL_OUT(arg, passthru_vol);
2011 break;
2012 default:
2013 rc = -EINVAL;
2014 }
2015
2016 return rc;
2017}
2018
2019static void awacs_mixer_init(void)
2020{
2021 awacs_volume_setter(line_vol, 2, 0, 6);
2022 if (has_perch)
2023 awacs_enable_amp(spk_vol);
2024 else
2025 (void)awacs_volume_setter(spk_vol, 4, MASK_CMUTE, 6);
2026 do_line_lev(line_lev) ;
2027 do_ip_gain(ip_gain) ;
2028 do_mic_lev(mic_lev) ;
2029 do_cd_lev(cd_lev) ;
2030 do_rec_lev(rec_lev) ;
2031 do_passthru_vol(passthru_vol) ;
2032}
2033
2034static int burgundy_mixer_ioctl(u_int cmd, u_long arg)
2035{
2036 int data;
2037 int rc;
2038
2039 /* We are, we are, we are... Burgundy or better */
2040 switch(cmd) {
2041 case SOUND_MIXER_READ_DEVMASK:
2042 data = SOUND_MASK_VOLUME | SOUND_MASK_CD |
2043 SOUND_MASK_LINE | SOUND_MASK_MIC |
2044 SOUND_MASK_SPEAKER | SOUND_MASK_ALTPCM;
2045 rc = IOCTL_OUT(arg, data);
2046 break;
2047 case SOUND_MIXER_READ_RECMASK:
2048 data = SOUND_MASK_LINE | SOUND_MASK_MIC
2049 | SOUND_MASK_CD;
2050 rc = IOCTL_OUT(arg, data);
2051 break;
2052 case SOUND_MIXER_READ_RECSRC:
2053 data = 0;
2054 if (awacs_reg[0] & MASK_MUX_AUDIN)
2055 data |= SOUND_MASK_LINE;
2056 if (awacs_reg[0] & MASK_MUX_MIC)
2057 data |= SOUND_MASK_MIC;
2058 if (awacs_reg[0] & MASK_MUX_CD)
2059 data |= SOUND_MASK_CD;
2060 rc = IOCTL_OUT(arg, data);
2061 break;
2062 case SOUND_MIXER_WRITE_RECSRC:
2063 IOCTL_IN(arg, data);
2064 data &= (SOUND_MASK_LINE
2065 | SOUND_MASK_MIC | SOUND_MASK_CD);
2066 awacs_reg[0] &= ~(MASK_MUX_CD | MASK_MUX_MIC
2067 | MASK_MUX_AUDIN);
2068 if (data & SOUND_MASK_LINE)
2069 awacs_reg[0] |= MASK_MUX_AUDIN;
2070 if (data & SOUND_MASK_MIC)
2071 awacs_reg[0] |= MASK_MUX_MIC;
2072 if (data & SOUND_MASK_CD)
2073 awacs_reg[0] |= MASK_MUX_CD;
2074 awacs_write(awacs_reg[0] | MASK_ADDR0);
2075 rc = IOCTL_OUT(arg, data);
2076 break;
2077 case SOUND_MIXER_READ_STEREODEVS:
2078 data = SOUND_MASK_VOLUME | SOUND_MASK_SPEAKER
2079 | SOUND_MASK_RECLEV | SOUND_MASK_CD
2080 | SOUND_MASK_LINE;
2081 rc = IOCTL_OUT(arg, data);
2082 break;
2083 case SOUND_MIXER_READ_CAPS:
2084 rc = IOCTL_OUT(arg, 0);
2085 break;
2086 case SOUND_MIXER_WRITE_VOLUME:
2087 IOCTL_IN(arg, data);
2088 awacs_burgundy_write_mvolume(MASK_ADDR_BURGUNDY_MASTER_VOLUME, data);
2089 /* Fall through */
2090 case SOUND_MIXER_READ_VOLUME:
2091 rc = IOCTL_OUT(arg, awacs_burgundy_read_mvolume(MASK_ADDR_BURGUNDY_MASTER_VOLUME));
2092 break;
2093 case SOUND_MIXER_WRITE_SPEAKER:
2094 IOCTL_IN(arg, data);
2095 if (!(data & 0xff)) {
2096 /* Mute the left speaker */
2097 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
2098 awacs_burgundy_rcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES) & ~0x2);
2099 } else {
2100 /* Unmute the left speaker */
2101 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
2102 awacs_burgundy_rcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES) | 0x2);
2103 }
2104 if (!(data & 0xff00)) {
2105 /* Mute the right speaker */
2106 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
2107 awacs_burgundy_rcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES) & ~0x4);
2108 } else {
2109 /* Unmute the right speaker */
2110 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
2111 awacs_burgundy_rcb(MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES) | 0x4);
2112 }
2113
2114 data = (((data&0xff)*16)/100 > 0xf ? 0xf :
2115 (((data&0xff)*16)/100)) +
2116 ((((data>>8)*16)/100 > 0xf ? 0xf :
2117 ((((data>>8)*16)/100)))<<4);
2118
2119 awacs_burgundy_wcb(MASK_ADDR_BURGUNDY_ATTENSPEAKER, ~data);
2120 /* Fall through */
2121 case SOUND_MIXER_READ_SPEAKER:
2122 data = awacs_burgundy_rcb(MASK_ADDR_BURGUNDY_ATTENSPEAKER);
2123 data = (((data & 0xf)*100)/16) + ((((data>>4)*100)/16)<<8);
2124 rc = IOCTL_OUT(arg, (~data) & 0x0000ffff);
2125 break;
2126 case SOUND_MIXER_WRITE_ALTPCM: /* really bell volume */
2127 IOCTL_IN(arg, data);
2128 beep_vol = data & 0xff;
2129 /* fall through */
2130 case SOUND_MIXER_READ_ALTPCM:
2131 rc = IOCTL_OUT(arg, beep_vol);
2132 break;
2133 case SOUND_MIXER_WRITE_LINE:
2134 IOCTL_IN(arg, data);
2135 awacs_burgundy_write_volume(MASK_ADDR_BURGUNDY_VOLLINE, data);
2136
2137 /* fall through */
2138 case SOUND_MIXER_READ_LINE:
2139 data = awacs_burgundy_read_volume(MASK_ADDR_BURGUNDY_VOLLINE);
2140 rc = IOCTL_OUT(arg, data);
2141 break;
2142 case SOUND_MIXER_WRITE_MIC:
2143 IOCTL_IN(arg, data);
2144 /* Mic is mono device */
2145 data = (data << 8) + (data << 24);
2146 awacs_burgundy_write_volume(MASK_ADDR_BURGUNDY_VOLMIC, data);
2147 /* fall through */
2148 case SOUND_MIXER_READ_MIC:
2149 data = awacs_burgundy_read_volume(MASK_ADDR_BURGUNDY_VOLMIC);
2150 data <<= 24;
2151 rc = IOCTL_OUT(arg, data);
2152 break;
2153 case SOUND_MIXER_WRITE_CD:
2154 IOCTL_IN(arg, data);
2155 awacs_burgundy_write_volume(MASK_ADDR_BURGUNDY_VOLCD, data);
2156 /* fall through */
2157 case SOUND_MIXER_READ_CD:
2158 data = awacs_burgundy_read_volume(MASK_ADDR_BURGUNDY_VOLCD);
2159 rc = IOCTL_OUT(arg, data);
2160 break;
2161 case SOUND_MIXER_WRITE_RECLEV:
2162 IOCTL_IN(arg, data);
2163 data = awacs_volume_setter(data, 0, 0, 4);
2164 rc = IOCTL_OUT(arg, data);
2165 break;
2166 case SOUND_MIXER_READ_RECLEV:
2167 data = awacs_get_volume(awacs_reg[0], 4);
2168 rc = IOCTL_OUT(arg, data);
2169 break;
2170 case SOUND_MIXER_OUTMASK:
2171 case SOUND_MIXER_OUTSRC:
2172 default:
2173 rc = -EINVAL;
2174 }
2175
2176 return rc;
2177}
2178
2179static int daca_mixer_ioctl(u_int cmd, u_long arg)
2180{
2181 int data;
2182 int rc;
2183
2184 /* And the DACA's no genius either! */
2185
2186 switch(cmd) {
2187 case SOUND_MIXER_READ_DEVMASK:
2188 data = SOUND_MASK_VOLUME;
2189 rc = IOCTL_OUT(arg, data);
2190 break;
2191 case SOUND_MIXER_READ_RECMASK:
2192 data = 0;
2193 rc = IOCTL_OUT(arg, data);
2194 break;
2195 case SOUND_MIXER_READ_RECSRC:
2196 data = 0;
2197 rc = IOCTL_OUT(arg, data);
2198 break;
2199 case SOUND_MIXER_WRITE_RECSRC:
2200 IOCTL_IN(arg, data);
2201 data =0;
2202 rc = IOCTL_OUT(arg, data);
2203 break;
2204 case SOUND_MIXER_READ_STEREODEVS:
2205 data = SOUND_MASK_VOLUME;
2206 rc = IOCTL_OUT(arg, data);
2207 break;
2208 case SOUND_MIXER_READ_CAPS:
2209 rc = IOCTL_OUT(arg, 0);
2210 break;
2211 case SOUND_MIXER_WRITE_VOLUME:
2212 IOCTL_IN(arg, data);
2213 daca_set_volume(data, data);
2214 /* Fall through */
2215 case SOUND_MIXER_READ_VOLUME:
2216 daca_get_volume(& data, &data);
2217 rc = IOCTL_OUT(arg, data);
2218 break;
2219 case SOUND_MIXER_OUTMASK:
2220 case SOUND_MIXER_OUTSRC:
2221 default:
2222 rc = -EINVAL;
2223 }
2224 return rc;
2225}
2226
2227static int PMacMixerIoctl(u_int cmd, u_long arg)
2228{
2229 int rc;
2230
2231 /* Different IOCTLS for burgundy and, eventually, DACA & Tumbler */
2232
2233 TRY_LOCK();
2234
2235 switch (awacs_revision){
2236 case AWACS_BURGUNDY:
2237 rc = burgundy_mixer_ioctl(cmd, arg);
2238 break ;
2239 case AWACS_DACA:
2240 rc = daca_mixer_ioctl(cmd, arg);
2241 break;
2242 case AWACS_TUMBLER:
2243 case AWACS_SNAPPER:
2244 rc = tas_mixer_ioctl(cmd, arg);
2245 break ;
2246 default: /* ;-)) */
2247 rc = awacs_mixer_ioctl(cmd, arg);
2248 }
2249
2250 UNLOCK();
2251
2252 return rc;
2253}
2254
2255static void PMacMixerInit(void)
2256{
2257 switch (awacs_revision) {
2258 case AWACS_TUMBLER:
2259 printk("AE-Init tumbler mixer\n");
2260 break ;
2261 case AWACS_SNAPPER:
2262 printk("AE-Init snapper mixer\n");
2263 break ;
2264 case AWACS_DACA:
2265 case AWACS_BURGUNDY:
2266 break ; /* don't know yet */
2267 case AWACS_AWACS:
2268 case AWACS_SCREAMER:
2269 default:
2270 awacs_mixer_init() ;
2271 break ;
2272 }
2273}
2274
2275/* Write/Read sq setup functions:
2276 Check to see if we have enough (or any) dbdma cmd buffers for the
2277 user's fragment settings. If not, allocate some. If this fails we will
2278 point at the beep buffer - as an emergency provision - to stop dma tromping
2279 on some random bit of memory (if someone lets it go anyway).
2280 The command buffers are then set up to point to the fragment buffers
2281 (allocated elsewhere). We need n+1 commands the last of which holds
2282 a NOP + loop to start.
2283*/
2284
2285static int PMacWriteSqSetup(void)
2286{
2287 int i, count = 600 ;
2288 volatile struct dbdma_cmd *cp;
2289
2290 LOCK();
2291
2292 /* stop the controller from doing any output - if it isn't already.
2293 it _should_ be before this is called anyway */
2294
2295 out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
2296 while ((in_le32(&awacs_txdma->status) & RUN) && count--)
2297 udelay(1);
2298#ifdef DEBUG_DMASOUND
2299if (count <= 0)
2300 printk("dmasound_pmac: write sq setup: timeout waiting for dma to stop\n");
2301#endif
2302
2303 if ((write_sq.max_count + 1) > number_of_tx_cmd_buffers) {
2304 kfree(awacs_tx_cmd_space);
2305 number_of_tx_cmd_buffers = 0;
2306
2307 /* we need nbufs + 1 (for the loop) and we should request + 1
2308 again because the DBDMA_ALIGN might pull the start up by up
2309 to sizeof(struct dbdma_cmd) - 4.
2310 */
2311
2312 awacs_tx_cmd_space = kmalloc
2313 ((write_sq.max_count + 1 + 1) * sizeof(struct dbdma_cmd),
2314 GFP_KERNEL);
2315 if (awacs_tx_cmd_space == NULL) {
2316 /* don't leave it dangling - nasty but better than a
2317 random address */
2318 out_le32(&awacs_txdma->cmdptr, virt_to_bus(beep_dbdma_cmd));
2319 printk(KERN_ERR
2320 "dmasound_pmac: can't allocate dbdma cmd buffers"
2321 ", driver disabled\n");
2322 UNLOCK();
2323 return -ENOMEM;
2324 }
2325 awacs_tx_cmds = (volatile struct dbdma_cmd *)
2326 DBDMA_ALIGN(awacs_tx_cmd_space);
2327 number_of_tx_cmd_buffers = write_sq.max_count + 1;
2328 }
2329
2330 cp = awacs_tx_cmds;
2331 memset((void *)cp, 0, (write_sq.max_count+1) * sizeof(struct dbdma_cmd));
2332 for (i = 0; i < write_sq.max_count; ++i, ++cp) {
2333 st_le32(&cp->phy_addr, virt_to_bus(write_sq.buffers[i]));
2334 }
2335 st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS);
2336 st_le32(&cp->cmd_dep, virt_to_bus(awacs_tx_cmds));
2337 /* point the controller at the command stack - ready to go */
2338 out_le32(&awacs_txdma->cmdptr, virt_to_bus(awacs_tx_cmds));
2339 UNLOCK();
2340 return 0;
2341}
2342
2343static int PMacReadSqSetup(void)
2344{
2345 int i, count = 600;
2346 volatile struct dbdma_cmd *cp;
2347
2348 LOCK();
2349
2350 /* stop the controller from doing any input - if it isn't already.
2351 it _should_ be before this is called anyway */
2352
2353 out_le32(&awacs_rxdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
2354 while ((in_le32(&awacs_rxdma->status) & RUN) && count--)
2355 udelay(1);
2356#ifdef DEBUG_DMASOUND
2357if (count <= 0)
2358 printk("dmasound_pmac: read sq setup: timeout waiting for dma to stop\n");
2359#endif
2360
2361 if ((read_sq.max_count+1) > number_of_rx_cmd_buffers ) {
2362 kfree(awacs_rx_cmd_space);
2363 number_of_rx_cmd_buffers = 0;
2364
2365 /* we need nbufs + 1 (for the loop) and we should request + 1 again
2366 because the DBDMA_ALIGN might pull the start up by up to
2367 sizeof(struct dbdma_cmd) - 4 (assuming kmalloc aligns 32 bits).
2368 */
2369
2370 awacs_rx_cmd_space = kmalloc
2371 ((read_sq.max_count + 1 + 1) * sizeof(struct dbdma_cmd),
2372 GFP_KERNEL);
2373 if (awacs_rx_cmd_space == NULL) {
2374 /* don't leave it dangling - nasty but better than a
2375 random address */
2376 out_le32(&awacs_rxdma->cmdptr, virt_to_bus(beep_dbdma_cmd));
2377 printk(KERN_ERR
2378 "dmasound_pmac: can't allocate dbdma cmd buffers"
2379 ", driver disabled\n");
2380 UNLOCK();
2381 return -ENOMEM;
2382 }
2383 awacs_rx_cmds = (volatile struct dbdma_cmd *)
2384 DBDMA_ALIGN(awacs_rx_cmd_space);
2385 number_of_rx_cmd_buffers = read_sq.max_count + 1 ;
2386 }
2387 cp = awacs_rx_cmds;
2388 memset((void *)cp, 0, (read_sq.max_count+1) * sizeof(struct dbdma_cmd));
2389
2390 /* Set dma buffers up in a loop */
2391 for (i = 0; i < read_sq.max_count; i++,cp++) {
2392 st_le32(&cp->phy_addr, virt_to_bus(read_sq.buffers[i]));
2393 st_le16(&cp->command, INPUT_MORE + INTR_ALWAYS);
2394 st_le16(&cp->req_count, read_sq.block_size);
2395 st_le16(&cp->xfer_status, 0);
2396 }
2397
2398 /* The next two lines make the thing loop around.
2399 */
2400 st_le16(&cp->command, DBDMA_NOP + BR_ALWAYS);
2401 st_le32(&cp->cmd_dep, virt_to_bus(awacs_rx_cmds));
2402 /* point the controller at the command stack - ready to go */
2403 out_le32(&awacs_rxdma->cmdptr, virt_to_bus(awacs_rx_cmds));
2404
2405 UNLOCK();
2406 return 0;
2407}
2408
2409/* TODO: this needs work to guarantee that when it returns DMA has stopped
2410 but in a more elegant way than is done here....
2411*/
2412
2413static void PMacAbortRead(void)
2414{
2415 int i;
2416 volatile struct dbdma_cmd *cp;
2417
2418 LOCK();
2419 /* give it a chance to update the output and provide the IRQ
2420 that is expected.
2421 */
2422
2423 out_le32(&awacs_rxdma->control, ((FLUSH) << 16) + FLUSH );
2424
2425 cp = awacs_rx_cmds;
2426 for (i = 0; i < read_sq.max_count; i++,cp++)
2427 st_le16(&cp->command, DBDMA_STOP);
2428 /*
2429 * We should probably wait for the thing to stop before we
2430 * release the memory.
2431 */
2432
2433 msleep(100) ; /* give it a (small) chance to act */
2434
2435 /* apply the sledgehammer approach - just stop it now */
2436
2437 out_le32(&awacs_rxdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
2438 UNLOCK();
2439}
2440
2441extern char *get_afmt_string(int);
2442static int PMacStateInfo(char *b, size_t sp)
2443{
2444 int i, len = 0;
2445 len = sprintf(b,"HW rates: ");
2446 switch (awacs_revision){
2447 case AWACS_DACA:
2448 case AWACS_BURGUNDY:
2449 len += sprintf(b,"44100 ") ;
2450 break ;
2451 case AWACS_TUMBLER:
2452 case AWACS_SNAPPER:
2453 for (i=0; i<1; i++){
2454 if (tas_freqs_ok[i])
2455 len += sprintf(b+len,"%d ", tas_freqs[i]) ;
2456 }
2457 break ;
2458 case AWACS_AWACS:
2459 case AWACS_SCREAMER:
2460 default:
2461 for (i=0; i<8; i++){
2462 if (awacs_freqs_ok[i])
2463 len += sprintf(b+len,"%d ", awacs_freqs[i]) ;
2464 }
2465 break ;
2466 }
2467 len += sprintf(b+len,"s/sec\n") ;
2468 if (len < sp) {
2469 len += sprintf(b+len,"HW AFMTS: ");
2470 i = AFMT_U16_BE ;
2471 while (i) {
2472 if (i & dmasound.mach.hardware_afmts)
2473 len += sprintf(b+len,"%s ",
2474 get_afmt_string(i & dmasound.mach.hardware_afmts));
2475 i >>= 1 ;
2476 }
2477 len += sprintf(b+len,"\n") ;
2478 }
2479 return len ;
2480}
2481
2482/*** Machine definitions *****************************************************/
2483
2484static SETTINGS def_hard = {
2485 .format = AFMT_S16_BE,
2486 .stereo = 1,
2487 .size = 16,
2488 .speed = 44100
2489} ;
2490
2491static SETTINGS def_soft = {
2492 .format = AFMT_S16_BE,
2493 .stereo = 1,
2494 .size = 16,
2495 .speed = 44100
2496} ;
2497
2498static MACHINE machPMac = {
2499 .name = awacs_name,
2500 .name2 = "PowerMac Built-in Sound",
2501 .owner = THIS_MODULE,
2502 .dma_alloc = PMacAlloc,
2503 .dma_free = PMacFree,
2504 .irqinit = PMacIrqInit,
2505#ifdef MODULE
2506 .irqcleanup = PMacIrqCleanup,
2507#endif /* MODULE */
2508 .init = PMacInit,
2509 .silence = PMacSilence,
2510 .setFormat = PMacSetFormat,
2511 .setVolume = PMacSetVolume,
2512 .play = PMacPlay,
2513 .record = NULL, /* default to no record */
2514 .mixer_init = PMacMixerInit,
2515 .mixer_ioctl = PMacMixerIoctl,
2516 .write_sq_setup = PMacWriteSqSetup,
2517 .read_sq_setup = PMacReadSqSetup,
2518 .state_info = PMacStateInfo,
2519 .abort_read = PMacAbortRead,
2520 .min_dsp_speed = 7350,
2521 .max_dsp_speed = 44100,
2522 .version = ((DMASOUND_AWACS_REVISION<<8) + DMASOUND_AWACS_EDITION)
2523};
2524
2525
2526/*** Config & Setup **********************************************************/
2527
2528/* Check for pmac models that we care about in terms of special actions.
2529*/
2530
2531void __init
2532set_model(void)
2533{
2534 /* portables/lap-tops */
2535
2536 if (machine_is_compatible("AAPL,3400/2400") ||
2537 machine_is_compatible("AAPL,3500")) {
2538 is_pbook_3X00 = 1 ;
2539 }
2540 if (machine_is_compatible("PowerBook1,1") || /* lombard */
2541 machine_is_compatible("AAPL,PowerBook1998")){ /* wallstreet */
2542 is_pbook_g3 = 1 ;
2543 return ;
2544 }
2545}
2546
2547/* Get the OF node that tells us about the registers, interrupts etc. to use
2548 for sound IO.
2549
2550 On most machines the sound IO OF node is the 'davbus' node. On newer pmacs
2551 with DACA (& Tumbler) the node to use is i2s-a. On much older machines i.e.
2552 before 9500 there is no davbus node and we have to use the 'awacs' property.
2553
2554 In the latter case we signal this by setting the codec value - so that the
2555 code that looks for chip properties knows how to go about it.
2556*/
2557
2558static struct device_node* __init
2559get_snd_io_node(void)
2560{
2561 struct device_node *np;
2562
2563 /* set up awacs_node for early OF which doesn't have a full set of
2564 * properties on davbus
2565 */
2566 awacs_node = of_find_node_by_name(NULL, "awacs");
2567 if (awacs_node)
2568 awacs_revision = AWACS_AWACS;
2569
2570 /* powermac models after 9500 (other than those which use DACA or
2571 * Tumbler) have a node called "davbus".
2572 */
2573 np = of_find_node_by_name(NULL, "davbus");
2574 /*
2575 * if we didn't find a davbus device, try 'i2s-a' since
2576 * this seems to be what iBooks (& Tumbler) have.
2577 */
2578 if (np == NULL) {
2579 i2s_node = of_find_node_by_name(NULL, "i2s-a");
2580 np = of_node_get(i2s_node);
2581 }
2582
2583 /* if we didn't find this - perhaps we are on an early model
2584 * which _only_ has an 'awacs' node
2585 */
2586 if (np == NULL && awacs_node)
2587 np = of_node_get(awacs_node);
2588
2589 /* if we failed all these return null - this will cause the
2590 * driver to give up...
2591 */
2592 return np ;
2593}
2594
2595/* Get the OF node that contains the info about the sound chip, inputs s-rates
2596 etc.
2597 This node does not exist (or contains much reduced info) on earlier machines
2598 we have to deduce the info other ways for these.
2599*/
2600
2601static struct device_node* __init
2602get_snd_info_node(struct device_node *io)
2603{
2604 struct device_node *info;
2605
2606 for_each_node_by_name(info, "sound")
2607 if (info->parent == io)
2608 break;
2609 return info;
2610}
2611
2612/* Find out what type of codec we have.
2613*/
2614
2615static int __init
2616get_codec_type(struct device_node *info)
2617{
2618 /* already set if pre-davbus model and info will be NULL */
2619 int codec = awacs_revision ;
2620
2621 if (info) {
2622 /* must do awacs first to allow screamer to overide it */
2623 if (of_device_is_compatible(info, "awacs"))
2624 codec = AWACS_AWACS ;
2625 if (of_device_is_compatible(info, "screamer"))
2626 codec = AWACS_SCREAMER;
2627 if (of_device_is_compatible(info, "burgundy"))
2628 codec = AWACS_BURGUNDY ;
2629 if (of_device_is_compatible(info, "daca"))
2630 codec = AWACS_DACA;
2631 if (of_device_is_compatible(info, "tumbler"))
2632 codec = AWACS_TUMBLER;
2633 if (of_device_is_compatible(info, "snapper"))
2634 codec = AWACS_SNAPPER;
2635 }
2636 return codec ;
2637}
2638
2639/* find out what type, if any, of expansion card we have
2640*/
2641static void __init
2642get_expansion_type(void)
2643{
2644 struct device_node *dn;
2645
2646 dn = of_find_node_by_name(NULL, "perch");
2647 if (dn != NULL)
2648 has_perch = 1;
2649 of_node_put(dn);
2650
2651 dn = of_find_node_by_name(NULL, "pb-ziva-pc");
2652 if (dn != NULL)
2653 has_ziva = 1;
2654 of_node_put(dn);
2655 /* need to work out how we deal with iMac SRS module */
2656}
2657
2658/* set up frame rates.
2659 * I suspect that these routines don't quite go about it the right way:
2660 * - where there is more than one rate - I think that the first property
2661 * value is the number of rates.
2662 * TODO: check some more device trees and modify accordingly
2663 * Set dmasound.mach.max_dsp_rate on the basis of these routines.
2664*/
2665
2666static void __init
2667awacs_init_frame_rates(const unsigned int *prop, unsigned int l)
2668{
2669 int i ;
2670 if (prop) {
2671 for (i=0; i<8; i++)
2672 awacs_freqs_ok[i] = 0 ;
2673 for (l /= sizeof(int); l > 0; --l) {
2674 unsigned int r = *prop++;
2675 /* Apple 'Fixed' format */
2676 if (r >= 0x10000)
2677 r >>= 16;
2678 for (i = 0; i < 8; ++i) {
2679 if (r == awacs_freqs[i]) {
2680 awacs_freqs_ok[i] = 1;
2681 break;
2682 }
2683 }
2684 }
2685 }
2686 /* else we assume that all the rates are available */
2687}
2688
2689static void __init
2690burgundy_init_frame_rates(const unsigned int *prop, unsigned int l)
2691{
2692 int temp[9] ;
2693 int i = 0 ;
2694 if (prop) {
2695 for (l /= sizeof(int); l > 0; --l) {
2696 unsigned int r = *prop++;
2697 /* Apple 'Fixed' format */
2698 if (r >= 0x10000)
2699 r >>= 16;
2700 temp[i] = r ;
2701 i++ ; if(i>=9) i=8;
2702 }
2703 }
2704#ifdef DEBUG_DMASOUND
2705if (i > 1){
2706 int j;
2707 printk("dmasound_pmac: burgundy with multiple frame rates\n");
2708 for(j=0; j<i; j++)
2709 printk("%d ", temp[j]) ;
2710 printk("\n") ;
2711}
2712#endif
2713}
2714
2715static void __init
2716daca_init_frame_rates(const unsigned int *prop, unsigned int l)
2717{
2718 int temp[9] ;
2719 int i = 0 ;
2720 if (prop) {
2721 for (l /= sizeof(int); l > 0; --l) {
2722 unsigned int r = *prop++;
2723 /* Apple 'Fixed' format */
2724 if (r >= 0x10000)
2725 r >>= 16;
2726 temp[i] = r ;
2727 i++ ; if(i>=9) i=8;
2728
2729 }
2730 }
2731#ifdef DEBUG_DMASOUND
2732if (i > 1){
2733 int j;
2734 printk("dmasound_pmac: DACA with multiple frame rates\n");
2735 for(j=0; j<i; j++)
2736 printk("%d ", temp[j]) ;
2737 printk("\n") ;
2738}
2739#endif
2740}
2741
2742static void __init
2743init_frame_rates(const unsigned int *prop, unsigned int l)
2744{
2745 switch (awacs_revision) {
2746 case AWACS_TUMBLER:
2747 case AWACS_SNAPPER:
2748 tas_init_frame_rates(prop, l);
2749 break ;
2750 case AWACS_DACA:
2751 daca_init_frame_rates(prop, l);
2752 break ;
2753 case AWACS_BURGUNDY:
2754 burgundy_init_frame_rates(prop, l);
2755 break ;
2756 default:
2757 awacs_init_frame_rates(prop, l);
2758 break ;
2759 }
2760}
2761
2762/* find things/machines that can't do mac-io byteswap
2763*/
2764
2765static void __init
2766set_hw_byteswap(struct device_node *io)
2767{
2768 struct device_node *mio ;
2769 unsigned int kl = 0 ;
2770
2771 /* if seems that Keylargo can't byte-swap */
2772
2773 for (mio = io->parent; mio ; mio = mio->parent) {
2774 if (strcmp(mio->name, "mac-io") == 0) {
2775 if (of_device_is_compatible(mio, "Keylargo"))
2776 kl = 1;
2777 break;
2778 }
2779 }
2780 hw_can_byteswap = !kl;
2781}
2782
2783/* Allocate the resources necessary for beep generation. This cannot be (quite)
2784 done statically (yet) because we cannot do virt_to_bus() on static vars when
2785 the code is loaded as a module.
2786
2787 for the sake of saving the possibility that two allocations will incur the
2788 overhead of two pull-ups in DBDMA_ALIGN() we allocate the 'emergency' dmdma
2789 command here as well... even tho' it is not part of the beep process.
2790*/
2791
2792int32_t
2793__init setup_beep(void)
2794{
2795 /* Initialize beep stuff */
2796 /* want one cmd buffer for beeps, and a second one for emergencies
2797 - i.e. dbdma error conditions.
2798 ask for three to allow for pull up in DBDMA_ALIGN().
2799 */
2800 beep_dbdma_cmd_space =
2801 kmalloc((2 + 1) * sizeof(struct dbdma_cmd), GFP_KERNEL);
2802 if(beep_dbdma_cmd_space == NULL) {
2803 printk(KERN_ERR "dmasound_pmac: no beep dbdma cmd space\n") ;
2804 return -ENOMEM ;
2805 }
2806 beep_dbdma_cmd = (volatile struct dbdma_cmd *)
2807 DBDMA_ALIGN(beep_dbdma_cmd_space);
2808 /* set up emergency dbdma cmd */
2809 emergency_dbdma_cmd = beep_dbdma_cmd+1 ;
2810 beep_buf = kmalloc(BEEP_BUFLEN * 4, GFP_KERNEL);
2811 if (beep_buf == NULL) {
2812 printk(KERN_ERR "dmasound_pmac: no memory for beep buffer\n");
2813 kfree(beep_dbdma_cmd_space) ;
2814 return -ENOMEM ;
2815 }
2816 return 0 ;
2817}
2818
2819static struct input_dev *awacs_beep_dev;
2820
2821int __init dmasound_awacs_init(void)
2822{
2823 struct device_node *io = NULL, *info = NULL;
2824 int vol, res;
2825
2826 if (!machine_is(powermac))
2827 return -ENODEV;
2828
2829 awacs_subframe = 0;
2830 awacs_revision = 0;
2831 hw_can_byteswap = 1 ; /* most can */
2832
2833 /* look for models we need to handle specially */
2834 set_model() ;
2835
2836 /* find the OF node that tells us about the dbdma stuff
2837 */
2838 io = get_snd_io_node();
2839 if (io == NULL) {
2840#ifdef DEBUG_DMASOUND
2841printk("dmasound_pmac: couldn't find sound io OF node\n");
2842#endif
2843 goto no_device;
2844 }
2845
2846 /* find the OF node that tells us about the sound sub-system
2847 * this doesn't exist on pre-davbus machines (earlier than 9500)
2848 */
2849 if (awacs_revision != AWACS_AWACS) { /* set for pre-davbus */
2850 info = get_snd_info_node(io) ;
2851 if (info == NULL){
2852#ifdef DEBUG_DMASOUND
2853printk("dmasound_pmac: couldn't find 'sound' OF node\n");
2854#endif
2855 goto no_device;
2856 }
2857 }
2858
2859 awacs_revision = get_codec_type(info) ;
2860 if (awacs_revision == 0) {
2861#ifdef DEBUG_DMASOUND
2862printk("dmasound_pmac: couldn't find a Codec we can handle\n");
2863#endif
2864 goto no_device; /* we don't know this type of h/w */
2865 }
2866
2867 /* set up perch, ziva, SRS or whatever else we have as sound
2868 * expansion.
2869 */
2870 get_expansion_type();
2871
2872 /* we've now got enough information to make up the audio topology.
2873 * we will map the sound part of mac-io now so that we can probe for
2874 * other info if necessary (early AWACS we want to read chip ids)
2875 */
2876
2877 if (of_get_address(io, 2, NULL, NULL) == NULL) {
2878 /* OK - maybe we need to use the 'awacs' node (on earlier
2879 * machines).
2880 */
2881 if (awacs_node) {
2882 of_node_put(io);
2883 io = of_node_get(awacs_node);
2884 if (of_get_address(io, 2, NULL, NULL) == NULL) {
2885 printk("dmasound_pmac: can't use %s\n",
2886 io->full_name);
2887 goto no_device;
2888 }
2889 } else
2890 printk("dmasound_pmac: can't use %s\n", io->full_name);
2891 }
2892
2893 if (of_address_to_resource(io, 0, &awacs_rsrc[0]) ||
2894 request_mem_region(awacs_rsrc[0].start,
2895 awacs_rsrc[0].end - awacs_rsrc[0].start + 1,
2896 " (IO)") == NULL) {
2897 printk(KERN_ERR "dmasound: can't request IO resource !\n");
2898 goto no_device;
2899 }
2900 if (of_address_to_resource(io, 1, &awacs_rsrc[1]) ||
2901 request_mem_region(awacs_rsrc[1].start,
2902 awacs_rsrc[1].end - awacs_rsrc[1].start + 1,
2903 " (tx dma)") == NULL) {
2904 release_mem_region(awacs_rsrc[0].start,
2905 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
2906 printk(KERN_ERR "dmasound: can't request Tx DMA resource !\n");
2907 goto no_device;
2908 }
2909 if (of_address_to_resource(io, 2, &awacs_rsrc[2]) ||
2910 request_mem_region(awacs_rsrc[2].start,
2911 awacs_rsrc[2].end - awacs_rsrc[2].start + 1,
2912 " (rx dma)") == NULL) {
2913 release_mem_region(awacs_rsrc[0].start,
2914 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
2915 release_mem_region(awacs_rsrc[1].start,
2916 awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
2917 printk(KERN_ERR "dmasound: can't request Rx DMA resource !\n");
2918 goto no_device;
2919 }
2920
2921 awacs_beep_dev = input_allocate_device();
2922 if (!awacs_beep_dev) {
2923 release_mem_region(awacs_rsrc[0].start,
2924 awacs_rsrc[0].end - awacs_rsrc[0].start + 1);
2925 release_mem_region(awacs_rsrc[1].start,
2926 awacs_rsrc[1].end - awacs_rsrc[1].start + 1);
2927 release_mem_region(awacs_rsrc[2].start,
2928 awacs_rsrc[2].end - awacs_rsrc[2].start + 1);
2929 printk(KERN_ERR "dmasound: can't allocate input device !\n");
2930 goto no_device;
2931 }
2932
2933 awacs_beep_dev->name = "dmasound beeper";
2934 awacs_beep_dev->phys = "macio/input0";
2935 awacs_beep_dev->id.bustype = BUS_HOST;
2936 awacs_beep_dev->event = awacs_beep_event;
2937 awacs_beep_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
2938 awacs_beep_dev->evbit[0] = BIT(EV_SND);
2939
2940 /* all OF versions I've seen use this value */
2941 if (i2s_node)
2942 i2s = ioremap(awacs_rsrc[0].start, 0x1000);
2943 else
2944 awacs = ioremap(awacs_rsrc[0].start, 0x1000);
2945 awacs_txdma = ioremap(awacs_rsrc[1].start, 0x100);
2946 awacs_rxdma = ioremap(awacs_rsrc[2].start, 0x100);
2947
2948 /* first of all make sure that the chip is powered up....*/
2949 pmac_call_feature(PMAC_FTR_SOUND_CHIP_ENABLE, io, 0, 1);
2950 if (awacs_revision == AWACS_SCREAMER && awacs)
2951 awacs_recalibrate();
2952
2953 awacs_irq = irq_of_parse_and_map(io, 0);
2954 awacs_tx_irq = irq_of_parse_and_map(io, 1);
2955 awacs_rx_irq = irq_of_parse_and_map(io, 2);
2956
2957 /* Hack for legacy crap that will be killed someday */
2958 of_node_put(awacs_node);
2959 awacs_node = of_node_get(io);
2960
2961 /* if we have an awacs or screamer - probe the chip to make
2962 * sure we have the right revision.
2963 */
2964
2965 if (awacs_revision <= AWACS_SCREAMER){
2966 uint32_t temp, rev, mfg ;
2967 /* find out the awacs revision from the chip */
2968 temp = in_le32(&awacs->codec_stat);
2969 rev = (temp >> 12) & 0xf;
2970 mfg = (temp >> 8) & 0xf;
2971#ifdef DEBUG_DMASOUND
2972printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
2973#endif
2974 if (rev >= AWACS_SCREAMER)
2975 awacs_revision = AWACS_SCREAMER ;
2976 else
2977 awacs_revision = rev ;
2978 }
2979
2980 dmasound.mach = machPMac;
2981
2982 /* find out other bits & pieces from OF, these may be present
2983 only on some models ... so be careful.
2984 */
2985
2986 /* in the absence of a frame rates property we will use the defaults
2987 */
2988
2989 if (info) {
2990 const unsigned int *prop;
2991 unsigned int l;
2992
2993 sound_device_id = 0;
2994 /* device ID appears post g3 b&w */
2995 prop = of_get_property(info, "device-id", NULL);
2996 if (prop != 0)
2997 sound_device_id = *prop;
2998
2999 /* look for a property saying what sample rates
3000 are available */
3001
3002 prop = of_get_property(info, "sample-rates", &l);
3003 if (prop == 0)
3004 prop = of_get_property(info, "output-frame-rates", &l);
3005
3006 /* if it's there use it to set up frame rates */
3007 init_frame_rates(prop, l) ;
3008 of_node_put(info);
3009 info = NULL;
3010 }
3011
3012 if (awacs)
3013 out_le32(&awacs->control, 0x11); /* set everything quiesent */
3014
3015 set_hw_byteswap(io) ; /* figure out if the h/w can do it */
3016
3017#ifdef CONFIG_NVRAM
3018 /* get default volume from nvram */
3019 vol = ((pmac_xpram_read( 8 ) & 7 ) << 1 );
3020#else
3021 vol = 0;
3022#endif
3023
3024 /* set up tracking values */
3025 spk_vol = vol * 100 ;
3026 spk_vol /= 7 ; /* get set value to a percentage */
3027 spk_vol |= (spk_vol << 8) ; /* equal left & right */
3028 line_vol = passthru_vol = spk_vol ;
3029
3030 /* fill regs that are shared between AWACS & Burgundy */
3031
3032 awacs_reg[2] = vol + (vol << 6);
3033 awacs_reg[4] = vol + (vol << 6);
3034 awacs_reg[5] = vol + (vol << 6); /* screamer has loopthru vol control */
3035 awacs_reg[6] = 0; /* maybe should be vol << 3 for PCMCIA speaker */
3036 awacs_reg[7] = 0;
3037
3038 awacs_reg[0] = MASK_MUX_CD;
3039 awacs_reg[1] = MASK_LOOPTHRU;
3040
3041 /* FIXME: Only machines with external SRS module need MASK_PAROUT */
3042 if (has_perch || sound_device_id == 0x5
3043 || /*sound_device_id == 0x8 ||*/ sound_device_id == 0xb)
3044 awacs_reg[1] |= MASK_PAROUT0 | MASK_PAROUT1;
3045
3046 switch (awacs_revision) {
3047 case AWACS_TUMBLER:
3048 tas_register_driver(&tas3001c_hooks);
3049 tas_init(I2C_DRIVERID_TAS3001C, I2C_DRIVERNAME_TAS3001C);
3050 tas_dmasound_init();
3051 tas_post_init();
3052 break ;
3053 case AWACS_SNAPPER:
3054 tas_register_driver(&tas3004_hooks);
3055 tas_init(I2C_DRIVERID_TAS3004,I2C_DRIVERNAME_TAS3004);
3056 tas_dmasound_init();
3057 tas_post_init();
3058 break;
3059 case AWACS_DACA:
3060 daca_init();
3061 break;
3062 case AWACS_BURGUNDY:
3063 awacs_burgundy_init();
3064 break ;
3065 case AWACS_SCREAMER:
3066 case AWACS_AWACS:
3067 default:
3068 load_awacs();
3069 break ;
3070 }
3071
3072 /* enable/set-up external modules - when we know how */
3073
3074 if (has_perch)
3075 awacs_enable_amp(100 * 0x101);
3076
3077 /* Reset dbdma channels */
3078 out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16);
3079 while (in_le32(&awacs_txdma->status) & RUN)
3080 udelay(1);
3081 out_le32(&awacs_rxdma->control, (RUN|PAUSE|FLUSH|WAKE|DEAD) << 16);
3082 while (in_le32(&awacs_rxdma->status) & RUN)
3083 udelay(1);
3084
3085 /* Initialize beep stuff */
3086 if ((res=setup_beep()))
3087 return res ;
3088
3089#ifdef CONFIG_PM
3090 pmu_register_sleep_notifier(&awacs_sleep_notifier);
3091#endif /* CONFIG_PM */
3092
3093 /* Powerbooks have odd ways of enabling inputs such as
3094 an expansion-bay CD or sound from an internal modem
3095 or a PC-card modem. */
3096 if (is_pbook_3X00) {
3097 /*
3098 * Enable CD and PC-card sound inputs.
3099 * This is done by reading from address
3100 * f301a000, + 0x10 to enable the expansion-bay
3101 * CD sound input, + 0x80 to enable the PC-card
3102 * sound input. The 0x100 enables the SCSI bus
3103 * terminator power.
3104 */
3105 latch_base = ioremap (0xf301a000, 0x1000);
3106 in_8(latch_base + 0x190);
3107
3108 } else if (is_pbook_g3) {
3109 struct device_node* mio;
3110 macio_base = NULL;
3111 for (mio = io->parent; mio; mio = mio->parent) {
3112 if (strcmp(mio->name, "mac-io") == 0) {
3113 struct resource r;
3114 if (of_address_to_resource(mio, 0, &r) == 0)
3115 macio_base = ioremap(r.start, 0x40);
3116 break;
3117 }
3118 }
3119 /*
3120 * Enable CD sound input.
3121 * The relevant bits for writing to this byte are 0x8f.
3122 * I haven't found out what the 0x80 bit does.
3123 * For the 0xf bits, writing 3 or 7 enables the CD
3124 * input, any other value disables it. Values
3125 * 1, 3, 5, 7 enable the microphone. Values 0, 2,
3126 * 4, 6, 8 - f enable the input from the modem.
3127 * -- paulus.
3128 */
3129 if (macio_base)
3130 out_8(macio_base + 0x37, 3);
3131 }
3132
3133 if (hw_can_byteswap)
3134 dmasound.mach.hardware_afmts = (AFMT_S16_BE | AFMT_S16_LE) ;
3135 else
3136 dmasound.mach.hardware_afmts = AFMT_S16_BE ;
3137
3138 /* shut out chips that do output only.
3139 * may need to extend this to machines which have no inputs - even tho'
3140 * they use screamer - IIRC one of the powerbooks is like this.
3141 */
3142
3143 if (awacs_revision != AWACS_DACA) {
3144 dmasound.mach.capabilities = DSP_CAP_DUPLEX ;
3145 dmasound.mach.record = PMacRecord ;
3146 }
3147
3148 dmasound.mach.default_hard = def_hard ;
3149 dmasound.mach.default_soft = def_soft ;
3150
3151 switch (awacs_revision) {
3152 case AWACS_BURGUNDY:
3153 sprintf(awacs_name, "PowerMac Burgundy ") ;
3154 break ;
3155 case AWACS_DACA:
3156 sprintf(awacs_name, "PowerMac DACA ") ;
3157 break ;
3158 case AWACS_TUMBLER:
3159 sprintf(awacs_name, "PowerMac Tumbler ") ;
3160 break ;
3161 case AWACS_SNAPPER:
3162 sprintf(awacs_name, "PowerMac Snapper ") ;
3163 break ;
3164 case AWACS_SCREAMER:
3165 sprintf(awacs_name, "PowerMac Screamer ") ;
3166 break ;
3167 case AWACS_AWACS:
3168 default:
3169 sprintf(awacs_name, "PowerMac AWACS rev %d ", awacs_revision) ;
3170 break ;
3171 }
3172
3173 /*
3174 * XXX: we should handle errors here, but that would mean
3175 * rewriting the whole init code. later..
3176 */
3177 input_register_device(awacs_beep_dev);
3178
3179 of_node_put(io);
3180
3181 return dmasound_init();
3182
3183no_device:
3184 of_node_put(info);
3185 of_node_put(awacs_node);
3186 of_node_put(i2s_node);
3187 of_node_put(io);
3188 return -ENODEV ;
3189}
3190
3191static void __exit dmasound_awacs_cleanup(void)
3192{
3193 input_unregister_device(awacs_beep_dev);
3194
3195 switch (awacs_revision) {
3196 case AWACS_TUMBLER:
3197 case AWACS_SNAPPER:
3198 tas_dmasound_cleanup();
3199 tas_cleanup();
3200 break ;
3201 case AWACS_DACA:
3202 daca_cleanup();
3203 break;
3204 }
3205 dmasound_deinit();
3206
3207 of_node_put(awacs_node);
3208 of_node_put(i2s_node);
3209}
3210
3211MODULE_DESCRIPTION("PowerMac built-in audio driver.");
3212MODULE_LICENSE("GPL");
3213
3214module_init(dmasound_awacs_init);
3215module_exit(dmasound_awacs_cleanup);
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
index f4056a9c371b..a003c0ea9303 100644
--- a/sound/oss/dmasound/dmasound_core.c
+++ b/sound/oss/dmasound/dmasound_core.c
@@ -202,13 +202,6 @@ module_param(numWriteBufs, int, 0);
202static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */ 202static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */
203module_param(writeBufSize, int, 0); 203module_param(writeBufSize, int, 0);
204 204
205#ifdef HAS_RECORD
206static unsigned int numReadBufs = DEFAULT_N_BUFFERS;
207module_param(numReadBufs, int, 0);
208static unsigned int readBufSize = DEFAULT_BUFF_SIZE; /* in bytes */
209module_param(readBufSize, int, 0);
210#endif
211
212MODULE_LICENSE("GPL"); 205MODULE_LICENSE("GPL");
213 206
214#ifdef MODULE 207#ifdef MODULE
@@ -403,10 +396,6 @@ static void mixer_init(void)
403 396
404struct sound_queue dmasound_write_sq; 397struct sound_queue dmasound_write_sq;
405static void sq_reset_output(void) ; 398static void sq_reset_output(void) ;
406#ifdef HAS_RECORD
407struct sound_queue dmasound_read_sq;
408static void sq_reset_input(void) ;
409#endif
410 399
411static int sq_allocate_buffers(struct sound_queue *sq, int num, int size) 400static int sq_allocate_buffers(struct sound_queue *sq, int num, int size)
412{ 401{
@@ -530,12 +519,6 @@ printk("dmasound_core: invalid frag count (user set %d)\n", sq->user_frags) ;
530 sq->rear = -1; 519 sq->rear = -1;
531 setup_func = dmasound.mach.write_sq_setup; 520 setup_func = dmasound.mach.write_sq_setup;
532 } 521 }
533#ifdef HAS_RECORD
534 else {
535 sq->rear = 0;
536 setup_func = dmasound.mach.read_sq_setup;
537 }
538#endif
539 if (setup_func) 522 if (setup_func)
540 return setup_func(); 523 return setup_func();
541 return 0 ; 524 return 0 ;
@@ -672,13 +655,6 @@ static unsigned int sq_poll(struct file *file, struct poll_table_struct *wait)
672 } 655 }
673 if (file->f_mode & FMODE_WRITE ) 656 if (file->f_mode & FMODE_WRITE )
674 poll_wait(file, &write_sq.action_queue, wait); 657 poll_wait(file, &write_sq.action_queue, wait);
675#ifdef HAS_RECORD
676 if (file->f_mode & FMODE_READ)
677 poll_wait(file, &read_sq.action_queue, wait);
678 if (file->f_mode & FMODE_READ)
679 if (read_sq.block_size - read_sq.rear_size > 0)
680 mask |= POLLIN | POLLRDNORM;
681#endif
682 if (file->f_mode & FMODE_WRITE) 658 if (file->f_mode & FMODE_WRITE)
683 if (write_sq.count < write_sq.max_active || write_sq.block_size - write_sq.rear_size > 0) 659 if (write_sq.count < write_sq.max_active || write_sq.block_size - write_sq.rear_size > 0)
684 mask |= POLLOUT | POLLWRNORM; 660 mask |= POLLOUT | POLLWRNORM;
@@ -686,101 +662,6 @@ static unsigned int sq_poll(struct file *file, struct poll_table_struct *wait)
686 662
687} 663}
688 664
689#ifdef HAS_RECORD
690 /*
691 * Here is how the values are used for reading.
692 * The value 'active' simply indicates the DMA is running. This is done
693 * so the driver semantics are DMA starts when the first read is posted.
694 * The value 'front' indicates the buffer we should next send to the user.
695 * The value 'rear' indicates the buffer the DMA is currently filling.
696 * When 'front' == 'rear' the buffer "ring" is empty (we always have an
697 * empty available). The 'rear_size' is used to track partial offsets
698 * into the buffer we are currently returning to the user.
699
700 * This level (> [1.5]) doesn't care what strategy the LL driver uses with
701 * DMA on over-run. It can leave it running (and keep active == 1) or it
702 * can kill it and set active == 0 in which case this routine will spot
703 * it and restart the DMA.
704 */
705
706static ssize_t sq_read(struct file *file, char __user *dst, size_t uLeft,
707 loff_t *ppos)
708{
709
710 ssize_t uRead, bLeft, bUsed, uUsed;
711
712 if (uLeft == 0)
713 return 0;
714
715 /* cater for the compatibility mode - record compiled in but no LL */
716 if (dmasound.mach.record == NULL)
717 return -EINVAL ;
718
719 /* see comment in sq_write()
720 */
721
722 if( shared_resources_initialised == 0) {
723 dmasound.mach.init() ;
724 shared_resources_initialised = 1 ;
725 }
726
727 /* set up the sq if it is not already done. see comments in sq_write().
728 */
729
730 if (read_sq.locked == 0) {
731 if ((uRead = sq_setup(&read_sq)) < 0)
732 return uRead ;
733 }
734
735 uRead = 0;
736
737 /* Move what the user requests, depending upon other options.
738 */
739 while (uLeft > 0) {
740
741 /* we happened to get behind and the LL driver killed DMA
742 then we should set it going again. This also sets it
743 going the first time through.
744 */
745 if ( !read_sq.active )
746 dmasound.mach.record();
747
748 /* When front == rear, the DMA is not done yet.
749 */
750 while (read_sq.front == read_sq.rear) {
751 if (read_sq.open_mode & O_NONBLOCK) {
752 return uRead > 0 ? uRead : -EAGAIN;
753 }
754 SLEEP(read_sq.action_queue);
755 if (signal_pending(current))
756 return uRead > 0 ? uRead : -EINTR;
757 }
758
759 /* The amount we move is either what is left in the
760 * current buffer or what the user wants.
761 */
762 bLeft = read_sq.block_size - read_sq.rear_size;
763 bUsed = read_sq.rear_size;
764 uUsed = sound_copy_translate(dmasound.trans_read, dst, uLeft,
765 read_sq.buffers[read_sq.front],
766 &bUsed, bLeft);
767 if (uUsed <= 0)
768 return uUsed;
769 dst += uUsed;
770 uRead += uUsed;
771 uLeft -= uUsed;
772 read_sq.rear_size += bUsed;
773 if (read_sq.rear_size >= read_sq.block_size) {
774 read_sq.rear_size = 0;
775 read_sq.front++;
776 if (read_sq.front >= read_sq.max_active)
777 read_sq.front = 0;
778 }
779 }
780 return uRead;
781}
782#endif /* HAS_RECORD */
783
784static inline void sq_init_waitqueue(struct sound_queue *sq) 665static inline void sq_init_waitqueue(struct sound_queue *sq)
785{ 666{
786 init_waitqueue_head(&sq->action_queue); 667 init_waitqueue_head(&sq->action_queue);
@@ -854,23 +735,6 @@ static int sq_open2(struct sound_queue *sq, struct file *file, mode_t mode,
854#define write_sq_open(file) \ 735#define write_sq_open(file) \
855 sq_open2(&write_sq, file, FMODE_WRITE, numWriteBufs, writeBufSize ) 736 sq_open2(&write_sq, file, FMODE_WRITE, numWriteBufs, writeBufSize )
856 737
857#ifdef HAS_RECORD
858#define read_sq_init_waitqueue() sq_init_waitqueue(&read_sq)
859#if 0 /* blocking open() */
860#define read_sq_wake_up(file) sq_wake_up(&read_sq, file, FMODE_READ)
861#endif
862#define read_sq_release_buffers() sq_release_buffers(&read_sq)
863#define read_sq_open(file) \
864 sq_open2(&read_sq, file, FMODE_READ, numReadBufs, readBufSize )
865#else
866#define read_sq_init_waitqueue() do {} while (0)
867#if 0 /* blocking open() */
868#define read_sq_wake_up(file) do {} while (0)
869#endif
870#define read_sq_release_buffers() do {} while (0)
871#define sq_reset_input() do {} while (0)
872#endif
873
874static int sq_open(struct inode *inode, struct file *file) 738static int sq_open(struct inode *inode, struct file *file)
875{ 739{
876 int rc; 740 int rc;
@@ -881,25 +745,11 @@ static int sq_open(struct inode *inode, struct file *file)
881 rc = write_sq_open(file); /* checks the f_mode */ 745 rc = write_sq_open(file); /* checks the f_mode */
882 if (rc) 746 if (rc)
883 goto out; 747 goto out;
884#ifdef HAS_RECORD
885 if (dmasound.mach.record) {
886 rc = read_sq_open(file); /* checks the f_mode */
887 if (rc)
888 goto out;
889 } else { /* no record function installed; in compat mode */
890 if (file->f_mode & FMODE_READ) {
891 /* TODO: if O_RDWR, release any resources grabbed by write part */
892 rc = -ENXIO;
893 goto out;
894 }
895 }
896#else /* !HAS_RECORD */
897 if (file->f_mode & FMODE_READ) { 748 if (file->f_mode & FMODE_READ) {
898 /* TODO: if O_RDWR, release any resources grabbed by write part */ 749 /* TODO: if O_RDWR, release any resources grabbed by write part */
899 rc = -ENXIO ; /* I think this is what is required by open(2) */ 750 rc = -ENXIO ; /* I think this is what is required by open(2) */
900 goto out; 751 goto out;
901 } 752 }
902#endif /* HAS_RECORD */
903 753
904 if (dmasound.mach.sq_open) 754 if (dmasound.mach.sq_open)
905 dmasound.mach.sq_open(file->f_mode); 755 dmasound.mach.sq_open(file->f_mode);
@@ -956,43 +806,9 @@ static void sq_reset_output(void)
956 write_sq.user_frag_size = 0 ; 806 write_sq.user_frag_size = 0 ;
957} 807}
958 808
959#ifdef HAS_RECORD
960
961static void sq_reset_input(void)
962{
963 if (dmasound.mach.record && read_sq.active) {
964 if (dmasound.mach.abort_read) { /* this routine must really be present */
965 read_sq.syncing = 1 ;
966 /* this can use the read_sq.sync_queue to sleep if
967 necessary - it should not return until DMA
968 is really stopped - because we might deallocate
969 the buffers as the next action...
970 */
971 dmasound.mach.abort_read() ;
972 } else {
973 printk(KERN_ERR
974 "dmasound_core: %s has no abort_read()!! all bets are off\n",
975 dmasound.mach.name) ;
976 }
977 }
978 read_sq.syncing =
979 read_sq.active =
980 read_sq.front =
981 read_sq.count =
982 read_sq.rear = 0 ;
983
984 /* OK - we can unlock the parameters and fragment settings */
985 read_sq.locked = 0 ;
986 read_sq.user_frags = 0 ;
987 read_sq.user_frag_size = 0 ;
988}
989
990#endif
991
992static void sq_reset(void) 809static void sq_reset(void)
993{ 810{
994 sq_reset_output() ; 811 sq_reset_output() ;
995 sq_reset_input() ;
996 /* we could consider resetting the shared_resources_owner here... but I 812 /* we could consider resetting the shared_resources_owner here... but I
997 think it is probably still rather non-obvious to application writer 813 think it is probably still rather non-obvious to application writer
998 */ 814 */
@@ -1038,17 +854,6 @@ static int sq_release(struct inode *inode, struct file *file)
1038 854
1039 lock_kernel(); 855 lock_kernel();
1040 856
1041#ifdef HAS_RECORD
1042 /* probably best to do the read side first - so that time taken to do it
1043 overlaps with playing any remaining output samples.
1044 */
1045 if (file->f_mode & FMODE_READ) {
1046 sq_reset_input() ; /* make sure dma is stopped and all is quiet */
1047 read_sq_release_buffers();
1048 read_sq.busy = 0;
1049 }
1050#endif
1051
1052 if (file->f_mode & FMODE_WRITE) { 857 if (file->f_mode & FMODE_WRITE) {
1053 if (write_sq.busy) 858 if (write_sq.busy)
1054 rc = sq_fsync(file, file->f_path.dentry); 859 rc = sq_fsync(file, file->f_path.dentry);
@@ -1105,11 +910,6 @@ static int shared_resources_are_mine(mode_t md)
1105 910
1106static int queues_are_quiescent(void) 911static int queues_are_quiescent(void)
1107{ 912{
1108#ifdef HAS_RECORD
1109 if (dmasound.mach.record)
1110 if (read_sq.locked)
1111 return 0 ;
1112#endif
1113 if (write_sq.locked) 913 if (write_sq.locked)
1114 return 0 ; 914 return 0 ;
1115 return 1 ; 915 return 1 ;
@@ -1185,13 +985,6 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
1185 the read_sq ones. 985 the read_sq ones.
1186 */ 986 */
1187 size = 0 ; 987 size = 0 ;
1188#ifdef HAS_RECORD
1189 if (dmasound.mach.record && (file->f_mode & FMODE_READ)) {
1190 if ( !read_sq.locked )
1191 sq_setup(&read_sq) ; /* set params */
1192 size = read_sq.user_frag_size ;
1193 }
1194#endif
1195 if (file->f_mode & FMODE_WRITE) { 988 if (file->f_mode & FMODE_WRITE) {
1196 if ( !write_sq.locked ) 989 if ( !write_sq.locked )
1197 sq_setup(&write_sq) ; 990 sq_setup(&write_sq) ;
@@ -1214,8 +1007,6 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
1214 everything - read, however, is killed imediately. 1007 everything - read, however, is killed imediately.
1215 */ 1008 */
1216 result = 0 ; 1009 result = 0 ;
1217 if ((file->f_mode & FMODE_READ) && dmasound.mach.record)
1218 sq_reset_input() ;
1219 if (file->f_mode & FMODE_WRITE) { 1010 if (file->f_mode & FMODE_WRITE) {
1220 result = sq_fsync(file, file->f_path.dentry); 1011 result = sq_fsync(file, file->f_path.dentry);
1221 sq_reset_output() ; 1012 sq_reset_output() ;
@@ -1294,13 +1085,6 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
1294 result = 0 ; 1085 result = 0 ;
1295 nbufs = (data >> 16) & 0x7fff ; /* 0x7fff is 'use maximum' */ 1086 nbufs = (data >> 16) & 0x7fff ; /* 0x7fff is 'use maximum' */
1296 size = data & 0xffff; 1087 size = data & 0xffff;
1297#ifdef HAS_RECORD
1298 if ((file->f_mode & FMODE_READ) && dmasound.mach.record) {
1299 result = set_queue_frags(&read_sq, nbufs, size) ;
1300 if (result)
1301 return result ;
1302 }
1303#endif
1304 if (file->f_mode & FMODE_WRITE) { 1088 if (file->f_mode & FMODE_WRITE) {
1305 result = set_queue_frags(&write_sq, nbufs, size) ; 1089 result = set_queue_frags(&write_sq, nbufs, size) ;
1306 if (result) 1090 if (result)
@@ -1348,20 +1132,6 @@ static const struct file_operations sq_fops =
1348 .release = sq_release, 1132 .release = sq_release,
1349}; 1133};
1350 1134
1351#ifdef HAS_RECORD
1352static const struct file_operations sq_fops_record =
1353{
1354 .owner = THIS_MODULE,
1355 .llseek = no_llseek,
1356 .write = sq_write,
1357 .poll = sq_poll,
1358 .ioctl = sq_ioctl,
1359 .open = sq_open,
1360 .release = sq_release,
1361 .read = sq_read,
1362};
1363#endif
1364
1365static int sq_init(void) 1135static int sq_init(void)
1366{ 1136{
1367 const struct file_operations *fops = &sq_fops; 1137 const struct file_operations *fops = &sq_fops;
@@ -1369,10 +1139,6 @@ static int sq_init(void)
1369 int sq_unit; 1139 int sq_unit;
1370#endif 1140#endif
1371 1141
1372#ifdef HAS_RECORD
1373 if (dmasound.mach.record)
1374 fops = &sq_fops_record;
1375#endif
1376 sq_unit = register_sound_dsp(fops, -1); 1142 sq_unit = register_sound_dsp(fops, -1);
1377 if (sq_unit < 0) { 1143 if (sq_unit < 0) {
1378 printk(KERN_ERR "dmasound_core: couldn't register fops\n") ; 1144 printk(KERN_ERR "dmasound_core: couldn't register fops\n") ;
@@ -1380,7 +1146,6 @@ static int sq_init(void)
1380 } 1146 }
1381 1147
1382 write_sq_init_waitqueue(); 1148 write_sq_init_waitqueue();
1383 read_sq_init_waitqueue();
1384 1149
1385 /* These parameters will be restored for every clean open() 1150 /* These parameters will be restored for every clean open()
1386 * in the case of multiple open()s (e.g. dsp0 & dsp1) they 1151 * in the case of multiple open()s (e.g. dsp0 & dsp1) they
@@ -1406,11 +1171,7 @@ static int sq_init(void)
1406 driver. 1171 driver.
1407*/ 1172*/
1408 1173
1409#ifdef HAS_RECORD
1410#define STAT_BUFF_LEN 1024
1411#else
1412#define STAT_BUFF_LEN 768 1174#define STAT_BUFF_LEN 768
1413#endif
1414 1175
1415/* this is how much space we will allow the low-level driver to use 1176/* this is how much space we will allow the low-level driver to use
1416 in the stat buffer. Currently, 2 * (80 character line + <NL>). 1177 in the stat buffer. Currently, 2 * (80 character line + <NL>).
@@ -1518,11 +1279,6 @@ static int state_open(struct inode *inode, struct file *file)
1518 len += sprintf(buffer+len,"Allocated:%8s%6s\n","Buffers","Size") ; 1279 len += sprintf(buffer+len,"Allocated:%8s%6s\n","Buffers","Size") ;
1519 len += sprintf(buffer+len,"%9s:%8d%6d\n", 1280 len += sprintf(buffer+len,"%9s:%8d%6d\n",
1520 "write", write_sq.numBufs, write_sq.bufSize) ; 1281 "write", write_sq.numBufs, write_sq.bufSize) ;
1521#ifdef HAS_RECORD
1522 if (dmasound.mach.record)
1523 len += sprintf(buffer+len,"%9s:%8d%6d\n",
1524 "read", read_sq.numBufs, read_sq.bufSize) ;
1525#endif
1526 len += sprintf(buffer+len, 1282 len += sprintf(buffer+len,
1527 "Current : MaxFrg FragSiz MaxAct Frnt Rear " 1283 "Current : MaxFrg FragSiz MaxAct Frnt Rear "
1528 "Cnt RrSize A B S L xruns\n") ; 1284 "Cnt RrSize A B S L xruns\n") ;
@@ -1531,14 +1287,6 @@ static int state_open(struct inode *inode, struct file *file)
1531 write_sq.max_active, write_sq.front, write_sq.rear, 1287 write_sq.max_active, write_sq.front, write_sq.rear,
1532 write_sq.count, write_sq.rear_size, write_sq.active, 1288 write_sq.count, write_sq.rear_size, write_sq.active,
1533 write_sq.busy, write_sq.syncing, write_sq.locked, write_sq.xruns) ; 1289 write_sq.busy, write_sq.syncing, write_sq.locked, write_sq.xruns) ;
1534#ifdef HAS_RECORD
1535 if (dmasound.mach.record)
1536 len += sprintf(buffer+len,"%9s:%7d%8d%7d%5d%5d%4d%7d%2d%2d%2d%2d%7d\n",
1537 "read", read_sq.max_count, read_sq.block_size,
1538 read_sq.max_active, read_sq.front, read_sq.rear,
1539 read_sq.count, read_sq.rear_size, read_sq.active,
1540 read_sq.busy, read_sq.syncing, read_sq.locked, read_sq.xruns) ;
1541#endif
1542#ifdef DEBUG_DMASOUND 1290#ifdef DEBUG_DMASOUND
1543printk("dmasound: stat buffer used %d bytes\n", len) ; 1291printk("dmasound: stat buffer used %d bytes\n", len) ;
1544#endif 1292#endif
@@ -1638,13 +1386,6 @@ int dmasound_init(void)
1638 (dmasound.mach.version >> 8), (dmasound.mach.version & 0xff)) ; 1386 (dmasound.mach.version >> 8), (dmasound.mach.version & 0xff)) ;
1639 printk(KERN_INFO "Write will use %4d fragments of %7d bytes as default\n", 1387 printk(KERN_INFO "Write will use %4d fragments of %7d bytes as default\n",
1640 numWriteBufs, writeBufSize) ; 1388 numWriteBufs, writeBufSize) ;
1641#ifdef HAS_RECORD
1642 if (dmasound.mach.record)
1643 printk(KERN_INFO
1644 "Read will use %4d fragments of %7d bytes as default\n",
1645 numReadBufs, readBufSize) ;
1646#endif
1647
1648 return 0; 1389 return 0;
1649} 1390}
1650 1391
@@ -1659,7 +1400,6 @@ void dmasound_deinit(void)
1659 } 1400 }
1660 1401
1661 write_sq_release_buffers(); 1402 write_sq_release_buffers();
1662 read_sq_release_buffers();
1663 1403
1664 if (mixer_unit >= 0) 1404 if (mixer_unit >= 0)
1665 unregister_sound_mixer(mixer_unit); 1405 unregister_sound_mixer(mixer_unit);
@@ -1684,36 +1424,12 @@ static int dmasound_setup(char *str)
1684 */ 1424 */
1685 1425
1686 switch (ints[0]) { 1426 switch (ints[0]) {
1687#ifdef HAS_RECORD
1688 case 5:
1689 if ((ints[5] < 0) || (ints[5] > MAX_CATCH_RADIUS))
1690 printk("dmasound_setup: invalid catch radius, using default = %d\n", catchRadius);
1691 else
1692 catchRadius = ints[5];
1693 /* fall through */
1694 case 4:
1695 if (ints[4] < MIN_BUFFERS)
1696 printk("dmasound_setup: invalid number of read buffers, using default = %d\n",
1697 numReadBufs);
1698 else
1699 numReadBufs = ints[4];
1700 /* fall through */
1701 case 3:
1702 if ((size = ints[3]) < 256) /* check for small buffer specs */
1703 size <<= 10 ;
1704 if (size < MIN_BUFSIZE || size > MAX_BUFSIZE)
1705 printk("dmasound_setup: invalid read buffer size, using default = %d\n", readBufSize);
1706 else
1707 readBufSize = size;
1708 /* fall through */
1709#else
1710 case 3: 1427 case 3:
1711 if ((ints[3] < 0) || (ints[3] > MAX_CATCH_RADIUS)) 1428 if ((ints[3] < 0) || (ints[3] > MAX_CATCH_RADIUS))
1712 printk("dmasound_setup: invalid catch radius, using default = %d\n", catchRadius); 1429 printk("dmasound_setup: invalid catch radius, using default = %d\n", catchRadius);
1713 else 1430 else
1714 catchRadius = ints[3]; 1431 catchRadius = ints[3];
1715 /* fall through */ 1432 /* fall through */
1716#endif
1717 case 2: 1433 case 2:
1718 if (ints[1] < MIN_BUFFERS) 1434 if (ints[1] < MIN_BUFFERS)
1719 printk("dmasound_setup: invalid number of buffers, using default = %d\n", numWriteBufs); 1435 printk("dmasound_setup: invalid number of buffers, using default = %d\n", numWriteBufs);
@@ -1830,9 +1546,6 @@ EXPORT_SYMBOL(dmasound_init);
1830EXPORT_SYMBOL(dmasound_deinit); 1546EXPORT_SYMBOL(dmasound_deinit);
1831#endif 1547#endif
1832EXPORT_SYMBOL(dmasound_write_sq); 1548EXPORT_SYMBOL(dmasound_write_sq);
1833#ifdef HAS_RECORD
1834EXPORT_SYMBOL(dmasound_read_sq);
1835#endif
1836EXPORT_SYMBOL(dmasound_catchRadius); 1549EXPORT_SYMBOL(dmasound_catchRadius);
1837#ifdef HAS_8BIT_TABLES 1550#ifdef HAS_8BIT_TABLES
1838EXPORT_SYMBOL(dmasound_ulaw2dma8); 1551EXPORT_SYMBOL(dmasound_ulaw2dma8);
diff --git a/sound/oss/dmasound/tas3001c.c b/sound/oss/dmasound/tas3001c.c
deleted file mode 100644
index 4b7dbdd2a438..000000000000
--- a/sound/oss/dmasound/tas3001c.c
+++ /dev/null
@@ -1,849 +0,0 @@
1/*
2 * Driver for the i2c/i2s based TA3004 sound chip used
3 * on some Apple hardware. Also known as "snapper".
4 *
5 * Tobias Sargeant <tobias.sargeant@bigpond.com>
6 * Based upon, tas3001c.c by Christopher C. Chimelis <chris@debian.org>:
7 *
8 * TODO:
9 * -----
10 * * Enable control over input line 2 (is this connected?)
11 * * Implement sleep support (at least mute everything and
12 * * set gains to minimum during sleep)
13 * * Look into some of Darwin's tweaks regarding the mute
14 * * lines (delays & different behaviour on some HW)
15 *
16 */
17
18#include <linux/module.h>
19#include <linux/slab.h>
20#include <linux/proc_fs.h>
21#include <linux/ioport.h>
22#include <linux/sysctl.h>
23#include <linux/types.h>
24#include <linux/i2c.h>
25#include <linux/init.h>
26#include <linux/soundcard.h>
27#include <linux/workqueue.h>
28#include <asm/uaccess.h>
29#include <asm/errno.h>
30#include <asm/io.h>
31#include <asm/prom.h>
32
33#include "dmasound.h"
34#include "tas_common.h"
35#include "tas3001c.h"
36
37#include "tas_ioctl.h"
38
39#define TAS3001C_BIQUAD_FILTER_COUNT 6
40#define TAS3001C_BIQUAD_CHANNEL_COUNT 2
41
42#define VOL_DEFAULT (100 * 4 / 5)
43#define INPUT_DEFAULT (100 * 4 / 5)
44#define BASS_DEFAULT (100 / 2)
45#define TREBLE_DEFAULT (100 / 2)
46
47struct tas3001c_data_t {
48 struct tas_data_t super;
49 int device_id;
50 int output_id;
51 int speaker_id;
52 struct tas_drce_t drce_state;
53 struct work_struct change;
54};
55
56
57static const union tas_biquad_t
58tas3001c_eq_unity={
59 .buf = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 }
60};
61
62
63static inline unsigned char db_to_regval(short db) {
64 int r=0;
65
66 r=(db+0x59a0) / 0x60;
67
68 if (r < 0x91) return 0x91;
69 if (r > 0xef) return 0xef;
70 return r;
71}
72
73static inline short quantize_db(short db) {
74 return db_to_regval(db) * 0x60 - 0x59a0;
75}
76
77
78static inline int
79register_width(enum tas3001c_reg_t r)
80{
81 switch(r) {
82 case TAS3001C_REG_MCR:
83 case TAS3001C_REG_TREBLE:
84 case TAS3001C_REG_BASS:
85 return 1;
86
87 case TAS3001C_REG_DRC:
88 return 2;
89
90 case TAS3001C_REG_MIXER1:
91 case TAS3001C_REG_MIXER2:
92 return 3;
93
94 case TAS3001C_REG_VOLUME:
95 return 6;
96
97 case TAS3001C_REG_LEFT_BIQUAD0:
98 case TAS3001C_REG_LEFT_BIQUAD1:
99 case TAS3001C_REG_LEFT_BIQUAD2:
100 case TAS3001C_REG_LEFT_BIQUAD3:
101 case TAS3001C_REG_LEFT_BIQUAD4:
102 case TAS3001C_REG_LEFT_BIQUAD5:
103 case TAS3001C_REG_LEFT_BIQUAD6:
104
105 case TAS3001C_REG_RIGHT_BIQUAD0:
106 case TAS3001C_REG_RIGHT_BIQUAD1:
107 case TAS3001C_REG_RIGHT_BIQUAD2:
108 case TAS3001C_REG_RIGHT_BIQUAD3:
109 case TAS3001C_REG_RIGHT_BIQUAD4:
110 case TAS3001C_REG_RIGHT_BIQUAD5:
111 case TAS3001C_REG_RIGHT_BIQUAD6:
112 return 15;
113
114 default:
115 return 0;
116 }
117}
118
119static int
120tas3001c_write_register( struct tas3001c_data_t *self,
121 enum tas3001c_reg_t reg_num,
122 char *data,
123 uint write_mode)
124{
125 if (reg_num==TAS3001C_REG_MCR ||
126 reg_num==TAS3001C_REG_BASS ||
127 reg_num==TAS3001C_REG_TREBLE) {
128 return tas_write_byte_register(&self->super,
129 (uint)reg_num,
130 *data,
131 write_mode);
132 } else {
133 return tas_write_register(&self->super,
134 (uint)reg_num,
135 register_width(reg_num),
136 data,
137 write_mode);
138 }
139}
140
141static int
142tas3001c_sync_register( struct tas3001c_data_t *self,
143 enum tas3001c_reg_t reg_num)
144{
145 if (reg_num==TAS3001C_REG_MCR ||
146 reg_num==TAS3001C_REG_BASS ||
147 reg_num==TAS3001C_REG_TREBLE) {
148 return tas_sync_byte_register(&self->super,
149 (uint)reg_num,
150 register_width(reg_num));
151 } else {
152 return tas_sync_register(&self->super,
153 (uint)reg_num,
154 register_width(reg_num));
155 }
156}
157
158static int
159tas3001c_read_register( struct tas3001c_data_t *self,
160 enum tas3001c_reg_t reg_num,
161 char *data,
162 uint write_mode)
163{
164 return tas_read_register(&self->super,
165 (uint)reg_num,
166 register_width(reg_num),
167 data);
168}
169
170static inline int
171tas3001c_fast_load(struct tas3001c_data_t *self, int fast)
172{
173 if (fast)
174 self->super.shadow[TAS3001C_REG_MCR][0] |= 0x80;
175 else
176 self->super.shadow[TAS3001C_REG_MCR][0] &= 0x7f;
177 return tas3001c_sync_register(self,TAS3001C_REG_MCR);
178}
179
180static uint
181tas3001c_supported_mixers(struct tas3001c_data_t *self)
182{
183 return SOUND_MASK_VOLUME |
184 SOUND_MASK_PCM |
185 SOUND_MASK_ALTPCM |
186 SOUND_MASK_TREBLE |
187 SOUND_MASK_BASS;
188}
189
190static int
191tas3001c_mixer_is_stereo(struct tas3001c_data_t *self,int mixer)
192{
193 switch(mixer) {
194 case SOUND_MIXER_VOLUME:
195 return 1;
196 default:
197 return 0;
198 }
199}
200
201static uint
202tas3001c_stereo_mixers(struct tas3001c_data_t *self)
203{
204 uint r=tas3001c_supported_mixers(self);
205 uint i;
206
207 for (i=1; i<SOUND_MIXER_NRDEVICES; i++)
208 if (r&(1<<i) && !tas3001c_mixer_is_stereo(self,i))
209 r &= ~(1<<i);
210 return r;
211}
212
213static int
214tas3001c_get_mixer_level(struct tas3001c_data_t *self,int mixer,uint *level)
215{
216 if (!self)
217 return -1;
218
219 *level=self->super.mixer[mixer];
220
221 return 0;
222}
223
224static int
225tas3001c_set_mixer_level(struct tas3001c_data_t *self,int mixer,uint level)
226{
227 int rc;
228 tas_shadow_t *shadow;
229
230 uint temp;
231 uint offset=0;
232
233 if (!self)
234 return -1;
235
236 shadow=self->super.shadow;
237
238 if (!tas3001c_mixer_is_stereo(self,mixer))
239 level = tas_mono_to_stereo(level);
240
241 switch(mixer) {
242 case SOUND_MIXER_VOLUME:
243 temp = tas3001c_gain.master[level&0xff];
244 shadow[TAS3001C_REG_VOLUME][0] = (temp >> 16) & 0xff;
245 shadow[TAS3001C_REG_VOLUME][1] = (temp >> 8) & 0xff;
246 shadow[TAS3001C_REG_VOLUME][2] = (temp >> 0) & 0xff;
247 temp = tas3001c_gain.master[(level>>8)&0xff];
248 shadow[TAS3001C_REG_VOLUME][3] = (temp >> 16) & 0xff;
249 shadow[TAS3001C_REG_VOLUME][4] = (temp >> 8) & 0xff;
250 shadow[TAS3001C_REG_VOLUME][5] = (temp >> 0) & 0xff;
251 rc = tas3001c_sync_register(self,TAS3001C_REG_VOLUME);
252 break;
253 case SOUND_MIXER_ALTPCM:
254 /* tas3001c_fast_load(self, 1); */
255 level = tas_mono_to_stereo(level);
256 temp = tas3001c_gain.mixer[level&0xff];
257 shadow[TAS3001C_REG_MIXER2][offset+0] = (temp >> 16) & 0xff;
258 shadow[TAS3001C_REG_MIXER2][offset+1] = (temp >> 8) & 0xff;
259 shadow[TAS3001C_REG_MIXER2][offset+2] = (temp >> 0) & 0xff;
260 rc = tas3001c_sync_register(self,TAS3001C_REG_MIXER2);
261 /* tas3001c_fast_load(self, 0); */
262 break;
263 case SOUND_MIXER_PCM:
264 /* tas3001c_fast_load(self, 1); */
265 level = tas_mono_to_stereo(level);
266 temp = tas3001c_gain.mixer[level&0xff];
267 shadow[TAS3001C_REG_MIXER1][offset+0] = (temp >> 16) & 0xff;
268 shadow[TAS3001C_REG_MIXER1][offset+1] = (temp >> 8) & 0xff;
269 shadow[TAS3001C_REG_MIXER1][offset+2] = (temp >> 0) & 0xff;
270 rc = tas3001c_sync_register(self,TAS3001C_REG_MIXER1);
271 /* tas3001c_fast_load(self, 0); */
272 break;
273 case SOUND_MIXER_TREBLE:
274 temp = tas3001c_gain.treble[level&0xff];
275 shadow[TAS3001C_REG_TREBLE][0]=temp&0xff;
276 rc = tas3001c_sync_register(self,TAS3001C_REG_TREBLE);
277 break;
278 case SOUND_MIXER_BASS:
279 temp = tas3001c_gain.bass[level&0xff];
280 shadow[TAS3001C_REG_BASS][0]=temp&0xff;
281 rc = tas3001c_sync_register(self,TAS3001C_REG_BASS);
282 break;
283 default:
284 rc = -1;
285 break;
286 }
287 if (rc < 0)
288 return rc;
289 self->super.mixer[mixer]=level;
290 return 0;
291}
292
293static int
294tas3001c_leave_sleep(struct tas3001c_data_t *self)
295{
296 unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
297
298 if (!self)
299 return -1;
300
301 /* Make sure something answers on the i2c bus */
302 if (tas3001c_write_register(self, TAS3001C_REG_MCR, &mcr,
303 WRITE_NORMAL|FORCE_WRITE) < 0)
304 return -1;
305
306 tas3001c_fast_load(self, 1);
307
308 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD0);
309 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD1);
310 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD2);
311 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD3);
312 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD4);
313 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD5);
314
315 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD0);
316 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD1);
317 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD2);
318 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD3);
319 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD4);
320 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD5);
321
322 tas3001c_fast_load(self, 0);
323
324 (void)tas3001c_sync_register(self,TAS3001C_REG_BASS);
325 (void)tas3001c_sync_register(self,TAS3001C_REG_TREBLE);
326 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER1);
327 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER2);
328 (void)tas3001c_sync_register(self,TAS3001C_REG_VOLUME);
329
330 return 0;
331}
332
333static int
334tas3001c_enter_sleep(struct tas3001c_data_t *self)
335{
336 /* Stub for now, but I have the details on low-power mode */
337 if (!self)
338 return -1;
339 return 0;
340}
341
342static int
343tas3001c_sync_biquad( struct tas3001c_data_t *self,
344 u_int channel,
345 u_int filter)
346{
347 enum tas3001c_reg_t reg;
348
349 if (channel >= TAS3001C_BIQUAD_CHANNEL_COUNT ||
350 filter >= TAS3001C_BIQUAD_FILTER_COUNT) return -EINVAL;
351
352 reg=( channel ? TAS3001C_REG_RIGHT_BIQUAD0 : TAS3001C_REG_LEFT_BIQUAD0 ) + filter;
353
354 return tas3001c_sync_register(self,reg);
355}
356
357static int
358tas3001c_write_biquad_shadow( struct tas3001c_data_t *self,
359 u_int channel,
360 u_int filter,
361 const union tas_biquad_t *biquad)
362{
363 tas_shadow_t *shadow=self->super.shadow;
364 enum tas3001c_reg_t reg;
365
366 if (channel >= TAS3001C_BIQUAD_CHANNEL_COUNT ||
367 filter >= TAS3001C_BIQUAD_FILTER_COUNT) return -EINVAL;
368
369 reg=( channel ? TAS3001C_REG_RIGHT_BIQUAD0 : TAS3001C_REG_LEFT_BIQUAD0 ) + filter;
370
371 SET_4_20(shadow[reg], 0,biquad->coeff.b0);
372 SET_4_20(shadow[reg], 3,biquad->coeff.b1);
373 SET_4_20(shadow[reg], 6,biquad->coeff.b2);
374 SET_4_20(shadow[reg], 9,biquad->coeff.a1);
375 SET_4_20(shadow[reg],12,biquad->coeff.a2);
376
377 return 0;
378}
379
380static int
381tas3001c_write_biquad( struct tas3001c_data_t *self,
382 u_int channel,
383 u_int filter,
384 const union tas_biquad_t *biquad)
385{
386 int rc;
387
388 rc=tas3001c_write_biquad_shadow(self, channel, filter, biquad);
389 if (rc < 0) return rc;
390
391 return tas3001c_sync_biquad(self, channel, filter);
392}
393
394static int
395tas3001c_write_biquad_list( struct tas3001c_data_t *self,
396 u_int filter_count,
397 u_int flags,
398 struct tas_biquad_ctrl_t *biquads)
399{
400 int i;
401 int rc;
402
403 if (flags & TAS_BIQUAD_FAST_LOAD) tas3001c_fast_load(self,1);
404
405 for (i=0; i<filter_count; i++) {
406 rc=tas3001c_write_biquad(self,
407 biquads[i].channel,
408 biquads[i].filter,
409 &biquads[i].data);
410 if (rc < 0) break;
411 }
412
413 if (flags & TAS_BIQUAD_FAST_LOAD) {
414 tas3001c_fast_load(self,0);
415
416 (void)tas3001c_sync_register(self,TAS3001C_REG_BASS);
417 (void)tas3001c_sync_register(self,TAS3001C_REG_TREBLE);
418 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER1);
419 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER2);
420 (void)tas3001c_sync_register(self,TAS3001C_REG_VOLUME);
421 }
422
423 return rc;
424}
425
426static int
427tas3001c_read_biquad( struct tas3001c_data_t *self,
428 u_int channel,
429 u_int filter,
430 union tas_biquad_t *biquad)
431{
432 tas_shadow_t *shadow=self->super.shadow;
433 enum tas3001c_reg_t reg;
434
435 if (channel >= TAS3001C_BIQUAD_CHANNEL_COUNT ||
436 filter >= TAS3001C_BIQUAD_FILTER_COUNT) return -EINVAL;
437
438 reg=( channel ? TAS3001C_REG_RIGHT_BIQUAD0 : TAS3001C_REG_LEFT_BIQUAD0 ) + filter;
439
440 biquad->coeff.b0=GET_4_20(shadow[reg], 0);
441 biquad->coeff.b1=GET_4_20(shadow[reg], 3);
442 biquad->coeff.b2=GET_4_20(shadow[reg], 6);
443 biquad->coeff.a1=GET_4_20(shadow[reg], 9);
444 biquad->coeff.a2=GET_4_20(shadow[reg],12);
445
446 return 0;
447}
448
449static int
450tas3001c_eq_rw( struct tas3001c_data_t *self,
451 u_int cmd,
452 u_long arg)
453{
454 int rc;
455 struct tas_biquad_ctrl_t biquad;
456 void __user *argp = (void __user *)arg;
457
458 if (copy_from_user(&biquad, argp, sizeof(struct tas_biquad_ctrl_t))) {
459 return -EFAULT;
460 }
461
462 if (cmd & SIOC_IN) {
463 rc=tas3001c_write_biquad(self, biquad.channel, biquad.filter, &biquad.data);
464 if (rc != 0) return rc;
465 }
466
467 if (cmd & SIOC_OUT) {
468 rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
469 if (rc != 0) return rc;
470
471 if (copy_to_user(argp, &biquad, sizeof(struct tas_biquad_ctrl_t))) {
472 return -EFAULT;
473 }
474
475 }
476 return 0;
477}
478
479static int
480tas3001c_eq_list_rw( struct tas3001c_data_t *self,
481 u_int cmd,
482 u_long arg)
483{
484 int rc;
485 int filter_count;
486 int flags;
487 int i,j;
488 char sync_required[2][6];
489 struct tas_biquad_ctrl_t biquad;
490 struct tas_biquad_ctrl_list_t __user *argp = (void __user *)arg;
491
492 memset(sync_required,0,sizeof(sync_required));
493
494 if (copy_from_user(&filter_count, &argp->filter_count, sizeof(int)))
495 return -EFAULT;
496
497 if (copy_from_user(&flags, &argp->flags, sizeof(int)))
498 return -EFAULT;
499
500 if (cmd & SIOC_IN) {
501 }
502
503 for (i=0; i < filter_count; i++) {
504 if (copy_from_user(&biquad, &argp->biquads[i],
505 sizeof(struct tas_biquad_ctrl_t))) {
506 return -EFAULT;
507 }
508
509 if (cmd & SIOC_IN) {
510 sync_required[biquad.channel][biquad.filter]=1;
511 rc=tas3001c_write_biquad_shadow(self, biquad.channel, biquad.filter, &biquad.data);
512 if (rc != 0) return rc;
513 }
514
515 if (cmd & SIOC_OUT) {
516 rc=tas3001c_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
517 if (rc != 0) return rc;
518
519 if (copy_to_user(&argp->biquads[i], &biquad,
520 sizeof(struct tas_biquad_ctrl_t))) {
521 return -EFAULT;
522 }
523 }
524 }
525
526 if (cmd & SIOC_IN) {
527 if (flags & TAS_BIQUAD_FAST_LOAD) tas3001c_fast_load(self,1);
528 for (i=0; i<2; i++) {
529 for (j=0; j<6; j++) {
530 if (sync_required[i][j]) {
531 rc=tas3001c_sync_biquad(self, i, j);
532 if (rc < 0) return rc;
533 }
534 }
535 }
536 if (flags & TAS_BIQUAD_FAST_LOAD) {
537 tas3001c_fast_load(self,0);
538 /* now we need to set up the mixers again,
539 because leaving fast mode resets them. */
540 (void)tas3001c_sync_register(self,TAS3001C_REG_BASS);
541 (void)tas3001c_sync_register(self,TAS3001C_REG_TREBLE);
542 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER1);
543 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER2);
544 (void)tas3001c_sync_register(self,TAS3001C_REG_VOLUME);
545 }
546 }
547
548 return 0;
549}
550
551static int
552tas3001c_update_drce( struct tas3001c_data_t *self,
553 int flags,
554 struct tas_drce_t *drce)
555{
556 tas_shadow_t *shadow;
557 shadow=self->super.shadow;
558
559 shadow[TAS3001C_REG_DRC][1] = 0xc1;
560
561 if (flags & TAS_DRCE_THRESHOLD) {
562 self->drce_state.threshold=quantize_db(drce->threshold);
563 shadow[TAS3001C_REG_DRC][2] = db_to_regval(self->drce_state.threshold);
564 }
565
566 if (flags & TAS_DRCE_ENABLE) {
567 self->drce_state.enable = drce->enable;
568 }
569
570 if (!self->drce_state.enable) {
571 shadow[TAS3001C_REG_DRC][0] = 0xf0;
572 }
573
574#ifdef DEBUG_DRCE
575 printk("DRCE IOCTL: set [ ENABLE:%x THRESH:%x\n",
576 self->drce_state.enable,
577 self->drce_state.threshold);
578
579 printk("DRCE IOCTL: reg [ %02x %02x ]\n",
580 (unsigned char)shadow[TAS3001C_REG_DRC][0],
581 (unsigned char)shadow[TAS3001C_REG_DRC][1]);
582#endif
583
584 return tas3001c_sync_register(self, TAS3001C_REG_DRC);
585}
586
587static int
588tas3001c_drce_rw( struct tas3001c_data_t *self,
589 u_int cmd,
590 u_long arg)
591{
592 int rc;
593 struct tas_drce_ctrl_t drce_ctrl;
594 void __user *argp = (void __user *)arg;
595
596 if (copy_from_user(&drce_ctrl, argp, sizeof(struct tas_drce_ctrl_t)))
597 return -EFAULT;
598
599#ifdef DEBUG_DRCE
600 printk("DRCE IOCTL: input [ FLAGS:%x ENABLE:%x THRESH:%x\n",
601 drce_ctrl.flags,
602 drce_ctrl.data.enable,
603 drce_ctrl.data.threshold);
604#endif
605
606 if (cmd & SIOC_IN) {
607 rc = tas3001c_update_drce(self, drce_ctrl.flags, &drce_ctrl.data);
608 if (rc < 0)
609 return rc;
610 }
611
612 if (cmd & SIOC_OUT) {
613 if (drce_ctrl.flags & TAS_DRCE_ENABLE)
614 drce_ctrl.data.enable = self->drce_state.enable;
615
616 if (drce_ctrl.flags & TAS_DRCE_THRESHOLD)
617 drce_ctrl.data.threshold = self->drce_state.threshold;
618
619 if (copy_to_user(argp, &drce_ctrl,
620 sizeof(struct tas_drce_ctrl_t))) {
621 return -EFAULT;
622 }
623 }
624
625 return 0;
626}
627
628static void
629tas3001c_update_device_parameters(struct tas3001c_data_t *self)
630{
631 int i,j;
632
633 if (!self) return;
634
635 if (self->output_id == TAS_OUTPUT_HEADPHONES) {
636 tas3001c_fast_load(self, 1);
637
638 for (i=0; i<TAS3001C_BIQUAD_CHANNEL_COUNT; i++) {
639 for (j=0; j<TAS3001C_BIQUAD_FILTER_COUNT; j++) {
640 tas3001c_write_biquad(self, i, j, &tas3001c_eq_unity);
641 }
642 }
643
644 tas3001c_fast_load(self, 0);
645
646 (void)tas3001c_sync_register(self,TAS3001C_REG_BASS);
647 (void)tas3001c_sync_register(self,TAS3001C_REG_TREBLE);
648 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER1);
649 (void)tas3001c_sync_register(self,TAS3001C_REG_MIXER2);
650 (void)tas3001c_sync_register(self,TAS3001C_REG_VOLUME);
651
652 return;
653 }
654
655 for (i=0; tas3001c_eq_prefs[i]; i++) {
656 struct tas_eq_pref_t *eq = tas3001c_eq_prefs[i];
657
658 if (eq->device_id == self->device_id &&
659 (eq->output_id == 0 || eq->output_id == self->output_id) &&
660 (eq->speaker_id == 0 || eq->speaker_id == self->speaker_id)) {
661
662 tas3001c_update_drce(self, TAS_DRCE_ALL, eq->drce);
663 tas3001c_write_biquad_list(self, eq->filter_count, TAS_BIQUAD_FAST_LOAD, eq->biquads);
664
665 break;
666 }
667 }
668}
669
670static void
671tas3001c_device_change_handler(struct work_struct *work)
672{
673 struct tas3001c_data_t *self;
674 self = container_of(work, struct tas3001c_data_t, change);
675 tas3001c_update_device_parameters(self);
676}
677
678static int
679tas3001c_output_device_change( struct tas3001c_data_t *self,
680 int device_id,
681 int output_id,
682 int speaker_id)
683{
684 self->device_id=device_id;
685 self->output_id=output_id;
686 self->speaker_id=speaker_id;
687
688 schedule_work(&self->change);
689 return 0;
690}
691
692static int
693tas3001c_device_ioctl( struct tas3001c_data_t *self,
694 u_int cmd,
695 u_long arg)
696{
697 uint __user *argp = (void __user *)arg;
698 switch (cmd) {
699 case TAS_READ_EQ:
700 case TAS_WRITE_EQ:
701 return tas3001c_eq_rw(self, cmd, arg);
702
703 case TAS_READ_EQ_LIST:
704 case TAS_WRITE_EQ_LIST:
705 return tas3001c_eq_list_rw(self, cmd, arg);
706
707 case TAS_READ_EQ_FILTER_COUNT:
708 put_user(TAS3001C_BIQUAD_FILTER_COUNT, argp);
709 return 0;
710
711 case TAS_READ_EQ_CHANNEL_COUNT:
712 put_user(TAS3001C_BIQUAD_CHANNEL_COUNT, argp);
713 return 0;
714
715 case TAS_READ_DRCE:
716 case TAS_WRITE_DRCE:
717 return tas3001c_drce_rw(self, cmd, arg);
718
719 case TAS_READ_DRCE_CAPS:
720 put_user(TAS_DRCE_ENABLE | TAS_DRCE_THRESHOLD, argp);
721 return 0;
722
723 case TAS_READ_DRCE_MIN:
724 case TAS_READ_DRCE_MAX: {
725 struct tas_drce_ctrl_t drce_ctrl;
726
727 if (copy_from_user(&drce_ctrl, argp,
728 sizeof(struct tas_drce_ctrl_t))) {
729 return -EFAULT;
730 }
731
732 if (drce_ctrl.flags & TAS_DRCE_THRESHOLD) {
733 if (cmd == TAS_READ_DRCE_MIN) {
734 drce_ctrl.data.threshold=-36<<8;
735 } else {
736 drce_ctrl.data.threshold=-6<<8;
737 }
738 }
739
740 if (copy_to_user(argp, &drce_ctrl,
741 sizeof(struct tas_drce_ctrl_t))) {
742 return -EFAULT;
743 }
744 }
745 }
746
747 return -EINVAL;
748}
749
750static int
751tas3001c_init_mixer(struct tas3001c_data_t *self)
752{
753 unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
754
755 /* Make sure something answers on the i2c bus */
756 if (tas3001c_write_register(self, TAS3001C_REG_MCR, &mcr,
757 WRITE_NORMAL|FORCE_WRITE) < 0)
758 return -1;
759
760 tas3001c_fast_load(self, 1);
761
762 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD0);
763 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD1);
764 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD2);
765 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD3);
766 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD4);
767 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD5);
768 (void)tas3001c_sync_register(self,TAS3001C_REG_RIGHT_BIQUAD6);
769
770 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD0);
771 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD1);
772 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD2);
773 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD3);
774 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD4);
775 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD5);
776 (void)tas3001c_sync_register(self,TAS3001C_REG_LEFT_BIQUAD6);
777
778 tas3001c_fast_load(self, 0);
779
780 tas3001c_set_mixer_level(self, SOUND_MIXER_VOLUME, VOL_DEFAULT<<8 | VOL_DEFAULT);
781 tas3001c_set_mixer_level(self, SOUND_MIXER_PCM, INPUT_DEFAULT<<8 | INPUT_DEFAULT);
782 tas3001c_set_mixer_level(self, SOUND_MIXER_ALTPCM, 0);
783
784 tas3001c_set_mixer_level(self, SOUND_MIXER_BASS, BASS_DEFAULT);
785 tas3001c_set_mixer_level(self, SOUND_MIXER_TREBLE, TREBLE_DEFAULT);
786
787 return 0;
788}
789
790static int
791tas3001c_uninit_mixer(struct tas3001c_data_t *self)
792{
793 tas3001c_set_mixer_level(self, SOUND_MIXER_VOLUME, 0);
794 tas3001c_set_mixer_level(self, SOUND_MIXER_PCM, 0);
795 tas3001c_set_mixer_level(self, SOUND_MIXER_ALTPCM, 0);
796
797 tas3001c_set_mixer_level(self, SOUND_MIXER_BASS, 0);
798 tas3001c_set_mixer_level(self, SOUND_MIXER_TREBLE, 0);
799
800 return 0;
801}
802
803static int
804tas3001c_init(struct i2c_client *client)
805{
806 struct tas3001c_data_t *self;
807 size_t sz = sizeof(*self) + (TAS3001C_REG_MAX*sizeof(tas_shadow_t));
808 int i, j;
809
810 self = kzalloc(sz, GFP_KERNEL);
811 if (!self)
812 return -ENOMEM;
813
814 self->super.client = client;
815 self->super.shadow = (tas_shadow_t *)(self+1);
816 self->output_id = TAS_OUTPUT_HEADPHONES;
817
818 dev_set_drvdata(&client->dev, self);
819
820 for (i = 0; i < TAS3001C_BIQUAD_CHANNEL_COUNT; i++)
821 for (j = 0; j < TAS3001C_BIQUAD_FILTER_COUNT; j++)
822 tas3001c_write_biquad_shadow(self, i, j,
823 &tas3001c_eq_unity);
824
825 INIT_WORK(&self->change, tas3001c_device_change_handler);
826 return 0;
827}
828
829static void
830tas3001c_uninit(struct tas3001c_data_t *self)
831{
832 tas3001c_uninit_mixer(self);
833 kfree(self);
834}
835
836struct tas_driver_hooks_t tas3001c_hooks = {
837 .init = (tas_hook_init_t)tas3001c_init,
838 .post_init = (tas_hook_post_init_t)tas3001c_init_mixer,
839 .uninit = (tas_hook_uninit_t)tas3001c_uninit,
840 .get_mixer_level = (tas_hook_get_mixer_level_t)tas3001c_get_mixer_level,
841 .set_mixer_level = (tas_hook_set_mixer_level_t)tas3001c_set_mixer_level,
842 .enter_sleep = (tas_hook_enter_sleep_t)tas3001c_enter_sleep,
843 .leave_sleep = (tas_hook_leave_sleep_t)tas3001c_leave_sleep,
844 .supported_mixers = (tas_hook_supported_mixers_t)tas3001c_supported_mixers,
845 .mixer_is_stereo = (tas_hook_mixer_is_stereo_t)tas3001c_mixer_is_stereo,
846 .stereo_mixers = (tas_hook_stereo_mixers_t)tas3001c_stereo_mixers,
847 .output_device_change = (tas_hook_output_device_change_t)tas3001c_output_device_change,
848 .device_ioctl = (tas_hook_device_ioctl_t)tas3001c_device_ioctl
849};
diff --git a/sound/oss/dmasound/tas3001c.h b/sound/oss/dmasound/tas3001c.h
deleted file mode 100644
index 3660da33a2db..000000000000
--- a/sound/oss/dmasound/tas3001c.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Header file for the i2c/i2s based TA3001c sound chip used
3 * on some Apple hardware. Also known as "tumbler".
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive
7 * for more details.
8 *
9 * Written by Christopher C. Chimelis <chris@debian.org>
10 */
11
12#ifndef _TAS3001C_H_
13#define _TAS3001C_H_
14
15#include <linux/types.h>
16
17#include "tas_common.h"
18#include "tas_eq_prefs.h"
19
20/*
21 * Macros that correspond to the registers that we write to
22 * when setting the various values.
23 */
24
25#define TAS3001C_VERSION "0.3"
26#define TAS3001C_DATE "20011214"
27
28#define I2C_DRIVERNAME_TAS3001C "TAS3001c driver V " TAS3001C_VERSION
29#define I2C_DRIVERID_TAS3001C (I2C_DRIVERID_TAS_BASE+0)
30
31extern struct tas_driver_hooks_t tas3001c_hooks;
32extern struct tas_gain_t tas3001c_gain;
33extern struct tas_eq_pref_t *tas3001c_eq_prefs[];
34
35enum tas3001c_reg_t {
36 TAS3001C_REG_MCR = 0x01,
37 TAS3001C_REG_DRC = 0x02,
38
39 TAS3001C_REG_VOLUME = 0x04,
40 TAS3001C_REG_TREBLE = 0x05,
41 TAS3001C_REG_BASS = 0x06,
42 TAS3001C_REG_MIXER1 = 0x07,
43 TAS3001C_REG_MIXER2 = 0x08,
44
45 TAS3001C_REG_LEFT_BIQUAD0 = 0x0a,
46 TAS3001C_REG_LEFT_BIQUAD1 = 0x0b,
47 TAS3001C_REG_LEFT_BIQUAD2 = 0x0c,
48 TAS3001C_REG_LEFT_BIQUAD3 = 0x0d,
49 TAS3001C_REG_LEFT_BIQUAD4 = 0x0e,
50 TAS3001C_REG_LEFT_BIQUAD5 = 0x0f,
51 TAS3001C_REG_LEFT_BIQUAD6 = 0x10,
52
53 TAS3001C_REG_RIGHT_BIQUAD0 = 0x13,
54 TAS3001C_REG_RIGHT_BIQUAD1 = 0x14,
55 TAS3001C_REG_RIGHT_BIQUAD2 = 0x15,
56 TAS3001C_REG_RIGHT_BIQUAD3 = 0x16,
57 TAS3001C_REG_RIGHT_BIQUAD4 = 0x17,
58 TAS3001C_REG_RIGHT_BIQUAD5 = 0x18,
59 TAS3001C_REG_RIGHT_BIQUAD6 = 0x19,
60
61 TAS3001C_REG_MAX = 0x20
62};
63
64#endif /* _TAS3001C_H_ */
diff --git a/sound/oss/dmasound/tas3001c_tables.c b/sound/oss/dmasound/tas3001c_tables.c
deleted file mode 100644
index 1768fa95f25b..000000000000
--- a/sound/oss/dmasound/tas3001c_tables.c
+++ /dev/null
@@ -1,375 +0,0 @@
1#include "tas_common.h"
2#include "tas_eq_prefs.h"
3
4static struct tas_drce_t eqp_0e_2_1_drce = {
5 .enable = 1,
6 .above = { .val = 3.0 * (1<<8), .expand = 0 },
7 .below = { .val = 1.0 * (1<<8), .expand = 0 },
8 .threshold = -15.33 * (1<<8),
9 .energy = 2.4 * (1<<12),
10 .attack = 0.013 * (1<<12),
11 .decay = 0.212 * (1<<12),
12};
13
14static struct tas_biquad_ctrl_t eqp_0e_2_1_biquads[]={
15 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0FCAD3, 0xE06A58, 0x0FCAD3, 0xE06B09, 0x0F9657 } } },
16 { .channel = 0, .filter = 1, .data = { .coeff = { 0x041731, 0x082E63, 0x041731, 0xFD8D08, 0x02CFBD } } },
17 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0FFDC7, 0xE0524C, 0x0FBFAA, 0xE0524C, 0x0FBD72 } } },
18 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0F3D35, 0xE228CA, 0x0EC7B2, 0xE228CA, 0x0E04E8 } } },
19 { .channel = 0, .filter = 4, .data = { .coeff = { 0x0FCEBF, 0xE181C2, 0x0F2656, 0xE181C2, 0x0EF516 } } },
20 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0EC417, 0x073E22, 0x0B0633, 0x073E22, 0x09CA4A } } },
21
22 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0FCAD3, 0xE06A58, 0x0FCAD3, 0xE06B09, 0x0F9657 } } },
23 { .channel = 1, .filter = 1, .data = { .coeff = { 0x041731, 0x082E63, 0x041731, 0xFD8D08, 0x02CFBD } } },
24 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0FFDC7, 0xE0524C, 0x0FBFAA, 0xE0524C, 0x0FBD72 } } },
25 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0F3D35, 0xE228CA, 0x0EC7B2, 0xE228CA, 0x0E04E8 } } },
26 { .channel = 1, .filter = 4, .data = { .coeff = { 0x0FCEBF, 0xE181C2, 0x0F2656, 0xE181C2, 0x0EF516 } } },
27 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0EC417, 0x073E22, 0x0B0633, 0x073E22, 0x09CA4A } } },
28};
29
30static struct tas_eq_pref_t eqp_0e_2_1 = {
31 .sample_rate = 44100,
32 .device_id = 0x0e,
33 .output_id = TAS_OUTPUT_EXTERNAL_SPKR,
34 .speaker_id = 0x01,
35
36 .drce = &eqp_0e_2_1_drce,
37
38 .filter_count = 12,
39 .biquads = eqp_0e_2_1_biquads
40};
41
42/* ======================================================================== */
43
44static struct tas_drce_t eqp_10_1_0_drce={
45 .enable = 1,
46 .above = { .val = 3.0 * (1<<8), .expand = 0 },
47 .below = { .val = 1.0 * (1<<8), .expand = 0 },
48 .threshold = -12.46 * (1<<8),
49 .energy = 2.4 * (1<<12),
50 .attack = 0.013 * (1<<12),
51 .decay = 0.212 * (1<<12),
52};
53
54static struct tas_biquad_ctrl_t eqp_10_1_0_biquads[]={
55 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0F4A12, 0xE16BDA, 0x0F4A12, 0xE173F0, 0x0E9C3A } } },
56 { .channel = 0, .filter = 1, .data = { .coeff = { 0x02DD54, 0x05BAA8, 0x02DD54, 0xF8001D, 0x037532 } } },
57 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0E2FC7, 0xE4D5DC, 0x0D7477, 0xE4D5DC, 0x0BA43F } } },
58 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0E7899, 0xE67CCA, 0x0D0E93, 0xE67CCA, 0x0B872D } } },
59 { .channel = 0, .filter = 4, .data = { .coeff = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 } } },
60 { .channel = 0, .filter = 5, .data = { .coeff = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 } } },
61
62 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0F4A12, 0xE16BDA, 0x0F4A12, 0xE173F0, 0x0E9C3A } } },
63 { .channel = 1, .filter = 1, .data = { .coeff = { 0x02DD54, 0x05BAA8, 0x02DD54, 0xF8001D, 0x037532 } } },
64 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0E2FC7, 0xE4D5DC, 0x0D7477, 0xE4D5DC, 0x0BA43F } } },
65 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0E7899, 0xE67CCA, 0x0D0E93, 0xE67CCA, 0x0B872D } } },
66 { .channel = 1, .filter = 4, .data = { .coeff = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 } } },
67 { .channel = 1, .filter = 5, .data = { .coeff = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 } } },
68};
69
70static struct tas_eq_pref_t eqp_10_1_0 = {
71 .sample_rate = 44100,
72 .device_id = 0x10,
73 .output_id = TAS_OUTPUT_INTERNAL_SPKR,
74 .speaker_id = 0x00,
75
76 .drce = &eqp_10_1_0_drce,
77
78 .filter_count = 12,
79 .biquads = eqp_10_1_0_biquads
80};
81
82/* ======================================================================== */
83
84static struct tas_drce_t eqp_15_2_1_drce={
85 .enable = 1,
86 .above = { .val = 3.0 * (1<<8), .expand = 0 },
87 .below = { .val = 1.0 * (1<<8), .expand = 0 },
88 .threshold = -15.33 * (1<<8),
89 .energy = 2.4 * (1<<12),
90 .attack = 0.013 * (1<<12),
91 .decay = 0.212 * (1<<12),
92};
93
94static struct tas_biquad_ctrl_t eqp_15_2_1_biquads[]={
95 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0FE143, 0xE05204, 0x0FCCC5, 0xE05266, 0x0FAE6B } } },
96 { .channel = 0, .filter = 1, .data = { .coeff = { 0x102383, 0xE03A03, 0x0FA325, 0xE03A03, 0x0FC6A8 } } },
97 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0FF2AB, 0xE06285, 0x0FB20A, 0xE06285, 0x0FA4B5 } } },
98 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0F544D, 0xE35971, 0x0D8F3A, 0xE35971, 0x0CE388 } } },
99 { .channel = 0, .filter = 4, .data = { .coeff = { 0x13E1D3, 0xF3ECB5, 0x042227, 0xF3ECB5, 0x0803FA } } },
100 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0AC119, 0x034181, 0x078AB1, 0x034181, 0x024BCA } } },
101
102 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0FE143, 0xE05204, 0x0FCCC5, 0xE05266, 0x0FAE6B } } },
103 { .channel = 1, .filter = 1, .data = { .coeff = { 0x102383, 0xE03A03, 0x0FA325, 0xE03A03, 0x0FC6A8 } } },
104 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0FF2AB, 0xE06285, 0x0FB20A, 0xE06285, 0x0FA4B5 } } },
105 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0F544D, 0xE35971, 0x0D8F3A, 0xE35971, 0x0CE388 } } },
106 { .channel = 1, .filter = 4, .data = { .coeff = { 0x13E1D3, 0xF3ECB5, 0x042227, 0xF3ECB5, 0x0803FA } } },
107 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0AC119, 0x034181, 0x078AB1, 0x034181, 0x024BCA } } },
108};
109
110static struct tas_eq_pref_t eqp_15_2_1 = {
111 .sample_rate = 44100,
112 .device_id = 0x15,
113 .output_id = TAS_OUTPUT_EXTERNAL_SPKR,
114 .speaker_id = 0x01,
115
116 .drce = &eqp_15_2_1_drce,
117
118 .filter_count = 12,
119 .biquads = eqp_15_2_1_biquads
120};
121
122/* ======================================================================== */
123
124static struct tas_drce_t eqp_15_1_0_drce={
125 .enable = 1,
126 .above = { .val = 3.0 * (1<<8), .expand = 0 },
127 .below = { .val = 1.0 * (1<<8), .expand = 0 },
128 .threshold = 0.0 * (1<<8),
129 .energy = 2.4 * (1<<12),
130 .attack = 0.013 * (1<<12),
131 .decay = 0.212 * (1<<12),
132};
133
134static struct tas_biquad_ctrl_t eqp_15_1_0_biquads[]={
135 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0FAD08, 0xE0A5EF, 0x0FAD08, 0xE0A79D, 0x0F5BBE } } },
136 { .channel = 0, .filter = 1, .data = { .coeff = { 0x04B38D, 0x09671B, 0x04B38D, 0x000F71, 0x02BEC5 } } },
137 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0FDD32, 0xE0A56F, 0x0F8A69, 0xE0A56F, 0x0F679C } } },
138 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0FD284, 0xE135FB, 0x0F2161, 0xE135FB, 0x0EF3E5 } } },
139 { .channel = 0, .filter = 4, .data = { .coeff = { 0x0E81B1, 0xE6283F, 0x0CE49D, 0xE6283F, 0x0B664F } } },
140 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0F2D62, 0xE98797, 0x0D1E19, 0xE98797, 0x0C4B7B } } },
141
142 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0FAD08, 0xE0A5EF, 0x0FAD08, 0xE0A79D, 0x0F5BBE } } },
143 { .channel = 1, .filter = 1, .data = { .coeff = { 0x04B38D, 0x09671B, 0x04B38D, 0x000F71, 0x02BEC5 } } },
144 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0FDD32, 0xE0A56F, 0x0F8A69, 0xE0A56F, 0x0F679C } } },
145 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0FD284, 0xE135FB, 0x0F2161, 0xE135FB, 0x0EF3E5 } } },
146 { .channel = 1, .filter = 4, .data = { .coeff = { 0x0E81B1, 0xE6283F, 0x0CE49D, 0xE6283F, 0x0B664F } } },
147 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0F2D62, 0xE98797, 0x0D1E19, 0xE98797, 0x0C4B7B } } },
148};
149
150static struct tas_eq_pref_t eqp_15_1_0 = {
151 .sample_rate = 44100,
152 .device_id = 0x15,
153 .output_id = TAS_OUTPUT_INTERNAL_SPKR,
154 .speaker_id = 0x00,
155
156 .drce = &eqp_15_1_0_drce,
157
158 .filter_count = 12,
159 .biquads = eqp_15_1_0_biquads
160};
161
162/* ======================================================================== */
163
164static struct tas_drce_t eqp_0f_2_1_drce={
165 .enable = 1,
166 .above = { .val = 3.0 * (1<<8), .expand = 0 },
167 .below = { .val = 1.0 * (1<<8), .expand = 0 },
168 .threshold = -15.33 * (1<<8),
169 .energy = 2.4 * (1<<12),
170 .attack = 0.013 * (1<<12),
171 .decay = 0.212 * (1<<12),
172};
173
174static struct tas_biquad_ctrl_t eqp_0f_2_1_biquads[]={
175 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0FE143, 0xE05204, 0x0FCCC5, 0xE05266, 0x0FAE6B } } },
176 { .channel = 0, .filter = 1, .data = { .coeff = { 0x102383, 0xE03A03, 0x0FA325, 0xE03A03, 0x0FC6A8 } } },
177 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0FF2AB, 0xE06285, 0x0FB20A, 0xE06285, 0x0FA4B5 } } },
178 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0F544D, 0xE35971, 0x0D8F3A, 0xE35971, 0x0CE388 } } },
179 { .channel = 0, .filter = 4, .data = { .coeff = { 0x13E1D3, 0xF3ECB5, 0x042227, 0xF3ECB5, 0x0803FA } } },
180 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0AC119, 0x034181, 0x078AB1, 0x034181, 0x024BCA } } },
181
182 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0FE143, 0xE05204, 0x0FCCC5, 0xE05266, 0x0FAE6B } } },
183 { .channel = 1, .filter = 1, .data = { .coeff = { 0x102383, 0xE03A03, 0x0FA325, 0xE03A03, 0x0FC6A8 } } },
184 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0FF2AB, 0xE06285, 0x0FB20A, 0xE06285, 0x0FA4B5 } } },
185 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0F544D, 0xE35971, 0x0D8F3A, 0xE35971, 0x0CE388 } } },
186 { .channel = 1, .filter = 4, .data = { .coeff = { 0x13E1D3, 0xF3ECB5, 0x042227, 0xF3ECB5, 0x0803FA } } },
187 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0AC119, 0x034181, 0x078AB1, 0x034181, 0x024BCA } } },
188};
189
190static struct tas_eq_pref_t eqp_0f_2_1 = {
191 .sample_rate = 44100,
192 .device_id = 0x0f,
193 .output_id = TAS_OUTPUT_EXTERNAL_SPKR,
194 .speaker_id = 0x01,
195
196 .drce = &eqp_0f_2_1_drce,
197
198 .filter_count = 12,
199 .biquads = eqp_0f_2_1_biquads
200};
201
202/* ======================================================================== */
203
204static struct tas_drce_t eqp_0f_1_0_drce={
205 .enable = 1,
206 .above = { .val = 3.0 * (1<<8), .expand = 0 },
207 .below = { .val = 1.0 * (1<<8), .expand = 0 },
208 .threshold = -15.33 * (1<<8),
209 .energy = 2.4 * (1<<12),
210 .attack = 0.013 * (1<<12),
211 .decay = 0.212 * (1<<12),
212};
213
214static struct tas_biquad_ctrl_t eqp_0f_1_0_biquads[]={
215 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0FCAD3, 0xE06A58, 0x0FCAD3, 0xE06B09, 0x0F9657 } } },
216 { .channel = 0, .filter = 1, .data = { .coeff = { 0x041731, 0x082E63, 0x041731, 0xFD8D08, 0x02CFBD } } },
217 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0FFDC7, 0xE0524C, 0x0FBFAA, 0xE0524C, 0x0FBD72 } } },
218 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0F3D35, 0xE228CA, 0x0EC7B2, 0xE228CA, 0x0E04E8 } } },
219 { .channel = 0, .filter = 4, .data = { .coeff = { 0x0FCEBF, 0xE181C2, 0x0F2656, 0xE181C2, 0x0EF516 } } },
220 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0EC417, 0x073E22, 0x0B0633, 0x073E22, 0x09CA4A } } },
221
222 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0FCAD3, 0xE06A58, 0x0FCAD3, 0xE06B09, 0x0F9657 } } },
223 { .channel = 1, .filter = 1, .data = { .coeff = { 0x041731, 0x082E63, 0x041731, 0xFD8D08, 0x02CFBD } } },
224 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0FFDC7, 0xE0524C, 0x0FBFAA, 0xE0524C, 0x0FBD72 } } },
225 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0F3D35, 0xE228CA, 0x0EC7B2, 0xE228CA, 0x0E04E8 } } },
226 { .channel = 1, .filter = 4, .data = { .coeff = { 0x0FCEBF, 0xE181C2, 0x0F2656, 0xE181C2, 0x0EF516 } } },
227 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0EC417, 0x073E22, 0x0B0633, 0x073E22, 0x09CA4A } } },
228};
229
230static struct tas_eq_pref_t eqp_0f_1_0 = {
231 .sample_rate = 44100,
232 .device_id = 0x0f,
233 .output_id = TAS_OUTPUT_INTERNAL_SPKR,
234 .speaker_id = 0x00,
235
236 .drce = &eqp_0f_1_0_drce,
237
238 .filter_count = 12,
239 .biquads = eqp_0f_1_0_biquads
240};
241
242/* ======================================================================== */
243
244static uint tas3001c_master_tab[]={
245 0x0, 0x75, 0x9c, 0xbb,
246 0xdb, 0xfb, 0x11e, 0x143,
247 0x16b, 0x196, 0x1c3, 0x1f5,
248 0x229, 0x263, 0x29f, 0x2e1,
249 0x328, 0x373, 0x3c5, 0x41b,
250 0x478, 0x4dc, 0x547, 0x5b8,
251 0x633, 0x6b5, 0x740, 0x7d5,
252 0x873, 0x91c, 0x9d2, 0xa92,
253 0xb5e, 0xc39, 0xd22, 0xe19,
254 0xf20, 0x1037, 0x1161, 0x129e,
255 0x13ed, 0x1551, 0x16ca, 0x185d,
256 0x1a08, 0x1bcc, 0x1dac, 0x1fa7,
257 0x21c1, 0x23fa, 0x2655, 0x28d6,
258 0x2b7c, 0x2e4a, 0x3141, 0x3464,
259 0x37b4, 0x3b35, 0x3ee9, 0x42d3,
260 0x46f6, 0x4b53, 0x4ff0, 0x54ce,
261 0x59f2, 0x5f5f, 0x6519, 0x6b24,
262 0x7183, 0x783c, 0x7f53, 0x86cc,
263 0x8ead, 0x96fa, 0x9fba, 0xa8f2,
264 0xb2a7, 0xbce1, 0xc7a5, 0xd2fa,
265 0xdee8, 0xeb75, 0xf8aa, 0x1068e,
266 0x1152a, 0x12487, 0x134ad, 0x145a5,
267 0x1577b, 0x16a37, 0x17df5, 0x192bd,
268 0x1a890, 0x1bf7b, 0x1d78d, 0x1f0d1,
269 0x20b55, 0x22727, 0x24456, 0x262f2,
270 0x2830b
271};
272
273static uint tas3001c_mixer_tab[]={
274 0x0, 0x748, 0x9be, 0xbaf,
275 0xda4, 0xfb1, 0x11de, 0x1431,
276 0x16ad, 0x1959, 0x1c37, 0x1f4b,
277 0x2298, 0x2628, 0x29fb, 0x2e12,
278 0x327d, 0x3734, 0x3c47, 0x41b4,
279 0x4787, 0x4dbe, 0x546d, 0x5b86,
280 0x632e, 0x6b52, 0x7400, 0x7d54,
281 0x873b, 0x91c6, 0x9d1a, 0xa920,
282 0xb5e5, 0xc38c, 0xd21b, 0xe18f,
283 0xf1f5, 0x1036a, 0x1160f, 0x129d6,
284 0x13ed0, 0x1550c, 0x16ca0, 0x185c9,
285 0x1a07b, 0x1bcc3, 0x1dab9, 0x1fa75,
286 0x21c0f, 0x23fa3, 0x26552, 0x28d64,
287 0x2b7c9, 0x2e4a2, 0x31411, 0x3463b,
288 0x37b44, 0x3b353, 0x3ee94, 0x42d30,
289 0x46f55, 0x4b533, 0x4fefc, 0x54ce5,
290 0x59f25, 0x5f5f6, 0x65193, 0x6b23c,
291 0x71835, 0x783c3, 0x7f52c, 0x86cc0,
292 0x8eacc, 0x96fa5, 0x9fba0, 0xa8f1a,
293 0xb2a71, 0xbce0a, 0xc7a4a, 0xd2fa0,
294 0xdee7b, 0xeb752, 0xf8a9f, 0x1068e4,
295 0x1152a3, 0x12486a, 0x134ac8, 0x145a55,
296 0x1577ac, 0x16a370, 0x17df51, 0x192bc2,
297 0x1a88f8, 0x1bf7b7, 0x1d78c9, 0x1f0d04,
298 0x20b542, 0x227268, 0x244564, 0x262f26,
299 0x2830af
300};
301
302static uint tas3001c_treble_tab[]={
303 0x96, 0x95, 0x95, 0x94,
304 0x93, 0x92, 0x92, 0x91,
305 0x90, 0x90, 0x8f, 0x8e,
306 0x8d, 0x8d, 0x8c, 0x8b,
307 0x8a, 0x8a, 0x89, 0x88,
308 0x88, 0x87, 0x86, 0x85,
309 0x85, 0x84, 0x83, 0x83,
310 0x82, 0x81, 0x80, 0x80,
311 0x7f, 0x7e, 0x7e, 0x7d,
312 0x7c, 0x7b, 0x7b, 0x7a,
313 0x79, 0x78, 0x78, 0x77,
314 0x76, 0x76, 0x75, 0x74,
315 0x73, 0x73, 0x72, 0x71,
316 0x71, 0x70, 0x6e, 0x6d,
317 0x6d, 0x6c, 0x6b, 0x6a,
318 0x69, 0x68, 0x67, 0x66,
319 0x65, 0x63, 0x62, 0x62,
320 0x60, 0x5f, 0x5d, 0x5c,
321 0x5a, 0x58, 0x56, 0x55,
322 0x53, 0x51, 0x4f, 0x4c,
323 0x4a, 0x48, 0x45, 0x43,
324 0x40, 0x3d, 0x3a, 0x37,
325 0x35, 0x32, 0x2e, 0x2a,
326 0x27, 0x22, 0x1e, 0x1a,
327 0x15, 0x11, 0xc, 0x7,
328 0x1
329};
330
331static uint tas3001c_bass_tab[]={
332 0x86, 0x83, 0x81, 0x7f,
333 0x7d, 0x7b, 0x79, 0x78,
334 0x76, 0x75, 0x74, 0x72,
335 0x71, 0x6f, 0x6e, 0x6d,
336 0x6c, 0x6b, 0x69, 0x67,
337 0x65, 0x64, 0x61, 0x60,
338 0x5e, 0x5d, 0x5c, 0x5b,
339 0x5a, 0x59, 0x58, 0x57,
340 0x56, 0x55, 0x55, 0x54,
341 0x53, 0x52, 0x50, 0x4f,
342 0x4d, 0x4c, 0x4b, 0x49,
343 0x47, 0x45, 0x44, 0x42,
344 0x41, 0x3f, 0x3e, 0x3d,
345 0x3c, 0x3b, 0x39, 0x38,
346 0x37, 0x36, 0x35, 0x34,
347 0x33, 0x31, 0x30, 0x2f,
348 0x2e, 0x2c, 0x2b, 0x2b,
349 0x29, 0x28, 0x27, 0x26,
350 0x25, 0x24, 0x22, 0x21,
351 0x20, 0x1e, 0x1c, 0x19,
352 0x18, 0x18, 0x17, 0x16,
353 0x15, 0x14, 0x13, 0x12,
354 0x11, 0x10, 0xf, 0xe,
355 0xd, 0xb, 0xa, 0x9,
356 0x8, 0x6, 0x4, 0x2,
357 0x1
358};
359
360struct tas_gain_t tas3001c_gain = {
361 .master = tas3001c_master_tab,
362 .treble = tas3001c_treble_tab,
363 .bass = tas3001c_bass_tab,
364 .mixer = tas3001c_mixer_tab
365};
366
367struct tas_eq_pref_t *tas3001c_eq_prefs[]={
368 &eqp_0e_2_1,
369 &eqp_10_1_0,
370 &eqp_15_2_1,
371 &eqp_15_1_0,
372 &eqp_0f_2_1,
373 &eqp_0f_1_0,
374 NULL
375};
diff --git a/sound/oss/dmasound/tas3004.c b/sound/oss/dmasound/tas3004.c
deleted file mode 100644
index 678bf0ff6da2..000000000000
--- a/sound/oss/dmasound/tas3004.c
+++ /dev/null
@@ -1,1138 +0,0 @@
1/*
2 * Driver for the i2c/i2s based TA3004 sound chip used
3 * on some Apple hardware. Also known as "snapper".
4 *
5 * Tobias Sargeant <tobias.sargeant@bigpond.com>
6 * Based upon tas3001c.c by Christopher C. Chimelis <chris@debian.org>:
7 *
8 * Input support by Renzo Davoli <renzo@cs.unibo.it>
9 *
10 */
11
12#include <linux/module.h>
13#include <linux/slab.h>
14#include <linux/proc_fs.h>
15#include <linux/ioport.h>
16#include <linux/sysctl.h>
17#include <linux/types.h>
18#include <linux/i2c.h>
19#include <linux/init.h>
20#include <linux/soundcard.h>
21#include <linux/interrupt.h>
22#include <linux/workqueue.h>
23
24#include <asm/uaccess.h>
25#include <asm/errno.h>
26#include <asm/io.h>
27#include <asm/prom.h>
28
29#include "dmasound.h"
30#include "tas_common.h"
31#include "tas3004.h"
32
33#include "tas_ioctl.h"
34
35/* #define DEBUG_DRCE */
36
37#define TAS3004_BIQUAD_FILTER_COUNT 7
38#define TAS3004_BIQUAD_CHANNEL_COUNT 2
39
40#define VOL_DEFAULT (100 * 4 / 5)
41#define INPUT_DEFAULT (100 * 4 / 5)
42#define BASS_DEFAULT (100 / 2)
43#define TREBLE_DEFAULT (100 / 2)
44
45struct tas3004_data_t {
46 struct tas_data_t super;
47 int device_id;
48 int output_id;
49 int speaker_id;
50 struct tas_drce_t drce_state;
51 struct work_struct change;
52};
53
54#define MAKE_TIME(sec,usec) (((sec)<<12) + (50000+(usec/10)*(1<<12))/100000)
55
56#define MAKE_RATIO(i,f) (((i)<<8) + ((500+(f)*(1<<8))/1000))
57
58
59static const union tas_biquad_t tas3004_eq_unity = {
60 .buf = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 },
61};
62
63
64static const struct tas_drce_t tas3004_drce_min = {
65 .enable = 1,
66 .above = { .val = MAKE_RATIO(16,0), .expand = 0 },
67 .below = { .val = MAKE_RATIO(2,0), .expand = 0 },
68 .threshold = -0x59a0,
69 .energy = MAKE_TIME(0, 1700),
70 .attack = MAKE_TIME(0, 1700),
71 .decay = MAKE_TIME(0, 1700),
72};
73
74
75static const struct tas_drce_t tas3004_drce_max = {
76 .enable = 1,
77 .above = { .val = MAKE_RATIO(1,500), .expand = 1 },
78 .below = { .val = MAKE_RATIO(2,0), .expand = 1 },
79 .threshold = -0x0,
80 .energy = MAKE_TIME(2,400000),
81 .attack = MAKE_TIME(2,400000),
82 .decay = MAKE_TIME(2,400000),
83};
84
85
86static const unsigned short time_constants[]={
87 MAKE_TIME(0, 1700),
88 MAKE_TIME(0, 3500),
89 MAKE_TIME(0, 6700),
90 MAKE_TIME(0, 13000),
91 MAKE_TIME(0, 26000),
92 MAKE_TIME(0, 53000),
93 MAKE_TIME(0,106000),
94 MAKE_TIME(0,212000),
95 MAKE_TIME(0,425000),
96 MAKE_TIME(0,850000),
97 MAKE_TIME(1,700000),
98 MAKE_TIME(2,400000),
99};
100
101static const unsigned short above_threshold_compression_ratio[]={
102 MAKE_RATIO( 1, 70),
103 MAKE_RATIO( 1,140),
104 MAKE_RATIO( 1,230),
105 MAKE_RATIO( 1,330),
106 MAKE_RATIO( 1,450),
107 MAKE_RATIO( 1,600),
108 MAKE_RATIO( 1,780),
109 MAKE_RATIO( 2, 0),
110 MAKE_RATIO( 2,290),
111 MAKE_RATIO( 2,670),
112 MAKE_RATIO( 3,200),
113 MAKE_RATIO( 4, 0),
114 MAKE_RATIO( 5,330),
115 MAKE_RATIO( 8, 0),
116 MAKE_RATIO(16, 0),
117};
118
119static const unsigned short above_threshold_expansion_ratio[]={
120 MAKE_RATIO(1, 60),
121 MAKE_RATIO(1,130),
122 MAKE_RATIO(1,190),
123 MAKE_RATIO(1,250),
124 MAKE_RATIO(1,310),
125 MAKE_RATIO(1,380),
126 MAKE_RATIO(1,440),
127 MAKE_RATIO(1,500)
128};
129
130static const unsigned short below_threshold_compression_ratio[]={
131 MAKE_RATIO(1, 70),
132 MAKE_RATIO(1,140),
133 MAKE_RATIO(1,230),
134 MAKE_RATIO(1,330),
135 MAKE_RATIO(1,450),
136 MAKE_RATIO(1,600),
137 MAKE_RATIO(1,780),
138 MAKE_RATIO(2, 0)
139};
140
141static const unsigned short below_threshold_expansion_ratio[]={
142 MAKE_RATIO(1, 60),
143 MAKE_RATIO(1,130),
144 MAKE_RATIO(1,190),
145 MAKE_RATIO(1,250),
146 MAKE_RATIO(1,310),
147 MAKE_RATIO(1,380),
148 MAKE_RATIO(1,440),
149 MAKE_RATIO(1,500),
150 MAKE_RATIO(1,560),
151 MAKE_RATIO(1,630),
152 MAKE_RATIO(1,690),
153 MAKE_RATIO(1,750),
154 MAKE_RATIO(1,810),
155 MAKE_RATIO(1,880),
156 MAKE_RATIO(1,940),
157 MAKE_RATIO(2, 0)
158};
159
160static inline int
161search( unsigned short val,
162 const unsigned short *arr,
163 const int arrsize) {
164 /*
165 * This could be a binary search, but for small tables,
166 * a linear search is likely to be faster
167 */
168
169 int i;
170
171 for (i=0; i < arrsize; i++)
172 if (arr[i] >= val)
173 goto _1;
174 return arrsize-1;
175 _1:
176 if (i == 0)
177 return 0;
178 return (arr[i]-val < val-arr[i-1]) ? i : i-1;
179}
180
181#define SEARCH(a, b) search(a, b, ARRAY_SIZE(b))
182
183static inline int
184time_index(unsigned short time)
185{
186 return SEARCH(time, time_constants);
187}
188
189
190static inline int
191above_threshold_compression_index(unsigned short ratio)
192{
193 return SEARCH(ratio, above_threshold_compression_ratio);
194}
195
196
197static inline int
198above_threshold_expansion_index(unsigned short ratio)
199{
200 return SEARCH(ratio, above_threshold_expansion_ratio);
201}
202
203
204static inline int
205below_threshold_compression_index(unsigned short ratio)
206{
207 return SEARCH(ratio, below_threshold_compression_ratio);
208}
209
210
211static inline int
212below_threshold_expansion_index(unsigned short ratio)
213{
214 return SEARCH(ratio, below_threshold_expansion_ratio);
215}
216
217static inline unsigned char db_to_regval(short db) {
218 int r=0;
219
220 r=(db+0x59a0) / 0x60;
221
222 if (r < 0x91) return 0x91;
223 if (r > 0xef) return 0xef;
224 return r;
225}
226
227static inline short quantize_db(short db)
228{
229 return db_to_regval(db) * 0x60 - 0x59a0;
230}
231
232static inline int
233register_width(enum tas3004_reg_t r)
234{
235 switch(r) {
236 case TAS3004_REG_MCR:
237 case TAS3004_REG_TREBLE:
238 case TAS3004_REG_BASS:
239 case TAS3004_REG_ANALOG_CTRL:
240 case TAS3004_REG_TEST1:
241 case TAS3004_REG_TEST2:
242 case TAS3004_REG_MCR2:
243 return 1;
244
245 case TAS3004_REG_LEFT_LOUD_BIQUAD_GAIN:
246 case TAS3004_REG_RIGHT_LOUD_BIQUAD_GAIN:
247 return 3;
248
249 case TAS3004_REG_DRC:
250 case TAS3004_REG_VOLUME:
251 return 6;
252
253 case TAS3004_REG_LEFT_MIXER:
254 case TAS3004_REG_RIGHT_MIXER:
255 return 9;
256
257 case TAS3004_REG_TEST:
258 return 10;
259
260 case TAS3004_REG_LEFT_BIQUAD0:
261 case TAS3004_REG_LEFT_BIQUAD1:
262 case TAS3004_REG_LEFT_BIQUAD2:
263 case TAS3004_REG_LEFT_BIQUAD3:
264 case TAS3004_REG_LEFT_BIQUAD4:
265 case TAS3004_REG_LEFT_BIQUAD5:
266 case TAS3004_REG_LEFT_BIQUAD6:
267
268 case TAS3004_REG_RIGHT_BIQUAD0:
269 case TAS3004_REG_RIGHT_BIQUAD1:
270 case TAS3004_REG_RIGHT_BIQUAD2:
271 case TAS3004_REG_RIGHT_BIQUAD3:
272 case TAS3004_REG_RIGHT_BIQUAD4:
273 case TAS3004_REG_RIGHT_BIQUAD5:
274 case TAS3004_REG_RIGHT_BIQUAD6:
275
276 case TAS3004_REG_LEFT_LOUD_BIQUAD:
277 case TAS3004_REG_RIGHT_LOUD_BIQUAD:
278 return 15;
279
280 default:
281 return 0;
282 }
283}
284
285static int
286tas3004_write_register( struct tas3004_data_t *self,
287 enum tas3004_reg_t reg_num,
288 char *data,
289 uint write_mode)
290{
291 if (reg_num==TAS3004_REG_MCR ||
292 reg_num==TAS3004_REG_BASS ||
293 reg_num==TAS3004_REG_TREBLE ||
294 reg_num==TAS3004_REG_ANALOG_CTRL) {
295 return tas_write_byte_register(&self->super,
296 (uint)reg_num,
297 *data,
298 write_mode);
299 } else {
300 return tas_write_register(&self->super,
301 (uint)reg_num,
302 register_width(reg_num),
303 data,
304 write_mode);
305 }
306}
307
308static int
309tas3004_sync_register( struct tas3004_data_t *self,
310 enum tas3004_reg_t reg_num)
311{
312 if (reg_num==TAS3004_REG_MCR ||
313 reg_num==TAS3004_REG_BASS ||
314 reg_num==TAS3004_REG_TREBLE ||
315 reg_num==TAS3004_REG_ANALOG_CTRL) {
316 return tas_sync_byte_register(&self->super,
317 (uint)reg_num,
318 register_width(reg_num));
319 } else {
320 return tas_sync_register(&self->super,
321 (uint)reg_num,
322 register_width(reg_num));
323 }
324}
325
326static int
327tas3004_read_register( struct tas3004_data_t *self,
328 enum tas3004_reg_t reg_num,
329 char *data,
330 uint write_mode)
331{
332 return tas_read_register(&self->super,
333 (uint)reg_num,
334 register_width(reg_num),
335 data);
336}
337
338static inline int
339tas3004_fast_load(struct tas3004_data_t *self, int fast)
340{
341 if (fast)
342 self->super.shadow[TAS3004_REG_MCR][0] |= 0x80;
343 else
344 self->super.shadow[TAS3004_REG_MCR][0] &= 0x7f;
345 return tas3004_sync_register(self,TAS3004_REG_MCR);
346}
347
348static uint
349tas3004_supported_mixers(struct tas3004_data_t *self)
350{
351 return SOUND_MASK_VOLUME |
352 SOUND_MASK_PCM |
353 SOUND_MASK_ALTPCM |
354 SOUND_MASK_IMIX |
355 SOUND_MASK_TREBLE |
356 SOUND_MASK_BASS |
357 SOUND_MASK_MIC |
358 SOUND_MASK_LINE;
359}
360
361static int
362tas3004_mixer_is_stereo(struct tas3004_data_t *self, int mixer)
363{
364 switch(mixer) {
365 case SOUND_MIXER_VOLUME:
366 case SOUND_MIXER_PCM:
367 case SOUND_MIXER_ALTPCM:
368 case SOUND_MIXER_IMIX:
369 return 1;
370 default:
371 return 0;
372 }
373}
374
375static uint
376tas3004_stereo_mixers(struct tas3004_data_t *self)
377{
378 uint r = tas3004_supported_mixers(self);
379 uint i;
380
381 for (i=1; i<SOUND_MIXER_NRDEVICES; i++)
382 if (r&(1<<i) && !tas3004_mixer_is_stereo(self,i))
383 r &= ~(1<<i);
384 return r;
385}
386
387static int
388tas3004_get_mixer_level(struct tas3004_data_t *self, int mixer, uint *level)
389{
390 if (!self)
391 return -1;
392
393 *level = self->super.mixer[mixer];
394
395 return 0;
396}
397
398static int
399tas3004_set_mixer_level(struct tas3004_data_t *self, int mixer, uint level)
400{
401 int rc;
402 tas_shadow_t *shadow;
403 uint temp;
404 uint offset=0;
405
406 if (!self)
407 return -1;
408
409 shadow = self->super.shadow;
410
411 if (!tas3004_mixer_is_stereo(self,mixer))
412 level = tas_mono_to_stereo(level);
413 switch(mixer) {
414 case SOUND_MIXER_VOLUME:
415 temp = tas3004_gain.master[level&0xff];
416 SET_4_20(shadow[TAS3004_REG_VOLUME], 0, temp);
417 temp = tas3004_gain.master[(level>>8)&0xff];
418 SET_4_20(shadow[TAS3004_REG_VOLUME], 3, temp);
419 rc = tas3004_sync_register(self,TAS3004_REG_VOLUME);
420 break;
421 case SOUND_MIXER_IMIX:
422 offset += 3;
423 case SOUND_MIXER_ALTPCM:
424 offset += 3;
425 case SOUND_MIXER_PCM:
426 /*
427 * Don't load these in fast mode. The documentation
428 * says it can be done in either mode, but testing it
429 * shows that fast mode produces ugly clicking.
430 */
431 /* tas3004_fast_load(self,1); */
432 temp = tas3004_gain.mixer[level&0xff];
433 SET_4_20(shadow[TAS3004_REG_LEFT_MIXER], offset, temp);
434 temp = tas3004_gain.mixer[(level>>8)&0xff];
435 SET_4_20(shadow[TAS3004_REG_RIGHT_MIXER], offset, temp);
436 rc = tas3004_sync_register(self,TAS3004_REG_LEFT_MIXER);
437 if (rc == 0)
438 rc=tas3004_sync_register(self,TAS3004_REG_RIGHT_MIXER);
439 /* tas3004_fast_load(self,0); */
440 break;
441 case SOUND_MIXER_TREBLE:
442 temp = tas3004_gain.treble[level&0xff];
443 shadow[TAS3004_REG_TREBLE][0]=temp&0xff;
444 rc = tas3004_sync_register(self,TAS3004_REG_TREBLE);
445 break;
446 case SOUND_MIXER_BASS:
447 temp = tas3004_gain.bass[level&0xff];
448 shadow[TAS3004_REG_BASS][0]=temp&0xff;
449 rc = tas3004_sync_register(self,TAS3004_REG_BASS);
450 break;
451 case SOUND_MIXER_MIC:
452 if ((level&0xff)>0) {
453 software_input_volume = SW_INPUT_VOLUME_SCALE * (level&0xff);
454 if (self->super.mixer[mixer] == 0) {
455 self->super.mixer[SOUND_MIXER_LINE] = 0;
456 shadow[TAS3004_REG_ANALOG_CTRL][0]=0xc2;
457 rc = tas3004_sync_register(self,TAS3004_REG_ANALOG_CTRL);
458 } else rc=0;
459 } else {
460 self->super.mixer[SOUND_MIXER_LINE] = SW_INPUT_VOLUME_DEFAULT;
461 software_input_volume = SW_INPUT_VOLUME_SCALE *
462 (self->super.mixer[SOUND_MIXER_LINE]&0xff);
463 shadow[TAS3004_REG_ANALOG_CTRL][0]=0x00;
464 rc = tas3004_sync_register(self,TAS3004_REG_ANALOG_CTRL);
465 }
466 break;
467 case SOUND_MIXER_LINE:
468 if (self->super.mixer[SOUND_MIXER_MIC] == 0) {
469 software_input_volume = SW_INPUT_VOLUME_SCALE * (level&0xff);
470 rc=0;
471 }
472 break;
473 default:
474 rc = -1;
475 break;
476 }
477 if (rc < 0)
478 return rc;
479 self->super.mixer[mixer] = level;
480
481 return 0;
482}
483
484static int
485tas3004_leave_sleep(struct tas3004_data_t *self)
486{
487 unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
488
489 if (!self)
490 return -1;
491
492 /* Make sure something answers on the i2c bus */
493 if (tas3004_write_register(self, TAS3004_REG_MCR, &mcr,
494 WRITE_NORMAL | FORCE_WRITE) < 0)
495 return -1;
496
497 tas3004_fast_load(self, 1);
498
499 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD0);
500 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD1);
501 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD2);
502 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD3);
503 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD4);
504 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD5);
505 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD6);
506
507 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD0);
508 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD1);
509 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD2);
510 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD3);
511 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD4);
512 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD5);
513 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD6);
514
515 tas3004_fast_load(self, 0);
516
517 (void)tas3004_sync_register(self,TAS3004_REG_VOLUME);
518 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_MIXER);
519 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_MIXER);
520 (void)tas3004_sync_register(self,TAS3004_REG_TREBLE);
521 (void)tas3004_sync_register(self,TAS3004_REG_BASS);
522 (void)tas3004_sync_register(self,TAS3004_REG_ANALOG_CTRL);
523
524 return 0;
525}
526
527static int
528tas3004_enter_sleep(struct tas3004_data_t *self)
529{
530 if (!self)
531 return -1;
532 return 0;
533}
534
535static int
536tas3004_sync_biquad( struct tas3004_data_t *self,
537 u_int channel,
538 u_int filter)
539{
540 enum tas3004_reg_t reg;
541
542 if (channel >= TAS3004_BIQUAD_CHANNEL_COUNT ||
543 filter >= TAS3004_BIQUAD_FILTER_COUNT) return -EINVAL;
544
545 reg=( channel ? TAS3004_REG_RIGHT_BIQUAD0 : TAS3004_REG_LEFT_BIQUAD0 ) + filter;
546
547 return tas3004_sync_register(self,reg);
548}
549
550static int
551tas3004_write_biquad_shadow( struct tas3004_data_t *self,
552 u_int channel,
553 u_int filter,
554 const union tas_biquad_t *biquad)
555{
556 tas_shadow_t *shadow=self->super.shadow;
557 enum tas3004_reg_t reg;
558
559 if (channel >= TAS3004_BIQUAD_CHANNEL_COUNT ||
560 filter >= TAS3004_BIQUAD_FILTER_COUNT) return -EINVAL;
561
562 reg=( channel ? TAS3004_REG_RIGHT_BIQUAD0 : TAS3004_REG_LEFT_BIQUAD0 ) + filter;
563
564 SET_4_20(shadow[reg], 0,biquad->coeff.b0);
565 SET_4_20(shadow[reg], 3,biquad->coeff.b1);
566 SET_4_20(shadow[reg], 6,biquad->coeff.b2);
567 SET_4_20(shadow[reg], 9,biquad->coeff.a1);
568 SET_4_20(shadow[reg],12,biquad->coeff.a2);
569
570 return 0;
571}
572
573static int
574tas3004_write_biquad( struct tas3004_data_t *self,
575 u_int channel,
576 u_int filter,
577 const union tas_biquad_t *biquad)
578{
579 int rc;
580
581 rc=tas3004_write_biquad_shadow(self, channel, filter, biquad);
582 if (rc < 0) return rc;
583
584 return tas3004_sync_biquad(self, channel, filter);
585}
586
587static int
588tas3004_write_biquad_list( struct tas3004_data_t *self,
589 u_int filter_count,
590 u_int flags,
591 struct tas_biquad_ctrl_t *biquads)
592{
593 int i;
594 int rc;
595
596 if (flags & TAS_BIQUAD_FAST_LOAD) tas3004_fast_load(self,1);
597
598 for (i=0; i<filter_count; i++) {
599 rc=tas3004_write_biquad(self,
600 biquads[i].channel,
601 biquads[i].filter,
602 &biquads[i].data);
603 if (rc < 0) break;
604 }
605
606 if (flags & TAS_BIQUAD_FAST_LOAD) tas3004_fast_load(self,0);
607
608 return rc;
609}
610
611static int
612tas3004_read_biquad( struct tas3004_data_t *self,
613 u_int channel,
614 u_int filter,
615 union tas_biquad_t *biquad)
616{
617 tas_shadow_t *shadow=self->super.shadow;
618 enum tas3004_reg_t reg;
619
620 if (channel >= TAS3004_BIQUAD_CHANNEL_COUNT ||
621 filter >= TAS3004_BIQUAD_FILTER_COUNT) return -EINVAL;
622
623 reg=( channel ? TAS3004_REG_RIGHT_BIQUAD0 : TAS3004_REG_LEFT_BIQUAD0 ) + filter;
624
625 biquad->coeff.b0=GET_4_20(shadow[reg], 0);
626 biquad->coeff.b1=GET_4_20(shadow[reg], 3);
627 biquad->coeff.b2=GET_4_20(shadow[reg], 6);
628 biquad->coeff.a1=GET_4_20(shadow[reg], 9);
629 biquad->coeff.a2=GET_4_20(shadow[reg],12);
630
631 return 0;
632}
633
634static int
635tas3004_eq_rw( struct tas3004_data_t *self,
636 u_int cmd,
637 u_long arg)
638{
639 void __user *argp = (void __user *)arg;
640 int rc;
641 struct tas_biquad_ctrl_t biquad;
642
643 if (copy_from_user((void *)&biquad, argp, sizeof(struct tas_biquad_ctrl_t))) {
644 return -EFAULT;
645 }
646
647 if (cmd & SIOC_IN) {
648 rc=tas3004_write_biquad(self, biquad.channel, biquad.filter, &biquad.data);
649 if (rc != 0) return rc;
650 }
651
652 if (cmd & SIOC_OUT) {
653 rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
654 if (rc != 0) return rc;
655
656 if (copy_to_user(argp, &biquad, sizeof(struct tas_biquad_ctrl_t))) {
657 return -EFAULT;
658 }
659
660 }
661 return 0;
662}
663
664static int
665tas3004_eq_list_rw( struct tas3004_data_t *self,
666 u_int cmd,
667 u_long arg)
668{
669 int rc = 0;
670 int filter_count;
671 int flags;
672 int i,j;
673 char sync_required[TAS3004_BIQUAD_CHANNEL_COUNT][TAS3004_BIQUAD_FILTER_COUNT];
674 struct tas_biquad_ctrl_t biquad;
675 struct tas_biquad_ctrl_list_t __user *argp = (void __user *)arg;
676
677 memset(sync_required,0,sizeof(sync_required));
678
679 if (copy_from_user(&filter_count, &argp->filter_count, sizeof(int)))
680 return -EFAULT;
681
682 if (copy_from_user(&flags, &argp->flags, sizeof(int)))
683 return -EFAULT;
684
685 if (cmd & SIOC_IN) {
686 }
687
688 for (i=0; i < filter_count; i++) {
689 if (copy_from_user(&biquad, &argp->biquads[i],
690 sizeof(struct tas_biquad_ctrl_t))) {
691 return -EFAULT;
692 }
693
694 if (cmd & SIOC_IN) {
695 sync_required[biquad.channel][biquad.filter]=1;
696 rc=tas3004_write_biquad_shadow(self, biquad.channel, biquad.filter, &biquad.data);
697 if (rc != 0) return rc;
698 }
699
700 if (cmd & SIOC_OUT) {
701 rc=tas3004_read_biquad(self, biquad.channel, biquad.filter, &biquad.data);
702 if (rc != 0) return rc;
703
704 if (copy_to_user(&argp->biquads[i], &biquad,
705 sizeof(struct tas_biquad_ctrl_t))) {
706 return -EFAULT;
707 }
708 }
709 }
710
711 if (cmd & SIOC_IN) {
712 /*
713 * This is OK for the tas3004. For the
714 * tas3001c, going into fast load mode causes
715 * the treble and bass to be reset to 0dB, and
716 * volume controls to be muted.
717 */
718 if (flags & TAS_BIQUAD_FAST_LOAD) tas3004_fast_load(self,1);
719 for (i=0; i<TAS3004_BIQUAD_CHANNEL_COUNT; i++) {
720 for (j=0; j<TAS3004_BIQUAD_FILTER_COUNT; j++) {
721 if (sync_required[i][j]) {
722 rc=tas3004_sync_biquad(self, i, j);
723 if (rc < 0) goto out;
724 }
725 }
726 }
727 out:
728 if (flags & TAS_BIQUAD_FAST_LOAD)
729 tas3004_fast_load(self,0);
730 }
731
732 return rc;
733}
734
735static int
736tas3004_update_drce( struct tas3004_data_t *self,
737 int flags,
738 struct tas_drce_t *drce)
739{
740 tas_shadow_t *shadow;
741 int i;
742 shadow=self->super.shadow;
743
744 if (flags & TAS_DRCE_ABOVE_RATIO) {
745 self->drce_state.above.expand = drce->above.expand;
746 if (drce->above.val == (1<<8)) {
747 self->drce_state.above.val = 1<<8;
748 shadow[TAS3004_REG_DRC][0] = 0x02;
749
750 } else if (drce->above.expand) {
751 i=above_threshold_expansion_index(drce->above.val);
752 self->drce_state.above.val=above_threshold_expansion_ratio[i];
753 shadow[TAS3004_REG_DRC][0] = 0x0a + (i<<3);
754 } else {
755 i=above_threshold_compression_index(drce->above.val);
756 self->drce_state.above.val=above_threshold_compression_ratio[i];
757 shadow[TAS3004_REG_DRC][0] = 0x08 + (i<<3);
758 }
759 }
760
761 if (flags & TAS_DRCE_BELOW_RATIO) {
762 self->drce_state.below.expand = drce->below.expand;
763 if (drce->below.val == (1<<8)) {
764 self->drce_state.below.val = 1<<8;
765 shadow[TAS3004_REG_DRC][1] = 0x02;
766
767 } else if (drce->below.expand) {
768 i=below_threshold_expansion_index(drce->below.val);
769 self->drce_state.below.val=below_threshold_expansion_ratio[i];
770 shadow[TAS3004_REG_DRC][1] = 0x08 + (i<<3);
771 } else {
772 i=below_threshold_compression_index(drce->below.val);
773 self->drce_state.below.val=below_threshold_compression_ratio[i];
774 shadow[TAS3004_REG_DRC][1] = 0x0a + (i<<3);
775 }
776 }
777
778 if (flags & TAS_DRCE_THRESHOLD) {
779 self->drce_state.threshold=quantize_db(drce->threshold);
780 shadow[TAS3004_REG_DRC][2] = db_to_regval(self->drce_state.threshold);
781 }
782
783 if (flags & TAS_DRCE_ENERGY) {
784 i=time_index(drce->energy);
785 self->drce_state.energy=time_constants[i];
786 shadow[TAS3004_REG_DRC][3] = 0x40 + (i<<4);
787 }
788
789 if (flags & TAS_DRCE_ATTACK) {
790 i=time_index(drce->attack);
791 self->drce_state.attack=time_constants[i];
792 shadow[TAS3004_REG_DRC][4] = 0x40 + (i<<4);
793 }
794
795 if (flags & TAS_DRCE_DECAY) {
796 i=time_index(drce->decay);
797 self->drce_state.decay=time_constants[i];
798 shadow[TAS3004_REG_DRC][5] = 0x40 + (i<<4);
799 }
800
801 if (flags & TAS_DRCE_ENABLE) {
802 self->drce_state.enable = drce->enable;
803 }
804
805 if (!self->drce_state.enable) {
806 shadow[TAS3004_REG_DRC][0] |= 0x01;
807 }
808
809#ifdef DEBUG_DRCE
810 printk("DRCE: set [ ENABLE:%x ABOVE:%x/%x BELOW:%x/%x THRESH:%x ENERGY:%x ATTACK:%x DECAY:%x\n",
811 self->drce_state.enable,
812 self->drce_state.above.expand,self->drce_state.above.val,
813 self->drce_state.below.expand,self->drce_state.below.val,
814 self->drce_state.threshold,
815 self->drce_state.energy,
816 self->drce_state.attack,
817 self->drce_state.decay);
818
819 printk("DRCE: reg [ %02x %02x %02x %02x %02x %02x ]\n",
820 (unsigned char)shadow[TAS3004_REG_DRC][0],
821 (unsigned char)shadow[TAS3004_REG_DRC][1],
822 (unsigned char)shadow[TAS3004_REG_DRC][2],
823 (unsigned char)shadow[TAS3004_REG_DRC][3],
824 (unsigned char)shadow[TAS3004_REG_DRC][4],
825 (unsigned char)shadow[TAS3004_REG_DRC][5]);
826#endif
827
828 return tas3004_sync_register(self, TAS3004_REG_DRC);
829}
830
831static int
832tas3004_drce_rw( struct tas3004_data_t *self,
833 u_int cmd,
834 u_long arg)
835{
836 int rc;
837 struct tas_drce_ctrl_t drce_ctrl;
838 void __user *argp = (void __user *)arg;
839
840 if (copy_from_user(&drce_ctrl, argp, sizeof(struct tas_drce_ctrl_t)))
841 return -EFAULT;
842
843#ifdef DEBUG_DRCE
844 printk("DRCE: input [ FLAGS:%x ENABLE:%x ABOVE:%x/%x BELOW:%x/%x THRESH:%x ENERGY:%x ATTACK:%x DECAY:%x\n",
845 drce_ctrl.flags,
846 drce_ctrl.data.enable,
847 drce_ctrl.data.above.expand,drce_ctrl.data.above.val,
848 drce_ctrl.data.below.expand,drce_ctrl.data.below.val,
849 drce_ctrl.data.threshold,
850 drce_ctrl.data.energy,
851 drce_ctrl.data.attack,
852 drce_ctrl.data.decay);
853#endif
854
855 if (cmd & SIOC_IN) {
856 rc = tas3004_update_drce(self, drce_ctrl.flags, &drce_ctrl.data);
857 if (rc < 0) return rc;
858 }
859
860 if (cmd & SIOC_OUT) {
861 if (drce_ctrl.flags & TAS_DRCE_ENABLE)
862 drce_ctrl.data.enable = self->drce_state.enable;
863 if (drce_ctrl.flags & TAS_DRCE_ABOVE_RATIO)
864 drce_ctrl.data.above = self->drce_state.above;
865 if (drce_ctrl.flags & TAS_DRCE_BELOW_RATIO)
866 drce_ctrl.data.below = self->drce_state.below;
867 if (drce_ctrl.flags & TAS_DRCE_THRESHOLD)
868 drce_ctrl.data.threshold = self->drce_state.threshold;
869 if (drce_ctrl.flags & TAS_DRCE_ENERGY)
870 drce_ctrl.data.energy = self->drce_state.energy;
871 if (drce_ctrl.flags & TAS_DRCE_ATTACK)
872 drce_ctrl.data.attack = self->drce_state.attack;
873 if (drce_ctrl.flags & TAS_DRCE_DECAY)
874 drce_ctrl.data.decay = self->drce_state.decay;
875
876 if (copy_to_user(argp, &drce_ctrl,
877 sizeof(struct tas_drce_ctrl_t))) {
878 return -EFAULT;
879 }
880 }
881
882 return 0;
883}
884
885static void
886tas3004_update_device_parameters(struct tas3004_data_t *self)
887{
888 char data;
889 int i;
890
891 if (!self) return;
892
893 if (self->output_id == TAS_OUTPUT_HEADPHONES) {
894 /* turn on allPass when headphones are plugged in */
895 data = 0x02;
896 } else {
897 data = 0x00;
898 }
899
900 tas3004_write_register(self, TAS3004_REG_MCR2, &data, WRITE_NORMAL | FORCE_WRITE);
901
902 for (i=0; tas3004_eq_prefs[i]; i++) {
903 struct tas_eq_pref_t *eq = tas3004_eq_prefs[i];
904
905 if (eq->device_id == self->device_id &&
906 (eq->output_id == 0 || eq->output_id == self->output_id) &&
907 (eq->speaker_id == 0 || eq->speaker_id == self->speaker_id)) {
908
909 tas3004_update_drce(self, TAS_DRCE_ALL, eq->drce);
910 tas3004_write_biquad_list(self, eq->filter_count, TAS_BIQUAD_FAST_LOAD, eq->biquads);
911
912 break;
913 }
914 }
915}
916
917static void
918tas3004_device_change_handler(struct work_struct *work)
919{
920 struct tas3004_data_t *self;
921 self = container_of(work, struct tas3004_data_t, change);
922 tas3004_update_device_parameters(self);
923}
924
925static int
926tas3004_output_device_change( struct tas3004_data_t *self,
927 int device_id,
928 int output_id,
929 int speaker_id)
930{
931 self->device_id=device_id;
932 self->output_id=output_id;
933 self->speaker_id=speaker_id;
934
935 schedule_work(&self->change);
936
937 return 0;
938}
939
940static int
941tas3004_device_ioctl( struct tas3004_data_t *self,
942 u_int cmd,
943 u_long arg)
944{
945 uint __user *argp = (void __user *)arg;
946 switch (cmd) {
947 case TAS_READ_EQ:
948 case TAS_WRITE_EQ:
949 return tas3004_eq_rw(self, cmd, arg);
950
951 case TAS_READ_EQ_LIST:
952 case TAS_WRITE_EQ_LIST:
953 return tas3004_eq_list_rw(self, cmd, arg);
954
955 case TAS_READ_EQ_FILTER_COUNT:
956 put_user(TAS3004_BIQUAD_FILTER_COUNT, argp);
957 return 0;
958
959 case TAS_READ_EQ_CHANNEL_COUNT:
960 put_user(TAS3004_BIQUAD_CHANNEL_COUNT, argp);
961 return 0;
962
963 case TAS_READ_DRCE:
964 case TAS_WRITE_DRCE:
965 return tas3004_drce_rw(self, cmd, arg);
966
967 case TAS_READ_DRCE_CAPS:
968 put_user(TAS_DRCE_ENABLE |
969 TAS_DRCE_ABOVE_RATIO |
970 TAS_DRCE_BELOW_RATIO |
971 TAS_DRCE_THRESHOLD |
972 TAS_DRCE_ENERGY |
973 TAS_DRCE_ATTACK |
974 TAS_DRCE_DECAY,
975 argp);
976 return 0;
977
978 case TAS_READ_DRCE_MIN:
979 case TAS_READ_DRCE_MAX: {
980 struct tas_drce_ctrl_t drce_ctrl;
981 const struct tas_drce_t *drce_copy;
982
983 if (copy_from_user(&drce_ctrl, argp,
984 sizeof(struct tas_drce_ctrl_t))) {
985 return -EFAULT;
986 }
987
988 if (cmd == TAS_READ_DRCE_MIN) {
989 drce_copy=&tas3004_drce_min;
990 } else {
991 drce_copy=&tas3004_drce_max;
992 }
993
994 if (drce_ctrl.flags & TAS_DRCE_ABOVE_RATIO) {
995 drce_ctrl.data.above=drce_copy->above;
996 }
997 if (drce_ctrl.flags & TAS_DRCE_BELOW_RATIO) {
998 drce_ctrl.data.below=drce_copy->below;
999 }
1000 if (drce_ctrl.flags & TAS_DRCE_THRESHOLD) {
1001 drce_ctrl.data.threshold=drce_copy->threshold;
1002 }
1003 if (drce_ctrl.flags & TAS_DRCE_ENERGY) {
1004 drce_ctrl.data.energy=drce_copy->energy;
1005 }
1006 if (drce_ctrl.flags & TAS_DRCE_ATTACK) {
1007 drce_ctrl.data.attack=drce_copy->attack;
1008 }
1009 if (drce_ctrl.flags & TAS_DRCE_DECAY) {
1010 drce_ctrl.data.decay=drce_copy->decay;
1011 }
1012
1013 if (copy_to_user(argp, &drce_ctrl,
1014 sizeof(struct tas_drce_ctrl_t))) {
1015 return -EFAULT;
1016 }
1017 }
1018 }
1019
1020 return -EINVAL;
1021}
1022
1023static int
1024tas3004_init_mixer(struct tas3004_data_t *self)
1025{
1026 unsigned char mcr = (1<<6)+(2<<4)+(2<<2);
1027
1028 /* Make sure something answers on the i2c bus */
1029 if (tas3004_write_register(self, TAS3004_REG_MCR, &mcr,
1030 WRITE_NORMAL | FORCE_WRITE) < 0)
1031 return -1;
1032
1033 tas3004_fast_load(self, 1);
1034
1035 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD0);
1036 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD1);
1037 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD2);
1038 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD3);
1039 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD4);
1040 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD5);
1041 (void)tas3004_sync_register(self,TAS3004_REG_RIGHT_BIQUAD6);
1042
1043 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD0);
1044 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD1);
1045 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD2);
1046 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD3);
1047 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD4);
1048 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD5);
1049 (void)tas3004_sync_register(self,TAS3004_REG_LEFT_BIQUAD6);
1050
1051 tas3004_sync_register(self, TAS3004_REG_DRC);
1052
1053 tas3004_sync_register(self, TAS3004_REG_MCR2);
1054
1055 tas3004_fast_load(self, 0);
1056
1057 tas3004_set_mixer_level(self, SOUND_MIXER_VOLUME, VOL_DEFAULT<<8 | VOL_DEFAULT);
1058 tas3004_set_mixer_level(self, SOUND_MIXER_PCM, INPUT_DEFAULT<<8 | INPUT_DEFAULT);
1059 tas3004_set_mixer_level(self, SOUND_MIXER_ALTPCM, 0);
1060 tas3004_set_mixer_level(self, SOUND_MIXER_IMIX, 0);
1061
1062 tas3004_set_mixer_level(self, SOUND_MIXER_BASS, BASS_DEFAULT);
1063 tas3004_set_mixer_level(self, SOUND_MIXER_TREBLE, TREBLE_DEFAULT);
1064
1065 tas3004_set_mixer_level(self, SOUND_MIXER_LINE,SW_INPUT_VOLUME_DEFAULT);
1066
1067 return 0;
1068}
1069
1070static int
1071tas3004_uninit_mixer(struct tas3004_data_t *self)
1072{
1073 tas3004_set_mixer_level(self, SOUND_MIXER_VOLUME, 0);
1074 tas3004_set_mixer_level(self, SOUND_MIXER_PCM, 0);
1075 tas3004_set_mixer_level(self, SOUND_MIXER_ALTPCM, 0);
1076 tas3004_set_mixer_level(self, SOUND_MIXER_IMIX, 0);
1077
1078 tas3004_set_mixer_level(self, SOUND_MIXER_BASS, 0);
1079 tas3004_set_mixer_level(self, SOUND_MIXER_TREBLE, 0);
1080
1081 tas3004_set_mixer_level(self, SOUND_MIXER_LINE, 0);
1082
1083 return 0;
1084}
1085
1086static int
1087tas3004_init(struct i2c_client *client)
1088{
1089 struct tas3004_data_t *self;
1090 size_t sz = sizeof(*self) + (TAS3004_REG_MAX*sizeof(tas_shadow_t));
1091 char drce_init[] = { 0x69, 0x22, 0x9f, 0xb0, 0x60, 0xa0 };
1092 char mcr2 = 0;
1093 int i, j;
1094
1095 self = kzalloc(sz, GFP_KERNEL);
1096 if (!self)
1097 return -ENOMEM;
1098
1099 self->super.client = client;
1100 self->super.shadow = (tas_shadow_t *)(self+1);
1101 self->output_id = TAS_OUTPUT_HEADPHONES;
1102
1103 dev_set_drvdata(&client->dev, self);
1104
1105 for (i = 0; i < TAS3004_BIQUAD_CHANNEL_COUNT; i++)
1106 for (j = 0; j<TAS3004_BIQUAD_FILTER_COUNT; j++)
1107 tas3004_write_biquad_shadow(self, i, j,
1108 &tas3004_eq_unity);
1109
1110 tas3004_write_register(self, TAS3004_REG_MCR2, &mcr2, WRITE_SHADOW);
1111 tas3004_write_register(self, TAS3004_REG_DRC, drce_init, WRITE_SHADOW);
1112
1113 INIT_WORK(&self->change, tas3004_device_change_handler);
1114 return 0;
1115}
1116
1117static void
1118tas3004_uninit(struct tas3004_data_t *self)
1119{
1120 tas3004_uninit_mixer(self);
1121 kfree(self);
1122}
1123
1124
1125struct tas_driver_hooks_t tas3004_hooks = {
1126 .init = (tas_hook_init_t)tas3004_init,
1127 .post_init = (tas_hook_post_init_t)tas3004_init_mixer,
1128 .uninit = (tas_hook_uninit_t)tas3004_uninit,
1129 .get_mixer_level = (tas_hook_get_mixer_level_t)tas3004_get_mixer_level,
1130 .set_mixer_level = (tas_hook_set_mixer_level_t)tas3004_set_mixer_level,
1131 .enter_sleep = (tas_hook_enter_sleep_t)tas3004_enter_sleep,
1132 .leave_sleep = (tas_hook_leave_sleep_t)tas3004_leave_sleep,
1133 .supported_mixers = (tas_hook_supported_mixers_t)tas3004_supported_mixers,
1134 .mixer_is_stereo = (tas_hook_mixer_is_stereo_t)tas3004_mixer_is_stereo,
1135 .stereo_mixers = (tas_hook_stereo_mixers_t)tas3004_stereo_mixers,
1136 .output_device_change = (tas_hook_output_device_change_t)tas3004_output_device_change,
1137 .device_ioctl = (tas_hook_device_ioctl_t)tas3004_device_ioctl
1138};
diff --git a/sound/oss/dmasound/tas3004.h b/sound/oss/dmasound/tas3004.h
deleted file mode 100644
index c6d584bf2ca4..000000000000
--- a/sound/oss/dmasound/tas3004.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * Header file for the i2c/i2s based TA3004 sound chip used
3 * on some Apple hardware. Also known as "tumbler".
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file COPYING in the main directory of this archive
7 * for more details.
8 *
9 * Written by Christopher C. Chimelis <chris@debian.org>
10 */
11
12#ifndef _TAS3004_H_
13#define _TAS3004_H_
14
15#include <linux/types.h>
16
17#include "tas_common.h"
18#include "tas_eq_prefs.h"
19
20/*
21 * Macros that correspond to the registers that we write to
22 * when setting the various values.
23 */
24
25#define TAS3004_VERSION "0.3"
26#define TAS3004_DATE "20011214"
27
28#define I2C_DRIVERNAME_TAS3004 "TAS3004 driver V " TAS3004_VERSION
29#define I2C_DRIVERID_TAS3004 (I2C_DRIVERID_TAS_BASE+1)
30
31extern struct tas_driver_hooks_t tas3004_hooks;
32extern struct tas_gain_t tas3004_gain;
33extern struct tas_eq_pref_t *tas3004_eq_prefs[];
34
35enum tas3004_reg_t {
36 TAS3004_REG_MCR = 0x01,
37 TAS3004_REG_DRC = 0x02,
38
39 TAS3004_REG_VOLUME = 0x04,
40 TAS3004_REG_TREBLE = 0x05,
41 TAS3004_REG_BASS = 0x06,
42 TAS3004_REG_LEFT_MIXER = 0x07,
43 TAS3004_REG_RIGHT_MIXER = 0x08,
44
45 TAS3004_REG_LEFT_BIQUAD0 = 0x0a,
46 TAS3004_REG_LEFT_BIQUAD1 = 0x0b,
47 TAS3004_REG_LEFT_BIQUAD2 = 0x0c,
48 TAS3004_REG_LEFT_BIQUAD3 = 0x0d,
49 TAS3004_REG_LEFT_BIQUAD4 = 0x0e,
50 TAS3004_REG_LEFT_BIQUAD5 = 0x0f,
51 TAS3004_REG_LEFT_BIQUAD6 = 0x10,
52
53 TAS3004_REG_RIGHT_BIQUAD0 = 0x13,
54 TAS3004_REG_RIGHT_BIQUAD1 = 0x14,
55 TAS3004_REG_RIGHT_BIQUAD2 = 0x15,
56 TAS3004_REG_RIGHT_BIQUAD3 = 0x16,
57 TAS3004_REG_RIGHT_BIQUAD4 = 0x17,
58 TAS3004_REG_RIGHT_BIQUAD5 = 0x18,
59 TAS3004_REG_RIGHT_BIQUAD6 = 0x19,
60
61 TAS3004_REG_LEFT_LOUD_BIQUAD = 0x21,
62 TAS3004_REG_RIGHT_LOUD_BIQUAD = 0x22,
63
64 TAS3004_REG_LEFT_LOUD_BIQUAD_GAIN = 0x23,
65 TAS3004_REG_RIGHT_LOUD_BIQUAD_GAIN = 0x24,
66
67 TAS3004_REG_TEST = 0x29,
68
69 TAS3004_REG_ANALOG_CTRL = 0x40,
70 TAS3004_REG_TEST1 = 0x41,
71 TAS3004_REG_TEST2 = 0x42,
72 TAS3004_REG_MCR2 = 0x43,
73
74 TAS3004_REG_MAX = 0x44
75};
76
77#endif /* _TAS3004_H_ */
diff --git a/sound/oss/dmasound/tas3004_tables.c b/sound/oss/dmasound/tas3004_tables.c
deleted file mode 100644
index b910e0a66775..000000000000
--- a/sound/oss/dmasound/tas3004_tables.c
+++ /dev/null
@@ -1,301 +0,0 @@
1#include "tas3004.h"
2#include "tas_eq_prefs.h"
3
4static struct tas_drce_t eqp_17_1_0_drce={
5 .enable = 1,
6 .above = { .val = 3.0 * (1<<8), .expand = 0 },
7 .below = { .val = 1.0 * (1<<8), .expand = 0 },
8 .threshold = -19.12 * (1<<8),
9 .energy = 2.4 * (1<<12),
10 .attack = 0.013 * (1<<12),
11 .decay = 0.212 * (1<<12),
12};
13
14static struct tas_biquad_ctrl_t eqp_17_1_0_biquads[]={
15 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0fd0d4, 0xe05e56, 0x0fd0d4, 0xe05ee1, 0x0fa234 } } },
16 { .channel = 0, .filter = 1, .data = { .coeff = { 0x0910d7, 0x088e1a, 0x030651, 0x01dcb1, 0x02c892 } } },
17 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0ff895, 0xe0970b, 0x0f7f00, 0xe0970b, 0x0f7795 } } },
18 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0fd1c4, 0xe1ac22, 0x0ec8cf, 0xe1ac22, 0x0e9a94 } } },
19 { .channel = 0, .filter = 4, .data = { .coeff = { 0x0f7c1c, 0xe3cc03, 0x0df786, 0xe3cc03, 0x0d73a2 } } },
20 { .channel = 0, .filter = 5, .data = { .coeff = { 0x11fb92, 0xf5a1a0, 0x073cd2, 0xf5a1a0, 0x093865 } } },
21 { .channel = 0, .filter = 6, .data = { .coeff = { 0x0e17a9, 0x068b6c, 0x08a0e5, 0x068b6c, 0x06b88e } } },
22
23 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0fd0d4, 0xe05e56, 0x0fd0d4, 0xe05ee1, 0x0fa234 } } },
24 { .channel = 1, .filter = 1, .data = { .coeff = { 0x0910d7, 0x088e1a, 0x030651, 0x01dcb1, 0x02c892 } } },
25 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0ff895, 0xe0970b, 0x0f7f00, 0xe0970b, 0x0f7795 } } },
26 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0fd1c4, 0xe1ac22, 0x0ec8cf, 0xe1ac22, 0x0e9a94 } } },
27 { .channel = 1, .filter = 4, .data = { .coeff = { 0x0f7c1c, 0xe3cc03, 0x0df786, 0xe3cc03, 0x0d73a2 } } },
28 { .channel = 1, .filter = 5, .data = { .coeff = { 0x11fb92, 0xf5a1a0, 0x073cd2, 0xf5a1a0, 0x093865 } } },
29 { .channel = 1, .filter = 6, .data = { .coeff = { 0x0e17a9, 0x068b6c, 0x08a0e5, 0x068b6c, 0x06b88e } } }
30};
31
32static struct tas_eq_pref_t eqp_17_1_0 = {
33 .sample_rate = 44100,
34 .device_id = 0x17,
35 .output_id = TAS_OUTPUT_INTERNAL_SPKR,
36 .speaker_id = 0x00,
37
38 .drce = &eqp_17_1_0_drce,
39
40 .filter_count = 14,
41 .biquads = eqp_17_1_0_biquads
42};
43
44/* ======================================================================== */
45
46static struct tas_drce_t eqp_18_1_0_drce={
47 .enable = 1,
48 .above = { .val = 3.0 * (1<<8), .expand = 0 },
49 .below = { .val = 1.0 * (1<<8), .expand = 0 },
50 .threshold = -13.14 * (1<<8),
51 .energy = 2.4 * (1<<12),
52 .attack = 0.013 * (1<<12),
53 .decay = 0.212 * (1<<12),
54};
55
56static struct tas_biquad_ctrl_t eqp_18_1_0_biquads[]={
57 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0f5514, 0xe155d7, 0x0f5514, 0xe15cfa, 0x0eb14b } } },
58 { .channel = 0, .filter = 1, .data = { .coeff = { 0x06ec33, 0x02abe3, 0x015eef, 0xf764d9, 0x03922d } } },
59 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0ef5f2, 0xe67d1f, 0x0bcf37, 0xe67d1f, 0x0ac529 } } },
60 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0db050, 0xe5be4d, 0x0d0c78, 0xe5be4d, 0x0abcc8 } } },
61 { .channel = 0, .filter = 4, .data = { .coeff = { 0x0f1298, 0xe64ec6, 0x0cc03e, 0xe64ec6, 0x0bd2d7 } } },
62 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0c641a, 0x06537a, 0x08d155, 0x06537a, 0x053570 } } },
63 { .channel = 0, .filter = 6, .data = { .coeff = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 } } },
64
65 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0f5514, 0xe155d7, 0x0f5514, 0xe15cfa, 0x0eb14b } } },
66 { .channel = 1, .filter = 1, .data = { .coeff = { 0x06ec33, 0x02abe3, 0x015eef, 0xf764d9, 0x03922d } } },
67 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0ef5f2, 0xe67d1f, 0x0bcf37, 0xe67d1f, 0x0ac529 } } },
68 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0db050, 0xe5be4d, 0x0d0c78, 0xe5be4d, 0x0abcc8 } } },
69 { .channel = 1, .filter = 4, .data = { .coeff = { 0x0f1298, 0xe64ec6, 0x0cc03e, 0xe64ec6, 0x0bd2d7 } } },
70 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0c641a, 0x06537a, 0x08d155, 0x06537a, 0x053570 } } },
71 { .channel = 1, .filter = 6, .data = { .coeff = { 0x100000, 0x000000, 0x000000, 0x000000, 0x000000 } } }
72};
73
74static struct tas_eq_pref_t eqp_18_1_0 = {
75 .sample_rate = 44100,
76 .device_id = 0x18,
77 .output_id = TAS_OUTPUT_INTERNAL_SPKR,
78 .speaker_id = 0x00,
79
80 .drce = &eqp_18_1_0_drce,
81
82 .filter_count = 14,
83 .biquads = eqp_18_1_0_biquads
84};
85
86/* ======================================================================== */
87
88static struct tas_drce_t eqp_1a_1_0_drce={
89 .enable = 1,
90 .above = { .val = 3.0 * (1<<8), .expand = 0 },
91 .below = { .val = 1.0 * (1<<8), .expand = 0 },
92 .threshold = -10.75 * (1<<8),
93 .energy = 2.4 * (1<<12),
94 .attack = 0.013 * (1<<12),
95 .decay = 0.212 * (1<<12),
96};
97
98static struct tas_biquad_ctrl_t eqp_1a_1_0_biquads[]={
99 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0fb8fd, 0xe08e04, 0x0fb8fd, 0xe08f40, 0x0f7336 } } },
100 { .channel = 0, .filter = 1, .data = { .coeff = { 0x06371d, 0x0c6e3a, 0x06371d, 0x05bfd3, 0x031ca2 } } },
101 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0fa1c0, 0xe18692, 0x0f030e, 0xe18692, 0x0ea4ce } } },
102 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0fe495, 0xe17eff, 0x0f0452, 0xe17eff, 0x0ee8e7 } } },
103 { .channel = 0, .filter = 4, .data = { .coeff = { 0x100857, 0xe7e71c, 0x0e9599, 0xe7e71c, 0x0e9df1 } } },
104 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0fb26e, 0x06a82c, 0x0db2b4, 0x06a82c, 0x0d6522 } } },
105 { .channel = 0, .filter = 6, .data = { .coeff = { 0x11419d, 0xf06cbf, 0x0a4f6e, 0xf06cbf, 0x0b910c } } },
106
107 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0fb8fd, 0xe08e04, 0x0fb8fd, 0xe08f40, 0x0f7336 } } },
108 { .channel = 1, .filter = 1, .data = { .coeff = { 0x06371d, 0x0c6e3a, 0x06371d, 0x05bfd3, 0x031ca2 } } },
109 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0fa1c0, 0xe18692, 0x0f030e, 0xe18692, 0x0ea4ce } } },
110 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0fe495, 0xe17eff, 0x0f0452, 0xe17eff, 0x0ee8e7 } } },
111 { .channel = 1, .filter = 4, .data = { .coeff = { 0x100857, 0xe7e71c, 0x0e9599, 0xe7e71c, 0x0e9df1 } } },
112 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0fb26e, 0x06a82c, 0x0db2b4, 0x06a82c, 0x0d6522 } } },
113 { .channel = 1, .filter = 6, .data = { .coeff = { 0x11419d, 0xf06cbf, 0x0a4f6e, 0xf06cbf, 0x0b910c } } }
114};
115
116static struct tas_eq_pref_t eqp_1a_1_0 = {
117 .sample_rate = 44100,
118 .device_id = 0x1a,
119 .output_id = TAS_OUTPUT_INTERNAL_SPKR,
120 .speaker_id = 0x00,
121
122 .drce = &eqp_1a_1_0_drce,
123
124 .filter_count = 14,
125 .biquads = eqp_1a_1_0_biquads
126};
127
128/* ======================================================================== */
129
130static struct tas_drce_t eqp_1c_1_0_drce={
131 .enable = 1,
132 .above = { .val = 3.0 * (1<<8), .expand = 0 },
133 .below = { .val = 1.0 * (1<<8), .expand = 0 },
134 .threshold = -14.34 * (1<<8),
135 .energy = 2.4 * (1<<12),
136 .attack = 0.013 * (1<<12),
137 .decay = 0.212 * (1<<12),
138};
139
140static struct tas_biquad_ctrl_t eqp_1c_1_0_biquads[]={
141 { .channel = 0, .filter = 0, .data = { .coeff = { 0x0f4f95, 0xe160d4, 0x0f4f95, 0xe1686e, 0x0ea6c5 } } },
142 { .channel = 0, .filter = 1, .data = { .coeff = { 0x066b92, 0x0290d4, 0x0148a0, 0xf6853f, 0x03bfc7 } } },
143 { .channel = 0, .filter = 2, .data = { .coeff = { 0x0f57dc, 0xe51c91, 0x0dd1cb, 0xe51c91, 0x0d29a8 } } },
144 { .channel = 0, .filter = 3, .data = { .coeff = { 0x0df1cb, 0xe4fa84, 0x0d7cdc, 0xe4fa84, 0x0b6ea7 } } },
145 { .channel = 0, .filter = 4, .data = { .coeff = { 0x0eba36, 0xe6aa48, 0x0b9f52, 0xe6aa48, 0x0a5989 } } },
146 { .channel = 0, .filter = 5, .data = { .coeff = { 0x0caf02, 0x05ef9d, 0x084beb, 0x05ef9d, 0x04faee } } },
147 { .channel = 0, .filter = 6, .data = { .coeff = { 0x0fc686, 0xe22947, 0x0e4b5d, 0xe22947, 0x0e11e4 } } },
148
149 { .channel = 1, .filter = 0, .data = { .coeff = { 0x0f4f95, 0xe160d4, 0x0f4f95, 0xe1686e, 0x0ea6c5 } } },
150 { .channel = 1, .filter = 1, .data = { .coeff = { 0x066b92, 0x0290d4, 0x0148a0, 0xf6853f, 0x03bfc7 } } },
151 { .channel = 1, .filter = 2, .data = { .coeff = { 0x0f57dc, 0xe51c91, 0x0dd1cb, 0xe51c91, 0x0d29a8 } } },
152 { .channel = 1, .filter = 3, .data = { .coeff = { 0x0df1cb, 0xe4fa84, 0x0d7cdc, 0xe4fa84, 0x0b6ea7 } } },
153 { .channel = 1, .filter = 4, .data = { .coeff = { 0x0eba36, 0xe6aa48, 0x0b9f52, 0xe6aa48, 0x0a5989 } } },
154 { .channel = 1, .filter = 5, .data = { .coeff = { 0x0caf02, 0x05ef9d, 0x084beb, 0x05ef9d, 0x04faee } } },
155 { .channel = 1, .filter = 6, .data = { .coeff = { 0x0fc686, 0xe22947, 0x0e4b5d, 0xe22947, 0x0e11e4 } } }
156};
157
158static struct tas_eq_pref_t eqp_1c_1_0 = {
159 .sample_rate = 44100,
160 .device_id = 0x1c,
161 .output_id = TAS_OUTPUT_INTERNAL_SPKR,
162 .speaker_id = 0x00,
163
164 .drce = &eqp_1c_1_0_drce,
165
166 .filter_count = 14,
167 .biquads = eqp_1c_1_0_biquads
168};
169
170/* ======================================================================== */
171
172static uint tas3004_master_tab[]={
173 0x0, 0x75, 0x9c, 0xbb,
174 0xdb, 0xfb, 0x11e, 0x143,
175 0x16b, 0x196, 0x1c3, 0x1f5,
176 0x229, 0x263, 0x29f, 0x2e1,
177 0x328, 0x373, 0x3c5, 0x41b,
178 0x478, 0x4dc, 0x547, 0x5b8,
179 0x633, 0x6b5, 0x740, 0x7d5,
180 0x873, 0x91c, 0x9d2, 0xa92,
181 0xb5e, 0xc39, 0xd22, 0xe19,
182 0xf20, 0x1037, 0x1161, 0x129e,
183 0x13ed, 0x1551, 0x16ca, 0x185d,
184 0x1a08, 0x1bcc, 0x1dac, 0x1fa7,
185 0x21c1, 0x23fa, 0x2655, 0x28d6,
186 0x2b7c, 0x2e4a, 0x3141, 0x3464,
187 0x37b4, 0x3b35, 0x3ee9, 0x42d3,
188 0x46f6, 0x4b53, 0x4ff0, 0x54ce,
189 0x59f2, 0x5f5f, 0x6519, 0x6b24,
190 0x7183, 0x783c, 0x7f53, 0x86cc,
191 0x8ead, 0x96fa, 0x9fba, 0xa8f2,
192 0xb2a7, 0xbce1, 0xc7a5, 0xd2fa,
193 0xdee8, 0xeb75, 0xf8aa, 0x1068e,
194 0x1152a, 0x12487, 0x134ad, 0x145a5,
195 0x1577b, 0x16a37, 0x17df5, 0x192bd,
196 0x1a890, 0x1bf7b, 0x1d78d, 0x1f0d1,
197 0x20b55, 0x22727, 0x24456, 0x262f2,
198 0x2830b
199};
200
201static uint tas3004_mixer_tab[]={
202 0x0, 0x748, 0x9be, 0xbaf,
203 0xda4, 0xfb1, 0x11de, 0x1431,
204 0x16ad, 0x1959, 0x1c37, 0x1f4b,
205 0x2298, 0x2628, 0x29fb, 0x2e12,
206 0x327d, 0x3734, 0x3c47, 0x41b4,
207 0x4787, 0x4dbe, 0x546d, 0x5b86,
208 0x632e, 0x6b52, 0x7400, 0x7d54,
209 0x873b, 0x91c6, 0x9d1a, 0xa920,
210 0xb5e5, 0xc38c, 0xd21b, 0xe18f,
211 0xf1f5, 0x1036a, 0x1160f, 0x129d6,
212 0x13ed0, 0x1550c, 0x16ca0, 0x185c9,
213 0x1a07b, 0x1bcc3, 0x1dab9, 0x1fa75,
214 0x21c0f, 0x23fa3, 0x26552, 0x28d64,
215 0x2b7c9, 0x2e4a2, 0x31411, 0x3463b,
216 0x37b44, 0x3b353, 0x3ee94, 0x42d30,
217 0x46f55, 0x4b533, 0x4fefc, 0x54ce5,
218 0x59f25, 0x5f5f6, 0x65193, 0x6b23c,
219 0x71835, 0x783c3, 0x7f52c, 0x86cc0,
220 0x8eacc, 0x96fa5, 0x9fba0, 0xa8f1a,
221 0xb2a71, 0xbce0a, 0xc7a4a, 0xd2fa0,
222 0xdee7b, 0xeb752, 0xf8a9f, 0x1068e4,
223 0x1152a3, 0x12486a, 0x134ac8, 0x145a55,
224 0x1577ac, 0x16a370, 0x17df51, 0x192bc2,
225 0x1a88f8, 0x1bf7b7, 0x1d78c9, 0x1f0d04,
226 0x20b542, 0x227268, 0x244564, 0x262f26,
227 0x2830af
228};
229
230static uint tas3004_treble_tab[]={
231 0x96, 0x95, 0x95, 0x94,
232 0x93, 0x92, 0x92, 0x91,
233 0x90, 0x90, 0x8f, 0x8e,
234 0x8d, 0x8d, 0x8c, 0x8b,
235 0x8a, 0x8a, 0x89, 0x88,
236 0x88, 0x87, 0x86, 0x85,
237 0x85, 0x84, 0x83, 0x83,
238 0x82, 0x81, 0x80, 0x80,
239 0x7f, 0x7e, 0x7e, 0x7d,
240 0x7c, 0x7b, 0x7b, 0x7a,
241 0x79, 0x78, 0x78, 0x77,
242 0x76, 0x76, 0x75, 0x74,
243 0x73, 0x73, 0x72, 0x71,
244 0x71, 0x68, 0x45, 0x5b,
245 0x6d, 0x6c, 0x6b, 0x6a,
246 0x69, 0x68, 0x67, 0x66,
247 0x65, 0x63, 0x62, 0x62,
248 0x60, 0x5e, 0x5c, 0x5b,
249 0x59, 0x57, 0x55, 0x53,
250 0x52, 0x4f, 0x4d, 0x4a,
251 0x48, 0x46, 0x43, 0x40,
252 0x3d, 0x3a, 0x36, 0x33,
253 0x2f, 0x2c, 0x27, 0x23,
254 0x1f, 0x1a, 0x15, 0xf,
255 0x8, 0x5, 0x2, 0x1,
256 0x1
257};
258
259static uint tas3004_bass_tab[]={
260 0x96, 0x95, 0x95, 0x94,
261 0x93, 0x92, 0x92, 0x91,
262 0x90, 0x90, 0x8f, 0x8e,
263 0x8d, 0x8d, 0x8c, 0x8b,
264 0x8a, 0x8a, 0x89, 0x88,
265 0x88, 0x87, 0x86, 0x85,
266 0x85, 0x84, 0x83, 0x83,
267 0x82, 0x81, 0x80, 0x80,
268 0x7f, 0x7e, 0x7e, 0x7d,
269 0x7c, 0x7b, 0x7b, 0x7a,
270 0x79, 0x78, 0x78, 0x77,
271 0x76, 0x76, 0x75, 0x74,
272 0x73, 0x73, 0x72, 0x71,
273 0x70, 0x6f, 0x6e, 0x6d,
274 0x6c, 0x6b, 0x6a, 0x6a,
275 0x69, 0x67, 0x66, 0x66,
276 0x65, 0x63, 0x62, 0x62,
277 0x61, 0x60, 0x5e, 0x5d,
278 0x5b, 0x59, 0x57, 0x55,
279 0x53, 0x51, 0x4f, 0x4c,
280 0x4a, 0x48, 0x46, 0x44,
281 0x41, 0x3e, 0x3b, 0x38,
282 0x36, 0x33, 0x2f, 0x2b,
283 0x28, 0x24, 0x20, 0x1c,
284 0x17, 0x12, 0xd, 0x7,
285 0x1
286};
287
288struct tas_gain_t tas3004_gain={
289 .master = tas3004_master_tab,
290 .treble = tas3004_treble_tab,
291 .bass = tas3004_bass_tab,
292 .mixer = tas3004_mixer_tab
293};
294
295struct tas_eq_pref_t *tas3004_eq_prefs[]={
296 &eqp_17_1_0,
297 &eqp_18_1_0,
298 &eqp_1a_1_0,
299 &eqp_1c_1_0,
300 NULL
301};
diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c
deleted file mode 100644
index b295ef682192..000000000000
--- a/sound/oss/dmasound/tas_common.c
+++ /dev/null
@@ -1,214 +0,0 @@
1#include <linux/module.h>
2#include <linux/slab.h>
3#include <linux/proc_fs.h>
4#include <linux/ioport.h>
5#include <linux/sysctl.h>
6#include <linux/types.h>
7#include <linux/i2c.h>
8#include <linux/init.h>
9#include <linux/soundcard.h>
10#include <asm/uaccess.h>
11#include <asm/errno.h>
12#include <asm/io.h>
13#include <asm/prom.h>
14
15#include "tas_common.h"
16
17#define CALL0(proc) \
18 do { \
19 struct tas_data_t *self; \
20 if (!tas_client || driver_hooks == NULL) \
21 return -1; \
22 self = dev_get_drvdata(&tas_client->dev); \
23 if (driver_hooks->proc) \
24 return driver_hooks->proc(self); \
25 else \
26 return -EINVAL; \
27 } while (0)
28
29#define CALL(proc,arg...) \
30 do { \
31 struct tas_data_t *self; \
32 if (!tas_client || driver_hooks == NULL) \
33 return -1; \
34 self = dev_get_drvdata(&tas_client->dev); \
35 if (driver_hooks->proc) \
36 return driver_hooks->proc(self, ## arg); \
37 else \
38 return -EINVAL; \
39 } while (0)
40
41
42static u8 tas_i2c_address = 0x34;
43static struct i2c_client *tas_client;
44
45static int tas_attach_adapter(struct i2c_adapter *);
46static int tas_detach_client(struct i2c_client *);
47
48struct i2c_driver tas_driver = {
49 .driver = {
50 .name = "tas",
51 },
52 .attach_adapter = tas_attach_adapter,
53 .detach_client = tas_detach_client,
54};
55
56struct tas_driver_hooks_t *driver_hooks;
57
58int
59tas_register_driver(struct tas_driver_hooks_t *hooks)
60{
61 driver_hooks = hooks;
62 return 0;
63}
64
65int
66tas_get_mixer_level(int mixer, uint *level)
67{
68 CALL(get_mixer_level,mixer,level);
69}
70
71int
72tas_set_mixer_level(int mixer,uint level)
73{
74 CALL(set_mixer_level,mixer,level);
75}
76
77int
78tas_enter_sleep(void)
79{
80 CALL0(enter_sleep);
81}
82
83int
84tas_leave_sleep(void)
85{
86 CALL0(leave_sleep);
87}
88
89int
90tas_supported_mixers(void)
91{
92 CALL0(supported_mixers);
93}
94
95int
96tas_mixer_is_stereo(int mixer)
97{
98 CALL(mixer_is_stereo,mixer);
99}
100
101int
102tas_stereo_mixers(void)
103{
104 CALL0(stereo_mixers);
105}
106
107int
108tas_output_device_change(int device_id,int layout_id,int speaker_id)
109{
110 CALL(output_device_change,device_id,layout_id,speaker_id);
111}
112
113int
114tas_device_ioctl(u_int cmd, u_long arg)
115{
116 CALL(device_ioctl,cmd,arg);
117}
118
119int
120tas_post_init(void)
121{
122 CALL0(post_init);
123}
124
125static int
126tas_detect_client(struct i2c_adapter *adapter, int address)
127{
128 static const char *client_name = "tas Digital Equalizer";
129 struct i2c_client *new_client;
130 int rc = -ENODEV;
131
132 if (!driver_hooks) {
133 printk(KERN_ERR "tas_detect_client called with no hooks !\n");
134 return -ENODEV;
135 }
136
137 new_client = kzalloc(sizeof(*new_client), GFP_KERNEL);
138 if (!new_client)
139 return -ENOMEM;
140
141 new_client->addr = address;
142 new_client->adapter = adapter;
143 new_client->driver = &tas_driver;
144 strlcpy(new_client->name, client_name, DEVICE_NAME_SIZE);
145
146 if (driver_hooks->init(new_client))
147 goto bail;
148
149 /* Tell the i2c layer a new client has arrived */
150 if (i2c_attach_client(new_client)) {
151 driver_hooks->uninit(dev_get_drvdata(&new_client->dev));
152 goto bail;
153 }
154
155 tas_client = new_client;
156 return 0;
157 bail:
158 tas_client = NULL;
159 kfree(new_client);
160 return rc;
161}
162
163static int
164tas_attach_adapter(struct i2c_adapter *adapter)
165{
166 if (!strncmp(adapter->name, "mac-io", 6))
167 return tas_detect_client(adapter, tas_i2c_address);
168 return 0;
169}
170
171static int
172tas_detach_client(struct i2c_client *client)
173{
174 if (client == tas_client) {
175 driver_hooks->uninit(dev_get_drvdata(&client->dev));
176
177 i2c_detach_client(client);
178 kfree(client);
179 }
180 return 0;
181}
182
183void
184tas_cleanup(void)
185{
186 i2c_del_driver(&tas_driver);
187}
188
189int __init
190tas_init(int driver_id, const char *driver_name)
191{
192 const u32* paddr;
193 struct device_node *tas_node;
194
195 printk(KERN_INFO "tas driver [%s])\n", driver_name);
196
197#ifndef CONFIG_I2C_POWERMAC
198 request_module("i2c-powermac");
199#endif
200 tas_node = of_find_node_by_name("deq");
201 if (tas_node == NULL)
202 return -ENODEV;
203 paddr = of_get_property(tas_node, "i2c-address", NULL);
204 if (paddr) {
205 tas_i2c_address = (*paddr) >> 1;
206 printk(KERN_INFO "using i2c address: 0x%x from device-tree\n",
207 tas_i2c_address);
208 } else
209 printk(KERN_INFO "using i2c address: 0x%x (default)\n",
210 tas_i2c_address);
211 of_node_put(tas_node);
212
213 return i2c_add_driver(&tas_driver);
214}
diff --git a/sound/oss/dmasound/tas_common.h b/sound/oss/dmasound/tas_common.h
deleted file mode 100644
index 0741c28e56ce..000000000000
--- a/sound/oss/dmasound/tas_common.h
+++ /dev/null
@@ -1,284 +0,0 @@
1#ifndef _TAS_COMMON_H_
2#define _TAS_COMMON_H_
3
4#include <linux/i2c.h>
5#include <linux/soundcard.h>
6#include <asm/string.h>
7
8#define I2C_DRIVERID_TAS_BASE (0xFEBA)
9
10#define SET_4_20(shadow, offset, val) \
11 do { \
12 (shadow)[(offset)+0] = ((val) >> 16) & 0xff; \
13 (shadow)[(offset)+1] = ((val) >> 8) & 0xff; \
14 (shadow)[(offset)+2] = ((val) >> 0) & 0xff; \
15 } while (0)
16
17#define GET_4_20(shadow, offset) \
18 (((u_int)((shadow)[(offset)+0]) << 16) | \
19 ((u_int)((shadow)[(offset)+1]) << 8) | \
20 ((u_int)((shadow)[(offset)+2]) << 0))
21
22
23#define TAS_BIQUAD_FAST_LOAD 0x01
24
25#define TAS_DRCE_ENABLE 0x01
26#define TAS_DRCE_ABOVE_RATIO 0x02
27#define TAS_DRCE_BELOW_RATIO 0x04
28#define TAS_DRCE_THRESHOLD 0x08
29#define TAS_DRCE_ENERGY 0x10
30#define TAS_DRCE_ATTACK 0x20
31#define TAS_DRCE_DECAY 0x40
32
33#define TAS_DRCE_ALL 0x7f
34
35
36#define TAS_OUTPUT_HEADPHONES 0x00
37#define TAS_OUTPUT_INTERNAL_SPKR 0x01
38#define TAS_OUTPUT_EXTERNAL_SPKR 0x02
39
40
41union tas_biquad_t {
42 struct {
43 int b0,b1,b2,a1,a2;
44 } coeff;
45 int buf[5];
46};
47
48struct tas_biquad_ctrl_t {
49 u_int channel:4;
50 u_int filter:4;
51
52 union tas_biquad_t data;
53};
54
55struct tas_biquad_ctrl_list_t {
56 int flags;
57 int filter_count;
58 struct tas_biquad_ctrl_t biquads[0];
59};
60
61struct tas_ratio_t {
62 unsigned short val; /* 8.8 */
63 unsigned short expand; /* 0 = compress, !0 = expand. */
64};
65
66struct tas_drce_t {
67 unsigned short enable;
68 struct tas_ratio_t above;
69 struct tas_ratio_t below;
70 short threshold; /* dB, 8.8 signed */
71 unsigned short energy; /* seconds, 4.12 unsigned */
72 unsigned short attack; /* seconds, 4.12 unsigned */
73 unsigned short decay; /* seconds, 4.12 unsigned */
74};
75
76struct tas_drce_ctrl_t {
77 uint flags;
78
79 struct tas_drce_t data;
80};
81
82struct tas_gain_t
83{
84 unsigned int *master;
85 unsigned int *treble;
86 unsigned int *bass;
87 unsigned int *mixer;
88};
89
90typedef char tas_shadow_t[0x45];
91
92struct tas_data_t
93{
94 struct i2c_client *client;
95 tas_shadow_t *shadow;
96 uint mixer[SOUND_MIXER_NRDEVICES];
97};
98
99typedef int (*tas_hook_init_t)(struct i2c_client *);
100typedef int (*tas_hook_post_init_t)(struct tas_data_t *);
101typedef void (*tas_hook_uninit_t)(struct tas_data_t *);
102
103typedef int (*tas_hook_get_mixer_level_t)(struct tas_data_t *,int,uint *);
104typedef int (*tas_hook_set_mixer_level_t)(struct tas_data_t *,int,uint);
105
106typedef int (*tas_hook_enter_sleep_t)(struct tas_data_t *);
107typedef int (*tas_hook_leave_sleep_t)(struct tas_data_t *);
108
109typedef int (*tas_hook_supported_mixers_t)(struct tas_data_t *);
110typedef int (*tas_hook_mixer_is_stereo_t)(struct tas_data_t *,int);
111typedef int (*tas_hook_stereo_mixers_t)(struct tas_data_t *);
112
113typedef int (*tas_hook_output_device_change_t)(struct tas_data_t *,int,int,int);
114typedef int (*tas_hook_device_ioctl_t)(struct tas_data_t *,u_int,u_long);
115
116struct tas_driver_hooks_t {
117 /*
118 * All hardware initialisation must be performed in
119 * post_init(), as tas_dmasound_init() does a hardware reset.
120 *
121 * init() is called before tas_dmasound_init() so that
122 * ouput_device_change() is always called after i2c driver
123 * initialisation. The implication is that
124 * output_device_change() must cope with the fact that it
125 * may be called before post_init().
126 */
127
128 tas_hook_init_t init;
129 tas_hook_post_init_t post_init;
130 tas_hook_uninit_t uninit;
131
132 tas_hook_get_mixer_level_t get_mixer_level;
133 tas_hook_set_mixer_level_t set_mixer_level;
134
135 tas_hook_enter_sleep_t enter_sleep;
136 tas_hook_leave_sleep_t leave_sleep;
137
138 tas_hook_supported_mixers_t supported_mixers;
139 tas_hook_mixer_is_stereo_t mixer_is_stereo;
140 tas_hook_stereo_mixers_t stereo_mixers;
141
142 tas_hook_output_device_change_t output_device_change;
143 tas_hook_device_ioctl_t device_ioctl;
144};
145
146enum tas_write_mode_t {
147 WRITE_HW = 0x01,
148 WRITE_SHADOW = 0x02,
149 WRITE_NORMAL = 0x03,
150 FORCE_WRITE = 0x04
151};
152
153static inline uint
154tas_mono_to_stereo(uint mono)
155{
156 mono &=0xff;
157 return mono | (mono<<8);
158}
159
160/*
161 * Todo: make these functions a bit more efficient !
162 */
163static inline int
164tas_write_register( struct tas_data_t *self,
165 uint reg_num,
166 uint reg_width,
167 char *data,
168 uint write_mode)
169{
170 int rc;
171
172 if (reg_width==0 || data==NULL || self==NULL)
173 return -EINVAL;
174 if (!(write_mode & FORCE_WRITE) &&
175 !memcmp(data,self->shadow[reg_num],reg_width))
176 return 0;
177
178 if (write_mode & WRITE_SHADOW)
179 memcpy(self->shadow[reg_num],data,reg_width);
180 if (write_mode & WRITE_HW) {
181 rc=i2c_smbus_write_i2c_block_data(self->client,
182 reg_num,
183 reg_width,
184 data);
185 if (rc < 0) {
186 printk("tas: I2C block write failed \n");
187 return rc;
188 }
189 }
190 return 0;
191}
192
193static inline int
194tas_sync_register( struct tas_data_t *self,
195 uint reg_num,
196 uint reg_width)
197{
198 int rc;
199
200 if (reg_width==0 || self==NULL)
201 return -EINVAL;
202 rc=i2c_smbus_write_i2c_block_data(self->client,
203 reg_num,
204 reg_width,
205 self->shadow[reg_num]);
206 if (rc < 0) {
207 printk("tas: I2C block write failed \n");
208 return rc;
209 }
210 return 0;
211}
212
213static inline int
214tas_write_byte_register( struct tas_data_t *self,
215 uint reg_num,
216 char data,
217 uint write_mode)
218{
219 if (self==NULL)
220 return -1;
221 if (!(write_mode & FORCE_WRITE) && data != self->shadow[reg_num][0])
222 return 0;
223 if (write_mode & WRITE_SHADOW)
224 self->shadow[reg_num][0]=data;
225 if (write_mode & WRITE_HW) {
226 if (i2c_smbus_write_byte_data(self->client, reg_num, data) < 0) {
227 printk("tas: I2C byte write failed \n");
228 return -1;
229 }
230 }
231 return 0;
232}
233
234static inline int
235tas_sync_byte_register( struct tas_data_t *self,
236 uint reg_num,
237 uint reg_width)
238{
239 if (reg_width==0 || self==NULL)
240 return -1;
241 if (i2c_smbus_write_byte_data(
242 self->client, reg_num, self->shadow[reg_num][0]) < 0) {
243 printk("tas: I2C byte write failed \n");
244 return -1;
245 }
246 return 0;
247}
248
249static inline int
250tas_read_register( struct tas_data_t *self,
251 uint reg_num,
252 uint reg_width,
253 char *data)
254{
255 if (reg_width==0 || data==NULL || self==NULL)
256 return -1;
257 memcpy(data,self->shadow[reg_num],reg_width);
258 return 0;
259}
260
261extern int tas_register_driver(struct tas_driver_hooks_t *hooks);
262
263extern int tas_get_mixer_level(int mixer,uint *level);
264extern int tas_set_mixer_level(int mixer,uint level);
265extern int tas_enter_sleep(void);
266extern int tas_leave_sleep(void);
267extern int tas_supported_mixers(void);
268extern int tas_mixer_is_stereo(int mixer);
269extern int tas_stereo_mixers(void);
270extern int tas_output_device_change(int,int,int);
271extern int tas_device_ioctl(u_int, u_long);
272
273extern void tas_cleanup(void);
274extern int tas_init(int driver_id,const char *driver_name);
275extern int tas_post_init(void);
276
277#endif /* _TAS_COMMON_H_ */
278/*
279 * Local Variables:
280 * tab-width: 8
281 * indent-tabs-mode: t
282 * c-basic-offset: 8
283 * End:
284 */
diff --git a/sound/oss/dmasound/tas_eq_prefs.h b/sound/oss/dmasound/tas_eq_prefs.h
deleted file mode 100644
index 3a994eda6abc..000000000000
--- a/sound/oss/dmasound/tas_eq_prefs.h
+++ /dev/null
@@ -1,24 +0,0 @@
1#ifndef _TAS_EQ_PREFS_H_
2#define _TAS_EQ_PREFS_H_
3
4struct tas_eq_pref_t {
5 u_int sample_rate;
6 u_int device_id;
7 u_int output_id;
8 u_int speaker_id;
9
10 struct tas_drce_t *drce;
11
12 u_int filter_count;
13 struct tas_biquad_ctrl_t *biquads;
14};
15
16#endif /* _TAS_EQ_PREFS_H_ */
17
18/*
19 * Local Variables:
20 * tab-width: 8
21 * indent-tabs-mode: t
22 * c-basic-offset: 8
23 * End:
24 */
diff --git a/sound/oss/dmasound/tas_ioctl.h b/sound/oss/dmasound/tas_ioctl.h
deleted file mode 100644
index 9d12b373b4a9..000000000000
--- a/sound/oss/dmasound/tas_ioctl.h
+++ /dev/null
@@ -1,23 +0,0 @@
1#ifndef _TAS_IOCTL_H_
2#define _TAS_IOCTL_H_
3
4#include <linux/soundcard.h>
5
6
7#define TAS_READ_EQ _SIOR('t',0,struct tas_biquad_ctrl_t)
8#define TAS_WRITE_EQ _SIOW('t',0,struct tas_biquad_ctrl_t)
9
10#define TAS_READ_EQ_LIST _SIOR('t',1,struct tas_biquad_ctrl_t)
11#define TAS_WRITE_EQ_LIST _SIOW('t',1,struct tas_biquad_ctrl_t)
12
13#define TAS_READ_EQ_FILTER_COUNT _SIOR('t',2,int)
14#define TAS_READ_EQ_CHANNEL_COUNT _SIOR('t',3,int)
15
16#define TAS_READ_DRCE _SIOR('t',4,struct tas_drce_ctrl_t)
17#define TAS_WRITE_DRCE _SIOW('t',4,struct tas_drce_ctrl_t)
18
19#define TAS_READ_DRCE_CAPS _SIOR('t',5,int)
20#define TAS_READ_DRCE_MIN _SIOR('t',6,int)
21#define TAS_READ_DRCE_MAX _SIOR('t',7,int)
22
23#endif
diff --git a/sound/oss/dmasound/trans_16.c b/sound/oss/dmasound/trans_16.c
deleted file mode 100644
index ca973ac2a30a..000000000000
--- a/sound/oss/dmasound/trans_16.c
+++ /dev/null
@@ -1,898 +0,0 @@
1/*
2 * linux/sound/oss/dmasound/trans_16.c
3 *
4 * 16 bit translation routines. Only used by Power mac at present.
5 *
6 * See linux/sound/oss/dmasound/dmasound_core.c for copyright and
7 * history prior to 08/02/2001.
8 *
9 * 08/02/2001 Iain Sandoe
10 * split from dmasound_awacs.c
11 * 11/29/2003 Renzo Davoli (King Enzo)
12 * - input resampling (for soft rate < hard rate)
13 * - software line in gain control
14 */
15
16#include <linux/soundcard.h>
17#include <asm/uaccess.h>
18#include "dmasound.h"
19
20extern int expand_bal; /* Balance factor for expanding (not volume!) */
21static short dmasound_alaw2dma16[] ;
22static short dmasound_ulaw2dma16[] ;
23
24static ssize_t pmac_ct_law(const u_char __user *userPtr, size_t userCount,
25 u_char frame[], ssize_t *frameUsed,
26 ssize_t frameLeft);
27static ssize_t pmac_ct_s8(const u_char __user *userPtr, size_t userCount,
28 u_char frame[], ssize_t *frameUsed,
29 ssize_t frameLeft);
30static ssize_t pmac_ct_u8(const u_char __user *userPtr, size_t userCount,
31 u_char frame[], ssize_t *frameUsed,
32 ssize_t frameLeft);
33static ssize_t pmac_ct_s16(const u_char __user *userPtr, size_t userCount,
34 u_char frame[], ssize_t *frameUsed,
35 ssize_t frameLeft);
36static ssize_t pmac_ct_u16(const u_char __user *userPtr, size_t userCount,
37 u_char frame[], ssize_t *frameUsed,
38 ssize_t frameLeft);
39
40static ssize_t pmac_ctx_law(const u_char __user *userPtr, size_t userCount,
41 u_char frame[], ssize_t *frameUsed,
42 ssize_t frameLeft);
43static ssize_t pmac_ctx_s8(const u_char __user *userPtr, size_t userCount,
44 u_char frame[], ssize_t *frameUsed,
45 ssize_t frameLeft);
46static ssize_t pmac_ctx_u8(const u_char __user *userPtr, size_t userCount,
47 u_char frame[], ssize_t *frameUsed,
48 ssize_t frameLeft);
49static ssize_t pmac_ctx_s16(const u_char __user *userPtr, size_t userCount,
50 u_char frame[], ssize_t *frameUsed,
51 ssize_t frameLeft);
52static ssize_t pmac_ctx_u16(const u_char __user *userPtr, size_t userCount,
53 u_char frame[], ssize_t *frameUsed,
54 ssize_t frameLeft);
55
56static ssize_t pmac_ct_s16_read(const u_char __user *userPtr, size_t userCount,
57 u_char frame[], ssize_t *frameUsed,
58 ssize_t frameLeft);
59static ssize_t pmac_ct_u16_read(const u_char __user *userPtr, size_t userCount,
60 u_char frame[], ssize_t *frameUsed,
61 ssize_t frameLeft);
62
63/*** Translations ************************************************************/
64
65static int expand_data; /* Data for expanding */
66
67static ssize_t pmac_ct_law(const u_char __user *userPtr, size_t userCount,
68 u_char frame[], ssize_t *frameUsed,
69 ssize_t frameLeft)
70{
71 short *table = dmasound.soft.format == AFMT_MU_LAW
72 ? dmasound_ulaw2dma16 : dmasound_alaw2dma16;
73 ssize_t count, used;
74 short *p = (short *) &frame[*frameUsed];
75 int val, stereo = dmasound.soft.stereo;
76
77 frameLeft >>= 2;
78 if (stereo)
79 userCount >>= 1;
80 used = count = min_t(unsigned long, userCount, frameLeft);
81 while (count > 0) {
82 u_char data;
83 if (get_user(data, userPtr++))
84 return -EFAULT;
85 val = table[data];
86 *p++ = val;
87 if (stereo) {
88 if (get_user(data, userPtr++))
89 return -EFAULT;
90 val = table[data];
91 }
92 *p++ = val;
93 count--;
94 }
95 *frameUsed += used * 4;
96 return stereo? used * 2: used;
97}
98
99
100static ssize_t pmac_ct_s8(const u_char __user *userPtr, size_t userCount,
101 u_char frame[], ssize_t *frameUsed,
102 ssize_t frameLeft)
103{
104 ssize_t count, used;
105 short *p = (short *) &frame[*frameUsed];
106 int val, stereo = dmasound.soft.stereo;
107
108 frameLeft >>= 2;
109 if (stereo)
110 userCount >>= 1;
111 used = count = min_t(unsigned long, userCount, frameLeft);
112 while (count > 0) {
113 u_char data;
114 if (get_user(data, userPtr++))
115 return -EFAULT;
116 val = data << 8;
117 *p++ = val;
118 if (stereo) {
119 if (get_user(data, userPtr++))
120 return -EFAULT;
121 val = data << 8;
122 }
123 *p++ = val;
124 count--;
125 }
126 *frameUsed += used * 4;
127 return stereo? used * 2: used;
128}
129
130
131static ssize_t pmac_ct_u8(const u_char __user *userPtr, size_t userCount,
132 u_char frame[], ssize_t *frameUsed,
133 ssize_t frameLeft)
134{
135 ssize_t count, used;
136 short *p = (short *) &frame[*frameUsed];
137 int val, stereo = dmasound.soft.stereo;
138
139 frameLeft >>= 2;
140 if (stereo)
141 userCount >>= 1;
142 used = count = min_t(unsigned long, userCount, frameLeft);
143 while (count > 0) {
144 u_char data;
145 if (get_user(data, userPtr++))
146 return -EFAULT;
147 val = (data ^ 0x80) << 8;
148 *p++ = val;
149 if (stereo) {
150 if (get_user(data, userPtr++))
151 return -EFAULT;
152 val = (data ^ 0x80) << 8;
153 }
154 *p++ = val;
155 count--;
156 }
157 *frameUsed += used * 4;
158 return stereo? used * 2: used;
159}
160
161
162static ssize_t pmac_ct_s16(const u_char __user *userPtr, size_t userCount,
163 u_char frame[], ssize_t *frameUsed,
164 ssize_t frameLeft)
165{
166 ssize_t count, used;
167 int stereo = dmasound.soft.stereo;
168 short *fp = (short *) &frame[*frameUsed];
169
170 frameLeft >>= 2;
171 userCount >>= (stereo? 2: 1);
172 used = count = min_t(unsigned long, userCount, frameLeft);
173 if (!stereo) {
174 short __user *up = (short __user *) userPtr;
175 while (count > 0) {
176 short data;
177 if (get_user(data, up++))
178 return -EFAULT;
179 *fp++ = data;
180 *fp++ = data;
181 count--;
182 }
183 } else {
184 if (copy_from_user(fp, userPtr, count * 4))
185 return -EFAULT;
186 }
187 *frameUsed += used * 4;
188 return stereo? used * 4: used * 2;
189}
190
191static ssize_t pmac_ct_u16(const u_char __user *userPtr, size_t userCount,
192 u_char frame[], ssize_t *frameUsed,
193 ssize_t frameLeft)
194{
195 ssize_t count, used;
196 int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
197 int stereo = dmasound.soft.stereo;
198 short *fp = (short *) &frame[*frameUsed];
199 short __user *up = (short __user *) userPtr;
200
201 frameLeft >>= 2;
202 userCount >>= (stereo? 2: 1);
203 used = count = min_t(unsigned long, userCount, frameLeft);
204 while (count > 0) {
205 short data;
206 if (get_user(data, up++))
207 return -EFAULT;
208 data ^= mask;
209 *fp++ = data;
210 if (stereo) {
211 if (get_user(data, up++))
212 return -EFAULT;
213 data ^= mask;
214 }
215 *fp++ = data;
216 count--;
217 }
218 *frameUsed += used * 4;
219 return stereo? used * 4: used * 2;
220}
221
222
223static ssize_t pmac_ctx_law(const u_char __user *userPtr, size_t userCount,
224 u_char frame[], ssize_t *frameUsed,
225 ssize_t frameLeft)
226{
227 unsigned short *table = (unsigned short *)
228 (dmasound.soft.format == AFMT_MU_LAW
229 ? dmasound_ulaw2dma16 : dmasound_alaw2dma16);
230 unsigned int data = expand_data;
231 unsigned int *p = (unsigned int *) &frame[*frameUsed];
232 int bal = expand_bal;
233 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
234 int utotal, ftotal;
235 int stereo = dmasound.soft.stereo;
236
237 frameLeft >>= 2;
238 if (stereo)
239 userCount >>= 1;
240 ftotal = frameLeft;
241 utotal = userCount;
242 while (frameLeft) {
243 u_char c;
244 if (bal < 0) {
245 if (userCount == 0)
246 break;
247 if (get_user(c, userPtr++))
248 return -EFAULT;
249 data = table[c];
250 if (stereo) {
251 if (get_user(c, userPtr++))
252 return -EFAULT;
253 data = (data << 16) + table[c];
254 } else
255 data = (data << 16) + data;
256 userCount--;
257 bal += hSpeed;
258 }
259 *p++ = data;
260 frameLeft--;
261 bal -= sSpeed;
262 }
263 expand_bal = bal;
264 expand_data = data;
265 *frameUsed += (ftotal - frameLeft) * 4;
266 utotal -= userCount;
267 return stereo? utotal * 2: utotal;
268}
269
270static ssize_t pmac_ctx_s8(const u_char __user *userPtr, size_t userCount,
271 u_char frame[], ssize_t *frameUsed,
272 ssize_t frameLeft)
273{
274 unsigned int *p = (unsigned int *) &frame[*frameUsed];
275 unsigned int data = expand_data;
276 int bal = expand_bal;
277 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
278 int stereo = dmasound.soft.stereo;
279 int utotal, ftotal;
280
281 frameLeft >>= 2;
282 if (stereo)
283 userCount >>= 1;
284 ftotal = frameLeft;
285 utotal = userCount;
286 while (frameLeft) {
287 u_char c;
288 if (bal < 0) {
289 if (userCount == 0)
290 break;
291 if (get_user(c, userPtr++))
292 return -EFAULT;
293 data = c << 8;
294 if (stereo) {
295 if (get_user(c, userPtr++))
296 return -EFAULT;
297 data = (data << 16) + (c << 8);
298 } else
299 data = (data << 16) + data;
300 userCount--;
301 bal += hSpeed;
302 }
303 *p++ = data;
304 frameLeft--;
305 bal -= sSpeed;
306 }
307 expand_bal = bal;
308 expand_data = data;
309 *frameUsed += (ftotal - frameLeft) * 4;
310 utotal -= userCount;
311 return stereo? utotal * 2: utotal;
312}
313
314
315static ssize_t pmac_ctx_u8(const u_char __user *userPtr, size_t userCount,
316 u_char frame[], ssize_t *frameUsed,
317 ssize_t frameLeft)
318{
319 unsigned int *p = (unsigned int *) &frame[*frameUsed];
320 unsigned int data = expand_data;
321 int bal = expand_bal;
322 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
323 int stereo = dmasound.soft.stereo;
324 int utotal, ftotal;
325
326 frameLeft >>= 2;
327 if (stereo)
328 userCount >>= 1;
329 ftotal = frameLeft;
330 utotal = userCount;
331 while (frameLeft) {
332 u_char c;
333 if (bal < 0) {
334 if (userCount == 0)
335 break;
336 if (get_user(c, userPtr++))
337 return -EFAULT;
338 data = (c ^ 0x80) << 8;
339 if (stereo) {
340 if (get_user(c, userPtr++))
341 return -EFAULT;
342 data = (data << 16) + ((c ^ 0x80) << 8);
343 } else
344 data = (data << 16) + data;
345 userCount--;
346 bal += hSpeed;
347 }
348 *p++ = data;
349 frameLeft--;
350 bal -= sSpeed;
351 }
352 expand_bal = bal;
353 expand_data = data;
354 *frameUsed += (ftotal - frameLeft) * 4;
355 utotal -= userCount;
356 return stereo? utotal * 2: utotal;
357}
358
359
360static ssize_t pmac_ctx_s16(const u_char __user *userPtr, size_t userCount,
361 u_char frame[], ssize_t *frameUsed,
362 ssize_t frameLeft)
363{
364 unsigned int *p = (unsigned int *) &frame[*frameUsed];
365 unsigned int data = expand_data;
366 unsigned short __user *up = (unsigned short __user *) userPtr;
367 int bal = expand_bal;
368 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
369 int stereo = dmasound.soft.stereo;
370 int utotal, ftotal;
371
372 frameLeft >>= 2;
373 userCount >>= (stereo? 2: 1);
374 ftotal = frameLeft;
375 utotal = userCount;
376 while (frameLeft) {
377 unsigned short c;
378 if (bal < 0) {
379 if (userCount == 0)
380 break;
381 if (get_user(data, up++))
382 return -EFAULT;
383 if (stereo) {
384 if (get_user(c, up++))
385 return -EFAULT;
386 data = (data << 16) + c;
387 } else
388 data = (data << 16) + data;
389 userCount--;
390 bal += hSpeed;
391 }
392 *p++ = data;
393 frameLeft--;
394 bal -= sSpeed;
395 }
396 expand_bal = bal;
397 expand_data = data;
398 *frameUsed += (ftotal - frameLeft) * 4;
399 utotal -= userCount;
400 return stereo? utotal * 4: utotal * 2;
401}
402
403
404static ssize_t pmac_ctx_u16(const u_char __user *userPtr, size_t userCount,
405 u_char frame[], ssize_t *frameUsed,
406 ssize_t frameLeft)
407{
408 int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
409 unsigned int *p = (unsigned int *) &frame[*frameUsed];
410 unsigned int data = expand_data;
411 unsigned short __user *up = (unsigned short __user *) userPtr;
412 int bal = expand_bal;
413 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
414 int stereo = dmasound.soft.stereo;
415 int utotal, ftotal;
416
417 frameLeft >>= 2;
418 userCount >>= (stereo? 2: 1);
419 ftotal = frameLeft;
420 utotal = userCount;
421 while (frameLeft) {
422 unsigned short c;
423 if (bal < 0) {
424 if (userCount == 0)
425 break;
426 if (get_user(data, up++))
427 return -EFAULT;
428 data ^= mask;
429 if (stereo) {
430 if (get_user(c, up++))
431 return -EFAULT;
432 data = (data << 16) + (c ^ mask);
433 } else
434 data = (data << 16) + data;
435 userCount--;
436 bal += hSpeed;
437 }
438 *p++ = data;
439 frameLeft--;
440 bal -= sSpeed;
441 }
442 expand_bal = bal;
443 expand_data = data;
444 *frameUsed += (ftotal - frameLeft) * 4;
445 utotal -= userCount;
446 return stereo? utotal * 4: utotal * 2;
447}
448
449/* data in routines... */
450
451static ssize_t pmac_ct_s8_read(const u_char __user *userPtr, size_t userCount,
452 u_char frame[], ssize_t *frameUsed,
453 ssize_t frameLeft)
454{
455 ssize_t count, used;
456 short *p = (short *) &frame[*frameUsed];
457 int val, stereo = dmasound.soft.stereo;
458
459 frameLeft >>= 2;
460 if (stereo)
461 userCount >>= 1;
462 used = count = min_t(unsigned long, userCount, frameLeft);
463 while (count > 0) {
464 u_char data;
465
466 val = *p++;
467 val = (val * software_input_volume) >> 7;
468 data = val >> 8;
469 if (put_user(data, (u_char __user *)userPtr++))
470 return -EFAULT;
471 if (stereo) {
472 val = *p;
473 val = (val * software_input_volume) >> 7;
474 data = val >> 8;
475 if (put_user(data, (u_char __user *)userPtr++))
476 return -EFAULT;
477 }
478 p++;
479 count--;
480 }
481 *frameUsed += used * 4;
482 return stereo? used * 2: used;
483}
484
485
486static ssize_t pmac_ct_u8_read(const u_char __user *userPtr, size_t userCount,
487 u_char frame[], ssize_t *frameUsed,
488 ssize_t frameLeft)
489{
490 ssize_t count, used;
491 short *p = (short *) &frame[*frameUsed];
492 int val, stereo = dmasound.soft.stereo;
493
494 frameLeft >>= 2;
495 if (stereo)
496 userCount >>= 1;
497 used = count = min_t(unsigned long, userCount, frameLeft);
498 while (count > 0) {
499 u_char data;
500
501 val = *p++;
502 val = (val * software_input_volume) >> 7;
503 data = (val >> 8) ^ 0x80;
504 if (put_user(data, (u_char __user *)userPtr++))
505 return -EFAULT;
506 if (stereo) {
507 val = *p;
508 val = (val * software_input_volume) >> 7;
509 data = (val >> 8) ^ 0x80;
510 if (put_user(data, (u_char __user *)userPtr++))
511 return -EFAULT;
512 }
513 p++;
514 count--;
515 }
516 *frameUsed += used * 4;
517 return stereo? used * 2: used;
518}
519
520static ssize_t pmac_ct_s16_read(const u_char __user *userPtr, size_t userCount,
521 u_char frame[], ssize_t *frameUsed,
522 ssize_t frameLeft)
523{
524 ssize_t count, used;
525 int stereo = dmasound.soft.stereo;
526 short *fp = (short *) &frame[*frameUsed];
527 short __user *up = (short __user *) userPtr;
528
529 frameLeft >>= 2;
530 userCount >>= (stereo? 2: 1);
531 used = count = min_t(unsigned long, userCount, frameLeft);
532 while (count > 0) {
533 short data;
534
535 data = *fp++;
536 data = (data * software_input_volume) >> 7;
537 if (put_user(data, up++))
538 return -EFAULT;
539 if (stereo) {
540 data = *fp;
541 data = (data * software_input_volume) >> 7;
542 if (put_user(data, up++))
543 return -EFAULT;
544 }
545 fp++;
546 count--;
547 }
548 *frameUsed += used * 4;
549 return stereo? used * 4: used * 2;
550}
551
552static ssize_t pmac_ct_u16_read(const u_char __user *userPtr, size_t userCount,
553 u_char frame[], ssize_t *frameUsed,
554 ssize_t frameLeft)
555{
556 ssize_t count, used;
557 int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
558 int stereo = dmasound.soft.stereo;
559 short *fp = (short *) &frame[*frameUsed];
560 short __user *up = (short __user *) userPtr;
561
562 frameLeft >>= 2;
563 userCount >>= (stereo? 2: 1);
564 used = count = min_t(unsigned long, userCount, frameLeft);
565 while (count > 0) {
566 int data;
567
568 data = *fp++;
569 data = (data * software_input_volume) >> 7;
570 data ^= mask;
571 if (put_user(data, up++))
572 return -EFAULT;
573 if (stereo) {
574 data = *fp;
575 data = (data * software_input_volume) >> 7;
576 data ^= mask;
577 if (put_user(data, up++))
578 return -EFAULT;
579 }
580 fp++;
581 count--;
582 }
583 *frameUsed += used * 4;
584 return stereo? used * 4: used * 2;
585}
586
587/* data in routines (reducing speed)... */
588
589static ssize_t pmac_ctx_s8_read(const u_char __user *userPtr, size_t userCount,
590 u_char frame[], ssize_t *frameUsed,
591 ssize_t frameLeft)
592{
593 short *p = (short *) &frame[*frameUsed];
594 int bal = expand_read_bal;
595 int vall,valr, stereo = dmasound.soft.stereo;
596 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
597 int utotal, ftotal;
598
599 frameLeft >>= 2;
600 if (stereo)
601 userCount >>= 1;
602 ftotal = frameLeft;
603 utotal = userCount;
604 while (frameLeft) {
605 u_char data;
606
607 if (bal<0 && userCount == 0)
608 break;
609 vall = *p++;
610 vall = (vall * software_input_volume) >> 7;
611 if (stereo) {
612 valr = *p;
613 valr = (valr * software_input_volume) >> 7;
614 }
615 p++;
616 if (bal < 0) {
617 data = vall >> 8;
618 if (put_user(data, (u_char __user *)userPtr++))
619 return -EFAULT;
620 if (stereo) {
621 data = valr >> 8;
622 if (put_user(data, (u_char __user *)userPtr++))
623 return -EFAULT;
624 }
625 userCount--;
626 bal += hSpeed;
627 }
628 frameLeft--;
629 bal -= sSpeed;
630 }
631 expand_read_bal=bal;
632 *frameUsed += (ftotal - frameLeft) * 4;
633 utotal -= userCount;
634 return stereo? utotal * 2: utotal;
635}
636
637
638static ssize_t pmac_ctx_u8_read(const u_char __user *userPtr, size_t userCount,
639 u_char frame[], ssize_t *frameUsed,
640 ssize_t frameLeft)
641{
642 short *p = (short *) &frame[*frameUsed];
643 int bal = expand_read_bal;
644 int vall,valr, stereo = dmasound.soft.stereo;
645 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
646 int utotal, ftotal;
647
648 frameLeft >>= 2;
649 if (stereo)
650 userCount >>= 1;
651 ftotal = frameLeft;
652 utotal = userCount;
653 while (frameLeft) {
654 u_char data;
655
656 if (bal<0 && userCount == 0)
657 break;
658
659 vall = *p++;
660 vall = (vall * software_input_volume) >> 7;
661 if (stereo) {
662 valr = *p;
663 valr = (valr * software_input_volume) >> 7;
664 }
665 p++;
666 if (bal < 0) {
667 data = (vall >> 8) ^ 0x80;
668 if (put_user(data, (u_char __user *)userPtr++))
669 return -EFAULT;
670 if (stereo) {
671 data = (valr >> 8) ^ 0x80;
672 if (put_user(data, (u_char __user *)userPtr++))
673 return -EFAULT;
674 }
675 userCount--;
676 bal += hSpeed;
677 }
678 frameLeft--;
679 bal -= sSpeed;
680 }
681 expand_read_bal=bal;
682 *frameUsed += (ftotal - frameLeft) * 4;
683 utotal -= userCount;
684 return stereo? utotal * 2: utotal;
685}
686
687static ssize_t pmac_ctx_s16_read(const u_char __user *userPtr, size_t userCount,
688 u_char frame[], ssize_t *frameUsed,
689 ssize_t frameLeft)
690{
691 int bal = expand_read_bal;
692 short *fp = (short *) &frame[*frameUsed];
693 short __user *up = (short __user *) userPtr;
694 int stereo = dmasound.soft.stereo;
695 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
696 int utotal, ftotal;
697
698 frameLeft >>= 2;
699 userCount >>= (stereo? 2: 1);
700 ftotal = frameLeft;
701 utotal = userCount;
702 while (frameLeft) {
703 int datal,datar;
704
705 if (bal<0 && userCount == 0)
706 break;
707
708 datal = *fp++;
709 datal = (datal * software_input_volume) >> 7;
710 if (stereo) {
711 datar = *fp;
712 datar = (datar * software_input_volume) >> 7;
713 }
714 fp++;
715 if (bal < 0) {
716 if (put_user(datal, up++))
717 return -EFAULT;
718 if (stereo) {
719 if (put_user(datar, up++))
720 return -EFAULT;
721 }
722 userCount--;
723 bal += hSpeed;
724 }
725 frameLeft--;
726 bal -= sSpeed;
727 }
728 expand_read_bal=bal;
729 *frameUsed += (ftotal - frameLeft) * 4;
730 utotal -= userCount;
731 return stereo? utotal * 4: utotal * 2;
732}
733
734static ssize_t pmac_ctx_u16_read(const u_char __user *userPtr, size_t userCount,
735 u_char frame[], ssize_t *frameUsed,
736 ssize_t frameLeft)
737{
738 int bal = expand_read_bal;
739 int mask = (dmasound.soft.format == AFMT_U16_LE? 0x0080: 0x8000);
740 short *fp = (short *) &frame[*frameUsed];
741 short __user *up = (short __user *) userPtr;
742 int stereo = dmasound.soft.stereo;
743 int hSpeed = dmasound.hard.speed, sSpeed = dmasound.soft.speed;
744 int utotal, ftotal;
745
746 frameLeft >>= 2;
747 userCount >>= (stereo? 2: 1);
748 ftotal = frameLeft;
749 utotal = userCount;
750 while (frameLeft) {
751 int datal,datar;
752
753 if (bal<0 && userCount == 0)
754 break;
755
756 datal = *fp++;
757 datal = (datal * software_input_volume) >> 7;
758 datal ^= mask;
759 if (stereo) {
760 datar = *fp;
761 datar = (datar * software_input_volume) >> 7;
762 datar ^= mask;
763 }
764 fp++;
765 if (bal < 0) {
766 if (put_user(datal, up++))
767 return -EFAULT;
768 if (stereo) {
769 if (put_user(datar, up++))
770 return -EFAULT;
771 }
772 userCount--;
773 bal += hSpeed;
774 }
775 frameLeft--;
776 bal -= sSpeed;
777 }
778 expand_read_bal=bal;
779 *frameUsed += (ftotal - frameLeft) * 4;
780 utotal -= userCount;
781 return stereo? utotal * 4: utotal * 2;
782}
783
784
785TRANS transAwacsNormal = {
786 .ct_ulaw= pmac_ct_law,
787 .ct_alaw= pmac_ct_law,
788 .ct_s8= pmac_ct_s8,
789 .ct_u8= pmac_ct_u8,
790 .ct_s16be= pmac_ct_s16,
791 .ct_u16be= pmac_ct_u16,
792 .ct_s16le= pmac_ct_s16,
793 .ct_u16le= pmac_ct_u16,
794};
795
796TRANS transAwacsExpand = {
797 .ct_ulaw= pmac_ctx_law,
798 .ct_alaw= pmac_ctx_law,
799 .ct_s8= pmac_ctx_s8,
800 .ct_u8= pmac_ctx_u8,
801 .ct_s16be= pmac_ctx_s16,
802 .ct_u16be= pmac_ctx_u16,
803 .ct_s16le= pmac_ctx_s16,
804 .ct_u16le= pmac_ctx_u16,
805};
806
807TRANS transAwacsNormalRead = {
808 .ct_s8= pmac_ct_s8_read,
809 .ct_u8= pmac_ct_u8_read,
810 .ct_s16be= pmac_ct_s16_read,
811 .ct_u16be= pmac_ct_u16_read,
812 .ct_s16le= pmac_ct_s16_read,
813 .ct_u16le= pmac_ct_u16_read,
814};
815
816TRANS transAwacsExpandRead = {
817 .ct_s8= pmac_ctx_s8_read,
818 .ct_u8= pmac_ctx_u8_read,
819 .ct_s16be= pmac_ctx_s16_read,
820 .ct_u16be= pmac_ctx_u16_read,
821 .ct_s16le= pmac_ctx_s16_read,
822 .ct_u16le= pmac_ctx_u16_read,
823};
824
825/* translation tables */
826/* 16 bit mu-law */
827
828static short dmasound_ulaw2dma16[] = {
829 -32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
830 -23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,
831 -15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412,
832 -11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316,
833 -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
834 -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
835 -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
836 -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
837 -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
838 -1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
839 -876, -844, -812, -780, -748, -716, -684, -652,
840 -620, -588, -556, -524, -492, -460, -428, -396,
841 -372, -356, -340, -324, -308, -292, -276, -260,
842 -244, -228, -212, -196, -180, -164, -148, -132,
843 -120, -112, -104, -96, -88, -80, -72, -64,
844 -56, -48, -40, -32, -24, -16, -8, 0,
845 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
846 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
847 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
848 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
849 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
850 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
851 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
852 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
853 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
854 1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
855 876, 844, 812, 780, 748, 716, 684, 652,
856 620, 588, 556, 524, 492, 460, 428, 396,
857 372, 356, 340, 324, 308, 292, 276, 260,
858 244, 228, 212, 196, 180, 164, 148, 132,
859 120, 112, 104, 96, 88, 80, 72, 64,
860 56, 48, 40, 32, 24, 16, 8, 0,
861};
862
863/* 16 bit A-law */
864
865static short dmasound_alaw2dma16[] = {
866 -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736,
867 -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784,
868 -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368,
869 -3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392,
870 -22016, -20992, -24064, -23040, -17920, -16896, -19968, -18944,
871 -30208, -29184, -32256, -31232, -26112, -25088, -28160, -27136,
872 -11008, -10496, -12032, -11520, -8960, -8448, -9984, -9472,
873 -15104, -14592, -16128, -15616, -13056, -12544, -14080, -13568,
874 -344, -328, -376, -360, -280, -264, -312, -296,
875 -472, -456, -504, -488, -408, -392, -440, -424,
876 -88, -72, -120, -104, -24, -8, -56, -40,
877 -216, -200, -248, -232, -152, -136, -184, -168,
878 -1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184,
879 -1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696,
880 -688, -656, -752, -720, -560, -528, -624, -592,
881 -944, -912, -1008, -976, -816, -784, -880, -848,
882 5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736,
883 7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784,
884 2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368,
885 3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392,
886 22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944,
887 30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136,
888 11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472,
889 15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568,
890 344, 328, 376, 360, 280, 264, 312, 296,
891 472, 456, 504, 488, 408, 392, 440, 424,
892 88, 72, 120, 104, 24, 8, 56, 40,
893 216, 200, 248, 232, 152, 136, 184, 168,
894 1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184,
895 1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696,
896 688, 656, 752, 720, 560, 528, 624, 592,
897 944, 912, 1008, 976, 816, 784, 880, 848,
898};
diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c
deleted file mode 100644
index 52648573f601..000000000000
--- a/sound/oss/es1371.c
+++ /dev/null
@@ -1,3131 +0,0 @@
1/*****************************************************************************/
2
3/*
4 * es1371.c -- Creative Ensoniq ES1371.
5 *
6 * Copyright (C) 1998-2001, 2003 Thomas Sailer (t.sailer@alumni.ethz.ch)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Special thanks to Ensoniq
23 *
24 * Supported devices:
25 * /dev/dsp standard /dev/dsp device, (mostly) OSS compatible
26 * /dev/mixer standard /dev/mixer device, (mostly) OSS compatible
27 * /dev/dsp1 additional DAC, like /dev/dsp, but outputs to mixer "SYNTH" setting
28 * /dev/midi simple MIDI UART interface, no ioctl
29 *
30 * NOTE: the card does not have any FM/Wavetable synthesizer, it is supposed
31 * to be done in software. That is what /dev/dac is for. By now (Q2 1998)
32 * there are several MIDI to PCM (WAV) packages, one of them is timidity.
33 *
34 * Revision history
35 * 04.06.1998 0.1 Initial release
36 * Mixer stuff should be overhauled; especially optional AC97 mixer bits
37 * should be detected. This results in strange behaviour of some mixer
38 * settings, like master volume and mic.
39 * 08.06.1998 0.2 First release using Alan Cox' soundcore instead of miscdevice
40 * 03.08.1998 0.3 Do not include modversions.h
41 * Now mixer behaviour can basically be selected between
42 * "OSS documented" and "OSS actual" behaviour
43 * 31.08.1998 0.4 Fix realplayer problems - dac.count issues
44 * 27.10.1998 0.5 Fix joystick support
45 * -- Oliver Neukum (c188@org.chemie.uni-muenchen.de)
46 * 10.12.1998 0.6 Fix drain_dac trying to wait on not yet initialized DMA
47 * 23.12.1998 0.7 Fix a few f_file & FMODE_ bugs
48 * Don't wake up app until there are fragsize bytes to read/write
49 * 06.01.1999 0.8 remove the silly SA_INTERRUPT flag.
50 * hopefully killed the egcs section type conflict
51 * 12.03.1999 0.9 cinfo.blocks should be reset after GETxPTR ioctl.
52 * reported by Johan Maes <joma@telindus.be>
53 * 22.03.1999 0.10 return EAGAIN instead of EBUSY when O_NONBLOCK
54 * read/write cannot be executed
55 * 07.04.1999 0.11 implemented the following ioctl's: SOUND_PCM_READ_RATE,
56 * SOUND_PCM_READ_CHANNELS, SOUND_PCM_READ_BITS;
57 * Alpha fixes reported by Peter Jones <pjones@redhat.com>
58 * Another Alpha fix (wait_src_ready in init routine)
59 * reported by "Ivan N. Kokshaysky" <ink@jurassic.park.msu.ru>
60 * Note: joystick address handling might still be wrong on archs
61 * other than i386
62 * 15.06.1999 0.12 Fix bad allocation bug.
63 * Thanks to Deti Fliegl <fliegl@in.tum.de>
64 * 28.06.1999 0.13 Add pci_set_master
65 * 03.08.1999 0.14 adapt to Linus' new __setup/__initcall
66 * added kernel command line option "es1371=joystickaddr"
67 * removed CONFIG_SOUND_ES1371_JOYPORT_BOOT kludge
68 * 10.08.1999 0.15 (Re)added S/PDIF module option for cards revision >= 4.
69 * Initial version by Dave Platt <dplatt@snulbug.mtview.ca.us>.
70 * module_init/__setup fixes
71 * 08.16.1999 0.16 Joe Cotellese <joec@ensoniq.com>
72 * Added detection for ES1371 revision ID so that we can
73 * detect the ES1373 and later parts.
74 * added AC97 #defines for readability
75 * added a /proc file system for dumping hardware state
76 * updated SRC and CODEC w/r functions to accommodate bugs
77 * in some versions of the ES137x chips.
78 * 31.08.1999 0.17 add spin_lock_init
79 * replaced current->state = x with set_current_state(x)
80 * 03.09.1999 0.18 change read semantics for MIDI to match
81 * OSS more closely; remove possible wakeup race
82 * 21.10.1999 0.19 Round sampling rates, requested by
83 * Kasamatsu Kenichi <t29w0267@ip.media.kyoto-u.ac.jp>
84 * 27.10.1999 0.20 Added SigmaTel 3D enhancement string
85 * Codec ID printing changes
86 * 28.10.1999 0.21 More waitqueue races fixed
87 * Joe Cotellese <joec@ensoniq.com>
88 * Changed PCI detection routine so we can more easily
89 * detect ES137x chip and derivatives.
90 * 05.01.2000 0.22 Should now work with rev7 boards; patch by
91 * Eric Lemar, elemar@cs.washington.edu
92 * 08.01.2000 0.23 Prevent some ioctl's from returning bad count values on underrun/overrun;
93 * Tim Janik's BSE (Bedevilled Sound Engine) found this
94 * 07.02.2000 0.24 Use pci_alloc_consistent and pci_register_driver
95 * 07.02.2000 0.25 Use ac97_codec
96 * 01.03.2000 0.26 SPDIF patch by Mikael Bouillot <mikael.bouillot@bigfoot.com>
97 * Use pci_module_init
98 * 21.11.2000 0.27 Initialize dma buffers in poll, otherwise poll may return a bogus mask
99 * 12.12.2000 0.28 More dma buffer initializations, patch from
100 * Tjeerd Mulder <tjeerd.mulder@fujitsu-siemens.com>
101 * 05.01.2001 0.29 Hopefully updates will not be required anymore when Creative bumps
102 * the CT5880 revision.
103 * suggested by Stephan Müller <smueller@chronox.de>
104 * 31.01.2001 0.30 Register/Unregister gameport
105 * Fix SETTRIGGER non OSS API conformity
106 * 14.07.2001 0.31 Add list of laptops needing amplifier control
107 * 03.01.2003 0.32 open_mode fixes from Georg Acher <acher@in.tum.de>
108 */
109
110/*****************************************************************************/
111
112#include <linux/interrupt.h>
113#include <linux/module.h>
114#include <linux/string.h>
115#include <linux/ioport.h>
116#include <linux/sched.h>
117#include <linux/delay.h>
118#include <linux/sound.h>
119#include <linux/slab.h>
120#include <linux/soundcard.h>
121#include <linux/pci.h>
122#include <linux/init.h>
123#include <linux/poll.h>
124#include <linux/bitops.h>
125#include <linux/proc_fs.h>
126#include <linux/spinlock.h>
127#include <linux/smp_lock.h>
128#include <linux/ac97_codec.h>
129#include <linux/gameport.h>
130#include <linux/wait.h>
131#include <linux/dma-mapping.h>
132#include <linux/mutex.h>
133#include <linux/mm.h>
134#include <linux/kernel.h>
135
136#include <asm/io.h>
137#include <asm/page.h>
138#include <asm/uaccess.h>
139
140#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
141#define SUPPORT_JOYSTICK
142#endif
143
144/* --------------------------------------------------------------------- */
145
146#undef OSS_DOCUMENTED_MIXER_SEMANTICS
147#define ES1371_DEBUG
148#define DBG(x) {}
149/*#define DBG(x) {x}*/
150
151/* --------------------------------------------------------------------- */
152
153#ifndef PCI_VENDOR_ID_ENSONIQ
154#define PCI_VENDOR_ID_ENSONIQ 0x1274
155#endif
156
157#ifndef PCI_VENDOR_ID_ECTIVA
158#define PCI_VENDOR_ID_ECTIVA 0x1102
159#endif
160
161#ifndef PCI_DEVICE_ID_ENSONIQ_ES1371
162#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371
163#endif
164
165#ifndef PCI_DEVICE_ID_ENSONIQ_CT5880
166#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880
167#endif
168
169#ifndef PCI_DEVICE_ID_ECTIVA_EV1938
170#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938
171#endif
172
173/* ES1371 chip ID */
174/* This is a little confusing because all ES1371 compatible chips have the
175 same DEVICE_ID, the only thing differentiating them is the REV_ID field.
176 This is only significant if you want to enable features on the later parts.
177 Yes, I know it's stupid and why didn't we use the sub IDs?
178*/
179#define ES1371REV_ES1373_A 0x04
180#define ES1371REV_ES1373_B 0x06
181#define ES1371REV_CT5880_A 0x07
182#define CT5880REV_CT5880_C 0x02
183#define CT5880REV_CT5880_D 0x03
184#define ES1371REV_ES1371_B 0x09
185#define EV1938REV_EV1938_A 0x00
186#define ES1371REV_ES1373_8 0x08
187
188#define ES1371_MAGIC ((PCI_VENDOR_ID_ENSONIQ<<16)|PCI_DEVICE_ID_ENSONIQ_ES1371)
189
190#define ES1371_EXTENT 0x40
191#define JOY_EXTENT 8
192
193#define ES1371_REG_CONTROL 0x00
194#define ES1371_REG_STATUS 0x04 /* on the 5880 it is control/status */
195#define ES1371_REG_UART_DATA 0x08
196#define ES1371_REG_UART_STATUS 0x09
197#define ES1371_REG_UART_CONTROL 0x09
198#define ES1371_REG_UART_TEST 0x0a
199#define ES1371_REG_MEMPAGE 0x0c
200#define ES1371_REG_SRCONV 0x10
201#define ES1371_REG_CODEC 0x14
202#define ES1371_REG_LEGACY 0x18
203#define ES1371_REG_SERIAL_CONTROL 0x20
204#define ES1371_REG_DAC1_SCOUNT 0x24
205#define ES1371_REG_DAC2_SCOUNT 0x28
206#define ES1371_REG_ADC_SCOUNT 0x2c
207
208#define ES1371_REG_DAC1_FRAMEADR 0xc30
209#define ES1371_REG_DAC1_FRAMECNT 0xc34
210#define ES1371_REG_DAC2_FRAMEADR 0xc38
211#define ES1371_REG_DAC2_FRAMECNT 0xc3c
212#define ES1371_REG_ADC_FRAMEADR 0xd30
213#define ES1371_REG_ADC_FRAMECNT 0xd34
214
215#define ES1371_FMT_U8_MONO 0
216#define ES1371_FMT_U8_STEREO 1
217#define ES1371_FMT_S16_MONO 2
218#define ES1371_FMT_S16_STEREO 3
219#define ES1371_FMT_STEREO 1
220#define ES1371_FMT_S16 2
221#define ES1371_FMT_MASK 3
222
223static const unsigned sample_size[] = { 1, 2, 2, 4 };
224static const unsigned sample_shift[] = { 0, 1, 1, 2 };
225
226#define CTRL_RECEN_B 0x08000000 /* 1 = don't mix analog in to digital out */
227#define CTRL_SPDIFEN_B 0x04000000
228#define CTRL_JOY_SHIFT 24
229#define CTRL_JOY_MASK 3
230#define CTRL_JOY_200 0x00000000 /* joystick base address */
231#define CTRL_JOY_208 0x01000000
232#define CTRL_JOY_210 0x02000000
233#define CTRL_JOY_218 0x03000000
234#define CTRL_GPIO_IN0 0x00100000 /* general purpose inputs/outputs */
235#define CTRL_GPIO_IN1 0x00200000
236#define CTRL_GPIO_IN2 0x00400000
237#define CTRL_GPIO_IN3 0x00800000
238#define CTRL_GPIO_OUT0 0x00010000
239#define CTRL_GPIO_OUT1 0x00020000
240#define CTRL_GPIO_OUT2 0x00040000
241#define CTRL_GPIO_OUT3 0x00080000
242#define CTRL_MSFMTSEL 0x00008000 /* MPEG serial data fmt: 0 = Sony, 1 = I2S */
243#define CTRL_SYNCRES 0x00004000 /* AC97 warm reset */
244#define CTRL_ADCSTOP 0x00002000 /* stop ADC transfers */
245#define CTRL_PWR_INTRM 0x00001000 /* 1 = power level ints enabled */
246#define CTRL_M_CB 0x00000800 /* recording source: 0 = ADC, 1 = MPEG */
247#define CTRL_CCB_INTRM 0x00000400 /* 1 = CCB "voice" ints enabled */
248#define CTRL_PDLEV0 0x00000000 /* power down level */
249#define CTRL_PDLEV1 0x00000100
250#define CTRL_PDLEV2 0x00000200
251#define CTRL_PDLEV3 0x00000300
252#define CTRL_BREQ 0x00000080 /* 1 = test mode (internal mem test) */
253#define CTRL_DAC1_EN 0x00000040 /* enable DAC1 */
254#define CTRL_DAC2_EN 0x00000020 /* enable DAC2 */
255#define CTRL_ADC_EN 0x00000010 /* enable ADC */
256#define CTRL_UART_EN 0x00000008 /* enable MIDI uart */
257#define CTRL_JYSTK_EN 0x00000004 /* enable Joystick port */
258#define CTRL_XTALCLKDIS 0x00000002 /* 1 = disable crystal clock input */
259#define CTRL_PCICLKDIS 0x00000001 /* 1 = disable PCI clock distribution */
260
261
262#define STAT_INTR 0x80000000 /* wired or of all interrupt bits */
263#define CSTAT_5880_AC97_RST 0x20000000 /* CT5880 Reset bit */
264#define STAT_EN_SPDIF 0x00040000 /* enable S/PDIF circuitry */
265#define STAT_TS_SPDIF 0x00020000 /* test S/PDIF circuitry */
266#define STAT_TESTMODE 0x00010000 /* test ASIC */
267#define STAT_SYNC_ERR 0x00000100 /* 1 = codec sync error */
268#define STAT_VC 0x000000c0 /* CCB int source, 0=DAC1, 1=DAC2, 2=ADC, 3=undef */
269#define STAT_SH_VC 6
270#define STAT_MPWR 0x00000020 /* power level interrupt */
271#define STAT_MCCB 0x00000010 /* CCB int pending */
272#define STAT_UART 0x00000008 /* UART int pending */
273#define STAT_DAC1 0x00000004 /* DAC1 int pending */
274#define STAT_DAC2 0x00000002 /* DAC2 int pending */
275#define STAT_ADC 0x00000001 /* ADC int pending */
276
277#define USTAT_RXINT 0x80 /* UART rx int pending */
278#define USTAT_TXINT 0x04 /* UART tx int pending */
279#define USTAT_TXRDY 0x02 /* UART tx ready */
280#define USTAT_RXRDY 0x01 /* UART rx ready */
281
282#define UCTRL_RXINTEN 0x80 /* 1 = enable RX ints */
283#define UCTRL_TXINTEN 0x60 /* TX int enable field mask */
284#define UCTRL_ENA_TXINT 0x20 /* enable TX int */
285#define UCTRL_CNTRL 0x03 /* control field */
286#define UCTRL_CNTRL_SWR 0x03 /* software reset command */
287
288/* sample rate converter */
289#define SRC_OKSTATE 1
290
291#define SRC_RAMADDR_MASK 0xfe000000
292#define SRC_RAMADDR_SHIFT 25
293#define SRC_DAC1FREEZE (1UL << 21)
294#define SRC_DAC2FREEZE (1UL << 20)
295#define SRC_ADCFREEZE (1UL << 19)
296
297
298#define SRC_WE 0x01000000 /* read/write control for SRC RAM */
299#define SRC_BUSY 0x00800000 /* SRC busy */
300#define SRC_DIS 0x00400000 /* 1 = disable SRC */
301#define SRC_DDAC1 0x00200000 /* 1 = disable accum update for DAC1 */
302#define SRC_DDAC2 0x00100000 /* 1 = disable accum update for DAC2 */
303#define SRC_DADC 0x00080000 /* 1 = disable accum update for ADC2 */
304#define SRC_CTLMASK 0x00780000
305#define SRC_RAMDATA_MASK 0x0000ffff
306#define SRC_RAMDATA_SHIFT 0
307
308#define SRCREG_ADC 0x78
309#define SRCREG_DAC1 0x70
310#define SRCREG_DAC2 0x74
311#define SRCREG_VOL_ADC 0x6c
312#define SRCREG_VOL_DAC1 0x7c
313#define SRCREG_VOL_DAC2 0x7e
314
315#define SRCREG_TRUNC_N 0x00
316#define SRCREG_INT_REGS 0x01
317#define SRCREG_ACCUM_FRAC 0x02
318#define SRCREG_VFREQ_FRAC 0x03
319
320#define CODEC_PIRD 0x00800000 /* 0 = write AC97 register */
321#define CODEC_PIADD_MASK 0x007f0000
322#define CODEC_PIADD_SHIFT 16
323#define CODEC_PIDAT_MASK 0x0000ffff
324#define CODEC_PIDAT_SHIFT 0
325
326#define CODEC_RDY 0x80000000 /* AC97 read data valid */
327#define CODEC_WIP 0x40000000 /* AC97 write in progress */
328#define CODEC_PORD 0x00800000 /* 0 = write AC97 register */
329#define CODEC_POADD_MASK 0x007f0000
330#define CODEC_POADD_SHIFT 16
331#define CODEC_PODAT_MASK 0x0000ffff
332#define CODEC_PODAT_SHIFT 0
333
334
335#define LEGACY_JFAST 0x80000000 /* fast joystick timing */
336#define LEGACY_FIRQ 0x01000000 /* force IRQ */
337
338#define SCTRL_DACTEST 0x00400000 /* 1 = DAC test, test vector generation purposes */
339#define SCTRL_P2ENDINC 0x00380000 /* */
340#define SCTRL_SH_P2ENDINC 19
341#define SCTRL_P2STINC 0x00070000 /* */
342#define SCTRL_SH_P2STINC 16
343#define SCTRL_R1LOOPSEL 0x00008000 /* 0 = loop mode */
344#define SCTRL_P2LOOPSEL 0x00004000 /* 0 = loop mode */
345#define SCTRL_P1LOOPSEL 0x00002000 /* 0 = loop mode */
346#define SCTRL_P2PAUSE 0x00001000 /* 1 = pause mode */
347#define SCTRL_P1PAUSE 0x00000800 /* 1 = pause mode */
348#define SCTRL_R1INTEN 0x00000400 /* enable interrupt */
349#define SCTRL_P2INTEN 0x00000200 /* enable interrupt */
350#define SCTRL_P1INTEN 0x00000100 /* enable interrupt */
351#define SCTRL_P1SCTRLD 0x00000080 /* reload sample count register for DAC1 */
352#define SCTRL_P2DACSEN 0x00000040 /* 1 = DAC2 play back last sample when disabled */
353#define SCTRL_R1SEB 0x00000020 /* 1 = 16bit */
354#define SCTRL_R1SMB 0x00000010 /* 1 = stereo */
355#define SCTRL_R1FMT 0x00000030 /* format mask */
356#define SCTRL_SH_R1FMT 4
357#define SCTRL_P2SEB 0x00000008 /* 1 = 16bit */
358#define SCTRL_P2SMB 0x00000004 /* 1 = stereo */
359#define SCTRL_P2FMT 0x0000000c /* format mask */
360#define SCTRL_SH_P2FMT 2
361#define SCTRL_P1SEB 0x00000002 /* 1 = 16bit */
362#define SCTRL_P1SMB 0x00000001 /* 1 = stereo */
363#define SCTRL_P1FMT 0x00000003 /* format mask */
364#define SCTRL_SH_P1FMT 0
365
366
367/* misc stuff */
368#define POLL_COUNT 0x1000
369#define FMODE_DAC 4 /* slight misuse of mode_t */
370
371/* MIDI buffer sizes */
372
373#define MIDIINBUF 256
374#define MIDIOUTBUF 256
375
376#define FMODE_MIDI_SHIFT 3
377#define FMODE_MIDI_READ (FMODE_READ << FMODE_MIDI_SHIFT)
378#define FMODE_MIDI_WRITE (FMODE_WRITE << FMODE_MIDI_SHIFT)
379
380#define ES1371_MODULE_NAME "es1371"
381#define PFX ES1371_MODULE_NAME ": "
382
383/* --------------------------------------------------------------------- */
384
385struct es1371_state {
386 /* magic */
387 unsigned int magic;
388
389 /* list of es1371 devices */
390 struct list_head devs;
391
392 /* the corresponding pci_dev structure */
393 struct pci_dev *dev;
394
395 /* soundcore stuff */
396 int dev_audio;
397 int dev_dac;
398 int dev_midi;
399
400 /* hardware resources */
401 unsigned long io; /* long for SPARC */
402 unsigned int irq;
403
404 /* PCI ID's */
405 u16 vendor;
406 u16 device;
407 u8 rev; /* the chip revision */
408
409 /* options */
410 int spdif_volume; /* S/PDIF output is enabled if != -1 */
411
412#ifdef ES1371_DEBUG
413 /* debug /proc entry */
414 struct proc_dir_entry *ps;
415#endif /* ES1371_DEBUG */
416
417 struct ac97_codec *codec;
418
419 /* wave stuff */
420 unsigned ctrl;
421 unsigned sctrl;
422 unsigned dac1rate, dac2rate, adcrate;
423
424 spinlock_t lock;
425 struct mutex open_mutex;
426 mode_t open_mode;
427 wait_queue_head_t open_wait;
428
429 struct dmabuf {
430 void *rawbuf;
431 dma_addr_t dmaaddr;
432 unsigned buforder;
433 unsigned numfrag;
434 unsigned fragshift;
435 unsigned hwptr, swptr;
436 unsigned total_bytes;
437 int count;
438 unsigned error; /* over/underrun */
439 wait_queue_head_t wait;
440 /* redundant, but makes calculations easier */
441 unsigned fragsize;
442 unsigned dmasize;
443 unsigned fragsamples;
444 /* OSS stuff */
445 unsigned mapped:1;
446 unsigned ready:1;
447 unsigned endcleared:1;
448 unsigned enabled:1;
449 unsigned ossfragshift;
450 int ossmaxfrags;
451 unsigned subdivision;
452 } dma_dac1, dma_dac2, dma_adc;
453
454 /* midi stuff */
455 struct {
456 unsigned ird, iwr, icnt;
457 unsigned ord, owr, ocnt;
458 wait_queue_head_t iwait;
459 wait_queue_head_t owait;
460 unsigned char ibuf[MIDIINBUF];
461 unsigned char obuf[MIDIOUTBUF];
462 } midi;
463
464#ifdef SUPPORT_JOYSTICK
465 struct gameport *gameport;
466#endif
467
468 struct mutex sem;
469};
470
471/* --------------------------------------------------------------------- */
472
473static LIST_HEAD(devs);
474
475/* --------------------------------------------------------------------- */
476
477static inline unsigned ld2(unsigned int x)
478{
479 unsigned r = 0;
480
481 if (x >= 0x10000) {
482 x >>= 16;
483 r += 16;
484 }
485 if (x >= 0x100) {
486 x >>= 8;
487 r += 8;
488 }
489 if (x >= 0x10) {
490 x >>= 4;
491 r += 4;
492 }
493 if (x >= 4) {
494 x >>= 2;
495 r += 2;
496 }
497 if (x >= 2)
498 r++;
499 return r;
500}
501
502/* --------------------------------------------------------------------- */
503
504static unsigned wait_src_ready(struct es1371_state *s)
505{
506 unsigned int t, r;
507
508 for (t = 0; t < POLL_COUNT; t++) {
509 if (!((r = inl(s->io + ES1371_REG_SRCONV)) & SRC_BUSY))
510 return r;
511 udelay(1);
512 }
513 printk(KERN_DEBUG PFX "sample rate converter timeout r = 0x%08x\n", r);
514 return r;
515}
516
517static unsigned src_read(struct es1371_state *s, unsigned reg)
518{
519 unsigned int temp,i,orig;
520
521 /* wait for ready */
522 temp = wait_src_ready (s);
523
524 /* we can only access the SRC at certain times, make sure
525 we're allowed to before we read */
526
527 orig = temp;
528 /* expose the SRC state bits */
529 outl ( (temp & SRC_CTLMASK) | (reg << SRC_RAMADDR_SHIFT) | 0x10000UL,
530 s->io + ES1371_REG_SRCONV);
531
532 /* now, wait for busy and the correct time to read */
533 temp = wait_src_ready (s);
534
535 if ( (temp & 0x00870000UL ) != ( SRC_OKSTATE << 16 )){
536 /* wait for the right state */
537 for (i=0; i<POLL_COUNT; i++){
538 temp = inl (s->io + ES1371_REG_SRCONV);
539 if ( (temp & 0x00870000UL ) == ( SRC_OKSTATE << 16 ))
540 break;
541 }
542 }
543
544 /* hide the state bits */
545 outl ((orig & SRC_CTLMASK) | (reg << SRC_RAMADDR_SHIFT), s->io + ES1371_REG_SRCONV);
546 return temp;
547
548
549}
550
551static void src_write(struct es1371_state *s, unsigned reg, unsigned data)
552{
553
554 unsigned int r;
555
556 r = wait_src_ready(s) & (SRC_DIS | SRC_DDAC1 | SRC_DDAC2 | SRC_DADC);
557 r |= (reg << SRC_RAMADDR_SHIFT) & SRC_RAMADDR_MASK;
558 r |= (data << SRC_RAMDATA_SHIFT) & SRC_RAMDATA_MASK;
559 outl(r | SRC_WE, s->io + ES1371_REG_SRCONV);
560
561}
562
563/* --------------------------------------------------------------------- */
564
565/* most of the following here is black magic */
566static void set_adc_rate(struct es1371_state *s, unsigned rate)
567{
568 unsigned long flags;
569 unsigned int n, truncm, freq;
570
571 if (rate > 48000)
572 rate = 48000;
573 if (rate < 4000)
574 rate = 4000;
575 n = rate / 3000;
576 if ((1 << n) & ((1 << 15) | (1 << 13) | (1 << 11) | (1 << 9)))
577 n--;
578 truncm = (21 * n - 1) | 1;
579 freq = ((48000UL << 15) / rate) * n;
580 s->adcrate = (48000UL << 15) / (freq / n);
581 spin_lock_irqsave(&s->lock, flags);
582 if (rate >= 24000) {
583 if (truncm > 239)
584 truncm = 239;
585 src_write(s, SRCREG_ADC+SRCREG_TRUNC_N,
586 (((239 - truncm) >> 1) << 9) | (n << 4));
587 } else {
588 if (truncm > 119)
589 truncm = 119;
590 src_write(s, SRCREG_ADC+SRCREG_TRUNC_N,
591 0x8000 | (((119 - truncm) >> 1) << 9) | (n << 4));
592 }
593 src_write(s, SRCREG_ADC+SRCREG_INT_REGS,
594 (src_read(s, SRCREG_ADC+SRCREG_INT_REGS) & 0x00ff) |
595 ((freq >> 5) & 0xfc00));
596 src_write(s, SRCREG_ADC+SRCREG_VFREQ_FRAC, freq & 0x7fff);
597 src_write(s, SRCREG_VOL_ADC, n << 8);
598 src_write(s, SRCREG_VOL_ADC+1, n << 8);
599 spin_unlock_irqrestore(&s->lock, flags);
600}
601
602
603static void set_dac1_rate(struct es1371_state *s, unsigned rate)
604{
605 unsigned long flags;
606 unsigned int freq, r;
607
608 if (rate > 48000)
609 rate = 48000;
610 if (rate < 4000)
611 rate = 4000;
612 freq = ((rate << 15) + 1500) / 3000;
613 s->dac1rate = (freq * 3000 + 16384) >> 15;
614 spin_lock_irqsave(&s->lock, flags);
615 r = (wait_src_ready(s) & (SRC_DIS | SRC_DDAC2 | SRC_DADC)) | SRC_DDAC1;
616 outl(r, s->io + ES1371_REG_SRCONV);
617 src_write(s, SRCREG_DAC1+SRCREG_INT_REGS,
618 (src_read(s, SRCREG_DAC1+SRCREG_INT_REGS) & 0x00ff) |
619 ((freq >> 5) & 0xfc00));
620 src_write(s, SRCREG_DAC1+SRCREG_VFREQ_FRAC, freq & 0x7fff);
621 r = (wait_src_ready(s) & (SRC_DIS | SRC_DDAC2 | SRC_DADC));
622 outl(r, s->io + ES1371_REG_SRCONV);
623 spin_unlock_irqrestore(&s->lock, flags);
624}
625
626static void set_dac2_rate(struct es1371_state *s, unsigned rate)
627{
628 unsigned long flags;
629 unsigned int freq, r;
630
631 if (rate > 48000)
632 rate = 48000;
633 if (rate < 4000)
634 rate = 4000;
635 freq = ((rate << 15) + 1500) / 3000;
636 s->dac2rate = (freq * 3000 + 16384) >> 15;
637 spin_lock_irqsave(&s->lock, flags);
638 r = (wait_src_ready(s) & (SRC_DIS | SRC_DDAC1 | SRC_DADC)) | SRC_DDAC2;
639 outl(r, s->io + ES1371_REG_SRCONV);
640 src_write(s, SRCREG_DAC2+SRCREG_INT_REGS,
641 (src_read(s, SRCREG_DAC2+SRCREG_INT_REGS) & 0x00ff) |
642 ((freq >> 5) & 0xfc00));
643 src_write(s, SRCREG_DAC2+SRCREG_VFREQ_FRAC, freq & 0x7fff);
644 r = (wait_src_ready(s) & (SRC_DIS | SRC_DDAC1 | SRC_DADC));
645 outl(r, s->io + ES1371_REG_SRCONV);
646 spin_unlock_irqrestore(&s->lock, flags);
647}
648
649/* --------------------------------------------------------------------- */
650
651static void __devinit src_init(struct es1371_state *s)
652{
653 unsigned int i;
654
655 /* before we enable or disable the SRC we need
656 to wait for it to become ready */
657 wait_src_ready(s);
658
659 outl(SRC_DIS, s->io + ES1371_REG_SRCONV);
660
661 for (i = 0; i < 0x80; i++)
662 src_write(s, i, 0);
663
664 src_write(s, SRCREG_DAC1+SRCREG_TRUNC_N, 16 << 4);
665 src_write(s, SRCREG_DAC1+SRCREG_INT_REGS, 16 << 10);
666 src_write(s, SRCREG_DAC2+SRCREG_TRUNC_N, 16 << 4);
667 src_write(s, SRCREG_DAC2+SRCREG_INT_REGS, 16 << 10);
668 src_write(s, SRCREG_VOL_ADC, 1 << 12);
669 src_write(s, SRCREG_VOL_ADC+1, 1 << 12);
670 src_write(s, SRCREG_VOL_DAC1, 1 << 12);
671 src_write(s, SRCREG_VOL_DAC1+1, 1 << 12);
672 src_write(s, SRCREG_VOL_DAC2, 1 << 12);
673 src_write(s, SRCREG_VOL_DAC2+1, 1 << 12);
674 set_adc_rate(s, 22050);
675 set_dac1_rate(s, 22050);
676 set_dac2_rate(s, 22050);
677
678 /* WARNING:
679 * enabling the sample rate converter without properly programming
680 * its parameters causes the chip to lock up (the SRC busy bit will
681 * be stuck high, and I've found no way to rectify this other than
682 * power cycle)
683 */
684 wait_src_ready(s);
685 outl(0, s->io+ES1371_REG_SRCONV);
686}
687
688/* --------------------------------------------------------------------- */
689
690static void wrcodec(struct ac97_codec *codec, u8 addr, u16 data)
691{
692 struct es1371_state *s = (struct es1371_state *)codec->private_data;
693 unsigned long flags;
694 unsigned t, x;
695
696 spin_lock_irqsave(&s->lock, flags);
697 for (t = 0; t < POLL_COUNT; t++)
698 if (!(inl(s->io+ES1371_REG_CODEC) & CODEC_WIP))
699 break;
700
701 /* save the current state for later */
702 x = wait_src_ready(s);
703
704 /* enable SRC state data in SRC mux */
705 outl((x & (SRC_DIS | SRC_DDAC1 | SRC_DDAC2 | SRC_DADC)) | 0x00010000,
706 s->io+ES1371_REG_SRCONV);
707
708 /* wait for not busy (state 0) first to avoid
709 transition states */
710 for (t=0; t<POLL_COUNT; t++){
711 if((inl(s->io+ES1371_REG_SRCONV) & 0x00870000) ==0 )
712 break;
713 udelay(1);
714 }
715
716 /* wait for a SAFE time to write addr/data and then do it, dammit */
717 for (t=0; t<POLL_COUNT; t++){
718 if((inl(s->io+ES1371_REG_SRCONV) & 0x00870000) ==0x00010000)
719 break;
720 udelay(1);
721 }
722
723 outl(((addr << CODEC_POADD_SHIFT) & CODEC_POADD_MASK) |
724 ((data << CODEC_PODAT_SHIFT) & CODEC_PODAT_MASK), s->io+ES1371_REG_CODEC);
725
726 /* restore SRC reg */
727 wait_src_ready(s);
728 outl(x, s->io+ES1371_REG_SRCONV);
729 spin_unlock_irqrestore(&s->lock, flags);
730}
731
732static u16 rdcodec(struct ac97_codec *codec, u8 addr)
733{
734 struct es1371_state *s = (struct es1371_state *)codec->private_data;
735 unsigned long flags;
736 unsigned t, x;
737
738 spin_lock_irqsave(&s->lock, flags);
739
740 /* wait for WIP to go away */
741 for (t = 0; t < 0x1000; t++)
742 if (!(inl(s->io+ES1371_REG_CODEC) & CODEC_WIP))
743 break;
744
745 /* save the current state for later */
746 x = (wait_src_ready(s) & (SRC_DIS | SRC_DDAC1 | SRC_DDAC2 | SRC_DADC));
747
748 /* enable SRC state data in SRC mux */
749 outl( x | 0x00010000,
750 s->io+ES1371_REG_SRCONV);
751
752 /* wait for not busy (state 0) first to avoid
753 transition states */
754 for (t=0; t<POLL_COUNT; t++){
755 if((inl(s->io+ES1371_REG_SRCONV) & 0x00870000) ==0 )
756 break;
757 udelay(1);
758 }
759
760 /* wait for a SAFE time to write addr/data and then do it, dammit */
761 for (t=0; t<POLL_COUNT; t++){
762 if((inl(s->io+ES1371_REG_SRCONV) & 0x00870000) ==0x00010000)
763 break;
764 udelay(1);
765 }
766
767 outl(((addr << CODEC_POADD_SHIFT) & CODEC_POADD_MASK) | CODEC_PORD, s->io+ES1371_REG_CODEC);
768 /* restore SRC reg */
769 wait_src_ready(s);
770 outl(x, s->io+ES1371_REG_SRCONV);
771
772 /* wait for WIP again */
773 for (t = 0; t < 0x1000; t++)
774 if (!(inl(s->io+ES1371_REG_CODEC) & CODEC_WIP))
775 break;
776
777 /* now wait for the stinkin' data (RDY) */
778 for (t = 0; t < POLL_COUNT; t++)
779 if ((x = inl(s->io+ES1371_REG_CODEC)) & CODEC_RDY)
780 break;
781
782 spin_unlock_irqrestore(&s->lock, flags);
783 return ((x & CODEC_PIDAT_MASK) >> CODEC_PIDAT_SHIFT);
784}
785
786/* --------------------------------------------------------------------- */
787
788static inline void stop_adc(struct es1371_state *s)
789{
790 unsigned long flags;
791
792 spin_lock_irqsave(&s->lock, flags);
793 s->ctrl &= ~CTRL_ADC_EN;
794 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
795 spin_unlock_irqrestore(&s->lock, flags);
796}
797
798static inline void stop_dac1(struct es1371_state *s)
799{
800 unsigned long flags;
801
802 spin_lock_irqsave(&s->lock, flags);
803 s->ctrl &= ~CTRL_DAC1_EN;
804 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
805 spin_unlock_irqrestore(&s->lock, flags);
806}
807
808static inline void stop_dac2(struct es1371_state *s)
809{
810 unsigned long flags;
811
812 spin_lock_irqsave(&s->lock, flags);
813 s->ctrl &= ~CTRL_DAC2_EN;
814 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
815 spin_unlock_irqrestore(&s->lock, flags);
816}
817
818static void start_dac1(struct es1371_state *s)
819{
820 unsigned long flags;
821 unsigned fragremain, fshift;
822
823 spin_lock_irqsave(&s->lock, flags);
824 if (!(s->ctrl & CTRL_DAC1_EN) && (s->dma_dac1.mapped || s->dma_dac1.count > 0)
825 && s->dma_dac1.ready) {
826 s->ctrl |= CTRL_DAC1_EN;
827 s->sctrl = (s->sctrl & ~(SCTRL_P1LOOPSEL | SCTRL_P1PAUSE | SCTRL_P1SCTRLD)) | SCTRL_P1INTEN;
828 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
829 fragremain = ((- s->dma_dac1.hwptr) & (s->dma_dac1.fragsize-1));
830 fshift = sample_shift[(s->sctrl & SCTRL_P1FMT) >> SCTRL_SH_P1FMT];
831 if (fragremain < 2*fshift)
832 fragremain = s->dma_dac1.fragsize;
833 outl((fragremain >> fshift) - 1, s->io+ES1371_REG_DAC1_SCOUNT);
834 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
835 outl((s->dma_dac1.fragsize >> fshift) - 1, s->io+ES1371_REG_DAC1_SCOUNT);
836 }
837 spin_unlock_irqrestore(&s->lock, flags);
838}
839
840static void start_dac2(struct es1371_state *s)
841{
842 unsigned long flags;
843 unsigned fragremain, fshift;
844
845 spin_lock_irqsave(&s->lock, flags);
846 if (!(s->ctrl & CTRL_DAC2_EN) && (s->dma_dac2.mapped || s->dma_dac2.count > 0)
847 && s->dma_dac2.ready) {
848 s->ctrl |= CTRL_DAC2_EN;
849 s->sctrl = (s->sctrl & ~(SCTRL_P2LOOPSEL | SCTRL_P2PAUSE | SCTRL_P2DACSEN |
850 SCTRL_P2ENDINC | SCTRL_P2STINC)) | SCTRL_P2INTEN |
851 (((s->sctrl & SCTRL_P2FMT) ? 2 : 1) << SCTRL_SH_P2ENDINC) |
852 (0 << SCTRL_SH_P2STINC);
853 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
854 fragremain = ((- s->dma_dac2.hwptr) & (s->dma_dac2.fragsize-1));
855 fshift = sample_shift[(s->sctrl & SCTRL_P2FMT) >> SCTRL_SH_P2FMT];
856 if (fragremain < 2*fshift)
857 fragremain = s->dma_dac2.fragsize;
858 outl((fragremain >> fshift) - 1, s->io+ES1371_REG_DAC2_SCOUNT);
859 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
860 outl((s->dma_dac2.fragsize >> fshift) - 1, s->io+ES1371_REG_DAC2_SCOUNT);
861 }
862 spin_unlock_irqrestore(&s->lock, flags);
863}
864
865static void start_adc(struct es1371_state *s)
866{
867 unsigned long flags;
868 unsigned fragremain, fshift;
869
870 spin_lock_irqsave(&s->lock, flags);
871 if (!(s->ctrl & CTRL_ADC_EN) && (s->dma_adc.mapped || s->dma_adc.count < (signed)(s->dma_adc.dmasize - 2*s->dma_adc.fragsize))
872 && s->dma_adc.ready) {
873 s->ctrl |= CTRL_ADC_EN;
874 s->sctrl = (s->sctrl & ~SCTRL_R1LOOPSEL) | SCTRL_R1INTEN;
875 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
876 fragremain = ((- s->dma_adc.hwptr) & (s->dma_adc.fragsize-1));
877 fshift = sample_shift[(s->sctrl & SCTRL_R1FMT) >> SCTRL_SH_R1FMT];
878 if (fragremain < 2*fshift)
879 fragremain = s->dma_adc.fragsize;
880 outl((fragremain >> fshift) - 1, s->io+ES1371_REG_ADC_SCOUNT);
881 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
882 outl((s->dma_adc.fragsize >> fshift) - 1, s->io+ES1371_REG_ADC_SCOUNT);
883 }
884 spin_unlock_irqrestore(&s->lock, flags);
885}
886
887/* --------------------------------------------------------------------- */
888
889#define DMABUF_DEFAULTORDER (17-PAGE_SHIFT)
890#define DMABUF_MINORDER 1
891
892
893static inline void dealloc_dmabuf(struct es1371_state *s, struct dmabuf *db)
894{
895 struct page *page, *pend;
896
897 if (db->rawbuf) {
898 /* undo marking the pages as reserved */
899 pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
900 for (page = virt_to_page(db->rawbuf); page <= pend; page++)
901 ClearPageReserved(page);
902 pci_free_consistent(s->dev, PAGE_SIZE << db->buforder, db->rawbuf, db->dmaaddr);
903 }
904 db->rawbuf = NULL;
905 db->mapped = db->ready = 0;
906}
907
908static int prog_dmabuf(struct es1371_state *s, struct dmabuf *db, unsigned rate, unsigned fmt, unsigned reg)
909{
910 int order;
911 unsigned bytepersec;
912 unsigned bufs;
913 struct page *page, *pend;
914
915 db->hwptr = db->swptr = db->total_bytes = db->count = db->error = db->endcleared = 0;
916 if (!db->rawbuf) {
917 db->ready = db->mapped = 0;
918 for (order = DMABUF_DEFAULTORDER; order >= DMABUF_MINORDER; order--)
919 if ((db->rawbuf = pci_alloc_consistent(s->dev, PAGE_SIZE << order, &db->dmaaddr)))
920 break;
921 if (!db->rawbuf)
922 return -ENOMEM;
923 db->buforder = order;
924 /* now mark the pages as reserved; otherwise remap_pfn_range doesn't do what we want */
925 pend = virt_to_page(db->rawbuf + (PAGE_SIZE << db->buforder) - 1);
926 for (page = virt_to_page(db->rawbuf); page <= pend; page++)
927 SetPageReserved(page);
928 }
929 fmt &= ES1371_FMT_MASK;
930 bytepersec = rate << sample_shift[fmt];
931 bufs = PAGE_SIZE << db->buforder;
932 if (db->ossfragshift) {
933 if ((1000 << db->ossfragshift) < bytepersec)
934 db->fragshift = ld2(bytepersec/1000);
935 else
936 db->fragshift = db->ossfragshift;
937 } else {
938 db->fragshift = ld2(bytepersec/100/(db->subdivision ? db->subdivision : 1));
939 if (db->fragshift < 3)
940 db->fragshift = 3;
941 }
942 db->numfrag = bufs >> db->fragshift;
943 while (db->numfrag < 4 && db->fragshift > 3) {
944 db->fragshift--;
945 db->numfrag = bufs >> db->fragshift;
946 }
947 db->fragsize = 1 << db->fragshift;
948 if (db->ossmaxfrags >= 4 && db->ossmaxfrags < db->numfrag)
949 db->numfrag = db->ossmaxfrags;
950 db->fragsamples = db->fragsize >> sample_shift[fmt];
951 db->dmasize = db->numfrag << db->fragshift;
952 memset(db->rawbuf, (fmt & ES1371_FMT_S16) ? 0 : 0x80, db->dmasize);
953 outl((reg >> 8) & 15, s->io+ES1371_REG_MEMPAGE);
954 outl(db->dmaaddr, s->io+(reg & 0xff));
955 outl((db->dmasize >> 2)-1, s->io+((reg + 4) & 0xff));
956 db->enabled = 1;
957 db->ready = 1;
958 return 0;
959}
960
961static inline int prog_dmabuf_adc(struct es1371_state *s)
962{
963 stop_adc(s);
964 return prog_dmabuf(s, &s->dma_adc, s->adcrate, (s->sctrl >> SCTRL_SH_R1FMT) & ES1371_FMT_MASK,
965 ES1371_REG_ADC_FRAMEADR);
966}
967
968static inline int prog_dmabuf_dac2(struct es1371_state *s)
969{
970 stop_dac2(s);
971 return prog_dmabuf(s, &s->dma_dac2, s->dac2rate, (s->sctrl >> SCTRL_SH_P2FMT) & ES1371_FMT_MASK,
972 ES1371_REG_DAC2_FRAMEADR);
973}
974
975static inline int prog_dmabuf_dac1(struct es1371_state *s)
976{
977 stop_dac1(s);
978 return prog_dmabuf(s, &s->dma_dac1, s->dac1rate, (s->sctrl >> SCTRL_SH_P1FMT) & ES1371_FMT_MASK,
979 ES1371_REG_DAC1_FRAMEADR);
980}
981
982static inline unsigned get_hwptr(struct es1371_state *s, struct dmabuf *db, unsigned reg)
983{
984 unsigned hwptr, diff;
985
986 outl((reg >> 8) & 15, s->io+ES1371_REG_MEMPAGE);
987 hwptr = (inl(s->io+(reg & 0xff)) >> 14) & 0x3fffc;
988 diff = (db->dmasize + hwptr - db->hwptr) % db->dmasize;
989 db->hwptr = hwptr;
990 return diff;
991}
992
993static inline void clear_advance(void *buf, unsigned bsize, unsigned bptr, unsigned len, unsigned char c)
994{
995 if (bptr + len > bsize) {
996 unsigned x = bsize - bptr;
997 memset(((char *)buf) + bptr, c, x);
998 bptr = 0;
999 len -= x;
1000 }
1001 memset(((char *)buf) + bptr, c, len);
1002}
1003
1004/* call with spinlock held! */
1005static void es1371_update_ptr(struct es1371_state *s)
1006{
1007 int diff;
1008
1009 /* update ADC pointer */
1010 if (s->ctrl & CTRL_ADC_EN) {
1011 diff = get_hwptr(s, &s->dma_adc, ES1371_REG_ADC_FRAMECNT);
1012 s->dma_adc.total_bytes += diff;
1013 s->dma_adc.count += diff;
1014 if (s->dma_adc.count >= (signed)s->dma_adc.fragsize)
1015 wake_up(&s->dma_adc.wait);
1016 if (!s->dma_adc.mapped) {
1017 if (s->dma_adc.count > (signed)(s->dma_adc.dmasize - ((3 * s->dma_adc.fragsize) >> 1))) {
1018 s->ctrl &= ~CTRL_ADC_EN;
1019 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
1020 s->dma_adc.error++;
1021 }
1022 }
1023 }
1024 /* update DAC1 pointer */
1025 if (s->ctrl & CTRL_DAC1_EN) {
1026 diff = get_hwptr(s, &s->dma_dac1, ES1371_REG_DAC1_FRAMECNT);
1027 s->dma_dac1.total_bytes += diff;
1028 if (s->dma_dac1.mapped) {
1029 s->dma_dac1.count += diff;
1030 if (s->dma_dac1.count >= (signed)s->dma_dac1.fragsize)
1031 wake_up(&s->dma_dac1.wait);
1032 } else {
1033 s->dma_dac1.count -= diff;
1034 if (s->dma_dac1.count <= 0) {
1035 s->ctrl &= ~CTRL_DAC1_EN;
1036 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
1037 s->dma_dac1.error++;
1038 } else if (s->dma_dac1.count <= (signed)s->dma_dac1.fragsize && !s->dma_dac1.endcleared) {
1039 clear_advance(s->dma_dac1.rawbuf, s->dma_dac1.dmasize, s->dma_dac1.swptr,
1040 s->dma_dac1.fragsize, (s->sctrl & SCTRL_P1SEB) ? 0 : 0x80);
1041 s->dma_dac1.endcleared = 1;
1042 }
1043 if (s->dma_dac1.count + (signed)s->dma_dac1.fragsize <= (signed)s->dma_dac1.dmasize)
1044 wake_up(&s->dma_dac1.wait);
1045 }
1046 }
1047 /* update DAC2 pointer */
1048 if (s->ctrl & CTRL_DAC2_EN) {
1049 diff = get_hwptr(s, &s->dma_dac2, ES1371_REG_DAC2_FRAMECNT);
1050 s->dma_dac2.total_bytes += diff;
1051 if (s->dma_dac2.mapped) {
1052 s->dma_dac2.count += diff;
1053 if (s->dma_dac2.count >= (signed)s->dma_dac2.fragsize)
1054 wake_up(&s->dma_dac2.wait);
1055 } else {
1056 s->dma_dac2.count -= diff;
1057 if (s->dma_dac2.count <= 0) {
1058 s->ctrl &= ~CTRL_DAC2_EN;
1059 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
1060 s->dma_dac2.error++;
1061 } else if (s->dma_dac2.count <= (signed)s->dma_dac2.fragsize && !s->dma_dac2.endcleared) {
1062 clear_advance(s->dma_dac2.rawbuf, s->dma_dac2.dmasize, s->dma_dac2.swptr,
1063 s->dma_dac2.fragsize, (s->sctrl & SCTRL_P2SEB) ? 0 : 0x80);
1064 s->dma_dac2.endcleared = 1;
1065 }
1066 if (s->dma_dac2.count + (signed)s->dma_dac2.fragsize <= (signed)s->dma_dac2.dmasize)
1067 wake_up(&s->dma_dac2.wait);
1068 }
1069 }
1070}
1071
1072/* hold spinlock for the following! */
1073static void es1371_handle_midi(struct es1371_state *s)
1074{
1075 unsigned char ch;
1076 int wake;
1077
1078 if (!(s->ctrl & CTRL_UART_EN))
1079 return;
1080 wake = 0;
1081 while (inb(s->io+ES1371_REG_UART_STATUS) & USTAT_RXRDY) {
1082 ch = inb(s->io+ES1371_REG_UART_DATA);
1083 if (s->midi.icnt < MIDIINBUF) {
1084 s->midi.ibuf[s->midi.iwr] = ch;
1085 s->midi.iwr = (s->midi.iwr + 1) % MIDIINBUF;
1086 s->midi.icnt++;
1087 }
1088 wake = 1;
1089 }
1090 if (wake)
1091 wake_up(&s->midi.iwait);
1092 wake = 0;
1093 while ((inb(s->io+ES1371_REG_UART_STATUS) & USTAT_TXRDY) && s->midi.ocnt > 0) {
1094 outb(s->midi.obuf[s->midi.ord], s->io+ES1371_REG_UART_DATA);
1095 s->midi.ord = (s->midi.ord + 1) % MIDIOUTBUF;
1096 s->midi.ocnt--;
1097 if (s->midi.ocnt < MIDIOUTBUF-16)
1098 wake = 1;
1099 }
1100 if (wake)
1101 wake_up(&s->midi.owait);
1102 outb((s->midi.ocnt > 0) ? UCTRL_RXINTEN | UCTRL_ENA_TXINT : UCTRL_RXINTEN, s->io+ES1371_REG_UART_CONTROL);
1103}
1104
1105static irqreturn_t es1371_interrupt(int irq, void *dev_id)
1106{
1107 struct es1371_state *s = dev_id;
1108 unsigned int intsrc, sctl;
1109
1110 /* fastpath out, to ease interrupt sharing */
1111 intsrc = inl(s->io+ES1371_REG_STATUS);
1112 if (!(intsrc & 0x80000000))
1113 return IRQ_NONE;
1114 spin_lock(&s->lock);
1115 /* clear audio interrupts first */
1116 sctl = s->sctrl;
1117 if (intsrc & STAT_ADC)
1118 sctl &= ~SCTRL_R1INTEN;
1119 if (intsrc & STAT_DAC1)
1120 sctl &= ~SCTRL_P1INTEN;
1121 if (intsrc & STAT_DAC2)
1122 sctl &= ~SCTRL_P2INTEN;
1123 outl(sctl, s->io+ES1371_REG_SERIAL_CONTROL);
1124 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1125 es1371_update_ptr(s);
1126 es1371_handle_midi(s);
1127 spin_unlock(&s->lock);
1128 return IRQ_HANDLED;
1129}
1130
1131/* --------------------------------------------------------------------- */
1132
1133static const char invalid_magic[] = KERN_CRIT PFX "invalid magic value\n";
1134
1135#define VALIDATE_STATE(s) \
1136({ \
1137 if (!(s) || (s)->magic != ES1371_MAGIC) { \
1138 printk(invalid_magic); \
1139 return -ENXIO; \
1140 } \
1141})
1142
1143/* --------------------------------------------------------------------- */
1144
1145/* Conversion table for S/PDIF PCM volume emulation through the SRC */
1146/* dB-linear table of DAC vol values; -0dB to -46.5dB with mute */
1147static const unsigned short DACVolTable[101] =
1148{
1149 0x1000, 0x0f2a, 0x0e60, 0x0da0, 0x0cea, 0x0c3e, 0x0b9a, 0x0aff,
1150 0x0a6d, 0x09e1, 0x095e, 0x08e1, 0x086a, 0x07fa, 0x078f, 0x072a,
1151 0x06cb, 0x0670, 0x061a, 0x05c9, 0x057b, 0x0532, 0x04ed, 0x04ab,
1152 0x046d, 0x0432, 0x03fa, 0x03c5, 0x0392, 0x0363, 0x0335, 0x030b,
1153 0x02e2, 0x02bc, 0x0297, 0x0275, 0x0254, 0x0235, 0x0217, 0x01fb,
1154 0x01e1, 0x01c8, 0x01b0, 0x0199, 0x0184, 0x0170, 0x015d, 0x014b,
1155 0x0139, 0x0129, 0x0119, 0x010b, 0x00fd, 0x00f0, 0x00e3, 0x00d7,
1156 0x00cc, 0x00c1, 0x00b7, 0x00ae, 0x00a5, 0x009c, 0x0094, 0x008c,
1157 0x0085, 0x007e, 0x0077, 0x0071, 0x006b, 0x0066, 0x0060, 0x005b,
1158 0x0057, 0x0052, 0x004e, 0x004a, 0x0046, 0x0042, 0x003f, 0x003c,
1159 0x0038, 0x0036, 0x0033, 0x0030, 0x002e, 0x002b, 0x0029, 0x0027,
1160 0x0025, 0x0023, 0x0021, 0x001f, 0x001e, 0x001c, 0x001b, 0x0019,
1161 0x0018, 0x0017, 0x0016, 0x0014, 0x0000
1162};
1163
1164/*
1165 * when we are in S/PDIF mode, we want to disable any analog output so
1166 * we filter the mixer ioctls
1167 */
1168static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd, unsigned long arg)
1169{
1170 struct es1371_state *s = (struct es1371_state *)codec->private_data;
1171 int val;
1172 unsigned long flags;
1173 unsigned int left, right;
1174
1175 VALIDATE_STATE(s);
1176 /* filter mixer ioctls to catch PCM and MASTER volume when in S/PDIF mode */
1177 if (s->spdif_volume == -1)
1178 return codec->mixer_ioctl(codec, cmd, arg);
1179 switch (cmd) {
1180 case SOUND_MIXER_WRITE_VOLUME:
1181 return 0;
1182
1183 case SOUND_MIXER_WRITE_PCM: /* use SRC for PCM volume */
1184 if (get_user(val, (int __user *)arg))
1185 return -EFAULT;
1186 right = ((val >> 8) & 0xff);
1187 left = (val & 0xff);
1188 if (right > 100)
1189 right = 100;
1190 if (left > 100)
1191 left = 100;
1192 s->spdif_volume = (right << 8) | left;
1193 spin_lock_irqsave(&s->lock, flags);
1194 src_write(s, SRCREG_VOL_DAC2, DACVolTable[100 - left]);
1195 src_write(s, SRCREG_VOL_DAC2+1, DACVolTable[100 - right]);
1196 spin_unlock_irqrestore(&s->lock, flags);
1197 return 0;
1198
1199 case SOUND_MIXER_READ_PCM:
1200 return put_user(s->spdif_volume, (int __user *)arg);
1201 }
1202 return codec->mixer_ioctl(codec, cmd, arg);
1203}
1204
1205/* --------------------------------------------------------------------- */
1206
1207/*
1208 * AC97 Mixer Register to Connections mapping of the Concert 97 board
1209 *
1210 * AC97_MASTER_VOL_STEREO Line Out
1211 * AC97_MASTER_VOL_MONO TAD Output
1212 * AC97_PCBEEP_VOL none
1213 * AC97_PHONE_VOL TAD Input (mono)
1214 * AC97_MIC_VOL MIC Input (mono)
1215 * AC97_LINEIN_VOL Line Input (stereo)
1216 * AC97_CD_VOL CD Input (stereo)
1217 * AC97_VIDEO_VOL none
1218 * AC97_AUX_VOL Aux Input (stereo)
1219 * AC97_PCMOUT_VOL Wave Output (stereo)
1220 */
1221
1222static int es1371_open_mixdev(struct inode *inode, struct file *file)
1223{
1224 int minor = iminor(inode);
1225 struct list_head *list;
1226 struct es1371_state *s;
1227
1228 for (list = devs.next; ; list = list->next) {
1229 if (list == &devs)
1230 return -ENODEV;
1231 s = list_entry(list, struct es1371_state, devs);
1232 if (s->codec->dev_mixer == minor)
1233 break;
1234 }
1235 VALIDATE_STATE(s);
1236 file->private_data = s;
1237 return nonseekable_open(inode, file);
1238}
1239
1240static int es1371_release_mixdev(struct inode *inode, struct file *file)
1241{
1242 struct es1371_state *s = (struct es1371_state *)file->private_data;
1243
1244 VALIDATE_STATE(s);
1245 return 0;
1246}
1247
1248static int es1371_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
1249{
1250 struct es1371_state *s = (struct es1371_state *)file->private_data;
1251 struct ac97_codec *codec = s->codec;
1252
1253 return mixdev_ioctl(codec, cmd, arg);
1254}
1255
1256static /*const*/ struct file_operations es1371_mixer_fops = {
1257 .owner = THIS_MODULE,
1258 .llseek = no_llseek,
1259 .ioctl = es1371_ioctl_mixdev,
1260 .open = es1371_open_mixdev,
1261 .release = es1371_release_mixdev,
1262};
1263
1264/* --------------------------------------------------------------------- */
1265
1266static int drain_dac1(struct es1371_state *s, int nonblock)
1267{
1268 DECLARE_WAITQUEUE(wait, current);
1269 unsigned long flags;
1270 int count, tmo;
1271
1272 if (s->dma_dac1.mapped || !s->dma_dac1.ready)
1273 return 0;
1274 add_wait_queue(&s->dma_dac1.wait, &wait);
1275 for (;;) {
1276 __set_current_state(TASK_INTERRUPTIBLE);
1277 spin_lock_irqsave(&s->lock, flags);
1278 count = s->dma_dac1.count;
1279 spin_unlock_irqrestore(&s->lock, flags);
1280 if (count <= 0)
1281 break;
1282 if (signal_pending(current))
1283 break;
1284 if (nonblock) {
1285 remove_wait_queue(&s->dma_dac1.wait, &wait);
1286 set_current_state(TASK_RUNNING);
1287 return -EBUSY;
1288 }
1289 tmo = 3 * HZ * (count + s->dma_dac1.fragsize) / 2 / s->dac1rate;
1290 tmo >>= sample_shift[(s->sctrl & SCTRL_P1FMT) >> SCTRL_SH_P1FMT];
1291 if (!schedule_timeout(tmo + 1))
1292 DBG(printk(KERN_DEBUG PFX "dac1 dma timed out??\n");)
1293 }
1294 remove_wait_queue(&s->dma_dac1.wait, &wait);
1295 set_current_state(TASK_RUNNING);
1296 if (signal_pending(current))
1297 return -ERESTARTSYS;
1298 return 0;
1299}
1300
1301static int drain_dac2(struct es1371_state *s, int nonblock)
1302{
1303 DECLARE_WAITQUEUE(wait, current);
1304 unsigned long flags;
1305 int count, tmo;
1306
1307 if (s->dma_dac2.mapped || !s->dma_dac2.ready)
1308 return 0;
1309 add_wait_queue(&s->dma_dac2.wait, &wait);
1310 for (;;) {
1311 __set_current_state(TASK_UNINTERRUPTIBLE);
1312 spin_lock_irqsave(&s->lock, flags);
1313 count = s->dma_dac2.count;
1314 spin_unlock_irqrestore(&s->lock, flags);
1315 if (count <= 0)
1316 break;
1317 if (signal_pending(current))
1318 break;
1319 if (nonblock) {
1320 remove_wait_queue(&s->dma_dac2.wait, &wait);
1321 set_current_state(TASK_RUNNING);
1322 return -EBUSY;
1323 }
1324 tmo = 3 * HZ * (count + s->dma_dac2.fragsize) / 2 / s->dac2rate;
1325 tmo >>= sample_shift[(s->sctrl & SCTRL_P2FMT) >> SCTRL_SH_P2FMT];
1326 if (!schedule_timeout(tmo + 1))
1327 DBG(printk(KERN_DEBUG PFX "dac2 dma timed out??\n");)
1328 }
1329 remove_wait_queue(&s->dma_dac2.wait, &wait);
1330 set_current_state(TASK_RUNNING);
1331 if (signal_pending(current))
1332 return -ERESTARTSYS;
1333 return 0;
1334}
1335
1336/* --------------------------------------------------------------------- */
1337
1338static ssize_t es1371_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
1339{
1340 struct es1371_state *s = (struct es1371_state *)file->private_data;
1341 DECLARE_WAITQUEUE(wait, current);
1342 ssize_t ret = 0;
1343 unsigned long flags;
1344 unsigned swptr;
1345 int cnt;
1346
1347 VALIDATE_STATE(s);
1348 if (s->dma_adc.mapped)
1349 return -ENXIO;
1350 if (!access_ok(VERIFY_WRITE, buffer, count))
1351 return -EFAULT;
1352 mutex_lock(&s->sem);
1353 if (!s->dma_adc.ready && (ret = prog_dmabuf_adc(s)))
1354 goto out2;
1355
1356 add_wait_queue(&s->dma_adc.wait, &wait);
1357 while (count > 0) {
1358 spin_lock_irqsave(&s->lock, flags);
1359 swptr = s->dma_adc.swptr;
1360 cnt = s->dma_adc.dmasize-swptr;
1361 if (s->dma_adc.count < cnt)
1362 cnt = s->dma_adc.count;
1363 if (cnt <= 0)
1364 __set_current_state(TASK_INTERRUPTIBLE);
1365 spin_unlock_irqrestore(&s->lock, flags);
1366 if (cnt > count)
1367 cnt = count;
1368 if (cnt <= 0) {
1369 if (s->dma_adc.enabled)
1370 start_adc(s);
1371 if (file->f_flags & O_NONBLOCK) {
1372 if (!ret)
1373 ret = -EAGAIN;
1374 goto out;
1375 }
1376 mutex_unlock(&s->sem);
1377 schedule();
1378 if (signal_pending(current)) {
1379 if (!ret)
1380 ret = -ERESTARTSYS;
1381 goto out2;
1382 }
1383 mutex_lock(&s->sem);
1384 if (s->dma_adc.mapped)
1385 {
1386 ret = -ENXIO;
1387 goto out;
1388 }
1389 continue;
1390 }
1391 if (copy_to_user(buffer, s->dma_adc.rawbuf + swptr, cnt)) {
1392 if (!ret)
1393 ret = -EFAULT;
1394 goto out;
1395 }
1396 swptr = (swptr + cnt) % s->dma_adc.dmasize;
1397 spin_lock_irqsave(&s->lock, flags);
1398 s->dma_adc.swptr = swptr;
1399 s->dma_adc.count -= cnt;
1400 spin_unlock_irqrestore(&s->lock, flags);
1401 count -= cnt;
1402 buffer += cnt;
1403 ret += cnt;
1404 if (s->dma_adc.enabled)
1405 start_adc(s);
1406 }
1407out:
1408 mutex_unlock(&s->sem);
1409out2:
1410 remove_wait_queue(&s->dma_adc.wait, &wait);
1411 set_current_state(TASK_RUNNING);
1412 return ret;
1413}
1414
1415static ssize_t es1371_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
1416{
1417 struct es1371_state *s = (struct es1371_state *)file->private_data;
1418 DECLARE_WAITQUEUE(wait, current);
1419 ssize_t ret;
1420 unsigned long flags;
1421 unsigned swptr;
1422 int cnt;
1423
1424 VALIDATE_STATE(s);
1425 if (s->dma_dac2.mapped)
1426 return -ENXIO;
1427 if (!access_ok(VERIFY_READ, buffer, count))
1428 return -EFAULT;
1429 mutex_lock(&s->sem);
1430 if (!s->dma_dac2.ready && (ret = prog_dmabuf_dac2(s)))
1431 goto out3;
1432 ret = 0;
1433 add_wait_queue(&s->dma_dac2.wait, &wait);
1434 while (count > 0) {
1435 spin_lock_irqsave(&s->lock, flags);
1436 if (s->dma_dac2.count < 0) {
1437 s->dma_dac2.count = 0;
1438 s->dma_dac2.swptr = s->dma_dac2.hwptr;
1439 }
1440 swptr = s->dma_dac2.swptr;
1441 cnt = s->dma_dac2.dmasize-swptr;
1442 if (s->dma_dac2.count + cnt > s->dma_dac2.dmasize)
1443 cnt = s->dma_dac2.dmasize - s->dma_dac2.count;
1444 if (cnt <= 0)
1445 __set_current_state(TASK_INTERRUPTIBLE);
1446 spin_unlock_irqrestore(&s->lock, flags);
1447 if (cnt > count)
1448 cnt = count;
1449 if (cnt <= 0) {
1450 if (s->dma_dac2.enabled)
1451 start_dac2(s);
1452 if (file->f_flags & O_NONBLOCK) {
1453 if (!ret)
1454 ret = -EAGAIN;
1455 goto out;
1456 }
1457 mutex_unlock(&s->sem);
1458 schedule();
1459 if (signal_pending(current)) {
1460 if (!ret)
1461 ret = -ERESTARTSYS;
1462 goto out2;
1463 }
1464 mutex_lock(&s->sem);
1465 if (s->dma_dac2.mapped)
1466 {
1467 ret = -ENXIO;
1468 goto out;
1469 }
1470 continue;
1471 }
1472 if (copy_from_user(s->dma_dac2.rawbuf + swptr, buffer, cnt)) {
1473 if (!ret)
1474 ret = -EFAULT;
1475 goto out;
1476 }
1477 swptr = (swptr + cnt) % s->dma_dac2.dmasize;
1478 spin_lock_irqsave(&s->lock, flags);
1479 s->dma_dac2.swptr = swptr;
1480 s->dma_dac2.count += cnt;
1481 s->dma_dac2.endcleared = 0;
1482 spin_unlock_irqrestore(&s->lock, flags);
1483 count -= cnt;
1484 buffer += cnt;
1485 ret += cnt;
1486 if (s->dma_dac2.enabled)
1487 start_dac2(s);
1488 }
1489out:
1490 mutex_unlock(&s->sem);
1491out2:
1492 remove_wait_queue(&s->dma_dac2.wait, &wait);
1493out3:
1494 set_current_state(TASK_RUNNING);
1495 return ret;
1496}
1497
1498/* No kernel lock - we have our own spinlock */
1499static unsigned int es1371_poll(struct file *file, struct poll_table_struct *wait)
1500{
1501 struct es1371_state *s = (struct es1371_state *)file->private_data;
1502 unsigned long flags;
1503 unsigned int mask = 0;
1504
1505 VALIDATE_STATE(s);
1506 if (file->f_mode & FMODE_WRITE) {
1507 if (!s->dma_dac2.ready && prog_dmabuf_dac2(s))
1508 return 0;
1509 poll_wait(file, &s->dma_dac2.wait, wait);
1510 }
1511 if (file->f_mode & FMODE_READ) {
1512 if (!s->dma_adc.ready && prog_dmabuf_adc(s))
1513 return 0;
1514 poll_wait(file, &s->dma_adc.wait, wait);
1515 }
1516 spin_lock_irqsave(&s->lock, flags);
1517 es1371_update_ptr(s);
1518 if (file->f_mode & FMODE_READ) {
1519 if (s->dma_adc.count >= (signed)s->dma_adc.fragsize)
1520 mask |= POLLIN | POLLRDNORM;
1521 }
1522 if (file->f_mode & FMODE_WRITE) {
1523 if (s->dma_dac2.mapped) {
1524 if (s->dma_dac2.count >= (signed)s->dma_dac2.fragsize)
1525 mask |= POLLOUT | POLLWRNORM;
1526 } else {
1527 if ((signed)s->dma_dac2.dmasize >= s->dma_dac2.count + (signed)s->dma_dac2.fragsize)
1528 mask |= POLLOUT | POLLWRNORM;
1529 }
1530 }
1531 spin_unlock_irqrestore(&s->lock, flags);
1532 return mask;
1533}
1534
1535static int es1371_mmap(struct file *file, struct vm_area_struct *vma)
1536{
1537 struct es1371_state *s = (struct es1371_state *)file->private_data;
1538 struct dmabuf *db;
1539 int ret = 0;
1540 unsigned long size;
1541
1542 VALIDATE_STATE(s);
1543 lock_kernel();
1544 mutex_lock(&s->sem);
1545
1546 if (vma->vm_flags & VM_WRITE) {
1547 if ((ret = prog_dmabuf_dac2(s)) != 0) {
1548 goto out;
1549 }
1550 db = &s->dma_dac2;
1551 } else if (vma->vm_flags & VM_READ) {
1552 if ((ret = prog_dmabuf_adc(s)) != 0) {
1553 goto out;
1554 }
1555 db = &s->dma_adc;
1556 } else {
1557 ret = -EINVAL;
1558 goto out;
1559 }
1560 if (vma->vm_pgoff != 0) {
1561 ret = -EINVAL;
1562 goto out;
1563 }
1564 size = vma->vm_end - vma->vm_start;
1565 if (size > (PAGE_SIZE << db->buforder)) {
1566 ret = -EINVAL;
1567 goto out;
1568 }
1569 if (remap_pfn_range(vma, vma->vm_start,
1570 virt_to_phys(db->rawbuf) >> PAGE_SHIFT,
1571 size, vma->vm_page_prot)) {
1572 ret = -EAGAIN;
1573 goto out;
1574 }
1575 db->mapped = 1;
1576out:
1577 mutex_unlock(&s->sem);
1578 unlock_kernel();
1579 return ret;
1580}
1581
1582static int es1371_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
1583{
1584 struct es1371_state *s = (struct es1371_state *)file->private_data;
1585 unsigned long flags;
1586 audio_buf_info abinfo;
1587 count_info cinfo;
1588 int count;
1589 int val, mapped, ret;
1590 void __user *argp = (void __user *)arg;
1591 int __user *p = argp;
1592
1593 VALIDATE_STATE(s);
1594 mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac2.mapped) ||
1595 ((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
1596 switch (cmd) {
1597 case OSS_GETVERSION:
1598 return put_user(SOUND_VERSION, p);
1599
1600 case SNDCTL_DSP_SYNC:
1601 if (file->f_mode & FMODE_WRITE)
1602 return drain_dac2(s, 0/*file->f_flags & O_NONBLOCK*/);
1603 return 0;
1604
1605 case SNDCTL_DSP_SETDUPLEX:
1606 return 0;
1607
1608 case SNDCTL_DSP_GETCAPS:
1609 return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
1610
1611 case SNDCTL_DSP_RESET:
1612 if (file->f_mode & FMODE_WRITE) {
1613 stop_dac2(s);
1614 synchronize_irq(s->irq);
1615 s->dma_dac2.swptr = s->dma_dac2.hwptr = s->dma_dac2.count = s->dma_dac2.total_bytes = 0;
1616 }
1617 if (file->f_mode & FMODE_READ) {
1618 stop_adc(s);
1619 synchronize_irq(s->irq);
1620 s->dma_adc.swptr = s->dma_adc.hwptr = s->dma_adc.count = s->dma_adc.total_bytes = 0;
1621 }
1622 return 0;
1623
1624 case SNDCTL_DSP_SPEED:
1625 if (get_user(val, p))
1626 return -EFAULT;
1627 if (val >= 0) {
1628 if (file->f_mode & FMODE_READ) {
1629 stop_adc(s);
1630 s->dma_adc.ready = 0;
1631 set_adc_rate(s, val);
1632 }
1633 if (file->f_mode & FMODE_WRITE) {
1634 stop_dac2(s);
1635 s->dma_dac2.ready = 0;
1636 set_dac2_rate(s, val);
1637 }
1638 }
1639 return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p);
1640
1641 case SNDCTL_DSP_STEREO:
1642 if (get_user(val, p))
1643 return -EFAULT;
1644 if (file->f_mode & FMODE_READ) {
1645 stop_adc(s);
1646 s->dma_adc.ready = 0;
1647 spin_lock_irqsave(&s->lock, flags);
1648 if (val)
1649 s->sctrl |= SCTRL_R1SMB;
1650 else
1651 s->sctrl &= ~SCTRL_R1SMB;
1652 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1653 spin_unlock_irqrestore(&s->lock, flags);
1654 }
1655 if (file->f_mode & FMODE_WRITE) {
1656 stop_dac2(s);
1657 s->dma_dac2.ready = 0;
1658 spin_lock_irqsave(&s->lock, flags);
1659 if (val)
1660 s->sctrl |= SCTRL_P2SMB;
1661 else
1662 s->sctrl &= ~SCTRL_P2SMB;
1663 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1664 spin_unlock_irqrestore(&s->lock, flags);
1665 }
1666 return 0;
1667
1668 case SNDCTL_DSP_CHANNELS:
1669 if (get_user(val, p))
1670 return -EFAULT;
1671 if (val != 0) {
1672 if (file->f_mode & FMODE_READ) {
1673 stop_adc(s);
1674 s->dma_adc.ready = 0;
1675 spin_lock_irqsave(&s->lock, flags);
1676 if (val >= 2)
1677 s->sctrl |= SCTRL_R1SMB;
1678 else
1679 s->sctrl &= ~SCTRL_R1SMB;
1680 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1681 spin_unlock_irqrestore(&s->lock, flags);
1682 }
1683 if (file->f_mode & FMODE_WRITE) {
1684 stop_dac2(s);
1685 s->dma_dac2.ready = 0;
1686 spin_lock_irqsave(&s->lock, flags);
1687 if (val >= 2)
1688 s->sctrl |= SCTRL_P2SMB;
1689 else
1690 s->sctrl &= ~SCTRL_P2SMB;
1691 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1692 spin_unlock_irqrestore(&s->lock, flags);
1693 }
1694 }
1695 return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p);
1696
1697 case SNDCTL_DSP_GETFMTS: /* Returns a mask */
1698 return put_user(AFMT_S16_LE|AFMT_U8, p);
1699
1700 case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
1701 if (get_user(val, p))
1702 return -EFAULT;
1703 if (val != AFMT_QUERY) {
1704 if (file->f_mode & FMODE_READ) {
1705 stop_adc(s);
1706 s->dma_adc.ready = 0;
1707 spin_lock_irqsave(&s->lock, flags);
1708 if (val == AFMT_S16_LE)
1709 s->sctrl |= SCTRL_R1SEB;
1710 else
1711 s->sctrl &= ~SCTRL_R1SEB;
1712 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1713 spin_unlock_irqrestore(&s->lock, flags);
1714 }
1715 if (file->f_mode & FMODE_WRITE) {
1716 stop_dac2(s);
1717 s->dma_dac2.ready = 0;
1718 spin_lock_irqsave(&s->lock, flags);
1719 if (val == AFMT_S16_LE)
1720 s->sctrl |= SCTRL_P2SEB;
1721 else
1722 s->sctrl &= ~SCTRL_P2SEB;
1723 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1724 spin_unlock_irqrestore(&s->lock, flags);
1725 }
1726 }
1727 return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ?
1728 AFMT_S16_LE : AFMT_U8, p);
1729
1730 case SNDCTL_DSP_POST:
1731 return 0;
1732
1733 case SNDCTL_DSP_GETTRIGGER:
1734 val = 0;
1735 if (file->f_mode & FMODE_READ && s->ctrl & CTRL_ADC_EN)
1736 val |= PCM_ENABLE_INPUT;
1737 if (file->f_mode & FMODE_WRITE && s->ctrl & CTRL_DAC2_EN)
1738 val |= PCM_ENABLE_OUTPUT;
1739 return put_user(val, p);
1740
1741 case SNDCTL_DSP_SETTRIGGER:
1742 if (get_user(val, p))
1743 return -EFAULT;
1744 if (file->f_mode & FMODE_READ) {
1745 if (val & PCM_ENABLE_INPUT) {
1746 if (!s->dma_adc.ready && (ret = prog_dmabuf_adc(s)))
1747 return ret;
1748 s->dma_adc.enabled = 1;
1749 start_adc(s);
1750 } else {
1751 s->dma_adc.enabled = 0;
1752 stop_adc(s);
1753 }
1754 }
1755 if (file->f_mode & FMODE_WRITE) {
1756 if (val & PCM_ENABLE_OUTPUT) {
1757 if (!s->dma_dac2.ready && (ret = prog_dmabuf_dac2(s)))
1758 return ret;
1759 s->dma_dac2.enabled = 1;
1760 start_dac2(s);
1761 } else {
1762 s->dma_dac2.enabled = 0;
1763 stop_dac2(s);
1764 }
1765 }
1766 return 0;
1767
1768 case SNDCTL_DSP_GETOSPACE:
1769 if (!(file->f_mode & FMODE_WRITE))
1770 return -EINVAL;
1771 if (!s->dma_dac2.ready && (val = prog_dmabuf_dac2(s)) != 0)
1772 return val;
1773 spin_lock_irqsave(&s->lock, flags);
1774 es1371_update_ptr(s);
1775 abinfo.fragsize = s->dma_dac2.fragsize;
1776 count = s->dma_dac2.count;
1777 if (count < 0)
1778 count = 0;
1779 abinfo.bytes = s->dma_dac2.dmasize - count;
1780 abinfo.fragstotal = s->dma_dac2.numfrag;
1781 abinfo.fragments = abinfo.bytes >> s->dma_dac2.fragshift;
1782 spin_unlock_irqrestore(&s->lock, flags);
1783 return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
1784
1785 case SNDCTL_DSP_GETISPACE:
1786 if (!(file->f_mode & FMODE_READ))
1787 return -EINVAL;
1788 if (!s->dma_adc.ready && (val = prog_dmabuf_adc(s)) != 0)
1789 return val;
1790 spin_lock_irqsave(&s->lock, flags);
1791 es1371_update_ptr(s);
1792 abinfo.fragsize = s->dma_adc.fragsize;
1793 count = s->dma_adc.count;
1794 if (count < 0)
1795 count = 0;
1796 abinfo.bytes = count;
1797 abinfo.fragstotal = s->dma_adc.numfrag;
1798 abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;
1799 spin_unlock_irqrestore(&s->lock, flags);
1800 return copy_to_user(argp, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
1801
1802 case SNDCTL_DSP_NONBLOCK:
1803 file->f_flags |= O_NONBLOCK;
1804 return 0;
1805
1806 case SNDCTL_DSP_GETODELAY:
1807 if (!(file->f_mode & FMODE_WRITE))
1808 return -EINVAL;
1809 if (!s->dma_dac2.ready && (val = prog_dmabuf_dac2(s)) != 0)
1810 return val;
1811 spin_lock_irqsave(&s->lock, flags);
1812 es1371_update_ptr(s);
1813 count = s->dma_dac2.count;
1814 spin_unlock_irqrestore(&s->lock, flags);
1815 if (count < 0)
1816 count = 0;
1817 return put_user(count, p);
1818
1819 case SNDCTL_DSP_GETIPTR:
1820 if (!(file->f_mode & FMODE_READ))
1821 return -EINVAL;
1822 if (!s->dma_adc.ready && (val = prog_dmabuf_adc(s)) != 0)
1823 return val;
1824 spin_lock_irqsave(&s->lock, flags);
1825 es1371_update_ptr(s);
1826 cinfo.bytes = s->dma_adc.total_bytes;
1827 count = s->dma_adc.count;
1828 if (count < 0)
1829 count = 0;
1830 cinfo.blocks = count >> s->dma_adc.fragshift;
1831 cinfo.ptr = s->dma_adc.hwptr;
1832 if (s->dma_adc.mapped)
1833 s->dma_adc.count &= s->dma_adc.fragsize-1;
1834 spin_unlock_irqrestore(&s->lock, flags);
1835 if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
1836 return -EFAULT;
1837 return 0;
1838
1839 case SNDCTL_DSP_GETOPTR:
1840 if (!(file->f_mode & FMODE_WRITE))
1841 return -EINVAL;
1842 if (!s->dma_dac2.ready && (val = prog_dmabuf_dac2(s)) != 0)
1843 return val;
1844 spin_lock_irqsave(&s->lock, flags);
1845 es1371_update_ptr(s);
1846 cinfo.bytes = s->dma_dac2.total_bytes;
1847 count = s->dma_dac2.count;
1848 if (count < 0)
1849 count = 0;
1850 cinfo.blocks = count >> s->dma_dac2.fragshift;
1851 cinfo.ptr = s->dma_dac2.hwptr;
1852 if (s->dma_dac2.mapped)
1853 s->dma_dac2.count &= s->dma_dac2.fragsize-1;
1854 spin_unlock_irqrestore(&s->lock, flags);
1855 if (copy_to_user(argp, &cinfo, sizeof(cinfo)))
1856 return -EFAULT;
1857 return 0;
1858
1859 case SNDCTL_DSP_GETBLKSIZE:
1860 if (file->f_mode & FMODE_WRITE) {
1861 if ((val = prog_dmabuf_dac2(s)))
1862 return val;
1863 return put_user(s->dma_dac2.fragsize, p);
1864 }
1865 if ((val = prog_dmabuf_adc(s)))
1866 return val;
1867 return put_user(s->dma_adc.fragsize, p);
1868
1869 case SNDCTL_DSP_SETFRAGMENT:
1870 if (get_user(val, p))
1871 return -EFAULT;
1872 if (file->f_mode & FMODE_READ) {
1873 s->dma_adc.ossfragshift = val & 0xffff;
1874 s->dma_adc.ossmaxfrags = (val >> 16) & 0xffff;
1875 if (s->dma_adc.ossfragshift < 4)
1876 s->dma_adc.ossfragshift = 4;
1877 if (s->dma_adc.ossfragshift > 15)
1878 s->dma_adc.ossfragshift = 15;
1879 if (s->dma_adc.ossmaxfrags < 4)
1880 s->dma_adc.ossmaxfrags = 4;
1881 }
1882 if (file->f_mode & FMODE_WRITE) {
1883 s->dma_dac2.ossfragshift = val & 0xffff;
1884 s->dma_dac2.ossmaxfrags = (val >> 16) & 0xffff;
1885 if (s->dma_dac2.ossfragshift < 4)
1886 s->dma_dac2.ossfragshift = 4;
1887 if (s->dma_dac2.ossfragshift > 15)
1888 s->dma_dac2.ossfragshift = 15;
1889 if (s->dma_dac2.ossmaxfrags < 4)
1890 s->dma_dac2.ossmaxfrags = 4;
1891 }
1892 return 0;
1893
1894 case SNDCTL_DSP_SUBDIVIDE:
1895 if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
1896 (file->f_mode & FMODE_WRITE && s->dma_dac2.subdivision))
1897 return -EINVAL;
1898 if (get_user(val, p))
1899 return -EFAULT;
1900 if (val != 1 && val != 2 && val != 4)
1901 return -EINVAL;
1902 if (file->f_mode & FMODE_READ)
1903 s->dma_adc.subdivision = val;
1904 if (file->f_mode & FMODE_WRITE)
1905 s->dma_dac2.subdivision = val;
1906 return 0;
1907
1908 case SOUND_PCM_READ_RATE:
1909 return put_user((file->f_mode & FMODE_READ) ? s->adcrate : s->dac2rate, p);
1910
1911 case SOUND_PCM_READ_CHANNELS:
1912 return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SMB : SCTRL_P2SMB)) ? 2 : 1, p);
1913
1914 case SOUND_PCM_READ_BITS:
1915 return put_user((s->sctrl & ((file->f_mode & FMODE_READ) ? SCTRL_R1SEB : SCTRL_P2SEB)) ? 16 : 8, p);
1916
1917 case SOUND_PCM_WRITE_FILTER:
1918 case SNDCTL_DSP_SETSYNCRO:
1919 case SOUND_PCM_READ_FILTER:
1920 return -EINVAL;
1921
1922 }
1923 return mixdev_ioctl(s->codec, cmd, arg);
1924}
1925
1926static int es1371_open(struct inode *inode, struct file *file)
1927{
1928 int minor = iminor(inode);
1929 DECLARE_WAITQUEUE(wait, current);
1930 unsigned long flags;
1931 struct list_head *list;
1932 struct es1371_state *s;
1933
1934 for (list = devs.next; ; list = list->next) {
1935 if (list == &devs)
1936 return -ENODEV;
1937 s = list_entry(list, struct es1371_state, devs);
1938 if (!((s->dev_audio ^ minor) & ~0xf))
1939 break;
1940 }
1941 VALIDATE_STATE(s);
1942 file->private_data = s;
1943 /* wait for device to become free */
1944 mutex_lock(&s->open_mutex);
1945 while (s->open_mode & file->f_mode) {
1946 if (file->f_flags & O_NONBLOCK) {
1947 mutex_unlock(&s->open_mutex);
1948 return -EBUSY;
1949 }
1950 add_wait_queue(&s->open_wait, &wait);
1951 __set_current_state(TASK_INTERRUPTIBLE);
1952 mutex_unlock(&s->open_mutex);
1953 schedule();
1954 remove_wait_queue(&s->open_wait, &wait);
1955 set_current_state(TASK_RUNNING);
1956 if (signal_pending(current))
1957 return -ERESTARTSYS;
1958 mutex_lock(&s->open_mutex);
1959 }
1960 if (file->f_mode & FMODE_READ) {
1961 s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags = s->dma_adc.subdivision = 0;
1962 s->dma_adc.enabled = 1;
1963 set_adc_rate(s, 8000);
1964 }
1965 if (file->f_mode & FMODE_WRITE) {
1966 s->dma_dac2.ossfragshift = s->dma_dac2.ossmaxfrags = s->dma_dac2.subdivision = 0;
1967 s->dma_dac2.enabled = 1;
1968 set_dac2_rate(s, 8000);
1969 }
1970 spin_lock_irqsave(&s->lock, flags);
1971 if (file->f_mode & FMODE_READ) {
1972 s->sctrl &= ~SCTRL_R1FMT;
1973 if ((minor & 0xf) == SND_DEV_DSP16)
1974 s->sctrl |= ES1371_FMT_S16_MONO << SCTRL_SH_R1FMT;
1975 else
1976 s->sctrl |= ES1371_FMT_U8_MONO << SCTRL_SH_R1FMT;
1977 }
1978 if (file->f_mode & FMODE_WRITE) {
1979 s->sctrl &= ~SCTRL_P2FMT;
1980 if ((minor & 0xf) == SND_DEV_DSP16)
1981 s->sctrl |= ES1371_FMT_S16_MONO << SCTRL_SH_P2FMT;
1982 else
1983 s->sctrl |= ES1371_FMT_U8_MONO << SCTRL_SH_P2FMT;
1984 }
1985 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
1986 spin_unlock_irqrestore(&s->lock, flags);
1987 s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
1988 mutex_unlock(&s->open_mutex);
1989 mutex_init(&s->sem);
1990 return nonseekable_open(inode, file);
1991}
1992
1993static int es1371_release(struct inode *inode, struct file *file)
1994{
1995 struct es1371_state *s = (struct es1371_state *)file->private_data;
1996
1997 VALIDATE_STATE(s);
1998 lock_kernel();
1999 if (file->f_mode & FMODE_WRITE)
2000 drain_dac2(s, file->f_flags & O_NONBLOCK);
2001 mutex_lock(&s->open_mutex);
2002 if (file->f_mode & FMODE_WRITE) {
2003 stop_dac2(s);
2004 dealloc_dmabuf(s, &s->dma_dac2);
2005 }
2006 if (file->f_mode & FMODE_READ) {
2007 stop_adc(s);
2008 dealloc_dmabuf(s, &s->dma_adc);
2009 }
2010 s->open_mode &= ~(file->f_mode & (FMODE_READ|FMODE_WRITE));
2011 mutex_unlock(&s->open_mutex);
2012 wake_up(&s->open_wait);
2013 unlock_kernel();
2014 return 0;
2015}
2016
2017static /*const*/ struct file_operations es1371_audio_fops = {
2018 .owner = THIS_MODULE,
2019 .llseek = no_llseek,
2020 .read = es1371_read,
2021 .write = es1371_write,
2022 .poll = es1371_poll,
2023 .ioctl = es1371_ioctl,
2024 .mmap = es1371_mmap,
2025 .open = es1371_open,
2026 .release = es1371_release,
2027};
2028
2029/* --------------------------------------------------------------------- */
2030
2031static ssize_t es1371_write_dac(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
2032{
2033 struct es1371_state *s = (struct es1371_state *)file->private_data;
2034 DECLARE_WAITQUEUE(wait, current);
2035 ssize_t ret = 0;
2036 unsigned long flags;
2037 unsigned swptr;
2038 int cnt;
2039
2040 VALIDATE_STATE(s);
2041 if (s->dma_dac1.mapped)
2042 return -ENXIO;
2043 if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s)))
2044 return ret;
2045 if (!access_ok(VERIFY_READ, buffer, count))
2046 return -EFAULT;
2047 add_wait_queue(&s->dma_dac1.wait, &wait);
2048 while (count > 0) {
2049 spin_lock_irqsave(&s->lock, flags);
2050 if (s->dma_dac1.count < 0) {
2051 s->dma_dac1.count = 0;
2052 s->dma_dac1.swptr = s->dma_dac1.hwptr;
2053 }
2054 swptr = s->dma_dac1.swptr;
2055 cnt = s->dma_dac1.dmasize-swptr;
2056 if (s->dma_dac1.count + cnt > s->dma_dac1.dmasize)
2057 cnt = s->dma_dac1.dmasize - s->dma_dac1.count;
2058 if (cnt <= 0)
2059 __set_current_state(TASK_INTERRUPTIBLE);
2060 spin_unlock_irqrestore(&s->lock, flags);
2061 if (cnt > count)
2062 cnt = count;
2063 if (cnt <= 0) {
2064 if (s->dma_dac1.enabled)
2065 start_dac1(s);
2066 if (file->f_flags & O_NONBLOCK) {
2067 if (!ret)
2068 ret = -EAGAIN;
2069 break;
2070 }
2071 schedule();
2072 if (signal_pending(current)) {
2073 if (!ret)
2074 ret = -ERESTARTSYS;
2075 break;
2076 }
2077 continue;
2078 }
2079 if (copy_from_user(s->dma_dac1.rawbuf + swptr, buffer, cnt)) {
2080 if (!ret)
2081 ret = -EFAULT;
2082 break;
2083 }
2084 swptr = (swptr + cnt) % s->dma_dac1.dmasize;
2085 spin_lock_irqsave(&s->lock, flags);
2086 s->dma_dac1.swptr = swptr;
2087 s->dma_dac1.count += cnt;
2088 s->dma_dac1.endcleared = 0;
2089 spin_unlock_irqrestore(&s->lock, flags);
2090 count -= cnt;
2091 buffer += cnt;
2092 ret += cnt;
2093 if (s->dma_dac1.enabled)
2094 start_dac1(s);
2095 }
2096 remove_wait_queue(&s->dma_dac1.wait, &wait);
2097 set_current_state(TASK_RUNNING);
2098 return ret;
2099}
2100
2101/* No kernel lock - we have our own spinlock */
2102static unsigned int es1371_poll_dac(struct file *file, struct poll_table_struct *wait)
2103{
2104 struct es1371_state *s = (struct es1371_state *)file->private_data;
2105 unsigned long flags;
2106 unsigned int mask = 0;
2107
2108 VALIDATE_STATE(s);
2109 if (!s->dma_dac1.ready && prog_dmabuf_dac1(s))
2110 return 0;
2111 poll_wait(file, &s->dma_dac1.wait, wait);
2112 spin_lock_irqsave(&s->lock, flags);
2113 es1371_update_ptr(s);
2114 if (s->dma_dac1.mapped) {
2115 if (s->dma_dac1.count >= (signed)s->dma_dac1.fragsize)
2116 mask |= POLLOUT | POLLWRNORM;
2117 } else {
2118 if ((signed)s->dma_dac1.dmasize >= s->dma_dac1.count + (signed)s->dma_dac1.fragsize)
2119 mask |= POLLOUT | POLLWRNORM;
2120 }
2121 spin_unlock_irqrestore(&s->lock, flags);
2122 return mask;
2123}
2124
2125static int es1371_mmap_dac(struct file *file, struct vm_area_struct *vma)
2126{
2127 struct es1371_state *s = (struct es1371_state *)file->private_data;
2128 int ret;
2129 unsigned long size;
2130
2131 VALIDATE_STATE(s);
2132 if (!(vma->vm_flags & VM_WRITE))
2133 return -EINVAL;
2134 lock_kernel();
2135 if ((ret = prog_dmabuf_dac1(s)) != 0)
2136 goto out;
2137 ret = -EINVAL;
2138 if (vma->vm_pgoff != 0)
2139 goto out;
2140 size = vma->vm_end - vma->vm_start;
2141 if (size > (PAGE_SIZE << s->dma_dac1.buforder))
2142 goto out;
2143 ret = -EAGAIN;
2144 if (remap_pfn_range(vma, vma->vm_start,
2145 virt_to_phys(s->dma_dac1.rawbuf) >> PAGE_SHIFT,
2146 size, vma->vm_page_prot))
2147 goto out;
2148 s->dma_dac1.mapped = 1;
2149 ret = 0;
2150out:
2151 unlock_kernel();
2152 return ret;
2153}
2154
2155static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
2156{
2157 struct es1371_state *s = (struct es1371_state *)file->private_data;
2158 unsigned long flags;
2159 audio_buf_info abinfo;
2160 count_info cinfo;
2161 int count;
2162 int val, ret;
2163 int __user *p = (int __user *)arg;
2164
2165 VALIDATE_STATE(s);
2166 switch (cmd) {
2167 case OSS_GETVERSION:
2168 return put_user(SOUND_VERSION, p);
2169
2170 case SNDCTL_DSP_SYNC:
2171 return drain_dac1(s, 0/*file->f_flags & O_NONBLOCK*/);
2172
2173 case SNDCTL_DSP_SETDUPLEX:
2174 return -EINVAL;
2175
2176 case SNDCTL_DSP_GETCAPS:
2177 return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER | DSP_CAP_MMAP, p);
2178
2179 case SNDCTL_DSP_RESET:
2180 stop_dac1(s);
2181 synchronize_irq(s->irq);
2182 s->dma_dac1.swptr = s->dma_dac1.hwptr = s->dma_dac1.count = s->dma_dac1.total_bytes = 0;
2183 return 0;
2184
2185 case SNDCTL_DSP_SPEED:
2186 if (get_user(val, p))
2187 return -EFAULT;
2188 if (val >= 0) {
2189 stop_dac1(s);
2190 s->dma_dac1.ready = 0;
2191 set_dac1_rate(s, val);
2192 }
2193 return put_user(s->dac1rate, p);
2194
2195 case SNDCTL_DSP_STEREO:
2196 if (get_user(val, p))
2197 return -EFAULT;
2198 stop_dac1(s);
2199 s->dma_dac1.ready = 0;
2200 spin_lock_irqsave(&s->lock, flags);
2201 if (val)
2202 s->sctrl |= SCTRL_P1SMB;
2203 else
2204 s->sctrl &= ~SCTRL_P1SMB;
2205 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
2206 spin_unlock_irqrestore(&s->lock, flags);
2207 return 0;
2208
2209 case SNDCTL_DSP_CHANNELS:
2210 if (get_user(val, p))
2211 return -EFAULT;
2212 if (val != 0) {
2213 stop_dac1(s);
2214 s->dma_dac1.ready = 0;
2215 spin_lock_irqsave(&s->lock, flags);
2216 if (val >= 2)
2217 s->sctrl |= SCTRL_P1SMB;
2218 else
2219 s->sctrl &= ~SCTRL_P1SMB;
2220 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
2221 spin_unlock_irqrestore(&s->lock, flags);
2222 }
2223 return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
2224
2225 case SNDCTL_DSP_GETFMTS: /* Returns a mask */
2226 return put_user(AFMT_S16_LE|AFMT_U8, p);
2227
2228 case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
2229 if (get_user(val, p))
2230 return -EFAULT;
2231 if (val != AFMT_QUERY) {
2232 stop_dac1(s);
2233 s->dma_dac1.ready = 0;
2234 spin_lock_irqsave(&s->lock, flags);
2235 if (val == AFMT_S16_LE)
2236 s->sctrl |= SCTRL_P1SEB;
2237 else
2238 s->sctrl &= ~SCTRL_P1SEB;
2239 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
2240 spin_unlock_irqrestore(&s->lock, flags);
2241 }
2242 return put_user((s->sctrl & SCTRL_P1SEB) ? AFMT_S16_LE : AFMT_U8, p);
2243
2244 case SNDCTL_DSP_POST:
2245 return 0;
2246
2247 case SNDCTL_DSP_GETTRIGGER:
2248 return put_user((s->ctrl & CTRL_DAC1_EN) ? PCM_ENABLE_OUTPUT : 0, p);
2249
2250 case SNDCTL_DSP_SETTRIGGER:
2251 if (get_user(val, p))
2252 return -EFAULT;
2253 if (val & PCM_ENABLE_OUTPUT) {
2254 if (!s->dma_dac1.ready && (ret = prog_dmabuf_dac1(s)))
2255 return ret;
2256 s->dma_dac1.enabled = 1;
2257 start_dac1(s);
2258 } else {
2259 s->dma_dac1.enabled = 0;
2260 stop_dac1(s);
2261 }
2262 return 0;
2263
2264 case SNDCTL_DSP_GETOSPACE:
2265 if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0)
2266 return val;
2267 spin_lock_irqsave(&s->lock, flags);
2268 es1371_update_ptr(s);
2269 abinfo.fragsize = s->dma_dac1.fragsize;
2270 count = s->dma_dac1.count;
2271 if (count < 0)
2272 count = 0;
2273 abinfo.bytes = s->dma_dac1.dmasize - count;
2274 abinfo.fragstotal = s->dma_dac1.numfrag;
2275 abinfo.fragments = abinfo.bytes >> s->dma_dac1.fragshift;
2276 spin_unlock_irqrestore(&s->lock, flags);
2277 return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
2278
2279 case SNDCTL_DSP_NONBLOCK:
2280 file->f_flags |= O_NONBLOCK;
2281 return 0;
2282
2283 case SNDCTL_DSP_GETODELAY:
2284 if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0)
2285 return val;
2286 spin_lock_irqsave(&s->lock, flags);
2287 es1371_update_ptr(s);
2288 count = s->dma_dac1.count;
2289 spin_unlock_irqrestore(&s->lock, flags);
2290 if (count < 0)
2291 count = 0;
2292 return put_user(count, p);
2293
2294 case SNDCTL_DSP_GETOPTR:
2295 if (!s->dma_dac1.ready && (val = prog_dmabuf_dac1(s)) != 0)
2296 return val;
2297 spin_lock_irqsave(&s->lock, flags);
2298 es1371_update_ptr(s);
2299 cinfo.bytes = s->dma_dac1.total_bytes;
2300 count = s->dma_dac1.count;
2301 if (count < 0)
2302 count = 0;
2303 cinfo.blocks = count >> s->dma_dac1.fragshift;
2304 cinfo.ptr = s->dma_dac1.hwptr;
2305 if (s->dma_dac1.mapped)
2306 s->dma_dac1.count &= s->dma_dac1.fragsize-1;
2307 spin_unlock_irqrestore(&s->lock, flags);
2308 if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo)))
2309 return -EFAULT;
2310 return 0;
2311
2312 case SNDCTL_DSP_GETBLKSIZE:
2313 if ((val = prog_dmabuf_dac1(s)))
2314 return val;
2315 return put_user(s->dma_dac1.fragsize, p);
2316
2317 case SNDCTL_DSP_SETFRAGMENT:
2318 if (get_user(val, p))
2319 return -EFAULT;
2320 s->dma_dac1.ossfragshift = val & 0xffff;
2321 s->dma_dac1.ossmaxfrags = (val >> 16) & 0xffff;
2322 if (s->dma_dac1.ossfragshift < 4)
2323 s->dma_dac1.ossfragshift = 4;
2324 if (s->dma_dac1.ossfragshift > 15)
2325 s->dma_dac1.ossfragshift = 15;
2326 if (s->dma_dac1.ossmaxfrags < 4)
2327 s->dma_dac1.ossmaxfrags = 4;
2328 return 0;
2329
2330 case SNDCTL_DSP_SUBDIVIDE:
2331 if (s->dma_dac1.subdivision)
2332 return -EINVAL;
2333 if (get_user(val, p))
2334 return -EFAULT;
2335 if (val != 1 && val != 2 && val != 4)
2336 return -EINVAL;
2337 s->dma_dac1.subdivision = val;
2338 return 0;
2339
2340 case SOUND_PCM_READ_RATE:
2341 return put_user(s->dac1rate, p);
2342
2343 case SOUND_PCM_READ_CHANNELS:
2344 return put_user((s->sctrl & SCTRL_P1SMB) ? 2 : 1, p);
2345
2346 case SOUND_PCM_READ_BITS:
2347 return put_user((s->sctrl & SCTRL_P1SEB) ? 16 : 8, p);
2348
2349 case SOUND_PCM_WRITE_FILTER:
2350 case SNDCTL_DSP_SETSYNCRO:
2351 case SOUND_PCM_READ_FILTER:
2352 return -EINVAL;
2353
2354 }
2355 return mixdev_ioctl(s->codec, cmd, arg);
2356}
2357
2358static int es1371_open_dac(struct inode *inode, struct file *file)
2359{
2360 int minor = iminor(inode);
2361 DECLARE_WAITQUEUE(wait, current);
2362 unsigned long flags;
2363 struct list_head *list;
2364 struct es1371_state *s;
2365
2366 for (list = devs.next; ; list = list->next) {
2367 if (list == &devs)
2368 return -ENODEV;
2369 s = list_entry(list, struct es1371_state, devs);
2370 if (!((s->dev_dac ^ minor) & ~0xf))
2371 break;
2372 }
2373 VALIDATE_STATE(s);
2374 /* we allow opening with O_RDWR, most programs do it although they will only write */
2375#if 0
2376 if (file->f_mode & FMODE_READ)
2377 return -EPERM;
2378#endif
2379 if (!(file->f_mode & FMODE_WRITE))
2380 return -EINVAL;
2381 file->private_data = s;
2382 /* wait for device to become free */
2383 mutex_lock(&s->open_mutex);
2384 while (s->open_mode & FMODE_DAC) {
2385 if (file->f_flags & O_NONBLOCK) {
2386 mutex_unlock(&s->open_mutex);
2387 return -EBUSY;
2388 }
2389 add_wait_queue(&s->open_wait, &wait);
2390 __set_current_state(TASK_INTERRUPTIBLE);
2391 mutex_unlock(&s->open_mutex);
2392 schedule();
2393 remove_wait_queue(&s->open_wait, &wait);
2394 set_current_state(TASK_RUNNING);
2395 if (signal_pending(current))
2396 return -ERESTARTSYS;
2397 mutex_lock(&s->open_mutex);
2398 }
2399 s->dma_dac1.ossfragshift = s->dma_dac1.ossmaxfrags = s->dma_dac1.subdivision = 0;
2400 s->dma_dac1.enabled = 1;
2401 set_dac1_rate(s, 8000);
2402 spin_lock_irqsave(&s->lock, flags);
2403 s->sctrl &= ~SCTRL_P1FMT;
2404 if ((minor & 0xf) == SND_DEV_DSP16)
2405 s->sctrl |= ES1371_FMT_S16_MONO << SCTRL_SH_P1FMT;
2406 else
2407 s->sctrl |= ES1371_FMT_U8_MONO << SCTRL_SH_P1FMT;
2408 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
2409 spin_unlock_irqrestore(&s->lock, flags);
2410 s->open_mode |= FMODE_DAC;
2411 mutex_unlock(&s->open_mutex);
2412 return nonseekable_open(inode, file);
2413}
2414
2415static int es1371_release_dac(struct inode *inode, struct file *file)
2416{
2417 struct es1371_state *s = (struct es1371_state *)file->private_data;
2418
2419 VALIDATE_STATE(s);
2420 lock_kernel();
2421 drain_dac1(s, file->f_flags & O_NONBLOCK);
2422 mutex_lock(&s->open_mutex);
2423 stop_dac1(s);
2424 dealloc_dmabuf(s, &s->dma_dac1);
2425 s->open_mode &= ~FMODE_DAC;
2426 mutex_unlock(&s->open_mutex);
2427 wake_up(&s->open_wait);
2428 unlock_kernel();
2429 return 0;
2430}
2431
2432static /*const*/ struct file_operations es1371_dac_fops = {
2433 .owner = THIS_MODULE,
2434 .llseek = no_llseek,
2435 .write = es1371_write_dac,
2436 .poll = es1371_poll_dac,
2437 .ioctl = es1371_ioctl_dac,
2438 .mmap = es1371_mmap_dac,
2439 .open = es1371_open_dac,
2440 .release = es1371_release_dac,
2441};
2442
2443/* --------------------------------------------------------------------- */
2444
2445static ssize_t es1371_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
2446{
2447 struct es1371_state *s = (struct es1371_state *)file->private_data;
2448 DECLARE_WAITQUEUE(wait, current);
2449 ssize_t ret;
2450 unsigned long flags;
2451 unsigned ptr;
2452 int cnt;
2453
2454 VALIDATE_STATE(s);
2455 if (!access_ok(VERIFY_WRITE, buffer, count))
2456 return -EFAULT;
2457 if (count == 0)
2458 return 0;
2459 ret = 0;
2460 add_wait_queue(&s->midi.iwait, &wait);
2461 while (count > 0) {
2462 spin_lock_irqsave(&s->lock, flags);
2463 ptr = s->midi.ird;
2464 cnt = MIDIINBUF - ptr;
2465 if (s->midi.icnt < cnt)
2466 cnt = s->midi.icnt;
2467 if (cnt <= 0)
2468 __set_current_state(TASK_INTERRUPTIBLE);
2469 spin_unlock_irqrestore(&s->lock, flags);
2470 if (cnt > count)
2471 cnt = count;
2472 if (cnt <= 0) {
2473 if (file->f_flags & O_NONBLOCK) {
2474 if (!ret)
2475 ret = -EAGAIN;
2476 break;
2477 }
2478 schedule();
2479 if (signal_pending(current)) {
2480 if (!ret)
2481 ret = -ERESTARTSYS;
2482 break;
2483 }
2484 continue;
2485 }
2486 if (copy_to_user(buffer, s->midi.ibuf + ptr, cnt)) {
2487 if (!ret)
2488 ret = -EFAULT;
2489 break;
2490 }
2491 ptr = (ptr + cnt) % MIDIINBUF;
2492 spin_lock_irqsave(&s->lock, flags);
2493 s->midi.ird = ptr;
2494 s->midi.icnt -= cnt;
2495 spin_unlock_irqrestore(&s->lock, flags);
2496 count -= cnt;
2497 buffer += cnt;
2498 ret += cnt;
2499 break;
2500 }
2501 __set_current_state(TASK_RUNNING);
2502 remove_wait_queue(&s->midi.iwait, &wait);
2503 return ret;
2504}
2505
2506static ssize_t es1371_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
2507{
2508 struct es1371_state *s = (struct es1371_state *)file->private_data;
2509 DECLARE_WAITQUEUE(wait, current);
2510 ssize_t ret;
2511 unsigned long flags;
2512 unsigned ptr;
2513 int cnt;
2514
2515 VALIDATE_STATE(s);
2516 if (!access_ok(VERIFY_READ, buffer, count))
2517 return -EFAULT;
2518 if (count == 0)
2519 return 0;
2520 ret = 0;
2521 add_wait_queue(&s->midi.owait, &wait);
2522 while (count > 0) {
2523 spin_lock_irqsave(&s->lock, flags);
2524 ptr = s->midi.owr;
2525 cnt = MIDIOUTBUF - ptr;
2526 if (s->midi.ocnt + cnt > MIDIOUTBUF)
2527 cnt = MIDIOUTBUF - s->midi.ocnt;
2528 if (cnt <= 0) {
2529 __set_current_state(TASK_INTERRUPTIBLE);
2530 es1371_handle_midi(s);
2531 }
2532 spin_unlock_irqrestore(&s->lock, flags);
2533 if (cnt > count)
2534 cnt = count;
2535 if (cnt <= 0) {
2536 if (file->f_flags & O_NONBLOCK) {
2537 if (!ret)
2538 ret = -EAGAIN;
2539 break;
2540 }
2541 schedule();
2542 if (signal_pending(current)) {
2543 if (!ret)
2544 ret = -ERESTARTSYS;
2545 break;
2546 }
2547 continue;
2548 }
2549 if (copy_from_user(s->midi.obuf + ptr, buffer, cnt)) {
2550 if (!ret)
2551 ret = -EFAULT;
2552 break;
2553 }
2554 ptr = (ptr + cnt) % MIDIOUTBUF;
2555 spin_lock_irqsave(&s->lock, flags);
2556 s->midi.owr = ptr;
2557 s->midi.ocnt += cnt;
2558 spin_unlock_irqrestore(&s->lock, flags);
2559 count -= cnt;
2560 buffer += cnt;
2561 ret += cnt;
2562 spin_lock_irqsave(&s->lock, flags);
2563 es1371_handle_midi(s);
2564 spin_unlock_irqrestore(&s->lock, flags);
2565 }
2566 __set_current_state(TASK_RUNNING);
2567 remove_wait_queue(&s->midi.owait, &wait);
2568 return ret;
2569}
2570
2571/* No kernel lock - we have our own spinlock */
2572static unsigned int es1371_midi_poll(struct file *file, struct poll_table_struct *wait)
2573{
2574 struct es1371_state *s = (struct es1371_state *)file->private_data;
2575 unsigned long flags;
2576 unsigned int mask = 0;
2577
2578 VALIDATE_STATE(s);
2579 if (file->f_mode & FMODE_WRITE)
2580 poll_wait(file, &s->midi.owait, wait);
2581 if (file->f_mode & FMODE_READ)
2582 poll_wait(file, &s->midi.iwait, wait);
2583 spin_lock_irqsave(&s->lock, flags);
2584 if (file->f_mode & FMODE_READ) {
2585 if (s->midi.icnt > 0)
2586 mask |= POLLIN | POLLRDNORM;
2587 }
2588 if (file->f_mode & FMODE_WRITE) {
2589 if (s->midi.ocnt < MIDIOUTBUF)
2590 mask |= POLLOUT | POLLWRNORM;
2591 }
2592 spin_unlock_irqrestore(&s->lock, flags);
2593 return mask;
2594}
2595
2596static int es1371_midi_open(struct inode *inode, struct file *file)
2597{
2598 int minor = iminor(inode);
2599 DECLARE_WAITQUEUE(wait, current);
2600 unsigned long flags;
2601 struct list_head *list;
2602 struct es1371_state *s;
2603
2604 for (list = devs.next; ; list = list->next) {
2605 if (list == &devs)
2606 return -ENODEV;
2607 s = list_entry(list, struct es1371_state, devs);
2608 if (s->dev_midi == minor)
2609 break;
2610 }
2611 VALIDATE_STATE(s);
2612 file->private_data = s;
2613 /* wait for device to become free */
2614 mutex_lock(&s->open_mutex);
2615 while (s->open_mode & (file->f_mode << FMODE_MIDI_SHIFT)) {
2616 if (file->f_flags & O_NONBLOCK) {
2617 mutex_unlock(&s->open_mutex);
2618 return -EBUSY;
2619 }
2620 add_wait_queue(&s->open_wait, &wait);
2621 __set_current_state(TASK_INTERRUPTIBLE);
2622 mutex_unlock(&s->open_mutex);
2623 schedule();
2624 remove_wait_queue(&s->open_wait, &wait);
2625 set_current_state(TASK_RUNNING);
2626 if (signal_pending(current))
2627 return -ERESTARTSYS;
2628 mutex_lock(&s->open_mutex);
2629 }
2630 spin_lock_irqsave(&s->lock, flags);
2631 if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) {
2632 s->midi.ird = s->midi.iwr = s->midi.icnt = 0;
2633 s->midi.ord = s->midi.owr = s->midi.ocnt = 0;
2634 outb(UCTRL_CNTRL_SWR, s->io+ES1371_REG_UART_CONTROL);
2635 outb(0, s->io+ES1371_REG_UART_CONTROL);
2636 outb(0, s->io+ES1371_REG_UART_TEST);
2637 }
2638 if (file->f_mode & FMODE_READ) {
2639 s->midi.ird = s->midi.iwr = s->midi.icnt = 0;
2640 }
2641 if (file->f_mode & FMODE_WRITE) {
2642 s->midi.ord = s->midi.owr = s->midi.ocnt = 0;
2643 }
2644 s->ctrl |= CTRL_UART_EN;
2645 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
2646 es1371_handle_midi(s);
2647 spin_unlock_irqrestore(&s->lock, flags);
2648 s->open_mode |= (file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE);
2649 mutex_unlock(&s->open_mutex);
2650 return nonseekable_open(inode, file);
2651}
2652
2653static int es1371_midi_release(struct inode *inode, struct file *file)
2654{
2655 struct es1371_state *s = (struct es1371_state *)file->private_data;
2656 DECLARE_WAITQUEUE(wait, current);
2657 unsigned long flags;
2658 unsigned count, tmo;
2659
2660 VALIDATE_STATE(s);
2661 lock_kernel();
2662 if (file->f_mode & FMODE_WRITE) {
2663 add_wait_queue(&s->midi.owait, &wait);
2664 for (;;) {
2665 __set_current_state(TASK_INTERRUPTIBLE);
2666 spin_lock_irqsave(&s->lock, flags);
2667 count = s->midi.ocnt;
2668 spin_unlock_irqrestore(&s->lock, flags);
2669 if (count <= 0)
2670 break;
2671 if (signal_pending(current))
2672 break;
2673 if (file->f_flags & O_NONBLOCK)
2674 break;
2675 tmo = (count * HZ) / 3100;
2676 if (!schedule_timeout(tmo ? : 1) && tmo)
2677 printk(KERN_DEBUG PFX "midi timed out??\n");
2678 }
2679 remove_wait_queue(&s->midi.owait, &wait);
2680 set_current_state(TASK_RUNNING);
2681 }
2682 mutex_lock(&s->open_mutex);
2683 s->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ|FMODE_MIDI_WRITE));
2684 spin_lock_irqsave(&s->lock, flags);
2685 if (!(s->open_mode & (FMODE_MIDI_READ | FMODE_MIDI_WRITE))) {
2686 s->ctrl &= ~CTRL_UART_EN;
2687 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
2688 }
2689 spin_unlock_irqrestore(&s->lock, flags);
2690 mutex_unlock(&s->open_mutex);
2691 wake_up(&s->open_wait);
2692 unlock_kernel();
2693 return 0;
2694}
2695
2696static /*const*/ struct file_operations es1371_midi_fops = {
2697 .owner = THIS_MODULE,
2698 .llseek = no_llseek,
2699 .read = es1371_midi_read,
2700 .write = es1371_midi_write,
2701 .poll = es1371_midi_poll,
2702 .open = es1371_midi_open,
2703 .release = es1371_midi_release,
2704};
2705
2706/* --------------------------------------------------------------------- */
2707
2708/*
2709 * for debugging purposes, we'll create a proc device that dumps the
2710 * CODEC chipstate
2711 */
2712
2713#ifdef ES1371_DEBUG
2714static int proc_es1371_dump (char *buf, char **start, off_t fpos, int length, int *eof, void *data)
2715{
2716 struct es1371_state *s;
2717 int cnt, len = 0;
2718
2719 if (list_empty(&devs))
2720 return 0;
2721 s = list_entry(devs.next, struct es1371_state, devs);
2722 /* print out header */
2723 len += sprintf(buf + len, "\t\tCreative ES137x Debug Dump-o-matic\n");
2724
2725 /* print out CODEC state */
2726 len += sprintf (buf + len, "AC97 CODEC state\n");
2727 for (cnt=0; cnt <= 0x7e; cnt = cnt +2)
2728 len+= sprintf (buf + len, "reg:0x%02x val:0x%04x\n", cnt, rdcodec(s->codec, cnt));
2729
2730 if (fpos >=len){
2731 *start = buf;
2732 *eof =1;
2733 return 0;
2734 }
2735 *start = buf + fpos;
2736 if ((len -= fpos) > length)
2737 return length;
2738 *eof =1;
2739 return len;
2740
2741}
2742#endif /* ES1371_DEBUG */
2743
2744/* --------------------------------------------------------------------- */
2745
2746/* maximum number of devices; only used for command line params */
2747#define NR_DEVICE 5
2748
2749static int spdif[NR_DEVICE];
2750static int nomix[NR_DEVICE];
2751static int amplifier[NR_DEVICE];
2752
2753static unsigned int devindex;
2754
2755module_param_array(spdif, bool, NULL, 0);
2756MODULE_PARM_DESC(spdif, "if 1 the output is in S/PDIF digital mode");
2757module_param_array(nomix, bool, NULL, 0);
2758MODULE_PARM_DESC(nomix, "if 1 no analog audio is mixed to the digital output");
2759module_param_array(amplifier, bool, NULL, 0);
2760MODULE_PARM_DESC(amplifier, "Set to 1 if the machine needs the amp control enabling (many laptops)");
2761
2762MODULE_AUTHOR("Thomas M. Sailer, sailer@ife.ee.ethz.ch, hb9jnx@hb9w.che.eu");
2763MODULE_DESCRIPTION("ES1371 AudioPCI97 Driver");
2764MODULE_LICENSE("GPL");
2765
2766
2767/* --------------------------------------------------------------------- */
2768
2769static struct initvol {
2770 int mixch;
2771 int vol;
2772} initvol[] __devinitdata = {
2773 { SOUND_MIXER_WRITE_LINE, 0x4040 },
2774 { SOUND_MIXER_WRITE_CD, 0x4040 },
2775 { MIXER_WRITE(SOUND_MIXER_VIDEO), 0x4040 },
2776 { SOUND_MIXER_WRITE_LINE1, 0x4040 },
2777 { SOUND_MIXER_WRITE_PCM, 0x4040 },
2778 { SOUND_MIXER_WRITE_VOLUME, 0x4040 },
2779 { MIXER_WRITE(SOUND_MIXER_PHONEOUT), 0x4040 },
2780 { SOUND_MIXER_WRITE_OGAIN, 0x4040 },
2781 { MIXER_WRITE(SOUND_MIXER_PHONEIN), 0x4040 },
2782 { SOUND_MIXER_WRITE_SPEAKER, 0x4040 },
2783 { SOUND_MIXER_WRITE_MIC, 0x4040 },
2784 { SOUND_MIXER_WRITE_RECLEV, 0x4040 },
2785 { SOUND_MIXER_WRITE_IGAIN, 0x4040 }
2786};
2787
2788static struct
2789{
2790 short svid, sdid;
2791} amplifier_needed[] =
2792{
2793 { 0x107B, 0x2150 }, /* Gateway Solo 2150 */
2794 { 0x13BD, 0x100C }, /* Mebius PC-MJ100V */
2795 { 0x1102, 0x5938 }, /* Targa Xtender 300 */
2796 { 0x1102, 0x8938 }, /* IPC notebook */
2797 { PCI_ANY_ID, PCI_ANY_ID }
2798};
2799
2800#ifdef SUPPORT_JOYSTICK
2801
2802static int __devinit es1371_register_gameport(struct es1371_state *s)
2803{
2804 struct gameport *gp;
2805 int gpio;
2806
2807 for (gpio = 0x218; gpio >= 0x200; gpio -= 0x08)
2808 if (request_region(gpio, JOY_EXTENT, "es1371"))
2809 break;
2810
2811 if (gpio < 0x200) {
2812 printk(KERN_ERR PFX "no free joystick address found\n");
2813 return -EBUSY;
2814 }
2815
2816 s->gameport = gp = gameport_allocate_port();
2817 if (!gp) {
2818 printk(KERN_ERR PFX "can not allocate memory for gameport\n");
2819 release_region(gpio, JOY_EXTENT);
2820 return -ENOMEM;
2821 }
2822
2823 gameport_set_name(gp, "ESS1371 Gameport");
2824 gameport_set_phys(gp, "isa%04x/gameport0", gpio);
2825 gp->dev.parent = &s->dev->dev;
2826 gp->io = gpio;
2827
2828 s->ctrl |= CTRL_JYSTK_EN | (((gpio >> 3) & CTRL_JOY_MASK) << CTRL_JOY_SHIFT);
2829 outl(s->ctrl, s->io + ES1371_REG_CONTROL);
2830
2831 gameport_register_port(gp);
2832
2833 return 0;
2834}
2835
2836static inline void es1371_unregister_gameport(struct es1371_state *s)
2837{
2838 if (s->gameport) {
2839 int gpio = s->gameport->io;
2840 gameport_unregister_port(s->gameport);
2841 release_region(gpio, JOY_EXTENT);
2842
2843 }
2844}
2845
2846#else
2847static inline int es1371_register_gameport(struct es1371_state *s) { return -ENOSYS; }
2848static inline void es1371_unregister_gameport(struct es1371_state *s) { }
2849#endif /* SUPPORT_JOYSTICK */
2850
2851
2852static int __devinit es1371_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid)
2853{
2854 struct es1371_state *s;
2855 mm_segment_t fs;
2856 int i, val, res = -1;
2857 int idx;
2858 unsigned long tmo;
2859 signed long tmo2;
2860 unsigned int cssr;
2861
2862 if ((res=pci_enable_device(pcidev)))
2863 return res;
2864
2865 if (!(pci_resource_flags(pcidev, 0) & IORESOURCE_IO))
2866 return -ENODEV;
2867 if (pcidev->irq == 0)
2868 return -ENODEV;
2869 i = pci_set_dma_mask(pcidev, DMA_32BIT_MASK);
2870 if (i) {
2871 printk(KERN_WARNING "es1371: architecture does not support 32bit PCI busmaster DMA\n");
2872 return i;
2873 }
2874 if (!(s = kzalloc(sizeof(struct es1371_state), GFP_KERNEL))) {
2875 printk(KERN_WARNING PFX "out of memory\n");
2876 return -ENOMEM;
2877 }
2878
2879 s->codec = ac97_alloc_codec();
2880 if(s->codec == NULL)
2881 goto err_codec;
2882
2883 init_waitqueue_head(&s->dma_adc.wait);
2884 init_waitqueue_head(&s->dma_dac1.wait);
2885 init_waitqueue_head(&s->dma_dac2.wait);
2886 init_waitqueue_head(&s->open_wait);
2887 init_waitqueue_head(&s->midi.iwait);
2888 init_waitqueue_head(&s->midi.owait);
2889 mutex_init(&s->open_mutex);
2890 spin_lock_init(&s->lock);
2891 s->magic = ES1371_MAGIC;
2892 s->dev = pcidev;
2893 s->io = pci_resource_start(pcidev, 0);
2894 s->irq = pcidev->irq;
2895 s->vendor = pcidev->vendor;
2896 s->device = pcidev->device;
2897 s->rev = pcidev->revision;
2898 s->codec->private_data = s;
2899 s->codec->id = 0;
2900 s->codec->codec_read = rdcodec;
2901 s->codec->codec_write = wrcodec;
2902 printk(KERN_INFO PFX "found chip, vendor id 0x%04x device id 0x%04x revision 0x%02x\n",
2903 s->vendor, s->device, s->rev);
2904 if (!request_region(s->io, ES1371_EXTENT, "es1371")) {
2905 printk(KERN_ERR PFX "io ports %#lx-%#lx in use\n", s->io, s->io+ES1371_EXTENT-1);
2906 res = -EBUSY;
2907 goto err_region;
2908 }
2909 if ((res=request_irq(s->irq, es1371_interrupt, IRQF_SHARED, "es1371",s))) {
2910 printk(KERN_ERR PFX "irq %u in use\n", s->irq);
2911 goto err_irq;
2912 }
2913 printk(KERN_INFO PFX "found es1371 rev %d at io %#lx irq %u\n",
2914 s->rev, s->io, s->irq);
2915 /* register devices */
2916 if ((res=(s->dev_audio = register_sound_dsp(&es1371_audio_fops,-1)))<0)
2917 goto err_dev1;
2918 if ((res=(s->codec->dev_mixer = register_sound_mixer(&es1371_mixer_fops, -1))) < 0)
2919 goto err_dev2;
2920 if ((res=(s->dev_dac = register_sound_dsp(&es1371_dac_fops, -1))) < 0)
2921 goto err_dev3;
2922 if ((res=(s->dev_midi = register_sound_midi(&es1371_midi_fops, -1)))<0 )
2923 goto err_dev4;
2924#ifdef ES1371_DEBUG
2925 /* initialize the debug proc device */
2926 s->ps = create_proc_read_entry("es1371",0,NULL,proc_es1371_dump,NULL);
2927#endif /* ES1371_DEBUG */
2928
2929 /* initialize codec registers */
2930 s->ctrl = 0;
2931
2932 /* Check amplifier requirements */
2933
2934 if (amplifier[devindex])
2935 s->ctrl |= CTRL_GPIO_OUT0;
2936 else for(idx = 0; amplifier_needed[idx].svid != PCI_ANY_ID; idx++)
2937 {
2938 if(pcidev->subsystem_vendor == amplifier_needed[idx].svid &&
2939 pcidev->subsystem_device == amplifier_needed[idx].sdid)
2940 {
2941 s->ctrl |= CTRL_GPIO_OUT0; /* turn internal amplifier on */
2942 printk(KERN_INFO PFX "Enabling internal amplifier.\n");
2943 }
2944 }
2945
2946 s->sctrl = 0;
2947 cssr = 0;
2948 s->spdif_volume = -1;
2949 /* check to see if s/pdif mode is being requested */
2950 if (spdif[devindex]) {
2951 if (s->rev >= 4) {
2952 printk(KERN_INFO PFX "enabling S/PDIF output\n");
2953 s->spdif_volume = 0;
2954 cssr |= STAT_EN_SPDIF;
2955 s->ctrl |= CTRL_SPDIFEN_B;
2956 if (nomix[devindex]) /* don't mix analog inputs to s/pdif output */
2957 s->ctrl |= CTRL_RECEN_B;
2958 } else {
2959 printk(KERN_ERR PFX "revision %d does not support S/PDIF\n", s->rev);
2960 }
2961 }
2962 /* initialize the chips */
2963 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
2964 outl(s->sctrl, s->io+ES1371_REG_SERIAL_CONTROL);
2965 outl(LEGACY_JFAST, s->io+ES1371_REG_LEGACY);
2966 pci_set_master(pcidev); /* enable bus mastering */
2967 /* if we are a 5880 turn on the AC97 */
2968 if (s->vendor == PCI_VENDOR_ID_ENSONIQ &&
2969 ((s->device == PCI_DEVICE_ID_ENSONIQ_CT5880 && s->rev >= CT5880REV_CT5880_C) ||
2970 (s->device == PCI_DEVICE_ID_ENSONIQ_ES1371 && s->rev == ES1371REV_CT5880_A) ||
2971 (s->device == PCI_DEVICE_ID_ENSONIQ_ES1371 && s->rev == ES1371REV_ES1373_8))) {
2972 cssr |= CSTAT_5880_AC97_RST;
2973 outl(cssr, s->io+ES1371_REG_STATUS);
2974 /* need to delay around 20ms(bleech) to give
2975 some CODECs enough time to wakeup */
2976 tmo = jiffies + (HZ / 50) + 1;
2977 for (;;) {
2978 tmo2 = tmo - jiffies;
2979 if (tmo2 <= 0)
2980 break;
2981 schedule_timeout(tmo2);
2982 }
2983 }
2984 /* AC97 warm reset to start the bitclk */
2985 outl(s->ctrl | CTRL_SYNCRES, s->io+ES1371_REG_CONTROL);
2986 udelay(2);
2987 outl(s->ctrl, s->io+ES1371_REG_CONTROL);
2988 /* init the sample rate converter */
2989 src_init(s);
2990 /* codec init */
2991 if (!ac97_probe_codec(s->codec)) {
2992 res = -ENODEV;
2993 goto err_gp;
2994 }
2995 /* set default values */
2996
2997 fs = get_fs();
2998 set_fs(KERNEL_DS);
2999 val = SOUND_MASK_LINE;
3000 mixdev_ioctl(s->codec, SOUND_MIXER_WRITE_RECSRC, (unsigned long)&val);
3001 for (i = 0; i < ARRAY_SIZE(initvol); i++) {
3002 val = initvol[i].vol;
3003 mixdev_ioctl(s->codec, initvol[i].mixch, (unsigned long)&val);
3004 }
3005 /* mute master and PCM when in S/PDIF mode */
3006 if (s->spdif_volume != -1) {
3007 val = 0x0000;
3008 s->codec->mixer_ioctl(s->codec, SOUND_MIXER_WRITE_VOLUME, (unsigned long)&val);
3009 s->codec->mixer_ioctl(s->codec, SOUND_MIXER_WRITE_PCM, (unsigned long)&val);
3010 }
3011 set_fs(fs);
3012 /* turn on S/PDIF output driver if requested */
3013 outl(cssr, s->io+ES1371_REG_STATUS);
3014
3015 es1371_register_gameport(s);
3016
3017 /* store it in the driver field */
3018 pci_set_drvdata(pcidev, s);
3019 /* put it into driver list */
3020 list_add_tail(&s->devs, &devs);
3021 /* increment devindex */
3022 if (devindex < NR_DEVICE-1)
3023 devindex++;
3024 return 0;
3025
3026 err_gp:
3027#ifdef ES1371_DEBUG
3028 if (s->ps)
3029 remove_proc_entry("es1371", NULL);
3030#endif
3031 unregister_sound_midi(s->dev_midi);
3032 err_dev4:
3033 unregister_sound_dsp(s->dev_dac);
3034 err_dev3:
3035 unregister_sound_mixer(s->codec->dev_mixer);
3036 err_dev2:
3037 unregister_sound_dsp(s->dev_audio);
3038 err_dev1:
3039 printk(KERN_ERR PFX "cannot register misc device\n");
3040 free_irq(s->irq, s);
3041 err_irq:
3042 release_region(s->io, ES1371_EXTENT);
3043 err_region:
3044 err_codec:
3045 ac97_release_codec(s->codec);
3046 kfree(s);
3047 return res;
3048}
3049
3050static void __devexit es1371_remove(struct pci_dev *dev)
3051{
3052 struct es1371_state *s = pci_get_drvdata(dev);
3053
3054 if (!s)
3055 return;
3056 list_del(&s->devs);
3057#ifdef ES1371_DEBUG
3058 if (s->ps)
3059 remove_proc_entry("es1371", NULL);
3060#endif /* ES1371_DEBUG */
3061 outl(0, s->io+ES1371_REG_CONTROL); /* switch everything off */
3062 outl(0, s->io+ES1371_REG_SERIAL_CONTROL); /* clear serial interrupts */
3063 synchronize_irq(s->irq);
3064 free_irq(s->irq, s);
3065 es1371_unregister_gameport(s);
3066 release_region(s->io, ES1371_EXTENT);
3067 unregister_sound_dsp(s->dev_audio);
3068 unregister_sound_mixer(s->codec->dev_mixer);
3069 unregister_sound_dsp(s->dev_dac);
3070 unregister_sound_midi(s->dev_midi);
3071 ac97_release_codec(s->codec);
3072 kfree(s);
3073 pci_set_drvdata(dev, NULL);
3074}
3075
3076static struct pci_device_id id_table[] = {
3077 { PCI_VENDOR_ID_ENSONIQ, PCI_DEVICE_ID_ENSONIQ_ES1371, PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
3078 { PCI_VENDOR_ID_ENSONIQ, PCI_DEVICE_ID_ENSONIQ_CT5880, PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
3079 { PCI_VENDOR_ID_ECTIVA, PCI_DEVICE_ID_ECTIVA_EV1938, PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
3080 { 0, }
3081};
3082
3083MODULE_DEVICE_TABLE(pci, id_table);
3084
3085static struct pci_driver es1371_driver = {
3086 .name = "es1371",
3087 .id_table = id_table,
3088 .probe = es1371_probe,
3089 .remove = __devexit_p(es1371_remove),
3090};
3091
3092static int __init init_es1371(void)
3093{
3094 printk(KERN_INFO PFX "version v0.32 time " __TIME__ " " __DATE__ "\n");
3095 return pci_register_driver(&es1371_driver);
3096}
3097
3098static void __exit cleanup_es1371(void)
3099{
3100 printk(KERN_INFO PFX "unloading\n");
3101 pci_unregister_driver(&es1371_driver);
3102}
3103
3104module_init(init_es1371);
3105module_exit(cleanup_es1371);
3106
3107/* --------------------------------------------------------------------- */
3108
3109#ifndef MODULE
3110
3111/* format is: es1371=[spdif,[nomix,[amplifier]]] */
3112
3113static int __init es1371_setup(char *str)
3114{
3115 static unsigned __initdata nr_dev = 0;
3116
3117 if (nr_dev >= NR_DEVICE)
3118 return 0;
3119
3120 (void)
3121 ((get_option(&str, &spdif[nr_dev]) == 2)
3122 && (get_option(&str, &nomix[nr_dev]) == 2)
3123 && (get_option(&str, &amplifier[nr_dev])));
3124
3125 nr_dev++;
3126 return 1;
3127}
3128
3129__setup("es1371=", es1371_setup);
3130
3131#endif /* MODULE */
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index f70286a7364a..26819e2f5761 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -191,7 +191,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
191 191
192 /* Init audio core. 192 /* Init audio core.
193 * This must be done before we do request_irq otherwise we can get spurious 193 * This must be done before we do request_irq otherwise we can get spurious
194 * interupts that we do not handle properly and make a mess of things */ 194 * interrupts that we do not handle properly and make a mess of things */
195 if ((err = vortex_core_init(chip)) != 0) { 195 if ((err = vortex_core_init(chip)) != 0) {
196 printk(KERN_ERR "hw core init failed\n"); 196 printk(KERN_ERR "hw core init failed\n");
197 goto core_out; 197 goto core_out;
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index a1aa89f2faf3..566b5ab9d4e8 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -236,8 +236,8 @@ int __init snd_pmac_attach_beep(struct snd_pmac *chip)
236 input_dev->id.product = 0x0001; 236 input_dev->id.product = 0x0001;
237 input_dev->id.version = 0x0100; 237 input_dev->id.version = 0x0100;
238 238
239 input_dev->evbit[0] = BIT(EV_SND); 239 input_dev->evbit[0] = BIT_MASK(EV_SND);
240 input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); 240 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
241 input_dev->event = snd_pmac_beep_event; 241 input_dev->event = snd_pmac_beep_event;
242 input_dev->dev.parent = &chip->pdev->dev; 242 input_dev->dev.parent = &chip->pdev->dev;
243 input_set_drvdata(input_dev, chip); 243 input_set_drvdata(input_dev, chip);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 91651bdfa761..e6a67b58f296 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -264,7 +264,7 @@ out:
264} 264}
265 265
266/* 266/*
267 * Power down the audio subsytem pmdown_time msecs after close is called. 267 * Power down the audio subsystem pmdown_time msecs after close is called.
268 * This is to ensure there are no pops or clicks in between any music tracks 268 * This is to ensure there are no pops or clicks in between any music tracks
269 * due to DAPM power cycling. 269 * due to DAPM power cycling.
270 */ 270 */
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index b3193e687db7..29a546fecacf 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -24,7 +24,7 @@
24 * o Automatic Mic Bias support 24 * o Automatic Mic Bias support
25 * o Jack insertion power event initiation - e.g. hp insertion will enable 25 * o Jack insertion power event initiation - e.g. hp insertion will enable
26 * sinks, dacs, etc 26 * sinks, dacs, etc
27 * o Delayed powerdown of audio susbsytem to reduce pops between a quick 27 * o Delayed powerdown of audio susbsystem to reduce pops between a quick
28 * device reopen. 28 * device reopen.
29 * 29 *
30 * Todo: 30 * Todo:
diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c
index 3733118d39bb..478369bb38c3 100644
--- a/sound/synth/emux/emux_synth.c
+++ b/sound/synth/emux/emux_synth.c
@@ -317,7 +317,7 @@ snd_emux_update_port(struct snd_emux_port *port, int update)
317 317
318 318
319/* 319/*
320 * Deal with a controler type event. This includes all types of 320 * Deal with a controller type event. This includes all types of
321 * control events, not just the midi controllers 321 * control events, not just the midi controllers
322 */ 322 */
323void 323void
diff --git a/sound/usb/caiaq/caiaq-input.c b/sound/usb/caiaq/caiaq-input.c
index a1de0c608957..cd536ca20e56 100644
--- a/sound/usb/caiaq/caiaq-input.c
+++ b/sound/usb/caiaq/caiaq-input.c
@@ -200,8 +200,9 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev)
200 200
201 switch (dev->chip.usb_id) { 201 switch (dev->chip.usb_id) {
202 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): 202 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2):
203 input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 203 input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
204 input->absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_Z); 204 input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) |
205 BIT_MASK(ABS_Z);
205 input->keycode = keycode_rk2; 206 input->keycode = keycode_rk2;
206 input->keycodesize = sizeof(char); 207 input->keycodesize = sizeof(char);
207 input->keycodemax = ARRAY_SIZE(keycode_rk2); 208 input->keycodemax = ARRAY_SIZE(keycode_rk2);
@@ -228,8 +229,8 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev)
228 snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); 229 snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0);
229 break; 230 break;
230 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): 231 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1):
231 input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 232 input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
232 input->absbit[0] = BIT(ABS_X); 233 input->absbit[0] = BIT_MASK(ABS_X);
233 input->keycode = keycode_ak1; 234 input->keycode = keycode_ak1;
234 input->keycodesize = sizeof(char); 235 input->keycodesize = sizeof(char);
235 input->keycodemax = ARRAY_SIZE(keycode_ak1); 236 input->keycodemax = ARRAY_SIZE(keycode_ak1);