aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DMA-API.txt4
-rw-r--r--Documentation/Intel-IOMMU.txt4
-rw-r--r--Documentation/accounting/taskstats-struct.txt2
-rw-r--r--Documentation/cpu-freq/governors.txt2
-rw-r--r--Documentation/edac.txt2
-rw-r--r--Documentation/filesystems/omfs.txt106
-rw-r--r--Documentation/filesystems/proc.txt4
-rw-r--r--Documentation/filesystems/relay.txt10
-rw-r--r--Documentation/filesystems/vfs.txt6
-rw-r--r--Documentation/ia64/kvm.txt8
-rw-r--r--Documentation/input/cs461x.txt2
-rw-r--r--Documentation/ioctl/ioctl-decoding.txt4
-rw-r--r--Documentation/iostats.txt2
-rw-r--r--Documentation/keys.txt2
-rw-r--r--Documentation/leds-class.txt2
-rw-r--r--Documentation/local_ops.txt2
-rw-r--r--Documentation/networking/bonding.txt2
-rw-r--r--Documentation/networking/can.txt4
-rw-r--r--Documentation/networking/packet_mmap.txt2
-rw-r--r--Documentation/networking/tc-actions-env-rules.txt15
-rw-r--r--Documentation/powerpc/booting-without-of.txt8
-rw-r--r--Documentation/powerpc/qe_firmware.txt2
-rw-r--r--Documentation/s390/driver-model.txt2
-rw-r--r--Documentation/scsi/ibmmca.txt6
-rw-r--r--Documentation/scsi/lpfc.txt2
-rw-r--r--Documentation/scsi/scsi_fc_transport.txt6
-rw-r--r--Documentation/sh/clk.txt2
-rw-r--r--Documentation/sound/alsa/Audiophile-Usb.txt10
-rw-r--r--Documentation/sound/alsa/hda_codec.txt2
-rw-r--r--Documentation/sound/alsa/soc/dapm.txt2
-rw-r--r--Documentation/sysctl/vm.txt2
-rw-r--r--Documentation/timers/highres.txt2
-rw-r--r--Documentation/usb/authorization.txt2
-rw-r--r--Documentation/video4linux/sn9c102.txt2
-rw-r--r--Documentation/vm/hugetlbpage.txt2
-rw-r--r--Documentation/vm/numa_memory_policy.txt4
-rw-r--r--Documentation/volatile-considered-harmful.txt2
-rw-r--r--MAINTAINERS6
-rw-r--r--arch/Kconfig18
-rw-r--r--arch/alpha/mm/init.c30
-rw-r--r--arch/alpha/mm/numa.c35
-rw-r--r--arch/arm/common/dmabounce.c2
-rw-r--r--arch/arm/plat-s3c24xx/dma.c2
-rw-r--r--arch/avr32/mm/init.c39
-rw-r--r--arch/blackfin/Kconfig100
-rw-r--r--arch/blackfin/Kconfig.debug7
-rw-r--r--arch/blackfin/Makefile5
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig187
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig279
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig340
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig337
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig65
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig273
-rw-r--r--arch/blackfin/configs/CM-BF527_defconfig1185
-rw-r--r--arch/blackfin/configs/CM-BF533_defconfig14
-rw-r--r--arch/blackfin/configs/CM-BF537E_defconfig21
-rw-r--r--arch/blackfin/configs/CM-BF537U_defconfig18
-rw-r--r--arch/blackfin/configs/CM-BF548_defconfig10
-rw-r--r--arch/blackfin/configs/CM-BF561_defconfig14
-rw-r--r--arch/blackfin/configs/H8606_defconfig2
-rw-r--r--arch/blackfin/configs/IP0X_defconfig2
-rw-r--r--arch/blackfin/configs/PNAV-10_defconfig4
-rw-r--r--arch/blackfin/configs/SRV1_defconfig2
-rw-r--r--arch/blackfin/kernel/Makefile1
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c34
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c118
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbhdlr.S2
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c6
-rw-r--r--arch/blackfin/kernel/dualcore_test.c49
-rw-r--r--arch/blackfin/kernel/entry.S5
-rw-r--r--arch/blackfin/kernel/kgdb.c16
-rw-r--r--arch/blackfin/kernel/module.c74
-rw-r--r--arch/blackfin/kernel/ptrace.c28
-rw-r--r--arch/blackfin/kernel/setup.c90
-rw-r--r--arch/blackfin/kernel/traps.c296
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S40
-rw-r--r--arch/blackfin/mach-bf527/boards/Kconfig5
-rw-r--r--arch/blackfin/mach-bf527/boards/Makefile1
-rw-r--r--arch/blackfin/mach-bf527/boards/cm_bf527.c1011
-rw-r--r--arch/blackfin/mach-bf527/head.S12
-rw-r--r--arch/blackfin/mach-bf533/head.S12
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c88
-rw-r--r--arch/blackfin/mach-bf537/head.S12
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c44
-rw-r--r--arch/blackfin/mach-bf548/head.S6
-rw-r--r--arch/blackfin/mach-bf561/head.S6
-rw-r--r--arch/blackfin/mach-common/arch_checks.c6
-rw-r--r--arch/blackfin/mach-common/dpmc_modes.S607
-rw-r--r--arch/blackfin/mach-common/entry.S50
-rw-r--r--arch/blackfin/mach-common/ints-priority.c4
-rw-r--r--arch/blackfin/mach-common/pm.c225
-rw-r--r--arch/blackfin/mm/blackfin_sram.c543
-rw-r--r--arch/blackfin/mm/blackfin_sram.h4
-rw-r--r--arch/blackfin/mm/init.c39
-rw-r--r--arch/cris/arch-v10/kernel/kgdb.c79
-rw-r--r--arch/cris/arch-v32/kernel/kgdb.c60
-rw-r--r--arch/cris/mm/init.c30
-rw-r--r--arch/frv/kernel/gdb-stub.c88
-rw-r--r--arch/frv/mm/init.c31
-rw-r--r--arch/h8300/mm/init.c27
-rw-r--r--arch/ia64/hp/common/hwsw_iommu.c5
-rw-r--r--arch/ia64/hp/common/sba_iommu.c2
-rw-r--r--arch/ia64/kernel/perfmon.c4
-rw-r--r--arch/ia64/sn/pci/pci_dma.c2
-rw-r--r--arch/m32r/mm/init.c36
-rw-r--r--arch/m68k/mm/init.c30
-rw-r--r--arch/m68knommu/mm/init.c27
-rw-r--r--arch/mips/mm/Makefile3
-rw-r--r--arch/mips/mm/dma-default.c2
-rw-r--r--arch/mips/mm/pgtable.c36
-rw-r--r--arch/mn10300/kernel/gdb-stub.c108
-rw-r--r--arch/mn10300/mm/pgtable.c27
-rw-r--r--arch/powerpc/kernel/machine_kexec.c2
-rw-r--r--arch/powerpc/kernel/rtas_flash.c2
-rw-r--r--arch/powerpc/mm/hugetlbpage.c9
-rw-r--r--arch/powerpc/mm/init_64.c24
-rw-r--r--arch/powerpc/mm/mem.c39
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_pciex.c2
-rw-r--r--arch/powerpc/platforms/cell/spider-pci.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c2
-rw-r--r--arch/powerpc/platforms/iseries/mf.c2
-rw-r--r--arch/s390/mm/init.c32
-rw-r--r--arch/sh/kernel/machine_kexec.c2
-rw-r--r--arch/sh/mm/init.c41
-rw-r--r--arch/sh/mm/pmb.c2
-rw-r--r--arch/sparc64/mm/init.c45
-rw-r--r--arch/um/kernel/mem.c31
-rw-r--r--arch/x86/Kconfig9
-rw-r--r--arch/x86/ia32/ia32_aout.c6
-rw-r--r--arch/x86/kernel/machine_kexec_32.c39
-rw-r--r--arch/x86/kernel/machine_kexec_64.c2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c73
-rw-r--r--arch/x86/kernel/pci-dma.c27
-rw-r--r--arch/x86/kernel/pci-gart_64.c3
-rw-r--r--arch/x86/kernel/pci-nommu.c14
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c2
-rw-r--r--arch/x86/kernel/relocate_kernel_32.S174
-rw-r--r--arch/x86/mm/Makefile1
-rw-r--r--arch/x86/mm/gup.c295
-rw-r--r--arch/x86/mm/init_64.c37
-rw-r--r--arch/x86/mm/pgtable_32.c47
-rw-r--r--arch/xtensa/mm/init.c29
-rw-r--r--block/as-iosched.c3
-rw-r--r--block/blk-map.c8
-rw-r--r--drivers/base/core.c6
-rw-r--r--drivers/base/isa.c4
-rw-r--r--drivers/base/memory.c3
-rw-r--r--drivers/base/sys.c12
-rw-r--r--drivers/char/dsp56k.c4
-rw-r--r--drivers/char/rtc.c5
-rw-r--r--drivers/char/tpm/tpm.c128
-rw-r--r--drivers/char/tpm/tpm_bios.c4
-rw-r--r--drivers/char/tpm/tpm_tis.c1
-rw-r--r--drivers/firewire/fw-iso.c2
-rw-r--r--drivers/firewire/fw-ohci.c2
-rw-r--r--drivers/firewire/fw-sbp2.c8
-rw-r--r--drivers/gpu/drm/drm_drv.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sdma.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_user_sdma.c6
-rw-r--r--drivers/infiniband/hw/mthca/mthca_eq.c2
-rw-r--r--drivers/isdn/hisax/hisax_fcpcipnp.c2
-rw-r--r--drivers/media/dvb/pluto2/pluto2.c2
-rw-r--r--drivers/memstick/core/memstick.c36
-rw-r--r--drivers/memstick/core/mspro_block.c365
-rw-r--r--drivers/memstick/host/jmb38x_ms.c102
-rw-r--r--drivers/memstick/host/tifm_ms.c66
-rw-r--r--drivers/message/fusion/lsi/mpi_history.txt6
-rw-r--r--drivers/mfd/asic3.c8
-rw-r--r--drivers/mmc/host/sdhci.c4
-rw-r--r--drivers/mmc/host/sdhci.h2
-rw-r--r--drivers/net/arm/ep93xx_eth.c4
-rw-r--r--drivers/net/bnx2x_main.c4
-rw-r--r--drivers/net/cassini.c12
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000e/ethtool.c4
-rw-r--r--drivers/net/e1000e/netdev.c11
-rw-r--r--drivers/net/ibmveth.c38
-rw-r--r--drivers/net/iseries_veth.c4
-rw-r--r--drivers/net/mlx4/eq.c2
-rw-r--r--drivers/net/pasemi_mac.c6
-rw-r--r--drivers/net/qla3xxx.c12
-rw-r--r--drivers/net/s2io.c48
-rw-r--r--drivers/net/sfc/rx.c4
-rw-r--r--drivers/net/sfc/tx.c7
-rw-r--r--drivers/net/spider_net.c4
-rw-r--r--drivers/net/tc35815.c4
-rw-r--r--drivers/net/wireless/ath5k/base.c4
-rw-r--r--drivers/parport/ieee1284.c2
-rw-r--r--drivers/parport/parport_cs.c2
-rw-r--r--drivers/parport/parport_pc.c2
-rw-r--r--drivers/parport/procfs.c3
-rw-r--r--drivers/pnp/base.h1
-rw-r--r--drivers/pnp/card.c6
-rw-r--r--drivers/pnp/quirks.c13
-rw-r--r--drivers/scsi/ibmvscsi/ibmvfc.c4
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.c4
-rw-r--r--drivers/scsi/ibmvscsi/ibmvstgt.c2
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c2
-rw-r--r--drivers/spi/atmel_spi.c4
-rw-r--r--drivers/spi/au1550_spi.c6
-rw-r--r--drivers/spi/omap2_mcspi.c4
-rw-r--r--drivers/spi/pxa2xx_spi.c4
-rw-r--r--drivers/spi/spi_imx.c6
-rw-r--r--drivers/usb/mon/mon_text.c4
-rw-r--r--drivers/video/console/sticon.c2
-rw-r--r--drivers/video/console/sticore.c33
-rw-r--r--drivers/video/fbmem.c1
-rw-r--r--drivers/video/macfb.c2
-rw-r--r--drivers/video/sticore.h2
-rw-r--r--drivers/video/stifb.c6
-rw-r--r--fs/Kconfig13
-rw-r--r--fs/Makefile1
-rw-r--r--fs/adfs/super.c2
-rw-r--r--fs/affs/affs.h3
-rw-r--r--fs/affs/bitmap.c18
-rw-r--r--fs/affs/super.c4
-rw-r--r--fs/afs/super.c4
-rw-r--r--fs/befs/linuxvfs.c2
-rw-r--r--fs/bfs/bfs.h5
-rw-r--r--fs/bfs/dir.c46
-rw-r--r--fs/bfs/file.c4
-rw-r--r--fs/bfs/inode.c29
-rw-r--r--fs/binfmt_aout.c6
-rw-r--r--fs/binfmt_elf.c6
-rw-r--r--fs/binfmt_elf_fdpic.c7
-rw-r--r--fs/binfmt_flat.c3
-rw-r--r--fs/binfmt_som.c2
-rw-r--r--fs/bio.c8
-rw-r--r--fs/block_dev.c2
-rw-r--r--fs/buffer.c9
-rw-r--r--fs/cifs/asn1.c4
-rw-r--r--fs/cifs/cifs_debug.c645
-rw-r--r--fs/cifs/cifsacl.c41
-rw-r--r--fs/cifs/cifsencrypt.c3
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/cifs/cifsglob.h6
-rw-r--r--fs/cifs/cifspdu.h8
-rw-r--r--fs/cifs/cifssmb.c10
-rw-r--r--fs/cifs/connect.c37
-rw-r--r--fs/cifs/inode.c151
-rw-r--r--fs/cifs/readdir.c1
-rw-r--r--fs/coda/inode.c2
-rw-r--r--fs/dcache.c1
-rw-r--r--fs/direct-io.c10
-rw-r--r--fs/ecryptfs/main.c4
-rw-r--r--fs/efs/super.c2
-rw-r--r--fs/exec.c12
-rw-r--r--fs/ext2/super.c2
-rw-r--r--fs/ext3/super.c2
-rw-r--r--fs/ext4/super.c2
-rw-r--r--fs/fat/cache.c2
-rw-r--r--fs/fat/inode.c2
-rw-r--r--fs/fuse/inode.c2
-rw-r--r--fs/gfs2/main.c4
-rw-r--r--fs/hfs/super.c2
-rw-r--r--fs/hfsplus/super.c2
-rw-r--r--fs/hpfs/super.c2
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--fs/inode.c4
-rw-r--r--fs/isofs/inode.c2
-rw-r--r--fs/jffs2/super.c2
-rw-r--r--fs/jfs/jfs_metapage.c2
-rw-r--r--fs/jfs/super.c2
-rw-r--r--fs/locks.c2
-rw-r--r--fs/minix/inode.c2
-rw-r--r--fs/namespace.c3
-rw-r--r--fs/ncpfs/inode.c2
-rw-r--r--fs/nfs/inode.c2
-rw-r--r--fs/ntfs/super.c2
-rw-r--r--fs/ocfs2/dlm/dlmfs.c3
-rw-r--r--fs/ocfs2/super.c2
-rw-r--r--fs/omfs/Makefile4
-rw-r--r--fs/omfs/bitmap.c192
-rw-r--r--fs/omfs/dir.c504
-rw-r--r--fs/omfs/file.c346
-rw-r--r--fs/omfs/inode.c553
-rw-r--r--fs/omfs/omfs.h67
-rw-r--r--fs/omfs/omfs_fs.h80
-rw-r--r--fs/openpromfs/inode.c2
-rw-r--r--fs/proc/array.c9
-rw-r--r--fs/proc/base.c39
-rw-r--r--fs/proc/generic.c5
-rw-r--r--fs/proc/inode.c2
-rw-r--r--fs/qnx4/inode.c2
-rw-r--r--fs/reiserfs/super.c2
-rw-r--r--fs/romfs/inode.c2
-rw-r--r--fs/smbfs/inode.c2
-rw-r--r--fs/splice.c41
-rw-r--r--fs/sysfs/dir.c5
-rw-r--r--fs/sysfs/file.c3
-rw-r--r--fs/sysfs/group.c3
-rw-r--r--fs/sysv/inode.c2
-rw-r--r--fs/ubifs/super.c2
-rw-r--r--fs/udf/super.c2
-rw-r--r--fs/ufs/super.c2
-rw-r--r--fs/xfs/linux-2.6/kmem.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c1
-rw-r--r--include/asm-alpha/dma-mapping.h6
-rw-r--r--include/asm-alpha/pci.h2
-rw-r--r--include/asm-arm/cacheflush.h4
-rw-r--r--include/asm-arm/dma-mapping.h2
-rw-r--r--include/asm-avr32/dma-mapping.h2
-rw-r--r--include/asm-blackfin/bfin-global.h8
-rw-r--r--include/asm-blackfin/dma.h8
-rw-r--r--include/asm-blackfin/dpmc.h82
-rw-r--r--include/asm-blackfin/elf.h2
-rw-r--r--include/asm-blackfin/gpio.h19
-rw-r--r--include/asm-blackfin/mach-bf527/anomaly.h2
-rw-r--r--include/asm-blackfin/mach-bf527/bfin_sir.h21
-rw-r--r--include/asm-blackfin/mach-bf527/defBF527.h1
-rw-r--r--include/asm-blackfin/mach-bf527/mem_init.h27
-rw-r--r--include/asm-blackfin/mach-bf533/bfin_sir.h13
-rw-r--r--include/asm-blackfin/mach-bf533/mem_init.h27
-rw-r--r--include/asm-blackfin/mach-bf537/bfin_sir.h21
-rw-r--r--include/asm-blackfin/mach-bf537/defBF537.h1
-rw-r--r--include/asm-blackfin/mach-bf537/mem_init.h27
-rw-r--r--include/asm-blackfin/mach-bf548/bfin_sir.h37
-rw-r--r--include/asm-blackfin/mach-bf548/gpio.h8
-rw-r--r--include/asm-blackfin/mach-bf561/bfin_sir.h13
-rw-r--r--include/asm-blackfin/mach-bf561/mem_init.h27
-rw-r--r--include/asm-blackfin/module.h5
-rw-r--r--include/asm-blackfin/processor.h21
-rw-r--r--include/asm-cris/dma-mapping.h2
-rw-r--r--include/asm-frv/dma-mapping.h2
-rw-r--r--include/asm-generic/dma-mapping-broken.h2
-rw-r--r--include/asm-generic/dma-mapping.h4
-rw-r--r--include/asm-generic/pci-dma-compat.h4
-rw-r--r--include/asm-generic/syscall.h141
-rw-r--r--include/asm-generic/vmlinux.lds.h2
-rw-r--r--include/asm-ia64/machvec.h2
-rw-r--r--include/asm-m68k/dma-mapping.h2
-rw-r--r--include/asm-mips/dma-mapping.h2
-rw-r--r--include/asm-mn10300/dma-mapping.h2
-rw-r--r--include/asm-parisc/cacheflush.h4
-rw-r--r--include/asm-parisc/dma-mapping.h2
-rw-r--r--include/asm-powerpc/dma-mapping.h2
-rw-r--r--include/asm-sh/dma-mapping.h2
-rw-r--r--include/asm-sparc/dma-mapping_64.h2
-rw-r--r--include/asm-sparc/pci_32.h3
-rw-r--r--include/asm-sparc/pci_64.h5
-rw-r--r--include/asm-x86/device.h3
-rw-r--r--include/asm-x86/dma-mapping.h99
-rw-r--r--include/asm-x86/iommu.h1
-rw-r--r--include/asm-x86/kexec.h18
-rw-r--r--include/asm-x86/pgtable.h9
-rw-r--r--include/asm-x86/swiotlb.h2
-rw-r--r--include/asm-x86/uaccess.h1
-rw-r--r--include/asm-xtensa/dma-mapping.h2
-rw-r--r--include/linux/aio.h1
-rw-r--r--include/linux/fs.h2
-rw-r--r--include/linux/i2o.h2
-rw-r--r--include/linux/init.h7
-rw-r--r--include/linux/kexec.h17
-rw-r--r--include/linux/memstick.h6
-rw-r--r--include/linux/mm.h34
-rw-r--r--include/linux/pagemap.h111
-rw-r--r--include/linux/parport.h3
-rw-r--r--include/linux/percpu.h29
-rw-r--r--include/linux/ptrace.h72
-rw-r--r--include/linux/radix-tree.h12
-rw-r--r--include/linux/relay.h5
-rw-r--r--include/linux/rtc.h2
-rw-r--r--include/linux/sched.h28
-rw-r--r--include/linux/slab.h2
-rw-r--r--include/linux/slub_def.h2
-rw-r--r--include/linux/smp.h5
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/suspend.h2
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/tracehook.h575
-rw-r--r--include/rdma/ib_verbs.h2
-rw-r--r--include/video/atmel_lcdc.h1
-rw-r--r--init/do_mounts.c2
-rw-r--r--init/do_mounts.h1
-rw-r--r--init/main.c22
-rw-r--r--ipc/mqueue.c2
-rw-r--r--kernel/cgroup.c2
-rw-r--r--kernel/exit.c53
-rw-r--r--kernel/fork.c76
-rw-r--r--kernel/irq/chip.c12
-rw-r--r--kernel/irq/manage.c3
-rw-r--r--kernel/kexec.c104
-rw-r--r--kernel/kthread.c2
-rw-r--r--kernel/power/main.c7
-rw-r--r--kernel/power/power.h2
-rw-r--r--kernel/ptrace.c2
-rw-r--r--kernel/relay.c170
-rw-r--r--kernel/sched.c34
-rw-r--r--kernel/signal.c99
-rw-r--r--kernel/smp.c4
-rw-r--r--kernel/softirq.c3
-rw-r--r--kernel/softlockup.c25
-rw-r--r--kernel/sys.c31
-rw-r--r--lib/Makefile4
-rw-r--r--lib/debugobjects.c15
-rw-r--r--lib/idr.c2
-rw-r--r--lib/iomap.c3
-rw-r--r--lib/kobject_uevent.c6
-rw-r--r--lib/plist.c13
-rw-r--r--lib/radix-tree.c180
-rw-r--r--lib/show_mem.c63
-rw-r--r--lib/swiotlb.c4
-rw-r--r--lib/syscall.c75
-rw-r--r--mm/Kconfig3
-rw-r--r--mm/allocpercpu.c20
-rw-r--r--mm/filemap.c221
-rw-r--r--mm/hugetlb.c24
-rw-r--r--mm/memory.c3
-rw-r--r--mm/migrate.c29
-rw-r--r--mm/nommu.c4
-rw-r--r--mm/page-writeback.c12
-rw-r--r--mm/readahead.c6
-rw-r--r--mm/rmap.c2
-rw-r--r--mm/shmem.c8
-rw-r--r--mm/slab.c11
-rw-r--r--mm/slob.c7
-rw-r--r--mm/slub.c13
-rw-r--r--mm/sparse.c2
-rw-r--r--mm/swap_state.c30
-rw-r--r--mm/swapfile.c10
-rw-r--r--mm/truncate.c6
-rw-r--r--mm/util.c10
-rw-r--r--mm/vmalloc.c6
-rw-r--r--mm/vmscan.c80
-rw-r--r--net/socket.c2
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rw-r--r--net/sunrpc/xprtrdma/svc_rdma_sendto.c3
-rw-r--r--security/selinux/hooks.c22
429 files changed, 11135 insertions, 4444 deletions
diff --git a/Documentation/DMA-API.txt b/Documentation/DMA-API.txt
index 80d150458c80..d8b63d164e41 100644
--- a/Documentation/DMA-API.txt
+++ b/Documentation/DMA-API.txt
@@ -298,10 +298,10 @@ recommended that you never use these unless you really know what the
298cache width is. 298cache width is.
299 299
300int 300int
301dma_mapping_error(dma_addr_t dma_addr) 301dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
302 302
303int 303int
304pci_dma_mapping_error(dma_addr_t dma_addr) 304pci_dma_mapping_error(struct pci_dev *hwdev, dma_addr_t dma_addr)
305 305
306In some circumstances dma_map_single and dma_map_page will fail to create 306In some circumstances dma_map_single and dma_map_page will fail to create
307a mapping. A driver can check for these errors by testing the returned 307a mapping. A driver can check for these errors by testing the returned
diff --git a/Documentation/Intel-IOMMU.txt b/Documentation/Intel-IOMMU.txt
index c2321903aa09..21bc416d887e 100644
--- a/Documentation/Intel-IOMMU.txt
+++ b/Documentation/Intel-IOMMU.txt
@@ -48,7 +48,7 @@ IOVA generation is pretty generic. We used the same technique as vmalloc()
48but these are not global address spaces, but separate for each domain. 48but these are not global address spaces, but separate for each domain.
49Different DMA engines may support different number of domains. 49Different DMA engines may support different number of domains.
50 50
51We also allocate gaurd pages with each mapping, so we can attempt to catch 51We also allocate guard pages with each mapping, so we can attempt to catch
52any overflow that might happen. 52any overflow that might happen.
53 53
54 54
@@ -112,4 +112,4 @@ TBD
112 112
113- For compatibility testing, could use unity map domain for all devices, just 113- For compatibility testing, could use unity map domain for all devices, just
114 provide a 1-1 for all useful memory under a single domain for all devices. 114 provide a 1-1 for all useful memory under a single domain for all devices.
115- API for paravirt ops for abstracting functionlity for VMM folks. 115- API for paravirt ops for abstracting functionality for VMM folks.
diff --git a/Documentation/accounting/taskstats-struct.txt b/Documentation/accounting/taskstats-struct.txt
index b988d110db59..e7512c061c15 100644
--- a/Documentation/accounting/taskstats-struct.txt
+++ b/Documentation/accounting/taskstats-struct.txt
@@ -6,7 +6,7 @@ This document contains an explanation of the struct taskstats fields.
6There are three different groups of fields in the struct taskstats: 6There are three different groups of fields in the struct taskstats:
7 7
81) Common and basic accounting fields 81) Common and basic accounting fields
9 If CONFIG_TASKSTATS is set, the taskstats inteface is enabled and 9 If CONFIG_TASKSTATS is set, the taskstats interface is enabled and
10 the common fields and basic accounting fields are collected for 10 the common fields and basic accounting fields are collected for
11 delivery at do_exit() of a task. 11 delivery at do_exit() of a task.
122) Delay accounting fields 122) Delay accounting fields
diff --git a/Documentation/cpu-freq/governors.txt b/Documentation/cpu-freq/governors.txt
index dcec0564d040..5b0cfa67aff9 100644
--- a/Documentation/cpu-freq/governors.txt
+++ b/Documentation/cpu-freq/governors.txt
@@ -122,7 +122,7 @@ around '10000' or more.
122show_sampling_rate_(min|max): the minimum and maximum sampling rates 122show_sampling_rate_(min|max): the minimum and maximum sampling rates
123available that you may set 'sampling_rate' to. 123available that you may set 'sampling_rate' to.
124 124
125up_threshold: defines what the average CPU usaged between the samplings 125up_threshold: defines what the average CPU usage between the samplings
126of 'sampling_rate' needs to be for the kernel to make a decision on 126of 'sampling_rate' needs to be for the kernel to make a decision on
127whether it should increase the frequency. For example when it is set 127whether it should increase the frequency. For example when it is set
128to its default value of '80' it means that between the checking 128to its default value of '80' it means that between the checking
diff --git a/Documentation/edac.txt b/Documentation/edac.txt
index ced527388001..8eda3fb66416 100644
--- a/Documentation/edac.txt
+++ b/Documentation/edac.txt
@@ -327,7 +327,7 @@ Sdram memory scrubbing rate:
327 'sdram_scrub_rate' 327 'sdram_scrub_rate'
328 328
329 Read/Write attribute file that controls memory scrubbing. The scrubbing 329 Read/Write attribute file that controls memory scrubbing. The scrubbing
330 rate is set by writing a minimum bandwith in bytes/sec to the attribute 330 rate is set by writing a minimum bandwidth in bytes/sec to the attribute
331 file. The rate will be translated to an internal value that gives at 331 file. The rate will be translated to an internal value that gives at
332 least the specified rate. 332 least the specified rate.
333 333
diff --git a/Documentation/filesystems/omfs.txt b/Documentation/filesystems/omfs.txt
new file mode 100644
index 000000000000..1d0d41ff5c65
--- /dev/null
+++ b/Documentation/filesystems/omfs.txt
@@ -0,0 +1,106 @@
1Optimized MPEG Filesystem (OMFS)
2
3Overview
4========
5
6OMFS is a filesystem created by SonicBlue for use in the ReplayTV DVR
7and Rio Karma MP3 player. The filesystem is extent-based, utilizing
8block sizes from 2k to 8k, with hash-based directories. This
9filesystem driver may be used to read and write disks from these
10devices.
11
12Note, it is not recommended that this FS be used in place of a general
13filesystem for your own streaming media device. Native Linux filesystems
14will likely perform better.
15
16More information is available at:
17
18 http://linux-karma.sf.net/
19
20Various utilities, including mkomfs and omfsck, are included with
21omfsprogs, available at:
22
23 http://bobcopeland.com/karma/
24
25Instructions are included in its README.
26
27Options
28=======
29
30OMFS supports the following mount-time options:
31
32 uid=n - make all files owned by specified user
33 gid=n - make all files owned by specified group
34 umask=xxx - set permission umask to xxx
35 fmask=xxx - set umask to xxx for files
36 dmask=xxx - set umask to xxx for directories
37
38Disk format
39===========
40
41OMFS discriminates between "sysblocks" and normal data blocks. The sysblock
42group consists of super block information, file metadata, directory structures,
43and extents. Each sysblock has a header containing CRCs of the entire
44sysblock, and may be mirrored in successive blocks on the disk. A sysblock may
45have a smaller size than a data block, but since they are both addressed by the
46same 64-bit block number, any remaining space in the smaller sysblock is
47unused.
48
49Sysblock header information:
50
51struct omfs_header {
52 __be64 h_self; /* FS block where this is located */
53 __be32 h_body_size; /* size of useful data after header */
54 __be16 h_crc; /* crc-ccitt of body_size bytes */
55 char h_fill1[2];
56 u8 h_version; /* version, always 1 */
57 char h_type; /* OMFS_INODE_X */
58 u8 h_magic; /* OMFS_IMAGIC */
59 u8 h_check_xor; /* XOR of header bytes before this */
60 __be32 h_fill2;
61};
62
63Files and directories are both represented by omfs_inode:
64
65struct omfs_inode {
66 struct omfs_header i_head; /* header */
67 __be64 i_parent; /* parent containing this inode */
68 __be64 i_sibling; /* next inode in hash bucket */
69 __be64 i_ctime; /* ctime, in milliseconds */
70 char i_fill1[35];
71 char i_type; /* OMFS_[DIR,FILE] */
72 __be32 i_fill2;
73 char i_fill3[64];
74 char i_name[OMFS_NAMELEN]; /* filename */
75 __be64 i_size; /* size of file, in bytes */
76};
77
78Directories in OMFS are implemented as a large hash table. Filenames are
79hashed then prepended into the bucket list beginning at OMFS_DIR_START.
80Lookup requires hashing the filename, then seeking across i_sibling pointers
81until a match is found on i_name. Empty buckets are represented by block
82pointers with all-1s (~0).
83
84A file is an omfs_inode structure followed by an extent table beginning at
85OMFS_EXTENT_START:
86
87struct omfs_extent_entry {
88 __be64 e_cluster; /* start location of a set of blocks */
89 __be64 e_blocks; /* number of blocks after e_cluster */
90};
91
92struct omfs_extent {
93 __be64 e_next; /* next extent table location */
94 __be32 e_extent_count; /* total # extents in this table */
95 __be32 e_fill;
96 struct omfs_extent_entry e_entry; /* start of extent entries */
97};
98
99Each extent holds the block offset followed by number of blocks allocated to
100the extent. The final extent in each table is a terminator with e_cluster
101being ~0 and e_blocks being ones'-complement of the total number of blocks
102in the table.
103
104If this table overflows, a continuation inode is written and pointed to by
105e_next. These have a header but lack the rest of the inode structure.
106
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 8c6384bdfed4..64557821ee59 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -931,7 +931,7 @@ group_prealloc max_to_scan mb_groups mb_history min_to_scan order2_req
931stats stream_req 931stats stream_req
932 932
933mb_groups: 933mb_groups:
934This file gives the details of mutiblock allocator buddy cache of free blocks 934This file gives the details of multiblock allocator buddy cache of free blocks
935 935
936mb_history: 936mb_history:
937Multiblock allocation history. 937Multiblock allocation history.
@@ -1474,7 +1474,7 @@ used because pages_free(1355) is smaller than watermark + protection[2]
1474normal page requirement. If requirement is DMA zone(index=0), protection[0] 1474normal page requirement. If requirement is DMA zone(index=0), protection[0]
1475(=0) is used. 1475(=0) is used.
1476 1476
1477zone[i]'s protection[j] is calculated by following exprssion. 1477zone[i]'s protection[j] is calculated by following expression.
1478 1478
1479(i < j): 1479(i < j):
1480 zone[i]->protection[j] 1480 zone[i]->protection[j]
diff --git a/Documentation/filesystems/relay.txt b/Documentation/filesystems/relay.txt
index 094f2d2f38b1..510b722667ac 100644
--- a/Documentation/filesystems/relay.txt
+++ b/Documentation/filesystems/relay.txt
@@ -294,6 +294,16 @@ user-defined data with a channel, and is immediately available
294(including in create_buf_file()) via chan->private_data or 294(including in create_buf_file()) via chan->private_data or
295buf->chan->private_data. 295buf->chan->private_data.
296 296
297Buffer-only channels
298--------------------
299
300These channels have no files associated and can be created with
301relay_open(NULL, NULL, ...). Such channels are useful in scenarios such
302as when doing early tracing in the kernel, before the VFS is up. In these
303cases, one may open a buffer-only channel and then call
304relay_late_setup_files() when the kernel is ready to handle files,
305to expose the buffered data to the userspace.
306
297Channel 'modes' 307Channel 'modes'
298--------------- 308---------------
299 309
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index b7522c6cbae3..c4d348dabe94 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -143,7 +143,7 @@ struct file_system_type {
143 143
144The get_sb() method has the following arguments: 144The get_sb() method has the following arguments:
145 145
146 struct file_system_type *fs_type: decribes the filesystem, partly initialized 146 struct file_system_type *fs_type: describes the filesystem, partly initialized
147 by the specific filesystem code 147 by the specific filesystem code
148 148
149 int flags: mount flags 149 int flags: mount flags
@@ -895,9 +895,9 @@ struct dentry_operations {
895 iput() yourself 895 iput() yourself
896 896
897 d_dname: called when the pathname of a dentry should be generated. 897 d_dname: called when the pathname of a dentry should be generated.
898 Usefull for some pseudo filesystems (sockfs, pipefs, ...) to delay 898 Useful for some pseudo filesystems (sockfs, pipefs, ...) to delay
899 pathname generation. (Instead of doing it when dentry is created, 899 pathname generation. (Instead of doing it when dentry is created,
900 its done only when the path is needed.). Real filesystems probably 900 it's done only when the path is needed.). Real filesystems probably
901 dont want to use it, because their dentries are present in global 901 dont want to use it, because their dentries are present in global
902 dcache hash, so their hash should be an invariant. As no lock is 902 dcache hash, so their hash should be an invariant. As no lock is
903 held, d_dname() should not try to modify the dentry itself, unless 903 held, d_dname() should not try to modify the dentry itself, unless
diff --git a/Documentation/ia64/kvm.txt b/Documentation/ia64/kvm.txt
index bec9d815da33..914d07f49268 100644
--- a/Documentation/ia64/kvm.txt
+++ b/Documentation/ia64/kvm.txt
@@ -50,9 +50,9 @@ Note: For step 2, please make sure that host page size == TARGET_PAGE_SIZE of qe
50 /usr/local/bin/qemu-system-ia64 -smp xx -m 512 -hda $your_image 50 /usr/local/bin/qemu-system-ia64 -smp xx -m 512 -hda $your_image
51 (xx is the number of virtual processors for the guest, now the maximum value is 4) 51 (xx is the number of virtual processors for the guest, now the maximum value is 4)
52 52
535. Known possibile issue on some platforms with old Firmware. 535. Known possible issue on some platforms with old Firmware.
54 54
55If meet strange host crashe issues, try to solve it through either of the following ways: 55In the event of strange host crash issues, try to solve it through either of the following ways:
56 56
57(1): Upgrade your Firmware to the latest one. 57(1): Upgrade your Firmware to the latest one.
58 58
@@ -65,8 +65,8 @@ index 0b53344..f02b0f7 100644
65 mov ar.pfs = loc1 65 mov ar.pfs = loc1
66 mov rp = loc0 66 mov rp = loc0
67 ;; 67 ;;
68- srlz.d // seralize restoration of psr.l 68- srlz.d // serialize restoration of psr.l
69+ srlz.i // seralize restoration of psr.l 69+ srlz.i // serialize restoration of psr.l
70+ ;; 70+ ;;
71 br.ret.sptk.many b0 71 br.ret.sptk.many b0
72 END(ia64_pal_call_static) 72 END(ia64_pal_call_static)
diff --git a/Documentation/input/cs461x.txt b/Documentation/input/cs461x.txt
index afe0d6543e09..202e9dbacec3 100644
--- a/Documentation/input/cs461x.txt
+++ b/Documentation/input/cs461x.txt
@@ -31,7 +31,7 @@ The driver works with ALSA drivers simultaneously. For example, the xracer
31uses joystick as input device and PCM device as sound output in one time. 31uses joystick as input device and PCM device as sound output in one time.
32There are no sound or input collisions detected. The source code have 32There are no sound or input collisions detected. The source code have
33comments about them; but I've found the joystick can be initialized 33comments about them; but I've found the joystick can be initialized
34separately of ALSA modules. So, you canm use only one joystick driver 34separately of ALSA modules. So, you can use only one joystick driver
35without ALSA drivers. The ALSA drivers are not needed to compile or 35without ALSA drivers. The ALSA drivers are not needed to compile or
36run this driver. 36run this driver.
37 37
diff --git a/Documentation/ioctl/ioctl-decoding.txt b/Documentation/ioctl/ioctl-decoding.txt
index bfdf7f3ee4f0..e35efb0cec2e 100644
--- a/Documentation/ioctl/ioctl-decoding.txt
+++ b/Documentation/ioctl/ioctl-decoding.txt
@@ -1,6 +1,6 @@
1To decode a hex IOCTL code: 1To decode a hex IOCTL code:
2 2
3Most architecures use this generic format, but check 3Most architectures use this generic format, but check
4include/ARCH/ioctl.h for specifics, e.g. powerpc 4include/ARCH/ioctl.h for specifics, e.g. powerpc
5uses 3 bits to encode read/write and 13 bits for size. 5uses 3 bits to encode read/write and 13 bits for size.
6 6
@@ -18,7 +18,7 @@ uses 3 bits to encode read/write and 13 bits for size.
18 7-0 function # 18 7-0 function #
19 19
20 20
21 So for example 0x82187201 is a read with arg length of 0x218, 21So for example 0x82187201 is a read with arg length of 0x218,
22character 'r' function 1. Grepping the source reveals this is: 22character 'r' function 1. Grepping the source reveals this is:
23 23
24#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2]) 24#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct dirent [2])
diff --git a/Documentation/iostats.txt b/Documentation/iostats.txt
index 5925c3cd030d..59a69ec67c40 100644
--- a/Documentation/iostats.txt
+++ b/Documentation/iostats.txt
@@ -143,7 +143,7 @@ disk and partition statistics are consistent again. Since we still don't
143keep record of the partition-relative address, an operation is attributed to 143keep record of the partition-relative address, an operation is attributed to
144the partition which contains the first sector of the request after the 144the partition which contains the first sector of the request after the
145eventual merges. As requests can be merged across partition, this could lead 145eventual merges. As requests can be merged across partition, this could lead
146to some (probably insignificant) innacuracy. 146to some (probably insignificant) inaccuracy.
147 147
148Additional notes 148Additional notes
149---------------- 149----------------
diff --git a/Documentation/keys.txt b/Documentation/keys.txt
index d5c7a57d1700..b56aacc1fff8 100644
--- a/Documentation/keys.txt
+++ b/Documentation/keys.txt
@@ -864,7 +864,7 @@ payload contents" for more information.
864 request_key_with_auxdata() respectively. 864 request_key_with_auxdata() respectively.
865 865
866 These two functions return with the key potentially still under 866 These two functions return with the key potentially still under
867 construction. To wait for contruction completion, the following should be 867 construction. To wait for construction completion, the following should be
868 called: 868 called:
869 869
870 int wait_for_key_construction(struct key *key, bool intr); 870 int wait_for_key_construction(struct key *key, bool intr);
diff --git a/Documentation/leds-class.txt b/Documentation/leds-class.txt
index 18860ad9935a..6399557cdab3 100644
--- a/Documentation/leds-class.txt
+++ b/Documentation/leds-class.txt
@@ -59,7 +59,7 @@ Hardware accelerated blink of LEDs
59 59
60Some LEDs can be programmed to blink without any CPU interaction. To 60Some LEDs can be programmed to blink without any CPU interaction. To
61support this feature, a LED driver can optionally implement the 61support this feature, a LED driver can optionally implement the
62blink_set() function (see <linux/leds.h>). If implemeted, triggers can 62blink_set() function (see <linux/leds.h>). If implemented, triggers can
63attempt to use it before falling back to software timers. The blink_set() 63attempt to use it before falling back to software timers. The blink_set()
64function should return 0 if the blink setting is supported, or -EINVAL 64function should return 0 if the blink setting is supported, or -EINVAL
65otherwise, which means that LED blinking will be handled by software. 65otherwise, which means that LED blinking will be handled by software.
diff --git a/Documentation/local_ops.txt b/Documentation/local_ops.txt
index 4269a1105b37..f4f8b1c6c8ba 100644
--- a/Documentation/local_ops.txt
+++ b/Documentation/local_ops.txt
@@ -36,7 +36,7 @@ It can be done by slightly modifying the standard atomic operations : only
36their UP variant must be kept. It typically means removing LOCK prefix (on 36their UP variant must be kept. It typically means removing LOCK prefix (on
37i386 and x86_64) and any SMP sychronization barrier. If the architecture does 37i386 and x86_64) and any SMP sychronization barrier. If the architecture does
38not have a different behavior between SMP and UP, including asm-generic/local.h 38not have a different behavior between SMP and UP, including asm-generic/local.h
39in your archtecture's local.h is sufficient. 39in your architecture's local.h is sufficient.
40 40
41The local_t type is defined as an opaque signed long by embedding an 41The local_t type is defined as an opaque signed long by embedding an
42atomic_long_t inside a structure. This is made so a cast from this type to a 42atomic_long_t inside a structure. This is made so a cast from this type to a
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
index 7fa7fe71d7a8..688dfe1e6b70 100644
--- a/Documentation/networking/bonding.txt
+++ b/Documentation/networking/bonding.txt
@@ -631,7 +631,7 @@ xmit_hash_policy
631 in environments where a layer3 gateway device is 631 in environments where a layer3 gateway device is
632 required to reach most destinations. 632 required to reach most destinations.
633 633
634 This algorithm is 802.3ad complient. 634 This algorithm is 802.3ad compliant.
635 635
636 layer3+4 636 layer3+4
637 637
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt
index 641d2afacffa..297ba7b1ccaf 100644
--- a/Documentation/networking/can.txt
+++ b/Documentation/networking/can.txt
@@ -186,7 +186,7 @@ solution for a couple of reasons:
186 186
187 The Linux network devices (by default) just can handle the 187 The Linux network devices (by default) just can handle the
188 transmission and reception of media dependent frames. Due to the 188 transmission and reception of media dependent frames. Due to the
189 arbritration on the CAN bus the transmission of a low prio CAN-ID 189 arbitration on the CAN bus the transmission of a low prio CAN-ID
190 may be delayed by the reception of a high prio CAN frame. To 190 may be delayed by the reception of a high prio CAN frame. To
191 reflect the correct* traffic on the node the loopback of the sent 191 reflect the correct* traffic on the node the loopback of the sent
192 data has to be performed right after a successful transmission. If 192 data has to be performed right after a successful transmission. If
@@ -481,7 +481,7 @@ solution for a couple of reasons:
481 - stats_timer: To calculate the Socket CAN core statistics 481 - stats_timer: To calculate the Socket CAN core statistics
482 (e.g. current/maximum frames per second) this 1 second timer is 482 (e.g. current/maximum frames per second) this 1 second timer is
483 invoked at can.ko module start time by default. This timer can be 483 invoked at can.ko module start time by default. This timer can be
484 disabled by using stattimer=0 on the module comandline. 484 disabled by using stattimer=0 on the module commandline.
485 485
486 - debug: (removed since SocketCAN SVN r546) 486 - debug: (removed since SocketCAN SVN r546)
487 487
diff --git a/Documentation/networking/packet_mmap.txt b/Documentation/networking/packet_mmap.txt
index db0cd5169581..07c53d596035 100644
--- a/Documentation/networking/packet_mmap.txt
+++ b/Documentation/networking/packet_mmap.txt
@@ -326,7 +326,7 @@ just one call to mmap is needed:
326 mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); 326 mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
327 327
328If tp_frame_size is a divisor of tp_block_size frames will be 328If tp_frame_size is a divisor of tp_block_size frames will be
329contiguosly spaced by tp_frame_size bytes. If not, each 329contiguously spaced by tp_frame_size bytes. If not, each
330tp_block_size/tp_frame_size frames there will be a gap between 330tp_block_size/tp_frame_size frames there will be a gap between
331the frames. This is because a frame cannot be spawn across two 331the frames. This is because a frame cannot be spawn across two
332blocks. 332blocks.
diff --git a/Documentation/networking/tc-actions-env-rules.txt b/Documentation/networking/tc-actions-env-rules.txt
index 01e716d185f4..dcadf6f88e34 100644
--- a/Documentation/networking/tc-actions-env-rules.txt
+++ b/Documentation/networking/tc-actions-env-rules.txt
@@ -4,26 +4,27 @@ The "enviromental" rules for authors of any new tc actions are:
41) If you stealeth or borroweth any packet thou shalt be branching 41) If you stealeth or borroweth any packet thou shalt be branching
5from the righteous path and thou shalt cloneth. 5from the righteous path and thou shalt cloneth.
6 6
7For example if your action queues a packet to be processed later 7For example if your action queues a packet to be processed later,
8or intentionaly branches by redirecting a packet then you need to 8or intentionally branches by redirecting a packet, then you need to
9clone the packet. 9clone the packet.
10
10There are certain fields in the skb tc_verd that need to be reset so we 11There are certain fields in the skb tc_verd that need to be reset so we
11avoid loops etc. A few are generic enough so much so that skb_act_clone() 12avoid loops, etc. A few are generic enough that skb_act_clone()
12resets them for you. So invoke skb_act_clone() rather than skb_clone() 13resets them for you, so invoke skb_act_clone() rather than skb_clone().
13 14
142) If you munge any packet thou shalt call pskb_expand_head in the case 152) If you munge any packet thou shalt call pskb_expand_head in the case
15someone else is referencing the skb. After that you "own" the skb. 16someone else is referencing the skb. After that you "own" the skb.
16You must also tell us if it is ok to munge the packet (TC_OK2MUNGE), 17You must also tell us if it is ok to munge the packet (TC_OK2MUNGE),
17this way any action downstream can stomp on the packet. 18this way any action downstream can stomp on the packet.
18 19
193) dropping packets you dont own is a nono. You simply return 203) Dropping packets you don't own is a no-no. You simply return
20TC_ACT_SHOT to the caller and they will drop it. 21TC_ACT_SHOT to the caller and they will drop it.
21 22
22The "enviromental" rules for callers of actions (qdiscs etc) are: 23The "enviromental" rules for callers of actions (qdiscs etc) are:
23 24
24*) thou art responsible for freeing anything returned as being 25*) Thou art responsible for freeing anything returned as being
25TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is 26TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is
26returned then all is great and you dont need to do anything. 27returned, then all is great and you don't need to do anything.
27 28
28Post on netdev if something is unclear. 29Post on netdev if something is unclear.
29 30
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index 99514ced82c5..928a79ceb7aa 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -708,7 +708,7 @@ device or bus to be described by the device tree.
708In general, the format of an address for a device is defined by the 708In general, the format of an address for a device is defined by the
709parent bus type, based on the #address-cells and #size-cells 709parent bus type, based on the #address-cells and #size-cells
710properties. Note that the parent's parent definitions of #address-cells 710properties. Note that the parent's parent definitions of #address-cells
711and #size-cells are not inhereted so every node with children must specify 711and #size-cells are not inherited so every node with children must specify
712them. The kernel requires the root node to have those properties defining 712them. The kernel requires the root node to have those properties defining
713addresses format for devices directly mapped on the processor bus. 713addresses format for devices directly mapped on the processor bus.
714 714
@@ -1777,7 +1777,7 @@ platforms are moved over to use the flattened-device-tree model.
1777 1777
1778 Xilinx uartlite devices are simple fixed speed serial ports. 1778 Xilinx uartlite devices are simple fixed speed serial ports.
1779 1779
1780 Requred properties: 1780 Required properties:
1781 - current-speed : Baud rate of uartlite 1781 - current-speed : Baud rate of uartlite
1782 1782
1783 v) Xilinx hwicap 1783 v) Xilinx hwicap
@@ -1799,7 +1799,7 @@ platforms are moved over to use the flattened-device-tree model.
1799 Xilinx UART 16550 devices are very similar to the NS16550 but with 1799 Xilinx UART 16550 devices are very similar to the NS16550 but with
1800 different register spacing and an offset from the base address. 1800 different register spacing and an offset from the base address.
1801 1801
1802 Requred properties: 1802 Required properties:
1803 - clock-frequency : Frequency of the clock input 1803 - clock-frequency : Frequency of the clock input
1804 - reg-offset : A value of 3 is required 1804 - reg-offset : A value of 3 is required
1805 - reg-shift : A value of 2 is required 1805 - reg-shift : A value of 2 is required
@@ -1953,7 +1953,7 @@ prefixed with the string "marvell,", for Marvell Technology Group Ltd.
19531) The /system-controller node 19531) The /system-controller node
1954 1954
1955 This node is used to represent the system-controller and must be 1955 This node is used to represent the system-controller and must be
1956 present when the system uses a system contller chip. The top-level 1956 present when the system uses a system controller chip. The top-level
1957 system-controller node contains information that is global to all 1957 system-controller node contains information that is global to all
1958 devices within the system controller chip. The node name begins 1958 devices within the system controller chip. The node name begins
1959 with "system-controller" followed by the unit address, which is 1959 with "system-controller" followed by the unit address, which is
diff --git a/Documentation/powerpc/qe_firmware.txt b/Documentation/powerpc/qe_firmware.txt
index 896266432d33..06da4d4b44f9 100644
--- a/Documentation/powerpc/qe_firmware.txt
+++ b/Documentation/powerpc/qe_firmware.txt
@@ -217,7 +217,7 @@ Although it is not recommended, you can specify '0' in the soc.model
217field to skip matching SOCs altogether. 217field to skip matching SOCs altogether.
218 218
219The 'model' field is a 16-bit number that matches the actual SOC. The 219The 'model' field is a 16-bit number that matches the actual SOC. The
220'major' and 'minor' fields are the major and minor revision numbrs, 220'major' and 'minor' fields are the major and minor revision numbers,
221respectively, of the SOC. 221respectively, of the SOC.
222 222
223For example, to match the 8323, revision 1.0: 223For example, to match the 8323, revision 1.0:
diff --git a/Documentation/s390/driver-model.txt b/Documentation/s390/driver-model.txt
index e938c442277d..bde473df748d 100644
--- a/Documentation/s390/driver-model.txt
+++ b/Documentation/s390/driver-model.txt
@@ -25,7 +25,7 @@ device 4711 via subchannel 1 in subchannel set 0, and subchannel 2 is a non-I/O
25subchannel. Device 1234 is accessed via subchannel 0 in subchannel set 1. 25subchannel. Device 1234 is accessed via subchannel 0 in subchannel set 1.
26 26
27The subchannel named 'defunct' does not represent any real subchannel on the 27The subchannel named 'defunct' does not represent any real subchannel on the
28system; it is a pseudo subchannel where disconnnected ccw devices are moved to 28system; it is a pseudo subchannel where disconnected ccw devices are moved to
29if they are displaced by another ccw device becoming operational on their 29if they are displaced by another ccw device becoming operational on their
30former subchannel. The ccw devices will be moved again to a proper subchannel 30former subchannel. The ccw devices will be moved again to a proper subchannel
31if they become operational again on that subchannel. 31if they become operational again on that subchannel.
diff --git a/Documentation/scsi/ibmmca.txt b/Documentation/scsi/ibmmca.txt
index a810421f1fb3..3920f28710c4 100644
--- a/Documentation/scsi/ibmmca.txt
+++ b/Documentation/scsi/ibmmca.txt
@@ -524,7 +524,7 @@
524 - Michael Lang 524 - Michael Lang
525 525
526 June 25 1997: (v1.8b) 526 June 25 1997: (v1.8b)
527 1) Some cosmetical changes for the handling of SCSI-device-types. 527 1) Some cosmetic changes for the handling of SCSI-device-types.
528 Now, also CD-Burners / WORMs and SCSI-scanners should work. For 528 Now, also CD-Burners / WORMs and SCSI-scanners should work. For
529 MO-drives I have no experience, therefore not yet supported. 529 MO-drives I have no experience, therefore not yet supported.
530 In logical_devices I changed from different type-variables to one 530 In logical_devices I changed from different type-variables to one
@@ -914,7 +914,7 @@
914 in version 4.0. This was never really necessary, as all troubles were 914 in version 4.0. This was never really necessary, as all troubles were
915 based on non-command related reasons up to now, so bypassing commands 915 based on non-command related reasons up to now, so bypassing commands
916 did not help to avoid any bugs. It is kept in 3.2X for debugging reasons. 916 did not help to avoid any bugs. It is kept in 3.2X for debugging reasons.
917 5) Dynamical reassignment of ldns was again verified and analyzed to be 917 5) Dynamic reassignment of ldns was again verified and analyzed to be
918 completely inoperational. This is corrected and should work now. 918 completely inoperational. This is corrected and should work now.
919 6) All commands that get sent to the SCSI adapter were verified and 919 6) All commands that get sent to the SCSI adapter were verified and
920 completed in such a way, that they are now completely conform to the 920 completed in such a way, that they are now completely conform to the
@@ -1386,7 +1386,7 @@
1386 concerning the Linux-kernel in special, this SCSI-driver comes without any 1386 concerning the Linux-kernel in special, this SCSI-driver comes without any
1387 warranty. Its functionality is tested as good as possible on certain 1387 warranty. Its functionality is tested as good as possible on certain
1388 machines and combinations of computer hardware, which does not exclude, 1388 machines and combinations of computer hardware, which does not exclude,
1389 that dataloss or severe damage of hardware is possible while using this 1389 that data loss or severe damage of hardware is possible while using this
1390 part of software on some arbitrary computer hardware or in combination 1390 part of software on some arbitrary computer hardware or in combination
1391 with other software packages. It is highly recommended to make backup 1391 with other software packages. It is highly recommended to make backup
1392 copies of your data before using this software. Furthermore, personal 1392 copies of your data before using this software. Furthermore, personal
diff --git a/Documentation/scsi/lpfc.txt b/Documentation/scsi/lpfc.txt
index 4dbe41370a6d..5741ea8aa88a 100644
--- a/Documentation/scsi/lpfc.txt
+++ b/Documentation/scsi/lpfc.txt
@@ -36,7 +36,7 @@ Cable pull and temporary device Loss:
36 being removed, a switch rebooting, or a device reboot), the driver could 36 being removed, a switch rebooting, or a device reboot), the driver could
37 hide the disappearance of the device from the midlayer. I/O's issued to 37 hide the disappearance of the device from the midlayer. I/O's issued to
38 the LLDD would simply be queued for a short duration, allowing the device 38 the LLDD would simply be queued for a short duration, allowing the device
39 to reappear or link come back alive, with no inadvertant side effects 39 to reappear or link come back alive, with no inadvertent side effects
40 to the system. If the driver did not hide these conditions, i/o would be 40 to the system. If the driver did not hide these conditions, i/o would be
41 errored by the driver, the mid-layer would exhaust its retries, and the 41 errored by the driver, the mid-layer would exhaust its retries, and the
42 device would be taken offline. Manual intervention would be required to 42 device would be taken offline. Manual intervention would be required to
diff --git a/Documentation/scsi/scsi_fc_transport.txt b/Documentation/scsi/scsi_fc_transport.txt
index d403e46d8463..75143f0c23b6 100644
--- a/Documentation/scsi/scsi_fc_transport.txt
+++ b/Documentation/scsi/scsi_fc_transport.txt
@@ -65,7 +65,7 @@ Overview:
65 discussion will concentrate on NPIV. 65 discussion will concentrate on NPIV.
66 66
67 Note: World Wide Name assignment (and uniqueness guarantees) are left 67 Note: World Wide Name assignment (and uniqueness guarantees) are left
68 up to an administrative entity controling the vport. For example, 68 up to an administrative entity controlling the vport. For example,
69 if vports are to be associated with virtual machines, a XEN mgmt 69 if vports are to be associated with virtual machines, a XEN mgmt
70 utility would be responsible for creating wwpn/wwnn's for the vport, 70 utility would be responsible for creating wwpn/wwnn's for the vport,
71 using it's own naming authority and OUI. (Note: it already does this 71 using it's own naming authority and OUI. (Note: it already does this
@@ -91,7 +91,7 @@ Device Trees and Vport Objects:
91 Here's what to expect in the device tree : 91 Here's what to expect in the device tree :
92 The typical Physical Port's Scsi_Host: 92 The typical Physical Port's Scsi_Host:
93 /sys/devices/.../host17/ 93 /sys/devices/.../host17/
94 and it has the typical decendent tree: 94 and it has the typical descendant tree:
95 /sys/devices/.../host17/rport-17:0-0/target17:0:0/17:0:0:0: 95 /sys/devices/.../host17/rport-17:0-0/target17:0:0/17:0:0:0:
96 and then the vport is created on the Physical Port: 96 and then the vport is created on the Physical Port:
97 /sys/devices/.../host17/vport-17:0-0 97 /sys/devices/.../host17/vport-17:0-0
@@ -192,7 +192,7 @@ Vport States:
192 independent of the adapter's link state. 192 independent of the adapter's link state.
193 - Instantiation of the vport on the FC link via ELS traffic, etc. 193 - Instantiation of the vport on the FC link via ELS traffic, etc.
194 This is equivalent to a "link up" and successfull link initialization. 194 This is equivalent to a "link up" and successfull link initialization.
195 Futher information can be found in the interfaces section below for 195 Further information can be found in the interfaces section below for
196 Vport Creation. 196 Vport Creation.
197 197
198 Once a vport has been instantiated with the kernel/LLDD, a vport state 198 Once a vport has been instantiated with the kernel/LLDD, a vport state
diff --git a/Documentation/sh/clk.txt b/Documentation/sh/clk.txt
index 9aef710e9a4b..114b595cfa97 100644
--- a/Documentation/sh/clk.txt
+++ b/Documentation/sh/clk.txt
@@ -12,7 +12,7 @@ means no changes to adjanced clock
12Internally, the clk_set_rate_ex forwards request to clk->ops->set_rate method, 12Internally, the clk_set_rate_ex forwards request to clk->ops->set_rate method,
13if it is present in ops structure. The method should set the clock rate and adjust 13if it is present in ops structure. The method should set the clock rate and adjust
14all needed clocks according to the passed algo_id. 14all needed clocks according to the passed algo_id.
15Exact values for algo_id are machine-dependend. For the sh7722, the following 15Exact values for algo_id are machine-dependent. For the sh7722, the following
16values are defined: 16values are defined:
17 17
18 NO_CHANGE = 0, 18 NO_CHANGE = 0,
diff --git a/Documentation/sound/alsa/Audiophile-Usb.txt b/Documentation/sound/alsa/Audiophile-Usb.txt
index 2ad5e6306c44..a4c53d8961e1 100644
--- a/Documentation/sound/alsa/Audiophile-Usb.txt
+++ b/Documentation/sound/alsa/Audiophile-Usb.txt
@@ -236,15 +236,15 @@ The parameter can be given:
236 alias snd-card-1 snd-usb-audio 236 alias snd-card-1 snd-usb-audio
237 options snd-usb-audio index=1 device_setup=0x09 237 options snd-usb-audio index=1 device_setup=0x09
238 238
239CAUTION when initializaing the device 239CAUTION when initializing the device
240------------------------------------- 240-------------------------------------
241 241
242 * Correct initialization on the device requires that device_setup is given to 242 * Correct initialization on the device requires that device_setup is given to
243 the module BEFORE the device is turned on. So, if you use the "manual probing" 243 the module BEFORE the device is turned on. So, if you use the "manual probing"
244 method described above, take care to power-on the device AFTER this initialization. 244 method described above, take care to power-on the device AFTER this initialization.
245 245
246 * Failing to respect this will lead in a misconfiguration of the device. In this case 246 * Failing to respect this will lead to a misconfiguration of the device. In this case
247 turn off the device, unproble the snd-usb-audio module, then probe it again with 247 turn off the device, unprobe the snd-usb-audio module, then probe it again with
248 correct device_setup parameter and then (and only then) turn on the device again. 248 correct device_setup parameter and then (and only then) turn on the device again.
249 249
250 * If you've correctly initialized the device in a valid mode and then want to switch 250 * If you've correctly initialized the device in a valid mode and then want to switch
@@ -388,9 +388,9 @@ There are 2 main potential issues when using Jackd with the device:
388 388
389Jack supports big endian devices only in recent versions (thanks to 389Jack supports big endian devices only in recent versions (thanks to
390Andreas Steinmetz for his first big-endian patch). I can't remember 390Andreas Steinmetz for his first big-endian patch). I can't remember
391extacly when this support was released into jackd, let's just say that 391exactly when this support was released into jackd, let's just say that
392with jackd version 0.103.0 it's almost ok (just a small bug is affecting 392with jackd version 0.103.0 it's almost ok (just a small bug is affecting
39316bits Big-Endian devices, but since you've read carefully the above 39316bits Big-Endian devices, but since you've read carefully the above
394paragraphs, you're now using kernel >= 2.6.23 and your 16bits devices 394paragraphs, you're now using kernel >= 2.6.23 and your 16bits devices
395are now Little Endians ;-) ). 395are now Little Endians ;-) ).
396 396
diff --git a/Documentation/sound/alsa/hda_codec.txt b/Documentation/sound/alsa/hda_codec.txt
index 8e1b02526698..34e87ec1379c 100644
--- a/Documentation/sound/alsa/hda_codec.txt
+++ b/Documentation/sound/alsa/hda_codec.txt
@@ -67,7 +67,7 @@ CONFIG_SND_HDA_POWER_SAVE kconfig. It's called when the codec needs
67to power up or may power down. The controller should check the all 67to power up or may power down. The controller should check the all
68belonging codecs on the bus whether they are actually powered off 68belonging codecs on the bus whether they are actually powered off
69(check codec->power_on), and optionally the driver may power down the 69(check codec->power_on), and optionally the driver may power down the
70contoller side, too. 70controller side, too.
71 71
72The bus instance is created via snd_hda_bus_new(). You need to pass 72The bus instance is created via snd_hda_bus_new(). You need to pass
73the card instance, the template, and the pointer to store the 73the card instance, the template, and the pointer to store the
diff --git a/Documentation/sound/alsa/soc/dapm.txt b/Documentation/sound/alsa/soc/dapm.txt
index c784a18b94dc..b2ed6983f40d 100644
--- a/Documentation/sound/alsa/soc/dapm.txt
+++ b/Documentation/sound/alsa/soc/dapm.txt
@@ -68,7 +68,7 @@ Audio DAPM widgets fall into a number of types:-
68(Widgets are defined in include/sound/soc-dapm.h) 68(Widgets are defined in include/sound/soc-dapm.h)
69 69
70Widgets are usually added in the codec driver and the machine driver. There are 70Widgets are usually added in the codec driver and the machine driver. There are
71convience macros defined in soc-dapm.h that can be used to quickly build a 71convenience macros defined in soc-dapm.h that can be used to quickly build a
72list of widgets of the codecs and machines DAPM widgets. 72list of widgets of the codecs and machines DAPM widgets.
73 73
74Most widgets have a name, register, shift and invert. Some widgets have extra 74Most widgets have a name, register, shift and invert. Some widgets have extra
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 8a4863c4edd4..d79eeda7a699 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -116,7 +116,7 @@ of kilobytes free. The VM uses this number to compute a pages_min
116value for each lowmem zone in the system. Each lowmem zone gets 116value for each lowmem zone in the system. Each lowmem zone gets
117a number of reserved free pages based proportionally on its size. 117a number of reserved free pages based proportionally on its size.
118 118
119Some minimal ammount of memory is needed to satisfy PF_MEMALLOC 119Some minimal amount of memory is needed to satisfy PF_MEMALLOC
120allocations; if you set this to lower than 1024KB, your system will 120allocations; if you set this to lower than 1024KB, your system will
121become subtly broken, and prone to deadlock under high loads. 121become subtly broken, and prone to deadlock under high loads.
122 122
diff --git a/Documentation/timers/highres.txt b/Documentation/timers/highres.txt
index a73ecf5b4bdb..21332233cef1 100644
--- a/Documentation/timers/highres.txt
+++ b/Documentation/timers/highres.txt
@@ -125,7 +125,7 @@ increase of flexibility and the avoidance of duplicated code across
125architectures justifies the slight increase of the binary size. 125architectures justifies the slight increase of the binary size.
126 126
127The conversion of an architecture has no functional impact, but allows to 127The conversion of an architecture has no functional impact, but allows to
128utilize the high resolution and dynamic tick functionalites without any change 128utilize the high resolution and dynamic tick functionalities without any change
129to the clock event device and timer interrupt code. After the conversion the 129to the clock event device and timer interrupt code. After the conversion the
130enabling of high resolution timers and dynamic ticks is simply provided by 130enabling of high resolution timers and dynamic ticks is simply provided by
131adding the kernel/time/Kconfig file to the architecture specific Kconfig and 131adding the kernel/time/Kconfig file to the architecture specific Kconfig and
diff --git a/Documentation/usb/authorization.txt b/Documentation/usb/authorization.txt
index 2af400609498..381b22ee7834 100644
--- a/Documentation/usb/authorization.txt
+++ b/Documentation/usb/authorization.txt
@@ -8,7 +8,7 @@ not) in a system. This feature will allow you to implement a lock-down
8of USB devices, fully controlled by user space. 8of USB devices, fully controlled by user space.
9 9
10As of now, when a USB device is connected it is configured and 10As of now, when a USB device is connected it is configured and
11it's interfaces inmediately made available to the users. With this 11its interfaces are immediately made available to the users. With this
12modification, only if root authorizes the device to be configured will 12modification, only if root authorizes the device to be configured will
13then it be possible to use it. 13then it be possible to use it.
14 14
diff --git a/Documentation/video4linux/sn9c102.txt b/Documentation/video4linux/sn9c102.txt
index b26f5195af51..73de4050d637 100644
--- a/Documentation/video4linux/sn9c102.txt
+++ b/Documentation/video4linux/sn9c102.txt
@@ -157,7 +157,7 @@ Loading can be done as shown below:
157 157
158 [root@localhost home]# modprobe sn9c102 158 [root@localhost home]# modprobe sn9c102
159 159
160Note that the module is called "sn9c102" for historic reasons, althought it 160Note that the module is called "sn9c102" for historic reasons, although it
161does not just support the SN9C102. 161does not just support the SN9C102.
162 162
163At this point all the devices supported by the driver and connected to the USB 163At this point all the devices supported by the driver and connected to the USB
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt
index 8a5b5763f0fe..ea8714fcc3ad 100644
--- a/Documentation/vm/hugetlbpage.txt
+++ b/Documentation/vm/hugetlbpage.txt
@@ -77,7 +77,7 @@ memory that is preset in system at this time. System administrators may want
77to put this command in one of the local rc init files. This will enable the 77to put this command in one of the local rc init files. This will enable the
78kernel to request huge pages early in the boot process (when the possibility 78kernel to request huge pages early in the boot process (when the possibility
79of getting physical contiguous pages is still very high). In either 79of getting physical contiguous pages is still very high). In either
80case, adminstrators will want to verify the number of hugepages actually 80case, administrators will want to verify the number of hugepages actually
81allocated by checking the sysctl or meminfo. 81allocated by checking the sysctl or meminfo.
82 82
83/proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of 83/proc/sys/vm/nr_overcommit_hugepages indicates how large the pool of
diff --git a/Documentation/vm/numa_memory_policy.txt b/Documentation/vm/numa_memory_policy.txt
index bad16d3f6a47..6aaaeb38730c 100644
--- a/Documentation/vm/numa_memory_policy.txt
+++ b/Documentation/vm/numa_memory_policy.txt
@@ -58,7 +58,7 @@ most general to most specific:
58 the policy at the time they were allocated. 58 the policy at the time they were allocated.
59 59
60 VMA Policy: A "VMA" or "Virtual Memory Area" refers to a range of a task's 60 VMA Policy: A "VMA" or "Virtual Memory Area" refers to a range of a task's
61 virtual adddress space. A task may define a specific policy for a range 61 virtual address space. A task may define a specific policy for a range
62 of its virtual address space. See the MEMORY POLICIES APIS section, 62 of its virtual address space. See the MEMORY POLICIES APIS section,
63 below, for an overview of the mbind() system call used to set a VMA 63 below, for an overview of the mbind() system call used to set a VMA
64 policy. 64 policy.
@@ -353,7 +353,7 @@ follows:
353 353
354 Because of this extra reference counting, and because we must lookup 354 Because of this extra reference counting, and because we must lookup
355 shared policies in a tree structure under spinlock, shared policies are 355 shared policies in a tree structure under spinlock, shared policies are
356 more expensive to use in the page allocation path. This is expecially 356 more expensive to use in the page allocation path. This is especially
357 true for shared policies on shared memory regions shared by tasks running 357 true for shared policies on shared memory regions shared by tasks running
358 on different NUMA nodes. This extra overhead can be avoided by always 358 on different NUMA nodes. This extra overhead can be avoided by always
359 falling back to task or system default policy for shared memory regions, 359 falling back to task or system default policy for shared memory regions,
diff --git a/Documentation/volatile-considered-harmful.txt b/Documentation/volatile-considered-harmful.txt
index 10c2e411cca8..991c26a6ef64 100644
--- a/Documentation/volatile-considered-harmful.txt
+++ b/Documentation/volatile-considered-harmful.txt
@@ -114,6 +114,6 @@ CREDITS
114 114
115Original impetus and research by Randy Dunlap 115Original impetus and research by Randy Dunlap
116Written by Jonathan Corbet 116Written by Jonathan Corbet
117Improvements via coments from Satyam Sharma, Johannes Stezenbach, Jesper 117Improvements via comments from Satyam Sharma, Johannes Stezenbach, Jesper
118 Juhl, Heikki Orsila, H. Peter Anvin, Philipp Hahn, and Stefan 118 Juhl, Heikki Orsila, H. Peter Anvin, Philipp Hahn, and Stefan
119 Richter. 119 Richter.
diff --git a/MAINTAINERS b/MAINTAINERS
index 4cbf6016a9b9..03c5d6ccb9f8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3123,6 +3123,12 @@ W: http://oss.oracle.com/projects/ocfs2/
3123T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2.git 3123T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfasheh/ocfs2.git
3124S: Supported 3124S: Supported
3125 3125
3126OMFS FILESYSTEM
3127P: Bob Copeland
3128M: me@bobcopeland.com
3129L: linux-karma-devel@lists.sourceforge.net
3130S: Maintained
3131
3126OMNIKEY CARDMAN 4000 DRIVER 3132OMNIKEY CARDMAN 4000 DRIVER
3127P: Harald Welte 3133P: Harald Welte
3128M: laforge@gnumonks.org 3134M: laforge@gnumonks.org
diff --git a/arch/Kconfig b/arch/Kconfig
index b0fabfa864ff..364c6dadde0a 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -59,6 +59,24 @@ config HAVE_KPROBES
59config HAVE_KRETPROBES 59config HAVE_KRETPROBES
60 def_bool n 60 def_bool n
61 61
62#
63# An arch should select this if it provides all these things:
64#
65# task_pt_regs() in asm/processor.h or asm/ptrace.h
66# arch_has_single_step() if there is hardware single-step support
67# arch_has_block_step() if there is hardware block-step support
68# arch_ptrace() and not #define __ARCH_SYS_PTRACE
69# compat_arch_ptrace() and #define __ARCH_WANT_COMPAT_SYS_PTRACE
70# asm/syscall.h supplying asm-generic/syscall.h interface
71# linux/regset.h user_regset interfaces
72# CORE_DUMP_USE_REGSET #define'd in linux/elf.h
73# TIF_SYSCALL_TRACE calls tracehook_report_syscall_{entry,exit}
74# TIF_NOTIFY_RESUME calls tracehook_notify_resume()
75# signal delivery calls tracehook_signal_handler()
76#
77config HAVE_ARCH_TRACEHOOK
78 def_bool n
79
62config HAVE_DMA_ATTRS 80config HAVE_DMA_ATTRS
63 def_bool n 81 def_bool n
64 82
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 40c15e7301de..234e42b8ee74 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -94,36 +94,6 @@ __bad_page(void)
94 return pte_mkdirty(mk_pte(virt_to_page(EMPTY_PGE), PAGE_SHARED)); 94 return pte_mkdirty(mk_pte(virt_to_page(EMPTY_PGE), PAGE_SHARED));
95} 95}
96 96
97#ifndef CONFIG_DISCONTIGMEM
98void
99show_mem(void)
100{
101 long i,free = 0,total = 0,reserved = 0;
102 long shared = 0, cached = 0;
103
104 printk("\nMem-info:\n");
105 show_free_areas();
106 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
107 i = max_mapnr;
108 while (i-- > 0) {
109 total++;
110 if (PageReserved(mem_map+i))
111 reserved++;
112 else if (PageSwapCache(mem_map+i))
113 cached++;
114 else if (!page_count(mem_map+i))
115 free++;
116 else
117 shared += page_count(mem_map + i) - 1;
118 }
119 printk("%ld pages of RAM\n",total);
120 printk("%ld free pages\n",free);
121 printk("%ld reserved pages\n",reserved);
122 printk("%ld pages shared\n",shared);
123 printk("%ld pages swap cached\n",cached);
124}
125#endif
126
127static inline unsigned long 97static inline unsigned long
128load_PCB(struct pcb_struct *pcb) 98load_PCB(struct pcb_struct *pcb)
129{ 99{
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index d8c4ceaf00b9..a13de49d1265 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -359,38 +359,3 @@ void __init mem_init(void)
359 mem_stress(); 359 mem_stress();
360#endif 360#endif
361} 361}
362
363void
364show_mem(void)
365{
366 long i,free = 0,total = 0,reserved = 0;
367 long shared = 0, cached = 0;
368 int nid;
369
370 printk("\nMem-info:\n");
371 show_free_areas();
372 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
373 for_each_online_node(nid) {
374 unsigned long flags;
375 pgdat_resize_lock(NODE_DATA(nid), &flags);
376 i = node_spanned_pages(nid);
377 while (i-- > 0) {
378 struct page *page = nid_page_nr(nid, i);
379 total++;
380 if (PageReserved(page))
381 reserved++;
382 else if (PageSwapCache(page))
383 cached++;
384 else if (!page_count(page))
385 free++;
386 else
387 shared += page_count(page) - 1;
388 }
389 pgdat_resize_unlock(NODE_DATA(nid), &flags);
390 }
391 printk("%ld pages of RAM\n",total);
392 printk("%ld free pages\n",free);
393 printk("%ld reserved pages\n",reserved);
394 printk("%ld pages shared\n",shared);
395 printk("%ld pages swap cached\n",cached);
396}
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index dd2947342604..69130f365904 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -280,7 +280,7 @@ unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
280 /* 280 /*
281 * Trying to unmap an invalid mapping 281 * Trying to unmap an invalid mapping
282 */ 282 */
283 if (dma_mapping_error(dma_addr)) { 283 if (dma_mapping_error(dev, dma_addr)) {
284 dev_err(dev, "Trying to unmap invalid mapping\n"); 284 dev_err(dev, "Trying to unmap invalid mapping\n");
285 return; 285 return;
286 } 286 }
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 60f162dc4fad..8c5e656d5d8c 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -1304,7 +1304,7 @@ struct sysdev_class dma_sysclass = {
1304 1304
1305/* kmem cache implementation */ 1305/* kmem cache implementation */
1306 1306
1307static void s3c2410_dma_cache_ctor(struct kmem_cache *c, void *p) 1307static void s3c2410_dma_cache_ctor(void *p)
1308{ 1308{
1309 memset(p, 0, sizeof(struct s3c2410_dma_buf)); 1309 memset(p, 0, sizeof(struct s3c2410_dma_buf));
1310} 1310}
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 3c85fdaa9487..fa92ff6d95f7 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -38,45 +38,6 @@ EXPORT_SYMBOL(empty_zero_page);
38 */ 38 */
39unsigned long mmu_context_cache = NO_CONTEXT; 39unsigned long mmu_context_cache = NO_CONTEXT;
40 40
41void show_mem(void)
42{
43 int total = 0, reserved = 0, cached = 0;
44 int slab = 0, free = 0, shared = 0;
45 pg_data_t *pgdat;
46
47 printk("Mem-info:\n");
48 show_free_areas();
49
50 for_each_online_pgdat(pgdat) {
51 struct page *page, *end;
52
53 page = pgdat->node_mem_map;
54 end = page + pgdat->node_spanned_pages;
55
56 do {
57 total++;
58 if (PageReserved(page))
59 reserved++;
60 else if (PageSwapCache(page))
61 cached++;
62 else if (PageSlab(page))
63 slab++;
64 else if (!page_count(page))
65 free++;
66 else
67 shared += page_count(page) - 1;
68 page++;
69 } while (page < end);
70 }
71
72 printk ("%d pages of RAM\n", total);
73 printk ("%d free pages\n", free);
74 printk ("%d reserved pages\n", reserved);
75 printk ("%d slab pages\n", slab);
76 printk ("%d pages shared\n", shared);
77 printk ("%d pages swap cached\n", cached);
78}
79
80/* 41/*
81 * paging_init() sets up the page tables 42 * paging_init() sets up the page tables
82 * 43 *
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index b83b8ef84e91..5a097c46bc46 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -234,7 +234,7 @@ config MEM_MT48LC16M16A2TG_75
234 bool 234 bool
235 depends on (BFIN533_EZKIT || BFIN561_EZKIT \ 235 depends on (BFIN533_EZKIT || BFIN561_EZKIT \
236 || BFIN533_BLUETECHNIX_CM || BFIN537_BLUETECHNIX_CM \ 236 || BFIN533_BLUETECHNIX_CM || BFIN537_BLUETECHNIX_CM \
237 || H8606_HVSISTEMAS) 237 || H8606_HVSISTEMAS || BFIN527_BLUETECHNIX_CM)
238 default y 238 default y
239 239
240config MEM_MT48LC32M8A2_75 240config MEM_MT48LC32M8A2_75
@@ -310,25 +310,6 @@ config BFIN_KERNEL_CLOCK
310 are also not changed, and the Bootloader does 100% of the hardware 310 are also not changed, and the Bootloader does 100% of the hardware
311 configuration. 311 configuration.
312 312
313config MEM_SIZE
314 int "SDRAM Memory Size in MBytes"
315 depends on BFIN_KERNEL_CLOCK
316 default 64
317
318config MEM_ADD_WIDTH
319 int "Memory Address Width"
320 depends on BFIN_KERNEL_CLOCK
321 depends on (!BF54x)
322 range 8 11
323 default 9 if BFIN533_EZKIT
324 default 9 if BFIN561_EZKIT
325 default 9 if H8606_HVSISTEMAS
326 default 10 if BFIN527_EZKIT
327 default 10 if BFIN537_STAMP
328 default 11 if BFIN533_STAMP
329 default 10 if PNAV10
330 default 10 if BFIN532_IP0X
331
332config PLL_BYPASS 313config PLL_BYPASS
333 bool "Bypass PLL" 314 bool "Bypass PLL"
334 depends on BFIN_KERNEL_CLOCK 315 depends on BFIN_KERNEL_CLOCK
@@ -349,8 +330,7 @@ config VCO_MULT
349 default "45" if BFIN533_STAMP 330 default "45" if BFIN533_STAMP
350 default "20" if (BFIN537_STAMP || BFIN527_EZKIT || BFIN548_EZKIT || BFIN548_BLUETECHNIX_CM) 331 default "20" if (BFIN537_STAMP || BFIN527_EZKIT || BFIN548_EZKIT || BFIN548_BLUETECHNIX_CM)
351 default "22" if BFIN533_BLUETECHNIX_CM 332 default "22" if BFIN533_BLUETECHNIX_CM
352 default "20" if BFIN537_BLUETECHNIX_CM 333 default "20" if (BFIN537_BLUETECHNIX_CM || BFIN527_BLUETECHNIX_CM || BFIN561_BLUETECHNIX_CM)
353 default "20" if BFIN561_BLUETECHNIX_CM
354 default "20" if BFIN561_EZKIT 334 default "20" if BFIN561_EZKIT
355 default "16" if H8606_HVSISTEMAS 335 default "16" if H8606_HVSISTEMAS
356 help 336 help
@@ -390,7 +370,7 @@ config SCLK_DIV
390 370
391config MAX_MEM_SIZE 371config MAX_MEM_SIZE
392 int "Max SDRAM Memory Size in MBytes" 372 int "Max SDRAM Memory Size in MBytes"
393 depends on !BFIN_KERNEL_CLOCK && !MPU 373 depends on !MPU
394 default 512 374 default 512
395 help 375 help
396 This is the max memory size that the kernel will create CPLB 376 This is the max memory size that the kernel will create CPLB
@@ -748,14 +728,6 @@ config BFIN_WT
748 728
749endchoice 729endchoice
750 730
751config L1_MAX_PIECE
752 int "Set the max L1 SRAM pieces"
753 default 16
754 help
755 Set the max memory pieces for the L1 SRAM allocation algorithm.
756 Min value is 16. Max value is 1024.
757
758
759config MPU 731config MPU
760 bool "Enable the memory protection unit (EXPERIMENTAL)" 732 bool "Enable the memory protection unit (EXPERIMENTAL)"
761 default n 733 default n
@@ -899,7 +871,7 @@ config ARCH_SUSPEND_POSSIBLE
899 depends on !SMP 871 depends on !SMP
900 872
901choice 873choice
902 prompt "Default Power Saving Mode" 874 prompt "Standby Power Saving Mode"
903 depends on PM 875 depends on PM
904 default PM_BFIN_SLEEP_DEEPER 876 default PM_BFIN_SLEEP_DEEPER
905config PM_BFIN_SLEEP_DEEPER 877config PM_BFIN_SLEEP_DEEPER
@@ -918,6 +890,8 @@ config PM_BFIN_SLEEP_DEEPER
918 normal during Sleep Deeper, due to the reduced SCLK frequency. 890 normal during Sleep Deeper, due to the reduced SCLK frequency.
919 When in the sleep mode, system DMA access to L1 memory is not supported. 891 When in the sleep mode, system DMA access to L1 memory is not supported.
920 892
893 If unsure, select "Sleep Deeper".
894
921config PM_BFIN_SLEEP 895config PM_BFIN_SLEEP
922 bool "Sleep" 896 bool "Sleep"
923 help 897 help
@@ -925,15 +899,17 @@ config PM_BFIN_SLEEP
925 dissipation by disabling the clock to the processor core (CCLK). 899 dissipation by disabling the clock to the processor core (CCLK).
926 The PLL and system clock (SCLK), however, continue to operate in 900 The PLL and system clock (SCLK), however, continue to operate in
927 this mode. Typically an external event or RTC activity will wake 901 this mode. Typically an external event or RTC activity will wake
928 up the processor. When in the sleep mode, 902 up the processor. When in the sleep mode, system DMA access to L1
929 system DMA access to L1 memory is not supported. 903 memory is not supported.
904
905 If unsure, select "Sleep Deeper".
930endchoice 906endchoice
931 907
932config PM_WAKEUP_BY_GPIO 908config PM_WAKEUP_BY_GPIO
933 bool "Cause Wakeup Event by GPIO" 909 bool "Allow Wakeup from Standby by GPIO"
934 910
935config PM_WAKEUP_GPIO_NUMBER 911config PM_WAKEUP_GPIO_NUMBER
936 int "Wakeup GPIO number" 912 int "GPIO number"
937 range 0 47 913 range 0 47
938 depends on PM_WAKEUP_BY_GPIO 914 depends on PM_WAKEUP_BY_GPIO
939 default 2 if BFIN537_STAMP 915 default 2 if BFIN537_STAMP
@@ -954,6 +930,58 @@ config PM_WAKEUP_GPIO_POLAR_EDGE_B
954 bool "Both EDGE" 930 bool "Both EDGE"
955endchoice 931endchoice
956 932
933comment "Possible Suspend Mem / Hibernate Wake-Up Sources"
934 depends on PM
935
936config PM_BFIN_WAKE_RTC
937 bool "Allow Wake-Up from RESET and on-chip RTC"
938 depends on PM
939 default n
940 help
941 Enable RTC Wake-Up (Voltage Regulator Power-Up)
942
943config PM_BFIN_WAKE_PH6
944 bool "Allow Wake-Up from on-chip PHY or PH6 GP"
945 depends on PM && (BF52x || BF534 || BF536 || BF537)
946 default n
947 help
948 Enable PHY and PH6 GP Wake-Up (Voltage Regulator Power-Up)
949
950config PM_BFIN_WAKE_CAN
951 bool "Allow Wake-Up from on-chip CAN0/1"
952 depends on PM && (BF54x || BF534 || BF536 || BF537)
953 default n
954 help
955 Enable CAN0/1 Wake-Up (Voltage Regulator Power-Up)
956
957config PM_BFIN_WAKE_GP
958 bool "Allow Wake-Up from GPIOs"
959 depends on PM && BF54x
960 default n
961 help
962 Enable General-Purpose Wake-Up (Voltage Regulator Power-Up)
963
964config PM_BFIN_WAKE_USB
965 bool "Allow Wake-Up from on-chip USB"
966 depends on PM && (BF54x || BF52x)
967 default n
968 help
969 Enable USB Wake-Up (Voltage Regulator Power-Up)
970
971config PM_BFIN_WAKE_KEYPAD
972 bool "Allow Wake-Up from on-chip Keypad"
973 depends on PM && BF54x
974 default n
975 help
976 Enable Keypad Wake-Up (Voltage Regulator Power-Up)
977
978config PM_BFIN_WAKE_ROTARY
979 bool "Allow Wake-Up from on-chip Rotary"
980 depends on PM && BF54x
981 default n
982 help
983 Enable Rotary Wake-Up (Voltage Regulator Power-Up)
984
957endmenu 985endmenu
958 986
959menu "CPU Frequency scaling" 987menu "CPU Frequency scaling"
diff --git a/arch/blackfin/Kconfig.debug b/arch/blackfin/Kconfig.debug
index c61bdebb9974..c468624d55f0 100644
--- a/arch/blackfin/Kconfig.debug
+++ b/arch/blackfin/Kconfig.debug
@@ -154,13 +154,6 @@ config EARLY_PRINTK
154 all of this lives in the init section and is thrown away after the 154 all of this lives in the init section and is thrown away after the
155 kernel boots completely. 155 kernel boots completely.
156 156
157config DUAL_CORE_TEST_MODULE
158 tristate "Dual Core Test Module"
159 depends on (BF561)
160 default n
161 help
162 Say Y here to build-in dual core test module for dual core test.
163
164config CPLB_INFO 157config CPLB_INFO
165 bool "Display the CPLB information" 158 bool "Display the CPLB information"
166 help 159 help
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 3cbe16caad4b..9564731ad3a8 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -6,8 +6,9 @@
6# for more details. 6# for more details.
7# 7#
8 8
9 9ifeq ($(CROSS_COMPILE),)
10CROSS_COMPILE ?= bfin-uclinux- 10CROSS_COMPILE := bfin-uclinux-
11endif
11LDFLAGS_vmlinux := -X 12LDFLAGS_vmlinux := -X
12OBJCOPYFLAGS := -O binary -R .note -R .comment -S 13OBJCOPYFLAGS := -O binary -R .note -R .comment -S
13GZFLAGS := -9 14GZFLAGS := -9
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index 5e6fb9d8e50f..66854a83c0de 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -1,7 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7 3# Linux kernel version: 2.6.24.7
4# Fri May 16 10:02:29 2008
5# 4#
6# CONFIG_MMU is not set 5# CONFIG_MMU is not set
7# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -290,7 +289,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
290# CONFIG_RESOURCES_64BIT is not set 289# CONFIG_RESOURCES_64BIT is not set
291CONFIG_ZONE_DMA_FLAG=1 290CONFIG_ZONE_DMA_FLAG=1
292CONFIG_VIRT_TO_BUS=y 291CONFIG_VIRT_TO_BUS=y
293# CONFIG_BFIN_GPTIMERS is not set 292CONFIG_BFIN_GPTIMERS=y
294CONFIG_BFIN_DMA_5XX=y 293CONFIG_BFIN_DMA_5XX=y
295# CONFIG_DMA_UNCACHED_4M is not set 294# CONFIG_DMA_UNCACHED_4M is not set
296# CONFIG_DMA_UNCACHED_2M is not set 295# CONFIG_DMA_UNCACHED_2M is not set
@@ -430,7 +429,58 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
430# 429#
431# CONFIG_NET_PKTGEN is not set 430# CONFIG_NET_PKTGEN is not set
432# CONFIG_HAMRADIO is not set 431# CONFIG_HAMRADIO is not set
433# CONFIG_IRDA is not set 432CONFIG_IRDA=m
433
434#
435# IrDA protocols
436#
437CONFIG_IRLAN=m
438CONFIG_IRCOMM=m
439# CONFIG_IRDA_ULTRA is not set
440
441#
442# IrDA options
443#
444# CONFIG_IRDA_CACHE_LAST_LSAP is not set
445# CONFIG_IRDA_FAST_RR is not set
446# CONFIG_IRDA_DEBUG is not set
447
448#
449# Infrared-port device drivers
450#
451
452#
453# SIR device drivers
454#
455CONFIG_IRTTY_SIR=m
456CONFIG_BFIN_SIR=m
457CONFIG_BFIN_SIR0=y
458CONFIG_SIR_BFIN_DMA=y
459# CONFIG_SIR_BFIN_PIO is not set
460
461#
462# Dongle support
463#
464# CONFIG_DONGLE is not set
465# CONFIG_KINGSUN_DONGLE is not set
466# CONFIG_KSDAZZLE_DONGLE is not set
467# CONFIG_KS959_DONGLE is not set
468
469#
470# Old SIR device drivers
471#
472# CONFIG_IRPORT_SIR is not set
473
474#
475# Old Serial dongle support
476#
477
478#
479# FIR device drivers
480#
481# CONFIG_USB_IRDA is not set
482# CONFIG_SIGMATEL_FIR is not set
483# CONFIG_MCS_FIR is not set
434# CONFIG_BT is not set 484# CONFIG_BT is not set
435# CONFIG_AF_RXRPC is not set 485# CONFIG_AF_RXRPC is not set
436 486
@@ -689,8 +739,11 @@ CONFIG_BFIN_OTP=y
689# CONFIG_BFIN_SPORT is not set 739# CONFIG_BFIN_SPORT is not set
690# CONFIG_BFIN_TIMER_LATENCY is not set 740# CONFIG_BFIN_TIMER_LATENCY is not set
691# CONFIG_TWI_LCD is not set 741# CONFIG_TWI_LCD is not set
692# CONFIG_SIMPLE_GPIO is not set 742CONFIG_SIMPLE_GPIO=m
693# CONFIG_VT is not set 743CONFIG_VT=y
744CONFIG_VT_CONSOLE=y
745CONFIG_HW_CONSOLE=y
746# CONFIG_VT_HW_CONSOLE_BINDING is not set
694# CONFIG_SERIAL_NONSTANDARD is not set 747# CONFIG_SERIAL_NONSTANDARD is not set
695 748
696# 749#
@@ -872,8 +925,36 @@ CONFIG_SSB_POSSIBLE=y
872# 925#
873# CONFIG_VGASTATE is not set 926# CONFIG_VGASTATE is not set
874# CONFIG_VIDEO_OUTPUT_CONTROL is not set 927# CONFIG_VIDEO_OUTPUT_CONTROL is not set
875# CONFIG_FB is not set 928CONFIG_FB=y
876# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 929# CONFIG_FIRMWARE_EDID is not set
930# CONFIG_FB_DDC is not set
931CONFIG_FB_CFB_FILLRECT=y
932CONFIG_FB_CFB_COPYAREA=y
933CONFIG_FB_CFB_IMAGEBLIT=y
934# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
935# CONFIG_FB_SYS_FILLRECT is not set
936# CONFIG_FB_SYS_COPYAREA is not set
937# CONFIG_FB_SYS_IMAGEBLIT is not set
938# CONFIG_FB_SYS_FOPS is not set
939CONFIG_FB_DEFERRED_IO=y
940# CONFIG_FB_SVGALIB is not set
941# CONFIG_FB_MACMODES is not set
942# CONFIG_FB_BACKLIGHT is not set
943# CONFIG_FB_MODE_HELPERS is not set
944# CONFIG_FB_TILEBLITTING is not set
945
946#
947# Frame buffer hardware drivers
948#
949CONFIG_FB_BFIN_T350MCQB=y
950# CONFIG_FB_BFIN_7393 is not set
951# CONFIG_FB_S1D13XXX is not set
952# CONFIG_FB_VIRTUAL is not set
953CONFIG_BACKLIGHT_LCD_SUPPORT=y
954CONFIG_LCD_CLASS_DEVICE=m
955CONFIG_LCD_LTV350QV=m
956CONFIG_BACKLIGHT_CLASS_DEVICE=m
957# CONFIG_BACKLIGHT_CORGI is not set
877 958
878# 959#
879# Display device support 960# Display device support
@@ -881,9 +962,99 @@ CONFIG_SSB_POSSIBLE=y
881# CONFIG_DISPLAY_SUPPORT is not set 962# CONFIG_DISPLAY_SUPPORT is not set
882 963
883# 964#
965# Console display driver support
966#
967CONFIG_DUMMY_CONSOLE=y
968CONFIG_FRAMEBUFFER_CONSOLE=y
969# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
970# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
971# CONFIG_FONTS is not set
972CONFIG_FONT_8x8=y
973CONFIG_FONT_8x16=y
974CONFIG_LOGO=y
975# CONFIG_LOGO_LINUX_MONO is not set
976# CONFIG_LOGO_LINUX_VGA16 is not set
977# CONFIG_LOGO_LINUX_CLUT224 is not set
978# CONFIG_LOGO_BLACKFIN_VGA16 is not set
979CONFIG_LOGO_BLACKFIN_CLUT224=y
980
981#
884# Sound 982# Sound
885# 983#
886# CONFIG_SOUND is not set 984CONFIG_SOUND=m
985
986#
987# Advanced Linux Sound Architecture
988#
989CONFIG_SND=m
990CONFIG_SND_TIMER=m
991CONFIG_SND_PCM=m
992# CONFIG_SND_SEQUENCER is not set
993# CONFIG_SND_MIXER_OSS is not set
994# CONFIG_SND_PCM_OSS is not set
995# CONFIG_SND_DYNAMIC_MINORS is not set
996CONFIG_SND_SUPPORT_OLD_API=y
997CONFIG_SND_VERBOSE_PROCFS=y
998# CONFIG_SND_VERBOSE_PRINTK is not set
999# CONFIG_SND_DEBUG is not set
1000
1001#
1002# Generic devices
1003#
1004# CONFIG_SND_DUMMY is not set
1005# CONFIG_SND_MTPAV is not set
1006# CONFIG_SND_SERIAL_U16550 is not set
1007# CONFIG_SND_MPU401 is not set
1008
1009#
1010# SPI devices
1011#
1012
1013#
1014# ALSA Blackfin devices
1015#
1016# CONFIG_SND_BLACKFIN_AD1836 is not set
1017# CONFIG_SND_BLACKFIN_AD1836_TDM is not set
1018# CONFIG_SND_BLACKFIN_AD1836_I2S is not set
1019# CONFIG_SND_BLACKFIN_AD1836_MULSUB is not set
1020# CONFIG_SND_BLACKFIN_AD1836_5P1 is not set
1021# CONFIG_SND_BFIN_AD73311 is not set
1022# CONFIG_SND_BFIN_AD73322 is not set
1023
1024#
1025# USB devices
1026#
1027# CONFIG_SND_USB_AUDIO is not set
1028# CONFIG_SND_USB_CAIAQ is not set
1029
1030#
1031# System on Chip audio support
1032#
1033CONFIG_SND_SOC_AC97_BUS=y
1034CONFIG_SND_SOC=m
1035CONFIG_SND_BF5XX_SOC=m
1036CONFIG_SND_MMAP_SUPPORT=y
1037CONFIG_SND_BF5XX_SOC_I2S=m
1038CONFIG_SND_BF5XX_SOC_AC97=m
1039# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1040# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1041CONFIG_SND_BF5XX_SOC_SSM2602=m
1042CONFIG_SND_BF5XX_SOC_BF5xx=m
1043CONFIG_SND_BF5XX_SPORT_NUM=0
1044# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1045
1046#
1047# SoC Audio support for SuperH
1048#
1049CONFIG_SND_SOC_SSM2602=m
1050# CONFIG_SND_SOC_SSM2602_SPI is not set
1051CONFIG_SND_SOC_AD1980=m
1052
1053#
1054# Open Sound System
1055#
1056# CONFIG_SOUND_PRIME is not set
1057CONFIG_AC97_BUS=m
887CONFIG_HID_SUPPORT=y 1058CONFIG_HID_SUPPORT=y
888CONFIG_HID=y 1059CONFIG_HID=y
889# CONFIG_HID_DEBUG is not set 1060# CONFIG_HID_DEBUG is not set
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 8d817ba01945..6bc11db12690 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.16 3# Linux kernel version: 2.6.24.7
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -13,35 +13,34 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_GPIO=y 16CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14 17CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 20
22# 21#
23# Code maturity level options 22# General setup
24# 23#
25CONFIG_EXPERIMENTAL=y 24CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 25CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 26CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 27CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 28CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 29CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 30CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 31# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 32# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 33# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 37CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 38CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 39CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y
42CONFIG_FAIR_USER_SCHED=y
43# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y 46CONFIG_BLK_DEV_INITRD=y
@@ -64,32 +63,24 @@ CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 63CONFIG_SIGNALFD=y
65CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
66CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
68# CONFIG_NP2 is not set
69CONFIG_SLAB=y 66CONFIG_SLAB=y
70# CONFIG_SLUB is not set 67# CONFIG_SLUB is not set
71# CONFIG_SLOB is not set 68# CONFIG_SLOB is not set
69CONFIG_SLABINFO=y
72CONFIG_RT_MUTEXES=y 70CONFIG_RT_MUTEXES=y
73CONFIG_TINY_SHMEM=y 71CONFIG_TINY_SHMEM=y
74CONFIG_BASE_SMALL=0 72CONFIG_BASE_SMALL=0
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y 73CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y 74CONFIG_MODULE_UNLOAD=y
81# CONFIG_MODULE_FORCE_UNLOAD is not set 75# CONFIG_MODULE_FORCE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set 76# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set 77# CONFIG_MODULE_SRCVERSION_ALL is not set
84CONFIG_KMOD=y 78CONFIG_KMOD=y
85
86#
87# Block layer
88#
89CONFIG_BLOCK=y 79CONFIG_BLOCK=y
90# CONFIG_LBD is not set 80# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set 81# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set 82# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set
93 84
94# 85#
95# IO Schedulers 86# IO Schedulers
@@ -141,12 +132,12 @@ CONFIG_BF_REV_0_3=y
141# CONFIG_BF_REV_ANY is not set 132# CONFIG_BF_REV_ANY is not set
142# CONFIG_BF_REV_NONE is not set 133# CONFIG_BF_REV_NONE is not set
143CONFIG_BF53x=y 134CONFIG_BF53x=y
144CONFIG_BFIN_SINGLE_CORE=y
145CONFIG_MEM_MT48LC16M16A2TG_75=y 135CONFIG_MEM_MT48LC16M16A2TG_75=y
146CONFIG_BFIN533_EZKIT=y 136CONFIG_BFIN533_EZKIT=y
147# CONFIG_BFIN533_STAMP is not set 137# CONFIG_BFIN533_STAMP is not set
148# CONFIG_BFIN533_BLUETECHNIX_CM is not set 138# CONFIG_BFIN533_BLUETECHNIX_CM is not set
149# CONFIG_H8606_HVSISTEMAS is not set 139# CONFIG_H8606_HVSISTEMAS is not set
140# CONFIG_BFIN532_IP0X is not set
150# CONFIG_GENERIC_BF533_BOARD is not set 141# CONFIG_GENERIC_BF533_BOARD is not set
151 142
152# 143#
@@ -189,12 +180,14 @@ CONFIG_WDTIMER=13
189# Board customizations 180# Board customizations
190# 181#
191# CONFIG_CMDLINE_BOOL is not set 182# CONFIG_CMDLINE_BOOL is not set
183CONFIG_BOOT_LOAD=0x1000
192 184
193# 185#
194# Clock/PLL Setup 186# Clock/PLL Setup
195# 187#
196CONFIG_CLKIN_HZ=27000000 188CONFIG_CLKIN_HZ=27000000
197# CONFIG_BFIN_KERNEL_CLOCK is not set 189# CONFIG_BFIN_KERNEL_CLOCK is not set
190CONFIG_MAX_MEM_SIZE=512
198CONFIG_MAX_VCO_HZ=750000000 191CONFIG_MAX_VCO_HZ=750000000
199CONFIG_MIN_VCO_HZ=50000000 192CONFIG_MIN_VCO_HZ=50000000
200CONFIG_MAX_SCLK_HZ=133333333 193CONFIG_MAX_SCLK_HZ=133333333
@@ -208,13 +201,17 @@ CONFIG_HZ_250=y
208# CONFIG_HZ_300 is not set 201# CONFIG_HZ_300 is not set
209# CONFIG_HZ_1000 is not set 202# CONFIG_HZ_1000 is not set
210CONFIG_HZ=250 203CONFIG_HZ=250
204CONFIG_GENERIC_TIME=y
205CONFIG_GENERIC_CLOCKEVENTS=y
206# CONFIG_CYCLES_CLOCKSOURCE is not set
207CONFIG_TICK_ONESHOT=y
208# CONFIG_NO_HZ is not set
209CONFIG_HIGH_RES_TIMERS=y
210CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
211 211
212# 212#
213# Memory Setup 213# Misc
214# 214#
215CONFIG_MAX_MEM_SIZE=512
216CONFIG_MEM_ADD_WIDTH=9
217CONFIG_BOOT_LOAD=0x1000
218CONFIG_BFIN_SCRATCH_REG_RETN=y 215CONFIG_BFIN_SCRATCH_REG_RETN=y
219# CONFIG_BFIN_SCRATCH_REG_RETE is not set 216# CONFIG_BFIN_SCRATCH_REG_RETE is not set
220# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 217# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
@@ -250,12 +247,14 @@ CONFIG_FLATMEM_MANUAL=y
250CONFIG_FLATMEM=y 247CONFIG_FLATMEM=y
251CONFIG_FLAT_NODE_MEM_MAP=y 248CONFIG_FLAT_NODE_MEM_MAP=y
252# CONFIG_SPARSEMEM_STATIC is not set 249# CONFIG_SPARSEMEM_STATIC is not set
250# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
253CONFIG_SPLIT_PTLOCK_CPUS=4 251CONFIG_SPLIT_PTLOCK_CPUS=4
254# CONFIG_RESOURCES_64BIT is not set 252# CONFIG_RESOURCES_64BIT is not set
255CONFIG_ZONE_DMA_FLAG=1 253CONFIG_ZONE_DMA_FLAG=1
256CONFIG_LARGE_ALLOCS=y 254CONFIG_VIRT_TO_BUS=y
257# CONFIG_BFIN_GPTIMERS is not set 255# CONFIG_BFIN_GPTIMERS is not set
258CONFIG_BFIN_DMA_5XX=y 256CONFIG_BFIN_DMA_5XX=y
257# CONFIG_DMA_UNCACHED_4M is not set
259# CONFIG_DMA_UNCACHED_2M is not set 258# CONFIG_DMA_UNCACHED_2M is not set
260CONFIG_DMA_UNCACHED_1M=y 259CONFIG_DMA_UNCACHED_1M=y
261# CONFIG_DMA_UNCACHED_NONE is not set 260# CONFIG_DMA_UNCACHED_NONE is not set
@@ -293,17 +292,13 @@ CONFIG_C_AMBEN_ALL=y
293CONFIG_BANK_0=0x7BB0 292CONFIG_BANK_0=0x7BB0
294CONFIG_BANK_1=0x7BB0 293CONFIG_BANK_1=0x7BB0
295CONFIG_BANK_2=0x7BB0 294CONFIG_BANK_2=0x7BB0
296CONFIG_BANK_3=0xAAC3 295CONFIG_BANK_3=0xAAC2
297 296
298# 297#
299# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 298# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
300# 299#
301# CONFIG_PCI is not set 300# CONFIG_PCI is not set
302# CONFIG_ARCH_SUPPORTS_MSI is not set 301# CONFIG_ARCH_SUPPORTS_MSI is not set
303
304#
305# PCCARD (PCMCIA/CardBus) support
306#
307# CONFIG_PCCARD is not set 302# CONFIG_PCCARD is not set
308 303
309# 304#
@@ -321,7 +316,9 @@ CONFIG_BINFMT_ZFLAT=y
321CONFIG_PM=y 316CONFIG_PM=y
322# CONFIG_PM_LEGACY is not set 317# CONFIG_PM_LEGACY is not set
323# CONFIG_PM_DEBUG is not set 318# CONFIG_PM_DEBUG is not set
324# CONFIG_PM_SYSFS_DEPRECATED is not set 319CONFIG_PM_SLEEP=y
320CONFIG_SUSPEND_UP_POSSIBLE=y
321CONFIG_SUSPEND=y
325CONFIG_PM_BFIN_SLEEP_DEEPER=y 322CONFIG_PM_BFIN_SLEEP_DEEPER=y
326# CONFIG_PM_BFIN_SLEEP is not set 323# CONFIG_PM_BFIN_SLEEP is not set
327# CONFIG_PM_WAKEUP_BY_GPIO is not set 324# CONFIG_PM_WAKEUP_BY_GPIO is not set
@@ -367,6 +364,7 @@ CONFIG_SYN_COOKIES=y
367CONFIG_INET_XFRM_MODE_TRANSPORT=y 364CONFIG_INET_XFRM_MODE_TRANSPORT=y
368CONFIG_INET_XFRM_MODE_TUNNEL=y 365CONFIG_INET_XFRM_MODE_TUNNEL=y
369CONFIG_INET_XFRM_MODE_BEET=y 366CONFIG_INET_XFRM_MODE_BEET=y
367# CONFIG_INET_LRO is not set
370CONFIG_INET_DIAG=y 368CONFIG_INET_DIAG=y
371CONFIG_INET_TCP_DIAG=y 369CONFIG_INET_TCP_DIAG=y
372# CONFIG_TCP_CONG_ADVANCED is not set 370# CONFIG_TCP_CONG_ADVANCED is not set
@@ -393,10 +391,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
393# CONFIG_LAPB is not set 391# CONFIG_LAPB is not set
394# CONFIG_ECONET is not set 392# CONFIG_ECONET is not set
395# CONFIG_WAN_ROUTER is not set 393# CONFIG_WAN_ROUTER is not set
396
397#
398# QoS and/or fair queueing
399#
400# CONFIG_NET_SCHED is not set 394# CONFIG_NET_SCHED is not set
401 395
402# 396#
@@ -428,6 +422,7 @@ CONFIG_IRDA_CACHE_LAST_LSAP=y
428# SIR device drivers 422# SIR device drivers
429# 423#
430CONFIG_IRTTY_SIR=m 424CONFIG_IRTTY_SIR=m
425# CONFIG_BFIN_SIR is not set
431 426
432# 427#
433# Dongle support 428# Dongle support
@@ -457,6 +452,7 @@ CONFIG_IRTTY_SIR=m
457# CONFIG_MAC80211 is not set 452# CONFIG_MAC80211 is not set
458# CONFIG_IEEE80211 is not set 453# CONFIG_IEEE80211 is not set
459# CONFIG_RFKILL is not set 454# CONFIG_RFKILL is not set
455# CONFIG_NET_9P is not set
460 456
461# 457#
462# Device Drivers 458# Device Drivers
@@ -465,14 +461,11 @@ CONFIG_IRTTY_SIR=m
465# 461#
466# Generic Driver Options 462# Generic Driver Options
467# 463#
464CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
468CONFIG_STANDALONE=y 465CONFIG_STANDALONE=y
469CONFIG_PREVENT_FIRMWARE_BUILD=y 466CONFIG_PREVENT_FIRMWARE_BUILD=y
470# CONFIG_FW_LOADER is not set 467# CONFIG_FW_LOADER is not set
471# CONFIG_SYS_HYPERVISOR is not set 468# CONFIG_SYS_HYPERVISOR is not set
472
473#
474# Connector - unified userspace <-> kernelspace linker
475#
476# CONFIG_CONNECTOR is not set 469# CONFIG_CONNECTOR is not set
477CONFIG_MTD=y 470CONFIG_MTD=y
478# CONFIG_MTD_DEBUG is not set 471# CONFIG_MTD_DEBUG is not set
@@ -492,6 +485,7 @@ CONFIG_MTD_BLOCK=y
492# CONFIG_INFTL is not set 485# CONFIG_INFTL is not set
493# CONFIG_RFD_FTL is not set 486# CONFIG_RFD_FTL is not set
494# CONFIG_SSFDC is not set 487# CONFIG_SSFDC is not set
488# CONFIG_MTD_OOPS is not set
495 489
496# 490#
497# RAM/ROM/Flash chip drivers 491# RAM/ROM/Flash chip drivers
@@ -548,20 +542,8 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
548# UBI - Unsorted block images 542# UBI - Unsorted block images
549# 543#
550# CONFIG_MTD_UBI is not set 544# CONFIG_MTD_UBI is not set
551
552#
553# Parallel port support
554#
555# CONFIG_PARPORT is not set 545# CONFIG_PARPORT is not set
556 546CONFIG_BLK_DEV=y
557#
558# Plug and Play support
559#
560# CONFIG_PNPACPI is not set
561
562#
563# Block devices
564#
565# CONFIG_BLK_DEV_COW_COMMON is not set 547# CONFIG_BLK_DEV_COW_COMMON is not set
566# CONFIG_BLK_DEV_LOOP is not set 548# CONFIG_BLK_DEV_LOOP is not set
567# CONFIG_BLK_DEV_NBD is not set 549# CONFIG_BLK_DEV_NBD is not set
@@ -571,10 +553,8 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
571CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 553CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
572# CONFIG_CDROM_PKTCDVD is not set 554# CONFIG_CDROM_PKTCDVD is not set
573# CONFIG_ATA_OVER_ETH is not set 555# CONFIG_ATA_OVER_ETH is not set
574 556CONFIG_MISC_DEVICES=y
575# 557# CONFIG_EEPROM_93CX6 is not set
576# Misc devices
577#
578# CONFIG_IDE is not set 558# CONFIG_IDE is not set
579 559
580# 560#
@@ -582,32 +562,29 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
582# 562#
583# CONFIG_RAID_ATTRS is not set 563# CONFIG_RAID_ATTRS is not set
584# CONFIG_SCSI is not set 564# CONFIG_SCSI is not set
565# CONFIG_SCSI_DMA is not set
585# CONFIG_SCSI_NETLINK is not set 566# CONFIG_SCSI_NETLINK is not set
586# CONFIG_ATA is not set 567# CONFIG_ATA is not set
587
588#
589# Multi-device support (RAID and LVM)
590#
591# CONFIG_MD is not set 568# CONFIG_MD is not set
592
593#
594# Network device support
595#
596CONFIG_NETDEVICES=y 569CONFIG_NETDEVICES=y
570# CONFIG_NETDEVICES_MULTIQUEUE is not set
597# CONFIG_DUMMY is not set 571# CONFIG_DUMMY is not set
598# CONFIG_BONDING is not set 572# CONFIG_BONDING is not set
573# CONFIG_MACVLAN is not set
599# CONFIG_EQUALIZER is not set 574# CONFIG_EQUALIZER is not set
600# CONFIG_TUN is not set 575# CONFIG_TUN is not set
576# CONFIG_VETH is not set
601# CONFIG_PHYLIB is not set 577# CONFIG_PHYLIB is not set
602
603#
604# Ethernet (10 or 100Mbit)
605#
606CONFIG_NET_ETHERNET=y 578CONFIG_NET_ETHERNET=y
607CONFIG_MII=y 579CONFIG_MII=y
608CONFIG_SMC91X=y 580CONFIG_SMC91X=y
609# CONFIG_SMSC911X is not set 581# CONFIG_SMSC911X is not set
610# CONFIG_DM9000 is not set 582# CONFIG_DM9000 is not set
583# CONFIG_IBM_NEW_EMAC_ZMII is not set
584# CONFIG_IBM_NEW_EMAC_RGMII is not set
585# CONFIG_IBM_NEW_EMAC_TAH is not set
586# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
587# CONFIG_B44 is not set
611CONFIG_NETDEV_1000=y 588CONFIG_NETDEV_1000=y
612# CONFIG_AX88180 is not set 589# CONFIG_AX88180 is not set
613CONFIG_NETDEV_10000=y 590CONFIG_NETDEV_10000=y
@@ -624,15 +601,7 @@ CONFIG_NETDEV_10000=y
624# CONFIG_NETCONSOLE is not set 601# CONFIG_NETCONSOLE is not set
625# CONFIG_NETPOLL is not set 602# CONFIG_NETPOLL is not set
626# CONFIG_NET_POLL_CONTROLLER is not set 603# CONFIG_NET_POLL_CONTROLLER is not set
627
628#
629# ISDN subsystem
630#
631# CONFIG_ISDN is not set 604# CONFIG_ISDN is not set
632
633#
634# Telephony Support
635#
636# CONFIG_PHONE is not set 605# CONFIG_PHONE is not set
637 606
638# 607#
@@ -647,7 +616,6 @@ CONFIG_INPUT=m
647# 616#
648# CONFIG_INPUT_MOUSEDEV is not set 617# CONFIG_INPUT_MOUSEDEV is not set
649# CONFIG_INPUT_JOYDEV is not set 618# CONFIG_INPUT_JOYDEV is not set
650# CONFIG_INPUT_TSDEV is not set
651CONFIG_INPUT_EVDEV=m 619CONFIG_INPUT_EVDEV=m
652# CONFIG_INPUT_EVBUG is not set 620# CONFIG_INPUT_EVBUG is not set
653 621
@@ -672,13 +640,12 @@ CONFIG_INPUT_EVDEV=m
672# 640#
673# CONFIG_AD9960 is not set 641# CONFIG_AD9960 is not set
674# CONFIG_SPI_ADC_BF533 is not set 642# CONFIG_SPI_ADC_BF533 is not set
675# CONFIG_BF5xx_PFLAGS is not set
676# CONFIG_BF5xx_PPIFCD is not set 643# CONFIG_BF5xx_PPIFCD is not set
677# CONFIG_BFIN_SIMPLE_TIMER is not set 644# CONFIG_BFIN_SIMPLE_TIMER is not set
678# CONFIG_BF5xx_PPI is not set 645# CONFIG_BF5xx_PPI is not set
679CONFIG_BFIN_SPORT=y 646CONFIG_BFIN_SPORT=y
680# CONFIG_BFIN_TIMER_LATENCY is not set 647# CONFIG_BFIN_TIMER_LATENCY is not set
681# CONFIG_AD5304 is not set 648CONFIG_SIMPLE_GPIO=m
682# CONFIG_VT is not set 649# CONFIG_VT is not set
683# CONFIG_SERIAL_NONSTANDARD is not set 650# CONFIG_SERIAL_NONSTANDARD is not set
684 651
@@ -706,28 +673,11 @@ CONFIG_UNIX98_PTYS=y
706# CAN, the car bus and industrial fieldbus 673# CAN, the car bus and industrial fieldbus
707# 674#
708# CONFIG_CAN4LINUX is not set 675# CONFIG_CAN4LINUX is not set
709
710#
711# IPMI
712#
713# CONFIG_IPMI_HANDLER is not set 676# CONFIG_IPMI_HANDLER is not set
714CONFIG_WATCHDOG=y
715# CONFIG_WATCHDOG_NOWAYOUT is not set
716
717#
718# Watchdog Device Drivers
719#
720# CONFIG_SOFT_WATCHDOG is not set
721CONFIG_BFIN_WDT=y
722CONFIG_HW_RANDOM=y 677CONFIG_HW_RANDOM=y
723# CONFIG_GEN_RTC is not set 678# CONFIG_GEN_RTC is not set
724CONFIG_BLACKFIN_DPMC=y
725# CONFIG_R3964 is not set 679# CONFIG_R3964 is not set
726# CONFIG_RAW_DRIVER is not set 680# CONFIG_RAW_DRIVER is not set
727
728#
729# TPM devices
730#
731# CONFIG_TCG_TPM is not set 681# CONFIG_TCG_TPM is not set
732# CONFIG_I2C is not set 682# CONFIG_I2C is not set
733 683
@@ -748,22 +698,37 @@ CONFIG_SPI_BFIN=y
748# 698#
749# CONFIG_SPI_AT25 is not set 699# CONFIG_SPI_AT25 is not set
750# CONFIG_SPI_SPIDEV is not set 700# CONFIG_SPI_SPIDEV is not set
751 701# CONFIG_SPI_TLE62X0 is not set
752#
753# Dallas's 1-wire bus
754#
755# CONFIG_W1 is not set 702# CONFIG_W1 is not set
703# CONFIG_POWER_SUPPLY is not set
756CONFIG_HWMON=y 704CONFIG_HWMON=y
757# CONFIG_HWMON_VID is not set 705# CONFIG_HWMON_VID is not set
758# CONFIG_SENSORS_ABITUGURU is not set
759# CONFIG_SENSORS_F71805F is not set 706# CONFIG_SENSORS_F71805F is not set
707# CONFIG_SENSORS_F71882FG is not set
708# CONFIG_SENSORS_IT87 is not set
760# CONFIG_SENSORS_LM70 is not set 709# CONFIG_SENSORS_LM70 is not set
710# CONFIG_SENSORS_PC87360 is not set
761# CONFIG_SENSORS_PC87427 is not set 711# CONFIG_SENSORS_PC87427 is not set
762# CONFIG_SENSORS_SMSC47M1 is not set 712# CONFIG_SENSORS_SMSC47M1 is not set
763# CONFIG_SENSORS_SMSC47B397 is not set 713# CONFIG_SENSORS_SMSC47B397 is not set
764# CONFIG_SENSORS_VT1211 is not set 714# CONFIG_SENSORS_VT1211 is not set
765# CONFIG_SENSORS_W83627HF is not set 715# CONFIG_SENSORS_W83627HF is not set
716# CONFIG_SENSORS_W83627EHF is not set
766# CONFIG_HWMON_DEBUG_CHIP is not set 717# CONFIG_HWMON_DEBUG_CHIP is not set
718CONFIG_WATCHDOG=y
719# CONFIG_WATCHDOG_NOWAYOUT is not set
720
721#
722# Watchdog Device Drivers
723#
724# CONFIG_SOFT_WATCHDOG is not set
725CONFIG_BFIN_WDT=y
726
727#
728# Sonics Silicon Backplane
729#
730CONFIG_SSB_POSSIBLE=y
731# CONFIG_SSB is not set
767 732
768# 733#
769# Multifunction device drivers 734# Multifunction device drivers
@@ -780,72 +745,27 @@ CONFIG_DAB=y
780# 745#
781# Graphics support 746# Graphics support
782# 747#
748# CONFIG_VGASTATE is not set
749# CONFIG_VIDEO_OUTPUT_CONTROL is not set
750# CONFIG_FB is not set
783# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 751# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
784 752
785# 753#
786# Display device support 754# Display device support
787# 755#
788# CONFIG_DISPLAY_SUPPORT is not set 756# CONFIG_DISPLAY_SUPPORT is not set
789# CONFIG_VGASTATE is not set
790# CONFIG_FB is not set
791 757
792# 758#
793# Sound 759# Sound
794# 760#
795# CONFIG_SOUND is not set 761# CONFIG_SOUND is not set
796 762CONFIG_HID_SUPPORT=y
797#
798# HID Devices
799#
800CONFIG_HID=m 763CONFIG_HID=m
801# CONFIG_HID_DEBUG is not set 764# CONFIG_HID_DEBUG is not set
802 765# CONFIG_HIDRAW is not set
803# 766# CONFIG_USB_SUPPORT is not set
804# USB support
805#
806CONFIG_USB_ARCH_HAS_HCD=y
807# CONFIG_USB_ARCH_HAS_OHCI is not set
808# CONFIG_USB_ARCH_HAS_EHCI is not set
809# CONFIG_USB is not set
810
811#
812# Enable Host or Gadget support to see Inventra options
813#
814
815#
816# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
817#
818
819#
820# USB Gadget Support
821#
822# CONFIG_USB_GADGET is not set
823# CONFIG_MMC is not set 767# CONFIG_MMC is not set
824
825#
826# LED devices
827#
828# CONFIG_NEW_LEDS is not set 768# CONFIG_NEW_LEDS is not set
829
830#
831# LED drivers
832#
833
834#
835# LED Triggers
836#
837
838#
839# InfiniBand support
840#
841
842#
843# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
844#
845
846#
847# Real Time Clock
848#
849CONFIG_RTC_LIB=y 769CONFIG_RTC_LIB=y
850CONFIG_RTC_CLASS=y 770CONFIG_RTC_CLASS=y
851CONFIG_RTC_HCTOSYS=y 771CONFIG_RTC_HCTOSYS=y
@@ -862,10 +782,6 @@ CONFIG_RTC_INTF_DEV=y
862# CONFIG_RTC_DRV_TEST is not set 782# CONFIG_RTC_DRV_TEST is not set
863 783
864# 784#
865# I2C RTC drivers
866#
867
868#
869# SPI RTC drivers 785# SPI RTC drivers
870# 786#
871# CONFIG_RTC_DRV_RS5C348 is not set 787# CONFIG_RTC_DRV_RS5C348 is not set
@@ -875,8 +791,10 @@ CONFIG_RTC_INTF_DEV=y
875# Platform RTC drivers 791# Platform RTC drivers
876# 792#
877# CONFIG_RTC_DRV_DS1553 is not set 793# CONFIG_RTC_DRV_DS1553 is not set
794# CONFIG_RTC_DRV_STK17TA8 is not set
878# CONFIG_RTC_DRV_DS1742 is not set 795# CONFIG_RTC_DRV_DS1742 is not set
879# CONFIG_RTC_DRV_M48T86 is not set 796# CONFIG_RTC_DRV_M48T86 is not set
797# CONFIG_RTC_DRV_M48T59 is not set
880# CONFIG_RTC_DRV_V3020 is not set 798# CONFIG_RTC_DRV_V3020 is not set
881 799
882# 800#
@@ -885,22 +803,9 @@ CONFIG_RTC_INTF_DEV=y
885CONFIG_RTC_DRV_BFIN=y 803CONFIG_RTC_DRV_BFIN=y
886 804
887# 805#
888# DMA Engine support 806# Userspace I/O
889#
890# CONFIG_DMA_ENGINE is not set
891
892#
893# DMA Clients
894#
895
896#
897# DMA Devices
898# 807#
899 808# CONFIG_UIO is not set
900#
901# PBX support
902#
903# CONFIG_PBX is not set
904 809
905# 810#
906# File systems 811# File systems
@@ -945,7 +850,6 @@ CONFIG_PROC_SYSCTL=y
945CONFIG_SYSFS=y 850CONFIG_SYSFS=y
946# CONFIG_TMPFS is not set 851# CONFIG_TMPFS is not set
947# CONFIG_HUGETLB_PAGE is not set 852# CONFIG_HUGETLB_PAGE is not set
948CONFIG_RAMFS=y
949# CONFIG_CONFIGFS_FS is not set 853# CONFIG_CONFIGFS_FS is not set
950 854
951# 855#
@@ -971,10 +875,12 @@ CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
971CONFIG_JFFS2_FS=m 875CONFIG_JFFS2_FS=m
972CONFIG_JFFS2_FS_DEBUG=0 876CONFIG_JFFS2_FS_DEBUG=0
973CONFIG_JFFS2_FS_WRITEBUFFER=y 877CONFIG_JFFS2_FS_WRITEBUFFER=y
878# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
974# CONFIG_JFFS2_SUMMARY is not set 879# CONFIG_JFFS2_SUMMARY is not set
975# CONFIG_JFFS2_FS_XATTR is not set 880# CONFIG_JFFS2_FS_XATTR is not set
976# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 881# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
977CONFIG_JFFS2_ZLIB=y 882CONFIG_JFFS2_ZLIB=y
883# CONFIG_JFFS2_LZO is not set
978CONFIG_JFFS2_RTIME=y 884CONFIG_JFFS2_RTIME=y
979# CONFIG_JFFS2_RUBIN is not set 885# CONFIG_JFFS2_RUBIN is not set
980# CONFIG_CRAMFS is not set 886# CONFIG_CRAMFS is not set
@@ -983,10 +889,7 @@ CONFIG_JFFS2_RTIME=y
983# CONFIG_QNX4FS_FS is not set 889# CONFIG_QNX4FS_FS is not set
984# CONFIG_SYSV_FS is not set 890# CONFIG_SYSV_FS is not set
985# CONFIG_UFS_FS is not set 891# CONFIG_UFS_FS is not set
986 892CONFIG_NETWORK_FILESYSTEMS=y
987#
988# Network File Systems
989#
990CONFIG_NFS_FS=m 893CONFIG_NFS_FS=m
991CONFIG_NFS_V3=y 894CONFIG_NFS_V3=y
992# CONFIG_NFS_V3_ACL is not set 895# CONFIG_NFS_V3_ACL is not set
@@ -1006,17 +909,12 @@ CONFIG_SMB_FS=m
1006# CONFIG_NCP_FS is not set 909# CONFIG_NCP_FS is not set
1007# CONFIG_CODA_FS is not set 910# CONFIG_CODA_FS is not set
1008# CONFIG_AFS_FS is not set 911# CONFIG_AFS_FS is not set
1009# CONFIG_9P_FS is not set
1010 912
1011# 913#
1012# Partition Types 914# Partition Types
1013# 915#
1014# CONFIG_PARTITION_ADVANCED is not set 916# CONFIG_PARTITION_ADVANCED is not set
1015CONFIG_MSDOS_PARTITION=y 917CONFIG_MSDOS_PARTITION=y
1016
1017#
1018# Native Language Support
1019#
1020CONFIG_NLS=m 918CONFIG_NLS=m
1021CONFIG_NLS_DEFAULT="iso8859-1" 919CONFIG_NLS_DEFAULT="iso8859-1"
1022# CONFIG_NLS_CODEPAGE_437 is not set 920# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1057,21 +955,16 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1057# CONFIG_NLS_KOI8_R is not set 955# CONFIG_NLS_KOI8_R is not set
1058# CONFIG_NLS_KOI8_U is not set 956# CONFIG_NLS_KOI8_U is not set
1059# CONFIG_NLS_UTF8 is not set 957# CONFIG_NLS_UTF8 is not set
1060
1061#
1062# Distributed Lock Manager
1063#
1064# CONFIG_DLM is not set 958# CONFIG_DLM is not set
1065 959CONFIG_INSTRUMENTATION=y
1066#
1067# Profiling support
1068#
1069# CONFIG_PROFILING is not set 960# CONFIG_PROFILING is not set
961# CONFIG_MARKERS is not set
1070 962
1071# 963#
1072# Kernel hacking 964# Kernel hacking
1073# 965#
1074# CONFIG_PRINTK_TIME is not set 966# CONFIG_PRINTK_TIME is not set
967CONFIG_ENABLE_WARN_DEPRECATED=y
1075CONFIG_ENABLE_MUST_CHECK=y 968CONFIG_ENABLE_MUST_CHECK=y
1076# CONFIG_MAGIC_SYSRQ is not set 969# CONFIG_MAGIC_SYSRQ is not set
1077# CONFIG_UNUSED_SYMBOLS is not set 970# CONFIG_UNUSED_SYMBOLS is not set
@@ -1079,6 +972,7 @@ CONFIG_DEBUG_FS=y
1079# CONFIG_HEADERS_CHECK is not set 972# CONFIG_HEADERS_CHECK is not set
1080# CONFIG_DEBUG_KERNEL is not set 973# CONFIG_DEBUG_KERNEL is not set
1081# CONFIG_DEBUG_BUGVERBOSE is not set 974# CONFIG_DEBUG_BUGVERBOSE is not set
975# CONFIG_SAMPLES is not set
1082CONFIG_DEBUG_MMRS=y 976CONFIG_DEBUG_MMRS=y
1083CONFIG_DEBUG_HUNT_FOR_ZERO=y 977CONFIG_DEBUG_HUNT_FOR_ZERO=y
1084CONFIG_DEBUG_BFIN_HWTRACE_ON=y 978CONFIG_DEBUG_BFIN_HWTRACE_ON=y
@@ -1098,11 +992,7 @@ CONFIG_ACCESS_CHECK=y
1098# CONFIG_KEYS is not set 992# CONFIG_KEYS is not set
1099CONFIG_SECURITY=y 993CONFIG_SECURITY=y
1100# CONFIG_SECURITY_NETWORK is not set 994# CONFIG_SECURITY_NETWORK is not set
1101CONFIG_SECURITY_CAPABILITIES=m 995# CONFIG_SECURITY_CAPABILITIES is not set
1102
1103#
1104# Cryptographic options
1105#
1106# CONFIG_CRYPTO is not set 996# CONFIG_CRYPTO is not set
1107 997
1108# 998#
@@ -1113,6 +1003,7 @@ CONFIG_CRC_CCITT=m
1113# CONFIG_CRC16 is not set 1003# CONFIG_CRC16 is not set
1114# CONFIG_CRC_ITU_T is not set 1004# CONFIG_CRC_ITU_T is not set
1115CONFIG_CRC32=y 1005CONFIG_CRC32=y
1006# CONFIG_CRC7 is not set
1116# CONFIG_LIBCRC32C is not set 1007# CONFIG_LIBCRC32C is not set
1117CONFIG_ZLIB_INFLATE=y 1008CONFIG_ZLIB_INFLATE=y
1118CONFIG_ZLIB_DEFLATE=m 1009CONFIG_ZLIB_DEFLATE=m
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index 20d598d17bd1..d77d991a1f61 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.16 3# Linux kernel version: 2.6.24.7
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -13,35 +13,34 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_GPIO=y 16CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14 17CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 20
22# 21#
23# Code maturity level options 22# General setup
24# 23#
25CONFIG_EXPERIMENTAL=y 24CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 25CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 26CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 27CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 28CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 29CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 30CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 31# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 32# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 33# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 37CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 38CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 39CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y
42CONFIG_FAIR_USER_SCHED=y
43# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y 46CONFIG_BLK_DEV_INITRD=y
@@ -64,32 +63,24 @@ CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 63CONFIG_SIGNALFD=y
65CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
66CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
68# CONFIG_NP2 is not set
69CONFIG_SLAB=y 66CONFIG_SLAB=y
70# CONFIG_SLUB is not set 67# CONFIG_SLUB is not set
71# CONFIG_SLOB is not set 68# CONFIG_SLOB is not set
69CONFIG_SLABINFO=y
72CONFIG_RT_MUTEXES=y 70CONFIG_RT_MUTEXES=y
73CONFIG_TINY_SHMEM=y 71CONFIG_TINY_SHMEM=y
74CONFIG_BASE_SMALL=0 72CONFIG_BASE_SMALL=0
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y 73CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y 74CONFIG_MODULE_UNLOAD=y
81# CONFIG_MODULE_FORCE_UNLOAD is not set 75# CONFIG_MODULE_FORCE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set 76# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set 77# CONFIG_MODULE_SRCVERSION_ALL is not set
84CONFIG_KMOD=y 78CONFIG_KMOD=y
85
86#
87# Block layer
88#
89CONFIG_BLOCK=y 79CONFIG_BLOCK=y
90# CONFIG_LBD is not set 80# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set 81# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set 82# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set
93 84
94# 85#
95# IO Schedulers 86# IO Schedulers
@@ -141,12 +132,12 @@ CONFIG_BF_REV_0_3=y
141# CONFIG_BF_REV_ANY is not set 132# CONFIG_BF_REV_ANY is not set
142# CONFIG_BF_REV_NONE is not set 133# CONFIG_BF_REV_NONE is not set
143CONFIG_BF53x=y 134CONFIG_BF53x=y
144CONFIG_BFIN_SINGLE_CORE=y
145CONFIG_MEM_MT48LC64M4A2FB_7E=y 135CONFIG_MEM_MT48LC64M4A2FB_7E=y
146# CONFIG_BFIN533_EZKIT is not set 136# CONFIG_BFIN533_EZKIT is not set
147CONFIG_BFIN533_STAMP=y 137CONFIG_BFIN533_STAMP=y
148# CONFIG_BFIN533_BLUETECHNIX_CM is not set 138# CONFIG_BFIN533_BLUETECHNIX_CM is not set
149# CONFIG_H8606_HVSISTEMAS is not set 139# CONFIG_H8606_HVSISTEMAS is not set
140# CONFIG_BFIN532_IP0X is not set
150# CONFIG_GENERIC_BF533_BOARD is not set 141# CONFIG_GENERIC_BF533_BOARD is not set
151 142
152# 143#
@@ -189,12 +180,14 @@ CONFIG_WDTIMER=13
189# Board customizations 180# Board customizations
190# 181#
191# CONFIG_CMDLINE_BOOL is not set 182# CONFIG_CMDLINE_BOOL is not set
183CONFIG_BOOT_LOAD=0x1000
192 184
193# 185#
194# Clock/PLL Setup 186# Clock/PLL Setup
195# 187#
196CONFIG_CLKIN_HZ=11059200 188CONFIG_CLKIN_HZ=11059200
197# CONFIG_BFIN_KERNEL_CLOCK is not set 189# CONFIG_BFIN_KERNEL_CLOCK is not set
190CONFIG_MAX_MEM_SIZE=512
198CONFIG_MAX_VCO_HZ=750000000 191CONFIG_MAX_VCO_HZ=750000000
199CONFIG_MIN_VCO_HZ=50000000 192CONFIG_MIN_VCO_HZ=50000000
200CONFIG_MAX_SCLK_HZ=133333333 193CONFIG_MAX_SCLK_HZ=133333333
@@ -208,14 +201,17 @@ CONFIG_HZ_250=y
208# CONFIG_HZ_300 is not set 201# CONFIG_HZ_300 is not set
209# CONFIG_HZ_1000 is not set 202# CONFIG_HZ_1000 is not set
210CONFIG_HZ=250 203CONFIG_HZ=250
204CONFIG_GENERIC_TIME=y
205CONFIG_GENERIC_CLOCKEVENTS=y
206# CONFIG_CYCLES_CLOCKSOURCE is not set
207CONFIG_TICK_ONESHOT=y
208# CONFIG_NO_HZ is not set
209CONFIG_HIGH_RES_TIMERS=y
210CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
211 211
212# 212#
213# Memory Setup 213# Misc
214# 214#
215CONFIG_MAX_MEM_SIZE=512
216CONFIG_MEM_ADD_WIDTH=11
217CONFIG_ENET_FLASH_PIN=0
218CONFIG_BOOT_LOAD=0x1000
219CONFIG_BFIN_SCRATCH_REG_RETN=y 215CONFIG_BFIN_SCRATCH_REG_RETN=y
220# CONFIG_BFIN_SCRATCH_REG_RETE is not set 216# CONFIG_BFIN_SCRATCH_REG_RETE is not set
221# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 217# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
@@ -251,12 +247,14 @@ CONFIG_FLATMEM_MANUAL=y
251CONFIG_FLATMEM=y 247CONFIG_FLATMEM=y
252CONFIG_FLAT_NODE_MEM_MAP=y 248CONFIG_FLAT_NODE_MEM_MAP=y
253# CONFIG_SPARSEMEM_STATIC is not set 249# CONFIG_SPARSEMEM_STATIC is not set
250# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
254CONFIG_SPLIT_PTLOCK_CPUS=4 251CONFIG_SPLIT_PTLOCK_CPUS=4
255# CONFIG_RESOURCES_64BIT is not set 252# CONFIG_RESOURCES_64BIT is not set
256CONFIG_ZONE_DMA_FLAG=1 253CONFIG_ZONE_DMA_FLAG=1
257CONFIG_LARGE_ALLOCS=y 254CONFIG_VIRT_TO_BUS=y
258# CONFIG_BFIN_GPTIMERS is not set 255# CONFIG_BFIN_GPTIMERS is not set
259CONFIG_BFIN_DMA_5XX=y 256CONFIG_BFIN_DMA_5XX=y
257# CONFIG_DMA_UNCACHED_4M is not set
260# CONFIG_DMA_UNCACHED_2M is not set 258# CONFIG_DMA_UNCACHED_2M is not set
261CONFIG_DMA_UNCACHED_1M=y 259CONFIG_DMA_UNCACHED_1M=y
262# CONFIG_DMA_UNCACHED_NONE is not set 260# CONFIG_DMA_UNCACHED_NONE is not set
@@ -294,17 +292,13 @@ CONFIG_C_AMBEN_ALL=y
294CONFIG_BANK_0=0x7BB0 292CONFIG_BANK_0=0x7BB0
295CONFIG_BANK_1=0x7BB0 293CONFIG_BANK_1=0x7BB0
296CONFIG_BANK_2=0x7BB0 294CONFIG_BANK_2=0x7BB0
297CONFIG_BANK_3=0xAAC3 295CONFIG_BANK_3=0xAAC2
298 296
299# 297#
300# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 298# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
301# 299#
302# CONFIG_PCI is not set 300# CONFIG_PCI is not set
303# CONFIG_ARCH_SUPPORTS_MSI is not set 301# CONFIG_ARCH_SUPPORTS_MSI is not set
304
305#
306# PCCARD (PCMCIA/CardBus) support
307#
308# CONFIG_PCCARD is not set 302# CONFIG_PCCARD is not set
309 303
310# 304#
@@ -322,7 +316,9 @@ CONFIG_BINFMT_ZFLAT=y
322CONFIG_PM=y 316CONFIG_PM=y
323# CONFIG_PM_LEGACY is not set 317# CONFIG_PM_LEGACY is not set
324# CONFIG_PM_DEBUG is not set 318# CONFIG_PM_DEBUG is not set
325# CONFIG_PM_SYSFS_DEPRECATED is not set 319CONFIG_PM_SLEEP=y
320CONFIG_SUSPEND_UP_POSSIBLE=y
321CONFIG_SUSPEND=y
326CONFIG_PM_BFIN_SLEEP_DEEPER=y 322CONFIG_PM_BFIN_SLEEP_DEEPER=y
327# CONFIG_PM_BFIN_SLEEP is not set 323# CONFIG_PM_BFIN_SLEEP is not set
328# CONFIG_PM_WAKEUP_BY_GPIO is not set 324# CONFIG_PM_WAKEUP_BY_GPIO is not set
@@ -368,6 +364,7 @@ CONFIG_SYN_COOKIES=y
368CONFIG_INET_XFRM_MODE_TRANSPORT=y 364CONFIG_INET_XFRM_MODE_TRANSPORT=y
369CONFIG_INET_XFRM_MODE_TUNNEL=y 365CONFIG_INET_XFRM_MODE_TUNNEL=y
370CONFIG_INET_XFRM_MODE_BEET=y 366CONFIG_INET_XFRM_MODE_BEET=y
367# CONFIG_INET_LRO is not set
371CONFIG_INET_DIAG=y 368CONFIG_INET_DIAG=y
372CONFIG_INET_TCP_DIAG=y 369CONFIG_INET_TCP_DIAG=y
373# CONFIG_TCP_CONG_ADVANCED is not set 370# CONFIG_TCP_CONG_ADVANCED is not set
@@ -394,10 +391,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
394# CONFIG_LAPB is not set 391# CONFIG_LAPB is not set
395# CONFIG_ECONET is not set 392# CONFIG_ECONET is not set
396# CONFIG_WAN_ROUTER is not set 393# CONFIG_WAN_ROUTER is not set
397
398#
399# QoS and/or fair queueing
400#
401# CONFIG_NET_SCHED is not set 394# CONFIG_NET_SCHED is not set
402 395
403# 396#
@@ -429,6 +422,9 @@ CONFIG_IRDA_CACHE_LAST_LSAP=y
429# SIR device drivers 422# SIR device drivers
430# 423#
431CONFIG_IRTTY_SIR=m 424CONFIG_IRTTY_SIR=m
425CONFIG_BFIN_SIR=m
426CONFIG_SIR_BFIN_DMA=y
427# CONFIG_SIR_BFIN_PIO is not set
432 428
433# 429#
434# Dongle support 430# Dongle support
@@ -458,6 +454,7 @@ CONFIG_IRTTY_SIR=m
458# CONFIG_MAC80211 is not set 454# CONFIG_MAC80211 is not set
459# CONFIG_IEEE80211 is not set 455# CONFIG_IEEE80211 is not set
460# CONFIG_RFKILL is not set 456# CONFIG_RFKILL is not set
457# CONFIG_NET_9P is not set
461 458
462# 459#
463# Device Drivers 460# Device Drivers
@@ -466,14 +463,11 @@ CONFIG_IRTTY_SIR=m
466# 463#
467# Generic Driver Options 464# Generic Driver Options
468# 465#
466CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
469CONFIG_STANDALONE=y 467CONFIG_STANDALONE=y
470CONFIG_PREVENT_FIRMWARE_BUILD=y 468CONFIG_PREVENT_FIRMWARE_BUILD=y
471# CONFIG_FW_LOADER is not set 469# CONFIG_FW_LOADER is not set
472# CONFIG_SYS_HYPERVISOR is not set 470# CONFIG_SYS_HYPERVISOR is not set
473
474#
475# Connector - unified userspace <-> kernelspace linker
476#
477# CONFIG_CONNECTOR is not set 471# CONFIG_CONNECTOR is not set
478CONFIG_MTD=y 472CONFIG_MTD=y
479# CONFIG_MTD_DEBUG is not set 473# CONFIG_MTD_DEBUG is not set
@@ -493,6 +487,7 @@ CONFIG_MTD_BLOCK=y
493# CONFIG_INFTL is not set 487# CONFIG_INFTL is not set
494# CONFIG_RFD_FTL is not set 488# CONFIG_RFD_FTL is not set
495# CONFIG_SSFDC is not set 489# CONFIG_SSFDC is not set
490# CONFIG_MTD_OOPS is not set
496 491
497# 492#
498# RAM/ROM/Flash chip drivers 493# RAM/ROM/Flash chip drivers
@@ -524,11 +519,7 @@ CONFIG_MTD_ROM=m
524# 519#
525CONFIG_MTD_COMPLEX_MAPPINGS=y 520CONFIG_MTD_COMPLEX_MAPPINGS=y
526# CONFIG_MTD_PHYSMAP is not set 521# CONFIG_MTD_PHYSMAP is not set
527CONFIG_MTD_BF5xx=m 522CONFIG_MTD_BFIN_ASYNC=m
528CONFIG_BFIN_FLASH_BANK_0=0x7BB0
529CONFIG_BFIN_FLASH_BANK_1=0x7BB0
530CONFIG_BFIN_FLASH_BANK_2=0x7BB0
531CONFIG_BFIN_FLASH_BANK_3=0x7BB0
532# CONFIG_MTD_UCLINUX is not set 523# CONFIG_MTD_UCLINUX is not set
533# CONFIG_MTD_PLATRAM is not set 524# CONFIG_MTD_PLATRAM is not set
534 525
@@ -555,20 +546,8 @@ CONFIG_BFIN_FLASH_BANK_3=0x7BB0
555# UBI - Unsorted block images 546# UBI - Unsorted block images
556# 547#
557# CONFIG_MTD_UBI is not set 548# CONFIG_MTD_UBI is not set
558
559#
560# Parallel port support
561#
562# CONFIG_PARPORT is not set 549# CONFIG_PARPORT is not set
563 550CONFIG_BLK_DEV=y
564#
565# Plug and Play support
566#
567# CONFIG_PNPACPI is not set
568
569#
570# Block devices
571#
572# CONFIG_BLK_DEV_COW_COMMON is not set 551# CONFIG_BLK_DEV_COW_COMMON is not set
573# CONFIG_BLK_DEV_LOOP is not set 552# CONFIG_BLK_DEV_LOOP is not set
574# CONFIG_BLK_DEV_NBD is not set 553# CONFIG_BLK_DEV_NBD is not set
@@ -578,10 +557,8 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
578CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 557CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
579# CONFIG_CDROM_PKTCDVD is not set 558# CONFIG_CDROM_PKTCDVD is not set
580# CONFIG_ATA_OVER_ETH is not set 559# CONFIG_ATA_OVER_ETH is not set
581 560CONFIG_MISC_DEVICES=y
582# 561# CONFIG_EEPROM_93CX6 is not set
583# Misc devices
584#
585# CONFIG_IDE is not set 562# CONFIG_IDE is not set
586 563
587# 564#
@@ -589,32 +566,29 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
589# 566#
590# CONFIG_RAID_ATTRS is not set 567# CONFIG_RAID_ATTRS is not set
591# CONFIG_SCSI is not set 568# CONFIG_SCSI is not set
569# CONFIG_SCSI_DMA is not set
592# CONFIG_SCSI_NETLINK is not set 570# CONFIG_SCSI_NETLINK is not set
593# CONFIG_ATA is not set 571# CONFIG_ATA is not set
594
595#
596# Multi-device support (RAID and LVM)
597#
598# CONFIG_MD is not set 572# CONFIG_MD is not set
599
600#
601# Network device support
602#
603CONFIG_NETDEVICES=y 573CONFIG_NETDEVICES=y
574# CONFIG_NETDEVICES_MULTIQUEUE is not set
604# CONFIG_DUMMY is not set 575# CONFIG_DUMMY is not set
605# CONFIG_BONDING is not set 576# CONFIG_BONDING is not set
577# CONFIG_MACVLAN is not set
606# CONFIG_EQUALIZER is not set 578# CONFIG_EQUALIZER is not set
607# CONFIG_TUN is not set 579# CONFIG_TUN is not set
580# CONFIG_VETH is not set
608# CONFIG_PHYLIB is not set 581# CONFIG_PHYLIB is not set
609
610#
611# Ethernet (10 or 100Mbit)
612#
613CONFIG_NET_ETHERNET=y 582CONFIG_NET_ETHERNET=y
614CONFIG_MII=y 583CONFIG_MII=y
615CONFIG_SMC91X=y 584CONFIG_SMC91X=y
616# CONFIG_SMSC911X is not set 585# CONFIG_SMSC911X is not set
617# CONFIG_DM9000 is not set 586# CONFIG_DM9000 is not set
587# CONFIG_IBM_NEW_EMAC_ZMII is not set
588# CONFIG_IBM_NEW_EMAC_RGMII is not set
589# CONFIG_IBM_NEW_EMAC_TAH is not set
590# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
591# CONFIG_B44 is not set
618CONFIG_NETDEV_1000=y 592CONFIG_NETDEV_1000=y
619# CONFIG_AX88180 is not set 593# CONFIG_AX88180 is not set
620CONFIG_NETDEV_10000=y 594CONFIG_NETDEV_10000=y
@@ -631,15 +605,7 @@ CONFIG_NETDEV_10000=y
631# CONFIG_NETCONSOLE is not set 605# CONFIG_NETCONSOLE is not set
632# CONFIG_NETPOLL is not set 606# CONFIG_NETPOLL is not set
633# CONFIG_NET_POLL_CONTROLLER is not set 607# CONFIG_NET_POLL_CONTROLLER is not set
634
635#
636# ISDN subsystem
637#
638# CONFIG_ISDN is not set 608# CONFIG_ISDN is not set
639
640#
641# Telephony Support
642#
643# CONFIG_PHONE is not set 609# CONFIG_PHONE is not set
644 610
645# 611#
@@ -654,7 +620,6 @@ CONFIG_INPUT=y
654# 620#
655# CONFIG_INPUT_MOUSEDEV is not set 621# CONFIG_INPUT_MOUSEDEV is not set
656# CONFIG_INPUT_JOYDEV is not set 622# CONFIG_INPUT_JOYDEV is not set
657# CONFIG_INPUT_TSDEV is not set
658CONFIG_INPUT_EVDEV=m 623CONFIG_INPUT_EVDEV=m
659# CONFIG_INPUT_EVBUG is not set 624# CONFIG_INPUT_EVBUG is not set
660 625
@@ -667,14 +632,8 @@ CONFIG_INPUT_EVDEV=m
667# CONFIG_INPUT_TABLET is not set 632# CONFIG_INPUT_TABLET is not set
668# CONFIG_INPUT_TOUCHSCREEN is not set 633# CONFIG_INPUT_TOUCHSCREEN is not set
669CONFIG_INPUT_MISC=y 634CONFIG_INPUT_MISC=y
670# CONFIG_INPUT_ATI_REMOTE is not set
671# CONFIG_INPUT_ATI_REMOTE2 is not set
672# CONFIG_INPUT_KEYSPAN_REMOTE is not set
673# CONFIG_INPUT_POWERMATE is not set
674# CONFIG_INPUT_YEALINK is not set
675# CONFIG_INPUT_UINPUT is not set 635# CONFIG_INPUT_UINPUT is not set
676CONFIG_TWI_KEYPAD=m 636CONFIG_TWI_KEYPAD=m
677CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39
678 637
679# 638#
680# Hardware I/O ports 639# Hardware I/O ports
@@ -687,15 +646,13 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39
687# 646#
688# CONFIG_AD9960 is not set 647# CONFIG_AD9960 is not set
689# CONFIG_SPI_ADC_BF533 is not set 648# CONFIG_SPI_ADC_BF533 is not set
690# CONFIG_BF5xx_PFLAGS is not set
691# CONFIG_BF5xx_PPIFCD is not set 649# CONFIG_BF5xx_PPIFCD is not set
692# CONFIG_BFIN_SIMPLE_TIMER is not set 650# CONFIG_BFIN_SIMPLE_TIMER is not set
693# CONFIG_BF5xx_PPI is not set 651# CONFIG_BF5xx_PPI is not set
694CONFIG_BFIN_SPORT=y 652CONFIG_BFIN_SPORT=y
695# CONFIG_BFIN_TIMER_LATENCY is not set 653# CONFIG_BFIN_TIMER_LATENCY is not set
696CONFIG_TWI_LCD=m 654CONFIG_TWI_LCD=m
697CONFIG_TWI_LCD_SLAVE_ADDR=34 655CONFIG_SIMPLE_GPIO=m
698# CONFIG_AD5304 is not set
699# CONFIG_VT is not set 656# CONFIG_VT is not set
700# CONFIG_SERIAL_NONSTANDARD is not set 657# CONFIG_SERIAL_NONSTANDARD is not set
701 658
@@ -723,28 +680,11 @@ CONFIG_UNIX98_PTYS=y
723# CAN, the car bus and industrial fieldbus 680# CAN, the car bus and industrial fieldbus
724# 681#
725# CONFIG_CAN4LINUX is not set 682# CONFIG_CAN4LINUX is not set
726
727#
728# IPMI
729#
730# CONFIG_IPMI_HANDLER is not set 683# CONFIG_IPMI_HANDLER is not set
731CONFIG_WATCHDOG=y
732# CONFIG_WATCHDOG_NOWAYOUT is not set
733
734#
735# Watchdog Device Drivers
736#
737# CONFIG_SOFT_WATCHDOG is not set
738CONFIG_BFIN_WDT=y
739CONFIG_HW_RANDOM=y 684CONFIG_HW_RANDOM=y
740# CONFIG_GEN_RTC is not set 685# CONFIG_GEN_RTC is not set
741CONFIG_BLACKFIN_DPMC=y
742# CONFIG_R3964 is not set 686# CONFIG_R3964 is not set
743# CONFIG_RAW_DRIVER is not set 687# CONFIG_RAW_DRIVER is not set
744
745#
746# TPM devices
747#
748# CONFIG_TCG_TPM is not set 688# CONFIG_TCG_TPM is not set
749CONFIG_I2C=m 689CONFIG_I2C=m
750CONFIG_I2C_BOARDINFO=y 690CONFIG_I2C_BOARDINFO=y
@@ -764,6 +704,7 @@ CONFIG_I2C_ALGOBIT=m
764# CONFIG_I2C_OCORES is not set 704# CONFIG_I2C_OCORES is not set
765# CONFIG_I2C_PARPORT_LIGHT is not set 705# CONFIG_I2C_PARPORT_LIGHT is not set
766# CONFIG_I2C_SIMTEC is not set 706# CONFIG_I2C_SIMTEC is not set
707# CONFIG_I2C_TAOS_EVM is not set
767# CONFIG_I2C_STUB is not set 708# CONFIG_I2C_STUB is not set
768 709
769# 710#
@@ -771,14 +712,15 @@ CONFIG_I2C_ALGOBIT=m
771# 712#
772# CONFIG_SENSORS_DS1337 is not set 713# CONFIG_SENSORS_DS1337 is not set
773# CONFIG_SENSORS_DS1374 is not set 714# CONFIG_SENSORS_DS1374 is not set
715# CONFIG_DS1682 is not set
774# CONFIG_SENSORS_AD5252 is not set 716# CONFIG_SENSORS_AD5252 is not set
775# CONFIG_SENSORS_EEPROM is not set 717# CONFIG_SENSORS_EEPROM is not set
776# CONFIG_SENSORS_PCF8574 is not set 718# CONFIG_SENSORS_PCF8574 is not set
777# CONFIG_SENSORS_PCF8575 is not set 719# CONFIG_SENSORS_PCF8575 is not set
778# CONFIG_SENSORS_PCA9543 is not set
779# CONFIG_SENSORS_PCA9539 is not set 720# CONFIG_SENSORS_PCA9539 is not set
780# CONFIG_SENSORS_PCF8591 is not set 721# CONFIG_SENSORS_PCF8591 is not set
781# CONFIG_SENSORS_MAX6875 is not set 722# CONFIG_SENSORS_MAX6875 is not set
723# CONFIG_SENSORS_TSL2550 is not set
782# CONFIG_I2C_DEBUG_CORE is not set 724# CONFIG_I2C_DEBUG_CORE is not set
783# CONFIG_I2C_DEBUG_ALGO is not set 725# CONFIG_I2C_DEBUG_ALGO is not set
784# CONFIG_I2C_DEBUG_BUS is not set 726# CONFIG_I2C_DEBUG_BUS is not set
@@ -801,14 +743,11 @@ CONFIG_SPI_BFIN=y
801# 743#
802# CONFIG_SPI_AT25 is not set 744# CONFIG_SPI_AT25 is not set
803# CONFIG_SPI_SPIDEV is not set 745# CONFIG_SPI_SPIDEV is not set
804 746# CONFIG_SPI_TLE62X0 is not set
805#
806# Dallas's 1-wire bus
807#
808# CONFIG_W1 is not set 747# CONFIG_W1 is not set
748# CONFIG_POWER_SUPPLY is not set
809CONFIG_HWMON=y 749CONFIG_HWMON=y
810# CONFIG_HWMON_VID is not set 750# CONFIG_HWMON_VID is not set
811# CONFIG_SENSORS_ABITUGURU is not set
812# CONFIG_SENSORS_AD7418 is not set 751# CONFIG_SENSORS_AD7418 is not set
813# CONFIG_SENSORS_ADM1021 is not set 752# CONFIG_SENSORS_ADM1021 is not set
814# CONFIG_SENSORS_ADM1025 is not set 753# CONFIG_SENSORS_ADM1025 is not set
@@ -816,12 +755,12 @@ CONFIG_HWMON=y
816# CONFIG_SENSORS_ADM1029 is not set 755# CONFIG_SENSORS_ADM1029 is not set
817# CONFIG_SENSORS_ADM1031 is not set 756# CONFIG_SENSORS_ADM1031 is not set
818# CONFIG_SENSORS_ADM9240 is not set 757# CONFIG_SENSORS_ADM9240 is not set
819# CONFIG_SENSORS_ASB100 is not set 758# CONFIG_SENSORS_ADT7470 is not set
820# CONFIG_SENSORS_ATXP1 is not set 759# CONFIG_SENSORS_ATXP1 is not set
821# CONFIG_SENSORS_DS1621 is not set 760# CONFIG_SENSORS_DS1621 is not set
822# CONFIG_SENSORS_F71805F is not set 761# CONFIG_SENSORS_F71805F is not set
823# CONFIG_SENSORS_FSCHER is not set 762# CONFIG_SENSORS_F71882FG is not set
824# CONFIG_SENSORS_FSCPOS is not set 763# CONFIG_SENSORS_F75375S is not set
825# CONFIG_SENSORS_GL518SM is not set 764# CONFIG_SENSORS_GL518SM is not set
826# CONFIG_SENSORS_GL520SM is not set 765# CONFIG_SENSORS_GL520SM is not set
827# CONFIG_SENSORS_IT87 is not set 766# CONFIG_SENSORS_IT87 is not set
@@ -836,13 +775,16 @@ CONFIG_HWMON=y
836# CONFIG_SENSORS_LM87 is not set 775# CONFIG_SENSORS_LM87 is not set
837# CONFIG_SENSORS_LM90 is not set 776# CONFIG_SENSORS_LM90 is not set
838# CONFIG_SENSORS_LM92 is not set 777# CONFIG_SENSORS_LM92 is not set
778# CONFIG_SENSORS_LM93 is not set
839# CONFIG_SENSORS_MAX1619 is not set 779# CONFIG_SENSORS_MAX1619 is not set
840# CONFIG_SENSORS_MAX6650 is not set 780# CONFIG_SENSORS_MAX6650 is not set
841# CONFIG_SENSORS_PC87360 is not set 781# CONFIG_SENSORS_PC87360 is not set
842# CONFIG_SENSORS_PC87427 is not set 782# CONFIG_SENSORS_PC87427 is not set
783# CONFIG_SENSORS_DME1737 is not set
843# CONFIG_SENSORS_SMSC47M1 is not set 784# CONFIG_SENSORS_SMSC47M1 is not set
844# CONFIG_SENSORS_SMSC47M192 is not set 785# CONFIG_SENSORS_SMSC47M192 is not set
845# CONFIG_SENSORS_SMSC47B397 is not set 786# CONFIG_SENSORS_SMSC47B397 is not set
787# CONFIG_SENSORS_THMC50 is not set
846# CONFIG_SENSORS_VT1211 is not set 788# CONFIG_SENSORS_VT1211 is not set
847# CONFIG_SENSORS_W83781D is not set 789# CONFIG_SENSORS_W83781D is not set
848# CONFIG_SENSORS_W83791D is not set 790# CONFIG_SENSORS_W83791D is not set
@@ -852,6 +794,20 @@ CONFIG_HWMON=y
852# CONFIG_SENSORS_W83627HF is not set 794# CONFIG_SENSORS_W83627HF is not set
853# CONFIG_SENSORS_W83627EHF is not set 795# CONFIG_SENSORS_W83627EHF is not set
854# CONFIG_HWMON_DEBUG_CHIP is not set 796# CONFIG_HWMON_DEBUG_CHIP is not set
797CONFIG_WATCHDOG=y
798# CONFIG_WATCHDOG_NOWAYOUT is not set
799
800#
801# Watchdog Device Drivers
802#
803# CONFIG_SOFT_WATCHDOG is not set
804CONFIG_BFIN_WDT=y
805
806#
807# Sonics Silicon Backplane
808#
809CONFIG_SSB_POSSIBLE=y
810# CONFIG_SSB is not set
855 811
856# 812#
857# Multifunction device drivers 813# Multifunction device drivers
@@ -863,24 +819,20 @@ CONFIG_HWMON=y
863# 819#
864# CONFIG_VIDEO_DEV is not set 820# CONFIG_VIDEO_DEV is not set
865# CONFIG_DVB_CORE is not set 821# CONFIG_DVB_CORE is not set
866CONFIG_DAB=y 822# CONFIG_DAB is not set
867 823
868# 824#
869# Graphics support 825# Graphics support
870# 826#
871# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
872
873#
874# Display device support
875#
876# CONFIG_DISPLAY_SUPPORT is not set
877# CONFIG_VGASTATE is not set 827# CONFIG_VGASTATE is not set
828# CONFIG_VIDEO_OUTPUT_CONTROL is not set
878CONFIG_FB=m 829CONFIG_FB=m
879CONFIG_FIRMWARE_EDID=y 830CONFIG_FIRMWARE_EDID=y
880# CONFIG_FB_DDC is not set 831# CONFIG_FB_DDC is not set
881CONFIG_FB_CFB_FILLRECT=m 832CONFIG_FB_CFB_FILLRECT=m
882CONFIG_FB_CFB_COPYAREA=m 833CONFIG_FB_CFB_COPYAREA=m
883CONFIG_FB_CFB_IMAGEBLIT=m 834CONFIG_FB_CFB_IMAGEBLIT=m
835# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
884# CONFIG_FB_SYS_FILLRECT is not set 836# CONFIG_FB_SYS_FILLRECT is not set
885# CONFIG_FB_SYS_COPYAREA is not set 837# CONFIG_FB_SYS_COPYAREA is not set
886# CONFIG_FB_SYS_IMAGEBLIT is not set 838# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -895,7 +847,7 @@ CONFIG_FB_DEFERRED_IO=y
895# 847#
896# Frame buffer hardware drivers 848# Frame buffer hardware drivers
897# 849#
898CONFIG_FB_BFIN_7171=m 850# CONFIG_FB_BFIN_T350MCQB is not set
899CONFIG_FB_BFIN_7393=m 851CONFIG_FB_BFIN_7393=m
900CONFIG_NTSC=y 852CONFIG_NTSC=y
901# CONFIG_PAL is not set 853# CONFIG_PAL is not set
@@ -905,9 +857,14 @@ CONFIG_NTSC=y
905# CONFIG_PAL_YCBCR is not set 857# CONFIG_PAL_YCBCR is not set
906CONFIG_ADV7393_1XMEM=y 858CONFIG_ADV7393_1XMEM=y
907# CONFIG_ADV7393_2XMEM is not set 859# CONFIG_ADV7393_2XMEM is not set
908# CONFIG_FB_BFIN_T350MCQB is not set
909# CONFIG_FB_S1D13XXX is not set 860# CONFIG_FB_S1D13XXX is not set
910# CONFIG_FB_VIRTUAL is not set 861# CONFIG_FB_VIRTUAL is not set
862# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
863
864#
865# Display device support
866#
867# CONFIG_DISPLAY_SUPPORT is not set
911# CONFIG_LOGO is not set 868# CONFIG_LOGO is not set
912 869
913# 870#
@@ -941,6 +898,10 @@ CONFIG_SND_VERBOSE_PROCFS=y
941# CONFIG_SND_MPU401 is not set 898# CONFIG_SND_MPU401 is not set
942 899
943# 900#
901# SPI devices
902#
903
904#
944# ALSA Blackfin devices 905# ALSA Blackfin devices
945# 906#
946CONFIG_SND_BLACKFIN_AD1836=m 907CONFIG_SND_BLACKFIN_AD1836=m
@@ -953,69 +914,43 @@ CONFIG_SND_BLACKFIN_SPI_PFBIT=4
953CONFIG_SND_BFIN_AD73311=m 914CONFIG_SND_BFIN_AD73311=m
954CONFIG_SND_BFIN_SPORT=0 915CONFIG_SND_BFIN_SPORT=0
955CONFIG_SND_BFIN_AD73311_SE=4 916CONFIG_SND_BFIN_AD73311_SE=4
917CONFIG_SND_BFIN_AD73322=m
918CONFIG_SND_BFIN_AD73322_SPORT0_SE=10
919CONFIG_SND_BFIN_AD73322_SPORT1_SE=14
920CONFIG_SND_BFIN_AD73322_RESET=12
956 921
957# 922#
958# System on Chip audio support 923# System on Chip audio support
959# 924#
960# CONFIG_SND_SOC is not set 925CONFIG_SND_SOC_AC97_BUS=y
926CONFIG_SND_SOC=m
927CONFIG_SND_BF5XX_SOC=m
928CONFIG_SND_MMAP_SUPPORT=y
929CONFIG_SND_BF5XX_SOC_AC97=m
930# CONFIG_SND_BF5XX_SOC_WM8750 is not set
931# CONFIG_SND_BF5XX_SOC_WM8731 is not set
932# CONFIG_SND_BF5XX_SOC_SSM2602 is not set
933CONFIG_SND_BF5XX_SOC_BF5xx=m
934CONFIG_SND_BF5XX_SPORT_NUM=0
935# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
961 936
962# 937#
963# Open Sound System 938# SoC Audio support for SuperH
964# 939#
965# CONFIG_SOUND_PRIME is not set 940CONFIG_SND_SOC_AD1980=m
966 941
967# 942#
968# HID Devices 943# Open Sound System
969# 944#
945# CONFIG_SOUND_PRIME is not set
946CONFIG_AC97_BUS=m
947CONFIG_HID_SUPPORT=y
970CONFIG_HID=y 948CONFIG_HID=y
971# CONFIG_HID_DEBUG is not set 949# CONFIG_HID_DEBUG is not set
972 950# CONFIG_HIDRAW is not set
973# 951# CONFIG_USB_SUPPORT is not set
974# USB support
975#
976CONFIG_USB_ARCH_HAS_HCD=y
977# CONFIG_USB_ARCH_HAS_OHCI is not set
978# CONFIG_USB_ARCH_HAS_EHCI is not set
979# CONFIG_USB is not set
980
981#
982# Enable Host or Gadget support to see Inventra options
983#
984
985#
986# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
987#
988
989#
990# USB Gadget Support
991#
992# CONFIG_USB_GADGET is not set
993# CONFIG_MMC is not set 952# CONFIG_MMC is not set
994
995#
996# LED devices
997#
998# CONFIG_NEW_LEDS is not set 953# CONFIG_NEW_LEDS is not set
999
1000#
1001# LED drivers
1002#
1003
1004#
1005# LED Triggers
1006#
1007
1008#
1009# InfiniBand support
1010#
1011
1012#
1013# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1014#
1015
1016#
1017# Real Time Clock
1018#
1019CONFIG_RTC_LIB=y 954CONFIG_RTC_LIB=y
1020CONFIG_RTC_CLASS=y 955CONFIG_RTC_CLASS=y
1021CONFIG_RTC_HCTOSYS=y 956CONFIG_RTC_HCTOSYS=y
@@ -1035,6 +970,7 @@ CONFIG_RTC_INTF_DEV=y
1035# I2C RTC drivers 970# I2C RTC drivers
1036# 971#
1037# CONFIG_RTC_DRV_DS1307 is not set 972# CONFIG_RTC_DRV_DS1307 is not set
973# CONFIG_RTC_DRV_DS1374 is not set
1038# CONFIG_RTC_DRV_DS1672 is not set 974# CONFIG_RTC_DRV_DS1672 is not set
1039# CONFIG_RTC_DRV_MAX6900 is not set 975# CONFIG_RTC_DRV_MAX6900 is not set
1040# CONFIG_RTC_DRV_RS5C372 is not set 976# CONFIG_RTC_DRV_RS5C372 is not set
@@ -1042,6 +978,7 @@ CONFIG_RTC_INTF_DEV=y
1042# CONFIG_RTC_DRV_X1205 is not set 978# CONFIG_RTC_DRV_X1205 is not set
1043# CONFIG_RTC_DRV_PCF8563 is not set 979# CONFIG_RTC_DRV_PCF8563 is not set
1044# CONFIG_RTC_DRV_PCF8583 is not set 980# CONFIG_RTC_DRV_PCF8583 is not set
981# CONFIG_RTC_DRV_M41T80 is not set
1045 982
1046# 983#
1047# SPI RTC drivers 984# SPI RTC drivers
@@ -1053,8 +990,10 @@ CONFIG_RTC_INTF_DEV=y
1053# Platform RTC drivers 990# Platform RTC drivers
1054# 991#
1055# CONFIG_RTC_DRV_DS1553 is not set 992# CONFIG_RTC_DRV_DS1553 is not set
993# CONFIG_RTC_DRV_STK17TA8 is not set
1056# CONFIG_RTC_DRV_DS1742 is not set 994# CONFIG_RTC_DRV_DS1742 is not set
1057# CONFIG_RTC_DRV_M48T86 is not set 995# CONFIG_RTC_DRV_M48T86 is not set
996# CONFIG_RTC_DRV_M48T59 is not set
1058# CONFIG_RTC_DRV_V3020 is not set 997# CONFIG_RTC_DRV_V3020 is not set
1059 998
1060# 999#
@@ -1063,22 +1002,9 @@ CONFIG_RTC_INTF_DEV=y
1063CONFIG_RTC_DRV_BFIN=y 1002CONFIG_RTC_DRV_BFIN=y
1064 1003
1065# 1004#
1066# DMA Engine support 1005# Userspace I/O
1067# 1006#
1068# CONFIG_DMA_ENGINE is not set 1007# CONFIG_UIO is not set
1069
1070#
1071# DMA Clients
1072#
1073
1074#
1075# DMA Devices
1076#
1077
1078#
1079# PBX support
1080#
1081# CONFIG_PBX is not set
1082 1008
1083# 1009#
1084# File systems 1010# File systems
@@ -1123,7 +1049,6 @@ CONFIG_PROC_SYSCTL=y
1123CONFIG_SYSFS=y 1049CONFIG_SYSFS=y
1124# CONFIG_TMPFS is not set 1050# CONFIG_TMPFS is not set
1125# CONFIG_HUGETLB_PAGE is not set 1051# CONFIG_HUGETLB_PAGE is not set
1126CONFIG_RAMFS=y
1127# CONFIG_CONFIGFS_FS is not set 1052# CONFIG_CONFIGFS_FS is not set
1128 1053
1129# 1054#
@@ -1149,10 +1074,12 @@ CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1149CONFIG_JFFS2_FS=m 1074CONFIG_JFFS2_FS=m
1150CONFIG_JFFS2_FS_DEBUG=0 1075CONFIG_JFFS2_FS_DEBUG=0
1151CONFIG_JFFS2_FS_WRITEBUFFER=y 1076CONFIG_JFFS2_FS_WRITEBUFFER=y
1077# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1152# CONFIG_JFFS2_SUMMARY is not set 1078# CONFIG_JFFS2_SUMMARY is not set
1153# CONFIG_JFFS2_FS_XATTR is not set 1079# CONFIG_JFFS2_FS_XATTR is not set
1154# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1080# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1155CONFIG_JFFS2_ZLIB=y 1081CONFIG_JFFS2_ZLIB=y
1082# CONFIG_JFFS2_LZO is not set
1156CONFIG_JFFS2_RTIME=y 1083CONFIG_JFFS2_RTIME=y
1157# CONFIG_JFFS2_RUBIN is not set 1084# CONFIG_JFFS2_RUBIN is not set
1158# CONFIG_CRAMFS is not set 1085# CONFIG_CRAMFS is not set
@@ -1161,10 +1088,7 @@ CONFIG_JFFS2_RTIME=y
1161# CONFIG_QNX4FS_FS is not set 1088# CONFIG_QNX4FS_FS is not set
1162# CONFIG_SYSV_FS is not set 1089# CONFIG_SYSV_FS is not set
1163# CONFIG_UFS_FS is not set 1090# CONFIG_UFS_FS is not set
1164 1091CONFIG_NETWORK_FILESYSTEMS=y
1165#
1166# Network File Systems
1167#
1168CONFIG_NFS_FS=m 1092CONFIG_NFS_FS=m
1169CONFIG_NFS_V3=y 1093CONFIG_NFS_V3=y
1170# CONFIG_NFS_V3_ACL is not set 1094# CONFIG_NFS_V3_ACL is not set
@@ -1184,17 +1108,12 @@ CONFIG_SMB_FS=m
1184# CONFIG_NCP_FS is not set 1108# CONFIG_NCP_FS is not set
1185# CONFIG_CODA_FS is not set 1109# CONFIG_CODA_FS is not set
1186# CONFIG_AFS_FS is not set 1110# CONFIG_AFS_FS is not set
1187# CONFIG_9P_FS is not set
1188 1111
1189# 1112#
1190# Partition Types 1113# Partition Types
1191# 1114#
1192# CONFIG_PARTITION_ADVANCED is not set 1115# CONFIG_PARTITION_ADVANCED is not set
1193CONFIG_MSDOS_PARTITION=y 1116CONFIG_MSDOS_PARTITION=y
1194
1195#
1196# Native Language Support
1197#
1198CONFIG_NLS=m 1117CONFIG_NLS=m
1199CONFIG_NLS_DEFAULT="iso8859-1" 1118CONFIG_NLS_DEFAULT="iso8859-1"
1200# CONFIG_NLS_CODEPAGE_437 is not set 1119# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1235,21 +1154,16 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1235# CONFIG_NLS_KOI8_R is not set 1154# CONFIG_NLS_KOI8_R is not set
1236# CONFIG_NLS_KOI8_U is not set 1155# CONFIG_NLS_KOI8_U is not set
1237# CONFIG_NLS_UTF8 is not set 1156# CONFIG_NLS_UTF8 is not set
1238
1239#
1240# Distributed Lock Manager
1241#
1242# CONFIG_DLM is not set 1157# CONFIG_DLM is not set
1243 1158CONFIG_INSTRUMENTATION=y
1244#
1245# Profiling support
1246#
1247# CONFIG_PROFILING is not set 1159# CONFIG_PROFILING is not set
1160# CONFIG_MARKERS is not set
1248 1161
1249# 1162#
1250# Kernel hacking 1163# Kernel hacking
1251# 1164#
1252# CONFIG_PRINTK_TIME is not set 1165# CONFIG_PRINTK_TIME is not set
1166CONFIG_ENABLE_WARN_DEPRECATED=y
1253CONFIG_ENABLE_MUST_CHECK=y 1167CONFIG_ENABLE_MUST_CHECK=y
1254# CONFIG_MAGIC_SYSRQ is not set 1168# CONFIG_MAGIC_SYSRQ is not set
1255# CONFIG_UNUSED_SYMBOLS is not set 1169# CONFIG_UNUSED_SYMBOLS is not set
@@ -1257,6 +1171,7 @@ CONFIG_DEBUG_FS=y
1257# CONFIG_HEADERS_CHECK is not set 1171# CONFIG_HEADERS_CHECK is not set
1258# CONFIG_DEBUG_KERNEL is not set 1172# CONFIG_DEBUG_KERNEL is not set
1259# CONFIG_DEBUG_BUGVERBOSE is not set 1173# CONFIG_DEBUG_BUGVERBOSE is not set
1174# CONFIG_SAMPLES is not set
1260CONFIG_DEBUG_MMRS=y 1175CONFIG_DEBUG_MMRS=y
1261CONFIG_DEBUG_HUNT_FOR_ZERO=y 1176CONFIG_DEBUG_HUNT_FOR_ZERO=y
1262CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1177CONFIG_DEBUG_BFIN_HWTRACE_ON=y
@@ -1276,11 +1191,7 @@ CONFIG_ACCESS_CHECK=y
1276# CONFIG_KEYS is not set 1191# CONFIG_KEYS is not set
1277CONFIG_SECURITY=y 1192CONFIG_SECURITY=y
1278# CONFIG_SECURITY_NETWORK is not set 1193# CONFIG_SECURITY_NETWORK is not set
1279CONFIG_SECURITY_CAPABILITIES=m 1194# CONFIG_SECURITY_CAPABILITIES is not set
1280
1281#
1282# Cryptographic options
1283#
1284# CONFIG_CRYPTO is not set 1195# CONFIG_CRYPTO is not set
1285 1196
1286# 1197#
@@ -1291,6 +1202,7 @@ CONFIG_CRC_CCITT=m
1291# CONFIG_CRC16 is not set 1202# CONFIG_CRC16 is not set
1292# CONFIG_CRC_ITU_T is not set 1203# CONFIG_CRC_ITU_T is not set
1293CONFIG_CRC32=y 1204CONFIG_CRC32=y
1205# CONFIG_CRC7 is not set
1294# CONFIG_LIBCRC32C is not set 1206# CONFIG_LIBCRC32C is not set
1295CONFIG_ZLIB_INFLATE=y 1207CONFIG_ZLIB_INFLATE=y
1296CONFIG_ZLIB_DEFLATE=m 1208CONFIG_ZLIB_DEFLATE=m
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index b5189c8ba263..5fd7c4b143df 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.16 3# Linux kernel version: 2.6.24.7
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -13,35 +13,34 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_GPIO=y 16CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14 17CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 20
22# 21#
23# Code maturity level options 22# General setup
24# 23#
25CONFIG_EXPERIMENTAL=y 24CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 25CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 26CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 27CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 28CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 29CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 30CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 31# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 32# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 33# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 37CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 38CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 39CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y
42CONFIG_FAIR_USER_SCHED=y
43# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y 46CONFIG_BLK_DEV_INITRD=y
@@ -64,32 +63,24 @@ CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 63CONFIG_SIGNALFD=y
65CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
66CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
68# CONFIG_NP2 is not set
69CONFIG_SLAB=y 66CONFIG_SLAB=y
70# CONFIG_SLUB is not set 67# CONFIG_SLUB is not set
71# CONFIG_SLOB is not set 68# CONFIG_SLOB is not set
69CONFIG_SLABINFO=y
72CONFIG_RT_MUTEXES=y 70CONFIG_RT_MUTEXES=y
73CONFIG_TINY_SHMEM=y 71CONFIG_TINY_SHMEM=y
74CONFIG_BASE_SMALL=0 72CONFIG_BASE_SMALL=0
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y 73CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y 74CONFIG_MODULE_UNLOAD=y
81# CONFIG_MODULE_FORCE_UNLOAD is not set 75# CONFIG_MODULE_FORCE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set 76# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set 77# CONFIG_MODULE_SRCVERSION_ALL is not set
84CONFIG_KMOD=y 78CONFIG_KMOD=y
85
86#
87# Block layer
88#
89CONFIG_BLOCK=y 79CONFIG_BLOCK=y
90# CONFIG_LBD is not set 80# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set 81# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set 82# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set
93 84
94# 85#
95# IO Schedulers 86# IO Schedulers
@@ -141,7 +132,6 @@ CONFIG_BF_REV_0_2=y
141# CONFIG_BF_REV_ANY is not set 132# CONFIG_BF_REV_ANY is not set
142# CONFIG_BF_REV_NONE is not set 133# CONFIG_BF_REV_NONE is not set
143CONFIG_BF53x=y 134CONFIG_BF53x=y
144CONFIG_BFIN_SINGLE_CORE=y
145CONFIG_MEM_MT48LC32M8A2_75=y 135CONFIG_MEM_MT48LC32M8A2_75=y
146CONFIG_IRQ_PLL_WAKEUP=7 136CONFIG_IRQ_PLL_WAKEUP=7
147CONFIG_IRQ_RTC=8 137CONFIG_IRQ_RTC=8
@@ -197,12 +187,14 @@ CONFIG_IRQ_PROG_INTA=12
197# Board customizations 187# Board customizations
198# 188#
199# CONFIG_CMDLINE_BOOL is not set 189# CONFIG_CMDLINE_BOOL is not set
190CONFIG_BOOT_LOAD=0x1000
200 191
201# 192#
202# Clock/PLL Setup 193# Clock/PLL Setup
203# 194#
204CONFIG_CLKIN_HZ=25000000 195CONFIG_CLKIN_HZ=25000000
205# CONFIG_BFIN_KERNEL_CLOCK is not set 196# CONFIG_BFIN_KERNEL_CLOCK is not set
197CONFIG_MAX_MEM_SIZE=512
206CONFIG_MAX_VCO_HZ=600000000 198CONFIG_MAX_VCO_HZ=600000000
207CONFIG_MIN_VCO_HZ=50000000 199CONFIG_MIN_VCO_HZ=50000000
208CONFIG_MAX_SCLK_HZ=133333333 200CONFIG_MAX_SCLK_HZ=133333333
@@ -216,13 +208,17 @@ CONFIG_HZ_250=y
216# CONFIG_HZ_300 is not set 208# CONFIG_HZ_300 is not set
217# CONFIG_HZ_1000 is not set 209# CONFIG_HZ_1000 is not set
218CONFIG_HZ=250 210CONFIG_HZ=250
211CONFIG_GENERIC_TIME=y
212CONFIG_GENERIC_CLOCKEVENTS=y
213# CONFIG_CYCLES_CLOCKSOURCE is not set
214CONFIG_TICK_ONESHOT=y
215# CONFIG_NO_HZ is not set
216CONFIG_HIGH_RES_TIMERS=y
217CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
219 218
220# 219#
221# Memory Setup 220# Misc
222# 221#
223CONFIG_MAX_MEM_SIZE=512
224CONFIG_MEM_ADD_WIDTH=10
225CONFIG_BOOT_LOAD=0x1000
226CONFIG_BFIN_SCRATCH_REG_RETN=y 222CONFIG_BFIN_SCRATCH_REG_RETN=y
227# CONFIG_BFIN_SCRATCH_REG_RETE is not set 223# CONFIG_BFIN_SCRATCH_REG_RETE is not set
228# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 224# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
@@ -258,12 +254,14 @@ CONFIG_FLATMEM_MANUAL=y
258CONFIG_FLATMEM=y 254CONFIG_FLATMEM=y
259CONFIG_FLAT_NODE_MEM_MAP=y 255CONFIG_FLAT_NODE_MEM_MAP=y
260# CONFIG_SPARSEMEM_STATIC is not set 256# CONFIG_SPARSEMEM_STATIC is not set
257# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
261CONFIG_SPLIT_PTLOCK_CPUS=4 258CONFIG_SPLIT_PTLOCK_CPUS=4
262# CONFIG_RESOURCES_64BIT is not set 259# CONFIG_RESOURCES_64BIT is not set
263CONFIG_ZONE_DMA_FLAG=1 260CONFIG_ZONE_DMA_FLAG=1
264CONFIG_LARGE_ALLOCS=y 261CONFIG_VIRT_TO_BUS=y
265# CONFIG_BFIN_GPTIMERS is not set 262# CONFIG_BFIN_GPTIMERS is not set
266CONFIG_BFIN_DMA_5XX=y 263CONFIG_BFIN_DMA_5XX=y
264# CONFIG_DMA_UNCACHED_4M is not set
267# CONFIG_DMA_UNCACHED_2M is not set 265# CONFIG_DMA_UNCACHED_2M is not set
268CONFIG_DMA_UNCACHED_1M=y 266CONFIG_DMA_UNCACHED_1M=y
269# CONFIG_DMA_UNCACHED_NONE is not set 267# CONFIG_DMA_UNCACHED_NONE is not set
@@ -301,17 +299,13 @@ CONFIG_C_AMBEN_ALL=y
301CONFIG_BANK_0=0x7BB0 299CONFIG_BANK_0=0x7BB0
302CONFIG_BANK_1=0x7BB0 300CONFIG_BANK_1=0x7BB0
303CONFIG_BANK_2=0x7BB0 301CONFIG_BANK_2=0x7BB0
304CONFIG_BANK_3=0x99B3 302CONFIG_BANK_3=0x99B2
305 303
306# 304#
307# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 305# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
308# 306#
309# CONFIG_PCI is not set 307# CONFIG_PCI is not set
310# CONFIG_ARCH_SUPPORTS_MSI is not set 308# CONFIG_ARCH_SUPPORTS_MSI is not set
311
312#
313# PCCARD (PCMCIA/CardBus) support
314#
315# CONFIG_PCCARD is not set 309# CONFIG_PCCARD is not set
316 310
317# 311#
@@ -329,7 +323,9 @@ CONFIG_BINFMT_ZFLAT=y
329CONFIG_PM=y 323CONFIG_PM=y
330# CONFIG_PM_LEGACY is not set 324# CONFIG_PM_LEGACY is not set
331# CONFIG_PM_DEBUG is not set 325# CONFIG_PM_DEBUG is not set
332# CONFIG_PM_SYSFS_DEPRECATED is not set 326CONFIG_PM_SLEEP=y
327CONFIG_SUSPEND_UP_POSSIBLE=y
328CONFIG_SUSPEND=y
333CONFIG_PM_BFIN_SLEEP_DEEPER=y 329CONFIG_PM_BFIN_SLEEP_DEEPER=y
334# CONFIG_PM_BFIN_SLEEP is not set 330# CONFIG_PM_BFIN_SLEEP is not set
335# CONFIG_PM_WAKEUP_BY_GPIO is not set 331# CONFIG_PM_WAKEUP_BY_GPIO is not set
@@ -375,6 +371,7 @@ CONFIG_SYN_COOKIES=y
375CONFIG_INET_XFRM_MODE_TRANSPORT=y 371CONFIG_INET_XFRM_MODE_TRANSPORT=y
376CONFIG_INET_XFRM_MODE_TUNNEL=y 372CONFIG_INET_XFRM_MODE_TUNNEL=y
377CONFIG_INET_XFRM_MODE_BEET=y 373CONFIG_INET_XFRM_MODE_BEET=y
374# CONFIG_INET_LRO is not set
378CONFIG_INET_DIAG=y 375CONFIG_INET_DIAG=y
379CONFIG_INET_TCP_DIAG=y 376CONFIG_INET_TCP_DIAG=y
380# CONFIG_TCP_CONG_ADVANCED is not set 377# CONFIG_TCP_CONG_ADVANCED is not set
@@ -401,10 +398,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
401# CONFIG_LAPB is not set 398# CONFIG_LAPB is not set
402# CONFIG_ECONET is not set 399# CONFIG_ECONET is not set
403# CONFIG_WAN_ROUTER is not set 400# CONFIG_WAN_ROUTER is not set
404
405#
406# QoS and/or fair queueing
407#
408# CONFIG_NET_SCHED is not set 401# CONFIG_NET_SCHED is not set
409 402
410# 403#
@@ -436,6 +429,10 @@ CONFIG_IRDA_CACHE_LAST_LSAP=y
436# SIR device drivers 429# SIR device drivers
437# 430#
438CONFIG_IRTTY_SIR=m 431CONFIG_IRTTY_SIR=m
432CONFIG_BFIN_SIR=m
433CONFIG_BFIN_SIR1=y
434CONFIG_SIR_BFIN_DMA=y
435# CONFIG_SIR_BFIN_PIO is not set
439 436
440# 437#
441# Dongle support 438# Dongle support
@@ -465,6 +462,7 @@ CONFIG_IRTTY_SIR=m
465# CONFIG_MAC80211 is not set 462# CONFIG_MAC80211 is not set
466# CONFIG_IEEE80211 is not set 463# CONFIG_IEEE80211 is not set
467# CONFIG_RFKILL is not set 464# CONFIG_RFKILL is not set
465# CONFIG_NET_9P is not set
468 466
469# 467#
470# Device Drivers 468# Device Drivers
@@ -473,14 +471,11 @@ CONFIG_IRTTY_SIR=m
473# 471#
474# Generic Driver Options 472# Generic Driver Options
475# 473#
474CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
476CONFIG_STANDALONE=y 475CONFIG_STANDALONE=y
477CONFIG_PREVENT_FIRMWARE_BUILD=y 476CONFIG_PREVENT_FIRMWARE_BUILD=y
478# CONFIG_FW_LOADER is not set 477# CONFIG_FW_LOADER is not set
479# CONFIG_SYS_HYPERVISOR is not set 478# CONFIG_SYS_HYPERVISOR is not set
480
481#
482# Connector - unified userspace <-> kernelspace linker
483#
484# CONFIG_CONNECTOR is not set 479# CONFIG_CONNECTOR is not set
485CONFIG_MTD=y 480CONFIG_MTD=y
486# CONFIG_MTD_DEBUG is not set 481# CONFIG_MTD_DEBUG is not set
@@ -500,6 +495,7 @@ CONFIG_MTD_BLOCK=y
500# CONFIG_INFTL is not set 495# CONFIG_INFTL is not set
501# CONFIG_RFD_FTL is not set 496# CONFIG_RFD_FTL is not set
502# CONFIG_SSFDC is not set 497# CONFIG_SSFDC is not set
498# CONFIG_MTD_OOPS is not set
503 499
504# 500#
505# RAM/ROM/Flash chip drivers 501# RAM/ROM/Flash chip drivers
@@ -572,20 +568,8 @@ CONFIG_MTD_NAND_IDS=m
572# UBI - Unsorted block images 568# UBI - Unsorted block images
573# 569#
574# CONFIG_MTD_UBI is not set 570# CONFIG_MTD_UBI is not set
575
576#
577# Parallel port support
578#
579# CONFIG_PARPORT is not set 571# CONFIG_PARPORT is not set
580 572CONFIG_BLK_DEV=y
581#
582# Plug and Play support
583#
584# CONFIG_PNPACPI is not set
585
586#
587# Block devices
588#
589# CONFIG_BLK_DEV_COW_COMMON is not set 573# CONFIG_BLK_DEV_COW_COMMON is not set
590# CONFIG_BLK_DEV_LOOP is not set 574# CONFIG_BLK_DEV_LOOP is not set
591# CONFIG_BLK_DEV_NBD is not set 575# CONFIG_BLK_DEV_NBD is not set
@@ -595,10 +579,8 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
595CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 579CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
596# CONFIG_CDROM_PKTCDVD is not set 580# CONFIG_CDROM_PKTCDVD is not set
597# CONFIG_ATA_OVER_ETH is not set 581# CONFIG_ATA_OVER_ETH is not set
598 582CONFIG_MISC_DEVICES=y
599# 583# CONFIG_EEPROM_93CX6 is not set
600# Misc devices
601#
602# CONFIG_IDE is not set 584# CONFIG_IDE is not set
603 585
604# 586#
@@ -606,22 +588,18 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
606# 588#
607# CONFIG_RAID_ATTRS is not set 589# CONFIG_RAID_ATTRS is not set
608# CONFIG_SCSI is not set 590# CONFIG_SCSI is not set
591# CONFIG_SCSI_DMA is not set
609# CONFIG_SCSI_NETLINK is not set 592# CONFIG_SCSI_NETLINK is not set
610# CONFIG_ATA is not set 593# CONFIG_ATA is not set
611
612#
613# Multi-device support (RAID and LVM)
614#
615# CONFIG_MD is not set 594# CONFIG_MD is not set
616
617#
618# Network device support
619#
620CONFIG_NETDEVICES=y 595CONFIG_NETDEVICES=y
596# CONFIG_NETDEVICES_MULTIQUEUE is not set
621# CONFIG_DUMMY is not set 597# CONFIG_DUMMY is not set
622# CONFIG_BONDING is not set 598# CONFIG_BONDING is not set
599# CONFIG_MACVLAN is not set
623# CONFIG_EQUALIZER is not set 600# CONFIG_EQUALIZER is not set
624# CONFIG_TUN is not set 601# CONFIG_TUN is not set
602# CONFIG_VETH is not set
625CONFIG_PHYLIB=y 603CONFIG_PHYLIB=y
626 604
627# 605#
@@ -635,21 +613,24 @@ CONFIG_PHYLIB=y
635# CONFIG_VITESSE_PHY is not set 613# CONFIG_VITESSE_PHY is not set
636CONFIG_SMSC_PHY=y 614CONFIG_SMSC_PHY=y
637# CONFIG_BROADCOM_PHY is not set 615# CONFIG_BROADCOM_PHY is not set
616# CONFIG_ICPLUS_PHY is not set
638# CONFIG_FIXED_PHY is not set 617# CONFIG_FIXED_PHY is not set
639 618# CONFIG_MDIO_BITBANG is not set
640#
641# Ethernet (10 or 100Mbit)
642#
643CONFIG_NET_ETHERNET=y 619CONFIG_NET_ETHERNET=y
644CONFIG_MII=y 620CONFIG_MII=y
645# CONFIG_SMC91X is not set
646CONFIG_BFIN_MAC=y 621CONFIG_BFIN_MAC=y
647CONFIG_BFIN_MAC_USE_L1=y 622CONFIG_BFIN_MAC_USE_L1=y
648CONFIG_BFIN_TX_DESC_NUM=10 623CONFIG_BFIN_TX_DESC_NUM=10
649CONFIG_BFIN_RX_DESC_NUM=20 624CONFIG_BFIN_RX_DESC_NUM=20
650# CONFIG_BFIN_MAC_RMII is not set 625# CONFIG_BFIN_MAC_RMII is not set
626# CONFIG_SMC91X is not set
651# CONFIG_SMSC911X is not set 627# CONFIG_SMSC911X is not set
652# CONFIG_DM9000 is not set 628# CONFIG_DM9000 is not set
629# CONFIG_IBM_NEW_EMAC_ZMII is not set
630# CONFIG_IBM_NEW_EMAC_RGMII is not set
631# CONFIG_IBM_NEW_EMAC_TAH is not set
632# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
633# CONFIG_B44 is not set
653CONFIG_NETDEV_1000=y 634CONFIG_NETDEV_1000=y
654# CONFIG_AX88180 is not set 635# CONFIG_AX88180 is not set
655CONFIG_NETDEV_10000=y 636CONFIG_NETDEV_10000=y
@@ -666,15 +647,7 @@ CONFIG_NETDEV_10000=y
666# CONFIG_NETCONSOLE is not set 647# CONFIG_NETCONSOLE is not set
667# CONFIG_NETPOLL is not set 648# CONFIG_NETPOLL is not set
668# CONFIG_NET_POLL_CONTROLLER is not set 649# CONFIG_NET_POLL_CONTROLLER is not set
669
670#
671# ISDN subsystem
672#
673# CONFIG_ISDN is not set 650# CONFIG_ISDN is not set
674
675#
676# Telephony Support
677#
678# CONFIG_PHONE is not set 651# CONFIG_PHONE is not set
679 652
680# 653#
@@ -689,7 +662,6 @@ CONFIG_INPUT=y
689# 662#
690# CONFIG_INPUT_MOUSEDEV is not set 663# CONFIG_INPUT_MOUSEDEV is not set
691# CONFIG_INPUT_JOYDEV is not set 664# CONFIG_INPUT_JOYDEV is not set
692# CONFIG_INPUT_TSDEV is not set
693CONFIG_INPUT_EVDEV=m 665CONFIG_INPUT_EVDEV=m
694# CONFIG_INPUT_EVBUG is not set 666# CONFIG_INPUT_EVBUG is not set
695 667
@@ -702,14 +674,8 @@ CONFIG_INPUT_EVDEV=m
702# CONFIG_INPUT_TABLET is not set 674# CONFIG_INPUT_TABLET is not set
703# CONFIG_INPUT_TOUCHSCREEN is not set 675# CONFIG_INPUT_TOUCHSCREEN is not set
704CONFIG_INPUT_MISC=y 676CONFIG_INPUT_MISC=y
705# CONFIG_INPUT_ATI_REMOTE is not set
706# CONFIG_INPUT_ATI_REMOTE2 is not set
707# CONFIG_INPUT_KEYSPAN_REMOTE is not set
708# CONFIG_INPUT_POWERMATE is not set
709# CONFIG_INPUT_YEALINK is not set
710# CONFIG_INPUT_UINPUT is not set 677# CONFIG_INPUT_UINPUT is not set
711CONFIG_TWI_KEYPAD=m 678CONFIG_TWI_KEYPAD=m
712CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
713 679
714# 680#
715# Hardware I/O ports 681# Hardware I/O ports
@@ -722,15 +688,13 @@ CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
722# 688#
723# CONFIG_AD9960 is not set 689# CONFIG_AD9960 is not set
724# CONFIG_SPI_ADC_BF533 is not set 690# CONFIG_SPI_ADC_BF533 is not set
725# CONFIG_BF5xx_PFLAGS is not set
726# CONFIG_BF5xx_PPIFCD is not set 691# CONFIG_BF5xx_PPIFCD is not set
727# CONFIG_BFIN_SIMPLE_TIMER is not set 692# CONFIG_BFIN_SIMPLE_TIMER is not set
728# CONFIG_BF5xx_PPI is not set 693# CONFIG_BF5xx_PPI is not set
729CONFIG_BFIN_SPORT=y 694CONFIG_BFIN_SPORT=y
730# CONFIG_BFIN_TIMER_LATENCY is not set 695# CONFIG_BFIN_TIMER_LATENCY is not set
731CONFIG_TWI_LCD=m 696CONFIG_TWI_LCD=m
732CONFIG_TWI_LCD_SLAVE_ADDR=34 697CONFIG_SIMPLE_GPIO=m
733# CONFIG_AD5304 is not set
734# CONFIG_VT is not set 698# CONFIG_VT is not set
735# CONFIG_SERIAL_NONSTANDARD is not set 699# CONFIG_SERIAL_NONSTANDARD is not set
736 700
@@ -766,28 +730,11 @@ CONFIG_CAN4LINUX=y
766# CONFIG_CAN_MCF5282 is not set 730# CONFIG_CAN_MCF5282 is not set
767# CONFIG_CAN_UNCTWINCAN is not set 731# CONFIG_CAN_UNCTWINCAN is not set
768CONFIG_CAN_BLACKFIN=m 732CONFIG_CAN_BLACKFIN=m
769
770#
771# IPMI
772#
773# CONFIG_IPMI_HANDLER is not set 733# CONFIG_IPMI_HANDLER is not set
774CONFIG_WATCHDOG=y
775# CONFIG_WATCHDOG_NOWAYOUT is not set
776
777#
778# Watchdog Device Drivers
779#
780# CONFIG_SOFT_WATCHDOG is not set
781CONFIG_BFIN_WDT=y
782CONFIG_HW_RANDOM=y 734CONFIG_HW_RANDOM=y
783# CONFIG_GEN_RTC is not set 735# CONFIG_GEN_RTC is not set
784CONFIG_BLACKFIN_DPMC=y
785# CONFIG_R3964 is not set 736# CONFIG_R3964 is not set
786# CONFIG_RAW_DRIVER is not set 737# CONFIG_RAW_DRIVER is not set
787
788#
789# TPM devices
790#
791# CONFIG_TCG_TPM is not set 738# CONFIG_TCG_TPM is not set
792CONFIG_I2C=m 739CONFIG_I2C=m
793CONFIG_I2C_BOARDINFO=y 740CONFIG_I2C_BOARDINFO=y
@@ -809,6 +756,7 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
809# CONFIG_I2C_OCORES is not set 756# CONFIG_I2C_OCORES is not set
810# CONFIG_I2C_PARPORT_LIGHT is not set 757# CONFIG_I2C_PARPORT_LIGHT is not set
811# CONFIG_I2C_SIMTEC is not set 758# CONFIG_I2C_SIMTEC is not set
759# CONFIG_I2C_TAOS_EVM is not set
812# CONFIG_I2C_STUB is not set 760# CONFIG_I2C_STUB is not set
813 761
814# 762#
@@ -816,14 +764,15 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
816# 764#
817# CONFIG_SENSORS_DS1337 is not set 765# CONFIG_SENSORS_DS1337 is not set
818# CONFIG_SENSORS_DS1374 is not set 766# CONFIG_SENSORS_DS1374 is not set
767# CONFIG_DS1682 is not set
819CONFIG_SENSORS_AD5252=m 768CONFIG_SENSORS_AD5252=m
820# CONFIG_SENSORS_EEPROM is not set 769# CONFIG_SENSORS_EEPROM is not set
821# CONFIG_SENSORS_PCF8574 is not set 770# CONFIG_SENSORS_PCF8574 is not set
822# CONFIG_SENSORS_PCF8575 is not set 771# CONFIG_SENSORS_PCF8575 is not set
823# CONFIG_SENSORS_PCA9543 is not set
824# CONFIG_SENSORS_PCA9539 is not set 772# CONFIG_SENSORS_PCA9539 is not set
825# CONFIG_SENSORS_PCF8591 is not set 773# CONFIG_SENSORS_PCF8591 is not set
826# CONFIG_SENSORS_MAX6875 is not set 774# CONFIG_SENSORS_MAX6875 is not set
775# CONFIG_SENSORS_TSL2550 is not set
827# CONFIG_I2C_DEBUG_CORE is not set 776# CONFIG_I2C_DEBUG_CORE is not set
828# CONFIG_I2C_DEBUG_ALGO is not set 777# CONFIG_I2C_DEBUG_ALGO is not set
829# CONFIG_I2C_DEBUG_BUS is not set 778# CONFIG_I2C_DEBUG_BUS is not set
@@ -846,14 +795,11 @@ CONFIG_SPI_BFIN=y
846# 795#
847# CONFIG_SPI_AT25 is not set 796# CONFIG_SPI_AT25 is not set
848# CONFIG_SPI_SPIDEV is not set 797# CONFIG_SPI_SPIDEV is not set
849 798# CONFIG_SPI_TLE62X0 is not set
850#
851# Dallas's 1-wire bus
852#
853# CONFIG_W1 is not set 799# CONFIG_W1 is not set
800# CONFIG_POWER_SUPPLY is not set
854CONFIG_HWMON=y 801CONFIG_HWMON=y
855# CONFIG_HWMON_VID is not set 802# CONFIG_HWMON_VID is not set
856# CONFIG_SENSORS_ABITUGURU is not set
857# CONFIG_SENSORS_AD7418 is not set 803# CONFIG_SENSORS_AD7418 is not set
858# CONFIG_SENSORS_ADM1021 is not set 804# CONFIG_SENSORS_ADM1021 is not set
859# CONFIG_SENSORS_ADM1025 is not set 805# CONFIG_SENSORS_ADM1025 is not set
@@ -861,12 +807,12 @@ CONFIG_HWMON=y
861# CONFIG_SENSORS_ADM1029 is not set 807# CONFIG_SENSORS_ADM1029 is not set
862# CONFIG_SENSORS_ADM1031 is not set 808# CONFIG_SENSORS_ADM1031 is not set
863# CONFIG_SENSORS_ADM9240 is not set 809# CONFIG_SENSORS_ADM9240 is not set
864# CONFIG_SENSORS_ASB100 is not set 810# CONFIG_SENSORS_ADT7470 is not set
865# CONFIG_SENSORS_ATXP1 is not set 811# CONFIG_SENSORS_ATXP1 is not set
866# CONFIG_SENSORS_DS1621 is not set 812# CONFIG_SENSORS_DS1621 is not set
867# CONFIG_SENSORS_F71805F is not set 813# CONFIG_SENSORS_F71805F is not set
868# CONFIG_SENSORS_FSCHER is not set 814# CONFIG_SENSORS_F71882FG is not set
869# CONFIG_SENSORS_FSCPOS is not set 815# CONFIG_SENSORS_F75375S is not set
870# CONFIG_SENSORS_GL518SM is not set 816# CONFIG_SENSORS_GL518SM is not set
871# CONFIG_SENSORS_GL520SM is not set 817# CONFIG_SENSORS_GL520SM is not set
872# CONFIG_SENSORS_IT87 is not set 818# CONFIG_SENSORS_IT87 is not set
@@ -881,13 +827,16 @@ CONFIG_HWMON=y
881# CONFIG_SENSORS_LM87 is not set 827# CONFIG_SENSORS_LM87 is not set
882# CONFIG_SENSORS_LM90 is not set 828# CONFIG_SENSORS_LM90 is not set
883# CONFIG_SENSORS_LM92 is not set 829# CONFIG_SENSORS_LM92 is not set
830# CONFIG_SENSORS_LM93 is not set
884# CONFIG_SENSORS_MAX1619 is not set 831# CONFIG_SENSORS_MAX1619 is not set
885# CONFIG_SENSORS_MAX6650 is not set 832# CONFIG_SENSORS_MAX6650 is not set
886# CONFIG_SENSORS_PC87360 is not set 833# CONFIG_SENSORS_PC87360 is not set
887# CONFIG_SENSORS_PC87427 is not set 834# CONFIG_SENSORS_PC87427 is not set
835# CONFIG_SENSORS_DME1737 is not set
888# CONFIG_SENSORS_SMSC47M1 is not set 836# CONFIG_SENSORS_SMSC47M1 is not set
889# CONFIG_SENSORS_SMSC47M192 is not set 837# CONFIG_SENSORS_SMSC47M192 is not set
890# CONFIG_SENSORS_SMSC47B397 is not set 838# CONFIG_SENSORS_SMSC47B397 is not set
839# CONFIG_SENSORS_THMC50 is not set
891# CONFIG_SENSORS_VT1211 is not set 840# CONFIG_SENSORS_VT1211 is not set
892# CONFIG_SENSORS_W83781D is not set 841# CONFIG_SENSORS_W83781D is not set
893# CONFIG_SENSORS_W83791D is not set 842# CONFIG_SENSORS_W83791D is not set
@@ -897,6 +846,20 @@ CONFIG_HWMON=y
897# CONFIG_SENSORS_W83627HF is not set 846# CONFIG_SENSORS_W83627HF is not set
898# CONFIG_SENSORS_W83627EHF is not set 847# CONFIG_SENSORS_W83627EHF is not set
899# CONFIG_HWMON_DEBUG_CHIP is not set 848# CONFIG_HWMON_DEBUG_CHIP is not set
849CONFIG_WATCHDOG=y
850# CONFIG_WATCHDOG_NOWAYOUT is not set
851
852#
853# Watchdog Device Drivers
854#
855# CONFIG_SOFT_WATCHDOG is not set
856CONFIG_BFIN_WDT=y
857
858#
859# Sonics Silicon Backplane
860#
861CONFIG_SSB_POSSIBLE=y
862# CONFIG_SSB is not set
900 863
901# 864#
902# Multifunction device drivers 865# Multifunction device drivers
@@ -913,21 +876,15 @@ CONFIG_DAB=y
913# 876#
914# Graphics support 877# Graphics support
915# 878#
916CONFIG_BACKLIGHT_LCD_SUPPORT=y
917CONFIG_BACKLIGHT_CLASS_DEVICE=m
918CONFIG_LCD_CLASS_DEVICE=m
919
920#
921# Display device support
922#
923# CONFIG_DISPLAY_SUPPORT is not set
924# CONFIG_VGASTATE is not set 879# CONFIG_VGASTATE is not set
880# CONFIG_VIDEO_OUTPUT_CONTROL is not set
925CONFIG_FB=m 881CONFIG_FB=m
926CONFIG_FIRMWARE_EDID=y 882CONFIG_FIRMWARE_EDID=y
927# CONFIG_FB_DDC is not set 883# CONFIG_FB_DDC is not set
928CONFIG_FB_CFB_FILLRECT=m 884CONFIG_FB_CFB_FILLRECT=m
929CONFIG_FB_CFB_COPYAREA=m 885CONFIG_FB_CFB_COPYAREA=m
930CONFIG_FB_CFB_IMAGEBLIT=m 886CONFIG_FB_CFB_IMAGEBLIT=m
887# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
931# CONFIG_FB_SYS_FILLRECT is not set 888# CONFIG_FB_SYS_FILLRECT is not set
932# CONFIG_FB_SYS_COPYAREA is not set 889# CONFIG_FB_SYS_COPYAREA is not set
933# CONFIG_FB_SYS_IMAGEBLIT is not set 890# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -942,7 +899,8 @@ CONFIG_FB_DEFERRED_IO=y
942# 899#
943# Frame buffer hardware drivers 900# Frame buffer hardware drivers
944# 901#
945CONFIG_FB_BFIN_7171=m 902# CONFIG_FB_HITACHI_TX09 is not set
903# CONFIG_FB_BFIN_T350MCQB is not set
946CONFIG_FB_BFIN_7393=m 904CONFIG_FB_BFIN_7393=m
947CONFIG_NTSC=y 905CONFIG_NTSC=y
948# CONFIG_PAL is not set 906# CONFIG_PAL is not set
@@ -956,10 +914,18 @@ CONFIG_FB_BF537_LQ035=m
956CONFIG_LQ035_SLAVE_ADDR=0x58 914CONFIG_LQ035_SLAVE_ADDR=0x58
957# CONFIG_FB_BFIN_LANDSCAPE is not set 915# CONFIG_FB_BFIN_LANDSCAPE is not set
958# CONFIG_FB_BFIN_BGR is not set 916# CONFIG_FB_BFIN_BGR is not set
959# CONFIG_FB_BFIN_T350MCQB is not set
960# CONFIG_FB_HITACHI_TX09 is not set
961# CONFIG_FB_S1D13XXX is not set 917# CONFIG_FB_S1D13XXX is not set
962# CONFIG_FB_VIRTUAL is not set 918# CONFIG_FB_VIRTUAL is not set
919CONFIG_BACKLIGHT_LCD_SUPPORT=y
920CONFIG_LCD_CLASS_DEVICE=m
921# CONFIG_LCD_LTV350QV is not set
922CONFIG_BACKLIGHT_CLASS_DEVICE=m
923CONFIG_BACKLIGHT_CORGI=m
924
925#
926# Display device support
927#
928# CONFIG_DISPLAY_SUPPORT is not set
963# CONFIG_LOGO is not set 929# CONFIG_LOGO is not set
964 930
965# 931#
@@ -993,6 +959,10 @@ CONFIG_SND_VERBOSE_PROCFS=y
993# CONFIG_SND_MPU401 is not set 959# CONFIG_SND_MPU401 is not set
994 960
995# 961#
962# SPI devices
963#
964
965#
996# ALSA Blackfin devices 966# ALSA Blackfin devices
997# 967#
998CONFIG_SND_BLACKFIN_AD1836=m 968CONFIG_SND_BLACKFIN_AD1836=m
@@ -1005,6 +975,10 @@ CONFIG_SND_BLACKFIN_SPI_PFBIT=4
1005CONFIG_SND_BFIN_AD73311=m 975CONFIG_SND_BFIN_AD73311=m
1006CONFIG_SND_BFIN_SPORT=0 976CONFIG_SND_BFIN_SPORT=0
1007CONFIG_SND_BFIN_AD73311_SE=4 977CONFIG_SND_BFIN_AD73311_SE=4
978CONFIG_SND_BFIN_AD73322=m
979CONFIG_SND_BFIN_AD73322_SPORT0_SE=10
980CONFIG_SND_BFIN_AD73322_SPORT1_SE=14
981CONFIG_SND_BFIN_AD73322_RESET=12
1008 982
1009# 983#
1010# System on Chip audio support 984# System on Chip audio support
@@ -1016,9 +990,14 @@ CONFIG_SND_MMAP_SUPPORT=y
1016CONFIG_SND_BF5XX_SOC_AC97=m 990CONFIG_SND_BF5XX_SOC_AC97=m
1017# CONFIG_SND_BF5XX_SOC_WM8750 is not set 991# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1018# CONFIG_SND_BF5XX_SOC_WM8731 is not set 992# CONFIG_SND_BF5XX_SOC_WM8731 is not set
993# CONFIG_SND_BF5XX_SOC_SSM2602 is not set
1019CONFIG_SND_BF5XX_SOC_BF5xx=m 994CONFIG_SND_BF5XX_SOC_BF5xx=m
1020CONFIG_SND_BF5XX_SPORT_NUM=0 995CONFIG_SND_BF5XX_SPORT_NUM=0
1021# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set 996# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
997
998#
999# SoC Audio support for SuperH
1000#
1022CONFIG_SND_SOC_AD1980=m 1001CONFIG_SND_SOC_AD1980=m
1023 1002
1024# 1003#
@@ -1026,59 +1005,18 @@ CONFIG_SND_SOC_AD1980=m
1026# 1005#
1027# CONFIG_SOUND_PRIME is not set 1006# CONFIG_SOUND_PRIME is not set
1028CONFIG_AC97_BUS=m 1007CONFIG_AC97_BUS=m
1029 1008CONFIG_HID_SUPPORT=y
1030#
1031# HID Devices
1032#
1033CONFIG_HID=y 1009CONFIG_HID=y
1034# CONFIG_HID_DEBUG is not set 1010# CONFIG_HID_DEBUG is not set
1035 1011# CONFIG_HIDRAW is not set
1036# 1012# CONFIG_USB_SUPPORT is not set
1037# USB support 1013# CONFIG_NO_DUMMY_DELAY is not set
1038# 1014# CONFIG_DUMMY_DELAY_BANK0 is not set
1039CONFIG_USB_ARCH_HAS_HCD=y 1015# CONFIG_DUMMY_DELAY_BANK1 is not set
1040# CONFIG_USB_ARCH_HAS_OHCI is not set 1016# CONFIG_DUMMY_DELAY_BANK2 is not set
1041# CONFIG_USB_ARCH_HAS_EHCI is not set 1017# CONFIG_DUMMY_DELAY_BANK3 is not set
1042# CONFIG_USB is not set
1043
1044#
1045# Enable Host or Gadget support to see Inventra options
1046#
1047
1048#
1049# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1050#
1051
1052#
1053# USB Gadget Support
1054#
1055# CONFIG_USB_GADGET is not set
1056# CONFIG_MMC is not set 1018# CONFIG_MMC is not set
1057
1058#
1059# LED devices
1060#
1061# CONFIG_NEW_LEDS is not set 1019# CONFIG_NEW_LEDS is not set
1062
1063#
1064# LED drivers
1065#
1066
1067#
1068# LED Triggers
1069#
1070
1071#
1072# InfiniBand support
1073#
1074
1075#
1076# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1077#
1078
1079#
1080# Real Time Clock
1081#
1082CONFIG_RTC_LIB=y 1020CONFIG_RTC_LIB=y
1083CONFIG_RTC_CLASS=y 1021CONFIG_RTC_CLASS=y
1084CONFIG_RTC_HCTOSYS=y 1022CONFIG_RTC_HCTOSYS=y
@@ -1098,6 +1036,7 @@ CONFIG_RTC_INTF_DEV=y
1098# I2C RTC drivers 1036# I2C RTC drivers
1099# 1037#
1100# CONFIG_RTC_DRV_DS1307 is not set 1038# CONFIG_RTC_DRV_DS1307 is not set
1039# CONFIG_RTC_DRV_DS1374 is not set
1101# CONFIG_RTC_DRV_DS1672 is not set 1040# CONFIG_RTC_DRV_DS1672 is not set
1102# CONFIG_RTC_DRV_MAX6900 is not set 1041# CONFIG_RTC_DRV_MAX6900 is not set
1103# CONFIG_RTC_DRV_RS5C372 is not set 1042# CONFIG_RTC_DRV_RS5C372 is not set
@@ -1105,6 +1044,7 @@ CONFIG_RTC_INTF_DEV=y
1105# CONFIG_RTC_DRV_X1205 is not set 1044# CONFIG_RTC_DRV_X1205 is not set
1106# CONFIG_RTC_DRV_PCF8563 is not set 1045# CONFIG_RTC_DRV_PCF8563 is not set
1107# CONFIG_RTC_DRV_PCF8583 is not set 1046# CONFIG_RTC_DRV_PCF8583 is not set
1047# CONFIG_RTC_DRV_M41T80 is not set
1108 1048
1109# 1049#
1110# SPI RTC drivers 1050# SPI RTC drivers
@@ -1116,8 +1056,10 @@ CONFIG_RTC_INTF_DEV=y
1116# Platform RTC drivers 1056# Platform RTC drivers
1117# 1057#
1118# CONFIG_RTC_DRV_DS1553 is not set 1058# CONFIG_RTC_DRV_DS1553 is not set
1059# CONFIG_RTC_DRV_STK17TA8 is not set
1119# CONFIG_RTC_DRV_DS1742 is not set 1060# CONFIG_RTC_DRV_DS1742 is not set
1120# CONFIG_RTC_DRV_M48T86 is not set 1061# CONFIG_RTC_DRV_M48T86 is not set
1062# CONFIG_RTC_DRV_M48T59 is not set
1121# CONFIG_RTC_DRV_V3020 is not set 1063# CONFIG_RTC_DRV_V3020 is not set
1122 1064
1123# 1065#
@@ -1126,22 +1068,9 @@ CONFIG_RTC_INTF_DEV=y
1126CONFIG_RTC_DRV_BFIN=y 1068CONFIG_RTC_DRV_BFIN=y
1127 1069
1128# 1070#
1129# DMA Engine support 1071# Userspace I/O
1130# 1072#
1131# CONFIG_DMA_ENGINE is not set 1073# CONFIG_UIO is not set
1132
1133#
1134# DMA Clients
1135#
1136
1137#
1138# DMA Devices
1139#
1140
1141#
1142# PBX support
1143#
1144# CONFIG_PBX is not set
1145 1074
1146# 1075#
1147# File systems 1076# File systems
@@ -1186,7 +1115,6 @@ CONFIG_PROC_SYSCTL=y
1186CONFIG_SYSFS=y 1115CONFIG_SYSFS=y
1187# CONFIG_TMPFS is not set 1116# CONFIG_TMPFS is not set
1188# CONFIG_HUGETLB_PAGE is not set 1117# CONFIG_HUGETLB_PAGE is not set
1189CONFIG_RAMFS=y
1190# CONFIG_CONFIGFS_FS is not set 1118# CONFIG_CONFIGFS_FS is not set
1191 1119
1192# 1120#
@@ -1212,10 +1140,12 @@ CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
1212CONFIG_JFFS2_FS=m 1140CONFIG_JFFS2_FS=m
1213CONFIG_JFFS2_FS_DEBUG=0 1141CONFIG_JFFS2_FS_DEBUG=0
1214CONFIG_JFFS2_FS_WRITEBUFFER=y 1142CONFIG_JFFS2_FS_WRITEBUFFER=y
1143# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1215# CONFIG_JFFS2_SUMMARY is not set 1144# CONFIG_JFFS2_SUMMARY is not set
1216# CONFIG_JFFS2_FS_XATTR is not set 1145# CONFIG_JFFS2_FS_XATTR is not set
1217# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1146# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1218CONFIG_JFFS2_ZLIB=y 1147CONFIG_JFFS2_ZLIB=y
1148# CONFIG_JFFS2_LZO is not set
1219CONFIG_JFFS2_RTIME=y 1149CONFIG_JFFS2_RTIME=y
1220# CONFIG_JFFS2_RUBIN is not set 1150# CONFIG_JFFS2_RUBIN is not set
1221# CONFIG_CRAMFS is not set 1151# CONFIG_CRAMFS is not set
@@ -1224,10 +1154,7 @@ CONFIG_JFFS2_RTIME=y
1224# CONFIG_QNX4FS_FS is not set 1154# CONFIG_QNX4FS_FS is not set
1225# CONFIG_SYSV_FS is not set 1155# CONFIG_SYSV_FS is not set
1226# CONFIG_UFS_FS is not set 1156# CONFIG_UFS_FS is not set
1227 1157CONFIG_NETWORK_FILESYSTEMS=y
1228#
1229# Network File Systems
1230#
1231CONFIG_NFS_FS=m 1158CONFIG_NFS_FS=m
1232CONFIG_NFS_V3=y 1159CONFIG_NFS_V3=y
1233# CONFIG_NFS_V3_ACL is not set 1160# CONFIG_NFS_V3_ACL is not set
@@ -1247,17 +1174,12 @@ CONFIG_SMB_FS=m
1247# CONFIG_NCP_FS is not set 1174# CONFIG_NCP_FS is not set
1248# CONFIG_CODA_FS is not set 1175# CONFIG_CODA_FS is not set
1249# CONFIG_AFS_FS is not set 1176# CONFIG_AFS_FS is not set
1250# CONFIG_9P_FS is not set
1251 1177
1252# 1178#
1253# Partition Types 1179# Partition Types
1254# 1180#
1255# CONFIG_PARTITION_ADVANCED is not set 1181# CONFIG_PARTITION_ADVANCED is not set
1256CONFIG_MSDOS_PARTITION=y 1182CONFIG_MSDOS_PARTITION=y
1257
1258#
1259# Native Language Support
1260#
1261CONFIG_NLS=m 1183CONFIG_NLS=m
1262CONFIG_NLS_DEFAULT="iso8859-1" 1184CONFIG_NLS_DEFAULT="iso8859-1"
1263# CONFIG_NLS_CODEPAGE_437 is not set 1185# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1298,21 +1220,16 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1298# CONFIG_NLS_KOI8_R is not set 1220# CONFIG_NLS_KOI8_R is not set
1299# CONFIG_NLS_KOI8_U is not set 1221# CONFIG_NLS_KOI8_U is not set
1300# CONFIG_NLS_UTF8 is not set 1222# CONFIG_NLS_UTF8 is not set
1301
1302#
1303# Distributed Lock Manager
1304#
1305# CONFIG_DLM is not set 1223# CONFIG_DLM is not set
1306 1224CONFIG_INSTRUMENTATION=y
1307#
1308# Profiling support
1309#
1310# CONFIG_PROFILING is not set 1225# CONFIG_PROFILING is not set
1226# CONFIG_MARKERS is not set
1311 1227
1312# 1228#
1313# Kernel hacking 1229# Kernel hacking
1314# 1230#
1315# CONFIG_PRINTK_TIME is not set 1231# CONFIG_PRINTK_TIME is not set
1232CONFIG_ENABLE_WARN_DEPRECATED=y
1316CONFIG_ENABLE_MUST_CHECK=y 1233CONFIG_ENABLE_MUST_CHECK=y
1317# CONFIG_MAGIC_SYSRQ is not set 1234# CONFIG_MAGIC_SYSRQ is not set
1318# CONFIG_UNUSED_SYMBOLS is not set 1235# CONFIG_UNUSED_SYMBOLS is not set
@@ -1320,6 +1237,7 @@ CONFIG_DEBUG_FS=y
1320# CONFIG_HEADERS_CHECK is not set 1237# CONFIG_HEADERS_CHECK is not set
1321# CONFIG_DEBUG_KERNEL is not set 1238# CONFIG_DEBUG_KERNEL is not set
1322# CONFIG_DEBUG_BUGVERBOSE is not set 1239# CONFIG_DEBUG_BUGVERBOSE is not set
1240# CONFIG_SAMPLES is not set
1323CONFIG_DEBUG_MMRS=y 1241CONFIG_DEBUG_MMRS=y
1324CONFIG_DEBUG_HUNT_FOR_ZERO=y 1242CONFIG_DEBUG_HUNT_FOR_ZERO=y
1325CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1243CONFIG_DEBUG_BFIN_HWTRACE_ON=y
@@ -1339,11 +1257,7 @@ CONFIG_ACCESS_CHECK=y
1339# CONFIG_KEYS is not set 1257# CONFIG_KEYS is not set
1340CONFIG_SECURITY=y 1258CONFIG_SECURITY=y
1341# CONFIG_SECURITY_NETWORK is not set 1259# CONFIG_SECURITY_NETWORK is not set
1342CONFIG_SECURITY_CAPABILITIES=m 1260# CONFIG_SECURITY_CAPABILITIES is not set
1343
1344#
1345# Cryptographic options
1346#
1347# CONFIG_CRYPTO is not set 1261# CONFIG_CRYPTO is not set
1348 1262
1349# 1263#
@@ -1354,6 +1268,7 @@ CONFIG_CRC_CCITT=m
1354# CONFIG_CRC16 is not set 1268# CONFIG_CRC16 is not set
1355# CONFIG_CRC_ITU_T is not set 1269# CONFIG_CRC_ITU_T is not set
1356CONFIG_CRC32=y 1270CONFIG_CRC32=y
1271# CONFIG_CRC7 is not set
1357# CONFIG_LIBCRC32C is not set 1272# CONFIG_LIBCRC32C is not set
1358CONFIG_ZLIB_INFLATE=y 1273CONFIG_ZLIB_INFLATE=y
1359CONFIG_ZLIB_DEFLATE=m 1274CONFIG_ZLIB_DEFLATE=m
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 1ff2ff4b49aa..390669e8668e 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -365,7 +365,7 @@ CONFIG_C_AMBEN_ALL=y
365CONFIG_BANK_0=0x7BB0 365CONFIG_BANK_0=0x7BB0
366CONFIG_BANK_1=0x5554 366CONFIG_BANK_1=0x5554
367CONFIG_BANK_2=0x7BB0 367CONFIG_BANK_2=0x7BB0
368CONFIG_BANK_3=0x99B3 368CONFIG_BANK_3=0x99B2
369CONFIG_EBIU_MBSCTLVAL=0x0 369CONFIG_EBIU_MBSCTLVAL=0x0
370CONFIG_EBIU_MODEVAL=0x1 370CONFIG_EBIU_MODEVAL=0x1
371CONFIG_EBIU_FCTLVAL=0x6 371CONFIG_EBIU_FCTLVAL=0x6
@@ -468,7 +468,60 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
468# 468#
469# CONFIG_NET_PKTGEN is not set 469# CONFIG_NET_PKTGEN is not set
470# CONFIG_HAMRADIO is not set 470# CONFIG_HAMRADIO is not set
471# CONFIG_IRDA is not set 471CONFIG_IRDA=m
472
473#
474# IrDA protocols
475#
476CONFIG_IRLAN=m
477CONFIG_IRCOMM=m
478# CONFIG_IRDA_ULTRA is not set
479
480#
481# IrDA options
482#
483# CONFIG_IRDA_CACHE_LAST_LSAP is not set
484# CONFIG_IRDA_FAST_RR is not set
485# CONFIG_IRDA_DEBUG is not set
486
487#
488# Infrared-port device drivers
489#
490
491#
492# SIR device drivers
493#
494CONFIG_IRTTY_SIR=m
495CONFIG_BFIN_SIR=m
496# CONFIG_BFIN_SIR0 is not set
497# CONFIG_BFIN_SIR2 is not set
498CONFIG_BFIN_SIR3=y
499CONFIG_SIR_BFIN_DMA=y
500# CONFIG_SIR_BFIN_PIO is not set
501
502#
503# Dongle support
504#
505# CONFIG_DONGLE is not set
506# CONFIG_KINGSUN_DONGLE is not set
507# CONFIG_KSDAZZLE_DONGLE is not set
508# CONFIG_KS959_DONGLE is not set
509
510#
511# Old SIR device drivers
512#
513# CONFIG_IRPORT_SIR is not set
514
515#
516# Old Serial dongle support
517#
518
519#
520# FIR device drivers
521#
522# CONFIG_USB_IRDA is not set
523# CONFIG_SIGMATEL_FIR is not set
524# CONFIG_MCS_FIR is not set
472# CONFIG_BT is not set 525# CONFIG_BT is not set
473# CONFIG_AF_RXRPC is not set 526# CONFIG_AF_RXRPC is not set
474 527
@@ -575,6 +628,7 @@ CONFIG_MTD_NAND=y
575CONFIG_MTD_NAND_IDS=y 628CONFIG_MTD_NAND_IDS=y
576CONFIG_MTD_NAND_BF5XX=y 629CONFIG_MTD_NAND_BF5XX=y
577CONFIG_MTD_NAND_BF5XX_HWECC=y 630CONFIG_MTD_NAND_BF5XX_HWECC=y
631# CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC is not set
578# CONFIG_MTD_NAND_DISKONCHIP is not set 632# CONFIG_MTD_NAND_DISKONCHIP is not set
579# CONFIG_MTD_NAND_NANDSIM is not set 633# CONFIG_MTD_NAND_NANDSIM is not set
580# CONFIG_MTD_NAND_PLATFORM is not set 634# CONFIG_MTD_NAND_PLATFORM is not set
@@ -766,7 +820,7 @@ CONFIG_BFIN_OTP=y
766# CONFIG_BFIN_SPORT is not set 820# CONFIG_BFIN_SPORT is not set
767# CONFIG_BFIN_TIMER_LATENCY is not set 821# CONFIG_BFIN_TIMER_LATENCY is not set
768# CONFIG_TWI_LCD is not set 822# CONFIG_TWI_LCD is not set
769# CONFIG_SIMPLE_GPIO is not set 823CONFIG_SIMPLE_GPIO=m
770CONFIG_VT=y 824CONFIG_VT=y
771CONFIG_VT_CONSOLE=y 825CONFIG_VT_CONSOLE=y
772CONFIG_HW_CONSOLE=y 826CONFIG_HW_CONSOLE=y
@@ -1071,6 +1125,7 @@ CONFIG_SND_BF5XX_SOC_AC97=y
1071CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y 1125CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y
1072# CONFIG_SND_BF5XX_SOC_WM8750 is not set 1126# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1073# CONFIG_SND_BF5XX_SOC_WM8731 is not set 1127# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1128# CONFIG_SND_BF5XX_SOC_SSM2602 is not set
1074CONFIG_SND_BF5XX_SPORT_NUM=0 1129CONFIG_SND_BF5XX_SPORT_NUM=0
1075CONFIG_SND_BF5XX_HAVE_COLD_RESET=y 1130CONFIG_SND_BF5XX_HAVE_COLD_RESET=y
1076CONFIG_SND_BF5XX_RESET_GPIO_NUM=19 1131CONFIG_SND_BF5XX_RESET_GPIO_NUM=19
@@ -1133,7 +1188,7 @@ CONFIG_USB_MUSB_HOST=y
1133# CONFIG_USB_MUSB_OTG is not set 1188# CONFIG_USB_MUSB_OTG is not set
1134CONFIG_USB_MUSB_HDRC_HCD=y 1189CONFIG_USB_MUSB_HDRC_HCD=y
1135# CONFIG_MUSB_PIO_ONLY is not set 1190# CONFIG_MUSB_PIO_ONLY is not set
1136# CONFIG_USB_INVENTRA_DMA is not set 1191CONFIG_USB_INVENTRA_DMA=y
1137# CONFIG_USB_TI_CPPI_DMA is not set 1192# CONFIG_USB_TI_CPPI_DMA is not set
1138CONFIG_USB_MUSB_LOGLEVEL=0 1193CONFIG_USB_MUSB_LOGLEVEL=0
1139 1194
@@ -1312,7 +1367,7 @@ CONFIG_FS_MBCACHE=y
1312CONFIG_INOTIFY=y 1367CONFIG_INOTIFY=y
1313CONFIG_INOTIFY_USER=y 1368CONFIG_INOTIFY_USER=y
1314# CONFIG_QUOTA is not set 1369# CONFIG_QUOTA is not set
1315CONFIG_DNOTIFY=y 1370# CONFIG_DNOTIFY is not set
1316# CONFIG_AUTOFS_FS is not set 1371# CONFIG_AUTOFS_FS is not set
1317# CONFIG_AUTOFS4_FS is not set 1372# CONFIG_AUTOFS4_FS is not set
1318# CONFIG_FUSE_FS is not set 1373# CONFIG_FUSE_FS is not set
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index b4a20c890816..976a4d7ba175 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.16 3# Linux kernel version: 2.6.24.7
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -13,35 +13,34 @@ CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y 13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_GPIO=y 16CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14 17CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y 18CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21 20
22# 21#
23# Code maturity level options 22# General setup
24# 23#
25CONFIG_EXPERIMENTAL=y 24CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y 25CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32 26CONFIG_INIT_ENV_ARG_LIMIT=32
28
29#
30# General setup
31#
32CONFIG_LOCALVERSION="" 27CONFIG_LOCALVERSION=""
33CONFIG_LOCALVERSION_AUTO=y 28CONFIG_LOCALVERSION_AUTO=y
34CONFIG_SYSVIPC=y 29CONFIG_SYSVIPC=y
35# CONFIG_IPC_NS is not set
36CONFIG_SYSVIPC_SYSCTL=y 30CONFIG_SYSVIPC_SYSCTL=y
37# CONFIG_POSIX_MQUEUE is not set 31# CONFIG_POSIX_MQUEUE is not set
38# CONFIG_BSD_PROCESS_ACCT is not set 32# CONFIG_BSD_PROCESS_ACCT is not set
39# CONFIG_TASKSTATS is not set 33# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 34# CONFIG_USER_NS is not set
35# CONFIG_PID_NS is not set
41# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
42CONFIG_IKCONFIG=y 37CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y 38CONFIG_IKCONFIG_PROC=y
44CONFIG_LOG_BUF_SHIFT=14 39CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y
42CONFIG_FAIR_USER_SCHED=y
43# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y 44CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set 45# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y 46CONFIG_BLK_DEV_INITRD=y
@@ -64,32 +63,24 @@ CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y 63CONFIG_SIGNALFD=y
65CONFIG_EVENTFD=y 64CONFIG_EVENTFD=y
66CONFIG_VM_EVENT_COUNTERS=y 65CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_BIG_ORDER_ALLOC_NOFAIL_MAGIC=3
68# CONFIG_NP2 is not set
69CONFIG_SLAB=y 66CONFIG_SLAB=y
70# CONFIG_SLUB is not set 67# CONFIG_SLUB is not set
71# CONFIG_SLOB is not set 68# CONFIG_SLOB is not set
69CONFIG_SLABINFO=y
72CONFIG_RT_MUTEXES=y 70CONFIG_RT_MUTEXES=y
73CONFIG_TINY_SHMEM=y 71CONFIG_TINY_SHMEM=y
74CONFIG_BASE_SMALL=0 72CONFIG_BASE_SMALL=0
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y 73CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y 74CONFIG_MODULE_UNLOAD=y
81# CONFIG_MODULE_FORCE_UNLOAD is not set 75# CONFIG_MODULE_FORCE_UNLOAD is not set
82# CONFIG_MODVERSIONS is not set 76# CONFIG_MODVERSIONS is not set
83# CONFIG_MODULE_SRCVERSION_ALL is not set 77# CONFIG_MODULE_SRCVERSION_ALL is not set
84CONFIG_KMOD=y 78CONFIG_KMOD=y
85
86#
87# Block layer
88#
89CONFIG_BLOCK=y 79CONFIG_BLOCK=y
90# CONFIG_LBD is not set 80# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set 81# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set 82# CONFIG_LSF is not set
83# CONFIG_BLK_DEV_BSG is not set
93 84
94# 85#
95# IO Schedulers 86# IO Schedulers
@@ -140,7 +131,6 @@ CONFIG_BF_REV_0_3=y
140# CONFIG_BF_REV_0_5 is not set 131# CONFIG_BF_REV_0_5 is not set
141# CONFIG_BF_REV_ANY is not set 132# CONFIG_BF_REV_ANY is not set
142# CONFIG_BF_REV_NONE is not set 133# CONFIG_BF_REV_NONE is not set
143CONFIG_BFIN_DUAL_CORE=y
144CONFIG_MEM_MT48LC16M16A2TG_75=y 134CONFIG_MEM_MT48LC16M16A2TG_75=y
145CONFIG_IRQ_PLL_WAKEUP=7 135CONFIG_IRQ_PLL_WAKEUP=7
146CONFIG_IRQ_SPORT0_ERROR=7 136CONFIG_IRQ_SPORT0_ERROR=7
@@ -233,12 +223,14 @@ CONFIG_IRQ_WDTIMER=13
233# Board customizations 223# Board customizations
234# 224#
235# CONFIG_CMDLINE_BOOL is not set 225# CONFIG_CMDLINE_BOOL is not set
226CONFIG_BOOT_LOAD=0x1000
236 227
237# 228#
238# Clock/PLL Setup 229# Clock/PLL Setup
239# 230#
240CONFIG_CLKIN_HZ=30000000 231CONFIG_CLKIN_HZ=30000000
241# CONFIG_BFIN_KERNEL_CLOCK is not set 232# CONFIG_BFIN_KERNEL_CLOCK is not set
233CONFIG_MAX_MEM_SIZE=512
242CONFIG_MAX_VCO_HZ=600000000 234CONFIG_MAX_VCO_HZ=600000000
243CONFIG_MIN_VCO_HZ=50000000 235CONFIG_MIN_VCO_HZ=50000000
244CONFIG_MAX_SCLK_HZ=133333333 236CONFIG_MAX_SCLK_HZ=133333333
@@ -252,13 +244,17 @@ CONFIG_HZ_250=y
252# CONFIG_HZ_300 is not set 244# CONFIG_HZ_300 is not set
253# CONFIG_HZ_1000 is not set 245# CONFIG_HZ_1000 is not set
254CONFIG_HZ=250 246CONFIG_HZ=250
247CONFIG_GENERIC_TIME=y
248CONFIG_GENERIC_CLOCKEVENTS=y
249# CONFIG_CYCLES_CLOCKSOURCE is not set
250CONFIG_TICK_ONESHOT=y
251# CONFIG_NO_HZ is not set
252CONFIG_HIGH_RES_TIMERS=y
253CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
255 254
256# 255#
257# Memory Setup 256# Misc
258# 257#
259CONFIG_MAX_MEM_SIZE=512
260CONFIG_MEM_ADD_WIDTH=9
261CONFIG_BOOT_LOAD=0x1000
262CONFIG_BFIN_SCRATCH_REG_RETN=y 258CONFIG_BFIN_SCRATCH_REG_RETN=y
263# CONFIG_BFIN_SCRATCH_REG_RETE is not set 259# CONFIG_BFIN_SCRATCH_REG_RETE is not set
264# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 260# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
@@ -294,12 +290,14 @@ CONFIG_FLATMEM_MANUAL=y
294CONFIG_FLATMEM=y 290CONFIG_FLATMEM=y
295CONFIG_FLAT_NODE_MEM_MAP=y 291CONFIG_FLAT_NODE_MEM_MAP=y
296# CONFIG_SPARSEMEM_STATIC is not set 292# CONFIG_SPARSEMEM_STATIC is not set
293# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
297CONFIG_SPLIT_PTLOCK_CPUS=4 294CONFIG_SPLIT_PTLOCK_CPUS=4
298# CONFIG_RESOURCES_64BIT is not set 295# CONFIG_RESOURCES_64BIT is not set
299CONFIG_ZONE_DMA_FLAG=1 296CONFIG_ZONE_DMA_FLAG=1
300CONFIG_LARGE_ALLOCS=y 297CONFIG_VIRT_TO_BUS=y
301# CONFIG_BFIN_GPTIMERS is not set 298# CONFIG_BFIN_GPTIMERS is not set
302CONFIG_BFIN_DMA_5XX=y 299CONFIG_BFIN_DMA_5XX=y
300# CONFIG_DMA_UNCACHED_4M is not set
303# CONFIG_DMA_UNCACHED_2M is not set 301# CONFIG_DMA_UNCACHED_2M is not set
304CONFIG_DMA_UNCACHED_1M=y 302CONFIG_DMA_UNCACHED_1M=y
305# CONFIG_DMA_UNCACHED_NONE is not set 303# CONFIG_DMA_UNCACHED_NONE is not set
@@ -341,17 +339,13 @@ CONFIG_C_AMBEN_ALL=y
341CONFIG_BANK_0=0x7BB0 339CONFIG_BANK_0=0x7BB0
342CONFIG_BANK_1=0x7BB0 340CONFIG_BANK_1=0x7BB0
343CONFIG_BANK_2=0x7BB0 341CONFIG_BANK_2=0x7BB0
344CONFIG_BANK_3=0xAAC3 342CONFIG_BANK_3=0xAAC2
345 343
346# 344#
347# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 345# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
348# 346#
349# CONFIG_PCI is not set 347# CONFIG_PCI is not set
350# CONFIG_ARCH_SUPPORTS_MSI is not set 348# CONFIG_ARCH_SUPPORTS_MSI is not set
351
352#
353# PCCARD (PCMCIA/CardBus) support
354#
355# CONFIG_PCCARD is not set 349# CONFIG_PCCARD is not set
356 350
357# 351#
@@ -367,9 +361,15 @@ CONFIG_BINFMT_ZFLAT=y
367# Power management options 361# Power management options
368# 362#
369# CONFIG_PM is not set 363# CONFIG_PM is not set
364CONFIG_SUSPEND_UP_POSSIBLE=y
370# CONFIG_PM_WAKEUP_BY_GPIO is not set 365# CONFIG_PM_WAKEUP_BY_GPIO is not set
371 366
372# 367#
368# CPU Frequency scaling
369#
370# CONFIG_CPU_FREQ is not set
371
372#
373# Networking 373# Networking
374# 374#
375CONFIG_NET=y 375CONFIG_NET=y
@@ -405,6 +405,7 @@ CONFIG_SYN_COOKIES=y
405CONFIG_INET_XFRM_MODE_TRANSPORT=y 405CONFIG_INET_XFRM_MODE_TRANSPORT=y
406CONFIG_INET_XFRM_MODE_TUNNEL=y 406CONFIG_INET_XFRM_MODE_TUNNEL=y
407CONFIG_INET_XFRM_MODE_BEET=y 407CONFIG_INET_XFRM_MODE_BEET=y
408# CONFIG_INET_LRO is not set
408CONFIG_INET_DIAG=y 409CONFIG_INET_DIAG=y
409CONFIG_INET_TCP_DIAG=y 410CONFIG_INET_TCP_DIAG=y
410# CONFIG_TCP_CONG_ADVANCED is not set 411# CONFIG_TCP_CONG_ADVANCED is not set
@@ -431,10 +432,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
431# CONFIG_LAPB is not set 432# CONFIG_LAPB is not set
432# CONFIG_ECONET is not set 433# CONFIG_ECONET is not set
433# CONFIG_WAN_ROUTER is not set 434# CONFIG_WAN_ROUTER is not set
434
435#
436# QoS and/or fair queueing
437#
438# CONFIG_NET_SCHED is not set 435# CONFIG_NET_SCHED is not set
439 436
440# 437#
@@ -466,6 +463,7 @@ CONFIG_IRDA_CACHE_LAST_LSAP=y
466# SIR device drivers 463# SIR device drivers
467# 464#
468CONFIG_IRTTY_SIR=m 465CONFIG_IRTTY_SIR=m
466# CONFIG_BFIN_SIR is not set
469 467
470# 468#
471# Dongle support 469# Dongle support
@@ -495,6 +493,7 @@ CONFIG_IRTTY_SIR=m
495# CONFIG_MAC80211 is not set 493# CONFIG_MAC80211 is not set
496# CONFIG_IEEE80211 is not set 494# CONFIG_IEEE80211 is not set
497# CONFIG_RFKILL is not set 495# CONFIG_RFKILL is not set
496# CONFIG_NET_9P is not set
498 497
499# 498#
500# Device Drivers 499# Device Drivers
@@ -503,14 +502,11 @@ CONFIG_IRTTY_SIR=m
503# 502#
504# Generic Driver Options 503# Generic Driver Options
505# 504#
505CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
506CONFIG_STANDALONE=y 506CONFIG_STANDALONE=y
507CONFIG_PREVENT_FIRMWARE_BUILD=y 507CONFIG_PREVENT_FIRMWARE_BUILD=y
508# CONFIG_FW_LOADER is not set 508# CONFIG_FW_LOADER is not set
509# CONFIG_SYS_HYPERVISOR is not set 509# CONFIG_SYS_HYPERVISOR is not set
510
511#
512# Connector - unified userspace <-> kernelspace linker
513#
514# CONFIG_CONNECTOR is not set 510# CONFIG_CONNECTOR is not set
515CONFIG_MTD=y 511CONFIG_MTD=y
516# CONFIG_MTD_DEBUG is not set 512# CONFIG_MTD_DEBUG is not set
@@ -530,6 +526,7 @@ CONFIG_MTD_BLOCK=y
530# CONFIG_INFTL is not set 526# CONFIG_INFTL is not set
531# CONFIG_RFD_FTL is not set 527# CONFIG_RFD_FTL is not set
532# CONFIG_SSFDC is not set 528# CONFIG_SSFDC is not set
529# CONFIG_MTD_OOPS is not set
533 530
534# 531#
535# RAM/ROM/Flash chip drivers 532# RAM/ROM/Flash chip drivers
@@ -590,20 +587,8 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
590# UBI - Unsorted block images 587# UBI - Unsorted block images
591# 588#
592# CONFIG_MTD_UBI is not set 589# CONFIG_MTD_UBI is not set
593
594#
595# Parallel port support
596#
597# CONFIG_PARPORT is not set 590# CONFIG_PARPORT is not set
598 591CONFIG_BLK_DEV=y
599#
600# Plug and Play support
601#
602# CONFIG_PNPACPI is not set
603
604#
605# Block devices
606#
607# CONFIG_BLK_DEV_COW_COMMON is not set 592# CONFIG_BLK_DEV_COW_COMMON is not set
608# CONFIG_BLK_DEV_LOOP is not set 593# CONFIG_BLK_DEV_LOOP is not set
609# CONFIG_BLK_DEV_NBD is not set 594# CONFIG_BLK_DEV_NBD is not set
@@ -613,10 +598,8 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
613CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024 598CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
614# CONFIG_CDROM_PKTCDVD is not set 599# CONFIG_CDROM_PKTCDVD is not set
615# CONFIG_ATA_OVER_ETH is not set 600# CONFIG_ATA_OVER_ETH is not set
616 601CONFIG_MISC_DEVICES=y
617# 602# CONFIG_EEPROM_93CX6 is not set
618# Misc devices
619#
620# CONFIG_IDE is not set 603# CONFIG_IDE is not set
621 604
622# 605#
@@ -624,32 +607,29 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
624# 607#
625# CONFIG_RAID_ATTRS is not set 608# CONFIG_RAID_ATTRS is not set
626# CONFIG_SCSI is not set 609# CONFIG_SCSI is not set
610# CONFIG_SCSI_DMA is not set
627# CONFIG_SCSI_NETLINK is not set 611# CONFIG_SCSI_NETLINK is not set
628# CONFIG_ATA is not set 612# CONFIG_ATA is not set
629
630#
631# Multi-device support (RAID and LVM)
632#
633# CONFIG_MD is not set 613# CONFIG_MD is not set
634
635#
636# Network device support
637#
638CONFIG_NETDEVICES=y 614CONFIG_NETDEVICES=y
615# CONFIG_NETDEVICES_MULTIQUEUE is not set
639# CONFIG_DUMMY is not set 616# CONFIG_DUMMY is not set
640# CONFIG_BONDING is not set 617# CONFIG_BONDING is not set
618# CONFIG_MACVLAN is not set
641# CONFIG_EQUALIZER is not set 619# CONFIG_EQUALIZER is not set
642# CONFIG_TUN is not set 620# CONFIG_TUN is not set
621# CONFIG_VETH is not set
643# CONFIG_PHYLIB is not set 622# CONFIG_PHYLIB is not set
644
645#
646# Ethernet (10 or 100Mbit)
647#
648CONFIG_NET_ETHERNET=y 623CONFIG_NET_ETHERNET=y
649CONFIG_MII=y 624CONFIG_MII=y
650CONFIG_SMC91X=y 625CONFIG_SMC91X=y
651# CONFIG_SMSC911X is not set 626# CONFIG_SMSC911X is not set
652# CONFIG_DM9000 is not set 627# CONFIG_DM9000 is not set
628# CONFIG_IBM_NEW_EMAC_ZMII is not set
629# CONFIG_IBM_NEW_EMAC_RGMII is not set
630# CONFIG_IBM_NEW_EMAC_TAH is not set
631# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
632# CONFIG_B44 is not set
653CONFIG_NETDEV_1000=y 633CONFIG_NETDEV_1000=y
654# CONFIG_AX88180 is not set 634# CONFIG_AX88180 is not set
655CONFIG_NETDEV_10000=y 635CONFIG_NETDEV_10000=y
@@ -666,15 +646,7 @@ CONFIG_NETDEV_10000=y
666# CONFIG_NETCONSOLE is not set 646# CONFIG_NETCONSOLE is not set
667# CONFIG_NETPOLL is not set 647# CONFIG_NETPOLL is not set
668# CONFIG_NET_POLL_CONTROLLER is not set 648# CONFIG_NET_POLL_CONTROLLER is not set
669
670#
671# ISDN subsystem
672#
673# CONFIG_ISDN is not set 649# CONFIG_ISDN is not set
674
675#
676# Telephony Support
677#
678# CONFIG_PHONE is not set 650# CONFIG_PHONE is not set
679 651
680# 652#
@@ -689,7 +661,6 @@ CONFIG_INPUT=m
689# 661#
690# CONFIG_INPUT_MOUSEDEV is not set 662# CONFIG_INPUT_MOUSEDEV is not set
691# CONFIG_INPUT_JOYDEV is not set 663# CONFIG_INPUT_JOYDEV is not set
692# CONFIG_INPUT_TSDEV is not set
693CONFIG_INPUT_EVDEV=m 664CONFIG_INPUT_EVDEV=m
694# CONFIG_INPUT_EVBUG is not set 665# CONFIG_INPUT_EVBUG is not set
695 666
@@ -714,13 +685,12 @@ CONFIG_INPUT_EVDEV=m
714# 685#
715# CONFIG_AD9960 is not set 686# CONFIG_AD9960 is not set
716# CONFIG_SPI_ADC_BF533 is not set 687# CONFIG_SPI_ADC_BF533 is not set
717# CONFIG_BF5xx_PFLAGS is not set
718# CONFIG_BF5xx_PPIFCD is not set 688# CONFIG_BF5xx_PPIFCD is not set
719# CONFIG_BFIN_SIMPLE_TIMER is not set 689# CONFIG_BFIN_SIMPLE_TIMER is not set
720# CONFIG_BF5xx_PPI is not set 690# CONFIG_BF5xx_PPI is not set
721# CONFIG_BFIN_SPORT is not set 691# CONFIG_BFIN_SPORT is not set
722# CONFIG_BFIN_TIMER_LATENCY is not set 692# CONFIG_BFIN_TIMER_LATENCY is not set
723# CONFIG_AD5304 is not set 693CONFIG_SIMPLE_GPIO=m
724# CONFIG_VT is not set 694# CONFIG_VT is not set
725# CONFIG_SERIAL_NONSTANDARD is not set 695# CONFIG_SERIAL_NONSTANDARD is not set
726 696
@@ -748,27 +718,11 @@ CONFIG_UNIX98_PTYS=y
748# CAN, the car bus and industrial fieldbus 718# CAN, the car bus and industrial fieldbus
749# 719#
750# CONFIG_CAN4LINUX is not set 720# CONFIG_CAN4LINUX is not set
751
752#
753# IPMI
754#
755# CONFIG_IPMI_HANDLER is not set 721# CONFIG_IPMI_HANDLER is not set
756CONFIG_WATCHDOG=y
757# CONFIG_WATCHDOG_NOWAYOUT is not set
758
759#
760# Watchdog Device Drivers
761#
762# CONFIG_SOFT_WATCHDOG is not set
763CONFIG_BFIN_WDT=y
764CONFIG_HW_RANDOM=y 722CONFIG_HW_RANDOM=y
765# CONFIG_GEN_RTC is not set 723# CONFIG_GEN_RTC is not set
766# CONFIG_R3964 is not set 724# CONFIG_R3964 is not set
767# CONFIG_RAW_DRIVER is not set 725# CONFIG_RAW_DRIVER is not set
768
769#
770# TPM devices
771#
772# CONFIG_TCG_TPM is not set 726# CONFIG_TCG_TPM is not set
773# CONFIG_I2C is not set 727# CONFIG_I2C is not set
774 728
@@ -789,22 +743,37 @@ CONFIG_SPI_BFIN=y
789# 743#
790# CONFIG_SPI_AT25 is not set 744# CONFIG_SPI_AT25 is not set
791# CONFIG_SPI_SPIDEV is not set 745# CONFIG_SPI_SPIDEV is not set
792 746# CONFIG_SPI_TLE62X0 is not set
793#
794# Dallas's 1-wire bus
795#
796# CONFIG_W1 is not set 747# CONFIG_W1 is not set
748# CONFIG_POWER_SUPPLY is not set
797CONFIG_HWMON=y 749CONFIG_HWMON=y
798# CONFIG_HWMON_VID is not set 750# CONFIG_HWMON_VID is not set
799# CONFIG_SENSORS_ABITUGURU is not set
800# CONFIG_SENSORS_F71805F is not set 751# CONFIG_SENSORS_F71805F is not set
752# CONFIG_SENSORS_F71882FG is not set
753# CONFIG_SENSORS_IT87 is not set
801# CONFIG_SENSORS_LM70 is not set 754# CONFIG_SENSORS_LM70 is not set
755# CONFIG_SENSORS_PC87360 is not set
802# CONFIG_SENSORS_PC87427 is not set 756# CONFIG_SENSORS_PC87427 is not set
803# CONFIG_SENSORS_SMSC47M1 is not set 757# CONFIG_SENSORS_SMSC47M1 is not set
804# CONFIG_SENSORS_SMSC47B397 is not set 758# CONFIG_SENSORS_SMSC47B397 is not set
805# CONFIG_SENSORS_VT1211 is not set 759# CONFIG_SENSORS_VT1211 is not set
806# CONFIG_SENSORS_W83627HF is not set 760# CONFIG_SENSORS_W83627HF is not set
761# CONFIG_SENSORS_W83627EHF is not set
807# CONFIG_HWMON_DEBUG_CHIP is not set 762# CONFIG_HWMON_DEBUG_CHIP is not set
763CONFIG_WATCHDOG=y
764# CONFIG_WATCHDOG_NOWAYOUT is not set
765
766#
767# Watchdog Device Drivers
768#
769# CONFIG_SOFT_WATCHDOG is not set
770CONFIG_BFIN_WDT=y
771
772#
773# Sonics Silicon Backplane
774#
775CONFIG_SSB_POSSIBLE=y
776# CONFIG_SSB is not set
808 777
809# 778#
810# Multifunction device drivers 779# Multifunction device drivers
@@ -821,91 +790,33 @@ CONFIG_DAB=y
821# 790#
822# Graphics support 791# Graphics support
823# 792#
793# CONFIG_VGASTATE is not set
794# CONFIG_VIDEO_OUTPUT_CONTROL is not set
795# CONFIG_FB is not set
824# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 796# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
825 797
826# 798#
827# Display device support 799# Display device support
828# 800#
829# CONFIG_DISPLAY_SUPPORT is not set 801# CONFIG_DISPLAY_SUPPORT is not set
830# CONFIG_VGASTATE is not set
831# CONFIG_FB is not set
832 802
833# 803#
834# Sound 804# Sound
835# 805#
836# CONFIG_SOUND is not set 806# CONFIG_SOUND is not set
837 807CONFIG_HID_SUPPORT=y
838#
839# HID Devices
840#
841CONFIG_HID=m 808CONFIG_HID=m
842# CONFIG_HID_DEBUG is not set 809# CONFIG_HID_DEBUG is not set
843 810# CONFIG_HIDRAW is not set
844# 811# CONFIG_USB_SUPPORT is not set
845# USB support
846#
847CONFIG_USB_ARCH_HAS_HCD=y
848# CONFIG_USB_ARCH_HAS_OHCI is not set
849# CONFIG_USB_ARCH_HAS_EHCI is not set
850# CONFIG_USB is not set
851
852#
853# Enable Host or Gadget support to see Inventra options
854#
855
856#
857# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
858#
859
860#
861# USB Gadget Support
862#
863# CONFIG_USB_GADGET is not set
864# CONFIG_MMC is not set 812# CONFIG_MMC is not set
865
866#
867# LED devices
868#
869# CONFIG_NEW_LEDS is not set 813# CONFIG_NEW_LEDS is not set
870
871#
872# LED drivers
873#
874
875#
876# LED Triggers
877#
878
879#
880# InfiniBand support
881#
882
883#
884# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
885#
886
887#
888# Real Time Clock
889#
890# CONFIG_RTC_CLASS is not set 814# CONFIG_RTC_CLASS is not set
891 815
892# 816#
893# DMA Engine support 817# Userspace I/O
894#
895# CONFIG_DMA_ENGINE is not set
896
897#
898# DMA Clients
899#
900
901#
902# DMA Devices
903# 818#
904 819# CONFIG_UIO is not set
905#
906# PBX support
907#
908# CONFIG_PBX is not set
909 820
910# 821#
911# File systems 822# File systems
@@ -950,7 +861,6 @@ CONFIG_PROC_SYSCTL=y
950CONFIG_SYSFS=y 861CONFIG_SYSFS=y
951# CONFIG_TMPFS is not set 862# CONFIG_TMPFS is not set
952# CONFIG_HUGETLB_PAGE is not set 863# CONFIG_HUGETLB_PAGE is not set
953CONFIG_RAMFS=y
954# CONFIG_CONFIGFS_FS is not set 864# CONFIG_CONFIGFS_FS is not set
955 865
956# 866#
@@ -976,10 +886,12 @@ CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
976CONFIG_JFFS2_FS=m 886CONFIG_JFFS2_FS=m
977CONFIG_JFFS2_FS_DEBUG=0 887CONFIG_JFFS2_FS_DEBUG=0
978CONFIG_JFFS2_FS_WRITEBUFFER=y 888CONFIG_JFFS2_FS_WRITEBUFFER=y
889# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
979# CONFIG_JFFS2_SUMMARY is not set 890# CONFIG_JFFS2_SUMMARY is not set
980# CONFIG_JFFS2_FS_XATTR is not set 891# CONFIG_JFFS2_FS_XATTR is not set
981# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 892# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
982CONFIG_JFFS2_ZLIB=y 893CONFIG_JFFS2_ZLIB=y
894# CONFIG_JFFS2_LZO is not set
983CONFIG_JFFS2_RTIME=y 895CONFIG_JFFS2_RTIME=y
984# CONFIG_JFFS2_RUBIN is not set 896# CONFIG_JFFS2_RUBIN is not set
985# CONFIG_CRAMFS is not set 897# CONFIG_CRAMFS is not set
@@ -988,10 +900,7 @@ CONFIG_JFFS2_RTIME=y
988# CONFIG_QNX4FS_FS is not set 900# CONFIG_QNX4FS_FS is not set
989# CONFIG_SYSV_FS is not set 901# CONFIG_SYSV_FS is not set
990# CONFIG_UFS_FS is not set 902# CONFIG_UFS_FS is not set
991 903CONFIG_NETWORK_FILESYSTEMS=y
992#
993# Network File Systems
994#
995CONFIG_NFS_FS=m 904CONFIG_NFS_FS=m
996CONFIG_NFS_V3=y 905CONFIG_NFS_V3=y
997# CONFIG_NFS_V3_ACL is not set 906# CONFIG_NFS_V3_ACL is not set
@@ -1011,17 +920,12 @@ CONFIG_SMB_FS=m
1011# CONFIG_NCP_FS is not set 920# CONFIG_NCP_FS is not set
1012# CONFIG_CODA_FS is not set 921# CONFIG_CODA_FS is not set
1013# CONFIG_AFS_FS is not set 922# CONFIG_AFS_FS is not set
1014# CONFIG_9P_FS is not set
1015 923
1016# 924#
1017# Partition Types 925# Partition Types
1018# 926#
1019# CONFIG_PARTITION_ADVANCED is not set 927# CONFIG_PARTITION_ADVANCED is not set
1020CONFIG_MSDOS_PARTITION=y 928CONFIG_MSDOS_PARTITION=y
1021
1022#
1023# Native Language Support
1024#
1025CONFIG_NLS=m 929CONFIG_NLS=m
1026CONFIG_NLS_DEFAULT="iso8859-1" 930CONFIG_NLS_DEFAULT="iso8859-1"
1027# CONFIG_NLS_CODEPAGE_437 is not set 931# CONFIG_NLS_CODEPAGE_437 is not set
@@ -1062,21 +966,16 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1062# CONFIG_NLS_KOI8_R is not set 966# CONFIG_NLS_KOI8_R is not set
1063# CONFIG_NLS_KOI8_U is not set 967# CONFIG_NLS_KOI8_U is not set
1064# CONFIG_NLS_UTF8 is not set 968# CONFIG_NLS_UTF8 is not set
1065
1066#
1067# Distributed Lock Manager
1068#
1069# CONFIG_DLM is not set 969# CONFIG_DLM is not set
1070 970CONFIG_INSTRUMENTATION=y
1071#
1072# Profiling support
1073#
1074# CONFIG_PROFILING is not set 971# CONFIG_PROFILING is not set
972# CONFIG_MARKERS is not set
1075 973
1076# 974#
1077# Kernel hacking 975# Kernel hacking
1078# 976#
1079# CONFIG_PRINTK_TIME is not set 977# CONFIG_PRINTK_TIME is not set
978CONFIG_ENABLE_WARN_DEPRECATED=y
1080CONFIG_ENABLE_MUST_CHECK=y 979CONFIG_ENABLE_MUST_CHECK=y
1081# CONFIG_MAGIC_SYSRQ is not set 980# CONFIG_MAGIC_SYSRQ is not set
1082# CONFIG_UNUSED_SYMBOLS is not set 981# CONFIG_UNUSED_SYMBOLS is not set
@@ -1084,6 +983,7 @@ CONFIG_DEBUG_FS=y
1084# CONFIG_HEADERS_CHECK is not set 983# CONFIG_HEADERS_CHECK is not set
1085# CONFIG_DEBUG_KERNEL is not set 984# CONFIG_DEBUG_KERNEL is not set
1086# CONFIG_DEBUG_BUGVERBOSE is not set 985# CONFIG_DEBUG_BUGVERBOSE is not set
986# CONFIG_SAMPLES is not set
1087CONFIG_DEBUG_MMRS=y 987CONFIG_DEBUG_MMRS=y
1088CONFIG_DEBUG_HUNT_FOR_ZERO=y 988CONFIG_DEBUG_HUNT_FOR_ZERO=y
1089CONFIG_DEBUG_BFIN_HWTRACE_ON=y 989CONFIG_DEBUG_BFIN_HWTRACE_ON=y
@@ -1104,11 +1004,7 @@ CONFIG_ACCESS_CHECK=y
1104# CONFIG_KEYS is not set 1004# CONFIG_KEYS is not set
1105CONFIG_SECURITY=y 1005CONFIG_SECURITY=y
1106# CONFIG_SECURITY_NETWORK is not set 1006# CONFIG_SECURITY_NETWORK is not set
1107CONFIG_SECURITY_CAPABILITIES=m 1007# CONFIG_SECURITY_CAPABILITIES is not set
1108
1109#
1110# Cryptographic options
1111#
1112# CONFIG_CRYPTO is not set 1008# CONFIG_CRYPTO is not set
1113 1009
1114# 1010#
@@ -1119,6 +1015,7 @@ CONFIG_CRC_CCITT=m
1119# CONFIG_CRC16 is not set 1015# CONFIG_CRC16 is not set
1120# CONFIG_CRC_ITU_T is not set 1016# CONFIG_CRC_ITU_T is not set
1121CONFIG_CRC32=y 1017CONFIG_CRC32=y
1018# CONFIG_CRC7 is not set
1122# CONFIG_LIBCRC32C is not set 1019# CONFIG_LIBCRC32C is not set
1123CONFIG_ZLIB_INFLATE=y 1020CONFIG_ZLIB_INFLATE=y
1124CONFIG_ZLIB_DEFLATE=m 1021CONFIG_ZLIB_DEFLATE=m
diff --git a/arch/blackfin/configs/CM-BF527_defconfig b/arch/blackfin/configs/CM-BF527_defconfig
new file mode 100644
index 000000000000..0799aa9bba9d
--- /dev/null
+++ b/arch/blackfin/configs/CM-BF527_defconfig
@@ -0,0 +1,1185 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24.7
4# Fri Jul 18 18:00:41 2008
5#
6# CONFIG_MMU is not set
7# CONFIG_FPU is not set
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_BLACKFIN=y
11CONFIG_ZONE_DMA=y
12CONFIG_SEMAPHORE_SLEEPERS=y
13CONFIG_GENERIC_FIND_NEXT_BIT=y
14CONFIG_GENERIC_HWEIGHT=y
15CONFIG_GENERIC_HARDIRQS=y
16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_GENERIC_GPIO=y
18CONFIG_FORCE_MAX_ZONEORDER=14
19CONFIG_GENERIC_CALIBRATE_DELAY=y
20CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
21
22#
23# General setup
24#
25CONFIG_EXPERIMENTAL=y
26CONFIG_BROKEN_ON_SMP=y
27CONFIG_INIT_ENV_ARG_LIMIT=32
28CONFIG_LOCALVERSION=""
29CONFIG_LOCALVERSION_AUTO=y
30CONFIG_SYSVIPC=y
31CONFIG_SYSVIPC_SYSCTL=y
32# CONFIG_POSIX_MQUEUE is not set
33# CONFIG_BSD_PROCESS_ACCT is not set
34# CONFIG_TASKSTATS is not set
35# CONFIG_USER_NS is not set
36# CONFIG_PID_NS is not set
37# CONFIG_AUDIT is not set
38CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y
40CONFIG_LOG_BUF_SHIFT=14
41# CONFIG_CGROUPS is not set
42CONFIG_FAIR_GROUP_SCHED=y
43CONFIG_FAIR_USER_SCHED=y
44# CONFIG_FAIR_CGROUP_SCHED is not set
45CONFIG_SYSFS_DEPRECATED=y
46# CONFIG_RELAY is not set
47CONFIG_BLK_DEV_INITRD=y
48CONFIG_INITRAMFS_SOURCE=""
49# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
50CONFIG_SYSCTL=y
51CONFIG_EMBEDDED=y
52CONFIG_UID16=y
53CONFIG_SYSCTL_SYSCALL=y
54CONFIG_KALLSYMS=y
55# CONFIG_KALLSYMS_EXTRA_PASS is not set
56CONFIG_HOTPLUG=y
57CONFIG_PRINTK=y
58CONFIG_BUG=y
59CONFIG_ELF_CORE=y
60CONFIG_BASE_FULL=y
61CONFIG_FUTEX=y
62CONFIG_ANON_INODES=y
63CONFIG_EPOLL=y
64CONFIG_SIGNALFD=y
65CONFIG_EVENTFD=y
66CONFIG_VM_EVENT_COUNTERS=y
67CONFIG_SLAB=y
68# CONFIG_SLUB is not set
69# CONFIG_SLOB is not set
70CONFIG_SLABINFO=y
71CONFIG_RT_MUTEXES=y
72CONFIG_TINY_SHMEM=y
73CONFIG_BASE_SMALL=0
74CONFIG_MODULES=y
75CONFIG_MODULE_UNLOAD=y
76# CONFIG_MODULE_FORCE_UNLOAD is not set
77# CONFIG_MODVERSIONS is not set
78# CONFIG_MODULE_SRCVERSION_ALL is not set
79CONFIG_KMOD=y
80CONFIG_BLOCK=y
81# CONFIG_LBD is not set
82# CONFIG_BLK_DEV_IO_TRACE is not set
83# CONFIG_LSF is not set
84# CONFIG_BLK_DEV_BSG is not set
85
86#
87# IO Schedulers
88#
89CONFIG_IOSCHED_NOOP=y
90# CONFIG_IOSCHED_AS is not set
91# CONFIG_IOSCHED_DEADLINE is not set
92CONFIG_IOSCHED_CFQ=y
93# CONFIG_DEFAULT_AS is not set
94# CONFIG_DEFAULT_DEADLINE is not set
95CONFIG_DEFAULT_CFQ=y
96# CONFIG_DEFAULT_NOOP is not set
97CONFIG_DEFAULT_IOSCHED="cfq"
98# CONFIG_PREEMPT_NONE is not set
99CONFIG_PREEMPT_VOLUNTARY=y
100# CONFIG_PREEMPT is not set
101
102#
103# Blackfin Processor Options
104#
105
106#
107# Processor and Board Settings
108#
109# CONFIG_BF522 is not set
110# CONFIG_BF523 is not set
111# CONFIG_BF524 is not set
112# CONFIG_BF525 is not set
113# CONFIG_BF526 is not set
114CONFIG_BF527=y
115# CONFIG_BF531 is not set
116# CONFIG_BF532 is not set
117# CONFIG_BF533 is not set
118# CONFIG_BF534 is not set
119# CONFIG_BF536 is not set
120# CONFIG_BF537 is not set
121# CONFIG_BF542 is not set
122# CONFIG_BF544 is not set
123# CONFIG_BF547 is not set
124# CONFIG_BF548 is not set
125# CONFIG_BF549 is not set
126# CONFIG_BF561 is not set
127# CONFIG_BF_REV_0_0 is not set
128CONFIG_BF_REV_0_1=y
129# CONFIG_BF_REV_0_2 is not set
130# CONFIG_BF_REV_0_3 is not set
131# CONFIG_BF_REV_0_4 is not set
132# CONFIG_BF_REV_0_5 is not set
133# CONFIG_BF_REV_ANY is not set
134# CONFIG_BF_REV_NONE is not set
135CONFIG_BF52x=y
136CONFIG_MEM_MT48LC16M16A2TG_75=y
137# CONFIG_BFIN527_EZKIT is not set
138CONFIG_BFIN527_BLUETECHNIX_CM=y
139
140#
141# BF527 Specific Configuration
142#
143
144#
145# Alternative Multiplexing Scheme
146#
147# CONFIG_BF527_SPORT0_PORTF is not set
148CONFIG_BF527_SPORT0_PORTG=y
149CONFIG_BF527_SPORT0_TSCLK_PG10=y
150# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
151CONFIG_BF527_UART1_PORTF=y
152# CONFIG_BF527_UART1_PORTG is not set
153# CONFIG_BF527_NAND_D_PORTF is not set
154CONFIG_BF527_NAND_D_PORTH=y
155
156#
157# Interrupt Priority Assignment
158#
159
160#
161# Priority
162#
163CONFIG_IRQ_PLL_WAKEUP=7
164CONFIG_IRQ_DMA0_ERROR=7
165CONFIG_IRQ_DMAR0_BLK=7
166CONFIG_IRQ_DMAR1_BLK=7
167CONFIG_IRQ_DMAR0_OVR=7
168CONFIG_IRQ_DMAR1_OVR=7
169CONFIG_IRQ_PPI_ERROR=7
170CONFIG_IRQ_MAC_ERROR=7
171CONFIG_IRQ_SPORT0_ERROR=7
172CONFIG_IRQ_SPORT1_ERROR=7
173CONFIG_IRQ_UART0_ERROR=7
174CONFIG_IRQ_UART1_ERROR=7
175CONFIG_IRQ_RTC=8
176CONFIG_IRQ_PPI=8
177CONFIG_IRQ_SPORT0_RX=9
178CONFIG_IRQ_SPORT0_TX=9
179CONFIG_IRQ_SPORT1_RX=9
180CONFIG_IRQ_SPORT1_TX=9
181CONFIG_IRQ_TWI=10
182CONFIG_IRQ_SPI=10
183CONFIG_IRQ_UART0_RX=10
184CONFIG_IRQ_UART0_TX=10
185CONFIG_IRQ_UART1_RX=10
186CONFIG_IRQ_UART1_TX=10
187CONFIG_IRQ_OPTSEC=11
188CONFIG_IRQ_CNT=11
189CONFIG_IRQ_MAC_RX=11
190CONFIG_IRQ_PORTH_INTA=11
191CONFIG_IRQ_MAC_TX=11
192CONFIG_IRQ_PORTH_INTB=11
193CONFIG_IRQ_TMR0=12
194CONFIG_IRQ_TMR1=12
195CONFIG_IRQ_TMR2=12
196CONFIG_IRQ_TMR3=12
197CONFIG_IRQ_TMR4=12
198CONFIG_IRQ_TMR5=12
199CONFIG_IRQ_TMR6=12
200CONFIG_IRQ_TMR7=12
201CONFIG_IRQ_PORTG_INTA=12
202CONFIG_IRQ_PORTG_INTB=12
203CONFIG_IRQ_MEM_DMA0=13
204CONFIG_IRQ_MEM_DMA1=13
205CONFIG_IRQ_WATCH=13
206CONFIG_IRQ_PORTF_INTA=13
207CONFIG_IRQ_PORTF_INTB=13
208CONFIG_IRQ_SPI_ERROR=7
209CONFIG_IRQ_NFC_ERROR=7
210CONFIG_IRQ_HDMA_ERROR=7
211CONFIG_IRQ_HDMA=7
212CONFIG_IRQ_USB_EINT=10
213CONFIG_IRQ_USB_INT0=11
214CONFIG_IRQ_USB_INT1=11
215CONFIG_IRQ_USB_INT2=11
216CONFIG_IRQ_USB_DMA=11
217
218#
219# Board customizations
220#
221# CONFIG_CMDLINE_BOOL is not set
222CONFIG_BOOT_LOAD=0x1000
223
224#
225# Clock/PLL Setup
226#
227CONFIG_CLKIN_HZ=25000000
228# CONFIG_BFIN_KERNEL_CLOCK is not set
229CONFIG_MAX_MEM_SIZE=512
230CONFIG_MAX_VCO_HZ=600000000
231CONFIG_MIN_VCO_HZ=50000000
232CONFIG_MAX_SCLK_HZ=133333333
233CONFIG_MIN_SCLK_HZ=27000000
234
235#
236# Kernel Timer/Scheduler
237#
238# CONFIG_HZ_100 is not set
239CONFIG_HZ_250=y
240# CONFIG_HZ_300 is not set
241# CONFIG_HZ_1000 is not set
242CONFIG_HZ=250
243CONFIG_GENERIC_TIME=y
244CONFIG_GENERIC_CLOCKEVENTS=y
245# CONFIG_CYCLES_CLOCKSOURCE is not set
246# CONFIG_TICK_ONESHOT is not set
247# CONFIG_NO_HZ is not set
248# CONFIG_HIGH_RES_TIMERS is not set
249CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
250
251#
252# Misc
253#
254CONFIG_BFIN_SCRATCH_REG_RETN=y
255# CONFIG_BFIN_SCRATCH_REG_RETE is not set
256# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
257
258#
259# Blackfin Kernel Optimizations
260#
261
262#
263# Memory Optimizations
264#
265CONFIG_I_ENTRY_L1=y
266CONFIG_EXCPT_IRQ_SYSC_L1=y
267CONFIG_DO_IRQ_L1=y
268CONFIG_CORE_TIMER_IRQ_L1=y
269CONFIG_IDLE_L1=y
270# CONFIG_SCHEDULE_L1 is not set
271CONFIG_ARITHMETIC_OPS_L1=y
272CONFIG_ACCESS_OK_L1=y
273# CONFIG_MEMSET_L1 is not set
274# CONFIG_MEMCPY_L1 is not set
275# CONFIG_SYS_BFIN_SPINLOCK_L1 is not set
276# CONFIG_IP_CHECKSUM_L1 is not set
277CONFIG_CACHELINE_ALIGNED_L1=y
278# CONFIG_SYSCALL_TAB_L1 is not set
279# CONFIG_CPLB_SWITCH_TAB_L1 is not set
280CONFIG_RAMKERNEL=y
281# CONFIG_ROMKERNEL is not set
282CONFIG_SELECT_MEMORY_MODEL=y
283CONFIG_FLATMEM_MANUAL=y
284# CONFIG_DISCONTIGMEM_MANUAL is not set
285# CONFIG_SPARSEMEM_MANUAL is not set
286CONFIG_FLATMEM=y
287CONFIG_FLAT_NODE_MEM_MAP=y
288# CONFIG_SPARSEMEM_STATIC is not set
289# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
290CONFIG_SPLIT_PTLOCK_CPUS=4
291# CONFIG_RESOURCES_64BIT is not set
292CONFIG_ZONE_DMA_FLAG=1
293CONFIG_VIRT_TO_BUS=y
294CONFIG_BFIN_GPTIMERS=y
295CONFIG_BFIN_DMA_5XX=y
296# CONFIG_DMA_UNCACHED_4M is not set
297# CONFIG_DMA_UNCACHED_2M is not set
298CONFIG_DMA_UNCACHED_1M=y
299# CONFIG_DMA_UNCACHED_NONE is not set
300
301#
302# Cache Support
303#
304CONFIG_BFIN_ICACHE=y
305CONFIG_BFIN_DCACHE=y
306# CONFIG_BFIN_DCACHE_BANKA is not set
307# CONFIG_BFIN_ICACHE_LOCK is not set
308# CONFIG_BFIN_WB is not set
309CONFIG_BFIN_WT=y
310# CONFIG_MPU is not set
311
312#
313# Asynchonous Memory Configuration
314#
315
316#
317# EBIU_AMGCTL Global Control
318#
319CONFIG_C_AMCKEN=y
320CONFIG_C_CDPRIO=y
321# CONFIG_C_AMBEN is not set
322# CONFIG_C_AMBEN_B0 is not set
323# CONFIG_C_AMBEN_B0_B1 is not set
324# CONFIG_C_AMBEN_B0_B1_B2 is not set
325CONFIG_C_AMBEN_ALL=y
326
327#
328# EBIU_AMBCTL Control
329#
330CONFIG_BANK_0=0x7BB0
331CONFIG_BANK_1=0x5554
332CONFIG_BANK_2=0x7BB0
333CONFIG_BANK_3=0xFFC0
334
335#
336# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
337#
338# CONFIG_PCI is not set
339# CONFIG_ARCH_SUPPORTS_MSI is not set
340# CONFIG_PCCARD is not set
341
342#
343# Executable file formats
344#
345CONFIG_BINFMT_ELF_FDPIC=y
346CONFIG_BINFMT_FLAT=y
347CONFIG_BINFMT_ZFLAT=y
348# CONFIG_BINFMT_SHARED_FLAT is not set
349# CONFIG_BINFMT_MISC is not set
350
351#
352# Power management options
353#
354# CONFIG_PM is not set
355CONFIG_SUSPEND_UP_POSSIBLE=y
356# CONFIG_PM_BFIN_SLEEP_DEEPER is not set
357# CONFIG_PM_BFIN_SLEEP is not set
358# CONFIG_PM_WAKEUP_BY_GPIO is not set
359
360#
361# CPU Frequency scaling
362#
363# CONFIG_CPU_FREQ is not set
364
365#
366# Networking
367#
368CONFIG_NET=y
369
370#
371# Networking options
372#
373CONFIG_PACKET=y
374# CONFIG_PACKET_MMAP is not set
375CONFIG_UNIX=y
376CONFIG_XFRM=y
377# CONFIG_XFRM_USER is not set
378# CONFIG_XFRM_SUB_POLICY is not set
379# CONFIG_XFRM_MIGRATE is not set
380# CONFIG_NET_KEY is not set
381CONFIG_INET=y
382# CONFIG_IP_MULTICAST is not set
383# CONFIG_IP_ADVANCED_ROUTER is not set
384CONFIG_IP_FIB_HASH=y
385CONFIG_IP_PNP=y
386# CONFIG_IP_PNP_DHCP is not set
387# CONFIG_IP_PNP_BOOTP is not set
388# CONFIG_IP_PNP_RARP is not set
389# CONFIG_NET_IPIP is not set
390# CONFIG_NET_IPGRE is not set
391# CONFIG_ARPD is not set
392CONFIG_SYN_COOKIES=y
393# CONFIG_INET_AH is not set
394# CONFIG_INET_ESP is not set
395# CONFIG_INET_IPCOMP is not set
396# CONFIG_INET_XFRM_TUNNEL is not set
397# CONFIG_INET_TUNNEL is not set
398CONFIG_INET_XFRM_MODE_TRANSPORT=y
399CONFIG_INET_XFRM_MODE_TUNNEL=y
400CONFIG_INET_XFRM_MODE_BEET=y
401# CONFIG_INET_LRO is not set
402CONFIG_INET_DIAG=y
403CONFIG_INET_TCP_DIAG=y
404# CONFIG_TCP_CONG_ADVANCED is not set
405CONFIG_TCP_CONG_CUBIC=y
406CONFIG_DEFAULT_TCP_CONG="cubic"
407# CONFIG_TCP_MD5SIG is not set
408# CONFIG_IPV6 is not set
409# CONFIG_INET6_XFRM_TUNNEL is not set
410# CONFIG_INET6_TUNNEL is not set
411# CONFIG_NETLABEL is not set
412# CONFIG_NETWORK_SECMARK is not set
413# CONFIG_NETFILTER is not set
414# CONFIG_IP_DCCP is not set
415# CONFIG_IP_SCTP is not set
416# CONFIG_TIPC is not set
417# CONFIG_ATM is not set
418# CONFIG_BRIDGE is not set
419# CONFIG_VLAN_8021Q is not set
420# CONFIG_DECNET is not set
421# CONFIG_LLC2 is not set
422# CONFIG_IPX is not set
423# CONFIG_ATALK is not set
424# CONFIG_X25 is not set
425# CONFIG_LAPB is not set
426# CONFIG_ECONET is not set
427# CONFIG_WAN_ROUTER is not set
428# CONFIG_NET_SCHED is not set
429
430#
431# Network testing
432#
433# CONFIG_NET_PKTGEN is not set
434# CONFIG_HAMRADIO is not set
435# CONFIG_IRDA is not set
436# CONFIG_BT is not set
437# CONFIG_AF_RXRPC is not set
438
439#
440# Wireless
441#
442# CONFIG_CFG80211 is not set
443# CONFIG_WIRELESS_EXT is not set
444# CONFIG_MAC80211 is not set
445# CONFIG_IEEE80211 is not set
446# CONFIG_RFKILL is not set
447# CONFIG_NET_9P is not set
448
449#
450# Device Drivers
451#
452
453#
454# Generic Driver Options
455#
456CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
457CONFIG_STANDALONE=y
458CONFIG_PREVENT_FIRMWARE_BUILD=y
459# CONFIG_FW_LOADER is not set
460# CONFIG_SYS_HYPERVISOR is not set
461# CONFIG_CONNECTOR is not set
462CONFIG_MTD=y
463# CONFIG_MTD_DEBUG is not set
464# CONFIG_MTD_CONCAT is not set
465CONFIG_MTD_PARTITIONS=y
466# CONFIG_MTD_REDBOOT_PARTS is not set
467# CONFIG_MTD_CMDLINE_PARTS is not set
468
469#
470# User Modules And Translation Layers
471#
472CONFIG_MTD_CHAR=m
473CONFIG_MTD_BLKDEVS=y
474CONFIG_MTD_BLOCK=y
475# CONFIG_FTL is not set
476# CONFIG_NFTL is not set
477# CONFIG_INFTL is not set
478# CONFIG_RFD_FTL is not set
479# CONFIG_SSFDC is not set
480# CONFIG_MTD_OOPS is not set
481
482#
483# RAM/ROM/Flash chip drivers
484#
485# CONFIG_MTD_CFI is not set
486CONFIG_MTD_JEDECPROBE=m
487CONFIG_MTD_GEN_PROBE=m
488# CONFIG_MTD_CFI_ADV_OPTIONS is not set
489CONFIG_MTD_MAP_BANK_WIDTH_1=y
490CONFIG_MTD_MAP_BANK_WIDTH_2=y
491CONFIG_MTD_MAP_BANK_WIDTH_4=y
492# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
493# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
494# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
495CONFIG_MTD_CFI_I1=y
496CONFIG_MTD_CFI_I2=y
497# CONFIG_MTD_CFI_I4 is not set
498# CONFIG_MTD_CFI_I8 is not set
499# CONFIG_MTD_CFI_INTELEXT is not set
500# CONFIG_MTD_CFI_AMDSTD is not set
501# CONFIG_MTD_CFI_STAA is not set
502CONFIG_MTD_RAM=y
503CONFIG_MTD_ROM=m
504# CONFIG_MTD_ABSENT is not set
505
506#
507# Mapping drivers for chip access
508#
509CONFIG_MTD_COMPLEX_MAPPINGS=y
510# CONFIG_MTD_PHYSMAP is not set
511# CONFIG_MTD_UCLINUX is not set
512# CONFIG_MTD_PLATRAM is not set
513
514#
515# Self-contained MTD device drivers
516#
517# CONFIG_MTD_DATAFLASH is not set
518# CONFIG_MTD_M25P80 is not set
519# CONFIG_MTD_SLRAM is not set
520# CONFIG_MTD_PHRAM is not set
521# CONFIG_MTD_MTDRAM is not set
522# CONFIG_MTD_BLOCK2MTD is not set
523
524#
525# Disk-On-Chip Device Drivers
526#
527# CONFIG_MTD_DOC2000 is not set
528# CONFIG_MTD_DOC2001 is not set
529# CONFIG_MTD_DOC2001PLUS is not set
530# CONFIG_MTD_NAND is not set
531# CONFIG_MTD_ONENAND is not set
532
533#
534# UBI - Unsorted block images
535#
536# CONFIG_MTD_UBI is not set
537# CONFIG_PARPORT is not set
538CONFIG_BLK_DEV=y
539# CONFIG_BLK_DEV_COW_COMMON is not set
540# CONFIG_BLK_DEV_LOOP is not set
541# CONFIG_BLK_DEV_NBD is not set
542# CONFIG_BLK_DEV_UB is not set
543CONFIG_BLK_DEV_RAM=y
544CONFIG_BLK_DEV_RAM_COUNT=16
545CONFIG_BLK_DEV_RAM_SIZE=4096
546CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
547# CONFIG_CDROM_PKTCDVD is not set
548# CONFIG_ATA_OVER_ETH is not set
549# CONFIG_MISC_DEVICES is not set
550# CONFIG_IDE is not set
551
552#
553# SCSI device support
554#
555# CONFIG_RAID_ATTRS is not set
556# CONFIG_SCSI is not set
557# CONFIG_SCSI_DMA is not set
558# CONFIG_SCSI_NETLINK is not set
559# CONFIG_ATA is not set
560# CONFIG_MD is not set
561CONFIG_NETDEVICES=y
562# CONFIG_NETDEVICES_MULTIQUEUE is not set
563# CONFIG_DUMMY is not set
564# CONFIG_BONDING is not set
565# CONFIG_MACVLAN is not set
566# CONFIG_EQUALIZER is not set
567# CONFIG_TUN is not set
568# CONFIG_VETH is not set
569CONFIG_PHYLIB=y
570
571#
572# MII PHY device drivers
573#
574# CONFIG_MARVELL_PHY is not set
575# CONFIG_DAVICOM_PHY is not set
576# CONFIG_QSEMI_PHY is not set
577# CONFIG_LXT_PHY is not set
578# CONFIG_CICADA_PHY is not set
579# CONFIG_VITESSE_PHY is not set
580# CONFIG_SMSC_PHY is not set
581# CONFIG_BROADCOM_PHY is not set
582# CONFIG_ICPLUS_PHY is not set
583# CONFIG_FIXED_PHY is not set
584# CONFIG_MDIO_BITBANG is not set
585CONFIG_NET_ETHERNET=y
586CONFIG_MII=y
587CONFIG_BFIN_MAC=y
588CONFIG_BFIN_MAC_USE_L1=y
589CONFIG_BFIN_TX_DESC_NUM=10
590CONFIG_BFIN_RX_DESC_NUM=20
591CONFIG_BFIN_MAC_RMII=y
592# CONFIG_SMC91X is not set
593# CONFIG_SMSC911X is not set
594# CONFIG_DM9000 is not set
595# CONFIG_IBM_NEW_EMAC_ZMII is not set
596# CONFIG_IBM_NEW_EMAC_RGMII is not set
597# CONFIG_IBM_NEW_EMAC_TAH is not set
598# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
599# CONFIG_B44 is not set
600# CONFIG_NETDEV_1000 is not set
601# CONFIG_NETDEV_10000 is not set
602
603#
604# Wireless LAN
605#
606# CONFIG_WLAN_PRE80211 is not set
607# CONFIG_WLAN_80211 is not set
608
609#
610# USB Network Adapters
611#
612# CONFIG_USB_CATC is not set
613# CONFIG_USB_KAWETH is not set
614# CONFIG_USB_PEGASUS is not set
615# CONFIG_USB_RTL8150 is not set
616# CONFIG_USB_USBNET is not set
617# CONFIG_WAN is not set
618# CONFIG_PPP is not set
619# CONFIG_SLIP is not set
620# CONFIG_SHAPER is not set
621# CONFIG_NETCONSOLE is not set
622# CONFIG_NETPOLL is not set
623# CONFIG_NET_POLL_CONTROLLER is not set
624# CONFIG_ISDN is not set
625# CONFIG_PHONE is not set
626
627#
628# Input device support
629#
630# CONFIG_INPUT is not set
631
632#
633# Hardware I/O ports
634#
635# CONFIG_SERIO is not set
636# CONFIG_GAMEPORT is not set
637
638#
639# Character devices
640#
641# CONFIG_AD9960 is not set
642# CONFIG_SPI_ADC_BF533 is not set
643# CONFIG_BF5xx_PPIFCD is not set
644# CONFIG_BFIN_SIMPLE_TIMER is not set
645# CONFIG_BF5xx_PPI is not set
646CONFIG_BFIN_OTP=y
647# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
648# CONFIG_BFIN_SPORT is not set
649# CONFIG_BFIN_TIMER_LATENCY is not set
650# CONFIG_TWI_LCD is not set
651CONFIG_SIMPLE_GPIO=m
652# CONFIG_VT is not set
653# CONFIG_SERIAL_NONSTANDARD is not set
654
655#
656# Serial drivers
657#
658# CONFIG_SERIAL_8250 is not set
659
660#
661# Non-8250 serial port support
662#
663CONFIG_SERIAL_BFIN=y
664CONFIG_SERIAL_BFIN_CONSOLE=y
665CONFIG_SERIAL_BFIN_DMA=y
666# CONFIG_SERIAL_BFIN_PIO is not set
667CONFIG_SERIAL_BFIN_UART0=y
668# CONFIG_BFIN_UART0_CTSRTS is not set
669CONFIG_SERIAL_BFIN_UART1=y
670# CONFIG_BFIN_UART1_CTSRTS is not set
671CONFIG_SERIAL_CORE=y
672CONFIG_SERIAL_CORE_CONSOLE=y
673# CONFIG_SERIAL_BFIN_SPORT is not set
674CONFIG_UNIX98_PTYS=y
675# CONFIG_LEGACY_PTYS is not set
676
677#
678# CAN, the car bus and industrial fieldbus
679#
680# CONFIG_CAN4LINUX is not set
681# CONFIG_IPMI_HANDLER is not set
682CONFIG_HW_RANDOM=y
683# CONFIG_GEN_RTC is not set
684# CONFIG_R3964 is not set
685# CONFIG_RAW_DRIVER is not set
686# CONFIG_TCG_TPM is not set
687CONFIG_I2C=y
688CONFIG_I2C_BOARDINFO=y
689CONFIG_I2C_CHARDEV=m
690
691#
692# I2C Algorithms
693#
694# CONFIG_I2C_ALGOBIT is not set
695# CONFIG_I2C_ALGOPCF is not set
696# CONFIG_I2C_ALGOPCA is not set
697
698#
699# I2C Hardware Bus support
700#
701CONFIG_I2C_BLACKFIN_TWI=m
702CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
703# CONFIG_I2C_GPIO is not set
704# CONFIG_I2C_OCORES is not set
705# CONFIG_I2C_PARPORT_LIGHT is not set
706# CONFIG_I2C_SIMTEC is not set
707# CONFIG_I2C_TAOS_EVM is not set
708# CONFIG_I2C_STUB is not set
709# CONFIG_I2C_TINY_USB is not set
710
711#
712# Miscellaneous I2C Chip support
713#
714# CONFIG_SENSORS_DS1337 is not set
715# CONFIG_SENSORS_DS1374 is not set
716# CONFIG_DS1682 is not set
717# CONFIG_SENSORS_AD5252 is not set
718# CONFIG_SENSORS_EEPROM is not set
719# CONFIG_SENSORS_PCF8574 is not set
720# CONFIG_SENSORS_PCF8575 is not set
721# CONFIG_SENSORS_PCA9539 is not set
722# CONFIG_SENSORS_PCF8591 is not set
723# CONFIG_SENSORS_MAX6875 is not set
724# CONFIG_SENSORS_TSL2550 is not set
725# CONFIG_I2C_DEBUG_CORE is not set
726# CONFIG_I2C_DEBUG_ALGO is not set
727# CONFIG_I2C_DEBUG_BUS is not set
728# CONFIG_I2C_DEBUG_CHIP is not set
729
730#
731# SPI support
732#
733CONFIG_SPI=y
734CONFIG_SPI_MASTER=y
735
736#
737# SPI Master Controller Drivers
738#
739CONFIG_SPI_BFIN=y
740# CONFIG_SPI_BITBANG is not set
741
742#
743# SPI Protocol Masters
744#
745# CONFIG_SPI_AT25 is not set
746# CONFIG_SPI_SPIDEV is not set
747# CONFIG_SPI_TLE62X0 is not set
748# CONFIG_W1 is not set
749# CONFIG_POWER_SUPPLY is not set
750CONFIG_HWMON=y
751# CONFIG_HWMON_VID is not set
752# CONFIG_SENSORS_AD7418 is not set
753# CONFIG_SENSORS_ADM1021 is not set
754# CONFIG_SENSORS_ADM1025 is not set
755# CONFIG_SENSORS_ADM1026 is not set
756# CONFIG_SENSORS_ADM1029 is not set
757# CONFIG_SENSORS_ADM1031 is not set
758# CONFIG_SENSORS_ADM9240 is not set
759# CONFIG_SENSORS_ADT7470 is not set
760# CONFIG_SENSORS_ATXP1 is not set
761# CONFIG_SENSORS_DS1621 is not set
762# CONFIG_SENSORS_F71805F is not set
763# CONFIG_SENSORS_F71882FG is not set
764# CONFIG_SENSORS_F75375S is not set
765# CONFIG_SENSORS_GL518SM is not set
766# CONFIG_SENSORS_GL520SM is not set
767# CONFIG_SENSORS_IT87 is not set
768# CONFIG_SENSORS_LM63 is not set
769# CONFIG_SENSORS_LM70 is not set
770# CONFIG_SENSORS_LM75 is not set
771# CONFIG_SENSORS_LM77 is not set
772# CONFIG_SENSORS_LM78 is not set
773# CONFIG_SENSORS_LM80 is not set
774# CONFIG_SENSORS_LM83 is not set
775# CONFIG_SENSORS_LM85 is not set
776# CONFIG_SENSORS_LM87 is not set
777# CONFIG_SENSORS_LM90 is not set
778# CONFIG_SENSORS_LM92 is not set
779# CONFIG_SENSORS_LM93 is not set
780# CONFIG_SENSORS_MAX1619 is not set
781# CONFIG_SENSORS_MAX6650 is not set
782# CONFIG_SENSORS_PC87360 is not set
783# CONFIG_SENSORS_PC87427 is not set
784# CONFIG_SENSORS_DME1737 is not set
785# CONFIG_SENSORS_SMSC47M1 is not set
786# CONFIG_SENSORS_SMSC47M192 is not set
787# CONFIG_SENSORS_SMSC47B397 is not set
788# CONFIG_SENSORS_THMC50 is not set
789# CONFIG_SENSORS_VT1211 is not set
790# CONFIG_SENSORS_W83781D is not set
791# CONFIG_SENSORS_W83791D is not set
792# CONFIG_SENSORS_W83792D is not set
793# CONFIG_SENSORS_W83793 is not set
794# CONFIG_SENSORS_W83L785TS is not set
795# CONFIG_SENSORS_W83627HF is not set
796# CONFIG_SENSORS_W83627EHF is not set
797# CONFIG_HWMON_DEBUG_CHIP is not set
798CONFIG_WATCHDOG=y
799# CONFIG_WATCHDOG_NOWAYOUT is not set
800
801#
802# Watchdog Device Drivers
803#
804# CONFIG_SOFT_WATCHDOG is not set
805CONFIG_BFIN_WDT=y
806
807#
808# USB-based Watchdog Cards
809#
810# CONFIG_USBPCWATCHDOG is not set
811
812#
813# Sonics Silicon Backplane
814#
815CONFIG_SSB_POSSIBLE=y
816# CONFIG_SSB is not set
817
818#
819# Multifunction device drivers
820#
821# CONFIG_MFD_SM501 is not set
822
823#
824# Multimedia devices
825#
826# CONFIG_VIDEO_DEV is not set
827# CONFIG_DVB_CORE is not set
828# CONFIG_DAB is not set
829
830#
831# Graphics support
832#
833# CONFIG_VGASTATE is not set
834# CONFIG_VIDEO_OUTPUT_CONTROL is not set
835# CONFIG_FB is not set
836# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
837
838#
839# Display device support
840#
841# CONFIG_DISPLAY_SUPPORT is not set
842
843#
844# Sound
845#
846# CONFIG_SOUND is not set
847CONFIG_USB_SUPPORT=y
848CONFIG_USB_ARCH_HAS_HCD=y
849# CONFIG_USB_ARCH_HAS_OHCI is not set
850# CONFIG_USB_ARCH_HAS_EHCI is not set
851CONFIG_USB=y
852# CONFIG_USB_DEBUG is not set
853
854#
855# Miscellaneous USB options
856#
857# CONFIG_USB_DEVICEFS is not set
858CONFIG_USB_DEVICE_CLASS=y
859# CONFIG_USB_DYNAMIC_MINORS is not set
860# CONFIG_USB_OTG is not set
861# CONFIG_USB_OTG_WHITELIST is not set
862CONFIG_USB_OTG_BLACKLIST_HUB=y
863
864#
865# USB Host Controller Drivers
866#
867# CONFIG_USB_ISP116X_HCD is not set
868# CONFIG_USB_ISP1362_HCD is not set
869# CONFIG_USB_ISP1760_HCD is not set
870# CONFIG_USB_SL811_HCD is not set
871# CONFIG_USB_R8A66597_HCD is not set
872CONFIG_USB_MUSB_HDRC=y
873CONFIG_USB_MUSB_SOC=y
874
875#
876# Blackfin high speed USB support
877#
878CONFIG_USB_MUSB_HOST=y
879# CONFIG_USB_MUSB_PERIPHERAL is not set
880# CONFIG_USB_MUSB_OTG is not set
881CONFIG_USB_MUSB_HDRC_HCD=y
882CONFIG_MUSB_PIO_ONLY=y
883CONFIG_USB_MUSB_LOGLEVEL=0
884
885#
886# USB Device Class drivers
887#
888# CONFIG_USB_ACM is not set
889# CONFIG_USB_PRINTER is not set
890
891#
892# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
893#
894
895#
896# may also be needed; see USB_STORAGE Help for more information
897#
898# CONFIG_USB_LIBUSUAL is not set
899
900#
901# USB Imaging devices
902#
903# CONFIG_USB_MDC800 is not set
904CONFIG_USB_MON=y
905
906#
907# USB port drivers
908#
909
910#
911# USB Serial Converter support
912#
913# CONFIG_USB_SERIAL is not set
914
915#
916# USB Miscellaneous drivers
917#
918# CONFIG_USB_EMI62 is not set
919# CONFIG_USB_EMI26 is not set
920# CONFIG_USB_ADUTUX is not set
921# CONFIG_USB_AUERSWALD is not set
922# CONFIG_USB_RIO500 is not set
923# CONFIG_USB_LEGOTOWER is not set
924# CONFIG_USB_LCD is not set
925# CONFIG_USB_BERRY_CHARGE is not set
926# CONFIG_USB_LED is not set
927# CONFIG_USB_CYPRESS_CY7C63 is not set
928# CONFIG_USB_CYTHERM is not set
929# CONFIG_USB_PHIDGET is not set
930# CONFIG_USB_IDMOUSE is not set
931# CONFIG_USB_FTDI_ELAN is not set
932# CONFIG_USB_APPLEDISPLAY is not set
933# CONFIG_USB_SISUSBVGA is not set
934# CONFIG_USB_LD is not set
935# CONFIG_USB_TRANCEVIBRATOR is not set
936# CONFIG_USB_IOWARRIOR is not set
937
938#
939# USB DSL modem support
940#
941
942#
943# USB Gadget Support
944#
945# CONFIG_USB_GADGET is not set
946# CONFIG_MMC is not set
947# CONFIG_NEW_LEDS is not set
948CONFIG_RTC_LIB=y
949CONFIG_RTC_CLASS=y
950CONFIG_RTC_HCTOSYS=y
951CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
952# CONFIG_RTC_DEBUG is not set
953
954#
955# RTC interfaces
956#
957CONFIG_RTC_INTF_SYSFS=y
958CONFIG_RTC_INTF_PROC=y
959CONFIG_RTC_INTF_DEV=y
960# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
961# CONFIG_RTC_DRV_TEST is not set
962
963#
964# I2C RTC drivers
965#
966# CONFIG_RTC_DRV_DS1307 is not set
967# CONFIG_RTC_DRV_DS1374 is not set
968# CONFIG_RTC_DRV_DS1672 is not set
969# CONFIG_RTC_DRV_MAX6900 is not set
970# CONFIG_RTC_DRV_RS5C372 is not set
971# CONFIG_RTC_DRV_ISL1208 is not set
972# CONFIG_RTC_DRV_X1205 is not set
973# CONFIG_RTC_DRV_PCF8563 is not set
974# CONFIG_RTC_DRV_PCF8583 is not set
975# CONFIG_RTC_DRV_M41T80 is not set
976
977#
978# SPI RTC drivers
979#
980# CONFIG_RTC_DRV_RS5C348 is not set
981# CONFIG_RTC_DRV_MAX6902 is not set
982
983#
984# Platform RTC drivers
985#
986# CONFIG_RTC_DRV_DS1553 is not set
987# CONFIG_RTC_DRV_STK17TA8 is not set
988# CONFIG_RTC_DRV_DS1742 is not set
989# CONFIG_RTC_DRV_M48T86 is not set
990# CONFIG_RTC_DRV_M48T59 is not set
991# CONFIG_RTC_DRV_V3020 is not set
992
993#
994# on-CPU RTC drivers
995#
996CONFIG_RTC_DRV_BFIN=y
997
998#
999# Userspace I/O
1000#
1001# CONFIG_UIO is not set
1002
1003#
1004# File systems
1005#
1006# CONFIG_EXT2_FS is not set
1007# CONFIG_EXT3_FS is not set
1008# CONFIG_EXT4DEV_FS is not set
1009# CONFIG_REISERFS_FS is not set
1010# CONFIG_JFS_FS is not set
1011# CONFIG_FS_POSIX_ACL is not set
1012# CONFIG_XFS_FS is not set
1013# CONFIG_GFS2_FS is not set
1014# CONFIG_OCFS2_FS is not set
1015# CONFIG_MINIX_FS is not set
1016# CONFIG_ROMFS_FS is not set
1017CONFIG_INOTIFY=y
1018CONFIG_INOTIFY_USER=y
1019# CONFIG_QUOTA is not set
1020# CONFIG_DNOTIFY is not set
1021# CONFIG_AUTOFS_FS is not set
1022# CONFIG_AUTOFS4_FS is not set
1023# CONFIG_FUSE_FS is not set
1024
1025#
1026# CD-ROM/DVD Filesystems
1027#
1028# CONFIG_ISO9660_FS is not set
1029# CONFIG_UDF_FS is not set
1030
1031#
1032# DOS/FAT/NT Filesystems
1033#
1034# CONFIG_MSDOS_FS is not set
1035# CONFIG_VFAT_FS is not set
1036# CONFIG_NTFS_FS is not set
1037
1038#
1039# Pseudo filesystems
1040#
1041CONFIG_PROC_FS=y
1042CONFIG_PROC_SYSCTL=y
1043CONFIG_SYSFS=y
1044# CONFIG_TMPFS is not set
1045# CONFIG_HUGETLB_PAGE is not set
1046# CONFIG_CONFIGFS_FS is not set
1047
1048#
1049# Miscellaneous filesystems
1050#
1051# CONFIG_ADFS_FS is not set
1052# CONFIG_AFFS_FS is not set
1053# CONFIG_HFS_FS is not set
1054# CONFIG_HFSPLUS_FS is not set
1055# CONFIG_BEFS_FS is not set
1056# CONFIG_BFS_FS is not set
1057# CONFIG_EFS_FS is not set
1058# CONFIG_YAFFS_FS is not set
1059# CONFIG_JFFS2_FS is not set
1060# CONFIG_CRAMFS is not set
1061# CONFIG_VXFS_FS is not set
1062# CONFIG_HPFS_FS is not set
1063# CONFIG_QNX4FS_FS is not set
1064# CONFIG_SYSV_FS is not set
1065# CONFIG_UFS_FS is not set
1066CONFIG_NETWORK_FILESYSTEMS=y
1067CONFIG_NFS_FS=m
1068CONFIG_NFS_V3=y
1069# CONFIG_NFS_V3_ACL is not set
1070# CONFIG_NFS_V4 is not set
1071# CONFIG_NFS_DIRECTIO is not set
1072# CONFIG_NFSD is not set
1073CONFIG_LOCKD=m
1074CONFIG_LOCKD_V4=y
1075CONFIG_NFS_COMMON=y
1076CONFIG_SUNRPC=m
1077# CONFIG_SUNRPC_BIND34 is not set
1078# CONFIG_RPCSEC_GSS_KRB5 is not set
1079# CONFIG_RPCSEC_GSS_SPKM3 is not set
1080CONFIG_SMB_FS=m
1081# CONFIG_SMB_NLS_DEFAULT is not set
1082# CONFIG_CIFS is not set
1083# CONFIG_NCP_FS is not set
1084# CONFIG_CODA_FS is not set
1085# CONFIG_AFS_FS is not set
1086
1087#
1088# Partition Types
1089#
1090# CONFIG_PARTITION_ADVANCED is not set
1091CONFIG_MSDOS_PARTITION=y
1092CONFIG_NLS=m
1093CONFIG_NLS_DEFAULT="iso8859-1"
1094# CONFIG_NLS_CODEPAGE_437 is not set
1095# CONFIG_NLS_CODEPAGE_737 is not set
1096# CONFIG_NLS_CODEPAGE_775 is not set
1097# CONFIG_NLS_CODEPAGE_850 is not set
1098# CONFIG_NLS_CODEPAGE_852 is not set
1099# CONFIG_NLS_CODEPAGE_855 is not set
1100# CONFIG_NLS_CODEPAGE_857 is not set
1101# CONFIG_NLS_CODEPAGE_860 is not set
1102# CONFIG_NLS_CODEPAGE_861 is not set
1103# CONFIG_NLS_CODEPAGE_862 is not set
1104# CONFIG_NLS_CODEPAGE_863 is not set
1105# CONFIG_NLS_CODEPAGE_864 is not set
1106# CONFIG_NLS_CODEPAGE_865 is not set
1107# CONFIG_NLS_CODEPAGE_866 is not set
1108# CONFIG_NLS_CODEPAGE_869 is not set
1109# CONFIG_NLS_CODEPAGE_936 is not set
1110# CONFIG_NLS_CODEPAGE_950 is not set
1111# CONFIG_NLS_CODEPAGE_932 is not set
1112# CONFIG_NLS_CODEPAGE_949 is not set
1113# CONFIG_NLS_CODEPAGE_874 is not set
1114# CONFIG_NLS_ISO8859_8 is not set
1115# CONFIG_NLS_CODEPAGE_1250 is not set
1116# CONFIG_NLS_CODEPAGE_1251 is not set
1117# CONFIG_NLS_ASCII is not set
1118# CONFIG_NLS_ISO8859_1 is not set
1119# CONFIG_NLS_ISO8859_2 is not set
1120# CONFIG_NLS_ISO8859_3 is not set
1121# CONFIG_NLS_ISO8859_4 is not set
1122# CONFIG_NLS_ISO8859_5 is not set
1123# CONFIG_NLS_ISO8859_6 is not set
1124# CONFIG_NLS_ISO8859_7 is not set
1125# CONFIG_NLS_ISO8859_9 is not set
1126# CONFIG_NLS_ISO8859_13 is not set
1127# CONFIG_NLS_ISO8859_14 is not set
1128# CONFIG_NLS_ISO8859_15 is not set
1129# CONFIG_NLS_KOI8_R is not set
1130# CONFIG_NLS_KOI8_U is not set
1131# CONFIG_NLS_UTF8 is not set
1132# CONFIG_DLM is not set
1133# CONFIG_INSTRUMENTATION is not set
1134
1135#
1136# Kernel hacking
1137#
1138# CONFIG_PRINTK_TIME is not set
1139CONFIG_ENABLE_WARN_DEPRECATED=y
1140CONFIG_ENABLE_MUST_CHECK=y
1141# CONFIG_MAGIC_SYSRQ is not set
1142# CONFIG_UNUSED_SYMBOLS is not set
1143CONFIG_DEBUG_FS=y
1144# CONFIG_HEADERS_CHECK is not set
1145# CONFIG_DEBUG_KERNEL is not set
1146# CONFIG_DEBUG_BUGVERBOSE is not set
1147# CONFIG_SAMPLES is not set
1148CONFIG_DEBUG_MMRS=y
1149CONFIG_DEBUG_HUNT_FOR_ZERO=y
1150CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1151CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
1152# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set
1153# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_TWO is not set
1154CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
1155# CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
1156# CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
1157CONFIG_EARLY_PRINTK=y
1158# CONFIG_CPLB_INFO is not set
1159CONFIG_ACCESS_CHECK=y
1160
1161#
1162# Security options
1163#
1164# CONFIG_KEYS is not set
1165CONFIG_SECURITY=y
1166# CONFIG_SECURITY_NETWORK is not set
1167# CONFIG_SECURITY_CAPABILITIES is not set
1168# CONFIG_SECURITY_ROOTPLUG is not set
1169# CONFIG_CRYPTO is not set
1170
1171#
1172# Library routines
1173#
1174CONFIG_BITREVERSE=y
1175CONFIG_CRC_CCITT=m
1176# CONFIG_CRC16 is not set
1177# CONFIG_CRC_ITU_T is not set
1178CONFIG_CRC32=y
1179# CONFIG_CRC7 is not set
1180# CONFIG_LIBCRC32C is not set
1181CONFIG_ZLIB_INFLATE=y
1182CONFIG_PLIST=y
1183CONFIG_HAS_IOMEM=y
1184CONFIG_HAS_IOPORT=y
1185CONFIG_HAS_DMA=y
diff --git a/arch/blackfin/configs/CM-BF533_defconfig b/arch/blackfin/configs/CM-BF533_defconfig
index 560890fe0d30..09deea44480b 100644
--- a/arch/blackfin/configs/CM-BF533_defconfig
+++ b/arch/blackfin/configs/CM-BF533_defconfig
@@ -39,7 +39,8 @@ CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 42CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y
43CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
44CONFIG_SYSFS_DEPRECATED=y 45CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
@@ -291,7 +292,7 @@ CONFIG_C_AMBEN_ALL=y
291CONFIG_BANK_0=0x7BB0 292CONFIG_BANK_0=0x7BB0
292CONFIG_BANK_1=0x7BB0 293CONFIG_BANK_1=0x7BB0
293CONFIG_BANK_2=0x7BB0 294CONFIG_BANK_2=0x7BB0
294CONFIG_BANK_3=0xFFC3 295CONFIG_BANK_3=0xFFC2
295 296
296# 297#
297# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 298# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -617,8 +618,7 @@ CONFIG_SERIAL_CORE=y
617CONFIG_SERIAL_CORE_CONSOLE=y 618CONFIG_SERIAL_CORE_CONSOLE=y
618# CONFIG_SERIAL_BFIN_SPORT is not set 619# CONFIG_SERIAL_BFIN_SPORT is not set
619CONFIG_UNIX98_PTYS=y 620CONFIG_UNIX98_PTYS=y
620CONFIG_LEGACY_PTYS=y 621# CONFIG_LEGACY_PTYS is not set
621CONFIG_LEGACY_PTY_COUNT=256
622 622
623# 623#
624# CAN, the car bus and industrial fieldbus 624# CAN, the car bus and industrial fieldbus
@@ -778,7 +778,7 @@ CONFIG_FS_MBCACHE=y
778CONFIG_INOTIFY=y 778CONFIG_INOTIFY=y
779CONFIG_INOTIFY_USER=y 779CONFIG_INOTIFY_USER=y
780# CONFIG_QUOTA is not set 780# CONFIG_QUOTA is not set
781CONFIG_DNOTIFY=y 781# CONFIG_DNOTIFY is not set
782# CONFIG_AUTOFS_FS is not set 782# CONFIG_AUTOFS_FS is not set
783# CONFIG_AUTOFS4_FS is not set 783# CONFIG_AUTOFS4_FS is not set
784# CONFIG_FUSE_FS is not set 784# CONFIG_FUSE_FS is not set
@@ -866,11 +866,11 @@ CONFIG_MSDOS_PARTITION=y
866CONFIG_ENABLE_MUST_CHECK=y 866CONFIG_ENABLE_MUST_CHECK=y
867# CONFIG_MAGIC_SYSRQ is not set 867# CONFIG_MAGIC_SYSRQ is not set
868# CONFIG_UNUSED_SYMBOLS is not set 868# CONFIG_UNUSED_SYMBOLS is not set
869# CONFIG_DEBUG_FS is not set 869CONFIG_DEBUG_FS=y
870# CONFIG_HEADERS_CHECK is not set 870# CONFIG_HEADERS_CHECK is not set
871# CONFIG_DEBUG_KERNEL is not set 871# CONFIG_DEBUG_KERNEL is not set
872# CONFIG_DEBUG_BUGVERBOSE is not set 872# CONFIG_DEBUG_BUGVERBOSE is not set
873# CONFIG_DEBUG_MMRS is not set 873CONFIG_DEBUG_MMRS=y
874CONFIG_DEBUG_HUNT_FOR_ZERO=y 874CONFIG_DEBUG_HUNT_FOR_ZERO=y
875CONFIG_DEBUG_BFIN_HWTRACE_ON=y 875CONFIG_DEBUG_BFIN_HWTRACE_ON=y
876CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 876CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
diff --git a/arch/blackfin/configs/CM-BF537E_defconfig b/arch/blackfin/configs/CM-BF537E_defconfig
index 9f66d2de1007..219fc345a5f5 100644
--- a/arch/blackfin/configs/CM-BF537E_defconfig
+++ b/arch/blackfin/configs/CM-BF537E_defconfig
@@ -39,7 +39,8 @@ CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 42CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y
43CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
44CONFIG_SYSFS_DEPRECATED=y 45CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
@@ -299,7 +300,7 @@ CONFIG_C_AMBEN_ALL=y
299CONFIG_BANK_0=0x7BB0 300CONFIG_BANK_0=0x7BB0
300CONFIG_BANK_1=0x7BB0 301CONFIG_BANK_1=0x7BB0
301CONFIG_BANK_2=0x7BB0 302CONFIG_BANK_2=0x7BB0
302CONFIG_BANK_3=0xFFC3 303CONFIG_BANK_3=0xFFC2
303 304
304# 305#
305# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 306# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -351,7 +352,10 @@ CONFIG_INET=y
351# CONFIG_IP_MULTICAST is not set 352# CONFIG_IP_MULTICAST is not set
352# CONFIG_IP_ADVANCED_ROUTER is not set 353# CONFIG_IP_ADVANCED_ROUTER is not set
353CONFIG_IP_FIB_HASH=y 354CONFIG_IP_FIB_HASH=y
354# CONFIG_IP_PNP is not set 355CONFIG_IP_PNP=y
356# CONFIG_IP_PNP_DHCP is not set
357# CONFIG_IP_PNP_BOOTP is not set
358# CONFIG_IP_PNP_RARP is not set
355# CONFIG_NET_IPIP is not set 359# CONFIG_NET_IPIP is not set
356# CONFIG_NET_IPGRE is not set 360# CONFIG_NET_IPGRE is not set
357# CONFIG_ARPD is not set 361# CONFIG_ARPD is not set
@@ -645,8 +649,7 @@ CONFIG_SERIAL_CORE=y
645CONFIG_SERIAL_CORE_CONSOLE=y 649CONFIG_SERIAL_CORE_CONSOLE=y
646# CONFIG_SERIAL_BFIN_SPORT is not set 650# CONFIG_SERIAL_BFIN_SPORT is not set
647CONFIG_UNIX98_PTYS=y 651CONFIG_UNIX98_PTYS=y
648CONFIG_LEGACY_PTYS=y 652# CONFIG_LEGACY_PTYS is not set
649CONFIG_LEGACY_PTY_COUNT=256
650 653
651# 654#
652# CAN, the car bus and industrial fieldbus 655# CAN, the car bus and industrial fieldbus
@@ -806,7 +809,7 @@ CONFIG_FS_MBCACHE=y
806CONFIG_INOTIFY=y 809CONFIG_INOTIFY=y
807CONFIG_INOTIFY_USER=y 810CONFIG_INOTIFY_USER=y
808# CONFIG_QUOTA is not set 811# CONFIG_QUOTA is not set
809CONFIG_DNOTIFY=y 812# CONFIG_DNOTIFY is not set
810# CONFIG_AUTOFS_FS is not set 813# CONFIG_AUTOFS_FS is not set
811# CONFIG_AUTOFS4_FS is not set 814# CONFIG_AUTOFS4_FS is not set
812# CONFIG_FUSE_FS is not set 815# CONFIG_FUSE_FS is not set
@@ -894,12 +897,12 @@ CONFIG_MSDOS_PARTITION=y
894CONFIG_ENABLE_MUST_CHECK=y 897CONFIG_ENABLE_MUST_CHECK=y
895# CONFIG_MAGIC_SYSRQ is not set 898# CONFIG_MAGIC_SYSRQ is not set
896# CONFIG_UNUSED_SYMBOLS is not set 899# CONFIG_UNUSED_SYMBOLS is not set
897# CONFIG_DEBUG_FS is not set 900CONFIG_DEBUG_FS=y
898# CONFIG_HEADERS_CHECK is not set 901# CONFIG_HEADERS_CHECK is not set
899# CONFIG_DEBUG_KERNEL is not set 902# CONFIG_DEBUG_KERNEL is not set
900# CONFIG_DEBUG_BUGVERBOSE is not set 903# CONFIG_DEBUG_BUGVERBOSE is not set
901# CONFIG_DEBUG_MMRS is not set 904CONFIG_DEBUG_MMRS=y
902# CONFIG_DEBUG_HUNT_FOR_ZERO is not set 905CONFIG_DEBUG_HUNT_FOR_ZERO=y
903CONFIG_DEBUG_BFIN_HWTRACE_ON=y 906CONFIG_DEBUG_BFIN_HWTRACE_ON=y
904CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 907CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
905# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set 908# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set
diff --git a/arch/blackfin/configs/CM-BF537U_defconfig b/arch/blackfin/configs/CM-BF537U_defconfig
index 2694d06c5bde..9873d586fc77 100644
--- a/arch/blackfin/configs/CM-BF537U_defconfig
+++ b/arch/blackfin/configs/CM-BF537U_defconfig
@@ -39,7 +39,8 @@ CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_TASKSTATS is not set 39# CONFIG_TASKSTATS is not set
40# CONFIG_UTS_NS is not set 40# CONFIG_UTS_NS is not set
41# CONFIG_AUDIT is not set 41# CONFIG_AUDIT is not set
42# CONFIG_IKCONFIG is not set 42CONFIG_IKCONFIG=y
43CONFIG_IKCONFIG_PROC=y
43CONFIG_LOG_BUF_SHIFT=14 44CONFIG_LOG_BUF_SHIFT=14
44CONFIG_SYSFS_DEPRECATED=y 45CONFIG_SYSFS_DEPRECATED=y
45# CONFIG_RELAY is not set 46# CONFIG_RELAY is not set
@@ -298,8 +299,8 @@ CONFIG_C_AMBEN_ALL=y
298# 299#
299CONFIG_BANK_0=0x7BB0 300CONFIG_BANK_0=0x7BB0
300CONFIG_BANK_1=0x7BB0 301CONFIG_BANK_1=0x7BB0
301CONFIG_BANK_2=0xFFC3 302CONFIG_BANK_2=0xFFC2
302CONFIG_BANK_3=0xFFC3 303CONFIG_BANK_3=0xFFC2
303 304
304# 305#
305# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 306# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -628,8 +629,7 @@ CONFIG_SERIAL_CORE=y
628CONFIG_SERIAL_CORE_CONSOLE=y 629CONFIG_SERIAL_CORE_CONSOLE=y
629# CONFIG_SERIAL_BFIN_SPORT is not set 630# CONFIG_SERIAL_BFIN_SPORT is not set
630CONFIG_UNIX98_PTYS=y 631CONFIG_UNIX98_PTYS=y
631CONFIG_LEGACY_PTYS=y 632# CONFIG_LEGACY_PTYS is not set
632CONFIG_LEGACY_PTY_COUNT=256
633 633
634# 634#
635# CAN, the car bus and industrial fieldbus 635# CAN, the car bus and industrial fieldbus
@@ -806,7 +806,7 @@ CONFIG_FS_MBCACHE=y
806CONFIG_INOTIFY=y 806CONFIG_INOTIFY=y
807CONFIG_INOTIFY_USER=y 807CONFIG_INOTIFY_USER=y
808# CONFIG_QUOTA is not set 808# CONFIG_QUOTA is not set
809CONFIG_DNOTIFY=y 809# CONFIG_DNOTIFY is not set
810# CONFIG_AUTOFS_FS is not set 810# CONFIG_AUTOFS_FS is not set
811# CONFIG_AUTOFS4_FS is not set 811# CONFIG_AUTOFS4_FS is not set
812# CONFIG_FUSE_FS is not set 812# CONFIG_FUSE_FS is not set
@@ -894,12 +894,12 @@ CONFIG_MSDOS_PARTITION=y
894CONFIG_ENABLE_MUST_CHECK=y 894CONFIG_ENABLE_MUST_CHECK=y
895# CONFIG_MAGIC_SYSRQ is not set 895# CONFIG_MAGIC_SYSRQ is not set
896# CONFIG_UNUSED_SYMBOLS is not set 896# CONFIG_UNUSED_SYMBOLS is not set
897# CONFIG_DEBUG_FS is not set 897CONFIG_DEBUG_FS=y
898# CONFIG_HEADERS_CHECK is not set 898# CONFIG_HEADERS_CHECK is not set
899# CONFIG_DEBUG_KERNEL is not set 899# CONFIG_DEBUG_KERNEL is not set
900# CONFIG_DEBUG_BUGVERBOSE is not set 900# CONFIG_DEBUG_BUGVERBOSE is not set
901# CONFIG_DEBUG_MMRS is not set 901CONFIG_DEBUG_MMRS=y
902# CONFIG_DEBUG_HUNT_FOR_ZERO is not set 902CONFIG_DEBUG_HUNT_FOR_ZERO=y
903CONFIG_DEBUG_BFIN_HWTRACE_ON=y 903CONFIG_DEBUG_BFIN_HWTRACE_ON=y
904CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 904CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
905# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set 905# CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE is not set
diff --git a/arch/blackfin/configs/CM-BF548_defconfig b/arch/blackfin/configs/CM-BF548_defconfig
index 90207251c533..0e3605fdb7b0 100644
--- a/arch/blackfin/configs/CM-BF548_defconfig
+++ b/arch/blackfin/configs/CM-BF548_defconfig
@@ -363,7 +363,7 @@ CONFIG_C_AMBEN_ALL=y
363CONFIG_BANK_0=0x7BB0 363CONFIG_BANK_0=0x7BB0
364CONFIG_BANK_1=0x5554 364CONFIG_BANK_1=0x5554
365CONFIG_BANK_2=0x7BB0 365CONFIG_BANK_2=0x7BB0
366CONFIG_BANK_3=0x99B3 366CONFIG_BANK_3=0x99B2
367CONFIG_EBIU_MBSCTLVAL=0x0 367CONFIG_EBIU_MBSCTLVAL=0x0
368CONFIG_EBIU_MODEVAL=0x1 368CONFIG_EBIU_MODEVAL=0x1
369CONFIG_EBIU_FCTLVAL=0x6 369CONFIG_EBIU_FCTLVAL=0x6
@@ -744,8 +744,8 @@ CONFIG_BFIN_OTP=y
744# 744#
745CONFIG_SERIAL_BFIN=y 745CONFIG_SERIAL_BFIN=y
746CONFIG_SERIAL_BFIN_CONSOLE=y 746CONFIG_SERIAL_BFIN_CONSOLE=y
747# CONFIG_SERIAL_BFIN_DMA is not set 747CONFIG_SERIAL_BFIN_DMA=y
748CONFIG_SERIAL_BFIN_PIO=y 748# CONFIG_SERIAL_BFIN_PIO is not set
749# CONFIG_SERIAL_BFIN_UART0 is not set 749# CONFIG_SERIAL_BFIN_UART0 is not set
750CONFIG_SERIAL_BFIN_UART1=y 750CONFIG_SERIAL_BFIN_UART1=y
751# CONFIG_BFIN_UART1_CTSRTS is not set 751# CONFIG_BFIN_UART1_CTSRTS is not set
@@ -1149,7 +1149,7 @@ CONFIG_RTC_DRV_BFIN=y
1149CONFIG_INOTIFY=y 1149CONFIG_INOTIFY=y
1150CONFIG_INOTIFY_USER=y 1150CONFIG_INOTIFY_USER=y
1151# CONFIG_QUOTA is not set 1151# CONFIG_QUOTA is not set
1152CONFIG_DNOTIFY=y 1152# CONFIG_DNOTIFY is not set
1153# CONFIG_AUTOFS_FS is not set 1153# CONFIG_AUTOFS_FS is not set
1154# CONFIG_AUTOFS4_FS is not set 1154# CONFIG_AUTOFS4_FS is not set
1155# CONFIG_FUSE_FS is not set 1155# CONFIG_FUSE_FS is not set
@@ -1332,7 +1332,7 @@ CONFIG_DEBUG_FS=y
1332# CONFIG_DEBUG_KERNEL is not set 1332# CONFIG_DEBUG_KERNEL is not set
1333# CONFIG_DEBUG_BUGVERBOSE is not set 1333# CONFIG_DEBUG_BUGVERBOSE is not set
1334# CONFIG_SAMPLES is not set 1334# CONFIG_SAMPLES is not set
1335# CONFIG_DEBUG_MMRS is not set 1335CONFIG_DEBUG_MMRS=y
1336CONFIG_DEBUG_HUNT_FOR_ZERO=y 1336CONFIG_DEBUG_HUNT_FOR_ZERO=y
1337CONFIG_DEBUG_BFIN_HWTRACE_ON=y 1337CONFIG_DEBUG_BFIN_HWTRACE_ON=y
1338CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 1338CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
diff --git a/arch/blackfin/configs/CM-BF561_defconfig b/arch/blackfin/configs/CM-BF561_defconfig
index daf00906c1ef..59c7cdbee904 100644
--- a/arch/blackfin/configs/CM-BF561_defconfig
+++ b/arch/blackfin/configs/CM-BF561_defconfig
@@ -35,7 +35,8 @@ CONFIG_SYSVIPC_SYSCTL=y
35# CONFIG_USER_NS is not set 35# CONFIG_USER_NS is not set
36# CONFIG_PID_NS is not set 36# CONFIG_PID_NS is not set
37# CONFIG_AUDIT is not set 37# CONFIG_AUDIT is not set
38# CONFIG_IKCONFIG is not set 38CONFIG_IKCONFIG=y
39CONFIG_IKCONFIG_PROC=y
39CONFIG_LOG_BUF_SHIFT=14 40CONFIG_LOG_BUF_SHIFT=14
40# CONFIG_CGROUPS is not set 41# CONFIG_CGROUPS is not set
41CONFIG_FAIR_GROUP_SCHED=y 42CONFIG_FAIR_GROUP_SCHED=y
@@ -341,7 +342,7 @@ CONFIG_C_AMBEN_ALL=y
341CONFIG_BANK_0=0x7BB0 342CONFIG_BANK_0=0x7BB0
342CONFIG_BANK_1=0x7BB0 343CONFIG_BANK_1=0x7BB0
343CONFIG_BANK_2=0x7BB0 344CONFIG_BANK_2=0x7BB0
344CONFIG_BANK_3=0xFFC3 345CONFIG_BANK_3=0xFFC2
345 346
346# 347#
347# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 348# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -631,8 +632,7 @@ CONFIG_SERIAL_CORE=y
631CONFIG_SERIAL_CORE_CONSOLE=y 632CONFIG_SERIAL_CORE_CONSOLE=y
632# CONFIG_SERIAL_BFIN_SPORT is not set 633# CONFIG_SERIAL_BFIN_SPORT is not set
633CONFIG_UNIX98_PTYS=y 634CONFIG_UNIX98_PTYS=y
634CONFIG_LEGACY_PTYS=y 635# CONFIG_LEGACY_PTYS is not set
635CONFIG_LEGACY_PTY_COUNT=256
636 636
637# 637#
638# CAN, the car bus and industrial fieldbus 638# CAN, the car bus and industrial fieldbus
@@ -756,7 +756,7 @@ CONFIG_FS_MBCACHE=y
756CONFIG_INOTIFY=y 756CONFIG_INOTIFY=y
757CONFIG_INOTIFY_USER=y 757CONFIG_INOTIFY_USER=y
758# CONFIG_QUOTA is not set 758# CONFIG_QUOTA is not set
759CONFIG_DNOTIFY=y 759# CONFIG_DNOTIFY is not set
760# CONFIG_AUTOFS_FS is not set 760# CONFIG_AUTOFS_FS is not set
761# CONFIG_AUTOFS4_FS is not set 761# CONFIG_AUTOFS4_FS is not set
762# CONFIG_FUSE_FS is not set 762# CONFIG_FUSE_FS is not set
@@ -830,12 +830,12 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
830CONFIG_ENABLE_MUST_CHECK=y 830CONFIG_ENABLE_MUST_CHECK=y
831# CONFIG_MAGIC_SYSRQ is not set 831# CONFIG_MAGIC_SYSRQ is not set
832# CONFIG_UNUSED_SYMBOLS is not set 832# CONFIG_UNUSED_SYMBOLS is not set
833# CONFIG_DEBUG_FS is not set 833CONFIG_DEBUG_FS=y
834# CONFIG_HEADERS_CHECK is not set 834# CONFIG_HEADERS_CHECK is not set
835# CONFIG_DEBUG_KERNEL is not set 835# CONFIG_DEBUG_KERNEL is not set
836# CONFIG_DEBUG_BUGVERBOSE is not set 836# CONFIG_DEBUG_BUGVERBOSE is not set
837# CONFIG_SAMPLES is not set 837# CONFIG_SAMPLES is not set
838# CONFIG_DEBUG_MMRS is not set 838CONFIG_DEBUG_MMRS=y
839CONFIG_DEBUG_HUNT_FOR_ZERO=y 839CONFIG_DEBUG_HUNT_FOR_ZERO=y
840CONFIG_DEBUG_BFIN_HWTRACE_ON=y 840CONFIG_DEBUG_BFIN_HWTRACE_ON=y
841CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y 841CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
diff --git a/arch/blackfin/configs/H8606_defconfig b/arch/blackfin/configs/H8606_defconfig
index 679c7483ea71..ba0bee90b7e1 100644
--- a/arch/blackfin/configs/H8606_defconfig
+++ b/arch/blackfin/configs/H8606_defconfig
@@ -967,7 +967,7 @@ CONFIG_FS_MBCACHE=y
967CONFIG_INOTIFY=y 967CONFIG_INOTIFY=y
968CONFIG_INOTIFY_USER=y 968CONFIG_INOTIFY_USER=y
969# CONFIG_QUOTA is not set 969# CONFIG_QUOTA is not set
970CONFIG_DNOTIFY=y 970# CONFIG_DNOTIFY is not set
971# CONFIG_AUTOFS_FS is not set 971# CONFIG_AUTOFS_FS is not set
972# CONFIG_AUTOFS4_FS is not set 972# CONFIG_AUTOFS4_FS is not set
973# CONFIG_FUSE_FS is not set 973# CONFIG_FUSE_FS is not set
diff --git a/arch/blackfin/configs/IP0X_defconfig b/arch/blackfin/configs/IP0X_defconfig
index 4384a670a8b8..285d2241df26 100644
--- a/arch/blackfin/configs/IP0X_defconfig
+++ b/arch/blackfin/configs/IP0X_defconfig
@@ -1066,7 +1066,7 @@ CONFIG_FS_MBCACHE=y
1066CONFIG_INOTIFY=y 1066CONFIG_INOTIFY=y
1067CONFIG_INOTIFY_USER=y 1067CONFIG_INOTIFY_USER=y
1068# CONFIG_QUOTA is not set 1068# CONFIG_QUOTA is not set
1069CONFIG_DNOTIFY=y 1069# CONFIG_DNOTIFY is not set
1070# CONFIG_AUTOFS_FS is not set 1070# CONFIG_AUTOFS_FS is not set
1071# CONFIG_AUTOFS4_FS is not set 1071# CONFIG_AUTOFS4_FS is not set
1072# CONFIG_FUSE_FS is not set 1072# CONFIG_FUSE_FS is not set
diff --git a/arch/blackfin/configs/PNAV-10_defconfig b/arch/blackfin/configs/PNAV-10_defconfig
index 87622ad9df47..bffca7de65d4 100644
--- a/arch/blackfin/configs/PNAV-10_defconfig
+++ b/arch/blackfin/configs/PNAV-10_defconfig
@@ -294,7 +294,7 @@ CONFIG_C_AMBEN_ALL=y
294CONFIG_BANK_0=0x7BB0 294CONFIG_BANK_0=0x7BB0
295CONFIG_BANK_1=0x33B0 295CONFIG_BANK_1=0x33B0
296CONFIG_BANK_2=0x33B0 296CONFIG_BANK_2=0x33B0
297CONFIG_BANK_3=0x99B3 297CONFIG_BANK_3=0x99B2
298 298
299# 299#
300# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 300# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -1080,7 +1080,7 @@ CONFIG_FS_MBCACHE=y
1080CONFIG_INOTIFY=y 1080CONFIG_INOTIFY=y
1081CONFIG_INOTIFY_USER=y 1081CONFIG_INOTIFY_USER=y
1082# CONFIG_QUOTA is not set 1082# CONFIG_QUOTA is not set
1083CONFIG_DNOTIFY=y 1083# CONFIG_DNOTIFY is not set
1084# CONFIG_AUTOFS_FS is not set 1084# CONFIG_AUTOFS_FS is not set
1085# CONFIG_AUTOFS4_FS is not set 1085# CONFIG_AUTOFS4_FS is not set
1086# CONFIG_FUSE_FS is not set 1086# CONFIG_FUSE_FS is not set
diff --git a/arch/blackfin/configs/SRV1_defconfig b/arch/blackfin/configs/SRV1_defconfig
index 951ea0412576..b1309f878fcd 100644
--- a/arch/blackfin/configs/SRV1_defconfig
+++ b/arch/blackfin/configs/SRV1_defconfig
@@ -1067,7 +1067,7 @@ CONFIG_FS_MBCACHE=y
1067CONFIG_INOTIFY=y 1067CONFIG_INOTIFY=y
1068CONFIG_INOTIFY_USER=y 1068CONFIG_INOTIFY_USER=y
1069# CONFIG_QUOTA is not set 1069# CONFIG_QUOTA is not set
1070CONFIG_DNOTIFY=y 1070# CONFIG_DNOTIFY is not set
1071# CONFIG_AUTOFS_FS is not set 1071# CONFIG_AUTOFS_FS is not set
1072# CONFIG_AUTOFS4_FS is not set 1072# CONFIG_AUTOFS4_FS is not set
1073# CONFIG_FUSE_FS is not set 1073# CONFIG_FUSE_FS is not set
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 6140cd69c782..606adc78aa85 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -18,6 +18,5 @@ endif
18obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o 18obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o
19obj-$(CONFIG_MODULES) += module.o 19obj-$(CONFIG_MODULES) += module.o
20obj-$(CONFIG_BFIN_DMA_5XX) += bfin_dma_5xx.o 20obj-$(CONFIG_BFIN_DMA_5XX) += bfin_dma_5xx.o
21obj-$(CONFIG_DUAL_CORE_TEST_MODULE) += dualcore_test.o
22obj-$(CONFIG_KGDB) += kgdb.o 21obj-$(CONFIG_KGDB) += kgdb.o
23obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 22obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index d54f19085f37..93229b3d6e3e 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -472,6 +472,40 @@ unsigned long get_dma_curr_addr(unsigned int channel)
472} 472}
473EXPORT_SYMBOL(get_dma_curr_addr); 473EXPORT_SYMBOL(get_dma_curr_addr);
474 474
475#ifdef CONFIG_PM
476int blackfin_dma_suspend(void)
477{
478 int i;
479
480#ifdef CONFIG_BF561 /* IMDMA channels doesn't have a PERIPHERAL_MAP */
481 for (i = 0; i <= CH_MEM_STREAM3_SRC; i++) {
482#else
483 for (i = 0; i < MAX_BLACKFIN_DMA_CHANNEL; i++) {
484#endif
485 if (dma_ch[i].chan_status == DMA_CHANNEL_ENABLED) {
486 printk(KERN_ERR "DMA Channel %d failed to suspend\n", i);
487 return -EBUSY;
488 }
489
490 dma_ch[i].saved_peripheral_map = dma_ch[i].regs->peripheral_map;
491 }
492
493 return 0;
494}
495
496void blackfin_dma_resume(void)
497{
498 int i;
499
500#ifdef CONFIG_BF561 /* IMDMA channels doesn't have a PERIPHERAL_MAP */
501 for (i = 0; i <= CH_MEM_STREAM3_SRC; i++)
502#else
503 for (i = 0; i < MAX_BLACKFIN_DMA_CHANNEL; i++)
504#endif
505 dma_ch[i].regs->peripheral_map = dma_ch[i].saved_peripheral_map;
506}
507#endif
508
475static void *__dma_memcpy(void *dest, const void *src, size_t size) 509static void *__dma_memcpy(void *dest, const void *src, size_t size)
476{ 510{
477 int direction; /* 1 - address decrease, 0 - address increase */ 511 int direction; /* 1 - address decrease, 0 - address increase */
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index b6d89d1644cc..ecbd141e0ef2 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -186,7 +186,10 @@ static struct str_ident {
186 char name[RESOURCE_LABEL_SIZE]; 186 char name[RESOURCE_LABEL_SIZE];
187} str_ident[MAX_RESOURCES]; 187} str_ident[MAX_RESOURCES];
188 188
189#if defined(CONFIG_PM) && !defined(CONFIG_BF54x) 189#if defined(CONFIG_PM)
190#if defined(CONFIG_BF54x)
191static struct gpio_port_s gpio_bank_saved[gpio_bank(MAX_BLACKFIN_GPIOS)];
192#else
190static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)]; 193static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
191static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS]; 194static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
192static struct gpio_port_s gpio_bank_saved[gpio_bank(MAX_BLACKFIN_GPIOS)]; 195static struct gpio_port_s gpio_bank_saved[gpio_bank(MAX_BLACKFIN_GPIOS)];
@@ -206,7 +209,7 @@ static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PORTF_INT
206#ifdef BF561_FAMILY 209#ifdef BF561_FAMILY
207static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB}; 210static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB};
208#endif 211#endif
209 212#endif
210#endif /* CONFIG_PM */ 213#endif /* CONFIG_PM */
211 214
212#if defined(BF548_FAMILY) 215#if defined(BF548_FAMILY)
@@ -667,7 +670,7 @@ static int bfin_gpio_wakeup_type(unsigned gpio, unsigned char type)
667 return 0; 670 return 0;
668} 671}
669 672
670u32 bfin_pm_setup(void) 673u32 bfin_pm_standby_setup(void)
671{ 674{
672 u16 bank, mask, i, gpio; 675 u16 bank, mask, i, gpio;
673 676
@@ -679,7 +682,7 @@ u32 bfin_pm_setup(void)
679 gpio_bankb[bank]->maskb = 0; 682 gpio_bankb[bank]->maskb = 0;
680 683
681 if (mask) { 684 if (mask) {
682#ifdef BF537_FAMILY 685#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
683 gpio_bank_saved[bank].fer = *port_fer[bank]; 686 gpio_bank_saved[bank].fer = *port_fer[bank];
684#endif 687#endif
685 gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen; 688 gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen;
@@ -715,7 +718,7 @@ u32 bfin_pm_setup(void)
715 return 0; 718 return 0;
716} 719}
717 720
718void bfin_pm_restore(void) 721void bfin_pm_standby_restore(void)
719{ 722{
720 u16 bank, mask, i; 723 u16 bank, mask, i;
721 724
@@ -724,7 +727,7 @@ void bfin_pm_restore(void)
724 bank = gpio_bank(i); 727 bank = gpio_bank(i);
725 728
726 if (mask) { 729 if (mask) {
727#ifdef BF537_FAMILY 730#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
728 *port_fer[bank] = gpio_bank_saved[bank].fer; 731 *port_fer[bank] = gpio_bank_saved[bank].fer;
729#endif 732#endif
730 gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen; 733 gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen;
@@ -743,8 +746,111 @@ void bfin_pm_restore(void)
743 AWA_DUMMY_READ(maskb); 746 AWA_DUMMY_READ(maskb);
744} 747}
745 748
749void bfin_gpio_pm_hibernate_suspend(void)
750{
751 int i, bank;
752
753 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
754 bank = gpio_bank(i);
755
756#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
757 gpio_bank_saved[bank].fer = *port_fer[bank];
758#ifdef BF527_FAMILY
759 gpio_bank_saved[bank].mux = *port_mux[bank];
760#else
761 if (bank == 0)
762 gpio_bank_saved[bank].mux = bfin_read_PORT_MUX();
763#endif
764#endif
765 gpio_bank_saved[bank].data = gpio_bankb[bank]->data;
766 gpio_bank_saved[bank].inen = gpio_bankb[bank]->inen;
767 gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar;
768 gpio_bank_saved[bank].dir = gpio_bankb[bank]->dir;
769 gpio_bank_saved[bank].edge = gpio_bankb[bank]->edge;
770 gpio_bank_saved[bank].both = gpio_bankb[bank]->both;
771 gpio_bank_saved[bank].maska = gpio_bankb[bank]->maska;
772 }
773
774 AWA_DUMMY_READ(maska);
775}
776
777void bfin_gpio_pm_hibernate_restore(void)
778{
779 int i, bank;
780
781 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
782 bank = gpio_bank(i);
783
784#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
785#ifdef BF527_FAMILY
786 *port_mux[bank] = gpio_bank_saved[bank].mux;
787#else
788 if (bank == 0)
789 bfin_write_PORT_MUX(gpio_bank_saved[bank].mux);
790#endif
791 *port_fer[bank] = gpio_bank_saved[bank].fer;
792#endif
793 gpio_bankb[bank]->inen = gpio_bank_saved[bank].inen;
794 gpio_bankb[bank]->dir = gpio_bank_saved[bank].dir;
795 gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar;
796 gpio_bankb[bank]->edge = gpio_bank_saved[bank].edge;
797 gpio_bankb[bank]->both = gpio_bank_saved[bank].both;
798
799 gpio_bankb[bank]->data_set = gpio_bank_saved[bank].data
800 | gpio_bank_saved[bank].dir;
801
802 gpio_bankb[bank]->maska = gpio_bank_saved[bank].maska;
803 }
804 AWA_DUMMY_READ(maska);
805}
806
807
746#endif 808#endif
747#else /* BF548_FAMILY */ 809#else /* BF548_FAMILY */
810#ifdef CONFIG_PM
811
812u32 bfin_pm_standby_setup(void)
813{
814 return 0;
815}
816
817void bfin_pm_standby_restore(void)
818{
819
820}
821
822void bfin_gpio_pm_hibernate_suspend(void)
823{
824 int i, bank;
825
826 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
827 bank = gpio_bank(i);
828
829 gpio_bank_saved[bank].fer = gpio_array[bank]->port_fer;
830 gpio_bank_saved[bank].mux = gpio_array[bank]->port_mux;
831 gpio_bank_saved[bank].data = gpio_array[bank]->port_data;
832 gpio_bank_saved[bank].data = gpio_array[bank]->port_data;
833 gpio_bank_saved[bank].inen = gpio_array[bank]->port_inen;
834 gpio_bank_saved[bank].dir = gpio_array[bank]->port_dir_set;
835 }
836}
837
838void bfin_gpio_pm_hibernate_restore(void)
839{
840 int i, bank;
841
842 for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
843 bank = gpio_bank(i);
844
845 gpio_array[bank]->port_mux = gpio_bank_saved[bank].mux;
846 gpio_array[bank]->port_fer = gpio_bank_saved[bank].fer;
847 gpio_array[bank]->port_inen = gpio_bank_saved[bank].inen;
848 gpio_array[bank]->port_dir_set = gpio_bank_saved[bank].dir;
849 gpio_array[bank]->port_set = gpio_bank_saved[bank].data
850 | gpio_bank_saved[bank].dir;
851 }
852}
853#endif
748 854
749unsigned short get_gpio_dir(unsigned gpio) 855unsigned short get_gpio_dir(unsigned gpio)
750{ 856{
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S b/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S
index 2788532de72b..ecbabc0a1fed 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S
+++ b/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S
@@ -125,6 +125,6 @@ ENTRY(__cplb_hdr)
125 SP += -12; 125 SP += -12;
126 call _panic_cplb_error; 126 call _panic_cplb_error;
127 SP += 12; 127 SP += 12;
128 JUMP _handle_bad_cplb; 128 JUMP.L _handle_bad_cplb;
129 129
130ENDPROC(__cplb_hdr) 130ENDPROC(__cplb_hdr)
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 6be0c50122e8..224e7cc30bc5 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -26,11 +26,7 @@
26#include <asm/cplb.h> 26#include <asm/cplb.h>
27#include <asm/cplbinit.h> 27#include <asm/cplbinit.h>
28 28
29#ifdef CONFIG_MAX_MEM_SIZE 29#define CPLB_MEM CONFIG_MAX_MEM_SIZE
30# define CPLB_MEM CONFIG_MAX_MEM_SIZE
31#else
32# define CPLB_MEM CONFIG_MEM_SIZE
33#endif
34 30
35/* 31/*
36* Number of required data CPLB switchtable entries 32* Number of required data CPLB switchtable entries
diff --git a/arch/blackfin/kernel/dualcore_test.c b/arch/blackfin/kernel/dualcore_test.c
deleted file mode 100644
index 0fcba74840b7..000000000000
--- a/arch/blackfin/kernel/dualcore_test.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * File: arch/blackfin/kernel/dualcore_test.c
3 * Based on:
4 * Author:
5 *
6 * Created:
7 * Description: Small test code for CoreB on a BF561
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/init.h>
31#include <linux/module.h>
32
33static int *testarg = (int *)0xfeb00000;
34
35static int test_init(void)
36{
37 *testarg = 1;
38 printk(KERN_INFO "Dual core test module inserted: set testarg = [%d]\n @ [%p]\n",
39 *testarg, testarg);
40 return 0;
41}
42
43static void test_exit(void)
44{
45 printk(KERN_INFO "Dual core test module removed: testarg = [%d]\n", *testarg);
46}
47
48module_init(test_init);
49module_exit(test_exit);
diff --git a/arch/blackfin/kernel/entry.S b/arch/blackfin/kernel/entry.S
index 65f4e67a65c4..31bd9bf3efae 100644
--- a/arch/blackfin/kernel/entry.S
+++ b/arch/blackfin/kernel/entry.S
@@ -64,6 +64,11 @@ ENDPROC(_ret_from_fork)
64 64
65ENTRY(_sys_fork) 65ENTRY(_sys_fork)
66 r0 = -EINVAL; 66 r0 = -EINVAL;
67#if (ANOMALY_05000371)
68 nop;
69 nop;
70 nop;
71#endif
67 rts; 72 rts;
68ENDPROC(_sys_fork) 73ENDPROC(_sys_fork)
69 74
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c
index a9c15515bfd7..a1f9641a6425 100644
--- a/arch/blackfin/kernel/kgdb.c
+++ b/arch/blackfin/kernel/kgdb.c
@@ -203,6 +203,8 @@ struct hw_breakpoint {
203 203
204int kgdb_arch_init(void) 204int kgdb_arch_init(void)
205{ 205{
206 debugger_step = 0;
207
206 kgdb_remove_all_hw_break(); 208 kgdb_remove_all_hw_break();
207 return 0; 209 return 0;
208} 210}
@@ -368,6 +370,7 @@ int kgdb_arch_handle_exception(int exceptionVector, int signo,
368 char *ptr; 370 char *ptr;
369 int newPC; 371 int newPC;
370 int wp_status; 372 int wp_status;
373 int i;
371 374
372 switch (remcom_in_buffer[0]) { 375 switch (remcom_in_buffer[0]) {
373 case 'c': 376 case 'c':
@@ -392,7 +395,18 @@ int kgdb_arch_handle_exception(int exceptionVector, int signo,
392 /* set the trace bit if we're stepping */ 395 /* set the trace bit if we're stepping */
393 if (remcom_in_buffer[0] == 's') { 396 if (remcom_in_buffer[0] == 's') {
394 linux_regs->syscfg |= 0x1; 397 linux_regs->syscfg |= 0x1;
395 debugger_step = 1; 398 debugger_step = linux_regs->ipend;
399 debugger_step >>= 6;
400 for (i = 10; i > 0; i--, debugger_step >>= 1)
401 if (debugger_step & 1)
402 break;
403 /* i indicate event priority of current stopped instruction
404 * user space instruction is 0, IVG15 is 1, IVTMR is 10.
405 * debugger_step > 0 means in single step mode
406 */
407 debugger_step = i + 1;
408 } else {
409 debugger_step = 0;
396 } 410 }
397 411
398 wp_status = bfin_read_WPSTAT(); 412 wp_status = bfin_read_WPSTAT();
diff --git a/arch/blackfin/kernel/module.c b/arch/blackfin/kernel/module.c
index 14a42848f37f..e1bebc80a5bf 100644
--- a/arch/blackfin/kernel/module.c
+++ b/arch/blackfin/kernel/module.c
@@ -173,7 +173,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
173 for (s = sechdrs; s < sechdrs_end; ++s) { 173 for (s = sechdrs; s < sechdrs_end; ++s) {
174 if ((strcmp(".l1.text", secstrings + s->sh_name) == 0) || 174 if ((strcmp(".l1.text", secstrings + s->sh_name) == 0) ||
175 ((strcmp(".text", secstrings + s->sh_name) == 0) && 175 ((strcmp(".text", secstrings + s->sh_name) == 0) &&
176 (hdr->e_flags & FLG_CODE_IN_L1) && (s->sh_size > 0))) { 176 (hdr->e_flags & EF_BFIN_CODE_IN_L1) && (s->sh_size > 0))) {
177 dest = l1_inst_sram_alloc(s->sh_size); 177 dest = l1_inst_sram_alloc(s->sh_size);
178 mod->arch.text_l1 = dest; 178 mod->arch.text_l1 = dest;
179 if (dest == NULL) { 179 if (dest == NULL) {
@@ -188,7 +188,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
188 } 188 }
189 if ((strcmp(".l1.data", secstrings + s->sh_name) == 0) || 189 if ((strcmp(".l1.data", secstrings + s->sh_name) == 0) ||
190 ((strcmp(".data", secstrings + s->sh_name) == 0) && 190 ((strcmp(".data", secstrings + s->sh_name) == 0) &&
191 (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { 191 (hdr->e_flags & EF_BFIN_DATA_IN_L1) && (s->sh_size > 0))) {
192 dest = l1_data_sram_alloc(s->sh_size); 192 dest = l1_data_sram_alloc(s->sh_size);
193 mod->arch.data_a_l1 = dest; 193 mod->arch.data_a_l1 = dest;
194 if (dest == NULL) { 194 if (dest == NULL) {
@@ -203,7 +203,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
203 } 203 }
204 if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 || 204 if (strcmp(".l1.bss", secstrings + s->sh_name) == 0 ||
205 ((strcmp(".bss", secstrings + s->sh_name) == 0) && 205 ((strcmp(".bss", secstrings + s->sh_name) == 0) &&
206 (hdr->e_flags & FLG_DATA_IN_L1) && (s->sh_size > 0))) { 206 (hdr->e_flags & EF_BFIN_DATA_IN_L1) && (s->sh_size > 0))) {
207 dest = l1_data_sram_alloc(s->sh_size); 207 dest = l1_data_sram_alloc(s->sh_size);
208 mod->arch.bss_a_l1 = dest; 208 mod->arch.bss_a_l1 = dest;
209 if (dest == NULL) { 209 if (dest == NULL) {
@@ -242,6 +242,51 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
242 s->sh_flags &= ~SHF_ALLOC; 242 s->sh_flags &= ~SHF_ALLOC;
243 s->sh_addr = (unsigned long)dest; 243 s->sh_addr = (unsigned long)dest;
244 } 244 }
245 if ((strcmp(".l2.text", secstrings + s->sh_name) == 0) ||
246 ((strcmp(".text", secstrings + s->sh_name) == 0) &&
247 (hdr->e_flags & EF_BFIN_CODE_IN_L2) && (s->sh_size > 0))) {
248 dest = l2_sram_alloc(s->sh_size);
249 mod->arch.text_l2 = dest;
250 if (dest == NULL) {
251 printk(KERN_ERR
252 "module %s: L2 SRAM allocation failed\n",
253 mod->name);
254 return -1;
255 }
256 memcpy(dest, (void *)s->sh_addr, s->sh_size);
257 s->sh_flags &= ~SHF_ALLOC;
258 s->sh_addr = (unsigned long)dest;
259 }
260 if ((strcmp(".l2.data", secstrings + s->sh_name) == 0) ||
261 ((strcmp(".data", secstrings + s->sh_name) == 0) &&
262 (hdr->e_flags & EF_BFIN_DATA_IN_L2) && (s->sh_size > 0))) {
263 dest = l2_sram_alloc(s->sh_size);
264 mod->arch.data_l2 = dest;
265 if (dest == NULL) {
266 printk(KERN_ERR
267 "module %s: L2 SRAM allocation failed\n",
268 mod->name);
269 return -1;
270 }
271 memcpy(dest, (void *)s->sh_addr, s->sh_size);
272 s->sh_flags &= ~SHF_ALLOC;
273 s->sh_addr = (unsigned long)dest;
274 }
275 if (strcmp(".l2.bss", secstrings + s->sh_name) == 0 ||
276 ((strcmp(".bss", secstrings + s->sh_name) == 0) &&
277 (hdr->e_flags & EF_BFIN_DATA_IN_L2) && (s->sh_size > 0))) {
278 dest = l2_sram_alloc(s->sh_size);
279 mod->arch.bss_l2 = dest;
280 if (dest == NULL) {
281 printk(KERN_ERR
282 "module %s: L2 SRAM allocation failed\n",
283 mod->name);
284 return -1;
285 }
286 memset(dest, 0, s->sh_size);
287 s->sh_flags &= ~SHF_ALLOC;
288 s->sh_addr = (unsigned long)dest;
289 }
245 } 290 }
246 return 0; 291 return 0;
247} 292}
@@ -411,9 +456,10 @@ module_finalize(const Elf_Ehdr * hdr,
411 continue; 456 continue;
412 457
413 if ((sechdrs[i].sh_type == SHT_RELA) && 458 if ((sechdrs[i].sh_type == SHT_RELA) &&
414 ((strcmp(".rela.l1.text", secstrings + sechdrs[i].sh_name) == 0) || 459 ((strcmp(".rela.l2.text", secstrings + sechdrs[i].sh_name) == 0) ||
460 (strcmp(".rela.l1.text", secstrings + sechdrs[i].sh_name) == 0) ||
415 ((strcmp(".rela.text", secstrings + sechdrs[i].sh_name) == 0) && 461 ((strcmp(".rela.text", secstrings + sechdrs[i].sh_name) == 0) &&
416 (hdr->e_flags & FLG_CODE_IN_L1)))) { 462 (hdr->e_flags & (EF_BFIN_CODE_IN_L1|EF_BFIN_CODE_IN_L2))))) {
417 apply_relocate_add((Elf_Shdr *) sechdrs, strtab, 463 apply_relocate_add((Elf_Shdr *) sechdrs, strtab,
418 symindex, i, mod); 464 symindex, i, mod);
419 } 465 }
@@ -423,14 +469,12 @@ module_finalize(const Elf_Ehdr * hdr,
423 469
424void module_arch_cleanup(struct module *mod) 470void module_arch_cleanup(struct module *mod)
425{ 471{
426 if (mod->arch.text_l1) 472 l1_inst_sram_free(mod->arch.text_l1);
427 l1_inst_sram_free((void *)mod->arch.text_l1); 473 l1_data_A_sram_free(mod->arch.data_a_l1);
428 if (mod->arch.data_a_l1) 474 l1_data_A_sram_free(mod->arch.bss_a_l1);
429 l1_data_sram_free((void *)mod->arch.data_a_l1); 475 l1_data_B_sram_free(mod->arch.data_b_l1);
430 if (mod->arch.bss_a_l1) 476 l1_data_B_sram_free(mod->arch.bss_b_l1);
431 l1_data_sram_free((void *)mod->arch.bss_a_l1); 477 l2_sram_free(mod->arch.text_l2);
432 if (mod->arch.data_b_l1) 478 l2_sram_free(mod->arch.data_l2);
433 l1_data_B_sram_free((void *)mod->arch.data_b_l1); 479 l2_sram_free(mod->arch.bss_l2);
434 if (mod->arch.bss_b_l1)
435 l1_data_B_sram_free((void *)mod->arch.bss_b_l1);
436} 480}
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c
index f51ab088098e..bf1a51d8e608 100644
--- a/arch/blackfin/kernel/ptrace.c
+++ b/arch/blackfin/kernel/ptrace.c
@@ -220,6 +220,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
220 copied = sizeof(tmp); 220 copied = sizeof(tmp);
221 } else 221 } else
222#endif 222#endif
223#if L1_DATA_A_LENGTH != 0
224 if (addr + add >= L1_DATA_A_START
225 && addr + add + sizeof(tmp) <= L1_DATA_A_START + L1_DATA_A_LENGTH) {
226 memcpy(&tmp, (const void *)(addr + add), sizeof(tmp));
227 copied = sizeof(tmp);
228 } else
229#endif
230#if L1_DATA_B_LENGTH != 0
231 if (addr + add >= L1_DATA_B_START
232 && addr + add + sizeof(tmp) <= L1_DATA_B_START + L1_DATA_B_LENGTH) {
233 memcpy(&tmp, (const void *)(addr + add), sizeof(tmp));
234 copied = sizeof(tmp);
235 } else
236#endif
223 if (addr + add >= FIXED_CODE_START 237 if (addr + add >= FIXED_CODE_START
224 && addr + add + sizeof(tmp) <= FIXED_CODE_END) { 238 && addr + add + sizeof(tmp) <= FIXED_CODE_END) {
225 memcpy(&tmp, (const void *)(addr + add), sizeof(tmp)); 239 memcpy(&tmp, (const void *)(addr + add), sizeof(tmp));
@@ -290,6 +304,20 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
290 copied = sizeof(data); 304 copied = sizeof(data);
291 } else 305 } else
292#endif 306#endif
307#if L1_DATA_A_LENGTH != 0
308 if (addr + add >= L1_DATA_A_START
309 && addr + add + sizeof(data) <= L1_DATA_A_START + L1_DATA_A_LENGTH) {
310 memcpy((void *)(addr + add), &data, sizeof(data));
311 copied = sizeof(data);
312 } else
313#endif
314#if L1_DATA_B_LENGTH != 0
315 if (addr + add >= L1_DATA_B_START
316 && addr + add + sizeof(data) <= L1_DATA_B_START + L1_DATA_B_LENGTH) {
317 memcpy((void *)(addr + add), &data, sizeof(data));
318 copied = sizeof(data);
319 } else
320#endif
293 if (addr + add >= FIXED_CODE_START 321 if (addr + add >= FIXED_CODE_START
294 && addr + add + sizeof(data) <= FIXED_CODE_END) { 322 && addr + add + sizeof(data) <= FIXED_CODE_END) {
295 memcpy((void *)(addr + add), &data, sizeof(data)); 323 memcpy((void *)(addr + add), &data, sizeof(data));
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 8efea004aecb..23e637eb78da 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -104,6 +104,7 @@ void __init bf53x_relocate_l1_mem(void)
104 unsigned long l1_code_length; 104 unsigned long l1_code_length;
105 unsigned long l1_data_a_length; 105 unsigned long l1_data_a_length;
106 unsigned long l1_data_b_length; 106 unsigned long l1_data_b_length;
107 unsigned long l2_length;
107 108
108 l1_code_length = _etext_l1 - _stext_l1; 109 l1_code_length = _etext_l1 - _stext_l1;
109 if (l1_code_length > L1_CODE_LENGTH) 110 if (l1_code_length > L1_CODE_LENGTH)
@@ -129,6 +130,15 @@ void __init bf53x_relocate_l1_mem(void)
129 /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */ 130 /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */
130 dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length + 131 dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length +
131 l1_data_a_length, l1_data_b_length); 132 l1_data_a_length, l1_data_b_length);
133
134#ifdef L2_LENGTH
135 l2_length = _ebss_l2 - _stext_l2;
136 if (l2_length > L2_LENGTH)
137 panic("L2 SRAM Overflow\n");
138
139 /* Copy _stext_l2 to _edata_l2 to L2 SRAM */
140 dma_memcpy(_stext_l2, _l2_lma_start, l2_length);
141#endif
132} 142}
133 143
134/* add_memory_region to memmap */ 144/* add_memory_region to memmap */
@@ -664,11 +674,8 @@ static __init void setup_bootmem_allocator(void)
664}) 674})
665static inline int __init get_mem_size(void) 675static inline int __init get_mem_size(void)
666{ 676{
667#ifdef CONFIG_MEM_SIZE 677#if defined(EBIU_SDBCTL)
668 return CONFIG_MEM_SIZE; 678# if defined(BF561_FAMILY)
669#else
670# if defined(EBIU_SDBCTL)
671# if defined(BF561_FAMILY)
672 int ret = 0; 679 int ret = 0;
673 u32 sdbctl = bfin_read_EBIU_SDBCTL(); 680 u32 sdbctl = bfin_read_EBIU_SDBCTL();
674 ret += EBSZ_TO_MEG(sdbctl >> 0); 681 ret += EBSZ_TO_MEG(sdbctl >> 0);
@@ -676,10 +683,10 @@ static inline int __init get_mem_size(void)
676 ret += EBSZ_TO_MEG(sdbctl >> 16); 683 ret += EBSZ_TO_MEG(sdbctl >> 16);
677 ret += EBSZ_TO_MEG(sdbctl >> 24); 684 ret += EBSZ_TO_MEG(sdbctl >> 24);
678 return ret; 685 return ret;
679# else 686# else
680 return EBSZ_TO_MEG(bfin_read_EBIU_SDBCTL()); 687 return EBSZ_TO_MEG(bfin_read_EBIU_SDBCTL());
681# endif 688# endif
682# elif defined(EBIU_DDRCTL1) 689#elif defined(EBIU_DDRCTL1)
683 u32 ddrctl = bfin_read_EBIU_DDRCTL1(); 690 u32 ddrctl = bfin_read_EBIU_DDRCTL1();
684 int ret = 0; 691 int ret = 0;
685 switch (ddrctl & 0xc0000) { 692 switch (ddrctl & 0xc0000) {
@@ -693,8 +700,9 @@ static inline int __init get_mem_size(void)
693 case DEVWD_8: ret *= 2; 700 case DEVWD_8: ret *= 2;
694 case DEVWD_16: break; 701 case DEVWD_16: break;
695 } 702 }
703 if ((ddrctl & 0xc000) == 0x4000)
704 ret *= 2;
696 return ret; 705 return ret;
697# endif
698#endif 706#endif
699 BUG(); 707 BUG();
700} 708}
@@ -763,6 +771,9 @@ void __init setup_arch(char **cmdline_p)
763 771
764 _bfin_swrst = bfin_read_SWRST(); 772 _bfin_swrst = bfin_read_SWRST();
765 773
774 /* If we double fault, reset the system - otherwise we hang forever */
775 bfin_write_SWRST(DOUBLE_FAULT);
776
766 if (_bfin_swrst & RESET_DOUBLE) 777 if (_bfin_swrst & RESET_DOUBLE)
767 printk(KERN_INFO "Recovering from Double Fault event\n"); 778 printk(KERN_INFO "Recovering from Double Fault event\n");
768 else if (_bfin_swrst & RESET_WDOG) 779 else if (_bfin_swrst & RESET_WDOG)
@@ -842,38 +853,55 @@ static int __init topology_init(void)
842 853
843subsys_initcall(topology_init); 854subsys_initcall(topology_init);
844 855
856/* Get the voltage input multiplier */
857static u_long cached_vco_pll_ctl, cached_vco;
845static u_long get_vco(void) 858static u_long get_vco(void)
846{ 859{
847 u_long msel; 860 u_long msel;
848 u_long vco;
849 861
850 msel = (bfin_read_PLL_CTL() >> 9) & 0x3F; 862 u_long pll_ctl = bfin_read_PLL_CTL();
863 if (pll_ctl == cached_vco_pll_ctl)
864 return cached_vco;
865 else
866 cached_vco_pll_ctl = pll_ctl;
867
868 msel = (pll_ctl >> 9) & 0x3F;
851 if (0 == msel) 869 if (0 == msel)
852 msel = 64; 870 msel = 64;
853 871
854 vco = CONFIG_CLKIN_HZ; 872 cached_vco = CONFIG_CLKIN_HZ;
855 vco >>= (1 & bfin_read_PLL_CTL()); /* DF bit */ 873 cached_vco >>= (1 & pll_ctl); /* DF bit */
856 vco = msel * vco; 874 cached_vco *= msel;
857 return vco; 875 return cached_vco;
858} 876}
859 877
860/* Get the Core clock */ 878/* Get the Core clock */
879static u_long cached_cclk_pll_div, cached_cclk;
861u_long get_cclk(void) 880u_long get_cclk(void)
862{ 881{
863 u_long csel, ssel; 882 u_long csel, ssel;
883
864 if (bfin_read_PLL_STAT() & 0x1) 884 if (bfin_read_PLL_STAT() & 0x1)
865 return CONFIG_CLKIN_HZ; 885 return CONFIG_CLKIN_HZ;
866 886
867 ssel = bfin_read_PLL_DIV(); 887 ssel = bfin_read_PLL_DIV();
888 if (ssel == cached_cclk_pll_div)
889 return cached_cclk;
890 else
891 cached_cclk_pll_div = ssel;
892
868 csel = ((ssel >> 4) & 0x03); 893 csel = ((ssel >> 4) & 0x03);
869 ssel &= 0xf; 894 ssel &= 0xf;
870 if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */ 895 if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */
871 return get_vco() / ssel; 896 cached_cclk = get_vco() / ssel;
872 return get_vco() >> csel; 897 else
898 cached_cclk = get_vco() >> csel;
899 return cached_cclk;
873} 900}
874EXPORT_SYMBOL(get_cclk); 901EXPORT_SYMBOL(get_cclk);
875 902
876/* Get the System clock */ 903/* Get the System clock */
904static u_long cached_sclk_pll_div, cached_sclk;
877u_long get_sclk(void) 905u_long get_sclk(void)
878{ 906{
879 u_long ssel; 907 u_long ssel;
@@ -881,13 +909,20 @@ u_long get_sclk(void)
881 if (bfin_read_PLL_STAT() & 0x1) 909 if (bfin_read_PLL_STAT() & 0x1)
882 return CONFIG_CLKIN_HZ; 910 return CONFIG_CLKIN_HZ;
883 911
884 ssel = (bfin_read_PLL_DIV() & 0xf); 912 ssel = bfin_read_PLL_DIV();
913 if (ssel == cached_sclk_pll_div)
914 return cached_sclk;
915 else
916 cached_sclk_pll_div = ssel;
917
918 ssel &= 0xf;
885 if (0 == ssel) { 919 if (0 == ssel) {
886 printk(KERN_WARNING "Invalid System Clock\n"); 920 printk(KERN_WARNING "Invalid System Clock\n");
887 ssel = 1; 921 ssel = 1;
888 } 922 }
889 923
890 return get_vco() / ssel; 924 cached_sclk = get_vco() / ssel;
925 return cached_sclk;
891} 926}
892EXPORT_SYMBOL(get_sclk); 927EXPORT_SYMBOL(get_sclk);
893 928
@@ -916,7 +951,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
916 uint32_t revid; 951 uint32_t revid;
917 952
918 u_long cclk = 0, sclk = 0; 953 u_long cclk = 0, sclk = 0;
919 u_int dcache_size = 0, dsup_banks = 0; 954 u_int icache_size = BFIN_ICACHESIZE / 1024, dcache_size = 0, dsup_banks = 0;
920 955
921 cpu = CPU; 956 cpu = CPU;
922 mmu = "none"; 957 mmu = "none";
@@ -985,12 +1020,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
985 } 1020 }
986 1021
987 /* Is it turned on? */ 1022 /* Is it turned on? */
988 if (!((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE))) 1023 if ((bfin_read_DMEM_CONTROL() & (ENDCPLB | DMC_ENABLE)) != (ENDCPLB | DMC_ENABLE))
989 dcache_size = 0; 1024 dcache_size = 0;
990 1025
1026 if ((bfin_read_IMEM_CONTROL() & (IMC | ENICPLB)) == (IMC | ENICPLB))
1027 icache_size = 0;
1028
991 seq_printf(m, "cache size\t: %d KB(L1 icache) " 1029 seq_printf(m, "cache size\t: %d KB(L1 icache) "
992 "%d KB(L1 dcache-%s) %d KB(L2 cache)\n", 1030 "%d KB(L1 dcache-%s) %d KB(L2 cache)\n",
993 BFIN_ICACHESIZE / 1024, dcache_size, 1031 icache_size, dcache_size,
994#if defined CONFIG_BFIN_WB 1032#if defined CONFIG_BFIN_WB
995 "wb" 1033 "wb"
996#elif defined CONFIG_BFIN_WT 1034#elif defined CONFIG_BFIN_WT
@@ -1000,8 +1038,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1000 1038
1001 seq_printf(m, "%s\n", cache); 1039 seq_printf(m, "%s\n", cache);
1002 1040
1003 seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n", 1041 if (icache_size)
1004 BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES); 1042 seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n",
1043 BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES);
1044 else
1045 seq_printf(m, "icache setup\t: off\n");
1046
1005 seq_printf(m, 1047 seq_printf(m,
1006 "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n", 1048 "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
1007 dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, 1049 dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS,
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index f061f5181623..ad922ab91543 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -69,8 +69,6 @@ void __init trap_init(void)
69 69
70unsigned long saved_icplb_fault_addr, saved_dcplb_fault_addr; 70unsigned long saved_icplb_fault_addr, saved_dcplb_fault_addr;
71 71
72int kstack_depth_to_print = 48;
73
74static void decode_address(char *buf, unsigned long address) 72static void decode_address(char *buf, unsigned long address)
75{ 73{
76 struct vm_list_struct *vml; 74 struct vm_list_struct *vml;
@@ -163,6 +161,9 @@ static void decode_address(char *buf, unsigned long address)
163 if (!in_atomic) 161 if (!in_atomic)
164 mmput(mm); 162 mmput(mm);
165 163
164 if (!strlen(buf))
165 sprintf(buf, "<0x%p> [ %s ] dynamic memory", (void *)address, name);
166
166 goto done; 167 goto done;
167 } 168 }
168 169
@@ -173,7 +174,7 @@ static void decode_address(char *buf, unsigned long address)
173 } 174 }
174 175
175 /* we were unable to find this address anywhere */ 176 /* we were unable to find this address anywhere */
176 sprintf(buf, "<0x%p> /* unknown address */", (void *)address); 177 sprintf(buf, "<0x%p> /* kernel dynamic memory */", (void *)address);
177 178
178done: 179done:
179 write_unlock_irqrestore(&tasklist_lock, flags); 180 write_unlock_irqrestore(&tasklist_lock, flags);
@@ -494,7 +495,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
494 BUG_ON(sig == 0); 495 BUG_ON(sig == 0);
495 496
496 if (sig != SIGTRAP) { 497 if (sig != SIGTRAP) {
497 unsigned long stack; 498 unsigned long *stack;
498 dump_bfin_process(fp); 499 dump_bfin_process(fp);
499 dump_bfin_mem(fp); 500 dump_bfin_mem(fp);
500 show_regs(fp); 501 show_regs(fp);
@@ -508,14 +509,23 @@ asmlinkage void trap_c(struct pt_regs *fp)
508 else 509 else
509#endif 510#endif
510 dump_bfin_trace_buffer(); 511 dump_bfin_trace_buffer();
511 show_stack(current, &stack); 512
512 if (oops_in_progress) { 513 if (oops_in_progress) {
514 /* Dump the current kernel stack */
515 printk(KERN_NOTICE "\n" KERN_NOTICE "Kernel Stack\n");
516 show_stack(current, NULL);
517
513 print_modules(); 518 print_modules();
514#ifndef CONFIG_ACCESS_CHECK 519#ifndef CONFIG_ACCESS_CHECK
515 printk(KERN_EMERG "Please turn on " 520 printk(KERN_EMERG "Please turn on "
516 "CONFIG_ACCESS_CHECK\n"); 521 "CONFIG_ACCESS_CHECK\n");
517#endif 522#endif
518 panic("Kernel exception"); 523 panic("Kernel exception");
524 } else {
525 /* Dump the user space stack */
526 stack = (unsigned long *)rdusp();
527 printk(KERN_NOTICE "Userspace Stack\n");
528 show_stack(NULL, stack);
519 } 529 }
520 } 530 }
521 531
@@ -532,11 +542,71 @@ asmlinkage void trap_c(struct pt_regs *fp)
532 542
533#define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1) 543#define EXPAND_LEN ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN) * 256 - 1)
534 544
545/*
546 * Similar to get_user, do some address checking, then dereference
547 * Return true on sucess, false on bad address
548 */
549bool get_instruction(unsigned short *val, unsigned short *address)
550{
551
552 unsigned long addr;
553
554 addr = (unsigned long)address;
555
556 /* Check for odd addresses */
557 if (addr & 0x1)
558 return false;
559
560 /* Check that things do not wrap around */
561 if (addr > (addr + 2))
562 return false;
563
564 /*
565 * Since we are in exception context, we need to do a little address checking
566 * We need to make sure we are only accessing valid memory, and
567 * we don't read something in the async space that can hang forever
568 */
569 if ((addr >= FIXED_CODE_START && (addr + 2) <= physical_mem_end) ||
570#ifdef L2_START
571 (addr >= L2_START && (addr + 2) <= (L2_START + L2_LENGTH)) ||
572#endif
573 (addr >= BOOT_ROM_START && (addr + 2) <= (BOOT_ROM_START + BOOT_ROM_LENGTH)) ||
574#if L1_DATA_A_LENGTH != 0
575 (addr >= L1_DATA_A_START && (addr + 2) <= (L1_DATA_A_START + L1_DATA_A_LENGTH)) ||
576#endif
577#if L1_DATA_B_LENGTH != 0
578 (addr >= L1_DATA_B_START && (addr + 2) <= (L1_DATA_B_START + L1_DATA_B_LENGTH)) ||
579#endif
580 (addr >= L1_SCRATCH_START && (addr + 2) <= (L1_SCRATCH_START + L1_SCRATCH_LENGTH)) ||
581 (!(bfin_read_EBIU_AMBCTL0() & B0RDYEN) &&
582 addr >= ASYNC_BANK0_BASE && (addr + 2) <= (ASYNC_BANK0_BASE + ASYNC_BANK0_SIZE)) ||
583 (!(bfin_read_EBIU_AMBCTL0() & B1RDYEN) &&
584 addr >= ASYNC_BANK1_BASE && (addr + 2) <= (ASYNC_BANK1_BASE + ASYNC_BANK1_SIZE)) ||
585 (!(bfin_read_EBIU_AMBCTL1() & B2RDYEN) &&
586 addr >= ASYNC_BANK2_BASE && (addr + 2) <= (ASYNC_BANK2_BASE + ASYNC_BANK1_SIZE)) ||
587 (!(bfin_read_EBIU_AMBCTL1() & B3RDYEN) &&
588 addr >= ASYNC_BANK3_BASE && (addr + 2) <= (ASYNC_BANK3_BASE + ASYNC_BANK1_SIZE))) {
589 *val = *address;
590 return true;
591 }
592
593#if L1_CODE_LENGTH != 0
594 if (addr >= L1_CODE_START && (addr + 2) <= (L1_CODE_START + L1_CODE_LENGTH)) {
595 dma_memcpy(val, address, 2);
596 return true;
597 }
598#endif
599
600
601 return false;
602}
603
535void dump_bfin_trace_buffer(void) 604void dump_bfin_trace_buffer(void)
536{ 605{
537#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON 606#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
538 int tflags, i = 0; 607 int tflags, i = 0;
539 char buf[150]; 608 char buf[150];
609 unsigned short val = 0, *addr;
540#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND 610#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
541 int j, index; 611 int j, index;
542#endif 612#endif
@@ -549,8 +619,42 @@ void dump_bfin_trace_buffer(void)
549 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) { 619 for (; bfin_read_TBUFSTAT() & TBUFCNT; i++) {
550 decode_address(buf, (unsigned long)bfin_read_TBUF()); 620 decode_address(buf, (unsigned long)bfin_read_TBUF());
551 printk(KERN_NOTICE "%4i Target : %s\n", i, buf); 621 printk(KERN_NOTICE "%4i Target : %s\n", i, buf);
552 decode_address(buf, (unsigned long)bfin_read_TBUF()); 622 addr = (unsigned short *)bfin_read_TBUF();
553 printk(KERN_NOTICE " Source : %s\n", buf); 623 decode_address(buf, (unsigned long)addr);
624 printk(KERN_NOTICE " Source : %s ", buf);
625 if (get_instruction(&val, addr)) {
626 if (val == 0x0010)
627 printk("RTS");
628 else if (val == 0x0011)
629 printk("RTI");
630 else if (val == 0x0012)
631 printk("RTX");
632 else if (val >= 0x0050 && val <= 0x0057)
633 printk("JUMP (P%i)", val & 7);
634 else if (val >= 0x0060 && val <= 0x0067)
635 printk("CALL (P%i)", val & 7);
636 else if (val >= 0x0070 && val <= 0x0077)
637 printk("CALL (PC+P%i)", val & 7);
638 else if (val >= 0x0080 && val <= 0x0087)
639 printk("JUMP (PC+P%i)", val & 7);
640 else if ((val >= 0x1000 && val <= 0x13FF) ||
641 (val >= 0x1800 && val <= 0x1BFF))
642 printk("IF !CC JUMP");
643 else if ((val >= 0x1400 && val <= 0x17ff) ||
644 (val >= 0x1c00 && val <= 0x1fff))
645 printk("IF CC JUMP");
646 else if (val >= 0x2000 && val <= 0x2fff)
647 printk("JUMP.S");
648 else if (val >= 0xe080 && val <= 0xe0ff)
649 printk("LSETUP");
650 else if (val >= 0xe200 && val <= 0xe2ff)
651 printk("JUMP.L");
652 else if (val >= 0xe300 && val <= 0xe3ff)
653 printk("CALL pcrel");
654 else
655 printk("0x%04x", val);
656 }
657 printk("\n");
554 } 658 }
555 } 659 }
556 660
@@ -582,59 +686,151 @@ void dump_bfin_trace_buffer(void)
582} 686}
583EXPORT_SYMBOL(dump_bfin_trace_buffer); 687EXPORT_SYMBOL(dump_bfin_trace_buffer);
584 688
585static void show_trace(struct task_struct *tsk, unsigned long *sp) 689/*
690 * Checks to see if the address pointed to is either a
691 * 16-bit CALL instruction, or a 32-bit CALL instruction
692 */
693bool is_bfin_call(unsigned short *addr)
586{ 694{
587 unsigned long addr; 695 unsigned short opcode = 0, *ins_addr;
696 ins_addr = (unsigned short *)addr;
588 697
589 printk(KERN_NOTICE "\n" KERN_NOTICE "Call Trace:\n"); 698 if (!get_instruction(&opcode, ins_addr))
590 699 return false;
591 while (!kstack_end(sp)) {
592 addr = *sp++;
593 /*
594 * If the address is either in the text segment of the
595 * kernel, or in the region which contains vmalloc'ed
596 * memory, it *may* be the address of a calling
597 * routine; if so, print it so that someone tracing
598 * down the cause of the crash will be able to figure
599 * out the call path that was taken.
600 */
601 if (kernel_text_address(addr))
602 print_ip_sym(addr);
603 }
604 700
605 printk(KERN_NOTICE "\n"); 701 if ((opcode >= 0x0060 && opcode <= 0x0067) ||
606} 702 (opcode >= 0x0070 && opcode <= 0x0077))
703 return true;
704
705 ins_addr--;
706 if (!get_instruction(&opcode, ins_addr))
707 return false;
607 708
709 if (opcode >= 0xE300 && opcode <= 0xE3FF)
710 return true;
711
712 return false;
713
714}
608void show_stack(struct task_struct *task, unsigned long *stack) 715void show_stack(struct task_struct *task, unsigned long *stack)
609{ 716{
610 unsigned long *endstack, addr; 717 unsigned int *addr, *endstack, *fp = 0, *frame;
611 int i; 718 unsigned short *ins_addr;
719 char buf[150];
720 unsigned int i, j, ret_addr, frame_no = 0;
612 721
613 /* Cannot call dump_bfin_trace_buffer() here as show_stack() is 722 /*
614 * called externally in some places in the kernel. 723 * If we have been passed a specific stack, use that one otherwise
724 * if we have been passed a task structure, use that, otherwise
725 * use the stack of where the variable "stack" exists
615 */ 726 */
616 727
617 if (!stack) { 728 if (stack == NULL) {
618 if (task) 729 if (task) {
730 /* We know this is a kernel stack, so this is the start/end */
619 stack = (unsigned long *)task->thread.ksp; 731 stack = (unsigned long *)task->thread.ksp;
620 else 732 endstack = (unsigned int *)(((unsigned int)(stack) & ~(THREAD_SIZE - 1)) + THREAD_SIZE);
733 } else {
734 /* print out the existing stack info */
621 stack = (unsigned long *)&stack; 735 stack = (unsigned long *)&stack;
736 endstack = (unsigned int *)PAGE_ALIGN((unsigned int)stack);
737 }
738 } else
739 endstack = (unsigned int *)PAGE_ALIGN((unsigned int)stack);
740
741 decode_address(buf, (unsigned int)stack);
742 printk(KERN_NOTICE "Stack info:\n" KERN_NOTICE " SP: [0x%p] %s\n", stack, buf);
743 addr = (unsigned int *)((unsigned int)stack & ~0x3F);
744
745 /* First thing is to look for a frame pointer */
746 for (addr = (unsigned int *)((unsigned int)stack & ~0xF), i = 0;
747 addr < endstack; addr++, i++) {
748 if (*addr & 0x1)
749 continue;
750 ins_addr = (unsigned short *)*addr;
751 ins_addr--;
752 if (is_bfin_call(ins_addr))
753 fp = addr - 1;
754
755 if (fp) {
756 /* Let's check to see if it is a frame pointer */
757 while (fp >= (addr - 1) && fp < endstack && fp)
758 fp = (unsigned int *)*fp;
759 if (fp == 0 || fp == endstack) {
760 fp = addr - 1;
761 break;
762 }
763 fp = 0;
764 }
622 } 765 }
766 if (fp) {
767 frame = fp;
768 printk(" FP: (0x%p)\n", fp);
769 } else
770 frame = 0;
623 771
624 addr = (unsigned long)stack; 772 /*
625 endstack = (unsigned long *)PAGE_ALIGN(addr); 773 * Now that we think we know where things are, we
774 * walk the stack again, this time printing things out
775 * incase there is no frame pointer, we still look for
776 * valid return addresses
777 */
626 778
627 printk(KERN_NOTICE "Stack from %08lx:", (unsigned long)stack); 779 /* First time print out data, next time, print out symbols */
628 for (i = 0; i < kstack_depth_to_print; i++) { 780 for (j = 0; j <= 1; j++) {
629 if (stack + 1 > endstack) 781 if (j)
630 break; 782 printk(KERN_NOTICE "Return addresses in stack:\n");
631 if (i % 8 == 0) 783 else
632 printk("\n" KERN_NOTICE " "); 784 printk(KERN_NOTICE " Memory from 0x%08lx to %p", ((long unsigned int)stack & ~0xF), endstack);
633 printk(" %08lx", *stack++); 785
786 fp = frame;
787 frame_no = 0;
788
789 for (addr = (unsigned int *)((unsigned int)stack & ~0xF), i = 0;
790 addr <= endstack; addr++, i++) {
791
792 ret_addr = 0;
793 if (!j && i % 8 == 0)
794 printk("\n" KERN_NOTICE "%p:",addr);
795
796 /* if it is an odd address, or zero, just skip it */
797 if (*addr & 0x1 || !*addr)
798 goto print;
799
800 ins_addr = (unsigned short *)*addr;
801
802 /* Go back one instruction, and see if it is a CALL */
803 ins_addr--;
804 ret_addr = is_bfin_call(ins_addr);
805 print:
806 if (!j && stack == (unsigned long *)addr)
807 printk("[%08x]", *addr);
808 else if (ret_addr)
809 if (j) {
810 decode_address(buf, (unsigned int)*addr);
811 if (frame == addr) {
812 printk(KERN_NOTICE " frame %2i : %s\n", frame_no, buf);
813 continue;
814 }
815 printk(KERN_NOTICE " address : %s\n", buf);
816 } else
817 printk("<%08x>", *addr);
818 else if (fp == addr) {
819 if (j)
820 frame = addr+1;
821 else
822 printk("(%08x)", *addr);
823
824 fp = (unsigned int *)*addr;
825 frame_no++;
826
827 } else if (!j)
828 printk(" %08x ", *addr);
829 }
830 if (!j)
831 printk("\n");
634 } 832 }
635 printk("\n");
636 833
637 show_trace(task, stack);
638} 834}
639 835
640void dump_stack(void) 836void dump_stack(void)
@@ -715,19 +911,9 @@ void dump_bfin_mem(struct pt_regs *fp)
715 if (!((unsigned long)addr & 0xF)) 911 if (!((unsigned long)addr & 0xF))
716 printk("\n" KERN_NOTICE "0x%p: ", addr); 912 printk("\n" KERN_NOTICE "0x%p: ", addr);
717 913
718 if (get_user(val, addr)) { 914 if (get_instruction(&val, addr)) {
719 if (addr >= (unsigned short *)L1_CODE_START &&
720 addr < (unsigned short *)(L1_CODE_START + L1_CODE_LENGTH)) {
721 dma_memcpy(&val, addr, sizeof(val));
722 sprintf(buf, "%04x", val);
723 } else if (addr >= (unsigned short *)FIXED_CODE_START &&
724 addr <= (unsigned short *)memory_start) {
725 val = bfin_read16(addr);
726 sprintf(buf, "%04x", val);
727 } else {
728 val = 0; 915 val = 0;
729 sprintf(buf, "????"); 916 sprintf(buf, "????");
730 }
731 } else 917 } else
732 sprintf(buf, "%04x", val); 918 sprintf(buf, "%04x", val);
733 919
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 3ecc64cab3be..0896e38d6108 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -101,6 +101,11 @@ SECTIONS
101#if !L1_DATA_B_LENGTH 101#if !L1_DATA_B_LENGTH
102 *(.l1.data.B) 102 *(.l1.data.B)
103#endif 103#endif
104#ifndef L2_LENGTH
105 . = ALIGN(32);
106 *(.data_l2.cacheline_aligned)
107 *(.l2.data)
108#endif
104 109
105 DATA_DATA 110 DATA_DATA
106 *(.data.*) 111 *(.data.*)
@@ -182,14 +187,13 @@ SECTIONS
182 *(.l1.data) 187 *(.l1.data)
183 __edata_l1 = .; 188 __edata_l1 = .;
184 189
185 . = ALIGN(4);
186 __sbss_l1 = .;
187 *(.l1.bss)
188
189 . = ALIGN(32); 190 . = ALIGN(32);
190 *(.data_l1.cacheline_aligned) 191 *(.data_l1.cacheline_aligned)
191 192
192 . = ALIGN(4); 193 . = ALIGN(4);
194 __sbss_l1 = .;
195 *(.l1.bss)
196 . = ALIGN(4);
193 __ebss_l1 = .; 197 __ebss_l1 = .;
194 } 198 }
195 199
@@ -203,11 +207,37 @@ SECTIONS
203 . = ALIGN(4); 207 . = ALIGN(4);
204 __sbss_b_l1 = .; 208 __sbss_b_l1 = .;
205 *(.l1.bss.B) 209 *(.l1.bss.B)
206
207 . = ALIGN(4); 210 . = ALIGN(4);
208 __ebss_b_l1 = .; 211 __ebss_b_l1 = .;
209 } 212 }
210 213
214#ifdef L2_LENGTH
215 __l2_lma_start = .;
216
217 .text_data_l2 L2_START : AT(LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1))
218 {
219 . = ALIGN(4);
220 __stext_l2 = .;
221 *(.l1.text)
222 . = ALIGN(4);
223 __etext_l2 = .;
224
225 . = ALIGN(4);
226 __sdata_l2 = .;
227 *(.l1.data)
228 __edata_l2 = .;
229
230 . = ALIGN(32);
231 *(.data_l2.cacheline_aligned)
232
233 . = ALIGN(4);
234 __sbss_l2 = .;
235 *(.l1.bss)
236 . = ALIGN(4);
237 __ebss_l2 = .;
238 }
239#endif
240
211 /* Force trailing alignment of our init section so that when we 241 /* Force trailing alignment of our init section so that when we
212 * free our init memory, we don't leave behind a partial page. 242 * free our init memory, we don't leave behind a partial page.
213 */ 243 */
diff --git a/arch/blackfin/mach-bf527/boards/Kconfig b/arch/blackfin/mach-bf527/boards/Kconfig
index 6a570ad03746..8bf9e58f0148 100644
--- a/arch/blackfin/mach-bf527/boards/Kconfig
+++ b/arch/blackfin/mach-bf527/boards/Kconfig
@@ -9,4 +9,9 @@ config BFIN527_EZKIT
9 help 9 help
10 BF527-EZKIT-LITE board support. 10 BF527-EZKIT-LITE board support.
11 11
12config BFIN527_BLUETECHNIX_CM
13 bool "Bluetechnix CM-BF527"
14 help
15 CM-BF527 support for EVAL- and DEV-Board.
16
12endchoice 17endchoice
diff --git a/arch/blackfin/mach-bf527/boards/Makefile b/arch/blackfin/mach-bf527/boards/Makefile
index 7277d35ef111..7ba7d256bbb8 100644
--- a/arch/blackfin/mach-bf527/boards/Makefile
+++ b/arch/blackfin/mach-bf527/boards/Makefile
@@ -3,3 +3,4 @@
3# 3#
4 4
5obj-$(CONFIG_BFIN527_EZKIT) += ezkit.o 5obj-$(CONFIG_BFIN527_EZKIT) += ezkit.o
6obj-$(CONFIG_BFIN527_BLUETECHNIX_CM) += cm_bf527.o
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
new file mode 100644
index 000000000000..0b26ae2de5ee
--- /dev/null
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -0,0 +1,1011 @@
1/*
2 * File: arch/blackfin/mach-bf527/boards/cm-bf527.c
3 * Based on: arch/blackfin/mach-bf537/boards/stamp.c
4 * Author: Aidan Williams <aidan@nicta.com.au>
5 *
6 * Created:
7 * Description:
8 *
9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2008 Analog Devices Inc.
12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 */
30
31#include <linux/device.h>
32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h>
35#include <linux/mtd/physmap.h>
36#include <linux/spi/spi.h>
37#include <linux/spi/flash.h>
38#include <linux/etherdevice.h>
39#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
40#include <linux/usb/isp1362.h>
41#endif
42#include <linux/pata_platform.h>
43#include <linux/i2c.h>
44#include <linux/irq.h>
45#include <linux/interrupt.h>
46#include <linux/usb/sl811.h>
47#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
48#include <linux/usb/musb.h>
49#endif
50#include <asm/cplb.h>
51#include <asm/dma.h>
52#include <asm/bfin5xx_spi.h>
53#include <asm/reboot.h>
54#include <asm/nand.h>
55#include <asm/portmux.h>
56#include <asm/dpmc.h>
57#include <linux/spi/ad7877.h>
58
59/*
60 * Name the Board for the /proc/cpuinfo
61 */
62const char bfin_board_name[] = "Bluetechnix CM-BF527";
63
64/*
65 * Driver needs to know address, irq and flag pin.
66 */
67
68#define ISP1761_BASE 0x203C0000
69#define ISP1761_IRQ IRQ_PF7
70
71#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
72static struct resource bfin_isp1761_resources[] = {
73 [0] = {
74 .name = "isp1761-regs",
75 .start = ISP1761_BASE + 0x00000000,
76 .end = ISP1761_BASE + 0x000fffff,
77 .flags = IORESOURCE_MEM,
78 },
79 [1] = {
80 .start = ISP1761_IRQ,
81 .end = ISP1761_IRQ,
82 .flags = IORESOURCE_IRQ,
83 },
84};
85
86static struct platform_device bfin_isp1761_device = {
87 .name = "isp1761",
88 .id = 0,
89 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
90 .resource = bfin_isp1761_resources,
91};
92
93static struct platform_device *bfin_isp1761_devices[] = {
94 &bfin_isp1761_device,
95};
96
97int __init bfin_isp1761_init(void)
98{
99 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
100
101 printk(KERN_INFO "%s(): registering device resources\n", __func__);
102 set_irq_type(ISP1761_IRQ, IRQF_TRIGGER_FALLING);
103
104 return platform_add_devices(bfin_isp1761_devices, num_devices);
105}
106
107void __exit bfin_isp1761_exit(void)
108{
109 platform_device_unregister(&bfin_isp1761_device);
110}
111
112arch_initcall(bfin_isp1761_init);
113#endif
114
115#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
116static struct resource musb_resources[] = {
117 [0] = {
118 .start = 0xffc03800,
119 .end = 0xffc03cff,
120 .flags = IORESOURCE_MEM,
121 },
122 [1] = { /* general IRQ */
123 .start = IRQ_USB_INT0,
124 .end = IRQ_USB_INT0,
125 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
126 },
127 [2] = { /* DMA IRQ */
128 .start = IRQ_USB_DMA,
129 .end = IRQ_USB_DMA,
130 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
131 },
132};
133
134static struct musb_hdrc_platform_data musb_plat = {
135#if defined(CONFIG_USB_MUSB_OTG)
136 .mode = MUSB_OTG,
137#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
138 .mode = MUSB_HOST,
139#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
140 .mode = MUSB_PERIPHERAL,
141#endif
142 .multipoint = 0,
143};
144
145static u64 musb_dmamask = ~(u32)0;
146
147static struct platform_device musb_device = {
148 .name = "musb_hdrc",
149 .id = 0,
150 .dev = {
151 .dma_mask = &musb_dmamask,
152 .coherent_dma_mask = 0xffffffff,
153 .platform_data = &musb_plat,
154 },
155 .num_resources = ARRAY_SIZE(musb_resources),
156 .resource = musb_resources,
157};
158#endif
159
160#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
161static struct mtd_partition ezkit_partitions[] = {
162 {
163 .name = "Bootloader",
164 .size = 0x40000,
165 .offset = 0,
166 }, {
167 .name = "Kernel",
168 .size = 0x1C0000,
169 .offset = MTDPART_OFS_APPEND,
170 }, {
171 .name = "RootFS",
172 .size = MTDPART_SIZ_FULL,
173 .offset = MTDPART_OFS_APPEND,
174 }
175};
176
177static struct physmap_flash_data ezkit_flash_data = {
178 .width = 2,
179 .parts = ezkit_partitions,
180 .nr_parts = ARRAY_SIZE(ezkit_partitions),
181};
182
183static struct resource ezkit_flash_resource = {
184 .start = 0x20000000,
185 .end = 0x201fffff,
186 .flags = IORESOURCE_MEM,
187};
188
189static struct platform_device ezkit_flash_device = {
190 .name = "physmap-flash",
191 .id = 0,
192 .dev = {
193 .platform_data = &ezkit_flash_data,
194 },
195 .num_resources = 1,
196 .resource = &ezkit_flash_resource,
197};
198#endif
199
200#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
201static struct mtd_partition partition_info[] = {
202 {
203 .name = "Linux Kernel",
204 .offset = 0,
205 .size = 4 * SIZE_1M,
206 },
207 {
208 .name = "File System",
209 .offset = MTDPART_OFS_APPEND,
210 .size = MTDPART_SIZ_FULL,
211 },
212};
213
214static struct bf5xx_nand_platform bf5xx_nand_platform = {
215 .page_size = NFC_PG_SIZE_256,
216 .data_width = NFC_NWIDTH_8,
217 .partitions = partition_info,
218 .nr_partitions = ARRAY_SIZE(partition_info),
219 .rd_dly = 3,
220 .wr_dly = 3,
221};
222
223static struct resource bf5xx_nand_resources[] = {
224 {
225 .start = NFC_CTL,
226 .end = NFC_DATA_RD + 2,
227 .flags = IORESOURCE_MEM,
228 },
229 {
230 .start = CH_NFC,
231 .end = CH_NFC,
232 .flags = IORESOURCE_IRQ,
233 },
234};
235
236static struct platform_device bf5xx_nand_device = {
237 .name = "bf5xx-nand",
238 .id = 0,
239 .num_resources = ARRAY_SIZE(bf5xx_nand_resources),
240 .resource = bf5xx_nand_resources,
241 .dev = {
242 .platform_data = &bf5xx_nand_platform,
243 },
244};
245#endif
246
247#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
248static struct resource bfin_pcmcia_cf_resources[] = {
249 {
250 .start = 0x20310000, /* IO PORT */
251 .end = 0x20312000,
252 .flags = IORESOURCE_MEM,
253 }, {
254 .start = 0x20311000, /* Attribute Memory */
255 .end = 0x20311FFF,
256 .flags = IORESOURCE_MEM,
257 }, {
258 .start = IRQ_PF4,
259 .end = IRQ_PF4,
260 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
261 }, {
262 .start = 6, /* Card Detect PF6 */
263 .end = 6,
264 .flags = IORESOURCE_IRQ,
265 },
266};
267
268static struct platform_device bfin_pcmcia_cf_device = {
269 .name = "bfin_cf_pcmcia",
270 .id = -1,
271 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
272 .resource = bfin_pcmcia_cf_resources,
273};
274#endif
275
276#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
277static struct platform_device rtc_device = {
278 .name = "rtc-bfin",
279 .id = -1,
280};
281#endif
282
283#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
284static struct resource smc91x_resources[] = {
285 {
286 .name = "smc91x-regs",
287 .start = 0x20300300,
288 .end = 0x20300300 + 16,
289 .flags = IORESOURCE_MEM,
290 }, {
291
292 .start = IRQ_PF7,
293 .end = IRQ_PF7,
294 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
295 },
296};
297static struct platform_device smc91x_device = {
298 .name = "smc91x",
299 .id = 0,
300 .num_resources = ARRAY_SIZE(smc91x_resources),
301 .resource = smc91x_resources,
302};
303#endif
304
305#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
306static struct resource dm9000_resources[] = {
307 [0] = {
308 .start = 0x203FB800,
309 .end = 0x203FB800 + 8,
310 .flags = IORESOURCE_MEM,
311 },
312 [1] = {
313 .start = IRQ_PF9,
314 .end = IRQ_PF9,
315 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE),
316 },
317};
318
319static struct platform_device dm9000_device = {
320 .name = "dm9000",
321 .id = -1,
322 .num_resources = ARRAY_SIZE(dm9000_resources),
323 .resource = dm9000_resources,
324};
325#endif
326
327#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
328static struct resource sl811_hcd_resources[] = {
329 {
330 .start = 0x20340000,
331 .end = 0x20340000,
332 .flags = IORESOURCE_MEM,
333 }, {
334 .start = 0x20340004,
335 .end = 0x20340004,
336 .flags = IORESOURCE_MEM,
337 }, {
338 .start = CONFIG_USB_SL811_BFIN_IRQ,
339 .end = CONFIG_USB_SL811_BFIN_IRQ,
340 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
341 },
342};
343
344#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
345void sl811_port_power(struct device *dev, int is_on)
346{
347 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
348 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
349}
350#endif
351
352static struct sl811_platform_data sl811_priv = {
353 .potpg = 10,
354 .power = 250, /* == 500mA */
355#if defined(CONFIG_USB_SL811_BFIN_USE_VBUS)
356 .port_power = &sl811_port_power,
357#endif
358};
359
360static struct platform_device sl811_hcd_device = {
361 .name = "sl811-hcd",
362 .id = 0,
363 .dev = {
364 .platform_data = &sl811_priv,
365 },
366 .num_resources = ARRAY_SIZE(sl811_hcd_resources),
367 .resource = sl811_hcd_resources,
368};
369#endif
370
371#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
372static struct resource isp1362_hcd_resources[] = {
373 {
374 .start = 0x20360000,
375 .end = 0x20360000,
376 .flags = IORESOURCE_MEM,
377 }, {
378 .start = 0x20360004,
379 .end = 0x20360004,
380 .flags = IORESOURCE_MEM,
381 }, {
382 .start = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
383 .end = CONFIG_USB_ISP1362_BFIN_GPIO_IRQ,
384 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
385 },
386};
387
388static struct isp1362_platform_data isp1362_priv = {
389 .sel15Kres = 1,
390 .clknotstop = 0,
391 .oc_enable = 0,
392 .int_act_high = 0,
393 .int_edge_triggered = 0,
394 .remote_wakeup_connected = 0,
395 .no_power_switching = 1,
396 .power_switching_mode = 0,
397};
398
399static struct platform_device isp1362_hcd_device = {
400 .name = "isp1362-hcd",
401 .id = 0,
402 .dev = {
403 .platform_data = &isp1362_priv,
404 },
405 .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
406 .resource = isp1362_hcd_resources,
407};
408#endif
409
410#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
411static struct platform_device bfin_mac_device = {
412 .name = "bfin_mac",
413};
414#endif
415
416#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
417static struct resource net2272_bfin_resources[] = {
418 {
419 .start = 0x20300000,
420 .end = 0x20300000 + 0x100,
421 .flags = IORESOURCE_MEM,
422 }, {
423 .start = IRQ_PF7,
424 .end = IRQ_PF7,
425 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
426 },
427};
428
429static struct platform_device net2272_bfin_device = {
430 .name = "net2272",
431 .id = -1,
432 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
433 .resource = net2272_bfin_resources,
434};
435#endif
436
437#if defined(CONFIG_MTD_M25P80) \
438 || defined(CONFIG_MTD_M25P80_MODULE)
439static struct mtd_partition bfin_spi_flash_partitions[] = {
440 {
441 .name = "bootloader",
442 .size = 0x00040000,
443 .offset = 0,
444 .mask_flags = MTD_CAP_ROM
445 }, {
446 .name = "linux kernel",
447 .size = MTDPART_SIZ_FULL,
448 .offset = MTDPART_OFS_APPEND,
449 }
450};
451
452static struct flash_platform_data bfin_spi_flash_data = {
453 .name = "m25p80",
454 .parts = bfin_spi_flash_partitions,
455 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
456 .type = "m25p16",
457};
458
459/* SPI flash chip (m25p64) */
460static struct bfin5xx_spi_chip spi_flash_chip_info = {
461 .enable_dma = 0, /* use dma transfer with this chip*/
462 .bits_per_word = 8,
463};
464#endif
465
466#if defined(CONFIG_SPI_ADC_BF533) \
467 || defined(CONFIG_SPI_ADC_BF533_MODULE)
468/* SPI ADC chip */
469static struct bfin5xx_spi_chip spi_adc_chip_info = {
470 .enable_dma = 1, /* use dma transfer with this chip*/
471 .bits_per_word = 16,
472};
473#endif
474
475#if defined(CONFIG_SND_BLACKFIN_AD1836) \
476 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
477static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
478 .enable_dma = 0,
479 .bits_per_word = 16,
480};
481#endif
482
483#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
484static struct bfin5xx_spi_chip ad9960_spi_chip_info = {
485 .enable_dma = 0,
486 .bits_per_word = 16,
487};
488#endif
489
490#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
491static struct bfin5xx_spi_chip spi_mmc_chip_info = {
492 .enable_dma = 1,
493 .bits_per_word = 8,
494};
495#endif
496
497#if defined(CONFIG_PBX)
498static struct bfin5xx_spi_chip spi_si3xxx_chip_info = {
499 .ctl_reg = 0x4, /* send zero */
500 .enable_dma = 0,
501 .bits_per_word = 8,
502 .cs_change_per_word = 1,
503};
504#endif
505
506#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
507static struct bfin5xx_spi_chip spi_ad7877_chip_info = {
508 .enable_dma = 0,
509 .bits_per_word = 16,
510};
511
512static const struct ad7877_platform_data bfin_ad7877_ts_info = {
513 .model = 7877,
514 .vref_delay_usecs = 50, /* internal, no capacitor */
515 .x_plate_ohms = 419,
516 .y_plate_ohms = 486,
517 .pressure_max = 1000,
518 .pressure_min = 0,
519 .stopacq_polarity = 1,
520 .first_conversion_delay = 3,
521 .acquisition_time = 1,
522 .averaging = 1,
523 .pen_down_acc_interval = 1,
524};
525#endif
526
527#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
528 && defined(CONFIG_SND_SOC_WM8731_SPI)
529static struct bfin5xx_spi_chip spi_wm8731_chip_info = {
530 .enable_dma = 0,
531 .bits_per_word = 16,
532};
533#endif
534
535#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
536static struct bfin5xx_spi_chip spidev_chip_info = {
537 .enable_dma = 0,
538 .bits_per_word = 8,
539};
540#endif
541
542static struct spi_board_info bfin_spi_board_info[] __initdata = {
543#if defined(CONFIG_MTD_M25P80) \
544 || defined(CONFIG_MTD_M25P80_MODULE)
545 {
546 /* the modalias must be the same as spi device driver name */
547 .modalias = "m25p80", /* Name of spi_driver for this device */
548 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
549 .bus_num = 0, /* Framework bus number */
550 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
551 .platform_data = &bfin_spi_flash_data,
552 .controller_data = &spi_flash_chip_info,
553 .mode = SPI_MODE_3,
554 },
555#endif
556
557#if defined(CONFIG_SPI_ADC_BF533) \
558 || defined(CONFIG_SPI_ADC_BF533_MODULE)
559 {
560 .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
561 .max_speed_hz = 6250000, /* max spi clock (SCK) speed in HZ */
562 .bus_num = 0, /* Framework bus number */
563 .chip_select = 1, /* Framework chip select. */
564 .platform_data = NULL, /* No spi_driver specific config */
565 .controller_data = &spi_adc_chip_info,
566 },
567#endif
568
569#if defined(CONFIG_SND_BLACKFIN_AD1836) \
570 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
571 {
572 .modalias = "ad1836-spi",
573 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
574 .bus_num = 0,
575 .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
576 .controller_data = &ad1836_spi_chip_info,
577 },
578#endif
579#if defined(CONFIG_AD9960) || defined(CONFIG_AD9960_MODULE)
580 {
581 .modalias = "ad9960-spi",
582 .max_speed_hz = 10000000, /* max spi clock (SCK) speed in HZ */
583 .bus_num = 0,
584 .chip_select = 1,
585 .controller_data = &ad9960_spi_chip_info,
586 },
587#endif
588#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
589 {
590 .modalias = "spi_mmc_dummy",
591 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
592 .bus_num = 0,
593 .chip_select = 0,
594 .platform_data = NULL,
595 .controller_data = &spi_mmc_chip_info,
596 .mode = SPI_MODE_3,
597 },
598 {
599 .modalias = "spi_mmc",
600 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
601 .bus_num = 0,
602 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
603 .platform_data = NULL,
604 .controller_data = &spi_mmc_chip_info,
605 .mode = SPI_MODE_3,
606 },
607#endif
608#if defined(CONFIG_PBX)
609 {
610 .modalias = "fxs-spi",
611 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
612 .bus_num = 0,
613 .chip_select = 8 - CONFIG_J11_JUMPER,
614 .controller_data = &spi_si3xxx_chip_info,
615 .mode = SPI_MODE_3,
616 },
617 {
618 .modalias = "fxo-spi",
619 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
620 .bus_num = 0,
621 .chip_select = 8 - CONFIG_J19_JUMPER,
622 .controller_data = &spi_si3xxx_chip_info,
623 .mode = SPI_MODE_3,
624 },
625#endif
626#if defined(CONFIG_TOUCHSCREEN_AD7877) || defined(CONFIG_TOUCHSCREEN_AD7877_MODULE)
627 {
628 .modalias = "ad7877",
629 .platform_data = &bfin_ad7877_ts_info,
630 .irq = IRQ_PF8,
631 .max_speed_hz = 12500000, /* max spi clock (SCK) speed in HZ */
632 .bus_num = 0,
633 .chip_select = 2,
634 .controller_data = &spi_ad7877_chip_info,
635 },
636#endif
637#if defined(CONFIG_SND_SOC_WM8731) || defined(CONFIG_SND_SOC_WM8731_MODULE) \
638 && defined(CONFIG_SND_SOC_WM8731_SPI)
639 {
640 .modalias = "wm8731",
641 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
642 .bus_num = 0,
643 .chip_select = 5,
644 .controller_data = &spi_wm8731_chip_info,
645 .mode = SPI_MODE_0,
646 },
647#endif
648#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
649 {
650 .modalias = "spidev",
651 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
652 .bus_num = 0,
653 .chip_select = 1,
654 .controller_data = &spidev_chip_info,
655 },
656#endif
657};
658
659#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
660/* SPI controller data */
661static struct bfin5xx_spi_master bfin_spi0_info = {
662 .num_chipselect = 8,
663 .enable_dma = 1, /* master has the ability to do dma transfer */
664 .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
665};
666
667/* SPI (0) */
668static struct resource bfin_spi0_resource[] = {
669 [0] = {
670 .start = SPI0_REGBASE,
671 .end = SPI0_REGBASE + 0xFF,
672 .flags = IORESOURCE_MEM,
673 },
674 [1] = {
675 .start = CH_SPI,
676 .end = CH_SPI,
677 .flags = IORESOURCE_IRQ,
678 },
679};
680
681static struct platform_device bfin_spi0_device = {
682 .name = "bfin-spi",
683 .id = 0, /* Bus number */
684 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
685 .resource = bfin_spi0_resource,
686 .dev = {
687 .platform_data = &bfin_spi0_info, /* Passed to driver */
688 },
689};
690#endif /* spi master and devices */
691
692#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
693static struct platform_device bfin_fb_adv7393_device = {
694 .name = "bfin-adv7393",
695};
696#endif
697
698#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
699static struct resource bfin_uart_resources[] = {
700#ifdef CONFIG_SERIAL_BFIN_UART0
701 {
702 .start = 0xFFC00400,
703 .end = 0xFFC004FF,
704 .flags = IORESOURCE_MEM,
705 },
706#endif
707#ifdef CONFIG_SERIAL_BFIN_UART1
708 {
709 .start = 0xFFC02000,
710 .end = 0xFFC020FF,
711 .flags = IORESOURCE_MEM,
712 },
713#endif
714};
715
716static struct platform_device bfin_uart_device = {
717 .name = "bfin-uart",
718 .id = 1,
719 .num_resources = ARRAY_SIZE(bfin_uart_resources),
720 .resource = bfin_uart_resources,
721};
722#endif
723
724#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
725static struct resource bfin_sir_resources[] = {
726#ifdef CONFIG_BFIN_SIR0
727 {
728 .start = 0xFFC00400,
729 .end = 0xFFC004FF,
730 .flags = IORESOURCE_MEM,
731 },
732#endif
733#ifdef CONFIG_BFIN_SIR1
734 {
735 .start = 0xFFC02000,
736 .end = 0xFFC020FF,
737 .flags = IORESOURCE_MEM,
738 },
739#endif
740};
741
742static struct platform_device bfin_sir_device = {
743 .name = "bfin_sir",
744 .id = 0,
745 .num_resources = ARRAY_SIZE(bfin_sir_resources),
746 .resource = bfin_sir_resources,
747};
748#endif
749
750#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
751static struct resource bfin_twi0_resource[] = {
752 [0] = {
753 .start = TWI0_REGBASE,
754 .end = TWI0_REGBASE,
755 .flags = IORESOURCE_MEM,
756 },
757 [1] = {
758 .start = IRQ_TWI,
759 .end = IRQ_TWI,
760 .flags = IORESOURCE_IRQ,
761 },
762};
763
764static struct platform_device i2c_bfin_twi_device = {
765 .name = "i2c-bfin-twi",
766 .id = 0,
767 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
768 .resource = bfin_twi0_resource,
769};
770#endif
771
772#ifdef CONFIG_I2C_BOARDINFO
773static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
774#if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
775 {
776 I2C_BOARD_INFO("pcf8574_lcd", 0x22),
777 .type = "pcf8574_lcd",
778 },
779#endif
780#if defined(CONFIG_TWI_KEYPAD) || defined(CONFIG_TWI_KEYPAD_MODULE)
781 {
782 I2C_BOARD_INFO("pcf8574_keypad", 0x27),
783 .type = "pcf8574_keypad",
784 .irq = IRQ_PF8,
785 },
786#endif
787};
788#endif
789
790#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
791static struct platform_device bfin_sport0_uart_device = {
792 .name = "bfin-sport-uart",
793 .id = 0,
794};
795
796static struct platform_device bfin_sport1_uart_device = {
797 .name = "bfin-sport-uart",
798 .id = 1,
799};
800#endif
801
802#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
803#define PATA_INT 55
804
805static struct pata_platform_info bfin_pata_platform_data = {
806 .ioport_shift = 1,
807 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
808};
809
810static struct resource bfin_pata_resources[] = {
811 {
812 .start = 0x20314020,
813 .end = 0x2031403F,
814 .flags = IORESOURCE_MEM,
815 },
816 {
817 .start = 0x2031401C,
818 .end = 0x2031401F,
819 .flags = IORESOURCE_MEM,
820 },
821 {
822 .start = PATA_INT,
823 .end = PATA_INT,
824 .flags = IORESOURCE_IRQ,
825 },
826};
827
828static struct platform_device bfin_pata_device = {
829 .name = "pata_platform",
830 .id = -1,
831 .num_resources = ARRAY_SIZE(bfin_pata_resources),
832 .resource = bfin_pata_resources,
833 .dev = {
834 .platform_data = &bfin_pata_platform_data,
835 }
836};
837#endif
838
839#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
840#include <linux/input.h>
841#include <linux/gpio_keys.h>
842
843static struct gpio_keys_button bfin_gpio_keys_table[] = {
844 {BTN_0, GPIO_PF14, 1, "gpio-keys: BTN0"},
845};
846
847static struct gpio_keys_platform_data bfin_gpio_keys_data = {
848 .buttons = bfin_gpio_keys_table,
849 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
850};
851
852static struct platform_device bfin_device_gpiokeys = {
853 .name = "gpio-keys",
854 .dev = {
855 .platform_data = &bfin_gpio_keys_data,
856 },
857};
858#endif
859
860static struct resource bfin_gpios_resources = {
861 .start = 0,
862 .end = MAX_BLACKFIN_GPIOS - 1,
863 .flags = IORESOURCE_IRQ,
864};
865
866static struct platform_device bfin_gpios_device = {
867 .name = "simple-gpio",
868 .id = -1,
869 .num_resources = 1,
870 .resource = &bfin_gpios_resources,
871};
872
873static const unsigned int cclk_vlev_datasheet[] =
874{
875 VRPAIR(VLEV_100, 400000000),
876 VRPAIR(VLEV_105, 426000000),
877 VRPAIR(VLEV_110, 500000000),
878 VRPAIR(VLEV_115, 533000000),
879 VRPAIR(VLEV_120, 600000000),
880};
881
882static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
883 .tuple_tab = cclk_vlev_datasheet,
884 .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
885 .vr_settling_time = 25 /* us */,
886};
887
888static struct platform_device bfin_dpmc = {
889 .name = "bfin dpmc",
890 .dev = {
891 .platform_data = &bfin_dmpc_vreg_data,
892 },
893};
894
895static struct platform_device *stamp_devices[] __initdata = {
896
897 &bfin_dpmc,
898
899#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
900 &bf5xx_nand_device,
901#endif
902
903#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
904 &bfin_pcmcia_cf_device,
905#endif
906
907#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
908 &rtc_device,
909#endif
910
911#if defined(CONFIG_USB_SL811_HCD) || defined(CONFIG_USB_SL811_HCD_MODULE)
912 &sl811_hcd_device,
913#endif
914
915#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
916 &isp1362_hcd_device,
917#endif
918
919#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
920 &musb_device,
921#endif
922
923#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
924 &smc91x_device,
925#endif
926
927#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
928 &dm9000_device,
929#endif
930
931#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
932 &bfin_mac_device,
933#endif
934
935#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
936 &net2272_bfin_device,
937#endif
938
939#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
940 &bfin_spi0_device,
941#endif
942
943#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
944 &bfin_fb_adv7393_device,
945#endif
946
947#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
948 &bfin_uart_device,
949#endif
950
951#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
952 &bfin_sir_device,
953#endif
954
955#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
956 &i2c_bfin_twi_device,
957#endif
958
959#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
960 &bfin_sport0_uart_device,
961 &bfin_sport1_uart_device,
962#endif
963
964#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
965 &bfin_pata_device,
966#endif
967
968#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
969 &bfin_device_gpiokeys,
970#endif
971
972#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
973 &ezkit_flash_device,
974#endif
975
976 &bfin_gpios_device,
977};
978
979static int __init stamp_init(void)
980{
981 printk(KERN_INFO "%s(): registering device resources\n", __func__);
982
983#ifdef CONFIG_I2C_BOARDINFO
984 i2c_register_board_info(0, bfin_i2c_board_info,
985 ARRAY_SIZE(bfin_i2c_board_info));
986#endif
987
988 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
989 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
990
991#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
992 irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
993#endif
994 return 0;
995}
996
997arch_initcall(stamp_init);
998
999void native_machine_restart(char *cmd)
1000{
1001 /* workaround reboot hang when booting from SPI */
1002 if ((bfin_read_SYSCR() & 0x7) == 0x3)
1003 bfin_gpio_reset_spi0_ssel1();
1004}
1005
1006void bfin_get_ether_addr(char *addr)
1007{
1008 random_ether_addr(addr);
1009 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
1010}
1011EXPORT_SYMBOL(bfin_get_ether_addr);
diff --git a/arch/blackfin/mach-bf527/head.S b/arch/blackfin/mach-bf527/head.S
index 57bdb3ba2fed..fe05cc1ef174 100644
--- a/arch/blackfin/mach-bf527/head.S
+++ b/arch/blackfin/mach-bf527/head.S
@@ -32,7 +32,7 @@
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/trace.h> 33#include <asm/trace.h>
34 34
35#if CONFIG_BFIN_KERNEL_CLOCK 35#ifdef CONFIG_BFIN_KERNEL_CLOCK
36#include <asm/mach-common/clocks.h> 36#include <asm/mach-common/clocks.h>
37#include <asm/mach/mem_init.h> 37#include <asm/mach/mem_init.h>
38#endif 38#endif
@@ -185,7 +185,7 @@ ENTRY(__start)
185 185
186 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 186 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
187 call _bf53x_relocate_l1_mem; 187 call _bf53x_relocate_l1_mem;
188#if CONFIG_BFIN_KERNEL_CLOCK 188#ifdef CONFIG_BFIN_KERNEL_CLOCK
189 call _start_dma_code; 189 call _start_dma_code;
190#endif 190#endif
191 191
@@ -318,7 +318,7 @@ ENDPROC(_real_start)
318__FINIT 318__FINIT
319 319
320.section .l1.text 320.section .l1.text
321#if CONFIG_BFIN_KERNEL_CLOCK 321#ifdef CONFIG_BFIN_KERNEL_CLOCK
322ENTRY(_start_dma_code) 322ENTRY(_start_dma_code)
323 323
324 /* Enable PHY CLK buffer output */ 324 /* Enable PHY CLK buffer output */
@@ -398,12 +398,6 @@ ENTRY(_start_dma_code)
398 w[p0] = r0.l; 398 w[p0] = r0.l;
399 ssync; 399 ssync;
400 400
401 p0.l = LO(EBIU_SDBCTL);
402 p0.h = HI(EBIU_SDBCTL); /* SDRAM Memory Bank Control Register */
403 r0 = mem_SDBCTL;
404 w[p0] = r0.l;
405 ssync;
406
407 P2.H = hi(EBIU_SDGCTL); 401 P2.H = hi(EBIU_SDGCTL);
408 P2.L = lo(EBIU_SDGCTL); 402 P2.L = lo(EBIU_SDGCTL);
409 R0 = [P2]; 403 R0 = [P2];
diff --git a/arch/blackfin/mach-bf533/head.S b/arch/blackfin/mach-bf533/head.S
index 1295deac00a4..c671e8549b17 100644
--- a/arch/blackfin/mach-bf533/head.S
+++ b/arch/blackfin/mach-bf533/head.S
@@ -31,7 +31,7 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/trace.h> 33#include <asm/trace.h>
34#if CONFIG_BFIN_KERNEL_CLOCK 34#ifdef CONFIG_BFIN_KERNEL_CLOCK
35#include <asm/mach-common/clocks.h> 35#include <asm/mach-common/clocks.h>
36#include <asm/mach/mem_init.h> 36#include <asm/mach/mem_init.h>
37#endif 37#endif
@@ -186,7 +186,7 @@ ENTRY(__start)
186 186
187 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 187 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
188 call _bf53x_relocate_l1_mem; 188 call _bf53x_relocate_l1_mem;
189#if CONFIG_BFIN_KERNEL_CLOCK 189#ifdef CONFIG_BFIN_KERNEL_CLOCK
190 call _start_dma_code; 190 call _start_dma_code;
191#endif 191#endif
192 192
@@ -319,7 +319,7 @@ ENDPROC(_real_start)
319__FINIT 319__FINIT
320 320
321.section .l1.text 321.section .l1.text
322#if CONFIG_BFIN_KERNEL_CLOCK 322#ifdef CONFIG_BFIN_KERNEL_CLOCK
323ENTRY(_start_dma_code) 323ENTRY(_start_dma_code)
324 p0.h = hi(SIC_IWR); 324 p0.h = hi(SIC_IWR);
325 p0.l = lo(SIC_IWR); 325 p0.l = lo(SIC_IWR);
@@ -390,12 +390,6 @@ ENTRY(_start_dma_code)
390 w[p0] = r0.l; 390 w[p0] = r0.l;
391 ssync; 391 ssync;
392 392
393 p0.l = LO(EBIU_SDBCTL);
394 p0.h = HI(EBIU_SDBCTL); /* SDRAM Memory Bank Control Register */
395 r0 = mem_SDBCTL;
396 w[p0] = r0.l;
397 ssync;
398
399 P2.H = hi(EBIU_SDGCTL); 393 P2.H = hi(EBIU_SDGCTL);
400 P2.L = lo(EBIU_SDGCTL); 394 P2.L = lo(EBIU_SDGCTL);
401 R0 = [P2]; 395 R0 = [P2];
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 671f9d67f23a..6dbc76fb080b 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -29,9 +29,12 @@
29 */ 29 */
30 30
31#include <linux/device.h> 31#include <linux/device.h>
32#include <linux/kernel.h>
32#include <linux/platform_device.h> 33#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 34#include <linux/mtd/mtd.h>
35#include <linux/mtd/nand.h>
34#include <linux/mtd/partitions.h> 36#include <linux/mtd/partitions.h>
37#include <linux/mtd/plat-ram.h>
35#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
36#include <linux/spi/spi.h> 39#include <linux/spi/spi.h>
37#include <linux/spi/flash.h> 40#include <linux/spi/flash.h>
@@ -355,6 +358,84 @@ static struct platform_device net2272_bfin_device = {
355}; 358};
356#endif 359#endif
357 360
361#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
362#ifdef CONFIG_MTD_PARTITIONS
363const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
364
365static struct mtd_partition bfin_plat_nand_partitions[] = {
366 {
367 .name = "linux kernel",
368 .size = 0x400000,
369 .offset = 0,
370 }, {
371 .name = "file system",
372 .size = MTDPART_SIZ_FULL,
373 .offset = MTDPART_OFS_APPEND,
374 },
375};
376#endif
377
378#define BFIN_NAND_PLAT_CLE 2
379#define BFIN_NAND_PLAT_ALE 1
380static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
381{
382 struct nand_chip *this = mtd->priv;
383
384 if (cmd == NAND_CMD_NONE)
385 return;
386
387 if (ctrl & NAND_CLE)
388 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));
389 else
390 writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));
391}
392
393#define BFIN_NAND_PLAT_READY GPIO_PF3
394static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)
395{
396 return gpio_get_value(BFIN_NAND_PLAT_READY);
397}
398
399static struct platform_nand_data bfin_plat_nand_data = {
400 .chip = {
401 .chip_delay = 30,
402#ifdef CONFIG_MTD_PARTITIONS
403 .part_probe_types = part_probes,
404 .partitions = bfin_plat_nand_partitions,
405 .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),
406#endif
407 },
408 .ctrl = {
409 .cmd_ctrl = bfin_plat_nand_cmd_ctrl,
410 .dev_ready = bfin_plat_nand_dev_ready,
411 },
412};
413
414#define MAX(x, y) (x > y ? x : y)
415static struct resource bfin_plat_nand_resources = {
416 .start = 0x20212000,
417 .end = 0x20212000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),
418 .flags = IORESOURCE_IO,
419};
420
421static struct platform_device bfin_async_nand_device = {
422 .name = "gen_nand",
423 .id = -1,
424 .num_resources = 1,
425 .resource = &bfin_plat_nand_resources,
426 .dev = {
427 .platform_data = &bfin_plat_nand_data,
428 },
429};
430
431static void bfin_plat_nand_init(void)
432{
433 gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");
434}
435#else
436static void bfin_plat_nand_init(void) {}
437#endif
438
358#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) 439#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
359static struct mtd_partition stamp_partitions[] = { 440static struct mtd_partition stamp_partitions[] = {
360 { 441 {
@@ -780,7 +861,7 @@ static struct platform_device bfin_sport1_uart_device = {
780#endif 861#endif
781 862
782#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 863#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
783#define PATA_INT 55 864#define PATA_INT IRQ_PF5
784 865
785static struct pata_platform_info bfin_pata_platform_data = { 866static struct pata_platform_info bfin_pata_platform_data = {
786 .ioport_shift = 1, 867 .ioport_shift = 1,
@@ -922,6 +1003,10 @@ static struct platform_device *stamp_devices[] __initdata = {
922 1003
923 &bfin_gpios_device, 1004 &bfin_gpios_device,
924 1005
1006#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
1007 &bfin_async_nand_device,
1008#endif
1009
925#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) 1010#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
926 &stamp_flash_device, 1011 &stamp_flash_device,
927#endif 1012#endif
@@ -936,6 +1021,7 @@ static int __init stamp_init(void)
936 ARRAY_SIZE(bfin_i2c_board_info)); 1021 ARRAY_SIZE(bfin_i2c_board_info));
937#endif 1022#endif
938 1023
1024 bfin_plat_nand_init();
939 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 1025 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
940 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 1026 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
941 1027
diff --git a/arch/blackfin/mach-bf537/head.S b/arch/blackfin/mach-bf537/head.S
index 48cd58a410a0..6b019eaee0b6 100644
--- a/arch/blackfin/mach-bf537/head.S
+++ b/arch/blackfin/mach-bf537/head.S
@@ -32,7 +32,7 @@
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/trace.h> 33#include <asm/trace.h>
34 34
35#if CONFIG_BFIN_KERNEL_CLOCK 35#ifdef CONFIG_BFIN_KERNEL_CLOCK
36#include <asm/mach-common/clocks.h> 36#include <asm/mach-common/clocks.h>
37#include <asm/mach/mem_init.h> 37#include <asm/mach/mem_init.h>
38#endif 38#endif
@@ -217,7 +217,7 @@ ENTRY(__start)
217 217
218 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 218 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
219 call _bf53x_relocate_l1_mem; 219 call _bf53x_relocate_l1_mem;
220#if CONFIG_BFIN_KERNEL_CLOCK 220#ifdef CONFIG_BFIN_KERNEL_CLOCK
221 call _start_dma_code; 221 call _start_dma_code;
222#endif 222#endif
223 223
@@ -350,7 +350,7 @@ ENDPROC(_real_start)
350__FINIT 350__FINIT
351 351
352.section .l1.text 352.section .l1.text
353#if CONFIG_BFIN_KERNEL_CLOCK 353#ifdef CONFIG_BFIN_KERNEL_CLOCK
354ENTRY(_start_dma_code) 354ENTRY(_start_dma_code)
355 355
356 /* Enable PHY CLK buffer output */ 356 /* Enable PHY CLK buffer output */
@@ -430,12 +430,6 @@ ENTRY(_start_dma_code)
430 w[p0] = r0.l; 430 w[p0] = r0.l;
431 ssync; 431 ssync;
432 432
433 p0.l = LO(EBIU_SDBCTL);
434 p0.h = HI(EBIU_SDBCTL); /* SDRAM Memory Bank Control Register */
435 r0 = mem_SDBCTL;
436 w[p0] = r0.l;
437 ssync;
438
439 P2.H = hi(EBIU_SDGCTL); 433 P2.H = hi(EBIU_SDGCTL);
440 P2.L = lo(EBIU_SDGCTL); 434 P2.L = lo(EBIU_SDGCTL);
441 R0 = [P2]; 435 R0 = [P2];
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index af7c211a580e..166fa2201ee7 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -61,6 +61,49 @@ const char bfin_board_name[] = "ADSP-BF548-EZKIT";
61 * Driver needs to know address, irq and flag pin. 61 * Driver needs to know address, irq and flag pin.
62 */ 62 */
63 63
64#if defined(CONFIG_USB_ISP1760_HCD) || defined(CONFIG_USB_ISP1760_HCD_MODULE)
65static struct resource bfin_isp1761_resources[] = {
66 [0] = {
67 .name = "isp1761-regs",
68 .start = 0x2C0C0000,
69 .end = 0x2C0C0000 + 0xfffff,
70 .flags = IORESOURCE_MEM,
71 },
72 [1] = {
73 .start = IRQ_PG7,
74 .end = IRQ_PG7,
75 .flags = IORESOURCE_IRQ,
76 },
77};
78
79static struct platform_device bfin_isp1761_device = {
80 .name = "isp1761",
81 .id = 0,
82 .num_resources = ARRAY_SIZE(bfin_isp1761_resources),
83 .resource = bfin_isp1761_resources,
84};
85
86static struct platform_device *bfin_isp1761_devices[] = {
87 &bfin_isp1761_device,
88};
89
90int __init bfin_isp1761_init(void)
91{
92 unsigned int num_devices = ARRAY_SIZE(bfin_isp1761_devices);
93
94 printk(KERN_INFO "%s(): registering device resources\n", __func__);
95 set_irq_type(bfin_isp1761_resources[1].start, IRQF_TRIGGER_FALLING);
96
97 return platform_add_devices(bfin_isp1761_devices, num_devices);
98}
99
100void __exit bfin_isp1761_exit(void)
101{
102 platform_device_unregister(&bfin_isp1761_device);
103}
104arch_initcall(bfin_isp1761_init);
105#endif
106
64#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE) 107#if defined(CONFIG_FB_BF54X_LQ043) || defined(CONFIG_FB_BF54X_LQ043_MODULE)
65 108
66#include <asm/mach/bf54x-lq043.h> 109#include <asm/mach/bf54x-lq043.h>
@@ -177,6 +220,7 @@ static struct resource bfin_uart_resources[] = {
177 { 220 {
178 .start = 0xFFC03100, 221 .start = 0xFFC03100,
179 .end = 0xFFC031FF, 222 .end = 0xFFC031FF,
223 .flags = IORESOURCE_MEM,
180 }, 224 },
181#endif 225#endif
182}; 226};
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S
index f7191141a3ce..06b9178cfcfe 100644
--- a/arch/blackfin/mach-bf548/head.S
+++ b/arch/blackfin/mach-bf548/head.S
@@ -31,7 +31,7 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <asm/blackfin.h> 32#include <asm/blackfin.h>
33#include <asm/trace.h> 33#include <asm/trace.h>
34#if CONFIG_BFIN_KERNEL_CLOCK 34#ifdef CONFIG_BFIN_KERNEL_CLOCK
35#include <asm/mach-common/clocks.h> 35#include <asm/mach-common/clocks.h>
36#include <asm/mach/mem_init.h> 36#include <asm/mach/mem_init.h>
37#endif 37#endif
@@ -130,7 +130,7 @@ ENTRY(__start)
130 130
131 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */ 131 /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
132 call _bf53x_relocate_l1_mem; 132 call _bf53x_relocate_l1_mem;
133#if CONFIG_BFIN_KERNEL_CLOCK 133#ifdef CONFIG_BFIN_KERNEL_CLOCK
134 call _start_dma_code; 134 call _start_dma_code;
135#endif 135#endif
136 /* Code for initializing Async memory banks */ 136 /* Code for initializing Async memory banks */
@@ -288,7 +288,7 @@ ENDPROC(_real_start)
288__FINIT 288__FINIT
289 289
290.section .l1.text 290.section .l1.text
291#if CONFIG_BFIN_KERNEL_CLOCK 291#ifdef CONFIG_BFIN_KERNEL_CLOCK
292ENTRY(_start_dma_code) 292ENTRY(_start_dma_code)
293 293
294 /* Enable PHY CLK buffer output */ 294 /* Enable PHY CLK buffer output */
diff --git a/arch/blackfin/mach-bf561/head.S b/arch/blackfin/mach-bf561/head.S
index 5b8bd40851dd..cf1a2dff01e7 100644
--- a/arch/blackfin/mach-bf561/head.S
+++ b/arch/blackfin/mach-bf561/head.S
@@ -377,12 +377,6 @@ ENTRY(_start_dma_code)
377 w[p0] = r0.l; 377 w[p0] = r0.l;
378 ssync; 378 ssync;
379 379
380 p0.l = LO(EBIU_SDBCTL);
381 p0.h = HI(EBIU_SDBCTL); /* SDRAM Memory Bank Control Register */
382 r0 = mem_SDBCTL;
383 w[p0] = r0.l;
384 ssync;
385
386 P2.H = hi(EBIU_SDGCTL); 380 P2.H = hi(EBIU_SDGCTL);
387 P2.L = lo(EBIU_SDGCTL); 381 P2.L = lo(EBIU_SDGCTL);
388 R0 = [P2]; 382 R0 = [P2];
diff --git a/arch/blackfin/mach-common/arch_checks.c b/arch/blackfin/mach-common/arch_checks.c
index caaab49e9cfa..f9160d83b91f 100644
--- a/arch/blackfin/mach-common/arch_checks.c
+++ b/arch/blackfin/mach-common/arch_checks.c
@@ -53,9 +53,3 @@
53# endif 53# endif
54 54
55#endif /* CONFIG_BFIN_KERNEL_CLOCK */ 55#endif /* CONFIG_BFIN_KERNEL_CLOCK */
56
57#ifdef CONFIG_MEM_SIZE
58#if (CONFIG_MEM_SIZE % 4)
59#error "SDRAM mem size must be multible of 4MB"
60#endif
61#endif
diff --git a/arch/blackfin/mach-common/dpmc_modes.S b/arch/blackfin/mach-common/dpmc_modes.S
index b7981d31c392..5e3f1d8a4fb8 100644
--- a/arch/blackfin/mach-common/dpmc_modes.S
+++ b/arch/blackfin/mach-common/dpmc_modes.S
@@ -7,7 +7,7 @@
7#include <linux/linkage.h> 7#include <linux/linkage.h>
8#include <asm/blackfin.h> 8#include <asm/blackfin.h>
9#include <asm/mach/irq.h> 9#include <asm/mach/irq.h>
10 10#include <asm/dpmc.h>
11 11
12.section .l1.text 12.section .l1.text
13 13
@@ -51,31 +51,32 @@ ENTRY(_sleep_mode)
51 RETS = [SP++]; 51 RETS = [SP++];
52 ( R7:0, P5:0 ) = [SP++]; 52 ( R7:0, P5:0 ) = [SP++];
53 RTS; 53 RTS;
54ENDPROC(_sleep_mode)
54 55
55ENTRY(_hibernate_mode) 56ENTRY(_hibernate_mode)
56 [--SP] = ( R7:0, P5:0 ); 57 [--SP] = ( R7:0, P5:0 );
57 [--SP] = RETS; 58 [--SP] = RETS;
58 59
60 R3 = R0;
61 R0 = IWR_DISABLE_ALL;
62 R1 = IWR_DISABLE_ALL;
63 R2 = IWR_DISABLE_ALL;
59 call _set_sic_iwr; 64 call _set_sic_iwr;
65 call _set_dram_srfs;
66 SSYNC;
60 67
61 R0 = 0xFFFF (Z); 68 R0 = 0xFFFF (Z);
62 call _set_rtc_istat; 69 call _set_rtc_istat;
63 70
64 P0.H = hi(VR_CTL); 71 P0.H = hi(VR_CTL);
65 P0.L = lo(VR_CTL); 72 P0.L = lo(VR_CTL);
66 R1 = W[P0](z);
67 BITSET (R1, 8);
68 BITCLR (R1, 0);
69 BITCLR (R1, 1);
70 W[P0] = R1.L;
71 SSYNC;
72 73
74 W[P0] = R3.L;
73 CLI R2; 75 CLI R2;
74 IDLE; 76 IDLE;
75 77.Lforever:
76 /* Actually, adding anything may not be necessary...SDRAM contents 78 jump .Lforever;
77 * are lost 79ENDPROC(_hibernate_mode)
78 */
79 80
80ENTRY(_deep_sleep) 81ENTRY(_deep_sleep)
81 [--SP] = ( R7:0, P5:0 ); 82 [--SP] = ( R7:0, P5:0 );
@@ -131,6 +132,7 @@ ENTRY(_deep_sleep)
131 RETS = [SP++]; 132 RETS = [SP++];
132 ( R7:0, P5:0 ) = [SP++]; 133 ( R7:0, P5:0 ) = [SP++];
133 RTS; 134 RTS;
135ENDPROC(_deep_sleep)
134 136
135ENTRY(_sleep_deeper) 137ENTRY(_sleep_deeper)
136 [--SP] = ( R7:0, P5:0 ); 138 [--SP] = ( R7:0, P5:0 );
@@ -232,53 +234,73 @@ ENTRY(_sleep_deeper)
232 RETS = [SP++]; 234 RETS = [SP++];
233 ( R7:0, P5:0 ) = [SP++]; 235 ( R7:0, P5:0 ) = [SP++];
234 RTS; 236 RTS;
237ENDPROC(_sleep_deeper)
235 238
236ENTRY(_set_dram_srfs) 239ENTRY(_set_dram_srfs)
237 /* set the dram to self refresh mode */ 240 /* set the dram to self refresh mode */
238#if defined(CONFIG_BF54x) 241 SSYNC;
242#if defined(EBIU_RSTCTL) /* DDR */
239 P0.H = hi(EBIU_RSTCTL); 243 P0.H = hi(EBIU_RSTCTL);
240 P0.L = lo(EBIU_RSTCTL); 244 P0.L = lo(EBIU_RSTCTL);
241 R2 = [P0]; 245 R2 = [P0];
242 R3.H = hi(SRREQ); 246 BITSET(R2, 3); /* SRREQ enter self-refresh mode */
243 R3.L = lo(SRREQ); 247 [P0] = R2;
244#else 248 SSYNC;
245 P0.H = hi(EBIU_SDGCTL); 2491:
250 R2 = [P0];
251 CC = BITTST(R2, 4);
252 if !CC JUMP 1b;
253#else /* SDRAM */
246 P0.L = lo(EBIU_SDGCTL); 254 P0.L = lo(EBIU_SDGCTL);
255 P0.H = hi(EBIU_SDGCTL);
247 R2 = [P0]; 256 R2 = [P0];
248 R3.H = hi(SRFS); 257 BITSET(R2, 24); /* SRFS enter self-refresh mode */
249 R3.L = lo(SRFS);
250#endif
251 R2 = R2|R3;
252 [P0] = R2; 258 [P0] = R2;
253 ssync; 259 SSYNC;
254#if defined(CONFIG_BF54x) 260
255.LSRR_MODE: 261 P0.L = lo(EBIU_SDSTAT);
262 P0.H = hi(EBIU_SDSTAT);
2631:
264 R2 = w[P0];
265 SSYNC;
266 cc = BITTST(R2, 1); /* SDSRA poll self-refresh status */
267 if !cc jump 1b;
268
269 P0.L = lo(EBIU_SDGCTL);
270 P0.H = hi(EBIU_SDGCTL);
256 R2 = [P0]; 271 R2 = [P0];
257 CC = BITTST(R2, 4); 272 BITCLR(R2, 0); /* SCTLE disable CLKOUT */
258 if !CC JUMP .LSRR_MODE; 273 [P0] = R2;
259#endif 274#endif
260 RTS; 275 RTS;
276ENDPROC(_set_dram_srfs)
261 277
262ENTRY(_unset_dram_srfs) 278ENTRY(_unset_dram_srfs)
263 /* set the dram out of self refresh mode */ 279 /* set the dram out of self refresh mode */
264#if defined(CONFIG_BF54x) 280#if defined(EBIU_RSTCTL) /* DDR */
265 P0.H = hi(EBIU_RSTCTL); 281 P0.H = hi(EBIU_RSTCTL);
266 P0.L = lo(EBIU_RSTCTL); 282 P0.L = lo(EBIU_RSTCTL);
267 R2 = [P0]; 283 R2 = [P0];
268 R3.H = hi(SRREQ); 284 BITCLR(R2, 3); /* clear SRREQ bit */
269 R3.L = lo(SRREQ); 285 [P0] = R2;
270#else 286#elif defined(EBIU_SDGCTL) /* SDRAM */
287
288 P0.L = lo(EBIU_SDGCTL); /* release CLKOUT from self-refresh */
289 P0.H = hi(EBIU_SDGCTL);
290 R2 = [P0];
291 BITSET(R2, 0); /* SCTLE enable CLKOUT */
292 [P0] = R2
293 SSYNC;
294
295 P0.L = lo(EBIU_SDGCTL); /* release SDRAM from self-refresh */
271 P0.H = hi(EBIU_SDGCTL); 296 P0.H = hi(EBIU_SDGCTL);
272 P0.L = lo(EBIU_SDGCTL);
273 R2 = [P0]; 297 R2 = [P0];
274 R3.H = hi(SRFS); 298 BITCLR(R2, 24); /* clear SRFS bit */
275 R3.L = lo(SRFS); 299 [P0] = R2
276#endif 300#endif
277 R3 = ~R3; 301 SSYNC;
278 R2 = R2&R3;
279 [P0] = R2;
280 ssync;
281 RTS; 302 RTS;
303ENDPROC(_unset_dram_srfs)
282 304
283ENTRY(_set_sic_iwr) 305ENTRY(_set_sic_iwr)
284#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 306#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
@@ -300,6 +322,7 @@ ENTRY(_set_sic_iwr)
300 322
301 SSYNC; 323 SSYNC;
302 RTS; 324 RTS;
325ENDPROC(_set_sic_iwr)
303 326
304ENTRY(_set_rtc_istat) 327ENTRY(_set_rtc_istat)
305#ifndef CONFIG_BF561 328#ifndef CONFIG_BF561
@@ -307,8 +330,14 @@ ENTRY(_set_rtc_istat)
307 P0.L = lo(RTC_ISTAT); 330 P0.L = lo(RTC_ISTAT);
308 w[P0] = R0.L; 331 w[P0] = R0.L;
309 SSYNC; 332 SSYNC;
333#elif (ANOMALY_05000371)
334 nop;
335 nop;
336 nop;
337 nop;
310#endif 338#endif
311 RTS; 339 RTS;
340ENDPROC(_set_rtc_istat)
312 341
313ENTRY(_test_pll_locked) 342ENTRY(_test_pll_locked)
314 P0.H = hi(PLL_STAT); 343 P0.H = hi(PLL_STAT);
@@ -318,3 +347,509 @@ ENTRY(_test_pll_locked)
318 CC = BITTST(R0,5); 347 CC = BITTST(R0,5);
319 IF !CC JUMP 1b; 348 IF !CC JUMP 1b;
320 RTS; 349 RTS;
350ENDPROC(_test_pll_locked)
351
352.section .text
353
354ENTRY(_do_hibernate)
355 [--SP] = ( R7:0, P5:0 );
356 [--SP] = RETS;
357 /* Save System MMRs */
358 R2 = R0;
359 P0.H = hi(PLL_CTL);
360 P0.L = lo(PLL_CTL);
361
362#ifdef SIC_IMASK0
363 PM_SYS_PUSH(SIC_IMASK0)
364#endif
365#ifdef SIC_IMASK1
366 PM_SYS_PUSH(SIC_IMASK1)
367#endif
368#ifdef SIC_IMASK2
369 PM_SYS_PUSH(SIC_IMASK2)
370#endif
371#ifdef SIC_IMASK
372 PM_SYS_PUSH(SIC_IMASK)
373#endif
374#ifdef SICA_IMASK0
375 PM_SYS_PUSH(SICA_IMASK0)
376#endif
377#ifdef SICA_IMASK1
378 PM_SYS_PUSH(SICA_IMASK1)
379#endif
380#ifdef SIC_IAR2
381 PM_SYS_PUSH(SIC_IAR0)
382 PM_SYS_PUSH(SIC_IAR1)
383 PM_SYS_PUSH(SIC_IAR2)
384#endif
385#ifdef SIC_IAR3
386 PM_SYS_PUSH(SIC_IAR3)
387#endif
388#ifdef SIC_IAR4
389 PM_SYS_PUSH(SIC_IAR4)
390 PM_SYS_PUSH(SIC_IAR5)
391 PM_SYS_PUSH(SIC_IAR6)
392#endif
393#ifdef SIC_IAR7
394 PM_SYS_PUSH(SIC_IAR7)
395#endif
396#ifdef SIC_IAR8
397 PM_SYS_PUSH(SIC_IAR8)
398 PM_SYS_PUSH(SIC_IAR9)
399 PM_SYS_PUSH(SIC_IAR10)
400 PM_SYS_PUSH(SIC_IAR11)
401#endif
402
403#ifdef SICA_IAR0
404 PM_SYS_PUSH(SICA_IAR0)
405 PM_SYS_PUSH(SICA_IAR1)
406 PM_SYS_PUSH(SICA_IAR2)
407 PM_SYS_PUSH(SICA_IAR3)
408 PM_SYS_PUSH(SICA_IAR4)
409 PM_SYS_PUSH(SICA_IAR5)
410 PM_SYS_PUSH(SICA_IAR6)
411 PM_SYS_PUSH(SICA_IAR7)
412#endif
413
414#ifdef SIC_IWR
415 PM_SYS_PUSH(SIC_IWR)
416#endif
417#ifdef SIC_IWR0
418 PM_SYS_PUSH(SIC_IWR0)
419#endif
420#ifdef SIC_IWR1
421 PM_SYS_PUSH(SIC_IWR1)
422#endif
423#ifdef SIC_IWR2
424 PM_SYS_PUSH(SIC_IWR2)
425#endif
426#ifdef SICA_IWR0
427 PM_SYS_PUSH(SICA_IWR0)
428#endif
429#ifdef SICA_IWR1
430 PM_SYS_PUSH(SICA_IWR1)
431#endif
432
433#ifdef PINT0_ASSIGN
434 PM_SYS_PUSH(PINT0_ASSIGN)
435 PM_SYS_PUSH(PINT1_ASSIGN)
436 PM_SYS_PUSH(PINT2_ASSIGN)
437 PM_SYS_PUSH(PINT3_ASSIGN)
438#endif
439
440 PM_SYS_PUSH(EBIU_AMBCTL0)
441 PM_SYS_PUSH(EBIU_AMBCTL1)
442 PM_SYS_PUSH16(EBIU_AMGCTL)
443
444#ifdef EBIU_FCTL
445 PM_SYS_PUSH(EBIU_MBSCTL)
446 PM_SYS_PUSH(EBIU_MODE)
447 PM_SYS_PUSH(EBIU_FCTL)
448#endif
449
450 PM_SYS_PUSH16(SYSCR)
451
452 /* Save Core MMRs */
453 P0.H = hi(SRAM_BASE_ADDRESS);
454 P0.L = lo(SRAM_BASE_ADDRESS);
455
456 PM_PUSH(DMEM_CONTROL)
457 PM_PUSH(DCPLB_ADDR0)
458 PM_PUSH(DCPLB_ADDR1)
459 PM_PUSH(DCPLB_ADDR2)
460 PM_PUSH(DCPLB_ADDR3)
461 PM_PUSH(DCPLB_ADDR4)
462 PM_PUSH(DCPLB_ADDR5)
463 PM_PUSH(DCPLB_ADDR6)
464 PM_PUSH(DCPLB_ADDR7)
465 PM_PUSH(DCPLB_ADDR8)
466 PM_PUSH(DCPLB_ADDR9)
467 PM_PUSH(DCPLB_ADDR10)
468 PM_PUSH(DCPLB_ADDR11)
469 PM_PUSH(DCPLB_ADDR12)
470 PM_PUSH(DCPLB_ADDR13)
471 PM_PUSH(DCPLB_ADDR14)
472 PM_PUSH(DCPLB_ADDR15)
473 PM_PUSH(DCPLB_DATA0)
474 PM_PUSH(DCPLB_DATA1)
475 PM_PUSH(DCPLB_DATA2)
476 PM_PUSH(DCPLB_DATA3)
477 PM_PUSH(DCPLB_DATA4)
478 PM_PUSH(DCPLB_DATA5)
479 PM_PUSH(DCPLB_DATA6)
480 PM_PUSH(DCPLB_DATA7)
481 PM_PUSH(DCPLB_DATA8)
482 PM_PUSH(DCPLB_DATA9)
483 PM_PUSH(DCPLB_DATA10)
484 PM_PUSH(DCPLB_DATA11)
485 PM_PUSH(DCPLB_DATA12)
486 PM_PUSH(DCPLB_DATA13)
487 PM_PUSH(DCPLB_DATA14)
488 PM_PUSH(DCPLB_DATA15)
489 PM_PUSH(IMEM_CONTROL)
490 PM_PUSH(ICPLB_ADDR0)
491 PM_PUSH(ICPLB_ADDR1)
492 PM_PUSH(ICPLB_ADDR2)
493 PM_PUSH(ICPLB_ADDR3)
494 PM_PUSH(ICPLB_ADDR4)
495 PM_PUSH(ICPLB_ADDR5)
496 PM_PUSH(ICPLB_ADDR6)
497 PM_PUSH(ICPLB_ADDR7)
498 PM_PUSH(ICPLB_ADDR8)
499 PM_PUSH(ICPLB_ADDR9)
500 PM_PUSH(ICPLB_ADDR10)
501 PM_PUSH(ICPLB_ADDR11)
502 PM_PUSH(ICPLB_ADDR12)
503 PM_PUSH(ICPLB_ADDR13)
504 PM_PUSH(ICPLB_ADDR14)
505 PM_PUSH(ICPLB_ADDR15)
506 PM_PUSH(ICPLB_DATA0)
507 PM_PUSH(ICPLB_DATA1)
508 PM_PUSH(ICPLB_DATA2)
509 PM_PUSH(ICPLB_DATA3)
510 PM_PUSH(ICPLB_DATA4)
511 PM_PUSH(ICPLB_DATA5)
512 PM_PUSH(ICPLB_DATA6)
513 PM_PUSH(ICPLB_DATA7)
514 PM_PUSH(ICPLB_DATA8)
515 PM_PUSH(ICPLB_DATA9)
516 PM_PUSH(ICPLB_DATA10)
517 PM_PUSH(ICPLB_DATA11)
518 PM_PUSH(ICPLB_DATA12)
519 PM_PUSH(ICPLB_DATA13)
520 PM_PUSH(ICPLB_DATA14)
521 PM_PUSH(ICPLB_DATA15)
522 PM_PUSH(EVT0)
523 PM_PUSH(EVT1)
524 PM_PUSH(EVT2)
525 PM_PUSH(EVT3)
526 PM_PUSH(EVT4)
527 PM_PUSH(EVT5)
528 PM_PUSH(EVT6)
529 PM_PUSH(EVT7)
530 PM_PUSH(EVT8)
531 PM_PUSH(EVT9)
532 PM_PUSH(EVT10)
533 PM_PUSH(EVT11)
534 PM_PUSH(EVT12)
535 PM_PUSH(EVT13)
536 PM_PUSH(EVT14)
537 PM_PUSH(EVT15)
538 PM_PUSH(IMASK)
539 PM_PUSH(ILAT)
540 PM_PUSH(IPRIO)
541 PM_PUSH(TCNTL)
542 PM_PUSH(TPERIOD)
543 PM_PUSH(TSCALE)
544 PM_PUSH(TCOUNT)
545 PM_PUSH(TBUFCTL)
546
547 /* Save Core Registers */
548 [--sp] = SYSCFG;
549 [--sp] = ( R7:0, P5:0 );
550 [--sp] = fp;
551 [--sp] = usp;
552
553 [--sp] = i0;
554 [--sp] = i1;
555 [--sp] = i2;
556 [--sp] = i3;
557
558 [--sp] = m0;
559 [--sp] = m1;
560 [--sp] = m2;
561 [--sp] = m3;
562
563 [--sp] = l0;
564 [--sp] = l1;
565 [--sp] = l2;
566 [--sp] = l3;
567
568 [--sp] = b0;
569 [--sp] = b1;
570 [--sp] = b2;
571 [--sp] = b3;
572 [--sp] = a0.x;
573 [--sp] = a0.w;
574 [--sp] = a1.x;
575 [--sp] = a1.w;
576
577 [--sp] = LC0;
578 [--sp] = LC1;
579 [--sp] = LT0;
580 [--sp] = LT1;
581 [--sp] = LB0;
582 [--sp] = LB1;
583
584 [--sp] = ASTAT;
585 [--sp] = CYCLES;
586 [--sp] = CYCLES2;
587
588 [--sp] = RETS;
589 r0 = RETI;
590 [--sp] = r0;
591 [--sp] = RETX;
592 [--sp] = RETN;
593 [--sp] = RETE;
594 [--sp] = SEQSTAT;
595
596 /* Save Magic, return address and Stack Pointer */
597 P0.H = 0;
598 P0.L = 0;
599 R0.H = 0xDEAD; /* Hibernate Magic */
600 R0.L = 0xBEEF;
601 [P0++] = R0; /* Store Hibernate Magic */
602 R0.H = .Lpm_resume_here;
603 R0.L = .Lpm_resume_here;
604 [P0++] = R0; /* Save Return Address */
605 [P0++] = SP; /* Save Stack Pointer */
606 P0.H = _hibernate_mode;
607 P0.L = _hibernate_mode;
608 R0 = R2;
609 call (P0); /* Goodbye */
610
611.Lpm_resume_here:
612
613 /* Restore Core Registers */
614 SEQSTAT = [sp++];
615 RETE = [sp++];
616 RETN = [sp++];
617 RETX = [sp++];
618 r0 = [sp++];
619 RETI = r0;
620 RETS = [sp++];
621
622 CYCLES2 = [sp++];
623 CYCLES = [sp++];
624 ASTAT = [sp++];
625
626 LB1 = [sp++];
627 LB0 = [sp++];
628 LT1 = [sp++];
629 LT0 = [sp++];
630 LC1 = [sp++];
631 LC0 = [sp++];
632
633 a1.w = [sp++];
634 a1.x = [sp++];
635 a0.w = [sp++];
636 a0.x = [sp++];
637 b3 = [sp++];
638 b2 = [sp++];
639 b1 = [sp++];
640 b0 = [sp++];
641
642 l3 = [sp++];
643 l2 = [sp++];
644 l1 = [sp++];
645 l0 = [sp++];
646
647 m3 = [sp++];
648 m2 = [sp++];
649 m1 = [sp++];
650 m0 = [sp++];
651
652 i3 = [sp++];
653 i2 = [sp++];
654 i1 = [sp++];
655 i0 = [sp++];
656
657 usp = [sp++];
658 fp = [sp++];
659
660 ( R7 : 0, P5 : 0) = [ SP ++ ];
661 SYSCFG = [sp++];
662
663 /* Restore Core MMRs */
664
665 PM_POP(TBUFCTL)
666 PM_POP(TCOUNT)
667 PM_POP(TSCALE)
668 PM_POP(TPERIOD)
669 PM_POP(TCNTL)
670 PM_POP(IPRIO)
671 PM_POP(ILAT)
672 PM_POP(IMASK)
673 PM_POP(EVT15)
674 PM_POP(EVT14)
675 PM_POP(EVT13)
676 PM_POP(EVT12)
677 PM_POP(EVT11)
678 PM_POP(EVT10)
679 PM_POP(EVT9)
680 PM_POP(EVT8)
681 PM_POP(EVT7)
682 PM_POP(EVT6)
683 PM_POP(EVT5)
684 PM_POP(EVT4)
685 PM_POP(EVT3)
686 PM_POP(EVT2)
687 PM_POP(EVT1)
688 PM_POP(EVT0)
689 PM_POP(ICPLB_DATA15)
690 PM_POP(ICPLB_DATA14)
691 PM_POP(ICPLB_DATA13)
692 PM_POP(ICPLB_DATA12)
693 PM_POP(ICPLB_DATA11)
694 PM_POP(ICPLB_DATA10)
695 PM_POP(ICPLB_DATA9)
696 PM_POP(ICPLB_DATA8)
697 PM_POP(ICPLB_DATA7)
698 PM_POP(ICPLB_DATA6)
699 PM_POP(ICPLB_DATA5)
700 PM_POP(ICPLB_DATA4)
701 PM_POP(ICPLB_DATA3)
702 PM_POP(ICPLB_DATA2)
703 PM_POP(ICPLB_DATA1)
704 PM_POP(ICPLB_DATA0)
705 PM_POP(ICPLB_ADDR15)
706 PM_POP(ICPLB_ADDR14)
707 PM_POP(ICPLB_ADDR13)
708 PM_POP(ICPLB_ADDR12)
709 PM_POP(ICPLB_ADDR11)
710 PM_POP(ICPLB_ADDR10)
711 PM_POP(ICPLB_ADDR9)
712 PM_POP(ICPLB_ADDR8)
713 PM_POP(ICPLB_ADDR7)
714 PM_POP(ICPLB_ADDR6)
715 PM_POP(ICPLB_ADDR5)
716 PM_POP(ICPLB_ADDR4)
717 PM_POP(ICPLB_ADDR3)
718 PM_POP(ICPLB_ADDR2)
719 PM_POP(ICPLB_ADDR1)
720 PM_POP(ICPLB_ADDR0)
721 PM_POP(IMEM_CONTROL)
722 PM_POP(DCPLB_DATA15)
723 PM_POP(DCPLB_DATA14)
724 PM_POP(DCPLB_DATA13)
725 PM_POP(DCPLB_DATA12)
726 PM_POP(DCPLB_DATA11)
727 PM_POP(DCPLB_DATA10)
728 PM_POP(DCPLB_DATA9)
729 PM_POP(DCPLB_DATA8)
730 PM_POP(DCPLB_DATA7)
731 PM_POP(DCPLB_DATA6)
732 PM_POP(DCPLB_DATA5)
733 PM_POP(DCPLB_DATA4)
734 PM_POP(DCPLB_DATA3)
735 PM_POP(DCPLB_DATA2)
736 PM_POP(DCPLB_DATA1)
737 PM_POP(DCPLB_DATA0)
738 PM_POP(DCPLB_ADDR15)
739 PM_POP(DCPLB_ADDR14)
740 PM_POP(DCPLB_ADDR13)
741 PM_POP(DCPLB_ADDR12)
742 PM_POP(DCPLB_ADDR11)
743 PM_POP(DCPLB_ADDR10)
744 PM_POP(DCPLB_ADDR9)
745 PM_POP(DCPLB_ADDR8)
746 PM_POP(DCPLB_ADDR7)
747 PM_POP(DCPLB_ADDR6)
748 PM_POP(DCPLB_ADDR5)
749 PM_POP(DCPLB_ADDR4)
750 PM_POP(DCPLB_ADDR3)
751 PM_POP(DCPLB_ADDR2)
752 PM_POP(DCPLB_ADDR1)
753 PM_POP(DCPLB_ADDR0)
754 PM_POP(DMEM_CONTROL)
755
756 /* Restore System MMRs */
757
758 P0.H = hi(PLL_CTL);
759 P0.L = lo(PLL_CTL);
760 PM_SYS_POP16(SYSCR)
761
762#ifdef EBIU_FCTL
763 PM_SYS_POP(EBIU_FCTL)
764 PM_SYS_POP(EBIU_MODE)
765 PM_SYS_POP(EBIU_MBSCTL)
766#endif
767 PM_SYS_POP16(EBIU_AMGCTL)
768 PM_SYS_POP(EBIU_AMBCTL1)
769 PM_SYS_POP(EBIU_AMBCTL0)
770
771#ifdef PINT0_ASSIGN
772 PM_SYS_POP(PINT3_ASSIGN)
773 PM_SYS_POP(PINT2_ASSIGN)
774 PM_SYS_POP(PINT1_ASSIGN)
775 PM_SYS_POP(PINT0_ASSIGN)
776#endif
777
778#ifdef SICA_IWR1
779 PM_SYS_POP(SICA_IWR1)
780#endif
781#ifdef SICA_IWR0
782 PM_SYS_POP(SICA_IWR0)
783#endif
784#ifdef SIC_IWR2
785 PM_SYS_POP(SIC_IWR2)
786#endif
787#ifdef SIC_IWR1
788 PM_SYS_POP(SIC_IWR1)
789#endif
790#ifdef SIC_IWR0
791 PM_SYS_POP(SIC_IWR0)
792#endif
793#ifdef SIC_IWR
794 PM_SYS_POP(SIC_IWR)
795#endif
796
797#ifdef SICA_IAR0
798 PM_SYS_POP(SICA_IAR7)
799 PM_SYS_POP(SICA_IAR6)
800 PM_SYS_POP(SICA_IAR5)
801 PM_SYS_POP(SICA_IAR4)
802 PM_SYS_POP(SICA_IAR3)
803 PM_SYS_POP(SICA_IAR2)
804 PM_SYS_POP(SICA_IAR1)
805 PM_SYS_POP(SICA_IAR0)
806#endif
807
808#ifdef SIC_IAR8
809 PM_SYS_POP(SIC_IAR11)
810 PM_SYS_POP(SIC_IAR10)
811 PM_SYS_POP(SIC_IAR9)
812 PM_SYS_POP(SIC_IAR8)
813#endif
814#ifdef SIC_IAR7
815 PM_SYS_POP(SIC_IAR7)
816#endif
817#ifdef SIC_IAR6
818 PM_SYS_POP(SIC_IAR6)
819 PM_SYS_POP(SIC_IAR5)
820 PM_SYS_POP(SIC_IAR4)
821#endif
822#ifdef SIC_IAR3
823 PM_SYS_POP(SIC_IAR3)
824#endif
825#ifdef SIC_IAR2
826 PM_SYS_POP(SIC_IAR2)
827 PM_SYS_POP(SIC_IAR1)
828 PM_SYS_POP(SIC_IAR0)
829#endif
830#ifdef SICA_IMASK1
831 PM_SYS_POP(SICA_IMASK1)
832#endif
833#ifdef SICA_IMASK0
834 PM_SYS_POP(SICA_IMASK0)
835#endif
836#ifdef SIC_IMASK
837 PM_SYS_POP(SIC_IMASK)
838#endif
839#ifdef SIC_IMASK2
840 PM_SYS_POP(SIC_IMASK2)
841#endif
842#ifdef SIC_IMASK1
843 PM_SYS_POP(SIC_IMASK1)
844#endif
845#ifdef SIC_IMASK0
846 PM_SYS_POP(SIC_IMASK0)
847#endif
848
849 [--sp] = RETI; /* Clear Global Interrupt Disable */
850 SP += 4;
851
852 RETS = [SP++];
853 ( R7:0, P5:0 ) = [SP++];
854 RTS;
855ENDPROC(_do_hibernate)
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index 038f70e0be65..eceb484d90f9 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -158,23 +158,45 @@ ENTRY(_ex_single_step)
158 cc = r7 == r6; 158 cc = r7 == r6;
159 if cc jump _bfin_return_from_exception; 159 if cc jump _bfin_return_from_exception;
160 160
161 /* Don't do single step in hardware exception handler */
162 p5.l = lo(IPEND);
163 p5.h = hi(IPEND);
164 r6 = [p5];
165 cc = bittst(r6, 5);
166 if cc jump _bfin_return_from_exception;
167
168#ifdef CONFIG_KGDB
169 /* skip single step if current interrupt priority is higher than
170 * that of the first instruction, from which gdb starts single step */
171 r6 >>= 6;
172 r7 = 10;
173.Lfind_priority_start:
174 cc = bittst(r6, 0);
175 if cc jump .Lfind_priority_done;
176 r6 >>= 1;
177 r7 += -1;
178 cc = r7 == 0;
179 if cc jump .Lfind_priority_done;
180 jump.s .Lfind_priority_start;
181.Lfind_priority_done:
182 p4.l = _debugger_step;
183 p4.h = _debugger_step;
184 r6 = [p4];
185 cc = r6 == 0;
186 if cc jump .Ldo_single_step;
187 r6 += -1;
188 cc = r6 < r7;
189 if cc jump _bfin_return_from_exception;
190.Ldo_single_step:
191#endif
192
161 /* If we were in user mode, do the single step normally. */ 193 /* If we were in user mode, do the single step normally. */
162 p5.l = lo(IPEND);
163 p5.h = hi(IPEND);
164 r6 = [p5]; 194 r6 = [p5];
165 r7 = 0xffe0 (z); 195 r7 = 0xffe0 (z);
166 r7 = r7 & r6; 196 r7 = r7 & r6;
167 cc = r7 == 0; 197 cc = r7 == 0;
168 if !cc jump 1f; 198 if cc jump 1f;
169
170 /* Single stepping only a single instruction, so clear the trace
171 * bit here. */
172 r7 = syscfg;
173 bitclr (r7, 0);
174 syscfg = R7;
175 jump _ex_trap_c;
176 199
1771:
178 /* 200 /*
179 * We were in an interrupt handler. By convention, all of them save 201 * We were in an interrupt handler. By convention, all of them save
180 * SYSCFG with their first instruction, so by checking whether our 202 * SYSCFG with their first instruction, so by checking whether our
@@ -202,11 +224,15 @@ ENTRY(_ex_single_step)
202 cc = R7 == R6; 224 cc = R7 == R6;
203 if !cc jump _bfin_return_from_exception; 225 if !cc jump _bfin_return_from_exception;
204 226
2271:
228 /* Single stepping only a single instruction, so clear the trace
229 * bit here. */
205 r7 = syscfg; 230 r7 = syscfg;
206 bitclr (r7, 0); 231 bitclr (r7, 0);
207 syscfg = R7; 232 syscfg = R7;
208 233
209 /* Fall through to _bfin_return_from_exception. */ 234 jump _ex_trap_c;
235
210ENDPROC(_ex_single_step) 236ENDPROC(_ex_single_step)
211 237
212ENTRY(_bfin_return_from_exception) 238ENTRY(_bfin_return_from_exception)
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index f5fd768022ea..64d746114e4b 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -459,6 +459,8 @@ static struct irq_chip bfin_gpio_irqchip = {
459 .mask = bfin_gpio_mask_irq, 459 .mask = bfin_gpio_mask_irq,
460 .mask_ack = bfin_gpio_mask_ack_irq, 460 .mask_ack = bfin_gpio_mask_ack_irq,
461 .unmask = bfin_gpio_unmask_irq, 461 .unmask = bfin_gpio_unmask_irq,
462 .disable = bfin_gpio_mask_irq,
463 .enable = bfin_gpio_unmask_irq,
462 .set_type = bfin_gpio_irq_type, 464 .set_type = bfin_gpio_irq_type,
463 .startup = bfin_gpio_irq_startup, 465 .startup = bfin_gpio_irq_startup,
464 .shutdown = bfin_gpio_irq_shutdown, 466 .shutdown = bfin_gpio_irq_shutdown,
@@ -846,6 +848,8 @@ static struct irq_chip bfin_gpio_irqchip = {
846 .mask = bfin_gpio_mask_irq, 848 .mask = bfin_gpio_mask_irq,
847 .mask_ack = bfin_gpio_mask_ack_irq, 849 .mask_ack = bfin_gpio_mask_ack_irq,
848 .unmask = bfin_gpio_unmask_irq, 850 .unmask = bfin_gpio_unmask_irq,
851 .disable = bfin_gpio_mask_irq,
852 .enable = bfin_gpio_unmask_irq,
849 .set_type = bfin_gpio_irq_type, 853 .set_type = bfin_gpio_irq_type,
850 .startup = bfin_gpio_irq_startup, 854 .startup = bfin_gpio_irq_startup,
851 .shutdown = bfin_gpio_irq_shutdown, 855 .shutdown = bfin_gpio_irq_shutdown,
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index 0be805ca423f..4fe6a2366b13 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -38,8 +38,9 @@
38#include <linux/io.h> 38#include <linux/io.h>
39#include <linux/irq.h> 39#include <linux/irq.h>
40 40
41#include <asm/dpmc.h>
42#include <asm/gpio.h> 41#include <asm/gpio.h>
42#include <asm/dma.h>
43#include <asm/dpmc.h>
43 44
44#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_H 45#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_H
45#define WAKEUP_TYPE PM_WAKE_HIGH 46#define WAKEUP_TYPE PM_WAKE_HIGH
@@ -61,16 +62,17 @@
61#define WAKEUP_TYPE PM_WAKE_BOTH_EDGES 62#define WAKEUP_TYPE PM_WAKE_BOTH_EDGES
62#endif 63#endif
63 64
65
64void bfin_pm_suspend_standby_enter(void) 66void bfin_pm_suspend_standby_enter(void)
65{ 67{
68 unsigned long flags;
69
66#ifdef CONFIG_PM_WAKEUP_BY_GPIO 70#ifdef CONFIG_PM_WAKEUP_BY_GPIO
67 gpio_pm_wakeup_request(CONFIG_PM_WAKEUP_GPIO_NUMBER, WAKEUP_TYPE); 71 gpio_pm_wakeup_request(CONFIG_PM_WAKEUP_GPIO_NUMBER, WAKEUP_TYPE);
68#endif 72#endif
69 73
70 u32 flags;
71
72 local_irq_save(flags); 74 local_irq_save(flags);
73 bfin_pm_setup(); 75 bfin_pm_standby_setup();
74 76
75#ifdef CONFIG_PM_BFIN_SLEEP_DEEPER 77#ifdef CONFIG_PM_BFIN_SLEEP_DEEPER
76 sleep_deeper(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); 78 sleep_deeper(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]);
@@ -78,7 +80,7 @@ void bfin_pm_suspend_standby_enter(void)
78 sleep_mode(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]); 80 sleep_mode(bfin_sic_iwr[0], bfin_sic_iwr[1], bfin_sic_iwr[2]);
79#endif 81#endif
80 82
81 bfin_pm_restore(); 83 bfin_pm_standby_restore();
82 84
83#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 85#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
84 bfin_write_SIC_IWR0(IWR_ENABLE_ALL); 86 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
@@ -93,6 +95,195 @@ void bfin_pm_suspend_standby_enter(void)
93 local_irq_restore(flags); 95 local_irq_restore(flags);
94} 96}
95 97
98int bf53x_suspend_l1_mem(unsigned char *memptr)
99{
100 dma_memcpy(memptr, (const void *) L1_CODE_START, L1_CODE_LENGTH);
101 dma_memcpy(memptr + L1_CODE_LENGTH, (const void *) L1_DATA_A_START,
102 L1_DATA_A_LENGTH);
103 dma_memcpy(memptr + L1_CODE_LENGTH + L1_DATA_A_LENGTH,
104 (const void *) L1_DATA_B_START, L1_DATA_B_LENGTH);
105 memcpy(memptr + L1_CODE_LENGTH + L1_DATA_A_LENGTH +
106 L1_DATA_B_LENGTH, (const void *) L1_SCRATCH_START,
107 L1_SCRATCH_LENGTH);
108
109 return 0;
110}
111
112int bf53x_resume_l1_mem(unsigned char *memptr)
113{
114 dma_memcpy((void *) L1_CODE_START, memptr, L1_CODE_LENGTH);
115 dma_memcpy((void *) L1_DATA_A_START, memptr + L1_CODE_LENGTH,
116 L1_DATA_A_LENGTH);
117 dma_memcpy((void *) L1_DATA_B_START, memptr + L1_CODE_LENGTH +
118 L1_DATA_A_LENGTH, L1_DATA_B_LENGTH);
119 memcpy((void *) L1_SCRATCH_START, memptr + L1_CODE_LENGTH +
120 L1_DATA_A_LENGTH + L1_DATA_B_LENGTH, L1_SCRATCH_LENGTH);
121
122 return 0;
123}
124
125#ifdef CONFIG_BFIN_WB
126static void flushinv_all_dcache(void)
127{
128 u32 way, bank, subbank, set;
129 u32 status, addr;
130 u32 dmem_ctl = bfin_read_DMEM_CONTROL();
131
132 for (bank = 0; bank < 2; ++bank) {
133 if (!(dmem_ctl & (1 << (DMC1_P - bank))))
134 continue;
135
136 for (way = 0; way < 2; ++way)
137 for (subbank = 0; subbank < 4; ++subbank)
138 for (set = 0; set < 64; ++set) {
139
140 bfin_write_DTEST_COMMAND(
141 way << 26 |
142 bank << 23 |
143 subbank << 16 |
144 set << 5
145 );
146 CSYNC();
147 status = bfin_read_DTEST_DATA0();
148
149 /* only worry about valid/dirty entries */
150 if ((status & 0x3) != 0x3)
151 continue;
152
153 /* construct the address using the tag */
154 addr = (status & 0xFFFFC800) | (subbank << 12) | (set << 5);
155
156 /* flush it */
157 __asm__ __volatile__("FLUSHINV[%0];" : : "a"(addr));
158 }
159 }
160}
161#endif
162
163static inline void dcache_disable(void)
164{
165#ifdef CONFIG_BFIN_DCACHE
166 unsigned long ctrl;
167
168#ifdef CONFIG_BFIN_WB
169 flushinv_all_dcache();
170#endif
171 SSYNC();
172 ctrl = bfin_read_DMEM_CONTROL();
173 ctrl &= ~ENDCPLB;
174 bfin_write_DMEM_CONTROL(ctrl);
175 SSYNC();
176#endif
177}
178
179static inline void dcache_enable(void)
180{
181#ifdef CONFIG_BFIN_DCACHE
182 unsigned long ctrl;
183 SSYNC();
184 ctrl = bfin_read_DMEM_CONTROL();
185 ctrl |= ENDCPLB;
186 bfin_write_DMEM_CONTROL(ctrl);
187 SSYNC();
188#endif
189}
190
191static inline void icache_disable(void)
192{
193#ifdef CONFIG_BFIN_ICACHE
194 unsigned long ctrl;
195 SSYNC();
196 ctrl = bfin_read_IMEM_CONTROL();
197 ctrl &= ~ENICPLB;
198 bfin_write_IMEM_CONTROL(ctrl);
199 SSYNC();
200#endif
201}
202
203static inline void icache_enable(void)
204{
205#ifdef CONFIG_BFIN_ICACHE
206 unsigned long ctrl;
207 SSYNC();
208 ctrl = bfin_read_IMEM_CONTROL();
209 ctrl |= ENICPLB;
210 bfin_write_IMEM_CONTROL(ctrl);
211 SSYNC();
212#endif
213}
214
215int bfin_pm_suspend_mem_enter(void)
216{
217 unsigned long flags;
218 int wakeup, ret;
219
220 unsigned char *memptr = kmalloc(L1_CODE_LENGTH + L1_DATA_A_LENGTH
221 + L1_DATA_B_LENGTH + L1_SCRATCH_LENGTH,
222 GFP_KERNEL);
223
224 if (memptr == NULL) {
225 panic("bf53x_suspend_l1_mem malloc failed");
226 return -ENOMEM;
227 }
228
229 wakeup = bfin_read_VR_CTL() & ~FREQ;
230 wakeup |= SCKELOW;
231
232 /* FIXME: merge this somehow with set_irq_wake */
233#ifdef CONFIG_PM_BFIN_WAKE_RTC
234 wakeup |= WAKE;
235#endif
236#ifdef CONFIG_PM_BFIN_WAKE_PH6
237 wakeup |= PHYWE;
238#endif
239#ifdef CONFIG_PM_BFIN_WAKE_CAN
240 wakeup |= CANWE;
241#endif
242#ifdef CONFIG_PM_BFIN_WAKE_GP
243 wakeup |= GPWE;
244#endif
245#ifdef CONFIG_PM_BFIN_WAKE_USB
246 wakeup |= USBWE;
247#endif
248#ifdef CONFIG_PM_BFIN_WAKE_KEYPAD
249 wakeup |= KPADWE;
250#endif
251#ifdef CONFIG_PM_BFIN_WAKE_ROTARY
252 wakeup |= ROTWE;
253#endif
254
255 local_irq_save(flags);
256
257 ret = blackfin_dma_suspend();
258
259 if (ret) {
260 local_irq_restore(flags);
261 kfree(memptr);
262 return ret;
263 }
264
265 bfin_gpio_pm_hibernate_suspend();
266
267 dcache_disable();
268 icache_disable();
269 bf53x_suspend_l1_mem(memptr);
270
271 do_hibernate(wakeup); /* Goodbye */
272
273 bf53x_resume_l1_mem(memptr);
274
275 icache_enable();
276 dcache_enable();
277
278 bfin_gpio_pm_hibernate_restore();
279 blackfin_dma_resume();
280
281 local_irq_restore(flags);
282 kfree(memptr);
283
284 return 0;
285}
286
96/* 287/*
97 * bfin_pm_valid - Tell the PM core that we only support the standby sleep 288 * bfin_pm_valid - Tell the PM core that we only support the standby sleep
98 * state 289 * state
@@ -101,7 +292,24 @@ void bfin_pm_suspend_standby_enter(void)
101 */ 292 */
102static int bfin_pm_valid(suspend_state_t state) 293static int bfin_pm_valid(suspend_state_t state)
103{ 294{
104 return (state == PM_SUSPEND_STANDBY); 295 return (state == PM_SUSPEND_STANDBY
296#ifndef BF533_FAMILY
297 /*
298 * On BF533/2/1:
299 * If we enter Hibernate the SCKE Pin is driven Low,
300 * so that the SDRAM enters Self Refresh Mode.
301 * However when the reset sequence that follows hibernate
302 * state is executed, SCKE is driven High, taking the
303 * SDRAM out of Self Refresh.
304 *
305 * If you reconfigure and access the SDRAM "very quickly",
306 * you are likely to avoid errors, otherwise the SDRAM
307 * start losing its contents.
308 * An external HW workaround is possible using logic gates.
309 */
310 || state == PM_SUSPEND_MEM
311#endif
312 );
105} 313}
106 314
107/* 315/*
@@ -115,10 +323,9 @@ static int bfin_pm_enter(suspend_state_t state)
115 case PM_SUSPEND_STANDBY: 323 case PM_SUSPEND_STANDBY:
116 bfin_pm_suspend_standby_enter(); 324 bfin_pm_suspend_standby_enter();
117 break; 325 break;
118
119 case PM_SUSPEND_MEM: 326 case PM_SUSPEND_MEM:
120 return -ENOTSUPP; 327 bfin_pm_suspend_mem_enter();
121 328 break;
122 default: 329 default:
123 return -EINVAL; 330 return -EINVAL;
124 } 331 }
diff --git a/arch/blackfin/mm/blackfin_sram.c b/arch/blackfin/mm/blackfin_sram.c
index 3246f91c7baa..5af3c31c9365 100644
--- a/arch/blackfin/mm/blackfin_sram.c
+++ b/arch/blackfin/mm/blackfin_sram.c
@@ -41,215 +41,309 @@
41#include <asm/blackfin.h> 41#include <asm/blackfin.h>
42#include "blackfin_sram.h" 42#include "blackfin_sram.h"
43 43
44spinlock_t l1sram_lock, l1_data_sram_lock, l1_inst_sram_lock; 44static spinlock_t l1sram_lock, l1_data_sram_lock, l1_inst_sram_lock;
45 45static spinlock_t l2_sram_lock;
46#if CONFIG_L1_MAX_PIECE < 16
47#undef CONFIG_L1_MAX_PIECE
48#define CONFIG_L1_MAX_PIECE 16
49#endif
50
51#if CONFIG_L1_MAX_PIECE > 1024
52#undef CONFIG_L1_MAX_PIECE
53#define CONFIG_L1_MAX_PIECE 1024
54#endif
55
56#define SRAM_SLT_NULL 0
57#define SRAM_SLT_FREE 1
58#define SRAM_SLT_ALLOCATED 2
59 46
60/* the data structure for L1 scratchpad and DATA SRAM */ 47/* the data structure for L1 scratchpad and DATA SRAM */
61struct l1_sram_piece { 48struct sram_piece {
62 void *paddr; 49 void *paddr;
63 int size; 50 int size;
64 int flag;
65 pid_t pid; 51 pid_t pid;
52 struct sram_piece *next;
66}; 53};
67 54
68static struct l1_sram_piece l1_ssram[CONFIG_L1_MAX_PIECE]; 55static struct sram_piece free_l1_ssram_head, used_l1_ssram_head;
69 56
70#if L1_DATA_A_LENGTH != 0 57#if L1_DATA_A_LENGTH != 0
71static struct l1_sram_piece l1_data_A_sram[CONFIG_L1_MAX_PIECE]; 58static struct sram_piece free_l1_data_A_sram_head, used_l1_data_A_sram_head;
72#endif 59#endif
73 60
74#if L1_DATA_B_LENGTH != 0 61#if L1_DATA_B_LENGTH != 0
75static struct l1_sram_piece l1_data_B_sram[CONFIG_L1_MAX_PIECE]; 62static struct sram_piece free_l1_data_B_sram_head, used_l1_data_B_sram_head;
76#endif 63#endif
77 64
78#if L1_CODE_LENGTH != 0 65#if L1_CODE_LENGTH != 0
79static struct l1_sram_piece l1_inst_sram[CONFIG_L1_MAX_PIECE]; 66static struct sram_piece free_l1_inst_sram_head, used_l1_inst_sram_head;
67#endif
68
69#ifdef L2_LENGTH
70static struct sram_piece free_l2_sram_head, used_l2_sram_head;
80#endif 71#endif
81 72
73static struct kmem_cache *sram_piece_cache;
74
82/* L1 Scratchpad SRAM initialization function */ 75/* L1 Scratchpad SRAM initialization function */
83void __init l1sram_init(void) 76static void __init l1sram_init(void)
84{ 77{
85 printk(KERN_INFO "Blackfin Scratchpad data SRAM: %d KB\n", 78 free_l1_ssram_head.next =
86 L1_SCRATCH_LENGTH >> 10); 79 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
80 if (!free_l1_ssram_head.next) {
81 printk(KERN_INFO"Fail to initialize Scratchpad data SRAM.\n");
82 return;
83 }
84
85 free_l1_ssram_head.next->paddr = (void *)L1_SCRATCH_START;
86 free_l1_ssram_head.next->size = L1_SCRATCH_LENGTH;
87 free_l1_ssram_head.next->pid = 0;
88 free_l1_ssram_head.next->next = NULL;
87 89
88 memset(&l1_ssram, 0x00, sizeof(l1_ssram)); 90 used_l1_ssram_head.next = NULL;
89 l1_ssram[0].paddr = (void *)L1_SCRATCH_START;
90 l1_ssram[0].size = L1_SCRATCH_LENGTH;
91 l1_ssram[0].flag = SRAM_SLT_FREE;
92 91
93 /* mutex initialize */ 92 /* mutex initialize */
94 spin_lock_init(&l1sram_lock); 93 spin_lock_init(&l1sram_lock);
94
95 printk(KERN_INFO "Blackfin Scratchpad data SRAM: %d KB\n",
96 L1_SCRATCH_LENGTH >> 10);
95} 97}
96 98
97void __init l1_data_sram_init(void) 99static void __init l1_data_sram_init(void)
98{ 100{
99#if L1_DATA_A_LENGTH != 0 101#if L1_DATA_A_LENGTH != 0
100 memset(&l1_data_A_sram, 0x00, sizeof(l1_data_A_sram)); 102 free_l1_data_A_sram_head.next =
101 l1_data_A_sram[0].paddr = (void *)L1_DATA_A_START + 103 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
102 (_ebss_l1 - _sdata_l1); 104 if (!free_l1_data_A_sram_head.next) {
103 l1_data_A_sram[0].size = L1_DATA_A_LENGTH - (_ebss_l1 - _sdata_l1); 105 printk(KERN_INFO"Fail to initialize L1 Data A SRAM.\n");
104 l1_data_A_sram[0].flag = SRAM_SLT_FREE; 106 return;
105 107 }
106 printk(KERN_INFO "Blackfin Data A SRAM: %d KB (%d KB free)\n", 108
107 L1_DATA_A_LENGTH >> 10, l1_data_A_sram[0].size >> 10); 109 free_l1_data_A_sram_head.next->paddr =
110 (void *)L1_DATA_A_START + (_ebss_l1 - _sdata_l1);
111 free_l1_data_A_sram_head.next->size =
112 L1_DATA_A_LENGTH - (_ebss_l1 - _sdata_l1);
113 free_l1_data_A_sram_head.next->pid = 0;
114 free_l1_data_A_sram_head.next->next = NULL;
115
116 used_l1_data_A_sram_head.next = NULL;
117
118 printk(KERN_INFO "Blackfin L1 Data A SRAM: %d KB (%d KB free)\n",
119 L1_DATA_A_LENGTH >> 10,
120 free_l1_data_A_sram_head.next->size >> 10);
108#endif 121#endif
109#if L1_DATA_B_LENGTH != 0 122#if L1_DATA_B_LENGTH != 0
110 memset(&l1_data_B_sram, 0x00, sizeof(l1_data_B_sram)); 123 free_l1_data_B_sram_head.next =
111 l1_data_B_sram[0].paddr = (void *)L1_DATA_B_START + 124 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
112 (_ebss_b_l1 - _sdata_b_l1); 125 if (!free_l1_data_B_sram_head.next) {
113 l1_data_B_sram[0].size = L1_DATA_B_LENGTH - (_ebss_b_l1 - _sdata_b_l1); 126 printk(KERN_INFO"Fail to initialize L1 Data B SRAM.\n");
114 l1_data_B_sram[0].flag = SRAM_SLT_FREE; 127 return;
115 128 }
116 printk(KERN_INFO "Blackfin Data B SRAM: %d KB (%d KB free)\n", 129
117 L1_DATA_B_LENGTH >> 10, l1_data_B_sram[0].size >> 10); 130 free_l1_data_B_sram_head.next->paddr =
131 (void *)L1_DATA_B_START + (_ebss_b_l1 - _sdata_b_l1);
132 free_l1_data_B_sram_head.next->size =
133 L1_DATA_B_LENGTH - (_ebss_b_l1 - _sdata_b_l1);
134 free_l1_data_B_sram_head.next->pid = 0;
135 free_l1_data_B_sram_head.next->next = NULL;
136
137 used_l1_data_B_sram_head.next = NULL;
138
139 printk(KERN_INFO "Blackfin L1 Data B SRAM: %d KB (%d KB free)\n",
140 L1_DATA_B_LENGTH >> 10,
141 free_l1_data_B_sram_head.next->size >> 10);
118#endif 142#endif
119 143
120 /* mutex initialize */ 144 /* mutex initialize */
121 spin_lock_init(&l1_data_sram_lock); 145 spin_lock_init(&l1_data_sram_lock);
122} 146}
123 147
124void __init l1_inst_sram_init(void) 148static void __init l1_inst_sram_init(void)
125{ 149{
126#if L1_CODE_LENGTH != 0 150#if L1_CODE_LENGTH != 0
127 memset(&l1_inst_sram, 0x00, sizeof(l1_inst_sram)); 151 free_l1_inst_sram_head.next =
128 l1_inst_sram[0].paddr = (void *)L1_CODE_START + (_etext_l1 - _stext_l1); 152 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
129 l1_inst_sram[0].size = L1_CODE_LENGTH - (_etext_l1 - _stext_l1); 153 if (!free_l1_inst_sram_head.next) {
130 l1_inst_sram[0].flag = SRAM_SLT_FREE; 154 printk(KERN_INFO"Fail to initialize L1 Instruction SRAM.\n");
155 return;
156 }
131 157
132 printk(KERN_INFO "Blackfin Instruction SRAM: %d KB (%d KB free)\n", 158 free_l1_inst_sram_head.next->paddr =
133 L1_CODE_LENGTH >> 10, l1_inst_sram[0].size >> 10); 159 (void *)L1_CODE_START + (_etext_l1 - _stext_l1);
160 free_l1_inst_sram_head.next->size =
161 L1_CODE_LENGTH - (_etext_l1 - _stext_l1);
162 free_l1_inst_sram_head.next->pid = 0;
163 free_l1_inst_sram_head.next->next = NULL;
164
165 used_l1_inst_sram_head.next = NULL;
166
167 printk(KERN_INFO "Blackfin L1 Instruction SRAM: %d KB (%d KB free)\n",
168 L1_CODE_LENGTH >> 10,
169 free_l1_inst_sram_head.next->size >> 10);
134#endif 170#endif
135 171
136 /* mutex initialize */ 172 /* mutex initialize */
137 spin_lock_init(&l1_inst_sram_lock); 173 spin_lock_init(&l1_inst_sram_lock);
138} 174}
139 175
140/* L1 memory allocate function */ 176static void __init l2_sram_init(void)
141static void *_l1_sram_alloc(size_t size, struct l1_sram_piece *pfree, int count)
142{ 177{
143 int i, index = 0; 178#ifdef L2_LENGTH
144 void *addr = NULL; 179 free_l2_sram_head.next =
180 kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
181 if (!free_l2_sram_head.next) {
182 printk(KERN_INFO"Fail to initialize L2 SRAM.\n");
183 return;
184 }
145 185
146 if (size <= 0) 186 free_l2_sram_head.next->paddr = (void *)L2_START +
187 (_etext_l2 - _stext_l2) + (_edata_l2 - _sdata_l2);
188 free_l2_sram_head.next->size = L2_LENGTH -
189 (_etext_l2 - _stext_l2) + (_edata_l2 - _sdata_l2);
190 free_l2_sram_head.next->pid = 0;
191 free_l2_sram_head.next->next = NULL;
192
193 used_l2_sram_head.next = NULL;
194
195 printk(KERN_INFO "Blackfin L2 SRAM: %d KB (%d KB free)\n",
196 L2_LENGTH >> 10,
197 free_l2_sram_head.next->size >> 10);
198#endif
199
200 /* mutex initialize */
201 spin_lock_init(&l2_sram_lock);
202}
203void __init bfin_sram_init(void)
204{
205 sram_piece_cache = kmem_cache_create("sram_piece_cache",
206 sizeof(struct sram_piece),
207 0, SLAB_PANIC, NULL);
208
209 l1sram_init();
210 l1_data_sram_init();
211 l1_inst_sram_init();
212 l2_sram_init();
213}
214
215/* SRAM allocate function */
216static void *_sram_alloc(size_t size, struct sram_piece *pfree_head,
217 struct sram_piece *pused_head)
218{
219 struct sram_piece *pslot, *plast, *pavail;
220
221 if (size <= 0 || !pfree_head || !pused_head)
147 return NULL; 222 return NULL;
148 223
149 /* Align the size */ 224 /* Align the size */
150 size = (size + 3) & ~3; 225 size = (size + 3) & ~3;
151 226
152 /* not use the good method to match the best slot !!! */ 227 pslot = pfree_head->next;
153 /* search an available memory slot */ 228 plast = pfree_head;
154 for (i = 0; i < count; i++) { 229
155 if ((pfree[i].flag == SRAM_SLT_FREE) 230 /* search an available piece slot */
156 && (pfree[i].size >= size)) { 231 while (pslot != NULL && size > pslot->size) {
157 addr = pfree[i].paddr; 232 plast = pslot;
158 pfree[i].flag = SRAM_SLT_ALLOCATED; 233 pslot = pslot->next;
159 pfree[i].pid = current->pid;
160 index = i;
161 break;
162 }
163 } 234 }
164 if (i >= count) 235
236 if (!pslot)
165 return NULL; 237 return NULL;
166 238
167 /* updated the NULL memory slot !!! */ 239 if (pslot->size == size) {
168 if (pfree[i].size > size) { 240 plast->next = pslot->next;
169 for (i = 0; i < count; i++) { 241 pavail = pslot;
170 if (pfree[i].flag == SRAM_SLT_NULL) { 242 } else {
171 pfree[i].pid = 0; 243 pavail = kmem_cache_alloc(sram_piece_cache, GFP_KERNEL);
172 pfree[i].flag = SRAM_SLT_FREE; 244
173 pfree[i].paddr = addr + size; 245 if (!pavail)
174 pfree[i].size = pfree[index].size - size; 246 return NULL;
175 pfree[index].size = size; 247
176 break; 248 pavail->paddr = pslot->paddr;
177 } 249 pavail->size = size;
178 } 250 pslot->paddr += size;
251 pslot->size -= size;
179 } 252 }
180 253
181 return addr; 254 pavail->pid = current->pid;
255
256 pslot = pused_head->next;
257 plast = pused_head;
258
259 /* insert new piece into used piece list !!! */
260 while (pslot != NULL && pavail->paddr < pslot->paddr) {
261 plast = pslot;
262 pslot = pslot->next;
263 }
264
265 pavail->next = pslot;
266 plast->next = pavail;
267
268 return pavail->paddr;
182} 269}
183 270
184/* Allocate the largest available block. */ 271/* Allocate the largest available block. */
185static void *_l1_sram_alloc_max(struct l1_sram_piece *pfree, int count, 272static void *_sram_alloc_max(struct sram_piece *pfree_head,
273 struct sram_piece *pused_head,
186 unsigned long *psize) 274 unsigned long *psize)
187{ 275{
188 unsigned long best = 0; 276 struct sram_piece *pslot, *pmax;
189 int i, index = -1;
190 void *addr = NULL;
191 277
192 /* search an available memory slot */ 278 if (!pfree_head || !pused_head)
193 for (i = 0; i < count; i++) { 279 return NULL;
194 if (pfree[i].flag == SRAM_SLT_FREE && pfree[i].size > best) { 280
195 addr = pfree[i].paddr; 281 pmax = pslot = pfree_head->next;
196 index = i; 282
197 best = pfree[i].size; 283 /* search an available piece slot */
198 } 284 while (pslot != NULL) {
285 if (pslot->size > pmax->size)
286 pmax = pslot;
287 pslot = pslot->next;
199 } 288 }
200 if (index < 0) 289
290 if (!pmax)
201 return NULL; 291 return NULL;
202 *psize = best;
203 292
204 pfree[index].pid = current->pid; 293 *psize = pmax->size;
205 pfree[index].flag = SRAM_SLT_ALLOCATED; 294
206 return addr; 295 return _sram_alloc(*psize, pfree_head, pused_head);
207} 296}
208 297
209/* L1 memory free function */ 298/* SRAM free function */
210static int _l1_sram_free(const void *addr, 299static int _sram_free(const void *addr,
211 struct l1_sram_piece *pfree, 300 struct sram_piece *pfree_head,
212 int count) 301 struct sram_piece *pused_head)
213{ 302{
214 int i, index = 0; 303 struct sram_piece *pslot, *plast, *pavail;
304
305 if (!pfree_head || !pused_head)
306 return -1;
215 307
216 /* search the relevant memory slot */ 308 /* search the relevant memory slot */
217 for (i = 0; i < count; i++) { 309 pslot = pused_head->next;
218 if (pfree[i].paddr == addr) { 310 plast = pused_head;
219 if (pfree[i].flag != SRAM_SLT_ALLOCATED) { 311
220 /* error log */ 312 /* search an available piece slot */
221 return -1; 313 while (pslot != NULL && pslot->paddr != addr) {
222 } 314 plast = pslot;
223 index = i; 315 pslot = pslot->next;
224 break;
225 }
226 } 316 }
227 if (i >= count) 317
318 if (!pslot)
228 return -1; 319 return -1;
229 320
230 pfree[index].pid = 0; 321 plast->next = pslot->next;
231 pfree[index].flag = SRAM_SLT_FREE; 322 pavail = pslot;
232 323 pavail->pid = 0;
233 /* link the next address slot */ 324
234 for (i = 0; i < count; i++) { 325 /* insert free pieces back to the free list */
235 if (((pfree[index].paddr + pfree[index].size) == pfree[i].paddr) 326 pslot = pfree_head->next;
236 && (pfree[i].flag == SRAM_SLT_FREE)) { 327 plast = pfree_head;
237 pfree[i].pid = 0; 328
238 pfree[i].flag = SRAM_SLT_NULL; 329 while (pslot != NULL && addr > pslot->paddr) {
239 pfree[index].size += pfree[i].size; 330 plast = pslot;
240 pfree[index].flag = SRAM_SLT_FREE; 331 pslot = pslot->next;
241 break; 332 }
242 } 333
334 if (plast != pfree_head && plast->paddr + plast->size == pavail->paddr) {
335 plast->size += pavail->size;
336 kmem_cache_free(sram_piece_cache, pavail);
337 } else {
338 pavail->next = plast;
339 plast->next = pavail;
340 plast = pavail;
243 } 341 }
244 342
245 /* link the last address slot */ 343 if (pslot && plast->paddr + plast->size == pslot->paddr) {
246 for (i = 0; i < count; i++) { 344 plast->size += pslot->size;
247 if (((pfree[i].paddr + pfree[i].size) == pfree[index].paddr) && 345 plast->next = pslot->next;
248 (pfree[i].flag == SRAM_SLT_FREE)) { 346 kmem_cache_free(sram_piece_cache, pslot);
249 pfree[index].flag = SRAM_SLT_NULL;
250 pfree[i].size += pfree[index].size;
251 break;
252 }
253 } 347 }
254 348
255 return 0; 349 return 0;
@@ -273,6 +367,11 @@ int sram_free(const void *addr)
273 && addr < (void *)(L1_DATA_B_START + L1_DATA_B_LENGTH)) 367 && addr < (void *)(L1_DATA_B_START + L1_DATA_B_LENGTH))
274 return l1_data_B_sram_free(addr); 368 return l1_data_B_sram_free(addr);
275#endif 369#endif
370#ifdef L2_LENGTH
371 else if (addr >= (void *)L2_START
372 && addr < (void *)(L2_START + L2_LENGTH))
373 return l2_sram_free(addr);
374#endif
276 else 375 else
277 return -1; 376 return -1;
278} 377}
@@ -287,7 +386,8 @@ void *l1_data_A_sram_alloc(size_t size)
287 spin_lock_irqsave(&l1_data_sram_lock, flags); 386 spin_lock_irqsave(&l1_data_sram_lock, flags);
288 387
289#if L1_DATA_A_LENGTH != 0 388#if L1_DATA_A_LENGTH != 0
290 addr = _l1_sram_alloc(size, l1_data_A_sram, ARRAY_SIZE(l1_data_A_sram)); 389 addr = _sram_alloc(size, &free_l1_data_A_sram_head,
390 &used_l1_data_A_sram_head);
291#endif 391#endif
292 392
293 /* add mutex operation */ 393 /* add mutex operation */
@@ -309,8 +409,8 @@ int l1_data_A_sram_free(const void *addr)
309 spin_lock_irqsave(&l1_data_sram_lock, flags); 409 spin_lock_irqsave(&l1_data_sram_lock, flags);
310 410
311#if L1_DATA_A_LENGTH != 0 411#if L1_DATA_A_LENGTH != 0
312 ret = _l1_sram_free(addr, 412 ret = _sram_free(addr, &free_l1_data_A_sram_head,
313 l1_data_A_sram, ARRAY_SIZE(l1_data_A_sram)); 413 &used_l1_data_A_sram_head);
314#else 414#else
315 ret = -1; 415 ret = -1;
316#endif 416#endif
@@ -331,7 +431,8 @@ void *l1_data_B_sram_alloc(size_t size)
331 /* add mutex operation */ 431 /* add mutex operation */
332 spin_lock_irqsave(&l1_data_sram_lock, flags); 432 spin_lock_irqsave(&l1_data_sram_lock, flags);
333 433
334 addr = _l1_sram_alloc(size, l1_data_B_sram, ARRAY_SIZE(l1_data_B_sram)); 434 addr = _sram_alloc(size, &free_l1_data_B_sram_head,
435 &used_l1_data_B_sram_head);
335 436
336 /* add mutex operation */ 437 /* add mutex operation */
337 spin_unlock_irqrestore(&l1_data_sram_lock, flags); 438 spin_unlock_irqrestore(&l1_data_sram_lock, flags);
@@ -355,7 +456,8 @@ int l1_data_B_sram_free(const void *addr)
355 /* add mutex operation */ 456 /* add mutex operation */
356 spin_lock_irqsave(&l1_data_sram_lock, flags); 457 spin_lock_irqsave(&l1_data_sram_lock, flags);
357 458
358 ret = _l1_sram_free(addr, l1_data_B_sram, ARRAY_SIZE(l1_data_B_sram)); 459 ret = _sram_free(addr, &free_l1_data_B_sram_head,
460 &used_l1_data_B_sram_head);
359 461
360 /* add mutex operation */ 462 /* add mutex operation */
361 spin_unlock_irqrestore(&l1_data_sram_lock, flags); 463 spin_unlock_irqrestore(&l1_data_sram_lock, flags);
@@ -408,7 +510,8 @@ void *l1_inst_sram_alloc(size_t size)
408 /* add mutex operation */ 510 /* add mutex operation */
409 spin_lock_irqsave(&l1_inst_sram_lock, flags); 511 spin_lock_irqsave(&l1_inst_sram_lock, flags);
410 512
411 addr = _l1_sram_alloc(size, l1_inst_sram, ARRAY_SIZE(l1_inst_sram)); 513 addr = _sram_alloc(size, &free_l1_inst_sram_head,
514 &used_l1_inst_sram_head);
412 515
413 /* add mutex operation */ 516 /* add mutex operation */
414 spin_unlock_irqrestore(&l1_inst_sram_lock, flags); 517 spin_unlock_irqrestore(&l1_inst_sram_lock, flags);
@@ -432,7 +535,8 @@ int l1_inst_sram_free(const void *addr)
432 /* add mutex operation */ 535 /* add mutex operation */
433 spin_lock_irqsave(&l1_inst_sram_lock, flags); 536 spin_lock_irqsave(&l1_inst_sram_lock, flags);
434 537
435 ret = _l1_sram_free(addr, l1_inst_sram, ARRAY_SIZE(l1_inst_sram)); 538 ret = _sram_free(addr, &free_l1_inst_sram_head,
539 &used_l1_inst_sram_head);
436 540
437 /* add mutex operation */ 541 /* add mutex operation */
438 spin_unlock_irqrestore(&l1_inst_sram_lock, flags); 542 spin_unlock_irqrestore(&l1_inst_sram_lock, flags);
@@ -453,7 +557,8 @@ void *l1sram_alloc(size_t size)
453 /* add mutex operation */ 557 /* add mutex operation */
454 spin_lock_irqsave(&l1sram_lock, flags); 558 spin_lock_irqsave(&l1sram_lock, flags);
455 559
456 addr = _l1_sram_alloc(size, l1_ssram, ARRAY_SIZE(l1_ssram)); 560 addr = _sram_alloc(size, &free_l1_ssram_head,
561 &used_l1_ssram_head);
457 562
458 /* add mutex operation */ 563 /* add mutex operation */
459 spin_unlock_irqrestore(&l1sram_lock, flags); 564 spin_unlock_irqrestore(&l1sram_lock, flags);
@@ -470,7 +575,8 @@ void *l1sram_alloc_max(size_t *psize)
470 /* add mutex operation */ 575 /* add mutex operation */
471 spin_lock_irqsave(&l1sram_lock, flags); 576 spin_lock_irqsave(&l1sram_lock, flags);
472 577
473 addr = _l1_sram_alloc_max(l1_ssram, ARRAY_SIZE(l1_ssram), psize); 578 addr = _sram_alloc_max(&free_l1_ssram_head,
579 &used_l1_ssram_head, psize);
474 580
475 /* add mutex operation */ 581 /* add mutex operation */
476 spin_unlock_irqrestore(&l1sram_lock, flags); 582 spin_unlock_irqrestore(&l1sram_lock, flags);
@@ -487,7 +593,8 @@ int l1sram_free(const void *addr)
487 /* add mutex operation */ 593 /* add mutex operation */
488 spin_lock_irqsave(&l1sram_lock, flags); 594 spin_lock_irqsave(&l1sram_lock, flags);
489 595
490 ret = _l1_sram_free(addr, l1_ssram, ARRAY_SIZE(l1_ssram)); 596 ret = _sram_free(addr, &free_l1_ssram_head,
597 &used_l1_ssram_head);
491 598
492 /* add mutex operation */ 599 /* add mutex operation */
493 spin_unlock_irqrestore(&l1sram_lock, flags); 600 spin_unlock_irqrestore(&l1sram_lock, flags);
@@ -495,6 +602,64 @@ int l1sram_free(const void *addr)
495 return ret; 602 return ret;
496} 603}
497 604
605void *l2_sram_alloc(size_t size)
606{
607#ifdef L2_LENGTH
608 unsigned flags;
609 void *addr;
610
611 /* add mutex operation */
612 spin_lock_irqsave(&l2_sram_lock, flags);
613
614 addr = _sram_alloc(size, &free_l2_sram_head,
615 &used_l2_sram_head);
616
617 /* add mutex operation */
618 spin_unlock_irqrestore(&l2_sram_lock, flags);
619
620 pr_debug("Allocated address in l2_sram_alloc is 0x%lx+0x%lx\n",
621 (long unsigned int)addr, size);
622
623 return addr;
624#else
625 return NULL;
626#endif
627}
628EXPORT_SYMBOL(l2_sram_alloc);
629
630void *l2_sram_zalloc(size_t size)
631{
632 void *addr = l2_sram_alloc(size);
633
634 if (addr)
635 memset(addr, 0x00, size);
636
637 return addr;
638}
639EXPORT_SYMBOL(l2_sram_zalloc);
640
641int l2_sram_free(const void *addr)
642{
643#ifdef L2_LENGTH
644 unsigned flags;
645 int ret;
646
647 /* add mutex operation */
648 spin_lock_irqsave(&l2_sram_lock, flags);
649
650 ret = _sram_free(addr, &free_l2_sram_head,
651 &used_l2_sram_head);
652
653 /* add mutex operation */
654 spin_unlock_irqrestore(&l2_sram_lock, flags);
655
656 return ret;
657#else
658 return -1;
659#endif
660}
661EXPORT_SYMBOL(l2_sram_free);
662
498int sram_free_with_lsl(const void *addr) 663int sram_free_with_lsl(const void *addr)
499{ 664{
500 struct sram_list_struct *lsl, **tmp; 665 struct sram_list_struct *lsl, **tmp;
@@ -533,6 +698,9 @@ void *sram_alloc_with_lsl(size_t size, unsigned long flags)
533 if (addr == NULL && (flags & L1_DATA_B_SRAM)) 698 if (addr == NULL && (flags & L1_DATA_B_SRAM))
534 addr = l1_data_B_sram_alloc(size); 699 addr = l1_data_B_sram_alloc(size);
535 700
701 if (addr == NULL && (flags & L2_SRAM))
702 addr = l2_sram_alloc(size);
703
536 if (addr == NULL) { 704 if (addr == NULL) {
537 kfree(lsl); 705 kfree(lsl);
538 return NULL; 706 return NULL;
@@ -549,49 +717,80 @@ EXPORT_SYMBOL(sram_alloc_with_lsl);
549/* Once we get a real allocator, we'll throw all of this away. 717/* Once we get a real allocator, we'll throw all of this away.
550 * Until then, we need some sort of visibility into the L1 alloc. 718 * Until then, we need some sort of visibility into the L1 alloc.
551 */ 719 */
552static void _l1sram_proc_read(char *buf, int *len, const char *desc, 720/* Need to keep line of output the same. Currently, that is 44 bytes
553 struct l1_sram_piece *pfree, const int array_size) 721 * (including newline).
722 */
723static int _sram_proc_read(char *buf, int *len, int count, const char *desc,
724 struct sram_piece *pfree_head,
725 struct sram_piece *pused_head)
554{ 726{
555 int i; 727 struct sram_piece *pslot;
556 728
557 *len += sprintf(&buf[*len], "--- L1 %-14s Size PID State\n", desc); 729 if (!pfree_head || !pused_head)
558 for (i = 0; i < array_size; ++i) { 730 return -1;
559 const char *alloc_type; 731
560 switch (pfree[i].flag) { 732 *len += sprintf(&buf[*len], "--- SRAM %-14s Size PID State \n", desc);
561 case SRAM_SLT_NULL: alloc_type = "NULL"; break; 733
562 case SRAM_SLT_FREE: alloc_type = "FREE"; break; 734 /* search the relevant memory slot */
563 case SRAM_SLT_ALLOCATED: alloc_type = "ALLOCATED"; break; 735 pslot = pused_head->next;
564 default: alloc_type = "????"; break; 736
565 } 737 while (pslot != NULL) {
566 *len += sprintf(&buf[*len], "%p-%p %8i %4i %s\n", 738 *len += sprintf(&buf[*len], "%p-%p %10i %5i %-10s\n",
567 pfree[i].paddr, pfree[i].paddr + pfree[i].size, 739 pslot->paddr, pslot->paddr + pslot->size,
568 pfree[i].size, pfree[i].pid, alloc_type); 740 pslot->size, pslot->pid, "ALLOCATED");
741
742 pslot = pslot->next;
569 } 743 }
744
745 pslot = pfree_head->next;
746
747 while (pslot != NULL) {
748 *len += sprintf(&buf[*len], "%p-%p %10i %5i %-10s\n",
749 pslot->paddr, pslot->paddr + pslot->size,
750 pslot->size, pslot->pid, "FREE");
751
752 pslot = pslot->next;
753 }
754
755 return 0;
570} 756}
571static int l1sram_proc_read(char *buf, char **start, off_t offset, int count, 757static int sram_proc_read(char *buf, char **start, off_t offset, int count,
572 int *eof, void *data) 758 int *eof, void *data)
573{ 759{
574 int len = 0; 760 int len = 0;
575 761
576 _l1sram_proc_read(buf, &len, "Scratchpad", 762 if (_sram_proc_read(buf, &len, count, "Scratchpad",
577 l1_ssram, ARRAY_SIZE(l1_ssram)); 763 &free_l1_ssram_head, &used_l1_ssram_head))
764 goto not_done;
578#if L1_DATA_A_LENGTH != 0 765#if L1_DATA_A_LENGTH != 0
579 _l1sram_proc_read(buf, &len, "Data A", 766 if (_sram_proc_read(buf, &len, count, "L1 Data A",
580 l1_data_A_sram, ARRAY_SIZE(l1_data_A_sram)); 767 &free_l1_data_A_sram_head,
768 &used_l1_data_A_sram_head))
769 goto not_done;
581#endif 770#endif
582#if L1_DATA_B_LENGTH != 0 771#if L1_DATA_B_LENGTH != 0
583 _l1sram_proc_read(buf, &len, "Data B", 772 if (_sram_proc_read(buf, &len, count, "L1 Data B",
584 l1_data_B_sram, ARRAY_SIZE(l1_data_B_sram)); 773 &free_l1_data_B_sram_head,
774 &used_l1_data_B_sram_head))
775 goto not_done;
585#endif 776#endif
586#if L1_CODE_LENGTH != 0 777#if L1_CODE_LENGTH != 0
587 _l1sram_proc_read(buf, &len, "Instruction", 778 if (_sram_proc_read(buf, &len, count, "L1 Instruction",
588 l1_inst_sram, ARRAY_SIZE(l1_inst_sram)); 779 &free_l1_inst_sram_head, &used_l1_inst_sram_head))
780 goto not_done;
781#endif
782#ifdef L2_LENGTH
783 if (_sram_proc_read(buf, &len, count, "L2",
784 &free_l2_sram_head, &used_l2_sram_head))
785 goto not_done;
589#endif 786#endif
590 787
788 *eof = 1;
789 not_done:
591 return len; 790 return len;
592} 791}
593 792
594static int __init l1sram_proc_init(void) 793static int __init sram_proc_init(void)
595{ 794{
596 struct proc_dir_entry *ptr; 795 struct proc_dir_entry *ptr;
597 ptr = create_proc_entry("sram", S_IFREG | S_IRUGO, NULL); 796 ptr = create_proc_entry("sram", S_IFREG | S_IRUGO, NULL);
@@ -600,8 +799,8 @@ static int __init l1sram_proc_init(void)
600 return -1; 799 return -1;
601 } 800 }
602 ptr->owner = THIS_MODULE; 801 ptr->owner = THIS_MODULE;
603 ptr->read_proc = l1sram_proc_read; 802 ptr->read_proc = sram_proc_read;
604 return 0; 803 return 0;
605} 804}
606late_initcall(l1sram_proc_init); 805late_initcall(sram_proc_init);
607#endif 806#endif
diff --git a/arch/blackfin/mm/blackfin_sram.h b/arch/blackfin/mm/blackfin_sram.h
index 0fb73b78dd60..8cb0945563f9 100644
--- a/arch/blackfin/mm/blackfin_sram.h
+++ b/arch/blackfin/mm/blackfin_sram.h
@@ -30,9 +30,7 @@
30#ifndef __BLACKFIN_SRAM_H__ 30#ifndef __BLACKFIN_SRAM_H__
31#define __BLACKFIN_SRAM_H__ 31#define __BLACKFIN_SRAM_H__
32 32
33extern void l1sram_init(void); 33extern void bfin_sram_init(void);
34extern void l1_inst_sram_init(void);
35extern void l1_data_sram_init(void);
36extern void *l1sram_alloc(size_t); 34extern void *l1sram_alloc(size_t);
37 35
38#endif 36#endif
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index ec3141fefd20..bc240abb8745 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -53,33 +53,6 @@ static unsigned long empty_bad_page;
53 53
54unsigned long empty_zero_page; 54unsigned long empty_zero_page;
55 55
56void show_mem(void)
57{
58 unsigned long i;
59 int free = 0, total = 0, reserved = 0, shared = 0;
60
61 int cached = 0;
62 printk(KERN_INFO "Mem-info:\n");
63 show_free_areas();
64 i = max_mapnr;
65 while (i-- > 0) {
66 total++;
67 if (PageReserved(mem_map + i))
68 reserved++;
69 else if (PageSwapCache(mem_map + i))
70 cached++;
71 else if (!page_count(mem_map + i))
72 free++;
73 else
74 shared += page_count(mem_map + i) - 1;
75 }
76 printk(KERN_INFO "%d pages of RAM\n", total);
77 printk(KERN_INFO "%d free pages\n", free);
78 printk(KERN_INFO "%d reserved pages\n", reserved);
79 printk(KERN_INFO "%d pages shared\n", shared);
80 printk(KERN_INFO "%d pages swap cached\n", cached);
81}
82
83/* 56/*
84 * paging_init() continues the virtual memory environment setup which 57 * paging_init() continues the virtual memory environment setup which
85 * was begun by the code in arch/head.S. 58 * was begun by the code in arch/head.S.
@@ -164,11 +137,14 @@ void __init mem_init(void)
164 "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n", 137 "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n",
165 (unsigned long) freepages << (PAGE_SHIFT-10), _ramend >> 10, 138 (unsigned long) freepages << (PAGE_SHIFT-10), _ramend >> 10,
166 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10))); 139 initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
140}
141
142static int __init sram_init(void)
143{
144 unsigned long tmp;
167 145
168 /* Initialize the blackfin L1 Memory. */ 146 /* Initialize the blackfin L1 Memory. */
169 l1sram_init(); 147 bfin_sram_init();
170 l1_data_sram_init();
171 l1_inst_sram_init();
172 148
173 /* Allocate this once; never free it. We assume this gives us a 149 /* Allocate this once; never free it. We assume this gives us a
174 pointer to the start of L1 scratchpad memory; panic if it 150 pointer to the start of L1 scratchpad memory; panic if it
@@ -179,7 +155,10 @@ void __init mem_init(void)
179 tmp, (unsigned long)L1_SCRATCH_TASK_INFO); 155 tmp, (unsigned long)L1_SCRATCH_TASK_INFO);
180 panic("No L1, time to give up\n"); 156 panic("No L1, time to give up\n");
181 } 157 }
158
159 return 0;
182} 160}
161pure_initcall(sram_init);
183 162
184static void __init free_init_pages(const char *what, unsigned long begin, unsigned long end) 163static void __init free_init_pages(const char *what, unsigned long begin, unsigned long end)
185{ 164{
diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c
index a3ca55150745..6fea45f2e40c 100644
--- a/arch/cris/arch-v10/kernel/kgdb.c
+++ b/arch/cris/arch-v10/kernel/kgdb.c
@@ -278,14 +278,6 @@ void putDebugChar (int val);
278 278
279void enableDebugIRQ (void); 279void enableDebugIRQ (void);
280 280
281/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
282 represented by int x. */
283static char highhex (int x);
284
285/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
286 represented by int x. */
287static char lowhex (int x);
288
289/* Returns the integer equivalent of a hexadecimal character. */ 281/* Returns the integer equivalent of a hexadecimal character. */
290static int hex (char ch); 282static int hex (char ch);
291 283
@@ -356,9 +348,6 @@ extern unsigned char executing_task;
356/* Run-length encoding maximum length. Send 64 at most. */ 348/* Run-length encoding maximum length. Send 64 at most. */
357#define RUNLENMAX 64 349#define RUNLENMAX 64
358 350
359/* Definition of all valid hexadecimal characters */
360static const char hexchars[] = "0123456789abcdef";
361
362/* The inbound/outbound buffers used in packet I/O */ 351/* The inbound/outbound buffers used in packet I/O */
363static char remcomInBuffer[BUFMAX]; 352static char remcomInBuffer[BUFMAX];
364static char remcomOutBuffer[BUFMAX]; 353static char remcomOutBuffer[BUFMAX];
@@ -499,8 +488,8 @@ gdb_cris_strtol (const char *s, char **endptr, int base)
499 char *sd; 488 char *sd;
500 int x = 0; 489 int x = 0;
501 490
502 for (s1 = (char*)s; (sd = gdb_cris_memchr(hexchars, *s1, base)) != NULL; ++s1) 491 for (s1 = (char*)s; (sd = gdb_cris_memchr(hex_asc, *s1, base)) != NULL; ++s1)
503 x = x * base + (sd - hexchars); 492 x = x * base + (sd - hex_asc);
504 493
505 if (endptr) 494 if (endptr)
506 { 495 {
@@ -670,22 +659,6 @@ read_register (char regno, unsigned int *valptr)
670} 659}
671 660
672/********************************** Packet I/O ******************************/ 661/********************************** Packet I/O ******************************/
673/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
674 represented by int x. */
675static inline char
676highhex(int x)
677{
678 return hexchars[(x >> 4) & 0xf];
679}
680
681/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
682 represented by int x. */
683static inline char
684lowhex(int x)
685{
686 return hexchars[x & 0xf];
687}
688
689/* Returns the integer equivalent of a hexadecimal character. */ 662/* Returns the integer equivalent of a hexadecimal character. */
690static int 663static int
691hex (char ch) 664hex (char ch)
@@ -721,8 +694,7 @@ mem2hex(char *buf, unsigned char *mem, int count)
721 /* Valid mem address. */ 694 /* Valid mem address. */
722 for (i = 0; i < count; i++) { 695 for (i = 0; i < count; i++) {
723 ch = *mem++; 696 ch = *mem++;
724 *buf++ = highhex (ch); 697 buf = pack_hex_byte(buf, ch);
725 *buf++ = lowhex (ch);
726 } 698 }
727 } 699 }
728 700
@@ -857,9 +829,9 @@ putpacket(char *buffer)
857 src++; 829 src++;
858 } 830 }
859 } 831 }
860 putDebugChar ('#'); 832 putDebugChar('#');
861 putDebugChar (highhex (checksum)); 833 putDebugChar(hex_asc_hi(checksum));
862 putDebugChar (lowhex (checksum)); 834 putDebugChar(hex_asc_lo(checksum));
863 } while(kgdb_started && (getDebugChar() != '+')); 835 } while(kgdb_started && (getDebugChar() != '+'));
864} 836}
865 837
@@ -895,9 +867,8 @@ stub_is_stopped(int sigval)
895 867
896 /* Send trap type (converted to signal) */ 868 /* Send trap type (converted to signal) */
897 869
898 *ptr++ = 'T'; 870 *ptr++ = 'T';
899 *ptr++ = highhex (sigval); 871 ptr = pack_hex_byte(ptr, sigval);
900 *ptr++ = lowhex (sigval);
901 872
902 /* Send register contents. We probably only need to send the 873 /* Send register contents. We probably only need to send the
903 * PC, frame pointer and stack pointer here. Other registers will be 874 * PC, frame pointer and stack pointer here. Other registers will be
@@ -910,9 +881,7 @@ stub_is_stopped(int sigval)
910 status = read_register (regno, &reg_cont); 881 status = read_register (regno, &reg_cont);
911 882
912 if (status == SUCCESS) { 883 if (status == SUCCESS) {
913 884 ptr = pack_hex_byte(ptr, regno);
914 *ptr++ = highhex (regno);
915 *ptr++ = lowhex (regno);
916 *ptr++ = ':'; 885 *ptr++ = ':';
917 886
918 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, 887 ptr = mem2hex(ptr, (unsigned char *)&reg_cont,
@@ -937,8 +906,8 @@ stub_is_stopped(int sigval)
937 /* Store thread:r...; with the executing task TID. */ 906 /* Store thread:r...; with the executing task TID. */
938 gdb_cris_strcpy (&remcomOutBuffer[pos], "thread:"); 907 gdb_cris_strcpy (&remcomOutBuffer[pos], "thread:");
939 pos += gdb_cris_strlen ("thread:"); 908 pos += gdb_cris_strlen ("thread:");
940 remcomOutBuffer[pos++] = highhex (executing_task); 909 remcomOutBuffer[pos++] = hex_asc_hi(executing_task);
941 remcomOutBuffer[pos++] = lowhex (executing_task); 910 remcomOutBuffer[pos++] = hex_asc_lo(executing_task);
942 gdb_cris_strcpy (&remcomOutBuffer[pos], ";"); 911 gdb_cris_strcpy (&remcomOutBuffer[pos], ";");
943#endif 912#endif
944 913
@@ -1126,8 +1095,8 @@ handle_exception (int sigval)
1126 Success: SAA, where AA is the signal number. 1095 Success: SAA, where AA is the signal number.
1127 Failure: void. */ 1096 Failure: void. */
1128 remcomOutBuffer[0] = 'S'; 1097 remcomOutBuffer[0] = 'S';
1129 remcomOutBuffer[1] = highhex (sigval); 1098 remcomOutBuffer[1] = hex_asc_hi(sigval);
1130 remcomOutBuffer[2] = lowhex (sigval); 1099 remcomOutBuffer[2] = hex_asc_lo(sigval);
1131 remcomOutBuffer[3] = 0; 1100 remcomOutBuffer[3] = 0;
1132 break; 1101 break;
1133 1102
@@ -1224,23 +1193,23 @@ handle_exception (int sigval)
1224 case 'C': 1193 case 'C':
1225 /* Identify the remote current thread. */ 1194 /* Identify the remote current thread. */
1226 gdb_cris_strcpy (&remcomOutBuffer[0], "QC"); 1195 gdb_cris_strcpy (&remcomOutBuffer[0], "QC");
1227 remcomOutBuffer[2] = highhex (current_thread_c); 1196 remcomOutBuffer[2] = hex_asc_hi(current_thread_c);
1228 remcomOutBuffer[3] = lowhex (current_thread_c); 1197 remcomOutBuffer[3] = hex_asc_lo(current_thread_c);
1229 remcomOutBuffer[4] = '\0'; 1198 remcomOutBuffer[4] = '\0';
1230 break; 1199 break;
1231 case 'L': 1200 case 'L':
1232 gdb_cris_strcpy (&remcomOutBuffer[0], "QM"); 1201 gdb_cris_strcpy (&remcomOutBuffer[0], "QM");
1233 /* Reply with number of threads. */ 1202 /* Reply with number of threads. */
1234 if (os_is_started()) { 1203 if (os_is_started()) {
1235 remcomOutBuffer[2] = highhex (number_of_tasks); 1204 remcomOutBuffer[2] = hex_asc_hi(number_of_tasks);
1236 remcomOutBuffer[3] = lowhex (number_of_tasks); 1205 remcomOutBuffer[3] = hex_asc_lo(number_of_tasks);
1237 } 1206 }
1238 else { 1207 else {
1239 remcomOutBuffer[2] = highhex (0); 1208 remcomOutBuffer[2] = hex_asc_hi(0);
1240 remcomOutBuffer[3] = lowhex (1); 1209 remcomOutBuffer[3] = hex_asc_lo(1);
1241 } 1210 }
1242 /* Done with the reply. */ 1211 /* Done with the reply. */
1243 remcomOutBuffer[4] = lowhex (1); 1212 remcomOutBuffer[4] = hex_asc_lo(1);
1244 pos = 5; 1213 pos = 5;
1245 /* Expects the argument thread id. */ 1214 /* Expects the argument thread id. */
1246 for (; pos < (5 + HEXCHARS_IN_THREAD_ID); pos++) 1215 for (; pos < (5 + HEXCHARS_IN_THREAD_ID); pos++)
@@ -1251,16 +1220,16 @@ handle_exception (int sigval)
1251 for (thread_id = 0; thread_id < number_of_tasks; thread_id++) { 1220 for (thread_id = 0; thread_id < number_of_tasks; thread_id++) {
1252 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1; 1221 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1253 for (; pos < nextpos; pos ++) 1222 for (; pos < nextpos; pos ++)
1254 remcomOutBuffer[pos] = lowhex (0); 1223 remcomOutBuffer[pos] = hex_asc_lo(0);
1255 remcomOutBuffer[pos++] = lowhex (thread_id); 1224 remcomOutBuffer[pos++] = hex_asc_lo(thread_id);
1256 } 1225 }
1257 } 1226 }
1258 else { 1227 else {
1259 /* Store the thread identifier of the boot task. */ 1228 /* Store the thread identifier of the boot task. */
1260 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1; 1229 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1261 for (; pos < nextpos; pos ++) 1230 for (; pos < nextpos; pos ++)
1262 remcomOutBuffer[pos] = lowhex (0); 1231 remcomOutBuffer[pos] = hex_asc_lo(0);
1263 remcomOutBuffer[pos++] = lowhex (current_thread_c); 1232 remcomOutBuffer[pos++] = hex_asc_lo(current_thread_c);
1264 } 1233 }
1265 remcomOutBuffer[pos] = '\0'; 1234 remcomOutBuffer[pos] = '\0';
1266 break; 1235 break;
diff --git a/arch/cris/arch-v32/kernel/kgdb.c b/arch/cris/arch-v32/kernel/kgdb.c
index 4e2e2e271efb..8bd5a5bc0dc7 100644
--- a/arch/cris/arch-v32/kernel/kgdb.c
+++ b/arch/cris/arch-v32/kernel/kgdb.c
@@ -398,14 +398,6 @@ void putDebugChar(int val)
398} 398}
399#endif 399#endif
400 400
401/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
402 represented by int x. */
403static char highhex(int x);
404
405/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
406 represented by int x. */
407static char lowhex(int x);
408
409/* Returns the integer equivalent of a hexadecimal character. */ 401/* Returns the integer equivalent of a hexadecimal character. */
410static int hex(char ch); 402static int hex(char ch);
411 403
@@ -464,9 +456,6 @@ void breakpoint(void);
464/* Run-length encoding maximum length. Send 64 at most. */ 456/* Run-length encoding maximum length. Send 64 at most. */
465#define RUNLENMAX 64 457#define RUNLENMAX 64
466 458
467/* Definition of all valid hexadecimal characters */
468static const char hexchars[] = "0123456789abcdef";
469
470/* The inbound/outbound buffers used in packet I/O */ 459/* The inbound/outbound buffers used in packet I/O */
471static char input_buffer[BUFMAX]; 460static char input_buffer[BUFMAX];
472static char output_buffer[BUFMAX]; 461static char output_buffer[BUFMAX];
@@ -550,8 +539,8 @@ gdb_cris_strtol(const char *s, char **endptr, int base)
550 char *sd; 539 char *sd;
551 int x = 0; 540 int x = 0;
552 541
553 for (s1 = (char*)s; (sd = gdb_cris_memchr(hexchars, *s1, base)) != NULL; ++s1) 542 for (s1 = (char*)s; (sd = gdb_cris_memchr(hex_asc, *s1, base)) != NULL; ++s1)
554 x = x * base + (sd - hexchars); 543 x = x * base + (sd - hex_asc);
555 544
556 if (endptr) { 545 if (endptr) {
557 /* Unconverted suffix is stored in endptr unless endptr is NULL. */ 546 /* Unconverted suffix is stored in endptr unless endptr is NULL. */
@@ -655,22 +644,6 @@ read_register(char regno, unsigned int *valptr)
655} 644}
656 645
657/********************************** Packet I/O ******************************/ 646/********************************** Packet I/O ******************************/
658/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
659 represented by int x. */
660static inline char
661highhex(int x)
662{
663 return hexchars[(x >> 4) & 0xf];
664}
665
666/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
667 represented by int x. */
668static inline char
669lowhex(int x)
670{
671 return hexchars[x & 0xf];
672}
673
674/* Returns the integer equivalent of a hexadecimal character. */ 647/* Returns the integer equivalent of a hexadecimal character. */
675static int 648static int
676hex(char ch) 649hex(char ch)
@@ -704,8 +677,7 @@ mem2hex(char *buf, unsigned char *mem, int count)
704 /* Valid mem address. */ 677 /* Valid mem address. */
705 for (i = 0; i < count; i++) { 678 for (i = 0; i < count; i++) {
706 ch = *mem++; 679 ch = *mem++;
707 *buf++ = highhex (ch); 680 buf = pack_hex_byte(buf, ch);
708 *buf++ = lowhex (ch);
709 } 681 }
710 } 682 }
711 /* Terminate properly. */ 683 /* Terminate properly. */
@@ -723,8 +695,7 @@ mem2hex_nbo(char *buf, unsigned char *mem, int count)
723 mem += count - 1; 695 mem += count - 1;
724 for (i = 0; i < count; i++) { 696 for (i = 0; i < count; i++) {
725 ch = *mem--; 697 ch = *mem--;
726 *buf++ = highhex (ch); 698 buf = pack_hex_byte(buf, ch);
727 *buf++ = lowhex (ch);
728 } 699 }
729 700
730 /* Terminate properly. */ 701 /* Terminate properly. */
@@ -862,8 +833,8 @@ putpacket(char *buffer)
862 } 833 }
863 } 834 }
864 putDebugChar('#'); 835 putDebugChar('#');
865 putDebugChar(highhex (checksum)); 836 putDebugChar(hex_asc_hi(checksum));
866 putDebugChar(lowhex (checksum)); 837 putDebugChar(hex_asc_lo(checksum));
867 } while(kgdb_started && (getDebugChar() != '+')); 838 } while(kgdb_started && (getDebugChar() != '+'));
868} 839}
869 840
@@ -909,8 +880,7 @@ stub_is_stopped(int sigval)
909 /* Send trap type (converted to signal) */ 880 /* Send trap type (converted to signal) */
910 881
911 *ptr++ = 'T'; 882 *ptr++ = 'T';
912 *ptr++ = highhex(sigval); 883 ptr = pack_hex_byte(ptr, sigval);
913 *ptr++ = lowhex(sigval);
914 884
915 if (((reg.exs & 0xff00) >> 8) == 0xc) { 885 if (((reg.exs & 0xff00) >> 8) == 0xc) {
916 886
@@ -1018,30 +988,26 @@ stub_is_stopped(int sigval)
1018 } 988 }
1019 /* Only send PC, frame and stack pointer. */ 989 /* Only send PC, frame and stack pointer. */
1020 read_register(PC, &reg_cont); 990 read_register(PC, &reg_cont);
1021 *ptr++ = highhex(PC); 991 ptr = pack_hex_byte(PC);
1022 *ptr++ = lowhex(PC);
1023 *ptr++ = ':'; 992 *ptr++ = ':';
1024 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]); 993 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]);
1025 *ptr++ = ';'; 994 *ptr++ = ';';
1026 995
1027 read_register(R8, &reg_cont); 996 read_register(R8, &reg_cont);
1028 *ptr++ = highhex(R8); 997 ptr = pack_hex_byte(R8);
1029 *ptr++ = lowhex(R8);
1030 *ptr++ = ':'; 998 *ptr++ = ':';
1031 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]); 999 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]);
1032 *ptr++ = ';'; 1000 *ptr++ = ';';
1033 1001
1034 read_register(SP, &reg_cont); 1002 read_register(SP, &reg_cont);
1035 *ptr++ = highhex(SP); 1003 ptr = pack_hex_byte(SP);
1036 *ptr++ = lowhex(SP);
1037 *ptr++ = ':'; 1004 *ptr++ = ':';
1038 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]); 1005 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]);
1039 *ptr++ = ';'; 1006 *ptr++ = ';';
1040 1007
1041 /* Send ERP as well; this will save us an entire register fetch in some cases. */ 1008 /* Send ERP as well; this will save us an entire register fetch in some cases. */
1042 read_register(ERP, &reg_cont); 1009 read_register(ERP, &reg_cont);
1043 *ptr++ = highhex(ERP); 1010 ptr = pack_hex_byte(ERP);
1044 *ptr++ = lowhex(ERP);
1045 *ptr++ = ':'; 1011 *ptr++ = ':';
1046 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]); 1012 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]);
1047 *ptr++ = ';'; 1013 *ptr++ = ';';
@@ -1533,8 +1499,8 @@ handle_exception(int sigval)
1533 Success: SAA, where AA is the signal number. 1499 Success: SAA, where AA is the signal number.
1534 Failure: void. */ 1500 Failure: void. */
1535 output_buffer[0] = 'S'; 1501 output_buffer[0] = 'S';
1536 output_buffer[1] = highhex(sigval); 1502 output_buffer[1] = hex_asc_hi(sigval);
1537 output_buffer[2] = lowhex(sigval); 1503 output_buffer[2] = hex_asc_lo(sigval);
1538 output_buffer[3] = 0; 1504 output_buffer[3] = 0;
1539 break; 1505 break;
1540 1506
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index 5b06ffa15e34..2fdd212eb250 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -19,36 +19,6 @@ unsigned long empty_zero_page;
19extern char _stext, _edata, _etext; /* From linkerscript */ 19extern char _stext, _edata, _etext; /* From linkerscript */
20extern char __init_begin, __init_end; 20extern char __init_begin, __init_end;
21 21
22void
23show_mem(void)
24{
25 int i,free = 0,total = 0,cached = 0, reserved = 0, nonshared = 0;
26 int shared = 0;
27
28 printk("\nMem-info:\n");
29 show_free_areas();
30 i = max_mapnr;
31 while (i-- > 0) {
32 total++;
33 if (PageReserved(mem_map+i))
34 reserved++;
35 else if (PageSwapCache(mem_map+i))
36 cached++;
37 else if (!page_count(mem_map+i))
38 free++;
39 else if (page_count(mem_map+i) == 1)
40 nonshared++;
41 else
42 shared += page_count(mem_map+i) - 1;
43 }
44 printk("%d pages of RAM\n",total);
45 printk("%d free pages\n",free);
46 printk("%d reserved pages\n",reserved);
47 printk("%d pages nonshared\n",nonshared);
48 printk("%d pages shared\n",shared);
49 printk("%d pages swap cached\n",cached);
50}
51
52void __init 22void __init
53mem_init(void) 23mem_init(void)
54{ 24{
diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c
index 48a0393e7cee..7ca8a6b19ac9 100644
--- a/arch/frv/kernel/gdb-stub.c
+++ b/arch/frv/kernel/gdb-stub.c
@@ -182,8 +182,6 @@ extern volatile u32 __attribute__((section(".bss"))) gdbstub_trace_through_excep
182static char input_buffer[BUFMAX]; 182static char input_buffer[BUFMAX];
183static char output_buffer[BUFMAX]; 183static char output_buffer[BUFMAX];
184 184
185static const char hexchars[] = "0123456789abcdef";
186
187static const char *regnames[] = { 185static const char *regnames[] = {
188 "PSR ", "ISR ", "CCR ", "CCCR", 186 "PSR ", "ISR ", "CCR ", "CCCR",
189 "LR ", "LCR ", "PC ", "_stt", 187 "LR ", "LCR ", "PC ", "_stt",
@@ -383,8 +381,8 @@ static int gdbstub_send_packet(char *buffer)
383 } 381 }
384 382
385 gdbstub_tx_char('#'); 383 gdbstub_tx_char('#');
386 gdbstub_tx_char(hexchars[checksum >> 4]); 384 gdbstub_tx_char(hex_asc_hi(checksum));
387 gdbstub_tx_char(hexchars[checksum & 0xf]); 385 gdbstub_tx_char(hex_asc_lo(checksum));
388 386
389 } while (gdbstub_rx_char(&ch,0), 387 } while (gdbstub_rx_char(&ch,0),
390#ifdef GDBSTUB_DEBUG_PROTOCOL 388#ifdef GDBSTUB_DEBUG_PROTOCOL
@@ -674,8 +672,7 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa
674 if ((uint32_t)mem&1 && count>=1) { 672 if ((uint32_t)mem&1 && count>=1) {
675 if (!gdbstub_read_byte(mem,ch)) 673 if (!gdbstub_read_byte(mem,ch))
676 return NULL; 674 return NULL;
677 *buf++ = hexchars[ch[0] >> 4]; 675 buf = pack_hex_byte(buf, ch[0]);
678 *buf++ = hexchars[ch[0] & 0xf];
679 mem++; 676 mem++;
680 count--; 677 count--;
681 } 678 }
@@ -683,10 +680,8 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa
683 if ((uint32_t)mem&3 && count>=2) { 680 if ((uint32_t)mem&3 && count>=2) {
684 if (!gdbstub_read_word(mem,(uint16_t *)ch)) 681 if (!gdbstub_read_word(mem,(uint16_t *)ch))
685 return NULL; 682 return NULL;
686 *buf++ = hexchars[ch[0] >> 4]; 683 buf = pack_hex_byte(buf, ch[0]);
687 *buf++ = hexchars[ch[0] & 0xf]; 684 buf = pack_hex_byte(buf, ch[1]);
688 *buf++ = hexchars[ch[1] >> 4];
689 *buf++ = hexchars[ch[1] & 0xf];
690 mem += 2; 685 mem += 2;
691 count -= 2; 686 count -= 2;
692 } 687 }
@@ -694,14 +689,10 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa
694 while (count>=4) { 689 while (count>=4) {
695 if (!gdbstub_read_dword(mem,(uint32_t *)ch)) 690 if (!gdbstub_read_dword(mem,(uint32_t *)ch))
696 return NULL; 691 return NULL;
697 *buf++ = hexchars[ch[0] >> 4]; 692 buf = pack_hex_byte(buf, ch[0]);
698 *buf++ = hexchars[ch[0] & 0xf]; 693 buf = pack_hex_byte(buf, ch[1]);
699 *buf++ = hexchars[ch[1] >> 4]; 694 buf = pack_hex_byte(buf, ch[2]);
700 *buf++ = hexchars[ch[1] & 0xf]; 695 buf = pack_hex_byte(buf, ch[3]);
701 *buf++ = hexchars[ch[2] >> 4];
702 *buf++ = hexchars[ch[2] & 0xf];
703 *buf++ = hexchars[ch[3] >> 4];
704 *buf++ = hexchars[ch[3] & 0xf];
705 mem += 4; 696 mem += 4;
706 count -= 4; 697 count -= 4;
707 } 698 }
@@ -709,10 +700,8 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa
709 if (count>=2) { 700 if (count>=2) {
710 if (!gdbstub_read_word(mem,(uint16_t *)ch)) 701 if (!gdbstub_read_word(mem,(uint16_t *)ch))
711 return NULL; 702 return NULL;
712 *buf++ = hexchars[ch[0] >> 4]; 703 buf = pack_hex_byte(buf, ch[0]);
713 *buf++ = hexchars[ch[0] & 0xf]; 704 buf = pack_hex_byte(buf, ch[1]);
714 *buf++ = hexchars[ch[1] >> 4];
715 *buf++ = hexchars[ch[1] & 0xf];
716 mem += 2; 705 mem += 2;
717 count -= 2; 706 count -= 2;
718 } 707 }
@@ -720,8 +709,7 @@ static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fa
720 if (count>=1) { 709 if (count>=1) {
721 if (!gdbstub_read_byte(mem,ch)) 710 if (!gdbstub_read_byte(mem,ch))
722 return NULL; 711 return NULL;
723 *buf++ = hexchars[ch[0] >> 4]; 712 buf = pack_hex_byte(buf, ch[0]);
724 *buf++ = hexchars[ch[0] & 0xf];
725 } 713 }
726 714
727 *buf = 0; 715 *buf = 0;
@@ -1471,22 +1459,22 @@ void gdbstub(int sigval)
1471 *ptr++ = 'O'; 1459 *ptr++ = 'O';
1472 ptr = mem2hex(title, ptr, sizeof(title) - 1,0); 1460 ptr = mem2hex(title, ptr, sizeof(title) - 1,0);
1473 1461
1474 hx = hexchars[(brr & 0xf0000000) >> 28]; 1462 hx = hex_asc_hi(brr >> 24);
1475 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1463 ptr = pack_hex_byte(ptr, hx);
1476 hx = hexchars[(brr & 0x0f000000) >> 24]; 1464 hx = hex_asc_lo(brr >> 24);
1477 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1465 ptr = pack_hex_byte(ptr, hx);
1478 hx = hexchars[(brr & 0x00f00000) >> 20]; 1466 hx = hex_asc_hi(brr >> 16);
1479 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1467 ptr = pack_hex_byte(ptr, hx);
1480 hx = hexchars[(brr & 0x000f0000) >> 16]; 1468 hx = hex_asc_lo(brr >> 16);
1481 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1469 ptr = pack_hex_byte(ptr, hx);
1482 hx = hexchars[(brr & 0x0000f000) >> 12]; 1470 hx = hex_asc_hi(brr >> 8);
1483 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1471 ptr = pack_hex_byte(ptr, hx);
1484 hx = hexchars[(brr & 0x00000f00) >> 8]; 1472 hx = hex_asc_lo(brr >> 8);
1485 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1473 ptr = pack_hex_byte(ptr, hx);
1486 hx = hexchars[(brr & 0x000000f0) >> 4]; 1474 hx = hex_asc_hi(brr);
1487 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1475 ptr = pack_hex_byte(ptr, hx);
1488 hx = hexchars[(brr & 0x0000000f)]; 1476 hx = hex_asc_lo(brr);
1489 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1477 ptr = pack_hex_byte(ptr, hx);
1490 1478
1491 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0); 1479 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0);
1492 *ptr = 0; 1480 *ptr = 0;
@@ -1500,12 +1488,10 @@ void gdbstub(int sigval)
1500 1488
1501 /* Send trap type (converted to signal) */ 1489 /* Send trap type (converted to signal) */
1502 *ptr++ = 'T'; 1490 *ptr++ = 'T';
1503 *ptr++ = hexchars[sigval >> 4]; 1491 ptr = pack_hex_byte(ptr, sigval);
1504 *ptr++ = hexchars[sigval & 0xf];
1505 1492
1506 /* Send Error PC */ 1493 /* Send Error PC */
1507 *ptr++ = hexchars[GDB_REG_PC >> 4]; 1494 ptr = pack_hex_byte(ptr, GDB_REG_PC);
1508 *ptr++ = hexchars[GDB_REG_PC & 0xf];
1509 *ptr++ = ':'; 1495 *ptr++ = ':';
1510 ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0); 1496 ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0);
1511 *ptr++ = ';'; 1497 *ptr++ = ';';
@@ -1513,8 +1499,7 @@ void gdbstub(int sigval)
1513 /* 1499 /*
1514 * Send frame pointer 1500 * Send frame pointer
1515 */ 1501 */
1516 *ptr++ = hexchars[GDB_REG_FP >> 4]; 1502 ptr = pack_hex_byte(ptr, GDB_REG_FP);
1517 *ptr++ = hexchars[GDB_REG_FP & 0xf];
1518 *ptr++ = ':'; 1503 *ptr++ = ':';
1519 ptr = mem2hex(&__debug_frame->fp, ptr, 4, 0); 1504 ptr = mem2hex(&__debug_frame->fp, ptr, 4, 0);
1520 *ptr++ = ';'; 1505 *ptr++ = ';';
@@ -1522,8 +1507,7 @@ void gdbstub(int sigval)
1522 /* 1507 /*
1523 * Send stack pointer 1508 * Send stack pointer
1524 */ 1509 */
1525 *ptr++ = hexchars[GDB_REG_SP >> 4]; 1510 ptr = pack_hex_byte(ptr, GDB_REG_SP);
1526 *ptr++ = hexchars[GDB_REG_SP & 0xf];
1527 *ptr++ = ':'; 1511 *ptr++ = ':';
1528 ptr = mem2hex(&__debug_frame->sp, ptr, 4, 0); 1512 ptr = mem2hex(&__debug_frame->sp, ptr, 4, 0);
1529 *ptr++ = ';'; 1513 *ptr++ = ';';
@@ -1548,8 +1532,8 @@ void gdbstub(int sigval)
1548 /* request repeat of last signal number */ 1532 /* request repeat of last signal number */
1549 case '?': 1533 case '?':
1550 output_buffer[0] = 'S'; 1534 output_buffer[0] = 'S';
1551 output_buffer[1] = hexchars[sigval >> 4]; 1535 output_buffer[1] = hex_asc_hi(sigval);
1552 output_buffer[2] = hexchars[sigval & 0xf]; 1536 output_buffer[2] = hex_asc_lo(sigval);
1553 output_buffer[3] = 0; 1537 output_buffer[3] = 0;
1554 break; 1538 break;
1555 1539
@@ -2059,8 +2043,8 @@ void gdbstub_exit(int status)
2059 } 2043 }
2060 2044
2061 gdbstub_tx_char('#'); 2045 gdbstub_tx_char('#');
2062 gdbstub_tx_char(hexchars[checksum >> 4]); 2046 gdbstub_tx_char(hex_asc_hi(checksum));
2063 gdbstub_tx_char(hexchars[checksum & 0xf]); 2047 gdbstub_tx_char(hex_asc_lo(checksum));
2064 2048
2065 /* make sure the output is flushed, or else RedBoot might clobber it */ 2049 /* make sure the output is flushed, or else RedBoot might clobber it */
2066 gdbstub_tx_char('-'); 2050 gdbstub_tx_char('-');
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 9af7740f32fb..1b851db34186 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -63,37 +63,6 @@ EXPORT_SYMBOL(empty_zero_page);
63 63
64/*****************************************************************************/ 64/*****************************************************************************/
65/* 65/*
66 *
67 */
68void show_mem(void)
69{
70 unsigned long i;
71 int free = 0, total = 0, reserved = 0, shared = 0;
72
73 printk("\nMem-info:\n");
74 show_free_areas();
75 i = max_mapnr;
76 while (i-- > 0) {
77 struct page *page = &mem_map[i];
78
79 total++;
80 if (PageReserved(page))
81 reserved++;
82 else if (!page_count(page))
83 free++;
84 else
85 shared += page_count(page) - 1;
86 }
87
88 printk("%d pages of RAM\n",total);
89 printk("%d free pages\n",free);
90 printk("%d reserved pages\n",reserved);
91 printk("%d pages shared\n",shared);
92
93} /* end show_mem() */
94
95/*****************************************************************************/
96/*
97 * paging_init() continues the virtual memory environment setup which 66 * paging_init() continues the virtual memory environment setup which
98 * was begun by the code in arch/head.S. 67 * was begun by the code in arch/head.S.
99 * The parameters are pointers to where to stick the starting and ending 68 * The parameters are pointers to where to stick the starting and ending
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
index e4f4199f97ab..a1d228f5e4e6 100644
--- a/arch/h8300/mm/init.c
+++ b/arch/h8300/mm/init.c
@@ -64,33 +64,6 @@ unsigned long empty_zero_page;
64 64
65extern unsigned long rom_length; 65extern unsigned long rom_length;
66 66
67void show_mem(void)
68{
69 unsigned long i;
70 int free = 0, total = 0, reserved = 0, shared = 0;
71 int cached = 0;
72
73 printk("\nMem-info:\n");
74 show_free_areas();
75 i = max_mapnr;
76 while (i-- > 0) {
77 total++;
78 if (PageReserved(mem_map+i))
79 reserved++;
80 else if (PageSwapCache(mem_map+i))
81 cached++;
82 else if (!page_count(mem_map+i))
83 free++;
84 else
85 shared += page_count(mem_map+i) - 1;
86 }
87 printk("%d pages of RAM\n",total);
88 printk("%d free pages\n",free);
89 printk("%d reserved pages\n",reserved);
90 printk("%d pages shared\n",shared);
91 printk("%d pages swap cached\n",cached);
92}
93
94extern unsigned long memory_start; 67extern unsigned long memory_start;
95extern unsigned long memory_end; 68extern unsigned long memory_end;
96 69
diff --git a/arch/ia64/hp/common/hwsw_iommu.c b/arch/ia64/hp/common/hwsw_iommu.c
index 1c44ec2a1d58..88b6e6f3fd88 100644
--- a/arch/ia64/hp/common/hwsw_iommu.c
+++ b/arch/ia64/hp/common/hwsw_iommu.c
@@ -186,9 +186,10 @@ hwsw_dma_supported (struct device *dev, u64 mask)
186} 186}
187 187
188int 188int
189hwsw_dma_mapping_error (dma_addr_t dma_addr) 189hwsw_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
190{ 190{
191 return hwiommu_dma_mapping_error (dma_addr) || swiotlb_dma_mapping_error(dma_addr); 191 return hwiommu_dma_mapping_error(dev, dma_addr) ||
192 swiotlb_dma_mapping_error(dev, dma_addr);
192} 193}
193 194
194EXPORT_SYMBOL(hwsw_dma_mapping_error); 195EXPORT_SYMBOL(hwsw_dma_mapping_error);
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 34421aed1e2a..4956be40d7b5 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -2147,7 +2147,7 @@ sba_dma_supported (struct device *dev, u64 mask)
2147} 2147}
2148 2148
2149int 2149int
2150sba_dma_mapping_error (dma_addr_t dma_addr) 2150sba_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
2151{ 2151{
2152 return 0; 2152 return 0;
2153} 2153}
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 19d4493c6193..fc8f3509df27 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2626,7 +2626,7 @@ pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
2626 /* 2626 /*
2627 * make sure the task is off any CPU 2627 * make sure the task is off any CPU
2628 */ 2628 */
2629 wait_task_inactive(task); 2629 wait_task_inactive(task, 0);
2630 2630
2631 /* more to come... */ 2631 /* more to come... */
2632 2632
@@ -4774,7 +4774,7 @@ recheck:
4774 4774
4775 UNPROTECT_CTX(ctx, flags); 4775 UNPROTECT_CTX(ctx, flags);
4776 4776
4777 wait_task_inactive(task); 4777 wait_task_inactive(task, 0);
4778 4778
4779 PROTECT_CTX(ctx, flags); 4779 PROTECT_CTX(ctx, flags);
4780 4780
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 52175af299a0..53ebb6484495 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -350,7 +350,7 @@ void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
350} 350}
351EXPORT_SYMBOL(sn_dma_sync_sg_for_device); 351EXPORT_SYMBOL(sn_dma_sync_sg_for_device);
352 352
353int sn_dma_mapping_error(dma_addr_t dma_addr) 353int sn_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
354{ 354{
355 return 0; 355 return 0;
356} 356}
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index 2554eb59cfef..24d429f9358a 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -36,42 +36,6 @@ pgd_t swapper_pg_dir[1024];
36 36
37DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 37DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
38 38
39void show_mem(void)
40{
41 int total = 0, reserved = 0;
42 int shared = 0, cached = 0;
43 int highmem = 0;
44 struct page *page;
45 pg_data_t *pgdat;
46 unsigned long i;
47
48 printk("Mem-info:\n");
49 show_free_areas();
50 printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
51 for_each_online_pgdat(pgdat) {
52 unsigned long flags;
53 pgdat_resize_lock(pgdat, &flags);
54 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
55 page = pgdat_page_nr(pgdat, i);
56 total++;
57 if (PageHighMem(page))
58 highmem++;
59 if (PageReserved(page))
60 reserved++;
61 else if (PageSwapCache(page))
62 cached++;
63 else if (page_count(page))
64 shared += page_count(page) - 1;
65 }
66 pgdat_resize_unlock(pgdat, &flags);
67 }
68 printk("%d pages of RAM\n", total);
69 printk("%d pages of HIGHMEM\n",highmem);
70 printk("%d reserved pages\n",reserved);
71 printk("%d pages shared\n",shared);
72 printk("%d pages swap cached\n",cached);
73}
74
75/* 39/*
76 * Cache of MMU context last used. 40 * Cache of MMU context last used.
77 */ 41 */
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 79f5f94d4800..81bb08ceec18 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -69,36 +69,6 @@ void __init m68k_setup_node(int node)
69void *empty_zero_page; 69void *empty_zero_page;
70EXPORT_SYMBOL(empty_zero_page); 70EXPORT_SYMBOL(empty_zero_page);
71 71
72void show_mem(void)
73{
74 pg_data_t *pgdat;
75 int free = 0, total = 0, reserved = 0, shared = 0;
76 int cached = 0;
77 int i;
78
79 printk("\nMem-info:\n");
80 show_free_areas();
81 for_each_online_pgdat(pgdat) {
82 for (i = 0; i < pgdat->node_spanned_pages; i++) {
83 struct page *page = pgdat->node_mem_map + i;
84 total++;
85 if (PageReserved(page))
86 reserved++;
87 else if (PageSwapCache(page))
88 cached++;
89 else if (!page_count(page))
90 free++;
91 else
92 shared += page_count(page) - 1;
93 }
94 }
95 printk("%d pages of RAM\n",total);
96 printk("%d free pages\n",free);
97 printk("%d reserved pages\n",reserved);
98 printk("%d pages shared\n",shared);
99 printk("%d pages swap cached\n",cached);
100}
101
102extern void init_pointer_table(unsigned long ptable); 72extern void init_pointer_table(unsigned long ptable);
103 73
104/* References to section boundaries */ 74/* References to section boundaries */
diff --git a/arch/m68knommu/mm/init.c b/arch/m68knommu/mm/init.c
index 22e2a0d02b81..3bf249c53e41 100644
--- a/arch/m68knommu/mm/init.c
+++ b/arch/m68knommu/mm/init.c
@@ -62,33 +62,6 @@ static unsigned long empty_bad_page;
62 62
63unsigned long empty_zero_page; 63unsigned long empty_zero_page;
64 64
65void show_mem(void)
66{
67 unsigned long i;
68 int free = 0, total = 0, reserved = 0, shared = 0;
69 int cached = 0;
70
71 printk(KERN_INFO "\nMem-info:\n");
72 show_free_areas();
73 i = max_mapnr;
74 while (i-- > 0) {
75 total++;
76 if (PageReserved(mem_map+i))
77 reserved++;
78 else if (PageSwapCache(mem_map+i))
79 cached++;
80 else if (!page_count(mem_map+i))
81 free++;
82 else
83 shared += page_count(mem_map+i) - 1;
84 }
85 printk(KERN_INFO "%d pages of RAM\n",total);
86 printk(KERN_INFO "%d free pages\n",free);
87 printk(KERN_INFO "%d reserved pages\n",reserved);
88 printk(KERN_INFO "%d pages shared\n",shared);
89 printk(KERN_INFO "%d pages swap cached\n",cached);
90}
91
92extern unsigned long memory_start; 65extern unsigned long memory_start;
93extern unsigned long memory_end; 66extern unsigned long memory_end;
94 67
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index 48731020ca0e..44e8dd8106bf 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -3,8 +3,7 @@
3# 3#
4 4
5obj-y += cache.o dma-default.o extable.o fault.o \ 5obj-y += cache.o dma-default.o extable.o fault.o \
6 init.o pgtable.o tlbex.o tlbex-fault.o \ 6 init.o tlbex.o tlbex-fault.o uasm.o page.o
7 uasm.o page.o
8 7
9obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o 8obj-$(CONFIG_32BIT) += ioremap.o pgtable-32.o
10obj-$(CONFIG_64BIT) += pgtable-64.o 9obj-$(CONFIG_64BIT) += pgtable-64.o
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index ae39dd88b9aa..891312f8e5a6 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -348,7 +348,7 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nele
348 348
349EXPORT_SYMBOL(dma_sync_sg_for_device); 349EXPORT_SYMBOL(dma_sync_sg_for_device);
350 350
351int dma_mapping_error(dma_addr_t dma_addr) 351int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
352{ 352{
353 return 0; 353 return 0;
354} 354}
diff --git a/arch/mips/mm/pgtable.c b/arch/mips/mm/pgtable.c
deleted file mode 100644
index 7dfa579ab24c..000000000000
--- a/arch/mips/mm/pgtable.c
+++ /dev/null
@@ -1,36 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/mm.h>
3#include <linux/swap.h>
4
5void show_mem(void)
6{
7#ifndef CONFIG_NEED_MULTIPLE_NODES /* XXX(hch): later.. */
8 int pfn, total = 0, reserved = 0;
9 int shared = 0, cached = 0;
10 int highmem = 0;
11 struct page *page;
12
13 printk("Mem-info:\n");
14 show_free_areas();
15 pfn = max_mapnr;
16 while (pfn-- > 0) {
17 if (!pfn_valid(pfn))
18 continue;
19 page = pfn_to_page(pfn);
20 total++;
21 if (PageHighMem(page))
22 highmem++;
23 if (PageReserved(page))
24 reserved++;
25 else if (PageSwapCache(page))
26 cached++;
27 else if (page_count(page))
28 shared += page_count(page) - 1;
29 }
30 printk("%d pages of RAM\n", total);
31 printk("%d pages of HIGHMEM\n", highmem);
32 printk("%d reserved pages\n", reserved);
33 printk("%d pages shared\n", shared);
34 printk("%d pages swap cached\n", cached);
35#endif
36}
diff --git a/arch/mn10300/kernel/gdb-stub.c b/arch/mn10300/kernel/gdb-stub.c
index 21891c71d549..54be6afb5555 100644
--- a/arch/mn10300/kernel/gdb-stub.c
+++ b/arch/mn10300/kernel/gdb-stub.c
@@ -163,8 +163,6 @@ static char input_buffer[BUFMAX];
163static char output_buffer[BUFMAX]; 163static char output_buffer[BUFMAX];
164static char trans_buffer[BUFMAX]; 164static char trans_buffer[BUFMAX];
165 165
166static const char hexchars[] = "0123456789abcdef";
167
168struct gdbstub_bkpt { 166struct gdbstub_bkpt {
169 u8 *addr; /* address of breakpoint */ 167 u8 *addr; /* address of breakpoint */
170 u8 len; /* size of breakpoint */ 168 u8 len; /* size of breakpoint */
@@ -363,8 +361,8 @@ static int putpacket(char *buffer)
363 } 361 }
364 362
365 gdbstub_io_tx_char('#'); 363 gdbstub_io_tx_char('#');
366 gdbstub_io_tx_char(hexchars[checksum >> 4]); 364 gdbstub_io_tx_char(hex_asc_hi(checksum));
367 gdbstub_io_tx_char(hexchars[checksum & 0xf]); 365 gdbstub_io_tx_char(hex_asc_lo(checksum));
368 366
369 } while (gdbstub_io_rx_char(&ch, 0), 367 } while (gdbstub_io_rx_char(&ch, 0),
370 ch == '-' && (gdbstub_io("### GDB Rx NAK\n"), 0), 368 ch == '-' && (gdbstub_io("### GDB Rx NAK\n"), 0),
@@ -822,8 +820,7 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault)
822 if ((u32) mem & 1 && count >= 1) { 820 if ((u32) mem & 1 && count >= 1) {
823 if (gdbstub_read_byte(mem, ch) != 0) 821 if (gdbstub_read_byte(mem, ch) != 0)
824 return 0; 822 return 0;
825 *buf++ = hexchars[ch[0] >> 4]; 823 buf = pack_hex_byte(buf, ch[0]);
826 *buf++ = hexchars[ch[0] & 0xf];
827 mem++; 824 mem++;
828 count--; 825 count--;
829 } 826 }
@@ -831,10 +828,8 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault)
831 if ((u32) mem & 3 && count >= 2) { 828 if ((u32) mem & 3 && count >= 2) {
832 if (gdbstub_read_word(mem, ch) != 0) 829 if (gdbstub_read_word(mem, ch) != 0)
833 return 0; 830 return 0;
834 *buf++ = hexchars[ch[0] >> 4]; 831 buf = pack_hex_byte(buf, ch[0]);
835 *buf++ = hexchars[ch[0] & 0xf]; 832 buf = pack_hex_byte(buf, ch[1]);
836 *buf++ = hexchars[ch[1] >> 4];
837 *buf++ = hexchars[ch[1] & 0xf];
838 mem += 2; 833 mem += 2;
839 count -= 2; 834 count -= 2;
840 } 835 }
@@ -842,14 +837,10 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault)
842 while (count >= 4) { 837 while (count >= 4) {
843 if (gdbstub_read_dword(mem, ch) != 0) 838 if (gdbstub_read_dword(mem, ch) != 0)
844 return 0; 839 return 0;
845 *buf++ = hexchars[ch[0] >> 4]; 840 buf = pack_hex_byte(buf, ch[0]);
846 *buf++ = hexchars[ch[0] & 0xf]; 841 buf = pack_hex_byte(buf, ch[1]);
847 *buf++ = hexchars[ch[1] >> 4]; 842 buf = pack_hex_byte(buf, ch[2]);
848 *buf++ = hexchars[ch[1] & 0xf]; 843 buf = pack_hex_byte(buf, ch[3]);
849 *buf++ = hexchars[ch[2] >> 4];
850 *buf++ = hexchars[ch[2] & 0xf];
851 *buf++ = hexchars[ch[3] >> 4];
852 *buf++ = hexchars[ch[3] & 0xf];
853 mem += 4; 844 mem += 4;
854 count -= 4; 845 count -= 4;
855 } 846 }
@@ -857,10 +848,8 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault)
857 if (count >= 2) { 848 if (count >= 2) {
858 if (gdbstub_read_word(mem, ch) != 0) 849 if (gdbstub_read_word(mem, ch) != 0)
859 return 0; 850 return 0;
860 *buf++ = hexchars[ch[0] >> 4]; 851 buf = pack_hex_byte(buf, ch[0]);
861 *buf++ = hexchars[ch[0] & 0xf]; 852 buf = pack_hex_byte(buf, ch[1]);
862 *buf++ = hexchars[ch[1] >> 4];
863 *buf++ = hexchars[ch[1] & 0xf];
864 mem += 2; 853 mem += 2;
865 count -= 2; 854 count -= 2;
866 } 855 }
@@ -868,8 +857,7 @@ unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault)
868 if (count >= 1) { 857 if (count >= 1) {
869 if (gdbstub_read_byte(mem, ch) != 0) 858 if (gdbstub_read_byte(mem, ch) != 0)
870 return 0; 859 return 0;
871 *buf++ = hexchars[ch[0] >> 4]; 860 buf = pack_hex_byte(buf, ch[0]);
872 *buf++ = hexchars[ch[0] & 0xf];
873 } 861 }
874 862
875 *buf = 0; 863 *buf = 0;
@@ -1304,14 +1292,14 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep)
1304 *ptr++ = 'O'; 1292 *ptr++ = 'O';
1305 ptr = mem2hex(title, ptr, sizeof(title) - 1, 0); 1293 ptr = mem2hex(title, ptr, sizeof(title) - 1, 0);
1306 1294
1307 hx = hexchars[(excep & 0xf000) >> 12]; 1295 hx = hex_asc_hi(excep >> 8);
1308 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1296 ptr = pack_hex_byte(ptr, hx);
1309 hx = hexchars[(excep & 0x0f00) >> 8]; 1297 hx = hex_asc_lo(excep >> 8);
1310 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1298 ptr = pack_hex_byte(ptr, hx);
1311 hx = hexchars[(excep & 0x00f0) >> 4]; 1299 hx = hex_asc_hi(excep);
1312 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1300 ptr = pack_hex_byte(ptr, hx);
1313 hx = hexchars[(excep & 0x000f)]; 1301 hx = hex_asc_lo(excep);
1314 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1302 ptr = pack_hex_byte(ptr, hx);
1315 1303
1316 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0); 1304 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0);
1317 *ptr = 0; 1305 *ptr = 0;
@@ -1322,22 +1310,22 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep)
1322 *ptr++ = 'O'; 1310 *ptr++ = 'O';
1323 ptr = mem2hex(tbcberr, ptr, sizeof(tbcberr) - 1, 0); 1311 ptr = mem2hex(tbcberr, ptr, sizeof(tbcberr) - 1, 0);
1324 1312
1325 hx = hexchars[(bcberr & 0xf0000000) >> 28]; 1313 hx = hex_asc_hi(bcberr >> 24);
1326 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1314 ptr = pack_hex_byte(ptr, hx);
1327 hx = hexchars[(bcberr & 0x0f000000) >> 24]; 1315 hx = hex_asc_lo(bcberr >> 24);
1328 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1316 ptr = pack_hex_byte(ptr, hx);
1329 hx = hexchars[(bcberr & 0x00f00000) >> 20]; 1317 hx = hex_asc_hi(bcberr >> 16);
1330 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1318 ptr = pack_hex_byte(ptr, hx);
1331 hx = hexchars[(bcberr & 0x000f0000) >> 16]; 1319 hx = hex_asc_lo(bcberr >> 16);
1332 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1320 ptr = pack_hex_byte(ptr, hx);
1333 hx = hexchars[(bcberr & 0x0000f000) >> 12]; 1321 hx = hex_asc_hi(bcberr >> 8);
1334 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1322 ptr = pack_hex_byte(ptr, hx);
1335 hx = hexchars[(bcberr & 0x00000f00) >> 8]; 1323 hx = hex_asc_lo(bcberr >> 8);
1336 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1324 ptr = pack_hex_byte(ptr, hx);
1337 hx = hexchars[(bcberr & 0x000000f0) >> 4]; 1325 hx = hex_asc_hi(bcberr);
1338 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1326 ptr = pack_hex_byte(ptr, hx);
1339 hx = hexchars[(bcberr & 0x0000000f)]; 1327 hx = hex_asc_lo(bcberr);
1340 *ptr++ = hexchars[hx >> 4]; *ptr++ = hexchars[hx & 0xf]; 1328 ptr = pack_hex_byte(ptr, hx);
1341 1329
1342 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0); 1330 ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0);
1343 *ptr = 0; 1331 *ptr = 0;
@@ -1353,14 +1341,12 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep)
1353 * Send trap type (converted to signal) 1341 * Send trap type (converted to signal)
1354 */ 1342 */
1355 *ptr++ = 'T'; 1343 *ptr++ = 'T';
1356 *ptr++ = hexchars[sigval >> 4]; 1344 ptr = pack_hex_byte(ptr, sigval);
1357 *ptr++ = hexchars[sigval & 0xf];
1358 1345
1359 /* 1346 /*
1360 * Send Error PC 1347 * Send Error PC
1361 */ 1348 */
1362 *ptr++ = hexchars[GDB_REGID_PC >> 4]; 1349 ptr = pack_hex_byte(ptr, GDB_REGID_PC);
1363 *ptr++ = hexchars[GDB_REGID_PC & 0xf];
1364 *ptr++ = ':'; 1350 *ptr++ = ':';
1365 ptr = mem2hex(&regs->pc, ptr, 4, 0); 1351 ptr = mem2hex(&regs->pc, ptr, 4, 0);
1366 *ptr++ = ';'; 1352 *ptr++ = ';';
@@ -1368,8 +1354,7 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep)
1368 /* 1354 /*
1369 * Send frame pointer 1355 * Send frame pointer
1370 */ 1356 */
1371 *ptr++ = hexchars[GDB_REGID_FP >> 4]; 1357 ptr = pack_hex_byte(ptr, GDB_REGID_FP);
1372 *ptr++ = hexchars[GDB_REGID_FP & 0xf];
1373 *ptr++ = ':'; 1358 *ptr++ = ':';
1374 ptr = mem2hex(&regs->a3, ptr, 4, 0); 1359 ptr = mem2hex(&regs->a3, ptr, 4, 0);
1375 *ptr++ = ';'; 1360 *ptr++ = ';';
@@ -1378,8 +1363,7 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep)
1378 * Send stack pointer 1363 * Send stack pointer
1379 */ 1364 */
1380 ssp = (unsigned long) (regs + 1); 1365 ssp = (unsigned long) (regs + 1);
1381 *ptr++ = hexchars[GDB_REGID_SP >> 4]; 1366 ptr = pack_hex_byte(ptr, GDB_REGID_SP);
1382 *ptr++ = hexchars[GDB_REGID_SP & 0xf];
1383 *ptr++ = ':'; 1367 *ptr++ = ':';
1384 ptr = mem2hex(&ssp, ptr, 4, 0); 1368 ptr = mem2hex(&ssp, ptr, 4, 0);
1385 *ptr++ = ';'; 1369 *ptr++ = ';';
@@ -1399,8 +1383,8 @@ packet_waiting:
1399 /* request repeat of last signal number */ 1383 /* request repeat of last signal number */
1400 case '?': 1384 case '?':
1401 output_buffer[0] = 'S'; 1385 output_buffer[0] = 'S';
1402 output_buffer[1] = hexchars[sigval >> 4]; 1386 output_buffer[1] = hex_asc_hi(sigval);
1403 output_buffer[2] = hexchars[sigval & 0xf]; 1387 output_buffer[2] = hex_asc_lo(sigval);
1404 output_buffer[3] = 0; 1388 output_buffer[3] = 0;
1405 break; 1389 break;
1406 1390
@@ -1838,8 +1822,8 @@ void gdbstub_exit(int status)
1838 1822
1839 gdbstub_busy = 1; 1823 gdbstub_busy = 1;
1840 output_buffer[0] = 'W'; 1824 output_buffer[0] = 'W';
1841 output_buffer[1] = hexchars[(status >> 4) & 0x0F]; 1825 output_buffer[1] = hex_asc_hi(status);
1842 output_buffer[2] = hexchars[status & 0x0F]; 1826 output_buffer[2] = hex_asc_lo(status);
1843 output_buffer[3] = 0; 1827 output_buffer[3] = 0;
1844 1828
1845 gdbstub_io_tx_char('$'); 1829 gdbstub_io_tx_char('$');
@@ -1853,8 +1837,8 @@ void gdbstub_exit(int status)
1853 } 1837 }
1854 1838
1855 gdbstub_io_tx_char('#'); 1839 gdbstub_io_tx_char('#');
1856 gdbstub_io_tx_char(hexchars[checksum >> 4]); 1840 gdbstub_io_tx_char(hex_asc_hi(checksum));
1857 gdbstub_io_tx_char(hexchars[checksum & 0xf]); 1841 gdbstub_io_tx_char(hex_asc_lo(checksum));
1858 1842
1859 /* make sure the output is flushed, or else RedBoot might clobber it */ 1843 /* make sure the output is flushed, or else RedBoot might clobber it */
1860 gdbstub_io_tx_flush(); 1844 gdbstub_io_tx_flush();
diff --git a/arch/mn10300/mm/pgtable.c b/arch/mn10300/mm/pgtable.c
index a477038752ba..baffc581e031 100644
--- a/arch/mn10300/mm/pgtable.c
+++ b/arch/mn10300/mm/pgtable.c
@@ -27,33 +27,6 @@
27#include <asm/tlb.h> 27#include <asm/tlb.h>
28#include <asm/tlbflush.h> 28#include <asm/tlbflush.h>
29 29
30void show_mem(void)
31{
32 unsigned long i;
33 int free = 0, total = 0, reserved = 0, shared = 0;
34
35 int cached = 0;
36 printk(KERN_INFO "Mem-info:\n");
37 show_free_areas();
38 i = max_mapnr;
39 while (i-- > 0) {
40 total++;
41 if (PageReserved(mem_map + i))
42 reserved++;
43 else if (PageSwapCache(mem_map + i))
44 cached++;
45 else if (!page_count(mem_map + i))
46 free++;
47 else
48 shared += page_count(mem_map + i) - 1;
49 }
50 printk(KERN_INFO "%d pages of RAM\n", total);
51 printk(KERN_INFO "%d free pages\n", free);
52 printk(KERN_INFO "%d reserved pages\n", reserved);
53 printk(KERN_INFO "%d pages shared\n", shared);
54 printk(KERN_INFO "%d pages swap cached\n", cached);
55}
56
57/* 30/*
58 * Associate a large virtual page frame with a given physical page frame 31 * Associate a large virtual page frame with a given physical page frame
59 * and protection flags for that frame. pfn is for the base of the page, 32 * and protection flags for that frame. pfn is for the base of the page,
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 29a0e039d436..aab76887a842 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -48,7 +48,7 @@ void machine_kexec_cleanup(struct kimage *image)
48 * Do not allocate memory (or fail in any way) in machine_kexec(). 48 * Do not allocate memory (or fail in any way) in machine_kexec().
49 * We are past the point of no return, committed to rebooting now. 49 * We are past the point of no return, committed to rebooting now.
50 */ 50 */
51NORET_TYPE void machine_kexec(struct kimage *image) 51void machine_kexec(struct kimage *image)
52{ 52{
53 if (ppc_md.machine_kexec) 53 if (ppc_md.machine_kexec)
54 ppc_md.machine_kexec(image); 54 ppc_md.machine_kexec(image);
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 09ded5c424a9..149cb112cd1a 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -286,7 +286,7 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
286} 286}
287 287
288/* constructor for flash_block_cache */ 288/* constructor for flash_block_cache */
289void rtas_block_ctor(struct kmem_cache *cache, void *ptr) 289void rtas_block_ctor(void *ptr)
290{ 290{
291 memset(ptr, 0, RTAS_BLK_SIZE); 291 memset(ptr, 0, RTAS_BLK_SIZE);
292} 292}
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index fb42c4dd3217..ed0aab0208a6 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -113,7 +113,7 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr,
113static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, 113static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
114 unsigned long address, unsigned int psize) 114 unsigned long address, unsigned int psize)
115{ 115{
116 pte_t *new = kmem_cache_alloc(huge_pgtable_cache(psize), 116 pte_t *new = kmem_cache_zalloc(huge_pgtable_cache(psize),
117 GFP_KERNEL|__GFP_REPEAT); 117 GFP_KERNEL|__GFP_REPEAT);
118 118
119 if (! new) 119 if (! new)
@@ -730,11 +730,6 @@ static int __init hugepage_setup_sz(char *str)
730} 730}
731__setup("hugepagesz=", hugepage_setup_sz); 731__setup("hugepagesz=", hugepage_setup_sz);
732 732
733static void zero_ctor(struct kmem_cache *cache, void *addr)
734{
735 memset(addr, 0, kmem_cache_size(cache));
736}
737
738static int __init hugetlbpage_init(void) 733static int __init hugetlbpage_init(void)
739{ 734{
740 unsigned int psize; 735 unsigned int psize;
@@ -756,7 +751,7 @@ static int __init hugetlbpage_init(void)
756 HUGEPTE_TABLE_SIZE(psize), 751 HUGEPTE_TABLE_SIZE(psize),
757 HUGEPTE_TABLE_SIZE(psize), 752 HUGEPTE_TABLE_SIZE(psize),
758 0, 753 0,
759 zero_ctor); 754 NULL);
760 if (!huge_pgtable_cache(psize)) 755 if (!huge_pgtable_cache(psize))
761 panic("hugetlbpage_init(): could not create %s"\ 756 panic("hugetlbpage_init(): could not create %s"\
762 "\n", HUGEPTE_CACHE_NAME(psize)); 757 "\n", HUGEPTE_CACHE_NAME(psize));
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index a41bc5aa2043..4f7df85129d8 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -136,9 +136,14 @@ static int __init setup_kcore(void)
136module_init(setup_kcore); 136module_init(setup_kcore);
137#endif 137#endif
138 138
139static void zero_ctor(struct kmem_cache *cache, void *addr) 139static void pgd_ctor(void *addr)
140{ 140{
141 memset(addr, 0, kmem_cache_size(cache)); 141 memset(addr, 0, PGD_TABLE_SIZE);
142}
143
144static void pmd_ctor(void *addr)
145{
146 memset(addr, 0, PMD_TABLE_SIZE);
142} 147}
143 148
144static const unsigned int pgtable_cache_size[2] = { 149static const unsigned int pgtable_cache_size[2] = {
@@ -163,19 +168,8 @@ struct kmem_cache *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)];
163 168
164void pgtable_cache_init(void) 169void pgtable_cache_init(void)
165{ 170{
166 int i; 171 pgtable_cache[0] = kmem_cache_create(pgtable_cache_name[0], PGD_TABLE_SIZE, PGD_TABLE_SIZE, SLAB_PANIC, pgd_ctor);
167 172 pgtable_cache[1] = kmem_cache_create(pgtable_cache_name[1], PMD_TABLE_SIZE, PMD_TABLE_SIZE, SLAB_PANIC, pmd_ctor);
168 for (i = 0; i < ARRAY_SIZE(pgtable_cache_size); i++) {
169 int size = pgtable_cache_size[i];
170 const char *name = pgtable_cache_name[i];
171
172 pr_debug("Allocating page table cache %s (#%d) "
173 "for size: %08x...\n", name, i, size);
174 pgtable_cache[i] = kmem_cache_create(name,
175 size, size,
176 SLAB_PANIC,
177 zero_ctor);
178 }
179} 173}
180 174
181#ifdef CONFIG_SPARSEMEM_VMEMMAP 175#ifdef CONFIG_SPARSEMEM_VMEMMAP
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 1ca2235f0965..702691cb9e82 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -186,45 +186,6 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg,
186} 186}
187EXPORT_SYMBOL_GPL(walk_memory_resource); 187EXPORT_SYMBOL_GPL(walk_memory_resource);
188 188
189void show_mem(void)
190{
191 unsigned long total = 0, reserved = 0;
192 unsigned long shared = 0, cached = 0;
193 unsigned long highmem = 0;
194 struct page *page;
195 pg_data_t *pgdat;
196 unsigned long i;
197
198 printk("Mem-info:\n");
199 show_free_areas();
200 for_each_online_pgdat(pgdat) {
201 unsigned long flags;
202 pgdat_resize_lock(pgdat, &flags);
203 for (i = 0; i < pgdat->node_spanned_pages; i++) {
204 if (!pfn_valid(pgdat->node_start_pfn + i))
205 continue;
206 page = pgdat_page_nr(pgdat, i);
207 total++;
208 if (PageHighMem(page))
209 highmem++;
210 if (PageReserved(page))
211 reserved++;
212 else if (PageSwapCache(page))
213 cached++;
214 else if (page_count(page))
215 shared += page_count(page) - 1;
216 }
217 pgdat_resize_unlock(pgdat, &flags);
218 }
219 printk("%ld pages of RAM\n", total);
220#ifdef CONFIG_HIGHMEM
221 printk("%ld pages of HIGHMEM\n", highmem);
222#endif
223 printk("%ld reserved pages\n", reserved);
224 printk("%ld pages shared\n", shared);
225 printk("%ld pages swap cached\n", cached);
226}
227
228/* 189/*
229 * Initialize the bootmem system and give it all the memory we 190 * Initialize the bootmem system and give it all the memory we
230 * have available. If we are using highmem, we only put the 191 * have available. If we are using highmem, we only put the
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
index 0e04f8fb152a..3e7e0f1568ef 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
@@ -281,7 +281,7 @@ static int __init scc_pciex_iowa_init(struct iowa_bus *bus, void *data)
281 281
282 dummy_page_da = dma_map_single(bus->phb->parent, dummy_page_va, 282 dummy_page_da = dma_map_single(bus->phb->parent, dummy_page_va,
283 PAGE_SIZE, DMA_FROM_DEVICE); 283 PAGE_SIZE, DMA_FROM_DEVICE);
284 if (dma_mapping_error(dummy_page_da)) { 284 if (dma_mapping_error(bus->phb->parent, dummy_page_da)) {
285 pr_err("PCIEX:Map dummy page failed.\n"); 285 pr_err("PCIEX:Map dummy page failed.\n");
286 kfree(dummy_page_va); 286 kfree(dummy_page_va);
287 return -1; 287 return -1;
diff --git a/arch/powerpc/platforms/cell/spider-pci.c b/arch/powerpc/platforms/cell/spider-pci.c
index 418b605ac35a..5122ec145271 100644
--- a/arch/powerpc/platforms/cell/spider-pci.c
+++ b/arch/powerpc/platforms/cell/spider-pci.c
@@ -111,7 +111,7 @@ static int __init spiderpci_pci_setup_chip(struct pci_controller *phb,
111 111
112 dummy_page_da = dma_map_single(phb->parent, dummy_page_va, 112 dummy_page_da = dma_map_single(phb->parent, dummy_page_va,
113 PAGE_SIZE, DMA_FROM_DEVICE); 113 PAGE_SIZE, DMA_FROM_DEVICE);
114 if (dma_mapping_error(dummy_page_da)) { 114 if (dma_mapping_error(phb->parent, dummy_page_da)) {
115 pr_err("SPIDER-IOWA:Map dummy page filed.\n"); 115 pr_err("SPIDER-IOWA:Map dummy page filed.\n");
116 kfree(dummy_page_va); 116 kfree(dummy_page_va);
117 return -1; 117 return -1;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 7123472801d9..690ca7b0dcf6 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -78,7 +78,7 @@ spufs_destroy_inode(struct inode *inode)
78} 78}
79 79
80static void 80static void
81spufs_init_once(struct kmem_cache *cachep, void *p) 81spufs_init_once(void *p)
82{ 82{
83 struct spufs_inode_info *ei = p; 83 struct spufs_inode_info *ei = p;
84 84
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 1dc7295746da..731d7b157749 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -871,7 +871,7 @@ static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
871 count = 256 - off; 871 count = 256 - off;
872 872
873 dma_addr = iseries_hv_map(page, off + count, DMA_FROM_DEVICE); 873 dma_addr = iseries_hv_map(page, off + count, DMA_FROM_DEVICE);
874 if (dma_mapping_error(dma_addr)) 874 if (dma_mapping_error(NULL, dma_addr))
875 return -ENOMEM; 875 return -ENOMEM;
876 memset(page, 0, off + count); 876 memset(page, 0, off + count);
877 memset(&vsp_cmd, 0, sizeof(vsp_cmd)); 877 memset(&vsp_cmd, 0, sizeof(vsp_cmd));
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 388cc7420055..4993b0f594eb 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -42,38 +42,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE))); 42pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE))); 43char empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
44 44
45void show_mem(void)
46{
47 unsigned long i, total = 0, reserved = 0;
48 unsigned long shared = 0, cached = 0;
49 unsigned long flags;
50 struct page *page;
51 pg_data_t *pgdat;
52
53 printk("Mem-info:\n");
54 show_free_areas();
55 for_each_online_pgdat(pgdat) {
56 pgdat_resize_lock(pgdat, &flags);
57 for (i = 0; i < pgdat->node_spanned_pages; i++) {
58 if (!pfn_valid(pgdat->node_start_pfn + i))
59 continue;
60 page = pfn_to_page(pgdat->node_start_pfn + i);
61 total++;
62 if (PageReserved(page))
63 reserved++;
64 else if (PageSwapCache(page))
65 cached++;
66 else if (page_count(page))
67 shared += page_count(page) - 1;
68 }
69 pgdat_resize_unlock(pgdat, &flags);
70 }
71 printk("%ld pages of RAM\n", total);
72 printk("%ld reserved pages\n", reserved);
73 printk("%ld pages shared\n", shared);
74 printk("%ld pages swap cached\n", cached);
75}
76
77/* 45/*
78 * paging_init() sets up the page tables 46 * paging_init() sets up the page tables
79 */ 47 */
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index 5c17de51987e..ec1eadce4aaa 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -70,7 +70,7 @@ static void kexec_info(struct kimage *image)
70 * Do not allocate memory (or fail in any way) in machine_kexec(). 70 * Do not allocate memory (or fail in any way) in machine_kexec().
71 * We are past the point of no return, committed to rebooting now. 71 * We are past the point of no return, committed to rebooting now.
72 */ 72 */
73NORET_TYPE void machine_kexec(struct kimage *image) 73void machine_kexec(struct kimage *image)
74{ 74{
75 75
76 unsigned long page_list; 76 unsigned long page_list;
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index d652d375eb1e..b75a7acd62fb 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -25,47 +25,6 @@ DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
25pgd_t swapper_pg_dir[PTRS_PER_PGD]; 25pgd_t swapper_pg_dir[PTRS_PER_PGD];
26unsigned long cached_to_uncached = 0; 26unsigned long cached_to_uncached = 0;
27 27
28void show_mem(void)
29{
30 int total = 0, reserved = 0, free = 0;
31 int shared = 0, cached = 0, slab = 0;
32 pg_data_t *pgdat;
33
34 printk("Mem-info:\n");
35 show_free_areas();
36
37 for_each_online_pgdat(pgdat) {
38 unsigned long flags, i;
39
40 pgdat_resize_lock(pgdat, &flags);
41 for (i = 0; i < pgdat->node_spanned_pages; i++) {
42 struct page *page = pgdat_page_nr(pgdat, i);
43 total++;
44 if (PageReserved(page))
45 reserved++;
46 else if (PageSwapCache(page))
47 cached++;
48 else if (PageSlab(page))
49 slab++;
50 else if (!page_count(page))
51 free++;
52 else
53 shared += page_count(page) - 1;
54 }
55 pgdat_resize_unlock(pgdat, &flags);
56 }
57
58 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
59 printk("%d pages of RAM\n", total);
60 printk("%d free pages\n", free);
61 printk("%d reserved pages\n", reserved);
62 printk("%d slab pages\n", slab);
63 printk("%d pages shared\n", shared);
64 printk("%d pages swap cached\n", cached);
65 printk(KERN_INFO "Total of %ld pages in page table cache\n",
66 quicklist_total_size());
67}
68
69#ifdef CONFIG_MMU 28#ifdef CONFIG_MMU
70static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot) 29static void set_pte_phys(unsigned long addr, unsigned long phys, pgprot_t prot)
71{ 30{
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index 0b0ec6e04753..46911bcbf17b 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -293,7 +293,7 @@ void pmb_unmap(unsigned long addr)
293 } while (pmbe); 293 } while (pmbe);
294} 294}
295 295
296static void pmb_cache_ctor(struct kmem_cache *cachep, void *pmb) 296static void pmb_cache_ctor(void *pmb)
297{ 297{
298 struct pmb_entry *pmbe = pmb; 298 struct pmb_entry *pmbe = pmb;
299 299
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 713297473951..4e821b3ecb03 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -392,51 +392,6 @@ void __kprobes flush_icache_range(unsigned long start, unsigned long end)
392 } 392 }
393} 393}
394 394
395void show_mem(void)
396{
397 unsigned long total = 0, reserved = 0;
398 unsigned long shared = 0, cached = 0;
399 pg_data_t *pgdat;
400
401 printk(KERN_INFO "Mem-info:\n");
402 show_free_areas();
403 printk(KERN_INFO "Free swap: %6ldkB\n",
404 nr_swap_pages << (PAGE_SHIFT-10));
405 for_each_online_pgdat(pgdat) {
406 unsigned long i, flags;
407
408 pgdat_resize_lock(pgdat, &flags);
409 for (i = 0; i < pgdat->node_spanned_pages; i++) {
410 struct page *page = pgdat_page_nr(pgdat, i);
411 total++;
412 if (PageReserved(page))
413 reserved++;
414 else if (PageSwapCache(page))
415 cached++;
416 else if (page_count(page))
417 shared += page_count(page) - 1;
418 }
419 pgdat_resize_unlock(pgdat, &flags);
420 }
421
422 printk(KERN_INFO "%lu pages of RAM\n", total);
423 printk(KERN_INFO "%lu reserved pages\n", reserved);
424 printk(KERN_INFO "%lu pages shared\n", shared);
425 printk(KERN_INFO "%lu pages swap cached\n", cached);
426
427 printk(KERN_INFO "%lu pages dirty\n",
428 global_page_state(NR_FILE_DIRTY));
429 printk(KERN_INFO "%lu pages writeback\n",
430 global_page_state(NR_WRITEBACK));
431 printk(KERN_INFO "%lu pages mapped\n",
432 global_page_state(NR_FILE_MAPPED));
433 printk(KERN_INFO "%lu pages slab\n",
434 global_page_state(NR_SLAB_RECLAIMABLE) +
435 global_page_state(NR_SLAB_UNRECLAIMABLE));
436 printk(KERN_INFO "%lu pages pagetables\n",
437 global_page_state(NR_PAGETABLE));
438}
439
440void mmu_info(struct seq_file *m) 395void mmu_info(struct seq_file *m)
441{ 396{
442 if (tlb_type == cheetah) 397 if (tlb_type == cheetah)
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index e2274ef3155d..61d7e6138ff5 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -264,37 +264,6 @@ void free_initrd_mem(unsigned long start, unsigned long end)
264} 264}
265#endif 265#endif
266 266
267void show_mem(void)
268{
269 int pfn, total = 0, reserved = 0;
270 int shared = 0, cached = 0;
271 int high_mem = 0;
272 struct page *page;
273
274 printk(KERN_INFO "Mem-info:\n");
275 show_free_areas();
276 printk(KERN_INFO "Free swap: %6ldkB\n",
277 nr_swap_pages<<(PAGE_SHIFT-10));
278 pfn = max_mapnr;
279 while (pfn-- > 0) {
280 page = pfn_to_page(pfn);
281 total++;
282 if (PageHighMem(page))
283 high_mem++;
284 if (PageReserved(page))
285 reserved++;
286 else if (PageSwapCache(page))
287 cached++;
288 else if (page_count(page))
289 shared += page_count(page) - 1;
290 }
291 printk(KERN_INFO "%d pages of RAM\n", total);
292 printk(KERN_INFO "%d pages of HIGHMEM\n", high_mem);
293 printk(KERN_INFO "%d reserved pages\n", reserved);
294 printk(KERN_INFO "%d pages shared\n", shared);
295 printk(KERN_INFO "%d pages swap cached\n", cached);
296}
297
298/* Allocate and free page tables. */ 267/* Allocate and free page tables. */
299 268
300pgd_t *pgd_alloc(struct mm_struct *mm) 269pgd_t *pgd_alloc(struct mm_struct *mm)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 39ae67985950..b6fa2877b173 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -22,6 +22,7 @@ config X86
22 select HAVE_IDE 22 select HAVE_IDE
23 select HAVE_OPROFILE 23 select HAVE_OPROFILE
24 select HAVE_IOREMAP_PROT 24 select HAVE_IOREMAP_PROT
25 select HAVE_GET_USER_PAGES_FAST
25 select HAVE_KPROBES 26 select HAVE_KPROBES
26 select ARCH_WANT_OPTIONAL_GPIOLIB 27 select ARCH_WANT_OPTIONAL_GPIOLIB
27 select HAVE_KRETPROBES 28 select HAVE_KRETPROBES
@@ -1275,6 +1276,14 @@ config CRASH_DUMP
1275 (CONFIG_RELOCATABLE=y). 1276 (CONFIG_RELOCATABLE=y).
1276 For more details see Documentation/kdump/kdump.txt 1277 For more details see Documentation/kdump/kdump.txt
1277 1278
1279config KEXEC_JUMP
1280 bool "kexec jump (EXPERIMENTAL)"
1281 depends on EXPERIMENTAL
1282 depends on KEXEC && HIBERNATION && X86_32
1283 help
1284 Jump between original kernel and kexeced kernel and invoke
1285 code in physical address mode via KEXEC
1286
1278config PHYSICAL_START 1287config PHYSICAL_START
1279 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP) 1288 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
1280 default "0x1000000" if X86_NUMAQ 1289 default "0x1000000" if X86_NUMAQ
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index 58cccb6483b0..a0e1dbe67dc1 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -441,12 +441,6 @@ beyond_if:
441 regs->r8 = regs->r9 = regs->r10 = regs->r11 = 441 regs->r8 = regs->r9 = regs->r10 = regs->r11 =
442 regs->r12 = regs->r13 = regs->r14 = regs->r15 = 0; 442 regs->r12 = regs->r13 = regs->r14 = regs->r15 = 0;
443 set_fs(USER_DS); 443 set_fs(USER_DS);
444 if (unlikely(current->ptrace & PT_PTRACED)) {
445 if (current->ptrace & PT_TRACE_EXEC)
446 ptrace_notify((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
447 else
448 send_sig(SIGTRAP, current, 0);
449 }
450 return 0; 444 return 0;
451} 445}
452 446
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 8864230d55af..9fe478d98406 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -22,6 +22,7 @@
22#include <asm/cpufeature.h> 22#include <asm/cpufeature.h>
23#include <asm/desc.h> 23#include <asm/desc.h>
24#include <asm/system.h> 24#include <asm/system.h>
25#include <asm/cacheflush.h>
25 26
26#define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE))) 27#define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
27static u32 kexec_pgd[1024] PAGE_ALIGNED; 28static u32 kexec_pgd[1024] PAGE_ALIGNED;
@@ -85,10 +86,12 @@ static void load_segments(void)
85 * reboot code buffer to allow us to avoid allocations 86 * reboot code buffer to allow us to avoid allocations
86 * later. 87 * later.
87 * 88 *
88 * Currently nothing. 89 * Make control page executable.
89 */ 90 */
90int machine_kexec_prepare(struct kimage *image) 91int machine_kexec_prepare(struct kimage *image)
91{ 92{
93 if (nx_enabled)
94 set_pages_x(image->control_code_page, 1);
92 return 0; 95 return 0;
93} 96}
94 97
@@ -98,27 +101,48 @@ int machine_kexec_prepare(struct kimage *image)
98 */ 101 */
99void machine_kexec_cleanup(struct kimage *image) 102void machine_kexec_cleanup(struct kimage *image)
100{ 103{
104 if (nx_enabled)
105 set_pages_nx(image->control_code_page, 1);
101} 106}
102 107
103/* 108/*
104 * Do not allocate memory (or fail in any way) in machine_kexec(). 109 * Do not allocate memory (or fail in any way) in machine_kexec().
105 * We are past the point of no return, committed to rebooting now. 110 * We are past the point of no return, committed to rebooting now.
106 */ 111 */
107NORET_TYPE void machine_kexec(struct kimage *image) 112void machine_kexec(struct kimage *image)
108{ 113{
109 unsigned long page_list[PAGES_NR]; 114 unsigned long page_list[PAGES_NR];
110 void *control_page; 115 void *control_page;
116 asmlinkage unsigned long
117 (*relocate_kernel_ptr)(unsigned long indirection_page,
118 unsigned long control_page,
119 unsigned long start_address,
120 unsigned int has_pae,
121 unsigned int preserve_context);
111 122
112 tracer_disable(); 123 tracer_disable();
113 124
114 /* Interrupts aren't acceptable while we reboot */ 125 /* Interrupts aren't acceptable while we reboot */
115 local_irq_disable(); 126 local_irq_disable();
116 127
128 if (image->preserve_context) {
129#ifdef CONFIG_X86_IO_APIC
130 /* We need to put APICs in legacy mode so that we can
131 * get timer interrupts in second kernel. kexec/kdump
132 * paths already have calls to disable_IO_APIC() in
133 * one form or other. kexec jump path also need
134 * one.
135 */
136 disable_IO_APIC();
137#endif
138 }
139
117 control_page = page_address(image->control_code_page); 140 control_page = page_address(image->control_code_page);
118 memcpy(control_page, relocate_kernel, PAGE_SIZE); 141 memcpy(control_page, relocate_kernel, PAGE_SIZE/2);
119 142
143 relocate_kernel_ptr = control_page;
120 page_list[PA_CONTROL_PAGE] = __pa(control_page); 144 page_list[PA_CONTROL_PAGE] = __pa(control_page);
121 page_list[VA_CONTROL_PAGE] = (unsigned long)relocate_kernel; 145 page_list[VA_CONTROL_PAGE] = (unsigned long)control_page;
122 page_list[PA_PGD] = __pa(kexec_pgd); 146 page_list[PA_PGD] = __pa(kexec_pgd);
123 page_list[VA_PGD] = (unsigned long)kexec_pgd; 147 page_list[VA_PGD] = (unsigned long)kexec_pgd;
124#ifdef CONFIG_X86_PAE 148#ifdef CONFIG_X86_PAE
@@ -131,6 +155,7 @@ NORET_TYPE void machine_kexec(struct kimage *image)
131 page_list[VA_PTE_0] = (unsigned long)kexec_pte0; 155 page_list[VA_PTE_0] = (unsigned long)kexec_pte0;
132 page_list[PA_PTE_1] = __pa(kexec_pte1); 156 page_list[PA_PTE_1] = __pa(kexec_pte1);
133 page_list[VA_PTE_1] = (unsigned long)kexec_pte1; 157 page_list[VA_PTE_1] = (unsigned long)kexec_pte1;
158 page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) << PAGE_SHIFT);
134 159
135 /* The segment registers are funny things, they have both a 160 /* The segment registers are funny things, they have both a
136 * visible and an invisible part. Whenever the visible part is 161 * visible and an invisible part. Whenever the visible part is
@@ -149,8 +174,10 @@ NORET_TYPE void machine_kexec(struct kimage *image)
149 set_idt(phys_to_virt(0),0); 174 set_idt(phys_to_virt(0),0);
150 175
151 /* now call it */ 176 /* now call it */
152 relocate_kernel((unsigned long)image->head, (unsigned long)page_list, 177 image->start = relocate_kernel_ptr((unsigned long)image->head,
153 image->start, cpu_has_pae); 178 (unsigned long)page_list,
179 image->start, cpu_has_pae,
180 image->preserve_context);
154} 181}
155 182
156void arch_crash_save_vmcoreinfo(void) 183void arch_crash_save_vmcoreinfo(void)
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 9dd9262693a3..c43caa3a91f3 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -181,7 +181,7 @@ void machine_kexec_cleanup(struct kimage *image)
181 * Do not allocate memory (or fail in any way) in machine_kexec(). 181 * Do not allocate memory (or fail in any way) in machine_kexec().
182 * We are past the point of no return, committed to rebooting now. 182 * We are past the point of no return, committed to rebooting now.
183 */ 183 */
184NORET_TYPE void machine_kexec(struct kimage *image) 184void machine_kexec(struct kimage *image)
185{ 185{
186 unsigned long page_list[PAGES_NR]; 186 unsigned long page_list[PAGES_NR];
187 void *control_page; 187 void *control_page;
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index 19e7fc7c2c4f..b67a4b1d4eae 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -37,6 +37,7 @@
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/scatterlist.h> 38#include <linux/scatterlist.h>
39#include <linux/iommu-helper.h> 39#include <linux/iommu-helper.h>
40
40#include <asm/iommu.h> 41#include <asm/iommu.h>
41#include <asm/calgary.h> 42#include <asm/calgary.h>
42#include <asm/tce.h> 43#include <asm/tce.h>
@@ -413,22 +414,6 @@ static void calgary_unmap_sg(struct device *dev,
413 } 414 }
414} 415}
415 416
416static int calgary_nontranslate_map_sg(struct device* dev,
417 struct scatterlist *sg, int nelems, int direction)
418{
419 struct scatterlist *s;
420 int i;
421
422 for_each_sg(sg, s, nelems, i) {
423 struct page *p = sg_page(s);
424
425 BUG_ON(!p);
426 s->dma_address = virt_to_bus(sg_virt(s));
427 s->dma_length = s->length;
428 }
429 return nelems;
430}
431
432static int calgary_map_sg(struct device *dev, struct scatterlist *sg, 417static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
433 int nelems, int direction) 418 int nelems, int direction)
434{ 419{
@@ -439,9 +424,6 @@ static int calgary_map_sg(struct device *dev, struct scatterlist *sg,
439 unsigned long entry; 424 unsigned long entry;
440 int i; 425 int i;
441 426
442 if (!translation_enabled(tbl))
443 return calgary_nontranslate_map_sg(dev, sg, nelems, direction);
444
445 for_each_sg(sg, s, nelems, i) { 427 for_each_sg(sg, s, nelems, i) {
446 BUG_ON(!sg_page(s)); 428 BUG_ON(!sg_page(s));
447 429
@@ -477,7 +459,6 @@ error:
477static dma_addr_t calgary_map_single(struct device *dev, phys_addr_t paddr, 459static dma_addr_t calgary_map_single(struct device *dev, phys_addr_t paddr,
478 size_t size, int direction) 460 size_t size, int direction)
479{ 461{
480 dma_addr_t dma_handle = bad_dma_address;
481 void *vaddr = phys_to_virt(paddr); 462 void *vaddr = phys_to_virt(paddr);
482 unsigned long uaddr; 463 unsigned long uaddr;
483 unsigned int npages; 464 unsigned int npages;
@@ -486,12 +467,7 @@ static dma_addr_t calgary_map_single(struct device *dev, phys_addr_t paddr,
486 uaddr = (unsigned long)vaddr; 467 uaddr = (unsigned long)vaddr;
487 npages = num_dma_pages(uaddr, size); 468 npages = num_dma_pages(uaddr, size);
488 469
489 if (translation_enabled(tbl)) 470 return iommu_alloc(dev, tbl, vaddr, npages, direction);
490 dma_handle = iommu_alloc(dev, tbl, vaddr, npages, direction);
491 else
492 dma_handle = virt_to_bus(vaddr);
493
494 return dma_handle;
495} 471}
496 472
497static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle, 473static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
@@ -500,9 +476,6 @@ static void calgary_unmap_single(struct device *dev, dma_addr_t dma_handle,
500 struct iommu_table *tbl = find_iommu_table(dev); 476 struct iommu_table *tbl = find_iommu_table(dev);
501 unsigned int npages; 477 unsigned int npages;
502 478
503 if (!translation_enabled(tbl))
504 return;
505
506 npages = num_dma_pages(dma_handle, size); 479 npages = num_dma_pages(dma_handle, size);
507 iommu_free(tbl, dma_handle, npages); 480 iommu_free(tbl, dma_handle, npages);
508} 481}
@@ -525,18 +498,12 @@ static void* calgary_alloc_coherent(struct device *dev, size_t size,
525 goto error; 498 goto error;
526 memset(ret, 0, size); 499 memset(ret, 0, size);
527 500
528 if (translation_enabled(tbl)) { 501 /* set up tces to cover the allocated range */
529 /* set up tces to cover the allocated range */ 502 mapping = iommu_alloc(dev, tbl, ret, npages, DMA_BIDIRECTIONAL);
530 mapping = iommu_alloc(dev, tbl, ret, npages, DMA_BIDIRECTIONAL); 503 if (mapping == bad_dma_address)
531 if (mapping == bad_dma_address) 504 goto free;
532 goto free; 505 *dma_handle = mapping;
533
534 *dma_handle = mapping;
535 } else /* non translated slot */
536 *dma_handle = virt_to_bus(ret);
537
538 return ret; 506 return ret;
539
540free: 507free:
541 free_pages((unsigned long)ret, get_order(size)); 508 free_pages((unsigned long)ret, get_order(size));
542 ret = NULL; 509 ret = NULL;
@@ -544,7 +511,7 @@ error:
544 return ret; 511 return ret;
545} 512}
546 513
547static const struct dma_mapping_ops calgary_dma_ops = { 514static struct dma_mapping_ops calgary_dma_ops = {
548 .alloc_coherent = calgary_alloc_coherent, 515 .alloc_coherent = calgary_alloc_coherent,
549 .map_single = calgary_map_single, 516 .map_single = calgary_map_single,
550 .unmap_single = calgary_unmap_single, 517 .unmap_single = calgary_unmap_single,
@@ -1241,6 +1208,16 @@ static int __init calgary_init(void)
1241 goto error; 1208 goto error;
1242 } while (1); 1209 } while (1);
1243 1210
1211 dev = NULL;
1212 for_each_pci_dev(dev) {
1213 struct iommu_table *tbl;
1214
1215 tbl = find_iommu_table(&dev->dev);
1216
1217 if (translation_enabled(tbl))
1218 dev->dev.archdata.dma_ops = &calgary_dma_ops;
1219 }
1220
1244 return ret; 1221 return ret;
1245 1222
1246error: 1223error:
@@ -1262,6 +1239,7 @@ error:
1262 calgary_disable_translation(dev); 1239 calgary_disable_translation(dev);
1263 calgary_free_bus(dev); 1240 calgary_free_bus(dev);
1264 pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */ 1241 pci_dev_put(dev); /* Undo calgary_init_one()'s pci_dev_get() */
1242 dev->dev.archdata.dma_ops = NULL;
1265 } while (1); 1243 } while (1);
1266 1244
1267 return ret; 1245 return ret;
@@ -1503,6 +1481,10 @@ void __init detect_calgary(void)
1503 printk(KERN_INFO "PCI-DMA: Calgary TCE table spec is %d, " 1481 printk(KERN_INFO "PCI-DMA: Calgary TCE table spec is %d, "
1504 "CONFIG_IOMMU_DEBUG is %s.\n", specified_table_size, 1482 "CONFIG_IOMMU_DEBUG is %s.\n", specified_table_size,
1505 debugging ? "enabled" : "disabled"); 1483 debugging ? "enabled" : "disabled");
1484
1485 /* swiotlb for devices that aren't behind the Calgary. */
1486 if (max_pfn > MAX_DMA32_PFN)
1487 swiotlb = 1;
1506 } 1488 }
1507 return; 1489 return;
1508 1490
@@ -1519,7 +1501,7 @@ int __init calgary_iommu_init(void)
1519{ 1501{
1520 int ret; 1502 int ret;
1521 1503
1522 if (no_iommu || swiotlb) 1504 if (no_iommu || (swiotlb && !calgary_detected))
1523 return -ENODEV; 1505 return -ENODEV;
1524 1506
1525 if (!calgary_detected) 1507 if (!calgary_detected)
@@ -1532,15 +1514,14 @@ int __init calgary_iommu_init(void)
1532 if (ret) { 1514 if (ret) {
1533 printk(KERN_ERR "PCI-DMA: Calgary init failed %d, " 1515 printk(KERN_ERR "PCI-DMA: Calgary init failed %d, "
1534 "falling back to no_iommu\n", ret); 1516 "falling back to no_iommu\n", ret);
1535 if (max_pfn > MAX_DMA32_PFN)
1536 printk(KERN_ERR "WARNING more than 4GB of memory, "
1537 "32bit PCI may malfunction.\n");
1538 return ret; 1517 return ret;
1539 } 1518 }
1540 1519
1541 force_iommu = 1; 1520 force_iommu = 1;
1542 bad_dma_address = 0x0; 1521 bad_dma_address = 0x0;
1543 dma_ops = &calgary_dma_ops; 1522 /* dma_ops is set to swiotlb or nommu */
1523 if (!dma_ops)
1524 dma_ops = &nommu_dma_ops;
1544 1525
1545 return 0; 1526 return 0;
1546} 1527}
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index cbecb05551bb..37544123896d 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -11,7 +11,7 @@
11 11
12static int forbid_dac __read_mostly; 12static int forbid_dac __read_mostly;
13 13
14const struct dma_mapping_ops *dma_ops; 14struct dma_mapping_ops *dma_ops;
15EXPORT_SYMBOL(dma_ops); 15EXPORT_SYMBOL(dma_ops);
16 16
17static int iommu_sac_force __read_mostly; 17static int iommu_sac_force __read_mostly;
@@ -312,6 +312,8 @@ static int dma_release_coherent(struct device *dev, int order, void *vaddr)
312 312
313int dma_supported(struct device *dev, u64 mask) 313int dma_supported(struct device *dev, u64 mask)
314{ 314{
315 struct dma_mapping_ops *ops = get_dma_ops(dev);
316
315#ifdef CONFIG_PCI 317#ifdef CONFIG_PCI
316 if (mask > 0xffffffff && forbid_dac > 0) { 318 if (mask > 0xffffffff && forbid_dac > 0) {
317 dev_info(dev, "PCI: Disallowing DAC for device\n"); 319 dev_info(dev, "PCI: Disallowing DAC for device\n");
@@ -319,8 +321,8 @@ int dma_supported(struct device *dev, u64 mask)
319 } 321 }
320#endif 322#endif
321 323
322 if (dma_ops->dma_supported) 324 if (ops->dma_supported)
323 return dma_ops->dma_supported(dev, mask); 325 return ops->dma_supported(dev, mask);
324 326
325 /* Copied from i386. Doesn't make much sense, because it will 327 /* Copied from i386. Doesn't make much sense, because it will
326 only work for pci_alloc_coherent. 328 only work for pci_alloc_coherent.
@@ -367,6 +369,7 @@ void *
367dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 369dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
368 gfp_t gfp) 370 gfp_t gfp)
369{ 371{
372 struct dma_mapping_ops *ops = get_dma_ops(dev);
370 void *memory = NULL; 373 void *memory = NULL;
371 struct page *page; 374 struct page *page;
372 unsigned long dma_mask = 0; 375 unsigned long dma_mask = 0;
@@ -435,8 +438,8 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
435 /* Let low level make its own zone decisions */ 438 /* Let low level make its own zone decisions */
436 gfp &= ~(GFP_DMA32|GFP_DMA); 439 gfp &= ~(GFP_DMA32|GFP_DMA);
437 440
438 if (dma_ops->alloc_coherent) 441 if (ops->alloc_coherent)
439 return dma_ops->alloc_coherent(dev, size, 442 return ops->alloc_coherent(dev, size,
440 dma_handle, gfp); 443 dma_handle, gfp);
441 return NULL; 444 return NULL;
442 } 445 }
@@ -448,14 +451,14 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
448 } 451 }
449 } 452 }
450 453
451 if (dma_ops->alloc_coherent) { 454 if (ops->alloc_coherent) {
452 free_pages((unsigned long)memory, get_order(size)); 455 free_pages((unsigned long)memory, get_order(size));
453 gfp &= ~(GFP_DMA|GFP_DMA32); 456 gfp &= ~(GFP_DMA|GFP_DMA32);
454 return dma_ops->alloc_coherent(dev, size, dma_handle, gfp); 457 return ops->alloc_coherent(dev, size, dma_handle, gfp);
455 } 458 }
456 459
457 if (dma_ops->map_simple) { 460 if (ops->map_simple) {
458 *dma_handle = dma_ops->map_simple(dev, virt_to_phys(memory), 461 *dma_handle = ops->map_simple(dev, virt_to_phys(memory),
459 size, 462 size,
460 PCI_DMA_BIDIRECTIONAL); 463 PCI_DMA_BIDIRECTIONAL);
461 if (*dma_handle != bad_dma_address) 464 if (*dma_handle != bad_dma_address)
@@ -477,12 +480,14 @@ EXPORT_SYMBOL(dma_alloc_coherent);
477void dma_free_coherent(struct device *dev, size_t size, 480void dma_free_coherent(struct device *dev, size_t size,
478 void *vaddr, dma_addr_t bus) 481 void *vaddr, dma_addr_t bus)
479{ 482{
483 struct dma_mapping_ops *ops = get_dma_ops(dev);
484
480 int order = get_order(size); 485 int order = get_order(size);
481 WARN_ON(irqs_disabled()); /* for portability */ 486 WARN_ON(irqs_disabled()); /* for portability */
482 if (dma_release_coherent(dev, order, vaddr)) 487 if (dma_release_coherent(dev, order, vaddr))
483 return; 488 return;
484 if (dma_ops->unmap_single) 489 if (ops->unmap_single)
485 dma_ops->unmap_single(dev, bus, size, 0); 490 ops->unmap_single(dev, bus, size, 0);
486 free_pages((unsigned long)vaddr, order); 491 free_pages((unsigned long)vaddr, order);
487} 492}
488EXPORT_SYMBOL(dma_free_coherent); 493EXPORT_SYMBOL(dma_free_coherent);
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index df5f142657d2..744126e64950 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -692,8 +692,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
692 692
693extern int agp_amd64_init(void); 693extern int agp_amd64_init(void);
694 694
695static const struct dma_mapping_ops gart_dma_ops = { 695static struct dma_mapping_ops gart_dma_ops = {
696 .mapping_error = NULL,
697 .map_single = gart_map_single, 696 .map_single = gart_map_single,
698 .map_simple = gart_map_simple, 697 .map_simple = gart_map_simple,
699 .unmap_single = gart_unmap_single, 698 .unmap_single = gart_unmap_single,
diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c
index 792b9179eff3..3f91f71cdc3e 100644
--- a/arch/x86/kernel/pci-nommu.c
+++ b/arch/x86/kernel/pci-nommu.c
@@ -72,21 +72,9 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
72 return nents; 72 return nents;
73} 73}
74 74
75/* Make sure we keep the same behaviour */ 75struct dma_mapping_ops nommu_dma_ops = {
76static int nommu_mapping_error(dma_addr_t dma_addr)
77{
78#ifdef CONFIG_X86_32
79 return 0;
80#else
81 return (dma_addr == bad_dma_address);
82#endif
83}
84
85
86const struct dma_mapping_ops nommu_dma_ops = {
87 .map_single = nommu_map_single, 76 .map_single = nommu_map_single,
88 .map_sg = nommu_map_sg, 77 .map_sg = nommu_map_sg,
89 .mapping_error = nommu_mapping_error,
90 .is_phys = 1, 78 .is_phys = 1,
91}; 79};
92 80
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 20df839b9c20..c4ce0332759e 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -18,7 +18,7 @@ swiotlb_map_single_phys(struct device *hwdev, phys_addr_t paddr, size_t size,
18 return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction); 18 return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction);
19} 19}
20 20
21const struct dma_mapping_ops swiotlb_dma_ops = { 21struct dma_mapping_ops swiotlb_dma_ops = {
22 .mapping_error = swiotlb_dma_mapping_error, 22 .mapping_error = swiotlb_dma_mapping_error,
23 .alloc_coherent = swiotlb_alloc_coherent, 23 .alloc_coherent = swiotlb_alloc_coherent,
24 .free_coherent = swiotlb_free_coherent, 24 .free_coherent = swiotlb_free_coherent,
diff --git a/arch/x86/kernel/relocate_kernel_32.S b/arch/x86/kernel/relocate_kernel_32.S
index c30fe25d470d..703310a99023 100644
--- a/arch/x86/kernel/relocate_kernel_32.S
+++ b/arch/x86/kernel/relocate_kernel_32.S
@@ -20,11 +20,44 @@
20#define PAGE_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY) 20#define PAGE_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
21#define PAE_PGD_ATTR (_PAGE_PRESENT) 21#define PAE_PGD_ATTR (_PAGE_PRESENT)
22 22
23/* control_page + PAGE_SIZE/2 ~ control_page + PAGE_SIZE * 3/4 are
24 * used to save some data for jumping back
25 */
26#define DATA(offset) (PAGE_SIZE/2+(offset))
27
28/* Minimal CPU state */
29#define ESP DATA(0x0)
30#define CR0 DATA(0x4)
31#define CR3 DATA(0x8)
32#define CR4 DATA(0xc)
33
34/* other data */
35#define CP_VA_CONTROL_PAGE DATA(0x10)
36#define CP_PA_PGD DATA(0x14)
37#define CP_PA_SWAP_PAGE DATA(0x18)
38#define CP_PA_BACKUP_PAGES_MAP DATA(0x1c)
39
23 .text 40 .text
24 .align PAGE_SIZE 41 .align PAGE_SIZE
25 .globl relocate_kernel 42 .globl relocate_kernel
26relocate_kernel: 43relocate_kernel:
27 movl 8(%esp), %ebp /* list of pages */ 44 /* Save the CPU context, used for jumping back */
45
46 pushl %ebx
47 pushl %esi
48 pushl %edi
49 pushl %ebp
50 pushf
51
52 movl 20+8(%esp), %ebp /* list of pages */
53 movl PTR(VA_CONTROL_PAGE)(%ebp), %edi
54 movl %esp, ESP(%edi)
55 movl %cr0, %eax
56 movl %eax, CR0(%edi)
57 movl %cr3, %eax
58 movl %eax, CR3(%edi)
59 movl %cr4, %eax
60 movl %eax, CR4(%edi)
28 61
29#ifdef CONFIG_X86_PAE 62#ifdef CONFIG_X86_PAE
30 /* map the control page at its virtual address */ 63 /* map the control page at its virtual address */
@@ -138,15 +171,25 @@ relocate_kernel:
138 171
139relocate_new_kernel: 172relocate_new_kernel:
140 /* read the arguments and say goodbye to the stack */ 173 /* read the arguments and say goodbye to the stack */
141 movl 4(%esp), %ebx /* page_list */ 174 movl 20+4(%esp), %ebx /* page_list */
142 movl 8(%esp), %ebp /* list of pages */ 175 movl 20+8(%esp), %ebp /* list of pages */
143 movl 12(%esp), %edx /* start address */ 176 movl 20+12(%esp), %edx /* start address */
144 movl 16(%esp), %ecx /* cpu_has_pae */ 177 movl 20+16(%esp), %ecx /* cpu_has_pae */
178 movl 20+20(%esp), %esi /* preserve_context */
145 179
146 /* zero out flags, and disable interrupts */ 180 /* zero out flags, and disable interrupts */
147 pushl $0 181 pushl $0
148 popfl 182 popfl
149 183
184 /* save some information for jumping back */
185 movl PTR(VA_CONTROL_PAGE)(%ebp), %edi
186 movl %edi, CP_VA_CONTROL_PAGE(%edi)
187 movl PTR(PA_PGD)(%ebp), %eax
188 movl %eax, CP_PA_PGD(%edi)
189 movl PTR(PA_SWAP_PAGE)(%ebp), %eax
190 movl %eax, CP_PA_SWAP_PAGE(%edi)
191 movl %ebx, CP_PA_BACKUP_PAGES_MAP(%edi)
192
150 /* get physical address of control page now */ 193 /* get physical address of control page now */
151 /* this is impossible after page table switch */ 194 /* this is impossible after page table switch */
152 movl PTR(PA_CONTROL_PAGE)(%ebp), %edi 195 movl PTR(PA_CONTROL_PAGE)(%ebp), %edi
@@ -197,8 +240,90 @@ identity_mapped:
197 xorl %eax, %eax 240 xorl %eax, %eax
198 movl %eax, %cr3 241 movl %eax, %cr3
199 242
243 movl CP_PA_SWAP_PAGE(%edi), %eax
244 pushl %eax
245 pushl %ebx
246 call swap_pages
247 addl $8, %esp
248
249 /* To be certain of avoiding problems with self-modifying code
250 * I need to execute a serializing instruction here.
251 * So I flush the TLB, it's handy, and not processor dependent.
252 */
253 xorl %eax, %eax
254 movl %eax, %cr3
255
256 /* set all of the registers to known values */
257 /* leave %esp alone */
258
259 testl %esi, %esi
260 jnz 1f
261 xorl %edi, %edi
262 xorl %eax, %eax
263 xorl %ebx, %ebx
264 xorl %ecx, %ecx
265 xorl %edx, %edx
266 xorl %esi, %esi
267 xorl %ebp, %ebp
268 ret
2691:
270 popl %edx
271 movl CP_PA_SWAP_PAGE(%edi), %esp
272 addl $PAGE_SIZE, %esp
2732:
274 call *%edx
275
276 /* get the re-entry point of the peer system */
277 movl 0(%esp), %ebp
278 call 1f
2791:
280 popl %ebx
281 subl $(1b - relocate_kernel), %ebx
282 movl CP_VA_CONTROL_PAGE(%ebx), %edi
283 lea PAGE_SIZE(%ebx), %esp
284 movl CP_PA_SWAP_PAGE(%ebx), %eax
285 movl CP_PA_BACKUP_PAGES_MAP(%ebx), %edx
286 pushl %eax
287 pushl %edx
288 call swap_pages
289 addl $8, %esp
290 movl CP_PA_PGD(%ebx), %eax
291 movl %eax, %cr3
292 movl %cr0, %eax
293 orl $(1<<31), %eax
294 movl %eax, %cr0
295 lea PAGE_SIZE(%edi), %esp
296 movl %edi, %eax
297 addl $(virtual_mapped - relocate_kernel), %eax
298 pushl %eax
299 ret
300
301virtual_mapped:
302 movl CR4(%edi), %eax
303 movl %eax, %cr4
304 movl CR3(%edi), %eax
305 movl %eax, %cr3
306 movl CR0(%edi), %eax
307 movl %eax, %cr0
308 movl ESP(%edi), %esp
309 movl %ebp, %eax
310
311 popf
312 popl %ebp
313 popl %edi
314 popl %esi
315 popl %ebx
316 ret
317
200 /* Do the copies */ 318 /* Do the copies */
201 movl %ebx, %ecx 319swap_pages:
320 movl 8(%esp), %edx
321 movl 4(%esp), %ecx
322 pushl %ebp
323 pushl %ebx
324 pushl %edi
325 pushl %esi
326 movl %ecx, %ebx
202 jmp 1f 327 jmp 1f
203 328
2040: /* top, read another word from the indirection page */ 3290: /* top, read another word from the indirection page */
@@ -226,27 +351,28 @@ identity_mapped:
226 movl %ecx, %esi /* For every source page do a copy */ 351 movl %ecx, %esi /* For every source page do a copy */
227 andl $0xfffff000, %esi 352 andl $0xfffff000, %esi
228 353
354 movl %edi, %eax
355 movl %esi, %ebp
356
357 movl %edx, %edi
229 movl $1024, %ecx 358 movl $1024, %ecx
230 rep ; movsl 359 rep ; movsl
231 jmp 0b
232 360
2333: 361 movl %ebp, %edi
234 362 movl %eax, %esi
235 /* To be certain of avoiding problems with self-modifying code 363 movl $1024, %ecx
236 * I need to execute a serializing instruction here. 364 rep ; movsl
237 * So I flush the TLB, it's handy, and not processor dependent.
238 */
239 xorl %eax, %eax
240 movl %eax, %cr3
241 365
242 /* set all of the registers to known values */ 366 movl %eax, %edi
243 /* leave %esp alone */ 367 movl %edx, %esi
368 movl $1024, %ecx
369 rep ; movsl
244 370
245 xorl %eax, %eax 371 lea PAGE_SIZE(%ebp), %esi
246 xorl %ebx, %ebx 372 jmp 0b
247 xorl %ecx, %ecx 3733:
248 xorl %edx, %edx 374 popl %esi
249 xorl %esi, %esi 375 popl %edi
250 xorl %edi, %edi 376 popl %ebx
251 xorl %ebp, %ebp 377 popl %ebp
252 ret 378 ret
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index 1fbb844c3d7a..2977ea37791f 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -1,6 +1,7 @@
1obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \ 1obj-y := init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \
2 pat.o pgtable.o 2 pat.o pgtable.o
3 3
4obj-$(CONFIG_HAVE_GET_USER_PAGES_FAST) += gup.o
4obj-$(CONFIG_X86_32) += pgtable_32.o 5obj-$(CONFIG_X86_32) += pgtable_32.o
5 6
6obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 7obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
diff --git a/arch/x86/mm/gup.c b/arch/x86/mm/gup.c
new file mode 100644
index 000000000000..3085f25b4355
--- /dev/null
+++ b/arch/x86/mm/gup.c
@@ -0,0 +1,295 @@
1/*
2 * Lockless get_user_pages_fast for x86
3 *
4 * Copyright (C) 2008 Nick Piggin
5 * Copyright (C) 2008 Novell Inc.
6 */
7#include <linux/sched.h>
8#include <linux/mm.h>
9#include <linux/vmstat.h>
10#include <linux/highmem.h>
11
12#include <asm/pgtable.h>
13
14static inline pte_t gup_get_pte(pte_t *ptep)
15{
16#ifndef CONFIG_X86_PAE
17 return *ptep;
18#else
19 /*
20 * With get_user_pages_fast, we walk down the pagetables without taking
21 * any locks. For this we would like to load the pointers atoimcally,
22 * but that is not possible (without expensive cmpxchg8b) on PAE. What
23 * we do have is the guarantee that a pte will only either go from not
24 * present to present, or present to not present or both -- it will not
25 * switch to a completely different present page without a TLB flush in
26 * between; something that we are blocking by holding interrupts off.
27 *
28 * Setting ptes from not present to present goes:
29 * ptep->pte_high = h;
30 * smp_wmb();
31 * ptep->pte_low = l;
32 *
33 * And present to not present goes:
34 * ptep->pte_low = 0;
35 * smp_wmb();
36 * ptep->pte_high = 0;
37 *
38 * We must ensure here that the load of pte_low sees l iff pte_high
39 * sees h. We load pte_high *after* loading pte_low, which ensures we
40 * don't see an older value of pte_high. *Then* we recheck pte_low,
41 * which ensures that we haven't picked up a changed pte high. We might
42 * have got rubbish values from pte_low and pte_high, but we are
43 * guaranteed that pte_low will not have the present bit set *unless*
44 * it is 'l'. And get_user_pages_fast only operates on present ptes, so
45 * we're safe.
46 *
47 * gup_get_pte should not be used or copied outside gup.c without being
48 * very careful -- it does not atomically load the pte or anything that
49 * is likely to be useful for you.
50 */
51 pte_t pte;
52
53retry:
54 pte.pte_low = ptep->pte_low;
55 smp_rmb();
56 pte.pte_high = ptep->pte_high;
57 smp_rmb();
58 if (unlikely(pte.pte_low != ptep->pte_low))
59 goto retry;
60
61 return pte;
62#endif
63}
64
65/*
66 * The performance critical leaf functions are made noinline otherwise gcc
67 * inlines everything into a single function which results in too much
68 * register pressure.
69 */
70static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
71 unsigned long end, int write, struct page **pages, int *nr)
72{
73 unsigned long mask;
74 pte_t *ptep;
75
76 mask = _PAGE_PRESENT|_PAGE_USER;
77 if (write)
78 mask |= _PAGE_RW;
79
80 ptep = pte_offset_map(&pmd, addr);
81 do {
82 pte_t pte = gup_get_pte(ptep);
83 struct page *page;
84
85 if ((pte_val(pte) & (mask | _PAGE_SPECIAL)) != mask) {
86 pte_unmap(ptep);
87 return 0;
88 }
89 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
90 page = pte_page(pte);
91 get_page(page);
92 pages[*nr] = page;
93 (*nr)++;
94
95 } while (ptep++, addr += PAGE_SIZE, addr != end);
96 pte_unmap(ptep - 1);
97
98 return 1;
99}
100
101static inline void get_head_page_multiple(struct page *page, int nr)
102{
103 VM_BUG_ON(page != compound_head(page));
104 VM_BUG_ON(page_count(page) == 0);
105 atomic_add(nr, &page->_count);
106}
107
108static noinline int gup_huge_pmd(pmd_t pmd, unsigned long addr,
109 unsigned long end, int write, struct page **pages, int *nr)
110{
111 unsigned long mask;
112 pte_t pte = *(pte_t *)&pmd;
113 struct page *head, *page;
114 int refs;
115
116 mask = _PAGE_PRESENT|_PAGE_USER;
117 if (write)
118 mask |= _PAGE_RW;
119 if ((pte_val(pte) & mask) != mask)
120 return 0;
121 /* hugepages are never "special" */
122 VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL);
123 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
124
125 refs = 0;
126 head = pte_page(pte);
127 page = head + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
128 do {
129 VM_BUG_ON(compound_head(page) != head);
130 pages[*nr] = page;
131 (*nr)++;
132 page++;
133 refs++;
134 } while (addr += PAGE_SIZE, addr != end);
135 get_head_page_multiple(head, refs);
136
137 return 1;
138}
139
140static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
141 int write, struct page **pages, int *nr)
142{
143 unsigned long next;
144 pmd_t *pmdp;
145
146 pmdp = pmd_offset(&pud, addr);
147 do {
148 pmd_t pmd = *pmdp;
149
150 next = pmd_addr_end(addr, end);
151 if (pmd_none(pmd))
152 return 0;
153 if (unlikely(pmd_large(pmd))) {
154 if (!gup_huge_pmd(pmd, addr, next, write, pages, nr))
155 return 0;
156 } else {
157 if (!gup_pte_range(pmd, addr, next, write, pages, nr))
158 return 0;
159 }
160 } while (pmdp++, addr = next, addr != end);
161
162 return 1;
163}
164
165static noinline int gup_huge_pud(pud_t pud, unsigned long addr,
166 unsigned long end, int write, struct page **pages, int *nr)
167{
168 unsigned long mask;
169 pte_t pte = *(pte_t *)&pud;
170 struct page *head, *page;
171 int refs;
172
173 mask = _PAGE_PRESENT|_PAGE_USER;
174 if (write)
175 mask |= _PAGE_RW;
176 if ((pte_val(pte) & mask) != mask)
177 return 0;
178 /* hugepages are never "special" */
179 VM_BUG_ON(pte_val(pte) & _PAGE_SPECIAL);
180 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
181
182 refs = 0;
183 head = pte_page(pte);
184 page = head + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
185 do {
186 VM_BUG_ON(compound_head(page) != head);
187 pages[*nr] = page;
188 (*nr)++;
189 page++;
190 refs++;
191 } while (addr += PAGE_SIZE, addr != end);
192 get_head_page_multiple(head, refs);
193
194 return 1;
195}
196
197static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
198 int write, struct page **pages, int *nr)
199{
200 unsigned long next;
201 pud_t *pudp;
202
203 pudp = pud_offset(&pgd, addr);
204 do {
205 pud_t pud = *pudp;
206
207 next = pud_addr_end(addr, end);
208 if (pud_none(pud))
209 return 0;
210 if (unlikely(pud_large(pud))) {
211 if (!gup_huge_pud(pud, addr, next, write, pages, nr))
212 return 0;
213 } else {
214 if (!gup_pmd_range(pud, addr, next, write, pages, nr))
215 return 0;
216 }
217 } while (pudp++, addr = next, addr != end);
218
219 return 1;
220}
221
222int get_user_pages_fast(unsigned long start, int nr_pages, int write,
223 struct page **pages)
224{
225 struct mm_struct *mm = current->mm;
226 unsigned long end = start + (nr_pages << PAGE_SHIFT);
227 unsigned long addr = start;
228 unsigned long next;
229 pgd_t *pgdp;
230 int nr = 0;
231
232 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
233 start, nr_pages*PAGE_SIZE)))
234 goto slow_irqon;
235
236 /*
237 * XXX: batch / limit 'nr', to avoid large irq off latency
238 * needs some instrumenting to determine the common sizes used by
239 * important workloads (eg. DB2), and whether limiting the batch size
240 * will decrease performance.
241 *
242 * It seems like we're in the clear for the moment. Direct-IO is
243 * the main guy that batches up lots of get_user_pages, and even
244 * they are limited to 64-at-a-time which is not so many.
245 */
246 /*
247 * This doesn't prevent pagetable teardown, but does prevent
248 * the pagetables and pages from being freed on x86.
249 *
250 * So long as we atomically load page table pointers versus teardown
251 * (which we do on x86, with the above PAE exception), we can follow the
252 * address down to the the page and take a ref on it.
253 */
254 local_irq_disable();
255 pgdp = pgd_offset(mm, addr);
256 do {
257 pgd_t pgd = *pgdp;
258
259 next = pgd_addr_end(addr, end);
260 if (pgd_none(pgd))
261 goto slow;
262 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
263 goto slow;
264 } while (pgdp++, addr = next, addr != end);
265 local_irq_enable();
266
267 VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT);
268 return nr;
269
270 {
271 int ret;
272
273slow:
274 local_irq_enable();
275slow_irqon:
276 /* Try to get the remaining pages with get_user_pages */
277 start += nr << PAGE_SHIFT;
278 pages += nr;
279
280 down_read(&mm->mmap_sem);
281 ret = get_user_pages(current, mm, start,
282 (end - start) >> PAGE_SHIFT, write, 0, pages, NULL);
283 up_read(&mm->mmap_sem);
284
285 /* Have to be a bit careful with return values */
286 if (nr > 0) {
287 if (ret < 0)
288 ret = nr;
289 else
290 ret += nr;
291 }
292
293 return ret;
294 }
295}
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ec37121f6709..129618ca0ea2 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -86,43 +86,6 @@ early_param("gbpages", parse_direct_gbpages_on);
86 * around without checking the pgd every time. 86 * around without checking the pgd every time.
87 */ 87 */
88 88
89void show_mem(void)
90{
91 long i, total = 0, reserved = 0;
92 long shared = 0, cached = 0;
93 struct page *page;
94 pg_data_t *pgdat;
95
96 printk(KERN_INFO "Mem-info:\n");
97 show_free_areas();
98 for_each_online_pgdat(pgdat) {
99 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
100 /*
101 * This loop can take a while with 256 GB and
102 * 4k pages so defer the NMI watchdog:
103 */
104 if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
105 touch_nmi_watchdog();
106
107 if (!pfn_valid(pgdat->node_start_pfn + i))
108 continue;
109
110 page = pfn_to_page(pgdat->node_start_pfn + i);
111 total++;
112 if (PageReserved(page))
113 reserved++;
114 else if (PageSwapCache(page))
115 cached++;
116 else if (page_count(page))
117 shared += page_count(page) - 1;
118 }
119 }
120 printk(KERN_INFO "%lu pages of RAM\n", total);
121 printk(KERN_INFO "%lu reserved pages\n", reserved);
122 printk(KERN_INFO "%lu pages shared\n", shared);
123 printk(KERN_INFO "%lu pages swap cached\n", cached);
124}
125
126int after_bootmem; 89int after_bootmem;
127 90
128static __init void *spp_getpage(void) 91static __init void *spp_getpage(void)
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index b4becbf8c570..cab0abbd1ebe 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -20,53 +20,6 @@
20#include <asm/tlb.h> 20#include <asm/tlb.h>
21#include <asm/tlbflush.h> 21#include <asm/tlbflush.h>
22 22
23void show_mem(void)
24{
25 int total = 0, reserved = 0;
26 int shared = 0, cached = 0;
27 int highmem = 0;
28 struct page *page;
29 pg_data_t *pgdat;
30 unsigned long i;
31 unsigned long flags;
32
33 printk(KERN_INFO "Mem-info:\n");
34 show_free_areas();
35 for_each_online_pgdat(pgdat) {
36 pgdat_resize_lock(pgdat, &flags);
37 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
38 if (unlikely(i % MAX_ORDER_NR_PAGES == 0))
39 touch_nmi_watchdog();
40 page = pgdat_page_nr(pgdat, i);
41 total++;
42 if (PageHighMem(page))
43 highmem++;
44 if (PageReserved(page))
45 reserved++;
46 else if (PageSwapCache(page))
47 cached++;
48 else if (page_count(page))
49 shared += page_count(page) - 1;
50 }
51 pgdat_resize_unlock(pgdat, &flags);
52 }
53 printk(KERN_INFO "%d pages of RAM\n", total);
54 printk(KERN_INFO "%d pages of HIGHMEM\n", highmem);
55 printk(KERN_INFO "%d reserved pages\n", reserved);
56 printk(KERN_INFO "%d pages shared\n", shared);
57 printk(KERN_INFO "%d pages swap cached\n", cached);
58
59 printk(KERN_INFO "%lu pages dirty\n", global_page_state(NR_FILE_DIRTY));
60 printk(KERN_INFO "%lu pages writeback\n",
61 global_page_state(NR_WRITEBACK));
62 printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));
63 printk(KERN_INFO "%lu pages slab\n",
64 global_page_state(NR_SLAB_RECLAIMABLE) +
65 global_page_state(NR_SLAB_UNRECLAIMABLE));
66 printk(KERN_INFO "%lu pages pagetables\n",
67 global_page_state(NR_PAGETABLE));
68}
69
70/* 23/*
71 * Associate a virtual page frame with a given physical page frame 24 * Associate a virtual page frame with a given physical page frame
72 * and protection flags for that frame. 25 * and protection flags for that frame.
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index 81d0560eaea2..34163cfaaffc 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -280,36 +280,9 @@ void free_initmem(void)
280 (&__init_end - &__init_begin) >> 10); 280 (&__init_end - &__init_begin) >> 10);
281} 281}
282 282
283void show_mem(void)
284{
285 int i, free = 0, total = 0, reserved = 0;
286 int shared = 0, cached = 0;
287
288 printk("Mem-info:\n");
289 show_free_areas();
290 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
291 i = max_mapnr;
292 while (i-- > 0) {
293 total++;
294 if (PageReserved(mem_map+i))
295 reserved++;
296 else if (PageSwapCache(mem_map+i))
297 cached++;
298 else if (!page_count(mem_map + i))
299 free++;
300 else
301 shared += page_count(mem_map + i) - 1;
302 }
303 printk("%d pages of RAM\n", total);
304 printk("%d reserved pages\n", reserved);
305 printk("%d pages shared\n", shared);
306 printk("%d pages swap cached\n",cached);
307 printk("%d free pages\n", free);
308}
309
310struct kmem_cache *pgtable_cache __read_mostly; 283struct kmem_cache *pgtable_cache __read_mostly;
311 284
312static void pgd_ctor(struct kmem_cache *cache, void* addr) 285static void pgd_ctor(void* addr)
313{ 286{
314 pte_t* ptep = (pte_t*)addr; 287 pte_t* ptep = (pte_t*)addr;
315 int i; 288 int i;
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 9735acb5b4f5..cf4eb0eefbbf 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -837,8 +837,7 @@ static void as_completed_request(struct request_queue *q, struct request *rq)
837 WARN_ON(!list_empty(&rq->queuelist)); 837 WARN_ON(!list_empty(&rq->queuelist));
838 838
839 if (RQ_STATE(rq) != AS_RQ_REMOVED) { 839 if (RQ_STATE(rq) != AS_RQ_REMOVED) {
840 printk("rq->state %d\n", RQ_STATE(rq)); 840 WARN(1, "rq->state %d\n", RQ_STATE(rq));
841 WARN_ON(1);
842 goto out; 841 goto out;
843 } 842 }
844 843
diff --git a/block/blk-map.c b/block/blk-map.c
index ddd96fb11a7d..af37e4ae62f5 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -269,7 +269,6 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
269 int reading = rq_data_dir(rq) == READ; 269 int reading = rq_data_dir(rq) == READ;
270 int do_copy = 0; 270 int do_copy = 0;
271 struct bio *bio; 271 struct bio *bio;
272 unsigned long stack_mask = ~(THREAD_SIZE - 1);
273 272
274 if (len > (q->max_hw_sectors << 9)) 273 if (len > (q->max_hw_sectors << 9))
275 return -EINVAL; 274 return -EINVAL;
@@ -278,11 +277,8 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
278 277
279 kaddr = (unsigned long)kbuf; 278 kaddr = (unsigned long)kbuf;
280 alignment = queue_dma_alignment(q) | q->dma_pad_mask; 279 alignment = queue_dma_alignment(q) | q->dma_pad_mask;
281 do_copy = ((kaddr & alignment) || (len & alignment)); 280 do_copy = ((kaddr & alignment) || (len & alignment) ||
282 281 object_is_on_stack(kbuf));
283 if (!((kaddr & stack_mask) ^
284 ((unsigned long)current->stack & stack_mask)))
285 do_copy = 1;
286 282
287 if (do_copy) 283 if (do_copy)
288 bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading); 284 bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 7d5c63c81a59..068aa1c9538c 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -116,12 +116,10 @@ static void device_release(struct kobject *kobj)
116 dev->type->release(dev); 116 dev->type->release(dev);
117 else if (dev->class && dev->class->dev_release) 117 else if (dev->class && dev->class->dev_release)
118 dev->class->dev_release(dev); 118 dev->class->dev_release(dev);
119 else { 119 else
120 printk(KERN_ERR "Device '%s' does not have a release() " 120 WARN(1, KERN_ERR "Device '%s' does not have a release() "
121 "function, it is broken and must be fixed.\n", 121 "function, it is broken and must be fixed.\n",
122 dev->bus_id); 122 dev->bus_id);
123 WARN_ON(1);
124 }
125} 123}
126 124
127static struct kobj_type device_ktype = { 125static struct kobj_type device_ktype = {
diff --git a/drivers/base/isa.c b/drivers/base/isa.c
index d2222397a401..efd577574948 100644
--- a/drivers/base/isa.c
+++ b/drivers/base/isa.c
@@ -7,6 +7,7 @@
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/dma-mapping.h>
10#include <linux/isa.h> 11#include <linux/isa.h>
11 12
12static struct device isa_bus = { 13static struct device isa_bus = {
@@ -141,6 +142,9 @@ int isa_register_driver(struct isa_driver *isa_driver, unsigned int ndev)
141 isa_dev->dev.release = isa_dev_release; 142 isa_dev->dev.release = isa_dev_release;
142 isa_dev->id = id; 143 isa_dev->id = id;
143 144
145 isa_dev->dev.coherent_dma_mask = DMA_24BIT_MASK;
146 isa_dev->dev.dma_mask = &isa_dev->dev.coherent_dma_mask;
147
144 error = device_register(&isa_dev->dev); 148 error = device_register(&isa_dev->dev);
145 if (error) { 149 if (error) {
146 put_device(&isa_dev->dev); 150 put_device(&isa_dev->dev);
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 855ed1a9f97b..3ad49a00029f 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -204,9 +204,8 @@ memory_block_action(struct memory_block *mem, unsigned long action)
204 } 204 }
205 break; 205 break;
206 default: 206 default:
207 printk(KERN_WARNING "%s(%p, %ld) unknown action: %ld\n", 207 WARN(1, KERN_WARNING "%s(%p, %ld) unknown action: %ld\n",
208 __func__, mem, action, action); 208 __func__, mem, action, action);
209 WARN_ON(1);
210 ret = -EINVAL; 209 ret = -EINVAL;
211 } 210 }
212 211
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 40fc14f03540..75dd6e22faff 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -168,19 +168,16 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
168 int err = 0; 168 int err = 0;
169 169
170 if (!cls) { 170 if (!cls) {
171 printk(KERN_WARNING "sysdev: invalid class passed to " 171 WARN(1, KERN_WARNING "sysdev: invalid class passed to "
172 "sysdev_driver_register!\n"); 172 "sysdev_driver_register!\n");
173 WARN_ON(1);
174 return -EINVAL; 173 return -EINVAL;
175 } 174 }
176 175
177 /* Check whether this driver has already been added to a class. */ 176 /* Check whether this driver has already been added to a class. */
178 if (drv->entry.next && !list_empty(&drv->entry)) { 177 if (drv->entry.next && !list_empty(&drv->entry))
179 printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" 178 WARN(1, KERN_WARNING "sysdev: class %s: driver (%p) has already"
180 " been registered to a class, something is wrong, but " 179 " been registered to a class, something is wrong, but "
181 "will forge on!\n", cls->name, drv); 180 "will forge on!\n", cls->name, drv);
182 WARN_ON(1);
183 }
184 181
185 mutex_lock(&sysdev_drivers_lock); 182 mutex_lock(&sysdev_drivers_lock);
186 if (cls && kset_get(&cls->kset)) { 183 if (cls && kset_get(&cls->kset)) {
@@ -194,8 +191,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
194 } 191 }
195 } else { 192 } else {
196 err = -EINVAL; 193 err = -EINVAL;
197 printk(KERN_ERR "%s: invalid device class\n", __func__); 194 WARN(1, KERN_ERR "%s: invalid device class\n", __func__);
198 WARN_ON(1);
199 } 195 }
200 mutex_unlock(&sysdev_drivers_lock); 196 mutex_unlock(&sysdev_drivers_lock);
201 return err; 197 return err;
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index 19b88504e960..ca7c72a486b2 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -304,9 +304,9 @@ static ssize_t dsp56k_write(struct file *file, const char __user *buf, size_t co
304} 304}
305 305
306static long dsp56k_ioctl(struct file *file, unsigned int cmd, 306static long dsp56k_ioctl(struct file *file, unsigned int cmd,
307 unsigned long arg) 307 unsigned long arg)
308{ 308{
309 int dev = iminor(inode) & 0x0f; 309 int dev = iminor(file->f_path.dentry->d_inode) & 0x0f;
310 void __user *argp = (void __user *)arg; 310 void __user *argp = (void __user *)arg;
311 311
312 switch(dev) 312 switch(dev)
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index dbefbb30ed44..d9799e2bcfbf 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -144,6 +144,7 @@ static ssize_t rtc_read(struct file *file, char __user *buf,
144 size_t count, loff_t *ppos); 144 size_t count, loff_t *ppos);
145 145
146static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg); 146static long rtc_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
147static void rtc_get_rtc_time(struct rtc_time *rtc_tm);
147 148
148#ifdef RTC_IRQ 149#ifdef RTC_IRQ
149static unsigned int rtc_poll(struct file *file, poll_table *wait); 150static unsigned int rtc_poll(struct file *file, poll_table *wait);
@@ -235,7 +236,7 @@ static inline unsigned char rtc_is_updating(void)
235 * (See ./arch/XXXX/kernel/time.c for the set_rtc_mmss() function.) 236 * (See ./arch/XXXX/kernel/time.c for the set_rtc_mmss() function.)
236 */ 237 */
237 238
238irqreturn_t rtc_interrupt(int irq, void *dev_id) 239static irqreturn_t rtc_interrupt(int irq, void *dev_id)
239{ 240{
240 /* 241 /*
241 * Can be an alarm interrupt, update complete interrupt, 242 * Can be an alarm interrupt, update complete interrupt,
@@ -1303,7 +1304,7 @@ static int rtc_proc_open(struct inode *inode, struct file *file)
1303} 1304}
1304#endif 1305#endif
1305 1306
1306void rtc_get_rtc_time(struct rtc_time *rtc_tm) 1307static void rtc_get_rtc_time(struct rtc_time *rtc_tm)
1307{ 1308{
1308 unsigned long uip_watchdog = jiffies, flags; 1309 unsigned long uip_watchdog = jiffies, flags;
1309 unsigned char ctrl; 1310 unsigned char ctrl;
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index e1fc193d9396..ae766d868454 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -580,91 +580,133 @@ void tpm_continue_selftest(struct tpm_chip *chip)
580} 580}
581EXPORT_SYMBOL_GPL(tpm_continue_selftest); 581EXPORT_SYMBOL_GPL(tpm_continue_selftest);
582 582
583#define TPM_INTERNAL_RESULT_SIZE 200
584
583ssize_t tpm_show_enabled(struct device * dev, struct device_attribute * attr, 585ssize_t tpm_show_enabled(struct device * dev, struct device_attribute * attr,
584 char *buf) 586 char *buf)
585{ 587{
586 u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 35)]; 588 u8 *data;
587 ssize_t rc; 589 ssize_t rc;
588 590
589 struct tpm_chip *chip = dev_get_drvdata(dev); 591 struct tpm_chip *chip = dev_get_drvdata(dev);
590 if (chip == NULL) 592 if (chip == NULL)
591 return -ENODEV; 593 return -ENODEV;
592 594
595 data = kzalloc(TPM_INTERNAL_RESULT_SIZE, GFP_KERNEL);
596 if (!data)
597 return -ENOMEM;
598
593 memcpy(data, tpm_cap, sizeof(tpm_cap)); 599 memcpy(data, tpm_cap, sizeof(tpm_cap));
594 data[TPM_CAP_IDX] = TPM_CAP_FLAG; 600 data[TPM_CAP_IDX] = TPM_CAP_FLAG;
595 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM; 601 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM;
596 602
597 rc = transmit_cmd(chip, data, sizeof(data), 603 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
598 "attemtping to determine the permanent state"); 604 "attemtping to determine the permanent enabled state");
599 if (rc) 605 if (rc) {
606 kfree(data);
600 return 0; 607 return 0;
601 return sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_DISABLE_IDX]); 608 }
609
610 rc = sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_DISABLE_IDX]);
611
612 kfree(data);
613 return rc;
602} 614}
603EXPORT_SYMBOL_GPL(tpm_show_enabled); 615EXPORT_SYMBOL_GPL(tpm_show_enabled);
604 616
605ssize_t tpm_show_active(struct device * dev, struct device_attribute * attr, 617ssize_t tpm_show_active(struct device * dev, struct device_attribute * attr,
606 char *buf) 618 char *buf)
607{ 619{
608 u8 data[max_t(int, ARRAY_SIZE(tpm_cap), 35)]; 620 u8 *data;
609 ssize_t rc; 621 ssize_t rc;
610 622
611 struct tpm_chip *chip = dev_get_drvdata(dev); 623 struct tpm_chip *chip = dev_get_drvdata(dev);
612 if (chip == NULL) 624 if (chip == NULL)
613 return -ENODEV; 625 return -ENODEV;
614 626
627 data = kzalloc(TPM_INTERNAL_RESULT_SIZE, GFP_KERNEL);
628 if (!data)
629 return -ENOMEM;
630
615 memcpy(data, tpm_cap, sizeof(tpm_cap)); 631 memcpy(data, tpm_cap, sizeof(tpm_cap));
616 data[TPM_CAP_IDX] = TPM_CAP_FLAG; 632 data[TPM_CAP_IDX] = TPM_CAP_FLAG;
617 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM; 633 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM;
618 634
619 rc = transmit_cmd(chip, data, sizeof(data), 635 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
620 "attemtping to determine the permanent state"); 636 "attemtping to determine the permanent active state");
621 if (rc) 637 if (rc) {
638 kfree(data);
622 return 0; 639 return 0;
623 return sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_INACTIVE_IDX]); 640 }
641
642 rc = sprintf(buf, "%d\n", !data[TPM_GET_CAP_PERM_INACTIVE_IDX]);
643
644 kfree(data);
645 return rc;
624} 646}
625EXPORT_SYMBOL_GPL(tpm_show_active); 647EXPORT_SYMBOL_GPL(tpm_show_active);
626 648
627ssize_t tpm_show_owned(struct device * dev, struct device_attribute * attr, 649ssize_t tpm_show_owned(struct device * dev, struct device_attribute * attr,
628 char *buf) 650 char *buf)
629{ 651{
630 u8 data[sizeof(tpm_cap)]; 652 u8 *data;
631 ssize_t rc; 653 ssize_t rc;
632 654
633 struct tpm_chip *chip = dev_get_drvdata(dev); 655 struct tpm_chip *chip = dev_get_drvdata(dev);
634 if (chip == NULL) 656 if (chip == NULL)
635 return -ENODEV; 657 return -ENODEV;
636 658
659 data = kzalloc(TPM_INTERNAL_RESULT_SIZE, GFP_KERNEL);
660 if (!data)
661 return -ENOMEM;
662
637 memcpy(data, tpm_cap, sizeof(tpm_cap)); 663 memcpy(data, tpm_cap, sizeof(tpm_cap));
638 data[TPM_CAP_IDX] = TPM_CAP_PROP; 664 data[TPM_CAP_IDX] = TPM_CAP_PROP;
639 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_OWNER; 665 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_OWNER;
640 666
641 rc = transmit_cmd(chip, data, sizeof(data), 667 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
642 "attempting to determine the owner state"); 668 "attempting to determine the owner state");
643 if (rc) 669 if (rc) {
670 kfree(data);
644 return 0; 671 return 0;
645 return sprintf(buf, "%d\n", data[TPM_GET_CAP_RET_BOOL_1_IDX]); 672 }
673
674 rc = sprintf(buf, "%d\n", data[TPM_GET_CAP_RET_BOOL_1_IDX]);
675
676 kfree(data);
677 return rc;
646} 678}
647EXPORT_SYMBOL_GPL(tpm_show_owned); 679EXPORT_SYMBOL_GPL(tpm_show_owned);
648 680
649ssize_t tpm_show_temp_deactivated(struct device * dev, 681ssize_t tpm_show_temp_deactivated(struct device * dev,
650 struct device_attribute * attr, char *buf) 682 struct device_attribute * attr, char *buf)
651{ 683{
652 u8 data[sizeof(tpm_cap)]; 684 u8 *data;
653 ssize_t rc; 685 ssize_t rc;
654 686
655 struct tpm_chip *chip = dev_get_drvdata(dev); 687 struct tpm_chip *chip = dev_get_drvdata(dev);
656 if (chip == NULL) 688 if (chip == NULL)
657 return -ENODEV; 689 return -ENODEV;
658 690
691 data = kzalloc(TPM_INTERNAL_RESULT_SIZE, GFP_KERNEL);
692 if (!data)
693 return -ENOMEM;
694
659 memcpy(data, tpm_cap, sizeof(tpm_cap)); 695 memcpy(data, tpm_cap, sizeof(tpm_cap));
660 data[TPM_CAP_IDX] = TPM_CAP_FLAG; 696 data[TPM_CAP_IDX] = TPM_CAP_FLAG;
661 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_VOL; 697 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_VOL;
662 698
663 rc = transmit_cmd(chip, data, sizeof(data), 699 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
664 "attempting to determine the temporary state"); 700 "attempting to determine the temporary state");
665 if (rc) 701 if (rc) {
702 kfree(data);
666 return 0; 703 return 0;
667 return sprintf(buf, "%d\n", data[TPM_GET_CAP_TEMP_INACTIVE_IDX]); 704 }
705
706 rc = sprintf(buf, "%d\n", data[TPM_GET_CAP_TEMP_INACTIVE_IDX]);
707
708 kfree(data);
709 return rc;
668} 710}
669EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated); 711EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated);
670 712
@@ -678,7 +720,7 @@ static const u8 pcrread[] = {
678ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr, 720ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
679 char *buf) 721 char *buf)
680{ 722{
681 u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(pcrread)), 30)]; 723 u8 *data;
682 ssize_t rc; 724 ssize_t rc;
683 int i, j, num_pcrs; 725 int i, j, num_pcrs;
684 __be32 index; 726 __be32 index;
@@ -688,21 +730,27 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
688 if (chip == NULL) 730 if (chip == NULL)
689 return -ENODEV; 731 return -ENODEV;
690 732
733 data = kzalloc(TPM_INTERNAL_RESULT_SIZE, GFP_KERNEL);
734 if (!data)
735 return -ENOMEM;
736
691 memcpy(data, tpm_cap, sizeof(tpm_cap)); 737 memcpy(data, tpm_cap, sizeof(tpm_cap));
692 data[TPM_CAP_IDX] = TPM_CAP_PROP; 738 data[TPM_CAP_IDX] = TPM_CAP_PROP;
693 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_PCR; 739 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_PCR;
694 740
695 rc = transmit_cmd(chip, data, sizeof(data), 741 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
696 "attempting to determine the number of PCRS"); 742 "attempting to determine the number of PCRS");
697 if (rc) 743 if (rc) {
744 kfree(data);
698 return 0; 745 return 0;
746 }
699 747
700 num_pcrs = be32_to_cpu(*((__be32 *) (data + 14))); 748 num_pcrs = be32_to_cpu(*((__be32 *) (data + 14)));
701 for (i = 0; i < num_pcrs; i++) { 749 for (i = 0; i < num_pcrs; i++) {
702 memcpy(data, pcrread, sizeof(pcrread)); 750 memcpy(data, pcrread, sizeof(pcrread));
703 index = cpu_to_be32(i); 751 index = cpu_to_be32(i);
704 memcpy(data + 10, &index, 4); 752 memcpy(data + 10, &index, 4);
705 rc = transmit_cmd(chip, data, sizeof(data), 753 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
706 "attempting to read a PCR"); 754 "attempting to read a PCR");
707 if (rc) 755 if (rc)
708 goto out; 756 goto out;
@@ -712,6 +760,7 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
712 str += sprintf(str, "\n"); 760 str += sprintf(str, "\n");
713 } 761 }
714out: 762out:
763 kfree(data);
715 return str - buf; 764 return str - buf;
716} 765}
717EXPORT_SYMBOL_GPL(tpm_show_pcrs); 766EXPORT_SYMBOL_GPL(tpm_show_pcrs);
@@ -795,7 +844,7 @@ static const u8 cap_version[] = {
795ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr, 844ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr,
796 char *buf) 845 char *buf)
797{ 846{
798 u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(cap_version)), 30)]; 847 u8 *data;
799 ssize_t rc; 848 ssize_t rc;
800 char *str = buf; 849 char *str = buf;
801 850
@@ -803,21 +852,27 @@ ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr,
803 if (chip == NULL) 852 if (chip == NULL)
804 return -ENODEV; 853 return -ENODEV;
805 854
855 data = kzalloc(TPM_INTERNAL_RESULT_SIZE, GFP_KERNEL);
856 if (!data)
857 return -ENOMEM;
858
806 memcpy(data, tpm_cap, sizeof(tpm_cap)); 859 memcpy(data, tpm_cap, sizeof(tpm_cap));
807 data[TPM_CAP_IDX] = TPM_CAP_PROP; 860 data[TPM_CAP_IDX] = TPM_CAP_PROP;
808 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER; 861 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER;
809 862
810 rc = transmit_cmd(chip, data, sizeof(data), 863 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
811 "attempting to determine the manufacturer"); 864 "attempting to determine the manufacturer");
812 if (rc) 865 if (rc) {
866 kfree(data);
813 return 0; 867 return 0;
868 }
814 869
815 str += sprintf(str, "Manufacturer: 0x%x\n", 870 str += sprintf(str, "Manufacturer: 0x%x\n",
816 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)))); 871 be32_to_cpu(*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX))));
817 872
818 memcpy(data, cap_version, sizeof(cap_version)); 873 memcpy(data, cap_version, sizeof(cap_version));
819 data[CAP_VERSION_IDX] = CAP_VERSION_1_1; 874 data[CAP_VERSION_IDX] = CAP_VERSION_1_1;
820 rc = transmit_cmd(chip, data, sizeof(data), 875 rc = transmit_cmd(chip, data, TPM_INTERNAL_RESULT_SIZE,
821 "attempting to determine the 1.1 version"); 876 "attempting to determine the 1.1 version");
822 if (rc) 877 if (rc)
823 goto out; 878 goto out;
@@ -828,6 +883,7 @@ ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr,
828 (int) data[17]); 883 (int) data[17]);
829 884
830out: 885out:
886 kfree(data);
831 return str - buf; 887 return str - buf;
832} 888}
833EXPORT_SYMBOL_GPL(tpm_show_caps); 889EXPORT_SYMBOL_GPL(tpm_show_caps);
@@ -835,7 +891,7 @@ EXPORT_SYMBOL_GPL(tpm_show_caps);
835ssize_t tpm_show_caps_1_2(struct device * dev, 891ssize_t tpm_show_caps_1_2(struct device * dev,
836 struct device_attribute * attr, char *buf) 892 struct device_attribute * attr, char *buf)
837{ 893{
838 u8 data[max_t(int, max(ARRAY_SIZE(tpm_cap), ARRAY_SIZE(cap_version)), 30)]; 894 u8 *data;
839 ssize_t len; 895 ssize_t len;
840 char *str = buf; 896 char *str = buf;
841 897
@@ -843,15 +899,20 @@ ssize_t tpm_show_caps_1_2(struct device * dev,
843 if (chip == NULL) 899 if (chip == NULL)
844 return -ENODEV; 900 return -ENODEV;
845 901
902 data = kzalloc(TPM_INTERNAL_RESULT_SIZE, GFP_KERNEL);
903 if (!data)
904 return -ENOMEM;
905
846 memcpy(data, tpm_cap, sizeof(tpm_cap)); 906 memcpy(data, tpm_cap, sizeof(tpm_cap));
847 data[TPM_CAP_IDX] = TPM_CAP_PROP; 907 data[TPM_CAP_IDX] = TPM_CAP_PROP;
848 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER; 908 data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_MANUFACTURER;
849 909
850 if ((len = tpm_transmit(chip, data, sizeof(data))) <= 910 len = tpm_transmit(chip, data, TPM_INTERNAL_RESULT_SIZE);
851 TPM_ERROR_SIZE) { 911 if (len <= TPM_ERROR_SIZE) {
852 dev_dbg(chip->dev, "A TPM error (%d) occurred " 912 dev_dbg(chip->dev, "A TPM error (%d) occurred "
853 "attempting to determine the manufacturer\n", 913 "attempting to determine the manufacturer\n",
854 be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX)))); 914 be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX))));
915 kfree(data);
855 return 0; 916 return 0;
856 } 917 }
857 918
@@ -861,8 +922,8 @@ ssize_t tpm_show_caps_1_2(struct device * dev,
861 memcpy(data, cap_version, sizeof(cap_version)); 922 memcpy(data, cap_version, sizeof(cap_version));
862 data[CAP_VERSION_IDX] = CAP_VERSION_1_2; 923 data[CAP_VERSION_IDX] = CAP_VERSION_1_2;
863 924
864 if ((len = tpm_transmit(chip, data, sizeof(data))) <= 925 len = tpm_transmit(chip, data, TPM_INTERNAL_RESULT_SIZE);
865 TPM_ERROR_SIZE) { 926 if (len <= TPM_ERROR_SIZE) {
866 dev_err(chip->dev, "A TPM error (%d) occurred " 927 dev_err(chip->dev, "A TPM error (%d) occurred "
867 "attempting to determine the 1.2 version\n", 928 "attempting to determine the 1.2 version\n",
868 be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX)))); 929 be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX))));
@@ -874,6 +935,7 @@ ssize_t tpm_show_caps_1_2(struct device * dev,
874 (int) data[19]); 935 (int) data[19]);
875 936
876out: 937out:
938 kfree(data);
877 return str - buf; 939 return str - buf;
878} 940}
879EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); 941EXPORT_SYMBOL_GPL(tpm_show_caps_1_2);
@@ -966,7 +1028,7 @@ ssize_t tpm_write(struct file *file, const char __user *buf,
966 size_t size, loff_t *off) 1028 size_t size, loff_t *off)
967{ 1029{
968 struct tpm_chip *chip = file->private_data; 1030 struct tpm_chip *chip = file->private_data;
969 int in_size = size, out_size; 1031 size_t in_size = size, out_size;
970 1032
971 /* cannot perform a write until the read has cleared 1033 /* cannot perform a write until the read has cleared
972 either via tpm_read or a user_read_timer timeout */ 1034 either via tpm_read or a user_read_timer timeout */
@@ -1001,7 +1063,7 @@ ssize_t tpm_read(struct file *file, char __user *buf,
1001 size_t size, loff_t *off) 1063 size_t size, loff_t *off)
1002{ 1064{
1003 struct tpm_chip *chip = file->private_data; 1065 struct tpm_chip *chip = file->private_data;
1004 int ret_size; 1066 ssize_t ret_size;
1005 1067
1006 del_singleshot_timer_sync(&chip->user_read_timer); 1068 del_singleshot_timer_sync(&chip->user_read_timer);
1007 flush_scheduled_work(); 1069 flush_scheduled_work();
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
index 60a2d2630e36..68f052b42ed7 100644
--- a/drivers/char/tpm/tpm_bios.c
+++ b/drivers/char/tpm/tpm_bios.c
@@ -448,7 +448,7 @@ out_free:
448 goto out; 448 goto out;
449} 449}
450 450
451const struct file_operations tpm_ascii_bios_measurements_ops = { 451static const struct file_operations tpm_ascii_bios_measurements_ops = {
452 .open = tpm_ascii_bios_measurements_open, 452 .open = tpm_ascii_bios_measurements_open,
453 .read = seq_read, 453 .read = seq_read,
454 .llseek = seq_lseek, 454 .llseek = seq_lseek,
@@ -486,7 +486,7 @@ out_free:
486 goto out; 486 goto out;
487} 487}
488 488
489const struct file_operations tpm_binary_bios_measurements_ops = { 489static const struct file_operations tpm_binary_bios_measurements_ops = {
490 .open = tpm_binary_bios_measurements_open, 490 .open = tpm_binary_bios_measurements_open,
491 .read = seq_read, 491 .read = seq_read,
492 .llseek = seq_lseek, 492 .llseek = seq_lseek,
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index c7a977bc03e8..ed1879c0dd8d 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -622,6 +622,7 @@ static struct pnp_device_id tpm_pnp_tbl[] __devinitdata = {
622 {"ATM1200", 0}, /* Atmel */ 622 {"ATM1200", 0}, /* Atmel */
623 {"IFX0102", 0}, /* Infineon */ 623 {"IFX0102", 0}, /* Infineon */
624 {"BCM0101", 0}, /* Broadcom */ 624 {"BCM0101", 0}, /* Broadcom */
625 {"BCM0102", 0}, /* Broadcom */
625 {"NSC1200", 0}, /* National */ 626 {"NSC1200", 0}, /* National */
626 {"ICO0102", 0}, /* Intel */ 627 {"ICO0102", 0}, /* Intel */
627 /* Add new here */ 628 /* Add new here */
diff --git a/drivers/firewire/fw-iso.c b/drivers/firewire/fw-iso.c
index bcbe794a3ea5..e14c03dc0065 100644
--- a/drivers/firewire/fw-iso.c
+++ b/drivers/firewire/fw-iso.c
@@ -50,7 +50,7 @@ fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
50 50
51 address = dma_map_page(card->device, buffer->pages[i], 51 address = dma_map_page(card->device, buffer->pages[i],
52 0, PAGE_SIZE, direction); 52 0, PAGE_SIZE, direction);
53 if (dma_mapping_error(address)) { 53 if (dma_mapping_error(card->device, address)) {
54 __free_page(buffer->pages[i]); 54 __free_page(buffer->pages[i]);
55 goto out_pages; 55 goto out_pages;
56 } 56 }
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 333b12544dd1..566672e0bcff 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -953,7 +953,7 @@ at_context_queue_packet(struct context *ctx, struct fw_packet *packet)
953 payload_bus = 953 payload_bus =
954 dma_map_single(ohci->card.device, packet->payload, 954 dma_map_single(ohci->card.device, packet->payload,
955 packet->payload_length, DMA_TO_DEVICE); 955 packet->payload_length, DMA_TO_DEVICE);
956 if (dma_mapping_error(payload_bus)) { 956 if (dma_mapping_error(ohci->card.device, payload_bus)) {
957 packet->ack = RCODE_SEND_ERROR; 957 packet->ack = RCODE_SEND_ERROR;
958 return -1; 958 return -1;
959 } 959 }
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 53fc5a641e6d..aaff50ebba1d 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -543,7 +543,7 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
543 orb->response_bus = 543 orb->response_bus =
544 dma_map_single(device->card->device, &orb->response, 544 dma_map_single(device->card->device, &orb->response,
545 sizeof(orb->response), DMA_FROM_DEVICE); 545 sizeof(orb->response), DMA_FROM_DEVICE);
546 if (dma_mapping_error(orb->response_bus)) 546 if (dma_mapping_error(device->card->device, orb->response_bus))
547 goto fail_mapping_response; 547 goto fail_mapping_response;
548 548
549 orb->request.response.high = 0; 549 orb->request.response.high = 0;
@@ -577,7 +577,7 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
577 orb->base.request_bus = 577 orb->base.request_bus =
578 dma_map_single(device->card->device, &orb->request, 578 dma_map_single(device->card->device, &orb->request,
579 sizeof(orb->request), DMA_TO_DEVICE); 579 sizeof(orb->request), DMA_TO_DEVICE);
580 if (dma_mapping_error(orb->base.request_bus)) 580 if (dma_mapping_error(device->card->device, orb->base.request_bus))
581 goto fail_mapping_request; 581 goto fail_mapping_request;
582 582
583 sbp2_send_orb(&orb->base, lu, node_id, generation, 583 sbp2_send_orb(&orb->base, lu, node_id, generation,
@@ -1424,7 +1424,7 @@ sbp2_map_scatterlist(struct sbp2_command_orb *orb, struct fw_device *device,
1424 orb->page_table_bus = 1424 orb->page_table_bus =
1425 dma_map_single(device->card->device, orb->page_table, 1425 dma_map_single(device->card->device, orb->page_table,
1426 sizeof(orb->page_table), DMA_TO_DEVICE); 1426 sizeof(orb->page_table), DMA_TO_DEVICE);
1427 if (dma_mapping_error(orb->page_table_bus)) 1427 if (dma_mapping_error(device->card->device, orb->page_table_bus))
1428 goto fail_page_table; 1428 goto fail_page_table;
1429 1429
1430 /* 1430 /*
@@ -1509,7 +1509,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1509 orb->base.request_bus = 1509 orb->base.request_bus =
1510 dma_map_single(device->card->device, &orb->request, 1510 dma_map_single(device->card->device, &orb->request,
1511 sizeof(orb->request), DMA_TO_DEVICE); 1511 sizeof(orb->request), DMA_TO_DEVICE);
1512 if (dma_mapping_error(orb->base.request_bus)) 1512 if (dma_mapping_error(device->card->device, orb->base.request_bus))
1513 goto out; 1513 goto out;
1514 1514
1515 sbp2_send_orb(&orb->base, lu, lu->tgt->node_id, lu->generation, 1515 sbp2_send_orb(&orb->base, lu, lu->tgt->node_id, lu->generation,
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 564138714bb5..452c2d866ec5 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -318,7 +318,7 @@ static void drm_cleanup(struct drm_device * dev)
318 DRM_ERROR("Cannot unload module\n"); 318 DRM_ERROR("Cannot unload module\n");
319} 319}
320 320
321int drm_minors_cleanup(int id, void *ptr, void *data) 321static int drm_minors_cleanup(int id, void *ptr, void *data)
322{ 322{
323 struct drm_minor *minor = ptr; 323 struct drm_minor *minor = ptr;
324 struct drm_device *dev; 324 struct drm_device *dev;
diff --git a/drivers/infiniband/hw/ipath/ipath_sdma.c b/drivers/infiniband/hw/ipath/ipath_sdma.c
index eaba03273e4f..284c9bca517e 100644
--- a/drivers/infiniband/hw/ipath/ipath_sdma.c
+++ b/drivers/infiniband/hw/ipath/ipath_sdma.c
@@ -698,7 +698,7 @@ retry:
698 698
699 addr = dma_map_single(&dd->pcidev->dev, tx->txreq.map_addr, 699 addr = dma_map_single(&dd->pcidev->dev, tx->txreq.map_addr,
700 tx->map_len, DMA_TO_DEVICE); 700 tx->map_len, DMA_TO_DEVICE);
701 if (dma_mapping_error(addr)) { 701 if (dma_mapping_error(&dd->pcidev->dev, addr)) {
702 ret = -EIO; 702 ret = -EIO;
703 goto unlock; 703 goto unlock;
704 } 704 }
diff --git a/drivers/infiniband/hw/ipath/ipath_user_sdma.c b/drivers/infiniband/hw/ipath/ipath_user_sdma.c
index 86e016916cd1..82d9a0b5ca2f 100644
--- a/drivers/infiniband/hw/ipath/ipath_user_sdma.c
+++ b/drivers/infiniband/hw/ipath/ipath_user_sdma.c
@@ -206,7 +206,7 @@ static int ipath_user_sdma_coalesce(const struct ipath_devdata *dd,
206 206
207 dma_addr = dma_map_page(&dd->pcidev->dev, page, 0, len, 207 dma_addr = dma_map_page(&dd->pcidev->dev, page, 0, len,
208 DMA_TO_DEVICE); 208 DMA_TO_DEVICE);
209 if (dma_mapping_error(dma_addr)) { 209 if (dma_mapping_error(&dd->pcidev->dev, dma_addr)) {
210 ret = -ENOMEM; 210 ret = -ENOMEM;
211 goto free_unmap; 211 goto free_unmap;
212 } 212 }
@@ -301,7 +301,7 @@ static int ipath_user_sdma_pin_pages(const struct ipath_devdata *dd,
301 pages[j], 0, flen, DMA_TO_DEVICE); 301 pages[j], 0, flen, DMA_TO_DEVICE);
302 unsigned long fofs = addr & ~PAGE_MASK; 302 unsigned long fofs = addr & ~PAGE_MASK;
303 303
304 if (dma_mapping_error(dma_addr)) { 304 if (dma_mapping_error(&dd->pcidev->dev, dma_addr)) {
305 ret = -ENOMEM; 305 ret = -ENOMEM;
306 goto done; 306 goto done;
307 } 307 }
@@ -508,7 +508,7 @@ static int ipath_user_sdma_queue_pkts(const struct ipath_devdata *dd,
508 if (page) { 508 if (page) {
509 dma_addr = dma_map_page(&dd->pcidev->dev, 509 dma_addr = dma_map_page(&dd->pcidev->dev,
510 page, 0, len, DMA_TO_DEVICE); 510 page, 0, len, DMA_TO_DEVICE);
511 if (dma_mapping_error(dma_addr)) { 511 if (dma_mapping_error(&dd->pcidev->dev, dma_addr)) {
512 ret = -ENOMEM; 512 ret = -ENOMEM;
513 goto free_pbc; 513 goto free_pbc;
514 } 514 }
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index 4e36aa7cb3d2..cc6858f0b65b 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -780,7 +780,7 @@ int mthca_map_eq_icm(struct mthca_dev *dev, u64 icm_virt)
780 return -ENOMEM; 780 return -ENOMEM;
781 dev->eq_table.icm_dma = pci_map_page(dev->pdev, dev->eq_table.icm_page, 0, 781 dev->eq_table.icm_dma = pci_map_page(dev->pdev, dev->eq_table.icm_page, 0,
782 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); 782 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
783 if (pci_dma_mapping_error(dev->eq_table.icm_dma)) { 783 if (pci_dma_mapping_error(dev->pdev, dev->eq_table.icm_dma)) {
784 __free_page(dev->eq_table.icm_page); 784 __free_page(dev->eq_table.icm_page);
785 return -ENOMEM; 785 return -ENOMEM;
786 } 786 }
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index c0b4db2f8364..1925118122f8 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -974,8 +974,6 @@ static struct pnp_driver fcpnp_driver = {
974 .remove = __devexit_p(fcpnp_remove), 974 .remove = __devexit_p(fcpnp_remove),
975 .id_table = fcpnp_ids, 975 .id_table = fcpnp_ids,
976}; 976};
977#else
978static struct pnp_driver fcpnp_driver;
979#endif 977#endif
980 978
981static void __devexit fcpci_remove(struct pci_dev *pdev) 979static void __devexit fcpci_remove(struct pci_dev *pdev)
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c
index 1360403b88b6..a9653c63f4db 100644
--- a/drivers/media/dvb/pluto2/pluto2.c
+++ b/drivers/media/dvb/pluto2/pluto2.c
@@ -242,7 +242,7 @@ static int __devinit pluto_dma_map(struct pluto *pluto)
242 pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf, 242 pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf,
243 TS_DMA_BYTES, PCI_DMA_FROMDEVICE); 243 TS_DMA_BYTES, PCI_DMA_FROMDEVICE);
244 244
245 return pci_dma_mapping_error(pluto->dma_addr); 245 return pci_dma_mapping_error(pluto->pdev, pluto->dma_addr);
246} 246}
247 247
248static void pluto_dma_unmap(struct pluto *pluto) 248static void pluto_dma_unmap(struct pluto *pluto)
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index 61b98c333cb0..a38005008a20 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -249,8 +249,11 @@ EXPORT_SYMBOL(memstick_next_req);
249 */ 249 */
250void memstick_new_req(struct memstick_host *host) 250void memstick_new_req(struct memstick_host *host)
251{ 251{
252 host->retries = cmd_retries; 252 if (host->card) {
253 host->request(host); 253 host->retries = cmd_retries;
254 INIT_COMPLETION(host->card->mrq_complete);
255 host->request(host);
256 }
254} 257}
255EXPORT_SYMBOL(memstick_new_req); 258EXPORT_SYMBOL(memstick_new_req);
256 259
@@ -415,10 +418,14 @@ err_out:
415 return NULL; 418 return NULL;
416} 419}
417 420
418static void memstick_power_on(struct memstick_host *host) 421static int memstick_power_on(struct memstick_host *host)
419{ 422{
420 host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON); 423 int rc = host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_ON);
421 host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL); 424
425 if (!rc)
426 rc = host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_SERIAL);
427
428 return rc;
422} 429}
423 430
424static void memstick_check(struct work_struct *work) 431static void memstick_check(struct work_struct *work)
@@ -429,8 +436,11 @@ static void memstick_check(struct work_struct *work)
429 436
430 dev_dbg(&host->dev, "memstick_check started\n"); 437 dev_dbg(&host->dev, "memstick_check started\n");
431 mutex_lock(&host->lock); 438 mutex_lock(&host->lock);
432 if (!host->card) 439 if (!host->card) {
433 memstick_power_on(host); 440 if (memstick_power_on(host))
441 goto out_power_off;
442 } else
443 host->card->stop(host->card);
434 444
435 card = memstick_alloc_card(host); 445 card = memstick_alloc_card(host);
436 446
@@ -448,7 +458,8 @@ static void memstick_check(struct work_struct *work)
448 || !(host->card->check(host->card))) { 458 || !(host->card->check(host->card))) {
449 device_unregister(&host->card->dev); 459 device_unregister(&host->card->dev);
450 host->card = NULL; 460 host->card = NULL;
451 } 461 } else
462 host->card->start(host->card);
452 } 463 }
453 464
454 if (!host->card) { 465 if (!host->card) {
@@ -461,6 +472,7 @@ static void memstick_check(struct work_struct *work)
461 kfree(card); 472 kfree(card);
462 } 473 }
463 474
475out_power_off:
464 if (!host->card) 476 if (!host->card)
465 host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF); 477 host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
466 478
@@ -573,11 +585,15 @@ EXPORT_SYMBOL(memstick_suspend_host);
573 */ 585 */
574void memstick_resume_host(struct memstick_host *host) 586void memstick_resume_host(struct memstick_host *host)
575{ 587{
588 int rc = 0;
589
576 mutex_lock(&host->lock); 590 mutex_lock(&host->lock);
577 if (host->card) 591 if (host->card)
578 memstick_power_on(host); 592 rc = memstick_power_on(host);
579 mutex_unlock(&host->lock); 593 mutex_unlock(&host->lock);
580 memstick_detect_change(host); 594
595 if (!rc)
596 memstick_detect_change(host);
581} 597}
582EXPORT_SYMBOL(memstick_resume_host); 598EXPORT_SYMBOL(memstick_resume_host);
583 599
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 477d0fb6e588..44b1817f2f2f 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -136,9 +136,8 @@ struct mspro_block_data {
136 unsigned int caps; 136 unsigned int caps;
137 struct gendisk *disk; 137 struct gendisk *disk;
138 struct request_queue *queue; 138 struct request_queue *queue;
139 struct request *block_req;
139 spinlock_t q_lock; 140 spinlock_t q_lock;
140 wait_queue_head_t q_wait;
141 struct task_struct *q_thread;
142 141
143 unsigned short page_size; 142 unsigned short page_size;
144 unsigned short cylinders; 143 unsigned short cylinders;
@@ -147,9 +146,10 @@ struct mspro_block_data {
147 146
148 unsigned char system; 147 unsigned char system;
149 unsigned char read_only:1, 148 unsigned char read_only:1,
150 active:1, 149 eject:1,
151 has_request:1, 150 has_request:1,
152 data_dir:1; 151 data_dir:1,
152 active:1;
153 unsigned char transfer_cmd; 153 unsigned char transfer_cmd;
154 154
155 int (*mrq_handler)(struct memstick_dev *card, 155 int (*mrq_handler)(struct memstick_dev *card,
@@ -160,12 +160,14 @@ struct mspro_block_data {
160 struct scatterlist req_sg[MSPRO_BLOCK_MAX_SEGS]; 160 struct scatterlist req_sg[MSPRO_BLOCK_MAX_SEGS];
161 unsigned int seg_count; 161 unsigned int seg_count;
162 unsigned int current_seg; 162 unsigned int current_seg;
163 unsigned short current_page; 163 unsigned int current_page;
164}; 164};
165 165
166static DEFINE_IDR(mspro_block_disk_idr); 166static DEFINE_IDR(mspro_block_disk_idr);
167static DEFINE_MUTEX(mspro_block_disk_lock); 167static DEFINE_MUTEX(mspro_block_disk_lock);
168 168
169static int mspro_block_complete_req(struct memstick_dev *card, int error);
170
169/*** Block device ***/ 171/*** Block device ***/
170 172
171static int mspro_block_bd_open(struct inode *inode, struct file *filp) 173static int mspro_block_bd_open(struct inode *inode, struct file *filp)
@@ -197,8 +199,10 @@ static int mspro_block_disk_release(struct gendisk *disk)
197 199
198 mutex_lock(&mspro_block_disk_lock); 200 mutex_lock(&mspro_block_disk_lock);
199 201
200 if (msb->usage_count) { 202 if (msb) {
201 msb->usage_count--; 203 if (msb->usage_count)
204 msb->usage_count--;
205
202 if (!msb->usage_count) { 206 if (!msb->usage_count) {
203 kfree(msb); 207 kfree(msb);
204 disk->private_data = NULL; 208 disk->private_data = NULL;
@@ -523,11 +527,13 @@ static int h_mspro_block_req_init(struct memstick_dev *card,
523static int h_mspro_block_default(struct memstick_dev *card, 527static int h_mspro_block_default(struct memstick_dev *card,
524 struct memstick_request **mrq) 528 struct memstick_request **mrq)
525{ 529{
526 complete(&card->mrq_complete); 530 return mspro_block_complete_req(card, (*mrq)->error);
527 if (!(*mrq)->error) 531}
528 return -EAGAIN; 532
529 else 533static int h_mspro_block_default_bad(struct memstick_dev *card,
530 return (*mrq)->error; 534 struct memstick_request **mrq)
535{
536 return -ENXIO;
531} 537}
532 538
533static int h_mspro_block_get_ro(struct memstick_dev *card, 539static int h_mspro_block_get_ro(struct memstick_dev *card,
@@ -535,44 +541,30 @@ static int h_mspro_block_get_ro(struct memstick_dev *card,
535{ 541{
536 struct mspro_block_data *msb = memstick_get_drvdata(card); 542 struct mspro_block_data *msb = memstick_get_drvdata(card);
537 543
538 if ((*mrq)->error) { 544 if (!(*mrq)->error) {
539 complete(&card->mrq_complete); 545 if ((*mrq)->data[offsetof(struct ms_status_register, status0)]
540 return (*mrq)->error; 546 & MEMSTICK_STATUS0_WP)
547 msb->read_only = 1;
548 else
549 msb->read_only = 0;
541 } 550 }
542 551
543 if ((*mrq)->data[offsetof(struct ms_status_register, status0)] 552 return mspro_block_complete_req(card, (*mrq)->error);
544 & MEMSTICK_STATUS0_WP)
545 msb->read_only = 1;
546 else
547 msb->read_only = 0;
548
549 complete(&card->mrq_complete);
550 return -EAGAIN;
551} 553}
552 554
553static int h_mspro_block_wait_for_ced(struct memstick_dev *card, 555static int h_mspro_block_wait_for_ced(struct memstick_dev *card,
554 struct memstick_request **mrq) 556 struct memstick_request **mrq)
555{ 557{
556 if ((*mrq)->error) {
557 complete(&card->mrq_complete);
558 return (*mrq)->error;
559 }
560
561 dev_dbg(&card->dev, "wait for ced: value %x\n", (*mrq)->data[0]); 558 dev_dbg(&card->dev, "wait for ced: value %x\n", (*mrq)->data[0]);
562 559
563 if ((*mrq)->data[0] & (MEMSTICK_INT_CMDNAK | MEMSTICK_INT_ERR)) { 560 if (!(*mrq)->error) {
564 card->current_mrq.error = -EFAULT; 561 if ((*mrq)->data[0] & (MEMSTICK_INT_CMDNAK | MEMSTICK_INT_ERR))
565 complete(&card->mrq_complete); 562 (*mrq)->error = -EFAULT;
566 return card->current_mrq.error; 563 else if (!((*mrq)->data[0] & MEMSTICK_INT_CED))
564 return 0;
567 } 565 }
568 566
569 if (!((*mrq)->data[0] & MEMSTICK_INT_CED)) 567 return mspro_block_complete_req(card, (*mrq)->error);
570 return 0;
571 else {
572 card->current_mrq.error = 0;
573 complete(&card->mrq_complete);
574 return -EAGAIN;
575 }
576} 568}
577 569
578static int h_mspro_block_transfer_data(struct memstick_dev *card, 570static int h_mspro_block_transfer_data(struct memstick_dev *card,
@@ -583,10 +575,8 @@ static int h_mspro_block_transfer_data(struct memstick_dev *card,
583 struct scatterlist t_sg = { 0 }; 575 struct scatterlist t_sg = { 0 };
584 size_t t_offset; 576 size_t t_offset;
585 577
586 if ((*mrq)->error) { 578 if ((*mrq)->error)
587 complete(&card->mrq_complete); 579 return mspro_block_complete_req(card, (*mrq)->error);
588 return (*mrq)->error;
589 }
590 580
591 switch ((*mrq)->tpc) { 581 switch ((*mrq)->tpc) {
592 case MS_TPC_WRITE_REG: 582 case MS_TPC_WRITE_REG:
@@ -617,8 +607,8 @@ has_int_reg:
617 607
618 if (msb->current_seg == msb->seg_count) { 608 if (msb->current_seg == msb->seg_count) {
619 if (t_val & MEMSTICK_INT_CED) { 609 if (t_val & MEMSTICK_INT_CED) {
620 complete(&card->mrq_complete); 610 return mspro_block_complete_req(card,
621 return -EAGAIN; 611 0);
622 } else { 612 } else {
623 card->next_request 613 card->next_request
624 = h_mspro_block_wait_for_ced; 614 = h_mspro_block_wait_for_ced;
@@ -666,140 +656,184 @@ has_int_reg:
666 656
667/*** Data transfer ***/ 657/*** Data transfer ***/
668 658
669static void mspro_block_process_request(struct memstick_dev *card, 659static int mspro_block_issue_req(struct memstick_dev *card, int chunk)
670 struct request *req)
671{ 660{
672 struct mspro_block_data *msb = memstick_get_drvdata(card); 661 struct mspro_block_data *msb = memstick_get_drvdata(card);
673 struct mspro_param_register param;
674 int rc, chunk, cnt;
675 unsigned short page_count;
676 sector_t t_sec; 662 sector_t t_sec;
677 unsigned long flags; 663 unsigned int count;
664 struct mspro_param_register param;
678 665
679 do { 666try_again:
680 page_count = 0; 667 while (chunk) {
668 msb->current_page = 0;
681 msb->current_seg = 0; 669 msb->current_seg = 0;
682 msb->seg_count = blk_rq_map_sg(req->q, req, msb->req_sg); 670 msb->seg_count = blk_rq_map_sg(msb->block_req->q,
671 msb->block_req,
672 msb->req_sg);
683 673
684 if (msb->seg_count) { 674 if (!msb->seg_count) {
685 msb->current_page = 0; 675 chunk = __blk_end_request(msb->block_req, -ENOMEM,
686 for (rc = 0; rc < msb->seg_count; rc++) 676 blk_rq_cur_bytes(msb->block_req));
687 page_count += msb->req_sg[rc].length 677 continue;
688 / msb->page_size; 678 }
689
690 t_sec = req->sector;
691 sector_div(t_sec, msb->page_size >> 9);
692 param.system = msb->system;
693 param.data_count = cpu_to_be16(page_count);
694 param.data_address = cpu_to_be32((uint32_t)t_sec);
695 param.tpc_param = 0;
696
697 msb->data_dir = rq_data_dir(req);
698 msb->transfer_cmd = msb->data_dir == READ
699 ? MSPRO_CMD_READ_DATA
700 : MSPRO_CMD_WRITE_DATA;
701
702 dev_dbg(&card->dev, "data transfer: cmd %x, "
703 "lba %x, count %x\n", msb->transfer_cmd,
704 be32_to_cpu(param.data_address),
705 page_count);
706
707 card->next_request = h_mspro_block_req_init;
708 msb->mrq_handler = h_mspro_block_transfer_data;
709 memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG,
710 &param, sizeof(param));
711 memstick_new_req(card->host);
712 wait_for_completion(&card->mrq_complete);
713 rc = card->current_mrq.error;
714 679
715 if (rc || (card->current_mrq.tpc == MSPRO_CMD_STOP)) { 680 t_sec = msb->block_req->sector << 9;
716 for (cnt = 0; cnt < msb->current_seg; cnt++) 681 sector_div(t_sec, msb->page_size);
717 page_count += msb->req_sg[cnt].length
718 / msb->page_size;
719
720 if (msb->current_page)
721 page_count += msb->current_page - 1;
722
723 if (page_count && (msb->data_dir == READ))
724 rc = msb->page_size * page_count;
725 else
726 rc = -EIO;
727 } else
728 rc = msb->page_size * page_count;
729 } else
730 rc = -EFAULT;
731 682
732 spin_lock_irqsave(&msb->q_lock, flags); 683 count = msb->block_req->nr_sectors << 9;
733 if (rc >= 0) 684 count /= msb->page_size;
734 chunk = __blk_end_request(req, 0, rc);
735 else
736 chunk = __blk_end_request(req, rc, 0);
737 685
738 dev_dbg(&card->dev, "end chunk %d, %d\n", rc, chunk); 686 param.system = msb->system;
739 spin_unlock_irqrestore(&msb->q_lock, flags); 687 param.data_count = cpu_to_be16(count);
740 } while (chunk); 688 param.data_address = cpu_to_be32((uint32_t)t_sec);
689 param.tpc_param = 0;
690
691 msb->data_dir = rq_data_dir(msb->block_req);
692 msb->transfer_cmd = msb->data_dir == READ
693 ? MSPRO_CMD_READ_DATA
694 : MSPRO_CMD_WRITE_DATA;
695
696 dev_dbg(&card->dev, "data transfer: cmd %x, "
697 "lba %x, count %x\n", msb->transfer_cmd,
698 be32_to_cpu(param.data_address), count);
699
700 card->next_request = h_mspro_block_req_init;
701 msb->mrq_handler = h_mspro_block_transfer_data;
702 memstick_init_req(&card->current_mrq, MS_TPC_WRITE_REG,
703 &param, sizeof(param));
704 memstick_new_req(card->host);
705 return 0;
706 }
707
708 dev_dbg(&card->dev, "elv_next\n");
709 msb->block_req = elv_next_request(msb->queue);
710 if (!msb->block_req) {
711 dev_dbg(&card->dev, "issue end\n");
712 return -EAGAIN;
713 }
714
715 dev_dbg(&card->dev, "trying again\n");
716 chunk = 1;
717 goto try_again;
741} 718}
742 719
743static int mspro_block_has_request(struct mspro_block_data *msb) 720static int mspro_block_complete_req(struct memstick_dev *card, int error)
744{ 721{
745 int rc = 0; 722 struct mspro_block_data *msb = memstick_get_drvdata(card);
723 int chunk, cnt;
724 unsigned int t_len = 0;
746 unsigned long flags; 725 unsigned long flags;
747 726
748 spin_lock_irqsave(&msb->q_lock, flags); 727 spin_lock_irqsave(&msb->q_lock, flags);
749 if (kthread_should_stop() || msb->has_request) 728 dev_dbg(&card->dev, "complete %d, %d\n", msb->has_request ? 1 : 0,
750 rc = 1; 729 error);
730
731 if (msb->has_request) {
732 /* Nothing to do - not really an error */
733 if (error == -EAGAIN)
734 error = 0;
735
736 if (error || (card->current_mrq.tpc == MSPRO_CMD_STOP)) {
737 if (msb->data_dir == READ) {
738 for (cnt = 0; cnt < msb->current_seg; cnt++)
739 t_len += msb->req_sg[cnt].length
740 / msb->page_size;
741
742 if (msb->current_page)
743 t_len += msb->current_page - 1;
744
745 t_len *= msb->page_size;
746 }
747 } else
748 t_len = msb->block_req->nr_sectors << 9;
749
750 dev_dbg(&card->dev, "transferred %x (%d)\n", t_len, error);
751
752 if (error && !t_len)
753 t_len = blk_rq_cur_bytes(msb->block_req);
754
755 chunk = __blk_end_request(msb->block_req, error, t_len);
756
757 error = mspro_block_issue_req(card, chunk);
758
759 if (!error)
760 goto out;
761 else
762 msb->has_request = 0;
763 } else {
764 if (!error)
765 error = -EAGAIN;
766 }
767
768 card->next_request = h_mspro_block_default_bad;
769 complete_all(&card->mrq_complete);
770out:
751 spin_unlock_irqrestore(&msb->q_lock, flags); 771 spin_unlock_irqrestore(&msb->q_lock, flags);
752 return rc; 772 return error;
753} 773}
754 774
755static int mspro_block_queue_thread(void *data) 775static void mspro_block_stop(struct memstick_dev *card)
756{ 776{
757 struct memstick_dev *card = data;
758 struct memstick_host *host = card->host;
759 struct mspro_block_data *msb = memstick_get_drvdata(card); 777 struct mspro_block_data *msb = memstick_get_drvdata(card);
760 struct request *req; 778 int rc = 0;
761 unsigned long flags; 779 unsigned long flags;
762 780
763 while (1) { 781 while (1) {
764 wait_event(msb->q_wait, mspro_block_has_request(msb));
765 dev_dbg(&card->dev, "thread iter\n");
766
767 spin_lock_irqsave(&msb->q_lock, flags); 782 spin_lock_irqsave(&msb->q_lock, flags);
768 req = elv_next_request(msb->queue); 783 if (!msb->has_request) {
769 dev_dbg(&card->dev, "next req %p\n", req); 784 blk_stop_queue(msb->queue);
770 if (!req) { 785 rc = 1;
771 msb->has_request = 0; 786 }
772 if (kthread_should_stop()) {
773 spin_unlock_irqrestore(&msb->q_lock, flags);
774 break;
775 }
776 } else
777 msb->has_request = 1;
778 spin_unlock_irqrestore(&msb->q_lock, flags); 787 spin_unlock_irqrestore(&msb->q_lock, flags);
779 788
780 if (req) { 789 if (rc)
781 mutex_lock(&host->lock); 790 break;
782 mspro_block_process_request(card, req); 791
783 mutex_unlock(&host->lock); 792 wait_for_completion(&card->mrq_complete);
784 }
785 } 793 }
786 dev_dbg(&card->dev, "thread finished\n");
787 return 0;
788} 794}
789 795
790static void mspro_block_request(struct request_queue *q) 796static void mspro_block_start(struct memstick_dev *card)
797{
798 struct mspro_block_data *msb = memstick_get_drvdata(card);
799 unsigned long flags;
800
801 spin_lock_irqsave(&msb->q_lock, flags);
802 blk_start_queue(msb->queue);
803 spin_unlock_irqrestore(&msb->q_lock, flags);
804}
805
806static int mspro_block_prepare_req(struct request_queue *q, struct request *req)
807{
808 if (!blk_fs_request(req) && !blk_pc_request(req)) {
809 blk_dump_rq_flags(req, "MSPro unsupported request");
810 return BLKPREP_KILL;
811 }
812
813 req->cmd_flags |= REQ_DONTPREP;
814
815 return BLKPREP_OK;
816}
817
818static void mspro_block_submit_req(struct request_queue *q)
791{ 819{
792 struct memstick_dev *card = q->queuedata; 820 struct memstick_dev *card = q->queuedata;
793 struct mspro_block_data *msb = memstick_get_drvdata(card); 821 struct mspro_block_data *msb = memstick_get_drvdata(card);
794 struct request *req = NULL; 822 struct request *req = NULL;
795 823
796 if (msb->q_thread) { 824 if (msb->has_request)
797 msb->has_request = 1; 825 return;
798 wake_up_all(&msb->q_wait); 826
799 } else { 827 if (msb->eject) {
800 while ((req = elv_next_request(q)) != NULL) 828 while ((req = elv_next_request(q)) != NULL)
801 end_queued_request(req, -ENODEV); 829 end_queued_request(req, -ENODEV);
830
831 return;
802 } 832 }
833
834 msb->has_request = 1;
835 if (mspro_block_issue_req(card, 0))
836 msb->has_request = 0;
803} 837}
804 838
805/*** Initialization ***/ 839/*** Initialization ***/
@@ -1169,16 +1203,14 @@ static int mspro_block_init_disk(struct memstick_dev *card)
1169 goto out_release_id; 1203 goto out_release_id;
1170 } 1204 }
1171 1205
1172 spin_lock_init(&msb->q_lock); 1206 msb->queue = blk_init_queue(mspro_block_submit_req, &msb->q_lock);
1173 init_waitqueue_head(&msb->q_wait);
1174
1175 msb->queue = blk_init_queue(mspro_block_request, &msb->q_lock);
1176 if (!msb->queue) { 1207 if (!msb->queue) {
1177 rc = -ENOMEM; 1208 rc = -ENOMEM;
1178 goto out_put_disk; 1209 goto out_put_disk;
1179 } 1210 }
1180 1211
1181 msb->queue->queuedata = card; 1212 msb->queue->queuedata = card;
1213 blk_queue_prep_rq(msb->queue, mspro_block_prepare_req);
1182 1214
1183 blk_queue_bounce_limit(msb->queue, limit); 1215 blk_queue_bounce_limit(msb->queue, limit);
1184 blk_queue_max_sectors(msb->queue, MSPRO_BLOCK_MAX_PAGES); 1216 blk_queue_max_sectors(msb->queue, MSPRO_BLOCK_MAX_PAGES);
@@ -1204,14 +1236,8 @@ static int mspro_block_init_disk(struct memstick_dev *card)
1204 capacity *= msb->page_size >> 9; 1236 capacity *= msb->page_size >> 9;
1205 set_capacity(msb->disk, capacity); 1237 set_capacity(msb->disk, capacity);
1206 dev_dbg(&card->dev, "capacity set %ld\n", capacity); 1238 dev_dbg(&card->dev, "capacity set %ld\n", capacity);
1207 msb->q_thread = kthread_run(mspro_block_queue_thread, card,
1208 DRIVER_NAME"d");
1209 if (IS_ERR(msb->q_thread))
1210 goto out_put_disk;
1211 1239
1212 mutex_unlock(&host->lock);
1213 add_disk(msb->disk); 1240 add_disk(msb->disk);
1214 mutex_lock(&host->lock);
1215 msb->active = 1; 1241 msb->active = 1;
1216 return 0; 1242 return 0;
1217 1243
@@ -1259,6 +1285,7 @@ static int mspro_block_probe(struct memstick_dev *card)
1259 return -ENOMEM; 1285 return -ENOMEM;
1260 memstick_set_drvdata(card, msb); 1286 memstick_set_drvdata(card, msb);
1261 msb->card = card; 1287 msb->card = card;
1288 spin_lock_init(&msb->q_lock);
1262 1289
1263 rc = mspro_block_init_card(card); 1290 rc = mspro_block_init_card(card);
1264 1291
@@ -1272,6 +1299,8 @@ static int mspro_block_probe(struct memstick_dev *card)
1272 rc = mspro_block_init_disk(card); 1299 rc = mspro_block_init_disk(card);
1273 if (!rc) { 1300 if (!rc) {
1274 card->check = mspro_block_check_card; 1301 card->check = mspro_block_check_card;
1302 card->stop = mspro_block_stop;
1303 card->start = mspro_block_start;
1275 return 0; 1304 return 0;
1276 } 1305 }
1277 1306
@@ -1286,26 +1315,17 @@ out_free:
1286static void mspro_block_remove(struct memstick_dev *card) 1315static void mspro_block_remove(struct memstick_dev *card)
1287{ 1316{
1288 struct mspro_block_data *msb = memstick_get_drvdata(card); 1317 struct mspro_block_data *msb = memstick_get_drvdata(card);
1289 struct task_struct *q_thread = NULL;
1290 unsigned long flags; 1318 unsigned long flags;
1291 1319
1292 del_gendisk(msb->disk); 1320 del_gendisk(msb->disk);
1293 dev_dbg(&card->dev, "mspro block remove\n"); 1321 dev_dbg(&card->dev, "mspro block remove\n");
1294 spin_lock_irqsave(&msb->q_lock, flags); 1322 spin_lock_irqsave(&msb->q_lock, flags);
1295 q_thread = msb->q_thread; 1323 msb->eject = 1;
1296 msb->q_thread = NULL; 1324 blk_start_queue(msb->queue);
1297 msb->active = 0;
1298 spin_unlock_irqrestore(&msb->q_lock, flags); 1325 spin_unlock_irqrestore(&msb->q_lock, flags);
1299 1326
1300 if (q_thread) {
1301 mutex_unlock(&card->host->lock);
1302 kthread_stop(q_thread);
1303 mutex_lock(&card->host->lock);
1304 }
1305
1306 dev_dbg(&card->dev, "queue thread stopped\n");
1307
1308 blk_cleanup_queue(msb->queue); 1327 blk_cleanup_queue(msb->queue);
1328 msb->queue = NULL;
1309 1329
1310 sysfs_remove_group(&card->dev.kobj, &msb->attr_group); 1330 sysfs_remove_group(&card->dev.kobj, &msb->attr_group);
1311 1331
@@ -1322,19 +1342,13 @@ static void mspro_block_remove(struct memstick_dev *card)
1322static int mspro_block_suspend(struct memstick_dev *card, pm_message_t state) 1342static int mspro_block_suspend(struct memstick_dev *card, pm_message_t state)
1323{ 1343{
1324 struct mspro_block_data *msb = memstick_get_drvdata(card); 1344 struct mspro_block_data *msb = memstick_get_drvdata(card);
1325 struct task_struct *q_thread = NULL;
1326 unsigned long flags; 1345 unsigned long flags;
1327 1346
1328 spin_lock_irqsave(&msb->q_lock, flags); 1347 spin_lock_irqsave(&msb->q_lock, flags);
1329 q_thread = msb->q_thread;
1330 msb->q_thread = NULL;
1331 msb->active = 0;
1332 blk_stop_queue(msb->queue); 1348 blk_stop_queue(msb->queue);
1349 msb->active = 0;
1333 spin_unlock_irqrestore(&msb->q_lock, flags); 1350 spin_unlock_irqrestore(&msb->q_lock, flags);
1334 1351
1335 if (q_thread)
1336 kthread_stop(q_thread);
1337
1338 return 0; 1352 return 0;
1339} 1353}
1340 1354
@@ -1373,14 +1387,7 @@ static int mspro_block_resume(struct memstick_dev *card)
1373 if (memcmp(s_attr->data, r_attr->data, s_attr->size)) 1387 if (memcmp(s_attr->data, r_attr->data, s_attr->size))
1374 break; 1388 break;
1375 1389
1376 memstick_set_drvdata(card, msb); 1390 msb->active = 1;
1377 msb->q_thread = kthread_run(mspro_block_queue_thread,
1378 card, DRIVER_NAME"d");
1379 if (IS_ERR(msb->q_thread))
1380 msb->q_thread = NULL;
1381 else
1382 msb->active = 1;
1383
1384 break; 1391 break;
1385 } 1392 }
1386 } 1393 }
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
index 4e3bfbcdf155..3485c63d20b0 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -50,6 +50,7 @@ struct jmb38x_ms_host {
50 struct jmb38x_ms *chip; 50 struct jmb38x_ms *chip;
51 void __iomem *addr; 51 void __iomem *addr;
52 spinlock_t lock; 52 spinlock_t lock;
53 struct tasklet_struct notify;
53 int id; 54 int id;
54 char host_id[32]; 55 char host_id[32];
55 int irq; 56 int irq;
@@ -590,55 +591,97 @@ static void jmb38x_ms_abort(unsigned long data)
590 spin_unlock_irqrestore(&host->lock, flags); 591 spin_unlock_irqrestore(&host->lock, flags);
591} 592}
592 593
593static void jmb38x_ms_request(struct memstick_host *msh) 594static void jmb38x_ms_req_tasklet(unsigned long data)
594{ 595{
596 struct memstick_host *msh = (struct memstick_host *)data;
595 struct jmb38x_ms_host *host = memstick_priv(msh); 597 struct jmb38x_ms_host *host = memstick_priv(msh);
596 unsigned long flags; 598 unsigned long flags;
597 int rc; 599 int rc;
598 600
599 spin_lock_irqsave(&host->lock, flags); 601 spin_lock_irqsave(&host->lock, flags);
600 if (host->req) { 602 if (!host->req) {
601 spin_unlock_irqrestore(&host->lock, flags); 603 do {
602 BUG(); 604 rc = memstick_next_req(msh, &host->req);
603 return; 605 dev_dbg(&host->chip->pdev->dev, "tasklet req %d\n", rc);
606 } while (!rc && jmb38x_ms_issue_cmd(msh));
604 } 607 }
605
606 do {
607 rc = memstick_next_req(msh, &host->req);
608 } while (!rc && jmb38x_ms_issue_cmd(msh));
609 spin_unlock_irqrestore(&host->lock, flags); 608 spin_unlock_irqrestore(&host->lock, flags);
610} 609}
611 610
612static void jmb38x_ms_reset(struct jmb38x_ms_host *host) 611static void jmb38x_ms_dummy_submit(struct memstick_host *msh)
613{ 612{
614 unsigned int host_ctl = readl(host->addr + HOST_CONTROL); 613 return;
614}
615
616static void jmb38x_ms_submit_req(struct memstick_host *msh)
617{
618 struct jmb38x_ms_host *host = memstick_priv(msh);
619
620 tasklet_schedule(&host->notify);
621}
622
623static int jmb38x_ms_reset(struct jmb38x_ms_host *host)
624{
625 int cnt;
626
627 writel(HOST_CONTROL_RESET_REQ | HOST_CONTROL_CLOCK_EN
628 | readl(host->addr + HOST_CONTROL),
629 host->addr + HOST_CONTROL);
630 mmiowb();
631
632 for (cnt = 0; cnt < 20; ++cnt) {
633 if (!(HOST_CONTROL_RESET_REQ
634 & readl(host->addr + HOST_CONTROL)))
635 goto reset_next;
615 636
616 writel(HOST_CONTROL_RESET_REQ, host->addr + HOST_CONTROL); 637 ndelay(20);
638 }
639 dev_dbg(&host->chip->pdev->dev, "reset_req timeout\n");
640 return -EIO;
641
642reset_next:
643 writel(HOST_CONTROL_RESET | HOST_CONTROL_CLOCK_EN
644 | readl(host->addr + HOST_CONTROL),
645 host->addr + HOST_CONTROL);
646 mmiowb();
647
648 for (cnt = 0; cnt < 20; ++cnt) {
649 if (!(HOST_CONTROL_RESET
650 & readl(host->addr + HOST_CONTROL)))
651 goto reset_ok;
617 652
618 while (HOST_CONTROL_RESET_REQ
619 & (host_ctl = readl(host->addr + HOST_CONTROL))) {
620 ndelay(20); 653 ndelay(20);
621 dev_dbg(&host->chip->pdev->dev, "reset %08x\n", host_ctl);
622 } 654 }
655 dev_dbg(&host->chip->pdev->dev, "reset timeout\n");
656 return -EIO;
623 657
624 writel(HOST_CONTROL_RESET, host->addr + HOST_CONTROL); 658reset_ok:
625 mmiowb(); 659 mmiowb();
626 writel(INT_STATUS_ALL, host->addr + INT_SIGNAL_ENABLE); 660 writel(INT_STATUS_ALL, host->addr + INT_SIGNAL_ENABLE);
627 writel(INT_STATUS_ALL, host->addr + INT_STATUS_ENABLE); 661 writel(INT_STATUS_ALL, host->addr + INT_STATUS_ENABLE);
662 return 0;
628} 663}
629 664
630static void jmb38x_ms_set_param(struct memstick_host *msh, 665static int jmb38x_ms_set_param(struct memstick_host *msh,
631 enum memstick_param param, 666 enum memstick_param param,
632 int value) 667 int value)
633{ 668{
634 struct jmb38x_ms_host *host = memstick_priv(msh); 669 struct jmb38x_ms_host *host = memstick_priv(msh);
635 unsigned int host_ctl = readl(host->addr + HOST_CONTROL); 670 unsigned int host_ctl = readl(host->addr + HOST_CONTROL);
636 unsigned int clock_ctl = CLOCK_CONTROL_40MHZ, clock_delay = 0; 671 unsigned int clock_ctl = CLOCK_CONTROL_40MHZ, clock_delay = 0;
672 int rc = 0;
637 673
638 switch (param) { 674 switch (param) {
639 case MEMSTICK_POWER: 675 case MEMSTICK_POWER:
640 if (value == MEMSTICK_POWER_ON) { 676 if (value == MEMSTICK_POWER_ON) {
641 jmb38x_ms_reset(host); 677 rc = jmb38x_ms_reset(host);
678 if (rc)
679 return rc;
680
681 host_ctl = 7;
682 host_ctl |= HOST_CONTROL_POWER_EN
683 | HOST_CONTROL_CLOCK_EN;
684 writel(host_ctl, host->addr + HOST_CONTROL);
642 685
643 writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 686 writel(host->id ? PAD_PU_PD_ON_MS_SOCK1
644 : PAD_PU_PD_ON_MS_SOCK0, 687 : PAD_PU_PD_ON_MS_SOCK0,
@@ -647,11 +690,7 @@ static void jmb38x_ms_set_param(struct memstick_host *msh,
647 writel(PAD_OUTPUT_ENABLE_MS, 690 writel(PAD_OUTPUT_ENABLE_MS,
648 host->addr + PAD_OUTPUT_ENABLE); 691 host->addr + PAD_OUTPUT_ENABLE);
649 692
650 host_ctl = 7; 693 msleep(10);
651 host_ctl |= HOST_CONTROL_POWER_EN
652 | HOST_CONTROL_CLOCK_EN;
653 writel(host_ctl, host->addr + HOST_CONTROL);
654
655 dev_dbg(&host->chip->pdev->dev, "power on\n"); 694 dev_dbg(&host->chip->pdev->dev, "power on\n");
656 } else if (value == MEMSTICK_POWER_OFF) { 695 } else if (value == MEMSTICK_POWER_OFF) {
657 host_ctl &= ~(HOST_CONTROL_POWER_EN 696 host_ctl &= ~(HOST_CONTROL_POWER_EN
@@ -660,7 +699,8 @@ static void jmb38x_ms_set_param(struct memstick_host *msh,
660 writel(0, host->addr + PAD_OUTPUT_ENABLE); 699 writel(0, host->addr + PAD_OUTPUT_ENABLE);
661 writel(PAD_PU_PD_OFF, host->addr + PAD_PU_PD); 700 writel(PAD_PU_PD_OFF, host->addr + PAD_PU_PD);
662 dev_dbg(&host->chip->pdev->dev, "power off\n"); 701 dev_dbg(&host->chip->pdev->dev, "power off\n");
663 } 702 } else
703 return -EINVAL;
664 break; 704 break;
665 case MEMSTICK_INTERFACE: 705 case MEMSTICK_INTERFACE:
666 host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); 706 host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT);
@@ -686,12 +726,14 @@ static void jmb38x_ms_set_param(struct memstick_host *msh,
686 host_ctl &= ~HOST_CONTROL_REI; 726 host_ctl &= ~HOST_CONTROL_REI;
687 clock_ctl = CLOCK_CONTROL_60MHZ; 727 clock_ctl = CLOCK_CONTROL_60MHZ;
688 clock_delay = 0; 728 clock_delay = 0;
689 } 729 } else
730 return -EINVAL;
690 writel(host_ctl, host->addr + HOST_CONTROL); 731 writel(host_ctl, host->addr + HOST_CONTROL);
691 writel(clock_ctl, host->addr + CLOCK_CONTROL); 732 writel(clock_ctl, host->addr + CLOCK_CONTROL);
692 writel(clock_delay, host->addr + CLOCK_DELAY); 733 writel(clock_delay, host->addr + CLOCK_DELAY);
693 break; 734 break;
694 }; 735 };
736 return 0;
695} 737}
696 738
697#ifdef CONFIG_PM 739#ifdef CONFIG_PM
@@ -785,7 +827,9 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
785 host->id); 827 host->id);
786 host->irq = jm->pdev->irq; 828 host->irq = jm->pdev->irq;
787 host->timeout_jiffies = msecs_to_jiffies(1000); 829 host->timeout_jiffies = msecs_to_jiffies(1000);
788 msh->request = jmb38x_ms_request; 830
831 tasklet_init(&host->notify, jmb38x_ms_req_tasklet, (unsigned long)msh);
832 msh->request = jmb38x_ms_submit_req;
789 msh->set_param = jmb38x_ms_set_param; 833 msh->set_param = jmb38x_ms_set_param;
790 834
791 msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; 835 msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8;
@@ -897,6 +941,8 @@ static void jmb38x_ms_remove(struct pci_dev *dev)
897 941
898 host = memstick_priv(jm->hosts[cnt]); 942 host = memstick_priv(jm->hosts[cnt]);
899 943
944 jm->hosts[cnt]->request = jmb38x_ms_dummy_submit;
945 tasklet_kill(&host->notify);
900 writel(0, host->addr + INT_SIGNAL_ENABLE); 946 writel(0, host->addr + INT_SIGNAL_ENABLE);
901 writel(0, host->addr + INT_STATUS_ENABLE); 947 writel(0, host->addr + INT_STATUS_ENABLE);
902 mmiowb(); 948 mmiowb();
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c
index 8577de4ebb0e..d32d6ad8f3fc 100644
--- a/drivers/memstick/host/tifm_ms.c
+++ b/drivers/memstick/host/tifm_ms.c
@@ -71,6 +71,7 @@ struct tifm_ms {
71 struct tifm_dev *dev; 71 struct tifm_dev *dev;
72 struct timer_list timer; 72 struct timer_list timer;
73 struct memstick_request *req; 73 struct memstick_request *req;
74 struct tasklet_struct notify;
74 unsigned int mode_mask; 75 unsigned int mode_mask;
75 unsigned int block_pos; 76 unsigned int block_pos;
76 unsigned long timeout_jiffies; 77 unsigned long timeout_jiffies;
@@ -455,49 +456,51 @@ static void tifm_ms_card_event(struct tifm_dev *sock)
455 return; 456 return;
456} 457}
457 458
458static void tifm_ms_request(struct memstick_host *msh) 459static void tifm_ms_req_tasklet(unsigned long data)
459{ 460{
461 struct memstick_host *msh = (struct memstick_host *)data;
460 struct tifm_ms *host = memstick_priv(msh); 462 struct tifm_ms *host = memstick_priv(msh);
461 struct tifm_dev *sock = host->dev; 463 struct tifm_dev *sock = host->dev;
462 unsigned long flags; 464 unsigned long flags;
463 int rc; 465 int rc;
464 466
465 spin_lock_irqsave(&sock->lock, flags); 467 spin_lock_irqsave(&sock->lock, flags);
466 if (host->req) { 468 if (!host->req) {
467 printk(KERN_ERR "%s : unfinished request detected\n", 469 if (host->eject) {
468 sock->dev.bus_id); 470 do {
469 spin_unlock_irqrestore(&sock->lock, flags); 471 rc = memstick_next_req(msh, &host->req);
470 tifm_eject(host->dev); 472 if (!rc)
471 return; 473 host->req->error = -ETIME;
472 } 474 } while (!rc);
475 spin_unlock_irqrestore(&sock->lock, flags);
476 return;
477 }
473 478
474 if (host->eject) {
475 do { 479 do {
476 rc = memstick_next_req(msh, &host->req); 480 rc = memstick_next_req(msh, &host->req);
477 if (!rc) 481 } while (!rc && tifm_ms_issue_cmd(host));
478 host->req->error = -ETIME;
479 } while (!rc);
480 spin_unlock_irqrestore(&sock->lock, flags);
481 return;
482 } 482 }
483
484 do {
485 rc = memstick_next_req(msh, &host->req);
486 } while (!rc && tifm_ms_issue_cmd(host));
487
488 spin_unlock_irqrestore(&sock->lock, flags); 483 spin_unlock_irqrestore(&sock->lock, flags);
484}
485
486static void tifm_ms_dummy_submit(struct memstick_host *msh)
487{
489 return; 488 return;
490} 489}
491 490
492static void tifm_ms_set_param(struct memstick_host *msh, 491static void tifm_ms_submit_req(struct memstick_host *msh)
493 enum memstick_param param,
494 int value)
495{ 492{
496 struct tifm_ms *host = memstick_priv(msh); 493 struct tifm_ms *host = memstick_priv(msh);
497 struct tifm_dev *sock = host->dev;
498 unsigned long flags;
499 494
500 spin_lock_irqsave(&sock->lock, flags); 495 tasklet_schedule(&host->notify);
496}
497
498static int tifm_ms_set_param(struct memstick_host *msh,
499 enum memstick_param param,
500 int value)
501{
502 struct tifm_ms *host = memstick_priv(msh);
503 struct tifm_dev *sock = host->dev;
501 504
502 switch (param) { 505 switch (param) {
503 case MEMSTICK_POWER: 506 case MEMSTICK_POWER:
@@ -512,7 +515,8 @@ static void tifm_ms_set_param(struct memstick_host *msh,
512 writel(TIFM_MS_SYS_FCLR | TIFM_MS_SYS_INTCLR, 515 writel(TIFM_MS_SYS_FCLR | TIFM_MS_SYS_INTCLR,
513 sock->addr + SOCK_MS_SYSTEM); 516 sock->addr + SOCK_MS_SYSTEM);
514 writel(0xffffffff, sock->addr + SOCK_MS_STATUS); 517 writel(0xffffffff, sock->addr + SOCK_MS_STATUS);
515 } 518 } else
519 return -EINVAL;
516 break; 520 break;
517 case MEMSTICK_INTERFACE: 521 case MEMSTICK_INTERFACE:
518 if (value == MEMSTICK_SERIAL) { 522 if (value == MEMSTICK_SERIAL) {
@@ -525,11 +529,12 @@ static void tifm_ms_set_param(struct memstick_host *msh,
525 writel(TIFM_CTRL_FAST_CLK 529 writel(TIFM_CTRL_FAST_CLK
526 | readl(sock->addr + SOCK_CONTROL), 530 | readl(sock->addr + SOCK_CONTROL),
527 sock->addr + SOCK_CONTROL); 531 sock->addr + SOCK_CONTROL);
528 } 532 } else
533 return -EINVAL;
529 break; 534 break;
530 }; 535 };
531 536
532 spin_unlock_irqrestore(&sock->lock, flags); 537 return 0;
533} 538}
534 539
535static void tifm_ms_abort(unsigned long data) 540static void tifm_ms_abort(unsigned long data)
@@ -570,8 +575,9 @@ static int tifm_ms_probe(struct tifm_dev *sock)
570 host->timeout_jiffies = msecs_to_jiffies(1000); 575 host->timeout_jiffies = msecs_to_jiffies(1000);
571 576
572 setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host); 577 setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host);
578 tasklet_init(&host->notify, tifm_ms_req_tasklet, (unsigned long)msh);
573 579
574 msh->request = tifm_ms_request; 580 msh->request = tifm_ms_submit_req;
575 msh->set_param = tifm_ms_set_param; 581 msh->set_param = tifm_ms_set_param;
576 sock->card_event = tifm_ms_card_event; 582 sock->card_event = tifm_ms_card_event;
577 sock->data_event = tifm_ms_data_event; 583 sock->data_event = tifm_ms_data_event;
@@ -593,6 +599,8 @@ static void tifm_ms_remove(struct tifm_dev *sock)
593 int rc = 0; 599 int rc = 0;
594 unsigned long flags; 600 unsigned long flags;
595 601
602 msh->request = tifm_ms_dummy_submit;
603 tasklet_kill(&host->notify);
596 spin_lock_irqsave(&sock->lock, flags); 604 spin_lock_irqsave(&sock->lock, flags);
597 host->eject = 1; 605 host->eject = 1;
598 if (host->req) { 606 if (host->req) {
diff --git a/drivers/message/fusion/lsi/mpi_history.txt b/drivers/message/fusion/lsi/mpi_history.txt
index 241592ab13ad..3f15fcfe4a2e 100644
--- a/drivers/message/fusion/lsi/mpi_history.txt
+++ b/drivers/message/fusion/lsi/mpi_history.txt
@@ -127,7 +127,7 @@ mpi_ioc.h
127 * 08-08-01 01.02.01 Original release for v1.2 work. 127 * 08-08-01 01.02.01 Original release for v1.2 work.
128 * New format for FWVersion and ProductId in 128 * New format for FWVersion and ProductId in
129 * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER. 129 * MSG_IOC_FACTS_REPLY and MPI_FW_HEADER.
130 * 08-31-01 01.02.02 Addded event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and 130 * 08-31-01 01.02.02 Added event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and
131 * related structure and defines. 131 * related structure and defines.
132 * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED. 132 * Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED.
133 * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE. 133 * Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE.
@@ -187,7 +187,7 @@ mpi_ioc.h
187 * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED. 187 * 10-11-06 01.05.12 Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED.
188 * Added MaxInitiators field to PortFacts reply. 188 * Added MaxInitiators field to PortFacts reply.
189 * Added SAS Device Status Change ReasonCode for 189 * Added SAS Device Status Change ReasonCode for
190 * asynchronous notificaiton. 190 * asynchronous notification.
191 * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event 191 * Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event
192 * data structure. 192 * data structure.
193 * Added new ImageType values for FWDownload and FWUpload 193 * Added new ImageType values for FWDownload and FWUpload
@@ -213,7 +213,7 @@ mpi_cnfg.h
213 * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1 213 * Added _RESPONSE_ID_MASK definition to SCSI_PORT_1
214 * page and updated the page version. 214 * page and updated the page version.
215 * Added Information field and _INFO_PARAMS_NEGOTIATED 215 * Added Information field and _INFO_PARAMS_NEGOTIATED
216 * definitionto SCSI_DEVICE_0 page. 216 * definition to SCSI_DEVICE_0 page.
217 * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the 217 * 06-22-00 01.00.03 Removed batch controls from LAN_0 page and updated the
218 * page version. 218 * page version.
219 * Added BucketsRemaining to LAN_1 page, redefined the 219 * Added BucketsRemaining to LAN_1 page, redefined the
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 3b870e7fb3e1..eabf0bfccab4 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -314,10 +314,12 @@ static int __init asic3_irq_probe(struct platform_device *pdev)
314 unsigned long clksel = 0; 314 unsigned long clksel = 0;
315 unsigned int irq, irq_base; 315 unsigned int irq, irq_base;
316 int map_size; 316 int map_size;
317 int ret;
317 318
318 asic->irq_nr = platform_get_irq(pdev, 0); 319 ret = platform_get_irq(pdev, 0);
319 if (asic->irq_nr < 0) 320 if (ret < 0)
320 return asic->irq_nr; 321 return ret;
322 asic->irq_nr = ret;
321 323
322 /* turn on clock to IRQ controller */ 324 /* turn on clock to IRQ controller */
323 clksel |= CLOCK_SEL_CX; 325 clksel |= CLOCK_SEL_CX;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c3a5db72ddd7..5f95e10229b5 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -337,7 +337,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
337 337
338 host->align_addr = dma_map_single(mmc_dev(host->mmc), 338 host->align_addr = dma_map_single(mmc_dev(host->mmc),
339 host->align_buffer, 128 * 4, direction); 339 host->align_buffer, 128 * 4, direction);
340 if (dma_mapping_error(host->align_addr)) 340 if (dma_mapping_error(mmc_dev(host->mmc), host->align_addr))
341 goto fail; 341 goto fail;
342 BUG_ON(host->align_addr & 0x3); 342 BUG_ON(host->align_addr & 0x3);
343 343
@@ -439,7 +439,7 @@ static int sdhci_adma_table_pre(struct sdhci_host *host,
439 439
440 host->adma_addr = dma_map_single(mmc_dev(host->mmc), 440 host->adma_addr = dma_map_single(mmc_dev(host->mmc),
441 host->adma_desc, (128 * 2 + 1) * 4, DMA_TO_DEVICE); 441 host->adma_desc, (128 * 2 + 1) * 4, DMA_TO_DEVICE);
442 if (dma_mapping_error(host->align_addr)) 442 if (dma_mapping_error(mmc_dev(host->mmc), host->align_addr))
443 goto unmap_entries; 443 goto unmap_entries;
444 BUG_ON(host->adma_addr & 0x3); 444 BUG_ON(host->adma_addr & 0x3);
445 445
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index a06bf8b89343..e354faee5df0 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -9,6 +9,8 @@
9 * your option) any later version. 9 * your option) any later version.
10 */ 10 */
11 11
12#include <linux/scatterlist.h>
13
12/* 14/*
13 * Controller registers 15 * Controller registers
14 */ 16 */
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index 7a14980f3472..18d3eeb7eab2 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -482,7 +482,7 @@ static int ep93xx_alloc_buffers(struct ep93xx_priv *ep)
482 goto err; 482 goto err;
483 483
484 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_FROM_DEVICE); 484 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_FROM_DEVICE);
485 if (dma_mapping_error(d)) { 485 if (dma_mapping_error(NULL, d)) {
486 free_page((unsigned long)page); 486 free_page((unsigned long)page);
487 goto err; 487 goto err;
488 } 488 }
@@ -505,7 +505,7 @@ static int ep93xx_alloc_buffers(struct ep93xx_priv *ep)
505 goto err; 505 goto err;
506 506
507 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_TO_DEVICE); 507 d = dma_map_single(NULL, page, PAGE_SIZE, DMA_TO_DEVICE);
508 if (dma_mapping_error(d)) { 508 if (dma_mapping_error(NULL, d)) {
509 free_page((unsigned long)page); 509 free_page((unsigned long)page);
510 goto err; 510 goto err;
511 } 511 }
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 0263bef9cc6d..c7cc760a1777 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -1020,7 +1020,7 @@ static inline int bnx2x_alloc_rx_sge(struct bnx2x *bp,
1020 1020
1021 mapping = pci_map_page(bp->pdev, page, 0, BCM_PAGE_SIZE*PAGES_PER_SGE, 1021 mapping = pci_map_page(bp->pdev, page, 0, BCM_PAGE_SIZE*PAGES_PER_SGE,
1022 PCI_DMA_FROMDEVICE); 1022 PCI_DMA_FROMDEVICE);
1023 if (unlikely(dma_mapping_error(mapping))) { 1023 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
1024 __free_pages(page, PAGES_PER_SGE_SHIFT); 1024 __free_pages(page, PAGES_PER_SGE_SHIFT);
1025 return -ENOMEM; 1025 return -ENOMEM;
1026 } 1026 }
@@ -1048,7 +1048,7 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp,
1048 1048
1049 mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size, 1049 mapping = pci_map_single(bp->pdev, skb->data, bp->rx_buf_use_size,
1050 PCI_DMA_FROMDEVICE); 1050 PCI_DMA_FROMDEVICE);
1051 if (unlikely(dma_mapping_error(mapping))) { 1051 if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) {
1052 dev_kfree_skb(skb); 1052 dev_kfree_skb(skb);
1053 return -ENOMEM; 1053 return -ENOMEM;
1054 } 1054 }
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 83768df27806..f1936d51b458 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -576,6 +576,18 @@ static void cas_spare_recover(struct cas *cp, const gfp_t flags)
576 list_for_each_safe(elem, tmp, &list) { 576 list_for_each_safe(elem, tmp, &list) {
577 cas_page_t *page = list_entry(elem, cas_page_t, list); 577 cas_page_t *page = list_entry(elem, cas_page_t, list);
578 578
579 /*
580 * With the lockless pagecache, cassini buffering scheme gets
581 * slightly less accurate: we might find that a page has an
582 * elevated reference count here, due to a speculative ref,
583 * and skip it as in-use. Ideally we would be able to reclaim
584 * it. However this would be such a rare case, it doesn't
585 * matter too much as we should pick it up the next time round.
586 *
587 * Importantly, if we find that the page has a refcount of 1
588 * here (our refcount), then we know it is definitely not inuse
589 * so we can reuse it.
590 */
579 if (page_count(page->buffer) > 1) 591 if (page_count(page->buffer) > 1)
580 continue; 592 continue;
581 593
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index a96331c875e6..1b0861d73ab7 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -386,7 +386,7 @@ static inline int add_one_rx_buf(void *va, unsigned int len,
386 dma_addr_t mapping; 386 dma_addr_t mapping;
387 387
388 mapping = pci_map_single(pdev, va, len, PCI_DMA_FROMDEVICE); 388 mapping = pci_map_single(pdev, va, len, PCI_DMA_FROMDEVICE);
389 if (unlikely(pci_dma_mapping_error(mapping))) 389 if (unlikely(pci_dma_mapping_error(pdev, mapping)))
390 return -ENOMEM; 390 return -ENOMEM;
391 391
392 pci_unmap_addr_set(sd, dma_addr, mapping); 392 pci_unmap_addr_set(sd, dma_addr, mapping);
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 1037b1332312..19d32a227be1 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1790,7 +1790,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
1790 rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data, 1790 rx->dma_addr = pci_map_single(nic->pdev, rx->skb->data,
1791 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); 1791 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
1792 1792
1793 if (pci_dma_mapping_error(rx->dma_addr)) { 1793 if (pci_dma_mapping_error(nic->pdev, rx->dma_addr)) {
1794 dev_kfree_skb_any(rx->skb); 1794 dev_kfree_skb_any(rx->skb);
1795 rx->skb = NULL; 1795 rx->skb = NULL;
1796 rx->dma_addr = 0; 1796 rx->dma_addr = 0;
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index a14561f40db0..9350564065e7 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1090,7 +1090,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1090 tx_ring->buffer_info[i].dma = 1090 tx_ring->buffer_info[i].dma =
1091 pci_map_single(pdev, skb->data, skb->len, 1091 pci_map_single(pdev, skb->data, skb->len,
1092 PCI_DMA_TODEVICE); 1092 PCI_DMA_TODEVICE);
1093 if (pci_dma_mapping_error(tx_ring->buffer_info[i].dma)) { 1093 if (pci_dma_mapping_error(pdev, tx_ring->buffer_info[i].dma)) {
1094 ret_val = 4; 1094 ret_val = 4;
1095 goto err_nomem; 1095 goto err_nomem;
1096 } 1096 }
@@ -1153,7 +1153,7 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
1153 rx_ring->buffer_info[i].dma = 1153 rx_ring->buffer_info[i].dma =
1154 pci_map_single(pdev, skb->data, 2048, 1154 pci_map_single(pdev, skb->data, 2048,
1155 PCI_DMA_FROMDEVICE); 1155 PCI_DMA_FROMDEVICE);
1156 if (pci_dma_mapping_error(rx_ring->buffer_info[i].dma)) { 1156 if (pci_dma_mapping_error(pdev, rx_ring->buffer_info[i].dma)) {
1157 ret_val = 8; 1157 ret_val = 8;
1158 goto err_nomem; 1158 goto err_nomem;
1159 } 1159 }
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 9c0f56b3c518..d13677899767 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -195,7 +195,7 @@ map_skb:
195 buffer_info->dma = pci_map_single(pdev, skb->data, 195 buffer_info->dma = pci_map_single(pdev, skb->data,
196 adapter->rx_buffer_len, 196 adapter->rx_buffer_len,
197 PCI_DMA_FROMDEVICE); 197 PCI_DMA_FROMDEVICE);
198 if (pci_dma_mapping_error(buffer_info->dma)) { 198 if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
199 dev_err(&pdev->dev, "RX DMA map failed\n"); 199 dev_err(&pdev->dev, "RX DMA map failed\n");
200 adapter->rx_dma_failed++; 200 adapter->rx_dma_failed++;
201 break; 201 break;
@@ -265,7 +265,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
265 ps_page->page, 265 ps_page->page,
266 0, PAGE_SIZE, 266 0, PAGE_SIZE,
267 PCI_DMA_FROMDEVICE); 267 PCI_DMA_FROMDEVICE);
268 if (pci_dma_mapping_error(ps_page->dma)) { 268 if (pci_dma_mapping_error(pdev, ps_page->dma)) {
269 dev_err(&adapter->pdev->dev, 269 dev_err(&adapter->pdev->dev,
270 "RX DMA page map failed\n"); 270 "RX DMA page map failed\n");
271 adapter->rx_dma_failed++; 271 adapter->rx_dma_failed++;
@@ -300,7 +300,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
300 buffer_info->dma = pci_map_single(pdev, skb->data, 300 buffer_info->dma = pci_map_single(pdev, skb->data,
301 adapter->rx_ps_bsize0, 301 adapter->rx_ps_bsize0,
302 PCI_DMA_FROMDEVICE); 302 PCI_DMA_FROMDEVICE);
303 if (pci_dma_mapping_error(buffer_info->dma)) { 303 if (pci_dma_mapping_error(pdev, buffer_info->dma)) {
304 dev_err(&pdev->dev, "RX DMA map failed\n"); 304 dev_err(&pdev->dev, "RX DMA map failed\n");
305 adapter->rx_dma_failed++; 305 adapter->rx_dma_failed++;
306 /* cleanup skb */ 306 /* cleanup skb */
@@ -3344,7 +3344,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
3344 skb->data + offset, 3344 skb->data + offset,
3345 size, 3345 size,
3346 PCI_DMA_TODEVICE); 3346 PCI_DMA_TODEVICE);
3347 if (pci_dma_mapping_error(buffer_info->dma)) { 3347 if (pci_dma_mapping_error(adapter->pdev, buffer_info->dma)) {
3348 dev_err(&adapter->pdev->dev, "TX DMA map failed\n"); 3348 dev_err(&adapter->pdev->dev, "TX DMA map failed\n");
3349 adapter->tx_dma_failed++; 3349 adapter->tx_dma_failed++;
3350 return -1; 3350 return -1;
@@ -3382,7 +3382,8 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
3382 offset, 3382 offset,
3383 size, 3383 size,
3384 PCI_DMA_TODEVICE); 3384 PCI_DMA_TODEVICE);
3385 if (pci_dma_mapping_error(buffer_info->dma)) { 3385 if (pci_dma_mapping_error(adapter->pdev,
3386 buffer_info->dma)) {
3386 dev_err(&adapter->pdev->dev, 3387 dev_err(&adapter->pdev->dev,
3387 "TX DMA page map failed\n"); 3388 "TX DMA page map failed\n");
3388 adapter->tx_dma_failed++; 3389 adapter->tx_dma_failed++;
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index e5a6e2e84540..91ec9fdc7184 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -260,7 +260,7 @@ static void ibmveth_replenish_buffer_pool(struct ibmveth_adapter *adapter, struc
260 dma_addr = dma_map_single(&adapter->vdev->dev, skb->data, 260 dma_addr = dma_map_single(&adapter->vdev->dev, skb->data,
261 pool->buff_size, DMA_FROM_DEVICE); 261 pool->buff_size, DMA_FROM_DEVICE);
262 262
263 if (dma_mapping_error(dma_addr)) 263 if (dma_mapping_error((&adapter->vdev->dev, dma_addr))
264 goto failure; 264 goto failure;
265 265
266 pool->free_map[free_index] = IBM_VETH_INVALID_MAP; 266 pool->free_map[free_index] = IBM_VETH_INVALID_MAP;
@@ -294,7 +294,7 @@ failure:
294 pool->consumer_index = pool->size - 1; 294 pool->consumer_index = pool->size - 1;
295 else 295 else
296 pool->consumer_index--; 296 pool->consumer_index--;
297 if (!dma_mapping_error(dma_addr)) 297 if (!dma_mapping_error((&adapter->vdev->dev, dma_addr))
298 dma_unmap_single(&adapter->vdev->dev, 298 dma_unmap_single(&adapter->vdev->dev,
299 pool->dma_addr[index], pool->buff_size, 299 pool->dma_addr[index], pool->buff_size,
300 DMA_FROM_DEVICE); 300 DMA_FROM_DEVICE);
@@ -448,11 +448,11 @@ static void ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter)
448static void ibmveth_cleanup(struct ibmveth_adapter *adapter) 448static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
449{ 449{
450 int i; 450 int i;
451 struct device *dev = &adapter->vdev->dev;
451 452
452 if(adapter->buffer_list_addr != NULL) { 453 if(adapter->buffer_list_addr != NULL) {
453 if(!dma_mapping_error(adapter->buffer_list_dma)) { 454 if (!dma_mapping_error(dev, adapter->buffer_list_dma)) {
454 dma_unmap_single(&adapter->vdev->dev, 455 dma_unmap_single(dev, adapter->buffer_list_dma, 4096,
455 adapter->buffer_list_dma, 4096,
456 DMA_BIDIRECTIONAL); 456 DMA_BIDIRECTIONAL);
457 adapter->buffer_list_dma = DMA_ERROR_CODE; 457 adapter->buffer_list_dma = DMA_ERROR_CODE;
458 } 458 }
@@ -461,9 +461,8 @@ static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
461 } 461 }
462 462
463 if(adapter->filter_list_addr != NULL) { 463 if(adapter->filter_list_addr != NULL) {
464 if(!dma_mapping_error(adapter->filter_list_dma)) { 464 if (!dma_mapping_error(dev, adapter->filter_list_dma)) {
465 dma_unmap_single(&adapter->vdev->dev, 465 dma_unmap_single(dev, adapter->filter_list_dma, 4096,
466 adapter->filter_list_dma, 4096,
467 DMA_BIDIRECTIONAL); 466 DMA_BIDIRECTIONAL);
468 adapter->filter_list_dma = DMA_ERROR_CODE; 467 adapter->filter_list_dma = DMA_ERROR_CODE;
469 } 468 }
@@ -472,8 +471,8 @@ static void ibmveth_cleanup(struct ibmveth_adapter *adapter)
472 } 471 }
473 472
474 if(adapter->rx_queue.queue_addr != NULL) { 473 if(adapter->rx_queue.queue_addr != NULL) {
475 if(!dma_mapping_error(adapter->rx_queue.queue_dma)) { 474 if (!dma_mapping_error(dev, adapter->rx_queue.queue_dma)) {
476 dma_unmap_single(&adapter->vdev->dev, 475 dma_unmap_single(dev,
477 adapter->rx_queue.queue_dma, 476 adapter->rx_queue.queue_dma,
478 adapter->rx_queue.queue_len, 477 adapter->rx_queue.queue_len,
479 DMA_BIDIRECTIONAL); 478 DMA_BIDIRECTIONAL);
@@ -535,6 +534,7 @@ static int ibmveth_open(struct net_device *netdev)
535 int rc; 534 int rc;
536 union ibmveth_buf_desc rxq_desc; 535 union ibmveth_buf_desc rxq_desc;
537 int i; 536 int i;
537 struct device *dev;
538 538
539 ibmveth_debug_printk("open starting\n"); 539 ibmveth_debug_printk("open starting\n");
540 540
@@ -563,17 +563,19 @@ static int ibmveth_open(struct net_device *netdev)
563 return -ENOMEM; 563 return -ENOMEM;
564 } 564 }
565 565
566 adapter->buffer_list_dma = dma_map_single(&adapter->vdev->dev, 566 dev = &adapter->vdev->dev;
567
568 adapter->buffer_list_dma = dma_map_single(dev,
567 adapter->buffer_list_addr, 4096, DMA_BIDIRECTIONAL); 569 adapter->buffer_list_addr, 4096, DMA_BIDIRECTIONAL);
568 adapter->filter_list_dma = dma_map_single(&adapter->vdev->dev, 570 adapter->filter_list_dma = dma_map_single(dev,
569 adapter->filter_list_addr, 4096, DMA_BIDIRECTIONAL); 571 adapter->filter_list_addr, 4096, DMA_BIDIRECTIONAL);
570 adapter->rx_queue.queue_dma = dma_map_single(&adapter->vdev->dev, 572 adapter->rx_queue.queue_dma = dma_map_single(dev,
571 adapter->rx_queue.queue_addr, 573 adapter->rx_queue.queue_addr,
572 adapter->rx_queue.queue_len, DMA_BIDIRECTIONAL); 574 adapter->rx_queue.queue_len, DMA_BIDIRECTIONAL);
573 575
574 if((dma_mapping_error(adapter->buffer_list_dma) ) || 576 if ((dma_mapping_error(dev, adapter->buffer_list_dma)) ||
575 (dma_mapping_error(adapter->filter_list_dma)) || 577 (dma_mapping_error(dev, adapter->filter_list_dma)) ||
576 (dma_mapping_error(adapter->rx_queue.queue_dma))) { 578 (dma_mapping_error(dev, adapter->rx_queue.queue_dma))) {
577 ibmveth_error_printk("unable to map filter or buffer list pages\n"); 579 ibmveth_error_printk("unable to map filter or buffer list pages\n");
578 ibmveth_cleanup(adapter); 580 ibmveth_cleanup(adapter);
579 napi_disable(&adapter->napi); 581 napi_disable(&adapter->napi);
@@ -645,7 +647,7 @@ static int ibmveth_open(struct net_device *netdev)
645 adapter->bounce_buffer_dma = 647 adapter->bounce_buffer_dma =
646 dma_map_single(&adapter->vdev->dev, adapter->bounce_buffer, 648 dma_map_single(&adapter->vdev->dev, adapter->bounce_buffer,
647 netdev->mtu + IBMVETH_BUFF_OH, DMA_BIDIRECTIONAL); 649 netdev->mtu + IBMVETH_BUFF_OH, DMA_BIDIRECTIONAL);
648 if (dma_mapping_error(adapter->bounce_buffer_dma)) { 650 if (dma_mapping_error(dev, adapter->bounce_buffer_dma)) {
649 ibmveth_error_printk("unable to map bounce buffer\n"); 651 ibmveth_error_printk("unable to map bounce buffer\n");
650 ibmveth_cleanup(adapter); 652 ibmveth_cleanup(adapter);
651 napi_disable(&adapter->napi); 653 napi_disable(&adapter->napi);
@@ -922,7 +924,7 @@ static int ibmveth_start_xmit(struct sk_buff *skb, struct net_device *netdev)
922 buf[1] = 0; 924 buf[1] = 0;
923 } 925 }
924 926
925 if (dma_mapping_error(data_dma_addr)) { 927 if (dma_mapping_error((&adapter->vdev->dev, data_dma_addr)) {
926 if (!firmware_has_feature(FW_FEATURE_CMO)) 928 if (!firmware_has_feature(FW_FEATURE_CMO))
927 ibmveth_error_printk("tx: unable to map xmit buffer\n"); 929 ibmveth_error_printk("tx: unable to map xmit buffer\n");
928 skb_copy_from_linear_data(skb, adapter->bounce_buffer, 930 skb_copy_from_linear_data(skb, adapter->bounce_buffer,
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index b8d0639c1cdf..c46864d626b2 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -1128,7 +1128,7 @@ static int veth_transmit_to_one(struct sk_buff *skb, HvLpIndex rlp,
1128 msg->data.addr[0] = dma_map_single(port->dev, skb->data, 1128 msg->data.addr[0] = dma_map_single(port->dev, skb->data,
1129 skb->len, DMA_TO_DEVICE); 1129 skb->len, DMA_TO_DEVICE);
1130 1130
1131 if (dma_mapping_error(msg->data.addr[0])) 1131 if (dma_mapping_error(port->dev, msg->data.addr[0]))
1132 goto recycle_and_drop; 1132 goto recycle_and_drop;
1133 1133
1134 msg->dev = port->dev; 1134 msg->dev = port->dev;
@@ -1226,7 +1226,7 @@ static void veth_recycle_msg(struct veth_lpar_connection *cnx,
1226 dma_address = msg->data.addr[0]; 1226 dma_address = msg->data.addr[0];
1227 dma_length = msg->data.len[0]; 1227 dma_length = msg->data.len[0];
1228 1228
1229 if (!dma_mapping_error(dma_address)) 1229 if (!dma_mapping_error(msg->dev, dma_address))
1230 dma_unmap_single(msg->dev, dma_address, dma_length, 1230 dma_unmap_single(msg->dev, dma_address, dma_length,
1231 DMA_TO_DEVICE); 1231 DMA_TO_DEVICE);
1232 1232
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index ea3a09aaa844..7df928d3a3d8 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -526,7 +526,7 @@ int mlx4_map_eq_icm(struct mlx4_dev *dev, u64 icm_virt)
526 return -ENOMEM; 526 return -ENOMEM;
527 priv->eq_table.icm_dma = pci_map_page(dev->pdev, priv->eq_table.icm_page, 0, 527 priv->eq_table.icm_dma = pci_map_page(dev->pdev, priv->eq_table.icm_page, 0,
528 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); 528 PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
529 if (pci_dma_mapping_error(priv->eq_table.icm_dma)) { 529 if (pci_dma_mapping_error(dev->pdev, priv->eq_table.icm_dma)) {
530 __free_page(priv->eq_table.icm_page); 530 __free_page(priv->eq_table.icm_page);
531 return -ENOMEM; 531 return -ENOMEM;
532 } 532 }
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 993d87c9296f..edc0fd588985 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -650,7 +650,7 @@ static void pasemi_mac_replenish_rx_ring(const struct net_device *dev,
650 mac->bufsz - LOCAL_SKB_ALIGN, 650 mac->bufsz - LOCAL_SKB_ALIGN,
651 PCI_DMA_FROMDEVICE); 651 PCI_DMA_FROMDEVICE);
652 652
653 if (unlikely(dma_mapping_error(dma))) { 653 if (unlikely(pci_dma_mapping_error(mac->dma_pdev, dma))) {
654 dev_kfree_skb_irq(info->skb); 654 dev_kfree_skb_irq(info->skb);
655 break; 655 break;
656 } 656 }
@@ -1519,7 +1519,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
1519 map[0] = pci_map_single(mac->dma_pdev, skb->data, skb_headlen(skb), 1519 map[0] = pci_map_single(mac->dma_pdev, skb->data, skb_headlen(skb),
1520 PCI_DMA_TODEVICE); 1520 PCI_DMA_TODEVICE);
1521 map_size[0] = skb_headlen(skb); 1521 map_size[0] = skb_headlen(skb);
1522 if (dma_mapping_error(map[0])) 1522 if (pci_dma_mapping_error(mac->dma_pdev, map[0]))
1523 goto out_err_nolock; 1523 goto out_err_nolock;
1524 1524
1525 for (i = 0; i < nfrags; i++) { 1525 for (i = 0; i < nfrags; i++) {
@@ -1529,7 +1529,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
1529 frag->page_offset, frag->size, 1529 frag->page_offset, frag->size,
1530 PCI_DMA_TODEVICE); 1530 PCI_DMA_TODEVICE);
1531 map_size[i+1] = frag->size; 1531 map_size[i+1] = frag->size;
1532 if (dma_mapping_error(map[i+1])) { 1532 if (pci_dma_mapping_error(mac->dma_pdev, map[i+1])) {
1533 nfrags = i; 1533 nfrags = i;
1534 goto out_err_nolock; 1534 goto out_err_nolock;
1535 } 1535 }
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index e7d48a352beb..e82b37bbd6c3 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -328,7 +328,7 @@ static void ql_release_to_lrg_buf_free_list(struct ql3_adapter *qdev,
328 qdev->lrg_buffer_len - 328 qdev->lrg_buffer_len -
329 QL_HEADER_SPACE, 329 QL_HEADER_SPACE,
330 PCI_DMA_FROMDEVICE); 330 PCI_DMA_FROMDEVICE);
331 err = pci_dma_mapping_error(map); 331 err = pci_dma_mapping_error(qdev->pdev, map);
332 if(err) { 332 if(err) {
333 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n", 333 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n",
334 qdev->ndev->name, err); 334 qdev->ndev->name, err);
@@ -1919,7 +1919,7 @@ static int ql_populate_free_queue(struct ql3_adapter *qdev)
1919 QL_HEADER_SPACE, 1919 QL_HEADER_SPACE,
1920 PCI_DMA_FROMDEVICE); 1920 PCI_DMA_FROMDEVICE);
1921 1921
1922 err = pci_dma_mapping_error(map); 1922 err = pci_dma_mapping_error(qdev->pdev, map);
1923 if(err) { 1923 if(err) {
1924 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n", 1924 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n",
1925 qdev->ndev->name, err); 1925 qdev->ndev->name, err);
@@ -2454,7 +2454,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2454 */ 2454 */
2455 map = pci_map_single(qdev->pdev, skb->data, len, PCI_DMA_TODEVICE); 2455 map = pci_map_single(qdev->pdev, skb->data, len, PCI_DMA_TODEVICE);
2456 2456
2457 err = pci_dma_mapping_error(map); 2457 err = pci_dma_mapping_error(qdev->pdev, map);
2458 if(err) { 2458 if(err) {
2459 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n", 2459 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n",
2460 qdev->ndev->name, err); 2460 qdev->ndev->name, err);
@@ -2487,7 +2487,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2487 sizeof(struct oal), 2487 sizeof(struct oal),
2488 PCI_DMA_TODEVICE); 2488 PCI_DMA_TODEVICE);
2489 2489
2490 err = pci_dma_mapping_error(map); 2490 err = pci_dma_mapping_error(qdev->pdev, map);
2491 if(err) { 2491 if(err) {
2492 2492
2493 printk(KERN_ERR "%s: PCI mapping outbound address list with error: %d\n", 2493 printk(KERN_ERR "%s: PCI mapping outbound address list with error: %d\n",
@@ -2514,7 +2514,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2514 frag->page_offset, frag->size, 2514 frag->page_offset, frag->size,
2515 PCI_DMA_TODEVICE); 2515 PCI_DMA_TODEVICE);
2516 2516
2517 err = pci_dma_mapping_error(map); 2517 err = pci_dma_mapping_error(qdev->pdev, map);
2518 if(err) { 2518 if(err) {
2519 printk(KERN_ERR "%s: PCI mapping frags failed with error: %d\n", 2519 printk(KERN_ERR "%s: PCI mapping frags failed with error: %d\n",
2520 qdev->ndev->name, err); 2520 qdev->ndev->name, err);
@@ -2916,7 +2916,7 @@ static int ql_alloc_large_buffers(struct ql3_adapter *qdev)
2916 QL_HEADER_SPACE, 2916 QL_HEADER_SPACE,
2917 PCI_DMA_FROMDEVICE); 2917 PCI_DMA_FROMDEVICE);
2918 2918
2919 err = pci_dma_mapping_error(map); 2919 err = pci_dma_mapping_error(qdev->pdev, map);
2920 if(err) { 2920 if(err) {
2921 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n", 2921 printk(KERN_ERR "%s: PCI mapping failed with error: %d\n",
2922 qdev->ndev->name, err); 2922 qdev->ndev->name, err);
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 9dae40ccf048..86d77d05190a 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2512,8 +2512,8 @@ static void stop_nic(struct s2io_nic *nic)
2512 * Return Value: 2512 * Return Value:
2513 * SUCCESS on success or an appropriate -ve value on failure. 2513 * SUCCESS on success or an appropriate -ve value on failure.
2514 */ 2514 */
2515 2515static int fill_rx_buffers(struct s2io_nic *nic, struct ring_info *ring,
2516static int fill_rx_buffers(struct ring_info *ring, int from_card_up) 2516 int from_card_up)
2517{ 2517{
2518 struct sk_buff *skb; 2518 struct sk_buff *skb;
2519 struct RxD_t *rxdp; 2519 struct RxD_t *rxdp;
@@ -2602,7 +2602,8 @@ static int fill_rx_buffers(struct ring_info *ring, int from_card_up)
2602 rxdp1->Buffer0_ptr = pci_map_single 2602 rxdp1->Buffer0_ptr = pci_map_single
2603 (ring->pdev, skb->data, size - NET_IP_ALIGN, 2603 (ring->pdev, skb->data, size - NET_IP_ALIGN,
2604 PCI_DMA_FROMDEVICE); 2604 PCI_DMA_FROMDEVICE);
2605 if(pci_dma_mapping_error(rxdp1->Buffer0_ptr)) 2605 if (pci_dma_mapping_error(nic->pdev,
2606 rxdp1->Buffer0_ptr))
2606 goto pci_map_failed; 2607 goto pci_map_failed;
2607 2608
2608 rxdp->Control_2 = 2609 rxdp->Control_2 =
@@ -2636,7 +2637,8 @@ static int fill_rx_buffers(struct ring_info *ring, int from_card_up)
2636 rxdp3->Buffer0_ptr = 2637 rxdp3->Buffer0_ptr =
2637 pci_map_single(ring->pdev, ba->ba_0, 2638 pci_map_single(ring->pdev, ba->ba_0,
2638 BUF0_LEN, PCI_DMA_FROMDEVICE); 2639 BUF0_LEN, PCI_DMA_FROMDEVICE);
2639 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr)) 2640 if (pci_dma_mapping_error(nic->pdev,
2641 rxdp3->Buffer0_ptr))
2640 goto pci_map_failed; 2642 goto pci_map_failed;
2641 } else 2643 } else
2642 pci_dma_sync_single_for_device(ring->pdev, 2644 pci_dma_sync_single_for_device(ring->pdev,
@@ -2655,7 +2657,8 @@ static int fill_rx_buffers(struct ring_info *ring, int from_card_up)
2655 (ring->pdev, skb->data, ring->mtu + 4, 2657 (ring->pdev, skb->data, ring->mtu + 4,
2656 PCI_DMA_FROMDEVICE); 2658 PCI_DMA_FROMDEVICE);
2657 2659
2658 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr)) 2660 if (pci_dma_mapping_error(nic->pdev,
2661 rxdp3->Buffer2_ptr))
2659 goto pci_map_failed; 2662 goto pci_map_failed;
2660 2663
2661 if (from_card_up) { 2664 if (from_card_up) {
@@ -2664,8 +2667,8 @@ static int fill_rx_buffers(struct ring_info *ring, int from_card_up)
2664 ba->ba_1, BUF1_LEN, 2667 ba->ba_1, BUF1_LEN,
2665 PCI_DMA_FROMDEVICE); 2668 PCI_DMA_FROMDEVICE);
2666 2669
2667 if (pci_dma_mapping_error 2670 if (pci_dma_mapping_error(nic->pdev,
2668 (rxdp3->Buffer1_ptr)) { 2671 rxdp3->Buffer1_ptr)) {
2669 pci_unmap_single 2672 pci_unmap_single
2670 (ring->pdev, 2673 (ring->pdev,
2671 (dma_addr_t)(unsigned long) 2674 (dma_addr_t)(unsigned long)
@@ -2806,9 +2809,9 @@ static void free_rx_buffers(struct s2io_nic *sp)
2806 } 2809 }
2807} 2810}
2808 2811
2809static int s2io_chk_rx_buffers(struct ring_info *ring) 2812static int s2io_chk_rx_buffers(struct s2io_nic *nic, struct ring_info *ring)
2810{ 2813{
2811 if (fill_rx_buffers(ring, 0) == -ENOMEM) { 2814 if (fill_rx_buffers(nic, ring, 0) == -ENOMEM) {
2812 DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name); 2815 DBG_PRINT(INFO_DBG, "%s:Out of memory", ring->dev->name);
2813 DBG_PRINT(INFO_DBG, " in Rx Intr!!\n"); 2816 DBG_PRINT(INFO_DBG, " in Rx Intr!!\n");
2814 } 2817 }
@@ -2848,7 +2851,7 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
2848 return 0; 2851 return 0;
2849 2852
2850 pkts_processed = rx_intr_handler(ring, budget); 2853 pkts_processed = rx_intr_handler(ring, budget);
2851 s2io_chk_rx_buffers(ring); 2854 s2io_chk_rx_buffers(nic, ring);
2852 2855
2853 if (pkts_processed < budget_org) { 2856 if (pkts_processed < budget_org) {
2854 netif_rx_complete(dev, napi); 2857 netif_rx_complete(dev, napi);
@@ -2882,7 +2885,7 @@ static int s2io_poll_inta(struct napi_struct *napi, int budget)
2882 for (i = 0; i < config->rx_ring_num; i++) { 2885 for (i = 0; i < config->rx_ring_num; i++) {
2883 ring = &mac_control->rings[i]; 2886 ring = &mac_control->rings[i];
2884 ring_pkts_processed = rx_intr_handler(ring, budget); 2887 ring_pkts_processed = rx_intr_handler(ring, budget);
2885 s2io_chk_rx_buffers(ring); 2888 s2io_chk_rx_buffers(nic, ring);
2886 pkts_processed += ring_pkts_processed; 2889 pkts_processed += ring_pkts_processed;
2887 budget -= ring_pkts_processed; 2890 budget -= ring_pkts_processed;
2888 if (budget <= 0) 2891 if (budget <= 0)
@@ -2939,7 +2942,8 @@ static void s2io_netpoll(struct net_device *dev)
2939 rx_intr_handler(&mac_control->rings[i], 0); 2942 rx_intr_handler(&mac_control->rings[i], 0);
2940 2943
2941 for (i = 0; i < config->rx_ring_num; i++) { 2944 for (i = 0; i < config->rx_ring_num; i++) {
2942 if (fill_rx_buffers(&mac_control->rings[i], 0) == -ENOMEM) { 2945 if (fill_rx_buffers(nic, &mac_control->rings[i], 0) ==
2946 -ENOMEM) {
2943 DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name); 2947 DBG_PRINT(INFO_DBG, "%s:Out of memory", dev->name);
2944 DBG_PRINT(INFO_DBG, " in Rx Netpoll!!\n"); 2948 DBG_PRINT(INFO_DBG, " in Rx Netpoll!!\n");
2945 break; 2949 break;
@@ -4235,14 +4239,14 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
4235 txdp->Buffer_Pointer = pci_map_single(sp->pdev, 4239 txdp->Buffer_Pointer = pci_map_single(sp->pdev,
4236 fifo->ufo_in_band_v, 4240 fifo->ufo_in_band_v,
4237 sizeof(u64), PCI_DMA_TODEVICE); 4241 sizeof(u64), PCI_DMA_TODEVICE);
4238 if (pci_dma_mapping_error(txdp->Buffer_Pointer)) 4242 if (pci_dma_mapping_error(sp->pdev, txdp->Buffer_Pointer))
4239 goto pci_map_failed; 4243 goto pci_map_failed;
4240 txdp++; 4244 txdp++;
4241 } 4245 }
4242 4246
4243 txdp->Buffer_Pointer = pci_map_single 4247 txdp->Buffer_Pointer = pci_map_single
4244 (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE); 4248 (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE);
4245 if (pci_dma_mapping_error(txdp->Buffer_Pointer)) 4249 if (pci_dma_mapping_error(sp->pdev, txdp->Buffer_Pointer))
4246 goto pci_map_failed; 4250 goto pci_map_failed;
4247 4251
4248 txdp->Host_Control = (unsigned long) skb; 4252 txdp->Host_Control = (unsigned long) skb;
@@ -4345,7 +4349,7 @@ static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
4345 netif_rx_schedule(dev, &ring->napi); 4349 netif_rx_schedule(dev, &ring->napi);
4346 } else { 4350 } else {
4347 rx_intr_handler(ring, 0); 4351 rx_intr_handler(ring, 0);
4348 s2io_chk_rx_buffers(ring); 4352 s2io_chk_rx_buffers(sp, ring);
4349 } 4353 }
4350 4354
4351 return IRQ_HANDLED; 4355 return IRQ_HANDLED;
@@ -4826,7 +4830,7 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
4826 */ 4830 */
4827 if (!config->napi) { 4831 if (!config->napi) {
4828 for (i = 0; i < config->rx_ring_num; i++) 4832 for (i = 0; i < config->rx_ring_num; i++)
4829 s2io_chk_rx_buffers(&mac_control->rings[i]); 4833 s2io_chk_rx_buffers(sp, &mac_control->rings[i]);
4830 } 4834 }
4831 writeq(sp->general_int_mask, &bar0->general_int_mask); 4835 writeq(sp->general_int_mask, &bar0->general_int_mask);
4832 readl(&bar0->general_int_status); 4836 readl(&bar0->general_int_status);
@@ -6859,7 +6863,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6859 pci_map_single( sp->pdev, (*skb)->data, 6863 pci_map_single( sp->pdev, (*skb)->data,
6860 size - NET_IP_ALIGN, 6864 size - NET_IP_ALIGN,
6861 PCI_DMA_FROMDEVICE); 6865 PCI_DMA_FROMDEVICE);
6862 if (pci_dma_mapping_error(rxdp1->Buffer0_ptr)) 6866 if (pci_dma_mapping_error(sp->pdev, rxdp1->Buffer0_ptr))
6863 goto memalloc_failed; 6867 goto memalloc_failed;
6864 rxdp->Host_Control = (unsigned long) (*skb); 6868 rxdp->Host_Control = (unsigned long) (*skb);
6865 } 6869 }
@@ -6886,12 +6890,13 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6886 pci_map_single(sp->pdev, (*skb)->data, 6890 pci_map_single(sp->pdev, (*skb)->data,
6887 dev->mtu + 4, 6891 dev->mtu + 4,
6888 PCI_DMA_FROMDEVICE); 6892 PCI_DMA_FROMDEVICE);
6889 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr)) 6893 if (pci_dma_mapping_error(sp->pdev, rxdp3->Buffer2_ptr))
6890 goto memalloc_failed; 6894 goto memalloc_failed;
6891 rxdp3->Buffer0_ptr = *temp0 = 6895 rxdp3->Buffer0_ptr = *temp0 =
6892 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN, 6896 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN,
6893 PCI_DMA_FROMDEVICE); 6897 PCI_DMA_FROMDEVICE);
6894 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr)) { 6898 if (pci_dma_mapping_error(sp->pdev,
6899 rxdp3->Buffer0_ptr)) {
6895 pci_unmap_single (sp->pdev, 6900 pci_unmap_single (sp->pdev,
6896 (dma_addr_t)rxdp3->Buffer2_ptr, 6901 (dma_addr_t)rxdp3->Buffer2_ptr,
6897 dev->mtu + 4, PCI_DMA_FROMDEVICE); 6902 dev->mtu + 4, PCI_DMA_FROMDEVICE);
@@ -6903,7 +6908,8 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6903 rxdp3->Buffer1_ptr = *temp1 = 6908 rxdp3->Buffer1_ptr = *temp1 =
6904 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN, 6909 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN,
6905 PCI_DMA_FROMDEVICE); 6910 PCI_DMA_FROMDEVICE);
6906 if (pci_dma_mapping_error(rxdp3->Buffer1_ptr)) { 6911 if (pci_dma_mapping_error(sp->pdev,
6912 rxdp3->Buffer1_ptr)) {
6907 pci_unmap_single (sp->pdev, 6913 pci_unmap_single (sp->pdev,
6908 (dma_addr_t)rxdp3->Buffer0_ptr, 6914 (dma_addr_t)rxdp3->Buffer0_ptr,
6909 BUF0_LEN, PCI_DMA_FROMDEVICE); 6915 BUF0_LEN, PCI_DMA_FROMDEVICE);
@@ -7187,7 +7193,7 @@ static int s2io_card_up(struct s2io_nic * sp)
7187 7193
7188 for (i = 0; i < config->rx_ring_num; i++) { 7194 for (i = 0; i < config->rx_ring_num; i++) {
7189 mac_control->rings[i].mtu = dev->mtu; 7195 mac_control->rings[i].mtu = dev->mtu;
7190 ret = fill_rx_buffers(&mac_control->rings[i], 1); 7196 ret = fill_rx_buffers(sp, &mac_control->rings[i], 1);
7191 if (ret) { 7197 if (ret) {
7192 DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n", 7198 DBG_PRINT(ERR_DBG, "%s: Out of memory in Open\n",
7193 dev->name); 7199 dev->name);
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index 601b001437c0..0d27dd39bc09 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -233,7 +233,7 @@ static inline int efx_init_rx_buffer_skb(struct efx_rx_queue *rx_queue,
233 rx_buf->data, rx_buf->len, 233 rx_buf->data, rx_buf->len,
234 PCI_DMA_FROMDEVICE); 234 PCI_DMA_FROMDEVICE);
235 235
236 if (unlikely(pci_dma_mapping_error(rx_buf->dma_addr))) { 236 if (unlikely(pci_dma_mapping_error(efx->pci_dev, rx_buf->dma_addr))) {
237 dev_kfree_skb_any(rx_buf->skb); 237 dev_kfree_skb_any(rx_buf->skb);
238 rx_buf->skb = NULL; 238 rx_buf->skb = NULL;
239 return -EIO; 239 return -EIO;
@@ -275,7 +275,7 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
275 0, efx_rx_buf_size(efx), 275 0, efx_rx_buf_size(efx),
276 PCI_DMA_FROMDEVICE); 276 PCI_DMA_FROMDEVICE);
277 277
278 if (unlikely(pci_dma_mapping_error(dma_addr))) { 278 if (unlikely(pci_dma_mapping_error(efx->pci_dev, dma_addr))) {
279 __free_pages(rx_buf->page, efx->rx_buffer_order); 279 __free_pages(rx_buf->page, efx->rx_buffer_order);
280 rx_buf->page = NULL; 280 rx_buf->page = NULL;
281 return -EIO; 281 return -EIO;
diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
index 5cdd082ab8f6..5e8374ab28ee 100644
--- a/drivers/net/sfc/tx.c
+++ b/drivers/net/sfc/tx.c
@@ -172,7 +172,7 @@ static inline int efx_enqueue_skb(struct efx_tx_queue *tx_queue,
172 172
173 /* Process all fragments */ 173 /* Process all fragments */
174 while (1) { 174 while (1) {
175 if (unlikely(pci_dma_mapping_error(dma_addr))) 175 if (unlikely(pci_dma_mapping_error(pci_dev, dma_addr)))
176 goto pci_err; 176 goto pci_err;
177 177
178 /* Store fields for marking in the per-fragment final 178 /* Store fields for marking in the per-fragment final
@@ -661,7 +661,8 @@ efx_tsoh_heap_alloc(struct efx_tx_queue *tx_queue, size_t header_len)
661 tsoh->dma_addr = pci_map_single(tx_queue->efx->pci_dev, 661 tsoh->dma_addr = pci_map_single(tx_queue->efx->pci_dev,
662 TSOH_BUFFER(tsoh), header_len, 662 TSOH_BUFFER(tsoh), header_len,
663 PCI_DMA_TODEVICE); 663 PCI_DMA_TODEVICE);
664 if (unlikely(pci_dma_mapping_error(tsoh->dma_addr))) { 664 if (unlikely(pci_dma_mapping_error(tx_queue->efx->pci_dev,
665 tsoh->dma_addr))) {
665 kfree(tsoh); 666 kfree(tsoh);
666 return NULL; 667 return NULL;
667 } 668 }
@@ -863,7 +864,7 @@ static inline int tso_get_fragment(struct tso_state *st, struct efx_nic *efx,
863 864
864 st->ifc.unmap_addr = pci_map_page(efx->pci_dev, page, page_off, 865 st->ifc.unmap_addr = pci_map_page(efx->pci_dev, page, page_off,
865 len, PCI_DMA_TODEVICE); 866 len, PCI_DMA_TODEVICE);
866 if (likely(!pci_dma_mapping_error(st->ifc.unmap_addr))) { 867 if (likely(!pci_dma_mapping_error(efx->pci_dev, st->ifc.unmap_addr))) {
867 st->ifc.unmap_len = len; 868 st->ifc.unmap_len = len;
868 st->ifc.len = len; 869 st->ifc.len = len;
869 st->ifc.dma_addr = st->ifc.unmap_addr; 870 st->ifc.dma_addr = st->ifc.unmap_addr;
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 00aa0b108cb9..b6435d0d71f9 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -452,7 +452,7 @@ spider_net_prepare_rx_descr(struct spider_net_card *card,
452 /* iommu-map the skb */ 452 /* iommu-map the skb */
453 buf = pci_map_single(card->pdev, descr->skb->data, 453 buf = pci_map_single(card->pdev, descr->skb->data,
454 SPIDER_NET_MAX_FRAME, PCI_DMA_FROMDEVICE); 454 SPIDER_NET_MAX_FRAME, PCI_DMA_FROMDEVICE);
455 if (pci_dma_mapping_error(buf)) { 455 if (pci_dma_mapping_error(card->pdev, buf)) {
456 dev_kfree_skb_any(descr->skb); 456 dev_kfree_skb_any(descr->skb);
457 descr->skb = NULL; 457 descr->skb = NULL;
458 if (netif_msg_rx_err(card) && net_ratelimit()) 458 if (netif_msg_rx_err(card) && net_ratelimit())
@@ -691,7 +691,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card,
691 unsigned long flags; 691 unsigned long flags;
692 692
693 buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); 693 buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE);
694 if (pci_dma_mapping_error(buf)) { 694 if (pci_dma_mapping_error(card->pdev, buf)) {
695 if (netif_msg_tx_err(card) && net_ratelimit()) 695 if (netif_msg_tx_err(card) && net_ratelimit())
696 dev_err(&card->netdev->dev, "could not iommu-map packet (%p, %i). " 696 dev_err(&card->netdev->dev, "could not iommu-map packet (%p, %i). "
697 "Dropping packet\n", skb->data, skb->len); 697 "Dropping packet\n", skb->data, skb->len);
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index a645e5028c14..8487ace9d2e3 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -506,7 +506,7 @@ static void *alloc_rxbuf_page(struct pci_dev *hwdev, dma_addr_t *dma_handle)
506 return NULL; 506 return NULL;
507 *dma_handle = pci_map_single(hwdev, buf, PAGE_SIZE, 507 *dma_handle = pci_map_single(hwdev, buf, PAGE_SIZE,
508 PCI_DMA_FROMDEVICE); 508 PCI_DMA_FROMDEVICE);
509 if (pci_dma_mapping_error(*dma_handle)) { 509 if (pci_dma_mapping_error(hwdev, *dma_handle)) {
510 free_page((unsigned long)buf); 510 free_page((unsigned long)buf);
511 return NULL; 511 return NULL;
512 } 512 }
@@ -536,7 +536,7 @@ static struct sk_buff *alloc_rxbuf_skb(struct net_device *dev,
536 return NULL; 536 return NULL;
537 *dma_handle = pci_map_single(hwdev, skb->data, RX_BUF_SIZE, 537 *dma_handle = pci_map_single(hwdev, skb->data, RX_BUF_SIZE,
538 PCI_DMA_FROMDEVICE); 538 PCI_DMA_FROMDEVICE);
539 if (pci_dma_mapping_error(*dma_handle)) { 539 if (pci_dma_mapping_error(hwdev, *dma_handle)) {
540 dev_kfree_skb_any(skb); 540 dev_kfree_skb_any(skb);
541 return NULL; 541 return NULL;
542 } 542 }
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 217d506527a9..d9769c527346 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -1166,7 +1166,7 @@ ath5k_rxbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1166 bf->skb = skb; 1166 bf->skb = skb;
1167 bf->skbaddr = pci_map_single(sc->pdev, 1167 bf->skbaddr = pci_map_single(sc->pdev,
1168 skb->data, sc->rxbufsize, PCI_DMA_FROMDEVICE); 1168 skb->data, sc->rxbufsize, PCI_DMA_FROMDEVICE);
1169 if (unlikely(pci_dma_mapping_error(bf->skbaddr))) { 1169 if (unlikely(pci_dma_mapping_error(sc->pdev, bf->skbaddr))) {
1170 ATH5K_ERR(sc, "%s: DMA mapping failed\n", __func__); 1170 ATH5K_ERR(sc, "%s: DMA mapping failed\n", __func__);
1171 dev_kfree_skb(skb); 1171 dev_kfree_skb(skb);
1172 bf->skb = NULL; 1172 bf->skb = NULL;
@@ -1918,7 +1918,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
1918 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "skb %p [data %p len %u] " 1918 ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "skb %p [data %p len %u] "
1919 "skbaddr %llx\n", skb, skb->data, skb->len, 1919 "skbaddr %llx\n", skb, skb->data, skb->len,
1920 (unsigned long long)bf->skbaddr); 1920 (unsigned long long)bf->skbaddr);
1921 if (pci_dma_mapping_error(bf->skbaddr)) { 1921 if (pci_dma_mapping_error(sc->pdev, bf->skbaddr)) {
1922 ATH5K_ERR(sc, "beacon DMA mapping failed\n"); 1922 ATH5K_ERR(sc, "beacon DMA mapping failed\n");
1923 return -EIO; 1923 return -EIO;
1924 } 1924 }
diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c
index 0338b0912674..e97059415ab4 100644
--- a/drivers/parport/ieee1284.c
+++ b/drivers/parport/ieee1284.c
@@ -199,8 +199,6 @@ int parport_wait_peripheral(struct parport *port,
199 /* 40ms of slow polling. */ 199 /* 40ms of slow polling. */
200 deadline = jiffies + msecs_to_jiffies(40); 200 deadline = jiffies + msecs_to_jiffies(40);
201 while (time_before (jiffies, deadline)) { 201 while (time_before (jiffies, deadline)) {
202 int ret;
203
204 if (signal_pending (current)) 202 if (signal_pending (current))
205 return -EINTR; 203 return -EINTR;
206 204
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 802a81d47367..00e1d9620f7c 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -235,7 +235,7 @@ failed:
235 235
236======================================================================*/ 236======================================================================*/
237 237
238void parport_cs_release(struct pcmcia_device *link) 238static void parport_cs_release(struct pcmcia_device *link)
239{ 239{
240 parport_info_t *info = link->priv; 240 parport_info_t *info = link->priv;
241 241
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index e0c2a4584ec6..8a846adf1dcf 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -2867,7 +2867,7 @@ static struct parport_pc_pci {
2867 * and 840 locks up if you write 1 to bit 2! */ 2867 * and 840 locks up if you write 1 to bit 2! */
2868 /* oxsemi_952 */ { 1, { { 0, 1 }, } }, 2868 /* oxsemi_952 */ { 1, { { 0, 1 }, } },
2869 /* oxsemi_954 */ { 1, { { 0, -1 }, } }, 2869 /* oxsemi_954 */ { 1, { { 0, -1 }, } },
2870 /* oxsemi_840 */ { 1, { { 0, -1 }, } }, 2870 /* oxsemi_840 */ { 1, { { 0, 1 }, } },
2871 /* aks_0100 */ { 1, { { 0, -1 }, } }, 2871 /* aks_0100 */ { 1, { { 0, -1 }, } },
2872 /* mobility_pp */ { 1, { { 0, 1 }, } }, 2872 /* mobility_pp */ { 1, { { 0, 1 }, } },
2873 /* netmos_9705 */ { 1, { { 0, -1 }, } }, /* untested */ 2873 /* netmos_9705 */ { 1, { { 0, -1 }, } }, /* untested */
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
index d950fc34320a..554e11f9e1ce 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -429,9 +429,6 @@ struct parport_default_sysctl_table
429 ctl_table dev_dir[2]; 429 ctl_table dev_dir[2];
430}; 430};
431 431
432extern unsigned long parport_default_timeslice;
433extern int parport_default_spintime;
434
435static struct parport_default_sysctl_table 432static struct parport_default_sysctl_table
436parport_default_sysctl_table = { 433parport_default_sysctl_table = {
437 .sysctl_header = NULL, 434 .sysctl_header = NULL,
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index e3fa9a2d9a3d..9fd7bb9b7dce 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -19,7 +19,6 @@ struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id);
19int pnp_interface_attach_device(struct pnp_dev *dev); 19int pnp_interface_attach_device(struct pnp_dev *dev);
20 20
21int pnp_add_card(struct pnp_card *card); 21int pnp_add_card(struct pnp_card *card);
22struct pnp_id *pnp_add_card_id(struct pnp_card *card, char *id);
23void pnp_remove_card(struct pnp_card *card); 22void pnp_remove_card(struct pnp_card *card);
24int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); 23int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
25void pnp_remove_card_device(struct pnp_dev *dev); 24void pnp_remove_card_device(struct pnp_dev *dev);
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index a762a4176736..e75b060daa95 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -8,6 +8,7 @@
8#include <linux/ctype.h> 8#include <linux/ctype.h>
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/pnp.h> 10#include <linux/pnp.h>
11#include <linux/dma-mapping.h>
11#include "base.h" 12#include "base.h"
12 13
13LIST_HEAD(pnp_cards); 14LIST_HEAD(pnp_cards);
@@ -101,7 +102,7 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
101 * @id: pointer to a pnp_id structure 102 * @id: pointer to a pnp_id structure
102 * @card: pointer to the desired card 103 * @card: pointer to the desired card
103 */ 104 */
104struct pnp_id *pnp_add_card_id(struct pnp_card *card, char *id) 105static struct pnp_id *pnp_add_card_id(struct pnp_card *card, char *id)
105{ 106{
106 struct pnp_id *dev_id, *ptr; 107 struct pnp_id *dev_id, *ptr;
107 108
@@ -167,6 +168,9 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnp
167 sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, 168 sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number,
168 card->number); 169 card->number);
169 170
171 card->dev.coherent_dma_mask = DMA_24BIT_MASK;
172 card->dev.dma_mask = &card->dev.coherent_dma_mask;
173
170 dev_id = pnp_add_card_id(card, pnpid); 174 dev_id = pnp_add_card_id(card, pnpid);
171 if (!dev_id) { 175 if (!dev_id) {
172 kfree(card); 176 kfree(card);
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 55f55ed72dc7..0bdf9b8a5e58 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -245,15 +245,17 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
245 */ 245 */
246 for_each_pci_dev(pdev) { 246 for_each_pci_dev(pdev) {
247 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 247 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
248 if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM) || 248 unsigned int type;
249 pci_resource_len(pdev, i) == 0) 249
250 type = pci_resource_flags(pdev, i) &
251 (IORESOURCE_IO | IORESOURCE_MEM);
252 if (!type || pci_resource_len(pdev, i) == 0)
250 continue; 253 continue;
251 254
252 pci_start = pci_resource_start(pdev, i); 255 pci_start = pci_resource_start(pdev, i);
253 pci_end = pci_resource_end(pdev, i); 256 pci_end = pci_resource_end(pdev, i);
254 for (j = 0; 257 for (j = 0;
255 (res = pnp_get_resource(dev, IORESOURCE_MEM, j)); 258 (res = pnp_get_resource(dev, type, j)); j++) {
256 j++) {
257 if (res->start == 0 && res->end == 0) 259 if (res->start == 0 && res->end == 0)
258 continue; 260 continue;
259 261
@@ -283,9 +285,10 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
283 * the PCI region, and that might prevent a PCI 285 * the PCI region, and that might prevent a PCI
284 * driver from requesting its resources. 286 * driver from requesting its resources.
285 */ 287 */
286 dev_warn(&dev->dev, "mem resource " 288 dev_warn(&dev->dev, "%s resource "
287 "(0x%llx-0x%llx) overlaps %s BAR %d " 289 "(0x%llx-0x%llx) overlaps %s BAR %d "
288 "(0x%llx-0x%llx), disabling\n", 290 "(0x%llx-0x%llx), disabling\n",
291 pnp_resource_type_name(res),
289 (unsigned long long) pnp_start, 292 (unsigned long long) pnp_start,
290 (unsigned long long) pnp_end, 293 (unsigned long long) pnp_end,
291 pci_name(pdev), i, 294 pci_name(pdev), i,
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index c4a7c06793c5..61f8fdea2d96 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -3525,7 +3525,7 @@ static int ibmvfc_init_crq(struct ibmvfc_host *vhost)
3525 crq->msg_token = dma_map_single(dev, crq->msgs, 3525 crq->msg_token = dma_map_single(dev, crq->msgs,
3526 PAGE_SIZE, DMA_BIDIRECTIONAL); 3526 PAGE_SIZE, DMA_BIDIRECTIONAL);
3527 3527
3528 if (dma_mapping_error(crq->msg_token)) 3528 if (dma_mapping_error(dev, crq->msg_token))
3529 goto map_failed; 3529 goto map_failed;
3530 3530
3531 retrc = rc = plpar_hcall_norets(H_REG_CRQ, vdev->unit_address, 3531 retrc = rc = plpar_hcall_norets(H_REG_CRQ, vdev->unit_address,
@@ -3618,7 +3618,7 @@ static int ibmvfc_alloc_mem(struct ibmvfc_host *vhost)
3618 async_q->size * sizeof(*async_q->msgs), 3618 async_q->size * sizeof(*async_q->msgs),
3619 DMA_BIDIRECTIONAL); 3619 DMA_BIDIRECTIONAL);
3620 3620
3621 if (dma_mapping_error(async_q->msg_token)) { 3621 if (dma_mapping_error(dev, async_q->msg_token)) {
3622 dev_err(dev, "Failed to map async queue\n"); 3622 dev_err(dev, "Failed to map async queue\n");
3623 goto free_async_crq; 3623 goto free_async_crq;
3624 } 3624 }
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 20000ec79b04..6b24b9cdb04c 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -859,7 +859,7 @@ static void send_mad_adapter_info(struct ibmvscsi_host_data *hostdata)
859 sizeof(hostdata->madapter_info), 859 sizeof(hostdata->madapter_info),
860 DMA_BIDIRECTIONAL); 860 DMA_BIDIRECTIONAL);
861 861
862 if (dma_mapping_error(req->buffer)) { 862 if (dma_mapping_error(hostdata->dev, req->buffer)) {
863 if (!firmware_has_feature(FW_FEATURE_CMO)) 863 if (!firmware_has_feature(FW_FEATURE_CMO))
864 dev_err(hostdata->dev, 864 dev_err(hostdata->dev,
865 "Unable to map request_buffer for " 865 "Unable to map request_buffer for "
@@ -1407,7 +1407,7 @@ static int ibmvscsi_do_host_config(struct ibmvscsi_host_data *hostdata,
1407 length, 1407 length,
1408 DMA_BIDIRECTIONAL); 1408 DMA_BIDIRECTIONAL);
1409 1409
1410 if (dma_mapping_error(host_config->buffer)) { 1410 if (dma_mapping_error(hostdata->dev, host_config->buffer)) {
1411 if (!firmware_has_feature(FW_FEATURE_CMO)) 1411 if (!firmware_has_feature(FW_FEATURE_CMO))
1412 dev_err(hostdata->dev, 1412 dev_err(hostdata->dev,
1413 "dma_mapping error getting host config\n"); 1413 "dma_mapping error getting host config\n");
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c
index 3b9514c8f1f1..2e13ec00172a 100644
--- a/drivers/scsi/ibmvscsi/ibmvstgt.c
+++ b/drivers/scsi/ibmvscsi/ibmvstgt.c
@@ -564,7 +564,7 @@ static int crq_queue_create(struct crq_queue *queue, struct srp_target *target)
564 queue->size * sizeof(*queue->msgs), 564 queue->size * sizeof(*queue->msgs),
565 DMA_BIDIRECTIONAL); 565 DMA_BIDIRECTIONAL);
566 566
567 if (dma_mapping_error(queue->msg_token)) 567 if (dma_mapping_error(target->dev, queue->msg_token))
568 goto map_failed; 568 goto map_failed;
569 569
570 err = h_reg_crq(vport->dma_dev->unit_address, queue->msg_token, 570 err = h_reg_crq(vport->dma_dev->unit_address, queue->msg_token,
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 182146100dc1..462a8574dad9 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -253,7 +253,7 @@ static int rpavscsi_init_crq_queue(struct crq_queue *queue,
253 queue->size * sizeof(*queue->msgs), 253 queue->size * sizeof(*queue->msgs),
254 DMA_BIDIRECTIONAL); 254 DMA_BIDIRECTIONAL);
255 255
256 if (dma_mapping_error(queue->msg_token)) 256 if (dma_mapping_error(hostdata->dev, queue->msg_token))
257 goto map_failed; 257 goto map_failed;
258 258
259 gather_partition_info(); 259 gather_partition_info();
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index e81d59d78910..0c7165660853 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -313,14 +313,14 @@ atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer)
313 xfer->tx_dma = dma_map_single(dev, 313 xfer->tx_dma = dma_map_single(dev,
314 (void *) xfer->tx_buf, xfer->len, 314 (void *) xfer->tx_buf, xfer->len,
315 DMA_TO_DEVICE); 315 DMA_TO_DEVICE);
316 if (dma_mapping_error(xfer->tx_dma)) 316 if (dma_mapping_error(dev, xfer->tx_dma))
317 return -ENOMEM; 317 return -ENOMEM;
318 } 318 }
319 if (xfer->rx_buf) { 319 if (xfer->rx_buf) {
320 xfer->rx_dma = dma_map_single(dev, 320 xfer->rx_dma = dma_map_single(dev,
321 xfer->rx_buf, xfer->len, 321 xfer->rx_buf, xfer->len,
322 DMA_FROM_DEVICE); 322 DMA_FROM_DEVICE);
323 if (dma_mapping_error(xfer->rx_dma)) { 323 if (dma_mapping_error(dev, xfer->rx_dma)) {
324 if (xfer->tx_buf) 324 if (xfer->tx_buf)
325 dma_unmap_single(dev, 325 dma_unmap_single(dev,
326 xfer->tx_dma, xfer->len, 326 xfer->tx_dma, xfer->len,
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/au1550_spi.c
index 9149689c79d9..87b73e0169c5 100644
--- a/drivers/spi/au1550_spi.c
+++ b/drivers/spi/au1550_spi.c
@@ -334,7 +334,7 @@ static int au1550_spi_dma_rxtmp_alloc(struct au1550_spi *hw, unsigned size)
334 hw->dma_rx_tmpbuf_size = size; 334 hw->dma_rx_tmpbuf_size = size;
335 hw->dma_rx_tmpbuf_addr = dma_map_single(hw->dev, hw->dma_rx_tmpbuf, 335 hw->dma_rx_tmpbuf_addr = dma_map_single(hw->dev, hw->dma_rx_tmpbuf,
336 size, DMA_FROM_DEVICE); 336 size, DMA_FROM_DEVICE);
337 if (dma_mapping_error(hw->dma_rx_tmpbuf_addr)) { 337 if (dma_mapping_error(hw->dev, hw->dma_rx_tmpbuf_addr)) {
338 kfree(hw->dma_rx_tmpbuf); 338 kfree(hw->dma_rx_tmpbuf);
339 hw->dma_rx_tmpbuf = 0; 339 hw->dma_rx_tmpbuf = 0;
340 hw->dma_rx_tmpbuf_size = 0; 340 hw->dma_rx_tmpbuf_size = 0;
@@ -378,7 +378,7 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t)
378 dma_rx_addr = dma_map_single(hw->dev, 378 dma_rx_addr = dma_map_single(hw->dev,
379 (void *)t->rx_buf, 379 (void *)t->rx_buf,
380 t->len, DMA_FROM_DEVICE); 380 t->len, DMA_FROM_DEVICE);
381 if (dma_mapping_error(dma_rx_addr)) 381 if (dma_mapping_error(hw->dev, dma_rx_addr))
382 dev_err(hw->dev, "rx dma map error\n"); 382 dev_err(hw->dev, "rx dma map error\n");
383 } 383 }
384 } else { 384 } else {
@@ -401,7 +401,7 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t)
401 dma_tx_addr = dma_map_single(hw->dev, 401 dma_tx_addr = dma_map_single(hw->dev,
402 (void *)t->tx_buf, 402 (void *)t->tx_buf,
403 t->len, DMA_TO_DEVICE); 403 t->len, DMA_TO_DEVICE);
404 if (dma_mapping_error(dma_tx_addr)) 404 if (dma_mapping_error(hw->dev, dma_tx_addr))
405 dev_err(hw->dev, "tx dma map error\n"); 405 dev_err(hw->dev, "tx dma map error\n");
406 } 406 }
407 } else { 407 } else {
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index b1cc148036c1..f6f987bb71ca 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -836,7 +836,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m)
836 if (tx_buf != NULL) { 836 if (tx_buf != NULL) {
837 t->tx_dma = dma_map_single(&spi->dev, (void *) tx_buf, 837 t->tx_dma = dma_map_single(&spi->dev, (void *) tx_buf,
838 len, DMA_TO_DEVICE); 838 len, DMA_TO_DEVICE);
839 if (dma_mapping_error(t->tx_dma)) { 839 if (dma_mapping_error(&spi->dev, t->tx_dma)) {
840 dev_dbg(&spi->dev, "dma %cX %d bytes error\n", 840 dev_dbg(&spi->dev, "dma %cX %d bytes error\n",
841 'T', len); 841 'T', len);
842 return -EINVAL; 842 return -EINVAL;
@@ -845,7 +845,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m)
845 if (rx_buf != NULL) { 845 if (rx_buf != NULL) {
846 t->rx_dma = dma_map_single(&spi->dev, rx_buf, t->len, 846 t->rx_dma = dma_map_single(&spi->dev, rx_buf, t->len,
847 DMA_FROM_DEVICE); 847 DMA_FROM_DEVICE);
848 if (dma_mapping_error(t->rx_dma)) { 848 if (dma_mapping_error(&spi->dev, t->rx_dma)) {
849 dev_dbg(&spi->dev, "dma %cX %d bytes error\n", 849 dev_dbg(&spi->dev, "dma %cX %d bytes error\n",
850 'R', len); 850 'R', len);
851 if (tx_buf != NULL) 851 if (tx_buf != NULL)
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 0c452c46ab07..067299d6d192 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -353,7 +353,7 @@ static int map_dma_buffers(struct driver_data *drv_data)
353 drv_data->rx_dma = dma_map_single(dev, drv_data->rx, 353 drv_data->rx_dma = dma_map_single(dev, drv_data->rx,
354 drv_data->rx_map_len, 354 drv_data->rx_map_len,
355 DMA_FROM_DEVICE); 355 DMA_FROM_DEVICE);
356 if (dma_mapping_error(drv_data->rx_dma)) 356 if (dma_mapping_error(dev, drv_data->rx_dma))
357 return 0; 357 return 0;
358 358
359 /* Stream map the tx buffer */ 359 /* Stream map the tx buffer */
@@ -361,7 +361,7 @@ static int map_dma_buffers(struct driver_data *drv_data)
361 drv_data->tx_map_len, 361 drv_data->tx_map_len,
362 DMA_TO_DEVICE); 362 DMA_TO_DEVICE);
363 363
364 if (dma_mapping_error(drv_data->tx_dma)) { 364 if (dma_mapping_error(dev, drv_data->tx_dma)) {
365 dma_unmap_single(dev, drv_data->rx_dma, 365 dma_unmap_single(dev, drv_data->rx_dma,
366 drv_data->rx_map_len, DMA_FROM_DEVICE); 366 drv_data->rx_map_len, DMA_FROM_DEVICE);
367 return 0; 367 return 0;
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c
index 54ac7bea5f8c..6fb77fcc4971 100644
--- a/drivers/spi/spi_imx.c
+++ b/drivers/spi/spi_imx.c
@@ -491,7 +491,7 @@ static int map_dma_buffers(struct driver_data *drv_data)
491 buf, 491 buf,
492 drv_data->tx_map_len, 492 drv_data->tx_map_len,
493 DMA_TO_DEVICE); 493 DMA_TO_DEVICE);
494 if (dma_mapping_error(drv_data->tx_dma)) 494 if (dma_mapping_error(dev, drv_data->tx_dma))
495 return -1; 495 return -1;
496 496
497 drv_data->tx_dma_needs_unmap = 1; 497 drv_data->tx_dma_needs_unmap = 1;
@@ -516,7 +516,7 @@ static int map_dma_buffers(struct driver_data *drv_data)
516 buf, 516 buf,
517 drv_data->len, 517 drv_data->len,
518 DMA_FROM_DEVICE); 518 DMA_FROM_DEVICE);
519 if (dma_mapping_error(drv_data->rx_dma)) 519 if (dma_mapping_error(dev, drv_data->rx_dma))
520 return -1; 520 return -1;
521 drv_data->rx_dma_needs_unmap = 1; 521 drv_data->rx_dma_needs_unmap = 1;
522 } 522 }
@@ -534,7 +534,7 @@ static int map_dma_buffers(struct driver_data *drv_data)
534 buf, 534 buf,
535 drv_data->tx_map_len, 535 drv_data->tx_map_len,
536 DMA_TO_DEVICE); 536 DMA_TO_DEVICE);
537 if (dma_mapping_error(drv_data->tx_dma)) { 537 if (dma_mapping_error(dev, drv_data->tx_dma)) {
538 if (drv_data->rx_dma) { 538 if (drv_data->rx_dma) {
539 dma_unmap_single(dev, 539 dma_unmap_single(dev,
540 drv_data->rx_dma, 540 drv_data->rx_dma,
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 5e3e4e9b6c77..1f715436d6d3 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -87,7 +87,7 @@ struct mon_reader_text {
87 87
88static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */ 88static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */
89 89
90static void mon_text_ctor(struct kmem_cache *, void *); 90static void mon_text_ctor(void *);
91 91
92struct mon_text_ptr { 92struct mon_text_ptr {
93 int cnt, limit; 93 int cnt, limit;
@@ -720,7 +720,7 @@ void mon_text_del(struct mon_bus *mbus)
720/* 720/*
721 * Slab interface: constructor. 721 * Slab interface: constructor.
722 */ 722 */
723static void mon_text_ctor(struct kmem_cache *slab, void *mem) 723static void mon_text_ctor(void *mem)
724{ 724{
725 /* 725 /*
726 * Nothing to initialize. No, really! 726 * Nothing to initialize. No, really!
diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
index a11cc2fdd4cd..4055dbdd1b42 100644
--- a/drivers/video/console/sticon.c
+++ b/drivers/video/console/sticon.c
@@ -370,7 +370,7 @@ static const struct consw sti_con = {
370 370
371 371
372 372
373int __init sticonsole_init(void) 373static int __init sticonsole_init(void)
374{ 374{
375 /* already initialized ? */ 375 /* already initialized ? */
376 if (sticon_sti) 376 if (sticon_sti)
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index e9ab657f0bb7..d7822af0e00a 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -29,7 +29,7 @@
29 29
30#define STI_DRIVERVERSION "Version 0.9a" 30#define STI_DRIVERVERSION "Version 0.9a"
31 31
32struct sti_struct *default_sti __read_mostly; 32static struct sti_struct *default_sti __read_mostly;
33 33
34/* number of STI ROMS found and their ptrs to each struct */ 34/* number of STI ROMS found and their ptrs to each struct */
35static int num_sti_roms __read_mostly; 35static int num_sti_roms __read_mostly;
@@ -68,8 +68,7 @@ static const struct sti_init_flags default_init_flags = {
68 .init_cmap_tx = 1, 68 .init_cmap_tx = 1,
69}; 69};
70 70
71int 71static int sti_init_graph(struct sti_struct *sti)
72sti_init_graph(struct sti_struct *sti)
73{ 72{
74 struct sti_init_inptr_ext inptr_ext = { 0, }; 73 struct sti_init_inptr_ext inptr_ext = { 0, };
75 struct sti_init_inptr inptr = { 74 struct sti_init_inptr inptr = {
@@ -100,8 +99,7 @@ static const struct sti_conf_flags default_conf_flags = {
100 .wait = STI_WAIT, 99 .wait = STI_WAIT,
101}; 100};
102 101
103void 102static void sti_inq_conf(struct sti_struct *sti)
104sti_inq_conf(struct sti_struct *sti)
105{ 103{
106 struct sti_conf_inptr inptr = { 0, }; 104 struct sti_conf_inptr inptr = { 0, };
107 unsigned long flags; 105 unsigned long flags;
@@ -237,8 +235,8 @@ static void sti_flush(unsigned long start, unsigned long end)
237 flush_icache_range(start, end); 235 flush_icache_range(start, end);
238} 236}
239 237
240void __devinit 238static void __devinit sti_rom_copy(unsigned long base, unsigned long count,
241sti_rom_copy(unsigned long base, unsigned long count, void *dest) 239 void *dest)
242{ 240{
243 unsigned long dest_start = (unsigned long) dest; 241 unsigned long dest_start = (unsigned long) dest;
244 242
@@ -478,8 +476,8 @@ sti_init_glob_cfg(struct sti_struct *sti,
478} 476}
479 477
480#ifdef CONFIG_FB 478#ifdef CONFIG_FB
481struct sti_cooked_font * __devinit 479static struct sti_cooked_font __devinit
482sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) 480*sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
483{ 481{
484 const struct font_desc *fbfont; 482 const struct font_desc *fbfont;
485 unsigned int size, bpc; 483 unsigned int size, bpc;
@@ -534,16 +532,16 @@ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
534 return cooked_font; 532 return cooked_font;
535} 533}
536#else 534#else
537struct sti_cooked_font * __devinit 535static struct sti_cooked_font __devinit
538sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) 536*sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
539{ 537{
540 return NULL; 538 return NULL;
541} 539}
542#endif 540#endif
543 541
544struct sti_cooked_font * __devinit 542static struct sti_cooked_font __devinit
545sti_select_font(struct sti_cooked_rom *rom, 543*sti_select_font(struct sti_cooked_rom *rom,
546 int (*search_font_fnc) (struct sti_cooked_rom *,int,int) ) 544 int (*search_font_fnc)(struct sti_cooked_rom *, int, int))
547{ 545{
548 struct sti_cooked_font *font; 546 struct sti_cooked_font *font;
549 int i; 547 int i;
@@ -707,8 +705,7 @@ sti_get_bmode_rom (unsigned long address)
707 return raw; 705 return raw;
708} 706}
709 707
710struct sti_rom * __devinit 708static struct sti_rom __devinit *sti_get_wmode_rom(unsigned long address)
711sti_get_wmode_rom (unsigned long address)
712{ 709{
713 struct sti_rom *raw; 710 struct sti_rom *raw;
714 unsigned long size; 711 unsigned long size;
@@ -723,8 +720,8 @@ sti_get_wmode_rom (unsigned long address)
723 return raw; 720 return raw;
724} 721}
725 722
726int __devinit 723static int __devinit sti_read_rom(int wordmode, struct sti_struct *sti,
727sti_read_rom(int wordmode, struct sti_struct *sti, unsigned long address) 724 unsigned long address)
728{ 725{
729 struct sti_cooked_rom *cooked; 726 struct sti_cooked_rom *cooked;
730 struct sti_rom *raw = NULL; 727 struct sti_rom *raw = NULL;
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 5d84b3431098..6b487801eeae 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -35,7 +35,6 @@
35#include <linux/device.h> 35#include <linux/device.h>
36#include <linux/efi.h> 36#include <linux/efi.h>
37#include <linux/fb.h> 37#include <linux/fb.h>
38#include <linux/major.h>
39 38
40#include <asm/fb.h> 39#include <asm/fb.h>
41 40
diff --git a/drivers/video/macfb.c b/drivers/video/macfb.c
index aa8c714d6245..b790ddff76f9 100644
--- a/drivers/video/macfb.c
+++ b/drivers/video/macfb.c
@@ -596,7 +596,7 @@ static struct fb_ops macfb_ops = {
596 .fb_imageblit = cfb_imageblit, 596 .fb_imageblit = cfb_imageblit,
597}; 597};
598 598
599void __init macfb_setup(char *options) 599static void __init macfb_setup(char *options)
600{ 600{
601 char *this_opt; 601 char *this_opt;
602 602
diff --git a/drivers/video/sticore.h b/drivers/video/sticore.h
index 1a9a60c74be3..7fe5be4bc70e 100644
--- a/drivers/video/sticore.h
+++ b/drivers/video/sticore.h
@@ -352,8 +352,6 @@ struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */
352 352
353/* functions to call the STI ROM directly */ 353/* functions to call the STI ROM directly */
354 354
355int sti_init_graph(struct sti_struct *sti);
356void sti_inq_conf(struct sti_struct *sti);
357void sti_putc(struct sti_struct *sti, int c, int y, int x); 355void sti_putc(struct sti_struct *sti, int c, int y, int x);
358void sti_set(struct sti_struct *sti, int src_y, int src_x, 356void sti_set(struct sti_struct *sti, int src_y, int src_x,
359 int height, int width, u8 color); 357 int height, int width, u8 color);
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c
index 598d35eff935..166481402412 100644
--- a/drivers/video/stifb.c
+++ b/drivers/video/stifb.c
@@ -1078,8 +1078,7 @@ static struct fb_ops stifb_ops = {
1078 * Initialization 1078 * Initialization
1079 */ 1079 */
1080 1080
1081int __init 1081static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1082stifb_init_fb(struct sti_struct *sti, int bpp_pref)
1083{ 1082{
1084 struct fb_fix_screeninfo *fix; 1083 struct fb_fix_screeninfo *fix;
1085 struct fb_var_screeninfo *var; 1084 struct fb_var_screeninfo *var;
@@ -1315,8 +1314,7 @@ static int stifb_disabled __initdata;
1315int __init 1314int __init
1316stifb_setup(char *options); 1315stifb_setup(char *options);
1317 1316
1318int __init 1317static int __init stifb_init(void)
1319stifb_init(void)
1320{ 1318{
1321 struct sti_struct *sti; 1319 struct sti_struct *sti;
1322 struct sti_struct *def_sti; 1320 struct sti_struct *def_sti;
diff --git a/fs/Kconfig b/fs/Kconfig
index 97e3bdedb1e6..d3873583360b 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1383,6 +1383,19 @@ config MINIX_FS
1383 partition (the one containing the directory /) cannot be compiled as 1383 partition (the one containing the directory /) cannot be compiled as
1384 a module. 1384 a module.
1385 1385
1386config OMFS_FS
1387 tristate "SonicBlue Optimized MPEG File System support"
1388 depends on BLOCK
1389 select CRC_ITU_T
1390 help
1391 This is the proprietary file system used by the Rio Karma music
1392 player and ReplayTV DVR. Despite the name, this filesystem is not
1393 more efficient than a standard FS for MPEG files, in fact likely
1394 the opposite is true. Say Y if you have either of these devices
1395 and wish to mount its disk.
1396
1397 To compile this file system support as a module, choose M here: the
1398 module will be called omfs. If unsure, say N.
1386 1399
1387config HPFS_FS 1400config HPFS_FS
1388 tristate "OS/2 HPFS file system support" 1401 tristate "OS/2 HPFS file system support"
diff --git a/fs/Makefile b/fs/Makefile
index 3b2178b4bb66..a1482a5eff15 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -111,6 +111,7 @@ obj-$(CONFIG_ADFS_FS) += adfs/
111obj-$(CONFIG_FUSE_FS) += fuse/ 111obj-$(CONFIG_FUSE_FS) += fuse/
112obj-$(CONFIG_UDF_FS) += udf/ 112obj-$(CONFIG_UDF_FS) += udf/
113obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ 113obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/
114obj-$(CONFIG_OMFS_FS) += omfs/
114obj-$(CONFIG_JFS_FS) += jfs/ 115obj-$(CONFIG_JFS_FS) += jfs/
115obj-$(CONFIG_XFS_FS) += xfs/ 116obj-$(CONFIG_XFS_FS) += xfs/
116obj-$(CONFIG_9P_FS) += 9p/ 117obj-$(CONFIG_9P_FS) += 9p/
diff --git a/fs/adfs/super.c b/fs/adfs/super.c
index 9e421eeb672b..26f3b43726bb 100644
--- a/fs/adfs/super.c
+++ b/fs/adfs/super.c
@@ -249,7 +249,7 @@ static void adfs_destroy_inode(struct inode *inode)
249 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode)); 249 kmem_cache_free(adfs_inode_cachep, ADFS_I(inode));
250} 250}
251 251
252static void init_once(struct kmem_cache *cachep, void *foo) 252static void init_once(void *foo)
253{ 253{
254 struct adfs_inode_info *ei = (struct adfs_inode_info *) foo; 254 struct adfs_inode_info *ei = (struct adfs_inode_info *) foo;
255 255
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index 223b1917093e..e9ec915f7553 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -2,6 +2,7 @@
2#include <linux/fs.h> 2#include <linux/fs.h>
3#include <linux/buffer_head.h> 3#include <linux/buffer_head.h>
4#include <linux/amigaffs.h> 4#include <linux/amigaffs.h>
5#include <linux/mutex.h>
5 6
6/* AmigaOS allows file names with up to 30 characters length. 7/* AmigaOS allows file names with up to 30 characters length.
7 * Names longer than that will be silently truncated. If you 8 * Names longer than that will be silently truncated. If you
@@ -98,7 +99,7 @@ struct affs_sb_info {
98 gid_t s_gid; /* gid to override */ 99 gid_t s_gid; /* gid to override */
99 umode_t s_mode; /* mode to override */ 100 umode_t s_mode; /* mode to override */
100 struct buffer_head *s_root_bh; /* Cached root block. */ 101 struct buffer_head *s_root_bh; /* Cached root block. */
101 struct semaphore s_bmlock; /* Protects bitmap access. */ 102 struct mutex s_bmlock; /* Protects bitmap access. */
102 struct affs_bm_info *s_bitmap; /* Bitmap infos. */ 103 struct affs_bm_info *s_bitmap; /* Bitmap infos. */
103 u32 s_bmap_count; /* # of bitmap blocks. */ 104 u32 s_bmap_count; /* # of bitmap blocks. */
104 u32 s_bmap_bits; /* # of bits in one bitmap blocks */ 105 u32 s_bmap_bits; /* # of bits in one bitmap blocks */
diff --git a/fs/affs/bitmap.c b/fs/affs/bitmap.c
index c4a5ad09ddf2..dc5ef14bdc1c 100644
--- a/fs/affs/bitmap.c
+++ b/fs/affs/bitmap.c
@@ -45,14 +45,14 @@ affs_count_free_blocks(struct super_block *sb)
45 if (sb->s_flags & MS_RDONLY) 45 if (sb->s_flags & MS_RDONLY)
46 return 0; 46 return 0;
47 47
48 down(&AFFS_SB(sb)->s_bmlock); 48 mutex_lock(&AFFS_SB(sb)->s_bmlock);
49 49
50 bm = AFFS_SB(sb)->s_bitmap; 50 bm = AFFS_SB(sb)->s_bitmap;
51 free = 0; 51 free = 0;
52 for (i = AFFS_SB(sb)->s_bmap_count; i > 0; bm++, i--) 52 for (i = AFFS_SB(sb)->s_bmap_count; i > 0; bm++, i--)
53 free += bm->bm_free; 53 free += bm->bm_free;
54 54
55 up(&AFFS_SB(sb)->s_bmlock); 55 mutex_unlock(&AFFS_SB(sb)->s_bmlock);
56 56
57 return free; 57 return free;
58} 58}
@@ -76,7 +76,7 @@ affs_free_block(struct super_block *sb, u32 block)
76 bit = blk % sbi->s_bmap_bits; 76 bit = blk % sbi->s_bmap_bits;
77 bm = &sbi->s_bitmap[bmap]; 77 bm = &sbi->s_bitmap[bmap];
78 78
79 down(&sbi->s_bmlock); 79 mutex_lock(&sbi->s_bmlock);
80 80
81 bh = sbi->s_bmap_bh; 81 bh = sbi->s_bmap_bh;
82 if (sbi->s_last_bmap != bmap) { 82 if (sbi->s_last_bmap != bmap) {
@@ -105,19 +105,19 @@ affs_free_block(struct super_block *sb, u32 block)
105 sb->s_dirt = 1; 105 sb->s_dirt = 1;
106 bm->bm_free++; 106 bm->bm_free++;
107 107
108 up(&sbi->s_bmlock); 108 mutex_unlock(&sbi->s_bmlock);
109 return; 109 return;
110 110
111err_free: 111err_free:
112 affs_warning(sb,"affs_free_block","Trying to free block %u which is already free", block); 112 affs_warning(sb,"affs_free_block","Trying to free block %u which is already free", block);
113 up(&sbi->s_bmlock); 113 mutex_unlock(&sbi->s_bmlock);
114 return; 114 return;
115 115
116err_bh_read: 116err_bh_read:
117 affs_error(sb,"affs_free_block","Cannot read bitmap block %u", bm->bm_key); 117 affs_error(sb,"affs_free_block","Cannot read bitmap block %u", bm->bm_key);
118 sbi->s_bmap_bh = NULL; 118 sbi->s_bmap_bh = NULL;
119 sbi->s_last_bmap = ~0; 119 sbi->s_last_bmap = ~0;
120 up(&sbi->s_bmlock); 120 mutex_unlock(&sbi->s_bmlock);
121 return; 121 return;
122 122
123err_range: 123err_range:
@@ -168,7 +168,7 @@ affs_alloc_block(struct inode *inode, u32 goal)
168 bmap = blk / sbi->s_bmap_bits; 168 bmap = blk / sbi->s_bmap_bits;
169 bm = &sbi->s_bitmap[bmap]; 169 bm = &sbi->s_bitmap[bmap];
170 170
171 down(&sbi->s_bmlock); 171 mutex_lock(&sbi->s_bmlock);
172 172
173 if (bm->bm_free) 173 if (bm->bm_free)
174 goto find_bmap_bit; 174 goto find_bmap_bit;
@@ -249,7 +249,7 @@ find_bit:
249 mark_buffer_dirty(bh); 249 mark_buffer_dirty(bh);
250 sb->s_dirt = 1; 250 sb->s_dirt = 1;
251 251
252 up(&sbi->s_bmlock); 252 mutex_unlock(&sbi->s_bmlock);
253 253
254 pr_debug("%d\n", blk); 254 pr_debug("%d\n", blk);
255 return blk; 255 return blk;
@@ -259,7 +259,7 @@ err_bh_read:
259 sbi->s_bmap_bh = NULL; 259 sbi->s_bmap_bh = NULL;
260 sbi->s_last_bmap = ~0; 260 sbi->s_last_bmap = ~0;
261err_full: 261err_full:
262 up(&sbi->s_bmlock); 262 mutex_unlock(&sbi->s_bmlock);
263 pr_debug("failed\n"); 263 pr_debug("failed\n");
264 return 0; 264 return 0;
265} 265}
diff --git a/fs/affs/super.c b/fs/affs/super.c
index d214837d5e42..3a89094f93d0 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -90,7 +90,7 @@ static void affs_destroy_inode(struct inode *inode)
90 kmem_cache_free(affs_inode_cachep, AFFS_I(inode)); 90 kmem_cache_free(affs_inode_cachep, AFFS_I(inode));
91} 91}
92 92
93static void init_once(struct kmem_cache *cachep, void *foo) 93static void init_once(void *foo)
94{ 94{
95 struct affs_inode_info *ei = (struct affs_inode_info *) foo; 95 struct affs_inode_info *ei = (struct affs_inode_info *) foo;
96 96
@@ -290,7 +290,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
290 if (!sbi) 290 if (!sbi)
291 return -ENOMEM; 291 return -ENOMEM;
292 sb->s_fs_info = sbi; 292 sb->s_fs_info = sbi;
293 init_MUTEX(&sbi->s_bmlock); 293 mutex_init(&sbi->s_bmlock);
294 294
295 if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, 295 if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
296 &blocksize,&sbi->s_prefix, 296 &blocksize,&sbi->s_prefix,
diff --git a/fs/afs/super.c b/fs/afs/super.c
index 7e3faeef6818..250d8c4d66e4 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -27,7 +27,7 @@
27 27
28#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */ 28#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
29 29
30static void afs_i_init_once(struct kmem_cache *cachep, void *foo); 30static void afs_i_init_once(void *foo);
31static int afs_get_sb(struct file_system_type *fs_type, 31static int afs_get_sb(struct file_system_type *fs_type,
32 int flags, const char *dev_name, 32 int flags, const char *dev_name,
33 void *data, struct vfsmount *mnt); 33 void *data, struct vfsmount *mnt);
@@ -449,7 +449,7 @@ static void afs_put_super(struct super_block *sb)
449/* 449/*
450 * initialise an inode cache slab element prior to any use 450 * initialise an inode cache slab element prior to any use
451 */ 451 */
452static void afs_i_init_once(struct kmem_cache *cachep, void *_vnode) 452static void afs_i_init_once(void *_vnode)
453{ 453{
454 struct afs_vnode *vnode = _vnode; 454 struct afs_vnode *vnode = _vnode;
455 455
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index e8717de3bab3..02c6e62b72f8 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -289,7 +289,7 @@ befs_destroy_inode(struct inode *inode)
289 kmem_cache_free(befs_inode_cachep, BEFS_I(inode)); 289 kmem_cache_free(befs_inode_cachep, BEFS_I(inode));
290} 290}
291 291
292static void init_once(struct kmem_cache *cachep, void *foo) 292static void init_once(void *foo)
293{ 293{
294 struct befs_inode_info *bi = (struct befs_inode_info *) foo; 294 struct befs_inode_info *bi = (struct befs_inode_info *) foo;
295 295
diff --git a/fs/bfs/bfs.h b/fs/bfs/bfs.h
index 70f5d3a8eede..7109e451abf7 100644
--- a/fs/bfs/bfs.h
+++ b/fs/bfs/bfs.h
@@ -16,8 +16,9 @@ struct bfs_sb_info {
16 unsigned long si_freei; 16 unsigned long si_freei;
17 unsigned long si_lf_eblk; 17 unsigned long si_lf_eblk;
18 unsigned long si_lasti; 18 unsigned long si_lasti;
19 unsigned long * si_imap; 19 unsigned long *si_imap;
20 struct buffer_head * si_sbh; /* buffer header w/superblock */ 20 struct buffer_head *si_sbh; /* buffer header w/superblock */
21 struct mutex bfs_lock;
21}; 22};
22 23
23/* 24/*
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 034950cb3cbe..87ee5ccee348 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -32,16 +32,17 @@ static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir)
32 struct inode *dir = f->f_path.dentry->d_inode; 32 struct inode *dir = f->f_path.dentry->d_inode;
33 struct buffer_head *bh; 33 struct buffer_head *bh;
34 struct bfs_dirent *de; 34 struct bfs_dirent *de;
35 struct bfs_sb_info *info = BFS_SB(dir->i_sb);
35 unsigned int offset; 36 unsigned int offset;
36 int block; 37 int block;
37 38
38 lock_kernel(); 39 mutex_lock(&info->bfs_lock);
39 40
40 if (f->f_pos & (BFS_DIRENT_SIZE - 1)) { 41 if (f->f_pos & (BFS_DIRENT_SIZE - 1)) {
41 printf("Bad f_pos=%08lx for %s:%08lx\n", 42 printf("Bad f_pos=%08lx for %s:%08lx\n",
42 (unsigned long)f->f_pos, 43 (unsigned long)f->f_pos,
43 dir->i_sb->s_id, dir->i_ino); 44 dir->i_sb->s_id, dir->i_ino);
44 unlock_kernel(); 45 mutex_unlock(&info->bfs_lock);
45 return -EBADF; 46 return -EBADF;
46 } 47 }
47 48
@@ -61,7 +62,7 @@ static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir)
61 le16_to_cpu(de->ino), 62 le16_to_cpu(de->ino),
62 DT_UNKNOWN) < 0) { 63 DT_UNKNOWN) < 0) {
63 brelse(bh); 64 brelse(bh);
64 unlock_kernel(); 65 mutex_unlock(&info->bfs_lock);
65 return 0; 66 return 0;
66 } 67 }
67 } 68 }
@@ -71,7 +72,7 @@ static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir)
71 brelse(bh); 72 brelse(bh);
72 } 73 }
73 74
74 unlock_kernel(); 75 mutex_unlock(&info->bfs_lock);
75 return 0; 76 return 0;
76} 77}
77 78
@@ -95,10 +96,10 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
95 inode = new_inode(s); 96 inode = new_inode(s);
96 if (!inode) 97 if (!inode)
97 return -ENOSPC; 98 return -ENOSPC;
98 lock_kernel(); 99 mutex_lock(&info->bfs_lock);
99 ino = find_first_zero_bit(info->si_imap, info->si_lasti); 100 ino = find_first_zero_bit(info->si_imap, info->si_lasti);
100 if (ino > info->si_lasti) { 101 if (ino > info->si_lasti) {
101 unlock_kernel(); 102 mutex_unlock(&info->bfs_lock);
102 iput(inode); 103 iput(inode);
103 return -ENOSPC; 104 return -ENOSPC;
104 } 105 }
@@ -125,10 +126,10 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
125 if (err) { 126 if (err) {
126 inode_dec_link_count(inode); 127 inode_dec_link_count(inode);
127 iput(inode); 128 iput(inode);
128 unlock_kernel(); 129 mutex_unlock(&info->bfs_lock);
129 return err; 130 return err;
130 } 131 }
131 unlock_kernel(); 132 mutex_unlock(&info->bfs_lock);
132 d_instantiate(dentry, inode); 133 d_instantiate(dentry, inode);
133 return 0; 134 return 0;
134} 135}
@@ -139,22 +140,23 @@ static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
139 struct inode *inode = NULL; 140 struct inode *inode = NULL;
140 struct buffer_head *bh; 141 struct buffer_head *bh;
141 struct bfs_dirent *de; 142 struct bfs_dirent *de;
143 struct bfs_sb_info *info = BFS_SB(dir->i_sb);
142 144
143 if (dentry->d_name.len > BFS_NAMELEN) 145 if (dentry->d_name.len > BFS_NAMELEN)
144 return ERR_PTR(-ENAMETOOLONG); 146 return ERR_PTR(-ENAMETOOLONG);
145 147
146 lock_kernel(); 148 mutex_lock(&info->bfs_lock);
147 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); 149 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de);
148 if (bh) { 150 if (bh) {
149 unsigned long ino = (unsigned long)le16_to_cpu(de->ino); 151 unsigned long ino = (unsigned long)le16_to_cpu(de->ino);
150 brelse(bh); 152 brelse(bh);
151 inode = bfs_iget(dir->i_sb, ino); 153 inode = bfs_iget(dir->i_sb, ino);
152 if (IS_ERR(inode)) { 154 if (IS_ERR(inode)) {
153 unlock_kernel(); 155 mutex_unlock(&info->bfs_lock);
154 return ERR_CAST(inode); 156 return ERR_CAST(inode);
155 } 157 }
156 } 158 }
157 unlock_kernel(); 159 mutex_unlock(&info->bfs_lock);
158 d_add(dentry, inode); 160 d_add(dentry, inode);
159 return NULL; 161 return NULL;
160} 162}
@@ -163,13 +165,14 @@ static int bfs_link(struct dentry *old, struct inode *dir,
163 struct dentry *new) 165 struct dentry *new)
164{ 166{
165 struct inode *inode = old->d_inode; 167 struct inode *inode = old->d_inode;
168 struct bfs_sb_info *info = BFS_SB(inode->i_sb);
166 int err; 169 int err;
167 170
168 lock_kernel(); 171 mutex_lock(&info->bfs_lock);
169 err = bfs_add_entry(dir, new->d_name.name, new->d_name.len, 172 err = bfs_add_entry(dir, new->d_name.name, new->d_name.len,
170 inode->i_ino); 173 inode->i_ino);
171 if (err) { 174 if (err) {
172 unlock_kernel(); 175 mutex_unlock(&info->bfs_lock);
173 return err; 176 return err;
174 } 177 }
175 inc_nlink(inode); 178 inc_nlink(inode);
@@ -177,19 +180,19 @@ static int bfs_link(struct dentry *old, struct inode *dir,
177 mark_inode_dirty(inode); 180 mark_inode_dirty(inode);
178 atomic_inc(&inode->i_count); 181 atomic_inc(&inode->i_count);
179 d_instantiate(new, inode); 182 d_instantiate(new, inode);
180 unlock_kernel(); 183 mutex_unlock(&info->bfs_lock);
181 return 0; 184 return 0;
182} 185}
183 186
184static int bfs_unlink(struct inode *dir, struct dentry *dentry) 187static int bfs_unlink(struct inode *dir, struct dentry *dentry)
185{ 188{
186 int error = -ENOENT; 189 int error = -ENOENT;
187 struct inode *inode; 190 struct inode *inode = dentry->d_inode;
188 struct buffer_head *bh; 191 struct buffer_head *bh;
189 struct bfs_dirent *de; 192 struct bfs_dirent *de;
193 struct bfs_sb_info *info = BFS_SB(inode->i_sb);
190 194
191 inode = dentry->d_inode; 195 mutex_lock(&info->bfs_lock);
192 lock_kernel();
193 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); 196 bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de);
194 if (!bh || (le16_to_cpu(de->ino) != inode->i_ino)) 197 if (!bh || (le16_to_cpu(de->ino) != inode->i_ino))
195 goto out_brelse; 198 goto out_brelse;
@@ -210,7 +213,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
210 213
211out_brelse: 214out_brelse:
212 brelse(bh); 215 brelse(bh);
213 unlock_kernel(); 216 mutex_unlock(&info->bfs_lock);
214 return error; 217 return error;
215} 218}
216 219
@@ -220,6 +223,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
220 struct inode *old_inode, *new_inode; 223 struct inode *old_inode, *new_inode;
221 struct buffer_head *old_bh, *new_bh; 224 struct buffer_head *old_bh, *new_bh;
222 struct bfs_dirent *old_de, *new_de; 225 struct bfs_dirent *old_de, *new_de;
226 struct bfs_sb_info *info;
223 int error = -ENOENT; 227 int error = -ENOENT;
224 228
225 old_bh = new_bh = NULL; 229 old_bh = new_bh = NULL;
@@ -227,7 +231,9 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
227 if (S_ISDIR(old_inode->i_mode)) 231 if (S_ISDIR(old_inode->i_mode))
228 return -EINVAL; 232 return -EINVAL;
229 233
230 lock_kernel(); 234 info = BFS_SB(old_inode->i_sb);
235
236 mutex_lock(&info->bfs_lock);
231 old_bh = bfs_find_entry(old_dir, 237 old_bh = bfs_find_entry(old_dir,
232 old_dentry->d_name.name, 238 old_dentry->d_name.name,
233 old_dentry->d_name.len, &old_de); 239 old_dentry->d_name.len, &old_de);
@@ -264,7 +270,7 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
264 error = 0; 270 error = 0;
265 271
266end_rename: 272end_rename:
267 unlock_kernel(); 273 mutex_unlock(&info->bfs_lock);
268 brelse(old_bh); 274 brelse(old_bh);
269 brelse(new_bh); 275 brelse(new_bh);
270 return error; 276 return error;
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index b11e63e8fbcd..6a021265f018 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -99,7 +99,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
99 return -ENOSPC; 99 return -ENOSPC;
100 100
101 /* The rest has to be protected against itself. */ 101 /* The rest has to be protected against itself. */
102 lock_kernel(); 102 mutex_lock(&info->bfs_lock);
103 103
104 /* 104 /*
105 * If the last data block for this file is the last allocated 105 * If the last data block for this file is the last allocated
@@ -151,7 +151,7 @@ static int bfs_get_block(struct inode *inode, sector_t block,
151 mark_buffer_dirty(sbh); 151 mark_buffer_dirty(sbh);
152 map_bh(bh_result, sb, phys); 152 map_bh(bh_result, sb, phys);
153out: 153out:
154 unlock_kernel(); 154 mutex_unlock(&info->bfs_lock);
155 return err; 155 return err;
156} 156}
157 157
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 8db623838b50..0ed57b5ee012 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -104,6 +104,7 @@ static int bfs_write_inode(struct inode *inode, int unused)
104 struct bfs_inode *di; 104 struct bfs_inode *di;
105 struct buffer_head *bh; 105 struct buffer_head *bh;
106 int block, off; 106 int block, off;
107 struct bfs_sb_info *info = BFS_SB(inode->i_sb);
107 108
108 dprintf("ino=%08x\n", ino); 109 dprintf("ino=%08x\n", ino);
109 110
@@ -112,13 +113,13 @@ static int bfs_write_inode(struct inode *inode, int unused)
112 return -EIO; 113 return -EIO;
113 } 114 }
114 115
115 lock_kernel(); 116 mutex_lock(&info->bfs_lock);
116 block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; 117 block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
117 bh = sb_bread(inode->i_sb, block); 118 bh = sb_bread(inode->i_sb, block);
118 if (!bh) { 119 if (!bh) {
119 printf("Unable to read inode %s:%08x\n", 120 printf("Unable to read inode %s:%08x\n",
120 inode->i_sb->s_id, ino); 121 inode->i_sb->s_id, ino);
121 unlock_kernel(); 122 mutex_unlock(&info->bfs_lock);
122 return -EIO; 123 return -EIO;
123 } 124 }
124 125
@@ -145,7 +146,7 @@ static int bfs_write_inode(struct inode *inode, int unused)
145 146
146 mark_buffer_dirty(bh); 147 mark_buffer_dirty(bh);
147 brelse(bh); 148 brelse(bh);
148 unlock_kernel(); 149 mutex_unlock(&info->bfs_lock);
149 return 0; 150 return 0;
150} 151}
151 152
@@ -170,7 +171,7 @@ static void bfs_delete_inode(struct inode *inode)
170 171
171 inode->i_size = 0; 172 inode->i_size = 0;
172 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; 173 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
173 lock_kernel(); 174 mutex_lock(&info->bfs_lock);
174 mark_inode_dirty(inode); 175 mark_inode_dirty(inode);
175 176
176 block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; 177 block = (ino - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
@@ -178,7 +179,7 @@ static void bfs_delete_inode(struct inode *inode)
178 if (!bh) { 179 if (!bh) {
179 printf("Unable to read inode %s:%08lx\n", 180 printf("Unable to read inode %s:%08lx\n",
180 inode->i_sb->s_id, ino); 181 inode->i_sb->s_id, ino);
181 unlock_kernel(); 182 mutex_unlock(&info->bfs_lock);
182 return; 183 return;
183 } 184 }
184 off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; 185 off = (ino - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
@@ -204,14 +205,16 @@ static void bfs_delete_inode(struct inode *inode)
204 info->si_lf_eblk = bi->i_sblock - 1; 205 info->si_lf_eblk = bi->i_sblock - 1;
205 mark_buffer_dirty(info->si_sbh); 206 mark_buffer_dirty(info->si_sbh);
206 } 207 }
207 unlock_kernel(); 208 mutex_unlock(&info->bfs_lock);
208 clear_inode(inode); 209 clear_inode(inode);
209} 210}
210 211
211static void bfs_put_super(struct super_block *s) 212static void bfs_put_super(struct super_block *s)
212{ 213{
213 struct bfs_sb_info *info = BFS_SB(s); 214 struct bfs_sb_info *info = BFS_SB(s);
215
214 brelse(info->si_sbh); 216 brelse(info->si_sbh);
217 mutex_destroy(&info->bfs_lock);
215 kfree(info->si_imap); 218 kfree(info->si_imap);
216 kfree(info); 219 kfree(info);
217 s->s_fs_info = NULL; 220 s->s_fs_info = NULL;
@@ -236,11 +239,13 @@ static int bfs_statfs(struct dentry *dentry, struct kstatfs *buf)
236 239
237static void bfs_write_super(struct super_block *s) 240static void bfs_write_super(struct super_block *s)
238{ 241{
239 lock_kernel(); 242 struct bfs_sb_info *info = BFS_SB(s);
243
244 mutex_lock(&info->bfs_lock);
240 if (!(s->s_flags & MS_RDONLY)) 245 if (!(s->s_flags & MS_RDONLY))
241 mark_buffer_dirty(BFS_SB(s)->si_sbh); 246 mark_buffer_dirty(info->si_sbh);
242 s->s_dirt = 0; 247 s->s_dirt = 0;
243 unlock_kernel(); 248 mutex_unlock(&info->bfs_lock);
244} 249}
245 250
246static struct kmem_cache *bfs_inode_cachep; 251static struct kmem_cache *bfs_inode_cachep;
@@ -259,7 +264,7 @@ static void bfs_destroy_inode(struct inode *inode)
259 kmem_cache_free(bfs_inode_cachep, BFS_I(inode)); 264 kmem_cache_free(bfs_inode_cachep, BFS_I(inode));
260} 265}
261 266
262static void init_once(struct kmem_cache *cachep, void *foo) 267static void init_once(void *foo)
263{ 268{
264 struct bfs_inode_info *bi = foo; 269 struct bfs_inode_info *bi = foo;
265 270
@@ -380,7 +385,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
380 struct bfs_inode *di; 385 struct bfs_inode *di;
381 int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1; 386 int block = (i - BFS_ROOT_INO) / BFS_INODES_PER_BLOCK + 1;
382 int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; 387 int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK;
383 unsigned long sblock, eblock; 388 unsigned long eblock;
384 389
385 if (!off) { 390 if (!off) {
386 brelse(bh); 391 brelse(bh);
@@ -399,7 +404,6 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
399 set_bit(i, info->si_imap); 404 set_bit(i, info->si_imap);
400 info->si_freeb -= BFS_FILEBLOCKS(di); 405 info->si_freeb -= BFS_FILEBLOCKS(di);
401 406
402 sblock = le32_to_cpu(di->i_sblock);
403 eblock = le32_to_cpu(di->i_eblock); 407 eblock = le32_to_cpu(di->i_eblock);
404 if (eblock > info->si_lf_eblk) 408 if (eblock > info->si_lf_eblk)
405 info->si_lf_eblk = eblock; 409 info->si_lf_eblk = eblock;
@@ -410,6 +414,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
410 s->s_dirt = 1; 414 s->s_dirt = 1;
411 } 415 }
412 dump_imap("read_super", s); 416 dump_imap("read_super", s);
417 mutex_init(&info->bfs_lock);
413 return 0; 418 return 0;
414 419
415out: 420out:
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index ba4cddb92f1d..204cfd1d7676 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -444,12 +444,6 @@ beyond_if:
444 regs->gp = ex.a_gpvalue; 444 regs->gp = ex.a_gpvalue;
445#endif 445#endif
446 start_thread(regs, ex.a_entry, current->mm->start_stack); 446 start_thread(regs, ex.a_entry, current->mm->start_stack);
447 if (unlikely(current->ptrace & PT_PTRACED)) {
448 if (current->ptrace & PT_TRACE_EXEC)
449 ptrace_notify ((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
450 else
451 send_sig(SIGTRAP, current, 0);
452 }
453 return 0; 447 return 0;
454} 448}
455 449
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 3b6ff854d983..655ed8d30a86 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1003,12 +1003,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
1003#endif 1003#endif
1004 1004
1005 start_thread(regs, elf_entry, bprm->p); 1005 start_thread(regs, elf_entry, bprm->p);
1006 if (unlikely(current->ptrace & PT_PTRACED)) {
1007 if (current->ptrace & PT_TRACE_EXEC)
1008 ptrace_notify ((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
1009 else
1010 send_sig(SIGTRAP, current, 0);
1011 }
1012 retval = 0; 1006 retval = 0;
1013out: 1007out:
1014 kfree(loc); 1008 kfree(loc);
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 1b59b1edf26d..fdeadab2f18b 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -433,13 +433,6 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
433 entryaddr = interp_params.entry_addr ?: exec_params.entry_addr; 433 entryaddr = interp_params.entry_addr ?: exec_params.entry_addr;
434 start_thread(regs, entryaddr, current->mm->start_stack); 434 start_thread(regs, entryaddr, current->mm->start_stack);
435 435
436 if (unlikely(current->ptrace & PT_PTRACED)) {
437 if (current->ptrace & PT_TRACE_EXEC)
438 ptrace_notify((PTRACE_EVENT_EXEC << 8) | SIGTRAP);
439 else
440 send_sig(SIGTRAP, current, 0);
441 }
442
443 retval = 0; 436 retval = 0;
444 437
445error: 438error:
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 2cb1acda3a82..56372ecf1690 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -920,9 +920,6 @@ static int load_flat_binary(struct linux_binprm * bprm, struct pt_regs * regs)
920 920
921 start_thread(regs, start_addr, current->mm->start_stack); 921 start_thread(regs, start_addr, current->mm->start_stack);
922 922
923 if (current->ptrace & PT_PTRACED)
924 send_sig(SIGTRAP, current, 0);
925
926 return 0; 923 return 0;
927} 924}
928 925
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c
index fdc36bfd6a7b..68be580ba289 100644
--- a/fs/binfmt_som.c
+++ b/fs/binfmt_som.c
@@ -274,8 +274,6 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
274 map_hpux_gateway_page(current,current->mm); 274 map_hpux_gateway_page(current,current->mm);
275 275
276 start_thread_som(regs, som_entry, bprm->p); 276 start_thread_som(regs, som_entry, bprm->p);
277 if (current->ptrace & PT_PTRACED)
278 send_sig(SIGTRAP, current, 0);
279 return 0; 277 return 0;
280 278
281 /* error cleanup */ 279 /* error cleanup */
diff --git a/fs/bio.c b/fs/bio.c
index 88322b066acb..25f1af0d81e5 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -721,12 +721,8 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
721 const int local_nr_pages = end - start; 721 const int local_nr_pages = end - start;
722 const int page_limit = cur_page + local_nr_pages; 722 const int page_limit = cur_page + local_nr_pages;
723 723
724 down_read(&current->mm->mmap_sem); 724 ret = get_user_pages_fast(uaddr, local_nr_pages,
725 ret = get_user_pages(current, current->mm, uaddr, 725 write_to_vm, &pages[cur_page]);
726 local_nr_pages,
727 write_to_vm, 0, &pages[cur_page], NULL);
728 up_read(&current->mm->mmap_sem);
729
730 if (ret < local_nr_pages) { 726 if (ret < local_nr_pages) {
731 ret = -EFAULT; 727 ret = -EFAULT;
732 goto out_unmap; 728 goto out_unmap;
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 10d8a0aa871a..dcf37cada369 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -271,7 +271,7 @@ static void bdev_destroy_inode(struct inode *inode)
271 kmem_cache_free(bdev_cachep, bdi); 271 kmem_cache_free(bdev_cachep, bdi);
272} 272}
273 273
274static void init_once(struct kmem_cache * cachep, void *foo) 274static void init_once(void *foo)
275{ 275{
276 struct bdev_inode *ei = (struct bdev_inode *) foo; 276 struct bdev_inode *ei = (struct bdev_inode *) foo;
277 struct block_device *bdev = &ei->bdev; 277 struct block_device *bdev = &ei->bdev;
diff --git a/fs/buffer.c b/fs/buffer.c
index d48caee12e2a..f95805019639 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -706,7 +706,7 @@ static int __set_page_dirty(struct page *page,
706 if (TestSetPageDirty(page)) 706 if (TestSetPageDirty(page))
707 return 0; 707 return 0;
708 708
709 write_lock_irq(&mapping->tree_lock); 709 spin_lock_irq(&mapping->tree_lock);
710 if (page->mapping) { /* Race with truncate? */ 710 if (page->mapping) { /* Race with truncate? */
711 WARN_ON_ONCE(warn && !PageUptodate(page)); 711 WARN_ON_ONCE(warn && !PageUptodate(page));
712 712
@@ -719,7 +719,7 @@ static int __set_page_dirty(struct page *page,
719 radix_tree_tag_set(&mapping->page_tree, 719 radix_tree_tag_set(&mapping->page_tree,
720 page_index(page), PAGECACHE_TAG_DIRTY); 720 page_index(page), PAGECACHE_TAG_DIRTY);
721 } 721 }
722 write_unlock_irq(&mapping->tree_lock); 722 spin_unlock_irq(&mapping->tree_lock);
723 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); 723 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
724 724
725 return 1; 725 return 1;
@@ -1214,8 +1214,7 @@ void __brelse(struct buffer_head * buf)
1214 put_bh(buf); 1214 put_bh(buf);
1215 return; 1215 return;
1216 } 1216 }
1217 printk(KERN_ERR "VFS: brelse: Trying to free free buffer\n"); 1217 WARN(1, KERN_ERR "VFS: brelse: Trying to free free buffer\n");
1218 WARN_ON(1);
1219} 1218}
1220 1219
1221/* 1220/*
@@ -3272,7 +3271,7 @@ int bh_submit_read(struct buffer_head *bh)
3272EXPORT_SYMBOL(bh_submit_read); 3271EXPORT_SYMBOL(bh_submit_read);
3273 3272
3274static void 3273static void
3275init_buffer_head(struct kmem_cache *cachep, void *data) 3274init_buffer_head(void *data)
3276{ 3275{
3277 struct buffer_head *bh = data; 3276 struct buffer_head *bh = data;
3278 3277
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index f58e41d3ba48..6bb440b257b0 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -400,7 +400,7 @@ asn1_oid_decode(struct asn1_ctx *ctx,
400 size = eoc - ctx->pointer + 1; 400 size = eoc - ctx->pointer + 1;
401 401
402 /* first subid actually encodes first two subids */ 402 /* first subid actually encodes first two subids */
403 if (size < 2 || size > ULONG_MAX/sizeof(unsigned long)) 403 if (size < 2 || size > UINT_MAX/sizeof(unsigned long))
404 return 0; 404 return 0;
405 405
406 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); 406 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
@@ -494,7 +494,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
494 /* remember to free obj->oid */ 494 /* remember to free obj->oid */
495 rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); 495 rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
496 if (rc) { 496 if (rc) {
497 if ((tag == ASN1_OJI) && (cls == ASN1_PRI)) { 497 if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
498 rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); 498 rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
499 if (rc) { 499 if (rc) {
500 rc = compare_oid(oid, oidlen, 500 rc = compare_oid(oid, oidlen,
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index cc950f69e51e..688a2d42153f 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -107,9 +107,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
107#endif /* CONFIG_CIFS_DEBUG2 */ 107#endif /* CONFIG_CIFS_DEBUG2 */
108 108
109#ifdef CONFIG_PROC_FS 109#ifdef CONFIG_PROC_FS
110static int 110static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
111cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
112 int count, int *eof, void *data)
113{ 111{
114 struct list_head *tmp; 112 struct list_head *tmp;
115 struct list_head *tmp1; 113 struct list_head *tmp1;
@@ -117,23 +115,13 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
117 struct cifsSesInfo *ses; 115 struct cifsSesInfo *ses;
118 struct cifsTconInfo *tcon; 116 struct cifsTconInfo *tcon;
119 int i; 117 int i;
120 int length = 0;
121 char *original_buf = buf;
122 118
123 *beginBuffer = buf + offset; 119 seq_puts(m,
124
125 length =
126 sprintf(buf,
127 "Display Internal CIFS Data Structures for Debugging\n" 120 "Display Internal CIFS Data Structures for Debugging\n"
128 "---------------------------------------------------\n"); 121 "---------------------------------------------------\n");
129 buf += length; 122 seq_printf(m, "CIFS Version %s\n", CIFS_VERSION);
130 length = sprintf(buf, "CIFS Version %s\n", CIFS_VERSION); 123 seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
131 buf += length; 124 seq_printf(m, "Servers:");
132 length = sprintf(buf,
133 "Active VFS Requests: %d\n", GlobalTotalActiveXid);
134 buf += length;
135 length = sprintf(buf, "Servers:");
136 buf += length;
137 125
138 i = 0; 126 i = 0;
139 read_lock(&GlobalSMBSeslock); 127 read_lock(&GlobalSMBSeslock);
@@ -142,11 +130,10 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
142 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList); 130 ses = list_entry(tmp, struct cifsSesInfo, cifsSessionList);
143 if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) || 131 if ((ses->serverDomain == NULL) || (ses->serverOS == NULL) ||
144 (ses->serverNOS == NULL)) { 132 (ses->serverNOS == NULL)) {
145 buf += sprintf(buf, "\nentry for %s not fully " 133 seq_printf(m, "\nentry for %s not fully "
146 "displayed\n\t", ses->serverName); 134 "displayed\n\t", ses->serverName);
147 } else { 135 } else {
148 length = 136 seq_printf(m,
149 sprintf(buf,
150 "\n%d) Name: %s Domain: %s Mounts: %d OS:" 137 "\n%d) Name: %s Domain: %s Mounts: %d OS:"
151 " %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB" 138 " %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB"
152 " session status: %d\t", 139 " session status: %d\t",
@@ -154,10 +141,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
154 atomic_read(&ses->inUse), 141 atomic_read(&ses->inUse),
155 ses->serverOS, ses->serverNOS, 142 ses->serverOS, ses->serverNOS,
156 ses->capabilities, ses->status); 143 ses->capabilities, ses->status);
157 buf += length;
158 } 144 }
159 if (ses->server) { 145 if (ses->server) {
160 buf += sprintf(buf, "TCP status: %d\n\tLocal Users To " 146 seq_printf(m, "TCP status: %d\n\tLocal Users To "
161 "Server: %d SecMode: 0x%x Req On Wire: %d", 147 "Server: %d SecMode: 0x%x Req On Wire: %d",
162 ses->server->tcpStatus, 148 ses->server->tcpStatus,
163 atomic_read(&ses->server->socketUseCount), 149 atomic_read(&ses->server->socketUseCount),
@@ -165,13 +151,12 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
165 atomic_read(&ses->server->inFlight)); 151 atomic_read(&ses->server->inFlight));
166 152
167#ifdef CONFIG_CIFS_STATS2 153#ifdef CONFIG_CIFS_STATS2
168 buf += sprintf(buf, " In Send: %d In MaxReq Wait: %d", 154 seq_printf(m, " In Send: %d In MaxReq Wait: %d",
169 atomic_read(&ses->server->inSend), 155 atomic_read(&ses->server->inSend),
170 atomic_read(&ses->server->num_waiters)); 156 atomic_read(&ses->server->num_waiters));
171#endif 157#endif
172 158
173 length = sprintf(buf, "\nMIDs:\n"); 159 seq_puts(m, "\nMIDs:\n");
174 buf += length;
175 160
176 spin_lock(&GlobalMid_Lock); 161 spin_lock(&GlobalMid_Lock);
177 list_for_each(tmp1, &ses->server->pending_mid_q) { 162 list_for_each(tmp1, &ses->server->pending_mid_q) {
@@ -179,7 +164,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
179 mid_q_entry, 164 mid_q_entry,
180 qhead); 165 qhead);
181 if (mid_entry) { 166 if (mid_entry) {
182 length = sprintf(buf, 167 seq_printf(m,
183 "State: %d com: %d pid:" 168 "State: %d com: %d pid:"
184 " %d tsk: %p mid %d\n", 169 " %d tsk: %p mid %d\n",
185 mid_entry->midState, 170 mid_entry->midState,
@@ -187,7 +172,6 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
187 mid_entry->pid, 172 mid_entry->pid,
188 mid_entry->tsk, 173 mid_entry->tsk,
189 mid_entry->mid); 174 mid_entry->mid);
190 buf += length;
191 } 175 }
192 } 176 }
193 spin_unlock(&GlobalMid_Lock); 177 spin_unlock(&GlobalMid_Lock);
@@ -195,11 +179,9 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
195 179
196 } 180 }
197 read_unlock(&GlobalSMBSeslock); 181 read_unlock(&GlobalSMBSeslock);
198 sprintf(buf, "\n"); 182 seq_putc(m, '\n');
199 buf++;
200 183
201 length = sprintf(buf, "Shares:"); 184 seq_puts(m, "Shares:");
202 buf += length;
203 185
204 i = 0; 186 i = 0;
205 read_lock(&GlobalSMBSeslock); 187 read_lock(&GlobalSMBSeslock);
@@ -208,62 +190,52 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
208 i++; 190 i++;
209 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 191 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
210 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); 192 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
211 length = sprintf(buf, "\n%d) %s Uses: %d ", i, 193 seq_printf(m, "\n%d) %s Uses: %d ", i,
212 tcon->treeName, atomic_read(&tcon->useCount)); 194 tcon->treeName, atomic_read(&tcon->useCount));
213 buf += length;
214 if (tcon->nativeFileSystem) { 195 if (tcon->nativeFileSystem) {
215 length = sprintf(buf, "Type: %s ", 196 seq_printf(m, "Type: %s ",
216 tcon->nativeFileSystem); 197 tcon->nativeFileSystem);
217 buf += length;
218 } 198 }
219 length = sprintf(buf, "DevInfo: 0x%x Attributes: 0x%x" 199 seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x"
220 "\nPathComponentMax: %d Status: %d", 200 "\nPathComponentMax: %d Status: %d",
221 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics), 201 le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
222 le32_to_cpu(tcon->fsAttrInfo.Attributes), 202 le32_to_cpu(tcon->fsAttrInfo.Attributes),
223 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength), 203 le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
224 tcon->tidStatus); 204 tcon->tidStatus);
225 buf += length;
226 if (dev_type == FILE_DEVICE_DISK) 205 if (dev_type == FILE_DEVICE_DISK)
227 length = sprintf(buf, " type: DISK "); 206 seq_puts(m, " type: DISK ");
228 else if (dev_type == FILE_DEVICE_CD_ROM) 207 else if (dev_type == FILE_DEVICE_CD_ROM)
229 length = sprintf(buf, " type: CDROM "); 208 seq_puts(m, " type: CDROM ");
230 else 209 else
231 length = 210 seq_printf(m, " type: %d ", dev_type);
232 sprintf(buf, " type: %d ", dev_type); 211
233 buf += length; 212 if (tcon->tidStatus == CifsNeedReconnect)
234 if (tcon->tidStatus == CifsNeedReconnect) { 213 seq_puts(m, "\tDISCONNECTED ");
235 buf += sprintf(buf, "\tDISCONNECTED ");
236 length += 14;
237 }
238 } 214 }
239 read_unlock(&GlobalSMBSeslock); 215 read_unlock(&GlobalSMBSeslock);
240 216
241 length = sprintf(buf, "\n"); 217 seq_putc(m, '\n');
242 buf += length;
243 218
244 /* BB add code to dump additional info such as TCP session info now */ 219 /* BB add code to dump additional info such as TCP session info now */
245 /* Now calculate total size of returned data */ 220 return 0;
246 length = buf - original_buf; 221}
247
248 if (offset + count >= length)
249 *eof = 1;
250 if (length < offset) {
251 *eof = 1;
252 return 0;
253 } else {
254 length = length - offset;
255 }
256 if (length > count)
257 length = count;
258 222
259 return length; 223static int cifs_debug_data_proc_open(struct inode *inode, struct file *file)
224{
225 return single_open(file, cifs_debug_data_proc_show, NULL);
260} 226}
261 227
262#ifdef CONFIG_CIFS_STATS 228static const struct file_operations cifs_debug_data_proc_fops = {
229 .owner = THIS_MODULE,
230 .open = cifs_debug_data_proc_open,
231 .read = seq_read,
232 .llseek = seq_lseek,
233 .release = single_release,
234};
263 235
264static int 236#ifdef CONFIG_CIFS_STATS
265cifs_stats_write(struct file *file, const char __user *buffer, 237static ssize_t cifs_stats_proc_write(struct file *file,
266 unsigned long count, void *data) 238 const char __user *buffer, size_t count, loff_t *ppos)
267{ 239{
268 char c; 240 char c;
269 int rc; 241 int rc;
@@ -307,236 +279,132 @@ cifs_stats_write(struct file *file, const char __user *buffer,
307 return count; 279 return count;
308} 280}
309 281
310static int 282static int cifs_stats_proc_show(struct seq_file *m, void *v)
311cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
312 int count, int *eof, void *data)
313{ 283{
314 int item_length, i, length; 284 int i;
315 struct list_head *tmp; 285 struct list_head *tmp;
316 struct cifsTconInfo *tcon; 286 struct cifsTconInfo *tcon;
317 287
318 *beginBuffer = buf + offset; 288 seq_printf(m,
319
320 length = sprintf(buf,
321 "Resources in use\nCIFS Session: %d\n", 289 "Resources in use\nCIFS Session: %d\n",
322 sesInfoAllocCount.counter); 290 sesInfoAllocCount.counter);
323 buf += length; 291 seq_printf(m, "Share (unique mount targets): %d\n",
324 item_length =
325 sprintf(buf, "Share (unique mount targets): %d\n",
326 tconInfoAllocCount.counter); 292 tconInfoAllocCount.counter);
327 length += item_length; 293 seq_printf(m, "SMB Request/Response Buffer: %d Pool size: %d\n",
328 buf += item_length;
329 item_length =
330 sprintf(buf, "SMB Request/Response Buffer: %d Pool size: %d\n",
331 bufAllocCount.counter, 294 bufAllocCount.counter,
332 cifs_min_rcv + tcpSesAllocCount.counter); 295 cifs_min_rcv + tcpSesAllocCount.counter);
333 length += item_length; 296 seq_printf(m, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
334 buf += item_length;
335 item_length =
336 sprintf(buf, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
337 smBufAllocCount.counter, cifs_min_small); 297 smBufAllocCount.counter, cifs_min_small);
338 length += item_length;
339 buf += item_length;
340#ifdef CONFIG_CIFS_STATS2 298#ifdef CONFIG_CIFS_STATS2
341 item_length = sprintf(buf, "Total Large %d Small %d Allocations\n", 299 seq_printf(m, "Total Large %d Small %d Allocations\n",
342 atomic_read(&totBufAllocCount), 300 atomic_read(&totBufAllocCount),
343 atomic_read(&totSmBufAllocCount)); 301 atomic_read(&totSmBufAllocCount));
344 length += item_length;
345 buf += item_length;
346#endif /* CONFIG_CIFS_STATS2 */ 302#endif /* CONFIG_CIFS_STATS2 */
347 303
348 item_length = 304 seq_printf(m, "Operations (MIDs): %d\n", midCount.counter);
349 sprintf(buf, "Operations (MIDs): %d\n", 305 seq_printf(m,
350 midCount.counter);
351 length += item_length;
352 buf += item_length;
353 item_length = sprintf(buf,
354 "\n%d session %d share reconnects\n", 306 "\n%d session %d share reconnects\n",
355 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter); 307 tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
356 length += item_length;
357 buf += item_length;
358 308
359 item_length = sprintf(buf, 309 seq_printf(m,
360 "Total vfs operations: %d maximum at one time: %d\n", 310 "Total vfs operations: %d maximum at one time: %d\n",
361 GlobalCurrentXid, GlobalMaxActiveXid); 311 GlobalCurrentXid, GlobalMaxActiveXid);
362 length += item_length;
363 buf += item_length;
364 312
365 i = 0; 313 i = 0;
366 read_lock(&GlobalSMBSeslock); 314 read_lock(&GlobalSMBSeslock);
367 list_for_each(tmp, &GlobalTreeConnectionList) { 315 list_for_each(tmp, &GlobalTreeConnectionList) {
368 i++; 316 i++;
369 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); 317 tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList);
370 item_length = sprintf(buf, "\n%d) %s", i, tcon->treeName); 318 seq_printf(m, "\n%d) %s", i, tcon->treeName);
371 buf += item_length; 319 if (tcon->tidStatus == CifsNeedReconnect)
372 length += item_length; 320 seq_puts(m, "\tDISCONNECTED ");
373 if (tcon->tidStatus == CifsNeedReconnect) { 321 seq_printf(m, "\nSMBs: %d Oplock Breaks: %d",
374 buf += sprintf(buf, "\tDISCONNECTED ");
375 length += 14;
376 }
377 item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
378 atomic_read(&tcon->num_smbs_sent), 322 atomic_read(&tcon->num_smbs_sent),
379 atomic_read(&tcon->num_oplock_brks)); 323 atomic_read(&tcon->num_oplock_brks));
380 buf += item_length; 324 seq_printf(m, "\nReads: %d Bytes: %lld",
381 length += item_length;
382 item_length = sprintf(buf, "\nReads: %d Bytes: %lld",
383 atomic_read(&tcon->num_reads), 325 atomic_read(&tcon->num_reads),
384 (long long)(tcon->bytes_read)); 326 (long long)(tcon->bytes_read));
385 buf += item_length; 327 seq_printf(m, "\nWrites: %d Bytes: %lld",
386 length += item_length;
387 item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
388 atomic_read(&tcon->num_writes), 328 atomic_read(&tcon->num_writes),
389 (long long)(tcon->bytes_written)); 329 (long long)(tcon->bytes_written));
390 buf += item_length; 330 seq_printf(m,
391 length += item_length;
392 item_length = sprintf(buf,
393 "\nLocks: %d HardLinks: %d Symlinks: %d", 331 "\nLocks: %d HardLinks: %d Symlinks: %d",
394 atomic_read(&tcon->num_locks), 332 atomic_read(&tcon->num_locks),
395 atomic_read(&tcon->num_hardlinks), 333 atomic_read(&tcon->num_hardlinks),
396 atomic_read(&tcon->num_symlinks)); 334 atomic_read(&tcon->num_symlinks));
397 buf += item_length;
398 length += item_length;
399 335
400 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d", 336 seq_printf(m, "\nOpens: %d Closes: %d Deletes: %d",
401 atomic_read(&tcon->num_opens), 337 atomic_read(&tcon->num_opens),
402 atomic_read(&tcon->num_closes), 338 atomic_read(&tcon->num_closes),
403 atomic_read(&tcon->num_deletes)); 339 atomic_read(&tcon->num_deletes));
404 buf += item_length; 340 seq_printf(m, "\nMkdirs: %d Rmdirs: %d",
405 length += item_length;
406 item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
407 atomic_read(&tcon->num_mkdirs), 341 atomic_read(&tcon->num_mkdirs),
408 atomic_read(&tcon->num_rmdirs)); 342 atomic_read(&tcon->num_rmdirs));
409 buf += item_length; 343 seq_printf(m, "\nRenames: %d T2 Renames %d",
410 length += item_length;
411 item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
412 atomic_read(&tcon->num_renames), 344 atomic_read(&tcon->num_renames),
413 atomic_read(&tcon->num_t2renames)); 345 atomic_read(&tcon->num_t2renames));
414 buf += item_length; 346 seq_printf(m, "\nFindFirst: %d FNext %d FClose %d",
415 length += item_length;
416 item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
417 atomic_read(&tcon->num_ffirst), 347 atomic_read(&tcon->num_ffirst),
418 atomic_read(&tcon->num_fnext), 348 atomic_read(&tcon->num_fnext),
419 atomic_read(&tcon->num_fclose)); 349 atomic_read(&tcon->num_fclose));
420 buf += item_length;
421 length += item_length;
422 } 350 }
423 read_unlock(&GlobalSMBSeslock); 351 read_unlock(&GlobalSMBSeslock);
424 352
425 buf += sprintf(buf, "\n"); 353 seq_putc(m, '\n');
426 length++; 354 return 0;
427 355}
428 if (offset + count >= length)
429 *eof = 1;
430 if (length < offset) {
431 *eof = 1;
432 return 0;
433 } else {
434 length = length - offset;
435 }
436 if (length > count)
437 length = count;
438 356
439 return length; 357static int cifs_stats_proc_open(struct inode *inode, struct file *file)
358{
359 return single_open(file, cifs_stats_proc_show, NULL);
440} 360}
361
362static const struct file_operations cifs_stats_proc_fops = {
363 .owner = THIS_MODULE,
364 .open = cifs_stats_proc_open,
365 .read = seq_read,
366 .llseek = seq_lseek,
367 .release = single_release,
368 .write = cifs_stats_proc_write,
369};
441#endif /* STATS */ 370#endif /* STATS */
442 371
443static struct proc_dir_entry *proc_fs_cifs; 372static struct proc_dir_entry *proc_fs_cifs;
444read_proc_t cifs_txanchor_read; 373static const struct file_operations cifsFYI_proc_fops;
445static read_proc_t cifsFYI_read; 374static const struct file_operations cifs_oplock_proc_fops;
446static write_proc_t cifsFYI_write; 375static const struct file_operations cifs_lookup_cache_proc_fops;
447static read_proc_t oplockEnabled_read; 376static const struct file_operations traceSMB_proc_fops;
448static write_proc_t oplockEnabled_write; 377static const struct file_operations cifs_multiuser_mount_proc_fops;
449static read_proc_t lookupFlag_read; 378static const struct file_operations cifs_security_flags_proc_fops;
450static write_proc_t lookupFlag_write; 379static const struct file_operations cifs_experimental_proc_fops;
451static read_proc_t traceSMB_read; 380static const struct file_operations cifs_linux_ext_proc_fops;
452static write_proc_t traceSMB_write;
453static read_proc_t multiuser_mount_read;
454static write_proc_t multiuser_mount_write;
455static read_proc_t security_flags_read;
456static write_proc_t security_flags_write;
457/* static read_proc_t ntlmv2_enabled_read;
458static write_proc_t ntlmv2_enabled_write;
459static read_proc_t packet_signing_enabled_read;
460static write_proc_t packet_signing_enabled_write;*/
461static read_proc_t experimEnabled_read;
462static write_proc_t experimEnabled_write;
463static read_proc_t linuxExtensionsEnabled_read;
464static write_proc_t linuxExtensionsEnabled_write;
465 381
466void 382void
467cifs_proc_init(void) 383cifs_proc_init(void)
468{ 384{
469 struct proc_dir_entry *pde;
470
471 proc_fs_cifs = proc_mkdir("fs/cifs", NULL); 385 proc_fs_cifs = proc_mkdir("fs/cifs", NULL);
472 if (proc_fs_cifs == NULL) 386 if (proc_fs_cifs == NULL)
473 return; 387 return;
474 388
475 proc_fs_cifs->owner = THIS_MODULE; 389 proc_fs_cifs->owner = THIS_MODULE;
476 create_proc_read_entry("DebugData", 0, proc_fs_cifs, 390 proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
477 cifs_debug_data_read, NULL);
478 391
479#ifdef CONFIG_CIFS_STATS 392#ifdef CONFIG_CIFS_STATS
480 pde = create_proc_read_entry("Stats", 0, proc_fs_cifs, 393 proc_create("Stats", 0, proc_fs_cifs, &cifs_stats_proc_fops);
481 cifs_stats_read, NULL);
482 if (pde)
483 pde->write_proc = cifs_stats_write;
484#endif /* STATS */ 394#endif /* STATS */
485 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, 395 proc_create("cifsFYI", 0, proc_fs_cifs, &cifsFYI_proc_fops);
486 cifsFYI_read, NULL); 396 proc_create("traceSMB", 0, proc_fs_cifs, &traceSMB_proc_fops);
487 if (pde) 397 proc_create("OplockEnabled", 0, proc_fs_cifs, &cifs_oplock_proc_fops);
488 pde->write_proc = cifsFYI_write; 398 proc_create("Experimental", 0, proc_fs_cifs,
489 399 &cifs_experimental_proc_fops);
490 pde = 400 proc_create("LinuxExtensionsEnabled", 0, proc_fs_cifs,
491 create_proc_read_entry("traceSMB", 0, proc_fs_cifs, 401 &cifs_linux_ext_proc_fops);
492 traceSMB_read, NULL); 402 proc_create("MultiuserMount", 0, proc_fs_cifs,
493 if (pde) 403 &cifs_multiuser_mount_proc_fops);
494 pde->write_proc = traceSMB_write; 404 proc_create("SecurityFlags", 0, proc_fs_cifs,
495 405 &cifs_security_flags_proc_fops);
496 pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs, 406 proc_create("LookupCacheEnabled", 0, proc_fs_cifs,
497 oplockEnabled_read, NULL); 407 &cifs_lookup_cache_proc_fops);
498 if (pde)
499 pde->write_proc = oplockEnabled_write;
500
501 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
502 experimEnabled_read, NULL);
503 if (pde)
504 pde->write_proc = experimEnabled_write;
505
506 pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs,
507 linuxExtensionsEnabled_read, NULL);
508 if (pde)
509 pde->write_proc = linuxExtensionsEnabled_write;
510
511 pde =
512 create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs,
513 multiuser_mount_read, NULL);
514 if (pde)
515 pde->write_proc = multiuser_mount_write;
516
517 pde =
518 create_proc_read_entry("SecurityFlags", 0, proc_fs_cifs,
519 security_flags_read, NULL);
520 if (pde)
521 pde->write_proc = security_flags_write;
522
523 pde =
524 create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs,
525 lookupFlag_read, NULL);
526 if (pde)
527 pde->write_proc = lookupFlag_write;
528
529/* pde =
530 create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs,
531 ntlmv2_enabled_read, NULL);
532 if (pde)
533 pde->write_proc = ntlmv2_enabled_write;
534
535 pde =
536 create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs,
537 packet_signing_enabled_read, NULL);
538 if (pde)
539 pde->write_proc = packet_signing_enabled_write;*/
540} 408}
541 409
542void 410void
@@ -553,39 +421,26 @@ cifs_proc_clean(void)
553#endif 421#endif
554 remove_proc_entry("MultiuserMount", proc_fs_cifs); 422 remove_proc_entry("MultiuserMount", proc_fs_cifs);
555 remove_proc_entry("OplockEnabled", proc_fs_cifs); 423 remove_proc_entry("OplockEnabled", proc_fs_cifs);
556/* remove_proc_entry("NTLMV2Enabled",proc_fs_cifs); */
557 remove_proc_entry("SecurityFlags", proc_fs_cifs); 424 remove_proc_entry("SecurityFlags", proc_fs_cifs);
558/* remove_proc_entry("PacketSigningEnabled", proc_fs_cifs); */
559 remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); 425 remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
560 remove_proc_entry("Experimental", proc_fs_cifs); 426 remove_proc_entry("Experimental", proc_fs_cifs);
561 remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); 427 remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
562 remove_proc_entry("fs/cifs", NULL); 428 remove_proc_entry("fs/cifs", NULL);
563} 429}
564 430
565static int 431static int cifsFYI_proc_show(struct seq_file *m, void *v)
566cifsFYI_read(char *page, char **start, off_t off, int count,
567 int *eof, void *data)
568{ 432{
569 int len; 433 seq_printf(m, "%d\n", cifsFYI);
570 434 return 0;
571 len = sprintf(page, "%d\n", cifsFYI); 435}
572
573 len -= off;
574 *start = page + off;
575
576 if (len > count)
577 len = count;
578 else
579 *eof = 1;
580
581 if (len < 0)
582 len = 0;
583 436
584 return len; 437static int cifsFYI_proc_open(struct inode *inode, struct file *file)
438{
439 return single_open(file, cifsFYI_proc_show, NULL);
585} 440}
586static int 441
587cifsFYI_write(struct file *file, const char __user *buffer, 442static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
588 unsigned long count, void *data) 443 size_t count, loff_t *ppos)
589{ 444{
590 char c; 445 char c;
591 int rc; 446 int rc;
@@ -603,30 +458,28 @@ cifsFYI_write(struct file *file, const char __user *buffer,
603 return count; 458 return count;
604} 459}
605 460
606static int 461static const struct file_operations cifsFYI_proc_fops = {
607oplockEnabled_read(char *page, char **start, off_t off, 462 .owner = THIS_MODULE,
608 int count, int *eof, void *data) 463 .open = cifsFYI_proc_open,
609{ 464 .read = seq_read,
610 int len; 465 .llseek = seq_lseek,
611 466 .release = single_release,
612 len = sprintf(page, "%d\n", oplockEnabled); 467 .write = cifsFYI_proc_write,
613 468};
614 len -= off;
615 *start = page + off;
616
617 if (len > count)
618 len = count;
619 else
620 *eof = 1;
621 469
622 if (len < 0) 470static int cifs_oplock_proc_show(struct seq_file *m, void *v)
623 len = 0; 471{
472 seq_printf(m, "%d\n", oplockEnabled);
473 return 0;
474}
624 475
625 return len; 476static int cifs_oplock_proc_open(struct inode *inode, struct file *file)
477{
478 return single_open(file, cifs_oplock_proc_show, NULL);
626} 479}
627static int 480
628oplockEnabled_write(struct file *file, const char __user *buffer, 481static ssize_t cifs_oplock_proc_write(struct file *file,
629 unsigned long count, void *data) 482 const char __user *buffer, size_t count, loff_t *ppos)
630{ 483{
631 char c; 484 char c;
632 int rc; 485 int rc;
@@ -642,30 +495,28 @@ oplockEnabled_write(struct file *file, const char __user *buffer,
642 return count; 495 return count;
643} 496}
644 497
645static int 498static const struct file_operations cifs_oplock_proc_fops = {
646experimEnabled_read(char *page, char **start, off_t off, 499 .owner = THIS_MODULE,
647 int count, int *eof, void *data) 500 .open = cifs_oplock_proc_open,
648{ 501 .read = seq_read,
649 int len; 502 .llseek = seq_lseek,
650 503 .release = single_release,
651 len = sprintf(page, "%d\n", experimEnabled); 504 .write = cifs_oplock_proc_write,
652 505};
653 len -= off;
654 *start = page + off;
655 506
656 if (len > count) 507static int cifs_experimental_proc_show(struct seq_file *m, void *v)
657 len = count; 508{
658 else 509 seq_printf(m, "%d\n", experimEnabled);
659 *eof = 1; 510 return 0;
660 511}
661 if (len < 0)
662 len = 0;
663 512
664 return len; 513static int cifs_experimental_proc_open(struct inode *inode, struct file *file)
514{
515 return single_open(file, cifs_experimental_proc_show, NULL);
665} 516}
666static int 517
667experimEnabled_write(struct file *file, const char __user *buffer, 518static ssize_t cifs_experimental_proc_write(struct file *file,
668 unsigned long count, void *data) 519 const char __user *buffer, size_t count, loff_t *ppos)
669{ 520{
670 char c; 521 char c;
671 int rc; 522 int rc;
@@ -683,29 +534,28 @@ experimEnabled_write(struct file *file, const char __user *buffer,
683 return count; 534 return count;
684} 535}
685 536
686static int 537static const struct file_operations cifs_experimental_proc_fops = {
687linuxExtensionsEnabled_read(char *page, char **start, off_t off, 538 .owner = THIS_MODULE,
688 int count, int *eof, void *data) 539 .open = cifs_experimental_proc_open,
689{ 540 .read = seq_read,
690 int len; 541 .llseek = seq_lseek,
691 542 .release = single_release,
692 len = sprintf(page, "%d\n", linuxExtEnabled); 543 .write = cifs_experimental_proc_write,
693 len -= off; 544};
694 *start = page + off;
695 545
696 if (len > count) 546static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
697 len = count; 547{
698 else 548 seq_printf(m, "%d\n", linuxExtEnabled);
699 *eof = 1; 549 return 0;
700 550}
701 if (len < 0)
702 len = 0;
703 551
704 return len; 552static int cifs_linux_ext_proc_open(struct inode *inode, struct file *file)
553{
554 return single_open(file, cifs_linux_ext_proc_show, NULL);
705} 555}
706static int 556
707linuxExtensionsEnabled_write(struct file *file, const char __user *buffer, 557static ssize_t cifs_linux_ext_proc_write(struct file *file,
708 unsigned long count, void *data) 558 const char __user *buffer, size_t count, loff_t *ppos)
709{ 559{
710 char c; 560 char c;
711 int rc; 561 int rc;
@@ -721,31 +571,28 @@ linuxExtensionsEnabled_write(struct file *file, const char __user *buffer,
721 return count; 571 return count;
722} 572}
723 573
574static const struct file_operations cifs_linux_ext_proc_fops = {
575 .owner = THIS_MODULE,
576 .open = cifs_linux_ext_proc_open,
577 .read = seq_read,
578 .llseek = seq_lseek,
579 .release = single_release,
580 .write = cifs_linux_ext_proc_write,
581};
724 582
725static int 583static int cifs_lookup_cache_proc_show(struct seq_file *m, void *v)
726lookupFlag_read(char *page, char **start, off_t off,
727 int count, int *eof, void *data)
728{ 584{
729 int len; 585 seq_printf(m, "%d\n", lookupCacheEnabled);
730 586 return 0;
731 len = sprintf(page, "%d\n", lookupCacheEnabled); 587}
732
733 len -= off;
734 *start = page + off;
735
736 if (len > count)
737 len = count;
738 else
739 *eof = 1;
740
741 if (len < 0)
742 len = 0;
743 588
744 return len; 589static int cifs_lookup_cache_proc_open(struct inode *inode, struct file *file)
590{
591 return single_open(file, cifs_lookup_cache_proc_show, NULL);
745} 592}
746static int 593
747lookupFlag_write(struct file *file, const char __user *buffer, 594static ssize_t cifs_lookup_cache_proc_write(struct file *file,
748 unsigned long count, void *data) 595 const char __user *buffer, size_t count, loff_t *ppos)
749{ 596{
750 char c; 597 char c;
751 int rc; 598 int rc;
@@ -760,30 +607,29 @@ lookupFlag_write(struct file *file, const char __user *buffer,
760 607
761 return count; 608 return count;
762} 609}
763static int
764traceSMB_read(char *page, char **start, off_t off, int count,
765 int *eof, void *data)
766{
767 int len;
768
769 len = sprintf(page, "%d\n", traceSMB);
770
771 len -= off;
772 *start = page + off;
773 610
774 if (len > count) 611static const struct file_operations cifs_lookup_cache_proc_fops = {
775 len = count; 612 .owner = THIS_MODULE,
776 else 613 .open = cifs_lookup_cache_proc_open,
777 *eof = 1; 614 .read = seq_read,
615 .llseek = seq_lseek,
616 .release = single_release,
617 .write = cifs_lookup_cache_proc_write,
618};
778 619
779 if (len < 0) 620static int traceSMB_proc_show(struct seq_file *m, void *v)
780 len = 0; 621{
622 seq_printf(m, "%d\n", traceSMB);
623 return 0;
624}
781 625
782 return len; 626static int traceSMB_proc_open(struct inode *inode, struct file *file)
627{
628 return single_open(file, traceSMB_proc_show, NULL);
783} 629}
784static int 630
785traceSMB_write(struct file *file, const char __user *buffer, 631static ssize_t traceSMB_proc_write(struct file *file, const char __user *buffer,
786 unsigned long count, void *data) 632 size_t count, loff_t *ppos)
787{ 633{
788 char c; 634 char c;
789 int rc; 635 int rc;
@@ -799,30 +645,28 @@ traceSMB_write(struct file *file, const char __user *buffer,
799 return count; 645 return count;
800} 646}
801 647
802static int 648static const struct file_operations traceSMB_proc_fops = {
803multiuser_mount_read(char *page, char **start, off_t off, 649 .owner = THIS_MODULE,
804 int count, int *eof, void *data) 650 .open = traceSMB_proc_open,
805{ 651 .read = seq_read,
806 int len; 652 .llseek = seq_lseek,
807 653 .release = single_release,
808 len = sprintf(page, "%d\n", multiuser_mount); 654 .write = traceSMB_proc_write,
809 655};
810 len -= off;
811 *start = page + off;
812 656
813 if (len > count) 657static int cifs_multiuser_mount_proc_show(struct seq_file *m, void *v)
814 len = count; 658{
815 else 659 seq_printf(m, "%d\n", multiuser_mount);
816 *eof = 1; 660 return 0;
817 661}
818 if (len < 0)
819 len = 0;
820 662
821 return len; 663static int cifs_multiuser_mount_proc_open(struct inode *inode, struct file *fh)
664{
665 return single_open(fh, cifs_multiuser_mount_proc_show, NULL);
822} 666}
823static int 667
824multiuser_mount_write(struct file *file, const char __user *buffer, 668static ssize_t cifs_multiuser_mount_proc_write(struct file *file,
825 unsigned long count, void *data) 669 const char __user *buffer, size_t count, loff_t *ppos)
826{ 670{
827 char c; 671 char c;
828 int rc; 672 int rc;
@@ -838,30 +682,28 @@ multiuser_mount_write(struct file *file, const char __user *buffer,
838 return count; 682 return count;
839} 683}
840 684
841static int 685static const struct file_operations cifs_multiuser_mount_proc_fops = {
842security_flags_read(char *page, char **start, off_t off, 686 .owner = THIS_MODULE,
843 int count, int *eof, void *data) 687 .open = cifs_multiuser_mount_proc_open,
844{ 688 .read = seq_read,
845 int len; 689 .llseek = seq_lseek,
846 690 .release = single_release,
847 len = sprintf(page, "0x%x\n", extended_security); 691 .write = cifs_multiuser_mount_proc_write,
848 692};
849 len -= off;
850 *start = page + off;
851 693
852 if (len > count) 694static int cifs_security_flags_proc_show(struct seq_file *m, void *v)
853 len = count; 695{
854 else 696 seq_printf(m, "0x%x\n", extended_security);
855 *eof = 1; 697 return 0;
856 698}
857 if (len < 0)
858 len = 0;
859 699
860 return len; 700static int cifs_security_flags_proc_open(struct inode *inode, struct file *file)
701{
702 return single_open(file, cifs_security_flags_proc_show, NULL);
861} 703}
862static int 704
863security_flags_write(struct file *file, const char __user *buffer, 705static ssize_t cifs_security_flags_proc_write(struct file *file,
864 unsigned long count, void *data) 706 const char __user *buffer, size_t count, loff_t *ppos)
865{ 707{
866 unsigned int flags; 708 unsigned int flags;
867 char flags_string[12]; 709 char flags_string[12];
@@ -917,6 +759,15 @@ security_flags_write(struct file *file, const char __user *buffer,
917 /* BB should we turn on MAY flags for other MUST options? */ 759 /* BB should we turn on MAY flags for other MUST options? */
918 return count; 760 return count;
919} 761}
762
763static const struct file_operations cifs_security_flags_proc_fops = {
764 .owner = THIS_MODULE,
765 .open = cifs_security_flags_proc_open,
766 .read = seq_read,
767 .llseek = seq_lseek,
768 .release = single_release,
769 .write = cifs_security_flags_proc_write,
770};
920#else 771#else
921inline void cifs_proc_init(void) 772inline void cifs_proc_init(void)
922{ 773{
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index 0e9fc2ba90ee..57ecdc83c26f 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -56,7 +56,7 @@ int match_sid(struct cifs_sid *ctsid)
56 struct cifs_sid *cwsid; 56 struct cifs_sid *cwsid;
57 57
58 if (!ctsid) 58 if (!ctsid)
59 return (-1); 59 return -1;
60 60
61 for (i = 0; i < NUM_WK_SIDS; ++i) { 61 for (i = 0; i < NUM_WK_SIDS; ++i) {
62 cwsid = &(wksidarr[i].cifssid); 62 cwsid = &(wksidarr[i].cifssid);
@@ -87,11 +87,11 @@ int match_sid(struct cifs_sid *ctsid)
87 } 87 }
88 88
89 cFYI(1, ("matching sid: %s\n", wksidarr[i].sidname)); 89 cFYI(1, ("matching sid: %s\n", wksidarr[i].sidname));
90 return (0); /* sids compare/match */ 90 return 0; /* sids compare/match */
91 } 91 }
92 92
93 cFYI(1, ("No matching sid")); 93 cFYI(1, ("No matching sid"));
94 return (-1); 94 return -1;
95} 95}
96 96
97/* if the two SIDs (roughly equivalent to a UUID for a user or group) are 97/* if the two SIDs (roughly equivalent to a UUID for a user or group) are
@@ -102,16 +102,16 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
102 int num_subauth, num_sat, num_saw; 102 int num_subauth, num_sat, num_saw;
103 103
104 if ((!ctsid) || (!cwsid)) 104 if ((!ctsid) || (!cwsid))
105 return (0); 105 return 0;
106 106
107 /* compare the revision */ 107 /* compare the revision */
108 if (ctsid->revision != cwsid->revision) 108 if (ctsid->revision != cwsid->revision)
109 return (0); 109 return 0;
110 110
111 /* compare all of the six auth values */ 111 /* compare all of the six auth values */
112 for (i = 0; i < 6; ++i) { 112 for (i = 0; i < 6; ++i) {
113 if (ctsid->authority[i] != cwsid->authority[i]) 113 if (ctsid->authority[i] != cwsid->authority[i])
114 return (0); 114 return 0;
115 } 115 }
116 116
117 /* compare all of the subauth values if any */ 117 /* compare all of the subauth values if any */
@@ -121,11 +121,11 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
121 if (num_subauth) { 121 if (num_subauth) {
122 for (i = 0; i < num_subauth; ++i) { 122 for (i = 0; i < num_subauth; ++i) {
123 if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) 123 if (ctsid->sub_auth[i] != cwsid->sub_auth[i])
124 return (0); 124 return 0;
125 } 125 }
126 } 126 }
127 127
128 return (1); /* sids compare/match */ 128 return 1; /* sids compare/match */
129} 129}
130 130
131 131
@@ -169,8 +169,7 @@ static void copy_sec_desc(const struct cifs_ntsd *pntsd,
169 for (i = 0; i < 6; i++) 169 for (i = 0; i < 6; i++)
170 ngroup_sid_ptr->authority[i] = group_sid_ptr->authority[i]; 170 ngroup_sid_ptr->authority[i] = group_sid_ptr->authority[i];
171 for (i = 0; i < 5; i++) 171 for (i = 0; i < 5; i++)
172 ngroup_sid_ptr->sub_auth[i] = 172 ngroup_sid_ptr->sub_auth[i] = group_sid_ptr->sub_auth[i];
173 cpu_to_le32(group_sid_ptr->sub_auth[i]);
174 173
175 return; 174 return;
176} 175}
@@ -285,7 +284,7 @@ static __u16 fill_ace_for_sid(struct cifs_ace *pntace,
285 size = 1 + 1 + 2 + 4 + 1 + 1 + 6 + (psid->num_subauth * 4); 284 size = 1 + 1 + 2 + 4 + 1 + 1 + 6 + (psid->num_subauth * 4);
286 pntace->size = cpu_to_le16(size); 285 pntace->size = cpu_to_le16(size);
287 286
288 return (size); 287 return size;
289} 288}
290 289
291 290
@@ -426,7 +425,7 @@ static int set_chmod_dacl(struct cifs_acl *pndacl, struct cifs_sid *pownersid,
426 pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl)); 425 pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl));
427 pndacl->num_aces = cpu_to_le32(3); 426 pndacl->num_aces = cpu_to_le32(3);
428 427
429 return (0); 428 return 0;
430} 429}
431 430
432 431
@@ -510,7 +509,7 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len,
510 sizeof(struct cifs_sid)); */ 509 sizeof(struct cifs_sid)); */
511 510
512 511
513 return (0); 512 return 0;
514} 513}
515 514
516 515
@@ -527,7 +526,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
527 struct cifs_acl *ndacl_ptr = NULL; /* no need for SACL ptr */ 526 struct cifs_acl *ndacl_ptr = NULL; /* no need for SACL ptr */
528 527
529 if ((inode == NULL) || (pntsd == NULL) || (pnntsd == NULL)) 528 if ((inode == NULL) || (pntsd == NULL) || (pnntsd == NULL))
530 return (-EIO); 529 return -EIO;
531 530
532 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + 531 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
533 le32_to_cpu(pntsd->osidoffset)); 532 le32_to_cpu(pntsd->osidoffset));
@@ -550,7 +549,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
550 /* copy security descriptor control portion and owner and group sid */ 549 /* copy security descriptor control portion and owner and group sid */
551 copy_sec_desc(pntsd, pnntsd, sidsoffset); 550 copy_sec_desc(pntsd, pnntsd, sidsoffset);
552 551
553 return (rc); 552 return rc;
554} 553}
555 554
556 555
@@ -629,11 +628,11 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
629 cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode)); 628 cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
630 629
631 if (!inode) 630 if (!inode)
632 return (rc); 631 return rc;
633 632
634 sb = inode->i_sb; 633 sb = inode->i_sb;
635 if (sb == NULL) 634 if (sb == NULL)
636 return (rc); 635 return rc;
637 636
638 cifs_sb = CIFS_SB(sb); 637 cifs_sb = CIFS_SB(sb);
639 xid = GetXid(); 638 xid = GetXid();
@@ -652,7 +651,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
652 if (rc != 0) { 651 if (rc != 0) {
653 cERROR(1, ("Unable to open file to set ACL")); 652 cERROR(1, ("Unable to open file to set ACL"));
654 FreeXid(xid); 653 FreeXid(xid);
655 return (rc); 654 return rc;
656 } 655 }
657 } 656 }
658 657
@@ -665,7 +664,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
665 664
666 FreeXid(xid); 665 FreeXid(xid);
667 666
668 return (rc); 667 return rc;
669} 668}
670 669
671/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */ 670/* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */
@@ -715,7 +714,7 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
715 if (!pnntsd) { 714 if (!pnntsd) {
716 cERROR(1, ("Unable to allocate security descriptor")); 715 cERROR(1, ("Unable to allocate security descriptor"));
717 kfree(pntsd); 716 kfree(pntsd);
718 return (-ENOMEM); 717 return -ENOMEM;
719 } 718 }
720 719
721 rc = build_sec_desc(pntsd, pnntsd, inode, nmode); 720 rc = build_sec_desc(pntsd, pnntsd, inode, nmode);
@@ -732,6 +731,6 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
732 kfree(pntsd); 731 kfree(pntsd);
733 } 732 }
734 733
735 return (rc); 734 return rc;
736} 735}
737#endif /* CONFIG_CIFS_EXPERIMENTAL */ 736#endif /* CONFIG_CIFS_EXPERIMENTAL */
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index 4ff8939c6cc7..83fd40dc1ef0 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -310,9 +310,8 @@ void calc_lanman_hash(struct cifsSesInfo *ses, char *lnm_session_key)
310 utf8 and other multibyte codepages each need their own strupper 310 utf8 and other multibyte codepages each need their own strupper
311 function since a byte at a time will ont work. */ 311 function since a byte at a time will ont work. */
312 312
313 for (i = 0; i < CIFS_ENCPWD_SIZE; i++) { 313 for (i = 0; i < CIFS_ENCPWD_SIZE; i++)
314 password_with_pad[i] = toupper(password_with_pad[i]); 314 password_with_pad[i] = toupper(password_with_pad[i]);
315 }
316 315
317 SMBencrypt(password_with_pad, ses->server->cryptKey, lnm_session_key); 316 SMBencrypt(password_with_pad, ses->server->cryptKey, lnm_session_key);
318 /* clear password before we return/free memory */ 317 /* clear password before we return/free memory */
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 22857c639df5..fe5f6809cba6 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -766,7 +766,7 @@ const struct file_operations cifs_dir_ops = {
766}; 766};
767 767
768static void 768static void
769cifs_init_once(struct kmem_cache *cachep, void *inode) 769cifs_init_once(void *inode)
770{ 770{
771 struct cifsInodeInfo *cifsi = inode; 771 struct cifsInodeInfo *cifsi = inode;
772 772
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 9cfcf326ead3..7e1cf262effe 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -27,7 +27,7 @@
27#define MAX_SES_INFO 2 27#define MAX_SES_INFO 2
28#define MAX_TCON_INFO 4 28#define MAX_TCON_INFO 4
29 29
30#define MAX_TREE_SIZE 2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1 30#define MAX_TREE_SIZE (2 + MAX_SERVER_SIZE + 1 + MAX_SHARE_SIZE + 1)
31#define MAX_SERVER_SIZE 15 31#define MAX_SERVER_SIZE 15
32#define MAX_SHARE_SIZE 64 /* used to be 20, this should still be enough */ 32#define MAX_SHARE_SIZE 64 /* used to be 20, this should still be enough */
33#define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null 33#define MAX_USERNAME_SIZE 32 /* 32 is to allow for 15 char names + null
@@ -537,8 +537,8 @@ require use of the stronger protocol */
537#endif /* WEAK_PW_HASH */ 537#endif /* WEAK_PW_HASH */
538#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */ 538#define CIFSSEC_MUST_SEAL 0x40040 /* not supported yet */
539 539
540#define CIFSSEC_DEF CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2 540#define CIFSSEC_DEF (CIFSSEC_MAY_SIGN | CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2)
541#define CIFSSEC_MAX CIFSSEC_MUST_SIGN | CIFSSEC_MUST_NTLMV2 541#define CIFSSEC_MAX (CIFSSEC_MUST_SIGN | CIFSSEC_MUST_NTLMV2)
542#define CIFSSEC_AUTH_MASK (CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_LANMAN | CIFSSEC_MAY_PLNTXT | CIFSSEC_MAY_KRB5) 542#define CIFSSEC_AUTH_MASK (CIFSSEC_MAY_NTLM | CIFSSEC_MAY_NTLMV2 | CIFSSEC_MAY_LANMAN | CIFSSEC_MAY_PLNTXT | CIFSSEC_MAY_KRB5)
543/* 543/*
544 ***************************************************************** 544 *****************************************************************
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 0f327c224da3..409abce12732 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -31,7 +31,7 @@
31#else 31#else
32#define CIFS_PROT 0 32#define CIFS_PROT 0
33#endif 33#endif
34#define POSIX_PROT CIFS_PROT+1 34#define POSIX_PROT (CIFS_PROT+1)
35#define BAD_PROT 0xFFFF 35#define BAD_PROT 0xFFFF
36 36
37/* SMB command codes */ 37/* SMB command codes */
@@ -341,7 +341,7 @@
341#define CREATE_COMPLETE_IF_OPLK 0x00000100 /* should be zero */ 341#define CREATE_COMPLETE_IF_OPLK 0x00000100 /* should be zero */
342#define CREATE_NO_EA_KNOWLEDGE 0x00000200 342#define CREATE_NO_EA_KNOWLEDGE 0x00000200
343#define CREATE_EIGHT_DOT_THREE 0x00000400 /* doc says this is obsolete 343#define CREATE_EIGHT_DOT_THREE 0x00000400 /* doc says this is obsolete
344 "open for recovery" flag - should 344 "open for recovery" flag should
345 be zero in any case */ 345 be zero in any case */
346#define CREATE_OPEN_FOR_RECOVERY 0x00000400 346#define CREATE_OPEN_FOR_RECOVERY 0x00000400
347#define CREATE_RANDOM_ACCESS 0x00000800 347#define CREATE_RANDOM_ACCESS 0x00000800
@@ -414,8 +414,8 @@ struct smb_hdr {
414 __u8 WordCount; 414 __u8 WordCount;
415} __attribute__((packed)); 415} __attribute__((packed));
416/* given a pointer to an smb_hdr retrieve the value of byte count */ 416/* given a pointer to an smb_hdr retrieve the value of byte count */
417#define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount))) 417#define BCC(smb_var) (*(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount)))
418#define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount))) 418#define BCC_LE(smb_var) (*(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount)))
419/* given a pointer to an smb_hdr retrieve the pointer to the byte area */ 419/* given a pointer to an smb_hdr retrieve the pointer to the byte area */
420#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount) + 2) 420#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount) + 2)
421 421
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 4511b708f0f3..c621ffa2ca90 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -686,11 +686,10 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
686 SecurityBlob, 686 SecurityBlob,
687 count - 16, 687 count - 16,
688 &server->secType); 688 &server->secType);
689 if (rc == 1) { 689 if (rc == 1)
690 rc = 0; 690 rc = 0;
691 } else { 691 else
692 rc = -EINVAL; 692 rc = -EINVAL;
693 }
694 } 693 }
695 } else 694 } else
696 server->capabilities &= ~CAP_EXTENDED_SECURITY; 695 server->capabilities &= ~CAP_EXTENDED_SECURITY;
@@ -3914,7 +3913,10 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3914 bool is_unicode; 3913 bool is_unicode;
3915 struct dfs_referral_level_3 *ref; 3914 struct dfs_referral_level_3 *ref;
3916 3915
3917 is_unicode = pSMBr->hdr.Flags2 & SMBFLG2_UNICODE; 3916 if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE)
3917 is_unicode = true;
3918 else
3919 is_unicode = false;
3918 *num_of_nodes = le16_to_cpu(pSMBr->NumberOfReferrals); 3920 *num_of_nodes = le16_to_cpu(pSMBr->NumberOfReferrals);
3919 3921
3920 if (*num_of_nodes < 1) { 3922 if (*num_of_nodes < 1) {
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e8fa46c7cff2..b51d5777cde6 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -455,7 +455,7 @@ incomplete_rcv:
455 /* Note that FC 1001 length is big endian on the wire, 455 /* Note that FC 1001 length is big endian on the wire,
456 but we convert it here so it is always manipulated 456 but we convert it here so it is always manipulated
457 as host byte order */ 457 as host byte order */
458 pdu_length = ntohl(smb_buffer->smb_buf_length); 458 pdu_length = be32_to_cpu((__force __be32)smb_buffer->smb_buf_length);
459 smb_buffer->smb_buf_length = pdu_length; 459 smb_buffer->smb_buf_length = pdu_length;
460 460
461 cFYI(1, ("rfc1002 length 0x%x", pdu_length+4)); 461 cFYI(1, ("rfc1002 length 0x%x", pdu_length+4));
@@ -1461,6 +1461,39 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
1461 return rc; 1461 return rc;
1462} 1462}
1463 1463
1464#ifdef CONFIG_DEBUG_LOCK_ALLOC
1465static struct lock_class_key cifs_key[2];
1466static struct lock_class_key cifs_slock_key[2];
1467
1468static inline void
1469cifs_reclassify_socket4(struct socket *sock)
1470{
1471 struct sock *sk = sock->sk;
1472 BUG_ON(sock_owned_by_user(sk));
1473 sock_lock_init_class_and_name(sk, "slock-AF_INET-CIFS",
1474 &cifs_slock_key[0], "sk_lock-AF_INET-CIFS", &cifs_key[0]);
1475}
1476
1477static inline void
1478cifs_reclassify_socket6(struct socket *sock)
1479{
1480 struct sock *sk = sock->sk;
1481 BUG_ON(sock_owned_by_user(sk));
1482 sock_lock_init_class_and_name(sk, "slock-AF_INET6-CIFS",
1483 &cifs_slock_key[1], "sk_lock-AF_INET6-CIFS", &cifs_key[1]);
1484}
1485#else
1486static inline void
1487cifs_reclassify_socket4(struct socket *sock)
1488{
1489}
1490
1491static inline void
1492cifs_reclassify_socket6(struct socket *sock)
1493{
1494}
1495#endif
1496
1464/* See RFC1001 section 14 on representation of Netbios names */ 1497/* See RFC1001 section 14 on representation of Netbios names */
1465static void rfc1002mangle(char *target, char *source, unsigned int length) 1498static void rfc1002mangle(char *target, char *source, unsigned int length)
1466{ 1499{
@@ -1495,6 +1528,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1495 /* BB other socket options to set KEEPALIVE, NODELAY? */ 1528 /* BB other socket options to set KEEPALIVE, NODELAY? */
1496 cFYI(1, ("Socket created")); 1529 cFYI(1, ("Socket created"));
1497 (*csocket)->sk->sk_allocation = GFP_NOFS; 1530 (*csocket)->sk->sk_allocation = GFP_NOFS;
1531 cifs_reclassify_socket4(*csocket);
1498 } 1532 }
1499 } 1533 }
1500 1534
@@ -1627,6 +1661,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1627 /* BB other socket options to set KEEPALIVE, NODELAY? */ 1661 /* BB other socket options to set KEEPALIVE, NODELAY? */
1628 cFYI(1, ("ipv6 Socket created")); 1662 cFYI(1, ("ipv6 Socket created"));
1629 (*csocket)->sk->sk_allocation = GFP_NOFS; 1663 (*csocket)->sk->sk_allocation = GFP_NOFS;
1664 cifs_reclassify_socket6(*csocket);
1630 } 1665 }
1631 } 1666 }
1632 1667
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 2e904bd111c8..46e54d39461d 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1413,6 +1413,82 @@ out_busy:
1413 return -ETXTBSY; 1413 return -ETXTBSY;
1414} 1414}
1415 1415
1416static int
1417cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1418 int xid, char *full_path)
1419{
1420 int rc;
1421 struct cifsFileInfo *open_file;
1422 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
1423 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1424 struct cifsTconInfo *pTcon = cifs_sb->tcon;
1425
1426 /*
1427 * To avoid spurious oplock breaks from server, in the case of
1428 * inodes that we already have open, avoid doing path based
1429 * setting of file size if we can do it by handle.
1430 * This keeps our caching token (oplock) and avoids timeouts
1431 * when the local oplock break takes longer to flush
1432 * writebehind data than the SMB timeout for the SetPathInfo
1433 * request would allow
1434 */
1435 open_file = find_writable_file(cifsInode);
1436 if (open_file) {
1437 __u16 nfid = open_file->netfid;
1438 __u32 npid = open_file->pid;
1439 rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid,
1440 npid, false);
1441 atomic_dec(&open_file->wrtPending);
1442 cFYI(1, ("SetFSize for attrs rc = %d", rc));
1443 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
1444 unsigned int bytes_written;
1445 rc = CIFSSMBWrite(xid, pTcon, nfid, 0, attrs->ia_size,
1446 &bytes_written, NULL, NULL, 1);
1447 cFYI(1, ("Wrt seteof rc %d", rc));
1448 }
1449 } else
1450 rc = -EINVAL;
1451
1452 if (rc != 0) {
1453 /* Set file size by pathname rather than by handle
1454 either because no valid, writeable file handle for
1455 it was found or because there was an error setting
1456 it by handle */
1457 rc = CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size,
1458 false, cifs_sb->local_nls,
1459 cifs_sb->mnt_cifs_flags &
1460 CIFS_MOUNT_MAP_SPECIAL_CHR);
1461 cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc));
1462 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
1463 __u16 netfid;
1464 int oplock = 0;
1465
1466 rc = SMBLegacyOpen(xid, pTcon, full_path,
1467 FILE_OPEN, GENERIC_WRITE,
1468 CREATE_NOT_DIR, &netfid, &oplock, NULL,
1469 cifs_sb->local_nls,
1470 cifs_sb->mnt_cifs_flags &
1471 CIFS_MOUNT_MAP_SPECIAL_CHR);
1472 if (rc == 0) {
1473 unsigned int bytes_written;
1474 rc = CIFSSMBWrite(xid, pTcon, netfid, 0,
1475 attrs->ia_size,
1476 &bytes_written, NULL,
1477 NULL, 1);
1478 cFYI(1, ("wrt seteof rc %d", rc));
1479 CIFSSMBClose(xid, pTcon, netfid);
1480 }
1481 }
1482 }
1483
1484 if (rc == 0) {
1485 rc = cifs_vmtruncate(inode, attrs->ia_size);
1486 cifs_truncate_page(inode->i_mapping, inode->i_size);
1487 }
1488
1489 return rc;
1490}
1491
1416int cifs_setattr(struct dentry *direntry, struct iattr *attrs) 1492int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1417{ 1493{
1418 int xid; 1494 int xid;
@@ -1420,7 +1496,6 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1420 struct cifsTconInfo *pTcon; 1496 struct cifsTconInfo *pTcon;
1421 char *full_path = NULL; 1497 char *full_path = NULL;
1422 int rc = -EACCES; 1498 int rc = -EACCES;
1423 struct cifsFileInfo *open_file = NULL;
1424 FILE_BASIC_INFO time_buf; 1499 FILE_BASIC_INFO time_buf;
1425 bool set_time = false; 1500 bool set_time = false;
1426 bool set_dosattr = false; 1501 bool set_dosattr = false;
@@ -1472,78 +1547,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1472 } 1547 }
1473 1548
1474 if (attrs->ia_valid & ATTR_SIZE) { 1549 if (attrs->ia_valid & ATTR_SIZE) {
1475 /* To avoid spurious oplock breaks from server, in the case of 1550 rc = cifs_set_file_size(inode, attrs, xid, full_path);
1476 inodes that we already have open, avoid doing path based 1551 if (rc != 0)
1477 setting of file size if we can do it by handle.
1478 This keeps our caching token (oplock) and avoids timeouts
1479 when the local oplock break takes longer to flush
1480 writebehind data than the SMB timeout for the SetPathInfo
1481 request would allow */
1482
1483 open_file = find_writable_file(cifsInode);
1484 if (open_file) {
1485 __u16 nfid = open_file->netfid;
1486 __u32 npid = open_file->pid;
1487 rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size,
1488 nfid, npid, false);
1489 atomic_dec(&open_file->wrtPending);
1490 cFYI(1, ("SetFSize for attrs rc = %d", rc));
1491 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
1492 unsigned int bytes_written;
1493 rc = CIFSSMBWrite(xid, pTcon,
1494 nfid, 0, attrs->ia_size,
1495 &bytes_written, NULL, NULL,
1496 1 /* 45 seconds */);
1497 cFYI(1, ("Wrt seteof rc %d", rc));
1498 }
1499 } else
1500 rc = -EINVAL;
1501
1502 if (rc != 0) {
1503 /* Set file size by pathname rather than by handle
1504 either because no valid, writeable file handle for
1505 it was found or because there was an error setting
1506 it by handle */
1507 rc = CIFSSMBSetEOF(xid, pTcon, full_path,
1508 attrs->ia_size, false,
1509 cifs_sb->local_nls,
1510 cifs_sb->mnt_cifs_flags &
1511 CIFS_MOUNT_MAP_SPECIAL_CHR);
1512 cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc));
1513 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
1514 __u16 netfid;
1515 int oplock = 0;
1516
1517 rc = SMBLegacyOpen(xid, pTcon, full_path,
1518 FILE_OPEN, GENERIC_WRITE,
1519 CREATE_NOT_DIR, &netfid, &oplock,
1520 NULL, cifs_sb->local_nls,
1521 cifs_sb->mnt_cifs_flags &
1522 CIFS_MOUNT_MAP_SPECIAL_CHR);
1523 if (rc == 0) {
1524 unsigned int bytes_written;
1525 rc = CIFSSMBWrite(xid, pTcon,
1526 netfid, 0,
1527 attrs->ia_size,
1528 &bytes_written, NULL,
1529 NULL, 1 /* 45 sec */);
1530 cFYI(1, ("wrt seteof rc %d", rc));
1531 CIFSSMBClose(xid, pTcon, netfid);
1532 }
1533
1534 }
1535 }
1536
1537 /* Server is ok setting allocation size implicitly - no need
1538 to call:
1539 CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, true,
1540 cifs_sb->local_nls);
1541 */
1542
1543 if (rc == 0) {
1544 rc = cifs_vmtruncate(inode, attrs->ia_size);
1545 cifs_truncate_page(inode->i_mapping, inode->i_size);
1546 } else
1547 goto cifs_setattr_exit; 1552 goto cifs_setattr_exit;
1548 } 1553 }
1549 1554
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 83f306954883..5f40ed3473f5 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -690,6 +690,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
690 else 690 else
691 cifs_buf_release(cifsFile->srch_inf. 691 cifs_buf_release(cifsFile->srch_inf.
692 ntwrk_buf_start); 692 ntwrk_buf_start);
693 cifsFile->srch_inf.ntwrk_buf_start = NULL;
693 } 694 }
694 rc = initiate_cifs_search(xid, file); 695 rc = initiate_cifs_search(xid, file);
695 if (rc) { 696 if (rc) {
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 2f58dfc70083..830f51abb971 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -58,7 +58,7 @@ static void coda_destroy_inode(struct inode *inode)
58 kmem_cache_free(coda_inode_cachep, ITOC(inode)); 58 kmem_cache_free(coda_inode_cachep, ITOC(inode));
59} 59}
60 60
61static void init_once(struct kmem_cache * cachep, void *foo) 61static void init_once(void *foo)
62{ 62{
63 struct coda_inode_info *ei = (struct coda_inode_info *) foo; 63 struct coda_inode_info *ei = (struct coda_inode_info *) foo;
64 64
diff --git a/fs/dcache.c b/fs/dcache.c
index 3818d6ab76ca..f2584d22cb45 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -487,6 +487,7 @@ restart:
487 if (!cnt) 487 if (!cnt)
488 break; 488 break;
489 } 489 }
490 cond_resched_lock(&dcache_lock);
490 } 491 }
491 } 492 }
492 while (!list_empty(&tmp)) { 493 while (!list_empty(&tmp)) {
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 9e81addbd6ea..9606ee848fd8 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -150,17 +150,11 @@ static int dio_refill_pages(struct dio *dio)
150 int nr_pages; 150 int nr_pages;
151 151
152 nr_pages = min(dio->total_pages - dio->curr_page, DIO_PAGES); 152 nr_pages = min(dio->total_pages - dio->curr_page, DIO_PAGES);
153 down_read(&current->mm->mmap_sem); 153 ret = get_user_pages_fast(
154 ret = get_user_pages(
155 current, /* Task for fault acounting */
156 current->mm, /* whose pages? */
157 dio->curr_user_address, /* Where from? */ 154 dio->curr_user_address, /* Where from? */
158 nr_pages, /* How many pages? */ 155 nr_pages, /* How many pages? */
159 dio->rw == READ, /* Write to memory? */ 156 dio->rw == READ, /* Write to memory? */
160 0, /* force (?) */ 157 &dio->pages[0]); /* Put results here */
161 &dio->pages[0],
162 NULL); /* vmas */
163 up_read(&current->mm->mmap_sem);
164 158
165 if (ret < 0 && dio->blocks_available && (dio->rw & WRITE)) { 159 if (ret < 0 && dio->blocks_available && (dio->rw & WRITE)) {
166 struct page *page = ZERO_PAGE(0); 160 struct page *page = ZERO_PAGE(0);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 6f403cfba14f..448dfd597b5f 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -578,7 +578,7 @@ static struct file_system_type ecryptfs_fs_type = {
578 * Initializes the ecryptfs_inode_info_cache when it is created 578 * Initializes the ecryptfs_inode_info_cache when it is created
579 */ 579 */
580static void 580static void
581inode_info_init_once(struct kmem_cache *cachep, void *vptr) 581inode_info_init_once(void *vptr)
582{ 582{
583 struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr; 583 struct ecryptfs_inode_info *ei = (struct ecryptfs_inode_info *)vptr;
584 584
@@ -589,7 +589,7 @@ static struct ecryptfs_cache_info {
589 struct kmem_cache **cache; 589 struct kmem_cache **cache;
590 const char *name; 590 const char *name;
591 size_t size; 591 size_t size;
592 void (*ctor)(struct kmem_cache *cache, void *obj); 592 void (*ctor)(void *obj);
593} ecryptfs_cache_infos[] = { 593} ecryptfs_cache_infos[] = {
594 { 594 {
595 .cache = &ecryptfs_auth_tok_list_item_cache, 595 .cache = &ecryptfs_auth_tok_list_item_cache,
diff --git a/fs/efs/super.c b/fs/efs/super.c
index d733531b55e2..567b134fa1f1 100644
--- a/fs/efs/super.c
+++ b/fs/efs/super.c
@@ -70,7 +70,7 @@ static void efs_destroy_inode(struct inode *inode)
70 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode)); 70 kmem_cache_free(efs_inode_cachep, INODE_INFO(inode));
71} 71}
72 72
73static void init_once(struct kmem_cache *cachep, void *foo) 73static void init_once(void *foo)
74{ 74{
75 struct efs_inode_info *ei = (struct efs_inode_info *) foo; 75 struct efs_inode_info *ei = (struct efs_inode_info *) foo;
76 76
diff --git a/fs/exec.c b/fs/exec.c
index 5e559013e303..b8792a131533 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -42,13 +42,13 @@
42#include <linux/module.h> 42#include <linux/module.h>
43#include <linux/namei.h> 43#include <linux/namei.h>
44#include <linux/proc_fs.h> 44#include <linux/proc_fs.h>
45#include <linux/ptrace.h>
46#include <linux/mount.h> 45#include <linux/mount.h>
47#include <linux/security.h> 46#include <linux/security.h>
48#include <linux/syscalls.h> 47#include <linux/syscalls.h>
49#include <linux/tsacct_kern.h> 48#include <linux/tsacct_kern.h>
50#include <linux/cn_proc.h> 49#include <linux/cn_proc.h>
51#include <linux/audit.h> 50#include <linux/audit.h>
51#include <linux/tracehook.h>
52 52
53#include <asm/uaccess.h> 53#include <asm/uaccess.h>
54#include <asm/mmu_context.h> 54#include <asm/mmu_context.h>
@@ -1071,13 +1071,8 @@ EXPORT_SYMBOL(prepare_binprm);
1071 1071
1072static int unsafe_exec(struct task_struct *p) 1072static int unsafe_exec(struct task_struct *p)
1073{ 1073{
1074 int unsafe = 0; 1074 int unsafe = tracehook_unsafe_exec(p);
1075 if (p->ptrace & PT_PTRACED) { 1075
1076 if (p->ptrace & PT_PTRACE_CAP)
1077 unsafe |= LSM_UNSAFE_PTRACE_CAP;
1078 else
1079 unsafe |= LSM_UNSAFE_PTRACE;
1080 }
1081 if (atomic_read(&p->fs->count) > 1 || 1076 if (atomic_read(&p->fs->count) > 1 ||
1082 atomic_read(&p->files->count) > 1 || 1077 atomic_read(&p->files->count) > 1 ||
1083 atomic_read(&p->sighand->count) > 1) 1078 atomic_read(&p->sighand->count) > 1)
@@ -1214,6 +1209,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
1214 read_unlock(&binfmt_lock); 1209 read_unlock(&binfmt_lock);
1215 retval = fn(bprm, regs); 1210 retval = fn(bprm, regs);
1216 if (retval >= 0) { 1211 if (retval >= 0) {
1212 tracehook_report_exec(fmt, bprm, regs);
1217 put_binfmt(fmt); 1213 put_binfmt(fmt);
1218 allow_write_access(bprm->file); 1214 allow_write_access(bprm->file);
1219 if (bprm->file) 1215 if (bprm->file)
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 31308a3b0b8b..fd88c7b43e66 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -159,7 +159,7 @@ static void ext2_destroy_inode(struct inode *inode)
159 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); 159 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
160} 160}
161 161
162static void init_once(struct kmem_cache * cachep, void *foo) 162static void init_once(void *foo)
163{ 163{
164 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; 164 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
165 165
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 615788c6843a..8ddced384674 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -472,7 +472,7 @@ static void ext3_destroy_inode(struct inode *inode)
472 kmem_cache_free(ext3_inode_cachep, EXT3_I(inode)); 472 kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
473} 473}
474 474
475static void init_once(struct kmem_cache * cachep, void *foo) 475static void init_once(void *foo)
476{ 476{
477 struct ext3_inode_info *ei = (struct ext3_inode_info *) foo; 477 struct ext3_inode_info *ei = (struct ext3_inode_info *) foo;
478 478
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 1cb371dcd609..b5479b1dff14 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -595,7 +595,7 @@ static void ext4_destroy_inode(struct inode *inode)
595 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode)); 595 kmem_cache_free(ext4_inode_cachep, EXT4_I(inode));
596} 596}
597 597
598static void init_once(struct kmem_cache *cachep, void *foo) 598static void init_once(void *foo)
599{ 599{
600 struct ext4_inode_info *ei = (struct ext4_inode_info *) foo; 600 struct ext4_inode_info *ei = (struct ext4_inode_info *) foo;
601 601
diff --git a/fs/fat/cache.c b/fs/fat/cache.c
index 3a9ecac8d61f..3222f51c41cf 100644
--- a/fs/fat/cache.c
+++ b/fs/fat/cache.c
@@ -36,7 +36,7 @@ static inline int fat_max_cache(struct inode *inode)
36 36
37static struct kmem_cache *fat_cache_cachep; 37static struct kmem_cache *fat_cache_cachep;
38 38
39static void init_once(struct kmem_cache *cachep, void *foo) 39static void init_once(void *foo)
40{ 40{
41 struct fat_cache *cache = (struct fat_cache *)foo; 41 struct fat_cache *cache = (struct fat_cache *)foo;
42 42
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 23676f9d79ce..6d266d793e2c 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -498,7 +498,7 @@ static void fat_destroy_inode(struct inode *inode)
498 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode)); 498 kmem_cache_free(fat_inode_cachep, MSDOS_I(inode));
499} 499}
500 500
501static void init_once(struct kmem_cache *cachep, void *foo) 501static void init_once(void *foo)
502{ 502{
503 struct msdos_inode_info *ei = (struct msdos_inode_info *)foo; 503 struct msdos_inode_info *ei = (struct msdos_inode_info *)foo;
504 504
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 7d2f7d6e22e2..d2249f174e20 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -956,7 +956,7 @@ static inline void unregister_fuseblk(void)
956} 956}
957#endif 957#endif
958 958
959static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo) 959static void fuse_inode_init_once(void *foo)
960{ 960{
961 struct inode * inode = foo; 961 struct inode * inode = foo;
962 962
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index bcc668d0fadd..bb2cc303ac29 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -24,7 +24,7 @@
24#include "util.h" 24#include "util.h"
25#include "glock.h" 25#include "glock.h"
26 26
27static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo) 27static void gfs2_init_inode_once(void *foo)
28{ 28{
29 struct gfs2_inode *ip = foo; 29 struct gfs2_inode *ip = foo;
30 30
@@ -33,7 +33,7 @@ static void gfs2_init_inode_once(struct kmem_cache *cachep, void *foo)
33 ip->i_alloc = NULL; 33 ip->i_alloc = NULL;
34} 34}
35 35
36static void gfs2_init_glock_once(struct kmem_cache *cachep, void *foo) 36static void gfs2_init_glock_once(void *foo)
37{ 37{
38 struct gfs2_glock *gl = foo; 38 struct gfs2_glock *gl = foo;
39 39
diff --git a/fs/hfs/super.c b/fs/hfs/super.c
index ac2ec5ef66e4..4abb1047c689 100644
--- a/fs/hfs/super.c
+++ b/fs/hfs/super.c
@@ -432,7 +432,7 @@ static struct file_system_type hfs_fs_type = {
432 .fs_flags = FS_REQUIRES_DEV, 432 .fs_flags = FS_REQUIRES_DEV,
433}; 433};
434 434
435static void hfs_init_once(struct kmem_cache *cachep, void *p) 435static void hfs_init_once(void *p)
436{ 436{
437 struct hfs_inode_info *i = p; 437 struct hfs_inode_info *i = p;
438 438
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 3859118531c7..e834e578c93f 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -485,7 +485,7 @@ static struct file_system_type hfsplus_fs_type = {
485 .fs_flags = FS_REQUIRES_DEV, 485 .fs_flags = FS_REQUIRES_DEV,
486}; 486};
487 487
488static void hfsplus_init_once(struct kmem_cache *cachep, void *p) 488static void hfsplus_init_once(void *p)
489{ 489{
490 struct hfsplus_inode_info *i = p; 490 struct hfsplus_inode_info *i = p;
491 491
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index f63a699ec659..b8ae9c90ada0 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -173,7 +173,7 @@ static void hpfs_destroy_inode(struct inode *inode)
173 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode)); 173 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
174} 174}
175 175
176static void init_once(struct kmem_cache *cachep, void *foo) 176static void init_once(void *foo)
177{ 177{
178 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; 178 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
179 179
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index dbd01d262ca4..3f58923fb39b 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -705,7 +705,7 @@ static const struct address_space_operations hugetlbfs_aops = {
705}; 705};
706 706
707 707
708static void init_once(struct kmem_cache *cachep, void *foo) 708static void init_once(void *foo)
709{ 709{
710 struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo; 710 struct hugetlbfs_inode_info *ei = (struct hugetlbfs_inode_info *)foo;
711 711
diff --git a/fs/inode.c b/fs/inode.c
index c36d9480335c..b6726f644530 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -209,7 +209,7 @@ void inode_init_once(struct inode *inode)
209 INIT_LIST_HEAD(&inode->i_dentry); 209 INIT_LIST_HEAD(&inode->i_dentry);
210 INIT_LIST_HEAD(&inode->i_devices); 210 INIT_LIST_HEAD(&inode->i_devices);
211 INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC); 211 INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC);
212 rwlock_init(&inode->i_data.tree_lock); 212 spin_lock_init(&inode->i_data.tree_lock);
213 spin_lock_init(&inode->i_data.i_mmap_lock); 213 spin_lock_init(&inode->i_data.i_mmap_lock);
214 INIT_LIST_HEAD(&inode->i_data.private_list); 214 INIT_LIST_HEAD(&inode->i_data.private_list);
215 spin_lock_init(&inode->i_data.private_lock); 215 spin_lock_init(&inode->i_data.private_lock);
@@ -224,7 +224,7 @@ void inode_init_once(struct inode *inode)
224 224
225EXPORT_SYMBOL(inode_init_once); 225EXPORT_SYMBOL(inode_init_once);
226 226
227static void init_once(struct kmem_cache * cachep, void *foo) 227static void init_once(void *foo)
228{ 228{
229 struct inode * inode = (struct inode *) foo; 229 struct inode * inode = (struct inode *) foo;
230 230
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 044a254d526b..26948a6033b6 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -73,7 +73,7 @@ static void isofs_destroy_inode(struct inode *inode)
73 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode)); 73 kmem_cache_free(isofs_inode_cachep, ISOFS_I(inode));
74} 74}
75 75
76static void init_once(struct kmem_cache *cachep, void *foo) 76static void init_once(void *foo)
77{ 77{
78 struct iso_inode_info *ei = foo; 78 struct iso_inode_info *ei = foo;
79 79
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 7da69eae49e4..efd401257ed9 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -44,7 +44,7 @@ static void jffs2_destroy_inode(struct inode *inode)
44 kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode)); 44 kmem_cache_free(jffs2_inode_cachep, JFFS2_INODE_INFO(inode));
45} 45}
46 46
47static void jffs2_i_init_once(struct kmem_cache *cachep, void *foo) 47static void jffs2_i_init_once(void *foo)
48{ 48{
49 struct jffs2_inode_info *f = foo; 49 struct jffs2_inode_info *f = foo;
50 50
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 854ff0ec574f..c350057087dd 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -182,7 +182,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp)
182 182
183#endif 183#endif
184 184
185static void init_once(struct kmem_cache *cachep, void *foo) 185static void init_once(void *foo)
186{ 186{
187 struct metapage *mp = (struct metapage *)foo; 187 struct metapage *mp = (struct metapage *)foo;
188 188
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 359c091d8965..3630718be395 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -760,7 +760,7 @@ static struct file_system_type jfs_fs_type = {
760 .fs_flags = FS_REQUIRES_DEV, 760 .fs_flags = FS_REQUIRES_DEV,
761}; 761};
762 762
763static void init_once(struct kmem_cache *cachep, void *foo) 763static void init_once(void *foo)
764{ 764{
765 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo; 765 struct jfs_inode_info *jfs_ip = (struct jfs_inode_info *) foo;
766 766
diff --git a/fs/locks.c b/fs/locks.c
index 01490300f7cb..5eb259e3cd38 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -201,7 +201,7 @@ EXPORT_SYMBOL(locks_init_lock);
201 * Initialises the fields of the file lock which are invariant for 201 * Initialises the fields of the file lock which are invariant for
202 * free file_locks. 202 * free file_locks.
203 */ 203 */
204static void init_once(struct kmem_cache *cache, void *foo) 204static void init_once(void *foo)
205{ 205{
206 struct file_lock *lock = (struct file_lock *) foo; 206 struct file_lock *lock = (struct file_lock *) foo;
207 207
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 523d73713418..d1d1eb84679d 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -68,7 +68,7 @@ static void minix_destroy_inode(struct inode *inode)
68 kmem_cache_free(minix_inode_cachep, minix_i(inode)); 68 kmem_cache_free(minix_inode_cachep, minix_i(inode));
69} 69}
70 70
71static void init_once(struct kmem_cache * cachep, void *foo) 71static void init_once(void *foo)
72{ 72{
73 struct minix_inode_info *ei = (struct minix_inode_info *) foo; 73 struct minix_inode_info *ei = (struct minix_inode_info *) foo;
74 74
diff --git a/fs/namespace.c b/fs/namespace.c
index 4f6f7635b59c..f30b11e2240e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -309,10 +309,9 @@ static void handle_write_count_underflow(struct vfsmount *mnt)
309 */ 309 */
310 if ((atomic_read(&mnt->__mnt_writers) < 0) && 310 if ((atomic_read(&mnt->__mnt_writers) < 0) &&
311 !(mnt->mnt_flags & MNT_IMBALANCED_WRITE_COUNT)) { 311 !(mnt->mnt_flags & MNT_IMBALANCED_WRITE_COUNT)) {
312 printk(KERN_DEBUG "leak detected on mount(%p) writers " 312 WARN(1, KERN_DEBUG "leak detected on mount(%p) writers "
313 "count: %d\n", 313 "count: %d\n",
314 mnt, atomic_read(&mnt->__mnt_writers)); 314 mnt, atomic_read(&mnt->__mnt_writers));
315 WARN_ON(1);
316 /* use the flag to keep the dmesg spam down */ 315 /* use the flag to keep the dmesg spam down */
317 mnt->mnt_flags |= MNT_IMBALANCED_WRITE_COUNT; 316 mnt->mnt_flags |= MNT_IMBALANCED_WRITE_COUNT;
318 } 317 }
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 2e5ab1204dec..d642f0e5b365 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -64,7 +64,7 @@ static void ncp_destroy_inode(struct inode *inode)
64 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode)); 64 kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
65} 65}
66 66
67static void init_once(struct kmem_cache *cachep, void *foo) 67static void init_once(void *foo)
68{ 68{
69 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo; 69 struct ncp_inode_info *ei = (struct ncp_inode_info *) foo;
70 70
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index df23f987da6b..52daefa2f521 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1242,7 +1242,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
1242#endif 1242#endif
1243} 1243}
1244 1244
1245static void init_once(struct kmem_cache * cachep, void *foo) 1245static void init_once(void *foo)
1246{ 1246{
1247 struct nfs_inode *nfsi = (struct nfs_inode *) foo; 1247 struct nfs_inode *nfsi = (struct nfs_inode *) foo;
1248 1248
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 3e76f3b216bc..4a46743b5077 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -3080,7 +3080,7 @@ struct kmem_cache *ntfs_inode_cache;
3080struct kmem_cache *ntfs_big_inode_cache; 3080struct kmem_cache *ntfs_big_inode_cache;
3081 3081
3082/* Init once constructor for the inode slab cache. */ 3082/* Init once constructor for the inode slab cache. */
3083static void ntfs_big_inode_init_once(struct kmem_cache *cachep, void *foo) 3083static void ntfs_big_inode_init_once(void *foo)
3084{ 3084{
3085 ntfs_inode *ni = (ntfs_inode *)foo; 3085 ntfs_inode *ni = (ntfs_inode *)foo;
3086 3086
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index e48aba698b77..533a789c3ef8 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -267,8 +267,7 @@ static ssize_t dlmfs_file_write(struct file *filp,
267 return writelen; 267 return writelen;
268} 268}
269 269
270static void dlmfs_init_once(struct kmem_cache *cachep, 270static void dlmfs_init_once(void *foo)
271 void *foo)
272{ 271{
273 struct dlmfs_inode_private *ip = 272 struct dlmfs_inode_private *ip =
274 (struct dlmfs_inode_private *) foo; 273 (struct dlmfs_inode_private *) foo;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index ccecfe5094fa..2560b33889aa 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1118,7 +1118,7 @@ bail:
1118 return status; 1118 return status;
1119} 1119}
1120 1120
1121static void ocfs2_inode_init_once(struct kmem_cache *cachep, void *data) 1121static void ocfs2_inode_init_once(void *data)
1122{ 1122{
1123 struct ocfs2_inode_info *oi = data; 1123 struct ocfs2_inode_info *oi = data;
1124 1124
diff --git a/fs/omfs/Makefile b/fs/omfs/Makefile
new file mode 100644
index 000000000000..8b82b63f1129
--- /dev/null
+++ b/fs/omfs/Makefile
@@ -0,0 +1,4 @@
1
2obj-$(CONFIG_OMFS_FS) += omfs.o
3
4omfs-y := bitmap.o dir.o file.o inode.o
diff --git a/fs/omfs/bitmap.c b/fs/omfs/bitmap.c
new file mode 100644
index 000000000000..dc75f22be3f2
--- /dev/null
+++ b/fs/omfs/bitmap.c
@@ -0,0 +1,192 @@
1#include <linux/kernel.h>
2#include <linux/fs.h>
3#include <linux/buffer_head.h>
4#include <asm/div64.h>
5#include "omfs.h"
6
7unsigned long omfs_count_free(struct super_block *sb)
8{
9 unsigned int i;
10 unsigned long sum = 0;
11 struct omfs_sb_info *sbi = OMFS_SB(sb);
12 int nbits = sb->s_blocksize * 8;
13
14 for (i = 0; i < sbi->s_imap_size; i++)
15 sum += nbits - bitmap_weight(sbi->s_imap[i], nbits);
16
17 return sum;
18}
19
20/*
21 * Counts the run of zero bits starting at bit up to max.
22 * It handles the case where a run might spill over a buffer.
23 * Called with bitmap lock.
24 */
25static int count_run(unsigned long **addr, int nbits,
26 int addrlen, int bit, int max)
27{
28 int count = 0;
29 int x;
30
31 for (; addrlen > 0; addrlen--, addr++) {
32 x = find_next_bit(*addr, nbits, bit);
33 count += x - bit;
34
35 if (x < nbits || count > max)
36 return min(count, max);
37
38 bit = 0;
39 }
40 return min(count, max);
41}
42
43/*
44 * Sets or clears the run of count bits starting with bit.
45 * Called with bitmap lock.
46 */
47static int set_run(struct super_block *sb, int map,
48 int nbits, int bit, int count, int set)
49{
50 int i;
51 int err;
52 struct buffer_head *bh;
53 struct omfs_sb_info *sbi = OMFS_SB(sb);
54
55 err = -ENOMEM;
56 bh = sb_bread(sb, clus_to_blk(sbi, sbi->s_bitmap_ino) + map);
57 if (!bh)
58 goto out;
59
60 for (i = 0; i < count; i++, bit++) {
61 if (bit >= nbits) {
62 bit = 0;
63 map++;
64
65 mark_buffer_dirty(bh);
66 brelse(bh);
67 bh = sb_bread(sb,
68 clus_to_blk(sbi, sbi->s_bitmap_ino) + map);
69 if (!bh)
70 goto out;
71 }
72 if (set) {
73 set_bit(bit, sbi->s_imap[map]);
74 set_bit(bit, (long *) bh->b_data);
75 } else {
76 clear_bit(bit, sbi->s_imap[map]);
77 clear_bit(bit, (long *) bh->b_data);
78 }
79 }
80 mark_buffer_dirty(bh);
81 brelse(bh);
82 err = 0;
83out:
84 return err;
85}
86
87/*
88 * Tries to allocate exactly one block. Returns true if sucessful.
89 */
90int omfs_allocate_block(struct super_block *sb, u64 block)
91{
92 struct buffer_head *bh;
93 struct omfs_sb_info *sbi = OMFS_SB(sb);
94 int bits_per_entry = 8 * sb->s_blocksize;
95 int map, bit;
96 int ret = 0;
97 u64 tmp;
98
99 tmp = block;
100 bit = do_div(tmp, bits_per_entry);
101 map = tmp;
102
103 mutex_lock(&sbi->s_bitmap_lock);
104 if (map >= sbi->s_imap_size || test_and_set_bit(bit, sbi->s_imap[map]))
105 goto out;
106
107 if (sbi->s_bitmap_ino > 0) {
108 bh = sb_bread(sb, clus_to_blk(sbi, sbi->s_bitmap_ino) + map);
109 if (!bh)
110 goto out;
111
112 set_bit(bit, (long *) bh->b_data);
113 mark_buffer_dirty(bh);
114 brelse(bh);
115 }
116 ret = 1;
117out:
118 mutex_unlock(&sbi->s_bitmap_lock);
119 return ret;
120}
121
122
123/*
124 * Tries to allocate a set of blocks. The request size depends on the
125 * type: for inodes, we must allocate sbi->s_mirrors blocks, and for file
126 * blocks, we try to allocate sbi->s_clustersize, but can always get away
127 * with just one block.
128 */
129int omfs_allocate_range(struct super_block *sb,
130 int min_request,
131 int max_request,
132 u64 *return_block,
133 int *return_size)
134{
135 struct omfs_sb_info *sbi = OMFS_SB(sb);
136 int bits_per_entry = 8 * sb->s_blocksize;
137 int ret = 0;
138 int i, run, bit;
139
140 mutex_lock(&sbi->s_bitmap_lock);
141 for (i = 0; i < sbi->s_imap_size; i++) {
142 bit = 0;
143 while (bit < bits_per_entry) {
144 bit = find_next_zero_bit(sbi->s_imap[i], bits_per_entry,
145 bit);
146
147 if (bit == bits_per_entry)
148 break;
149
150 run = count_run(&sbi->s_imap[i], bits_per_entry,
151 sbi->s_imap_size-i, bit, max_request);
152
153 if (run >= min_request)
154 goto found;
155 bit += run;
156 }
157 }
158 ret = -ENOSPC;
159 goto out;
160
161found:
162 *return_block = i * bits_per_entry + bit;
163 *return_size = run;
164 ret = set_run(sb, i, bits_per_entry, bit, run, 1);
165
166out:
167 mutex_unlock(&sbi->s_bitmap_lock);
168 return ret;
169}
170
171/*
172 * Clears count bits starting at a given block.
173 */
174int omfs_clear_range(struct super_block *sb, u64 block, int count)
175{
176 struct omfs_sb_info *sbi = OMFS_SB(sb);
177 int bits_per_entry = 8 * sb->s_blocksize;
178 u64 tmp;
179 int map, bit, ret;
180
181 tmp = block;
182 bit = do_div(tmp, bits_per_entry);
183 map = tmp;
184
185 if (map >= sbi->s_imap_size)
186 return 0;
187
188 mutex_lock(&sbi->s_bitmap_lock);
189 ret = set_run(sb, map, bits_per_entry, bit, count, 0);
190 mutex_unlock(&sbi->s_bitmap_lock);
191 return ret;
192}
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c
new file mode 100644
index 000000000000..05a5bc31e4bd
--- /dev/null
+++ b/fs/omfs/dir.c
@@ -0,0 +1,504 @@
1/*
2 * OMFS (as used by RIO Karma) directory operations.
3 * Copyright (C) 2005 Bob Copeland <me@bobcopeland.com>
4 * Released under GPL v2.
5 */
6
7#include <linux/fs.h>
8#include <linux/ctype.h>
9#include <linux/buffer_head.h>
10#include "omfs.h"
11
12static int omfs_hash(const char *name, int namelen, int mod)
13{
14 int i, hash = 0;
15 for (i = 0; i < namelen; i++)
16 hash ^= tolower(name[i]) << (i % 24);
17 return hash % mod;
18}
19
20/*
21 * Finds the bucket for a given name and reads the containing block;
22 * *ofs is set to the offset of the first list entry.
23 */
24static struct buffer_head *omfs_get_bucket(struct inode *dir,
25 const char *name, int namelen, int *ofs)
26{
27 int nbuckets = (dir->i_size - OMFS_DIR_START)/8;
28 int block = clus_to_blk(OMFS_SB(dir->i_sb), dir->i_ino);
29 int bucket = omfs_hash(name, namelen, nbuckets);
30
31 *ofs = OMFS_DIR_START + bucket * 8;
32 return sb_bread(dir->i_sb, block);
33}
34
35static struct buffer_head *omfs_scan_list(struct inode *dir, u64 block,
36 const char *name, int namelen,
37 u64 *prev_block)
38{
39 struct buffer_head *bh;
40 struct omfs_inode *oi;
41 int err = -ENOENT;
42 *prev_block = ~0;
43
44 while (block != ~0) {
45 bh = sb_bread(dir->i_sb,
46 clus_to_blk(OMFS_SB(dir->i_sb), block));
47 if (!bh) {
48 err = -EIO;
49 goto err;
50 }
51
52 oi = (struct omfs_inode *) bh->b_data;
53 if (omfs_is_bad(OMFS_SB(dir->i_sb), &oi->i_head, block)) {
54 brelse(bh);
55 goto err;
56 }
57
58 if (strncmp(oi->i_name, name, namelen) == 0)
59 return bh;
60
61 *prev_block = block;
62 block = be64_to_cpu(oi->i_sibling);
63 brelse(bh);
64 }
65err:
66 return ERR_PTR(err);
67}
68
69static struct buffer_head *omfs_find_entry(struct inode *dir,
70 const char *name, int namelen)
71{
72 struct buffer_head *bh;
73 int ofs;
74 u64 block, dummy;
75
76 bh = omfs_get_bucket(dir, name, namelen, &ofs);
77 if (!bh)
78 return ERR_PTR(-EIO);
79
80 block = be64_to_cpu(*((__be64 *) &bh->b_data[ofs]));
81 brelse(bh);
82
83 return omfs_scan_list(dir, block, name, namelen, &dummy);
84}
85
86int omfs_make_empty(struct inode *inode, struct super_block *sb)
87{
88 struct omfs_sb_info *sbi = OMFS_SB(sb);
89 int block = clus_to_blk(sbi, inode->i_ino);
90 struct buffer_head *bh;
91 struct omfs_inode *oi;
92
93 bh = sb_bread(sb, block);
94 if (!bh)
95 return -ENOMEM;
96
97 memset(bh->b_data, 0, sizeof(struct omfs_inode));
98
99 if (inode->i_mode & S_IFDIR) {
100 memset(&bh->b_data[OMFS_DIR_START], 0xff,
101 sbi->s_sys_blocksize - OMFS_DIR_START);
102 } else
103 omfs_make_empty_table(bh, OMFS_EXTENT_START);
104
105 oi = (struct omfs_inode *) bh->b_data;
106 oi->i_head.h_self = cpu_to_be64(inode->i_ino);
107 oi->i_sibling = ~0ULL;
108
109 mark_buffer_dirty(bh);
110 brelse(bh);
111 return 0;
112}
113
114static int omfs_add_link(struct dentry *dentry, struct inode *inode)
115{
116 struct inode *dir = dentry->d_parent->d_inode;
117 const char *name = dentry->d_name.name;
118 int namelen = dentry->d_name.len;
119 struct omfs_inode *oi;
120 struct buffer_head *bh;
121 u64 block;
122 __be64 *entry;
123 int ofs;
124
125 /* just prepend to head of queue in proper bucket */
126 bh = omfs_get_bucket(dir, name, namelen, &ofs);
127 if (!bh)
128 goto out;
129
130 entry = (__be64 *) &bh->b_data[ofs];
131 block = be64_to_cpu(*entry);
132 *entry = cpu_to_be64(inode->i_ino);
133 mark_buffer_dirty(bh);
134 brelse(bh);
135
136 /* now set the sibling and parent pointers on the new inode */
137 bh = sb_bread(dir->i_sb, clus_to_blk(OMFS_SB(dir->i_sb), inode->i_ino));
138 if (!bh)
139 goto out;
140
141 oi = (struct omfs_inode *) bh->b_data;
142 memcpy(oi->i_name, name, namelen);
143 memset(oi->i_name + namelen, 0, OMFS_NAMELEN - namelen);
144 oi->i_sibling = cpu_to_be64(block);
145 oi->i_parent = cpu_to_be64(dir->i_ino);
146 mark_buffer_dirty(bh);
147 brelse(bh);
148
149 dir->i_ctime = CURRENT_TIME_SEC;
150
151 /* mark affected inodes dirty to rebuild checksums */
152 mark_inode_dirty(dir);
153 mark_inode_dirty(inode);
154 return 0;
155out:
156 return -ENOMEM;
157}
158
159static int omfs_delete_entry(struct dentry *dentry)
160{
161 struct inode *dir = dentry->d_parent->d_inode;
162 struct inode *dirty;
163 const char *name = dentry->d_name.name;
164 int namelen = dentry->d_name.len;
165 struct omfs_inode *oi;
166 struct buffer_head *bh, *bh2;
167 __be64 *entry, next;
168 u64 block, prev;
169 int ofs;
170 int err = -ENOMEM;
171
172 /* delete the proper node in the bucket's linked list */
173 bh = omfs_get_bucket(dir, name, namelen, &ofs);
174 if (!bh)
175 goto out;
176
177 entry = (__be64 *) &bh->b_data[ofs];
178 block = be64_to_cpu(*entry);
179
180 bh2 = omfs_scan_list(dir, block, name, namelen, &prev);
181 if (IS_ERR(bh2)) {
182 err = PTR_ERR(bh2);
183 goto out_free_bh;
184 }
185
186 oi = (struct omfs_inode *) bh2->b_data;
187 next = oi->i_sibling;
188 brelse(bh2);
189
190 if (prev != ~0) {
191 /* found in middle of list, get list ptr */
192 brelse(bh);
193 bh = sb_bread(dir->i_sb,
194 clus_to_blk(OMFS_SB(dir->i_sb), prev));
195 if (!bh)
196 goto out;
197
198 oi = (struct omfs_inode *) bh->b_data;
199 entry = &oi->i_sibling;
200 }
201
202 *entry = next;
203 mark_buffer_dirty(bh);
204
205 if (prev != ~0) {
206 dirty = omfs_iget(dir->i_sb, prev);
207 if (!IS_ERR(dirty)) {
208 mark_inode_dirty(dirty);
209 iput(dirty);
210 }
211 }
212
213 err = 0;
214out_free_bh:
215 brelse(bh);
216out:
217 return err;
218}
219
220static int omfs_dir_is_empty(struct inode *inode)
221{
222 int nbuckets = (inode->i_size - OMFS_DIR_START) / 8;
223 struct buffer_head *bh;
224 u64 *ptr;
225 int i;
226
227 bh = sb_bread(inode->i_sb, clus_to_blk(OMFS_SB(inode->i_sb),
228 inode->i_ino));
229
230 if (!bh)
231 return 0;
232
233 ptr = (u64 *) &bh->b_data[OMFS_DIR_START];
234
235 for (i = 0; i < nbuckets; i++, ptr++)
236 if (*ptr != ~0)
237 break;
238
239 brelse(bh);
240 return *ptr != ~0;
241}
242
243static int omfs_unlink(struct inode *dir, struct dentry *dentry)
244{
245 int ret;
246 struct inode *inode = dentry->d_inode;
247
248 ret = omfs_delete_entry(dentry);
249 if (ret)
250 goto end_unlink;
251
252 inode_dec_link_count(inode);
253 mark_inode_dirty(dir);
254
255end_unlink:
256 return ret;
257}
258
259static int omfs_rmdir(struct inode *dir, struct dentry *dentry)
260{
261 int err = -ENOTEMPTY;
262 struct inode *inode = dentry->d_inode;
263
264 if (omfs_dir_is_empty(inode)) {
265 err = omfs_unlink(dir, dentry);
266 if (!err)
267 inode_dec_link_count(inode);
268 }
269 return err;
270}
271
272static int omfs_add_node(struct inode *dir, struct dentry *dentry, int mode)
273{
274 int err;
275 struct inode *inode = omfs_new_inode(dir, mode);
276
277 if (IS_ERR(inode))
278 return PTR_ERR(inode);
279
280 err = omfs_make_empty(inode, dir->i_sb);
281 if (err)
282 goto out_free_inode;
283
284 err = omfs_add_link(dentry, inode);
285 if (err)
286 goto out_free_inode;
287
288 d_instantiate(dentry, inode);
289 return 0;
290
291out_free_inode:
292 iput(inode);
293 return err;
294}
295
296static int omfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
297{
298 return omfs_add_node(dir, dentry, mode | S_IFDIR);
299}
300
301static int omfs_create(struct inode *dir, struct dentry *dentry, int mode,
302 struct nameidata *nd)
303{
304 return omfs_add_node(dir, dentry, mode | S_IFREG);
305}
306
307static struct dentry *omfs_lookup(struct inode *dir, struct dentry *dentry,
308 struct nameidata *nd)
309{
310 struct buffer_head *bh;
311 struct inode *inode = NULL;
312
313 if (dentry->d_name.len > OMFS_NAMELEN)
314 return ERR_PTR(-ENAMETOOLONG);
315
316 bh = omfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len);
317 if (!IS_ERR(bh)) {
318 struct omfs_inode *oi = (struct omfs_inode *)bh->b_data;
319 ino_t ino = be64_to_cpu(oi->i_head.h_self);
320 brelse(bh);
321 inode = omfs_iget(dir->i_sb, ino);
322 if (IS_ERR(inode))
323 return ERR_CAST(inode);
324 }
325 d_add(dentry, inode);
326 return NULL;
327}
328
329/* sanity check block's self pointer */
330int omfs_is_bad(struct omfs_sb_info *sbi, struct omfs_header *header,
331 u64 fsblock)
332{
333 int is_bad;
334 u64 ino = be64_to_cpu(header->h_self);
335 is_bad = ((ino != fsblock) || (ino < sbi->s_root_ino) ||
336 (ino > sbi->s_num_blocks));
337
338 if (is_bad)
339 printk(KERN_WARNING "omfs: bad hash chain detected\n");
340
341 return is_bad;
342}
343
344static int omfs_fill_chain(struct file *filp, void *dirent, filldir_t filldir,
345 u64 fsblock, int hindex)
346{
347 struct inode *dir = filp->f_dentry->d_inode;
348 struct buffer_head *bh;
349 struct omfs_inode *oi;
350 u64 self;
351 int res = 0;
352 unsigned char d_type;
353
354 /* follow chain in this bucket */
355 while (fsblock != ~0) {
356 bh = sb_bread(dir->i_sb, clus_to_blk(OMFS_SB(dir->i_sb),
357 fsblock));
358 if (!bh)
359 goto out;
360
361 oi = (struct omfs_inode *) bh->b_data;
362 if (omfs_is_bad(OMFS_SB(dir->i_sb), &oi->i_head, fsblock)) {
363 brelse(bh);
364 goto out;
365 }
366
367 self = fsblock;
368 fsblock = be64_to_cpu(oi->i_sibling);
369
370 /* skip visited nodes */
371 if (hindex) {
372 hindex--;
373 brelse(bh);
374 continue;
375 }
376
377 d_type = (oi->i_type == OMFS_DIR) ? DT_DIR : DT_REG;
378
379 res = filldir(dirent, oi->i_name, strnlen(oi->i_name,
380 OMFS_NAMELEN), filp->f_pos, self, d_type);
381 if (res == 0)
382 filp->f_pos++;
383 brelse(bh);
384 }
385out:
386 return res;
387}
388
389static int omfs_rename(struct inode *old_dir, struct dentry *old_dentry,
390 struct inode *new_dir, struct dentry *new_dentry)
391{
392 struct inode *new_inode = new_dentry->d_inode;
393 struct inode *old_inode = old_dentry->d_inode;
394 struct buffer_head *bh;
395 int is_dir;
396 int err;
397
398 is_dir = S_ISDIR(old_inode->i_mode);
399
400 if (new_inode) {
401 /* overwriting existing file/dir */
402 err = -ENOTEMPTY;
403 if (is_dir && !omfs_dir_is_empty(new_inode))
404 goto out;
405
406 err = -ENOENT;
407 bh = omfs_find_entry(new_dir, new_dentry->d_name.name,
408 new_dentry->d_name.len);
409 if (IS_ERR(bh))
410 goto out;
411 brelse(bh);
412
413 err = omfs_unlink(new_dir, new_dentry);
414 if (err)
415 goto out;
416 }
417
418 /* since omfs locates files by name, we need to unlink _before_
419 * adding the new link or we won't find the old one */
420 inode_inc_link_count(old_inode);
421 err = omfs_unlink(old_dir, old_dentry);
422 if (err) {
423 inode_dec_link_count(old_inode);
424 goto out;
425 }
426
427 err = omfs_add_link(new_dentry, old_inode);
428 if (err)
429 goto out;
430
431 old_inode->i_ctime = CURRENT_TIME_SEC;
432out:
433 return err;
434}
435
436static int omfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
437{
438 struct inode *dir = filp->f_dentry->d_inode;
439 struct buffer_head *bh;
440 loff_t offset, res;
441 unsigned int hchain, hindex;
442 int nbuckets;
443 u64 fsblock;
444 int ret = -EINVAL;
445
446 if (filp->f_pos >> 32)
447 goto success;
448
449 switch ((unsigned long) filp->f_pos) {
450 case 0:
451 if (filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR) < 0)
452 goto success;
453 filp->f_pos++;
454 /* fall through */
455 case 1:
456 if (filldir(dirent, "..", 2, 1,
457 parent_ino(filp->f_dentry), DT_DIR) < 0)
458 goto success;
459 filp->f_pos = 1 << 20;
460 /* fall through */
461 }
462
463 nbuckets = (dir->i_size - OMFS_DIR_START) / 8;
464
465 /* high 12 bits store bucket + 1 and low 20 bits store hash index */
466 hchain = (filp->f_pos >> 20) - 1;
467 hindex = filp->f_pos & 0xfffff;
468
469 bh = sb_bread(dir->i_sb, clus_to_blk(OMFS_SB(dir->i_sb), dir->i_ino));
470 if (!bh)
471 goto out;
472
473 offset = OMFS_DIR_START + hchain * 8;
474
475 for (; hchain < nbuckets; hchain++, offset += 8) {
476 fsblock = be64_to_cpu(*((__be64 *) &bh->b_data[offset]));
477
478 res = omfs_fill_chain(filp, dirent, filldir, fsblock, hindex);
479 hindex = 0;
480 if (res < 0)
481 break;
482
483 filp->f_pos = (hchain+2) << 20;
484 }
485 brelse(bh);
486success:
487 ret = 0;
488out:
489 return ret;
490}
491
492struct inode_operations omfs_dir_inops = {
493 .lookup = omfs_lookup,
494 .mkdir = omfs_mkdir,
495 .rename = omfs_rename,
496 .create = omfs_create,
497 .unlink = omfs_unlink,
498 .rmdir = omfs_rmdir,
499};
500
501struct file_operations omfs_dir_operations = {
502 .read = generic_read_dir,
503 .readdir = omfs_readdir,
504};
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
new file mode 100644
index 000000000000..66e01fae4384
--- /dev/null
+++ b/fs/omfs/file.c
@@ -0,0 +1,346 @@
1/*
2 * OMFS (as used by RIO Karma) file operations.
3 * Copyright (C) 2005 Bob Copeland <me@bobcopeland.com>
4 * Released under GPL v2.
5 */
6
7#include <linux/version.h>
8#include <linux/module.h>
9#include <linux/fs.h>
10#include <linux/buffer_head.h>
11#include <linux/mpage.h>
12#include "omfs.h"
13
14static int omfs_sync_file(struct file *file, struct dentry *dentry,
15 int datasync)
16{
17 struct inode *inode = dentry->d_inode;
18 int err;
19
20 err = sync_mapping_buffers(inode->i_mapping);
21 if (!(inode->i_state & I_DIRTY))
22 return err;
23 if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
24 return err;
25 err |= omfs_sync_inode(inode);
26 return err ? -EIO : 0;
27}
28
29void omfs_make_empty_table(struct buffer_head *bh, int offset)
30{
31 struct omfs_extent *oe = (struct omfs_extent *) &bh->b_data[offset];
32
33 oe->e_next = ~0ULL;
34 oe->e_extent_count = cpu_to_be32(1),
35 oe->e_fill = cpu_to_be32(0x22),
36 oe->e_entry.e_cluster = ~0ULL;
37 oe->e_entry.e_blocks = ~0ULL;
38}
39
40int omfs_shrink_inode(struct inode *inode)
41{
42 struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
43 struct omfs_extent *oe;
44 struct omfs_extent_entry *entry;
45 struct buffer_head *bh;
46 u64 next, last;
47 u32 extent_count;
48 int ret;
49
50 /* traverse extent table, freeing each entry that is greater
51 * than inode->i_size;
52 */
53 next = inode->i_ino;
54
55 /* only support truncate -> 0 for now */
56 ret = -EIO;
57 if (inode->i_size != 0)
58 goto out;
59
60 bh = sb_bread(inode->i_sb, clus_to_blk(sbi, next));
61 if (!bh)
62 goto out;
63
64 oe = (struct omfs_extent *)(&bh->b_data[OMFS_EXTENT_START]);
65
66 for (;;) {
67
68 if (omfs_is_bad(sbi, (struct omfs_header *) bh->b_data, next)) {
69 brelse(bh);
70 goto out;
71 }
72
73 extent_count = be32_to_cpu(oe->e_extent_count);
74 last = next;
75 next = be64_to_cpu(oe->e_next);
76 entry = &oe->e_entry;
77
78 /* ignore last entry as it is the terminator */
79 for (; extent_count > 1; extent_count--) {
80 u64 start, count;
81 start = be64_to_cpu(entry->e_cluster);
82 count = be64_to_cpu(entry->e_blocks);
83
84 omfs_clear_range(inode->i_sb, start, (int) count);
85 entry++;
86 }
87 omfs_make_empty_table(bh, (char *) oe - bh->b_data);
88 mark_buffer_dirty(bh);
89 brelse(bh);
90
91 if (last != inode->i_ino)
92 omfs_clear_range(inode->i_sb, last, sbi->s_mirrors);
93
94 if (next == ~0)
95 break;
96
97 bh = sb_bread(inode->i_sb, clus_to_blk(sbi, next));
98 if (!bh)
99 goto out;
100 oe = (struct omfs_extent *) (&bh->b_data[OMFS_EXTENT_CONT]);
101 }
102 ret = 0;
103out:
104 return ret;
105}
106
107static void omfs_truncate(struct inode *inode)
108{
109 omfs_shrink_inode(inode);
110 mark_inode_dirty(inode);
111}
112
113/*
114 * Add new blocks to the current extent, or create new entries/continuations
115 * as necessary.
116 */
117static int omfs_grow_extent(struct inode *inode, struct omfs_extent *oe,
118 u64 *ret_block)
119{
120 struct omfs_extent_entry *terminator;
121 struct omfs_extent_entry *entry = &oe->e_entry;
122 struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
123 u32 extent_count = be32_to_cpu(oe->e_extent_count);
124 u64 new_block = 0;
125 u32 max_count;
126 int new_count;
127 int ret = 0;
128
129 /* reached the end of the extent table with no blocks mapped.
130 * there are three possibilities for adding: grow last extent,
131 * add a new extent to the current extent table, and add a
132 * continuation inode. in last two cases need an allocator for
133 * sbi->s_cluster_size
134 */
135
136 /* TODO: handle holes */
137
138 /* should always have a terminator */
139 if (extent_count < 1)
140 return -EIO;
141
142 /* trivially grow current extent, if next block is not taken */
143 terminator = entry + extent_count - 1;
144 if (extent_count > 1) {
145 entry = terminator-1;
146 new_block = be64_to_cpu(entry->e_cluster) +
147 be64_to_cpu(entry->e_blocks);
148
149 if (omfs_allocate_block(inode->i_sb, new_block)) {
150 entry->e_blocks =
151 cpu_to_be64(be64_to_cpu(entry->e_blocks) + 1);
152 terminator->e_blocks = ~(cpu_to_be64(
153 be64_to_cpu(~terminator->e_blocks) + 1));
154 goto out;
155 }
156 }
157 max_count = (sbi->s_sys_blocksize - OMFS_EXTENT_START -
158 sizeof(struct omfs_extent)) /
159 sizeof(struct omfs_extent_entry) + 1;
160
161 /* TODO: add a continuation block here */
162 if (be32_to_cpu(oe->e_extent_count) > max_count-1)
163 return -EIO;
164
165 /* try to allocate a new cluster */
166 ret = omfs_allocate_range(inode->i_sb, 1, sbi->s_clustersize,
167 &new_block, &new_count);
168 if (ret)
169 goto out_fail;
170
171 /* copy terminator down an entry */
172 entry = terminator;
173 terminator++;
174 memcpy(terminator, entry, sizeof(struct omfs_extent_entry));
175
176 entry->e_cluster = cpu_to_be64(new_block);
177 entry->e_blocks = cpu_to_be64((u64) new_count);
178
179 terminator->e_blocks = ~(cpu_to_be64(
180 be64_to_cpu(~terminator->e_blocks) + (u64) new_count));
181
182 /* write in new entry */
183 oe->e_extent_count = cpu_to_be32(1 + be32_to_cpu(oe->e_extent_count));
184
185out:
186 *ret_block = new_block;
187out_fail:
188 return ret;
189}
190
191/*
192 * Scans across the directory table for a given file block number.
193 * If block not found, return 0.
194 */
195static sector_t find_block(struct inode *inode, struct omfs_extent_entry *ent,
196 sector_t block, int count, int *left)
197{
198 /* count > 1 because of terminator */
199 sector_t searched = 0;
200 for (; count > 1; count--) {
201 int numblocks = clus_to_blk(OMFS_SB(inode->i_sb),
202 be64_to_cpu(ent->e_blocks));
203
204 if (block >= searched &&
205 block < searched + numblocks) {
206 /*
207 * found it at cluster + (block - searched)
208 * numblocks - (block - searched) is remainder
209 */
210 *left = numblocks - (block - searched);
211 return clus_to_blk(OMFS_SB(inode->i_sb),
212 be64_to_cpu(ent->e_cluster)) +
213 block - searched;
214 }
215 searched += numblocks;
216 ent++;
217 }
218 return 0;
219}
220
221static int omfs_get_block(struct inode *inode, sector_t block,
222 struct buffer_head *bh_result, int create)
223{
224 struct buffer_head *bh;
225 sector_t next, offset;
226 int ret;
227 u64 new_block;
228 int extent_count;
229 struct omfs_extent *oe;
230 struct omfs_extent_entry *entry;
231 struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
232 int max_blocks = bh_result->b_size >> inode->i_blkbits;
233 int remain;
234
235 ret = -EIO;
236 bh = sb_bread(inode->i_sb, clus_to_blk(sbi, inode->i_ino));
237 if (!bh)
238 goto out;
239
240 oe = (struct omfs_extent *)(&bh->b_data[OMFS_EXTENT_START]);
241 next = inode->i_ino;
242
243 for (;;) {
244
245 if (omfs_is_bad(sbi, (struct omfs_header *) bh->b_data, next))
246 goto out_brelse;
247
248 extent_count = be32_to_cpu(oe->e_extent_count);
249 next = be64_to_cpu(oe->e_next);
250 entry = &oe->e_entry;
251
252 offset = find_block(inode, entry, block, extent_count, &remain);
253 if (offset > 0) {
254 ret = 0;
255 map_bh(bh_result, inode->i_sb, offset);
256 if (remain > max_blocks)
257 remain = max_blocks;
258 bh_result->b_size = (remain << inode->i_blkbits);
259 goto out_brelse;
260 }
261 if (next == ~0)
262 break;
263
264 brelse(bh);
265 bh = sb_bread(inode->i_sb, clus_to_blk(sbi, next));
266 if (!bh)
267 goto out;
268 oe = (struct omfs_extent *) (&bh->b_data[OMFS_EXTENT_CONT]);
269 }
270 if (create) {
271 ret = omfs_grow_extent(inode, oe, &new_block);
272 if (ret == 0) {
273 mark_buffer_dirty(bh);
274 mark_inode_dirty(inode);
275 map_bh(bh_result, inode->i_sb,
276 clus_to_blk(sbi, new_block));
277 }
278 }
279out_brelse:
280 brelse(bh);
281out:
282 return ret;
283}
284
285static int omfs_readpage(struct file *file, struct page *page)
286{
287 return block_read_full_page(page, omfs_get_block);
288}
289
290static int omfs_readpages(struct file *file, struct address_space *mapping,
291 struct list_head *pages, unsigned nr_pages)
292{
293 return mpage_readpages(mapping, pages, nr_pages, omfs_get_block);
294}
295
296static int omfs_writepage(struct page *page, struct writeback_control *wbc)
297{
298 return block_write_full_page(page, omfs_get_block, wbc);
299}
300
301static int
302omfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
303{
304 return mpage_writepages(mapping, wbc, omfs_get_block);
305}
306
307static int omfs_write_begin(struct file *file, struct address_space *mapping,
308 loff_t pos, unsigned len, unsigned flags,
309 struct page **pagep, void **fsdata)
310{
311 *pagep = NULL;
312 return block_write_begin(file, mapping, pos, len, flags,
313 pagep, fsdata, omfs_get_block);
314}
315
316static sector_t omfs_bmap(struct address_space *mapping, sector_t block)
317{
318 return generic_block_bmap(mapping, block, omfs_get_block);
319}
320
321struct file_operations omfs_file_operations = {
322 .llseek = generic_file_llseek,
323 .read = do_sync_read,
324 .write = do_sync_write,
325 .aio_read = generic_file_aio_read,
326 .aio_write = generic_file_aio_write,
327 .mmap = generic_file_mmap,
328 .fsync = omfs_sync_file,
329 .splice_read = generic_file_splice_read,
330};
331
332struct inode_operations omfs_file_inops = {
333 .truncate = omfs_truncate
334};
335
336struct address_space_operations omfs_aops = {
337 .readpage = omfs_readpage,
338 .readpages = omfs_readpages,
339 .writepage = omfs_writepage,
340 .writepages = omfs_writepages,
341 .sync_page = block_sync_page,
342 .write_begin = omfs_write_begin,
343 .write_end = generic_write_end,
344 .bmap = omfs_bmap,
345};
346
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
new file mode 100644
index 000000000000..d865f5535436
--- /dev/null
+++ b/fs/omfs/inode.c
@@ -0,0 +1,553 @@
1/*
2 * Optimized MPEG FS - inode and super operations.
3 * Copyright (C) 2006 Bob Copeland <me@bobcopeland.com>
4 * Released under GPL v2.
5 */
6#include <linux/version.h>
7#include <linux/module.h>
8#include <linux/sched.h>
9#include <linux/fs.h>
10#include <linux/vfs.h>
11#include <linux/parser.h>
12#include <linux/buffer_head.h>
13#include <linux/vmalloc.h>
14#include <linux/crc-itu-t.h>
15#include "omfs.h"
16
17MODULE_AUTHOR("Bob Copeland <me@bobcopeland.com>");
18MODULE_DESCRIPTION("OMFS (ReplayTV/Karma) Filesystem for Linux");
19MODULE_LICENSE("GPL");
20
21struct inode *omfs_new_inode(struct inode *dir, int mode)
22{
23 struct inode *inode;
24 u64 new_block;
25 int err;
26 int len;
27 struct omfs_sb_info *sbi = OMFS_SB(dir->i_sb);
28
29 inode = new_inode(dir->i_sb);
30 if (!inode)
31 return ERR_PTR(-ENOMEM);
32
33 err = omfs_allocate_range(dir->i_sb, sbi->s_mirrors, sbi->s_mirrors,
34 &new_block, &len);
35 if (err)
36 goto fail;
37
38 inode->i_ino = new_block;
39 inode->i_mode = mode;
40 inode->i_uid = current->fsuid;
41 inode->i_gid = current->fsgid;
42 inode->i_blocks = 0;
43 inode->i_mapping->a_ops = &omfs_aops;
44
45 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
46 switch (mode & S_IFMT) {
47 case S_IFDIR:
48 inode->i_op = &omfs_dir_inops;
49 inode->i_fop = &omfs_dir_operations;
50 inode->i_size = sbi->s_sys_blocksize;
51 inc_nlink(inode);
52 break;
53 case S_IFREG:
54 inode->i_op = &omfs_file_inops;
55 inode->i_fop = &omfs_file_operations;
56 inode->i_size = 0;
57 break;
58 }
59
60 insert_inode_hash(inode);
61 mark_inode_dirty(inode);
62 return inode;
63fail:
64 make_bad_inode(inode);
65 iput(inode);
66 return ERR_PTR(err);
67}
68
69/*
70 * Update the header checksums for a dirty inode based on its contents.
71 * Caller is expected to hold the buffer head underlying oi and mark it
72 * dirty.
73 */
74static void omfs_update_checksums(struct omfs_inode *oi)
75{
76 int xor, i, ofs = 0, count;
77 u16 crc = 0;
78 unsigned char *ptr = (unsigned char *) oi;
79
80 count = be32_to_cpu(oi->i_head.h_body_size);
81 ofs = sizeof(struct omfs_header);
82
83 crc = crc_itu_t(crc, ptr + ofs, count);
84 oi->i_head.h_crc = cpu_to_be16(crc);
85
86 xor = ptr[0];
87 for (i = 1; i < OMFS_XOR_COUNT; i++)
88 xor ^= ptr[i];
89
90 oi->i_head.h_check_xor = xor;
91}
92
93static int omfs_write_inode(struct inode *inode, int wait)
94{
95 struct omfs_inode *oi;
96 struct omfs_sb_info *sbi = OMFS_SB(inode->i_sb);
97 struct buffer_head *bh, *bh2;
98 unsigned int block;
99 u64 ctime;
100 int i;
101 int ret = -EIO;
102 int sync_failed = 0;
103
104 /* get current inode since we may have written sibling ptrs etc. */
105 block = clus_to_blk(sbi, inode->i_ino);
106 bh = sb_bread(inode->i_sb, block);
107 if (!bh)
108 goto out;
109
110 oi = (struct omfs_inode *) bh->b_data;
111
112 oi->i_head.h_self = cpu_to_be64(inode->i_ino);
113 if (S_ISDIR(inode->i_mode))
114 oi->i_type = OMFS_DIR;
115 else if (S_ISREG(inode->i_mode))
116 oi->i_type = OMFS_FILE;
117 else {
118 printk(KERN_WARNING "omfs: unknown file type: %d\n",
119 inode->i_mode);
120 goto out_brelse;
121 }
122
123 oi->i_head.h_body_size = cpu_to_be32(sbi->s_sys_blocksize -
124 sizeof(struct omfs_header));
125 oi->i_head.h_version = 1;
126 oi->i_head.h_type = OMFS_INODE_NORMAL;
127 oi->i_head.h_magic = OMFS_IMAGIC;
128 oi->i_size = cpu_to_be64(inode->i_size);
129
130 ctime = inode->i_ctime.tv_sec * 1000LL +
131 ((inode->i_ctime.tv_nsec + 999)/1000);
132 oi->i_ctime = cpu_to_be64(ctime);
133
134 omfs_update_checksums(oi);
135
136 mark_buffer_dirty(bh);
137 if (wait) {
138 sync_dirty_buffer(bh);
139 if (buffer_req(bh) && !buffer_uptodate(bh))
140 sync_failed = 1;
141 }
142
143 /* if mirroring writes, copy to next fsblock */
144 for (i = 1; i < sbi->s_mirrors; i++) {
145 bh2 = sb_bread(inode->i_sb, block + i *
146 (sbi->s_blocksize / sbi->s_sys_blocksize));
147 if (!bh2)
148 goto out_brelse;
149
150 memcpy(bh2->b_data, bh->b_data, bh->b_size);
151 mark_buffer_dirty(bh2);
152 if (wait) {
153 sync_dirty_buffer(bh2);
154 if (buffer_req(bh2) && !buffer_uptodate(bh2))
155 sync_failed = 1;
156 }
157 brelse(bh2);
158 }
159 ret = (sync_failed) ? -EIO : 0;
160out_brelse:
161 brelse(bh);
162out:
163 return ret;
164}
165
166int omfs_sync_inode(struct inode *inode)
167{
168 return omfs_write_inode(inode, 1);
169}
170
171/*
172 * called when an entry is deleted, need to clear the bits in the
173 * bitmaps.
174 */
175static void omfs_delete_inode(struct inode *inode)
176{
177 truncate_inode_pages(&inode->i_data, 0);
178
179 if (S_ISREG(inode->i_mode)) {
180 inode->i_size = 0;
181 omfs_shrink_inode(inode);
182 }
183
184 omfs_clear_range(inode->i_sb, inode->i_ino, 2);
185 clear_inode(inode);
186}
187
188struct inode *omfs_iget(struct super_block *sb, ino_t ino)
189{
190 struct omfs_sb_info *sbi = OMFS_SB(sb);
191 struct omfs_inode *oi;
192 struct buffer_head *bh;
193 unsigned int block;
194 u64 ctime;
195 unsigned long nsecs;
196 struct inode *inode;
197
198 inode = iget_locked(sb, ino);
199 if (!inode)
200 return ERR_PTR(-ENOMEM);
201 if (!(inode->i_state & I_NEW))
202 return inode;
203
204 block = clus_to_blk(sbi, ino);
205 bh = sb_bread(inode->i_sb, block);
206 if (!bh)
207 goto iget_failed;
208
209 oi = (struct omfs_inode *)bh->b_data;
210
211 /* check self */
212 if (ino != be64_to_cpu(oi->i_head.h_self))
213 goto fail_bh;
214
215 inode->i_uid = sbi->s_uid;
216 inode->i_gid = sbi->s_gid;
217
218 ctime = be64_to_cpu(oi->i_ctime);
219 nsecs = do_div(ctime, 1000) * 1000L;
220
221 inode->i_atime.tv_sec = ctime;
222 inode->i_mtime.tv_sec = ctime;
223 inode->i_ctime.tv_sec = ctime;
224 inode->i_atime.tv_nsec = nsecs;
225 inode->i_mtime.tv_nsec = nsecs;
226 inode->i_ctime.tv_nsec = nsecs;
227
228 inode->i_mapping->a_ops = &omfs_aops;
229
230 switch (oi->i_type) {
231 case OMFS_DIR:
232 inode->i_mode = S_IFDIR | (S_IRWXUGO & ~sbi->s_dmask);
233 inode->i_op = &omfs_dir_inops;
234 inode->i_fop = &omfs_dir_operations;
235 inode->i_size = be32_to_cpu(oi->i_head.h_body_size) +
236 sizeof(struct omfs_header);
237 inc_nlink(inode);
238 break;
239 case OMFS_FILE:
240 inode->i_mode = S_IFREG | (S_IRWXUGO & ~sbi->s_fmask);
241 inode->i_fop = &omfs_file_operations;
242 inode->i_size = be64_to_cpu(oi->i_size);
243 break;
244 }
245 brelse(bh);
246 unlock_new_inode(inode);
247 return inode;
248fail_bh:
249 brelse(bh);
250iget_failed:
251 iget_failed(inode);
252 return ERR_PTR(-EIO);
253}
254
255static void omfs_put_super(struct super_block *sb)
256{
257 struct omfs_sb_info *sbi = OMFS_SB(sb);
258 kfree(sbi->s_imap);
259 kfree(sbi);
260 sb->s_fs_info = NULL;
261}
262
263static int omfs_statfs(struct dentry *dentry, struct kstatfs *buf)
264{
265 struct super_block *s = dentry->d_sb;
266 struct omfs_sb_info *sbi = OMFS_SB(s);
267 buf->f_type = OMFS_MAGIC;
268 buf->f_bsize = sbi->s_blocksize;
269 buf->f_blocks = sbi->s_num_blocks;
270 buf->f_files = sbi->s_num_blocks;
271 buf->f_namelen = OMFS_NAMELEN;
272
273 buf->f_bfree = buf->f_bavail = buf->f_ffree =
274 omfs_count_free(s);
275 return 0;
276}
277
278static struct super_operations omfs_sops = {
279 .write_inode = omfs_write_inode,
280 .delete_inode = omfs_delete_inode,
281 .put_super = omfs_put_super,
282 .statfs = omfs_statfs,
283 .show_options = generic_show_options,
284};
285
286/*
287 * For Rio Karma, there is an on-disk free bitmap whose location is
288 * stored in the root block. For ReplayTV, there is no such free bitmap
289 * so we have to walk the tree. Both inodes and file data are allocated
290 * from the same map. This array can be big (300k) so we allocate
291 * in units of the blocksize.
292 */
293static int omfs_get_imap(struct super_block *sb)
294{
295 int bitmap_size;
296 int array_size;
297 int count;
298 struct omfs_sb_info *sbi = OMFS_SB(sb);
299 struct buffer_head *bh;
300 unsigned long **ptr;
301 sector_t block;
302
303 bitmap_size = DIV_ROUND_UP(sbi->s_num_blocks, 8);
304 array_size = DIV_ROUND_UP(bitmap_size, sb->s_blocksize);
305
306 if (sbi->s_bitmap_ino == ~0ULL)
307 goto out;
308
309 sbi->s_imap_size = array_size;
310 sbi->s_imap = kzalloc(array_size * sizeof(unsigned long *), GFP_KERNEL);
311 if (!sbi->s_imap)
312 goto nomem;
313
314 block = clus_to_blk(sbi, sbi->s_bitmap_ino);
315 ptr = sbi->s_imap;
316 for (count = bitmap_size; count > 0; count -= sb->s_blocksize) {
317 bh = sb_bread(sb, block++);
318 if (!bh)
319 goto nomem_free;
320 *ptr = kmalloc(sb->s_blocksize, GFP_KERNEL);
321 if (!*ptr) {
322 brelse(bh);
323 goto nomem_free;
324 }
325 memcpy(*ptr, bh->b_data, sb->s_blocksize);
326 if (count < sb->s_blocksize)
327 memset((void *)*ptr + count, 0xff,
328 sb->s_blocksize - count);
329 brelse(bh);
330 ptr++;
331 }
332out:
333 return 0;
334
335nomem_free:
336 for (count = 0; count < array_size; count++)
337 kfree(sbi->s_imap[count]);
338
339 kfree(sbi->s_imap);
340nomem:
341 sbi->s_imap = NULL;
342 sbi->s_imap_size = 0;
343 return -ENOMEM;
344}
345
346enum {
347 Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask
348};
349
350static match_table_t tokens = {
351 {Opt_uid, "uid=%u"},
352 {Opt_gid, "gid=%u"},
353 {Opt_umask, "umask=%o"},
354 {Opt_dmask, "dmask=%o"},
355 {Opt_fmask, "fmask=%o"},
356};
357
358static int parse_options(char *options, struct omfs_sb_info *sbi)
359{
360 char *p;
361 substring_t args[MAX_OPT_ARGS];
362 int option;
363
364 if (!options)
365 return 1;
366
367 while ((p = strsep(&options, ",")) != NULL) {
368 int token;
369 if (!*p)
370 continue;
371
372 token = match_token(p, tokens, args);
373 switch (token) {
374 case Opt_uid:
375 if (match_int(&args[0], &option))
376 return 0;
377 sbi->s_uid = option;
378 break;
379 case Opt_gid:
380 if (match_int(&args[0], &option))
381 return 0;
382 sbi->s_gid = option;
383 break;
384 case Opt_umask:
385 if (match_octal(&args[0], &option))
386 return 0;
387 sbi->s_fmask = sbi->s_dmask = option;
388 break;
389 case Opt_dmask:
390 if (match_octal(&args[0], &option))
391 return 0;
392 sbi->s_dmask = option;
393 break;
394 case Opt_fmask:
395 if (match_octal(&args[0], &option))
396 return 0;
397 sbi->s_fmask = option;
398 break;
399 default:
400 return 0;
401 }
402 }
403 return 1;
404}
405
406static int omfs_fill_super(struct super_block *sb, void *data, int silent)
407{
408 struct buffer_head *bh, *bh2;
409 struct omfs_super_block *omfs_sb;
410 struct omfs_root_block *omfs_rb;
411 struct omfs_sb_info *sbi;
412 struct inode *root;
413 sector_t start;
414 int ret = -EINVAL;
415
416 save_mount_options(sb, (char *) data);
417
418 sbi = kzalloc(sizeof(struct omfs_sb_info), GFP_KERNEL);
419 if (!sbi)
420 return -ENOMEM;
421
422 sb->s_fs_info = sbi;
423
424 sbi->s_uid = current->uid;
425 sbi->s_gid = current->gid;
426 sbi->s_dmask = sbi->s_fmask = current->fs->umask;
427
428 if (!parse_options((char *) data, sbi))
429 goto end;
430
431 sb->s_maxbytes = 0xffffffff;
432
433 sb_set_blocksize(sb, 0x200);
434
435 bh = sb_bread(sb, 0);
436 if (!bh)
437 goto end;
438
439 omfs_sb = (struct omfs_super_block *)bh->b_data;
440
441 if (omfs_sb->s_magic != cpu_to_be32(OMFS_MAGIC)) {
442 if (!silent)
443 printk(KERN_ERR "omfs: Invalid superblock (%x)\n",
444 omfs_sb->s_magic);
445 goto out_brelse_bh;
446 }
447 sb->s_magic = OMFS_MAGIC;
448
449 sbi->s_num_blocks = be64_to_cpu(omfs_sb->s_num_blocks);
450 sbi->s_blocksize = be32_to_cpu(omfs_sb->s_blocksize);
451 sbi->s_mirrors = be32_to_cpu(omfs_sb->s_mirrors);
452 sbi->s_root_ino = be64_to_cpu(omfs_sb->s_root_block);
453 sbi->s_sys_blocksize = be32_to_cpu(omfs_sb->s_sys_blocksize);
454 mutex_init(&sbi->s_bitmap_lock);
455
456 if (sbi->s_sys_blocksize > PAGE_SIZE) {
457 printk(KERN_ERR "omfs: sysblock size (%d) is out of range\n",
458 sbi->s_sys_blocksize);
459 goto out_brelse_bh;
460 }
461
462 if (sbi->s_blocksize < sbi->s_sys_blocksize ||
463 sbi->s_blocksize > OMFS_MAX_BLOCK_SIZE) {
464 printk(KERN_ERR "omfs: block size (%d) is out of range\n",
465 sbi->s_blocksize);
466 goto out_brelse_bh;
467 }
468
469 /*
470 * Use sys_blocksize as the fs block since it is smaller than a
471 * page while the fs blocksize can be larger.
472 */
473 sb_set_blocksize(sb, sbi->s_sys_blocksize);
474
475 /*
476 * ...and the difference goes into a shift. sys_blocksize is always
477 * a power of two factor of blocksize.
478 */
479 sbi->s_block_shift = get_bitmask_order(sbi->s_blocksize) -
480 get_bitmask_order(sbi->s_sys_blocksize);
481
482 start = clus_to_blk(sbi, be64_to_cpu(omfs_sb->s_root_block));
483 bh2 = sb_bread(sb, start);
484 if (!bh2)
485 goto out_brelse_bh;
486
487 omfs_rb = (struct omfs_root_block *)bh2->b_data;
488
489 sbi->s_bitmap_ino = be64_to_cpu(omfs_rb->r_bitmap);
490 sbi->s_clustersize = be32_to_cpu(omfs_rb->r_clustersize);
491
492 if (sbi->s_num_blocks != be64_to_cpu(omfs_rb->r_num_blocks)) {
493 printk(KERN_ERR "omfs: block count discrepancy between "
494 "super and root blocks (%llx, %llx)\n",
495 sbi->s_num_blocks, be64_to_cpu(omfs_rb->r_num_blocks));
496 goto out_brelse_bh2;
497 }
498
499 ret = omfs_get_imap(sb);
500 if (ret)
501 goto out_brelse_bh2;
502
503 sb->s_op = &omfs_sops;
504
505 root = omfs_iget(sb, be64_to_cpu(omfs_rb->r_root_dir));
506 if (IS_ERR(root)) {
507 ret = PTR_ERR(root);
508 goto out_brelse_bh2;
509 }
510
511 sb->s_root = d_alloc_root(root);
512 if (!sb->s_root) {
513 iput(root);
514 goto out_brelse_bh2;
515 }
516 printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name);
517
518 ret = 0;
519out_brelse_bh2:
520 brelse(bh2);
521out_brelse_bh:
522 brelse(bh);
523end:
524 return ret;
525}
526
527static int omfs_get_sb(struct file_system_type *fs_type,
528 int flags, const char *dev_name,
529 void *data, struct vfsmount *m)
530{
531 return get_sb_bdev(fs_type, flags, dev_name, data, omfs_fill_super, m);
532}
533
534static struct file_system_type omfs_fs_type = {
535 .owner = THIS_MODULE,
536 .name = "omfs",
537 .get_sb = omfs_get_sb,
538 .kill_sb = kill_block_super,
539 .fs_flags = FS_REQUIRES_DEV,
540};
541
542static int __init init_omfs_fs(void)
543{
544 return register_filesystem(&omfs_fs_type);
545}
546
547static void __exit exit_omfs_fs(void)
548{
549 unregister_filesystem(&omfs_fs_type);
550}
551
552module_init(init_omfs_fs);
553module_exit(exit_omfs_fs);
diff --git a/fs/omfs/omfs.h b/fs/omfs/omfs.h
new file mode 100644
index 000000000000..2bc0f0670406
--- /dev/null
+++ b/fs/omfs/omfs.h
@@ -0,0 +1,67 @@
1#ifndef _OMFS_H
2#define _OMFS_H
3
4#include <linux/module.h>
5#include <linux/fs.h>
6
7#include "omfs_fs.h"
8
9/* In-memory structures */
10struct omfs_sb_info {
11 u64 s_num_blocks;
12 u64 s_bitmap_ino;
13 u64 s_root_ino;
14 u32 s_blocksize;
15 u32 s_mirrors;
16 u32 s_sys_blocksize;
17 u32 s_clustersize;
18 int s_block_shift;
19 unsigned long **s_imap;
20 int s_imap_size;
21 struct mutex s_bitmap_lock;
22 int s_uid;
23 int s_gid;
24 int s_dmask;
25 int s_fmask;
26};
27
28/* convert a cluster number to a scaled block number */
29static inline sector_t clus_to_blk(struct omfs_sb_info *sbi, sector_t block)
30{
31 return block << sbi->s_block_shift;
32}
33
34static inline struct omfs_sb_info *OMFS_SB(struct super_block *sb)
35{
36 return sb->s_fs_info;
37}
38
39/* bitmap.c */
40extern unsigned long omfs_count_free(struct super_block *sb);
41extern int omfs_allocate_block(struct super_block *sb, u64 block);
42extern int omfs_allocate_range(struct super_block *sb, int min_request,
43 int max_request, u64 *return_block, int *return_size);
44extern int omfs_clear_range(struct super_block *sb, u64 block, int count);
45
46/* dir.c */
47extern struct file_operations omfs_dir_operations;
48extern struct inode_operations omfs_dir_inops;
49extern int omfs_make_empty(struct inode *inode, struct super_block *sb);
50extern int omfs_is_bad(struct omfs_sb_info *sbi, struct omfs_header *header,
51 u64 fsblock);
52
53/* file.c */
54extern struct file_operations omfs_file_operations;
55extern struct inode_operations omfs_file_inops;
56extern struct address_space_operations omfs_aops;
57extern void omfs_make_empty_table(struct buffer_head *bh, int offset);
58extern int omfs_shrink_inode(struct inode *inode);
59
60/* inode.c */
61extern struct inode *omfs_iget(struct super_block *sb, ino_t inode);
62extern struct inode *omfs_new_inode(struct inode *dir, int mode);
63extern int omfs_reserve_block(struct super_block *sb, sector_t block);
64extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino);
65extern int omfs_sync_inode(struct inode *inode);
66
67#endif
diff --git a/fs/omfs/omfs_fs.h b/fs/omfs/omfs_fs.h
new file mode 100644
index 000000000000..12cca245d6e8
--- /dev/null
+++ b/fs/omfs/omfs_fs.h
@@ -0,0 +1,80 @@
1#ifndef _OMFS_FS_H
2#define _OMFS_FS_H
3
4/* OMFS On-disk structures */
5
6#define OMFS_MAGIC 0xC2993D87
7#define OMFS_IMAGIC 0xD2
8
9#define OMFS_DIR 'D'
10#define OMFS_FILE 'F'
11#define OMFS_INODE_NORMAL 'e'
12#define OMFS_INODE_CONTINUATION 'c'
13#define OMFS_INODE_SYSTEM 's'
14#define OMFS_NAMELEN 256
15#define OMFS_DIR_START 0x1b8
16#define OMFS_EXTENT_START 0x1d0
17#define OMFS_EXTENT_CONT 0x40
18#define OMFS_XOR_COUNT 19
19#define OMFS_MAX_BLOCK_SIZE 8192
20
21struct omfs_super_block {
22 char s_fill1[256];
23 __be64 s_root_block; /* block number of omfs_root_block */
24 __be64 s_num_blocks; /* total number of FS blocks */
25 __be32 s_magic; /* OMFS_MAGIC */
26 __be32 s_blocksize; /* size of a block */
27 __be32 s_mirrors; /* # of mirrors of system blocks */
28 __be32 s_sys_blocksize; /* size of non-data blocks */
29};
30
31struct omfs_header {
32 __be64 h_self; /* FS block where this is located */
33 __be32 h_body_size; /* size of useful data after header */
34 __be16 h_crc; /* crc-ccitt of body_size bytes */
35 char h_fill1[2];
36 u8 h_version; /* version, always 1 */
37 char h_type; /* OMFS_INODE_X */
38 u8 h_magic; /* OMFS_IMAGIC */
39 u8 h_check_xor; /* XOR of header bytes before this */
40 __be32 h_fill2;
41};
42
43struct omfs_root_block {
44 struct omfs_header r_head; /* header */
45 __be64 r_fill1;
46 __be64 r_num_blocks; /* total number of FS blocks */
47 __be64 r_root_dir; /* block # of root directory */
48 __be64 r_bitmap; /* block # of free space bitmap */
49 __be32 r_blocksize; /* size of a block */
50 __be32 r_clustersize; /* size allocated for data blocks */
51 __be64 r_mirrors; /* # of mirrors of system blocks */
52 char r_name[OMFS_NAMELEN]; /* partition label */
53};
54
55struct omfs_inode {
56 struct omfs_header i_head; /* header */
57 __be64 i_parent; /* parent containing this inode */
58 __be64 i_sibling; /* next inode in hash bucket */
59 __be64 i_ctime; /* ctime, in milliseconds */
60 char i_fill1[35];
61 char i_type; /* OMFS_[DIR,FILE] */
62 __be32 i_fill2;
63 char i_fill3[64];
64 char i_name[OMFS_NAMELEN]; /* filename */
65 __be64 i_size; /* size of file, in bytes */
66};
67
68struct omfs_extent_entry {
69 __be64 e_cluster; /* start location of a set of blocks */
70 __be64 e_blocks; /* number of blocks after e_cluster */
71};
72
73struct omfs_extent {
74 __be64 e_next; /* next extent table location */
75 __be32 e_extent_count; /* total # extents in this table */
76 __be32 e_fill;
77 struct omfs_extent_entry e_entry; /* start of extent entries */
78};
79
80#endif
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index d17b4fd204e1..9f5b054f06b9 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -430,7 +430,7 @@ static struct file_system_type openprom_fs_type = {
430 .kill_sb = kill_anon_super, 430 .kill_sb = kill_anon_super,
431}; 431};
432 432
433static void op_inode_init_once(struct kmem_cache * cachep, void *data) 433static void op_inode_init_once(void *data)
434{ 434{
435 struct op_inode_info *oi = (struct op_inode_info *) data; 435 struct op_inode_info *oi = (struct op_inode_info *) data;
436 436
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 797d775e0354..0d6eb33597c6 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -80,6 +80,7 @@
80#include <linux/delayacct.h> 80#include <linux/delayacct.h>
81#include <linux/seq_file.h> 81#include <linux/seq_file.h>
82#include <linux/pid_namespace.h> 82#include <linux/pid_namespace.h>
83#include <linux/tracehook.h>
83 84
84#include <asm/pgtable.h> 85#include <asm/pgtable.h>
85#include <asm/processor.h> 86#include <asm/processor.h>
@@ -168,8 +169,12 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
168 rcu_read_lock(); 169 rcu_read_lock();
169 ppid = pid_alive(p) ? 170 ppid = pid_alive(p) ?
170 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; 171 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
171 tpid = pid_alive(p) && p->ptrace ? 172 tpid = 0;
172 task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0; 173 if (pid_alive(p)) {
174 struct task_struct *tracer = tracehook_tracer_task(p);
175 if (tracer)
176 tpid = task_pid_nr_ns(tracer, ns);
177 }
173 seq_printf(m, 178 seq_printf(m,
174 "State:\t%s\n" 179 "State:\t%s\n"
175 "Tgid:\t%d\n" 180 "Tgid:\t%d\n"
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a891fe4cb43b..81bce6791bfc 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -69,6 +69,7 @@
69#include <linux/mount.h> 69#include <linux/mount.h>
70#include <linux/security.h> 70#include <linux/security.h>
71#include <linux/ptrace.h> 71#include <linux/ptrace.h>
72#include <linux/tracehook.h>
72#include <linux/cgroup.h> 73#include <linux/cgroup.h>
73#include <linux/cpuset.h> 74#include <linux/cpuset.h>
74#include <linux/audit.h> 75#include <linux/audit.h>
@@ -231,10 +232,14 @@ static int check_mem_permission(struct task_struct *task)
231 * If current is actively ptrace'ing, and would also be 232 * If current is actively ptrace'ing, and would also be
232 * permitted to freshly attach with ptrace now, permit it. 233 * permitted to freshly attach with ptrace now, permit it.
233 */ 234 */
234 if (task->parent == current && (task->ptrace & PT_PTRACED) && 235 if (task_is_stopped_or_traced(task)) {
235 task_is_stopped_or_traced(task) && 236 int match;
236 ptrace_may_access(task, PTRACE_MODE_ATTACH)) 237 rcu_read_lock();
237 return 0; 238 match = (tracehook_tracer_task(task) == current);
239 rcu_read_unlock();
240 if (match && ptrace_may_access(task, PTRACE_MODE_ATTACH))
241 return 0;
242 }
238 243
239 /* 244 /*
240 * Noone else is allowed. 245 * Noone else is allowed.
@@ -504,6 +509,26 @@ static int proc_pid_limits(struct task_struct *task, char *buffer)
504 return count; 509 return count;
505} 510}
506 511
512#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
513static int proc_pid_syscall(struct task_struct *task, char *buffer)
514{
515 long nr;
516 unsigned long args[6], sp, pc;
517
518 if (task_current_syscall(task, &nr, args, 6, &sp, &pc))
519 return sprintf(buffer, "running\n");
520
521 if (nr < 0)
522 return sprintf(buffer, "%ld 0x%lx 0x%lx\n", nr, sp, pc);
523
524 return sprintf(buffer,
525 "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
526 nr,
527 args[0], args[1], args[2], args[3], args[4], args[5],
528 sp, pc);
529}
530#endif /* CONFIG_HAVE_ARCH_TRACEHOOK */
531
507/************************************************************************/ 532/************************************************************************/
508/* Here the fs part begins */ 533/* Here the fs part begins */
509/************************************************************************/ 534/************************************************************************/
@@ -2473,6 +2498,9 @@ static const struct pid_entry tgid_base_stuff[] = {
2473#ifdef CONFIG_SCHED_DEBUG 2498#ifdef CONFIG_SCHED_DEBUG
2474 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2499 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
2475#endif 2500#endif
2501#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2502 INF("syscall", S_IRUSR, pid_syscall),
2503#endif
2476 INF("cmdline", S_IRUGO, pid_cmdline), 2504 INF("cmdline", S_IRUGO, pid_cmdline),
2477 ONE("stat", S_IRUGO, tgid_stat), 2505 ONE("stat", S_IRUGO, tgid_stat),
2478 ONE("statm", S_IRUGO, pid_statm), 2506 ONE("statm", S_IRUGO, pid_statm),
@@ -2805,6 +2833,9 @@ static const struct pid_entry tid_base_stuff[] = {
2805#ifdef CONFIG_SCHED_DEBUG 2833#ifdef CONFIG_SCHED_DEBUG
2806 REG("sched", S_IRUGO|S_IWUSR, pid_sched), 2834 REG("sched", S_IRUGO|S_IWUSR, pid_sched),
2807#endif 2835#endif
2836#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
2837 INF("syscall", S_IRUSR, pid_syscall),
2838#endif
2808 INF("cmdline", S_IRUGO, pid_cmdline), 2839 INF("cmdline", S_IRUGO, pid_cmdline),
2809 ONE("stat", S_IRUGO, tid_stat), 2840 ONE("stat", S_IRUGO, tid_stat),
2810 ONE("statm", S_IRUGO, pid_statm), 2841 ONE("statm", S_IRUGO, pid_statm),
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index bc0a0dd2d844..cb4096cc3fb7 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -806,12 +806,9 @@ continue_removing:
806 if (S_ISDIR(de->mode)) 806 if (S_ISDIR(de->mode))
807 parent->nlink--; 807 parent->nlink--;
808 de->nlink = 0; 808 de->nlink = 0;
809 if (de->subdir) { 809 WARN(de->subdir, KERN_WARNING "%s: removing non-empty directory "
810 printk(KERN_WARNING "%s: removing non-empty directory "
811 "'%s/%s', leaking at least '%s'\n", __func__, 810 "'%s/%s', leaking at least '%s'\n", __func__,
812 de->parent->name, de->name, de->subdir->name); 811 de->parent->name, de->name, de->subdir->name);
813 WARN_ON(1);
814 }
815 if (atomic_dec_and_test(&de->count)) 812 if (atomic_dec_and_test(&de->count))
816 free_proc_entry(de); 813 free_proc_entry(de);
817} 814}
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 02eca2ed9dd7..b37f25dc45a5 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -94,7 +94,7 @@ static void proc_destroy_inode(struct inode *inode)
94 kmem_cache_free(proc_inode_cachep, PROC_I(inode)); 94 kmem_cache_free(proc_inode_cachep, PROC_I(inode));
95} 95}
96 96
97static void init_once(struct kmem_cache * cachep, void *foo) 97static void init_once(void *foo)
98{ 98{
99 struct proc_inode *ei = (struct proc_inode *) foo; 99 struct proc_inode *ei = (struct proc_inode *) foo;
100 100
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index b31ab78052b3..2aad1044b84c 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -553,7 +553,7 @@ static void qnx4_destroy_inode(struct inode *inode)
553 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode)); 553 kmem_cache_free(qnx4_inode_cachep, qnx4_i(inode));
554} 554}
555 555
556static void init_once(struct kmem_cache *cachep, void *foo) 556static void init_once(void *foo)
557{ 557{
558 struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo; 558 struct qnx4_inode_info *ei = (struct qnx4_inode_info *) foo;
559 559
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 2ec748ba0bd3..879e54d35c2d 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -521,7 +521,7 @@ static void reiserfs_destroy_inode(struct inode *inode)
521 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); 521 kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode));
522} 522}
523 523
524static void init_once(struct kmem_cache * cachep, void *foo) 524static void init_once(void *foo)
525{ 525{
526 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; 526 struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo;
527 527
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 3f13d491c7c7..8e51a2aaa977 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -577,7 +577,7 @@ static void romfs_destroy_inode(struct inode *inode)
577 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode)); 577 kmem_cache_free(romfs_inode_cachep, ROMFS_I(inode));
578} 578}
579 579
580static void init_once(struct kmem_cache *cachep, void *foo) 580static void init_once(void *foo)
581{ 581{
582 struct romfs_inode_info *ei = foo; 582 struct romfs_inode_info *ei = foo;
583 583
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index 376ef3ee6ed7..3528f40ffb0f 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -67,7 +67,7 @@ static void smb_destroy_inode(struct inode *inode)
67 kmem_cache_free(smb_inode_cachep, SMB_I(inode)); 67 kmem_cache_free(smb_inode_cachep, SMB_I(inode));
68} 68}
69 69
70static void init_once(struct kmem_cache *cachep, void *foo) 70static void init_once(void *foo)
71{ 71{
72 struct smb_inode_info *ei = (struct smb_inode_info *) foo; 72 struct smb_inode_info *ei = (struct smb_inode_info *) foo;
73 73
diff --git a/fs/splice.c b/fs/splice.c
index 399442179d89..47dc1a445d1f 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1161,36 +1161,6 @@ static long do_splice(struct file *in, loff_t __user *off_in,
1161} 1161}
1162 1162
1163/* 1163/*
1164 * Do a copy-from-user while holding the mmap_semaphore for reading, in a
1165 * manner safe from deadlocking with simultaneous mmap() (grabbing mmap_sem
1166 * for writing) and page faulting on the user memory pointed to by src.
1167 * This assumes that we will very rarely hit the partial != 0 path, or this
1168 * will not be a win.
1169 */
1170static int copy_from_user_mmap_sem(void *dst, const void __user *src, size_t n)
1171{
1172 int partial;
1173
1174 if (!access_ok(VERIFY_READ, src, n))
1175 return -EFAULT;
1176
1177 pagefault_disable();
1178 partial = __copy_from_user_inatomic(dst, src, n);
1179 pagefault_enable();
1180
1181 /*
1182 * Didn't copy everything, drop the mmap_sem and do a faulting copy
1183 */
1184 if (unlikely(partial)) {
1185 up_read(&current->mm->mmap_sem);
1186 partial = copy_from_user(dst, src, n);
1187 down_read(&current->mm->mmap_sem);
1188 }
1189
1190 return partial;
1191}
1192
1193/*
1194 * Map an iov into an array of pages and offset/length tupples. With the 1164 * Map an iov into an array of pages and offset/length tupples. With the
1195 * partial_page structure, we can map several non-contiguous ranges into 1165 * partial_page structure, we can map several non-contiguous ranges into
1196 * our ones pages[] map instead of splitting that operation into pieces. 1166 * our ones pages[] map instead of splitting that operation into pieces.
@@ -1203,8 +1173,6 @@ static int get_iovec_page_array(const struct iovec __user *iov,
1203{ 1173{
1204 int buffers = 0, error = 0; 1174 int buffers = 0, error = 0;
1205 1175
1206 down_read(&current->mm->mmap_sem);
1207
1208 while (nr_vecs) { 1176 while (nr_vecs) {
1209 unsigned long off, npages; 1177 unsigned long off, npages;
1210 struct iovec entry; 1178 struct iovec entry;
@@ -1213,7 +1181,7 @@ static int get_iovec_page_array(const struct iovec __user *iov,
1213 int i; 1181 int i;
1214 1182
1215 error = -EFAULT; 1183 error = -EFAULT;
1216 if (copy_from_user_mmap_sem(&entry, iov, sizeof(entry))) 1184 if (copy_from_user(&entry, iov, sizeof(entry)))
1217 break; 1185 break;
1218 1186
1219 base = entry.iov_base; 1187 base = entry.iov_base;
@@ -1247,9 +1215,8 @@ static int get_iovec_page_array(const struct iovec __user *iov,
1247 if (npages > PIPE_BUFFERS - buffers) 1215 if (npages > PIPE_BUFFERS - buffers)
1248 npages = PIPE_BUFFERS - buffers; 1216 npages = PIPE_BUFFERS - buffers;
1249 1217
1250 error = get_user_pages(current, current->mm, 1218 error = get_user_pages_fast((unsigned long)base, npages,
1251 (unsigned long) base, npages, 0, 0, 1219 0, &pages[buffers]);
1252 &pages[buffers], NULL);
1253 1220
1254 if (unlikely(error <= 0)) 1221 if (unlikely(error <= 0))
1255 break; 1222 break;
@@ -1288,8 +1255,6 @@ static int get_iovec_page_array(const struct iovec __user *iov,
1288 iov++; 1255 iov++;
1289 } 1256 }
1290 1257
1291 up_read(&current->mm->mmap_sem);
1292
1293 if (buffers) 1258 if (buffers)
1294 return buffers; 1259 return buffers;
1295 1260
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index c1a7efb310bf..aedaeba82ae5 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -459,11 +459,8 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
459 int ret; 459 int ret;
460 460
461 ret = __sysfs_add_one(acxt, sd); 461 ret = __sysfs_add_one(acxt, sd);
462 if (ret == -EEXIST) { 462 WARN(ret == -EEXIST, KERN_WARNING "sysfs: duplicate filename '%s' "
463 printk(KERN_WARNING "sysfs: duplicate filename '%s' "
464 "can not be created\n", sd->s_name); 463 "can not be created\n", sd->s_name);
465 WARN_ON(1);
466 }
467 return ret; 464 return ret;
468} 465}
469 466
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 3f07893ff896..c9e4e5091da1 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -337,9 +337,8 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
337 if (kobj->ktype && kobj->ktype->sysfs_ops) 337 if (kobj->ktype && kobj->ktype->sysfs_ops)
338 ops = kobj->ktype->sysfs_ops; 338 ops = kobj->ktype->sysfs_ops;
339 else { 339 else {
340 printk(KERN_ERR "missing sysfs attribute operations for " 340 WARN(1, KERN_ERR "missing sysfs attribute operations for "
341 "kobject: %s\n", kobject_name(kobj)); 341 "kobject: %s\n", kobject_name(kobj));
342 WARN_ON(1);
343 goto err_out; 342 goto err_out;
344 } 343 }
345 344
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index eeba38417b1d..fe611949a7f7 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -134,9 +134,8 @@ void sysfs_remove_group(struct kobject * kobj,
134 if (grp->name) { 134 if (grp->name) {
135 sd = sysfs_get_dirent(dir_sd, grp->name); 135 sd = sysfs_get_dirent(dir_sd, grp->name);
136 if (!sd) { 136 if (!sd) {
137 printk(KERN_WARNING "sysfs group %p not found for " 137 WARN(!sd, KERN_WARNING "sysfs group %p not found for "
138 "kobject '%s'\n", grp, kobject_name(kobj)); 138 "kobject '%s'\n", grp, kobject_name(kobj));
139 WARN_ON(!sd);
140 return; 139 return;
141 } 140 }
142 } else 141 } else
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index c5d60de0658f..df0d435baa48 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -326,7 +326,7 @@ static void sysv_destroy_inode(struct inode *inode)
326 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode)); 326 kmem_cache_free(sysv_inode_cachep, SYSV_I(inode));
327} 327}
328 328
329static void init_once(struct kmem_cache *cachep, void *p) 329static void init_once(void *p)
330{ 330{
331 struct sysv_inode_info *si = (struct sysv_inode_info *)p; 331 struct sysv_inode_info *si = (struct sysv_inode_info *)p;
332 332
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 00eb9c68ad03..ca1e2d4e03cc 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1841,7 +1841,7 @@ static struct file_system_type ubifs_fs_type = {
1841/* 1841/*
1842 * Inode slab cache constructor. 1842 * Inode slab cache constructor.
1843 */ 1843 */
1844static void inode_slab_ctor(struct kmem_cache *cachep, void *obj) 1844static void inode_slab_ctor(void *obj)
1845{ 1845{
1846 struct ubifs_inode *ui = obj; 1846 struct ubifs_inode *ui = obj;
1847 inode_init_once(&ui->vfs_inode); 1847 inode_init_once(&ui->vfs_inode);
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 44cc702f96cc..5698bbf83bbf 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -148,7 +148,7 @@ static void udf_destroy_inode(struct inode *inode)
148 kmem_cache_free(udf_inode_cachep, UDF_I(inode)); 148 kmem_cache_free(udf_inode_cachep, UDF_I(inode));
149} 149}
150 150
151static void init_once(struct kmem_cache *cachep, void *foo) 151static void init_once(void *foo)
152{ 152{
153 struct udf_inode_info *ei = (struct udf_inode_info *)foo; 153 struct udf_inode_info *ei = (struct udf_inode_info *)foo;
154 154
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 227c9d700040..3e30e40aa24d 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1302,7 +1302,7 @@ static void ufs_destroy_inode(struct inode *inode)
1302 kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); 1302 kmem_cache_free(ufs_inode_cachep, UFS_I(inode));
1303} 1303}
1304 1304
1305static void init_once(struct kmem_cache * cachep, void *foo) 1305static void init_once(void *foo)
1306{ 1306{
1307 struct ufs_inode_info *ei = (struct ufs_inode_info *) foo; 1307 struct ufs_inode_info *ei = (struct ufs_inode_info *) foo;
1308 1308
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h
index 5e9564902976..a20683cf74dd 100644
--- a/fs/xfs/linux-2.6/kmem.h
+++ b/fs/xfs/linux-2.6/kmem.h
@@ -79,7 +79,7 @@ kmem_zone_init(int size, char *zone_name)
79 79
80static inline kmem_zone_t * 80static inline kmem_zone_t *
81kmem_zone_init_flags(int size, char *zone_name, unsigned long flags, 81kmem_zone_init_flags(int size, char *zone_name, unsigned long flags,
82 void (*construct)(kmem_zone_t *, void *)) 82 void (*construct)(void *))
83{ 83{
84 return kmem_cache_create(zone_name, size, 0, flags, construct); 84 return kmem_cache_create(zone_name, size, 0, flags, construct);
85} 85}
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 742b2c7852c1..943381284e2e 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -843,7 +843,6 @@ xfs_fs_destroy_inode(
843 843
844STATIC void 844STATIC void
845xfs_fs_inode_init_once( 845xfs_fs_inode_init_once(
846 kmem_zone_t *zonep,
847 void *vnode) 846 void *vnode)
848{ 847{
849 inode_init_once(vn_to_inode((bhv_vnode_t *)vnode)); 848 inode_init_once(vn_to_inode((bhv_vnode_t *)vnode));
diff --git a/include/asm-alpha/dma-mapping.h b/include/asm-alpha/dma-mapping.h
index db351d1296f4..a5801ae02e4b 100644
--- a/include/asm-alpha/dma-mapping.h
+++ b/include/asm-alpha/dma-mapping.h
@@ -24,8 +24,8 @@
24 pci_unmap_sg(alpha_gendev_to_pci(dev), sg, nents, dir) 24 pci_unmap_sg(alpha_gendev_to_pci(dev), sg, nents, dir)
25#define dma_supported(dev, mask) \ 25#define dma_supported(dev, mask) \
26 pci_dma_supported(alpha_gendev_to_pci(dev), mask) 26 pci_dma_supported(alpha_gendev_to_pci(dev), mask)
27#define dma_mapping_error(addr) \ 27#define dma_mapping_error(dev, addr) \
28 pci_dma_mapping_error(addr) 28 pci_dma_mapping_error(alpha_gendev_to_pci(dev), addr)
29 29
30#else /* no PCI - no IOMMU. */ 30#else /* no PCI - no IOMMU. */
31 31
@@ -45,7 +45,7 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
45#define dma_unmap_page(dev, addr, size, dir) ((void)0) 45#define dma_unmap_page(dev, addr, size, dir) ((void)0)
46#define dma_unmap_sg(dev, sg, nents, dir) ((void)0) 46#define dma_unmap_sg(dev, sg, nents, dir) ((void)0)
47 47
48#define dma_mapping_error(addr) (0) 48#define dma_mapping_error(dev, addr) (0)
49 49
50#endif /* !CONFIG_PCI */ 50#endif /* !CONFIG_PCI */
51 51
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index d31fd49ff79a..2a14302c17a3 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -106,7 +106,7 @@ extern dma_addr_t pci_map_page(struct pci_dev *, struct page *,
106/* Test for pci_map_single or pci_map_page having generated an error. */ 106/* Test for pci_map_single or pci_map_page having generated an error. */
107 107
108static inline int 108static inline int
109pci_dma_mapping_error(dma_addr_t dma_addr) 109pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
110{ 110{
111 return dma_addr == 0; 111 return dma_addr == 0;
112} 112}
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
index 70b0fe724b62..03cf1ee977b7 100644
--- a/include/asm-arm/cacheflush.h
+++ b/include/asm-arm/cacheflush.h
@@ -424,9 +424,9 @@ static inline void flush_anon_page(struct vm_area_struct *vma,
424} 424}
425 425
426#define flush_dcache_mmap_lock(mapping) \ 426#define flush_dcache_mmap_lock(mapping) \
427 write_lock_irq(&(mapping)->tree_lock) 427 spin_lock_irq(&(mapping)->tree_lock)
428#define flush_dcache_mmap_unlock(mapping) \ 428#define flush_dcache_mmap_unlock(mapping) \
429 write_unlock_irq(&(mapping)->tree_lock) 429 spin_unlock_irq(&(mapping)->tree_lock)
430 430
431#define flush_icache_user_range(vma,page,addr,len) \ 431#define flush_icache_user_range(vma,page,addr,len) \
432 flush_dcache_page(page) 432 flush_dcache_page(page)
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index e99406a7bece..f41335ba6337 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -56,7 +56,7 @@ static inline int dma_is_consistent(struct device *dev, dma_addr_t handle)
56/* 56/*
57 * DMA errors are defined by all-bits-set in the DMA address. 57 * DMA errors are defined by all-bits-set in the DMA address.
58 */ 58 */
59static inline int dma_mapping_error(dma_addr_t dma_addr) 59static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
60{ 60{
61 return dma_addr == ~0; 61 return dma_addr == ~0;
62} 62}
diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 57dc672bab8e..0399359ab5d8 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -35,7 +35,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
35/* 35/*
36 * dma_map_single can't fail as it is implemented now. 36 * dma_map_single can't fail as it is implemented now.
37 */ 37 */
38static inline int dma_mapping_error(dma_addr_t addr) 38static inline int dma_mapping_error(struct device *dev, dma_addr_t addr)
39{ 39{
40 return 0; 40 return 0;
41} 41}
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h
index 76033831eb35..320aa5e167e9 100644
--- a/include/asm-blackfin/bfin-global.h
+++ b/include/asm-blackfin/bfin-global.h
@@ -92,16 +92,20 @@ extern void *l1_data_B_sram_alloc(size_t);
92extern void *l1_inst_sram_alloc(size_t); 92extern void *l1_inst_sram_alloc(size_t);
93extern void *l1_data_sram_alloc(size_t); 93extern void *l1_data_sram_alloc(size_t);
94extern void *l1_data_sram_zalloc(size_t); 94extern void *l1_data_sram_zalloc(size_t);
95extern void *l2_sram_alloc(size_t);
96extern void *l2_sram_zalloc(size_t);
95extern int l1_data_A_sram_free(const void*); 97extern int l1_data_A_sram_free(const void*);
96extern int l1_data_B_sram_free(const void*); 98extern int l1_data_B_sram_free(const void*);
97extern int l1_inst_sram_free(const void*); 99extern int l1_inst_sram_free(const void*);
98extern int l1_data_sram_free(const void*); 100extern int l1_data_sram_free(const void*);
101extern int l2_sram_free(const void *);
99extern int sram_free(const void*); 102extern int sram_free(const void*);
100 103
101#define L1_INST_SRAM 0x00000001 104#define L1_INST_SRAM 0x00000001
102#define L1_DATA_A_SRAM 0x00000002 105#define L1_DATA_A_SRAM 0x00000002
103#define L1_DATA_B_SRAM 0x00000004 106#define L1_DATA_B_SRAM 0x00000004
104#define L1_DATA_SRAM 0x00000006 107#define L1_DATA_SRAM 0x00000006
108#define L2_SRAM 0x00000008
105extern void *sram_alloc_with_lsl(size_t, unsigned long); 109extern void *sram_alloc_with_lsl(size_t, unsigned long);
106extern int sram_free_with_lsl(const void*); 110extern int sram_free_with_lsl(const void*);
107 111
@@ -114,7 +118,9 @@ extern struct file_operations dpmc_fops;
114extern unsigned long _ramstart, _ramend, _rambase; 118extern unsigned long _ramstart, _ramend, _rambase;
115extern unsigned long memory_start, memory_end, physical_mem_end; 119extern unsigned long memory_start, memory_end, physical_mem_end;
116extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[], 120extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[],
117 _ebss_l1[], _l1_lma_start[], _sdata_b_l1[], _ebss_b_l1[]; 121 _ebss_l1[], _l1_lma_start[], _sdata_b_l1[], _ebss_b_l1[],
122 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[],
123 _ebss_l2[], _l2_lma_start[];
118 124
119#ifdef CONFIG_MTD_UCLINUX 125#ifdef CONFIG_MTD_UCLINUX
120extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size; 126extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
diff --git a/include/asm-blackfin/dma.h b/include/asm-blackfin/dma.h
index c0d5259e315b..3cd4b522aa3f 100644
--- a/include/asm-blackfin/dma.h
+++ b/include/asm-blackfin/dma.h
@@ -144,8 +144,16 @@ struct dma_channel {
144 void *data; 144 void *data;
145 unsigned int dma_enable_flag; 145 unsigned int dma_enable_flag;
146 unsigned int loopback_flag; 146 unsigned int loopback_flag;
147#ifdef CONFIG_PM
148 unsigned short saved_peripheral_map;
149#endif
147}; 150};
148 151
152#ifdef CONFIG_PM
153int blackfin_dma_suspend(void);
154void blackfin_dma_resume(void);
155#endif
156
149/******************************************************************************* 157/*******************************************************************************
150* DMA API's 158* DMA API's
151*******************************************************************************/ 159*******************************************************************************/
diff --git a/include/asm-blackfin/dpmc.h b/include/asm-blackfin/dpmc.h
index 7f34cd384f12..de28e6e018b3 100644
--- a/include/asm-blackfin/dpmc.h
+++ b/include/asm-blackfin/dpmc.h
@@ -7,63 +7,18 @@
7#ifndef _BLACKFIN_DPMC_H_ 7#ifndef _BLACKFIN_DPMC_H_
8#define _BLACKFIN_DPMC_H_ 8#define _BLACKFIN_DPMC_H_
9 9
10#define SLEEP_MODE 1
11#define DEEP_SLEEP_MODE 2
12#define ACTIVE_PLL_DISABLED 3
13#define FULLON_MODE 4
14#define ACTIVE_PLL_ENABLED 5
15#define HIBERNATE_MODE 6
16
17#define IOCTL_FULL_ON_MODE _IO('s', 0xA0)
18#define IOCTL_ACTIVE_MODE _IO('s', 0xA1)
19#define IOCTL_SLEEP_MODE _IO('s', 0xA2)
20#define IOCTL_DEEP_SLEEP_MODE _IO('s', 0xA3)
21#define IOCTL_HIBERNATE_MODE _IO('s', 0xA4)
22#define IOCTL_CHANGE_FREQUENCY _IOW('s', 0xA5, unsigned long)
23#define IOCTL_CHANGE_VOLTAGE _IOW('s', 0xA6, unsigned long)
24#define IOCTL_SET_CCLK _IOW('s', 0xA7, unsigned long)
25#define IOCTL_SET_SCLK _IOW('s', 0xA8, unsigned long)
26#define IOCTL_GET_PLLSTATUS _IOW('s', 0xA9, unsigned long)
27#define IOCTL_GET_CORECLOCK _IOW('s', 0xAA, unsigned long)
28#define IOCTL_GET_SYSTEMCLOCK _IOW('s', 0xAB, unsigned long)
29#define IOCTL_GET_VCO _IOW('s', 0xAC, unsigned long)
30#define IOCTL_DISABLE_WDOG_TIMER _IO('s', 0xAD)
31#define IOCTL_UNMASK_WDOG_WAKEUP_EVENT _IO('s',0xAE)
32#define IOCTL_PROGRAM_WDOG_TIMER _IOW('s',0xAF,unsigned long)
33#define IOCTL_CLEAR_WDOG_WAKEUP_EVENT _IO('s',0xB0)
34#define IOCTL_SLEEP_DEEPER_MODE _IO('s',0xB1)
35
36#define DPMC_MINOR 254
37
38#define ON 0
39#define OFF 1
40
41#ifdef __KERNEL__ 10#ifdef __KERNEL__
11#ifndef __ASSEMBLY__
42 12
43unsigned long calc_volt(void);
44int calc_vlev(int vlt);
45unsigned long change_voltage(unsigned long volt);
46int calc_msel(int vco_hz);
47unsigned long change_frequency(unsigned long vco_mhz);
48int set_pll_div(unsigned short sel, unsigned char flag);
49int get_vco(void);
50unsigned long change_system_clock(unsigned long clock);
51unsigned long change_core_clock(unsigned long clock);
52unsigned long get_pll_status(void);
53void change_baud(int baud);
54void fullon_mode(void);
55void active_mode(void);
56void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); 13void sleep_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
57void deep_sleep(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); 14void deep_sleep(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
58void hibernate_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); 15void hibernate_mode(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
59void sleep_deeper(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2); 16void sleep_deeper(u32 sic_iwr0, u32 sic_iwr1, u32 sic_iwr2);
60void program_wdog_timer(unsigned long); 17void do_hibernate(int wakeup);
61void unmask_wdog_wakeup_evt(void); 18void set_dram_srfs(void);
62void clear_wdog_wakeup_evt(void); 19void unset_dram_srfs(void);
63void disable_wdog_timer(void);
64 20
65extern unsigned long get_cclk(void); 21#define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16))
66extern unsigned long get_sclk(void);
67 22
68struct bfin_dpmc_platform_data { 23struct bfin_dpmc_platform_data {
69 const unsigned int *tuple_tab; 24 const unsigned int *tuple_tab;
@@ -71,8 +26,33 @@ struct bfin_dpmc_platform_data {
71 unsigned short vr_settling_time; /* in us */ 26 unsigned short vr_settling_time; /* in us */
72}; 27};
73 28
74#define VRPAIR(vlev, freq) (((vlev) << 16) | ((freq) >> 16)) 29#else
30
31#define PM_PUSH(x) \
32 R0 = [P0 + (x - SRAM_BASE_ADDRESS)];\
33 [--SP] = R0;\
34
35#define PM_POP(x) \
36 R0 = [SP++];\
37 [P0 + (x - SRAM_BASE_ADDRESS)] = R0;\
38
39#define PM_SYS_PUSH(x) \
40 R0 = [P0 + (x - PLL_CTL)];\
41 [--SP] = R0;\
42
43#define PM_SYS_POP(x) \
44 R0 = [SP++];\
45 [P0 + (x - PLL_CTL)] = R0;\
46
47#define PM_SYS_PUSH16(x) \
48 R0 = w[P0 + (x - PLL_CTL)];\
49 [--SP] = R0;\
50
51#define PM_SYS_POP16(x) \
52 R0 = [SP++];\
53 w[P0 + (x - PLL_CTL)] = R0;\
75 54
55#endif
76#endif /* __KERNEL__ */ 56#endif /* __KERNEL__ */
77 57
78#endif /*_BLACKFIN_DPMC_H_*/ 58#endif /*_BLACKFIN_DPMC_H_*/
diff --git a/include/asm-blackfin/elf.h b/include/asm-blackfin/elf.h
index 30303fc8292c..67a03a8a353e 100644
--- a/include/asm-blackfin/elf.h
+++ b/include/asm-blackfin/elf.h
@@ -15,6 +15,8 @@
15#define EF_BFIN_FDPIC 0x00000002 /* -mfdpic */ 15#define EF_BFIN_FDPIC 0x00000002 /* -mfdpic */
16#define EF_BFIN_CODE_IN_L1 0x00000010 /* --code-in-l1 */ 16#define EF_BFIN_CODE_IN_L1 0x00000010 /* --code-in-l1 */
17#define EF_BFIN_DATA_IN_L1 0x00000020 /* --data-in-l1 */ 17#define EF_BFIN_DATA_IN_L1 0x00000020 /* --data-in-l1 */
18#define EF_BFIN_CODE_IN_L2 0x00000040 /* --code-in-l2 */
19#define EF_BFIN_DATA_IN_L2 0x00000080 /* --data-in-l2 */
18 20
19typedef unsigned long elf_greg_t; 21typedef unsigned long elf_greg_t;
20 22
diff --git a/include/asm-blackfin/gpio.h b/include/asm-blackfin/gpio.h
index ff95e9d88342..168f1251eb4d 100644
--- a/include/asm-blackfin/gpio.h
+++ b/include/asm-blackfin/gpio.h
@@ -376,8 +376,12 @@ struct gpio_port_t {
376#endif 376#endif
377 377
378#ifdef CONFIG_PM 378#ifdef CONFIG_PM
379unsigned int bfin_pm_setup(void); 379
380void bfin_pm_restore(void); 380unsigned int bfin_pm_standby_setup(void);
381void bfin_pm_standby_restore(void);
382
383void bfin_gpio_pm_hibernate_restore(void);
384void bfin_gpio_pm_hibernate_suspend(void);
381 385
382#ifndef CONFIG_BF54x 386#ifndef CONFIG_BF54x
383#define PM_WAKE_RISING 0x1 387#define PM_WAKE_RISING 0x1
@@ -392,17 +396,8 @@ void gpio_pm_wakeup_free(unsigned gpio);
392 396
393struct gpio_port_s { 397struct gpio_port_s {
394 unsigned short data; 398 unsigned short data;
395 unsigned short data_clear;
396 unsigned short data_set;
397 unsigned short toggle;
398 unsigned short maska; 399 unsigned short maska;
399 unsigned short maska_clear;
400 unsigned short maska_set;
401 unsigned short maska_toggle;
402 unsigned short maskb; 400 unsigned short maskb;
403 unsigned short maskb_clear;
404 unsigned short maskb_set;
405 unsigned short maskb_toggle;
406 unsigned short dir; 401 unsigned short dir;
407 unsigned short polar; 402 unsigned short polar;
408 unsigned short edge; 403 unsigned short edge;
@@ -411,10 +406,10 @@ struct gpio_port_s {
411 406
412 unsigned short fer; 407 unsigned short fer;
413 unsigned short reserved; 408 unsigned short reserved;
409 unsigned short mux;
414}; 410};
415#endif /*CONFIG_BF54x*/ 411#endif /*CONFIG_BF54x*/
416#endif /*CONFIG_PM*/ 412#endif /*CONFIG_PM*/
417
418/*********************************************************** 413/***********************************************************
419* 414*
420* FUNCTIONS: Blackfin GPIO Driver 415* FUNCTIONS: Blackfin GPIO Driver
diff --git a/include/asm-blackfin/mach-bf527/anomaly.h b/include/asm-blackfin/mach-bf527/anomaly.h
index 4725268a5ada..b7b166f4f064 100644
--- a/include/asm-blackfin/mach-bf527/anomaly.h
+++ b/include/asm-blackfin/mach-bf527/anomaly.h
@@ -23,6 +23,8 @@
23#define ANOMALY_05000245 (1) 23#define ANOMALY_05000245 (1)
24/* Sensitivity To Noise with Slow Input Edge Rates on External SPORT TX and RX Clocks */ 24/* Sensitivity To Noise with Slow Input Edge Rates on External SPORT TX and RX Clocks */
25#define ANOMALY_05000265 (1) 25#define ANOMALY_05000265 (1)
26/* New Feature: EMAC TX DMA Word Alignment */
27#define ANOMALY_05000285 (1)
26/* Errors when SSYNC, CSYNC, or Loads to LT, LB and LC Registers Are Interrupted */ 28/* Errors when SSYNC, CSYNC, or Loads to LT, LB and LC Registers Are Interrupted */
27#define ANOMALY_05000312 (1) 29#define ANOMALY_05000312 (1)
28/* Incorrect Access of OTP_STATUS During otp_write() Function */ 30/* Incorrect Access of OTP_STATUS During otp_write() Function */
diff --git a/include/asm-blackfin/mach-bf527/bfin_sir.h b/include/asm-blackfin/mach-bf527/bfin_sir.h
index 0612d0c9501c..cfd8ad4f1f2c 100644
--- a/include/asm-blackfin/mach-bf527/bfin_sir.h
+++ b/include/asm-blackfin/mach-bf527/bfin_sir.h
@@ -118,16 +118,25 @@ static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
118 118
119#define DRIVER_NAME "bfin_sir" 119#define DRIVER_NAME "bfin_sir"
120 120
121static void bfin_sir_hw_init(void) 121static int bfin_sir_hw_init(void)
122{ 122{
123 int ret = -ENODEV;
123#ifdef CONFIG_BFIN_SIR0 124#ifdef CONFIG_BFIN_SIR0
124 peripheral_request(P_UART0_TX, DRIVER_NAME); 125 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
125 peripheral_request(P_UART0_RX, DRIVER_NAME); 126 if (ret)
127 return ret;
128 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
129 if (ret)
130 return ret;
126#endif 131#endif
127 132
128#ifdef CONFIG_BFIN_SIR1 133#ifdef CONFIG_BFIN_SIR1
129 peripheral_request(P_UART1_TX, DRIVER_NAME); 134 ret = peripheral_request(P_UART1_TX, DRIVER_NAME);
130 peripheral_request(P_UART1_RX, DRIVER_NAME); 135 if (ret)
136 return ret;
137 ret = peripheral_request(P_UART1_RX, DRIVER_NAME);
138 if (ret)
139 return ret;
131#endif 140#endif
132 SSYNC(); 141 return ret;
133} 142}
diff --git a/include/asm-blackfin/mach-bf527/defBF527.h b/include/asm-blackfin/mach-bf527/defBF527.h
index 82134f578f32..f1a70db70cb8 100644
--- a/include/asm-blackfin/mach-bf527/defBF527.h
+++ b/include/asm-blackfin/mach-bf527/defBF527.h
@@ -302,6 +302,7 @@
302#define PHYIE 0x00000001 /* PHY_INT Interrupt Enable */ 302#define PHYIE 0x00000001 /* PHY_INT Interrupt Enable */
303#define RXDWA 0x00000002 /* Receive Frame DMA Word Alignment (Odd/Even*) */ 303#define RXDWA 0x00000002 /* Receive Frame DMA Word Alignment (Odd/Even*) */
304#define RXCKS 0x00000004 /* Enable RX Frame TCP/UDP Checksum Computation */ 304#define RXCKS 0x00000004 /* Enable RX Frame TCP/UDP Checksum Computation */
305#define TXDWA 0x00000010 /* Transmit Frame DMA Word Alignment (Odd/Even*) */
305#define MDCDIV 0x00003F00 /* SCLK:MDC Clock Divisor [MDC=SCLK/(2*(N+1))] */ 306#define MDCDIV 0x00003F00 /* SCLK:MDC Clock Divisor [MDC=SCLK/(2*(N+1))] */
306 307
307#define SET_MDCDIV(x) (((x)&0x3F)<< 8) /* Set MDC Clock Divisor */ 308#define SET_MDCDIV(x) (((x)&0x3F)<< 8) /* Set MDC Clock Divisor */
diff --git a/include/asm-blackfin/mach-bf527/mem_init.h b/include/asm-blackfin/mach-bf527/mem_init.h
index 008ca66719e2..cbe03f4a5698 100644
--- a/include/asm-blackfin/mach-bf527/mem_init.h
+++ b/include/asm-blackfin/mach-bf527/mem_init.h
@@ -146,33 +146,6 @@
146#define SDRAM_CL CL_3 146#define SDRAM_CL CL_3
147#endif 147#endif
148 148
149#if (CONFIG_MEM_SIZE == 128)
150#define SDRAM_SIZE EBSZ_128
151#endif
152#if (CONFIG_MEM_SIZE == 64)
153#define SDRAM_SIZE EBSZ_64
154#endif
155#if (CONFIG_MEM_SIZE == 32)
156#define SDRAM_SIZE EBSZ_32
157#endif
158#if (CONFIG_MEM_SIZE == 16)
159#define SDRAM_SIZE EBSZ_16
160#endif
161#if (CONFIG_MEM_ADD_WIDTH == 11)
162#define SDRAM_WIDTH EBCAW_11
163#endif
164#if (CONFIG_MEM_ADD_WIDTH == 10)
165#define SDRAM_WIDTH EBCAW_10
166#endif
167#if (CONFIG_MEM_ADD_WIDTH == 9)
168#define SDRAM_WIDTH EBCAW_9
169#endif
170#if (CONFIG_MEM_ADD_WIDTH == 8)
171#define SDRAM_WIDTH EBCAW_8
172#endif
173
174#define mem_SDBCTL (SDRAM_WIDTH | SDRAM_SIZE | EBE)
175
176/* Equation from section 17 (p17-46) of BF533 HRM */ 149/* Equation from section 17 (p17-46) of BF533 HRM */
177#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) 150#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
178 151
diff --git a/include/asm-blackfin/mach-bf533/bfin_sir.h b/include/asm-blackfin/mach-bf533/bfin_sir.h
index cefcf8bb505b..9bb87e9e2e9b 100644
--- a/include/asm-blackfin/mach-bf533/bfin_sir.h
+++ b/include/asm-blackfin/mach-bf533/bfin_sir.h
@@ -110,11 +110,16 @@ static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
110 110
111#define DRIVER_NAME "bfin_sir" 111#define DRIVER_NAME "bfin_sir"
112 112
113static void bfin_sir_hw_init(void) 113static int bfin_sir_hw_init(void)
114{ 114{
115 int ret = -ENODEV;
115#ifdef CONFIG_BFIN_SIR0 116#ifdef CONFIG_BFIN_SIR0
116 peripheral_request(P_UART0_TX, DRIVER_NAME); 117 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
117 peripheral_request(P_UART0_RX, DRIVER_NAME); 118 if (ret)
119 return ret;
120 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
121 if (ret)
122 return ret;
118#endif 123#endif
119 SSYNC(); 124 return ret;
120} 125}
diff --git a/include/asm-blackfin/mach-bf533/mem_init.h b/include/asm-blackfin/mach-bf533/mem_init.h
index f8f31901fca9..995c06b2b1ef 100644
--- a/include/asm-blackfin/mach-bf533/mem_init.h
+++ b/include/asm-blackfin/mach-bf533/mem_init.h
@@ -133,33 +133,6 @@
133#define SDRAM_CL CL_3 133#define SDRAM_CL CL_3
134#endif 134#endif
135 135
136#if (CONFIG_MEM_SIZE == 128)
137#define SDRAM_SIZE EBSZ_128
138#endif
139#if (CONFIG_MEM_SIZE == 64)
140#define SDRAM_SIZE EBSZ_64
141#endif
142#if (CONFIG_MEM_SIZE == 32)
143#define SDRAM_SIZE EBSZ_32
144#endif
145#if (CONFIG_MEM_SIZE == 16)
146#define SDRAM_SIZE EBSZ_16
147#endif
148#if (CONFIG_MEM_ADD_WIDTH == 11)
149#define SDRAM_WIDTH EBCAW_11
150#endif
151#if (CONFIG_MEM_ADD_WIDTH == 10)
152#define SDRAM_WIDTH EBCAW_10
153#endif
154#if (CONFIG_MEM_ADD_WIDTH == 9)
155#define SDRAM_WIDTH EBCAW_9
156#endif
157#if (CONFIG_MEM_ADD_WIDTH == 8)
158#define SDRAM_WIDTH EBCAW_8
159#endif
160
161#define mem_SDBCTL (SDRAM_WIDTH | SDRAM_SIZE | EBE)
162
163/* Equation from section 17 (p17-46) of BF533 HRM */ 136/* Equation from section 17 (p17-46) of BF533 HRM */
164#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) 137#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
165 138
diff --git a/include/asm-blackfin/mach-bf537/bfin_sir.h b/include/asm-blackfin/mach-bf537/bfin_sir.h
index 0612d0c9501c..cfd8ad4f1f2c 100644
--- a/include/asm-blackfin/mach-bf537/bfin_sir.h
+++ b/include/asm-blackfin/mach-bf537/bfin_sir.h
@@ -118,16 +118,25 @@ static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
118 118
119#define DRIVER_NAME "bfin_sir" 119#define DRIVER_NAME "bfin_sir"
120 120
121static void bfin_sir_hw_init(void) 121static int bfin_sir_hw_init(void)
122{ 122{
123 int ret = -ENODEV;
123#ifdef CONFIG_BFIN_SIR0 124#ifdef CONFIG_BFIN_SIR0
124 peripheral_request(P_UART0_TX, DRIVER_NAME); 125 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
125 peripheral_request(P_UART0_RX, DRIVER_NAME); 126 if (ret)
127 return ret;
128 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
129 if (ret)
130 return ret;
126#endif 131#endif
127 132
128#ifdef CONFIG_BFIN_SIR1 133#ifdef CONFIG_BFIN_SIR1
129 peripheral_request(P_UART1_TX, DRIVER_NAME); 134 ret = peripheral_request(P_UART1_TX, DRIVER_NAME);
130 peripheral_request(P_UART1_RX, DRIVER_NAME); 135 if (ret)
136 return ret;
137 ret = peripheral_request(P_UART1_RX, DRIVER_NAME);
138 if (ret)
139 return ret;
131#endif 140#endif
132 SSYNC(); 141 return ret;
133} 142}
diff --git a/include/asm-blackfin/mach-bf537/defBF537.h b/include/asm-blackfin/mach-bf537/defBF537.h
index 3f455909c418..abde24c6d3b1 100644
--- a/include/asm-blackfin/mach-bf537/defBF537.h
+++ b/include/asm-blackfin/mach-bf537/defBF537.h
@@ -290,6 +290,7 @@
290#define PHYIE 0x00000001 /* PHY_INT Interrupt Enable */ 290#define PHYIE 0x00000001 /* PHY_INT Interrupt Enable */
291#define RXDWA 0x00000002 /* Receive Frame DMA Word Alignment (Odd/Even*) */ 291#define RXDWA 0x00000002 /* Receive Frame DMA Word Alignment (Odd/Even*) */
292#define RXCKS 0x00000004 /* Enable RX Frame TCP/UDP Checksum Computation */ 292#define RXCKS 0x00000004 /* Enable RX Frame TCP/UDP Checksum Computation */
293#define TXDWA 0x00000010 /* Transmit Frame DMA Word Alignment (Odd/Even*) */
293#define MDCDIV 0x00003F00 /* SCLK:MDC Clock Divisor [MDC=SCLK/(2*(N+1))] */ 294#define MDCDIV 0x00003F00 /* SCLK:MDC Clock Divisor [MDC=SCLK/(2*(N+1))] */
294 295
295#define SET_MDCDIV(x) (((x)&0x3F)<< 8) /* Set MDC Clock Divisor */ 296#define SET_MDCDIV(x) (((x)&0x3F)<< 8) /* Set MDC Clock Divisor */
diff --git a/include/asm-blackfin/mach-bf537/mem_init.h b/include/asm-blackfin/mach-bf537/mem_init.h
index 9ad979d416c6..f67698f670ca 100644
--- a/include/asm-blackfin/mach-bf537/mem_init.h
+++ b/include/asm-blackfin/mach-bf537/mem_init.h
@@ -139,33 +139,6 @@
139#define SDRAM_CL CL_3 139#define SDRAM_CL CL_3
140#endif 140#endif
141 141
142#if (CONFIG_MEM_SIZE == 128)
143#define SDRAM_SIZE EBSZ_128
144#endif
145#if (CONFIG_MEM_SIZE == 64)
146#define SDRAM_SIZE EBSZ_64
147#endif
148#if (CONFIG_MEM_SIZE == 32)
149#define SDRAM_SIZE EBSZ_32
150#endif
151#if (CONFIG_MEM_SIZE == 16)
152#define SDRAM_SIZE EBSZ_16
153#endif
154#if (CONFIG_MEM_ADD_WIDTH == 11)
155#define SDRAM_WIDTH EBCAW_11
156#endif
157#if (CONFIG_MEM_ADD_WIDTH == 10)
158#define SDRAM_WIDTH EBCAW_10
159#endif
160#if (CONFIG_MEM_ADD_WIDTH == 9)
161#define SDRAM_WIDTH EBCAW_9
162#endif
163#if (CONFIG_MEM_ADD_WIDTH == 8)
164#define SDRAM_WIDTH EBCAW_8
165#endif
166
167#define mem_SDBCTL (SDRAM_WIDTH | SDRAM_SIZE | EBE)
168
169/* Equation from section 17 (p17-46) of BF533 HRM */ 142/* Equation from section 17 (p17-46) of BF533 HRM */
170#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) 143#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
171 144
diff --git a/include/asm-blackfin/mach-bf548/bfin_sir.h b/include/asm-blackfin/mach-bf548/bfin_sir.h
index 5e94271c7e3b..c41f9cf00268 100644
--- a/include/asm-blackfin/mach-bf548/bfin_sir.h
+++ b/include/asm-blackfin/mach-bf548/bfin_sir.h
@@ -124,26 +124,43 @@ struct bfin_sir_self {
124 124
125#define DRIVER_NAME "bfin_sir" 125#define DRIVER_NAME "bfin_sir"
126 126
127static void bfin_sir_hw_init(void) 127static int bfin_sir_hw_init(void)
128{ 128{
129 int ret = -ENODEV;
129#ifdef CONFIG_BFIN_SIR0 130#ifdef CONFIG_BFIN_SIR0
130 peripheral_request(P_UART0_TX, DRIVER_NAME); 131 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
131 peripheral_request(P_UART0_RX, DRIVER_NAME); 132 if (ret)
133 return ret;
134 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
135 if (ret)
136 return ret;
132#endif 137#endif
133 138
134#ifdef CONFIG_BFIN_SIR1 139#ifdef CONFIG_BFIN_SIR1
135 peripheral_request(P_UART1_TX, DRIVER_NAME); 140 ret = peripheral_request(P_UART1_TX, DRIVER_NAME);
136 peripheral_request(P_UART1_RX, DRIVER_NAME); 141 if (ret)
142 return ret;
143 ret = peripheral_request(P_UART1_RX, DRIVER_NAME);
144 if (ret)
145 return ret;
137#endif 146#endif
138 147
139#ifdef CONFIG_BFIN_SIR2 148#ifdef CONFIG_BFIN_SIR2
140 peripheral_request(P_UART2_TX, DRIVER_NAME); 149 ret = peripheral_request(P_UART2_TX, DRIVER_NAME);
141 peripheral_request(P_UART2_RX, DRIVER_NAME); 150 if (ret)
151 return ret;
152 ret = peripheral_request(P_UART2_RX, DRIVER_NAME);
153 if (ret)
154 return ret;
142#endif 155#endif
143 156
144#ifdef CONFIG_BFIN_SIR3 157#ifdef CONFIG_BFIN_SIR3
145 peripheral_request(P_UART3_TX, DRIVER_NAME); 158 ret = peripheral_request(P_UART3_TX, DRIVER_NAME);
146 peripheral_request(P_UART3_RX, DRIVER_NAME); 159 if (ret)
160 return ret;
161 ret = peripheral_request(P_UART3_RX, DRIVER_NAME);
162 if (ret)
163 return ret;
147#endif 164#endif
148 SSYNC(); 165 return ret;
149} 166}
diff --git a/include/asm-blackfin/mach-bf548/gpio.h b/include/asm-blackfin/mach-bf548/gpio.h
index cb8b0f15c9a6..bba82dc75f16 100644
--- a/include/asm-blackfin/mach-bf548/gpio.h
+++ b/include/asm-blackfin/mach-bf548/gpio.h
@@ -209,3 +209,11 @@ struct gpio_port_t {
209 unsigned short dummy7; 209 unsigned short dummy7;
210 unsigned int port_mux; 210 unsigned int port_mux;
211}; 211};
212
213struct gpio_port_s {
214 unsigned short fer;
215 unsigned short data;
216 unsigned short dir;
217 unsigned short inen;
218 unsigned int mux;
219};
diff --git a/include/asm-blackfin/mach-bf561/bfin_sir.h b/include/asm-blackfin/mach-bf561/bfin_sir.h
index cefcf8bb505b..9bb87e9e2e9b 100644
--- a/include/asm-blackfin/mach-bf561/bfin_sir.h
+++ b/include/asm-blackfin/mach-bf561/bfin_sir.h
@@ -110,11 +110,16 @@ static inline void SIR_UART_CLEAR_LSR(struct bfin_sir_port *port)
110 110
111#define DRIVER_NAME "bfin_sir" 111#define DRIVER_NAME "bfin_sir"
112 112
113static void bfin_sir_hw_init(void) 113static int bfin_sir_hw_init(void)
114{ 114{
115 int ret = -ENODEV;
115#ifdef CONFIG_BFIN_SIR0 116#ifdef CONFIG_BFIN_SIR0
116 peripheral_request(P_UART0_TX, DRIVER_NAME); 117 ret = peripheral_request(P_UART0_TX, DRIVER_NAME);
117 peripheral_request(P_UART0_RX, DRIVER_NAME); 118 if (ret)
119 return ret;
120 ret = peripheral_request(P_UART0_RX, DRIVER_NAME);
121 if (ret)
122 return ret;
118#endif 123#endif
119 SSYNC(); 124 return ret;
120} 125}
diff --git a/include/asm-blackfin/mach-bf561/mem_init.h b/include/asm-blackfin/mach-bf561/mem_init.h
index 439a5895b346..e163260bca18 100644
--- a/include/asm-blackfin/mach-bf561/mem_init.h
+++ b/include/asm-blackfin/mach-bf561/mem_init.h
@@ -131,33 +131,6 @@
131#define SDRAM_CL CL_3 131#define SDRAM_CL CL_3
132#endif 132#endif
133 133
134#if (CONFIG_MEM_SIZE == 128)
135#define SDRAM_SIZE EB0_SZ_128
136#endif
137#if (CONFIG_MEM_SIZE == 64)
138#define SDRAM_SIZE EB0_SZ_64
139#endif
140#if ( CONFIG_MEM_SIZE == 32)
141#define SDRAM_SIZE EB0_SZ_32
142#endif
143#if (CONFIG_MEM_SIZE == 16)
144#define SDRAM_SIZE EB0_SZ_16
145#endif
146#if (CONFIG_MEM_ADD_WIDTH == 11)
147#define SDRAM_WIDTH EB0_CAW_11
148#endif
149#if (CONFIG_MEM_ADD_WIDTH == 10)
150#define SDRAM_WIDTH EB0_CAW_10
151#endif
152#if (CONFIG_MEM_ADD_WIDTH == 9)
153#define SDRAM_WIDTH EB0_CAW_9
154#endif
155#if (CONFIG_MEM_ADD_WIDTH == 8)
156#define SDRAM_WIDTH EB0_CAW_8
157#endif
158
159#define mem_SDBCTL (SDRAM_WIDTH | SDRAM_SIZE | EB0_E)
160
161/* Equation from section 17 (p17-46) of BF533 HRM */ 134/* Equation from section 17 (p17-46) of BF533 HRM */
162#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num) 135#define mem_SDRRC (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
163 136
diff --git a/include/asm-blackfin/module.h b/include/asm-blackfin/module.h
index 3c7ce1644280..e3128df139d6 100644
--- a/include/asm-blackfin/module.h
+++ b/include/asm-blackfin/module.h
@@ -6,8 +6,6 @@
6#define Elf_Shdr Elf32_Shdr 6#define Elf_Shdr Elf32_Shdr
7#define Elf_Sym Elf32_Sym 7#define Elf_Sym Elf32_Sym
8#define Elf_Ehdr Elf32_Ehdr 8#define Elf_Ehdr Elf32_Ehdr
9#define FLG_CODE_IN_L1 0x10
10#define FLG_DATA_IN_L1 0x20
11 9
12struct mod_arch_specific { 10struct mod_arch_specific {
13 Elf_Shdr *text_l1; 11 Elf_Shdr *text_l1;
@@ -15,5 +13,8 @@ struct mod_arch_specific {
15 Elf_Shdr *bss_a_l1; 13 Elf_Shdr *bss_a_l1;
16 Elf_Shdr *data_b_l1; 14 Elf_Shdr *data_b_l1;
17 Elf_Shdr *bss_b_l1; 15 Elf_Shdr *bss_b_l1;
16 Elf_Shdr *text_l2;
17 Elf_Shdr *data_l2;
18 Elf_Shdr *bss_l2;
18}; 19};
19#endif /* _ASM_BFIN_MODULE_H */ 20#endif /* _ASM_BFIN_MODULE_H */
diff --git a/include/asm-blackfin/processor.h b/include/asm-blackfin/processor.h
index 1c0040724612..6f3995b119d8 100644
--- a/include/asm-blackfin/processor.h
+++ b/include/asm-blackfin/processor.h
@@ -112,7 +112,26 @@ unsigned long get_wchan(struct task_struct *p);
112static inline uint32_t __pure bfin_revid(void) 112static inline uint32_t __pure bfin_revid(void)
113{ 113{
114 /* stored in the upper 4 bits */ 114 /* stored in the upper 4 bits */
115 return bfin_read_CHIPID() >> 28; 115 uint32_t revid = bfin_read_CHIPID() >> 28;
116
117#ifdef CONFIG_BF52x
118 /* ANOMALY_05000357
119 * Incorrect Revision Number in DSPID Register
120 */
121 if (revid == 0)
122 switch (bfin_read16(_BOOTROM_GET_DXE_ADDRESS_TWI)) {
123 case 0x0010:
124 revid = 0;
125 break;
126 case 0x2796:
127 revid = 1;
128 break;
129 default:
130 revid = 0xFFFF;
131 break;
132 }
133#endif
134 return revid;
116} 135}
117 136
118static inline uint32_t __pure bfin_compiled_revid(void) 137static inline uint32_t __pure bfin_compiled_revid(void)
diff --git a/include/asm-cris/dma-mapping.h b/include/asm-cris/dma-mapping.h
index edc8d1bfaae2..cb2fb25ff8d9 100644
--- a/include/asm-cris/dma-mapping.h
+++ b/include/asm-cris/dma-mapping.h
@@ -120,7 +120,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
120} 120}
121 121
122static inline int 122static inline int
123dma_mapping_error(dma_addr_t dma_addr) 123dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
124{ 124{
125 return 0; 125 return 0;
126} 126}
diff --git a/include/asm-frv/dma-mapping.h b/include/asm-frv/dma-mapping.h
index 2e8966ca030d..b2898877c07b 100644
--- a/include/asm-frv/dma-mapping.h
+++ b/include/asm-frv/dma-mapping.h
@@ -126,7 +126,7 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nele
126} 126}
127 127
128static inline 128static inline
129int dma_mapping_error(dma_addr_t dma_addr) 129int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
130{ 130{
131 return 0; 131 return 0;
132} 132}
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h
index e2468f894d2a..82cd0cb1c3fe 100644
--- a/include/asm-generic/dma-mapping-broken.h
+++ b/include/asm-generic/dma-mapping-broken.h
@@ -61,7 +61,7 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
61#define dma_sync_sg_for_device dma_sync_sg_for_cpu 61#define dma_sync_sg_for_device dma_sync_sg_for_cpu
62 62
63extern int 63extern int
64dma_mapping_error(dma_addr_t dma_addr); 64dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
65 65
66extern int 66extern int
67dma_supported(struct device *dev, u64 mask); 67dma_supported(struct device *dev, u64 mask);
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 783ab9944d70..189486c3f92e 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -144,9 +144,9 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
144} 144}
145 145
146static inline int 146static inline int
147dma_mapping_error(dma_addr_t dma_addr) 147dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
148{ 148{
149 return pci_dma_mapping_error(dma_addr); 149 return pci_dma_mapping_error(to_pci_dev(dev), dma_addr);
150} 150}
151 151
152 152
diff --git a/include/asm-generic/pci-dma-compat.h b/include/asm-generic/pci-dma-compat.h
index 25c10e96b2b7..37b3706226e7 100644
--- a/include/asm-generic/pci-dma-compat.h
+++ b/include/asm-generic/pci-dma-compat.h
@@ -99,9 +99,9 @@ pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
99} 99}
100 100
101static inline int 101static inline int
102pci_dma_mapping_error(dma_addr_t dma_addr) 102pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
103{ 103{
104 return dma_mapping_error(dma_addr); 104 return dma_mapping_error(&pdev->dev, dma_addr);
105} 105}
106 106
107#endif 107#endif
diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
new file mode 100644
index 000000000000..abcf34c2fdc7
--- /dev/null
+++ b/include/asm-generic/syscall.h
@@ -0,0 +1,141 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * This file is a stub providing documentation for what functions
11 * asm-ARCH/syscall.h files need to define. Most arch definitions
12 * will be simple inlines.
13 *
14 * All of these functions expect to be called with no locks,
15 * and only when the caller is sure that the task of interest
16 * cannot return to user mode while we are looking at it.
17 */
18
19#ifndef _ASM_SYSCALL_H
20#define _ASM_SYSCALL_H 1
21
22struct task_struct;
23struct pt_regs;
24
25/**
26 * syscall_get_nr - find what system call a task is executing
27 * @task: task of interest, must be blocked
28 * @regs: task_pt_regs() of @task
29 *
30 * If @task is executing a system call or is at system call
31 * tracing about to attempt one, returns the system call number.
32 * If @task is not executing a system call, i.e. it's blocked
33 * inside the kernel for a fault or signal, returns -1.
34 *
35 * It's only valid to call this when @task is known to be blocked.
36 */
37long syscall_get_nr(struct task_struct *task, struct pt_regs *regs);
38
39/**
40 * syscall_rollback - roll back registers after an aborted system call
41 * @task: task of interest, must be in system call exit tracing
42 * @regs: task_pt_regs() of @task
43 *
44 * It's only valid to call this when @task is stopped for system
45 * call exit tracing (due to TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT),
46 * after tracehook_report_syscall_entry() returned nonzero to prevent
47 * the system call from taking place.
48 *
49 * This rolls back the register state in @regs so it's as if the
50 * system call instruction was a no-op. The registers containing
51 * the system call number and arguments are as they were before the
52 * system call instruction. This may not be the same as what the
53 * register state looked like at system call entry tracing.
54 */
55void syscall_rollback(struct task_struct *task, struct pt_regs *regs);
56
57/**
58 * syscall_get_error - check result of traced system call
59 * @task: task of interest, must be blocked
60 * @regs: task_pt_regs() of @task
61 *
62 * Returns 0 if the system call succeeded, or -ERRORCODE if it failed.
63 *
64 * It's only valid to call this when @task is stopped for tracing on exit
65 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
66 */
67long syscall_get_error(struct task_struct *task, struct pt_regs *regs);
68
69/**
70 * syscall_get_return_value - get the return value of a traced system call
71 * @task: task of interest, must be blocked
72 * @regs: task_pt_regs() of @task
73 *
74 * Returns the return value of the successful system call.
75 * This value is meaningless if syscall_get_error() returned nonzero.
76 *
77 * It's only valid to call this when @task is stopped for tracing on exit
78 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
79 */
80long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs);
81
82/**
83 * syscall_set_return_value - change the return value of a traced system call
84 * @task: task of interest, must be blocked
85 * @regs: task_pt_regs() of @task
86 * @error: negative error code, or zero to indicate success
87 * @val: user return value if @error is zero
88 *
89 * This changes the results of the system call that user mode will see.
90 * If @error is zero, the user sees a successful system call with a
91 * return value of @val. If @error is nonzero, it's a negated errno
92 * code; the user sees a failed system call with this errno code.
93 *
94 * It's only valid to call this when @task is stopped for tracing on exit
95 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
96 */
97void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
98 int error, long val);
99
100/**
101 * syscall_get_arguments - extract system call parameter values
102 * @task: task of interest, must be blocked
103 * @regs: task_pt_regs() of @task
104 * @i: argument index [0,5]
105 * @n: number of arguments; n+i must be [1,6].
106 * @args: array filled with argument values
107 *
108 * Fetches @n arguments to the system call starting with the @i'th argument
109 * (from 0 through 5). Argument @i is stored in @args[0], and so on.
110 * An arch inline version is probably optimal when @i and @n are constants.
111 *
112 * It's only valid to call this when @task is stopped for tracing on
113 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
114 * It's invalid to call this with @i + @n > 6; we only support system calls
115 * taking up to 6 arguments.
116 */
117void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
118 unsigned int i, unsigned int n, unsigned long *args);
119
120/**
121 * syscall_set_arguments - change system call parameter value
122 * @task: task of interest, must be in system call entry tracing
123 * @regs: task_pt_regs() of @task
124 * @i: argument index [0,5]
125 * @n: number of arguments; n+i must be [1,6].
126 * @args: array of argument values to store
127 *
128 * Changes @n arguments to the system call starting with the @i'th argument.
129 * @n'th argument to @val. Argument @i gets value @args[0], and so on.
130 * An arch inline version is probably optimal when @i and @n are constants.
131 *
132 * It's only valid to call this when @task is stopped for tracing on
133 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
134 * It's invalid to call this with @i + @n > 6; we only support system calls
135 * taking up to 6 arguments.
136 */
137void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
138 unsigned int i, unsigned int n,
139 const unsigned long *args);
140
141#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 729f6b0a60e9..9cd44b162ba1 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -359,6 +359,8 @@
359 } 359 }
360 360
361#define INITCALLS \ 361#define INITCALLS \
362 *(.initcallearly.init) \
363 __early_initcall_end = .; \
362 *(.initcall0.init) \ 364 *(.initcall0.init) \
363 *(.initcall0s.init) \ 365 *(.initcall0s.init) \
364 *(.initcall1.init) \ 366 *(.initcall1.init) \
diff --git a/include/asm-ia64/machvec.h b/include/asm-ia64/machvec.h
index 0721a5e8271e..a6d50c77b6bf 100644
--- a/include/asm-ia64/machvec.h
+++ b/include/asm-ia64/machvec.h
@@ -54,7 +54,7 @@ typedef void ia64_mv_dma_sync_single_for_cpu (struct device *, dma_addr_t, size_
54typedef void ia64_mv_dma_sync_sg_for_cpu (struct device *, struct scatterlist *, int, int); 54typedef void ia64_mv_dma_sync_sg_for_cpu (struct device *, struct scatterlist *, int, int);
55typedef void ia64_mv_dma_sync_single_for_device (struct device *, dma_addr_t, size_t, int); 55typedef void ia64_mv_dma_sync_single_for_device (struct device *, dma_addr_t, size_t, int);
56typedef void ia64_mv_dma_sync_sg_for_device (struct device *, struct scatterlist *, int, int); 56typedef void ia64_mv_dma_sync_sg_for_device (struct device *, struct scatterlist *, int, int);
57typedef int ia64_mv_dma_mapping_error (dma_addr_t dma_addr); 57typedef int ia64_mv_dma_mapping_error(struct device *, dma_addr_t dma_addr);
58typedef int ia64_mv_dma_supported (struct device *, u64); 58typedef int ia64_mv_dma_supported (struct device *, u64);
59 59
60typedef dma_addr_t ia64_mv_dma_map_single_attrs (struct device *, void *, size_t, int, struct dma_attrs *); 60typedef dma_addr_t ia64_mv_dma_map_single_attrs (struct device *, void *, size_t, int, struct dma_attrs *);
diff --git a/include/asm-m68k/dma-mapping.h b/include/asm-m68k/dma-mapping.h
index a26cdeb46a57..91f7944333d4 100644
--- a/include/asm-m68k/dma-mapping.h
+++ b/include/asm-m68k/dma-mapping.h
@@ -84,7 +84,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *s
84{ 84{
85} 85}
86 86
87static inline int dma_mapping_error(dma_addr_t handle) 87static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
88{ 88{
89 return 0; 89 return 0;
90} 90}
diff --git a/include/asm-mips/dma-mapping.h b/include/asm-mips/dma-mapping.h
index 230b3f1b69b1..c64afb40cd06 100644
--- a/include/asm-mips/dma-mapping.h
+++ b/include/asm-mips/dma-mapping.h
@@ -42,7 +42,7 @@ extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
42 int nelems, enum dma_data_direction direction); 42 int nelems, enum dma_data_direction direction);
43extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, 43extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
44 int nelems, enum dma_data_direction direction); 44 int nelems, enum dma_data_direction direction);
45extern int dma_mapping_error(dma_addr_t dma_addr); 45extern int dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
46extern int dma_supported(struct device *dev, u64 mask); 46extern int dma_supported(struct device *dev, u64 mask);
47 47
48static inline int 48static inline int
diff --git a/include/asm-mn10300/dma-mapping.h b/include/asm-mn10300/dma-mapping.h
index 7c882fca9ec8..ccae8f6c6326 100644
--- a/include/asm-mn10300/dma-mapping.h
+++ b/include/asm-mn10300/dma-mapping.h
@@ -182,7 +182,7 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
182} 182}
183 183
184static inline 184static inline
185int dma_mapping_error(dma_addr_t dma_addr) 185int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
186{ 186{
187 return 0; 187 return 0;
188} 188}
diff --git a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
index 2f1e1b05440a..b7ca6dc7fddc 100644
--- a/include/asm-parisc/cacheflush.h
+++ b/include/asm-parisc/cacheflush.h
@@ -45,9 +45,9 @@ void flush_cache_mm(struct mm_struct *mm);
45extern void flush_dcache_page(struct page *page); 45extern void flush_dcache_page(struct page *page);
46 46
47#define flush_dcache_mmap_lock(mapping) \ 47#define flush_dcache_mmap_lock(mapping) \
48 write_lock_irq(&(mapping)->tree_lock) 48 spin_lock_irq(&(mapping)->tree_lock)
49#define flush_dcache_mmap_unlock(mapping) \ 49#define flush_dcache_mmap_unlock(mapping) \
50 write_unlock_irq(&(mapping)->tree_lock) 50 spin_unlock_irq(&(mapping)->tree_lock)
51 51
52#define flush_icache_page(vma,page) do { \ 52#define flush_icache_page(vma,page) do { \
53 flush_kernel_dcache_page(page); \ 53 flush_kernel_dcache_page(page); \
diff --git a/include/asm-parisc/dma-mapping.h b/include/asm-parisc/dma-mapping.h
index c6c0e9ff6bde..53af696f23d2 100644
--- a/include/asm-parisc/dma-mapping.h
+++ b/include/asm-parisc/dma-mapping.h
@@ -248,6 +248,6 @@ void * sba_get_iommu(struct parisc_device *dev);
248#endif 248#endif
249 249
250/* At the moment, we panic on error for IOMMU resource exaustion */ 250/* At the moment, we panic on error for IOMMU resource exaustion */
251#define dma_mapping_error(x) 0 251#define dma_mapping_error(dev, x) 0
252 252
253#endif 253#endif
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 74c549780987..c7ca45f97dd2 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -415,7 +415,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
415 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction); 415 __dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
416} 416}
417 417
418static inline int dma_mapping_error(dma_addr_t dma_addr) 418static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
419{ 419{
420#ifdef CONFIG_PPC64 420#ifdef CONFIG_PPC64
421 return (dma_addr == DMA_ERROR_CODE); 421 return (dma_addr == DMA_ERROR_CODE);
diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index 22cc419389fe..6c0b8a2de143 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -171,7 +171,7 @@ static inline int dma_get_cache_alignment(void)
171 return L1_CACHE_BYTES; 171 return L1_CACHE_BYTES;
172} 172}
173 173
174static inline int dma_mapping_error(dma_addr_t dma_addr) 174static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
175{ 175{
176 return dma_addr == 0; 176 return dma_addr == 0;
177} 177}
diff --git a/include/asm-sparc/dma-mapping_64.h b/include/asm-sparc/dma-mapping_64.h
index 38cbec76a33f..bfa64f9702d5 100644
--- a/include/asm-sparc/dma-mapping_64.h
+++ b/include/asm-sparc/dma-mapping_64.h
@@ -135,7 +135,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
135 /* No flushing needed to sync cpu writes to the device. */ 135 /* No flushing needed to sync cpu writes to the device. */
136} 136}
137 137
138static inline int dma_mapping_error(dma_addr_t dma_addr) 138static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
139{ 139{
140 return (dma_addr == DMA_ERROR_CODE); 140 return (dma_addr == DMA_ERROR_CODE);
141} 141}
diff --git a/include/asm-sparc/pci_32.h b/include/asm-sparc/pci_32.h
index b93b6c79e08f..0ee949d220c0 100644
--- a/include/asm-sparc/pci_32.h
+++ b/include/asm-sparc/pci_32.h
@@ -154,7 +154,8 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
154 154
155#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0) 155#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0)
156 156
157static inline int pci_dma_mapping_error(dma_addr_t dma_addr) 157static inline int pci_dma_mapping_error(struct pci_dev *pdev,
158 dma_addr_t dma_addr)
158{ 159{
159 return (dma_addr == PCI_DMA_ERROR_CODE); 160 return (dma_addr == PCI_DMA_ERROR_CODE);
160} 161}
diff --git a/include/asm-sparc/pci_64.h b/include/asm-sparc/pci_64.h
index f59f2571295b..4f79a54948f6 100644
--- a/include/asm-sparc/pci_64.h
+++ b/include/asm-sparc/pci_64.h
@@ -140,9 +140,10 @@ extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask);
140#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) 140#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0)
141#define PCI64_ADDR_BASE 0xfffc000000000000UL 141#define PCI64_ADDR_BASE 0xfffc000000000000UL
142 142
143static inline int pci_dma_mapping_error(dma_addr_t dma_addr) 143static inline int pci_dma_mapping_error(struct pci_dev *pdev,
144 dma_addr_t dma_addr)
144{ 145{
145 return dma_mapping_error(dma_addr); 146 return dma_mapping_error(&pdev->dev, dma_addr);
146} 147}
147 148
148#ifdef CONFIG_PCI 149#ifdef CONFIG_PCI
diff --git a/include/asm-x86/device.h b/include/asm-x86/device.h
index 87a715367a1b..3c034f48fdb0 100644
--- a/include/asm-x86/device.h
+++ b/include/asm-x86/device.h
@@ -5,6 +5,9 @@ struct dev_archdata {
5#ifdef CONFIG_ACPI 5#ifdef CONFIG_ACPI
6 void *acpi_handle; 6 void *acpi_handle;
7#endif 7#endif
8#ifdef CONFIG_X86_64
9struct dma_mapping_ops *dma_ops;
10#endif
8#ifdef CONFIG_DMAR 11#ifdef CONFIG_DMAR
9 void *iommu; /* hook for IOMMU specific extension */ 12 void *iommu; /* hook for IOMMU specific extension */
10#endif 13#endif
diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h
index c2ddd3d1b883..0eaa9bf6011f 100644
--- a/include/asm-x86/dma-mapping.h
+++ b/include/asm-x86/dma-mapping.h
@@ -17,7 +17,8 @@ extern int panic_on_overflow;
17extern int force_iommu; 17extern int force_iommu;
18 18
19struct dma_mapping_ops { 19struct dma_mapping_ops {
20 int (*mapping_error)(dma_addr_t dma_addr); 20 int (*mapping_error)(struct device *dev,
21 dma_addr_t dma_addr);
21 void* (*alloc_coherent)(struct device *dev, size_t size, 22 void* (*alloc_coherent)(struct device *dev, size_t size,
22 dma_addr_t *dma_handle, gfp_t gfp); 23 dma_addr_t *dma_handle, gfp_t gfp);
23 void (*free_coherent)(struct device *dev, size_t size, 24 void (*free_coherent)(struct device *dev, size_t size,
@@ -56,14 +57,32 @@ struct dma_mapping_ops {
56 int is_phys; 57 int is_phys;
57}; 58};
58 59
59extern const struct dma_mapping_ops *dma_ops; 60extern struct dma_mapping_ops *dma_ops;
60 61
61static inline int dma_mapping_error(dma_addr_t dma_addr) 62static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
62{ 63{
63 if (dma_ops->mapping_error) 64#ifdef CONFIG_X86_32
64 return dma_ops->mapping_error(dma_addr); 65 return dma_ops;
66#else
67 if (unlikely(!dev) || !dev->archdata.dma_ops)
68 return dma_ops;
69 else
70 return dev->archdata.dma_ops;
71#endif
72}
73
74/* Make sure we keep the same behaviour */
75static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
76{
77#ifdef CONFIG_X86_32
78 return 0;
79#else
80 struct dma_mapping_ops *ops = get_dma_ops(dev);
81 if (ops->mapping_error)
82 return ops->mapping_error(dev, dma_addr);
65 83
66 return (dma_addr == bad_dma_address); 84 return (dma_addr == bad_dma_address);
85#endif
67} 86}
68 87
69#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 88#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
@@ -83,44 +102,53 @@ static inline dma_addr_t
83dma_map_single(struct device *hwdev, void *ptr, size_t size, 102dma_map_single(struct device *hwdev, void *ptr, size_t size,
84 int direction) 103 int direction)
85{ 104{
105 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
106
86 BUG_ON(!valid_dma_direction(direction)); 107 BUG_ON(!valid_dma_direction(direction));
87 return dma_ops->map_single(hwdev, virt_to_phys(ptr), size, direction); 108 return ops->map_single(hwdev, virt_to_phys(ptr), size, direction);
88} 109}
89 110
90static inline void 111static inline void
91dma_unmap_single(struct device *dev, dma_addr_t addr, size_t size, 112dma_unmap_single(struct device *dev, dma_addr_t addr, size_t size,
92 int direction) 113 int direction)
93{ 114{
115 struct dma_mapping_ops *ops = get_dma_ops(dev);
116
94 BUG_ON(!valid_dma_direction(direction)); 117 BUG_ON(!valid_dma_direction(direction));
95 if (dma_ops->unmap_single) 118 if (ops->unmap_single)
96 dma_ops->unmap_single(dev, addr, size, direction); 119 ops->unmap_single(dev, addr, size, direction);
97} 120}
98 121
99static inline int 122static inline int
100dma_map_sg(struct device *hwdev, struct scatterlist *sg, 123dma_map_sg(struct device *hwdev, struct scatterlist *sg,
101 int nents, int direction) 124 int nents, int direction)
102{ 125{
126 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
127
103 BUG_ON(!valid_dma_direction(direction)); 128 BUG_ON(!valid_dma_direction(direction));
104 return dma_ops->map_sg(hwdev, sg, nents, direction); 129 return ops->map_sg(hwdev, sg, nents, direction);
105} 130}
106 131
107static inline void 132static inline void
108dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents, 133dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
109 int direction) 134 int direction)
110{ 135{
136 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
137
111 BUG_ON(!valid_dma_direction(direction)); 138 BUG_ON(!valid_dma_direction(direction));
112 if (dma_ops->unmap_sg) 139 if (ops->unmap_sg)
113 dma_ops->unmap_sg(hwdev, sg, nents, direction); 140 ops->unmap_sg(hwdev, sg, nents, direction);
114} 141}
115 142
116static inline void 143static inline void
117dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle, 144dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
118 size_t size, int direction) 145 size_t size, int direction)
119{ 146{
147 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
148
120 BUG_ON(!valid_dma_direction(direction)); 149 BUG_ON(!valid_dma_direction(direction));
121 if (dma_ops->sync_single_for_cpu) 150 if (ops->sync_single_for_cpu)
122 dma_ops->sync_single_for_cpu(hwdev, dma_handle, size, 151 ops->sync_single_for_cpu(hwdev, dma_handle, size, direction);
123 direction);
124 flush_write_buffers(); 152 flush_write_buffers();
125} 153}
126 154
@@ -128,10 +156,11 @@ static inline void
128dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle, 156dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle,
129 size_t size, int direction) 157 size_t size, int direction)
130{ 158{
159 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
160
131 BUG_ON(!valid_dma_direction(direction)); 161 BUG_ON(!valid_dma_direction(direction));
132 if (dma_ops->sync_single_for_device) 162 if (ops->sync_single_for_device)
133 dma_ops->sync_single_for_device(hwdev, dma_handle, size, 163 ops->sync_single_for_device(hwdev, dma_handle, size, direction);
134 direction);
135 flush_write_buffers(); 164 flush_write_buffers();
136} 165}
137 166
@@ -139,11 +168,12 @@ static inline void
139dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle, 168dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
140 unsigned long offset, size_t size, int direction) 169 unsigned long offset, size_t size, int direction)
141{ 170{
142 BUG_ON(!valid_dma_direction(direction)); 171 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
143 if (dma_ops->sync_single_range_for_cpu)
144 dma_ops->sync_single_range_for_cpu(hwdev, dma_handle, offset,
145 size, direction);
146 172
173 BUG_ON(!valid_dma_direction(direction));
174 if (ops->sync_single_range_for_cpu)
175 ops->sync_single_range_for_cpu(hwdev, dma_handle, offset,
176 size, direction);
147 flush_write_buffers(); 177 flush_write_buffers();
148} 178}
149 179
@@ -152,11 +182,12 @@ dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle,
152 unsigned long offset, size_t size, 182 unsigned long offset, size_t size,
153 int direction) 183 int direction)
154{ 184{
155 BUG_ON(!valid_dma_direction(direction)); 185 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
156 if (dma_ops->sync_single_range_for_device)
157 dma_ops->sync_single_range_for_device(hwdev, dma_handle,
158 offset, size, direction);
159 186
187 BUG_ON(!valid_dma_direction(direction));
188 if (ops->sync_single_range_for_device)
189 ops->sync_single_range_for_device(hwdev, dma_handle,
190 offset, size, direction);
160 flush_write_buffers(); 191 flush_write_buffers();
161} 192}
162 193
@@ -164,9 +195,11 @@ static inline void
164dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, 195dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
165 int nelems, int direction) 196 int nelems, int direction)
166{ 197{
198 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
199
167 BUG_ON(!valid_dma_direction(direction)); 200 BUG_ON(!valid_dma_direction(direction));
168 if (dma_ops->sync_sg_for_cpu) 201 if (ops->sync_sg_for_cpu)
169 dma_ops->sync_sg_for_cpu(hwdev, sg, nelems, direction); 202 ops->sync_sg_for_cpu(hwdev, sg, nelems, direction);
170 flush_write_buffers(); 203 flush_write_buffers();
171} 204}
172 205
@@ -174,9 +207,11 @@ static inline void
174dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg, 207dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
175 int nelems, int direction) 208 int nelems, int direction)
176{ 209{
210 struct dma_mapping_ops *ops = get_dma_ops(hwdev);
211
177 BUG_ON(!valid_dma_direction(direction)); 212 BUG_ON(!valid_dma_direction(direction));
178 if (dma_ops->sync_sg_for_device) 213 if (ops->sync_sg_for_device)
179 dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction); 214 ops->sync_sg_for_device(hwdev, sg, nelems, direction);
180 215
181 flush_write_buffers(); 216 flush_write_buffers();
182} 217}
@@ -185,9 +220,11 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
185 size_t offset, size_t size, 220 size_t offset, size_t size,
186 int direction) 221 int direction)
187{ 222{
223 struct dma_mapping_ops *ops = get_dma_ops(dev);
224
188 BUG_ON(!valid_dma_direction(direction)); 225 BUG_ON(!valid_dma_direction(direction));
189 return dma_ops->map_single(dev, page_to_phys(page)+offset, 226 return ops->map_single(dev, page_to_phys(page) + offset,
190 size, direction); 227 size, direction);
191} 228}
192 229
193static inline void dma_unmap_page(struct device *dev, dma_addr_t addr, 230static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
index d63166fb3ab7..ecc8061904a9 100644
--- a/include/asm-x86/iommu.h
+++ b/include/asm-x86/iommu.h
@@ -3,6 +3,7 @@
3 3
4extern void pci_iommu_shutdown(void); 4extern void pci_iommu_shutdown(void);
5extern void no_iommu_init(void); 5extern void no_iommu_init(void);
6extern struct dma_mapping_ops nommu_dma_ops;
6extern int force_iommu, no_iommu; 7extern int force_iommu, no_iommu;
7extern int iommu_detected; 8extern int iommu_detected;
8 9
diff --git a/include/asm-x86/kexec.h b/include/asm-x86/kexec.h
index 8f855a15f64d..c0e52a14fd4d 100644
--- a/include/asm-x86/kexec.h
+++ b/include/asm-x86/kexec.h
@@ -10,14 +10,15 @@
10# define VA_PTE_0 5 10# define VA_PTE_0 5
11# define PA_PTE_1 6 11# define PA_PTE_1 6
12# define VA_PTE_1 7 12# define VA_PTE_1 7
13# define PA_SWAP_PAGE 8
13# ifdef CONFIG_X86_PAE 14# ifdef CONFIG_X86_PAE
14# define PA_PMD_0 8 15# define PA_PMD_0 9
15# define VA_PMD_0 9 16# define VA_PMD_0 10
16# define PA_PMD_1 10 17# define PA_PMD_1 11
17# define VA_PMD_1 11 18# define VA_PMD_1 12
18# define PAGES_NR 12 19# define PAGES_NR 13
19# else 20# else
20# define PAGES_NR 8 21# define PAGES_NR 9
21# endif 22# endif
22#else 23#else
23# define PA_CONTROL_PAGE 0 24# define PA_CONTROL_PAGE 0
@@ -152,11 +153,12 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
152} 153}
153 154
154#ifdef CONFIG_X86_32 155#ifdef CONFIG_X86_32
155asmlinkage NORET_TYPE void 156asmlinkage unsigned long
156relocate_kernel(unsigned long indirection_page, 157relocate_kernel(unsigned long indirection_page,
157 unsigned long control_page, 158 unsigned long control_page,
158 unsigned long start_address, 159 unsigned long start_address,
159 unsigned int has_pae) ATTRIB_NORET; 160 unsigned int has_pae,
161 unsigned int preserve_context);
160#else 162#else
161NORET_TYPE void 163NORET_TYPE void
162relocate_kernel(unsigned long indirection_page, 164relocate_kernel(unsigned long indirection_page,
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 3e5dbc4195f4..04caa2f544df 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -18,6 +18,7 @@
18#define _PAGE_BIT_UNUSED2 10 18#define _PAGE_BIT_UNUSED2 10
19#define _PAGE_BIT_UNUSED3 11 19#define _PAGE_BIT_UNUSED3 11
20#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ 20#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
21#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1
21#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ 22#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */
22 23
23#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) 24#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
@@ -34,6 +35,8 @@
34#define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3) 35#define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3)
35#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) 36#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
36#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) 37#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
38#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL)
39#define __HAVE_ARCH_PTE_SPECIAL
37 40
38#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 41#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
39#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) 42#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
@@ -54,7 +57,7 @@
54 57
55/* Set of bits not changed in pte_modify */ 58/* Set of bits not changed in pte_modify */
56#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ 59#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \
57 _PAGE_ACCESSED | _PAGE_DIRTY) 60 _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY)
58 61
59#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT) 62#define _PAGE_CACHE_MASK (_PAGE_PCD | _PAGE_PWT)
60#define _PAGE_CACHE_WB (0) 63#define _PAGE_CACHE_WB (0)
@@ -180,7 +183,7 @@ static inline int pte_exec(pte_t pte)
180 183
181static inline int pte_special(pte_t pte) 184static inline int pte_special(pte_t pte)
182{ 185{
183 return 0; 186 return pte_val(pte) & _PAGE_SPECIAL;
184} 187}
185 188
186static inline int pmd_large(pmd_t pte) 189static inline int pmd_large(pmd_t pte)
@@ -246,7 +249,7 @@ static inline pte_t pte_clrglobal(pte_t pte)
246 249
247static inline pte_t pte_mkspecial(pte_t pte) 250static inline pte_t pte_mkspecial(pte_t pte)
248{ 251{
249 return pte; 252 return __pte(pte_val(pte) | _PAGE_SPECIAL);
250} 253}
251 254
252extern pteval_t __supported_pte_mask; 255extern pteval_t __supported_pte_mask;
diff --git a/include/asm-x86/swiotlb.h b/include/asm-x86/swiotlb.h
index c706a7442633..2730b351afcf 100644
--- a/include/asm-x86/swiotlb.h
+++ b/include/asm-x86/swiotlb.h
@@ -35,7 +35,7 @@ extern int swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg,
35 int nents, int direction); 35 int nents, int direction);
36extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, 36extern void swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg,
37 int nents, int direction); 37 int nents, int direction);
38extern int swiotlb_dma_mapping_error(dma_addr_t dma_addr); 38extern int swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr);
39extern void swiotlb_free_coherent(struct device *hwdev, size_t size, 39extern void swiotlb_free_coherent(struct device *hwdev, size_t size,
40 void *vaddr, dma_addr_t dma_handle); 40 void *vaddr, dma_addr_t dma_handle);
41extern int swiotlb_dma_supported(struct device *hwdev, u64 mask); 41extern int swiotlb_dma_supported(struct device *hwdev, u64 mask);
diff --git a/include/asm-x86/uaccess.h b/include/asm-x86/uaccess.h
index f6fa4d841bbc..5f702d1d5218 100644
--- a/include/asm-x86/uaccess.h
+++ b/include/asm-x86/uaccess.h
@@ -451,3 +451,4 @@ extern struct movsl_mask {
451#endif 451#endif
452 452
453#endif 453#endif
454
diff --git a/include/asm-xtensa/dma-mapping.h b/include/asm-xtensa/dma-mapping.h
index 3c7d537dd15d..51882ae3db4d 100644
--- a/include/asm-xtensa/dma-mapping.h
+++ b/include/asm-xtensa/dma-mapping.h
@@ -139,7 +139,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
139 consistent_sync(sg_virt(sg), sg->length, dir); 139 consistent_sync(sg_virt(sg), sg->length, dir);
140} 140}
141static inline int 141static inline int
142dma_mapping_error(dma_addr_t dma_addr) 142dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
143{ 143{
144 return 0; 144 return 0;
145} 145}
diff --git a/include/linux/aio.h b/include/linux/aio.h
index b51ddd28444e..09b276c35227 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -7,7 +7,6 @@
7#include <linux/uio.h> 7#include <linux/uio.h>
8 8
9#include <asm/atomic.h> 9#include <asm/atomic.h>
10#include <linux/uio.h>
11 10
12#define AIO_MAXSEGS 4 11#define AIO_MAXSEGS 4
13#define AIO_KIOGRP_NR_ATOMIC 8 12#define AIO_KIOGRP_NR_ATOMIC 8
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 49d8eb7a71be..53d2edb709b3 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -499,7 +499,7 @@ struct backing_dev_info;
499struct address_space { 499struct address_space {
500 struct inode *host; /* owner: inode, block_device */ 500 struct inode *host; /* owner: inode, block_device */
501 struct radix_tree_root page_tree; /* radix tree of all pages */ 501 struct radix_tree_root page_tree; /* radix tree of all pages */
502 rwlock_t tree_lock; /* and rwlock protecting it */ 502 spinlock_t tree_lock; /* and lock protecting it */
503 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 503 unsigned int i_mmap_writable;/* count VM_SHARED mappings */
504 struct prio_tree_root i_mmap; /* tree of private and shared mappings */ 504 struct prio_tree_root i_mmap; /* tree of private and shared mappings */
505 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 505 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 7d51cbca49ab..75ae6d8aba4f 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -758,7 +758,7 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
758 } 758 }
759 759
760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); 760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
761 if (!dma_mapping_error(dma_addr)) { 761 if (!dma_mapping_error(&c->pdev->dev, dma_addr)) {
762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
764 *mptr++ = cpu_to_le32(0x7C020002); 764 *mptr++ = cpu_to_le32(0x7C020002);
diff --git a/include/linux/init.h b/include/linux/init.h
index 42ae95411a93..11b84e106053 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -170,6 +170,13 @@ extern void (*late_time_init)(void);
170 __attribute__((__section__(".initcall" level ".init"))) = fn 170 __attribute__((__section__(".initcall" level ".init"))) = fn
171 171
172/* 172/*
173 * Early initcalls run before initializing SMP.
174 *
175 * Only for built-in code, not modules.
176 */
177#define early_initcall(fn) __define_initcall("early",fn,early)
178
179/*
173 * A "pure" initcall has no dependencies on anything else, and purely 180 * A "pure" initcall has no dependencies on anything else, and purely
174 * initializes variables that couldn't be statically initialized. 181 * initializes variables that couldn't be statically initialized.
175 * 182 *
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 3265968cd2cd..82f88a8a827b 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -83,6 +83,7 @@ struct kimage {
83 83
84 unsigned long start; 84 unsigned long start;
85 struct page *control_code_page; 85 struct page *control_code_page;
86 struct page *swap_page;
86 87
87 unsigned long nr_segments; 88 unsigned long nr_segments;
88 struct kexec_segment segment[KEXEC_SEGMENT_MAX]; 89 struct kexec_segment segment[KEXEC_SEGMENT_MAX];
@@ -98,18 +99,20 @@ struct kimage {
98 unsigned int type : 1; 99 unsigned int type : 1;
99#define KEXEC_TYPE_DEFAULT 0 100#define KEXEC_TYPE_DEFAULT 0
100#define KEXEC_TYPE_CRASH 1 101#define KEXEC_TYPE_CRASH 1
102 unsigned int preserve_context : 1;
101}; 103};
102 104
103 105
104 106
105/* kexec interface functions */ 107/* kexec interface functions */
106extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET; 108extern void machine_kexec(struct kimage *image);
107extern int machine_kexec_prepare(struct kimage *image); 109extern int machine_kexec_prepare(struct kimage *image);
108extern void machine_kexec_cleanup(struct kimage *image); 110extern void machine_kexec_cleanup(struct kimage *image);
109extern asmlinkage long sys_kexec_load(unsigned long entry, 111extern asmlinkage long sys_kexec_load(unsigned long entry,
110 unsigned long nr_segments, 112 unsigned long nr_segments,
111 struct kexec_segment __user *segments, 113 struct kexec_segment __user *segments,
112 unsigned long flags); 114 unsigned long flags);
115extern int kernel_kexec(void);
113#ifdef CONFIG_COMPAT 116#ifdef CONFIG_COMPAT
114extern asmlinkage long compat_sys_kexec_load(unsigned long entry, 117extern asmlinkage long compat_sys_kexec_load(unsigned long entry,
115 unsigned long nr_segments, 118 unsigned long nr_segments,
@@ -156,8 +159,9 @@ extern struct kimage *kexec_crash_image;
156#define kexec_flush_icache_page(page) 159#define kexec_flush_icache_page(page)
157#endif 160#endif
158 161
159#define KEXEC_ON_CRASH 0x00000001 162#define KEXEC_ON_CRASH 0x00000001
160#define KEXEC_ARCH_MASK 0xffff0000 163#define KEXEC_PRESERVE_CONTEXT 0x00000002
164#define KEXEC_ARCH_MASK 0xffff0000
161 165
162/* These values match the ELF architecture values. 166/* These values match the ELF architecture values.
163 * Unless there is a good reason that should continue to be the case. 167 * Unless there is a good reason that should continue to be the case.
@@ -174,7 +178,12 @@ extern struct kimage *kexec_crash_image;
174#define KEXEC_ARCH_MIPS_LE (10 << 16) 178#define KEXEC_ARCH_MIPS_LE (10 << 16)
175#define KEXEC_ARCH_MIPS ( 8 << 16) 179#define KEXEC_ARCH_MIPS ( 8 << 16)
176 180
177#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 181/* List of defined/legal kexec flags */
182#ifndef CONFIG_KEXEC_JUMP
183#define KEXEC_FLAGS KEXEC_ON_CRASH
184#else
185#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
186#endif
178 187
179#define VMCOREINFO_BYTES (4096) 188#define VMCOREINFO_BYTES (4096)
180#define VMCOREINFO_NOTE_NAME "VMCOREINFO" 189#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index 37a5cdb03918..a9f998a3f48b 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -263,6 +263,10 @@ struct memstick_dev {
263 /* Get next request from the media driver. */ 263 /* Get next request from the media driver. */
264 int (*next_request)(struct memstick_dev *card, 264 int (*next_request)(struct memstick_dev *card,
265 struct memstick_request **mrq); 265 struct memstick_request **mrq);
266 /* Tell the media driver to stop doing things */
267 void (*stop)(struct memstick_dev *card);
268 /* Allow the media driver to continue */
269 void (*start)(struct memstick_dev *card);
266 270
267 struct device dev; 271 struct device dev;
268}; 272};
@@ -284,7 +288,7 @@ struct memstick_host {
284 /* Notify the host that some requests are pending. */ 288 /* Notify the host that some requests are pending. */
285 void (*request)(struct memstick_host *host); 289 void (*request)(struct memstick_host *host);
286 /* Set host IO parameters (power, clock, etc). */ 290 /* Set host IO parameters (power, clock, etc). */
287 void (*set_param)(struct memstick_host *host, 291 int (*set_param)(struct memstick_host *host,
288 enum memstick_param param, 292 enum memstick_param param,
289 int value); 293 int value);
290 unsigned long private[0] ____cacheline_aligned; 294 unsigned long private[0] ____cacheline_aligned;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d87a5a5fe87d..6e695eaab4ce 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -810,7 +810,6 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *
810 810
811int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 811int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
812 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 812 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
813void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long);
814 813
815extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 814extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
816extern void do_invalidatepage(struct page *page, unsigned long offset); 815extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -833,6 +832,39 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
833 struct vm_area_struct **pprev, unsigned long start, 832 struct vm_area_struct **pprev, unsigned long start,
834 unsigned long end, unsigned long newflags); 833 unsigned long end, unsigned long newflags);
835 834
835#ifdef CONFIG_HAVE_GET_USER_PAGES_FAST
836/*
837 * get_user_pages_fast provides equivalent functionality to get_user_pages,
838 * operating on current and current->mm (force=0 and doesn't return any vmas).
839 *
840 * get_user_pages_fast may take mmap_sem and page tables, so no assumptions
841 * can be made about locking. get_user_pages_fast is to be implemented in a
842 * way that is advantageous (vs get_user_pages()) when the user memory area is
843 * already faulted in and present in ptes. However if the pages have to be
844 * faulted in, it may turn out to be slightly slower).
845 */
846int get_user_pages_fast(unsigned long start, int nr_pages, int write,
847 struct page **pages);
848
849#else
850/*
851 * Should probably be moved to asm-generic, and architectures can include it if
852 * they don't implement their own get_user_pages_fast.
853 */
854#define get_user_pages_fast(start, nr_pages, write, pages) \
855({ \
856 struct mm_struct *mm = current->mm; \
857 int ret; \
858 \
859 down_read(&mm->mmap_sem); \
860 ret = get_user_pages(current, mm, start, nr_pages, \
861 write, 0, pages, NULL); \
862 up_read(&mm->mmap_sem); \
863 \
864 ret; \
865})
866#endif
867
836/* 868/*
837 * A callback you can register to apply pressure to ageable caches. 869 * A callback you can register to apply pressure to ageable caches.
838 * 870 *
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index ee1ec2c7723c..a81d81890422 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -12,6 +12,7 @@
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <linux/gfp.h> 13#include <linux/gfp.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/hardirq.h> /* for in_interrupt() */
15 16
16/* 17/*
17 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page 18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
@@ -62,6 +63,98 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
62#define page_cache_release(page) put_page(page) 63#define page_cache_release(page) put_page(page)
63void release_pages(struct page **pages, int nr, int cold); 64void release_pages(struct page **pages, int nr, int cold);
64 65
66/*
67 * speculatively take a reference to a page.
68 * If the page is free (_count == 0), then _count is untouched, and 0
69 * is returned. Otherwise, _count is incremented by 1 and 1 is returned.
70 *
71 * This function must be called inside the same rcu_read_lock() section as has
72 * been used to lookup the page in the pagecache radix-tree (or page table):
73 * this allows allocators to use a synchronize_rcu() to stabilize _count.
74 *
75 * Unless an RCU grace period has passed, the count of all pages coming out
76 * of the allocator must be considered unstable. page_count may return higher
77 * than expected, and put_page must be able to do the right thing when the
78 * page has been finished with, no matter what it is subsequently allocated
79 * for (because put_page is what is used here to drop an invalid speculative
80 * reference).
81 *
82 * This is the interesting part of the lockless pagecache (and lockless
83 * get_user_pages) locking protocol, where the lookup-side (eg. find_get_page)
84 * has the following pattern:
85 * 1. find page in radix tree
86 * 2. conditionally increment refcount
87 * 3. check the page is still in pagecache (if no, goto 1)
88 *
89 * Remove-side that cares about stability of _count (eg. reclaim) has the
90 * following (with tree_lock held for write):
91 * A. atomically check refcount is correct and set it to 0 (atomic_cmpxchg)
92 * B. remove page from pagecache
93 * C. free the page
94 *
95 * There are 2 critical interleavings that matter:
96 * - 2 runs before A: in this case, A sees elevated refcount and bails out
97 * - A runs before 2: in this case, 2 sees zero refcount and retries;
98 * subsequently, B will complete and 1 will find no page, causing the
99 * lookup to return NULL.
100 *
101 * It is possible that between 1 and 2, the page is removed then the exact same
102 * page is inserted into the same position in pagecache. That's OK: the
103 * old find_get_page using tree_lock could equally have run before or after
104 * such a re-insertion, depending on order that locks are granted.
105 *
106 * Lookups racing against pagecache insertion isn't a big problem: either 1
107 * will find the page or it will not. Likewise, the old find_get_page could run
108 * either before the insertion or afterwards, depending on timing.
109 */
110static inline int page_cache_get_speculative(struct page *page)
111{
112 VM_BUG_ON(in_interrupt());
113
114#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU)
115# ifdef CONFIG_PREEMPT
116 VM_BUG_ON(!in_atomic());
117# endif
118 /*
119 * Preempt must be disabled here - we rely on rcu_read_lock doing
120 * this for us.
121 *
122 * Pagecache won't be truncated from interrupt context, so if we have
123 * found a page in the radix tree here, we have pinned its refcount by
124 * disabling preempt, and hence no need for the "speculative get" that
125 * SMP requires.
126 */
127 VM_BUG_ON(page_count(page) == 0);
128 atomic_inc(&page->_count);
129
130#else
131 if (unlikely(!get_page_unless_zero(page))) {
132 /*
133 * Either the page has been freed, or will be freed.
134 * In either case, retry here and the caller should
135 * do the right thing (see comments above).
136 */
137 return 0;
138 }
139#endif
140 VM_BUG_ON(PageTail(page));
141
142 return 1;
143}
144
145static inline int page_freeze_refs(struct page *page, int count)
146{
147 return likely(atomic_cmpxchg(&page->_count, count, 0) == count);
148}
149
150static inline void page_unfreeze_refs(struct page *page, int count)
151{
152 VM_BUG_ON(page_count(page) != 0);
153 VM_BUG_ON(count == 0);
154
155 atomic_set(&page->_count, count);
156}
157
65#ifdef CONFIG_NUMA 158#ifdef CONFIG_NUMA
66extern struct page *__page_cache_alloc(gfp_t gfp); 159extern struct page *__page_cache_alloc(gfp_t gfp);
67#else 160#else
@@ -133,7 +226,7 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
133 return read_cache_page(mapping, index, filler, data); 226 return read_cache_page(mapping, index, filler, data);
134} 227}
135 228
136int add_to_page_cache(struct page *page, struct address_space *mapping, 229int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
137 pgoff_t index, gfp_t gfp_mask); 230 pgoff_t index, gfp_t gfp_mask);
138int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 231int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
139 pgoff_t index, gfp_t gfp_mask); 232 pgoff_t index, gfp_t gfp_mask);
@@ -141,6 +234,22 @@ extern void remove_from_page_cache(struct page *page);
141extern void __remove_from_page_cache(struct page *page); 234extern void __remove_from_page_cache(struct page *page);
142 235
143/* 236/*
237 * Like add_to_page_cache_locked, but used to add newly allocated pages:
238 * the page is new, so we can just run SetPageLocked() against it.
239 */
240static inline int add_to_page_cache(struct page *page,
241 struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask)
242{
243 int error;
244
245 SetPageLocked(page);
246 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask);
247 if (unlikely(error))
248 ClearPageLocked(page);
249 return error;
250}
251
252/*
144 * Return byte-offset into filesystem object for page. 253 * Return byte-offset into filesystem object for page.
145 */ 254 */
146static inline loff_t page_offset(struct page *page) 255static inline loff_t page_offset(struct page *page)
diff --git a/include/linux/parport.h b/include/linux/parport.h
index dcb9e01a69ca..6a0d7cdb5774 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -560,5 +560,8 @@ extern int parport_device_proc_unregister(struct pardevice *device);
560 560
561#endif /* !CONFIG_PARPORT_NOT_PC */ 561#endif /* !CONFIG_PARPORT_NOT_PC */
562 562
563extern unsigned long parport_default_timeslice;
564extern int parport_default_spintime;
565
563#endif /* __KERNEL__ */ 566#endif /* __KERNEL__ */
564#endif /* _PARPORT_H_ */ 567#endif /* _PARPORT_H_ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 4cdd393e71e1..fac3337547eb 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -74,11 +74,6 @@ struct percpu_data {
74 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 74 (__typeof__(ptr))__p->ptrs[(cpu)]; \
75}) 75})
76 76
77extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu);
78extern void percpu_depopulate(void *__pdata, int cpu);
79extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
80 cpumask_t *mask);
81extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask);
82extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); 77extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask);
83extern void percpu_free(void *__pdata); 78extern void percpu_free(void *__pdata);
84 79
@@ -86,26 +81,6 @@ extern void percpu_free(void *__pdata);
86 81
87#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 82#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
88 83
89static inline void percpu_depopulate(void *__pdata, int cpu)
90{
91}
92
93static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask)
94{
95}
96
97static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp,
98 int cpu)
99{
100 return percpu_ptr(__pdata, cpu);
101}
102
103static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
104 cpumask_t *mask)
105{
106 return 0;
107}
108
109static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) 84static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
110{ 85{
111 return kzalloc(size, gfp); 86 return kzalloc(size, gfp);
@@ -118,10 +93,6 @@ static inline void percpu_free(void *__pdata)
118 93
119#endif /* CONFIG_SMP */ 94#endif /* CONFIG_SMP */
120 95
121#define percpu_populate_mask(__pdata, size, gfp, mask) \
122 __percpu_populate_mask((__pdata), (size), (gfp), &(mask))
123#define percpu_depopulate_mask(__pdata, mask) \
124 __percpu_depopulate_mask((__pdata), &(mask))
125#define percpu_alloc_mask(size, gfp, mask) \ 96#define percpu_alloc_mask(size, gfp, mask) \
126 __percpu_alloc_mask((size), (gfp), &(mask)) 97 __percpu_alloc_mask((size), (gfp), &(mask))
127 98
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index c6f5f9dd0cee..fd31756e1a00 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -121,6 +121,74 @@ static inline void ptrace_unlink(struct task_struct *child)
121int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data); 121int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data);
122int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data); 122int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
123 123
124/**
125 * task_ptrace - return %PT_* flags that apply to a task
126 * @task: pointer to &task_struct in question
127 *
128 * Returns the %PT_* flags that apply to @task.
129 */
130static inline int task_ptrace(struct task_struct *task)
131{
132 return task->ptrace;
133}
134
135/**
136 * ptrace_event - possibly stop for a ptrace event notification
137 * @mask: %PT_* bit to check in @current->ptrace
138 * @event: %PTRACE_EVENT_* value to report if @mask is set
139 * @message: value for %PTRACE_GETEVENTMSG to return
140 *
141 * This checks the @mask bit to see if ptrace wants stops for this event.
142 * If so we stop, reporting @event and @message to the ptrace parent.
143 *
144 * Returns nonzero if we did a ptrace notification, zero if not.
145 *
146 * Called without locks.
147 */
148static inline int ptrace_event(int mask, int event, unsigned long message)
149{
150 if (mask && likely(!(current->ptrace & mask)))
151 return 0;
152 current->ptrace_message = message;
153 ptrace_notify((event << 8) | SIGTRAP);
154 return 1;
155}
156
157/**
158 * ptrace_init_task - initialize ptrace state for a new child
159 * @child: new child task
160 * @ptrace: true if child should be ptrace'd by parent's tracer
161 *
162 * This is called immediately after adding @child to its parent's children
163 * list. @ptrace is false in the normal case, and true to ptrace @child.
164 *
165 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
166 */
167static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
168{
169 INIT_LIST_HEAD(&child->ptrace_entry);
170 INIT_LIST_HEAD(&child->ptraced);
171 child->parent = child->real_parent;
172 child->ptrace = 0;
173 if (unlikely(ptrace)) {
174 child->ptrace = current->ptrace;
175 __ptrace_link(child, current->parent);
176 }
177}
178
179/**
180 * ptrace_release_task - final ptrace-related cleanup of a zombie being reaped
181 * @task: task in %EXIT_DEAD state
182 *
183 * Called with write_lock(&tasklist_lock) held.
184 */
185static inline void ptrace_release_task(struct task_struct *task)
186{
187 BUG_ON(!list_empty(&task->ptraced));
188 ptrace_unlink(task);
189 BUG_ON(!list_empty(&task->ptrace_entry));
190}
191
124#ifndef force_successful_syscall_return 192#ifndef force_successful_syscall_return
125/* 193/*
126 * System call handlers that, upon successful completion, need to return a 194 * System call handlers that, upon successful completion, need to return a
@@ -246,6 +314,10 @@ static inline void user_enable_block_step(struct task_struct *task)
246#define arch_ptrace_stop(code, info) do { } while (0) 314#define arch_ptrace_stop(code, info) do { } while (0)
247#endif 315#endif
248 316
317extern int task_current_syscall(struct task_struct *target, long *callno,
318 unsigned long args[6], unsigned int maxargs,
319 unsigned long *sp, unsigned long *pc);
320
249#endif 321#endif
250 322
251#endif 323#endif
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index b8ce2b444bb5..a916c6660dfa 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -99,12 +99,15 @@ do { \
99 * 99 *
100 * The notable exceptions to this rule are the following functions: 100 * The notable exceptions to this rule are the following functions:
101 * radix_tree_lookup 101 * radix_tree_lookup
102 * radix_tree_lookup_slot
102 * radix_tree_tag_get 103 * radix_tree_tag_get
103 * radix_tree_gang_lookup 104 * radix_tree_gang_lookup
105 * radix_tree_gang_lookup_slot
104 * radix_tree_gang_lookup_tag 106 * radix_tree_gang_lookup_tag
107 * radix_tree_gang_lookup_tag_slot
105 * radix_tree_tagged 108 * radix_tree_tagged
106 * 109 *
107 * The first 4 functions are able to be called locklessly, using RCU. The 110 * The first 7 functions are able to be called locklessly, using RCU. The
108 * caller must ensure calls to these functions are made within rcu_read_lock() 111 * caller must ensure calls to these functions are made within rcu_read_lock()
109 * regions. Other readers (lock-free or otherwise) and modifications may be 112 * regions. Other readers (lock-free or otherwise) and modifications may be
110 * running concurrently. 113 * running concurrently.
@@ -159,6 +162,9 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long);
159unsigned int 162unsigned int
160radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 163radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
161 unsigned long first_index, unsigned int max_items); 164 unsigned long first_index, unsigned int max_items);
165unsigned int
166radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
167 unsigned long first_index, unsigned int max_items);
162unsigned long radix_tree_next_hole(struct radix_tree_root *root, 168unsigned long radix_tree_next_hole(struct radix_tree_root *root,
163 unsigned long index, unsigned long max_scan); 169 unsigned long index, unsigned long max_scan);
164int radix_tree_preload(gfp_t gfp_mask); 170int radix_tree_preload(gfp_t gfp_mask);
@@ -173,6 +179,10 @@ unsigned int
173radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, 179radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
174 unsigned long first_index, unsigned int max_items, 180 unsigned long first_index, unsigned int max_items,
175 unsigned int tag); 181 unsigned int tag);
182unsigned int
183radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
184 unsigned long first_index, unsigned int max_items,
185 unsigned int tag);
176int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); 186int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
177 187
178static inline void radix_tree_preload_end(void) 188static inline void radix_tree_preload_end(void)
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 6cd8c4425fc7..953fc055e875 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -48,6 +48,7 @@ struct rchan_buf
48 size_t *padding; /* padding counts per sub-buffer */ 48 size_t *padding; /* padding counts per sub-buffer */
49 size_t prev_padding; /* temporary variable */ 49 size_t prev_padding; /* temporary variable */
50 size_t bytes_consumed; /* bytes consumed in cur read subbuf */ 50 size_t bytes_consumed; /* bytes consumed in cur read subbuf */
51 size_t early_bytes; /* bytes consumed before VFS inited */
51 unsigned int cpu; /* this buf's cpu */ 52 unsigned int cpu; /* this buf's cpu */
52} ____cacheline_aligned; 53} ____cacheline_aligned;
53 54
@@ -68,6 +69,7 @@ struct rchan
68 int is_global; /* One global buffer ? */ 69 int is_global; /* One global buffer ? */
69 struct list_head list; /* for channel list */ 70 struct list_head list; /* for channel list */
70 struct dentry *parent; /* parent dentry passed to open */ 71 struct dentry *parent; /* parent dentry passed to open */
72 int has_base_filename; /* has a filename associated? */
71 char base_filename[NAME_MAX]; /* saved base filename */ 73 char base_filename[NAME_MAX]; /* saved base filename */
72}; 74};
73 75
@@ -169,6 +171,9 @@ struct rchan *relay_open(const char *base_filename,
169 size_t n_subbufs, 171 size_t n_subbufs,
170 struct rchan_callbacks *cb, 172 struct rchan_callbacks *cb,
171 void *private_data); 173 void *private_data);
174extern int relay_late_setup_files(struct rchan *chan,
175 const char *base_filename,
176 struct dentry *parent);
172extern void relay_close(struct rchan *chan); 177extern void relay_close(struct rchan *chan);
173extern void relay_flush(struct rchan *chan); 178extern void relay_flush(struct rchan *chan);
174extern void relay_subbufs_consumed(struct rchan *chan, 179extern void relay_subbufs_consumed(struct rchan *chan,
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index b01fe004cb5e..91f597ad6acc 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -225,8 +225,6 @@ typedef struct rtc_task {
225int rtc_register(rtc_task_t *task); 225int rtc_register(rtc_task_t *task);
226int rtc_unregister(rtc_task_t *task); 226int rtc_unregister(rtc_task_t *task);
227int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 227int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
228void rtc_get_rtc_time(struct rtc_time *rtc_tm);
229irqreturn_t rtc_interrupt(int irq, void *dev_id);
230 228
231#endif /* __KERNEL__ */ 229#endif /* __KERNEL__ */
232 230
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 42036ffe6b00..f59318a0099b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -292,7 +292,6 @@ extern void sched_show_task(struct task_struct *p);
292 292
293#ifdef CONFIG_DETECT_SOFTLOCKUP 293#ifdef CONFIG_DETECT_SOFTLOCKUP
294extern void softlockup_tick(void); 294extern void softlockup_tick(void);
295extern void spawn_softlockup_task(void);
296extern void touch_softlockup_watchdog(void); 295extern void touch_softlockup_watchdog(void);
297extern void touch_all_softlockup_watchdogs(void); 296extern void touch_all_softlockup_watchdogs(void);
298extern unsigned int softlockup_panic; 297extern unsigned int softlockup_panic;
@@ -1797,7 +1796,7 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_
1797extern int kill_pgrp(struct pid *pid, int sig, int priv); 1796extern int kill_pgrp(struct pid *pid, int sig, int priv);
1798extern int kill_pid(struct pid *pid, int sig, int priv); 1797extern int kill_pid(struct pid *pid, int sig, int priv);
1799extern int kill_proc_info(int, struct siginfo *, pid_t); 1798extern int kill_proc_info(int, struct siginfo *, pid_t);
1800extern void do_notify_parent(struct task_struct *, int); 1799extern int do_notify_parent(struct task_struct *, int);
1801extern void force_sig(int, struct task_struct *); 1800extern void force_sig(int, struct task_struct *);
1802extern void force_sig_specific(int, struct task_struct *); 1801extern void force_sig_specific(int, struct task_struct *);
1803extern int send_sig(int, struct task_struct *, int); 1802extern int send_sig(int, struct task_struct *, int);
@@ -1883,9 +1882,13 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
1883extern char *get_task_comm(char *to, struct task_struct *tsk); 1882extern char *get_task_comm(char *to, struct task_struct *tsk);
1884 1883
1885#ifdef CONFIG_SMP 1884#ifdef CONFIG_SMP
1886extern void wait_task_inactive(struct task_struct * p); 1885extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
1887#else 1886#else
1888#define wait_task_inactive(p) do { } while (0) 1887static inline unsigned long wait_task_inactive(struct task_struct *p,
1888 long match_state)
1889{
1890 return 1;
1891}
1889#endif 1892#endif
1890 1893
1891#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) 1894#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
@@ -2139,16 +2142,7 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
2139 2142
2140#endif /* CONFIG_SMP */ 2143#endif /* CONFIG_SMP */
2141 2144
2142#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
2143extern void arch_pick_mmap_layout(struct mm_struct *mm); 2145extern void arch_pick_mmap_layout(struct mm_struct *mm);
2144#else
2145static inline void arch_pick_mmap_layout(struct mm_struct *mm)
2146{
2147 mm->mmap_base = TASK_UNMAPPED_BASE;
2148 mm->get_unmapped_area = arch_get_unmapped_area;
2149 mm->unmap_area = arch_unmap_area;
2150}
2151#endif
2152 2146
2153#ifdef CONFIG_TRACING 2147#ifdef CONFIG_TRACING
2154extern void 2148extern void
@@ -2231,14 +2225,6 @@ static inline void inc_syscw(struct task_struct *tsk)
2231} 2225}
2232#endif 2226#endif
2233 2227
2234#ifdef CONFIG_SMP
2235void migration_init(void);
2236#else
2237static inline void migration_init(void)
2238{
2239}
2240#endif
2241
2242#ifndef TASK_SIZE_OF 2228#ifndef TASK_SIZE_OF
2243#define TASK_SIZE_OF(tsk) TASK_SIZE 2229#define TASK_SIZE_OF(tsk) TASK_SIZE
2244#endif 2230#endif
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 41103910f8a2..9ff8e8499403 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -58,7 +58,7 @@ int slab_is_available(void);
58 58
59struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 59struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
60 unsigned long, 60 unsigned long,
61 void (*)(struct kmem_cache *, void *)); 61 void (*)(void *));
62void kmem_cache_destroy(struct kmem_cache *); 62void kmem_cache_destroy(struct kmem_cache *);
63int kmem_cache_shrink(struct kmem_cache *); 63int kmem_cache_shrink(struct kmem_cache *);
64void kmem_cache_free(struct kmem_cache *, void *); 64void kmem_cache_free(struct kmem_cache *, void *);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index d117ea2825a9..5bad61a93f65 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -85,7 +85,7 @@ struct kmem_cache {
85 struct kmem_cache_order_objects min; 85 struct kmem_cache_order_objects min;
86 gfp_t allocflags; /* gfp flags to use on each alloc */ 86 gfp_t allocflags; /* gfp flags to use on each alloc */
87 int refcount; /* Refcount for slab cache destroy */ 87 int refcount; /* Refcount for slab cache destroy */
88 void (*ctor)(struct kmem_cache *, void *); 88 void (*ctor)(void *);
89 int inuse; /* Offset to metadata */ 89 int inuse; /* Offset to metadata */
90 int align; /* Alignment */ 90 int align; /* Alignment */
91 const char *name; /* Name (only for display!) */ 91 const char *name; /* Name (only for display!) */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 48262f86c969..66484d4a8459 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -74,15 +74,10 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data);
74#ifdef CONFIG_USE_GENERIC_SMP_HELPERS 74#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
75void generic_smp_call_function_single_interrupt(void); 75void generic_smp_call_function_single_interrupt(void);
76void generic_smp_call_function_interrupt(void); 76void generic_smp_call_function_interrupt(void);
77void init_call_single_data(void);
78void ipi_call_lock(void); 77void ipi_call_lock(void);
79void ipi_call_unlock(void); 78void ipi_call_unlock(void);
80void ipi_call_lock_irq(void); 79void ipi_call_lock_irq(void);
81void ipi_call_unlock_irq(void); 80void ipi_call_unlock_irq(void);
82#else
83static inline void init_call_single_data(void)
84{
85}
86#endif 81#endif
87 82
88/* 83/*
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 4bf8cade9dbc..e530026eedf7 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -427,9 +427,9 @@ static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
427{ 427{
428 switch (dev->bus->bustype) { 428 switch (dev->bus->bustype) {
429 case SSB_BUSTYPE_PCI: 429 case SSB_BUSTYPE_PCI:
430 return pci_dma_mapping_error(addr); 430 return pci_dma_mapping_error(dev->bus->host_pci, addr);
431 case SSB_BUSTYPE_SSB: 431 case SSB_BUSTYPE_SSB:
432 return dma_mapping_error(addr); 432 return dma_mapping_error(dev->dev, addr);
433 default: 433 default:
434 __ssb_dma_not_implemented(dev); 434 __ssb_dma_not_implemented(dev);
435 } 435 }
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index e8e69159af71..c63435095970 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -278,4 +278,6 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
278} 278}
279#endif 279#endif
280 280
281extern struct mutex pm_mutex;
282
281#endif /* _LINUX_SUSPEND_H */ 283#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 0b3377650c85..de40f169a4e4 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -237,7 +237,6 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t,
237 237
238/* linux/mm/swapfile.c */ 238/* linux/mm/swapfile.c */
239extern long total_swap_pages; 239extern long total_swap_pages;
240extern unsigned int nr_swapfiles;
241extern void si_swapinfo(struct sysinfo *); 240extern void si_swapinfo(struct sysinfo *);
242extern swp_entry_t get_swap_page(void); 241extern swp_entry_t get_swap_page(void);
243extern swp_entry_t get_swap_page_of_type(int); 242extern swp_entry_t get_swap_page_of_type(int);
@@ -254,8 +253,6 @@ extern int can_share_swap_page(struct page *);
254extern int remove_exclusive_swap_page(struct page *); 253extern int remove_exclusive_swap_page(struct page *);
255struct backing_dev_info; 254struct backing_dev_info;
256 255
257extern spinlock_t swap_lock;
258
259/* linux/mm/thrash.c */ 256/* linux/mm/thrash.c */
260extern struct mm_struct * swap_token_mm; 257extern struct mm_struct * swap_token_mm;
261extern void grab_swap_token(void); 258extern void grab_swap_token(void);
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
new file mode 100644
index 000000000000..589f429619c9
--- /dev/null
+++ b/include/linux/tracehook.h
@@ -0,0 +1,575 @@
1/*
2 * Tracing hooks
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * This file defines hook entry points called by core code where
11 * user tracing/debugging support might need to do something. These
12 * entry points are called tracehook_*(). Each hook declared below
13 * has a detailed kerneldoc comment giving the context (locking et
14 * al) from which it is called, and the meaning of its return value.
15 *
16 * Each function here typically has only one call site, so it is ok
17 * to have some nontrivial tracehook_*() inlines. In all cases, the
18 * fast path when no tracing is enabled should be very short.
19 *
20 * The purpose of this file and the tracehook_* layer is to consolidate
21 * the interface that the kernel core and arch code uses to enable any
22 * user debugging or tracing facility (such as ptrace). The interfaces
23 * here are carefully documented so that maintainers of core and arch
24 * code do not need to think about the implementation details of the
25 * tracing facilities. Likewise, maintainers of the tracing code do not
26 * need to understand all the calling core or arch code in detail, just
27 * documented circumstances of each call, such as locking conditions.
28 *
29 * If the calling core code changes so that locking is different, then
30 * it is ok to change the interface documented here. The maintainer of
31 * core code changing should notify the maintainers of the tracing code
32 * that they need to work out the change.
33 *
34 * Some tracehook_*() inlines take arguments that the current tracing
35 * implementations might not necessarily use. These function signatures
36 * are chosen to pass in all the information that is on hand in the
37 * caller and might conceivably be relevant to a tracer, so that the
38 * core code won't have to be updated when tracing adds more features.
39 * If a call site changes so that some of those parameters are no longer
40 * already on hand without extra work, then the tracehook_* interface
41 * can change so there is no make-work burden on the core code. The
42 * maintainer of core code changing should notify the maintainers of the
43 * tracing code that they need to work out the change.
44 */
45
46#ifndef _LINUX_TRACEHOOK_H
47#define _LINUX_TRACEHOOK_H 1
48
49#include <linux/sched.h>
50#include <linux/ptrace.h>
51#include <linux/security.h>
52struct linux_binprm;
53
54/**
55 * tracehook_expect_breakpoints - guess if task memory might be touched
56 * @task: current task, making a new mapping
57 *
58 * Return nonzero if @task is expected to want breakpoint insertion in
59 * its memory at some point. A zero return is no guarantee it won't
60 * be done, but this is a hint that it's known to be likely.
61 *
62 * May be called with @task->mm->mmap_sem held for writing.
63 */
64static inline int tracehook_expect_breakpoints(struct task_struct *task)
65{
66 return (task_ptrace(task) & PT_PTRACED) != 0;
67}
68
69/*
70 * ptrace report for syscall entry and exit looks identical.
71 */
72static inline void ptrace_report_syscall(struct pt_regs *regs)
73{
74 int ptrace = task_ptrace(current);
75
76 if (!(ptrace & PT_PTRACED))
77 return;
78
79 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
80
81 /*
82 * this isn't the same as continuing with a signal, but it will do
83 * for normal use. strace only continues with a signal if the
84 * stopping signal is not SIGTRAP. -brl
85 */
86 if (current->exit_code) {
87 send_sig(current->exit_code, current, 1);
88 current->exit_code = 0;
89 }
90}
91
92/**
93 * tracehook_report_syscall_entry - task is about to attempt a system call
94 * @regs: user register state of current task
95 *
96 * This will be called if %TIF_SYSCALL_TRACE has been set, when the
97 * current task has just entered the kernel for a system call.
98 * Full user register state is available here. Changing the values
99 * in @regs can affect the system call number and arguments to be tried.
100 * It is safe to block here, preventing the system call from beginning.
101 *
102 * Returns zero normally, or nonzero if the calling arch code should abort
103 * the system call. That must prevent normal entry so no system call is
104 * made. If @task ever returns to user mode after this, its register state
105 * is unspecified, but should be something harmless like an %ENOSYS error
106 * return. It should preserve enough information so that syscall_rollback()
107 * can work (see asm-generic/syscall.h).
108 *
109 * Called without locks, just after entering kernel mode.
110 */
111static inline __must_check int tracehook_report_syscall_entry(
112 struct pt_regs *regs)
113{
114 ptrace_report_syscall(regs);
115 return 0;
116}
117
118/**
119 * tracehook_report_syscall_exit - task has just finished a system call
120 * @regs: user register state of current task
121 * @step: nonzero if simulating single-step or block-step
122 *
123 * This will be called if %TIF_SYSCALL_TRACE has been set, when the
124 * current task has just finished an attempted system call. Full
125 * user register state is available here. It is safe to block here,
126 * preventing signals from being processed.
127 *
128 * If @step is nonzero, this report is also in lieu of the normal
129 * trap that would follow the system call instruction because
130 * user_enable_block_step() or user_enable_single_step() was used.
131 * In this case, %TIF_SYSCALL_TRACE might not be set.
132 *
133 * Called without locks, just before checking for pending signals.
134 */
135static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
136{
137 ptrace_report_syscall(regs);
138}
139
140/**
141 * tracehook_unsafe_exec - check for exec declared unsafe due to tracing
142 * @task: current task doing exec
143 *
144 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing.
145 *
146 * Called with task_lock() held on @task.
147 */
148static inline int tracehook_unsafe_exec(struct task_struct *task)
149{
150 int unsafe = 0;
151 int ptrace = task_ptrace(task);
152 if (ptrace & PT_PTRACED) {
153 if (ptrace & PT_PTRACE_CAP)
154 unsafe |= LSM_UNSAFE_PTRACE_CAP;
155 else
156 unsafe |= LSM_UNSAFE_PTRACE;
157 }
158 return unsafe;
159}
160
161/**
162 * tracehook_tracer_task - return the task that is tracing the given task
163 * @tsk: task to consider
164 *
165 * Returns NULL if noone is tracing @task, or the &struct task_struct
166 * pointer to its tracer.
167 *
168 * Must called under rcu_read_lock(). The pointer returned might be kept
169 * live only by RCU. During exec, this may be called with task_lock()
170 * held on @task, still held from when tracehook_unsafe_exec() was called.
171 */
172static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk)
173{
174 if (task_ptrace(tsk) & PT_PTRACED)
175 return rcu_dereference(tsk->parent);
176 return NULL;
177}
178
179/**
180 * tracehook_report_exec - a successful exec was completed
181 * @fmt: &struct linux_binfmt that performed the exec
182 * @bprm: &struct linux_binprm containing exec details
183 * @regs: user-mode register state
184 *
185 * An exec just completed, we are shortly going to return to user mode.
186 * The freshly initialized register state can be seen and changed in @regs.
187 * The name, file and other pointers in @bprm are still on hand to be
188 * inspected, but will be freed as soon as this returns.
189 *
190 * Called with no locks, but with some kernel resources held live
191 * and a reference on @fmt->module.
192 */
193static inline void tracehook_report_exec(struct linux_binfmt *fmt,
194 struct linux_binprm *bprm,
195 struct pt_regs *regs)
196{
197 if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) &&
198 unlikely(task_ptrace(current) & PT_PTRACED))
199 send_sig(SIGTRAP, current, 0);
200}
201
202/**
203 * tracehook_report_exit - task has begun to exit
204 * @exit_code: pointer to value destined for @current->exit_code
205 *
206 * @exit_code points to the value passed to do_exit(), which tracing
207 * might change here. This is almost the first thing in do_exit(),
208 * before freeing any resources or setting the %PF_EXITING flag.
209 *
210 * Called with no locks held.
211 */
212static inline void tracehook_report_exit(long *exit_code)
213{
214 ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code);
215}
216
217/**
218 * tracehook_prepare_clone - prepare for new child to be cloned
219 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
220 *
221 * This is called before a new user task is to be cloned.
222 * Its return value will be passed to tracehook_finish_clone().
223 *
224 * Called with no locks held.
225 */
226static inline int tracehook_prepare_clone(unsigned clone_flags)
227{
228 if (clone_flags & CLONE_UNTRACED)
229 return 0;
230
231 if (clone_flags & CLONE_VFORK) {
232 if (current->ptrace & PT_TRACE_VFORK)
233 return PTRACE_EVENT_VFORK;
234 } else if ((clone_flags & CSIGNAL) != SIGCHLD) {
235 if (current->ptrace & PT_TRACE_CLONE)
236 return PTRACE_EVENT_CLONE;
237 } else if (current->ptrace & PT_TRACE_FORK)
238 return PTRACE_EVENT_FORK;
239
240 return 0;
241}
242
243/**
244 * tracehook_finish_clone - new child created and being attached
245 * @child: new child task
246 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
247 * @trace: return value from tracehook_clone_prepare()
248 *
249 * This is called immediately after adding @child to its parent's children list.
250 * The @trace value is that returned by tracehook_prepare_clone().
251 *
252 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
253 */
254static inline void tracehook_finish_clone(struct task_struct *child,
255 unsigned long clone_flags, int trace)
256{
257 ptrace_init_task(child, (clone_flags & CLONE_PTRACE) || trace);
258}
259
260/**
261 * tracehook_report_clone - in parent, new child is about to start running
262 * @trace: return value from tracehook_clone_prepare()
263 * @regs: parent's user register state
264 * @clone_flags: flags from parent's system call
265 * @pid: new child's PID in the parent's namespace
266 * @child: new child task
267 *
268 * Called after a child is set up, but before it has been started running.
269 * The @trace value is that returned by tracehook_clone_prepare().
270 * This is not a good place to block, because the child has not started yet.
271 * Suspend the child here if desired, and block in tracehook_clone_complete().
272 * This must prevent the child from self-reaping if tracehook_clone_complete()
273 * uses the @child pointer; otherwise it might have died and been released by
274 * the time tracehook_report_clone_complete() is called.
275 *
276 * Called with no locks held, but the child cannot run until this returns.
277 */
278static inline void tracehook_report_clone(int trace, struct pt_regs *regs,
279 unsigned long clone_flags,
280 pid_t pid, struct task_struct *child)
281{
282 if (unlikely(trace)) {
283 /*
284 * The child starts up with an immediate SIGSTOP.
285 */
286 sigaddset(&child->pending.signal, SIGSTOP);
287 set_tsk_thread_flag(child, TIF_SIGPENDING);
288 }
289}
290
291/**
292 * tracehook_report_clone_complete - new child is running
293 * @trace: return value from tracehook_clone_prepare()
294 * @regs: parent's user register state
295 * @clone_flags: flags from parent's system call
296 * @pid: new child's PID in the parent's namespace
297 * @child: child task, already running
298 *
299 * This is called just after the child has started running. This is
300 * just before the clone/fork syscall returns, or blocks for vfork
301 * child completion if @clone_flags has the %CLONE_VFORK bit set.
302 * The @child pointer may be invalid if a self-reaping child died and
303 * tracehook_report_clone() took no action to prevent it from self-reaping.
304 *
305 * Called with no locks held.
306 */
307static inline void tracehook_report_clone_complete(int trace,
308 struct pt_regs *regs,
309 unsigned long clone_flags,
310 pid_t pid,
311 struct task_struct *child)
312{
313 if (unlikely(trace))
314 ptrace_event(0, trace, pid);
315}
316
317/**
318 * tracehook_report_vfork_done - vfork parent's child has exited or exec'd
319 * @child: child task, already running
320 * @pid: new child's PID in the parent's namespace
321 *
322 * Called after a %CLONE_VFORK parent has waited for the child to complete.
323 * The clone/vfork system call will return immediately after this.
324 * The @child pointer may be invalid if a self-reaping child died and
325 * tracehook_report_clone() took no action to prevent it from self-reaping.
326 *
327 * Called with no locks held.
328 */
329static inline void tracehook_report_vfork_done(struct task_struct *child,
330 pid_t pid)
331{
332 ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid);
333}
334
335/**
336 * tracehook_prepare_release_task - task is being reaped, clean up tracing
337 * @task: task in %EXIT_DEAD state
338 *
339 * This is called in release_task() just before @task gets finally reaped
340 * and freed. This would be the ideal place to remove and clean up any
341 * tracing-related state for @task.
342 *
343 * Called with no locks held.
344 */
345static inline void tracehook_prepare_release_task(struct task_struct *task)
346{
347}
348
349/**
350 * tracehook_finish_release_task - task is being reaped, clean up tracing
351 * @task: task in %EXIT_DEAD state
352 *
353 * This is called in release_task() when @task is being in the middle of
354 * being reaped. After this, there must be no tracing entanglements.
355 *
356 * Called with write_lock_irq(&tasklist_lock) held.
357 */
358static inline void tracehook_finish_release_task(struct task_struct *task)
359{
360 ptrace_release_task(task);
361}
362
363/**
364 * tracehook_signal_handler - signal handler setup is complete
365 * @sig: number of signal being delivered
366 * @info: siginfo_t of signal being delivered
367 * @ka: sigaction setting that chose the handler
368 * @regs: user register state
369 * @stepping: nonzero if debugger single-step or block-step in use
370 *
371 * Called by the arch code after a signal handler has been set up.
372 * Register and stack state reflects the user handler about to run.
373 * Signal mask changes have already been made.
374 *
375 * Called without locks, shortly before returning to user mode
376 * (or handling more signals).
377 */
378static inline void tracehook_signal_handler(int sig, siginfo_t *info,
379 const struct k_sigaction *ka,
380 struct pt_regs *regs, int stepping)
381{
382 if (stepping)
383 ptrace_notify(SIGTRAP);
384}
385
386/**
387 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal
388 * @task: task receiving the signal
389 * @sig: signal number being sent
390 * @handler: %SIG_IGN or %SIG_DFL
391 *
392 * Return zero iff tracing doesn't care to examine this ignored signal,
393 * so it can short-circuit normal delivery and never even get queued.
394 * Either @handler is %SIG_DFL and @sig's default is ignore, or it's %SIG_IGN.
395 *
396 * Called with @task->sighand->siglock held.
397 */
398static inline int tracehook_consider_ignored_signal(struct task_struct *task,
399 int sig,
400 void __user *handler)
401{
402 return (task_ptrace(task) & PT_PTRACED) != 0;
403}
404
405/**
406 * tracehook_consider_fatal_signal - suppress special handling of fatal signal
407 * @task: task receiving the signal
408 * @sig: signal number being sent
409 * @handler: %SIG_DFL or %SIG_IGN
410 *
411 * Return nonzero to prevent special handling of this termination signal.
412 * Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored,
413 * in which case force_sig() is about to reset it to %SIG_DFL.
414 * When this returns zero, this signal might cause a quick termination
415 * that does not give the debugger a chance to intercept the signal.
416 *
417 * Called with or without @task->sighand->siglock held.
418 */
419static inline int tracehook_consider_fatal_signal(struct task_struct *task,
420 int sig,
421 void __user *handler)
422{
423 return (task_ptrace(task) & PT_PTRACED) != 0;
424}
425
426/**
427 * tracehook_force_sigpending - let tracing force signal_pending(current) on
428 *
429 * Called when recomputing our signal_pending() flag. Return nonzero
430 * to force the signal_pending() flag on, so that tracehook_get_signal()
431 * will be called before the next return to user mode.
432 *
433 * Called with @current->sighand->siglock held.
434 */
435static inline int tracehook_force_sigpending(void)
436{
437 return 0;
438}
439
440/**
441 * tracehook_get_signal - deliver synthetic signal to traced task
442 * @task: @current
443 * @regs: task_pt_regs(@current)
444 * @info: details of synthetic signal
445 * @return_ka: sigaction for synthetic signal
446 *
447 * Return zero to check for a real pending signal normally.
448 * Return -1 after releasing the siglock to repeat the check.
449 * Return a signal number to induce an artifical signal delivery,
450 * setting *@info and *@return_ka to specify its details and behavior.
451 *
452 * The @return_ka->sa_handler value controls the disposition of the
453 * signal, no matter the signal number. For %SIG_DFL, the return value
454 * is a representative signal to indicate the behavior (e.g. %SIGTERM
455 * for death, %SIGQUIT for core dump, %SIGSTOP for job control stop,
456 * %SIGTSTP for stop unless in an orphaned pgrp), but the signal number
457 * reported will be @info->si_signo instead.
458 *
459 * Called with @task->sighand->siglock held, before dequeuing pending signals.
460 */
461static inline int tracehook_get_signal(struct task_struct *task,
462 struct pt_regs *regs,
463 siginfo_t *info,
464 struct k_sigaction *return_ka)
465{
466 return 0;
467}
468
469/**
470 * tracehook_notify_jctl - report about job control stop/continue
471 * @notify: nonzero if this is the last thread in the group to stop
472 * @why: %CLD_STOPPED or %CLD_CONTINUED
473 *
474 * This is called when we might call do_notify_parent_cldstop().
475 * It's called when about to stop for job control; we are already in
476 * %TASK_STOPPED state, about to call schedule(). It's also called when
477 * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
478 *
479 * Return nonzero to generate a %SIGCHLD with @why, which is
480 * normal if @notify is nonzero.
481 *
482 * Called with no locks held.
483 */
484static inline int tracehook_notify_jctl(int notify, int why)
485{
486 return notify || (current->ptrace & PT_PTRACED);
487}
488
489/**
490 * tracehook_notify_death - task is dead, ready to notify parent
491 * @task: @current task now exiting
492 * @death_cookie: value to pass to tracehook_report_death()
493 * @group_dead: nonzero if this was the last thread in the group to die
494 *
495 * Return the signal number to send our parent with do_notify_parent(), or
496 * zero to send no signal and leave a zombie, or -1 to self-reap right now.
497 *
498 * Called with write_lock_irq(&tasklist_lock) held.
499 */
500static inline int tracehook_notify_death(struct task_struct *task,
501 void **death_cookie, int group_dead)
502{
503 if (task->exit_signal == -1)
504 return task->ptrace ? SIGCHLD : -1;
505
506 /*
507 * If something other than our normal parent is ptracing us, then
508 * send it a SIGCHLD instead of honoring exit_signal. exit_signal
509 * only has special meaning to our real parent.
510 */
511 if (thread_group_empty(task) && !ptrace_reparented(task))
512 return task->exit_signal;
513
514 return task->ptrace ? SIGCHLD : 0;
515}
516
517/**
518 * tracehook_report_death - task is dead and ready to be reaped
519 * @task: @current task now exiting
520 * @signal: signal number sent to parent, or 0 or -1
521 * @death_cookie: value passed back from tracehook_notify_death()
522 * @group_dead: nonzero if this was the last thread in the group to die
523 *
524 * Thread has just become a zombie or is about to self-reap. If positive,
525 * @signal is the signal number just sent to the parent (usually %SIGCHLD).
526 * If @signal is -1, this thread will self-reap. If @signal is 0, this is
527 * a delayed_group_leader() zombie. The @death_cookie was passed back by
528 * tracehook_notify_death().
529 *
530 * If normal reaping is not inhibited, @task->exit_state might be changing
531 * in parallel.
532 *
533 * Called without locks.
534 */
535static inline void tracehook_report_death(struct task_struct *task,
536 int signal, void *death_cookie,
537 int group_dead)
538{
539}
540
541#ifdef TIF_NOTIFY_RESUME
542/**
543 * set_notify_resume - cause tracehook_notify_resume() to be called
544 * @task: task that will call tracehook_notify_resume()
545 *
546 * Calling this arranges that @task will call tracehook_notify_resume()
547 * before returning to user mode. If it's already running in user mode,
548 * it will enter the kernel and call tracehook_notify_resume() soon.
549 * If it's blocked, it will not be woken.
550 */
551static inline void set_notify_resume(struct task_struct *task)
552{
553 if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_RESUME))
554 kick_process(task);
555}
556
557/**
558 * tracehook_notify_resume - report when about to return to user mode
559 * @regs: user-mode registers of @current task
560 *
561 * This is called when %TIF_NOTIFY_RESUME has been set. Now we are
562 * about to return to user mode, and the user state in @regs can be
563 * inspected or adjusted. The caller in arch code has cleared
564 * %TIF_NOTIFY_RESUME before the call. If the flag gets set again
565 * asynchronously, this will be called again before we return to
566 * user mode.
567 *
568 * Called without locks.
569 */
570static inline void tracehook_notify_resume(struct pt_regs *regs)
571{
572}
573#endif /* TIF_NOTIFY_RESUME */
574
575#endif /* <linux/tracehook.h> */
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 90b529f7a154..936e333e7ce5 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1590,7 +1590,7 @@ static inline int ib_dma_mapping_error(struct ib_device *dev, u64 dma_addr)
1590{ 1590{
1591 if (dev->dma_ops) 1591 if (dev->dma_ops)
1592 return dev->dma_ops->mapping_error(dev, dma_addr); 1592 return dev->dma_ops->mapping_error(dev, dma_addr);
1593 return dma_mapping_error(dma_addr); 1593 return dma_mapping_error(dev->dma_device, dma_addr);
1594} 1594}
1595 1595
1596/** 1596/**
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 1ccf462b433a..613173b5db69 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -22,6 +22,7 @@
22#ifndef __ATMEL_LCDC_H__ 22#ifndef __ATMEL_LCDC_H__
23#define __ATMEL_LCDC_H__ 23#define __ATMEL_LCDC_H__
24 24
25#include <linux/workqueue.h>
25 26
26/* Way LCD wires are connected to the chip: 27/* Way LCD wires are connected to the chip:
27 * Some Atmel chips use BGR color mode (instead of standard RGB) 28 * Some Atmel chips use BGR color mode (instead of standard RGB)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index f769fac4f4c0..3715feb8446d 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -23,7 +23,7 @@
23int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */ 23int __initdata rd_doload; /* 1 = load RAM disk, 0 = don't load */
24 24
25int root_mountflags = MS_RDONLY | MS_SILENT; 25int root_mountflags = MS_RDONLY | MS_SILENT;
26char * __initdata root_device_name; 26static char * __initdata root_device_name;
27static char __initdata saved_root_name[64]; 27static char __initdata saved_root_name[64];
28static int __initdata root_wait; 28static int __initdata root_wait;
29 29
diff --git a/init/do_mounts.h b/init/do_mounts.h
index 735705d137ff..9aa968d54329 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -11,7 +11,6 @@ void change_floppy(char *fmt, ...);
11void mount_block_root(char *name, int flags); 11void mount_block_root(char *name, int flags);
12void mount_root(void); 12void mount_root(void);
13extern int root_mountflags; 13extern int root_mountflags;
14extern char *root_device_name;
15 14
16static inline int create_dev(char *name, dev_t dev) 15static inline int create_dev(char *name, dev_t dev)
17{ 16{
diff --git a/init/main.c b/init/main.c
index 0604cbcaf1e4..20fdc9884b77 100644
--- a/init/main.c
+++ b/init/main.c
@@ -743,13 +743,13 @@ static void __init do_one_initcall(initcall_t fn)
743} 743}
744 744
745 745
746extern initcall_t __initcall_start[], __initcall_end[]; 746extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
747 747
748static void __init do_initcalls(void) 748static void __init do_initcalls(void)
749{ 749{
750 initcall_t *call; 750 initcall_t *call;
751 751
752 for (call = __initcall_start; call < __initcall_end; call++) 752 for (call = __early_initcall_end; call < __initcall_end; call++)
753 do_one_initcall(*call); 753 do_one_initcall(*call);
754 754
755 /* Make sure there is no pending stuff from the initcall sequence */ 755 /* Make sure there is no pending stuff from the initcall sequence */
@@ -774,24 +774,12 @@ static void __init do_basic_setup(void)
774 do_initcalls(); 774 do_initcalls();
775} 775}
776 776
777static int __initdata nosoftlockup;
778
779static int __init nosoftlockup_setup(char *str)
780{
781 nosoftlockup = 1;
782 return 1;
783}
784__setup("nosoftlockup", nosoftlockup_setup);
785
786static void __init do_pre_smp_initcalls(void) 777static void __init do_pre_smp_initcalls(void)
787{ 778{
788 extern int spawn_ksoftirqd(void); 779 initcall_t *call;
789 780
790 init_call_single_data(); 781 for (call = __initcall_start; call < __early_initcall_end; call++)
791 migration_init(); 782 do_one_initcall(*call);
792 spawn_ksoftirqd();
793 if (!nosoftlockup)
794 spawn_softlockup_task();
795} 783}
796 784
797static void run_init_process(char *init_filename) 785static void run_init_process(char *init_filename)
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 1fdc2eb2f6d8..474984f9e032 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -207,7 +207,7 @@ static int mqueue_get_sb(struct file_system_type *fs_type,
207 return get_sb_single(fs_type, flags, data, mqueue_fill_super, mnt); 207 return get_sb_single(fs_type, flags, data, mqueue_fill_super, mnt);
208} 208}
209 209
210static void init_once(struct kmem_cache *cachep, void *foo) 210static void init_once(void *foo)
211{ 211{
212 struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo; 212 struct mqueue_inode_info *p = (struct mqueue_inode_info *) foo;
213 213
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 66ec9fd21e0c..89bd6fb7894f 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1529,7 +1529,7 @@ static int cgroup_seqfile_show(struct seq_file *m, void *arg)
1529 return cft->read_seq_string(state->cgroup, cft, m); 1529 return cft->read_seq_string(state->cgroup, cft, m);
1530} 1530}
1531 1531
1532int cgroup_seqfile_release(struct inode *inode, struct file *file) 1532static int cgroup_seqfile_release(struct inode *inode, struct file *file)
1533{ 1533{
1534 struct seq_file *seq = file->private_data; 1534 struct seq_file *seq = file->private_data;
1535 kfree(seq->private); 1535 kfree(seq->private);
diff --git a/kernel/exit.c b/kernel/exit.c
index ad933bb29ec7..6cdf60712bd2 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -46,6 +46,7 @@
46#include <linux/resource.h> 46#include <linux/resource.h>
47#include <linux/blkdev.h> 47#include <linux/blkdev.h>
48#include <linux/task_io_accounting_ops.h> 48#include <linux/task_io_accounting_ops.h>
49#include <linux/tracehook.h>
49 50
50#include <asm/uaccess.h> 51#include <asm/uaccess.h>
51#include <asm/unistd.h> 52#include <asm/unistd.h>
@@ -162,27 +163,17 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
162 put_task_struct(container_of(rhp, struct task_struct, rcu)); 163 put_task_struct(container_of(rhp, struct task_struct, rcu));
163} 164}
164 165
165/*
166 * Do final ptrace-related cleanup of a zombie being reaped.
167 *
168 * Called with write_lock(&tasklist_lock) held.
169 */
170static void ptrace_release_task(struct task_struct *p)
171{
172 BUG_ON(!list_empty(&p->ptraced));
173 ptrace_unlink(p);
174 BUG_ON(!list_empty(&p->ptrace_entry));
175}
176 166
177void release_task(struct task_struct * p) 167void release_task(struct task_struct * p)
178{ 168{
179 struct task_struct *leader; 169 struct task_struct *leader;
180 int zap_leader; 170 int zap_leader;
181repeat: 171repeat:
172 tracehook_prepare_release_task(p);
182 atomic_dec(&p->user->processes); 173 atomic_dec(&p->user->processes);
183 proc_flush_task(p); 174 proc_flush_task(p);
184 write_lock_irq(&tasklist_lock); 175 write_lock_irq(&tasklist_lock);
185 ptrace_release_task(p); 176 tracehook_finish_release_task(p);
186 __exit_signal(p); 177 __exit_signal(p);
187 178
188 /* 179 /*
@@ -204,6 +195,13 @@ repeat:
204 * that case. 195 * that case.
205 */ 196 */
206 zap_leader = task_detached(leader); 197 zap_leader = task_detached(leader);
198
199 /*
200 * This maintains the invariant that release_task()
201 * only runs on a task in EXIT_DEAD, just for sanity.
202 */
203 if (zap_leader)
204 leader->exit_state = EXIT_DEAD;
207 } 205 }
208 206
209 write_unlock_irq(&tasklist_lock); 207 write_unlock_irq(&tasklist_lock);
@@ -887,7 +885,8 @@ static void forget_original_parent(struct task_struct *father)
887 */ 885 */
888static void exit_notify(struct task_struct *tsk, int group_dead) 886static void exit_notify(struct task_struct *tsk, int group_dead)
889{ 887{
890 int state; 888 int signal;
889 void *cookie;
891 890
892 /* 891 /*
893 * This does two things: 892 * This does two things:
@@ -924,22 +923,11 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
924 !capable(CAP_KILL)) 923 !capable(CAP_KILL))
925 tsk->exit_signal = SIGCHLD; 924 tsk->exit_signal = SIGCHLD;
926 925
927 /* If something other than our normal parent is ptracing us, then 926 signal = tracehook_notify_death(tsk, &cookie, group_dead);
928 * send it a SIGCHLD instead of honoring exit_signal. exit_signal 927 if (signal > 0)
929 * only has special meaning to our real parent. 928 signal = do_notify_parent(tsk, signal);
930 */
931 if (!task_detached(tsk) && thread_group_empty(tsk)) {
932 int signal = ptrace_reparented(tsk) ?
933 SIGCHLD : tsk->exit_signal;
934 do_notify_parent(tsk, signal);
935 } else if (tsk->ptrace) {
936 do_notify_parent(tsk, SIGCHLD);
937 }
938 929
939 state = EXIT_ZOMBIE; 930 tsk->exit_state = signal < 0 ? EXIT_DEAD : EXIT_ZOMBIE;
940 if (task_detached(tsk) && likely(!tsk->ptrace))
941 state = EXIT_DEAD;
942 tsk->exit_state = state;
943 931
944 /* mt-exec, de_thread() is waiting for us */ 932 /* mt-exec, de_thread() is waiting for us */
945 if (thread_group_leader(tsk) && 933 if (thread_group_leader(tsk) &&
@@ -949,8 +937,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
949 937
950 write_unlock_irq(&tasklist_lock); 938 write_unlock_irq(&tasklist_lock);
951 939
940 tracehook_report_death(tsk, signal, cookie, group_dead);
941
952 /* If the process is dead, release it - nobody will wait for it */ 942 /* If the process is dead, release it - nobody will wait for it */
953 if (state == EXIT_DEAD) 943 if (signal < 0)
954 release_task(tsk); 944 release_task(tsk);
955} 945}
956 946
@@ -1029,10 +1019,7 @@ NORET_TYPE void do_exit(long code)
1029 if (unlikely(!tsk->pid)) 1019 if (unlikely(!tsk->pid))
1030 panic("Attempted to kill the idle task!"); 1020 panic("Attempted to kill the idle task!");
1031 1021
1032 if (unlikely(current->ptrace & PT_TRACE_EXIT)) { 1022 tracehook_report_exit(&code);
1033 current->ptrace_message = code;
1034 ptrace_notify((PTRACE_EVENT_EXIT << 8) | SIGTRAP);
1035 }
1036 1023
1037 /* 1024 /*
1038 * We're taking recursive faults here in do_exit. Safest is to just 1025 * We're taking recursive faults here in do_exit. Safest is to just
diff --git a/kernel/fork.c b/kernel/fork.c
index b99d73e971a4..abb3ed6298f6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -37,6 +37,7 @@
37#include <linux/swap.h> 37#include <linux/swap.h>
38#include <linux/syscalls.h> 38#include <linux/syscalls.h>
39#include <linux/jiffies.h> 39#include <linux/jiffies.h>
40#include <linux/tracehook.h>
40#include <linux/futex.h> 41#include <linux/futex.h>
41#include <linux/task_io_accounting_ops.h> 42#include <linux/task_io_accounting_ops.h>
42#include <linux/rcupdate.h> 43#include <linux/rcupdate.h>
@@ -865,8 +866,7 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p)
865 866
866 new_flags &= ~PF_SUPERPRIV; 867 new_flags &= ~PF_SUPERPRIV;
867 new_flags |= PF_FORKNOEXEC; 868 new_flags |= PF_FORKNOEXEC;
868 if (!(clone_flags & CLONE_PTRACE)) 869 new_flags |= PF_STARTING;
869 p->ptrace = 0;
870 p->flags = new_flags; 870 p->flags = new_flags;
871 clear_freeze_flag(p); 871 clear_freeze_flag(p);
872} 872}
@@ -907,7 +907,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
907 struct pt_regs *regs, 907 struct pt_regs *regs,
908 unsigned long stack_size, 908 unsigned long stack_size,
909 int __user *child_tidptr, 909 int __user *child_tidptr,
910 struct pid *pid) 910 struct pid *pid,
911 int trace)
911{ 912{
912 int retval; 913 int retval;
913 struct task_struct *p; 914 struct task_struct *p;
@@ -1163,8 +1164,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1163 */ 1164 */
1164 p->group_leader = p; 1165 p->group_leader = p;
1165 INIT_LIST_HEAD(&p->thread_group); 1166 INIT_LIST_HEAD(&p->thread_group);
1166 INIT_LIST_HEAD(&p->ptrace_entry);
1167 INIT_LIST_HEAD(&p->ptraced);
1168 1167
1169 /* Now that the task is set up, run cgroup callbacks if 1168 /* Now that the task is set up, run cgroup callbacks if
1170 * necessary. We need to run them before the task is visible 1169 * necessary. We need to run them before the task is visible
@@ -1195,7 +1194,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1195 p->real_parent = current->real_parent; 1194 p->real_parent = current->real_parent;
1196 else 1195 else
1197 p->real_parent = current; 1196 p->real_parent = current;
1198 p->parent = p->real_parent;
1199 1197
1200 spin_lock(&current->sighand->siglock); 1198 spin_lock(&current->sighand->siglock);
1201 1199
@@ -1237,8 +1235,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1237 1235
1238 if (likely(p->pid)) { 1236 if (likely(p->pid)) {
1239 list_add_tail(&p->sibling, &p->real_parent->children); 1237 list_add_tail(&p->sibling, &p->real_parent->children);
1240 if (unlikely(p->ptrace & PT_PTRACED)) 1238 tracehook_finish_clone(p, clone_flags, trace);
1241 __ptrace_link(p, current->parent);
1242 1239
1243 if (thread_group_leader(p)) { 1240 if (thread_group_leader(p)) {
1244 if (clone_flags & CLONE_NEWPID) 1241 if (clone_flags & CLONE_NEWPID)
@@ -1323,29 +1320,13 @@ struct task_struct * __cpuinit fork_idle(int cpu)
1323 struct pt_regs regs; 1320 struct pt_regs regs;
1324 1321
1325 task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, 1322 task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL,
1326 &init_struct_pid); 1323 &init_struct_pid, 0);
1327 if (!IS_ERR(task)) 1324 if (!IS_ERR(task))
1328 init_idle(task, cpu); 1325 init_idle(task, cpu);
1329 1326
1330 return task; 1327 return task;
1331} 1328}
1332 1329
1333static int fork_traceflag(unsigned clone_flags)
1334{
1335 if (clone_flags & CLONE_UNTRACED)
1336 return 0;
1337 else if (clone_flags & CLONE_VFORK) {
1338 if (current->ptrace & PT_TRACE_VFORK)
1339 return PTRACE_EVENT_VFORK;
1340 } else if ((clone_flags & CSIGNAL) != SIGCHLD) {
1341 if (current->ptrace & PT_TRACE_CLONE)
1342 return PTRACE_EVENT_CLONE;
1343 } else if (current->ptrace & PT_TRACE_FORK)
1344 return PTRACE_EVENT_FORK;
1345
1346 return 0;
1347}
1348
1349/* 1330/*
1350 * Ok, this is the main fork-routine. 1331 * Ok, this is the main fork-routine.
1351 * 1332 *
@@ -1380,14 +1361,14 @@ long do_fork(unsigned long clone_flags,
1380 } 1361 }
1381 } 1362 }
1382 1363
1383 if (unlikely(current->ptrace)) { 1364 /*
1384 trace = fork_traceflag (clone_flags); 1365 * When called from kernel_thread, don't do user tracing stuff.
1385 if (trace) 1366 */
1386 clone_flags |= CLONE_PTRACE; 1367 if (likely(user_mode(regs)))
1387 } 1368 trace = tracehook_prepare_clone(clone_flags);
1388 1369
1389 p = copy_process(clone_flags, stack_start, regs, stack_size, 1370 p = copy_process(clone_flags, stack_start, regs, stack_size,
1390 child_tidptr, NULL); 1371 child_tidptr, NULL, trace);
1391 /* 1372 /*
1392 * Do this prior waking up the new thread - the thread pointer 1373 * Do this prior waking up the new thread - the thread pointer
1393 * might get invalid after that point, if the thread exits quickly. 1374 * might get invalid after that point, if the thread exits quickly.
@@ -1405,32 +1386,35 @@ long do_fork(unsigned long clone_flags,
1405 init_completion(&vfork); 1386 init_completion(&vfork);
1406 } 1387 }
1407 1388
1408 if ((p->ptrace & PT_PTRACED) || (clone_flags & CLONE_STOPPED)) { 1389 tracehook_report_clone(trace, regs, clone_flags, nr, p);
1390
1391 /*
1392 * We set PF_STARTING at creation in case tracing wants to
1393 * use this to distinguish a fully live task from one that
1394 * hasn't gotten to tracehook_report_clone() yet. Now we
1395 * clear it and set the child going.
1396 */
1397 p->flags &= ~PF_STARTING;
1398
1399 if (unlikely(clone_flags & CLONE_STOPPED)) {
1409 /* 1400 /*
1410 * We'll start up with an immediate SIGSTOP. 1401 * We'll start up with an immediate SIGSTOP.
1411 */ 1402 */
1412 sigaddset(&p->pending.signal, SIGSTOP); 1403 sigaddset(&p->pending.signal, SIGSTOP);
1413 set_tsk_thread_flag(p, TIF_SIGPENDING); 1404 set_tsk_thread_flag(p, TIF_SIGPENDING);
1414 }
1415
1416 if (!(clone_flags & CLONE_STOPPED))
1417 wake_up_new_task(p, clone_flags);
1418 else
1419 __set_task_state(p, TASK_STOPPED); 1405 __set_task_state(p, TASK_STOPPED);
1420 1406 } else {
1421 if (unlikely (trace)) { 1407 wake_up_new_task(p, clone_flags);
1422 current->ptrace_message = nr;
1423 ptrace_notify ((trace << 8) | SIGTRAP);
1424 } 1408 }
1425 1409
1410 tracehook_report_clone_complete(trace, regs,
1411 clone_flags, nr, p);
1412
1426 if (clone_flags & CLONE_VFORK) { 1413 if (clone_flags & CLONE_VFORK) {
1427 freezer_do_not_count(); 1414 freezer_do_not_count();
1428 wait_for_completion(&vfork); 1415 wait_for_completion(&vfork);
1429 freezer_count(); 1416 freezer_count();
1430 if (unlikely (current->ptrace & PT_TRACE_VFORK_DONE)) { 1417 tracehook_report_vfork_done(p, nr);
1431 current->ptrace_message = nr;
1432 ptrace_notify ((PTRACE_EVENT_VFORK_DONE << 8) | SIGTRAP);
1433 }
1434 } 1418 }
1435 } else { 1419 } else {
1436 nr = PTR_ERR(p); 1420 nr = PTR_ERR(p);
@@ -1442,7 +1426,7 @@ long do_fork(unsigned long clone_flags,
1442#define ARCH_MIN_MMSTRUCT_ALIGN 0 1426#define ARCH_MIN_MMSTRUCT_ALIGN 0
1443#endif 1427#endif
1444 1428
1445static void sighand_ctor(struct kmem_cache *cachep, void *data) 1429static void sighand_ctor(void *data)
1446{ 1430{
1447 struct sighand_struct *sighand = data; 1431 struct sighand_struct *sighand = data;
1448 1432
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 964964baefa2..3cd441ebf5d2 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -28,8 +28,7 @@ void dynamic_irq_init(unsigned int irq)
28 unsigned long flags; 28 unsigned long flags;
29 29
30 if (irq >= NR_IRQS) { 30 if (irq >= NR_IRQS) {
31 printk(KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); 31 WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq);
32 WARN_ON(1);
33 return; 32 return;
34 } 33 }
35 34
@@ -62,8 +61,7 @@ void dynamic_irq_cleanup(unsigned int irq)
62 unsigned long flags; 61 unsigned long flags;
63 62
64 if (irq >= NR_IRQS) { 63 if (irq >= NR_IRQS) {
65 printk(KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); 64 WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq);
66 WARN_ON(1);
67 return; 65 return;
68 } 66 }
69 67
@@ -71,9 +69,8 @@ void dynamic_irq_cleanup(unsigned int irq)
71 spin_lock_irqsave(&desc->lock, flags); 69 spin_lock_irqsave(&desc->lock, flags);
72 if (desc->action) { 70 if (desc->action) {
73 spin_unlock_irqrestore(&desc->lock, flags); 71 spin_unlock_irqrestore(&desc->lock, flags);
74 printk(KERN_ERR "Destroying IRQ%d without calling free_irq\n", 72 WARN(1, KERN_ERR "Destroying IRQ%d without calling free_irq\n",
75 irq); 73 irq);
76 WARN_ON(1);
77 return; 74 return;
78 } 75 }
79 desc->msi_desc = NULL; 76 desc->msi_desc = NULL;
@@ -96,8 +93,7 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)
96 unsigned long flags; 93 unsigned long flags;
97 94
98 if (irq >= NR_IRQS) { 95 if (irq >= NR_IRQS) {
99 printk(KERN_ERR "Trying to install chip for IRQ%d\n", irq); 96 WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq);
100 WARN_ON(1);
101 return -EINVAL; 97 return -EINVAL;
102 } 98 }
103 99
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index f8914b92b664..152abfd3589f 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -177,8 +177,7 @@ static void __enable_irq(struct irq_desc *desc, unsigned int irq)
177{ 177{
178 switch (desc->depth) { 178 switch (desc->depth) {
179 case 0: 179 case 0:
180 printk(KERN_WARNING "Unbalanced enable for IRQ %d\n", irq); 180 WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n", irq);
181 WARN_ON(1);
182 break; 181 break;
183 case 1: { 182 case 1: {
184 unsigned int status = desc->status & ~IRQ_DISABLED; 183 unsigned int status = desc->status & ~IRQ_DISABLED;
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 1c5fcacbcf33..c8a4370e2a34 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -24,6 +24,12 @@
24#include <linux/utsrelease.h> 24#include <linux/utsrelease.h>
25#include <linux/utsname.h> 25#include <linux/utsname.h>
26#include <linux/numa.h> 26#include <linux/numa.h>
27#include <linux/suspend.h>
28#include <linux/device.h>
29#include <linux/freezer.h>
30#include <linux/pm.h>
31#include <linux/cpu.h>
32#include <linux/console.h>
27 33
28#include <asm/page.h> 34#include <asm/page.h>
29#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -242,6 +248,12 @@ static int kimage_normal_alloc(struct kimage **rimage, unsigned long entry,
242 goto out; 248 goto out;
243 } 249 }
244 250
251 image->swap_page = kimage_alloc_control_pages(image, 0);
252 if (!image->swap_page) {
253 printk(KERN_ERR "Could not allocate swap buffer\n");
254 goto out;
255 }
256
245 result = 0; 257 result = 0;
246 out: 258 out:
247 if (result == 0) 259 if (result == 0)
@@ -589,14 +601,12 @@ static void kimage_free_extra_pages(struct kimage *image)
589 kimage_free_page_list(&image->unuseable_pages); 601 kimage_free_page_list(&image->unuseable_pages);
590 602
591} 603}
592static int kimage_terminate(struct kimage *image) 604static void kimage_terminate(struct kimage *image)
593{ 605{
594 if (*image->entry != 0) 606 if (*image->entry != 0)
595 image->entry++; 607 image->entry++;
596 608
597 *image->entry = IND_DONE; 609 *image->entry = IND_DONE;
598
599 return 0;
600} 610}
601 611
602#define for_each_kimage_entry(image, ptr, entry) \ 612#define for_each_kimage_entry(image, ptr, entry) \
@@ -988,6 +998,8 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
988 if (result) 998 if (result)
989 goto out; 999 goto out;
990 1000
1001 if (flags & KEXEC_PRESERVE_CONTEXT)
1002 image->preserve_context = 1;
991 result = machine_kexec_prepare(image); 1003 result = machine_kexec_prepare(image);
992 if (result) 1004 if (result)
993 goto out; 1005 goto out;
@@ -997,9 +1009,7 @@ asmlinkage long sys_kexec_load(unsigned long entry, unsigned long nr_segments,
997 if (result) 1009 if (result)
998 goto out; 1010 goto out;
999 } 1011 }
1000 result = kimage_terminate(image); 1012 kimage_terminate(image);
1001 if (result)
1002 goto out;
1003 } 1013 }
1004 /* Install the new kernel, and Uninstall the old */ 1014 /* Install the new kernel, and Uninstall the old */
1005 image = xchg(dest_image, image); 1015 image = xchg(dest_image, image);
@@ -1415,3 +1425,85 @@ static int __init crash_save_vmcoreinfo_init(void)
1415} 1425}
1416 1426
1417module_init(crash_save_vmcoreinfo_init) 1427module_init(crash_save_vmcoreinfo_init)
1428
1429/**
1430 * kernel_kexec - reboot the system
1431 *
1432 * Move into place and start executing a preloaded standalone
1433 * executable. If nothing was preloaded return an error.
1434 */
1435int kernel_kexec(void)
1436{
1437 int error = 0;
1438
1439 if (xchg(&kexec_lock, 1))
1440 return -EBUSY;
1441 if (!kexec_image) {
1442 error = -EINVAL;
1443 goto Unlock;
1444 }
1445
1446 if (kexec_image->preserve_context) {
1447#ifdef CONFIG_KEXEC_JUMP
1448 mutex_lock(&pm_mutex);
1449 pm_prepare_console();
1450 error = freeze_processes();
1451 if (error) {
1452 error = -EBUSY;
1453 goto Restore_console;
1454 }
1455 suspend_console();
1456 error = device_suspend(PMSG_FREEZE);
1457 if (error)
1458 goto Resume_console;
1459 error = disable_nonboot_cpus();
1460 if (error)
1461 goto Resume_devices;
1462 local_irq_disable();
1463 /* At this point, device_suspend() has been called,
1464 * but *not* device_power_down(). We *must*
1465 * device_power_down() now. Otherwise, drivers for
1466 * some devices (e.g. interrupt controllers) become
1467 * desynchronized with the actual state of the
1468 * hardware at resume time, and evil weirdness ensues.
1469 */
1470 error = device_power_down(PMSG_FREEZE);
1471 if (error)
1472 goto Enable_irqs;
1473 save_processor_state();
1474#endif
1475 } else {
1476 blocking_notifier_call_chain(&reboot_notifier_list,
1477 SYS_RESTART, NULL);
1478 system_state = SYSTEM_RESTART;
1479 device_shutdown();
1480 sysdev_shutdown();
1481 printk(KERN_EMERG "Starting new kernel\n");
1482 machine_shutdown();
1483 }
1484
1485 machine_kexec(kexec_image);
1486
1487 if (kexec_image->preserve_context) {
1488#ifdef CONFIG_KEXEC_JUMP
1489 restore_processor_state();
1490 device_power_up(PMSG_RESTORE);
1491 Enable_irqs:
1492 local_irq_enable();
1493 enable_nonboot_cpus();
1494 Resume_devices:
1495 device_resume(PMSG_RESTORE);
1496 Resume_console:
1497 resume_console();
1498 thaw_processes();
1499 Restore_console:
1500 pm_restore_console();
1501 mutex_unlock(&pm_mutex);
1502#endif
1503 }
1504
1505 Unlock:
1506 xchg(&kexec_lock, 0);
1507
1508 return error;
1509}
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 6111c27491b1..96cff2f8710b 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -176,7 +176,7 @@ void kthread_bind(struct task_struct *k, unsigned int cpu)
176 return; 176 return;
177 } 177 }
178 /* Must have done schedule() in kthread() before we set_task_cpu */ 178 /* Must have done schedule() in kthread() before we set_task_cpu */
179 wait_task_inactive(k); 179 wait_task_inactive(k, 0);
180 set_task_cpu(k, cpu); 180 set_task_cpu(k, cpu);
181 k->cpus_allowed = cpumask_of_cpu(cpu); 181 k->cpus_allowed = cpumask_of_cpu(cpu);
182 k->rt.nr_cpus_allowed = 1; 182 k->rt.nr_cpus_allowed = 1;
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 95bff23ecdaa..0b7476f5d2a6 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -635,6 +635,13 @@ static void __init test_wakealarm(struct rtc_device *rtc, suspend_state_t state)
635 } 635 }
636 if (status < 0) 636 if (status < 0)
637 printk(err_suspend, status); 637 printk(err_suspend, status);
638
639 /* Some platforms can't detect that the alarm triggered the
640 * wakeup, or (accordingly) disable it after it afterwards.
641 * It's supposed to give oneshot behavior; cope.
642 */
643 alm.enabled = false;
644 rtc_set_alarm(rtc, &alm);
638} 645}
639 646
640static int __init has_wakealarm(struct device *dev, void *name_ptr) 647static int __init has_wakealarm(struct device *dev, void *name_ptr)
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 700f44ec8406..acc0c101dbd5 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -53,8 +53,6 @@ extern int hibernation_platform_enter(void);
53 53
54extern int pfn_is_nosave(unsigned long); 54extern int pfn_is_nosave(unsigned long);
55 55
56extern struct mutex pm_mutex;
57
58#define power_attr(_name) \ 56#define power_attr(_name) \
59static struct kobj_attribute _name##_attr = { \ 57static struct kobj_attribute _name##_attr = { \
60 .attr = { \ 58 .attr = { \
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 8392a9da6450..082b3fcb32a0 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -107,7 +107,7 @@ int ptrace_check_attach(struct task_struct *child, int kill)
107 read_unlock(&tasklist_lock); 107 read_unlock(&tasklist_lock);
108 108
109 if (!ret && !kill) 109 if (!ret && !kill)
110 wait_task_inactive(child); 110 ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH;
111 111
112 /* All systems go.. */ 112 /* All systems go.. */
113 return ret; 113 return ret;
diff --git a/kernel/relay.c b/kernel/relay.c
index 7de644cdec43..04006ef970b8 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -407,6 +407,35 @@ void relay_reset(struct rchan *chan)
407} 407}
408EXPORT_SYMBOL_GPL(relay_reset); 408EXPORT_SYMBOL_GPL(relay_reset);
409 409
410static inline void relay_set_buf_dentry(struct rchan_buf *buf,
411 struct dentry *dentry)
412{
413 buf->dentry = dentry;
414 buf->dentry->d_inode->i_size = buf->early_bytes;
415}
416
417static struct dentry *relay_create_buf_file(struct rchan *chan,
418 struct rchan_buf *buf,
419 unsigned int cpu)
420{
421 struct dentry *dentry;
422 char *tmpname;
423
424 tmpname = kzalloc(NAME_MAX + 1, GFP_KERNEL);
425 if (!tmpname)
426 return NULL;
427 snprintf(tmpname, NAME_MAX, "%s%d", chan->base_filename, cpu);
428
429 /* Create file in fs */
430 dentry = chan->cb->create_buf_file(tmpname, chan->parent,
431 S_IRUSR, buf,
432 &chan->is_global);
433
434 kfree(tmpname);
435
436 return dentry;
437}
438
410/* 439/*
411 * relay_open_buf - create a new relay channel buffer 440 * relay_open_buf - create a new relay channel buffer
412 * 441 *
@@ -416,45 +445,34 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
416{ 445{
417 struct rchan_buf *buf = NULL; 446 struct rchan_buf *buf = NULL;
418 struct dentry *dentry; 447 struct dentry *dentry;
419 char *tmpname;
420 448
421 if (chan->is_global) 449 if (chan->is_global)
422 return chan->buf[0]; 450 return chan->buf[0];
423 451
424 tmpname = kzalloc(NAME_MAX + 1, GFP_KERNEL);
425 if (!tmpname)
426 goto end;
427 snprintf(tmpname, NAME_MAX, "%s%d", chan->base_filename, cpu);
428
429 buf = relay_create_buf(chan); 452 buf = relay_create_buf(chan);
430 if (!buf) 453 if (!buf)
431 goto free_name; 454 return NULL;
455
456 if (chan->has_base_filename) {
457 dentry = relay_create_buf_file(chan, buf, cpu);
458 if (!dentry)
459 goto free_buf;
460 relay_set_buf_dentry(buf, dentry);
461 }
432 462
433 buf->cpu = cpu; 463 buf->cpu = cpu;
434 __relay_reset(buf, 1); 464 __relay_reset(buf, 1);
435 465
436 /* Create file in fs */
437 dentry = chan->cb->create_buf_file(tmpname, chan->parent, S_IRUSR,
438 buf, &chan->is_global);
439 if (!dentry)
440 goto free_buf;
441
442 buf->dentry = dentry;
443
444 if(chan->is_global) { 466 if(chan->is_global) {
445 chan->buf[0] = buf; 467 chan->buf[0] = buf;
446 buf->cpu = 0; 468 buf->cpu = 0;
447 } 469 }
448 470
449 goto free_name; 471 return buf;
450 472
451free_buf: 473free_buf:
452 relay_destroy_buf(buf); 474 relay_destroy_buf(buf);
453 buf = NULL; 475 return NULL;
454free_name:
455 kfree(tmpname);
456end:
457 return buf;
458} 476}
459 477
460/** 478/**
@@ -537,8 +555,8 @@ static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb,
537 555
538/** 556/**
539 * relay_open - create a new relay channel 557 * relay_open - create a new relay channel
540 * @base_filename: base name of files to create 558 * @base_filename: base name of files to create, %NULL for buffering only
541 * @parent: dentry of parent directory, %NULL for root directory 559 * @parent: dentry of parent directory, %NULL for root directory or buffer
542 * @subbuf_size: size of sub-buffers 560 * @subbuf_size: size of sub-buffers
543 * @n_subbufs: number of sub-buffers 561 * @n_subbufs: number of sub-buffers
544 * @cb: client callback functions 562 * @cb: client callback functions
@@ -560,8 +578,6 @@ struct rchan *relay_open(const char *base_filename,
560{ 578{
561 unsigned int i; 579 unsigned int i;
562 struct rchan *chan; 580 struct rchan *chan;
563 if (!base_filename)
564 return NULL;
565 581
566 if (!(subbuf_size && n_subbufs)) 582 if (!(subbuf_size && n_subbufs))
567 return NULL; 583 return NULL;
@@ -576,7 +592,10 @@ struct rchan *relay_open(const char *base_filename,
576 chan->alloc_size = FIX_SIZE(subbuf_size * n_subbufs); 592 chan->alloc_size = FIX_SIZE(subbuf_size * n_subbufs);
577 chan->parent = parent; 593 chan->parent = parent;
578 chan->private_data = private_data; 594 chan->private_data = private_data;
579 strlcpy(chan->base_filename, base_filename, NAME_MAX); 595 if (base_filename) {
596 chan->has_base_filename = 1;
597 strlcpy(chan->base_filename, base_filename, NAME_MAX);
598 }
580 setup_callbacks(chan, cb); 599 setup_callbacks(chan, cb);
581 kref_init(&chan->kref); 600 kref_init(&chan->kref);
582 601
@@ -604,6 +623,94 @@ free_bufs:
604} 623}
605EXPORT_SYMBOL_GPL(relay_open); 624EXPORT_SYMBOL_GPL(relay_open);
606 625
626struct rchan_percpu_buf_dispatcher {
627 struct rchan_buf *buf;
628 struct dentry *dentry;
629};
630
631/* Called in atomic context. */
632static void __relay_set_buf_dentry(void *info)
633{
634 struct rchan_percpu_buf_dispatcher *p = info;
635
636 relay_set_buf_dentry(p->buf, p->dentry);
637}
638
639/**
640 * relay_late_setup_files - triggers file creation
641 * @chan: channel to operate on
642 * @base_filename: base name of files to create
643 * @parent: dentry of parent directory, %NULL for root directory
644 *
645 * Returns 0 if successful, non-zero otherwise.
646 *
647 * Use to setup files for a previously buffer-only channel.
648 * Useful to do early tracing in kernel, before VFS is up, for example.
649 */
650int relay_late_setup_files(struct rchan *chan,
651 const char *base_filename,
652 struct dentry *parent)
653{
654 int err = 0;
655 unsigned int i, curr_cpu;
656 unsigned long flags;
657 struct dentry *dentry;
658 struct rchan_percpu_buf_dispatcher disp;
659
660 if (!chan || !base_filename)
661 return -EINVAL;
662
663 strlcpy(chan->base_filename, base_filename, NAME_MAX);
664
665 mutex_lock(&relay_channels_mutex);
666 /* Is chan already set up? */
667 if (unlikely(chan->has_base_filename))
668 return -EEXIST;
669 chan->has_base_filename = 1;
670 chan->parent = parent;
671 curr_cpu = get_cpu();
672 /*
673 * The CPU hotplug notifier ran before us and created buffers with
674 * no files associated. So it's safe to call relay_setup_buf_file()
675 * on all currently online CPUs.
676 */
677 for_each_online_cpu(i) {
678 if (unlikely(!chan->buf[i])) {
679 printk(KERN_ERR "relay_late_setup_files: CPU %u "
680 "has no buffer, it must have!\n", i);
681 BUG();
682 err = -EINVAL;
683 break;
684 }
685
686 dentry = relay_create_buf_file(chan, chan->buf[i], i);
687 if (unlikely(!dentry)) {
688 err = -EINVAL;
689 break;
690 }
691
692 if (curr_cpu == i) {
693 local_irq_save(flags);
694 relay_set_buf_dentry(chan->buf[i], dentry);
695 local_irq_restore(flags);
696 } else {
697 disp.buf = chan->buf[i];
698 disp.dentry = dentry;
699 smp_mb();
700 /* relay_channels_mutex must be held, so wait. */
701 err = smp_call_function_single(i,
702 __relay_set_buf_dentry,
703 &disp, 1);
704 }
705 if (unlikely(err))
706 break;
707 }
708 put_cpu();
709 mutex_unlock(&relay_channels_mutex);
710
711 return err;
712}
713
607/** 714/**
608 * relay_switch_subbuf - switch to a new sub-buffer 715 * relay_switch_subbuf - switch to a new sub-buffer
609 * @buf: channel buffer 716 * @buf: channel buffer
@@ -627,8 +734,13 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)
627 old_subbuf = buf->subbufs_produced % buf->chan->n_subbufs; 734 old_subbuf = buf->subbufs_produced % buf->chan->n_subbufs;
628 buf->padding[old_subbuf] = buf->prev_padding; 735 buf->padding[old_subbuf] = buf->prev_padding;
629 buf->subbufs_produced++; 736 buf->subbufs_produced++;
630 buf->dentry->d_inode->i_size += buf->chan->subbuf_size - 737 if (buf->dentry)
631 buf->padding[old_subbuf]; 738 buf->dentry->d_inode->i_size +=
739 buf->chan->subbuf_size -
740 buf->padding[old_subbuf];
741 else
742 buf->early_bytes += buf->chan->subbuf_size -
743 buf->padding[old_subbuf];
632 smp_mb(); 744 smp_mb();
633 if (waitqueue_active(&buf->read_wait)) 745 if (waitqueue_active(&buf->read_wait))
634 /* 746 /*
@@ -1237,4 +1349,4 @@ static __init int relay_init(void)
1237 return 0; 1349 return 0;
1238} 1350}
1239 1351
1240module_init(relay_init); 1352early_initcall(relay_init);
diff --git a/kernel/sched.c b/kernel/sched.c
index 0047bd9b96aa..0236958addcb 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1867,16 +1867,24 @@ migrate_task(struct task_struct *p, int dest_cpu, struct migration_req *req)
1867/* 1867/*
1868 * wait_task_inactive - wait for a thread to unschedule. 1868 * wait_task_inactive - wait for a thread to unschedule.
1869 * 1869 *
1870 * If @match_state is nonzero, it's the @p->state value just checked and
1871 * not expected to change. If it changes, i.e. @p might have woken up,
1872 * then return zero. When we succeed in waiting for @p to be off its CPU,
1873 * we return a positive number (its total switch count). If a second call
1874 * a short while later returns the same number, the caller can be sure that
1875 * @p has remained unscheduled the whole time.
1876 *
1870 * The caller must ensure that the task *will* unschedule sometime soon, 1877 * The caller must ensure that the task *will* unschedule sometime soon,
1871 * else this function might spin for a *long* time. This function can't 1878 * else this function might spin for a *long* time. This function can't
1872 * be called with interrupts off, or it may introduce deadlock with 1879 * be called with interrupts off, or it may introduce deadlock with
1873 * smp_call_function() if an IPI is sent by the same process we are 1880 * smp_call_function() if an IPI is sent by the same process we are
1874 * waiting to become inactive. 1881 * waiting to become inactive.
1875 */ 1882 */
1876void wait_task_inactive(struct task_struct *p) 1883unsigned long wait_task_inactive(struct task_struct *p, long match_state)
1877{ 1884{
1878 unsigned long flags; 1885 unsigned long flags;
1879 int running, on_rq; 1886 int running, on_rq;
1887 unsigned long ncsw;
1880 struct rq *rq; 1888 struct rq *rq;
1881 1889
1882 for (;;) { 1890 for (;;) {
@@ -1899,8 +1907,11 @@ void wait_task_inactive(struct task_struct *p)
1899 * return false if the runqueue has changed and p 1907 * return false if the runqueue has changed and p
1900 * is actually now running somewhere else! 1908 * is actually now running somewhere else!
1901 */ 1909 */
1902 while (task_running(rq, p)) 1910 while (task_running(rq, p)) {
1911 if (match_state && unlikely(p->state != match_state))
1912 return 0;
1903 cpu_relax(); 1913 cpu_relax();
1914 }
1904 1915
1905 /* 1916 /*
1906 * Ok, time to look more closely! We need the rq 1917 * Ok, time to look more closely! We need the rq
@@ -1910,9 +1921,21 @@ void wait_task_inactive(struct task_struct *p)
1910 rq = task_rq_lock(p, &flags); 1921 rq = task_rq_lock(p, &flags);
1911 running = task_running(rq, p); 1922 running = task_running(rq, p);
1912 on_rq = p->se.on_rq; 1923 on_rq = p->se.on_rq;
1924 ncsw = 0;
1925 if (!match_state || p->state == match_state) {
1926 ncsw = p->nivcsw + p->nvcsw;
1927 if (unlikely(!ncsw))
1928 ncsw = 1;
1929 }
1913 task_rq_unlock(rq, &flags); 1930 task_rq_unlock(rq, &flags);
1914 1931
1915 /* 1932 /*
1933 * If it changed from the expected state, bail out now.
1934 */
1935 if (unlikely(!ncsw))
1936 break;
1937
1938 /*
1916 * Was it really running after all now that we 1939 * Was it really running after all now that we
1917 * checked with the proper locks actually held? 1940 * checked with the proper locks actually held?
1918 * 1941 *
@@ -1944,6 +1967,8 @@ void wait_task_inactive(struct task_struct *p)
1944 */ 1967 */
1945 break; 1968 break;
1946 } 1969 }
1970
1971 return ncsw;
1947} 1972}
1948 1973
1949/*** 1974/***
@@ -6389,7 +6414,7 @@ static struct notifier_block __cpuinitdata migration_notifier = {
6389 .priority = 10 6414 .priority = 10
6390}; 6415};
6391 6416
6392void __init migration_init(void) 6417static int __init migration_init(void)
6393{ 6418{
6394 void *cpu = (void *)(long)smp_processor_id(); 6419 void *cpu = (void *)(long)smp_processor_id();
6395 int err; 6420 int err;
@@ -6399,7 +6424,10 @@ void __init migration_init(void)
6399 BUG_ON(err == NOTIFY_BAD); 6424 BUG_ON(err == NOTIFY_BAD);
6400 migration_call(&migration_notifier, CPU_ONLINE, cpu); 6425 migration_call(&migration_notifier, CPU_ONLINE, cpu);
6401 register_cpu_notifier(&migration_notifier); 6426 register_cpu_notifier(&migration_notifier);
6427
6428 return err;
6402} 6429}
6430early_initcall(migration_init);
6403#endif 6431#endif
6404 6432
6405#ifdef CONFIG_SMP 6433#ifdef CONFIG_SMP
diff --git a/kernel/signal.c b/kernel/signal.c
index 82c3545596c5..954f77d7e3bc 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -22,6 +22,7 @@
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/signal.h> 23#include <linux/signal.h>
24#include <linux/signalfd.h> 24#include <linux/signalfd.h>
25#include <linux/tracehook.h>
25#include <linux/capability.h> 26#include <linux/capability.h>
26#include <linux/freezer.h> 27#include <linux/freezer.h>
27#include <linux/pid_namespace.h> 28#include <linux/pid_namespace.h>
@@ -39,24 +40,21 @@
39 40
40static struct kmem_cache *sigqueue_cachep; 41static struct kmem_cache *sigqueue_cachep;
41 42
42static int __sig_ignored(struct task_struct *t, int sig) 43static void __user *sig_handler(struct task_struct *t, int sig)
43{ 44{
44 void __user *handler; 45 return t->sighand->action[sig - 1].sa.sa_handler;
46}
45 47
48static int sig_handler_ignored(void __user *handler, int sig)
49{
46 /* Is it explicitly or implicitly ignored? */ 50 /* Is it explicitly or implicitly ignored? */
47
48 handler = t->sighand->action[sig - 1].sa.sa_handler;
49 return handler == SIG_IGN || 51 return handler == SIG_IGN ||
50 (handler == SIG_DFL && sig_kernel_ignore(sig)); 52 (handler == SIG_DFL && sig_kernel_ignore(sig));
51} 53}
52 54
53static int sig_ignored(struct task_struct *t, int sig) 55static int sig_ignored(struct task_struct *t, int sig)
54{ 56{
55 /* 57 void __user *handler;
56 * Tracers always want to know about signals..
57 */
58 if (t->ptrace & PT_PTRACED)
59 return 0;
60 58
61 /* 59 /*
62 * Blocked signals are never ignored, since the 60 * Blocked signals are never ignored, since the
@@ -66,7 +64,14 @@ static int sig_ignored(struct task_struct *t, int sig)
66 if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) 64 if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig))
67 return 0; 65 return 0;
68 66
69 return __sig_ignored(t, sig); 67 handler = sig_handler(t, sig);
68 if (!sig_handler_ignored(handler, sig))
69 return 0;
70
71 /*
72 * Tracers may want to know about even ignored signals.
73 */
74 return !tracehook_consider_ignored_signal(t, sig, handler);
70} 75}
71 76
72/* 77/*
@@ -129,7 +134,9 @@ void recalc_sigpending_and_wake(struct task_struct *t)
129 134
130void recalc_sigpending(void) 135void recalc_sigpending(void)
131{ 136{
132 if (!recalc_sigpending_tsk(current) && !freezing(current)) 137 if (unlikely(tracehook_force_sigpending()))
138 set_thread_flag(TIF_SIGPENDING);
139 else if (!recalc_sigpending_tsk(current) && !freezing(current))
133 clear_thread_flag(TIF_SIGPENDING); 140 clear_thread_flag(TIF_SIGPENDING);
134 141
135} 142}
@@ -295,12 +302,12 @@ flush_signal_handlers(struct task_struct *t, int force_default)
295 302
296int unhandled_signal(struct task_struct *tsk, int sig) 303int unhandled_signal(struct task_struct *tsk, int sig)
297{ 304{
305 void __user *handler = tsk->sighand->action[sig-1].sa.sa_handler;
298 if (is_global_init(tsk)) 306 if (is_global_init(tsk))
299 return 1; 307 return 1;
300 if (tsk->ptrace & PT_PTRACED) 308 if (handler != SIG_IGN && handler != SIG_DFL)
301 return 0; 309 return 0;
302 return (tsk->sighand->action[sig-1].sa.sa_handler == SIG_IGN) || 310 return !tracehook_consider_fatal_signal(tsk, sig, handler);
303 (tsk->sighand->action[sig-1].sa.sa_handler == SIG_DFL);
304} 311}
305 312
306 313
@@ -591,9 +598,6 @@ static int check_kill_permission(int sig, struct siginfo *info,
591 return security_task_kill(t, info, sig, 0); 598 return security_task_kill(t, info, sig, 0);
592} 599}
593 600
594/* forward decl */
595static void do_notify_parent_cldstop(struct task_struct *tsk, int why);
596
597/* 601/*
598 * Handle magic process-wide effects of stop/continue signals. Unlike 602 * Handle magic process-wide effects of stop/continue signals. Unlike
599 * the signal actions, these happen immediately at signal-generation 603 * the signal actions, these happen immediately at signal-generation
@@ -756,7 +760,8 @@ static void complete_signal(int sig, struct task_struct *p, int group)
756 if (sig_fatal(p, sig) && 760 if (sig_fatal(p, sig) &&
757 !(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) && 761 !(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) &&
758 !sigismember(&t->real_blocked, sig) && 762 !sigismember(&t->real_blocked, sig) &&
759 (sig == SIGKILL || !(t->ptrace & PT_PTRACED))) { 763 (sig == SIGKILL ||
764 !tracehook_consider_fatal_signal(t, sig, SIG_DFL))) {
760 /* 765 /*
761 * This signal will be fatal to the whole group. 766 * This signal will be fatal to the whole group.
762 */ 767 */
@@ -1323,9 +1328,11 @@ static inline void __wake_up_parent(struct task_struct *p,
1323/* 1328/*
1324 * Let a parent know about the death of a child. 1329 * Let a parent know about the death of a child.
1325 * For a stopped/continued status change, use do_notify_parent_cldstop instead. 1330 * For a stopped/continued status change, use do_notify_parent_cldstop instead.
1331 *
1332 * Returns -1 if our parent ignored us and so we've switched to
1333 * self-reaping, or else @sig.
1326 */ 1334 */
1327 1335int do_notify_parent(struct task_struct *tsk, int sig)
1328void do_notify_parent(struct task_struct *tsk, int sig)
1329{ 1336{
1330 struct siginfo info; 1337 struct siginfo info;
1331 unsigned long flags; 1338 unsigned long flags;
@@ -1396,12 +1403,14 @@ void do_notify_parent(struct task_struct *tsk, int sig)
1396 */ 1403 */
1397 tsk->exit_signal = -1; 1404 tsk->exit_signal = -1;
1398 if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) 1405 if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
1399 sig = 0; 1406 sig = -1;
1400 } 1407 }
1401 if (valid_signal(sig) && sig > 0) 1408 if (valid_signal(sig) && sig > 0)
1402 __group_send_sig_info(sig, &info, tsk->parent); 1409 __group_send_sig_info(sig, &info, tsk->parent);
1403 __wake_up_parent(tsk, tsk->parent); 1410 __wake_up_parent(tsk, tsk->parent);
1404 spin_unlock_irqrestore(&psig->siglock, flags); 1411 spin_unlock_irqrestore(&psig->siglock, flags);
1412
1413 return sig;
1405} 1414}
1406 1415
1407static void do_notify_parent_cldstop(struct task_struct *tsk, int why) 1416static void do_notify_parent_cldstop(struct task_struct *tsk, int why)
@@ -1599,7 +1608,7 @@ finish_stop(int stop_count)
1599 * a group stop in progress and we are the last to stop, 1608 * a group stop in progress and we are the last to stop,
1600 * report to the parent. When ptraced, every thread reports itself. 1609 * report to the parent. When ptraced, every thread reports itself.
1601 */ 1610 */
1602 if (stop_count == 0 || (current->ptrace & PT_PTRACED)) { 1611 if (tracehook_notify_jctl(stop_count == 0, CLD_STOPPED)) {
1603 read_lock(&tasklist_lock); 1612 read_lock(&tasklist_lock);
1604 do_notify_parent_cldstop(current, CLD_STOPPED); 1613 do_notify_parent_cldstop(current, CLD_STOPPED);
1605 read_unlock(&tasklist_lock); 1614 read_unlock(&tasklist_lock);
@@ -1735,6 +1744,9 @@ relock:
1735 signal->flags &= ~SIGNAL_CLD_MASK; 1744 signal->flags &= ~SIGNAL_CLD_MASK;
1736 spin_unlock_irq(&sighand->siglock); 1745 spin_unlock_irq(&sighand->siglock);
1737 1746
1747 if (unlikely(!tracehook_notify_jctl(1, why)))
1748 goto relock;
1749
1738 read_lock(&tasklist_lock); 1750 read_lock(&tasklist_lock);
1739 do_notify_parent_cldstop(current->group_leader, why); 1751 do_notify_parent_cldstop(current->group_leader, why);
1740 read_unlock(&tasklist_lock); 1752 read_unlock(&tasklist_lock);
@@ -1748,17 +1760,33 @@ relock:
1748 do_signal_stop(0)) 1760 do_signal_stop(0))
1749 goto relock; 1761 goto relock;
1750 1762
1751 signr = dequeue_signal(current, &current->blocked, info); 1763 /*
1752 if (!signr) 1764 * Tracing can induce an artifical signal and choose sigaction.
1753 break; /* will return 0 */ 1765 * The return value in @signr determines the default action,
1766 * but @info->si_signo is the signal number we will report.
1767 */
1768 signr = tracehook_get_signal(current, regs, info, return_ka);
1769 if (unlikely(signr < 0))
1770 goto relock;
1771 if (unlikely(signr != 0))
1772 ka = return_ka;
1773 else {
1774 signr = dequeue_signal(current, &current->blocked,
1775 info);
1754 1776
1755 if (signr != SIGKILL) {
1756 signr = ptrace_signal(signr, info, regs, cookie);
1757 if (!signr) 1777 if (!signr)
1758 continue; 1778 break; /* will return 0 */
1779
1780 if (signr != SIGKILL) {
1781 signr = ptrace_signal(signr, info,
1782 regs, cookie);
1783 if (!signr)
1784 continue;
1785 }
1786
1787 ka = &sighand->action[signr-1];
1759 } 1788 }
1760 1789
1761 ka = &sighand->action[signr-1];
1762 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */ 1790 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */
1763 continue; 1791 continue;
1764 if (ka->sa.sa_handler != SIG_DFL) { 1792 if (ka->sa.sa_handler != SIG_DFL) {
@@ -1806,7 +1834,7 @@ relock:
1806 spin_lock_irq(&sighand->siglock); 1834 spin_lock_irq(&sighand->siglock);
1807 } 1835 }
1808 1836
1809 if (likely(do_signal_stop(signr))) { 1837 if (likely(do_signal_stop(info->si_signo))) {
1810 /* It released the siglock. */ 1838 /* It released the siglock. */
1811 goto relock; 1839 goto relock;
1812 } 1840 }
@@ -1827,7 +1855,7 @@ relock:
1827 1855
1828 if (sig_kernel_coredump(signr)) { 1856 if (sig_kernel_coredump(signr)) {
1829 if (print_fatal_signals) 1857 if (print_fatal_signals)
1830 print_fatal_signal(regs, signr); 1858 print_fatal_signal(regs, info->si_signo);
1831 /* 1859 /*
1832 * If it was able to dump core, this kills all 1860 * If it was able to dump core, this kills all
1833 * other threads in the group and synchronizes with 1861 * other threads in the group and synchronizes with
@@ -1836,13 +1864,13 @@ relock:
1836 * first and our do_group_exit call below will use 1864 * first and our do_group_exit call below will use
1837 * that value and ignore the one we pass it. 1865 * that value and ignore the one we pass it.
1838 */ 1866 */
1839 do_coredump((long)signr, signr, regs); 1867 do_coredump(info->si_signo, info->si_signo, regs);
1840 } 1868 }
1841 1869
1842 /* 1870 /*
1843 * Death signals, no core dump. 1871 * Death signals, no core dump.
1844 */ 1872 */
1845 do_group_exit(signr); 1873 do_group_exit(info->si_signo);
1846 /* NOTREACHED */ 1874 /* NOTREACHED */
1847 } 1875 }
1848 spin_unlock_irq(&sighand->siglock); 1876 spin_unlock_irq(&sighand->siglock);
@@ -1884,7 +1912,7 @@ void exit_signals(struct task_struct *tsk)
1884out: 1912out:
1885 spin_unlock_irq(&tsk->sighand->siglock); 1913 spin_unlock_irq(&tsk->sighand->siglock);
1886 1914
1887 if (unlikely(group_stop)) { 1915 if (unlikely(group_stop) && tracehook_notify_jctl(1, CLD_STOPPED)) {
1888 read_lock(&tasklist_lock); 1916 read_lock(&tasklist_lock);
1889 do_notify_parent_cldstop(tsk, CLD_STOPPED); 1917 do_notify_parent_cldstop(tsk, CLD_STOPPED);
1890 read_unlock(&tasklist_lock); 1918 read_unlock(&tasklist_lock);
@@ -1895,7 +1923,6 @@ EXPORT_SYMBOL(recalc_sigpending);
1895EXPORT_SYMBOL_GPL(dequeue_signal); 1923EXPORT_SYMBOL_GPL(dequeue_signal);
1896EXPORT_SYMBOL(flush_signals); 1924EXPORT_SYMBOL(flush_signals);
1897EXPORT_SYMBOL(force_sig); 1925EXPORT_SYMBOL(force_sig);
1898EXPORT_SYMBOL(ptrace_notify);
1899EXPORT_SYMBOL(send_sig); 1926EXPORT_SYMBOL(send_sig);
1900EXPORT_SYMBOL(send_sig_info); 1927EXPORT_SYMBOL(send_sig_info);
1901EXPORT_SYMBOL(sigprocmask); 1928EXPORT_SYMBOL(sigprocmask);
@@ -2299,7 +2326,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
2299 * (for example, SIGCHLD), shall cause the pending signal to 2326 * (for example, SIGCHLD), shall cause the pending signal to
2300 * be discarded, whether or not it is blocked" 2327 * be discarded, whether or not it is blocked"
2301 */ 2328 */
2302 if (__sig_ignored(t, sig)) { 2329 if (sig_handler_ignored(sig_handler(t, sig), sig)) {
2303 sigemptyset(&mask); 2330 sigemptyset(&mask);
2304 sigaddset(&mask, sig); 2331 sigaddset(&mask, sig);
2305 rm_from_queue_full(&mask, &t->signal->shared_pending); 2332 rm_from_queue_full(&mask, &t->signal->shared_pending);
diff --git a/kernel/smp.c b/kernel/smp.c
index 462c785ca1ee..96fc7c0edc59 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -33,7 +33,7 @@ struct call_single_queue {
33 spinlock_t lock; 33 spinlock_t lock;
34}; 34};
35 35
36void __cpuinit init_call_single_data(void) 36static int __cpuinit init_call_single_data(void)
37{ 37{
38 int i; 38 int i;
39 39
@@ -43,7 +43,9 @@ void __cpuinit init_call_single_data(void)
43 spin_lock_init(&q->lock); 43 spin_lock_init(&q->lock);
44 INIT_LIST_HEAD(&q->list); 44 INIT_LIST_HEAD(&q->list);
45 } 45 }
46 return 0;
46} 47}
48early_initcall(init_call_single_data);
47 49
48static void csd_flag_wait(struct call_single_data *data) 50static void csd_flag_wait(struct call_single_data *data)
49{ 51{
diff --git a/kernel/softirq.c b/kernel/softirq.c
index f6b03d56c2bf..c506f266a6b9 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -630,7 +630,7 @@ static struct notifier_block __cpuinitdata cpu_nfb = {
630 .notifier_call = cpu_callback 630 .notifier_call = cpu_callback
631}; 631};
632 632
633__init int spawn_ksoftirqd(void) 633static __init int spawn_ksoftirqd(void)
634{ 634{
635 void *cpu = (void *)(long)smp_processor_id(); 635 void *cpu = (void *)(long)smp_processor_id();
636 int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); 636 int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
@@ -640,6 +640,7 @@ __init int spawn_ksoftirqd(void)
640 register_cpu_notifier(&cpu_nfb); 640 register_cpu_notifier(&cpu_nfb);
641 return 0; 641 return 0;
642} 642}
643early_initcall(spawn_ksoftirqd);
643 644
644#ifdef CONFIG_SMP 645#ifdef CONFIG_SMP
645/* 646/*
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index 7bd8d1aadd5d..b75b492fbfcf 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -338,14 +338,33 @@ static struct notifier_block __cpuinitdata cpu_nfb = {
338 .notifier_call = cpu_callback 338 .notifier_call = cpu_callback
339}; 339};
340 340
341__init void spawn_softlockup_task(void) 341static int __initdata nosoftlockup;
342
343static int __init nosoftlockup_setup(char *str)
344{
345 nosoftlockup = 1;
346 return 1;
347}
348__setup("nosoftlockup", nosoftlockup_setup);
349
350static int __init spawn_softlockup_task(void)
342{ 351{
343 void *cpu = (void *)(long)smp_processor_id(); 352 void *cpu = (void *)(long)smp_processor_id();
344 int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); 353 int err;
345 354
346 BUG_ON(err == NOTIFY_BAD); 355 if (nosoftlockup)
356 return 0;
357
358 err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu);
359 if (err == NOTIFY_BAD) {
360 BUG();
361 return 1;
362 }
347 cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); 363 cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
348 register_cpu_notifier(&cpu_nfb); 364 register_cpu_notifier(&cpu_nfb);
349 365
350 atomic_notifier_chain_register(&panic_notifier_list, &panic_block); 366 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
367
368 return 0;
351} 369}
370early_initcall(spawn_softlockup_task);
diff --git a/kernel/sys.c b/kernel/sys.c
index 0c9d3fa1f5ff..c01858090a98 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -301,26 +301,6 @@ void kernel_restart(char *cmd)
301} 301}
302EXPORT_SYMBOL_GPL(kernel_restart); 302EXPORT_SYMBOL_GPL(kernel_restart);
303 303
304/**
305 * kernel_kexec - reboot the system
306 *
307 * Move into place and start executing a preloaded standalone
308 * executable. If nothing was preloaded return an error.
309 */
310static void kernel_kexec(void)
311{
312#ifdef CONFIG_KEXEC
313 struct kimage *image;
314 image = xchg(&kexec_image, NULL);
315 if (!image)
316 return;
317 kernel_restart_prepare(NULL);
318 printk(KERN_EMERG "Starting new kernel\n");
319 machine_shutdown();
320 machine_kexec(image);
321#endif
322}
323
324static void kernel_shutdown_prepare(enum system_states state) 304static void kernel_shutdown_prepare(enum system_states state)
325{ 305{
326 blocking_notifier_call_chain(&reboot_notifier_list, 306 blocking_notifier_call_chain(&reboot_notifier_list,
@@ -425,10 +405,15 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
425 kernel_restart(buffer); 405 kernel_restart(buffer);
426 break; 406 break;
427 407
408#ifdef CONFIG_KEXEC
428 case LINUX_REBOOT_CMD_KEXEC: 409 case LINUX_REBOOT_CMD_KEXEC:
429 kernel_kexec(); 410 {
430 unlock_kernel(); 411 int ret;
431 return -EINVAL; 412 ret = kernel_kexec();
413 unlock_kernel();
414 return ret;
415 }
416#endif
432 417
433#ifdef CONFIG_HIBERNATION 418#ifdef CONFIG_HIBERNATION
434 case LINUX_REBOOT_CMD_SW_SUSPEND: 419 case LINUX_REBOOT_CMD_SW_SUSPEND:
diff --git a/lib/Makefile b/lib/Makefile
index 9085ad6fa53d..3b1f94bbe9de 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -11,7 +11,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
11 rbtree.o radix-tree.o dump_stack.o \ 11 rbtree.o radix-tree.o dump_stack.o \
12 idr.o int_sqrt.o extable.o prio_tree.o \ 12 idr.o int_sqrt.o extable.o prio_tree.o \
13 sha1.o irq_regs.o reciprocal_div.o argv_split.o \ 13 sha1.o irq_regs.o reciprocal_div.o argv_split.o \
14 proportions.o prio_heap.o ratelimit.o 14 proportions.o prio_heap.o ratelimit.o show_mem.o
15 15
16lib-$(CONFIG_MMU) += ioremap.o 16lib-$(CONFIG_MMU) += ioremap.o
17lib-$(CONFIG_SMP) += cpumask.o 17lib-$(CONFIG_SMP) += cpumask.o
@@ -78,6 +78,8 @@ lib-$(CONFIG_GENERIC_BUG) += bug.o
78 78
79obj-$(CONFIG_HAVE_LMB) += lmb.o 79obj-$(CONFIG_HAVE_LMB) += lmb.o
80 80
81obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
82
81hostprogs-y := gen_crc32table 83hostprogs-y := gen_crc32table
82clean-files := crc32table.h 84clean-files := crc32table.h
83 85
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index f86196390cfd..45a6bde762d1 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -205,9 +205,8 @@ static void debug_print_object(struct debug_obj *obj, char *msg)
205 205
206 if (limit < 5 && obj->descr != descr_test) { 206 if (limit < 5 && obj->descr != descr_test) {
207 limit++; 207 limit++;
208 printk(KERN_ERR "ODEBUG: %s %s object type: %s\n", msg, 208 WARN(1, KERN_ERR "ODEBUG: %s %s object type: %s\n", msg,
209 obj_states[obj->state], obj->descr->name); 209 obj_states[obj->state], obj->descr->name);
210 WARN_ON(1);
211 } 210 }
212 debug_objects_warnings++; 211 debug_objects_warnings++;
213} 212}
@@ -733,26 +732,22 @@ check_results(void *addr, enum debug_obj_state state, int fixups, int warnings)
733 732
734 obj = lookup_object(addr, db); 733 obj = lookup_object(addr, db);
735 if (!obj && state != ODEBUG_STATE_NONE) { 734 if (!obj && state != ODEBUG_STATE_NONE) {
736 printk(KERN_ERR "ODEBUG: selftest object not found\n"); 735 WARN(1, KERN_ERR "ODEBUG: selftest object not found\n");
737 WARN_ON(1);
738 goto out; 736 goto out;
739 } 737 }
740 if (obj && obj->state != state) { 738 if (obj && obj->state != state) {
741 printk(KERN_ERR "ODEBUG: selftest wrong state: %d != %d\n", 739 WARN(1, KERN_ERR "ODEBUG: selftest wrong state: %d != %d\n",
742 obj->state, state); 740 obj->state, state);
743 WARN_ON(1);
744 goto out; 741 goto out;
745 } 742 }
746 if (fixups != debug_objects_fixups) { 743 if (fixups != debug_objects_fixups) {
747 printk(KERN_ERR "ODEBUG: selftest fixups failed %d != %d\n", 744 WARN(1, KERN_ERR "ODEBUG: selftest fixups failed %d != %d\n",
748 fixups, debug_objects_fixups); 745 fixups, debug_objects_fixups);
749 WARN_ON(1);
750 goto out; 746 goto out;
751 } 747 }
752 if (warnings != debug_objects_warnings) { 748 if (warnings != debug_objects_warnings) {
753 printk(KERN_ERR "ODEBUG: selftest warnings failed %d != %d\n", 749 WARN(1, KERN_ERR "ODEBUG: selftest warnings failed %d != %d\n",
754 warnings, debug_objects_warnings); 750 warnings, debug_objects_warnings);
755 WARN_ON(1);
756 goto out; 751 goto out;
757 } 752 }
758 res = 0; 753 res = 0;
diff --git a/lib/idr.c b/lib/idr.c
index 3476f8203e97..e728c7fccc4d 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -607,7 +607,7 @@ void *idr_replace(struct idr *idp, void *ptr, int id)
607} 607}
608EXPORT_SYMBOL(idr_replace); 608EXPORT_SYMBOL(idr_replace);
609 609
610static void idr_cache_ctor(struct kmem_cache *idr_layer_cache, void *idr_layer) 610static void idr_cache_ctor(void *idr_layer)
611{ 611{
612 memset(idr_layer, 0, sizeof(struct idr_layer)); 612 memset(idr_layer, 0, sizeof(struct idr_layer));
613} 613}
diff --git a/lib/iomap.c b/lib/iomap.c
index 37a3ea4cac9f..d32229385151 100644
--- a/lib/iomap.c
+++ b/lib/iomap.c
@@ -40,8 +40,7 @@ static void bad_io_access(unsigned long port, const char *access)
40 static int count = 10; 40 static int count = 10;
41 if (count) { 41 if (count) {
42 count--; 42 count--;
43 printk(KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access); 43 WARN(1, KERN_ERR "Bad IO access at port %#lx (%s)\n", port, access);
44 WARN_ON(1);
45 } 44 }
46} 45}
47 46
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 9f8d599459d1..3f914725bda8 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -285,8 +285,7 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
285 int len; 285 int len;
286 286
287 if (env->envp_idx >= ARRAY_SIZE(env->envp)) { 287 if (env->envp_idx >= ARRAY_SIZE(env->envp)) {
288 printk(KERN_ERR "add_uevent_var: too many keys\n"); 288 WARN(1, KERN_ERR "add_uevent_var: too many keys\n");
289 WARN_ON(1);
290 return -ENOMEM; 289 return -ENOMEM;
291 } 290 }
292 291
@@ -297,8 +296,7 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
297 va_end(args); 296 va_end(args);
298 297
299 if (len >= (sizeof(env->buf) - env->buflen)) { 298 if (len >= (sizeof(env->buf) - env->buflen)) {
300 printk(KERN_ERR "add_uevent_var: buffer size too small\n"); 299 WARN(1, KERN_ERR "add_uevent_var: buffer size too small\n");
301 WARN_ON(1);
302 return -ENOMEM; 300 return -ENOMEM;
303 } 301 }
304 302
diff --git a/lib/plist.c b/lib/plist.c
index 3074a02272f3..d6c64a824e1d 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -31,12 +31,13 @@
31static void plist_check_prev_next(struct list_head *t, struct list_head *p, 31static void plist_check_prev_next(struct list_head *t, struct list_head *p,
32 struct list_head *n) 32 struct list_head *n)
33{ 33{
34 if (n->prev != p || p->next != n) { 34 WARN(n->prev != p || p->next != n,
35 printk("top: %p, n: %p, p: %p\n", t, t->next, t->prev); 35 "top: %p, n: %p, p: %p\n"
36 printk("prev: %p, n: %p, p: %p\n", p, p->next, p->prev); 36 "prev: %p, n: %p, p: %p\n"
37 printk("next: %p, n: %p, p: %p\n", n, n->next, n->prev); 37 "next: %p, n: %p, p: %p\n",
38 WARN_ON(1); 38 t, t->next, t->prev,
39 } 39 p, p->next, p->prev,
40 n, n->next, n->prev);
40} 41}
41 42
42static void plist_check_list(struct list_head *top) 43static void plist_check_list(struct list_head *top)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 56ec21a7f73d..be86b32bc874 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -359,18 +359,17 @@ EXPORT_SYMBOL(radix_tree_insert);
359 * Returns: the slot corresponding to the position @index in the 359 * Returns: the slot corresponding to the position @index in the
360 * radix tree @root. This is useful for update-if-exists operations. 360 * radix tree @root. This is useful for update-if-exists operations.
361 * 361 *
362 * This function cannot be called under rcu_read_lock, it must be 362 * This function can be called under rcu_read_lock iff the slot is not
363 * excluded from writers, as must the returned slot for subsequent 363 * modified by radix_tree_replace_slot, otherwise it must be called
364 * use by radix_tree_deref_slot() and radix_tree_replace slot. 364 * exclusive from other writers. Any dereference of the slot must be done
365 * Caller must hold tree write locked across slot lookup and 365 * using radix_tree_deref_slot.
366 * replace.
367 */ 366 */
368void **radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index) 367void **radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index)
369{ 368{
370 unsigned int height, shift; 369 unsigned int height, shift;
371 struct radix_tree_node *node, **slot; 370 struct radix_tree_node *node, **slot;
372 371
373 node = root->rnode; 372 node = rcu_dereference(root->rnode);
374 if (node == NULL) 373 if (node == NULL)
375 return NULL; 374 return NULL;
376 375
@@ -390,7 +389,7 @@ void **radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index)
390 do { 389 do {
391 slot = (struct radix_tree_node **) 390 slot = (struct radix_tree_node **)
392 (node->slots + ((index>>shift) & RADIX_TREE_MAP_MASK)); 391 (node->slots + ((index>>shift) & RADIX_TREE_MAP_MASK));
393 node = *slot; 392 node = rcu_dereference(*slot);
394 if (node == NULL) 393 if (node == NULL)
395 return NULL; 394 return NULL;
396 395
@@ -667,7 +666,7 @@ unsigned long radix_tree_next_hole(struct radix_tree_root *root,
667EXPORT_SYMBOL(radix_tree_next_hole); 666EXPORT_SYMBOL(radix_tree_next_hole);
668 667
669static unsigned int 668static unsigned int
670__lookup(struct radix_tree_node *slot, void **results, unsigned long index, 669__lookup(struct radix_tree_node *slot, void ***results, unsigned long index,
671 unsigned int max_items, unsigned long *next_index) 670 unsigned int max_items, unsigned long *next_index)
672{ 671{
673 unsigned int nr_found = 0; 672 unsigned int nr_found = 0;
@@ -701,11 +700,9 @@ __lookup(struct radix_tree_node *slot, void **results, unsigned long index,
701 700
702 /* Bottom level: grab some items */ 701 /* Bottom level: grab some items */
703 for (i = index & RADIX_TREE_MAP_MASK; i < RADIX_TREE_MAP_SIZE; i++) { 702 for (i = index & RADIX_TREE_MAP_MASK; i < RADIX_TREE_MAP_SIZE; i++) {
704 struct radix_tree_node *node;
705 index++; 703 index++;
706 node = slot->slots[i]; 704 if (slot->slots[i]) {
707 if (node) { 705 results[nr_found++] = &(slot->slots[i]);
708 results[nr_found++] = rcu_dereference(node);
709 if (nr_found == max_items) 706 if (nr_found == max_items)
710 goto out; 707 goto out;
711 } 708 }
@@ -759,13 +756,22 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
759 756
760 ret = 0; 757 ret = 0;
761 while (ret < max_items) { 758 while (ret < max_items) {
762 unsigned int nr_found; 759 unsigned int nr_found, slots_found, i;
763 unsigned long next_index; /* Index of next search */ 760 unsigned long next_index; /* Index of next search */
764 761
765 if (cur_index > max_index) 762 if (cur_index > max_index)
766 break; 763 break;
767 nr_found = __lookup(node, results + ret, cur_index, 764 slots_found = __lookup(node, (void ***)results + ret, cur_index,
768 max_items - ret, &next_index); 765 max_items - ret, &next_index);
766 nr_found = 0;
767 for (i = 0; i < slots_found; i++) {
768 struct radix_tree_node *slot;
769 slot = *(((void ***)results)[ret + i]);
770 if (!slot)
771 continue;
772 results[ret + nr_found] = rcu_dereference(slot);
773 nr_found++;
774 }
769 ret += nr_found; 775 ret += nr_found;
770 if (next_index == 0) 776 if (next_index == 0)
771 break; 777 break;
@@ -776,12 +782,71 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
776} 782}
777EXPORT_SYMBOL(radix_tree_gang_lookup); 783EXPORT_SYMBOL(radix_tree_gang_lookup);
778 784
785/**
786 * radix_tree_gang_lookup_slot - perform multiple slot lookup on radix tree
787 * @root: radix tree root
788 * @results: where the results of the lookup are placed
789 * @first_index: start the lookup from this key
790 * @max_items: place up to this many items at *results
791 *
792 * Performs an index-ascending scan of the tree for present items. Places
793 * their slots at *@results and returns the number of items which were
794 * placed at *@results.
795 *
796 * The implementation is naive.
797 *
798 * Like radix_tree_gang_lookup as far as RCU and locking goes. Slots must
799 * be dereferenced with radix_tree_deref_slot, and if using only RCU
800 * protection, radix_tree_deref_slot may fail requiring a retry.
801 */
802unsigned int
803radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
804 unsigned long first_index, unsigned int max_items)
805{
806 unsigned long max_index;
807 struct radix_tree_node *node;
808 unsigned long cur_index = first_index;
809 unsigned int ret;
810
811 node = rcu_dereference(root->rnode);
812 if (!node)
813 return 0;
814
815 if (!radix_tree_is_indirect_ptr(node)) {
816 if (first_index > 0)
817 return 0;
818 results[0] = (void **)&root->rnode;
819 return 1;
820 }
821 node = radix_tree_indirect_to_ptr(node);
822
823 max_index = radix_tree_maxindex(node->height);
824
825 ret = 0;
826 while (ret < max_items) {
827 unsigned int slots_found;
828 unsigned long next_index; /* Index of next search */
829
830 if (cur_index > max_index)
831 break;
832 slots_found = __lookup(node, results + ret, cur_index,
833 max_items - ret, &next_index);
834 ret += slots_found;
835 if (next_index == 0)
836 break;
837 cur_index = next_index;
838 }
839
840 return ret;
841}
842EXPORT_SYMBOL(radix_tree_gang_lookup_slot);
843
779/* 844/*
780 * FIXME: the two tag_get()s here should use find_next_bit() instead of 845 * FIXME: the two tag_get()s here should use find_next_bit() instead of
781 * open-coding the search. 846 * open-coding the search.
782 */ 847 */
783static unsigned int 848static unsigned int
784__lookup_tag(struct radix_tree_node *slot, void **results, unsigned long index, 849__lookup_tag(struct radix_tree_node *slot, void ***results, unsigned long index,
785 unsigned int max_items, unsigned long *next_index, unsigned int tag) 850 unsigned int max_items, unsigned long *next_index, unsigned int tag)
786{ 851{
787 unsigned int nr_found = 0; 852 unsigned int nr_found = 0;
@@ -811,11 +876,9 @@ __lookup_tag(struct radix_tree_node *slot, void **results, unsigned long index,
811 unsigned long j = index & RADIX_TREE_MAP_MASK; 876 unsigned long j = index & RADIX_TREE_MAP_MASK;
812 877
813 for ( ; j < RADIX_TREE_MAP_SIZE; j++) { 878 for ( ; j < RADIX_TREE_MAP_SIZE; j++) {
814 struct radix_tree_node *node;
815 index++; 879 index++;
816 if (!tag_get(slot, tag, j)) 880 if (!tag_get(slot, tag, j))
817 continue; 881 continue;
818 node = slot->slots[j];
819 /* 882 /*
820 * Even though the tag was found set, we need to 883 * Even though the tag was found set, we need to
821 * recheck that we have a non-NULL node, because 884 * recheck that we have a non-NULL node, because
@@ -826,9 +889,8 @@ __lookup_tag(struct radix_tree_node *slot, void **results, unsigned long index,
826 * lookup ->slots[x] without a lock (ie. can't 889 * lookup ->slots[x] without a lock (ie. can't
827 * rely on its value remaining the same). 890 * rely on its value remaining the same).
828 */ 891 */
829 if (node) { 892 if (slot->slots[j]) {
830 node = rcu_dereference(node); 893 results[nr_found++] = &(slot->slots[j]);
831 results[nr_found++] = node;
832 if (nr_found == max_items) 894 if (nr_found == max_items)
833 goto out; 895 goto out;
834 } 896 }
@@ -887,13 +949,22 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
887 949
888 ret = 0; 950 ret = 0;
889 while (ret < max_items) { 951 while (ret < max_items) {
890 unsigned int nr_found; 952 unsigned int nr_found, slots_found, i;
891 unsigned long next_index; /* Index of next search */ 953 unsigned long next_index; /* Index of next search */
892 954
893 if (cur_index > max_index) 955 if (cur_index > max_index)
894 break; 956 break;
895 nr_found = __lookup_tag(node, results + ret, cur_index, 957 slots_found = __lookup_tag(node, (void ***)results + ret,
896 max_items - ret, &next_index, tag); 958 cur_index, max_items - ret, &next_index, tag);
959 nr_found = 0;
960 for (i = 0; i < slots_found; i++) {
961 struct radix_tree_node *slot;
962 slot = *(((void ***)results)[ret + i]);
963 if (!slot)
964 continue;
965 results[ret + nr_found] = rcu_dereference(slot);
966 nr_found++;
967 }
897 ret += nr_found; 968 ret += nr_found;
898 if (next_index == 0) 969 if (next_index == 0)
899 break; 970 break;
@@ -905,6 +976,67 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
905EXPORT_SYMBOL(radix_tree_gang_lookup_tag); 976EXPORT_SYMBOL(radix_tree_gang_lookup_tag);
906 977
907/** 978/**
979 * radix_tree_gang_lookup_tag_slot - perform multiple slot lookup on a
980 * radix tree based on a tag
981 * @root: radix tree root
982 * @results: where the results of the lookup are placed
983 * @first_index: start the lookup from this key
984 * @max_items: place up to this many items at *results
985 * @tag: the tag index (< RADIX_TREE_MAX_TAGS)
986 *
987 * Performs an index-ascending scan of the tree for present items which
988 * have the tag indexed by @tag set. Places the slots at *@results and
989 * returns the number of slots which were placed at *@results.
990 */
991unsigned int
992radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
993 unsigned long first_index, unsigned int max_items,
994 unsigned int tag)
995{
996 struct radix_tree_node *node;
997 unsigned long max_index;
998 unsigned long cur_index = first_index;
999 unsigned int ret;
1000
1001 /* check the root's tag bit */
1002 if (!root_tag_get(root, tag))
1003 return 0;
1004
1005 node = rcu_dereference(root->rnode);
1006 if (!node)
1007 return 0;
1008
1009 if (!radix_tree_is_indirect_ptr(node)) {
1010 if (first_index > 0)
1011 return 0;
1012 results[0] = (void **)&root->rnode;
1013 return 1;
1014 }
1015 node = radix_tree_indirect_to_ptr(node);
1016
1017 max_index = radix_tree_maxindex(node->height);
1018
1019 ret = 0;
1020 while (ret < max_items) {
1021 unsigned int slots_found;
1022 unsigned long next_index; /* Index of next search */
1023
1024 if (cur_index > max_index)
1025 break;
1026 slots_found = __lookup_tag(node, results + ret,
1027 cur_index, max_items - ret, &next_index, tag);
1028 ret += slots_found;
1029 if (next_index == 0)
1030 break;
1031 cur_index = next_index;
1032 }
1033
1034 return ret;
1035}
1036EXPORT_SYMBOL(radix_tree_gang_lookup_tag_slot);
1037
1038
1039/**
908 * radix_tree_shrink - shrink height of a radix tree to minimal 1040 * radix_tree_shrink - shrink height of a radix tree to minimal
909 * @root radix tree root 1041 * @root radix tree root
910 */ 1042 */
@@ -1051,7 +1183,7 @@ int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag)
1051EXPORT_SYMBOL(radix_tree_tagged); 1183EXPORT_SYMBOL(radix_tree_tagged);
1052 1184
1053static void 1185static void
1054radix_tree_node_ctor(struct kmem_cache *cachep, void *node) 1186radix_tree_node_ctor(void *node)
1055{ 1187{
1056 memset(node, 0, sizeof(struct radix_tree_node)); 1188 memset(node, 0, sizeof(struct radix_tree_node));
1057} 1189}
diff --git a/lib/show_mem.c b/lib/show_mem.c
new file mode 100644
index 000000000000..238e72a18ce1
--- /dev/null
+++ b/lib/show_mem.c
@@ -0,0 +1,63 @@
1/*
2 * Generic show_mem() implementation
3 *
4 * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
5 * All code subject to the GPL version 2.
6 */
7
8#include <linux/mm.h>
9#include <linux/nmi.h>
10#include <linux/quicklist.h>
11
12void show_mem(void)
13{
14 pg_data_t *pgdat;
15 unsigned long total = 0, reserved = 0, shared = 0,
16 nonshared = 0, highmem = 0;
17
18 printk(KERN_INFO "Mem-Info:\n");
19 show_free_areas();
20
21 for_each_online_pgdat(pgdat) {
22 unsigned long i, flags;
23
24 pgdat_resize_lock(pgdat, &flags);
25 for (i = 0; i < pgdat->node_spanned_pages; i++) {
26 struct page *page;
27 unsigned long pfn = pgdat->node_start_pfn + i;
28
29 if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
30 touch_nmi_watchdog();
31
32 if (!pfn_valid(pfn))
33 continue;
34
35 page = pfn_to_page(pfn);
36
37 if (PageHighMem(page))
38 highmem++;
39
40 if (PageReserved(page))
41 reserved++;
42 else if (page_count(page) == 1)
43 nonshared++;
44 else if (page_count(page) > 1)
45 shared += page_count(page) - 1;
46
47 total++;
48 }
49 pgdat_resize_unlock(pgdat, &flags);
50 }
51
52 printk(KERN_INFO "%lu pages RAM\n", total);
53#ifdef CONFIG_HIGHMEM
54 printk(KERN_INFO "%lu pages HighMem\n", highmem);
55#endif
56 printk(KERN_INFO "%lu pages reserved\n", reserved);
57 printk(KERN_INFO "%lu pages shared\n", shared);
58 printk(KERN_INFO "%lu pages non-shared\n", nonshared);
59#ifdef CONFIG_QUICKLIST
60 printk(KERN_INFO "%lu pages in pagetable cache\n",
61 quicklist_total_size());
62#endif
63}
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index d568894df8cc..977edbdbc1de 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -492,7 +492,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
492 */ 492 */
493 dma_addr_t handle; 493 dma_addr_t handle;
494 handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE); 494 handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE);
495 if (swiotlb_dma_mapping_error(handle)) 495 if (swiotlb_dma_mapping_error(hwdev, handle))
496 return NULL; 496 return NULL;
497 497
498 ret = bus_to_virt(handle); 498 ret = bus_to_virt(handle);
@@ -824,7 +824,7 @@ swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
824} 824}
825 825
826int 826int
827swiotlb_dma_mapping_error(dma_addr_t dma_addr) 827swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
828{ 828{
829 return (dma_addr == virt_to_bus(io_tlb_overflow_buffer)); 829 return (dma_addr == virt_to_bus(io_tlb_overflow_buffer));
830} 830}
diff --git a/lib/syscall.c b/lib/syscall.c
new file mode 100644
index 000000000000..a4f7067f72fa
--- /dev/null
+++ b/lib/syscall.c
@@ -0,0 +1,75 @@
1#include <linux/ptrace.h>
2#include <linux/sched.h>
3#include <linux/module.h>
4#include <asm/syscall.h>
5
6static int collect_syscall(struct task_struct *target, long *callno,
7 unsigned long args[6], unsigned int maxargs,
8 unsigned long *sp, unsigned long *pc)
9{
10 struct pt_regs *regs = task_pt_regs(target);
11 if (unlikely(!regs))
12 return -EAGAIN;
13
14 *sp = user_stack_pointer(regs);
15 *pc = instruction_pointer(regs);
16
17 *callno = syscall_get_nr(target, regs);
18 if (*callno != -1L && maxargs > 0)
19 syscall_get_arguments(target, regs, 0, maxargs, args);
20
21 return 0;
22}
23
24/**
25 * task_current_syscall - Discover what a blocked task is doing.
26 * @target: thread to examine
27 * @callno: filled with system call number or -1
28 * @args: filled with @maxargs system call arguments
29 * @maxargs: number of elements in @args to fill
30 * @sp: filled with user stack pointer
31 * @pc: filled with user PC
32 *
33 * If @target is blocked in a system call, returns zero with *@callno
34 * set to the the call's number and @args filled in with its arguments.
35 * Registers not used for system call arguments may not be available and
36 * it is not kosher to use &struct user_regset calls while the system
37 * call is still in progress. Note we may get this result if @target
38 * has finished its system call but not yet returned to user mode, such
39 * as when it's stopped for signal handling or syscall exit tracing.
40 *
41 * If @target is blocked in the kernel during a fault or exception,
42 * returns zero with *@callno set to -1 and does not fill in @args.
43 * If so, it's now safe to examine @target using &struct user_regset
44 * get() calls as long as we're sure @target won't return to user mode.
45 *
46 * Returns -%EAGAIN if @target does not remain blocked.
47 *
48 * Returns -%EINVAL if @maxargs is too large (maximum is six).
49 */
50int task_current_syscall(struct task_struct *target, long *callno,
51 unsigned long args[6], unsigned int maxargs,
52 unsigned long *sp, unsigned long *pc)
53{
54 long state;
55 unsigned long ncsw;
56
57 if (unlikely(maxargs > 6))
58 return -EINVAL;
59
60 if (target == current)
61 return collect_syscall(target, callno, args, maxargs, sp, pc);
62
63 state = target->state;
64 if (unlikely(!state))
65 return -EAGAIN;
66
67 ncsw = wait_task_inactive(target, state);
68 if (unlikely(!ncsw) ||
69 unlikely(collect_syscall(target, callno, args, maxargs, sp, pc)) ||
70 unlikely(wait_task_inactive(target, state) != ncsw))
71 return -EAGAIN;
72
73 return 0;
74}
75EXPORT_SYMBOL_GPL(task_current_syscall);
diff --git a/mm/Kconfig b/mm/Kconfig
index aa799007a11b..efee5d379df4 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -77,6 +77,9 @@ config FLAT_NODE_MEM_MAP
77 def_bool y 77 def_bool y
78 depends on !SPARSEMEM 78 depends on !SPARSEMEM
79 79
80config HAVE_GET_USER_PAGES_FAST
81 bool
82
80# 83#
81# Both the NUMA code and DISCONTIGMEM use arrays of pg_data_t's 84# Both the NUMA code and DISCONTIGMEM use arrays of pg_data_t's
82# to represent different areas of memory. This variable allows 85# to represent different areas of memory. This variable allows
diff --git a/mm/allocpercpu.c b/mm/allocpercpu.c
index 843364594e23..4297bc41bfd2 100644
--- a/mm/allocpercpu.c
+++ b/mm/allocpercpu.c
@@ -18,27 +18,28 @@
18 * Depopulating per-cpu data for a cpu going offline would be a typical 18 * Depopulating per-cpu data for a cpu going offline would be a typical
19 * use case. You need to register a cpu hotplug handler for that purpose. 19 * use case. You need to register a cpu hotplug handler for that purpose.
20 */ 20 */
21void percpu_depopulate(void *__pdata, int cpu) 21static void percpu_depopulate(void *__pdata, int cpu)
22{ 22{
23 struct percpu_data *pdata = __percpu_disguise(__pdata); 23 struct percpu_data *pdata = __percpu_disguise(__pdata);
24 24
25 kfree(pdata->ptrs[cpu]); 25 kfree(pdata->ptrs[cpu]);
26 pdata->ptrs[cpu] = NULL; 26 pdata->ptrs[cpu] = NULL;
27} 27}
28EXPORT_SYMBOL_GPL(percpu_depopulate);
29 28
30/** 29/**
31 * percpu_depopulate_mask - depopulate per-cpu data for some cpu's 30 * percpu_depopulate_mask - depopulate per-cpu data for some cpu's
32 * @__pdata: per-cpu data to depopulate 31 * @__pdata: per-cpu data to depopulate
33 * @mask: depopulate per-cpu data for cpu's selected through mask bits 32 * @mask: depopulate per-cpu data for cpu's selected through mask bits
34 */ 33 */
35void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask) 34static void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask)
36{ 35{
37 int cpu; 36 int cpu;
38 for_each_cpu_mask_nr(cpu, *mask) 37 for_each_cpu_mask_nr(cpu, *mask)
39 percpu_depopulate(__pdata, cpu); 38 percpu_depopulate(__pdata, cpu);
40} 39}
41EXPORT_SYMBOL_GPL(__percpu_depopulate_mask); 40
41#define percpu_depopulate_mask(__pdata, mask) \
42 __percpu_depopulate_mask((__pdata), &(mask))
42 43
43/** 44/**
44 * percpu_populate - populate per-cpu data for given cpu 45 * percpu_populate - populate per-cpu data for given cpu
@@ -51,7 +52,7 @@ EXPORT_SYMBOL_GPL(__percpu_depopulate_mask);
51 * use case. You need to register a cpu hotplug handler for that purpose. 52 * use case. You need to register a cpu hotplug handler for that purpose.
52 * Per-cpu object is populated with zeroed buffer. 53 * Per-cpu object is populated with zeroed buffer.
53 */ 54 */
54void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu) 55static void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu)
55{ 56{
56 struct percpu_data *pdata = __percpu_disguise(__pdata); 57 struct percpu_data *pdata = __percpu_disguise(__pdata);
57 int node = cpu_to_node(cpu); 58 int node = cpu_to_node(cpu);
@@ -68,7 +69,6 @@ void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu)
68 pdata->ptrs[cpu] = kzalloc(size, gfp); 69 pdata->ptrs[cpu] = kzalloc(size, gfp);
69 return pdata->ptrs[cpu]; 70 return pdata->ptrs[cpu];
70} 71}
71EXPORT_SYMBOL_GPL(percpu_populate);
72 72
73/** 73/**
74 * percpu_populate_mask - populate per-cpu data for more cpu's 74 * percpu_populate_mask - populate per-cpu data for more cpu's
@@ -79,8 +79,8 @@ EXPORT_SYMBOL_GPL(percpu_populate);
79 * 79 *
80 * Per-cpu objects are populated with zeroed buffers. 80 * Per-cpu objects are populated with zeroed buffers.
81 */ 81 */
82int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp, 82static int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
83 cpumask_t *mask) 83 cpumask_t *mask)
84{ 84{
85 cpumask_t populated; 85 cpumask_t populated;
86 int cpu; 86 int cpu;
@@ -94,7 +94,9 @@ int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
94 cpu_set(cpu, populated); 94 cpu_set(cpu, populated);
95 return 0; 95 return 0;
96} 96}
97EXPORT_SYMBOL_GPL(__percpu_populate_mask); 97
98#define percpu_populate_mask(__pdata, size, gfp, mask) \
99 __percpu_populate_mask((__pdata), (size), (gfp), &(mask))
98 100
99/** 101/**
100 * percpu_alloc_mask - initial setup of per-cpu data 102 * percpu_alloc_mask - initial setup of per-cpu data
diff --git a/mm/filemap.c b/mm/filemap.c
index 2d3ec1ffc66e..2ed8b0389c51 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -109,7 +109,7 @@
109/* 109/*
110 * Remove a page from the page cache and free it. Caller has to make 110 * Remove a page from the page cache and free it. Caller has to make
111 * sure the page is locked and that nobody else uses it - or that usage 111 * sure the page is locked and that nobody else uses it - or that usage
112 * is safe. The caller must hold a write_lock on the mapping's tree_lock. 112 * is safe. The caller must hold the mapping's tree_lock.
113 */ 113 */
114void __remove_from_page_cache(struct page *page) 114void __remove_from_page_cache(struct page *page)
115{ 115{
@@ -141,9 +141,9 @@ void remove_from_page_cache(struct page *page)
141 141
142 BUG_ON(!PageLocked(page)); 142 BUG_ON(!PageLocked(page));
143 143
144 write_lock_irq(&mapping->tree_lock); 144 spin_lock_irq(&mapping->tree_lock);
145 __remove_from_page_cache(page); 145 __remove_from_page_cache(page);
146 write_unlock_irq(&mapping->tree_lock); 146 spin_unlock_irq(&mapping->tree_lock);
147} 147}
148 148
149static int sync_page(void *word) 149static int sync_page(void *word)
@@ -442,48 +442,52 @@ int filemap_write_and_wait_range(struct address_space *mapping,
442} 442}
443 443
444/** 444/**
445 * add_to_page_cache - add newly allocated pagecache pages 445 * add_to_page_cache_locked - add a locked page to the pagecache
446 * @page: page to add 446 * @page: page to add
447 * @mapping: the page's address_space 447 * @mapping: the page's address_space
448 * @offset: page index 448 * @offset: page index
449 * @gfp_mask: page allocation mode 449 * @gfp_mask: page allocation mode
450 * 450 *
451 * This function is used to add newly allocated pagecache pages; 451 * This function is used to add a page to the pagecache. It must be locked.
452 * the page is new, so we can just run SetPageLocked() against it.
453 * The other page state flags were set by rmqueue().
454 *
455 * This function does not add the page to the LRU. The caller must do that. 452 * This function does not add the page to the LRU. The caller must do that.
456 */ 453 */
457int add_to_page_cache(struct page *page, struct address_space *mapping, 454int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
458 pgoff_t offset, gfp_t gfp_mask) 455 pgoff_t offset, gfp_t gfp_mask)
459{ 456{
460 int error = mem_cgroup_cache_charge(page, current->mm, 457 int error;
458
459 VM_BUG_ON(!PageLocked(page));
460
461 error = mem_cgroup_cache_charge(page, current->mm,
461 gfp_mask & ~__GFP_HIGHMEM); 462 gfp_mask & ~__GFP_HIGHMEM);
462 if (error) 463 if (error)
463 goto out; 464 goto out;
464 465
465 error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM); 466 error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
466 if (error == 0) { 467 if (error == 0) {
467 write_lock_irq(&mapping->tree_lock); 468 page_cache_get(page);
469 page->mapping = mapping;
470 page->index = offset;
471
472 spin_lock_irq(&mapping->tree_lock);
468 error = radix_tree_insert(&mapping->page_tree, offset, page); 473 error = radix_tree_insert(&mapping->page_tree, offset, page);
469 if (!error) { 474 if (likely(!error)) {
470 page_cache_get(page);
471 SetPageLocked(page);
472 page->mapping = mapping;
473 page->index = offset;
474 mapping->nrpages++; 475 mapping->nrpages++;
475 __inc_zone_page_state(page, NR_FILE_PAGES); 476 __inc_zone_page_state(page, NR_FILE_PAGES);
476 } else 477 } else {
478 page->mapping = NULL;
477 mem_cgroup_uncharge_cache_page(page); 479 mem_cgroup_uncharge_cache_page(page);
480 page_cache_release(page);
481 }
478 482
479 write_unlock_irq(&mapping->tree_lock); 483 spin_unlock_irq(&mapping->tree_lock);
480 radix_tree_preload_end(); 484 radix_tree_preload_end();
481 } else 485 } else
482 mem_cgroup_uncharge_cache_page(page); 486 mem_cgroup_uncharge_cache_page(page);
483out: 487out:
484 return error; 488 return error;
485} 489}
486EXPORT_SYMBOL(add_to_page_cache); 490EXPORT_SYMBOL(add_to_page_cache_locked);
487 491
488int add_to_page_cache_lru(struct page *page, struct address_space *mapping, 492int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
489 pgoff_t offset, gfp_t gfp_mask) 493 pgoff_t offset, gfp_t gfp_mask)
@@ -633,15 +637,35 @@ void __lock_page_nosync(struct page *page)
633 * Is there a pagecache struct page at the given (mapping, offset) tuple? 637 * Is there a pagecache struct page at the given (mapping, offset) tuple?
634 * If yes, increment its refcount and return it; if no, return NULL. 638 * If yes, increment its refcount and return it; if no, return NULL.
635 */ 639 */
636struct page * find_get_page(struct address_space *mapping, pgoff_t offset) 640struct page *find_get_page(struct address_space *mapping, pgoff_t offset)
637{ 641{
642 void **pagep;
638 struct page *page; 643 struct page *page;
639 644
640 read_lock_irq(&mapping->tree_lock); 645 rcu_read_lock();
641 page = radix_tree_lookup(&mapping->page_tree, offset); 646repeat:
642 if (page) 647 page = NULL;
643 page_cache_get(page); 648 pagep = radix_tree_lookup_slot(&mapping->page_tree, offset);
644 read_unlock_irq(&mapping->tree_lock); 649 if (pagep) {
650 page = radix_tree_deref_slot(pagep);
651 if (unlikely(!page || page == RADIX_TREE_RETRY))
652 goto repeat;
653
654 if (!page_cache_get_speculative(page))
655 goto repeat;
656
657 /*
658 * Has the page moved?
659 * This is part of the lockless pagecache protocol. See
660 * include/linux/pagemap.h for details.
661 */
662 if (unlikely(page != *pagep)) {
663 page_cache_release(page);
664 goto repeat;
665 }
666 }
667 rcu_read_unlock();
668
645 return page; 669 return page;
646} 670}
647EXPORT_SYMBOL(find_get_page); 671EXPORT_SYMBOL(find_get_page);
@@ -656,32 +680,22 @@ EXPORT_SYMBOL(find_get_page);
656 * 680 *
657 * Returns zero if the page was not present. find_lock_page() may sleep. 681 * Returns zero if the page was not present. find_lock_page() may sleep.
658 */ 682 */
659struct page *find_lock_page(struct address_space *mapping, 683struct page *find_lock_page(struct address_space *mapping, pgoff_t offset)
660 pgoff_t offset)
661{ 684{
662 struct page *page; 685 struct page *page;
663 686
664repeat: 687repeat:
665 read_lock_irq(&mapping->tree_lock); 688 page = find_get_page(mapping, offset);
666 page = radix_tree_lookup(&mapping->page_tree, offset);
667 if (page) { 689 if (page) {
668 page_cache_get(page); 690 lock_page(page);
669 if (TestSetPageLocked(page)) { 691 /* Has the page been truncated? */
670 read_unlock_irq(&mapping->tree_lock); 692 if (unlikely(page->mapping != mapping)) {
671 __lock_page(page); 693 unlock_page(page);
672 694 page_cache_release(page);
673 /* Has the page been truncated while we slept? */ 695 goto repeat;
674 if (unlikely(page->mapping != mapping)) {
675 unlock_page(page);
676 page_cache_release(page);
677 goto repeat;
678 }
679 VM_BUG_ON(page->index != offset);
680 goto out;
681 } 696 }
697 VM_BUG_ON(page->index != offset);
682 } 698 }
683 read_unlock_irq(&mapping->tree_lock);
684out:
685 return page; 699 return page;
686} 700}
687EXPORT_SYMBOL(find_lock_page); 701EXPORT_SYMBOL(find_lock_page);
@@ -747,13 +761,39 @@ unsigned find_get_pages(struct address_space *mapping, pgoff_t start,
747{ 761{
748 unsigned int i; 762 unsigned int i;
749 unsigned int ret; 763 unsigned int ret;
764 unsigned int nr_found;
765
766 rcu_read_lock();
767restart:
768 nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree,
769 (void ***)pages, start, nr_pages);
770 ret = 0;
771 for (i = 0; i < nr_found; i++) {
772 struct page *page;
773repeat:
774 page = radix_tree_deref_slot((void **)pages[i]);
775 if (unlikely(!page))
776 continue;
777 /*
778 * this can only trigger if nr_found == 1, making livelock
779 * a non issue.
780 */
781 if (unlikely(page == RADIX_TREE_RETRY))
782 goto restart;
750 783
751 read_lock_irq(&mapping->tree_lock); 784 if (!page_cache_get_speculative(page))
752 ret = radix_tree_gang_lookup(&mapping->page_tree, 785 goto repeat;
753 (void **)pages, start, nr_pages); 786
754 for (i = 0; i < ret; i++) 787 /* Has the page moved? */
755 page_cache_get(pages[i]); 788 if (unlikely(page != *((void **)pages[i]))) {
756 read_unlock_irq(&mapping->tree_lock); 789 page_cache_release(page);
790 goto repeat;
791 }
792
793 pages[ret] = page;
794 ret++;
795 }
796 rcu_read_unlock();
757 return ret; 797 return ret;
758} 798}
759 799
@@ -774,19 +814,44 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
774{ 814{
775 unsigned int i; 815 unsigned int i;
776 unsigned int ret; 816 unsigned int ret;
817 unsigned int nr_found;
818
819 rcu_read_lock();
820restart:
821 nr_found = radix_tree_gang_lookup_slot(&mapping->page_tree,
822 (void ***)pages, index, nr_pages);
823 ret = 0;
824 for (i = 0; i < nr_found; i++) {
825 struct page *page;
826repeat:
827 page = radix_tree_deref_slot((void **)pages[i]);
828 if (unlikely(!page))
829 continue;
830 /*
831 * this can only trigger if nr_found == 1, making livelock
832 * a non issue.
833 */
834 if (unlikely(page == RADIX_TREE_RETRY))
835 goto restart;
777 836
778 read_lock_irq(&mapping->tree_lock); 837 if (page->mapping == NULL || page->index != index)
779 ret = radix_tree_gang_lookup(&mapping->page_tree,
780 (void **)pages, index, nr_pages);
781 for (i = 0; i < ret; i++) {
782 if (pages[i]->mapping == NULL || pages[i]->index != index)
783 break; 838 break;
784 839
785 page_cache_get(pages[i]); 840 if (!page_cache_get_speculative(page))
841 goto repeat;
842
843 /* Has the page moved? */
844 if (unlikely(page != *((void **)pages[i]))) {
845 page_cache_release(page);
846 goto repeat;
847 }
848
849 pages[ret] = page;
850 ret++;
786 index++; 851 index++;
787 } 852 }
788 read_unlock_irq(&mapping->tree_lock); 853 rcu_read_unlock();
789 return i; 854 return ret;
790} 855}
791EXPORT_SYMBOL(find_get_pages_contig); 856EXPORT_SYMBOL(find_get_pages_contig);
792 857
@@ -806,15 +871,43 @@ unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
806{ 871{
807 unsigned int i; 872 unsigned int i;
808 unsigned int ret; 873 unsigned int ret;
874 unsigned int nr_found;
875
876 rcu_read_lock();
877restart:
878 nr_found = radix_tree_gang_lookup_tag_slot(&mapping->page_tree,
879 (void ***)pages, *index, nr_pages, tag);
880 ret = 0;
881 for (i = 0; i < nr_found; i++) {
882 struct page *page;
883repeat:
884 page = radix_tree_deref_slot((void **)pages[i]);
885 if (unlikely(!page))
886 continue;
887 /*
888 * this can only trigger if nr_found == 1, making livelock
889 * a non issue.
890 */
891 if (unlikely(page == RADIX_TREE_RETRY))
892 goto restart;
893
894 if (!page_cache_get_speculative(page))
895 goto repeat;
896
897 /* Has the page moved? */
898 if (unlikely(page != *((void **)pages[i]))) {
899 page_cache_release(page);
900 goto repeat;
901 }
902
903 pages[ret] = page;
904 ret++;
905 }
906 rcu_read_unlock();
809 907
810 read_lock_irq(&mapping->tree_lock);
811 ret = radix_tree_gang_lookup_tag(&mapping->page_tree,
812 (void **)pages, *index, nr_pages, tag);
813 for (i = 0; i < ret; i++)
814 page_cache_get(pages[i]);
815 if (ret) 908 if (ret)
816 *index = pages[ret - 1]->index + 1; 909 *index = pages[ret - 1]->index + 1;
817 read_unlock_irq(&mapping->tree_lock); 910
818 return ret; 911 return ret;
819} 912}
820EXPORT_SYMBOL(find_get_pages_tag); 913EXPORT_SYMBOL(find_get_pages_tag);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a8bf4ab01f86..3be79dc18c5c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1026,18 +1026,6 @@ static void __init report_hugepages(void)
1026 } 1026 }
1027} 1027}
1028 1028
1029static unsigned int cpuset_mems_nr(unsigned int *array)
1030{
1031 int node;
1032 unsigned int nr = 0;
1033
1034 for_each_node_mask(node, cpuset_current_mems_allowed)
1035 nr += array[node];
1036
1037 return nr;
1038}
1039
1040#ifdef CONFIG_SYSCTL
1041#ifdef CONFIG_HIGHMEM 1029#ifdef CONFIG_HIGHMEM
1042static void try_to_free_low(struct hstate *h, unsigned long count) 1030static void try_to_free_low(struct hstate *h, unsigned long count)
1043{ 1031{
@@ -1386,6 +1374,18 @@ static int __init hugetlb_default_setup(char *s)
1386} 1374}
1387__setup("default_hugepagesz=", hugetlb_default_setup); 1375__setup("default_hugepagesz=", hugetlb_default_setup);
1388 1376
1377static unsigned int cpuset_mems_nr(unsigned int *array)
1378{
1379 int node;
1380 unsigned int nr = 0;
1381
1382 for_each_node_mask(node, cpuset_current_mems_allowed)
1383 nr += array[node];
1384
1385 return nr;
1386}
1387
1388#ifdef CONFIG_SYSCTL
1389int hugetlb_sysctl_handler(struct ctl_table *table, int write, 1389int hugetlb_sysctl_handler(struct ctl_table *table, int write,
1390 struct file *file, void __user *buffer, 1390 struct file *file, void __user *buffer,
1391 size_t *length, loff_t *ppos) 1391 size_t *length, loff_t *ppos)
diff --git a/mm/memory.c b/mm/memory.c
index 262e3eb6601a..a8ca04faaea6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -374,7 +374,8 @@ static inline void add_mm_rss(struct mm_struct *mm, int file_rss, int anon_rss)
374 * 374 *
375 * The calling function must still handle the error. 375 * The calling function must still handle the error.
376 */ 376 */
377void print_bad_pte(struct vm_area_struct *vma, pte_t pte, unsigned long vaddr) 377static void print_bad_pte(struct vm_area_struct *vma, pte_t pte,
378 unsigned long vaddr)
378{ 379{
379 printk(KERN_ERR "Bad pte = %08llx, process = %s, " 380 printk(KERN_ERR "Bad pte = %08llx, process = %s, "
380 "vm_flags = %lx, vaddr = %lx\n", 381 "vm_flags = %lx, vaddr = %lx\n",
diff --git a/mm/migrate.c b/mm/migrate.c
index d8c65a65c61d..153572fb60b8 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -285,7 +285,15 @@ void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
285 285
286 page = migration_entry_to_page(entry); 286 page = migration_entry_to_page(entry);
287 287
288 get_page(page); 288 /*
289 * Once radix-tree replacement of page migration started, page_count
290 * *must* be zero. And, we don't want to call wait_on_page_locked()
291 * against a page without get_page().
292 * So, we use get_page_unless_zero(), here. Even failed, page fault
293 * will occur again.
294 */
295 if (!get_page_unless_zero(page))
296 goto out;
289 pte_unmap_unlock(ptep, ptl); 297 pte_unmap_unlock(ptep, ptl);
290 wait_on_page_locked(page); 298 wait_on_page_locked(page);
291 put_page(page); 299 put_page(page);
@@ -305,6 +313,7 @@ out:
305static int migrate_page_move_mapping(struct address_space *mapping, 313static int migrate_page_move_mapping(struct address_space *mapping,
306 struct page *newpage, struct page *page) 314 struct page *newpage, struct page *page)
307{ 315{
316 int expected_count;
308 void **pslot; 317 void **pslot;
309 318
310 if (!mapping) { 319 if (!mapping) {
@@ -314,14 +323,20 @@ static int migrate_page_move_mapping(struct address_space *mapping,
314 return 0; 323 return 0;
315 } 324 }
316 325
317 write_lock_irq(&mapping->tree_lock); 326 spin_lock_irq(&mapping->tree_lock);
318 327
319 pslot = radix_tree_lookup_slot(&mapping->page_tree, 328 pslot = radix_tree_lookup_slot(&mapping->page_tree,
320 page_index(page)); 329 page_index(page));
321 330
322 if (page_count(page) != 2 + !!PagePrivate(page) || 331 expected_count = 2 + !!PagePrivate(page);
332 if (page_count(page) != expected_count ||
323 (struct page *)radix_tree_deref_slot(pslot) != page) { 333 (struct page *)radix_tree_deref_slot(pslot) != page) {
324 write_unlock_irq(&mapping->tree_lock); 334 spin_unlock_irq(&mapping->tree_lock);
335 return -EAGAIN;
336 }
337
338 if (!page_freeze_refs(page, expected_count)) {
339 spin_unlock_irq(&mapping->tree_lock);
325 return -EAGAIN; 340 return -EAGAIN;
326 } 341 }
327 342
@@ -338,6 +353,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
338 353
339 radix_tree_replace_slot(pslot, newpage); 354 radix_tree_replace_slot(pslot, newpage);
340 355
356 page_unfreeze_refs(page, expected_count);
341 /* 357 /*
342 * Drop cache reference from old page. 358 * Drop cache reference from old page.
343 * We know this isn't the last reference. 359 * We know this isn't the last reference.
@@ -357,10 +373,9 @@ static int migrate_page_move_mapping(struct address_space *mapping,
357 __dec_zone_page_state(page, NR_FILE_PAGES); 373 __dec_zone_page_state(page, NR_FILE_PAGES);
358 __inc_zone_page_state(newpage, NR_FILE_PAGES); 374 __inc_zone_page_state(newpage, NR_FILE_PAGES);
359 375
360 write_unlock_irq(&mapping->tree_lock); 376 spin_unlock_irq(&mapping->tree_lock);
361 if (!PageSwapCache(newpage)) { 377 if (!PageSwapCache(newpage))
362 mem_cgroup_uncharge_cache_page(page); 378 mem_cgroup_uncharge_cache_page(page);
363 }
364 379
365 return 0; 380 return 0;
366} 381}
diff --git a/mm/nommu.c b/mm/nommu.c
index 4462b6a3fcb9..5edccd9c9218 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -22,7 +22,7 @@
22#include <linux/pagemap.h> 22#include <linux/pagemap.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/vmalloc.h> 24#include <linux/vmalloc.h>
25#include <linux/ptrace.h> 25#include <linux/tracehook.h>
26#include <linux/blkdev.h> 26#include <linux/blkdev.h>
27#include <linux/backing-dev.h> 27#include <linux/backing-dev.h>
28#include <linux/mount.h> 28#include <linux/mount.h>
@@ -745,7 +745,7 @@ static unsigned long determine_vm_flags(struct file *file,
745 * it's being traced - otherwise breakpoints set in it may interfere 745 * it's being traced - otherwise breakpoints set in it may interfere
746 * with another untraced process 746 * with another untraced process
747 */ 747 */
748 if ((flags & MAP_PRIVATE) && (current->ptrace & PT_PTRACED)) 748 if ((flags & MAP_PRIVATE) && tracehook_expect_breakpoints(current))
749 vm_flags &= ~VM_MAYSHARE; 749 vm_flags &= ~VM_MAYSHARE;
750 750
751 return vm_flags; 751 return vm_flags;
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 94c6d8988ab3..24de8b65fdbd 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1088,7 +1088,7 @@ int __set_page_dirty_nobuffers(struct page *page)
1088 if (!mapping) 1088 if (!mapping)
1089 return 1; 1089 return 1;
1090 1090
1091 write_lock_irq(&mapping->tree_lock); 1091 spin_lock_irq(&mapping->tree_lock);
1092 mapping2 = page_mapping(page); 1092 mapping2 = page_mapping(page);
1093 if (mapping2) { /* Race with truncate? */ 1093 if (mapping2) { /* Race with truncate? */
1094 BUG_ON(mapping2 != mapping); 1094 BUG_ON(mapping2 != mapping);
@@ -1102,7 +1102,7 @@ int __set_page_dirty_nobuffers(struct page *page)
1102 radix_tree_tag_set(&mapping->page_tree, 1102 radix_tree_tag_set(&mapping->page_tree,
1103 page_index(page), PAGECACHE_TAG_DIRTY); 1103 page_index(page), PAGECACHE_TAG_DIRTY);
1104 } 1104 }
1105 write_unlock_irq(&mapping->tree_lock); 1105 spin_unlock_irq(&mapping->tree_lock);
1106 if (mapping->host) { 1106 if (mapping->host) {
1107 /* !PageAnon && !swapper_space */ 1107 /* !PageAnon && !swapper_space */
1108 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); 1108 __mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
@@ -1258,7 +1258,7 @@ int test_clear_page_writeback(struct page *page)
1258 struct backing_dev_info *bdi = mapping->backing_dev_info; 1258 struct backing_dev_info *bdi = mapping->backing_dev_info;
1259 unsigned long flags; 1259 unsigned long flags;
1260 1260
1261 write_lock_irqsave(&mapping->tree_lock, flags); 1261 spin_lock_irqsave(&mapping->tree_lock, flags);
1262 ret = TestClearPageWriteback(page); 1262 ret = TestClearPageWriteback(page);
1263 if (ret) { 1263 if (ret) {
1264 radix_tree_tag_clear(&mapping->page_tree, 1264 radix_tree_tag_clear(&mapping->page_tree,
@@ -1269,7 +1269,7 @@ int test_clear_page_writeback(struct page *page)
1269 __bdi_writeout_inc(bdi); 1269 __bdi_writeout_inc(bdi);
1270 } 1270 }
1271 } 1271 }
1272 write_unlock_irqrestore(&mapping->tree_lock, flags); 1272 spin_unlock_irqrestore(&mapping->tree_lock, flags);
1273 } else { 1273 } else {
1274 ret = TestClearPageWriteback(page); 1274 ret = TestClearPageWriteback(page);
1275 } 1275 }
@@ -1287,7 +1287,7 @@ int test_set_page_writeback(struct page *page)
1287 struct backing_dev_info *bdi = mapping->backing_dev_info; 1287 struct backing_dev_info *bdi = mapping->backing_dev_info;
1288 unsigned long flags; 1288 unsigned long flags;
1289 1289
1290 write_lock_irqsave(&mapping->tree_lock, flags); 1290 spin_lock_irqsave(&mapping->tree_lock, flags);
1291 ret = TestSetPageWriteback(page); 1291 ret = TestSetPageWriteback(page);
1292 if (!ret) { 1292 if (!ret) {
1293 radix_tree_tag_set(&mapping->page_tree, 1293 radix_tree_tag_set(&mapping->page_tree,
@@ -1300,7 +1300,7 @@ int test_set_page_writeback(struct page *page)
1300 radix_tree_tag_clear(&mapping->page_tree, 1300 radix_tree_tag_clear(&mapping->page_tree,
1301 page_index(page), 1301 page_index(page),
1302 PAGECACHE_TAG_DIRTY); 1302 PAGECACHE_TAG_DIRTY);
1303 write_unlock_irqrestore(&mapping->tree_lock, flags); 1303 spin_unlock_irqrestore(&mapping->tree_lock, flags);
1304 } else { 1304 } else {
1305 ret = TestSetPageWriteback(page); 1305 ret = TestSetPageWriteback(page);
1306 } 1306 }
diff --git a/mm/readahead.c b/mm/readahead.c
index d8723a5f6496..77e8ddf945e9 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -382,9 +382,9 @@ ondemand_readahead(struct address_space *mapping,
382 if (hit_readahead_marker) { 382 if (hit_readahead_marker) {
383 pgoff_t start; 383 pgoff_t start;
384 384
385 read_lock_irq(&mapping->tree_lock); 385 rcu_read_lock();
386 start = radix_tree_next_hole(&mapping->page_tree, offset, max+1); 386 start = radix_tree_next_hole(&mapping->page_tree, offset,max+1);
387 read_unlock_irq(&mapping->tree_lock); 387 rcu_read_unlock();
388 388
389 if (!start || start - offset > max) 389 if (!start || start - offset > max)
390 return 0; 390 return 0;
diff --git a/mm/rmap.c b/mm/rmap.c
index abbd29f7c43f..39ae5a9bf382 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -138,7 +138,7 @@ void anon_vma_unlink(struct vm_area_struct *vma)
138 anon_vma_free(anon_vma); 138 anon_vma_free(anon_vma);
139} 139}
140 140
141static void anon_vma_ctor(struct kmem_cache *cachep, void *data) 141static void anon_vma_ctor(void *data)
142{ 142{
143 struct anon_vma *anon_vma = data; 143 struct anon_vma *anon_vma = data;
144 144
diff --git a/mm/shmem.c b/mm/shmem.c
index f92fea94d037..952d361774bb 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -936,7 +936,7 @@ found:
936 spin_lock(&info->lock); 936 spin_lock(&info->lock);
937 ptr = shmem_swp_entry(info, idx, NULL); 937 ptr = shmem_swp_entry(info, idx, NULL);
938 if (ptr && ptr->val == entry.val) { 938 if (ptr && ptr->val == entry.val) {
939 error = add_to_page_cache(page, inode->i_mapping, 939 error = add_to_page_cache_locked(page, inode->i_mapping,
940 idx, GFP_NOWAIT); 940 idx, GFP_NOWAIT);
941 /* does mem_cgroup_uncharge_cache_page on error */ 941 /* does mem_cgroup_uncharge_cache_page on error */
942 } else /* we must compensate for our precharge above */ 942 } else /* we must compensate for our precharge above */
@@ -1301,8 +1301,8 @@ repeat:
1301 SetPageUptodate(filepage); 1301 SetPageUptodate(filepage);
1302 set_page_dirty(filepage); 1302 set_page_dirty(filepage);
1303 swap_free(swap); 1303 swap_free(swap);
1304 } else if (!(error = add_to_page_cache( 1304 } else if (!(error = add_to_page_cache_locked(swappage, mapping,
1305 swappage, mapping, idx, GFP_NOWAIT))) { 1305 idx, GFP_NOWAIT))) {
1306 info->flags |= SHMEM_PAGEIN; 1306 info->flags |= SHMEM_PAGEIN;
1307 shmem_swp_set(info, entry, 0); 1307 shmem_swp_set(info, entry, 0);
1308 shmem_swp_unmap(entry); 1308 shmem_swp_unmap(entry);
@@ -2352,7 +2352,7 @@ static void shmem_destroy_inode(struct inode *inode)
2352 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode)); 2352 kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
2353} 2353}
2354 2354
2355static void init_once(struct kmem_cache *cachep, void *foo) 2355static void init_once(void *foo)
2356{ 2356{
2357 struct shmem_inode_info *p = (struct shmem_inode_info *) foo; 2357 struct shmem_inode_info *p = (struct shmem_inode_info *) foo;
2358 2358
diff --git a/mm/slab.c b/mm/slab.c
index 052e7d64537e..918f04f7fef1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -406,7 +406,7 @@ struct kmem_cache {
406 unsigned int dflags; /* dynamic flags */ 406 unsigned int dflags; /* dynamic flags */
407 407
408 /* constructor func */ 408 /* constructor func */
409 void (*ctor)(struct kmem_cache *, void *); 409 void (*ctor)(void *obj);
410 410
411/* 5) cache creation/removal */ 411/* 5) cache creation/removal */
412 const char *name; 412 const char *name;
@@ -2137,8 +2137,7 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
2137 */ 2137 */
2138struct kmem_cache * 2138struct kmem_cache *
2139kmem_cache_create (const char *name, size_t size, size_t align, 2139kmem_cache_create (const char *name, size_t size, size_t align,
2140 unsigned long flags, 2140 unsigned long flags, void (*ctor)(void *))
2141 void (*ctor)(struct kmem_cache *, void *))
2142{ 2141{
2143 size_t left_over, slab_size, ralign; 2142 size_t left_over, slab_size, ralign;
2144 struct kmem_cache *cachep = NULL, *pc; 2143 struct kmem_cache *cachep = NULL, *pc;
@@ -2653,7 +2652,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
2653 * They must also be threaded. 2652 * They must also be threaded.
2654 */ 2653 */
2655 if (cachep->ctor && !(cachep->flags & SLAB_POISON)) 2654 if (cachep->ctor && !(cachep->flags & SLAB_POISON))
2656 cachep->ctor(cachep, objp + obj_offset(cachep)); 2655 cachep->ctor(objp + obj_offset(cachep));
2657 2656
2658 if (cachep->flags & SLAB_RED_ZONE) { 2657 if (cachep->flags & SLAB_RED_ZONE) {
2659 if (*dbg_redzone2(cachep, objp) != RED_INACTIVE) 2658 if (*dbg_redzone2(cachep, objp) != RED_INACTIVE)
@@ -2669,7 +2668,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
2669 cachep->buffer_size / PAGE_SIZE, 0); 2668 cachep->buffer_size / PAGE_SIZE, 0);
2670#else 2669#else
2671 if (cachep->ctor) 2670 if (cachep->ctor)
2672 cachep->ctor(cachep, objp); 2671 cachep->ctor(objp);
2673#endif 2672#endif
2674 slab_bufctl(slabp)[i] = i + 1; 2673 slab_bufctl(slabp)[i] = i + 1;
2675 } 2674 }
@@ -3093,7 +3092,7 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep,
3093#endif 3092#endif
3094 objp += obj_offset(cachep); 3093 objp += obj_offset(cachep);
3095 if (cachep->ctor && cachep->flags & SLAB_POISON) 3094 if (cachep->ctor && cachep->flags & SLAB_POISON)
3096 cachep->ctor(cachep, objp); 3095 cachep->ctor(objp);
3097#if ARCH_SLAB_MINALIGN 3096#if ARCH_SLAB_MINALIGN
3098 if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) { 3097 if ((u32)objp & (ARCH_SLAB_MINALIGN-1)) {
3099 printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n", 3098 printk(KERN_ERR "0x%p: not aligned to ARCH_SLAB_MINALIGN=%d\n",
diff --git a/mm/slob.c b/mm/slob.c
index de268eb7ac70..d8fbd4d1bfa7 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -525,12 +525,11 @@ struct kmem_cache {
525 unsigned int size, align; 525 unsigned int size, align;
526 unsigned long flags; 526 unsigned long flags;
527 const char *name; 527 const char *name;
528 void (*ctor)(struct kmem_cache *, void *); 528 void (*ctor)(void *);
529}; 529};
530 530
531struct kmem_cache *kmem_cache_create(const char *name, size_t size, 531struct kmem_cache *kmem_cache_create(const char *name, size_t size,
532 size_t align, unsigned long flags, 532 size_t align, unsigned long flags, void (*ctor)(void *))
533 void (*ctor)(struct kmem_cache *, void *))
534{ 533{
535 struct kmem_cache *c; 534 struct kmem_cache *c;
536 535
@@ -575,7 +574,7 @@ void *kmem_cache_alloc_node(struct kmem_cache *c, gfp_t flags, int node)
575 b = slob_new_page(flags, get_order(c->size), node); 574 b = slob_new_page(flags, get_order(c->size), node);
576 575
577 if (c->ctor) 576 if (c->ctor)
578 c->ctor(c, b); 577 c->ctor(b);
579 578
580 return b; 579 return b;
581} 580}
diff --git a/mm/slub.c b/mm/slub.c
index 77c21cf53ff9..b7e2cd5d82db 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1012,7 +1012,7 @@ __setup("slub_debug", setup_slub_debug);
1012 1012
1013static unsigned long kmem_cache_flags(unsigned long objsize, 1013static unsigned long kmem_cache_flags(unsigned long objsize,
1014 unsigned long flags, const char *name, 1014 unsigned long flags, const char *name,
1015 void (*ctor)(struct kmem_cache *, void *)) 1015 void (*ctor)(void *))
1016{ 1016{
1017 /* 1017 /*
1018 * Enable debugging if selected on the kernel commandline. 1018 * Enable debugging if selected on the kernel commandline.
@@ -1040,7 +1040,7 @@ static inline int check_object(struct kmem_cache *s, struct page *page,
1040static inline void add_full(struct kmem_cache_node *n, struct page *page) {} 1040static inline void add_full(struct kmem_cache_node *n, struct page *page) {}
1041static inline unsigned long kmem_cache_flags(unsigned long objsize, 1041static inline unsigned long kmem_cache_flags(unsigned long objsize,
1042 unsigned long flags, const char *name, 1042 unsigned long flags, const char *name,
1043 void (*ctor)(struct kmem_cache *, void *)) 1043 void (*ctor)(void *))
1044{ 1044{
1045 return flags; 1045 return flags;
1046} 1046}
@@ -1103,7 +1103,7 @@ static void setup_object(struct kmem_cache *s, struct page *page,
1103{ 1103{
1104 setup_object_debug(s, page, object); 1104 setup_object_debug(s, page, object);
1105 if (unlikely(s->ctor)) 1105 if (unlikely(s->ctor))
1106 s->ctor(s, object); 1106 s->ctor(object);
1107} 1107}
1108 1108
1109static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node) 1109static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
@@ -2286,7 +2286,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
2286static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags, 2286static int kmem_cache_open(struct kmem_cache *s, gfp_t gfpflags,
2287 const char *name, size_t size, 2287 const char *name, size_t size,
2288 size_t align, unsigned long flags, 2288 size_t align, unsigned long flags,
2289 void (*ctor)(struct kmem_cache *, void *)) 2289 void (*ctor)(void *))
2290{ 2290{
2291 memset(s, 0, kmem_size); 2291 memset(s, 0, kmem_size);
2292 s->name = name; 2292 s->name = name;
@@ -3042,7 +3042,7 @@ static int slab_unmergeable(struct kmem_cache *s)
3042 3042
3043static struct kmem_cache *find_mergeable(size_t size, 3043static struct kmem_cache *find_mergeable(size_t size,
3044 size_t align, unsigned long flags, const char *name, 3044 size_t align, unsigned long flags, const char *name,
3045 void (*ctor)(struct kmem_cache *, void *)) 3045 void (*ctor)(void *))
3046{ 3046{
3047 struct kmem_cache *s; 3047 struct kmem_cache *s;
3048 3048
@@ -3082,8 +3082,7 @@ static struct kmem_cache *find_mergeable(size_t size,
3082} 3082}
3083 3083
3084struct kmem_cache *kmem_cache_create(const char *name, size_t size, 3084struct kmem_cache *kmem_cache_create(const char *name, size_t size,
3085 size_t align, unsigned long flags, 3085 size_t align, unsigned long flags, void (*ctor)(void *))
3086 void (*ctor)(struct kmem_cache *, void *))
3087{ 3086{
3088 struct kmem_cache *s; 3087 struct kmem_cache *s;
3089 3088
diff --git a/mm/sparse.c b/mm/sparse.c
index 8ffc08990008..5d9dbbb9d39e 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -377,7 +377,7 @@ struct page __init *sparse_mem_map_populate(unsigned long pnum, int nid)
377} 377}
378#endif /* !CONFIG_SPARSEMEM_VMEMMAP */ 378#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
379 379
380struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) 380static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
381{ 381{
382 struct page *map; 382 struct page *map;
383 struct mem_section *ms = __nr_to_section(pnum); 383 struct mem_section *ms = __nr_to_section(pnum);
diff --git a/mm/swap_state.c b/mm/swap_state.c
index d8aadaf2a0ba..b8035b055129 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -39,7 +39,7 @@ static struct backing_dev_info swap_backing_dev_info = {
39 39
40struct address_space swapper_space = { 40struct address_space swapper_space = {
41 .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), 41 .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN),
42 .tree_lock = __RW_LOCK_UNLOCKED(swapper_space.tree_lock), 42 .tree_lock = __SPIN_LOCK_UNLOCKED(swapper_space.tree_lock),
43 .a_ops = &swap_aops, 43 .a_ops = &swap_aops,
44 .i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear), 44 .i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear),
45 .backing_dev_info = &swap_backing_dev_info, 45 .backing_dev_info = &swap_backing_dev_info,
@@ -56,7 +56,8 @@ static struct {
56 56
57void show_swap_cache_info(void) 57void show_swap_cache_info(void)
58{ 58{
59 printk("Swap cache: add %lu, delete %lu, find %lu/%lu\n", 59 printk("%lu pages in swap cache\n", total_swapcache_pages);
60 printk("Swap cache stats: add %lu, delete %lu, find %lu/%lu\n",
60 swap_cache_info.add_total, swap_cache_info.del_total, 61 swap_cache_info.add_total, swap_cache_info.del_total,
61 swap_cache_info.find_success, swap_cache_info.find_total); 62 swap_cache_info.find_success, swap_cache_info.find_total);
62 printk("Free swap = %lukB\n", nr_swap_pages << (PAGE_SHIFT - 10)); 63 printk("Free swap = %lukB\n", nr_swap_pages << (PAGE_SHIFT - 10));
@@ -64,7 +65,7 @@ void show_swap_cache_info(void)
64} 65}
65 66
66/* 67/*
67 * add_to_swap_cache resembles add_to_page_cache on swapper_space, 68 * add_to_swap_cache resembles add_to_page_cache_locked on swapper_space,
68 * but sets SwapCache flag and private instead of mapping and index. 69 * but sets SwapCache flag and private instead of mapping and index.
69 */ 70 */
70int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask) 71int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
@@ -76,19 +77,26 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry, gfp_t gfp_mask)
76 BUG_ON(PagePrivate(page)); 77 BUG_ON(PagePrivate(page));
77 error = radix_tree_preload(gfp_mask); 78 error = radix_tree_preload(gfp_mask);
78 if (!error) { 79 if (!error) {
79 write_lock_irq(&swapper_space.tree_lock); 80 page_cache_get(page);
81 SetPageSwapCache(page);
82 set_page_private(page, entry.val);
83
84 spin_lock_irq(&swapper_space.tree_lock);
80 error = radix_tree_insert(&swapper_space.page_tree, 85 error = radix_tree_insert(&swapper_space.page_tree,
81 entry.val, page); 86 entry.val, page);
82 if (!error) { 87 if (likely(!error)) {
83 page_cache_get(page);
84 SetPageSwapCache(page);
85 set_page_private(page, entry.val);
86 total_swapcache_pages++; 88 total_swapcache_pages++;
87 __inc_zone_page_state(page, NR_FILE_PAGES); 89 __inc_zone_page_state(page, NR_FILE_PAGES);
88 INC_CACHE_INFO(add_total); 90 INC_CACHE_INFO(add_total);
89 } 91 }
90 write_unlock_irq(&swapper_space.tree_lock); 92 spin_unlock_irq(&swapper_space.tree_lock);
91 radix_tree_preload_end(); 93 radix_tree_preload_end();
94
95 if (unlikely(error)) {
96 set_page_private(page, 0UL);
97 ClearPageSwapCache(page);
98 page_cache_release(page);
99 }
92 } 100 }
93 return error; 101 return error;
94} 102}
@@ -175,9 +183,9 @@ void delete_from_swap_cache(struct page *page)
175 183
176 entry.val = page_private(page); 184 entry.val = page_private(page);
177 185
178 write_lock_irq(&swapper_space.tree_lock); 186 spin_lock_irq(&swapper_space.tree_lock);
179 __delete_from_swap_cache(page); 187 __delete_from_swap_cache(page);
180 write_unlock_irq(&swapper_space.tree_lock); 188 spin_unlock_irq(&swapper_space.tree_lock);
181 189
182 swap_free(entry); 190 swap_free(entry);
183 page_cache_release(page); 191 page_cache_release(page);
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 2f33edb8bee9..6beb6251e99d 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -33,8 +33,8 @@
33#include <asm/tlbflush.h> 33#include <asm/tlbflush.h>
34#include <linux/swapops.h> 34#include <linux/swapops.h>
35 35
36DEFINE_SPINLOCK(swap_lock); 36static DEFINE_SPINLOCK(swap_lock);
37unsigned int nr_swapfiles; 37static unsigned int nr_swapfiles;
38long total_swap_pages; 38long total_swap_pages;
39static int swap_overflow; 39static int swap_overflow;
40static int least_priority; 40static int least_priority;
@@ -44,7 +44,7 @@ static const char Unused_file[] = "Unused swap file entry ";
44static const char Bad_offset[] = "Bad swap offset entry "; 44static const char Bad_offset[] = "Bad swap offset entry ";
45static const char Unused_offset[] = "Unused swap offset entry "; 45static const char Unused_offset[] = "Unused swap offset entry ";
46 46
47struct swap_list_t swap_list = {-1, -1}; 47static struct swap_list_t swap_list = {-1, -1};
48 48
49static struct swap_info_struct swap_info[MAX_SWAPFILES]; 49static struct swap_info_struct swap_info[MAX_SWAPFILES];
50 50
@@ -369,13 +369,13 @@ int remove_exclusive_swap_page(struct page *page)
369 retval = 0; 369 retval = 0;
370 if (p->swap_map[swp_offset(entry)] == 1) { 370 if (p->swap_map[swp_offset(entry)] == 1) {
371 /* Recheck the page count with the swapcache lock held.. */ 371 /* Recheck the page count with the swapcache lock held.. */
372 write_lock_irq(&swapper_space.tree_lock); 372 spin_lock_irq(&swapper_space.tree_lock);
373 if ((page_count(page) == 2) && !PageWriteback(page)) { 373 if ((page_count(page) == 2) && !PageWriteback(page)) {
374 __delete_from_swap_cache(page); 374 __delete_from_swap_cache(page);
375 SetPageDirty(page); 375 SetPageDirty(page);
376 retval = 1; 376 retval = 1;
377 } 377 }
378 write_unlock_irq(&swapper_space.tree_lock); 378 spin_unlock_irq(&swapper_space.tree_lock);
379 } 379 }
380 spin_unlock(&swap_lock); 380 spin_unlock(&swap_lock);
381 381
diff --git a/mm/truncate.c b/mm/truncate.c
index b8961cb63414..e68443d74567 100644
--- a/mm/truncate.c
+++ b/mm/truncate.c
@@ -349,18 +349,18 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
349 if (PagePrivate(page) && !try_to_release_page(page, GFP_KERNEL)) 349 if (PagePrivate(page) && !try_to_release_page(page, GFP_KERNEL))
350 return 0; 350 return 0;
351 351
352 write_lock_irq(&mapping->tree_lock); 352 spin_lock_irq(&mapping->tree_lock);
353 if (PageDirty(page)) 353 if (PageDirty(page))
354 goto failed; 354 goto failed;
355 355
356 BUG_ON(PagePrivate(page)); 356 BUG_ON(PagePrivate(page));
357 __remove_from_page_cache(page); 357 __remove_from_page_cache(page);
358 write_unlock_irq(&mapping->tree_lock); 358 spin_unlock_irq(&mapping->tree_lock);
359 ClearPageUptodate(page); 359 ClearPageUptodate(page);
360 page_cache_release(page); /* pagecache ref */ 360 page_cache_release(page); /* pagecache ref */
361 return 1; 361 return 1;
362failed: 362failed:
363 write_unlock_irq(&mapping->tree_lock); 363 spin_unlock_irq(&mapping->tree_lock);
364 return 0; 364 return 0;
365} 365}
366 366
diff --git a/mm/util.c b/mm/util.c
index 8f18683825bc..0efd83097ecf 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -1,3 +1,4 @@
1#include <linux/mm.h>
1#include <linux/slab.h> 2#include <linux/slab.h>
2#include <linux/string.h> 3#include <linux/string.h>
3#include <linux/module.h> 4#include <linux/module.h>
@@ -136,3 +137,12 @@ char *strndup_user(const char __user *s, long n)
136 return p; 137 return p;
137} 138}
138EXPORT_SYMBOL(strndup_user); 139EXPORT_SYMBOL(strndup_user);
140
141#ifndef HAVE_ARCH_PICK_MMAP_LAYOUT
142void arch_pick_mmap_layout(struct mm_struct *mm)
143{
144 mm->mmap_base = TASK_UNMAPPED_BASE;
145 mm->get_unmapped_area = arch_get_unmapped_area;
146 mm->unmap_area = arch_unmap_area;
147}
148#endif
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 35f293816294..85b9a0d2c877 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -381,16 +381,14 @@ static void __vunmap(const void *addr, int deallocate_pages)
381 return; 381 return;
382 382
383 if ((PAGE_SIZE-1) & (unsigned long)addr) { 383 if ((PAGE_SIZE-1) & (unsigned long)addr) {
384 printk(KERN_ERR "Trying to vfree() bad address (%p)\n", addr); 384 WARN(1, KERN_ERR "Trying to vfree() bad address (%p)\n", addr);
385 WARN_ON(1);
386 return; 385 return;
387 } 386 }
388 387
389 area = remove_vm_area(addr); 388 area = remove_vm_area(addr);
390 if (unlikely(!area)) { 389 if (unlikely(!area)) {
391 printk(KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n", 390 WARN(1, KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n",
392 addr); 391 addr);
393 WARN_ON(1);
394 return; 392 return;
395 } 393 }
396 394
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 26672c6cd3ce..8f71761bc4b7 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -391,17 +391,15 @@ static pageout_t pageout(struct page *page, struct address_space *mapping,
391} 391}
392 392
393/* 393/*
394 * Attempt to detach a locked page from its ->mapping. If it is dirty or if 394 * Same as remove_mapping, but if the page is removed from the mapping, it
395 * someone else has a ref on the page, abort and return 0. If it was 395 * gets returned with a refcount of 0.
396 * successfully detached, return 1. Assumes the caller has a single ref on
397 * this page.
398 */ 396 */
399int remove_mapping(struct address_space *mapping, struct page *page) 397static int __remove_mapping(struct address_space *mapping, struct page *page)
400{ 398{
401 BUG_ON(!PageLocked(page)); 399 BUG_ON(!PageLocked(page));
402 BUG_ON(mapping != page_mapping(page)); 400 BUG_ON(mapping != page_mapping(page));
403 401
404 write_lock_irq(&mapping->tree_lock); 402 spin_lock_irq(&mapping->tree_lock);
405 /* 403 /*
406 * The non racy check for a busy page. 404 * The non racy check for a busy page.
407 * 405 *
@@ -427,28 +425,48 @@ int remove_mapping(struct address_space *mapping, struct page *page)
427 * Note that if SetPageDirty is always performed via set_page_dirty, 425 * Note that if SetPageDirty is always performed via set_page_dirty,
428 * and thus under tree_lock, then this ordering is not required. 426 * and thus under tree_lock, then this ordering is not required.
429 */ 427 */
430 if (unlikely(page_count(page) != 2)) 428 if (!page_freeze_refs(page, 2))
431 goto cannot_free; 429 goto cannot_free;
432 smp_rmb(); 430 /* note: atomic_cmpxchg in page_freeze_refs provides the smp_rmb */
433 if (unlikely(PageDirty(page))) 431 if (unlikely(PageDirty(page))) {
432 page_unfreeze_refs(page, 2);
434 goto cannot_free; 433 goto cannot_free;
434 }
435 435
436 if (PageSwapCache(page)) { 436 if (PageSwapCache(page)) {
437 swp_entry_t swap = { .val = page_private(page) }; 437 swp_entry_t swap = { .val = page_private(page) };
438 __delete_from_swap_cache(page); 438 __delete_from_swap_cache(page);
439 write_unlock_irq(&mapping->tree_lock); 439 spin_unlock_irq(&mapping->tree_lock);
440 swap_free(swap); 440 swap_free(swap);
441 __put_page(page); /* The pagecache ref */ 441 } else {
442 return 1; 442 __remove_from_page_cache(page);
443 spin_unlock_irq(&mapping->tree_lock);
443 } 444 }
444 445
445 __remove_from_page_cache(page);
446 write_unlock_irq(&mapping->tree_lock);
447 __put_page(page);
448 return 1; 446 return 1;
449 447
450cannot_free: 448cannot_free:
451 write_unlock_irq(&mapping->tree_lock); 449 spin_unlock_irq(&mapping->tree_lock);
450 return 0;
451}
452
453/*
454 * Attempt to detach a locked page from its ->mapping. If it is dirty or if
455 * someone else has a ref on the page, abort and return 0. If it was
456 * successfully detached, return 1. Assumes the caller has a single ref on
457 * this page.
458 */
459int remove_mapping(struct address_space *mapping, struct page *page)
460{
461 if (__remove_mapping(mapping, page)) {
462 /*
463 * Unfreezing the refcount with 1 rather than 2 effectively
464 * drops the pagecache ref for us without requiring another
465 * atomic operation.
466 */
467 page_unfreeze_refs(page, 1);
468 return 1;
469 }
452 return 0; 470 return 0;
453} 471}
454 472
@@ -598,18 +616,34 @@ static unsigned long shrink_page_list(struct list_head *page_list,
598 if (PagePrivate(page)) { 616 if (PagePrivate(page)) {
599 if (!try_to_release_page(page, sc->gfp_mask)) 617 if (!try_to_release_page(page, sc->gfp_mask))
600 goto activate_locked; 618 goto activate_locked;
601 if (!mapping && page_count(page) == 1) 619 if (!mapping && page_count(page) == 1) {
602 goto free_it; 620 unlock_page(page);
621 if (put_page_testzero(page))
622 goto free_it;
623 else {
624 /*
625 * rare race with speculative reference.
626 * the speculative reference will free
627 * this page shortly, so we may
628 * increment nr_reclaimed here (and
629 * leave it off the LRU).
630 */
631 nr_reclaimed++;
632 continue;
633 }
634 }
603 } 635 }
604 636
605 if (!mapping || !remove_mapping(mapping, page)) 637 if (!mapping || !__remove_mapping(mapping, page))
606 goto keep_locked; 638 goto keep_locked;
607 639
608free_it:
609 unlock_page(page); 640 unlock_page(page);
641free_it:
610 nr_reclaimed++; 642 nr_reclaimed++;
611 if (!pagevec_add(&freed_pvec, page)) 643 if (!pagevec_add(&freed_pvec, page)) {
612 __pagevec_release_nonlru(&freed_pvec); 644 __pagevec_free(&freed_pvec);
645 pagevec_reinit(&freed_pvec);
646 }
613 continue; 647 continue;
614 648
615activate_locked: 649activate_locked:
@@ -623,7 +657,7 @@ keep:
623 } 657 }
624 list_splice(&ret_pages, page_list); 658 list_splice(&ret_pages, page_list);
625 if (pagevec_count(&freed_pvec)) 659 if (pagevec_count(&freed_pvec))
626 __pagevec_release_nonlru(&freed_pvec); 660 __pagevec_free(&freed_pvec);
627 count_vm_events(PGACTIVATE, pgactivate); 661 count_vm_events(PGACTIVATE, pgactivate);
628 return nr_reclaimed; 662 return nr_reclaimed;
629} 663}
diff --git a/net/socket.c b/net/socket.c
index 1310a82cbba7..8ef8ba81b9e2 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -265,7 +265,7 @@ static void sock_destroy_inode(struct inode *inode)
265 container_of(inode, struct socket_alloc, vfs_inode)); 265 container_of(inode, struct socket_alloc, vfs_inode));
266} 266}
267 267
268static void init_once(struct kmem_cache *cachep, void *foo) 268static void init_once(void *foo)
269{ 269{
270 struct socket_alloc *ei = (struct socket_alloc *)foo; 270 struct socket_alloc *ei = (struct socket_alloc *)foo;
271 271
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 5a9b0e7828cd..23a2b8f6dc49 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -897,7 +897,7 @@ static struct file_system_type rpc_pipe_fs_type = {
897}; 897};
898 898
899static void 899static void
900init_once(struct kmem_cache * cachep, void *foo) 900init_once(void *foo)
901{ 901{
902 struct rpc_inode *rpci = (struct rpc_inode *) foo; 902 struct rpc_inode *rpci = (struct rpc_inode *) foo;
903 903
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index a19b22b452a3..84d328329d98 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -169,7 +169,8 @@ static int send_write(struct svcxprt_rdma *xprt, struct svc_rqst *rqstp,
169 (void *) 169 (void *)
170 vec->sge[xdr_sge_no].iov_base + sge_off, 170 vec->sge[xdr_sge_no].iov_base + sge_off,
171 sge_bytes, DMA_TO_DEVICE); 171 sge_bytes, DMA_TO_DEVICE);
172 if (dma_mapping_error(sge[sge_no].addr)) 172 if (dma_mapping_error(xprt->sc_cm_id->device->dma_device,
173 sge[sge_no].addr))
173 goto err; 174 goto err;
174 sge_off = 0; 175 sge_off = 0;
175 sge_no++; 176 sge_no++;
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 63f131fc42e4..3481cde5bf15 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -25,7 +25,7 @@
25 25
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/ptrace.h> 28#include <linux/tracehook.h>
29#include <linux/errno.h> 29#include <linux/errno.h>
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <linux/security.h> 31#include <linux/security.h>
@@ -1971,22 +1971,6 @@ static int selinux_vm_enough_memory(struct mm_struct *mm, long pages)
1971 return __vm_enough_memory(mm, pages, cap_sys_admin); 1971 return __vm_enough_memory(mm, pages, cap_sys_admin);
1972} 1972}
1973 1973
1974/**
1975 * task_tracer_task - return the task that is tracing the given task
1976 * @task: task to consider
1977 *
1978 * Returns NULL if noone is tracing @task, or the &struct task_struct
1979 * pointer to its tracer.
1980 *
1981 * Must be called under rcu_read_lock().
1982 */
1983static struct task_struct *task_tracer_task(struct task_struct *task)
1984{
1985 if (task->ptrace & PT_PTRACED)
1986 return rcu_dereference(task->parent);
1987 return NULL;
1988}
1989
1990/* binprm security operations */ 1974/* binprm security operations */
1991 1975
1992static int selinux_bprm_alloc_security(struct linux_binprm *bprm) 1976static int selinux_bprm_alloc_security(struct linux_binprm *bprm)
@@ -2238,7 +2222,7 @@ static void selinux_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
2238 u32 ptsid = 0; 2222 u32 ptsid = 0;
2239 2223
2240 rcu_read_lock(); 2224 rcu_read_lock();
2241 tracer = task_tracer_task(current); 2225 tracer = tracehook_tracer_task(current);
2242 if (likely(tracer != NULL)) { 2226 if (likely(tracer != NULL)) {
2243 sec = tracer->security; 2227 sec = tracer->security;
2244 ptsid = sec->sid; 2228 ptsid = sec->sid;
@@ -5247,7 +5231,7 @@ static int selinux_setprocattr(struct task_struct *p,
5247 Otherwise, leave SID unchanged and fail. */ 5231 Otherwise, leave SID unchanged and fail. */
5248 task_lock(p); 5232 task_lock(p);
5249 rcu_read_lock(); 5233 rcu_read_lock();
5250 tracer = task_tracer_task(p); 5234 tracer = tracehook_tracer_task(p);
5251 if (tracer != NULL) { 5235 if (tracer != NULL) {
5252 struct task_security_struct *ptsec = tracer->security; 5236 struct task_security_struct *ptsec = tracer->security;
5253 u32 ptsid = ptsec->sid; 5237 u32 ptsid = ptsec->sid;